- Previously, any each block parents where used as keys for the sub group. That's wrong, it should only be using each blocks whos declarations contribute to the `bind:group` expression. Fixes#10345
- Only the left-most identifier of the expression was used to determine the binding group. This is wrong, all identifiers within the expression need to be taken into account. Fixes#9947
* fix: don't reuse proxies when state symbol refers to stale value
When somebody copies over the state symbol property onto a new object (you can retrieve the symbol by using `Reflect.ownKeys(...)`), it was wrongfully assumed that it always relates to the current value. This PR adds an additional check that this is actually the case.
This also adds a dev time warning when an object is frozen but contains a state property, which hints at a bug in user land.
fixes#10316
* lint
* rename
* remove warning
* update test
* changeset
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* strip typescript assertions before analysis
* add test
* changeset
* move ts handling from transform to before analysis
* format
* types
* remove unwrap_ts_expression
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
* fix: improve unstate handling of non enumerable properties
* Update packages/svelte/src/internal/client/proxy.js
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* give this another try
* fix: lint
* fix: Forgot to save
* feat: it works boiiii
* look, ok, it did work, i just needed to update the snapshots
* bruh
* changeset
* feat: ok I think the client snippet block finally works
* feat: current tests pass; I'm sure I'm missing stuff for new things
* fix: snapshot
* feat: I think non-destructured rest should work now?
* chore: duplicated computation
* feat: Tests (passing and failing
* feat: it's... alive?
* chore: Clean up my messes
* chore: devtime stuff
* fix: fmt
* chore: see if this fixes repl
* chore: make naming more offensive
* fix: Don't throw on missing keys, return undefined as it usually would
* Update packages/svelte/src/compiler/phases/1-parse/state/tag.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/src/compiler/phases/1-parse/state/tag.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: Hopefully default param values now work
* dumb
* types
* feat: Test it
* fix: Turns out javascript parameters are optional
* feat: The Final Solution
* document function
* feat: Better bracket matching, unit tests
* feat: exclude test files from publish
* feat: More unit tests
* feat: Use more efficient parsing for @const
* Update .changeset/curvy-cups-cough.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/package.json
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/src/compiler/phases/1-parse/utils/bracket.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: changesets
* chore: additional comments
* fix: kill foreach
* fix: foreach again
* feat: Docs
* Revert "fix: kill foreach"
This reverts commit 9a688cc543.
* fix: My own stupidity
* fix: style
* fix - maybe
* Update sites/svelte-5-preview/src/routes/docs/content/01-api/03-snippets.md
* Update tag.js
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* Update .changeset/curvy-cups-cough.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* chore: Remove rest params
* Delete .changeset/eighty-rivers-wash.md
* fix: Honestly idk why it was broken but it's fixed now
* fix: var name lol
* fix: typegen
* fix: idk
* fix: It looks like a bunch of unformatted shit came in through main?? idk
* Revert "fix: It looks like a bunch of unformatted shit came in through main?? idk"
This reverts commit ab851d5627.
* fix: format again
* this is getting ridiculous
* Update tag.js
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* fix errors
* simplify a bit
* use read_context
* use read_context for const as well
* remove unused code
* unused import
* unused export
* remove spread args. sorry elliott
* tidy up SnippetBlock interface
* fix test
* simplify
* tweak
* revert example, so that it matches the surrounding text
* move PropsWithChildren back to public.d.ts
* update typing docs, so that it flows from previous example
* temporarily revert const parsing changes, to get prettier working again (???)
* oops
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
If you had `on:` directives listening to the same name (through multiple on:click on the same element or indirectly through multiple `<svelte:window>` elements with event listeners of the same name) there was a bug of delegation firing too often. This PR fixes that by tweaking the "should I continue with the given path index" logic.
fixes#10271
Accessing values might throw errors if they're not just values but getters. Guard against that by try-catching every access so that `$inspect` doesn't fail
fixes the iframe error in the playground reported in #10174
Someone could programmatically add a class to an element and Svelte doesn't see it, so having global be part of a modifier is necessary so that Svelte doesn't mark it as unused
fixes#10210