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

7383 Commits

Author SHA1 Message Date
Puru Vijay
9bee59cc4f
feat(site-2): TS in docs (#8452)
* Commit

* Push working type generation code

* Fix type gen script invocation

* Delete type-info.js

* Change build script

* Recreate package lock

* mkdir generated

* Add type references to some pages

* Add TS-able snippets to docs examples

* Fix some stuff

* Add types to individual functions

* Add to store page

* Refactor compile-types.js

* Move ts sourcefile stuff to compile-types

* Remove commented code

* Half attempt at export aliases

* Add

* Fix, add disclaimer for svelte/internal

* Disable /docs prerendering

* Remove internals page

* Remove redundant stuff

* Make search work with it

* Fix compile types logic

* Add file: comment,

* Add two-slash to docs pages

* Get type links working

* Remove console.log

* Add action module

* Fix actions logic

* Make compile-types logic more robust

* Bump site-kit

* Fix gitignore

* Use moduleResolution bundler

* Don't apply shiki-twoslash to auto generated code snippets from render

* Recreate package lock

* Make TSbpage undraft

* Fix svelte component types

* Remove console.log

* No more sveltekit

* Make regex smarter

* Update sites/svelte.dev/scripts/type-gen/compile-types.js

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* Rebuild package lock

* Remove commented out code

* Update deps

* Remove $$_attributes

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-05-11 14:18:57 +05:30
Puru Vijay
b9ea60cff4
fix(site-2): Remove marked warnings (#8574) 2023-05-10 08:24:10 +05:30
Dominik G
3bc791bcba
feat: add workflow to trigger ecosystem-ci from svelte PRs (#8571) 2023-05-09 14:01:56 -04:00
Puru Vijay
3b4ab35b4e
feat(site-2): Use entries (#8570)
* Push

* Image stuff

* Use entries

* Update deps

* Update kit
2023-05-09 21:39:07 +05:30
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
Puru Vijay
23d63c760a chore: Rebuild package.lock 2023-05-01 02:07:37 +05:30
Puru Vijay
12f4f6c457 Merge remote-tracking branch 'origin/master' into sites 2023-04-30 16:01:28 +05:30
Cas
c4261abfde
feat: document fullscreenElement and visibilityState bindings (#8507) 2023-04-28 10:15:58 +02:00
abirtley
a74caf1381
docs: Clarify when bind:group does not work (#8540)
Clarify documentation around when bind:group does and does not work. See issue #2308
2023-04-27 16:34:23 +02:00
xxkl1
b7359c8361
feat: add window bind devicePixelRatio support (#8534)
closes: #8285

add window bind devicePixelRatio support, change devicePixelRatio on window resize.

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-04-27 16:17:42 +02:00
Yuichiro Yamashita
0677d89fff
chore: fix CI on Node 20 (#8528) 2023-04-26 14:02:22 -07:00
Yuichiro Yamashita
384927dbf3
chore: TypeScript to JavaScript + JSDoc for tests (#8526) 2023-04-26 09:24:33 +02:00
Ben McCann
8ffd2112bc
chore: fix CI setup for unit tests (#8530) 2023-04-26 09:21:21 +02:00
Nguyen Tran
f064c39d5f
fix: relax no-redundant-roles implementation (#8536)
Deals with the no-redundant-roles part of #8529

There was an erroneous check which compares the element name with the current role. This fix brings no-redundant-roles closer to the original eslint-jsx implementation
2023-04-26 09:18:22 +02:00
Simon H
572f5372d4
breaking: deprecate SvelteComponentTyped, add generics to SvelteComponent (#8512)
Also add data- attribute to HTMLAttributes and use available TS interfaces
2023-04-24 22:03:33 +02:00
Puru Vijay
ce686c95d1
chore: Upgrade to Vite 4.3 (#8524) 2023-04-20 23:21:33 +05:30
Puru Vijay
1e9e843ca5 Merge 2023-04-20 23:01:04 +05:30
Tan Li Hau
df2f656557
feat: improve hydration, claim static html elements using innerHTML instead of deopt to claiming every nodes (#7426)
Related: #7341, #7226

For purely static HTML, instead of walking the node tree and claiming every node/text etc, hydration now uses the same innerHTML optimization technique for hydration compared to normal create. It uses a new data-svelte-h attribute which is added upon server side rendering containing a hash (computed at build time), and then comparing that hash in the client to ensure it's the same node. If the hash is the same, the whole child content is expected to be the same. If the hash is different, the whole child content is replaced with innerHTML.

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
2023-04-20 09:47:38 +02:00
Simon H
6ba2f72251
chore: Update CHANGELOG.md 2023-04-19 15:27:42 +02:00
xxkl1
32153e318d
fix: inline style value become undefined (#8517)
fixes #8462

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-04-19 15:21:24 +02:00
Ben McCann
6f8cdf3b0f
chore: run CI tests on Node 20 (#8519) 2023-04-19 10:23:14 +02:00
Ben McCann
d64e86a260
chore: switch from npm to pnpm (#8514) 2023-04-18 18:18:00 +02:00
Ben McCann
be645202d6
breaking: remove legacy package.json files (#8515) 2023-04-18 17:40:43 +02:00
Simon H
6bbae502f6
chore: Update CHANGELOG.md 2023-04-18 17:29:59 +02:00
gtmnayan
1964535adf
fix: interpolated style directive updates properly with spread (#8505)
fixes #8438
2023-04-18 17:27:43 +02:00
Rafi Strauss
f30faa702d
feat: improve duplicate key error for keyed each blocks (#8411)
Closes #8410

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-04-18 17:18:21 +02:00
James Scott-Brown
1770fc140a
docs: clarify statement about initial values for props (#8477) 2023-04-18 16:27:04 +02:00
Chris Kerr
236ffa833d breaking: update onMount type definition to prevent async function return (#8136)
---------

Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
2023-04-18 11:12:34 +02:00
gtmnayan
2f423475f7 chore: produce single bundle for runtime with multiple entrypoints (#8504)
* single runtime bundle

* formatting

* dedupe output options

* fix tests apparently

* skip writeBundle for cjs build

* revert quotes

* remove manualChunks

* some node16 module resolution compliance

* disable minifyInternalExports (doesn't really make sense for a library since users'
build step will do it again anyway)
2023-04-18 11:12:33 +02:00
Yuichiro Yamashita
5d4f3bd9e5 chore: remove Node 8 and 10 logic (#8503) 2023-04-18 11:12:33 +02:00
Nguyen Tran
68bf3e8143 feat: add a11y no-noninteractive-element-interactions (#8391)
#820
2023-04-18 11:12:33 +02:00