@vue/runtime-vapor 3.6.0-alpha.3 → 3.6.0-alpha.5
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 +49 -25
- package/dist/runtime-vapor.esm-bundler.js +984 -591
- package/package.json +4 -4
package/dist/runtime-vapor.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { VNode, TransitionHooks, TransitionState, TransitionProps, Plugin, SchedulerJob, GenericComponentInstance, GenericAppContext, EffectScope as EffectScope$1, EmitFn, SuspenseBoundary, LifecycleHook, NormalizedPropsOptions, ObjectEmitsOptions, ComponentInternalOptions, AsyncComponentInternalOptions, ComponentPropsOptions, EmitsOptions, CreateAppFunction, AsyncComponentLoader, AsyncComponentOptions, DirectiveModifiers } from '@vue/runtime-dom';
|
|
1
|
+
import { VNode, TransitionHooks, TransitionState, TransitionProps, Plugin, SchedulerJob, GenericComponentInstance, GenericAppContext, EffectScope as EffectScope$1, EmitFn, SuspenseBoundary, LifecycleHook, NormalizedPropsOptions, ObjectEmitsOptions, ComponentInternalOptions, AsyncComponentInternalOptions, ComponentPropsOptions, EmitsOptions, CreateAppFunction, AsyncComponentLoader, AsyncComponentOptions, DirectiveModifiers, VueElementBase, CustomElementOptions } from '@vue/runtime-dom';
|
|
2
2
|
import { Ref, EffectScope, ReactiveEffect, ShallowRef } from '@vue/reactivity';
|
|
3
|
-
import { NormalizedStyle } from '@vue/shared';
|
|
3
|
+
import { Namespace, NormalizedStyle } from '@vue/shared';
|
|
4
4
|
|
|
5
5
|
type NodeRef = string | Ref | ((ref: Element | VaporComponentInstance, refs: Record<string, any>) => void);
|
|
6
6
|
type RefEl = Element | VaporComponentInstance;
|
|
7
|
-
type setRefFn = (el: RefEl, ref: NodeRef, oldRef?: NodeRef, refFor?: boolean) => NodeRef | undefined;
|
|
7
|
+
type setRefFn = (el: RefEl, ref: NodeRef, oldRef?: NodeRef, refFor?: boolean, refKey?: string) => NodeRef | undefined;
|
|
8
8
|
export declare function createTemplateRefSetter(): setRefFn;
|
|
9
9
|
|
|
10
10
|
export declare class VaporFragment<T extends Block = Block> implements TransitionOptions {
|
|
@@ -18,6 +18,7 @@ export declare class VaporFragment<T extends Block = Block> implements Transitio
|
|
|
18
18
|
remove?: (parent?: ParentNode, transitionHooks?: TransitionHooks) => void;
|
|
19
19
|
hydrate?: (...args: any[]) => void;
|
|
20
20
|
setRef?: (instance: VaporComponentInstance, ref: NodeRef, refFor: boolean, refKey: string | undefined) => void;
|
|
21
|
+
updated?: ((nodes?: Block) => void)[];
|
|
21
22
|
constructor(nodes: T);
|
|
22
23
|
}
|
|
23
24
|
declare class ForFragment extends VaporFragment<Block[]> {
|
|
@@ -29,8 +30,9 @@ declare class DynamicFragment extends VaporFragment {
|
|
|
29
30
|
current?: BlockFn;
|
|
30
31
|
fallback?: BlockFn;
|
|
31
32
|
anchorLabel?: string;
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
getScope?: (key: any) => EffectScope | undefined;
|
|
34
|
+
beforeTeardown?: ((oldKey: any, nodes: Block, scope: EffectScope) => boolean)[];
|
|
35
|
+
beforeMount?: ((newKey: any, nodes: Block, scope: EffectScope) => void)[];
|
|
34
36
|
constructor(anchorLabel?: string);
|
|
35
37
|
update(render?: BlockFn, key?: any): void;
|
|
36
38
|
private render;
|
|
@@ -43,6 +45,7 @@ interface VaporTransitionHooks extends TransitionHooks {
|
|
|
43
45
|
props: TransitionProps;
|
|
44
46
|
instance: VaporComponentInstance;
|
|
45
47
|
disabled?: boolean;
|
|
48
|
+
group?: boolean;
|
|
46
49
|
}
|
|
47
50
|
interface TransitionOptions {
|
|
48
51
|
$key?: any;
|
|
@@ -90,18 +93,9 @@ type DynamicSlot = {
|
|
|
90
93
|
type DynamicSlotFn = () => DynamicSlot | DynamicSlot[];
|
|
91
94
|
type DynamicSlotSource = StaticSlots | DynamicSlotFn;
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* 1. Reactive effects created inside the slot (e.g., `renderEffect`) bind to the
|
|
97
|
-
* parent's instance, so the parent's lifecycle hooks fire when the slot's
|
|
98
|
-
* reactive dependencies change.
|
|
99
|
-
* 2. Elements created in the slot inherit the parent's scopeId for proper style
|
|
100
|
-
* scoping in scoped CSS.
|
|
101
|
-
*
|
|
102
|
-
* **Rationale**: Slots are defined in the parent's template, so the parent should
|
|
103
|
-
* own the rendering context and be aware of updates.
|
|
104
|
-
*
|
|
96
|
+
* Wrap a slot function to memoize currentInstance
|
|
97
|
+
* 1. ensure correct currentInstance in forwarded slots
|
|
98
|
+
* 2. elements created in the slot inherit the slot owner's scopeId
|
|
105
99
|
*/
|
|
106
100
|
export declare function withVaporCtx(fn: Function): BlockFn;
|
|
107
101
|
export declare function createSlot(name: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, noSlotted?: boolean): Block;
|
|
@@ -117,12 +111,14 @@ declare class TeleportFragment extends VaporFragment {
|
|
|
117
111
|
private rawProps?;
|
|
118
112
|
private resolvedProps?;
|
|
119
113
|
private rawSlots?;
|
|
114
|
+
isDisabled?: boolean;
|
|
120
115
|
target?: ParentNode | null;
|
|
121
116
|
targetAnchor?: Node | null;
|
|
122
117
|
targetStart?: Node | null;
|
|
123
118
|
placeholder?: Node;
|
|
124
119
|
mountContainer?: ParentNode | null;
|
|
125
120
|
mountAnchor?: Node | null;
|
|
121
|
+
parentComponent: GenericComponentInstance;
|
|
126
122
|
constructor(props: LooseRawProps, slots: LooseRawSlots);
|
|
127
123
|
get parent(): ParentNode | null;
|
|
128
124
|
private initChildren;
|
|
@@ -187,6 +183,7 @@ declare class VaporComponentInstance implements GenericComponentInstance {
|
|
|
187
183
|
attrs: Record<string, any>;
|
|
188
184
|
propsDefaults: Record<string, any> | null;
|
|
189
185
|
slots: StaticSlots;
|
|
186
|
+
scopeId?: string | null;
|
|
190
187
|
rawPropsRef?: ShallowRef<any>;
|
|
191
188
|
rawSlotsRef?: ShallowRef<any>;
|
|
192
189
|
emit: EmitFn;
|
|
@@ -198,7 +195,9 @@ declare class VaporComponentInstance implements GenericComponentInstance {
|
|
|
198
195
|
provides: Record<string, any>;
|
|
199
196
|
ids: [string, number, number];
|
|
200
197
|
suspense: SuspenseBoundary | null;
|
|
198
|
+
renderEffects?: RenderEffect[];
|
|
201
199
|
hasFallthrough: boolean;
|
|
200
|
+
shapeFlag?: number;
|
|
202
201
|
isMounted: boolean;
|
|
203
202
|
isUnmounted: boolean;
|
|
204
203
|
isDeactivated: boolean;
|
|
@@ -221,13 +220,11 @@ declare class VaporComponentInstance implements GenericComponentInstance {
|
|
|
221
220
|
devtoolsRawSetupState?: any;
|
|
222
221
|
hmrRerender?: () => void;
|
|
223
222
|
hmrReload?: (newComp: VaporComponent) => void;
|
|
224
|
-
renderEffects?: RenderEffect[];
|
|
225
223
|
parentTeleport?: TeleportFragment | null;
|
|
226
224
|
propsOptions?: NormalizedPropsOptions;
|
|
227
225
|
emitsOptions?: ObjectEmitsOptions | null;
|
|
228
226
|
isSingleRoot?: boolean;
|
|
229
|
-
|
|
230
|
-
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: RawSlots | null, appContext?: GenericAppContext, once?: boolean);
|
|
227
|
+
constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: RawSlots | null, appContext?: GenericAppContext, once?: boolean, parent?: GenericComponentInstance | null);
|
|
231
228
|
/**
|
|
232
229
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
233
230
|
* paths where it's needed, e.g. `useModel`
|
|
@@ -241,6 +238,7 @@ export declare function isVaporComponent(value: unknown): value is VaporComponen
|
|
|
241
238
|
* element if the resolution fails.
|
|
242
239
|
*/
|
|
243
240
|
export declare function createComponentWithFallback(comp: VaporComponent | string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean, appContext?: GenericAppContext): HTMLElement | VaporComponentInstance;
|
|
241
|
+
export declare function createPlainElement(comp: string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean): HTMLElement;
|
|
244
242
|
|
|
245
243
|
export declare const createVaporApp: CreateAppFunction<ParentNode, VaporComponent>;
|
|
246
244
|
export declare const createVaporSSRApp: CreateAppFunction<ParentNode, VaporComponent>;
|
|
@@ -261,6 +259,29 @@ export declare function withVaporDirectives(node: Element | VaporComponentInstan
|
|
|
261
259
|
|
|
262
260
|
export declare const VaporKeepAliveImpl: ObjectVaporComponent;
|
|
263
261
|
|
|
262
|
+
type VaporElementConstructor<P = {}> = {
|
|
263
|
+
new (initialProps?: Record<string, any>): VaporElement & P;
|
|
264
|
+
};
|
|
265
|
+
export declare function defineVaporCustomElement(options: any, extraOptions?: Omit<ObjectVaporComponent, 'setup'>,
|
|
266
|
+
/**
|
|
267
|
+
* @internal
|
|
268
|
+
*/
|
|
269
|
+
_createApp?: CreateAppFunction<ParentNode, VaporComponent>): VaporElementConstructor;
|
|
270
|
+
export declare const defineVaporSSRCustomElement: typeof defineVaporCustomElement;
|
|
271
|
+
type VaporInnerComponentDef = VaporComponent & CustomElementOptions;
|
|
272
|
+
declare class VaporElement extends VueElementBase<ParentNode, VaporComponent, VaporInnerComponentDef> {
|
|
273
|
+
constructor(def: VaporInnerComponentDef, props?: Record<string, any> | undefined, createAppFn?: CreateAppFunction<ParentNode, VaporComponent>);
|
|
274
|
+
protected _needsHydration(): boolean;
|
|
275
|
+
protected _mount(def: VaporInnerComponentDef): void;
|
|
276
|
+
protected _update(): void;
|
|
277
|
+
protected _unmount(): void;
|
|
278
|
+
/**
|
|
279
|
+
* Only called when shadowRoot is false
|
|
280
|
+
*/
|
|
281
|
+
protected _updateSlotNodes(replacements: Map<Node, Node[]>): void;
|
|
282
|
+
private _createComponent;
|
|
283
|
+
}
|
|
284
|
+
|
|
264
285
|
type InsertionParent = ParentNode & {
|
|
265
286
|
$fc?: Node | null;
|
|
266
287
|
$llc?: Node | null;
|
|
@@ -278,7 +299,7 @@ export declare function setInsertionState(parent: ParentNode & {
|
|
|
278
299
|
}, anchor?: Node | 0 | null | number, last?: boolean): void;
|
|
279
300
|
|
|
280
301
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
281
|
-
export declare function template(html: string, root?: boolean): () => Node & {
|
|
302
|
+
export declare function template(html: string, root?: boolean, ns?: Namespace): () => Node & {
|
|
282
303
|
$root?: true;
|
|
283
304
|
};
|
|
284
305
|
|
|
@@ -304,9 +325,9 @@ type TargetElement = Element & {
|
|
|
304
325
|
_value?: any;
|
|
305
326
|
};
|
|
306
327
|
export declare function setProp(el: any, key: string, value: any): void;
|
|
307
|
-
export declare function setAttr(el: any, key: string, value: any): void;
|
|
308
|
-
export declare function setDOMProp(el: any, key: string, value: any, forceHydrate?: boolean): void;
|
|
309
|
-
export declare function setClass(el: TargetElement, value: any): void;
|
|
328
|
+
export declare function setAttr(el: any, key: string, value: any, isSVG?: boolean): void;
|
|
329
|
+
export declare function setDOMProp(el: any, key: string, value: any, forceHydrate?: boolean, attrName?: string): void;
|
|
330
|
+
export declare function setClass(el: TargetElement, value: any, isSVG?: boolean): void;
|
|
310
331
|
export declare function setStyle(el: TargetElement, value: any): void;
|
|
311
332
|
export declare function setValue(el: TargetElement, value: any, forceHydrate?: boolean): void;
|
|
312
333
|
/**
|
|
@@ -330,7 +351,7 @@ export declare function setHtml(el: TargetElement, value: any): void;
|
|
|
330
351
|
export declare function setBlockHtml(block: Block & {
|
|
331
352
|
$html?: string;
|
|
332
353
|
}, value: any): void;
|
|
333
|
-
export declare function setDynamicProps(el: any, args: any[]): void;
|
|
354
|
+
export declare function setDynamicProps(el: any, args: any[], isSVG?: boolean): void;
|
|
334
355
|
|
|
335
356
|
export declare function on(el: Element, event: string, handler: (e: Event) => any, options?: AddEventListenerOptions & {
|
|
336
357
|
effect?: boolean;
|
|
@@ -338,6 +359,7 @@ export declare function on(el: Element, event: string, handler: (e: Event) => an
|
|
|
338
359
|
export declare function delegate(el: any, event: string, handler: (e: Event) => any): void;
|
|
339
360
|
export declare const delegateEvents: (...names: string[]) => void;
|
|
340
361
|
export declare function setDynamicEvents(el: HTMLElement, events: Record<string, (...args: any[]) => any>): void;
|
|
362
|
+
export declare function createInvoker(handler: (...args: any[]) => any): (...args: any[]) => any;
|
|
341
363
|
|
|
342
364
|
export declare function createIf(condition: () => any, b1: BlockFn, b2?: BlockFn, once?: boolean): Block;
|
|
343
365
|
|
|
@@ -351,6 +373,8 @@ export declare function createForSlots(rawSource: Source, getSlot: (item: any, k
|
|
|
351
373
|
export declare function getRestElement(val: any, keys: string[]): any;
|
|
352
374
|
export declare function getDefaultValue(val: any, defaultVal: any): any;
|
|
353
375
|
|
|
376
|
+
export declare function useVaporCssVars(getter: () => Record<string, string>): void;
|
|
377
|
+
|
|
354
378
|
export declare function createDynamicComponent(getter: () => any, rawProps?: RawProps | null, rawSlots?: RawSlots | null, isSingleRoot?: boolean, once?: boolean): VaporFragment;
|
|
355
379
|
|
|
356
380
|
export declare function applyVShow(target: Block, source: () => any): void;
|