0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
Commit Graph

3227 Commits

Author SHA1 Message Date
Puru Vijay
db2d07f236
feat(site-2): Update links, move blog out of SK folder to content (#8289)
* Update links

* Move blog to site/content

* Update site/content/docs/02-component-format.md

* Fix docs links

* Add global prettierrc

* Auto format

* Fix git merge artifact

* Fix errors

* Update html to svelte(remaining ones)

* Add 2 blog posts

* Modify prettierrc

* Minor design fix

* Switch package lock to spaces, prettier ignore

* Regenerate package lock

* prettier format

* Update deps

* Hack the build into working

* add missing blog post

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>
2023-04-02 11:24:33 -04:00
Michael Leahy
d42ca041dd
Closes #5876. Adds single value function support to media queries and media query range syntax / MQ level 4 support. (#8430) 2023-03-30 23:48:10 +02:00
Yuichiro Yamashita
5a934e9f43
fix: escape <textarea value={...}> attribute properly (#8434) 2023-03-30 13:03:00 -04:00
Filip Ambrosius
1333be0c6a
fix: Regression itemscope as boolean_attribute (#8414)
Microdata are a strange set of attributes which are ONLY defined in markup, and have no relationship to the underlying Document Object Model node. As such programmatically defining an element and setting a property on it with a given Microdata attribute will not work:
https://codepen.io/iambrosius/full/jOvXBBG

One can read more about microdata here: https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata

The fix is to remove itemscope being a boolean attribute, because that opts into a transformation as a DOM property, which is wrong.
2023-03-27 11:02:12 +02:00
Nguyen Tran
dadd6fe945
fix: resolve computed_prop_# collision (#8418)
Fixes #8417

The issue is that unpack_destructuring in each blocks, await blocks, and @const tags were making computed_props independently. This causes computed_props_# to conflict when each blocks were used with @const tags, or await blocks and @const tags, or consecutive @const tags together. Therefore, one solution is to use component.get_unique_name to, well, make unique names and never get conflicts.
2023-03-27 10:15:39 +02:00
esthe
95c46552fe
feat: make preserveComments effective in DOM renderer (#7182) 2023-03-27 10:12:44 +02:00
Michael Leahy
91e8dfcd6d
feat: container query support via css-tree extension (#8275)
Closes #6969

As discussed there, container query support is quite useful to add to Svelte as it is now broadly available with Firefox releasing support imminently w/ FF v110 this upcoming week (~Feb 14th). Chrome has had support since ~Aug '22. The central issue is that css-tree which is a dependency for CSS AST parsing is significantly lagging behind on adding more recent features such as container query support. Ample time has been given to the maintainer to update css-tree and I do have every confidence that in time css-tree will receive a new major version with all sorts of modern CSS syntax supported including container queries. This PR provides an interim solution for what Svelte needs to support container queries now.
2023-03-27 10:07:39 +02:00
Snaipe
d49b568019
fix: allow use of document root as target in typescript (#7554)
It is not possible to use typescript when using `target: document`
during component initialization, because target can only be of type
Element or ShadowRoot. This means that it is not possible to hydrate
the entire document when managing the <html> element as a Svelte
component.

This commit fixes this by allowing documents to be targets.
2023-03-27 10:05:04 +02:00
Yuichiro Yamashita
a2170f5bd5
fix: use wholeText for only contenteditable for set_data (#8394)
- split logic up into "is this a contenteditable element" and depending on the outcome use either .wholeText or .data to check if an update is necessary
- add to puppeteer because jsdom does not support contenteditable
- one test is skipped it because it fails right now but helps test #5018

---------

Co-authored-by: suxin2017 <1107178482@qq.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-03-21 14:30:25 +01:00
Simon H
6ce6f14755
fix: relax a11y-no-noninteractive-element-to-interactive-role warning (#8402)
#8167 introduced the strict version of it - until this is configurable, we should use the relaxed version instead, since many a11y docs actually advise using ul/ol etc
2023-03-21 10:51:05 +01:00
Nguyen Tran
fed93ab9e1
feat: add a11y interactive-supports-focus (#8392)
#820
2023-03-20 13:18:54 +01:00
Dave Lunny
f56fe33931
feat: bind:innerText for contenteditable (#4291)
closes #3311

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-03-16 10:58:49 +01:00
Simon H
68e492eaff
fix: revert buggy reactive vars optimization (#8382)
Reverts #7942
Fixes #8374
2023-03-15 18:05:50 +01:00
Nguyen Tran
a1e8421368
fix: object destructuring picks up computed properties (#8386)
fixes #6609. Prior related PR: #8357
2023-03-15 17:10:40 +01:00
Henrik Giesel
4b0b471ee1
feat: add back <svelte:document> (#7149)
Closes #3310

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-03-15 16:38:03 +01:00
Ben McCann
c19d0889c5
chore: rename variable to follow coding style (#8385) 2023-03-15 16:31:25 +01:00
Bob Fanger
6aee49bad3
feat: css units in fly & blur transitions (#7623)
Closes #6050

---------

Co-authored-by: Bob Fanger <b.fanger@wearetriple.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
2023-03-15 12:40:49 +01:00
Bob Fanger
fb5f281e9a
fix: Prevent intro from cancelling outro (#7300)
The issue

1. When the block.i (intro) is called it registers a callback (via add_render_callback)
2. Then the block.o (outro) is called and start the outro and adds a callback to detach on outroend
3. The render callback from the intro is executed, starts the intro and cancels the outro animation

This causes components that should've been destroyed to stay on the page.

The fix in this PR: Inside the intro render callback it checks if it is still current and if it isn't (because an outro was triggered) it won't start the intro animation.

fixes #6152
fixes #6812
2023-03-14 15:33:52 +01:00
gtmnayan
7578af3a11
fix: retain style directive value after style attribute is updated (#7610)
fixes #7475
2023-03-14 11:58:04 +01:00
Nguyen Tran
a6c329f489
fix: object destructring picks up literal properties (#8357)
Part of #6609
2023-03-14 10:52:51 +01:00
Nguyen Tran
26c38e750c
feat: add a11y no-noninteractive-element-to-interactive-role (#8167)
Part of #820
2023-03-14 10:51:40 +01:00
Jon Rouleau
127b61a465
fix: derived store restarting when unsubscribed from another store with a shared ancestor (#8368)
Fixes #8364

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-03-14 10:46:49 +01:00
Tan Li Hau
c99dd2e045
fix: binding group with if block (#8373)
Fixes #8372

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-03-14 10:17:50 +01:00
Theodore Brown
c7dcfac883
fix: select option with selected attribute when initial state is undefined (#8371)
Resolves a second unintended regression introduced in #6170.

Follow-up to #8331, this time addressing the root issue so the correct select option won't be deselected in the first place when the initial bound value is undefined.

Fixes #8361
2023-03-13 18:21:51 +01:00
Lyu, Wei-Da
5c14bc5f01
fix: support es2022 class features (#8355)
Follow up to #8349. We also have to bump the parsing ECMAScript version here. Fixes #6900, fixes #6592.
2023-03-10 09:47:30 +01:00
Conduitry
80e6e28204
chore: mark Promise.resolve() as pure to appease Agadoo (#8366) 2023-03-09 11:04:38 +01:00
Ben McCann
f9efb4d992
chore: upgrade aria-query (#8353) 2023-03-08 12:56:24 -05:00
Ben McCann
b336b16204
chore: upgrade to code-red 1.0 (#8349) 2023-03-04 15:18:25 +08:00
Ben McCann
5b2fa1f247
chore: upgrade magic-string (#8339)
- overwrite -> update
- update comments
2023-03-02 20:10:12 +01:00
Tan Li Hau
0966d1d282
feat: improve bind:group behavior (#7892)
track all `#each` variables that could result in a change to the inputs and also update the `$$binding_groups` variable which holds the references to the inputs of each group accordingly.

Fixes #7633
Fixes #6112
Fixes #7884
2023-03-02 19:57:38 +01:00
Tan Li Hau
d525901556
fix validation for global compound selector (#8344) 2023-03-02 09:24:33 +01:00
Tan Li Hau
fbaf3cfc12
fix: call <svelte:component> update to this only when it's dirty (#4192)
Closes #4129

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-03-01 17:28:37 +01:00
Dane David
c0bc86e214
feat: support exclusively special characters in component filenames (#7664)
Fixes #7143

---------

Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com>
Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
2023-03-01 14:45:50 +01:00
Brad Dougherty
dd371f58fe
feat: add readyState binding for media elements (#6843)
Closes #6666

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-03-01 11:54:00 +01:00
Tan Li Hau
c611f318d2
feat: add stopImmediatePropagation event modifier (#8341)
Closes #5085

---------

Co-authored-by: Marcin Wicha <23581770+marcin-wicha@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-03-01 11:51:40 +01:00
Roy Choo
acbf8135a8
fix: add global compound selector validation (#6322)
fixes #6272
prevents invalid CSS output

---------

Co-authored-by: Roy Choo <roy.choo@bytedance.com>
Co-authored-by: tanhauhau <lhtan93@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-03-01 11:28:59 +01:00
Nguyen Tran
ed575cc927
fix: make svelte-ignore work above components (#8338)
Fixes #8082, where svelte-ignore somehow does not pick up the reactive-component warning.

The issue on this problem is that the map_children function suppresses warnings and errors while traversing AST nodes as src/compiler/compile/nodes classes. However, the reactive-component warning is called in src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts, and its warnings are not suppressed in map_children. Thus, we need to extract ignores and suppress here separately.
2023-03-01 11:06:15 +01:00
xxkl1
f34abc5689
fix: decode html entities correctly (#8047)
fixes #8026

1. replace the big entities list with entities that have a ; at the end where valid (there are some exceptions)
2. construct two regexes from that entities list: one for HTML where it's strictly matched, one for attributes where it tries to match browser behavior by also allowing = / digit / character afterwards
3. decode character references with one of these regexes depending on this is an attribute value or not

---------

Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
2023-02-28 18:21:39 +01:00
lidlanca
aa15a64cbe
fix: account for <template> tag in {@html} (#7364)
Ensure innerHTML for template is done on template element
fixes #7315
fixes #7319

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-02-28 18:16:55 +01:00
Simon H
60db05da86
fix: hide some a11y warnings for <svelte:element> tags (#8335)
Some a11y warnings only work on specific tags, which results in potential false positives for `<svelte:element>` tags - silence those
closes #7939
2023-03-01 00:01:40 +08:00
Tan Li Hau
f6dc86f02c
feat: optimise svelte-element output code for static tag and static attribute (#8161)
* feat: optimise svelte-element output code for static tag and static attribute

* Update src/compiler/compile/render_dom/wrappers/Element/index.ts

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* Update src/runtime/internal/dom.ts

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* Update src/compiler/compile/render_dom/wrappers/Element/index.ts

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* fix logic

* fix pipeline errors

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-02-28 23:57:45 +08:00
Theodor Steiner
c7bbe55b9f
feat: introduce axis parameter to allow for horizontal slide transition (#6183)
---------

Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com>
2023-02-27 17:58:23 +01:00
Cory Virok
32a94fcfc5
chore: implemented a small runtime optimization for SSR (#7539)
Prior to this change, the compiler would generate a template literal that had many purely static
string variables nested within it. This change collapses these static strings into the surrounding
template literal which should result in (minor) size and performance improvements for the SSR
generated code.

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-02-27 16:32:45 +01:00
David Hunt
4e8efd3c1e
fix: fixes sveltejs/svelte#8214 bind:group to undefined (#8215)
* fixes sveltejs/svelte#8214 bind:group to undefined

* fix code and add test

---------

Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
2023-02-27 22:02:34 +08:00
Vaibhav Rai
26104eaaba
fix: no error assigning to a const property (#7966)
Fixes #7964
currently for a case where the parent type is ArrayPattern code needs to check if the elements are of direct type MemberExpression or Identifier, in the case of MemberExpression there will be an Identifier check for the Object of the MemberExpression.

---------

Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
2023-02-27 13:45:14 +01:00
4eb0da
9edd2df0d3
fix: check each_blocks is empty on mount (#7505)
fixes #8282
2023-02-27 13:36:57 +01:00
Nico Beierle
474a13ad90
fix: prevent undefined value when remount keyed input element with spread props (#7699)
Fixes: #7578

When remounting a keyed input element (e.g. because the element order has changed) with spread properties, the input value gets undefined. This has happened because data_value is updated before remounting and it won't contain a value for input-value (because the value hasn't changed). When calling mount() an undefined value was assigned because of a missing check.
2023-02-27 13:25:24 +01:00
Theodore Brown
8cf037c904
fix: select first enabled option by default when initial value is undefined (#8331)
Fixes an unintended regression introduced in #6170.

Fixes #7041
2023-02-27 13:11:06 +01:00
adiGuba
69c199feac
fix: race condition in svelte:element with transition #7948 (#7949)
fixes #7948
- The assignment of the variable "previous_tag" was incorrectly positioned and could cause race condition when used with transitions.
- We need another variable to detect when we are in a transition to remove a node

---------

Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
2023-02-27 13:10:22 +01:00
Yuichiro Yamashita
60a205edb8
fix: don't set selected option(s) if value is unbound or not passed (#8329)
fix: #5644

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-02-27 13:00:35 +01:00