0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-24 16:29:46 +01:00
Commit Graph

7166 Commits

Author SHA1 Message Date
Ben McCann
ddfff4df8c
chore: convert to monorepo (#8644) 2023-05-26 16:17:13 -07:00
Simon Holthausen
1c581bc56f chore: changelog 2023-05-26 23:17:49 +02:00
Tan Li Hau
5c6d111065
Do not expose default slot let bindings to named slots (#6049)
* should not extend scope for across slots

* disallow named slots inheriting let: scope from default slots

* fix tests

* fix test

* fix

* add runtime tests

* rename test since it doesn't inherit anymore

* fix lint

* remove warnings

* add compile script

* document script

* improve warning

* fix test

* handle renames

* fix lint

* gather names from all parents instead of just the nearest

* remove unused import

* add reminder

---------

Co-authored-by: gtmnayan <gtmnayan@gmail.com>
2023-05-26 20:49:32 +02:00
Simon Holthausen
198dbcf714 chore: warn on passed format option 2023-05-26 19:37:21 +02:00
Nguyen Tran
a3f52f9348
fix: error when animation directive is on component (#8641)
Fixes #8639
2023-05-26 17:31:18 +02:00
Simon H
d9698551fb
feat: allow #each to iterate over iterables (#8626)
closes #7425
Uses a new ensure_array_like function to use Array.from in case the variable doesn't have a length property ('length' in 'some string' fails, therefore obj?.length). This ensures other places can stay unmodified. Using for (const x of y) constructs would require large changes across the each block code where it's uncertain that it would work for all cases since the array length is needed in various places.
2023-05-26 13:29:43 +02:00
Simon H
5dd707d4f5
feat: make transitions local by default (#8632)
To make them global, add the |global modifier
This is a breaking change
closes #6686
2023-05-26 13:26:03 +02:00
Aarni Koskela
a52106405d
fix(perf): use classList.toggle instead of add/remove (#8629)
`classList.toggle(..., flag)` has been a part of the DOM standard forever,
so better use it instead of possibly causing browser deopts by using dynamic attribute access.
The `!!` is required because an `undefined` flag means flipping the current state.

---------

Co-authored-by: Dominik G <dominik.goepel@gmx.de>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2023-05-26 13:24:35 +02:00
Simon H
734cc19846
feat: apply inert to outroing elements (#8628)
that way they are invisible to assistive technology and can't be interacted with, which makes sense since the element is already "dead" and only transitioning out at this point
closes #8445
2023-05-26 13:07:27 +02:00
Simon H
df361a2d6d
chore: warn about : in attributes and props (#8633)
closes #6823

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>
2023-05-26 13:04:50 +02:00
Simon Holthausen
5a4b48bb44 fix: type error 2023-05-25 18:26:20 +02:00
Simon H
a40af4dd11
chore: unbundled esm (#8613)
- remove esm bundle step
- introduce generated version.js because we can no longer use replace because we don't bundle esm
- remove register hook, cjs compiler output and cjs runtime
- keep umd compiler version for prettier/eslint/browser but without sourcemaps
- move devdependencies to dependencies where necessary
- various cleanup

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
2023-05-24 15:31:09 +02:00
gtmnayan
d658e7036e chore(test): fix path to compiler 2023-05-24 09:53:38 +05:45
Ben McCann
086f225ea9
chore: remove unused source-map-support depedency (#8622) 2023-05-23 11:13:47 -07:00
Ben McCann
5ed440ba50
chore: remove unused codemod-lazy-props.mjs (#8619) 2023-05-23 21:54:29 +05:45
gtmnayan
d6b02ed009
chore(test): use esm output for Svelte files (#8614) 2023-05-23 17:52:56 +02:00
gtmnayan
c2cec9597e
chore(test): move some error tests out of runtime (#8600) 2023-05-23 17:41:06 +02:00
Simon H
f223bc1c53
feat: change preprocessor ordering, allow attributes modification (#8618)
- change mapping order
- add support to modify attributes of script/style tags
- add source mapping tests to preprocessor tests
2023-05-23 17:39:54 +02:00
gtmnayan
7cec17c4cb fix flaky test 2023-05-22 20:06:22 +05:45
gtmnayan
3df9d8466f
chore: speed up test execution (#8598)
- shard runtime tests for better use of Vite's test parallelization
- merge custom element and other browser tests to run in one test suite and use esbuild in it
- on some setups only generate code output when test fails
2023-05-22 15:46:27 +02:00
gtmnayan
7e9af10dce
chore(test): link compiler directly from source (#8612) 2023-05-22 14:17:43 +02:00
Simon Holthausen
f09a942130 silence wrong tsconfig errors 2023-05-22 11:40:39 +02:00
Ben McCann
0467219701 chore: switch to released version of eslint-config 2023-05-20 20:32:35 -07:00
Ben McCann
0c99aa8904
chore: update eslint config (#8608)
Co-authored-by: gtmnayan <gtmnayan@gmail.com>
2023-05-19 20:21:54 -07:00
gtmnayan
61218d3c9c
chore(test): tidy up html equal (#8599) 2023-05-19 08:37:30 -07:00
Simon Holthausen
d35d9045f6 rename ts to js 2023-05-19 16:02:41 +02:00
S. Elliott Johnson
fd9d61a7b7
chore: TS to JSDoc Conversion (#8569)
---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-05-19 15:59:42 +02:00
gtmnayan
783bd9899e
chore: swap mocha with vitest (#8584)
Also swap out the require hook hacks with a less-hacky-but-still-somewhat-hacky loader for the Svelte files

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
2023-05-17 21:00:20 +02:00
gtmnayan
202d119e9a
chore: convert puppeteer tests to playwright (#8577) 2023-05-15 09:04:12 +05:45
Yuichiro Yamashita
b6a400a549
chore: add prettier (#8543) 2023-05-08 23:32:52 +02:00
Simon Holthausen
573acf9073 Merge branch 'master' into version-4 2023-05-08 17:34:58 +02:00
Dominik G
56df761f95
breaking: set verison to 4, remove engines.pnpm and bump engines.node to >=16 (#8566) 2023-05-08 16:30:24 +02:00
Ben McCann
5e486c19ad
docs: fix links in changelog 2023-05-08 07:09:29 -07:00
Conduitry
64b8c8b33c -> v3.59.1 2023-05-08 09:58:26 -04:00
Simon H
b6288ecdb7
fix: Handle dynamic values in a11y-autocomplete-valid (#8567)
Fixes #8562
Fixes #8565
2023-05-08 15:41:02 +02:00
Ben McCann
6fbb36d1fe
fix: improve setup of default export and remove svelte/ssr (#8516) 2023-05-05 17:33:08 +02:00
Simon Holthausen
418f4c2381 Merge branch 'master' into version-4 2023-05-05 17:13:45 +02:00
Conduitry
4537eb77bb -> v3.59.0 2023-05-05 10:06:22 -04:00
Vaibhav Rai
37c8bd7e67
fix: var scope should not extend outside the reactive block (#6800)
Fixes: #6794

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-05-05 15:32:27 +02:00
Christoph Rüßler
3f2f1e58df
feat: add a11y autocomplete-valid (#8520)
Part of #820

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-05-05 13:39:34 +02:00
Ben McCann
81cfab9142
Update CHANGELOG.md 2023-05-04 14:03:20 -07:00
Karl Erik Hofseth
afd38494b4
fix: provide a workaround for unsafe-inline CSP that also works in Safari (#7800)
This changes the inserted style element for transitions to initially include the string '/* empty */'. This allows you to work around requiring unsafe-inline CSP discussed in #6662 by adding a hash to your CSP:

'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc='

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-05-04 17:30:33 +02:00
Nguyen Tran
c0363966d3
fix: treat slots as if they don't exist when using CSS adjacent and general sibling combinators (#8422)
Fixes #8284.

The problem is that the <slot> element is treated as an actual element, and for this purpose, we have to treat them as if they don't exist. More specifically, we treat all slot fallback children nodes on the same level as the slot's non-slot siblings.
2023-05-04 15:48:05 +02:00
Robin Munn
19e163f59d
feat: pass update function to store setup callbacks (#6750)
Fixes #4880.
Fixes #6737.

This will be a breaking change for anyone who uses the StartStopNotifier
type in their / implements custom stores.

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-05-04 15:42:57 +02:00
Ramon Snir
ea73930132
fix: allow $store to be used with changing values including nullish values (#7947)
fixes #7555
breaking change: derived now throws an error if you pass falsy values

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-05-04 15:14:28 +02:00
Nguyen Tran
83679e9700
fix: array rest destructuring in markup (#8555)
Fixes #8554

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-05-04 13:59:33 +02:00
Nguyen Tran
17bf6db541
fix: Array rest property fix (#8553)
Fixes #8552
2023-05-04 13:19:10 +02:00
Simon H
e45a1e05a3
note of restructuring 2023-05-02 12:47:03 +02:00
Simon H
d083f8a3f2
feat: custom elements rework (#8457)
This is an overhaul of custom elements in Svelte. Instead of compiling to a custom element class, the Svelte component class is mostly preserved as-is. Instead a wrapper is introduced which wraps a Svelte component constructor and returns a HTML element constructor. This has a couple of advantages:

- component can be used both as a custom element as well as a regular component. This allows creating one wrapper custom element and using regular Svelte components inside. Fixes #3594, fixes #3128, fixes #4274, fixes #5486, fixes #3422, fixes #2969, helps with https://github.com/sveltejs/kit/issues/4502
- all components are compiled with injected styles (inlined through Javascript), fixes #4274
- the wrapper instantiates the component in `connectedCallback` and disconnects it in `disconnectedCallback` (but only after one tick, because this could be a element move). Mount/destroy works as expected inside, fixes #5989, fixes #8191
- the wrapper forwards `addEventListener` calls to `component.$on`, which allows to listen to custom events, fixes #3119, closes #4142 
- some things are hard to auto-configure, like attribute hyphen preferences or whether or not setting a property should reflect back to the attribute. This is why `<svelte:options customElement={..}>` can also take an object to modify such aspects. This option allows to specify whether setting a prop should be reflected back to the attribute (default `false`), what to use when converting the property to the attribute value and vice versa (through `type`, default `String`, or when `export let prop = false` then `Boolean`), and what the corresponding attribute for the property is (`attribute`, default lowercased prop name). These options are heavily inspired by lit: https://lit.dev/docs/components/properties. Closes #7638, fixes #5705
- adds a `shadowdom` option to control whether or not encapsulate the custom element. Closes #4330, closes #1748 

Breaking changes:
- Wrapped Svelte component now stays as a regular Svelte component (invokeing it like before with `new Component({ target: ..})` won't create a custom element). Its custom element constructor is now a static property named `element` on the class (`Component.element`) and should be regularly invoked through setting it in the html.
- The timing of mount/destroy/update is different. Mount/destroy/updating a prop all happen after a tick, so `shadowRoot.innerHTML` won't immediately reflect the change (Lit does this too). If you rely on it, you need to await a promise
2023-05-02 12:39:23 +02:00
Cas
c4261abfde
feat: document fullscreenElement and visibilityState bindings (#8507) 2023-04-28 10:15:58 +02:00