Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21fd970

Browse files
authored
feat(jsx-directive)!: use v-slots instead of vSlots (#930)
* feat(jsx-directive)!: use v-slots instead of vSlots* fix: test
1 parent42968b3 commit21fd970

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

‎packages/jsx-directive/src/core/v-slot.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function transformVSlot(
2727
Array.from(nodeMap)
2828
.reverse()
2929
.forEach(([node,{ attributeMap, vSlotAttribute}])=>{
30-
constresult=[`vSlots={{`]
30+
constresult=[`v-slots={{`]
3131
constattributes=Array.from(attributeMap)
3232
attributes.forEach(
3333
([attribute,{ children, vIfAttribute, vForAttribute}],index)=>{

‎packages/jsx-directive/tests/__snapshots__/v-slot.test.ts.snap‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Comp: FunctionalComponent<
1616
}
1717
> = (props,{slots}) =>{
1818
return (
19-
<ChildvSlots={{...Object.fromEntries(__MACROS_renderList(slots, (Slot,slotName)=> ([[__MACROS_unref(slotName)], (scope)=><>
19+
<Childv-slots={{...Object.fromEntries(__MACROS_renderList(slots, (Slot,slotName)=> ([[__MACROS_unref(slotName)], (scope)=><>
2020
<Slot{...scope} />
2121
</>,]))),}}
2222
@@ -28,25 +28,25 @@ let baz = $ref('')
2828
let show = $ref<boolean|undefined>()
2929
defineRender(() => (
3030
<div>
31-
<ChildvSlots={{'bottom': ({foo })=><>
31+
<Childv-slots={{'bottom': ({foo })=><>
3232
{foo}
33-
<ChildvSlots={{'default': ()=><>default</>,}}></Child>
33+
<Childv-slots={{'default': ()=><>default</>,}}></Child>
3434
</>,}}></Child>
3535
36-
<CompvSlots={{'default': ()=><>default</>,}}></Comp>
37-
<ChildvSlots={{'bottom': ({foo })=><>{foo}</>,}}></Child>
36+
<Compv-slots={{'default': ()=><>default</>,}}></Comp>
37+
<Childv-slots={{'bottom': ({foo })=><>{foo}</>,}}></Child>
3838
39-
<Childbaz={baz}vSlots={{'title': ({foo })=><>
39+
<Childbaz={baz}v-slots={{'title': ({foo })=><>
4040
{expectTypeOf<string>(foo)}
4141
</>,}}></Child>
4242
43-
<ChildvSlots={{...(show)? {'bottom': ({foo })=><>
43+
<Childv-slots={{...(show)? {'bottom': ({foo })=><>
4444
{foo}
4545
</>,}:null,}}
4646
4747
></Child>
4848
49-
<Child<number>vSlots={{...(show)? {'title': ({foo })=><>
49+
<Child<number>v-slots={{...(show)? {'title': ({foo })=><>
5050
{expectTypeOf<number>(foo)}
5151
{show}
5252
</>,}: (show===false)? {'center': ({foo })=><>

‎packages/volar/src/jsx-directive/context.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export function resolveCtxMap(
1818
):Map<import('typescript').Node,string>{
1919
if(ctxNodeMap.size){
2020
options.codes.push(`
21-
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
22-
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
21+
// @ts-ignore
22+
type__VLS_IsAny<T> = 0 extends 1 & T ? true : false; type__VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
2323
type __VLS_Element = globalThis.JSX.Element;
24-
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
24+
declarefunction __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
2525
T extends new (...args: any) => any
2626
? (props: (K extends { $props: infer Props } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & { __ctx?: {
2727
attrs?: any,
@@ -35,7 +35,7 @@ const __VLS_nativeElements = {
3535
...{} as SVGElementTagNameMap,
3636
...{} as HTMLElementTagNameMap,
3737
};
38-
function __VLS_getFunctionalComponentCtx<T, K, const S>(
38+
declarefunction __VLS_getFunctionalComponentCtx<T, K, const S>(
3939
comp: T,
4040
compInstance: K,
4141
s: S,
@@ -46,7 +46,7 @@ function __VLS_getFunctionalComponentCtx<T, K, const S>(
4646
? Ctx
4747
: never
4848
: T extends (props: infer P, ctx: infer Ctx) => any
49-
? { props: P; slots: P['vSlots']; expose: P['vExpose'] } & Ctx
49+
? { props: P } & Ctx
5050
: {};\n`)
5151
}
5252

‎packages/volar/src/jsx-directive/v-slot.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function transformVSlot(
2828
const{ codes, ts, ast, source, prefix}=options
2929

3030
nodeMap.forEach(({ attributeMap, vSlotAttribute},node)=>{
31-
constresult:Code[]=['vSlots={{']
31+
constresult:Code[]=['v-slots={{']
3232
constattributes=Array.from(attributeMap)
3333
attributes.forEach(
3434
([attribute,{ children, vIfAttribute, vForAttribute}],index)=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp