Skip to content

Commit b45fe80

Browse files
committed
Merge remote-tracking branch 'origin/master' into sites
2 parents ec8b7e8 + 33065aa commit b45fe80

File tree

129 files changed

+2563
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+2563
-374
lines changed

CHANGELOG.md

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,61 @@
22

33
## Unreleased
44

5+
* Add `bind:innerText` for `contenteditable` elements ([#3311](https://github.com/sveltejs/svelte/issues/3311))
6+
7+
## 3.57.0
8+
9+
* Add `<svelte:document>` ([#3310](https://github.com/sveltejs/svelte/issues/3310))
10+
* Add a11y `no-noninteractive-element-to-interactive-role` ([#8167](https://github.com/sveltejs/svelte/pull/8167))
11+
* Stop intro transition from triggering incorrectly ([#6152](https://github.com/sveltejs/svelte/issues/6152), [#6812](https://github.com/sveltejs/svelte/issues/6812))
12+
* Support computed and literal properties when destructuring objects in the template ([#6609](https://github.com/sveltejs/svelte/issues/6609))
13+
* Give `style:` directive precedence over `style=` attribute ([#7475](https://github.com/sveltejs/svelte/issues/7475))
14+
* Select `<option>` with `selected` attribute when initial state is `undefined` ([#8361](https://github.com/sveltejs/svelte/issues/8361))
15+
* Prevent derived store callbacks after store is unsubscribed from ([#8364](https://github.com/sveltejs/svelte/issues/8364))
16+
* Account for `bind:group` members being spread across multiple control flow blocks ([#8372](https://github.com/sveltejs/svelte/issues/8372))
17+
* Revert buggy reactive statement optimization ([#8374](https://github.com/sveltejs/svelte/issues/8374))
18+
* Support CSS units in the `fly` and `blur` transitions ([#7623](https://github.com/sveltejs/svelte/pull/7623))
19+
20+
## 3.56.0
21+
22+
* Add `|stopImmediatePropagation` event modifier ([#5085](https://github.com/sveltejs/svelte/issues/5085))
23+
* Add `axis` parameter to `slide` transition ([#6182](https://github.com/sveltejs/svelte/issues/6182))
24+
* Add `readonly` utility to convert `writable` store to readonly ([#6518](https://github.com/sveltejs/svelte/pull/6518))
25+
* Add `readyState` binding for media elements ([#6666](https://github.com/sveltejs/svelte/issues/6666))
26+
* Generate valid automatic component names when the filename contains only special characters ([#7143](https://github.com/sveltejs/svelte/issues/7143))
27+
* Add `naturalWidth` and `naturalHeight` bindings ([#7771](https://github.com/sveltejs/svelte/issues/7771))
28+
* Support `<!-- svelte-ignore ... -->` on components ([#8082](https://github.com/sveltejs/svelte/issues/8082))
529
* Add a11y warnings:
6-
* `aria-activedescendant-has-tabindex`: elements with `aria-activedescendant` need to have a `tabindex` ([#8172](https://github.com/sveltejs/svelte/pull/8172))
30+
* `aria-activedescendant-has-tabindex`: checks that elements with `aria-activedescendant` have a `tabindex` ([#8172](https://github.com/sveltejs/svelte/pull/8172))
731
* `role-supports-aria-props`: checks that the (implicit) element role supports the given aria attributes ([#8195](https://github.com/sveltejs/svelte/pull/8195))
8-
* Omit a11y warning on `<video>` tags with `aria-hidden="true"` ([#7874](https://github.com/sveltejs/svelte/issues/7874))
9-
* Omit a11y "no child content" warning on elements with `aria-label` ([#8299](https://github.com/sveltejs/svelte/pull/8299))
10-
* Omit a11y warnings on `<svelte:element>` ([#7939](https://github.com/sveltejs/svelte/issues/7939))
11-
* Make `noreferrer` warning less zealous ([#6289](https://github.com/sveltejs/svelte/issues/6289))
12-
* `trusted-types` CSP compatibility for Web Components ([#8134](https://github.com/sveltejs/svelte/issues/8134))
1332
* Add `data-sveltekit-replacestate` and `data-sveltekit-keepfocus` attribute typings ([#8281](https://github.com/sveltejs/svelte/issues/8281))
14-
* Don't throw when calling `unsubscribe` twice ([#8186](https://github.com/sveltejs/svelte/pull/8186))
15-
* Detect unused empty attribute CSS selectors ([#8042](https://github.com/sveltejs/svelte/issues/8042))
16-
* Simpler output for reactive statements if dependencies are all static ([#7942](https://github.com/sveltejs/svelte/pull/7942))
17-
* Flush remaining `afterUpdate` calls before `onDestroy` ([#7476](https://github.com/sveltejs/svelte/issues/7476))
18-
* Check value equality for `input` types `url` and `search` ([#7027](https://github.com/sveltejs/svelte/issues/7027))
19-
* Compute node dimensions directly before crossfading ([#4111](https://github.com/sveltejs/svelte/issues/4111))
20-
* Add `readonly` method to convert `writable` store to readonly ([#6518](https://github.com/sveltejs/svelte/pull/6518))
33+
* Compute node dimensions immediately before crossfading ([#4111](https://github.com/sveltejs/svelte/issues/4111))
34+
* Fix potential infinite invalidate loop with `<svelte:component>` ([#4129](https://github.com/sveltejs/svelte/issues/4129))
2135
* Ensure `bind:offsetHeight` updates initially ([#4233](https://github.com/sveltejs/svelte/issues/4233))
22-
* Better handling of `inert` attribute ([#7500](https://github.com/sveltejs/svelte/issues/7500))
23-
* Clear inputs when `bind:group` to `undefined` ([#8214](https://github.com/sveltejs/svelte/issues/8214))
24-
* Ensure nested arrays can change at the same time ([#8282](https://github.com/sveltejs/svelte/issues/8282))
25-
* Reduce use of template literals in SSR output for better performance ([#7539](https://github.com/sveltejs/svelte/pull/7539))
26-
* Allow assigning to property of const while destructuring ([#7964](https://github.com/sveltejs/svelte/issues/7964))
2736
* Don't set selected options if value is unbound or not passed ([#5644](https://github.com/sveltejs/svelte/issues/5644))
28-
* Ensure `<input>` value persists when swapping elements with spread attributes in an `#each` block ([#7578](https://github.com/sveltejs/svelte/issues/7578))
29-
* Select first enabled option by default when initial value is undefined ([#7041](https://github.com/sveltejs/svelte/issues/7041))
30-
* Fix race condition on `svelte:element` with transitions ([#7948](https://github.com/sveltejs/svelte/issues/7948))
31-
* Optimise `<svelte:element>` output code for static tag and static attribute ([#8161](https://github.com/sveltejs/svelte/pull/8161))
32-
* Decode html entities correctly ([#8026](https://github.com/sveltejs/svelte/issues/8026))
37+
* Validate component `:global()` selectors ([#6272](https://github.com/sveltejs/svelte/issues/6272))
38+
* Improve warnings:
39+
* Make `noreferrer` warning less zealous ([#6289](https://github.com/sveltejs/svelte/issues/6289))
40+
* Omit a11y warnings on `<video aria-hidden="true">` ([#7874](https://github.com/sveltejs/svelte/issues/7874))
41+
* Omit a11y warnings on `<svelte:element>` ([#7939](https://github.com/sveltejs/svelte/issues/7939))
42+
* Detect unused empty attribute CSS selectors ([#8042](https://github.com/sveltejs/svelte/issues/8042))
43+
* Omit "no child content" warning on elements with `aria-label` ([#8296](https://github.com/sveltejs/svelte/issues/8296))
44+
* Check value equality for `<input type="search">` and `<input type="url">` ([#7027](https://github.com/sveltejs/svelte/issues/7027))
45+
* Do not select a disabled `<option>` by default when the initial bound value is undefined ([#7041](https://github.com/sveltejs/svelte/issues/7041))
3346
* Handle `{@html}` tags inside `<template>` tags ([#7364](https://github.com/sveltejs/svelte/pull/7364))
34-
* Introduce parameter to allow for horizontal slide transition ([#6182](https://github.com/sveltejs/svelte/issues/6182))
35-
* Add `naturalWidth` and `naturalHeight` bindings ([#7771](https://github.com/sveltejs/svelte/issues/7771))
36-
* make `<!-- svelte-ignore ... -->` work above components ([#8082](https://github.com/sveltejs/svelte/issues/8082))
37-
* add global compound selector validation ([#6272](https://github.com/sveltejs/svelte/issues/6272))
38-
* add `stopImmediatePropagation` event modifier ([#5085](https://github.com/sveltejs/svelte/issues/5085))
39-
* add `readyState` binding for media elements ([#6666](https://github.com/sveltejs/svelte/issues/6666))
40-
* call `<svelte:component>` update to `this` only when it's dirty ([#4129](https://github.com/sveltejs/svelte/issues/4129))
41-
* support exclusively special characters in component filenames ([#7143](https://github.com/sveltejs/svelte/issues/7143))
47+
* Ensure `afterUpdate` is not called after `onDestroy` ([#7476](https://github.com/sveltejs/svelte/issues/7476))
48+
* Improve handling of `inert` attribute ([#7500](https://github.com/sveltejs/svelte/issues/7500))
49+
* Reduce use of template literals in SSR output for better performance ([#7539](https://github.com/sveltejs/svelte/pull/7539))
50+
* Ensure `<input>` value persists when swapping elements with spread attributes in an `{#each}` block ([#7578](https://github.com/sveltejs/svelte/issues/7578))
51+
* Simplify generated code for reactive statements if dependencies are all static ([#7942](https://github.com/sveltejs/svelte/pull/7942))
52+
* Fix race condition on `<svelte:element>` with transitions ([#7948](https://github.com/sveltejs/svelte/issues/7948))
53+
* Allow assigning to a property of a `const` when destructuring ([#7964](https://github.com/sveltejs/svelte/issues/7964))
54+
* Match browser behavior for decoding malformed HTML entities ([#8026](https://github.com/sveltejs/svelte/issues/8026))
55+
* Ensure `trusted-types` CSP compatibility for Web Components ([#8134](https://github.com/sveltejs/svelte/issues/8134))
56+
* Optimise `<svelte:element>` output code for static tag and static attribute ([#8161](https://github.com/sveltejs/svelte/pull/8161))
57+
* Don't throw when calling unsubscribing from a store twice ([#8186](https://github.com/sveltejs/svelte/pull/8186))
58+
* Clear inputs when `bind:group` value is set to `undefined` ([#8214](https://github.com/sveltejs/svelte/issues/8214))
59+
* Fix handling of nested arrays with keyed `{#each}` containing a non-keyed `{#each}` ([#8282](https://github.com/sveltejs/svelte/issues/8282))
4260

4361
## 3.55.1
4462

elements/index.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,13 +534,17 @@ export interface HTMLAttributes<T extends EventTarget> extends AriaAttributes, D
534534
is?: string | undefined | null;
535535

536536
/**
537-
* Elements with the contenteditable attribute support innerHTML and textContent bindings.
537+
* Elements with the contenteditable attribute support `innerHTML`, `textContent` and `innerText` bindings.
538538
*/
539539
'bind:innerHTML'?: string | undefined | null;
540540
/**
541-
* Elements with the contenteditable attribute support innerHTML and textContent bindings.
541+
* Elements with the contenteditable attribute support `innerHTML`, `textContent` and `innerText` bindings.
542542
*/
543543
'bind:textContent'?: string | undefined | null;
544+
/**
545+
* Elements with the contenteditable attribute support `innerHTML`, `textContent` and `innerText` bindings.
546+
*/
547+
'bind:innerText'?: string | undefined | null;
544548

545549
// SvelteKit
546550
'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;

generate-type-definitions.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
const { execSync } = require('child_process');
44
const { readFileSync, writeFileSync } = require('fs');
55

6-
try {
7-
execSync('tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly');
8-
} catch (err) {
9-
console.error(err.stderr.toString());
10-
throw err;
11-
}
6+
execSync('tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly', { stdio: 'inherit' });
127
// We need to add these types to the .d.ts files here because if we add them before building, the build will fail,
138
// because the TS->JS transformation doesn't know these exports are types and produces code that fails at runtime.
149
// We can't use `export type` syntax either because the TS version we're on doesn't have this feature yet.

package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte",
3-
"version": "3.55.1",
3+
"version": "3.57.0",
44
"description": "Cybernetically enhanced web apps",
55
"module": "index.mjs",
66
"main": "index",
@@ -129,14 +129,14 @@
129129
"@rollup/plugin-typescript": "^2.0.1",
130130
"@rollup/plugin-virtual": "^3.0.1",
131131
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.8.0",
132-
"@types/aria-query": "^5.0.0",
132+
"@types/aria-query": "^5.0.1",
133133
"@types/mocha": "^7.0.0",
134134
"@types/node": "^8.10.53",
135135
"@typescript-eslint/eslint-plugin": "^5.29.0",
136136
"@typescript-eslint/parser": "^5.29.0",
137137
"acorn": "^8.8.1",
138138
"agadoo": "^3.0.0",
139-
"aria-query": "^5.1.1",
139+
"aria-query": "^5.1.3",
140140
"axobject-query": "^3.1.1",
141141
"code-red": "^1.0.0",
142142
"css-tree": "^2.3.1",

site/content/docs/03-template-syntax.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,12 @@ When the value of an `<option>` matches its text content, the attribute can be o
691691

692692
---
693693

694-
Elements with the `contenteditable` attribute support `innerHTML` and `textContent` bindings.
694+
Elements with the `contenteditable` attribute support the following bindings:
695+
- [`innerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)
696+
- [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText)
697+
- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
698+
699+
There are slight differences between each of these, read more about them [here](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#Differences_from_innerText).
695700

696701
```sv
697702
<div contenteditable="true" bind:innerHTML={html}></div>
@@ -1746,6 +1751,25 @@ All except `scrollX` and `scrollY` are readonly.
17461751

17471752
> Note that the page will not be scrolled to the initial value to avoid accessibility issues. Only subsequent changes to the bound variable of `scrollX` and `scrollY` will cause scrolling. However, if the scrolling behaviour is desired, call `scrollTo()` in `onMount()`.
17481753
1754+
### `<svelte:document>`
1755+
1756+
```sv
1757+
<svelte:document on:event={handler}/>
1758+
```
1759+
1760+
---
1761+
1762+
Similarly to `<svelte:window>`, this element allows you to add listeners to events on `document`, such as `visibilitychange`, which don't fire on `window`. It also lets you use [actions](/docs#template-syntax-element-directives-use-action) on `document`.
1763+
1764+
As with `<svelte:window>`, this element may only appear the top level of your component and must never be inside a block or element.
1765+
1766+
```sv
1767+
<svelte:document
1768+
on:visibilitychange={handleVisibilityChange}
1769+
use:someAction
1770+
/>
1771+
```
1772+
17491773
### `<svelte:body>`
17501774

17511775
```sv
@@ -1756,7 +1780,7 @@ All except `scrollX` and `scrollY` are readonly.
17561780

17571781
Similarly to `<svelte:window>`, this element allows you to add listeners to events on `document.body`, such as `mouseenter` and `mouseleave`, which don't fire on `window`. It also lets you use [actions](/docs#template-syntax-element-directives-use-action) on the `<body>` element.
17581782

1759-
As with `<svelte:window>`, this element may only appear the top level of your component and must never be inside a block or element.
1783+
As with `<svelte:window>` and `<svelte:document>`, this element may only appear the top level of your component and must never be inside a block or element.
17601784

17611785
```sv
17621786
<svelte:body
@@ -1777,7 +1801,7 @@ As with `<svelte:window>`, this element may only appear the top level of your co
17771801

17781802
This element makes it possible to insert elements into `document.head`. During server-side rendering, `head` content is exposed separately to the main `html` content.
17791803

1780-
As with `<svelte:window>` and `<svelte:body>`, this element may only appear at the top level of your component and must never be inside a block or element.
1804+
As with `<svelte:window>`, `<svelte:document>` and `<svelte:body>`, this element may only appear at the top level of your component and must never be inside a block or element.
17811805

17821806
```sv
17831807
<svelte:head>

site/content/docs/04-run-time.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ Animates a `blur` filter alongside an element's opacity.
693693
* `duration` (`number`, default 400) — milliseconds the transition lasts
694694
* `easing` (`function`, default `cubicInOut`) — an [easing function](/docs#run-time-svelte-easing)
695695
* `opacity` (`number`, default 0) - the opacity value to animate out to and in from
696-
* `amount` (`number`, default 5) - the size of the blur in pixels
696+
* `amount` (`number | string`, default 5) - the size of the blur. Supports css units (for example: `"4rem"`). The default unit is `px`
697697

698698
```sv
699699
<script>
@@ -728,10 +728,11 @@ Animates the x and y positions and the opacity of an element. `in` transitions a
728728
* `delay` (`number`, default 0) — milliseconds before starting
729729
* `duration` (`number`, default 400) — milliseconds the transition lasts
730730
* `easing` (`function`, default `cubicOut`) — an [easing function](/docs#run-time-svelte-easing)
731-
* `x` (`number`, default 0) - the x offset to animate out to and in from
732-
* `y` (`number`, default 0) - the y offset to animate out to and in from
731+
* `x` (`number | string`, default 0) - the x offset to animate out to and in from
732+
* `y` (`number | string`, default 0) - the y offset to animate out to and in from
733733
* `opacity` (`number`, default 0) - the opacity value to animate out to and in from
734734

735+
x and y use `px` by default but support css units, for example `x: '100vw'` or `y: '50%'`.
735736
You can see the `fly` transition in action in the [transition tutorial](/tutorial/adding-parameters-to-transitions).
736737

737738
```sv

0 commit comments

Comments
 (0)