@vue/runtime-core 3.5.0-alpha.3 → 3.5.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.
@@ -1119,7 +1119,7 @@ declare enum TeleportMoveTypes {
1119
1119
  REORDER = 2
1120
1120
  }
1121
1121
  declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
1122
- declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
1122
+ declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector, insert, createText }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
1123
1123
  export declare const Teleport: {
1124
1124
  new (): {
1125
1125
  $props: VNodeProps & TeleportProps;
@@ -1461,7 +1461,7 @@ export declare function registerRuntimeCompiler(_compile: any): void;
1461
1461
  export declare const isRuntimeOnly: () => boolean;
1462
1462
 
1463
1463
  export type WatchEffect = (onCleanup: OnCleanup) => void;
1464
- export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
1464
+ export type WatchSource<T = any> = Ref<T, any> | ComputedRef<T> | (() => T);
1465
1465
  export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
1466
1466
  type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
1467
1467
  type MapSources<T, Immediate> = {
@@ -1486,6 +1486,22 @@ export declare function watch<T extends Readonly<MultiWatchSources>, Immediate e
1486
1486
  export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
1487
1487
  export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
1488
1488
 
1489
+ /**
1490
+ * A lazy hydration strategy for async components.
1491
+ * @param hydrate - call this to perform the actual hydration.
1492
+ * @param forEachElement - iterate through the root elements of the component's
1493
+ * non-hydrated DOM, accounting for possible fragments.
1494
+ * @returns a teardown function to be called if the async component is unmounted
1495
+ * before it is hydrated. This can be used to e.g. remove DOM event
1496
+ * listeners.
1497
+ */
1498
+ export type HydrationStrategy = (hydrate: () => void, forEachElement: (cb: (el: Element) => any) => void) => (() => void) | void;
1499
+ export type HydrationStrategyFactory<Options = any> = (options?: Options) => HydrationStrategy;
1500
+ export declare const hydrateOnIdle: HydrationStrategyFactory;
1501
+ export declare const hydrateOnVisible: HydrationStrategyFactory<string | number>;
1502
+ export declare const hydrateOnMediaQuery: HydrationStrategyFactory<string>;
1503
+ export declare const hydrateOnInteraction: HydrationStrategyFactory<string | string[]>;
1504
+
1489
1505
  type AsyncComponentResolveResult<T = Component> = T | {
1490
1506
  default: T;
1491
1507
  };
@@ -1497,6 +1513,7 @@ export interface AsyncComponentOptions<T = any> {
1497
1513
  delay?: number;
1498
1514
  timeout?: number;
1499
1515
  suspensible?: boolean;
1516
+ hydrate?: HydrationStrategy;
1500
1517
  onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
1501
1518
  }
1502
1519
  /*! #__NO_SIDE_EFFECTS__ */