Merge branch 'silence-warnings' of https://github.com/dummdidumm/svelte into silence-warnings

pull/6504/head
Simon Holthausen 5 years ago
commit 196245b822

@ -2,18 +2,19 @@
## Unreleased ## Unreleased
* Expose `svelte/ssr` which exported lifecycle methods as noop ([#6416](https://github.com/sveltejs/svelte/pull/6416)) * Expose `svelte/ssr` which exports lifecycle methods as no-ops ([#6416](https://github.com/sveltejs/svelte/pull/6416))
* Add `trusted` event modifier ([#6137](https://github.com/sveltejs/svelte/issues/6137)) * Add `|trusted` event modifier ([#6137](https://github.com/sveltejs/svelte/issues/6137))
* Add `varsReport` compiler option ([#6192](https://github.com/sveltejs/svelte/pull/6192)) * Add `varsReport` compiler option to include all variables reference in the component in the `variables` report ([#6192](https://github.com/sveltejs/svelte/pull/6192))
* Throw compiler error when passing empty directive names ([#6299](https://github.com/sveltejs/svelte/issues/6299)) * Throw compiler error when passing empty directive names ([#6299](https://github.com/sveltejs/svelte/issues/6299))
* Update `periscopic` to allow for export of anonymous function or class ([#3275](https://github.com/sveltejs/svelte/issues/3275)) * Throw proper error for `export default function() {}` and `export default class {}` rather than crashing the compiler ([#3275](https://github.com/sveltejs/svelte/issues/3275))
* Fix ordering of elements in keyed `{#each}` ([#6445](https://github.com/sveltejs/svelte/pull/6445))
* Fix `preserveComments` in SSR mode ([#4730](https://github.com/sveltejs/svelte/issues/4730)) * Fix `preserveComments` in SSR mode ([#4730](https://github.com/sveltejs/svelte/issues/4730))
* Fix compiler error when using `:where()` inside `:global()` ([#6434](https://github.com/sveltejs/svelte/issues/6434)) * Fix compiler error when using `:where()` inside `:global()` ([#6434](https://github.com/sveltejs/svelte/issues/6434))
* Fix erroneous `unknown prop` warning when using slot on a component ([#6065](https://github.com/sveltejs/svelte/pull/6065)) * Fix erroneous `unknown prop` warning when using slot on a component ([#6065](https://github.com/sveltejs/svelte/pull/6065))
* Fix :global() with pseudo element should be considered as global ([#6470](https://github.com/sveltejs/svelte/pull/6470)) * Fix `:global()` with pseudo element not being seen as global ([#6470](https://github.com/sveltejs/svelte/pull/6470))
* New a11y warning `a11y-mouse-events-have-key-events` which checks that `mouseover`/`mouseout` are accompanied by `focus`/`blur` event handlers ([#5938](https://github.com/sveltejs/svelte/pull/5938)) * Add a11y warning `a11y-mouse-events-have-key-events` which checks that `mouseover`/`mouseout` are accompanied by `focus`/`blur` event handlers ([#5938](https://github.com/sveltejs/svelte/pull/5938))
* Remove deprecated `a11y-no-onchange warning` ([#6457](https://github.com/sveltejs/svelte/issues/6457)) * Remove deprecated a11y warning `a11y-no-onchange warning` ([#6457](https://github.com/sveltejs/svelte/issues/6457))
* Remove `a11y-media-has-caption` from `audio` elements ([#6054](https://github.com/sveltejs/svelte/issues/6054)) * Stop checking `a11y-media-has-caption` a11y warning on `<audio>` elements ([#6054](https://github.com/sveltejs/svelte/issues/6054))
* Make it possible to silence more warnings ([#5954](https://github.com/sveltejs/svelte/issues/5954)) * Make it possible to silence more warnings ([#5954](https://github.com/sveltejs/svelte/issues/5954))
## 3.38.3 ## 3.38.3

@ -24,7 +24,7 @@ All three sections — script, styles and markup — are optional.
A `<script>` block contains JavaScript that runs when a component instance is created. Variables declared (or imported) at the top level are 'visible' from the component's markup. There are four additional rules: A `<script>` block contains JavaScript that runs when a component instance is created. Variables declared (or imported) at the top level are 'visible' from the component's markup. There are four additional rules:
##### 1. `export` creates a component prop #### 1. `export` creates a component prop
--- ---
@ -87,7 +87,7 @@ You can use reserved words as prop names.
</script> </script>
``` ```
##### 2. Assignments are 'reactive' #### 2. Assignments are 'reactive'
--- ---
@ -109,7 +109,7 @@ Because Svelte's reactivity is based on assignments, using array methods like `.
</script> </script>
``` ```
##### 3. `$:` marks a statement as reactive #### 3. `$:` marks a statement as reactive
--- ---
@ -171,7 +171,7 @@ If a statement consists entirely of an assignment to an undeclared variable, Sve
</script> </script>
``` ```
##### 4. Prefix stores with `$` to access their values #### 4. Prefix stores with `$` to access their values
--- ---

@ -44,8 +44,8 @@ The following options can be passed to the compiler. None are required:
| `filename` | string | `null` | `filename` | string | `null`
| `name` | string | `"Component"` | `name` | string | `"Component"`
| `format` | `"esm"` or `"cjs"` | `"esm"` | `format` | `"esm"` or `"cjs"` | `"esm"`
| `generate` | `"dom"` or `"ssr" or false` | `"dom"` | `generate` | `"dom"` or `"ssr"` or `false` | `"dom"`
| `varsReport` | `"strict"` or `"full" or false` | `"strict"` | `varsReport` | `"strict"` or `"full"` or `false` | `"strict"`
| `dev` | boolean | `false` | `dev` | boolean | `false`
| `immutable` | boolean | `false` | `immutable` | boolean | `false`
| `hydratable` | boolean | `false` | `hydratable` | boolean | `false`

@ -0,0 +1,19 @@
<script>
import { fly } from 'svelte/transition';
let number = 0;
</script>
<div>
The number is:
<span style="display: inline-block" in:fly={{ y: -20 }}>
{number}
</span>
</div>
<br />
<button
on:click={() => {
number += 1;
}}>
Increment
</button>

@ -0,0 +1,21 @@
<script>
import { fly } from 'svelte/transition';
let number = 0;
</script>
<div>
The number is:
{#key number}
<span style="display: inline-block" in:fly={{ y: -20 }}>
{number}
</span>
{/key}
</div>
<br />
<button
on:click={() => {
number += 1;
}}>
Increment
</button>

@ -0,0 +1,16 @@
---
title: Key blocks
---
Key blocks destroy and recreate their contents when the value of an expression changes.
```html
{#key value}
<div transition:fade>{value}</div>
{/key}
```
This is useful if you want an element to play its transition whenever a value changes instead of only when the element enters or leaves the DOM.
Wrap the `<span>` element in a key block depending on `number`. This will make the
animation play whenever you press the increment button.

@ -1,6 +1,23 @@
<script context="module"> <script context="module">
const title_replacements = {
'1_export_creates_a_component_prop': 'props',
'2_Assignments_are_reactive': 'reactive assignments',
'3_$_marks_a_statement_as_reactive': 'reactive statements ($:)',
'4_Prefix_stores_with_$_to_access_their_values': 'accessing stores ($)'
};
export async function preload() { export async function preload() {
const sections = await this.fetch(`docs.json`).then(r => r.json()); const sections = await this.fetch(`docs.json`).then(r => r.json());
for (const section of sections) {
for (const subsection of section.subsections) {
const { slug } = subsection;
// show abbreviated title in the table of contents
if (slug in title_replacements) {
subsection.title = title_replacements[slug];
}
}
}
return { sections }; return { sections };
} }
</script> </script>

@ -132,7 +132,7 @@ export function append(target: NodeEx, node: NodeEx) {
export function insert(target: NodeEx, node: NodeEx, anchor?: NodeEx) { export function insert(target: NodeEx, node: NodeEx, anchor?: NodeEx) {
if (is_hydrating && !anchor) { if (is_hydrating && !anchor) {
append(target, node); append(target, node);
} else if (node.parentNode !== target || (anchor && node.nextSibling !== anchor)) { } else if (node.parentNode !== target || node.nextSibling != anchor) {
target.insertBefore(node, anchor || null); target.insertBefore(node, anchor || null);
} }
} }

@ -0,0 +1,13 @@
export default {
props: {
titles: [{ name: 'a' }, { name: 'b' }, { name: 'c' }]
},
html: '<div class="container"><p>a</p><p>b</p><p>c</p></div>',
test({ assert, component, target }) {
component.titles = [{ name: 'b' }, { name: 'c' }, { name: 'a' }];
assert.htmlEqual(target.innerHTML, '<div class="container"><p>b</p><p>c</p><p>a</p></div>');
}
};

@ -0,0 +1,8 @@
<script>
export let titles;
</script>
<div class="container">
{#each titles as title (title.name)}
<p>{title.name}</p>
{/each}
</div>
Loading…
Cancel
Save