* fix: set strings as attributes, non-strings as properties if property exists
* simplify
* remove draggable from list, no longer needed
* in fact we dont need the lookup at all
* lint
* beef up test
* correctly SSR translate attribute
* fix: flip not accounting for scaled lengths
* zoom is uniform, one calculation will do
* stash width/height multipliers
* use var
* scale-first appears to work better?
* more robust zoom calculation
* changeset
---------
Co-authored-by: Etai Nadler <75544136+etainad008@users.noreply.github.com>
This was done previously to align with browser behavior, but the browser behavior actually only makes them passive on window/document/body. Since wheel events are not delegated, we can revert their passive-by-default setting. Closes#13318
For touchstart/touchmove we're not changing it because these events are delegated, which means they happen a lot more often on a target higher up the tree, which may cause jank.
#13225 did not fully fix the described issue: As soon as you have a child component, that child component's anchor will not be in the right ownerDocument yet, and so the logic falls down.
To fix that, we would need to move the ownerDocument check into the microtask - and that map check was mainly done to avoid just that. So instead I opted to simplify the code and just remove the map checks. According to my benchmarking (https://jsbench.me/3hm17l0bxl/1) this has no impact on performance assuming that you'll have cache hits roughly half the time - and even if you'd have much more cache hits, the performance loss is microscopic. Given that the default mode is to not inject styles, this will not be common anyway, so I favor removing that map.
* feat: provide guidance in browser console when logging `$state` objects
Wrap console.log/warn/error statements in DEV mode with a check whether or not they contain state objects. Closes#13123
This is an alternative or enhancement to #13070. Alternative if we deem it the better solution. Enhancement because it's not as robust as a custom formatter: We only check the top level of each entry (though we could maybe traverse a few levels), and if you're logging class instances, snapshot currently stops at the boundaries there and so you don't get snapshotted values for these (arguably this is a more general problem of $inspect and $state.snapshot), whereas with custom formatter it doesn't matter at which level you come across it.
* lint
* use normal warning mechanism, so we can link to docs etc
* add a few more methods
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: separate `template_effect` for dynamic class/style directive with dynamic attributes
* fix: only move to `init` if it `has_call`
* fix: initialize spread `needs_isolation` based on if there are directives with `has_call`
* fix: revert splitting templates and generate deriveds instead
* small tweaks
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* Update 04-event-handlers.md
Added documentation on managing multiple event handlers and spreading props.
* Update 04-event-handlers.md
Used spread variable rather than implying there was a props variable from $props above.
* tweak
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: ensure function calls to identifiers are made reactive
* update test
* we have has_local at home
* add note
* make it a TODO
* Update .changeset/red-ladybugs-turn.md
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: escape more template-literal-related characters
Escape `{` at the start of a string, because it could be preceeded by a `$`, which in combination loads to the following characters being treated as a value
Fixes#13258
(used the opportunity to merge closely-related tests into one)
* sanitize template strings once assembled (#13263)
* only sanitize template quasis once assembled
* changeset
* remove old changeset
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Our current validation was both too lax and too strict:
- too strict, because you can define a `$` variable in Svelte 4 if it's not at the top level
- too strict, because you can define `$`-prefixed function parameters, but not give the parameter the name `$`
- too lax, because you can define a `$`-prefixed variable if you're at least one level deep into a function. In runes mode, this should be an error
This PR aligns the behavior, ensures this isn't a breaking change in legacy anymore, and makes the validation in runes mode more strict
* fix: follow spec for `customElement` option
* tweak messages, add link to details that will be included on future docs site
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>