0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-21 11:28:58 +01:00
Commit Graph

1514 Commits

Author SHA1 Message Date
github-actions[bot]
6e391fce59
Version Packages (#14380)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-20 17:14:43 -05:00
Paolo Ricciuti
520055cf5c
fix: always use set for private identifiers (#14378)
* fix: always use set for private identifiers

* we can simplify this further - no need to check the value was transformed, since the outcome of not returning immediately is the same but with extra steps

* add explanatory note

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-20 15:03:05 -05:00
github-actions[bot]
85ec6fa276
Version Packages (#14377)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-20 19:54:56 +00:00
Dominic Gannaway
9d12fd1a01
chore: remove template expression inlining (#14374)
* chore: remove template expression inlining

* missed some

* fix

* feedback

* feedback

* Update packages/svelte/src/compiler/phases/3-transform/client/utils.js

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

* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

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

* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

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

* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js

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

* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js

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

* Update packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js

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

* fix

* Update .changeset/calm-mice-perform.md

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

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-20 17:46:53 +00:00
github-actions[bot]
f616c22053
Version Packages (#14366)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-20 10:30:25 -05:00
Dominic Gannaway
811c8d32eb
fix: correctly handle srcObject attribute on video elements (#14369)
* fix: correctly handle srcObject attribute on video elements

* remove side-effect

* side-effects agin

* side-effects agin

* better fix
2024-11-20 15:19:17 +00:00
Frédéric Crozatier
7bd1cdf427
feat: add content-visibility: auto state change event (#14373)
* add contentvisibilityautostatechange event

* changeset

* Update .changeset/kind-horses-lay.md

* Update .changeset/kind-horses-lay.md

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>
2024-11-20 10:14:56 -05:00
Simon H
4dfa0e31fe
fix: tighten up export default validation (#14368)
through #14363 I noticed our `export default` validation wasn't quite right:
- missed checking for derived/state exports
- the "cannot have a default export" error was only thrown if you did `export default` from the instance script, but it shouldn't matter from which component part you export it; it's never ok
2024-11-20 10:14:33 -05:00
Paolo Ricciuti
32a1453805
fix: include method definitions in class private fields (#14365)
* fix: include method definitions in class private fields

* Update packages/svelte/tests/runtime-runes/samples/class-disabinguate-private-method-definition/_config.js

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-19 22:38:36 +01:00
github-actions[bot]
53cc60085e
Version Packages (#14362)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-19 14:05:50 -05:00
Dominic Gannaway
747d40833b
fix: ensure is_pure takes into account runes (#14333)
* fix: ensure is_pure takes into account runes

* feedback
2024-11-19 14:04:40 -05:00
Dominic Gannaway
741106879b
fix: ensure internal cloning can work circular values (#14347)
* fix: ensure internal cloning can work circular values

* better fixc

* 'original' feels slightly clearer than 'json_instance'

* use an optional parameter, so we can omit it in most cases

* Update packages/svelte/src/internal/shared/clone.js

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

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-19 13:11:30 -05:00
Dominic Gannaway
6e8267f462
fix: correctly update dynamic member expressions (#14359)
* fix: output template effect for svg xlink attribute

* mark subtree dynamic in MemberExpression visitor

* don't treat attributes and text nodes differently

* Update .changeset/serious-spiders-bake.md

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-19 11:48:30 -05:00
Santiago Cézar
012166ec3c
fix: convert input value to number on hydration (#14349)
* convert input value to number on hydration

* add test

* changeset

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-19 11:48:01 -05:00
github-actions[bot]
b145035a00
Version Packages (#14348)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-18 15:23:13 +00:00
Dominic Gannaway
1c454c236e
fix: ensure dynamic call expressions correctly generate output (#14345) 2024-11-18 14:24:55 +00:00
github-actions[bot]
396ea2ef37
Version Packages (#14328)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-16 17:13:21 +00:00
Dominic Gannaway
3a69b4c415
fix: ensure inline object literals are correctly serialised (#14325)
* fix: ensure inline object literals are correctly serialised

* Apply suggestions from code review

* address feedback

* address feedback

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-16 17:10:45 +00:00
github-actions[bot]
95ab85fad7
Version Packages (#14304)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-16 00:07:08 +00:00
Simon H
94471ca38e
fix: avoid relying on Node specifics within compiler (#14314)
fixes #14294
2024-11-15 23:50:47 +01:00
Paolo Ricciuti
1f0700f5c5
fix: mark subtree dynamic for img with loading attribute (#14317)
* fix: mark subtree dynamic for img with loading attribute

* chore: unify conditions

* chore: change conditions
2024-11-15 23:40:08 +01:00
Simon H
efc65d4e0c
fix: mark pseudo classes nested inside :not as used (#14303)
fixes the css bug part of #14299
2024-11-15 14:33:10 +01:00
Simon H
e379319626
fix: ensure props passed to components via mount are updateable (#14210)
The detection whether or not props are writable is buggy; it doesn't take into account the case when instantiating components via `mount` or legacy-`new`

Fixes #14161

This posed an interesting question: What to do about (non-)`bind:`able properties? The answer I arrived on was: Treat it as if everything that _can_ be bound _is_ treated as bound, and everything else as readonly. In other words, if you're reassigning a prop, it will diverge from the passed in props if it's not bindable or not set in the parent, otherwise it will mutate the passed in props. I think that makes the most sense, given that you can't control this behavior from the outside.
2024-11-14 22:47:18 +01:00
Dominic Gannaway
7fd3774015
fix: disallow invalid attributes for <svelte:window> and <svelte:document> (#14228) 2024-11-14 20:22:35 +00:00
github-actions[bot]
312dd51acc
Version Packages (#14302)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-14 12:56:16 -05:00
Paolo Ricciuti
8a8e6f70e8
fix: avoid marking subtree as dynamic for inlined attributes (#14269)
* fix: avoid marking subtree as dynamic for inlined attributes

* fix: i'm a silly goose 🪿

* chore: refactor `is_inlinable_expression` to accept the attribute

* feat: inline dom expression too

* fix: special case literals with `"` in it and fix standalone case

* chore: simpler check first

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

* typo

* add more stuff to snapshot test

* simplify/speedup by doing the work once, during analysis

* simplify

* simplify - no reason these cases should prevent inlining

* return template

* name is incorrect

* name is incorrect

* fix escaping

* no longer necessary

* remove obsolete description

* better concatenation

* fix test

* do the work at runtime

* fix another thing

* tidy

* tidy up

* simplify

* simplify

* fix

* note to self

* another

* simplify

* more accurate name

* simplify

* simplify

* explain what is happening

* tidy up

* simplify

* better inlining

* update test

* colocate some code

* better inlining

* use attribute metadata

* Update packages/svelte/src/compiler/phases/2-analyze/visitors/Identifier.js

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

* Apply suggestions from code review

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2024-11-14 12:48:11 -05:00
github-actions[bot]
6a7146bee7
Version Packages (#14287)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-14 12:47:14 -05:00
Simon H
320ebd24d8
fix: bump is-reference dependency to fix import.meta bug (#14286)
closes #14234
2024-11-14 12:54:27 +01:00
Simon H
45fa678242
fix: account for :has(...) as part of :root (#14229)
We previously marked all `:root` selectors as global-like, which excempted them from further analysis. This causes problems:
- things like `:not(...)` are never visited and therefore never marked as used -> we gotta do that directly when coming across this
- `:has(...)` was never visited, too. Just marking it as used is not enough though, because we might need to scope its contents

Therefore the logic is enhanced to account for these special cases. Fixes #14118

While fixing this I cleaned up some inconsistencies in what we mark as global. This simplified code and fixed some adjacent bugs, which conindicentally also fixes #14189
2024-11-14 11:24:02 +01:00
Rich Harris
ac9b7de058
fix: use strict equality for key block comparisons in runes mode (#14285)
fixes #14283
2024-11-13 09:24:56 +01:00
github-actions[bot]
f5a7d49216
Version Packages (#14274)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-12 17:59:34 -05:00
Torsten Dittmann
033061842d
fix: named slots with reserved keywords during migration (#14278)
Fixes named slots with a reserved keyword not working anymore after migration. Re-uses the @migration-task logic for invalid identifiers.

Fixes #14277
2024-11-12 18:13:05 +01:00
Simon H
36ece1c381
fix: don't wrap pseudo classes inside :global(...) with another :global(...) (#14267)
fixes #14088
2024-11-12 14:46:26 +01:00
github-actions[bot]
4a85c4157d
Version Packages (#14262)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-11 10:07:09 -08:00
Paolo Ricciuti
0fa43e216d
fix: consider static attributes that are inlined in the template (#14249)
* fix: consider static attributes that are inlined in the template

* fix: use `is_inlinable_expression`

* fix: move check for inlinable expression as last

* fix: simplify and correct

* chore: accept single node in `is_inlinable_expression`

* chore: update comment

* chore: add snapshots for non static nodes
2024-11-11 14:55:04 +01:00
github-actions[bot]
832499fee8
Version Packages (#14251)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-11 10:36:28 +01:00
Paolo Ricciuti
653f4accbd
fix: migration script messing with attributes (#14260) 2024-11-11 10:28:56 +01:00
Paolo Ricciuti
ae9f53a3bd
fix: account for mutations in script module in ownership check (#14253) 2024-11-10 20:56:00 +01:00
Paolo Ricciuti
7bc94b9984
fix: do not treat reassigned synthetic binds as state in runes mode (#14236)
* fix: do not treat reassigned synthetic binds as state in runes mode

* fix: avoid calling checks if we are in runes mode
2024-11-10 20:55:39 +01:00
Paolo Ricciuti
d207666ec3
fix: consider img with loading attribute not static (#14237)
* fix: consider img with loading attribute not static

* chore: add comment for `is_static_element`

* chore: better comment

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

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
2024-11-10 17:48:10 +01:00
github-actions[bot]
4bcd01b994
Version Packages (#14207)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-08 11:48:03 -08:00
Paolo Ricciuti
1060bea6e1
fix: consider valueOf in the reactive methods of SvelteDate (#14227) 2024-11-08 15:30:38 +01:00
Paolo Ricciuti
f0c2d4c698
fix: account for shadowing children slot during migration (#14224)
Fixes #14171
2024-11-08 14:14:56 +01:00
Simon H
31e6bbb646
fix: add lang="ts" attribute during migration if needed (#14222)
* fix: add `lang="ts"` attribute during migration if needed

fixes #14219

* fix
2024-11-08 12:25:03 +01:00
Paolo Ricciuti
438de04fb2
fix: add migration task when there's a variable named that would conflict with a rune (#14216)
Closes #14215
2024-11-08 11:18:50 +01:00
Simon H
870745fc53
fix: handle sibling combinators within :has (#14213)
We didn't collect sibling elements of a given element to then check the `:has` selectors. This adds the logic for that. Fixes #14072
2024-11-08 10:53:43 +01:00
Paolo Ricciuti
53af138d58
fix: read index as a source in legacy keyed each block (#14208)
Fixes #14203
2024-11-07 21:18:45 +01:00
Paolo Ricciuti
ea0d80e195
fix: consider variables with synthetic store sub as state (#14195)
Fixes #14183
2024-11-07 15:33:02 +01:00
Simon H
1eed645919
fix: ensure explicit nesting selector is always applied (#14193)
Previously, we were applying an explicit nesting selector to the start of a relative selector chain only when starting the traversal. Prepending the selector is important because it ensures we traverse upwards to the parent rule when the current selectors all matched and there's still more to do. But we forgot to do the prepend for parent rules, which meant that if we were nested two levels deep, we would stop too early. This fix ensures we prepend in that case, too.

Fixes #14178
2024-11-07 15:30:06 +01:00
github-actions[bot]
d7caf0833c
Version Packages (#14184)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-07 09:00:26 +00:00