@vue/runtime-vapor 3.6.0-beta.5 → 3.6.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-vapor.d.ts +84 -83
- package/dist/runtime-vapor.esm-bundler.js +318 -131
- package/package.json +4 -4
package/dist/runtime-vapor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AllowedComponentProps, AsyncComponentInternalOptions, AsyncComponentLoader, AsyncComponentOptions, ComponentCustomProps, ComponentInternalOptions, ComponentObjectPropsOptions, ComponentPropsOptions, ComponentTypeEmits, CreateAppFunction, CustomElementOptions, DirectiveModifiers, EffectScope, EmitFn, EmitsOptions, EmitsToProps, ExtractDefaultPropTypes, ExtractPropTypes, GenericAppContext, GenericComponentInstance, LifecycleHook, NULL_DYNAMIC_COMPONENT, NormalizedPropsOptions, ObjectEmitsOptions, Plugin, ReservedProps, SchedulerJob, ShallowUnwrapRef, SuspenseBoundary, TransitionHooks, TransitionProps, TransitionState, TypeEmitsToOptions, VNode, VueElementBase } from "@vue/runtime-dom";
|
|
1
|
+
import { AllowedComponentProps, AsyncComponentInternalOptions, AsyncComponentLoader, AsyncComponentOptions, ComponentCustomProps, ComponentInternalOptions, ComponentObjectPropsOptions, ComponentPropsOptions, ComponentTypeEmits, CreateAppFunction, CustomElementOptions, DirectiveModifiers, EffectScope, EmitFn, EmitsOptions, EmitsToProps, ExtractDefaultPropTypes, ExtractPropTypes, GenericAppContext, GenericComponentInstance, KeepAliveProps, LifecycleHook, NULL_DYNAMIC_COMPONENT, NormalizedPropsOptions, ObjectEmitsOptions, Plugin, ReservedProps, SchedulerJob, ShallowUnwrapRef, SuspenseBoundary, TeleportProps, TransitionGroupProps, TransitionHooks, TransitionProps, TransitionState, TypeEmitsToOptions, VNode, VueElementBase } from "@vue/runtime-dom";
|
|
2
2
|
import { EffectScope as EffectScope$1, ReactiveEffect, Ref, ShallowRef } from "@vue/reactivity";
|
|
3
3
|
import { IsKeyValues, Namespace, NormalizedStyle, Prettify } from "@vue/shared";
|
|
4
4
|
|
|
@@ -8,14 +8,80 @@ type RefEl = Element | VaporComponentInstance;
|
|
|
8
8
|
type setRefFn = (el: RefEl, ref: NodeRef, refFor?: boolean, refKey?: string) => NodeRef | undefined;
|
|
9
9
|
export declare function createTemplateRefSetter(): setRefFn;
|
|
10
10
|
//#endregion
|
|
11
|
+
//#region temp/packages/runtime-vapor/src/componentSlots.d.ts
|
|
12
|
+
type RawSlots = Record<string, VaporSlot> & {
|
|
13
|
+
$?: DynamicSlotSource[];
|
|
14
|
+
};
|
|
15
|
+
type StaticSlots = Record<string, VaporSlot>;
|
|
16
|
+
export type VaporSlot = BlockFn;
|
|
17
|
+
type DynamicSlot = {
|
|
18
|
+
name: string;
|
|
19
|
+
fn: VaporSlot;
|
|
20
|
+
};
|
|
21
|
+
type DynamicSlotFn = () => DynamicSlot | DynamicSlot[];
|
|
22
|
+
type DynamicSlotSource = StaticSlots | DynamicSlotFn;
|
|
23
|
+
/**
|
|
24
|
+
* Wrap a slot function to track the slot owner.
|
|
25
|
+
*
|
|
26
|
+
* This ensures:
|
|
27
|
+
* 1. createSlot gets rawSlots from the correct component (slot owner)
|
|
28
|
+
* 2. Elements inherit the slot owner's scopeId
|
|
29
|
+
*/
|
|
30
|
+
export declare function withVaporCtx(fn: Function): BlockFn;
|
|
31
|
+
export declare function createSlot(name: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, noSlotted?: boolean, once?: boolean): Block;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region temp/packages/runtime-vapor/src/apiDefineComponent.d.ts
|
|
34
|
+
export type VaporPublicProps = ReservedProps & AllowedComponentProps & ComponentCustomProps;
|
|
35
|
+
export type VaporRenderResult<T = Block> = VNode | T | VaporRenderResult<T>[];
|
|
36
|
+
type VaporComponentInstanceConstructor<T extends VaporComponentInstance> = {
|
|
37
|
+
__isFragment?: never;
|
|
38
|
+
__isTeleport?: never;
|
|
39
|
+
__isSuspense?: never;
|
|
40
|
+
new (...args: any[]): T;
|
|
41
|
+
};
|
|
42
|
+
export type DefineVaporComponent<RuntimePropsOptions = {}, RuntimePropsKeys extends string = string, InferredProps = (string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, TypeRefs extends Record<string, unknown> = {}, MakeDefaultsOptional extends boolean = true, PublicProps = VaporPublicProps, ResolvedProps = InferredProps & EmitsToProps<Emits>, Defaults = ExtractDefaultPropTypes<RuntimePropsOptions>> = VaporComponentInstanceConstructor<VaporComponentInstance<MakeDefaultsOptional extends true ? keyof Defaults extends never ? Prettify<ResolvedProps> & PublicProps : Partial<Defaults> & Omit<Prettify<ResolvedProps> & PublicProps, keyof Defaults> : Prettify<ResolvedProps> & PublicProps, Emits, Slots, Exposed, TypeBlock, TypeRefs>> & VaporComponentOptions<RuntimePropsOptions | RuntimePropsKeys[], Emits, RuntimeEmitsKeys, Slots, Exposed>;
|
|
43
|
+
type DefineVaporSetupFnComponent<Props extends Record<string, any> = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, ResolvedProps extends Record<string, any> = Props & EmitsToProps<Emits> & VaporPublicProps> = new () => VaporComponentInstance<ResolvedProps, Emits, Slots, Exposed, TypeBlock>;
|
|
44
|
+
export declare function defineVaporComponent<Props extends Record<string, any>, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block>(setup: (props: Props, ctx: {
|
|
45
|
+
emit: EmitFn<Emits>;
|
|
46
|
+
slots: Slots;
|
|
47
|
+
attrs: Record<string, any>;
|
|
48
|
+
expose: (exposed: Exposed) => void;
|
|
49
|
+
}) => VaporRenderResult<TypeBlock> | void, extraOptions?: VaporComponentOptions<(keyof Props)[], Emits, RuntimeEmitsKeys, Slots, Exposed> & ThisType<void>): DefineVaporSetupFnComponent<Props, Emits, Slots, Exposed, TypeBlock>;
|
|
50
|
+
export declare function defineVaporComponent<Props extends Record<string, any>, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block>(setup: (props: Props, ctx: {
|
|
51
|
+
emit: EmitFn<Emits>;
|
|
52
|
+
slots: Slots;
|
|
53
|
+
attrs: Record<string, any>;
|
|
54
|
+
expose: (exposed: Exposed) => void;
|
|
55
|
+
}) => VaporRenderResult<TypeBlock> | void, extraOptions?: VaporComponentOptions<ComponentObjectPropsOptions<Props>, Emits, RuntimeEmitsKeys, Slots, Exposed> & ThisType<void>): DefineVaporSetupFnComponent<Props, Emits, Slots, Exposed, TypeBlock>;
|
|
56
|
+
export declare function defineVaporComponent<TypeProps, RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, RuntimePropsKeys extends string = string, TypeEmits extends ComponentTypeEmits = {}, RuntimeEmitsOptions extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, ResolvedEmits extends EmitsOptions = ({} extends RuntimeEmitsOptions ? TypeEmitsToOptions<TypeEmits> : RuntimeEmitsOptions), InferredProps = (IsKeyValues<TypeProps> extends true ? TypeProps : string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), TypeRefs extends Record<string, unknown> = {}, TypeBlock extends Block = Block>(options: VaporComponentOptions<RuntimePropsOptions | RuntimePropsKeys[], ResolvedEmits, RuntimeEmitsKeys, Slots, Exposed, TypeBlock, InferredProps> & {
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
/**
|
|
59
|
+
* @private for language-tools use only
|
|
60
|
+
*/
|
|
61
|
+
__typeProps?: TypeProps;
|
|
62
|
+
/**
|
|
63
|
+
* @private for language-tools use only
|
|
64
|
+
*/
|
|
65
|
+
__typeEmits?: TypeEmits;
|
|
66
|
+
/**
|
|
67
|
+
* @private for language-tools use only
|
|
68
|
+
*/
|
|
69
|
+
__typeRefs?: TypeRefs;
|
|
70
|
+
/**
|
|
71
|
+
* @private for language-tools use only
|
|
72
|
+
*/
|
|
73
|
+
__typeEl?: TypeBlock;
|
|
74
|
+
} & ThisType<void>): DefineVaporComponent<RuntimePropsOptions, RuntimePropsKeys, InferredProps, ResolvedEmits, RuntimeEmitsKeys, Slots, Exposed extends Block ? Record<string, any> : Exposed, TypeBlock, TypeRefs, unknown extends TypeProps ? true : false>;
|
|
75
|
+
//#endregion
|
|
11
76
|
//#region temp/packages/runtime-vapor/src/components/KeepAlive.d.ts
|
|
12
|
-
interface
|
|
77
|
+
export interface VaporKeepAliveContext {
|
|
13
78
|
processShapeFlag(block: Block): boolean;
|
|
14
79
|
cacheBlock(): void;
|
|
15
80
|
cacheScope(key: any, scope: EffectScope$1): void;
|
|
16
81
|
getScope(key: any): EffectScope$1 | undefined;
|
|
82
|
+
setCurrentBranchKey(key: any): any;
|
|
17
83
|
}
|
|
18
|
-
export declare const
|
|
84
|
+
export declare const VaporKeepAlive: DefineVaporComponent<{}, string, KeepAliveProps>;
|
|
19
85
|
//#endregion
|
|
20
86
|
//#region temp/packages/runtime-vapor/src/fragment.d.ts
|
|
21
87
|
export declare class VaporFragment<T extends Block = Block> implements TransitionOptions {
|
|
@@ -36,7 +102,7 @@ export declare class VaporFragment<T extends Block = Block> implements Transitio
|
|
|
36
102
|
declare class ForFragment extends VaporFragment<Block[]> {
|
|
37
103
|
constructor(nodes: Block[]);
|
|
38
104
|
}
|
|
39
|
-
declare class DynamicFragment extends VaporFragment {
|
|
105
|
+
export declare class DynamicFragment extends VaporFragment {
|
|
40
106
|
anchor: Node;
|
|
41
107
|
scope: EffectScope$1 | undefined;
|
|
42
108
|
current?: BlockFn;
|
|
@@ -44,12 +110,11 @@ declare class DynamicFragment extends VaporFragment {
|
|
|
44
110
|
render?: BlockFn;
|
|
45
111
|
key: any;
|
|
46
112
|
};
|
|
47
|
-
fallback?: BlockFn;
|
|
48
113
|
anchorLabel?: string;
|
|
49
114
|
keyed?: boolean;
|
|
50
115
|
attrs?: Record<string, any>;
|
|
51
116
|
setAsyncRef?: (instance: VaporComponentInstance) => void;
|
|
52
|
-
keepAliveCtx:
|
|
117
|
+
keepAliveCtx: VaporKeepAliveContext | null;
|
|
53
118
|
slotOwner: VaporComponentInstance | null;
|
|
54
119
|
constructor(anchorLabel?: string, keyed?: boolean);
|
|
55
120
|
update(render?: BlockFn, key?: any): void;
|
|
@@ -101,41 +166,14 @@ declare class RenderEffect extends ReactiveEffect {
|
|
|
101
166
|
}
|
|
102
167
|
export declare function renderEffect(fn: () => void, noLifecycle?: boolean): void;
|
|
103
168
|
//#endregion
|
|
104
|
-
//#region temp/packages/runtime-vapor/src/componentSlots.d.ts
|
|
105
|
-
type RawSlots = Record<string, VaporSlot> & {
|
|
106
|
-
$?: DynamicSlotSource[];
|
|
107
|
-
};
|
|
108
|
-
type StaticSlots = Record<string, VaporSlot>;
|
|
109
|
-
export type VaporSlot = BlockFn;
|
|
110
|
-
type DynamicSlot = {
|
|
111
|
-
name: string;
|
|
112
|
-
fn: VaporSlot;
|
|
113
|
-
};
|
|
114
|
-
type DynamicSlotFn = () => DynamicSlot | DynamicSlot[];
|
|
115
|
-
type DynamicSlotSource = StaticSlots | DynamicSlotFn;
|
|
116
|
-
/**
|
|
117
|
-
* Wrap a slot function to track the slot owner.
|
|
118
|
-
*
|
|
119
|
-
* This ensures:
|
|
120
|
-
* 1. createSlot gets rawSlots from the correct component (slot owner)
|
|
121
|
-
* 2. Elements inherit the slot owner's scopeId
|
|
122
|
-
*/
|
|
123
|
-
export declare function withVaporCtx(fn: Function): BlockFn;
|
|
124
|
-
export declare function createSlot(name: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, noSlotted?: boolean, once?: boolean): Block;
|
|
125
|
-
//#endregion
|
|
126
169
|
//#region temp/packages/runtime-vapor/src/components/Teleport.d.ts
|
|
127
|
-
export declare const VaporTeleportImpl: {
|
|
128
|
-
name: string;
|
|
129
|
-
__isTeleport: boolean;
|
|
130
|
-
__vapor: boolean;
|
|
131
|
-
process(props: LooseRawProps, slots: LooseRawSlots): TeleportFragment;
|
|
132
|
-
};
|
|
133
170
|
declare class TeleportFragment extends VaporFragment {
|
|
134
171
|
anchor?: Node;
|
|
135
172
|
private rawProps?;
|
|
136
173
|
private resolvedProps?;
|
|
137
174
|
private rawSlots?;
|
|
138
175
|
isDisabled?: boolean;
|
|
176
|
+
private isMounted;
|
|
139
177
|
target?: ParentNode | null;
|
|
140
178
|
targetAnchor?: Node | null;
|
|
141
179
|
targetStart?: Node | null;
|
|
@@ -156,60 +194,19 @@ declare class TeleportFragment extends VaporFragment {
|
|
|
156
194
|
private mountChildren;
|
|
157
195
|
hydrate: () => void;
|
|
158
196
|
}
|
|
159
|
-
|
|
160
|
-
//#region temp/packages/runtime-vapor/src/apiDefineComponent.d.ts
|
|
161
|
-
export type VaporPublicProps = ReservedProps & AllowedComponentProps & ComponentCustomProps;
|
|
162
|
-
export type VaporRenderResult<T = Block> = VNode | T | VaporRenderResult<T>[];
|
|
163
|
-
type VaporComponentInstanceConstructor<T extends VaporComponentInstance> = {
|
|
164
|
-
__isFragment?: never;
|
|
165
|
-
__isTeleport?: never;
|
|
166
|
-
__isSuspense?: never;
|
|
167
|
-
new (...args: any[]): T;
|
|
168
|
-
};
|
|
169
|
-
export type DefineVaporComponent<RuntimePropsOptions = {}, RuntimePropsKeys extends string = string, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, TypeRefs extends Record<string, unknown> = {}, MakeDefaultsOptional extends boolean = true, InferredProps = (string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), PublicProps = VaporPublicProps, ResolvedProps = InferredProps & EmitsToProps<Emits>, Defaults = ExtractDefaultPropTypes<RuntimePropsOptions>> = VaporComponentInstanceConstructor<VaporComponentInstance<MakeDefaultsOptional extends true ? keyof Defaults extends never ? Prettify<ResolvedProps> & PublicProps : Partial<Defaults> & Omit<Prettify<ResolvedProps> & PublicProps, keyof Defaults> : Prettify<ResolvedProps> & PublicProps, Emits, Slots, Exposed, TypeBlock, TypeRefs>> & ObjectVaporComponent<RuntimePropsOptions | RuntimePropsKeys[], Emits, RuntimeEmitsKeys, Slots, Exposed>;
|
|
170
|
-
type DefineVaporSetupFnComponent<Props extends Record<string, any> = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, ResolvedProps extends Record<string, any> = Props & EmitsToProps<Emits> & VaporPublicProps> = new (props?: ResolvedProps) => VaporComponentInstance<ResolvedProps, Emits, Slots, Exposed, TypeBlock>;
|
|
171
|
-
export declare function defineVaporComponent<Props extends Record<string, any>, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block>(setup: (props: Props, ctx: {
|
|
172
|
-
emit: EmitFn<Emits>;
|
|
173
|
-
slots: Slots;
|
|
174
|
-
attrs: Record<string, any>;
|
|
175
|
-
expose: (exposed: Exposed) => void;
|
|
176
|
-
}) => VaporRenderResult<TypeBlock> | void, extraOptions?: ObjectVaporComponent<(keyof Props)[], Emits, RuntimeEmitsKeys, Slots, Exposed> & ThisType<void>): DefineVaporSetupFnComponent<Props, Emits, Slots, Exposed, TypeBlock>;
|
|
177
|
-
export declare function defineVaporComponent<Props extends Record<string, any>, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block>(setup: (props: Props, ctx: {
|
|
178
|
-
emit: EmitFn<Emits>;
|
|
179
|
-
slots: Slots;
|
|
180
|
-
attrs: Record<string, any>;
|
|
181
|
-
expose: (exposed: Exposed) => void;
|
|
182
|
-
}) => VaporRenderResult<TypeBlock> | void, extraOptions?: ObjectVaporComponent<ComponentObjectPropsOptions<Props>, Emits, RuntimeEmitsKeys, Slots, Exposed> & ThisType<void>): DefineVaporSetupFnComponent<Props, Emits, Slots, Exposed, TypeBlock>;
|
|
183
|
-
export declare function defineVaporComponent<TypeProps, RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, RuntimePropsKeys extends string = string, TypeEmits extends ComponentTypeEmits = {}, RuntimeEmitsOptions extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, ResolvedEmits extends EmitsOptions = ({} extends RuntimeEmitsOptions ? TypeEmitsToOptions<TypeEmits> : RuntimeEmitsOptions), InferredProps = (IsKeyValues<TypeProps> extends true ? TypeProps : string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), TypeRefs extends Record<string, unknown> = {}, TypeBlock extends Block = Block>(options: ObjectVaporComponent<RuntimePropsOptions | RuntimePropsKeys[], ResolvedEmits, RuntimeEmitsKeys, Slots, Exposed, TypeBlock, InferredProps> & {
|
|
184
|
-
/**
|
|
185
|
-
* @private for language-tools use only
|
|
186
|
-
*/
|
|
187
|
-
__typeProps?: TypeProps;
|
|
188
|
-
/**
|
|
189
|
-
* @private for language-tools use only
|
|
190
|
-
*/
|
|
191
|
-
__typeEmits?: TypeEmits;
|
|
192
|
-
/**
|
|
193
|
-
* @private for language-tools use only
|
|
194
|
-
*/
|
|
195
|
-
__typeRefs?: TypeRefs;
|
|
196
|
-
/**
|
|
197
|
-
* @private for language-tools use only
|
|
198
|
-
*/
|
|
199
|
-
__typeEl?: TypeBlock;
|
|
200
|
-
} & ThisType<void>): DefineVaporComponent<RuntimePropsOptions, RuntimePropsKeys, ResolvedEmits, RuntimeEmitsKeys, Slots, Exposed extends Block ? Record<string, any> : Exposed, TypeBlock, TypeRefs, unknown extends TypeProps ? true : false, InferredProps>;
|
|
197
|
+
export declare const VaporTeleport: DefineVaporSetupFnComponent<TeleportProps>;
|
|
201
198
|
//#endregion
|
|
202
199
|
//#region temp/packages/runtime-vapor/src/component.d.ts
|
|
203
|
-
export type VaporComponent = FunctionalVaporComponent |
|
|
200
|
+
export type VaporComponent = FunctionalVaporComponent | VaporComponentOptions | DefineVaporComponent;
|
|
204
201
|
export type FunctionalVaporComponent<Props = {}, Emits extends EmitsOptions = {}, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>> = ((props: Readonly<Props & EmitsToProps<Emits>>, ctx: {
|
|
205
202
|
emit: EmitFn<Emits>;
|
|
206
203
|
slots: Slots;
|
|
207
204
|
attrs: Record<string, any>;
|
|
208
205
|
expose: <T extends Record<string, any> = Exposed>(exposed: T) => void;
|
|
209
|
-
}) => VaporRenderResult) & Omit<
|
|
206
|
+
}) => VaporRenderResult) & Omit<VaporComponentOptions<ComponentPropsOptions<Props>, Emits, string, Slots>, "setup"> & {
|
|
210
207
|
displayName?: string;
|
|
211
208
|
} & SharedInternalOptions;
|
|
212
|
-
interface
|
|
209
|
+
export interface VaporComponentOptions<Props = {}, Emits extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, Exposed extends Record<string, any> = Record<string, any>, TypeBlock extends Block = Block, InferredProps = (ComponentObjectPropsOptions extends Props ? {} : ExtractPropTypes<Props>)> extends ComponentInternalOptions, AsyncComponentInternalOptions<VaporComponentOptions, VaporComponentInstance>, SharedInternalOptions {
|
|
213
210
|
inheritAttrs?: boolean;
|
|
214
211
|
props?: Props;
|
|
215
212
|
emits?: Emits | RuntimeEmitsKeys[];
|
|
@@ -281,6 +278,7 @@ export declare class VaporComponentInstance<Props extends Record<string, any> =
|
|
|
281
278
|
renderEffects?: RenderEffect[];
|
|
282
279
|
hasFallthrough: boolean;
|
|
283
280
|
shapeFlag?: number;
|
|
281
|
+
key?: any;
|
|
284
282
|
oncePropsCache?: Record<string | symbol, any>;
|
|
285
283
|
isMounted: boolean;
|
|
286
284
|
isUnmounted: boolean;
|
|
@@ -314,6 +312,10 @@ export declare class VaporComponentInstance<Props extends Record<string, any> =
|
|
|
314
312
|
* fallthrough can be suppressed.
|
|
315
313
|
*/
|
|
316
314
|
accessedAttrs: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated only used for JSX to detect props types.
|
|
317
|
+
*/
|
|
318
|
+
$props: Props;
|
|
317
319
|
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: RawSlots | null, appContext?: GenericAppContext, once?: boolean);
|
|
318
320
|
/**
|
|
319
321
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
@@ -351,7 +353,7 @@ export declare function defineVaporCustomElement<Props, RawBindings = object>(se
|
|
|
351
353
|
slots: StaticSlots;
|
|
352
354
|
emit: EmitFn;
|
|
353
355
|
expose: (exposed: Record<string, any>) => void;
|
|
354
|
-
}) => RawBindings | VaporRenderResult, options?: Pick<
|
|
356
|
+
}) => RawBindings | VaporRenderResult, options?: Pick<VaporComponentOptions, "name" | "inheritAttrs" | "emits"> & CustomElementOptions & {
|
|
355
357
|
props?: (keyof Props)[];
|
|
356
358
|
}): VaporElementConstructor<Props>;
|
|
357
359
|
export declare function defineVaporCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: {
|
|
@@ -359,7 +361,7 @@ export declare function defineVaporCustomElement<Props, RawBindings = object>(se
|
|
|
359
361
|
slots: StaticSlots;
|
|
360
362
|
emit: EmitFn;
|
|
361
363
|
expose: (exposed: Record<string, any>) => void;
|
|
362
|
-
}) => RawBindings | VaporRenderResult, options?: Pick<
|
|
364
|
+
}) => RawBindings | VaporRenderResult, options?: Pick<VaporComponentOptions, "name" | "inheritAttrs" | "emits"> & CustomElementOptions & {
|
|
363
365
|
props?: ComponentObjectPropsOptions<Props>;
|
|
364
366
|
}): VaporElementConstructor<Props>;
|
|
365
367
|
export declare function defineVaporCustomElement<RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, RuntimePropsKeys extends string = string, RuntimeEmitsOptions extends EmitsOptions = {}, RuntimeEmitsKeys extends string = string, Slots extends StaticSlots = StaticSlots, InferredProps = (string extends RuntimePropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : { [key in RuntimePropsKeys]?: any }), ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>>(options: CustomElementOptions & {
|
|
@@ -515,6 +517,5 @@ export declare const applyDynamicModel: VaporModelDirective;
|
|
|
515
517
|
export declare const VaporTransition: FunctionalVaporComponent<TransitionProps>;
|
|
516
518
|
//#endregion
|
|
517
519
|
//#region temp/packages/runtime-vapor/src/components/TransitionGroup.d.ts
|
|
518
|
-
export declare const VaporTransitionGroup:
|
|
520
|
+
export declare const VaporTransitionGroup: DefineVaporComponent<{}, string, TransitionGroupProps>;
|
|
519
521
|
//#endregion
|
|
520
|
-
export { VaporKeepAliveImpl as VaporKeepAlive, VaporTeleportImpl as VaporTeleport, };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { EffectScope, NULL_DYNAMIC_COMPONENT, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isVNode, isValidHtmlOrSvgAttribute, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, xlinkNS } from "@vue/runtime-dom";
|
|
7
|
-
import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP,
|
|
6
|
+
import { EffectScope, NULL_DYNAMIC_COMPONENT, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, xlinkNS } from "@vue/runtime-dom";
|
|
7
|
+
import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, canSetValueDirectly, extend, getEscapedCssVarName, getGlobalThis, hasOwn, includeBooleanAttr, invokeArrayFns, isArray, isFunction, isObject, isOn, isPlainObject, isPromise, isReservedProp, isString, looseEqual, normalizeClass, normalizeCssVarValue, normalizeStyle, parseStringStyle, remove as remove$1, stringifyStyle, toDisplayString } from "@vue/shared";
|
|
8
8
|
import { EffectScope as EffectScope$1, ReactiveEffect, computed, isReactive, isReadonly, isRef as isRef$1, isShallow, markRaw, onEffectCleanup, onScopeDispose as onScopeDispose$1, pauseTracking, proxyRefs, resetTracking, setActiveSub, shallowReadArray, shallowRef as shallowRef$1, toRaw, toReactive, toReadonly, traverse, unref, watch as watch$1 } from "@vue/reactivity";
|
|
9
9
|
|
|
10
10
|
//#region packages/runtime-vapor/src/insertionState.ts
|
|
@@ -62,7 +62,6 @@ function performHydration(fn, setup, cleanup) {
|
|
|
62
62
|
adoptTemplate = adoptTemplateImpl;
|
|
63
63
|
locateHydrationNode = locateHydrationNodeImpl;
|
|
64
64
|
Comment.prototype.$fe = void 0;
|
|
65
|
-
Node.prototype.$pns = void 0;
|
|
66
65
|
Node.prototype.$idx = void 0;
|
|
67
66
|
Node.prototype.$llc = void 0;
|
|
68
67
|
isOptimized$1 = true;
|
|
@@ -99,7 +98,7 @@ function locateNextSiblingOfParent(n) {
|
|
|
99
98
|
return n.parentNode.nextSibling || /* @__PURE__ */ locateNextSiblingOfParent(n.parentNode);
|
|
100
99
|
}
|
|
101
100
|
function advanceHydrationNode(node) {
|
|
102
|
-
const ret = node.nextSibling ||
|
|
101
|
+
const ret = node.nextSibling || /* @__PURE__ */ locateNextSiblingOfParent(node);
|
|
103
102
|
if (ret) setCurrentHydrationNode(ret);
|
|
104
103
|
}
|
|
105
104
|
/**
|
|
@@ -863,6 +862,13 @@ function setTransitionHooks$1(block, hooks) {
|
|
|
863
862
|
block.$transition = hooks;
|
|
864
863
|
}
|
|
865
864
|
|
|
865
|
+
//#endregion
|
|
866
|
+
//#region packages/runtime-vapor/src/vdominteropState.ts
|
|
867
|
+
let isInteropEnabled = false;
|
|
868
|
+
function setInteropEnabled() {
|
|
869
|
+
isInteropEnabled = true;
|
|
870
|
+
}
|
|
871
|
+
|
|
866
872
|
//#endregion
|
|
867
873
|
//#region packages/runtime-vapor/src/apiDefineComponent.ts
|
|
868
874
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -885,7 +891,25 @@ function setCurrentKeepAliveCtx(ctx) {
|
|
|
885
891
|
currentKeepAliveCtx = ctx;
|
|
886
892
|
}
|
|
887
893
|
}
|
|
888
|
-
const
|
|
894
|
+
const compositeKeyCache = /* @__PURE__ */ new WeakMap();
|
|
895
|
+
const compositeKeyCachePrimitive = /* @__PURE__ */ new Map();
|
|
896
|
+
function getCompositeKey(type, branchKey) {
|
|
897
|
+
const isObjectType = isObject(type) || isFunction(type);
|
|
898
|
+
const perType = isObjectType ? compositeKeyCache.get(type) || /* @__PURE__ */ new Map() : compositeKeyCachePrimitive.get(type) || /* @__PURE__ */ new Map();
|
|
899
|
+
if (isObjectType) {
|
|
900
|
+
if (!compositeKeyCache.has(type)) compositeKeyCache.set(type, perType);
|
|
901
|
+
} else if (!compositeKeyCachePrimitive.has(type)) compositeKeyCachePrimitive.set(type, perType);
|
|
902
|
+
let composite = perType.get(branchKey);
|
|
903
|
+
if (!composite) {
|
|
904
|
+
composite = {
|
|
905
|
+
type,
|
|
906
|
+
branchKey
|
|
907
|
+
};
|
|
908
|
+
perType.set(branchKey, composite);
|
|
909
|
+
}
|
|
910
|
+
return composite;
|
|
911
|
+
}
|
|
912
|
+
const VaporKeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
889
913
|
name: "VaporKeepAlive",
|
|
890
914
|
__isKeepAlive: true,
|
|
891
915
|
props: {
|
|
@@ -908,6 +932,7 @@ const KeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
908
932
|
const keys = /* @__PURE__ */ new Set();
|
|
909
933
|
const storageContainer = /* @__PURE__ */ createElement("div");
|
|
910
934
|
const keptAliveScopes = /* @__PURE__ */ new Map();
|
|
935
|
+
let currentBranchKey;
|
|
911
936
|
let current;
|
|
912
937
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) keepAliveInstance.__v_cache = cache;
|
|
913
938
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -925,7 +950,10 @@ const KeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
925
950
|
}
|
|
926
951
|
keepAliveInstance.ctx = {
|
|
927
952
|
getStorageContainer: () => storageContainer,
|
|
928
|
-
getCachedComponent: (comp) =>
|
|
953
|
+
getCachedComponent: (comp, key) => {
|
|
954
|
+
if (isInteropEnabled && isVNode(comp)) return cache.get(resolveKey(comp.type, comp.key, currentBranchKey));
|
|
955
|
+
return cache.get(resolveKey(comp, key, currentBranchKey));
|
|
956
|
+
},
|
|
929
957
|
activate: (instance, parentNode, anchor) => {
|
|
930
958
|
current = instance;
|
|
931
959
|
activate$1(instance, parentNode, anchor);
|
|
@@ -955,16 +983,18 @@ const KeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
955
983
|
}
|
|
956
984
|
const [innerBlock, interop] = getInnerBlock(block);
|
|
957
985
|
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
958
|
-
innerCacheBlock(
|
|
986
|
+
innerCacheBlock(getCacheKey(innerBlock, interop, currentBranchKey), innerBlock);
|
|
959
987
|
};
|
|
960
988
|
const processShapeFlag = (block) => {
|
|
961
989
|
const [innerBlock, interop] = getInnerBlock(block);
|
|
962
990
|
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return false;
|
|
963
|
-
if (interop) {
|
|
964
|
-
|
|
991
|
+
if (interop && isInteropEnabled) {
|
|
992
|
+
const cacheKey = getCacheKey(innerBlock, true, currentBranchKey);
|
|
993
|
+
if (cache.has(cacheKey)) innerBlock.vnode.shapeFlag |= 512;
|
|
965
994
|
innerBlock.vnode.shapeFlag |= 256;
|
|
966
995
|
} else {
|
|
967
|
-
|
|
996
|
+
const cacheKey = getCacheKey(innerBlock, false, currentBranchKey);
|
|
997
|
+
if (cache.has(cacheKey)) innerBlock.shapeFlag |= 512;
|
|
968
998
|
innerBlock.shapeFlag |= 256;
|
|
969
999
|
}
|
|
970
1000
|
return true;
|
|
@@ -1002,7 +1032,7 @@ const KeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
1002
1032
|
resetCachedShapeFlag(cached);
|
|
1003
1033
|
cache.delete(key);
|
|
1004
1034
|
if (current) {
|
|
1005
|
-
if ((isVaporComponent(current)
|
|
1035
|
+
if (getCacheKey(current, !isVaporComponent(current), currentBranchKey) === key) {
|
|
1006
1036
|
const da = instance.da;
|
|
1007
1037
|
da && queuePostFlushCb(da);
|
|
1008
1038
|
return;
|
|
@@ -1025,6 +1055,13 @@ const KeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
1025
1055
|
keptAliveScopes.delete(key);
|
|
1026
1056
|
return scope;
|
|
1027
1057
|
}
|
|
1058
|
+
},
|
|
1059
|
+
setCurrentBranchKey(key) {
|
|
1060
|
+
try {
|
|
1061
|
+
return currentBranchKey;
|
|
1062
|
+
} finally {
|
|
1063
|
+
currentBranchKey = key;
|
|
1064
|
+
}
|
|
1028
1065
|
}
|
|
1029
1066
|
});
|
|
1030
1067
|
let children = slots.default();
|
|
@@ -1039,10 +1076,10 @@ const KeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
1039
1076
|
return children;
|
|
1040
1077
|
}
|
|
1041
1078
|
});
|
|
1042
|
-
const
|
|
1079
|
+
const VaporKeepAlive = VaporKeepAliveImpl;
|
|
1043
1080
|
const shouldCache = (block, props, interop = false) => {
|
|
1044
1081
|
const isAsync = !interop && isAsyncWrapper(block);
|
|
1045
|
-
const type = interop ? block.vnode.type : block.type;
|
|
1082
|
+
const type = interop && isInteropEnabled ? block.vnode.type : block.type;
|
|
1046
1083
|
if (isAsync && !type.__asyncResolved) return false;
|
|
1047
1084
|
const { include, exclude } = props;
|
|
1048
1085
|
const name = getComponentName(isAsync ? type.__asyncResolved : type);
|
|
@@ -1050,11 +1087,24 @@ const shouldCache = (block, props, interop = false) => {
|
|
|
1050
1087
|
};
|
|
1051
1088
|
const resetCachedShapeFlag = (cached) => {
|
|
1052
1089
|
if (isVaporComponent(cached)) resetShapeFlag(cached);
|
|
1053
|
-
else resetShapeFlag(cached.vnode);
|
|
1090
|
+
else if (isInteropEnabled) resetShapeFlag(cached.vnode);
|
|
1054
1091
|
};
|
|
1092
|
+
function resolveKey(type, key, branchKey) {
|
|
1093
|
+
if (key != null) return getCompositeKey(type, key);
|
|
1094
|
+
if (branchKey !== void 0) return getCompositeKey(type, branchKey);
|
|
1095
|
+
return type;
|
|
1096
|
+
}
|
|
1097
|
+
function getCacheKey(block, interop, branchKey) {
|
|
1098
|
+
if (interop && isInteropEnabled) {
|
|
1099
|
+
const frag = block;
|
|
1100
|
+
return resolveKey(frag.vnode.type, frag.$key !== void 0 ? frag.$key : frag.vnode.key, branchKey);
|
|
1101
|
+
}
|
|
1102
|
+
const instance = block;
|
|
1103
|
+
return resolveKey(instance.type, instance.key, branchKey);
|
|
1104
|
+
}
|
|
1055
1105
|
function getInnerBlock(block) {
|
|
1056
1106
|
if (isVaporComponent(block)) return [block, false];
|
|
1057
|
-
else if (isInteropFragment(block)) return [block, true];
|
|
1107
|
+
else if (isInteropEnabled && isInteropFragment(block)) return [block, true];
|
|
1058
1108
|
else if (isFragment(block)) return getInnerBlock(block.nodes);
|
|
1059
1109
|
return [void 0, false];
|
|
1060
1110
|
}
|
|
@@ -1063,7 +1113,7 @@ function isInteropFragment(block) {
|
|
|
1063
1113
|
}
|
|
1064
1114
|
function getInstanceFromCache(cached) {
|
|
1065
1115
|
if (isVaporComponent(cached)) return cached;
|
|
1066
|
-
return cached.vnode.component;
|
|
1116
|
+
if (isInteropEnabled) return cached.vnode.component;
|
|
1067
1117
|
}
|
|
1068
1118
|
function activate$1(instance, parentNode, anchor) {
|
|
1069
1119
|
move(instance.block, parentNode, anchor, 0, instance);
|
|
@@ -1159,11 +1209,13 @@ const vaporInteropImpl = {
|
|
|
1159
1209
|
let selfAnchor;
|
|
1160
1210
|
const { slot, fallback } = n2.vs;
|
|
1161
1211
|
const propsRef = n2.vs.ref = shallowRef(n2.props);
|
|
1162
|
-
|
|
1163
|
-
if (fallback
|
|
1164
|
-
|
|
1165
|
-
|
|
1212
|
+
let slotBlock = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
|
|
1213
|
+
if (fallback) {
|
|
1214
|
+
const vaporFallback = createVaporFallback(fallback, parentComponent);
|
|
1215
|
+
const emptyFrag = attachSlotFallback(slotBlock, vaporFallback);
|
|
1216
|
+
if (!isValidBlock(slotBlock)) slotBlock = renderSlotFallback(slotBlock, vaporFallback, emptyFrag);
|
|
1166
1217
|
}
|
|
1218
|
+
if (isFragment(slotBlock)) selfAnchor = slotBlock.anchor;
|
|
1167
1219
|
simpleSetCurrentInstance(prev);
|
|
1168
1220
|
if (!selfAnchor) selfAnchor = /* @__PURE__ */ createTextNode();
|
|
1169
1221
|
insert(n2.el = n2.anchor = selfAnchor, container, anchor);
|
|
@@ -1346,64 +1398,91 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1346
1398
|
*/
|
|
1347
1399
|
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
1348
1400
|
const frag = new VaporFragment([]);
|
|
1401
|
+
if (fallback && !frag.fallback) frag.fallback = fallback;
|
|
1349
1402
|
let isMounted = false;
|
|
1350
|
-
let
|
|
1351
|
-
let
|
|
1352
|
-
frag.fallback = fallback;
|
|
1403
|
+
let currentBlock = null;
|
|
1404
|
+
let currentVNode = null;
|
|
1353
1405
|
frag.insert = (parentNode, anchor) => {
|
|
1354
1406
|
if (isHydrating$1) return;
|
|
1355
1407
|
if (!isMounted) {
|
|
1356
1408
|
render(parentNode, anchor);
|
|
1357
1409
|
isMounted = true;
|
|
1358
|
-
} else internals.m(
|
|
1410
|
+
} else if (currentVNode) internals.m(currentVNode, parentNode, anchor, 2, parentComponent);
|
|
1411
|
+
else if (currentBlock) insert(currentBlock, parentNode, anchor);
|
|
1359
1412
|
frag.remove = (parentNode) => {
|
|
1360
|
-
if (
|
|
1361
|
-
else if (
|
|
1413
|
+
if (currentBlock) remove(currentBlock, parentNode);
|
|
1414
|
+
else if (currentVNode) internals.um(currentVNode, parentComponent, null);
|
|
1362
1415
|
};
|
|
1363
1416
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1364
1417
|
};
|
|
1365
1418
|
const render = (parentNode, anchor) => {
|
|
1366
1419
|
renderEffect(() => {
|
|
1367
|
-
|
|
1368
|
-
let
|
|
1420
|
+
const effectiveFallback = frag.fallback || fallback;
|
|
1421
|
+
let slotContent;
|
|
1422
|
+
let isEmpty = true;
|
|
1423
|
+
let emptyFrag = null;
|
|
1369
1424
|
if (slotsRef.value) {
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1425
|
+
slotContent = renderSlot(slotsRef.value, isFunction(name) ? name() : name, props);
|
|
1426
|
+
if (isVNode(slotContent)) {
|
|
1427
|
+
const children = slotContent.children;
|
|
1428
|
+
ensureVaporSlotFallback(children, effectiveFallback);
|
|
1429
|
+
isEmpty = children.length === 0;
|
|
1430
|
+
} else {
|
|
1431
|
+
if (effectiveFallback && slotContent) emptyFrag = attachSlotFallback(slotContent, () => effectiveFallback(internals, parentComponent));
|
|
1432
|
+
isEmpty = !isValidBlock(slotContent);
|
|
1433
|
+
}
|
|
1374
1434
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1435
|
+
let resolved = slotContent;
|
|
1436
|
+
if (isEmpty && effectiveFallback) if (isVNode(slotContent)) resolved = effectiveFallback(internals, parentComponent);
|
|
1437
|
+
else if (slotContent) resolved = renderSlotFallback(slotContent, () => effectiveFallback(internals, parentComponent), emptyFrag);
|
|
1438
|
+
else resolved = effectiveFallback(internals, parentComponent);
|
|
1439
|
+
if (isHydrating$1) {
|
|
1440
|
+
if (isVNode(resolved)) {
|
|
1441
|
+
hydrateVNode(resolved, parentComponent);
|
|
1442
|
+
currentVNode = resolved;
|
|
1443
|
+
currentBlock = null;
|
|
1444
|
+
frag.nodes = resolved.el;
|
|
1445
|
+
} else if (resolved) {
|
|
1446
|
+
currentBlock = resolved;
|
|
1447
|
+
currentVNode = null;
|
|
1448
|
+
frag.nodes = resolved;
|
|
1449
|
+
} else {
|
|
1450
|
+
currentBlock = null;
|
|
1451
|
+
currentVNode = null;
|
|
1452
|
+
frag.nodes = [];
|
|
1380
1453
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
if (isVNode(resolved)) {
|
|
1457
|
+
if (currentBlock) {
|
|
1458
|
+
remove(currentBlock, parentNode);
|
|
1459
|
+
currentBlock = null;
|
|
1385
1460
|
}
|
|
1386
|
-
internals.p(
|
|
1387
|
-
|
|
1388
|
-
frag.nodes =
|
|
1461
|
+
internals.p(currentVNode, resolved, parentNode, anchor, parentComponent, null, void 0, resolved.slotScopeIds);
|
|
1462
|
+
currentVNode = resolved;
|
|
1463
|
+
frag.nodes = resolved.el;
|
|
1464
|
+
return;
|
|
1389
1465
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
if (isHydrating$1) {
|
|
1395
|
-
if (isVNode(fallbackNodes)) {
|
|
1396
|
-
hydrateVNode(fallbackNodes, parentComponent);
|
|
1397
|
-
frag.nodes = fallbackNodes.el;
|
|
1398
|
-
}
|
|
1399
|
-
} else {
|
|
1400
|
-
if (oldVNode) internals.um(oldVNode, parentComponent, null, true);
|
|
1401
|
-
insert(fallbackNodes, parentNode, anchor);
|
|
1402
|
-
frag.nodes = fallbackNodes;
|
|
1403
|
-
}
|
|
1466
|
+
if (resolved) {
|
|
1467
|
+
if (currentVNode) {
|
|
1468
|
+
internals.um(currentVNode, parentComponent, null, true);
|
|
1469
|
+
currentVNode = null;
|
|
1404
1470
|
}
|
|
1405
|
-
|
|
1471
|
+
if (currentBlock) remove(currentBlock, parentNode);
|
|
1472
|
+
insert(resolved, parentNode, anchor);
|
|
1473
|
+
currentBlock = resolved;
|
|
1474
|
+
frag.nodes = resolved;
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
if (currentBlock) {
|
|
1478
|
+
remove(currentBlock, parentNode);
|
|
1479
|
+
currentBlock = null;
|
|
1406
1480
|
}
|
|
1481
|
+
if (currentVNode) {
|
|
1482
|
+
internals.um(currentVNode, parentComponent, null, true);
|
|
1483
|
+
currentVNode = null;
|
|
1484
|
+
}
|
|
1485
|
+
frag.nodes = [];
|
|
1407
1486
|
});
|
|
1408
1487
|
};
|
|
1409
1488
|
frag.hydrate = () => {
|
|
@@ -1414,6 +1493,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
1414
1493
|
return frag;
|
|
1415
1494
|
}
|
|
1416
1495
|
const vaporInteropPlugin = (app) => {
|
|
1496
|
+
setInteropEnabled();
|
|
1417
1497
|
const internals = ensureRenderer().internals;
|
|
1418
1498
|
app._context.vapor = extend(vaporInteropImpl, {
|
|
1419
1499
|
vdomMount: createVDOMComponent.bind(null, internals),
|
|
@@ -1436,6 +1516,10 @@ function hydrateVNode(vnode, parentComponent, skipFragmentAnchor = false) {
|
|
|
1436
1516
|
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
1437
1517
|
else advanceHydrationNode(node);
|
|
1438
1518
|
}
|
|
1519
|
+
function createVaporFallback(fallback, parentComponent) {
|
|
1520
|
+
const internals = ensureRenderer().internals;
|
|
1521
|
+
return () => createFallback(fallback)(internals, parentComponent);
|
|
1522
|
+
}
|
|
1439
1523
|
const createFallback = (fallback) => (internals, parentComponent) => {
|
|
1440
1524
|
const fallbackNodes = fallback();
|
|
1441
1525
|
if (isArray(fallbackNodes) && fallbackNodes.every(isVNode)) {
|
|
@@ -1514,7 +1598,7 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
1514
1598
|
const propsOptions = normalizePropsOptions(comp)[0];
|
|
1515
1599
|
const emitsOptions = normalizeEmitsOptions(comp);
|
|
1516
1600
|
const isProp = propsOptions ? (key) => isString(key) && hasOwn(propsOptions, camelize(key)) : NO;
|
|
1517
|
-
const isAttr = propsOptions ? (key) => key !== "$" && !isProp(key) && !isEmitListener(emitsOptions, key) :
|
|
1601
|
+
const isAttr = propsOptions ? (key) => isString(key) && key !== "$" && !isProp(key) && !isEmitListener(emitsOptions, key) : (key) => isString(key);
|
|
1518
1602
|
const getProp = (instance, key) => {
|
|
1519
1603
|
if (key === "__v_isReactive") return true;
|
|
1520
1604
|
if (!isProp(key)) return;
|
|
@@ -1565,7 +1649,7 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
1565
1649
|
deleteProperty: propsDeleteDevTrap
|
|
1566
1650
|
});
|
|
1567
1651
|
const getAttr = (target, key) => {
|
|
1568
|
-
if (!isProp(key) && !isEmitListener(emitsOptions, key)) return getAttrFromRawProps(target, key);
|
|
1652
|
+
if (isString(key) && !isProp(key) && !isEmitListener(emitsOptions, key)) return getAttrFromRawProps(target, key);
|
|
1569
1653
|
};
|
|
1570
1654
|
const hasAttr = (target, key) => {
|
|
1571
1655
|
if (isAttr(key)) return hasAttrFromRawProps(target, key);
|
|
@@ -1577,7 +1661,7 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
1577
1661
|
has: (target, key) => hasAttr(target.rawProps, key),
|
|
1578
1662
|
ownKeys: (target) => getKeysFromRawProps(target.rawProps).filter(isAttr),
|
|
1579
1663
|
getOwnPropertyDescriptor(target, key) {
|
|
1580
|
-
if (hasAttr(target.rawProps, key)) return {
|
|
1664
|
+
if (isString(key) && hasAttr(target.rawProps, key)) return {
|
|
1581
1665
|
configurable: true,
|
|
1582
1666
|
enumerable: true,
|
|
1583
1667
|
get: () => once ? getOnceAttr(target, key) : getAttr(target.rawProps, key)
|
|
@@ -1828,11 +1912,11 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1828
1912
|
const rawSlots = instance.rawSlots;
|
|
1829
1913
|
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
1830
1914
|
let fragment;
|
|
1831
|
-
if (isRef(rawSlots._)) {
|
|
1915
|
+
if (isRef(rawSlots._) && isInteropEnabled) {
|
|
1832
1916
|
if (isHydrating$1) locateHydrationNode();
|
|
1833
1917
|
fragment = instance.appContext.vapor.vdomSlot(rawSlots._, name, slotProps, instance, fallback);
|
|
1834
1918
|
} else {
|
|
1835
|
-
fragment =
|
|
1919
|
+
fragment = new SlotFragment();
|
|
1836
1920
|
const isDynamicName = isFunction(name);
|
|
1837
1921
|
const slotScopeIds = [];
|
|
1838
1922
|
if (!noSlotted) {
|
|
@@ -1852,19 +1936,24 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1852
1936
|
}
|
|
1853
1937
|
const slot = getSlot(rawSlots, slotName);
|
|
1854
1938
|
if (slot) {
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1939
|
+
const boundMap = slot._boundMap || (slot._boundMap = /* @__PURE__ */ new WeakMap());
|
|
1940
|
+
let bound = boundMap.get(fragment);
|
|
1941
|
+
if (!bound) {
|
|
1942
|
+
bound = () => {
|
|
1943
|
+
const prevSlotScopeIds = setCurrentSlotScopeIds(slotScopeIds.length > 0 ? slotScopeIds : null);
|
|
1944
|
+
const prev = inOnceSlot;
|
|
1945
|
+
try {
|
|
1946
|
+
if (once) inOnceSlot = true;
|
|
1947
|
+
return slot(slotProps);
|
|
1948
|
+
} finally {
|
|
1949
|
+
inOnceSlot = prev;
|
|
1950
|
+
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
boundMap.set(fragment, bound);
|
|
1954
|
+
}
|
|
1955
|
+
fragment.updateSlot(bound, fallback);
|
|
1956
|
+
} else fragment.updateSlot(void 0, fallback);
|
|
1868
1957
|
};
|
|
1869
1958
|
if (!once && (isDynamicName || rawSlots.$)) renderEffect(renderSlot);
|
|
1870
1959
|
else renderSlot();
|
|
@@ -2033,21 +2122,6 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2033
2122
|
} else parent && remove(this.nodes, parent);
|
|
2034
2123
|
}
|
|
2035
2124
|
this.renderBranch(render, transition, parent, instance);
|
|
2036
|
-
if (this.fallback) {
|
|
2037
|
-
let invalidFragment = null;
|
|
2038
|
-
if (isFragment(this.nodes)) setFragmentFallback(this.nodes, this.fallback, (frag) => {
|
|
2039
|
-
if (!isValidBlock(frag.nodes)) invalidFragment = frag;
|
|
2040
|
-
});
|
|
2041
|
-
if (!invalidFragment && !isValidBlock(this.nodes)) invalidFragment = this;
|
|
2042
|
-
if (invalidFragment) {
|
|
2043
|
-
parent && remove(this.nodes, parent);
|
|
2044
|
-
(this.scope || (this.scope = new EffectScope$1())).run(() => {
|
|
2045
|
-
if (invalidFragment !== this) renderFragmentFallback(invalidFragment);
|
|
2046
|
-
else this.nodes = this.fallback() || [];
|
|
2047
|
-
});
|
|
2048
|
-
parent && insert(this.nodes, parent, this.anchor);
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
2125
|
setActiveSub(prevSub);
|
|
2052
2126
|
if (isHydrating$1) this.hydrate();
|
|
2053
2127
|
}
|
|
@@ -2059,9 +2133,12 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2059
2133
|
else this.scope = new EffectScope$1();
|
|
2060
2134
|
const prevOwner = setCurrentSlotOwner(this.slotOwner);
|
|
2061
2135
|
const prevCtx = setCurrentKeepAliveCtx(keepAliveCtx);
|
|
2136
|
+
let prevBranchKey;
|
|
2137
|
+
if (keepAliveCtx && this.keyed) prevBranchKey = keepAliveCtx.setCurrentBranchKey(this.current);
|
|
2062
2138
|
const prev = parent && instance ? setCurrentInstance(instance) : void 0;
|
|
2063
2139
|
this.nodes = this.scope.run(render) || [];
|
|
2064
2140
|
if (prev !== void 0) setCurrentInstance(...prev);
|
|
2141
|
+
if (keepAliveCtx && this.keyed) keepAliveCtx.setCurrentBranchKey(prevBranchKey);
|
|
2065
2142
|
setCurrentKeepAliveCtx(prevCtx);
|
|
2066
2143
|
setCurrentSlotOwner(prevOwner);
|
|
2067
2144
|
if (this.keyed) setKey(this.nodes, this.current);
|
|
@@ -2084,33 +2161,122 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2084
2161
|
}
|
|
2085
2162
|
}
|
|
2086
2163
|
};
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2164
|
+
var SlotFragment = class extends DynamicFragment {
|
|
2165
|
+
constructor() {
|
|
2166
|
+
super(isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? "slot" : void 0);
|
|
2167
|
+
}
|
|
2168
|
+
updateSlot(render, fallback, key = render) {
|
|
2169
|
+
if (!render || !fallback) {
|
|
2170
|
+
this.update(render || fallback, key);
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
const wrapped = () => {
|
|
2174
|
+
const block = render();
|
|
2175
|
+
const emptyFrag = attachSlotFallback(block, fallback);
|
|
2176
|
+
if (!isValidBlock(block)) return renderSlotFallback(block, fallback, emptyFrag);
|
|
2177
|
+
return block;
|
|
2094
2178
|
};
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
}
|
|
2099
|
-
function renderFragmentFallback(fragment) {
|
|
2100
|
-
if (fragment instanceof ForFragment) fragment.nodes[0] = [fragment.fallback() || []];
|
|
2101
|
-
else if (fragment instanceof DynamicFragment) fragment.update(fragment.fallback);
|
|
2102
|
-
}
|
|
2179
|
+
this.update(wrapped, key);
|
|
2180
|
+
}
|
|
2181
|
+
};
|
|
2103
2182
|
function isFragment(val) {
|
|
2104
2183
|
return val instanceof VaporFragment;
|
|
2105
2184
|
}
|
|
2106
2185
|
function isDynamicFragment(val) {
|
|
2107
2186
|
return val instanceof DynamicFragment;
|
|
2108
2187
|
}
|
|
2188
|
+
function renderSlotFallback(block, fallback, emptyFragment) {
|
|
2189
|
+
const frag = emptyFragment || findDeepestEmptyFragment(block);
|
|
2190
|
+
if (frag) {
|
|
2191
|
+
if (frag instanceof ForFragment) frag.nodes[0] = [fallback() || []];
|
|
2192
|
+
else if (frag instanceof DynamicFragment) frag.update(fallback);
|
|
2193
|
+
return block;
|
|
2194
|
+
}
|
|
2195
|
+
return fallback();
|
|
2196
|
+
}
|
|
2197
|
+
function attachSlotFallback(block, fallback) {
|
|
2198
|
+
const state = { emptyFrag: null };
|
|
2199
|
+
traverseForFallback(block, fallback, state);
|
|
2200
|
+
return state.emptyFrag;
|
|
2201
|
+
}
|
|
2202
|
+
const slotFallbackState = /* @__PURE__ */ new WeakMap();
|
|
2203
|
+
function traverseForFallback(block, fallback, state) {
|
|
2204
|
+
if (isVaporComponent(block)) {
|
|
2205
|
+
if (block.block) traverseForFallback(block.block, fallback, state);
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
if (isArray(block)) {
|
|
2209
|
+
for (const item of block) traverseForFallback(item, fallback, state);
|
|
2210
|
+
return;
|
|
2211
|
+
}
|
|
2212
|
+
if (block instanceof ForFragment) {
|
|
2213
|
+
block.fallback = chainFallback(block.fallback, fallback);
|
|
2214
|
+
if (!isValidBlock(block.nodes)) state.emptyFrag = block;
|
|
2215
|
+
traverseForFallback(block.nodes, fallback, state);
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
if (block instanceof VaporFragment && block.insert) {
|
|
2219
|
+
block.fallback = chainFallback(block.fallback, fallback);
|
|
2220
|
+
if (!isValidBlock(block.nodes)) state.emptyFrag = block;
|
|
2221
|
+
traverseForFallback(block.nodes, fallback, state);
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
if (block instanceof DynamicFragment) {
|
|
2225
|
+
let slotState = slotFallbackState.get(block);
|
|
2226
|
+
if (slotState) slotState.fallback = chainFallback(slotState.fallback, fallback);
|
|
2227
|
+
else slotFallbackState.set(block, slotState = {
|
|
2228
|
+
fallback,
|
|
2229
|
+
wrapped: false
|
|
2230
|
+
});
|
|
2231
|
+
if (!slotState.wrapped) {
|
|
2232
|
+
slotState.wrapped = true;
|
|
2233
|
+
const original = block.update.bind(block);
|
|
2234
|
+
block.update = (render, key) => {
|
|
2235
|
+
original(render, key);
|
|
2236
|
+
const emptyFrag = attachSlotFallback(block.nodes, slotState.fallback);
|
|
2237
|
+
if (render !== slotState.fallback && !isValidBlock(block.nodes)) renderSlotFallback(block, slotState.fallback, emptyFrag);
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
if (!isValidBlock(block.nodes)) state.emptyFrag = block;
|
|
2241
|
+
traverseForFallback(block.nodes, fallback, state);
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
function findDeepestEmptyFragment(block) {
|
|
2245
|
+
let emptyFrag = null;
|
|
2246
|
+
traverseForEmptyFragment(block, (frag) => emptyFrag = frag);
|
|
2247
|
+
return emptyFrag;
|
|
2248
|
+
}
|
|
2249
|
+
function traverseForEmptyFragment(block, onFound) {
|
|
2250
|
+
if (isVaporComponent(block)) {
|
|
2251
|
+
if (block.block) traverseForEmptyFragment(block.block, onFound);
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
if (isArray(block)) {
|
|
2255
|
+
for (const item of block) traverseForEmptyFragment(item, onFound);
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
if (isFragment(block)) {
|
|
2259
|
+
if (!isValidBlock(block.nodes)) onFound(block);
|
|
2260
|
+
traverseForEmptyFragment(block.nodes, onFound);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
function chainFallback(existing, next) {
|
|
2264
|
+
if (!existing) return next;
|
|
2265
|
+
return (...args) => {
|
|
2266
|
+
const res = existing(...args);
|
|
2267
|
+
return !isValidBlock(res) ? next(...args) : res;
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2109
2270
|
function setKey(block, key) {
|
|
2110
2271
|
if (block instanceof Node) block.$key = key;
|
|
2111
|
-
else if (isVaporComponent(block))
|
|
2112
|
-
|
|
2113
|
-
|
|
2272
|
+
else if (isVaporComponent(block)) {
|
|
2273
|
+
block.key = key;
|
|
2274
|
+
setKey(block.block, key);
|
|
2275
|
+
} else if (isArray(block)) for (const b of block) setKey(b, key);
|
|
2276
|
+
else {
|
|
2277
|
+
block.$key = key;
|
|
2278
|
+
setKey(block.nodes, key);
|
|
2279
|
+
}
|
|
2114
2280
|
}
|
|
2115
2281
|
|
|
2116
2282
|
//#endregion
|
|
@@ -2127,6 +2293,7 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
2127
2293
|
constructor(props, slots) {
|
|
2128
2294
|
super([]);
|
|
2129
2295
|
this.__isTeleportFragment = true;
|
|
2296
|
+
this.isMounted = false;
|
|
2130
2297
|
this.insert = (container, anchor) => {
|
|
2131
2298
|
if (isHydrating$1) return;
|
|
2132
2299
|
this.placeholder = !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport start") : /* @__PURE__ */ createTextNode();
|
|
@@ -2139,6 +2306,7 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
2139
2306
|
remove(this.nodes, this.mountContainer);
|
|
2140
2307
|
this.nodes = [];
|
|
2141
2308
|
}
|
|
2309
|
+
this.isMounted = false;
|
|
2142
2310
|
if (this.targetStart) {
|
|
2143
2311
|
remove(this.targetStart, this.target);
|
|
2144
2312
|
this.targetStart = void 0;
|
|
@@ -2192,9 +2360,11 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
2192
2360
|
this.parentComponent = currentInstance;
|
|
2193
2361
|
this.anchor = isHydrating$1 ? void 0 : !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport end") : /* @__PURE__ */ createTextNode();
|
|
2194
2362
|
renderEffect(() => {
|
|
2363
|
+
const prevTo = this.resolvedProps && this.resolvedProps.to;
|
|
2364
|
+
const wasDisabled = this.isDisabled;
|
|
2195
2365
|
this.resolvedProps = extend({}, new Proxy(this.rawProps, rawPropsProxyHandlers));
|
|
2196
2366
|
this.isDisabled = isTeleportDisabled(this.resolvedProps);
|
|
2197
|
-
this.handlePropsUpdate();
|
|
2367
|
+
if (wasDisabled !== this.isDisabled || !this.isDisabled && prevTo !== this.resolvedProps.to) this.handlePropsUpdate();
|
|
2198
2368
|
});
|
|
2199
2369
|
if (!isHydrating$1) this.initChildren();
|
|
2200
2370
|
}
|
|
@@ -2228,8 +2398,12 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
2228
2398
|
insert(this.nodes = children, this.mountContainer, this.mountAnchor);
|
|
2229
2399
|
}
|
|
2230
2400
|
mount(parent, anchor) {
|
|
2231
|
-
if (this.$transition) applyTransitionHooks(this.nodes, this.$transition);
|
|
2232
|
-
|
|
2401
|
+
if (this.$transition && !this.isMounted) applyTransitionHooks(this.nodes, this.$transition);
|
|
2402
|
+
if (this.isMounted) move(this.nodes, this.mountContainer = parent, this.mountAnchor = anchor, 2);
|
|
2403
|
+
else {
|
|
2404
|
+
insert(this.nodes, this.mountContainer = parent, this.mountAnchor = anchor);
|
|
2405
|
+
this.isMounted = true;
|
|
2406
|
+
}
|
|
2233
2407
|
}
|
|
2234
2408
|
mountToTarget() {
|
|
2235
2409
|
const target = this.target = resolveTeleportTarget(this.resolvedProps, querySelector);
|
|
@@ -2272,6 +2446,7 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
2272
2446
|
runWithoutHydration(this.initChildren.bind(this));
|
|
2273
2447
|
}
|
|
2274
2448
|
};
|
|
2449
|
+
const VaporTeleport = VaporTeleportImpl;
|
|
2275
2450
|
/**
|
|
2276
2451
|
* Use duck typing to check for VaporTeleport instead of direct reference
|
|
2277
2452
|
* to VaporTeleportImpl, allowing tree-shaking when Teleport is not used.
|
|
@@ -2538,7 +2713,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2538
2713
|
const cached = currentInstance.ctx.getCachedComponent(component);
|
|
2539
2714
|
if (cached) return cached;
|
|
2540
2715
|
}
|
|
2541
|
-
if (appContext.vapor && !component.__vapor) {
|
|
2716
|
+
if (isInteropEnabled && appContext.vapor && !component.__vapor) {
|
|
2542
2717
|
const frag = appContext.vapor.vdomMount(component, currentInstance, rawProps, rawSlots, isSingleRoot);
|
|
2543
2718
|
if (!isHydrating$1) {
|
|
2544
2719
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
@@ -2746,8 +2921,11 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
2746
2921
|
renderEffect(() => frag.update(getSlot(rawSlots, "default")));
|
|
2747
2922
|
if (!isHydrating$1) insert(frag, el);
|
|
2748
2923
|
} else {
|
|
2749
|
-
|
|
2750
|
-
if (
|
|
2924
|
+
let slot = getSlot(rawSlots, "default");
|
|
2925
|
+
if (slot) {
|
|
2926
|
+
const block = slot();
|
|
2927
|
+
if (!isHydrating$1) insert(block, el);
|
|
2928
|
+
}
|
|
2751
2929
|
}
|
|
2752
2930
|
if (isHydrating$1) setCurrentHydrationNode(nextNode);
|
|
2753
2931
|
}
|
|
@@ -3439,8 +3617,11 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3439
3617
|
let activeOpers;
|
|
3440
3618
|
watch$1(source, (newValue) => {
|
|
3441
3619
|
if (activeOpers !== void 0) for (const oper of activeOpers) oper();
|
|
3442
|
-
|
|
3443
|
-
|
|
3620
|
+
queuePostFlushCb(() => {
|
|
3621
|
+
activeKey = newValue;
|
|
3622
|
+
activeOpers = operMap.get(newValue);
|
|
3623
|
+
if (activeOpers !== void 0) for (const oper of activeOpers) oper();
|
|
3624
|
+
});
|
|
3444
3625
|
});
|
|
3445
3626
|
selectors.push({
|
|
3446
3627
|
deregister,
|
|
@@ -3591,12 +3772,19 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3591
3772
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
3592
3773
|
const refValue = getRefValue(el);
|
|
3593
3774
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
3594
|
-
const canSetSetupRef = !!(process.env.NODE_ENV !== "production") ? createCanSetSetupRefChecker(setupState) : NO;
|
|
3775
|
+
const canSetSetupRef = !!(process.env.NODE_ENV !== "production") ? createCanSetSetupRefChecker(setupState, refs) : NO;
|
|
3776
|
+
const canSetRef = (ref, key) => {
|
|
3777
|
+
if (!!(process.env.NODE_ENV !== "production") && knownTemplateRefs.has(ref)) return false;
|
|
3778
|
+
if (key && isTemplateRefKey(refs, key)) return false;
|
|
3779
|
+
return true;
|
|
3780
|
+
};
|
|
3595
3781
|
if (oldRef != null && oldRef !== ref) {
|
|
3596
3782
|
if (isString(oldRef)) {
|
|
3597
3783
|
refs[oldRef] = null;
|
|
3598
3784
|
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(oldRef)) setupState[oldRef] = null;
|
|
3599
|
-
} else if (isRef$1(oldRef))
|
|
3785
|
+
} else if (isRef$1(oldRef)) {
|
|
3786
|
+
if (canSetRef(oldRef)) oldRef.value = null;
|
|
3787
|
+
}
|
|
3600
3788
|
}
|
|
3601
3789
|
if (isFunction(ref)) {
|
|
3602
3790
|
const invokeRefSetter = (value) => {
|
|
@@ -3611,7 +3799,7 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3611
3799
|
if (_isString || _isRef) {
|
|
3612
3800
|
const doSet = () => {
|
|
3613
3801
|
if (refFor) {
|
|
3614
|
-
existing = _isString ? !!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
3802
|
+
existing = _isString ? !!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !refKey ? ref.value : refs[refKey];
|
|
3615
3803
|
if (!isArray(existing)) {
|
|
3616
3804
|
existing = [refValue];
|
|
3617
3805
|
if (_isString) {
|
|
@@ -3621,7 +3809,7 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3621
3809
|
existing = setupState[ref];
|
|
3622
3810
|
}
|
|
3623
3811
|
} else {
|
|
3624
|
-
ref.value = existing;
|
|
3812
|
+
if (canSetRef(ref, refKey)) ref.value = existing;
|
|
3625
3813
|
if (refKey) refs[refKey] = existing;
|
|
3626
3814
|
}
|
|
3627
3815
|
} else if (!existing.includes(refValue)) existing.push(refValue);
|
|
@@ -3629,7 +3817,7 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3629
3817
|
refs[ref] = refValue;
|
|
3630
3818
|
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) setupState[ref] = refValue;
|
|
3631
3819
|
} else if (_isRef) {
|
|
3632
|
-
ref.value = refValue;
|
|
3820
|
+
if (canSetRef(ref, refKey)) ref.value = refValue;
|
|
3633
3821
|
if (refKey) refs[refKey] = refValue;
|
|
3634
3822
|
} else if (!!(process.env.NODE_ENV !== "production")) warn("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
3635
3823
|
};
|
|
@@ -3641,7 +3829,7 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3641
3829
|
refs[ref] = null;
|
|
3642
3830
|
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) setupState[ref] = null;
|
|
3643
3831
|
} else if (_isRef) {
|
|
3644
|
-
ref.value = null;
|
|
3832
|
+
if (canSetRef(ref, refKey)) ref.value = null;
|
|
3645
3833
|
if (refKey) refs[refKey] = null;
|
|
3646
3834
|
}
|
|
3647
3835
|
});
|
|
@@ -3692,9 +3880,9 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
3692
3880
|
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
3693
3881
|
frag.update(() => {
|
|
3694
3882
|
if (isBlock(value)) return value;
|
|
3695
|
-
if (appContext.vapor && isVNode(value)) {
|
|
3883
|
+
if (isInteropEnabled && appContext.vapor && isVNode(value)) {
|
|
3696
3884
|
if (isKeepAlive(currentInstance)) {
|
|
3697
|
-
const frag = currentInstance.ctx.getCachedComponent(value.type);
|
|
3885
|
+
const frag = currentInstance.ctx.getCachedComponent(value.type, value.key);
|
|
3698
3886
|
if (frag) return frag;
|
|
3699
3887
|
}
|
|
3700
3888
|
const frag = appContext.vapor.vdomMountVNode(value, currentInstance);
|
|
@@ -3834,10 +4022,9 @@ const positionMap = /* @__PURE__ */ new WeakMap();
|
|
|
3834
4022
|
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
3835
4023
|
const decorate = (t) => {
|
|
3836
4024
|
delete t.props.mode;
|
|
3837
|
-
t.__vapor = true;
|
|
3838
4025
|
return t;
|
|
3839
4026
|
};
|
|
3840
|
-
const VaporTransitionGroupImpl = {
|
|
4027
|
+
const VaporTransitionGroupImpl = /* @__PURE__ */ defineVaporComponent({
|
|
3841
4028
|
name: "VaporTransitionGroup",
|
|
3842
4029
|
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
3843
4030
|
tag: String,
|
|
@@ -3907,7 +4094,7 @@ const VaporTransitionGroupImpl = {
|
|
|
3907
4094
|
return container;
|
|
3908
4095
|
} else return slottedBlock;
|
|
3909
4096
|
}
|
|
3910
|
-
};
|
|
4097
|
+
});
|
|
3911
4098
|
const VaporTransitionGroup = /* @__PURE__ */ decorate(VaporTransitionGroupImpl);
|
|
3912
4099
|
function getTransitionBlocks(block) {
|
|
3913
4100
|
let children = [];
|
|
@@ -3944,4 +4131,4 @@ function getFirstConnectedChild(children) {
|
|
|
3944
4131
|
}
|
|
3945
4132
|
|
|
3946
4133
|
//#endregion
|
|
3947
|
-
export { VaporElement, VaporFragment,
|
|
4134
|
+
export { DynamicFragment, VaporElement, VaporFragment, VaporKeepAlive, VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockText, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, useVaporCssVars, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-vapor",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.6",
|
|
4
4
|
"description": "@vue/runtime-vapor",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-vapor.esm-bundler.js",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/vuejs/core/tree/dev/packages/runtime-vapor#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vue/shared": "3.6.0-beta.
|
|
42
|
-
"@vue/reactivity": "3.6.0-beta.
|
|
41
|
+
"@vue/shared": "3.6.0-beta.6",
|
|
42
|
+
"@vue/reactivity": "3.6.0-beta.6"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@vue/runtime-dom": "3.6.0-beta.
|
|
45
|
+
"@vue/runtime-dom": "3.6.0-beta.6"
|
|
46
46
|
}
|
|
47
47
|
}
|