* Update 04-event-handlers.md
Added documentation on managing multiple event handlers and spreading props.
* Update 04-event-handlers.md
Used spread variable rather than implying there was a props variable from $props above.
* tweak
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* chore: cleanup repo configs
- remove prettier from packages, everything runs through the root now (also better aligns with how you work with it in VS Code: no more config duplication needed)
- remove eslint from packages, run it once through the root now (revealed some inconsistencies and missing stuff, config tightened up as a result) (bump eslint while we're at it)
* update vite and related packages (since rollup includes an addition to one estree node we need to adjust code a bit)
* bump more packages
* bump jsdom
* lint
closes#12910
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: brunnerh <brunnerh@users.noreply.github.com>
* 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: 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
* feat: make `<svelte:component>` unnecessary in runes mode
In Svelte 4, writing `<Component />` meant that the component instance is static. If you made the variable `Component` a reactive state variable and updated the component value, the component would not be reinstantiated with the new value - you had to use `<svelte:component>` for that. One reason was that having a dynamic component was more overhead, which is no longer the case in Svelte 5. We can therefore reduce the potential API surface area (by maybe deprecating `<svelte:component>` in the future) by allowing Svelte to recognize when a component variable is potentially dynamic. It turned out that this was already mostly the case. This PR fixes one case where it wasn't, and fixes another where this was wrongfully applied in legacy mode.
* we already have this function
* add interactive demos
* changeset
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Now that we've made `mount` and `hydrate` not call `flushSync` anymore, we can go back to using `queue_microtask` inside `#await`, which means people who want to synchronously see the pending block can do so using `flushSync` (as validated by our tests). This essentially reverts #12274
* chore: document `@html` and `<img src>` hydration change
Also add a test for it
closes#12333
* add a test
* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* lint
* update example and wording
* update test
* since it turns out we already had a test, we can delete the new one
* fix test
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* chore: reenable server CSS output through a compiler option
There are various use cases where this continues to be necessary/nice to have:
- rendering OG cards
- rendering emails
- basically anything where you use `render` manually and want to quickly stitch together the CSS without setting up an elaborate tooling chain
* cssRenderOnServer -> css: 'injected'
* update tests
* move append_styles into new module, update implementation
* get HMR working
* don't append styles to head when compiling as a custom element
* update changeset
* tweak
* tweak
* tweak wording
* update test
* fix
* reinstate optimisation, but without the bug
* fix sourcemap test
* move breaking change note
* Update packages/svelte/src/internal/server/index.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* breaking: play transitions on `mount` by default
closes#11280
* only prevent transitions when the component is invalidated
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>