* simplify some parser logic, improve some compiler errors
* move logic into visitors
* more
* turns out we're doing a bunch of unnecessary work on closing tags
* tidy up
* changeset
* lint
This makes it possible to slow them down using dev tools, and overall ties the implementation more closely to WAAPI, which is good. Also fixes#12730 (all four cases, css, tick, css+tick, neither are now supported) and fixes#13019 (passed empty fallback object)
---------
Co-authored-by: Matei Trandafir <matei_trand@yahoo.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: repair `href` attribute mismatches
The reasoning in #9662 turns out to be false: While it's true that the href would resolve to the same URL on the initial page, once you're doing a client-side navigation to a URL at a different depth, the relative path would now point to the wrong location. Therefore we need to repair href hydration mismatches
fixes https://github.com/sveltejs/kit/issues/12254
* remove test
* Revert "remove test"
This reverts commit fa43304329.
* fix test
* remove comment, since the rationale for skipping the attributes in question is covered by the one immediately below
* fix
* add test for <a> specifically
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* feat: allow non-synchronous legacy component instantiation
Add a new option to the legacy class component interface so that `flush_sync` can be omitted. Part of https://github.com/sveltejs/kit/issues/12248
* lint
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: ensure $inspect works with SvelteMap and SvelteSet
* build
* dev only
* dev only
* lint
* lint
* lint
* alternative
* Update packages/svelte/src/reactivity/map.js
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: more robust handling of var declarations
- fixes#12807: state declared with var is now retrieved using a new `safe_get` function, which works like `get` but checks for undefined
- fixes#12900: ensure we're not creating another new scope for block statements of function declarations, which resulted in var declarations getting "swallowed" (because they were hoisted to the function declaration scope and never seen by our logic)
* simplify
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
The backing store variable of a $store read could be a variable that itself needs a transformer, which is why we need to make accessing the reads lazy
fixes#12859
* breaking: deprecate `context="module"` in favor of `module`
Also reserve a few attributes, which we may or may not use in the future
closes#12637
* fix tests
* one more
* add svelte package to the root so eslint and prettier can use it
* tweak messages
* warn on unknown attributes
* regenerate
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* feat: adds $state.link rune
* add tests
* types
* docs
* debugger
* lint
* Update .changeset/friendly-rice-confess.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/src/compiler/phases/2-analyze/index.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* feedback
* feedback
* feedback
* feedback
* rename link_state to linked_state for grammatical consistency
* oops, victim of find-replace
* no need to store linked_value if setting
* simplify tests
* test behaviour of objects
* update docs
* copy
* more direct example that shows unlinking and relinking
* add callback argument support
* fix
* tidy up
* document callback
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
We need to allow mixing those within custom element components because in a future version of Svelte where we remove the Svelte-version of slots, we'll preserve slots as-is, and people should use those within their components. At the same time they should be able to make use of snippets for reusable blocks of code.
Also document that you should continue using slots within custom elements.
closes#12892
* feat: treat tag with `[` as a component, even if lowercase
* chore: simpler regex
Co-authored-by: Conduitry <git@chor.date>
* feat: error on invalid component name
* fix: fully revert dot notation test
* tweak error message
---------
Co-authored-by: Conduitry <git@chor.date>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* step one
* WIP
* more
* fix
* collapse sequential sibling calls
* working
* working but messy
* tidy up
* unused
* tweak
* tweak
* tidy
* tweak
* tweak
* revert
* changeset
* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* revert this bit
* align
* comments
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* chore: use closures for state proxies
* use variables
* early return
* tidy up
* move ownership stuff into separate object
* put original value directly on STATE_SYMBOL
* rename
* tidy up
* tidy
* tweak
* fix
* remove is_frozen check
* remove `$state.is`
* avoid mutations
* tweak
* changesets
* changeset
* changeset
* regenerate
* add comment
* add note
* add test
* fix: improve createRawSnippet types
Add cleanup type to return value of setup function
* changeset
---------
Co-authored-by: Rich Harris <hello@rich-harris.dev>
* fix: avoid throwing `store_invalid_subscription_module` for runes
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
* move test to the validator suite, which is faster
---------
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* analyse exports before walking
* more
* another
* this is unused
* move stuff/tidy up
* this appears to be unnecessary
* this is all unnecessary
* simplify
* simplify
* simplify
* simplify
* move more stuff over
* changeset
* unused
* separate reassignment from mutation
* regenerate
* lint
* feat: add compiler error when encountering a $-prefixed store value outside a .svelte file
* add fromState/toState APIs
* another test, update types
* rename fromState to toStore, and toState to fromStore
* docs
* add docs
* separate client/server entry points for svelte/store