@vue/runtime-vapor 3.6.0-alpha.3 → 3.6.0-alpha.4

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.
@@ -1,6 +1,6 @@
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;
@@ -43,6 +43,7 @@ interface VaporTransitionHooks extends TransitionHooks {
43
43
  props: TransitionProps;
44
44
  instance: VaporComponentInstance;
45
45
  disabled?: boolean;
46
+ group?: boolean;
46
47
  }
47
48
  interface TransitionOptions {
48
49
  $key?: any;
@@ -90,18 +91,9 @@ type DynamicSlot = {
90
91
  type DynamicSlotFn = () => DynamicSlot | DynamicSlot[];
91
92
  type DynamicSlotSource = StaticSlots | DynamicSlotFn;
92
93
  /**
93
- * Wraps a slot function to execute in the parent component's context.
94
- *
95
- * This ensures that:
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
- *
94
+ * Wrap a slot function to memoize currentInstance
95
+ * 1. ensure correct currentInstance in forwarded slots
96
+ * 2. elements created in the slot inherit the slot owner's scopeId
105
97
  */
106
98
  export declare function withVaporCtx(fn: Function): BlockFn;
107
99
  export declare function createSlot(name: string | (() => string), rawProps?: LooseRawProps | null, fallback?: VaporSlot, noSlotted?: boolean): Block;
@@ -123,6 +115,7 @@ declare class TeleportFragment extends VaporFragment {
123
115
  placeholder?: Node;
124
116
  mountContainer?: ParentNode | null;
125
117
  mountAnchor?: Node | null;
118
+ parentComponent: GenericComponentInstance;
126
119
  constructor(props: LooseRawProps, slots: LooseRawSlots);
127
120
  get parent(): ParentNode | null;
128
121
  private initChildren;
@@ -187,6 +180,7 @@ declare class VaporComponentInstance implements GenericComponentInstance {
187
180
  attrs: Record<string, any>;
188
181
  propsDefaults: Record<string, any> | null;
189
182
  slots: StaticSlots;
183
+ scopeId?: string | null;
190
184
  rawPropsRef?: ShallowRef<any>;
191
185
  rawSlotsRef?: ShallowRef<any>;
192
186
  emit: EmitFn;
@@ -198,7 +192,9 @@ declare class VaporComponentInstance implements GenericComponentInstance {
198
192
  provides: Record<string, any>;
199
193
  ids: [string, number, number];
200
194
  suspense: SuspenseBoundary | null;
195
+ renderEffects?: RenderEffect[];
201
196
  hasFallthrough: boolean;
197
+ shapeFlag?: number;
202
198
  isMounted: boolean;
203
199
  isUnmounted: boolean;
204
200
  isDeactivated: boolean;
@@ -221,13 +217,11 @@ declare class VaporComponentInstance implements GenericComponentInstance {
221
217
  devtoolsRawSetupState?: any;
222
218
  hmrRerender?: () => void;
223
219
  hmrReload?: (newComp: VaporComponent) => void;
224
- renderEffects?: RenderEffect[];
225
220
  parentTeleport?: TeleportFragment | null;
226
221
  propsOptions?: NormalizedPropsOptions;
227
222
  emitsOptions?: ObjectEmitsOptions | null;
228
223
  isSingleRoot?: boolean;
229
- shapeFlag?: number;
230
- constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: RawSlots | null, appContext?: GenericAppContext, once?: boolean);
224
+ constructor(comp: VaporComponent, rawProps?: RawProps | null, rawSlots?: RawSlots | null, appContext?: GenericAppContext, once?: boolean, parent?: GenericComponentInstance | null);
231
225
  /**
232
226
  * Expose `getKeysFromRawProps` on the instance so it can be used in code
233
227
  * paths where it's needed, e.g. `useModel`
@@ -241,6 +235,7 @@ export declare function isVaporComponent(value: unknown): value is VaporComponen
241
235
  * element if the resolution fails.
242
236
  */
243
237
  export declare function createComponentWithFallback(comp: VaporComponent | string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean, appContext?: GenericAppContext): HTMLElement | VaporComponentInstance;
238
+ export declare function createPlainElement(comp: string, rawProps?: LooseRawProps | null, rawSlots?: LooseRawSlots | null, isSingleRoot?: boolean, once?: boolean): HTMLElement;
244
239
 
245
240
  export declare const createVaporApp: CreateAppFunction<ParentNode, VaporComponent>;
246
241
  export declare const createVaporSSRApp: CreateAppFunction<ParentNode, VaporComponent>;
@@ -261,6 +256,29 @@ export declare function withVaporDirectives(node: Element | VaporComponentInstan
261
256
 
262
257
  export declare const VaporKeepAliveImpl: ObjectVaporComponent;
263
258
 
259
+ type VaporElementConstructor<P = {}> = {
260
+ new (initialProps?: Record<string, any>): VaporElement & P;
261
+ };
262
+ export declare function defineVaporCustomElement(options: any, extraOptions?: Omit<ObjectVaporComponent, 'setup'>,
263
+ /**
264
+ * @internal
265
+ */
266
+ _createApp?: CreateAppFunction<ParentNode, VaporComponent>): VaporElementConstructor;
267
+ export declare const defineVaporSSRCustomElement: typeof defineVaporCustomElement;
268
+ type VaporInnerComponentDef = VaporComponent & CustomElementOptions;
269
+ declare class VaporElement extends VueElementBase<ParentNode, VaporComponent, VaporInnerComponentDef> {
270
+ constructor(def: VaporInnerComponentDef, props?: Record<string, any> | undefined, createAppFn?: CreateAppFunction<ParentNode, VaporComponent>);
271
+ protected _needsHydration(): boolean;
272
+ protected _mount(def: VaporInnerComponentDef): void;
273
+ protected _update(): void;
274
+ protected _unmount(): void;
275
+ /**
276
+ * Only called when shadowRoot is false
277
+ */
278
+ protected _updateSlotNodes(replacements: Map<Node, Node[]>): void;
279
+ private _createComponent;
280
+ }
281
+
264
282
  type InsertionParent = ParentNode & {
265
283
  $fc?: Node | null;
266
284
  $llc?: Node | null;
@@ -278,7 +296,7 @@ export declare function setInsertionState(parent: ParentNode & {
278
296
  }, anchor?: Node | 0 | null | number, last?: boolean): void;
279
297
 
280
298
  /*! #__NO_SIDE_EFFECTS__ */
281
- export declare function template(html: string, root?: boolean): () => Node & {
299
+ export declare function template(html: string, root?: boolean, ns?: Namespace): () => Node & {
282
300
  $root?: true;
283
301
  };
284
302
 
@@ -304,9 +322,9 @@ type TargetElement = Element & {
304
322
  _value?: any;
305
323
  };
306
324
  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;
325
+ export declare function setAttr(el: any, key: string, value: any, isSVG?: boolean): void;
326
+ export declare function setDOMProp(el: any, key: string, value: any, forceHydrate?: boolean, attrName?: string): void;
327
+ export declare function setClass(el: TargetElement, value: any, isSVG?: boolean): void;
310
328
  export declare function setStyle(el: TargetElement, value: any): void;
311
329
  export declare function setValue(el: TargetElement, value: any, forceHydrate?: boolean): void;
312
330
  /**
@@ -330,7 +348,7 @@ export declare function setHtml(el: TargetElement, value: any): void;
330
348
  export declare function setBlockHtml(block: Block & {
331
349
  $html?: string;
332
350
  }, value: any): void;
333
- export declare function setDynamicProps(el: any, args: any[]): void;
351
+ export declare function setDynamicProps(el: any, args: any[], root?: boolean, isSVG?: boolean): void;
334
352
 
335
353
  export declare function on(el: Element, event: string, handler: (e: Event) => any, options?: AddEventListenerOptions & {
336
354
  effect?: boolean;
@@ -338,6 +356,7 @@ export declare function on(el: Element, event: string, handler: (e: Event) => an
338
356
  export declare function delegate(el: any, event: string, handler: (e: Event) => any): void;
339
357
  export declare const delegateEvents: (...names: string[]) => void;
340
358
  export declare function setDynamicEvents(el: HTMLElement, events: Record<string, (...args: any[]) => any>): void;
359
+ export declare function createInvoker(handler: (...args: any[]) => any): (...args: any[]) => any;
341
360
 
342
361
  export declare function createIf(condition: () => any, b1: BlockFn, b2?: BlockFn, once?: boolean): Block;
343
362