-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This ensures someone like Astro can render multiple islands and the unique ids produced in them are able to be deduplicated --------- Co-authored-by: Hugos68 <[email protected]> Co-authored-by: paoloricciuti <[email protected]> Co-authored-by: Simon Holthausen <[email protected]>
- Loading branch information
1 parent
7ce2dfc
commit b82692a
Showing
16 changed files
with
149 additions
and
29 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 `idPrefix` option to `render` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { PUBLIC_VERSION } from '../version.js'; | ||
|
||
if (typeof window !== 'undefined') | ||
// @ts-ignore | ||
(window.__svelte ||= { v: new Set() }).v.add(PUBLIC_VERSION); | ||
if (typeof window !== 'undefined') { | ||
// @ts-expect-error | ||
((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION); | ||
} |
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
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-runes/samples/props-id-prefix/Child.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,5 @@ | ||
<script> | ||
let id = $props.id(); | ||
</script> | ||
|
||
<p>{id}</p> |
60 changes: 60 additions & 0 deletions
60
packages/svelte/tests/runtime-runes/samples/props-id-prefix/_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,60 @@ | ||
import { flushSync } from 'svelte'; | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
id_prefix: 'myPrefix', | ||
test({ assert, target, variant }) { | ||
if (variant === 'dom') { | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>toggle</button> | ||
<h1>c1</h1> | ||
<p>c2</p> | ||
<p>c3</p> | ||
<p>c4</p> | ||
` | ||
); | ||
} else { | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>toggle</button> | ||
<h1>myPrefix-s1</h1> | ||
<p>myPrefix-s2</p> | ||
<p>myPrefix-s3</p> | ||
<p>myPrefix-s4</p> | ||
` | ||
); | ||
} | ||
|
||
let button = target.querySelector('button'); | ||
flushSync(() => button?.click()); | ||
|
||
if (variant === 'dom') { | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>toggle</button> | ||
<h1>c1</h1> | ||
<p>c2</p> | ||
<p>c3</p> | ||
<p>c4</p> | ||
<p>c5</p> | ||
` | ||
); | ||
} else { | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>toggle</button> | ||
<h1>myPrefix-s1</h1> | ||
<p>myPrefix-s2</p> | ||
<p>myPrefix-s3</p> | ||
<p>myPrefix-s4</p> | ||
<p>c1</p> | ||
` | ||
); | ||
} | ||
} | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/svelte/tests/runtime-runes/samples/props-id-prefix/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> | ||
import Child from './Child.svelte'; | ||
let id = $props.id(); | ||
let show = $state(false); | ||
</script> | ||
|
||
<button onclick={() => show = !show}>toggle</button> | ||
|
||
<h1>{id}</h1> | ||
|
||
<Child /> | ||
<Child /> | ||
<Child /> | ||
|
||
{#if show} | ||
<Child /> | ||
{/if} |
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