* tidy
* tidy
* yes it can, apparently
* tidy up
* unused
* complete merge
* WIP
* simplify
* debugging help
* WIP
* unused
* partial merge
* WIP
* fix
* add test
* rename
* fix
* unused
* oops
* chore: merge main into async branch (#16197)
* chore: merge main into async branch
* adjust test
* fix: make effects depend on state created inside them (#16198)
* make effects depend on state created inside them
* fix, add github action
* disable test in async mode
* make batch.#deferred private
* fix settled when awaits occur inside pending boundary
* tweak
* change behaviour of `tick()` to be requestAnimationFrame-based
* get rid of a bunch of Promise.resolve chains
* more
* more
* fix test
* disallow `flushSync()` inside effects
* regenerate
* handle errors in block expressions
* make validate_each_keys async-aware
* for unowned deriveds, throw errors lazily
* rename ASYNC_ERROR -> ERROR_VALUE, and avoid conflicts with other flags now that it's used with deriveds as well as sources
* invoke boundary directly
* local effect pending
* update test
* fix
* fix
* fix weird bug in tests
* delete old changeset that somehow got left over here
* Update .changeset/eleven-weeks-dance.md
* update error details
* unused
* simplify
* tweak
* tweak
* tweak
* tweak
* tidy up
* handle errors in async block expressions
* tweak
* groundwork for async attribute_effect
* dry out
* fix async directives
* tidy up
* initialize option values before initing select values
* simplify init_select
* simplify
* tweak
* tidy up
* tweak
* on second thoughts just simplify it here
* tidy
* handle awaits in `<slot>`
* unused
* tidy up
* tidy up
* dry out
* dry out
* Revert "dry out"
This reverts commit 25855163bf.
* dry out
* dry out
* use let for block-scoped stuff
* dry out
* dry out
* tidy up
* only wrap awaits in `$.save` when necessary
* oops
* remove TODO comment (just checked)
* oops, leftover
* simplify
* unused
* remove logging
* tweak
* unused
* unused
* remove logging
* partial fix
* fix
* remove unused EFFECT_HAS_DERIVED
* Update packages/svelte/src/reactivity/create-subscriber.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* Update packages/svelte/src/index-client.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* Update packages/svelte/src/internal/client/runtime.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* unused
* Update packages/svelte/src/internal/client/reactivity/sources.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* Update packages/svelte/src/internal/client/reactivity/deriveds.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* Update packages/svelte/src/internal/client/reactivity/deriveds.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* prettier
* unused
* fix flags
* tweak
* tweak
* unused
* fix
* no idea what a 'boundary micro task' is or why it was deemed necessary but evidently it isn't
* remove queue_boundary_micro_task
* oops
* note
* tidy up
* remove TODO
* make method private
* simplify
* flesh out await_reactivity_loss warning
* tweak
* update test
* fix
* null out from_async_derived in more places
* tidy up test
* failing test
* unused
* fix test
* fix
* simplify. no idea what the async_mode_flag stuff is about, but it appears unnecessary
* add async_derived_orphan error
* regenerate
* flesh out await_outside_boundary message
* add some JSDoc
* only update `$effect.pending()` if someone is listening, since it causes a double flush and makes debugging harder
* tweak logic to make it clearer why and when we commit a batch
* add a couple of comments
* false -> 0
* add comment
* unused
* silence warning
* add effect_pending_outside_reaction error
* Update packages/svelte/src/compiler/types/index.d.ts
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* suspend batch, not boundary
* rename from_async_derived -> current_async_derived
* tweak
* remove TODO - this method is only called when pending snippet exists
* use error boundary for test - vitest does some weird error swallowing afaict
* flush less often
* restore -> activate
* remove TODO
* move batch-related code into batch.js
* make flush_queued_root_effects a method of batch
* make process_effects a method of batch
* make stuff private
* unused
* regenerate
* update test
* more JSDoc
* add more JSDoc
* branch and block effects do not also need to be render effects
* tidy up
* simplify
* unused
* move code where it belongs
* remove, for now
* fix
* only apply error adjustments when error escapes boundaries
* remove EFFECT_IS_UPDATING
* is_dirty is a better name than check_dirtiness
* duplicates are rare and harmless
* apparently we no longer need the merging logic? we can simplify and fix stuff by removing it
* tidy
* don't commit stale batches
* add skipped failing test
* partial merge
* WIP
* WIP
* WIP
* tweak
* tidy up
* dont update derived status when time-travelling
* tidy up
* tidy up
* tag async deriveds
* tweak
* bail out of secondary flushes
* re-run blocks on subsequent flushes
* add test
* fix
* add tests, one failing
* fix
* flesh out await_waterfall message
* tidy up
* dry out
* unused
* tweak
* tidy up
* TODO
* tweak
* tidy up
* remove TODO
* unused export
* add optimisation back
* revert unneeded changes
* revert
* update some tests
* more
* more
* move some code
* rename
* WIP
* unset context synchronously
* remove unused argument
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* add comment
* add comment
* use queue_micro_task in createSubscriber
* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/AwaitExpression.js
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* prettier
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
* Store deriveds old value before updating them for consistency with directly assigned sources when reading in teardown functions
* Add tests for derived old values in teardown functions
* Add tests for props old values in onDestroy hooks to prevent regressions
* Add changeset
* Update comment
* remove extraneous tests - these pass with or without the src change
* revert
* WIP
* simplify props
* simplify
* tweak
* reorder a bit
* simplify
* unused
* more
* more
* tweak
* also appears to be unnecessary
* changeset
* fix
* Update .changeset/light-rivers-jump.md
* easier debugging
* fix
* WIP
* fix
---------
Co-authored-by: raythurnvoid <53383860+raythurnvoid@users.noreply.github.com>
* feat: add parent hierarchy to `__svelte_meta` objects at dev time
This adds a `parent` property to the `__svelte_meta` properties that are added to elements at dev time. This property represents the closest non-element parent the element is related to. For example for `{#if ...}<div>foo</div>{/if}` the `parent` of the div would be the line/column of the if block.
The parent is recursive and goes upwards (through component boundaries) until the root component is reached, which has no parent.
part of #11389
* oops
* Apply suggestions from code review
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* tweak
* original component tag
* make render appear in tree, keep tree in sync when rerenders occur
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* simplify props
* simplify
* tweak
* reorder a bit
* simplify
* unused
* more
* more
* tweak
* also appears to be unnecessary
* changeset
* apparently this is also unnecessary
* explanatory comment
an unowned derived should still add itself as a reaction while it is properly connected, which means it can be cleaned up correctly - and this connection is indicated by it having reactions.
Fixes#15829 and potentially #15853
* fix: use fine grained for template if the component is not explicitly in legacy mode
* chore: add comment
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: add `LabeledStatement` to `instance.ast` check
* fix: spread `keys`
* fix: snapshots
* fix: use `compileOption.runes` if defined + add other tests
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: ensure undefined attributes are removed during hydration
Attributes that are `undefined` on the client should be removed during hydration,
even if their value hasn't changed compared to `prev_value`.
* Create plenty-wasps-sleep.md
* added test
* Update .changeset/plenty-wasps-sleep.md
---------
Co-authored-by: Rich Harris <hello@rich-harris.dev>
* fix: keep spread non-delegated event handlers up to date
#15961 introduced a regression where non-delegated events that were spread and updated were not getting updated. This fixes that by ensuring prev is actually updated to the most recent value
* fix
* fix: avoid shadowing a variable in dynamic components
* split component name and intermediate name
---------
Co-authored-by: 7nik <kifiranet@gmail.com>
* fix: ensure sources within nested effects still register correctly
When an effect creates another effect and a proxy property is read that wasn't before, the proxy will have logic where it creates the new signal in its original reaction context. But it did not have logic to correctly handle the `reaction_sources` array which prevents effects/deriveds rerunning when state created inside themselves is read and then changed inside them: Since `reaction_sources` wasn't take the reaction context into account, false positives could occur where nested effects would not register the sources as dependencies.
Fixes#15870
* oops forgot to push this
Make sure we track statically visible dependencies and untrack indirect dependencies
Fixes#14351
---------
Co-authored-by: 7nik <kifiranet@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Closes#16164
We can't set everywhere within with_parent otherwise if it's the first time we are reading a derived it could look like we are setting state in a derived (which you are not).
* Add failing test
* Add {@const} test case
* Fix the bug
* Add yet another test case
* Better fix
* Changeset
* simplify
* this appears to be unnecessary
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* remove code thatcan't be reached and would error if it could
* tidy up types, fix duplication
* this seems needless
* better naming
* tidy up
* reorder
* this code doesn't appear to do anything useful, and no tests fail without it
* unused
* WIP
* revert part of #14811. it makes no sense to show the initial value, it just makes things inconsistent with deriveds. personally i find it more confusing anyway
* explanatory comment on both sides
* make things a bit more self-explanatory
* simplify
* missing type
* only log UpdatedAt for dirty signals
* changeset
* lint
* Revert "unused"
This reverts commit a95b625800.
* complete revert
* ok it works now
* init
* improve symbol logging
* doh
* remove proxy path name when reassigned to a source
* try this
* fix
* oops
* fix
* "unown" proxy when in another source declaration
* fix
* tag proxy version
* proxy bindable props
* tag iterables used in destructuring
* add changeset, fix failing tests
* add comments, minor tweak
* lint
* somehow forgot to add support for class fields
* more class fields
* tag_source -> tag, since it applies to deriveds as well
* private class fields
* this condition is impossible
* explicit type narrowing lets us avoid coercion
* simplify
* unused
* tweak
* oops, never meant to commit that
* minor tweaks
* fix private field tagging, only get `declaration` once
* fix state declarations in constructors
* fix
* tag `svelte/reactivity`, `svelte/motion` sources in DEV
* try fixing lint
* fix intellisense formatting
* actually fix lint
* replace tag_if_necessary with conditional tagging
* avoid [[object Object]] in labels
* remove PROXY_REMOVE_PATH
* simplify a bit
* simplify
* tweak
* tweak implementation
* tweak implementation
* tweak implementation
* hoist
* tweak
* fix
* WIP (reduce number of with_parent calls, move towards possibility of combining tag and tag_proxy)
* DRY out
* tweak labels
* remove PROXY_REMOVE_PATH (#16126)
* remove PROXY_REMOVE_PATH
* simplify a bit
* simplify
* tweak
* tweak implementation
* tweak implementation
* tweak implementation
* hoist
* tweak
* fix
* WIP (reduce number of with_parent calls, move towards possibility of combining tag and tag_proxy)
* DRY out
* come on this was just lazy
* fix tests
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* Add `xmlns` attribute to HTMLAttributes type
The `xmlns` attribute is not only allowed on SVG elements, but on all HTML elements.
* move to DOMAttributes
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: use local mutable sources for props in legacy mode in case they are indirectly invalidated
* rename test
* add another test
* fix
* more conservative
* Update .changeset/orange-tips-pull.md
* skip work in runes mode
* remove comment
* revert whitespace change
* fix: transitions might render animated elements without animation styles applied for the duration of some rendering frames when they starts
* add changeset
* Apply suggestions from code review
---------
Co-authored-by: Rich Harris <hello@rich-harris.dev>
* feat: ssr select value
* fix: adjust test output
* minor aesthetic OCD tweak - the normalizer takes care of this
* fix: handle implicit values
* chore: implicit value test
* fix: deal with spreads on select AND option
* fix: spreading
* chore: add test for cross component
* fix: test
* chore: add failing test
* fix: runtime valueless option selection
* tweak
* fix: snapshots
* fix (options are erroneously being marked as valueless
* simplify a bit (pass callback direct to valueless_option)
* tweak
* tweak ("execute the child" is the sort of thing that gets you visited by the FBI)
* lint
* changeset
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: warn when using rest or identifier in custom elements without props option
* chore: update message
* tweak message
* update tests
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: make deriveds on the server lazy again
Fixes a regression introduced in #15820: deriveds need to be lazily called on the server, too, since they can close over variables only later defined
Fixes#15960
* fix: handle basic assignment of deriveds on the server
* fix: use `build_assignment_value` for deriveds assignments
* use once
* allow writing to public deriveds on server
---------
Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
* feat: attachments `fromAction` utility
* fix: typing of the utility
Co-authored-by: Aidan Bleser <117548273+ieedan@users.noreply.github.com>
* simplify implementation - create action first, then only create update/destroy effects if necessary
* add since
* regenerate
* remove FromAction interface
* overload
* fix: use typedef instead of exported interface
* get rid of the arg0, arg1 stuff
* oops
* god i hate overloads
* defer to the reference documentation
* damn ur weird typescript
* gah
---------
Co-authored-by: Aidan Bleser <117548273+ieedan@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: avoid auto-parenthesis for special keywords only `MediaQuery`
* chore: update changeset
* chore: i has english knowledge
* fix: fix media queries with commas
* feat: State declarations in class constructors
* feat: Analysis phase
* misc
* feat: client
* improvements
* feat: It is now at least backwards compatible. though the new stuff may still be wrong
* feat: It works I think?
* final cleanup??
* tests
* test for better types
* changeset
* rename functions (the function doesn't test call-expression-ness)
* small readability tweak
* failing test
* fix
* disallow computed state fields
* tweak message to better accommodate the case in which state is declared after a regular property
* failing test
* wildly confusing to have so many things called 'class analysis' - rename the transform-phrase ones to transformers
* missed a spot
* and another
* store analysis for use during transformation
* move code to where it is used
* do the analysis upfront, it's way simpler
* skip failing test for now
* simplify
* get rid of the class
* on second thoughts
* reduce indirection
* make analysis available at transform time
* WIP
* WIP
* WIP
* fix
* remove unused stuff
* revert snapshot tests
* unused
* note to self
* fix
* unused
* unused
* remove some unused stuff
* unused
* lint, tidy up
* reuse helper
* tweak
* simplify/DRY
* unused
* tweak
* unused
* more
* tweak
* tweak
* fix proxying logic
* tweak
* tweak
* adjust message to accommodate more cases
* unskip and fix test
* fix
* move
* revert unneeded drive-by change
* fix
* fix
* update docs
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: wrap array destructuring in spread to avoid iterator edge case
* spread at `tmp` declaration
* completely rewrite destructuring handling
* only wrap in iife if necessary
* oops
* minor style tweaks
* separate visitors
* tweak
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: don't spread away `$$slots` from `$props` is it's used
* beef up test
* fix
* Update .changeset/ten-plants-carry.md
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: more frequently update `bind:buffered` to actual value
* small tweak
---------
Co-authored-by: 7nik <kifiranet@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
* fix: warn on bidirectional control characters
* check evaluated values as well, fix minor issue
* fix failing tests
* lint
* fix
* shrink warning code
* use validator test suite rather than snapshot (which should be used sparingly as it creates more git noise)
* show ranges during parsing, and warn on all occurrences rather than just the first
* fix lint
* move check into Text visitor so it happens in expected order
* unused
* add svelte-ignore test
* ignore control characters following a svelte-ignore comment
* tweak message
* no need to test evaluations, since we are already testing the literals that they are composed of
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>