People could've done bind:this and called instance methods on the instance - a rare case, but not impossible. This shims $set and $on when in legacy compat mode. $destroy is never shimmed because you shouldn't manually destroy a component, ever, and there's no way to make that work in the new world.
closes#10420
fixes#10271
The prior fix in #10307 wasn't quite right, because JSDom has a difference between window and event.composedPath which sounds like a bug, and a workaround in that PR made it so the test did pass when the bug still occurred. That's also why there isn't a test here, because we can't properly test this using JSDom.
* fix: correctly handle proxied signal writes before reads
* managed
* Update packages/svelte/src/internal/client/proxy.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fixes#10511
We used the animation frame dance previously where the `$effect` timing was slightly different and did not wait on its children before rerunning. With that changed now everything false into place nicely.
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
The previous `bind_this` implementation had flaws around timing and didn't work correctly when the binding wasn't `$state` in runes mode.
This PR reimplements `bind_this` by aligning it more with how Svelte 4 bindings work, namely reacting to each block context variables updates properly and introducing a mechanism to get the previous binding destination using said variables.
* 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>
* 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>
* 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>
* 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>
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)
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.
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