-
-
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: allow member access on directives (#9462)
fixes #9445
- Loading branch information
1 parent
9eb969d
commit 6f3dc04
Showing
6 changed files
with
196 additions
and
4 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 | ||
--- | ||
|
||
fix: allow member access on directives |
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/snapshot/samples/directives-with-member-access/_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,5 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
skip_if_ssr: true | ||
}); |
108 changes: 108 additions & 0 deletions
108
...lte/tests/snapshot/samples/directives-with-member-access/_expected/client/index.svelte.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,108 @@ | ||
// index.svelte (Svelte VERSION) | ||
// Note: compiler output will change before 5.0 is released! | ||
import "svelte/internal/disclose-version"; | ||
import * as $ from "svelte/internal"; | ||
|
||
var frag = $.template(`<div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div>`, true); | ||
|
||
export default function Directives_with_member_access($$anchor, $$props) { | ||
$.push($$props, false); | ||
|
||
const one = () => {}; | ||
const nested = { one, "with-string": one }; | ||
const evenmore = { nested }; | ||
|
||
/* Init */ | ||
var fragment = $.open_frag($$anchor, true, frag); | ||
var div = $.child_frag(fragment); | ||
var div_1 = $.sibling($.sibling(div)); | ||
var div_2 = $.sibling($.sibling(div_1)); | ||
var div_3 = $.sibling($.sibling(div_2)); | ||
|
||
$.transition(div_3, one, null, false); | ||
|
||
var div_4 = $.sibling($.sibling(div_3)); | ||
|
||
$.transition(div_4, nested['one'], null, false); | ||
|
||
var div_5 = $.sibling($.sibling(div_4)); | ||
|
||
$.transition(div_5, evenmore['nested']['one'], null, false); | ||
|
||
var div_6 = $.sibling($.sibling(div_5)); | ||
|
||
$.animate(div_6, one, null); | ||
|
||
var div_7 = $.sibling($.sibling(div_6)); | ||
|
||
$.animate(div_7, nested['one'], null); | ||
|
||
var div_8 = $.sibling($.sibling(div_7)); | ||
|
||
$.animate(div_8, evenmore['nested']['one'], null); | ||
|
||
var div_9 = $.sibling($.sibling(div_8)); | ||
|
||
$.in(div_9, one, null, false); | ||
|
||
var div_10 = $.sibling($.sibling(div_9)); | ||
|
||
$.in(div_10, nested['one'], null, false); | ||
|
||
var div_11 = $.sibling($.sibling(div_10)); | ||
|
||
$.in(div_11, evenmore['nested']['one'], null, false); | ||
|
||
var div_12 = $.sibling($.sibling(div_11)); | ||
|
||
$.out(div_12, one, null, false); | ||
|
||
var div_13 = $.sibling($.sibling(div_12)); | ||
|
||
$.out(div_13, nested['one'], null, false); | ||
|
||
var div_14 = $.sibling($.sibling(div_13)); | ||
|
||
$.out(div_14, evenmore['nested']['one'], null, false); | ||
|
||
var div_15 = $.sibling($.sibling(div_14)); | ||
var div_16 = $.sibling($.sibling(div_15)); | ||
var div_17 = $.sibling($.sibling(div_16)); | ||
|
||
$.transition(div_17, nested['with-string'], null, false); | ||
|
||
var div_18 = $.sibling($.sibling(div_17)); | ||
|
||
$.transition(div_18, evenmore['nested']['with-string'], null, false); | ||
|
||
var div_19 = $.sibling($.sibling(div_18)); | ||
|
||
$.animate(div_19, nested['with-string'], null); | ||
|
||
var div_20 = $.sibling($.sibling(div_19)); | ||
|
||
$.animate(div_20, evenmore['nested']['with-string'], null); | ||
|
||
var div_21 = $.sibling($.sibling(div_20)); | ||
|
||
$.in(div_21, nested['with-string'], null, false); | ||
|
||
var div_22 = $.sibling($.sibling(div_21)); | ||
|
||
$.in(div_22, evenmore['nested']['with-string'], null, false); | ||
|
||
var div_23 = $.sibling($.sibling(div_22)); | ||
|
||
$.out(div_23, nested['with-string'], null, false); | ||
|
||
var div_24 = $.sibling($.sibling(div_23)); | ||
|
||
$.out(div_24, evenmore['nested']['with-string'], null, false); | ||
$.action(div, $$node => one($$node)); | ||
$.action(div_1, $$node => nested['one']($$node)); | ||
$.action(div_2, $$node => evenmore['nested']['one']($$node)); | ||
$.action(div_15, $$node => nested['with-string']($$node)); | ||
$.action(div_16, $$node => evenmore['nested']['with-string']($$node)); | ||
$.close_frag($$anchor, fragment); | ||
$.pop(); | ||
} |
40 changes: 40 additions & 0 deletions
40
packages/svelte/tests/snapshot/samples/directives-with-member-access/index.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,40 @@ | ||
<script> | ||
const one = ()=>{}; | ||
const nested = {one, "with-string": one}; | ||
const evenmore = {nested}; | ||
</script> | ||
|
||
<div use:one /> | ||
<div use:nested.one /> | ||
<div use:evenmore.nested.one /> | ||
|
||
<div transition:one /> | ||
<div transition:nested.one /> | ||
<div transition:evenmore.nested.one /> | ||
|
||
<div animate:one /> | ||
<div animate:nested.one /> | ||
<div animate:evenmore.nested.one /> | ||
|
||
<div in:one /> | ||
<div in:nested.one /> | ||
<div in:evenmore.nested.one /> | ||
|
||
<div out:one /> | ||
<div out:nested.one /> | ||
<div out:evenmore.nested.one /> | ||
|
||
<div use:nested.with-string /> | ||
<div use:evenmore.nested.with-string /> | ||
|
||
<div transition:nested.with-string /> | ||
<div transition:evenmore.nested.with-string /> | ||
|
||
<div animate:nested.with-string /> | ||
<div animate:evenmore.nested.with-string /> | ||
|
||
<div in:nested.with-string /> | ||
<div in:evenmore.nested.with-string /> | ||
|
||
<div out:nested.with-string /> | ||
<div out:evenmore.nested.with-string /> |
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
6f3dc04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
svelte-5-preview – ./sites/svelte-5-preview
svelte-octane.vercel.app
svelte-5-preview-svelte.vercel.app
svelte-5-preview.vercel.app
svelte-5-preview-git-main-svelte.vercel.app