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

8236 Commits

Author SHA1 Message Date
Dominic Gannaway
ec52c75cc4
fix: permit whitespace within template scripts (#10591) 2024-02-21 15:24:36 +00:00
Dominic Gannaway
a2fbef2050
fix: improve import event handler support (#10592)
* fix: improve import event handler support

* simplify
2024-02-21 15:13:45 +00:00
Simon H
66b624491e
fix: allow boolean contenteditable attribute (#10590)
fixes #10559
2024-02-21 14:30:29 +01:00
Dominic Gannaway
58008479fc
fix: improve $inspect handling of derived objects (#10584)
* fix: improve $inspect handling of derived objects

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

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

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2024-02-21 13:03:18 +00:00
Rich Harris
29890bb616
chore: move signal logic into subdirectory (#10582)
* move effect code

* move source code

* derived

* move more stuff

* simplify

* init is a daft name for something that runs repeatedly

* remove unneeded effect variant

* chore: reshuffle part2 (#10588)

* extract store

* move prop/init to render

* introduce constants file and move all constants there to reduce cyclic dependencies

* move reactive_import to render

* move bubble_event into render, move (raf) task handing into its own file

* expect-error did hide that one

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2024-02-21 07:21:45 -05:00
github-actions[bot]
187400b409
Version Packages (next) (#10579)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-20 16:59:40 -05:00
Rich Harris
ddb968cc35
fix: ensure proxy owner set always has 1 or more members (#10577)
* fix missing owners

* regression test

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-20 16:55:36 -05:00
github-actions[bot]
88389ad2cf
Version Packages (next) (#10571)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-20 16:05:07 -05:00
Ahmad
d6e0fbd8ba
fix: handle member expressions in directives (#10576) 2024-02-20 15:59:07 -05:00
Dominic Gannaway
802bfcabec
fix: improve props spreading logic (#10574) 2024-02-20 20:20:20 +00:00
Rich Harris
96eae28ed2
fix: remove memory leak, make beforeUpdate etc work correctly (#10570)
* fix: remove memory leak

* changeset

* mutable_source is only used in non-runes mode, no need to check here

* simplify

* oops

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-20 13:07:27 -05:00
github-actions[bot]
662eda4ae7
Version Packages (next) (#10568)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-20 13:06:46 -05:00
Rich Harris
8613a6f28a
fix: stack-trace-based readonly validation (#10464)
* fix: remove readonly validation

The readonly dev time validation results in false-negative object equality checks: The original object is proxified and thus comparisons could be between the unproxified and proxified version, which will always return false. Fixes #10372

There's also the problem that an object could be passed into a component but then passed upwards into shared state. At that point, it should no longer be readonly, but it's not possible to statically analyze these points. Fixes #10372

Lastly, the each block logic mutates an internal array and that also throws errors with the readonly logic. Fixes #10037

* reinstate tests

* track ownership of state and mutations

* working?

* remove old changeset

* tidy

* error

* simplify

* fix

* fix

* fix

* tidy

* make it a warning

* rename test

* remove unused test

* update tests

* slap ts-expect-error everywhere, because its too finicky otherwise

* oops

* oh no the hall monitor is here

* only call add_owner in dev

* only owners can transfer ownership

* simplify

* fixes

* tidy up

* fix type error

* while we're at it

* rename file

* rename functions

* add some comments

* move ownership checking logic

* ugh eslint

* more detailed message

* only add filename in dev

* comment

* update tests

* move more code

* undo change to sourcemap tests

* allow proxy to have multiple owners

* use SignalDebug

* i was doing this all wrong

* tidy up

* implement inheritance

* fix

* tidy up

* update filename stuff

* changeset

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-20 11:59:14 -05:00
Dominic Gannaway
f1550b2ea3
fix: correct context applied to batch_inspect (#10569) 2024-02-20 16:48:15 +00:00
Rich Harris
02c6176622
feat: allow state/derived/props to be explicitly exported from components (#10523)
* Revert "fix: stricter validation for component exports (#10430)"

This reverts commit dab0a43693.

* dont remove old changeset

* changeset

* tweak error messages

* make component-exported state work

* consistency

* fix

* fix

* update messages

* update tests

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-20 11:26:59 -05:00
github-actions[bot]
ad2b8b9112
Version Packages (next) (#10539)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-20 11:23:13 -05:00
Dominic Gannaway
bcb1b8eb98
fix: improve handling of unowned derived signals (#10565)
* fix: improve handling of unowned derived signals

* lint
2024-02-20 15:49:30 +00:00
Dominic Gannaway
0afb8d489e
fix: improve state store mutation compiler output (#10561) 2024-02-20 14:12:59 +00:00
Dominic Gannaway
5698fb789c
fix: better handling of derived signals that have no dependencies (#10558)
* fix: better handling of derived signals that have no dependencies

* fix: better handling of derived signals that have no dependencies
2024-02-20 13:37:27 +00:00
Simon H
aef245364c
fix: only escape characters in SSR template (#10555)
Adjusts the escaping mechanism done for server compilation. For template literals it's now only applied when explicitly told, which is the case for generated literals from the html template. Fixes a bug where a template literal string inside the `@html` tag was wrongfully escaped (https://github.com/sveltejs/svelte/issues/10359#issuecomment-1949678228)
2024-02-20 13:33:14 +01:00
Simon H
08978bfae8
fix: don't execute scripts inside @html when instantiated on the client (#10556)
In Svelte 4, scripts inside `@html` were not executed when it was created client-side. This is because `innerHTML = ..` which was used under the hood does not execute scripts due to security reasons. This adjusts the code so the same is true for Svelte 5.
2024-02-20 13:32:51 +01:00
Simon H
b80d9bd654
fix: wire up events in mount correctly and fix its types (#10553)
fixes #10551
2024-02-20 11:37:09 +01:00
Simon H
f5102013af
fix: better interop of $state with actions/$: statements (#10543)
Ensure update methods of actions and reactive statements work with fine-grained `$state` by deep-reading them. This is necessary because mutations to `$state` objects don't notify listeners to only the object as a whole, it only notifies the listeners of the property that changed.
fixes #10460
fixes https://github.com/simeydotme/svelte-range-slider-pips/issues/130
2024-02-20 10:50:22 +01:00
Rich Harris
4c9d71f8cf
chore: init map prototype methods eagerly (#10544)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-20 07:01:04 +05:45
Dominic Gannaway
7032837ef0
fix: better handling of empty text node hydration (#10545)
* fix: better handling of empty text node hydration
2024-02-19 17:14:13 +00:00
Rich Harris
41e7dab755
chore: move block logic into separate modules (#10542)
* move if block logic

* key and await

* move each

* move more stuff

* dedupe

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-19 11:35:01 -05:00
Dominic Gannaway
71db9edcdc
fix: improve each block item equality for immutable mode (#10537)
* fix: improve each block item equality for immutable mode

* alter
2024-02-19 14:50:38 +00:00
github-actions[bot]
01b6543739
Version Packages (next) (#10534)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-19 08:51:42 -05:00
Rich Harris
151cdeacaf
simplify test (#10538)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-19 08:51:11 -05:00
Rich Harris
9c8e643b64
disable inspector (#10531)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-19 08:06:50 -05:00
Dominic Gannaway
41cdbafc40
fix: improve effect over-fire on store subscription init (#10535) 2024-02-19 12:24:35 +00:00
Rich Harris
73830596b5
chore: clarify usage of accessors (#10522) 2024-02-19 10:25:56 +01:00
Rich Harris
fbb8839aba
chore: simplify accessor return (#10520)
Return `pop` directly by returning the component from it; gets rid of extraneous variable declaration

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2024-02-19 09:45:51 +01:00
Rich Harris
8feb86583a
fix: use init properties when exporting non-state values (#10521) 2024-02-19 09:44:37 +01:00
github-actions[bot]
a279e802d5
Version Packages (next) (#10528)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-18 17:59:40 -05:00
Ahmad
06e1d86091
fix: visit expression node in directives (#10527)
* fix: visit child nodes in directives

* test

* cleanup

* small change

* lint

* err

* types

* define the set locally, limit the blast radius

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-18 17:45:57 -05:00
Rich Harris
4d8d2928d8
chore: ignore test directories left over from other branches (#10525)
* chore: ignore test directories left over from other branches

* tighten up

* one comment will do

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-18 13:25:32 -05:00
Rich Harris
3da6cef29b
chore: improve code generation for bind:this in SSR mode (#10524)
* chore: improve code generation for `bind:this` in SSR mode

* test

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-18 13:09:26 -05:00
github-actions[bot]
b5628af72e
Version Packages (next) (#10518)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-18 08:40:04 -05:00
Rich Harris
ce8495c66d
chore: fix preview site (#10519)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-18 08:05:12 -05:00
Simon H
2755401034
breaking: remove createRoot, adjust mount/hydrate APIs, introduce unmount (#10516)
* breaking: remove `createRoot`, adjust `mount`/`hydrate` APIs, introduce `unmount`

closes #9827

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

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

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
2024-02-18 07:52:56 -05:00
github-actions[bot]
11b69459b9
Version Packages (next) (#10509)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-17 17:09:26 -05:00
Rich Harris
5605e8cf49
feat: implement support for :is(...) and :where(...) (#10490)
* failing test for :is(...)

* simplify

* trim

* factor out truncate function

* pass stylesheet around

* recurse into :is and :where

* fix types

* fix types

* almost there

* gah so close

* tada

* changeset

* simplify

* feat: nested CSS support (#10491)

* parse nested CSS

* tests

* track parent rules

* some progress

* switch it up

* pruning

* works

* changeset

* lint

* error early on invalid nesting selector

* tidy

* note to self

* fix some specificity stuff

* failing test

* note to self

* fix: correctly scope CSS selectors with descendant combinators (#10502)

* fix traversal, but break some other stuff

* man this is fucken hard

* fixes

* getting closer

* be conservative for now

* tidy

* invert

* invert

* simplify

* switch

* for now

* progress

* i think it works?

* fix

* tidy up

* revert some stuff

* remove some junk

* handle weird cases

* update

* tweak

* shrink

* changeset

---------

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

---------

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

* Update playgrounds/sandbox/run.js

* changeset

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-17 16:56:03 -05:00
Rich Harris
40ac2cafd6
chore: treeshakeable store subs (#10506)
* make store subscriptions treeshakeable on the server

* drive-by fix

* changeset

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-17 16:35:18 -05:00
Dominic Gannaway
df10204fcc
fix: improve bind:this support for each blocks (#10510) 2024-02-17 20:26:54 +00:00
Rich Harris
1700e47858
chore: remove unneeded store_get_dev function (#10507)
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-17 14:39:03 -05:00
Simon H
71601ba2e5
fix: warn against accidental global event referenced (#10442)
* fix: warn against accidental global event referenced

closes #10393

* remove list

* remove else

* tweak

* update test

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-17 14:38:17 -05:00
Ben McCann
49ad7f9589
chore: upgrade xml2js and codemirror plugins (#10463)
* chore: upgrade xml2js

* deduplicate @codemirror/lang-html

* bump eslint-plugin to eliminate duplicate dependency

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-17 11:43:56 -05:00
github-actions[bot]
2a5ca51594
Version Packages (next) (#10499)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-17 11:26:31 -05:00
Simon H
72ff5366de
feat: add hydrate method, make hydration treeshakeable (#10497)
* feat: add hydrate method, make hydration treeshakeable

Introduces a new `hydrate` method which does hydration. Refactors code so that hydration-related code is treeshaken out when not using that method.
closes #9533
part of #9827

* get docs building

* ugh

* one more

* Update packages/svelte/scripts/check-treeshakeability.js

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* warn

* Update sites/svelte-5-preview/src/routes/docs/content/01-api/05-functions.md

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-02-17 11:25:18 -05:00