-
-
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.
- Loading branch information
Showing
18 changed files
with
222 additions
and
12 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': minor | ||
--- | ||
|
||
feat: add $state.opqaue 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
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
38 changes: 38 additions & 0 deletions
38
packages/svelte/tests/runtime-runes/samples/opaque-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,38 @@ | ||
import { flushSync } from 'svelte'; | ||
import { test } from '../../test'; | ||
import { assert_ok } from '../../../suite'; | ||
|
||
export default test({ | ||
html: `<button>+</button><button>invalidate</button><div>0</div><div>0</div><input>`, | ||
ssrHtml: `<button>+</button><button>invalidate</button><div>0</div><div>0</div><input value="0">`, | ||
|
||
test({ assert, target }) { | ||
const [b1, b2] = target.querySelectorAll('button'); | ||
const input = target.querySelector('input'); | ||
assert_ok(input); | ||
|
||
b1?.click(); | ||
flushSync(); | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
`<button>+</button><button>invalidate</button><div>0</div><div>0</div><input>` | ||
); | ||
assert.equal(input.value, '0'); | ||
|
||
b2?.click(); | ||
flushSync(); | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
`<button>+</button><button>invalidate</button><div>1</div><div>1</div><input>` | ||
); | ||
assert.equal(input.value, '1'); | ||
|
||
input.value = '2'; | ||
input.dispatchEvent(new window.Event('input')); | ||
flushSync(); | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
`<button>+</button><button>invalidate</button><div>1</div><div>1</div><input>` | ||
); | ||
} | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/svelte/tests/runtime-runes/samples/opaque-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> | ||
let [count, invalidate_count] = $state.opaque(0); | ||
let [value, invalidate_value] = $state.opaque({ count: 0 }); | ||
</script> | ||
|
||
<button onclick={() => { | ||
count++ | ||
value.count++ | ||
}}>+</button> | ||
|
||
<button onclick={() => { | ||
invalidate_count(); | ||
invalidate_value(); | ||
}}>invalidate</button> | ||
|
||
<div>{count}</div> | ||
<div>{value.count}</div> | ||
|
||
<input bind:value={count}> |
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