Fixes#13848.
When we set custom element attributes/props, we should be doing so without the current effect/reaction active. Otherwise, the custom element lifecycle might attach effects/dependencies to the wrong reaction and all manner of things can incorrectly occur
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
We originally didn't extend from `Error` anymore because its fields are of no real value to us, and has problems with serialization in a worker context.
Turns out this was a mistake, because various build tools rely on errors being thrown as something that extends Error, else they try to wrap it in their own error.
We therefore revert that change while still trying to preserve most of the advantages of not extending `Error`, namely nuking the useless stack trace and making sure the message is enumerable.
When CSS is externalized we rightfully rely on the following tooling chain to properly minify CSS. When we inject the CSS however, that tooling won't be able to do that, so we gotta do it ourselves.
This PR brings back most of that logic that existed in Svelte 4. Fixes#13716
Only count down after timeout, else we would reach 0 before our own render effect reruns, but reach 1 again when the tick callback of the prior teardown runs. That would mean we re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.
* fix: add empty stack to `CompileDiagnostic` to show error on build
* chore: generate types
* chore: make stack optional to make TS happy
* chore: generate types -.-"
* chore: add comment
* fix: ensure value is correctly set to zero on the progress element
* fix: ensure value is correctly set to zero on the progress element
* fix: ensure value is correctly set to zero on the progress element
* chore: highlight swallowed errors from await blocks in DEV
* chore: highlight swallowed errors from await blocks in DEV
* chore: highlight swallowed errors from await blocks in DEV
* lint
* feedback
* feedback
* add test
* Update packages/svelte/tests/runtime-runes/samples/await-no-catch-error/main.svelte
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: ensure SVG element attributes have case preserved
* fix: ensure SVG element attributes have case preserved
* fix: ensure SVG element attributes have case preserved
* fix: enable bound store props in runes mode components
* add some JSDoc, since it could be a headscratcher for future us
* make it clear that this is specifically about bindings
* skip intermediate value
* tweak other names too
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: internally wrap store subscribe in untrack
* lint
* Update packages/svelte/src/store/utils.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Version Packages
* Update packages/svelte/CHANGELOG.md
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Closes#13493.
This PR allows the usage of getContext() inside $derived runes. Previously, you could use it, but only on init and not updates – and this inconsistency was unnecessary. We can make it work just like we do in other places.
I resisted this previously because it felt a bit wasteful, but I now think that there's really no way around this: Instead of only going upwards the tree while matching, for `:has` we go _down_ the tree to see what matches. More specifically, we're collecting the children of the current element and then check if one of those does match the selectors inside `:has`.
This makes the way the code works easier to reason about and also removes some boolean tracking we had to add for the previous approach.
Fixes#13779
Fixes#13717
There are two parts to this:
1. the parent selectors weren't passed along for the check inside `:has`, which in case of a leading combinator would mean it would always count as unused
2. In case if a selector like `x > y:has(z)`, the prior logic would correctly determine that for element `z` there's a match for the `:has` selector, by first checking its contents and then walking up the tree. But after it did that, it would try to walk up the tree once more, which is a) wasteful b) buggy because the tree walking mechanism would no longer be adjusted for the `:has` special case, resulting in false negatives. To fix that, the `:has` will return a new value from the function, signaling that it already fully checked the upper selectors, and so the function calling it will skip doing that.
- detect store mutations and not use `$derived` in that case, fixes#13723
- better detect `let x` that can be folded into `$derived`, fixes#13727
---------
Co-authored-by: ComputerGuy <63362464+Ocean-OS@users.noreply.github.com>
- correctly assign children snippet to default slot, fixes#13067
- allow `svelte:fragment` without `let:` directives to be rendered by `@render children()`, fixes#13066
* fix: avoid chromium issue with dispatching blur on element removal
* fix: avoid chromium issue with dispatching blur on element removal
* fix: avoid chromium issue with dispatching blur on element removal
* active effect too
* try/finally