mirror of https://github.com/sveltejs/svelte
commit
910043079a
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: apply keyed validation only for keyed each
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: warn on references to mutated non-state in template
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: adjust mount and createRoot types
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: prevent reactive snippet from reinitializing unnecessarily
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: omit this bind this arg if we know it's not a signal
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: take event attributes into account when checking a11y
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': minor
|
||||
---
|
||||
|
||||
feat: support type definition in {@const}
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: ignore href attributes when hydrating
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
chore: bump esrap
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: remove constructor overload
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: improve each block index handling
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: type-level back-compat for default slot and children prop
|
@ -0,0 +1 @@
|
||||
<!--ssr:0--><a href="/bar">foo</a><!--ssr:0-->
|
@ -0,0 +1,7 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test(assert, target) {
|
||||
assert.equal(target.querySelector('a')?.getAttribute('href'), '/bar');
|
||||
}
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let browser = typeof window !== 'undefined';
|
||||
</script>
|
||||
|
||||
<a href={browser ? '/foo': '/bar'}>foo</a>
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<div>0</div><div>1</div>'
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
{#each ["a", "b"] as result, i (i)}
|
||||
<div>{i}</div>
|
||||
{/each}
|
@ -0,0 +1,7 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target, component }) {
|
||||
assert.equal(target.querySelector('img'), component.items[0].img);
|
||||
}
|
||||
});
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
let { items = [{ src: 'https://ds' }] } = $props();
|
||||
</script>
|
||||
|
||||
{#each items as item, i}
|
||||
<img
|
||||
src={item.src}
|
||||
bind:this={items[i].img}
|
||||
alt="slider{i}"
|
||||
/>
|
||||
{/each}
|
@ -0,0 +1,62 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `
|
||||
<p>snippet: 0</p>
|
||||
<button>toggle</button>
|
||||
<button>increase count</button>
|
||||
`,
|
||||
props: {
|
||||
get log() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
async test({ assert, target, component }) {
|
||||
const [toggle, increment] = target.querySelectorAll('button');
|
||||
|
||||
await increment?.click();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<p>snippet: 1</p>
|
||||
<button>toggle</button>
|
||||
<button>increase count</button>
|
||||
`
|
||||
);
|
||||
assert.deepEqual(component.log, []);
|
||||
|
||||
await toggle?.click();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<p>component: 1</p>
|
||||
<button>toggle</button>
|
||||
<button>increase count</button>
|
||||
`
|
||||
);
|
||||
assert.deepEqual(component.log, [1]);
|
||||
|
||||
await increment?.click();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<p>component: 2</p>
|
||||
<button>toggle</button>
|
||||
<button>increase count</button>
|
||||
`
|
||||
);
|
||||
assert.deepEqual(component.log, [1]);
|
||||
|
||||
await toggle?.click();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<p>snippet: 2</p>
|
||||
<button>toggle</button>
|
||||
<button>increase count</button>
|
||||
`
|
||||
);
|
||||
assert.deepEqual(component.log, [1]);
|
||||
}
|
||||
});
|
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let { count, log } = $props();
|
||||
log.push(count);
|
||||
</script>
|
||||
|
||||
<p>component: {count}</p>
|
@ -0,0 +1,22 @@
|
||||
<script>
|
||||
import Inner from "./inner.svelte";
|
||||
|
||||
let { log } = $props();
|
||||
|
||||
let count = $state(0);
|
||||
let show_foo = $state(true);
|
||||
let snippet = $derived(show_foo ? foo : bar);
|
||||
</script>
|
||||
|
||||
{#snippet foo({count})}
|
||||
<p>snippet: {count}</p>
|
||||
{/snippet}
|
||||
|
||||
{#snippet bar(props)}
|
||||
<Inner {...props}></Inner>
|
||||
{/snippet}
|
||||
|
||||
{@render snippet({ count, log })}
|
||||
|
||||
<button onclick={() => show_foo = !show_foo}>toggle</button>
|
||||
<button onclick={() => count++}>increase count</button>
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<p>10 * 10 = 100</p><p>20 * 20 = 400</p>'
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
<script lang="ts">
|
||||
const boxes = [ { width: 10, height: 10 }, { width: 20, height: 20 } ];
|
||||
</script>
|
||||
|
||||
{#each boxes as box}
|
||||
{@const area: number = box.width * box.height}
|
||||
<p>{box.width} * {box.height} = {area}</p>
|
||||
{/each}
|
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<p>{}</p>'
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
<script lang="ts">
|
||||
</script>
|
||||
|
||||
{@const name: string = "{}"}
|
||||
<p>{name}</p>
|
@ -0,0 +1,3 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({});
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
let a = $state(1);
|
||||
let b = 2;
|
||||
let c = 3;
|
||||
</script>
|
||||
|
||||
<button onclick={() => a += 1}>a += 1</button>
|
||||
<button onclick={() => b += 1}>b += 1</button>
|
||||
<button onclick={() => c += 1}>c += 1</button>
|
||||
<p>{a} + {b} + {c} = {a + b + c}</p>
|
@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"code": "non-state-reference",
|
||||
"message": "b is updated, but is not declared with $state(...). Changing its value will not correctly trigger updates.",
|
||||
"start": {
|
||||
"column": 5,
|
||||
"line": 3
|
||||
},
|
||||
"end": {
|
||||
"column": 6,
|
||||
"line": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "non-state-reference",
|
||||
"message": "c is updated, but is not declared with $state(...). Changing its value will not correctly trigger updates.",
|
||||
"start": {
|
||||
"column": 5,
|
||||
"line": 4
|
||||
},
|
||||
"end": {
|
||||
"column": 6,
|
||||
"line": 4
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,8 @@
|
||||
<script lang="ts">
|
||||
function openInEditor() {
|
||||
fetch('./__open-in-editor?file=src/App.svelte');
|
||||
}
|
||||
</script>
|
||||
|
||||
<h1>Demo App</h1>
|
||||
<button class="open-in-editor" on:click={openInEditor}>edit App.svelte</button>
|
@ -0,0 +1,6 @@
|
||||
import fs from 'node:fs';
|
||||
const destination = new URL('../src/App.svelte', import.meta.url);
|
||||
if (!fs.existsSync(destination)) {
|
||||
const template = new URL('./App.template.svelte', import.meta.url);
|
||||
fs.writeFileSync(destination, fs.readFileSync(template, 'utf-8'), 'utf-8');
|
||||
}
|
Loading…
Reference in new issue