0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-28 07:52:41 +01:00
Commit Graph

8850 Commits

Author SHA1 Message Date
Ben McCann
145d67a489
docs: copy Svelte 5 docs from omnisite (#12317) 2024-07-09 19:30:36 -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
256e60994e
chore: remove some junk (#12372) 2024-07-09 15:30:55 -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
Rich Harris
1d8d38c8bd
fix: correctly validate <svelte:component> with bind:this (#12368) 2024-07-09 14:26:45 -04:00
Simon H
529db97928
fix: handle nested :global(...) selectors (#12365)
fixes #10540
2024-07-09 12:54:19 -04:00
github-actions[bot]
6ac1ae8a12
Version Packages (next) (#12361)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-09 12:03:08 -04:00
Rich Harris
12579d47bc
chore: remove unnecessary Invalidator type (#12354)
* chore: fix Invalidator type

* regenerate types

* in fact you know what, this whole thing is overkill. get rid of it

* oops
2024-07-09 11:43:35 -04:00
Rich Harris
2789a3c0ef
feat: single-pass hydration (#12335)
* WIP towards single-pass hydration

* fix

* fixes

* fix

* fix

* fixes

* fix

* fixes

* fix

* fix, tidy up

* update script (it currently fails)

* fix

* fix

* hmm

* fix

* fix

* fix

* fix

* all hydration tests passing

* drive-by fix

* fix

* update snapshot tests

* fix

* recover: false

* fix invalid HTML message

* note to self

* fix

* fix

* update snapshot tests

* fix

* fix

* fix

* update test

* fix

* fix

* fix

* ALL TESTS PASSING THIS IS NOT A DRILL

* optimise each blocks

* changeset

* type stuff

* fix comment

* tidy up

* tidy up

* tidy up

* tidy up

* tidy up

* remove comment, turns out we do need it

* revert

* reinstate standalone optimisation

* improve <svelte:element> SSR

* reset more conservatively

* tweak

* DRY/fix

* revert

* simplify

* add comment

* tweak

* simplify

* simplify

* answer: yes, at least for now, because otherwise empty components are a nuisance

* tweak

* unused

* comment is answered by https://github.com/sveltejs/svelte/pull/12356

* tweak

* handle `<template>` edge case at compile time

* this is no longer a possibility, because of is_text_first

* unused

* tweak

* fix

* move annotations to properties

* Update packages/svelte/src/constants.js

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

* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js

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

* Update packages/svelte/src/internal/client/dom/blocks/each.js

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

* Update packages/svelte/src/internal/client/dom/hydration.js

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

* Update playgrounds/demo/vite.config.js

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

* add a comment

* prettier

* tweak

* tighten up hydration tests, add test for standalone component

* test for standalone snippet

* fix

* add some comments

* tidy up

* avoid mutating `arguments`

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2024-07-09 11:39:27 -04:00
Simon H
3dbb220169
fix: ensure $$slots returns a record of booleans (#12359)
Returned the underlying functions previously
2024-07-09 09:53:12 -04:00
Rich Harris
c314d1bb33
chore: allow <svelte:element> effects to be pruned (#12356)
assign_nodes inside the branch sets the nodes property, and there's a dependency on the `this` value, which both (on its own) already prevent the effect from being pruned.
2024-07-09 13:28:52 +02:00
Rich Harris
056a1aeb89
chore: move slot function into its own module (#12357) 2024-07-08 22:56:04 -04:00
github-actions[bot]
94197b069e
Version Packages (next) (#12355)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-08 19:45:15 -04:00
Dominic Gannaway
202f1dd819
fix: reconnected deep derived signals to graph (#12350)
* fix: fixed derived disconnected issues

* add test

* changeset

* lint

* refactor

* Update packages/svelte/src/internal/client/reactivity/deriveds.js

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

* Update packages/svelte/src/internal/client/runtime.js

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

* address feedback

* tweak

* tweak

* simplify

* lint

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-07-08 18:50:38 -04:00
github-actions[bot]
787e091a5e
Version Packages (next) (#12349)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-08 17:21:50 -04:00
Rich Harris
66a184689b
chore: simplify legacy props (#12353)
* chore: simplify legacy props

* add test
2024-07-08 17:19:54 -04:00
Dominic Gannaway
ee47696986
fix: resolve legacy component props equality for mutations (#12348)
* fix: resolve legacy component props equality for mutations

* lint

* Update packages/svelte/src/legacy/legacy-client.js

* simplify test

* rename test

* make all proxies immutable

* remove unused parameter

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-07-08 20:29:07 +01:00
Simon H
63f3ee4ffd
fix: make <select> <option value> behavior consistent (#12316)
Setting the `value` attribute of an `<option>` element to a falsy value should result in the empty string. This wasn't happening in all situations previously.
Fixes #11616
2024-07-08 21:06:57 +02: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
Simon H
e8c3729fc9
fix: make $state component exports settable (#12345)
* fix: make `$state` component exports settable

fixes #11983

* failing test

* fix

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-07-08 12:27:31 -04:00
Simon H
14cbb65d85
chore: stricter control flow syntax validation in runes mode (#12342)
disallow characters between `{` and `#` / `:` / `@` in runes mode

closes #11975
2024-07-08 11:28:06 -04:00
github-actions[bot]
76ddfb3d45
Version Packages (next) (#12340)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-08 11:25:16 -04:00
Simon H
dba4aa3567
chore: align warning and error objects, add frame property (#12326)
This aligns warning and error objects to contain the same properties and have their toString methods return the same shape. It's implemented by warnings becoming class objects, too, and sharing the same base class with errors. It also adds back the `frame` property that got lost in the Svelte 4->5 transition. The only difference to Svelte 4 now is a slightly adjusted toString property (which is consistent between warnings and errors now) and a `position` property that contains a tuple of start/end offsets instead of a `pos` property only containing the start offset

closes #12151
2024-07-08 17:09:10 +02:00
Simon H
243c4b78b1
fix: ensure $effect.root is ignored on the server (#12332)
Ignore the contents of the effect root, just return a noop where necessary

fixes #12322
2024-07-08 16:54:21 +02:00
Simon H
cf16acda32
fix: enable local transitions on svelte:element (#12346)
fixes #12231
2024-07-08 09:55:00 -04:00
Yuichiro Yamashita
67bf7a8067
fix: correct start of {:else if} and {:else} (#12043)
The modern AST is an opportunity to tweak things. In the old AST, the start of else (if) branches was the content, now it's the opening bracket, which makes more sense.
2024-07-08 11:46:47 +02:00
Simon H
2ffb55ce7d
fix: reorder reactive statements during migration (#12329)
fixes #12183
2024-07-08 10:32:59 +02:00
Rich Harris
bbf489504d
feat: better <svelte:element> SSR output (#12339) 2024-07-07 23:02:11 -04:00
Rich Harris
a59bc99782
chore: tidy up (#12336)
* chore: tidy up

* changeset

* reverse wrap_snippet argument order, for more compact output

* more tidy-up
2024-07-07 22:35:29 -04:00
Rich Harris
daac5fca13 oops, sorry 2024-07-07 17:15:25 -04:00
Rich Harris
d1432b0ab3
chore: fix playground prod preview (#12334)
* chore: fix playground prod preview

* tweak

* tweak
2024-07-07 17:14:07 -04:00
Simon H
5eff68f63d
chore: runtime linting (#12314)
- check that the runtime doesn't use methods that are too new
- add linting rule to prevent references to the compiler in the runtime (this is important for the first check, else the ambient node typings would be included, which includes a definition for `at()`, which means we no longer would get errors when violating the "don't use new methods" rule in the runtime)
- fix code as a result of these new checks

closes #10438
2024-07-05 23:32:44 +02:00
github-actions[bot]
ed6084806d
Version Packages (next) (#12307)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-05 11:15:22 -04:00
Dominic Gannaway
b3c002a703
fix: correctly compile $effect.root in svelte modules (#12315)
Fixes #12222
2024-07-05 16:24:22 +02:00
Rich Harris
b2448dcc5c
fix: ensure bind:this works with component with no return value (#12308) 2024-07-05 13:28:58 +02:00
Paolo Ricciuti
e42bb61296
fix: ensure components always return an object (#12290)
Closes #12287

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2024-07-04 20:45:57 +02:00
github-actions[bot]
831552f4b3
Version Packages (next) (#12282)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-04 16:29:58 +01:00
Rich Harris
445f890cd5
fix: create wrapper template for components in HMR mode (#12304) 2024-07-04 16:27:10 +01:00
Dominic Gannaway
15a8518b91
fix: ensure each blocks properly handle $state.frozen objects in prod (#12305)
* fix: ensure each blocks properly handle $state.frozen objects in prod

* fix: ensure each blocks properly handle $state.frozen objects in prod
2024-07-04 15:20:21 +01:00
Simon H
bc32b7c828
fix: ensure rest props access on hoisted event handlers works (#12298)
If an even handler is hoisted and said event handler access rest props, we can't be sure whether or not it will access it via `$$props` (optimized) or via `rest()` - therefore we add both as params in this edge case

fixes #12279
2024-07-04 08:09:28 -04:00
Dominic Gannaway
80263770f1
fix: bail out of event hoisting when referencing store subscriptions (#12301) 2024-07-04 13:09:15 +01:00
Naser Aleisa
521988c53e
chore: improve npm search ranking for 'svelte' package (#12297)
add "svelte" it to the list of keywords
2024-07-04 11:40:25 +02:00
Rich Harris
eb3e677e05
chore: various playground fixes (#12291) 2024-07-04 09:52:12 +02:00
Rich Harris
2f1d2d5906
fix: make props optional during SSR (#12284) 2024-07-03 16:23:44 -04:00
Rich Harris
7e64e84479
chore: make store initialization logic simpler (#12281)
* chore: make store initialization logic simpler

* simpler still

* add comment
2024-07-03 14:34:03 -04:00
Rich Harris
07b0088dab
chore: remove unused create_element helper (#12283) 2024-07-03 14:33:17 -04:00
FoHoOV
e5d70c3b97
fix: improved fine-grainability of ReactiveDate (#12110)
* fix: improve ReactiveDate class

* improved test

* added changeset

* improved performance by using less signals

* using the same signal for getX and getUTCX

* fixed types

* combined setX with setUTCX tests together

* simplified fine-grainability by using deriveds

* reused the calculated new_time

* removed logic that reduced number of signals, cuz its use-cases are rare

* inference is fine

* tidy up

* tweaks

* more efficient iteration

* tweak

* more descriptive changeset

* this makes all tests but one pass

* fix

* adjust test to be robust across timezones

* tweak more tests

* Update .changeset/sleepy-dogs-sit.md

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2024-07-03 12:35:31 -04:00
github-actions[bot]
730e179772
Version Packages (next) (#12278)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-03 16:50:08 +01:00
Rich Harris
f2179c90e6
chore: better store subscriptions (#12277)
* use existing teardown function

* set up stores and unsubscriptions in one go

* we never set last_value, this is gibberish

* simplify

* tidy up

* inline

* more
2024-07-03 09:30:24 -04:00
Rich Harris
15873ab09b
chore: only call mark_reactions when updating a source (#12272)
* only call mark_reactions when updating a source

* move mark_reactions to where it belongs, remove force_schedule stuff

* tweak

* move inspect_effects to where it is used

* this is wrong

* remove obsolete comment

* tweak

* reconnect on get

* try marking unowneds as clean

* tidy up

* tidy up

* simplify

* typo

* don't bother caching length

* fix lint

---------

Co-authored-by: Dominic Gannaway <dg@domgan.com>
2024-07-03 09:50:50 +01:00