-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) different action/animation/transition transformation (#767)
#754 Avoid incorrect type inference in edge cases by calling the functions directly. Also cleaned up typings - actions/animations/transitions only have one parameter, not arbitrary ones. Therefore passing a ( and ) around the params so they are interpreted as a comma-separated command instead of two parameters if user does use:action={1,2} , because it is interpreted as action(node, (1,2)) by the Svelte compiler.
- Loading branch information
1 parent
37291dc
commit 73707aa
Showing
13 changed files
with
45 additions
and
47 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
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
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/htmlx2jsx/samples/action-bare/expected.jsx
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 +1 @@ | ||
<><h1 {...__sveltets_ensureAction(__sveltets_mapElementTag('h1'),blink)}>Hello</h1></> | ||
<><h1 {...__sveltets_ensureAction(blink(__sveltets_mapElementTag('h1')))}>Hello</h1></> |
10 changes: 5 additions & 5 deletions
10
packages/svelte2tsx/test/htmlx2jsx/samples/action-nested/expected.jsx
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,6 +1,6 @@ | ||
<><svg {...__sveltets_ensureAction(__sveltets_mapElementTag('svg'),svgAction)}></svg> | ||
<div {...__sveltets_ensureAction(__sveltets_mapElementTag('div'),divAction)}> | ||
<input {...__sveltets_ensureAction(__sveltets_mapElementTag('input'),action)} /> | ||
<p {...__sveltets_ensureAction(__sveltets_mapElementTag('p'),pAction)}></p> | ||
<unknownTag {...__sveltets_ensureAction(__sveltets_mapElementTag('unknownTag'),unknownAction)}></unknownTag> | ||
<><svg {...__sveltets_ensureAction(svgAction(__sveltets_mapElementTag('svg')))}></svg> | ||
<div {...__sveltets_ensureAction(divAction(__sveltets_mapElementTag('div')))}> | ||
<input {...__sveltets_ensureAction(action(__sveltets_mapElementTag('input')))} /> | ||
<p {...__sveltets_ensureAction(pAction(__sveltets_mapElementTag('p')))}></p> | ||
<unknownTag {...__sveltets_ensureAction(unknownAction(__sveltets_mapElementTag('unknownTag')))}></unknownTag> | ||
</div></> |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/htmlx2jsx/samples/action-params/expected.jsx
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 +1 @@ | ||
<><h1 {...__sveltets_ensureAction(__sveltets_mapElementTag('h1'),blink,500,2)}>Hello</h1></> | ||
<><h1 {...__sveltets_ensureAction(blink(__sveltets_mapElementTag('h1'),(500,2)))}>Hello</h1></> |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/htmlx2jsx/samples/animation-bare/expected.jsx
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 +1 @@ | ||
<><h1 {...__sveltets_ensureAnimation(blink, {})}>Hello</h1></> | ||
<><h1 {...__sveltets_ensureAnimation(blink(__sveltets_ElementNode,__sveltets_AnimationMove))}>Hello</h1></> |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/htmlx2jsx/samples/animation-params/expected.jsx
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,2 +1,2 @@ | ||
<><h1 {...__sveltets_ensureAnimation(blink, {y: 50, duration: 500})}>Hello</h1></> | ||
<><h1 {...__sveltets_ensureAnimation(blink(__sveltets_ElementNode,__sveltets_AnimationMove,({y: 50, duration: 500})))}>Hello</h1></> | ||
|
6 changes: 3 additions & 3 deletions
6
packages/svelte2tsx/test/htmlx2jsx/samples/directive-quoted/expected.jsx
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,7 +1,7 @@ | ||
<><h1 onclick={()=>console.log("click")}>Hello</h1> | ||
<Component />{__sveltets_instanceOf(Component).$on('click', test)} | ||
<img {...__sveltets_ensureAction(__sveltets_mapElementTag('img'),action,thing)} /> | ||
<img {...__sveltets_ensureTransition(fade, params)} /> | ||
<img {...__sveltets_ensureAction(action(__sveltets_mapElementTag('img'),(thing)))} /> | ||
<img {...__sveltets_ensureTransition(fade(__sveltets_ElementNode,(params)))} /> | ||
<img {...__sveltets_ensureType(Boolean, !!(classthing))} /> | ||
<img {...__sveltets_ensureAnimation(thing, params)} /> | ||
<img {...__sveltets_ensureAnimation(thing(__sveltets_ElementNode,__sveltets_AnimationMove,(params)))} /> | ||
<img thing={binding} /></> |
6 changes: 3 additions & 3 deletions
6
packages/svelte2tsx/test/htmlx2jsx/samples/transition-bare/expected.jsx
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,3 +1,3 @@ | ||
<><h1 {...__sveltets_ensureTransition(blink, {})}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink, {})}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink, {})}>Hello</h1></> | ||
<><h1 {...__sveltets_ensureTransition(blink(__sveltets_ElementNode))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink(__sveltets_ElementNode))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink(__sveltets_ElementNode))}>Hello</h1></> |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/htmlx2jsx/samples/transition-modifiers/expected.jsx
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,3 +1,3 @@ | ||
<><div {...__sveltets_ensureTransition(slide, {})}> | ||
<><div {...__sveltets_ensureTransition(slide(__sveltets_ElementNode))}> | ||
{item} | ||
</div></> |
6 changes: 3 additions & 3 deletions
6
packages/svelte2tsx/test/htmlx2jsx/samples/transition-params/expected.jsx
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,3 +1,3 @@ | ||
<><h1 {...__sveltets_ensureTransition(blink, {y: 50, duration: 500})}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink, {y: 50, duration: 500})}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink, {y: 50, duration: 500})}>Hello</h1></> | ||
<><h1 {...__sveltets_ensureTransition(blink(__sveltets_ElementNode,({y: 50, duration: 500})))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink(__sveltets_ElementNode,({y: 50, duration: 500})))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blink(__sveltets_ElementNode,({y: 50, duration: 500})))}>Hello</h1></> |