-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix typo fix typo
- Loading branch information
Showing
21 changed files
with
189 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
feat: add $state.raw rune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/svelte/tests/runtime-runes/samples/class-private-raw-state/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: `<button>0</button>`, | ||
|
||
async test({ assert, target }) { | ||
const btn = target.querySelector('button'); | ||
|
||
await btn?.click(); | ||
assert.htmlEqual(target.innerHTML, `<button>1</button>`); | ||
|
||
await btn?.click(); | ||
assert.htmlEqual(target.innerHTML, `<button>2</button>`); | ||
} | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/svelte/tests/runtime-runes/samples/class-private-raw-state/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script> | ||
class Counter { | ||
#count = $state.raw(0); | ||
constructor(initial_count) { | ||
this.#count = initial_count; | ||
} | ||
get count() { | ||
return this.#count; | ||
} | ||
set count(val) { | ||
this.#count = val; | ||
} | ||
} | ||
const counter = new Counter(0); | ||
</script> | ||
|
||
<button on:click={() => counter.count++}>{counter.count}</button> |
15 changes: 15 additions & 0 deletions
15
packages/svelte/tests/runtime-runes/samples/class-raw-state/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: `<button>0</button>`, | ||
|
||
async test({ assert, target }) { | ||
const btn = target.querySelector('button'); | ||
|
||
await btn?.click(); | ||
assert.htmlEqual(target.innerHTML, `<button>1</button>`); | ||
|
||
await btn?.click(); | ||
assert.htmlEqual(target.innerHTML, `<button>2</button>`); | ||
} | ||
}); |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/runtime-runes/samples/class-raw-state/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
class Counter { | ||
count = $state.raw(0); | ||
} | ||
const counter = new Counter(); | ||
</script> | ||
|
||
<button on:click={() => counter.count++}>{counter.count}</button> |
17 changes: 17 additions & 0 deletions
17
packages/svelte/tests/runtime-runes/samples/raw-state/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { test } from '../../test'; | ||
import { log } from './log.js'; | ||
|
||
export default test({ | ||
before_test() { | ||
log.length = 0; | ||
}, | ||
|
||
async test({ assert, target }) { | ||
const [b1, b2] = target.querySelectorAll('button'); | ||
b1.click(); | ||
b2.click(); | ||
await Promise.resolve(); | ||
|
||
assert.deepEqual(log, [0, 1]); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/** @type {any[]} */ | ||
export const log = []; |
13 changes: 13 additions & 0 deletions
13
packages/svelte/tests/runtime-runes/samples/raw-state/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
import { log } from './log.js'; | ||
let x = $state.raw(0); | ||
let y = $state.raw(0); | ||
$effect(() => { | ||
log.push(x); | ||
}); | ||
</script> | ||
|
||
<button on:click={() => x++}>{x}</button> | ||
<button on:click={() => y++}>{y}</button> |
Oops, something went wrong.