0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-22 12:27:29 +01:00
Commit Graph

311 Commits

Author SHA1 Message Date
Rich Harris
b92fe7951b
docs: add note on stricter attribute syntax (#12988)
closes #12910

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: brunnerh <brunnerh@users.noreply.github.com>
2024-08-23 17:56:21 +02:00
Rich Harris
213258b024
docs: add note on when effects re-run (#12961)
closes #11806

---------

Co-authored-by: Conduitry <git@chor.date>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2024-08-22 09:58:45 +02:00
Rich Harris
9f962d6f81
breaking: remove $state.link (#12943)
* Revert "breaking: remove `$state.link` callback (#12942)"

This reverts commit 0b51ff04b0.

* Revert "feat: adds $state.link rune (#12545)"

This reverts commit 63ec2e2e88.

* put changesets back

* changeset

* merge main
2024-08-21 15:28:58 -04:00
Simon H
732dbf7fa9
breaking: deprecate context="module" in favor of module (#12948)
* 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>
2024-08-21 15:15:22 -04:00
Rich Harris
0b51ff04b0
breaking: remove $state.link callback (#12942)
* breaking: remove `$state.link` callback

* simplify

* regenerate
2024-08-21 09:48:50 -04:00
Rich Harris
78677e40ef
fix: align list of passive events with browser defaults, and add documentation (#12933)
closes #12639
2024-08-20 23:10:48 +02:00
Dominic Gannaway
63ec2e2e88
feat: adds $state.link rune (#12545)
* 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>
2024-08-20 15:11:15 -04:00
Simon H
8aed27db97
fix: allow mixing slots and snippets in custom elements mode (#12929)
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
2024-08-20 18:30:01 +02:00
Dominic Gannaway
a8c6b92f9a
chore: remove $state.is from docs (#12927) 2024-08-20 11:55:22 -04:00
Rich Harris
44a780fb9c
bump sveltekit (#12923) 2024-08-20 10:49:11 -04:00
Simon H
1681b218cf
docs: mention removal of foreign namespace (#12906)
leftover from #12869
2024-08-19 15:35:58 -04:00
brunnerh
686b0865c5
docs: Move note on runes mode that ended up in wrong section. (#12876) 2024-08-16 16:20:59 +01:00
Rich Harris
c8f963ab97
docs: add note on destructured declarations (#12873) 2024-08-16 09:53:16 +01:00
brunnerh
d64aee7432
docs: Add <svelte:component> deprecation section also to preview docs. (#12862) 2024-08-15 13:00:07 -04:00
Rich Harris
dfb6755514
feat: add compiler error when encountering a $-prefixed store value outside a .svelte file (#12799)
* 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
2024-08-12 15:42:33 -04:00
Rich Harris
9ba370f305
docs: replace $state.frozen docs with $state.raw (#12812) 2024-08-12 12:55:46 -04:00
Rich Harris
9a67ab15da
docs: fix section on browser requirements (#12804)
* docs: fix section on browser requirements

* link
2024-08-12 08:56:11 -04:00
Rich Harris
5094cb9e89
feat: treat tag with . as a component, even if lowercase (#12798)
* feat: treat tag with `.` as a component, even if lowercase

* changeset

* consistency

* note breaking change

* oops, wrong place
2024-08-12 06:45:30 -04:00
Simon H
8be7dd558b
feat: make <svelte:component> unnecessary in runes mode (#12646)
* 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>
2024-07-30 17:54:58 -04:00
Simon H
85f2f161ed
chore: use queue_microtask on #await again (#12647)
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
2024-07-29 15:32:26 +02:00
Rich Harris
2e8a205161
chore: remove outdated comment (#12632) 2024-07-27 15:14:54 -04:00
Simon H
13d86e9019
feat: allow :global in more places (alternative) (#12560)
* `div { :global { &.x { ... } } }` is equivalent to `div:global.x { ... }`, so the latter should be allowed, too

* finalize

* replace obsolete breaking change (which turned out to be a wrong change and was since reverted), add new breaking change note

* changeset

* regenerate types

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Co-authored-by: Rich Harris <rich.harris@vercel.com>

* always remove descendant selector before global

* error on lone `:global` with nested `&`, revert "remove spaces" rule

* regenerate types

* documentation

* oops

* switch to removing descendant combinator

* fix

* revert combinator validation relaxation

* error on first global being modified

* tweak docs

* tweak error messages

* Update documentation/docs/02-template-syntax/05-styles-and-classes.md

Co-authored-by: Rich Harris <rich.harris@vercel.com>

* clarify

* tweak messages

* update tests

* tweak docs

* tweak `:global(...)` docs

* tweak docs

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-07-25 13:04:07 -04:00
Dominic Gannaway
afa3128d2f
breaking: avoid flushing queued updates on mount/hydrate (#12602)
* Revert "Revert "breaking: avoid flushing queued updates on mount/hydrate" (#1…"

This reverts commit 8d139210b7.

* fix legacy wrapper

* lint

* docs

* duplicate

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-07-25 10:07:44 -04:00
Simon H
528d3468d0
docs: note hydration comments change (#12580)
closes #10375
2024-07-24 11:53:19 -04:00
Simon H
2698716bdf
docs: fine-tune $props types info (#12534)
Show how to do optional props, add jsdoc example to non-preview-docs

closes #12528
2024-07-22 08:36:16 -04:00
Cevdet Arda Haran
0fb9fb9a95
docs: change meta element from "Description" to "description" (#12526) 2024-07-22 14:20:05 +02:00
Kohei Yoshino
0891fa7a18
docs: Fix a typo and spelling in Svelte 5 breaking changes doc (#12517)
* Fix a typo in Svelte 5 breaking changes doc: “accessors”

* Fix inconsistent spelling: “favour”
2024-07-21 11:28:11 -04:00
Willow (GHOST)
b88e667b85
docs: fix svelte 5 discord channel name & release estimation (#12465)
* docs: fix svelte 5 discord channel name

* docs: fix release estimate

* Apply suggestions from code review

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>
2024-07-17 15:31:45 -04:00
Rich Harris
c287bd503d
Raw snippet alternative (#12425)
* feat: add createRawSnippet API

* handle missing hydrate function, improve types

* fix

* tweak types

* beef up test

* build

* types

* oops this was temporary

* typo

* regenerate types

* make mount/render optional, error if missing

* move code to new module

* test hydration

* simpler createRawSnippet API

* regenerate types

* change signature

* docs

* h1 -> node

* allow `setup` to return a teardown function

---------

Co-authored-by: Dominic Gannaway <dg@domgan.com>
2024-07-17 09:49:44 +01:00
Rich Harris
c92620dcbe
feat: skip pending block for already-resolved promises (#12274)
* feat: skip pending block for already-resolved promises

* update tests

* update docs
2024-07-16 11:18:59 -04:00
Simon H
73d97f7af9
docs: fix $effect.pre code example (#12444)
closes #12439
2024-07-15 14:41:27 +02:00
Simon H
f58d60068d
docs: note default value breaking change to bind: in runes mode (#12412)
* docs: note default value breaking change to `bind:` in runes mode

https://github.com/sveltejs/svelte/issues/11400#issuecomment-2223186433

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Co-authored-by: Rich Harris <rich.harris@vercel.com>

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-07-12 10:11:48 -04:00
Simon H
42a7a0ecd8
chore: document @html and <img src> hydration change (#12373)
* 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>
2024-07-10 21:07:17 -04:00
Paolo Ricciuti
2cee6fb141
fix: playground warnings (#12394) 2024-07-10 18:33:25 -04:00
Rich Harris
d9860941eb
chore: expose HMR option, add disclaimer to compiler options UI (#12386)
* chore: expose HMR option, add disclaimer to compiler options UI

* ok prettier whatever you say
2024-07-10 15:12:42 -04:00
Dominik G
9c1371a487
chore: bump vite-plugin-svelte to 4.0.0-next in demo and preview site (#12385) 2024-07-10 10:00:02 -04:00
Rich Harris
a4f6407144
feat: universal injected css (#12374)
* 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>
2024-07-10 09:35:43 -04:00
Rich Harris
bdc45fdf7f
breaking: rename legacy.componentApi to compatibility.componentApi (#12370)
* breaking: rename `legacy.componentApi` to `compatibility.legacyComponent`

closes #12112

* fix

* rename to compatibility.componentApi

* update changeset

* tidy up

* default to 5

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2024-07-09 18:43:57 -04:00
Rich Harris
27c54407b6
chore: expose css option in playground (#12369)
* expose css compiler option

* pass options to worker
2024-07-09 15:18:59 -04:00
Simon H
ba93e5fce3
breaking: play transitions on mount by default (#12351)
* 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>
2024-07-08 19:27:48 +02:00
Dominic Gannaway
cae5f1ed26
breaking: rename svelte/reactivity helpers to include Svelte prefix (#12248)
* breaking: rename svelte/reactivity helpers to include Svelte prefix

* keep old exports

* add runtime errors

* add runtime errors

* feedback

* feedback

* feedback

* Update .changeset/nice-jobs-breathe.md

Co-authored-by: Conduitry <git@chor.date>

---------

Co-authored-by: Conduitry <git@chor.date>
2024-07-01 19:19:11 +01:00
Simon H
33e44ea697
feat: allow let props = $props(), optimize prop read access (#12201)
- allow to write `let props = $props()`
- optimize read access of props.x to use `$$props` argument directly; closes #11055
2024-06-28 09:20:41 +02:00
Ahmad S
d9e8acd0d8
docs: rename $effect.active to $effect.tracking` in REPL example (#12200) 2024-06-27 11:57:12 +02:00
Ahmad S
b93adb7d00
docs: correct $effect examples (#12196) 2024-06-27 09:49:48 +02:00
Theodor Steiner
48d1ef96a6
fix(repl): attach listener above svelte event delegator (#12127) (#12135) 2024-06-26 14:25:25 +01:00
Dominic Gannaway
59f7bd6f9f
fix: improve await block behaviour in non-runes mode (#12179)
Fixes #12166. Turns out that the recent refactors here negated the fact that non-runes mode uses a slightly different source signal that has different equality rules.

I also updated the docs in this PR too to reflect that only plain objects and arrays are proxied.
2024-06-25 17:20:22 +02:00
Dominic Gannaway
e3d8ee6c6d
chore: add note for state.is using object.is (#12180) 2024-06-25 17:01:57 +02:00
Rich Harris
4540ff3118
docs: tweak effect docs (#11982)
better examples 

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2024-06-25 15:32:26 +02:00
Ben McCann
8ae5885d8d
chore: remove unused devDependencies (#12157) 2024-06-24 12:22:42 +02:00
Rich Harris
6c66680919
chore: bump typescript to 5.5 (#12126)
* chore: bump typescript to 5.5

* try to revert non-typescript-related changes to lockfile

---------

Co-authored-by: Conduitry <git@chor.date>
2024-06-21 15:28:36 -04:00