UNPKG

@kdujs/runtime-core-canary

Version:
898 lines (872 loc) 83.6 kB
import { computed as computed$1, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, Ref, ReactiveEffect, ComputedRef, DebuggerOptions, reactive } from '@kdujs/reactivity'; export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@kdujs/reactivity'; import { IfAny, Prettify, Awaited, UnionToIntersection, LooseRequired } from '@kdujs/shared'; export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@kdujs/shared'; export declare const computed: typeof computed$1; export type Slot<T extends any = any> = (...args: IfAny<T, any[], [T] | (T extends undefined ? [] : never)>) => KNode[]; type InternalSlots = { [name: string]: Slot | undefined; }; export type Slots = Readonly<InternalSlots>; declare const SlotSymbol: unique symbol; export type SlotsType<T extends Record<string, any> = Record<string, any>> = { [SlotSymbol]?: T; }; type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T> & T; type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{ [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>; }>>; type RawSlots = { [name: string]: unknown; $stable?: boolean; }; interface SchedulerJob extends Function { id?: number; pre?: boolean; active?: boolean; computed?: boolean; /** * Indicates whether the effect is allowed to recursively trigger itself * when managed by the scheduler. * * By default, a job cannot trigger itself because some built-in method calls, * e.g. Array.prototype.push actually performs reads as well (#1740) which * can lead to confusing infinite loops. * The allowed cases are component update functions and watch callbacks. * Component update functions may update child component props, which in turn * trigger flush: "pre" watch callbacks that mutates state that the parent * relies on (#1801). Watch callbacks doesn't track its dependencies so if it * triggers itself again, it's likely intentional and it is the user's * responsibility to perform recursive state mutation that eventually * stabilizes (#1727). */ allowRecurse?: boolean; /** * Attached by renderer.ts when setting up a component's render effect * Used to obtain component information when reporting max recursive updates. * dev only. */ ownerInstance?: ComponentInternalInstance; } type SchedulerJobs = SchedulerJob | SchedulerJob[]; export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>; export declare function queuePostFlushCb(cb: SchedulerJobs): void; export type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>; export type EmitsOptions = ObjectEmitsOptions | string[]; type EmitsToProps<T extends EmitsOptions> = T extends string[] ? { [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any; } : T extends ObjectEmitsOptions ? { [K in `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : T[Uncapitalize<C>] extends null ? any[] : never) => any : never; } : {}; type ShortEmitsToObject<E> = E extends Record<string, any[]> ? { [K in keyof E]: (...args: E[K]) => any; } : E; type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{ [key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void; }[Event]>; /** * Custom properties added to component instances in any way and can be accessed through `this` * * @example * Here is an example of adding a property `$router` to every component instance: * ```ts * import { createApp } from 'kdu' * import { Router, createRouter } from 'kdu-router' * * declare module '@kdujs/runtime-core' { * interface ComponentCustomProperties { * $router: Router * } * } * * // effectively adding the router to every component instance * const app = createApp({}) * const router = createRouter() * app.config.globalProperties.$router = router * * const vm = app.mount('#app') * // we can access the router from the instance * vm.$router.push('/') * ``` */ export interface ComponentCustomProperties { } type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin ? ComponentOptionsMixin extends T ? true : false : false; type MixinToOptionTypes<T> = T extends ComponentOptionsBase<infer P, infer B, infer D, infer C, infer M, infer Mixin, infer Extends, any, any, infer Defaults, any, any, any> ? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> & IntersectionMixin<Mixin> & IntersectionMixin<Extends> : never; type ExtractMixin<T> = { Mixin: MixinToOptionTypes<T>; }[T extends ComponentOptionsMixin ? 'Mixin' : never]; type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true ? OptionTypesType : UnionToIntersection<ExtractMixin<T>>; type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never; type EnsureNonVoid<T> = T extends void ? {} : T; type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = { __isFragment?: never; __isTeleport?: never; __isSuspense?: never; new (...args: any[]): T; }; export type CreateComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S>, I, S>; export type ComponentPublicInstance<P = {}, // props type extracted from props option B = {}, // raw bindings returned from setup() D = {}, // return from data() C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}> = { $: ComponentInternalInstance; $data: D; $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps; $attrs: Data; $refs: Data; $slots: UnwrapSlotsType<S>; $root: ComponentPublicInstance | null; $parent: ComponentPublicInstance | null; $emit: EmitFn<E>; $el: any; $options: Options & MergedComponentOptionsOverride; $forceUpdate: () => void; $nextTick: typeof nextTick; $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle; } & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>; declare enum LifecycleHooks { BEFORE_CREATE = "bc", CREATED = "c", BEFORE_MOUNT = "bm", MOUNTED = "m", BEFORE_UPDATE = "bu", UPDATED = "u", BEFORE_UNMOUNT = "bum", UNMOUNTED = "um", DEACTIVATED = "da", ACTIVATED = "a", RENDER_TRIGGERED = "rtg", RENDER_TRACKED = "rtc", ERROR_CAPTURED = "ec", SERVER_PREFETCH = "sp" } export interface SuspenseProps { onResolve?: () => void; onPending?: () => void; onFallback?: () => void; timeout?: string | number; /** * Allow suspense to be captured by parent suspense * * @default false */ suspensible?: boolean; } declare const SuspenseImpl: { name: string; __isSuspense: boolean; process(n1: KNode | null, n2: KNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void; hydrate: typeof hydrateSuspense; create: typeof createSuspenseBoundary; normalize: typeof normalizeSuspenseChildren; }; export declare const Suspense: { new (): { $props: KNodeProps & SuspenseProps; $slots: { default(): KNode[]; fallback(): KNode[]; }; }; __isSuspense: true; }; export interface SuspenseBoundary { knode: KNode<RendererNode, RendererElement, SuspenseProps>; parent: SuspenseBoundary | null; parentComponent: ComponentInternalInstance | null; namespace: ElementNamespace; container: RendererElement; hiddenContainer: RendererElement; activeBranch: KNode | null; pendingBranch: KNode | null; deps: number; pendingId: number; timeout: number; isInFallback: boolean; isHydrating: boolean; isUnmounted: boolean; effects: Function[]; resolve(force?: boolean, sync?: boolean): void; fallback(fallbackKNode: KNode): void; move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void; next(): RendererNode | null; registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn): void; unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void; } declare function createSuspenseBoundary(knode: KNode, parentSuspense: SuspenseBoundary | null, parentComponent: ComponentInternalInstance | null, container: RendererElement, hiddenContainer: RendererElement, anchor: RendererNode | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, isHydrating?: boolean): SuspenseBoundary; declare function hydrateSuspense(node: Node, knode: KNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, knode: KNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null; declare function normalizeSuspenseChildren(knode: KNode): void; export type RootHydrateFunction = (knode: KNode<Node, Element>, container: (Element | ShadowRoot) & { _knode?: KNode; }) => void; type Hook<T = () => void> = T | T[]; export interface BaseTransitionProps<HostElement = RendererElement> { mode?: 'in-out' | 'out-in' | 'default'; appear?: boolean; persisted?: boolean; onBeforeEnter?: Hook<(el: HostElement) => void>; onEnter?: Hook<(el: HostElement, done: () => void) => void>; onAfterEnter?: Hook<(el: HostElement) => void>; onEnterCancelled?: Hook<(el: HostElement) => void>; onBeforeLeave?: Hook<(el: HostElement) => void>; onLeave?: Hook<(el: HostElement, done: () => void) => void>; onAfterLeave?: Hook<(el: HostElement) => void>; onLeaveCancelled?: Hook<(el: HostElement) => void>; onBeforeAppear?: Hook<(el: HostElement) => void>; onAppear?: Hook<(el: HostElement, done: () => void) => void>; onAfterAppear?: Hook<(el: HostElement) => void>; onAppearCancelled?: Hook<(el: HostElement) => void>; } export interface TransitionHooks<HostElement = RendererElement> { mode: BaseTransitionProps['mode']; persisted: boolean; beforeEnter(el: HostElement): void; enter(el: HostElement): void; leave(el: HostElement, remove: () => void): void; clone(knode: KNode): TransitionHooks<HostElement>; afterLeave?(): void; delayLeave?(el: HostElement, earlyRemove: () => void, delayedLeave: () => void): void; delayedLeave?(): void; } export interface TransitionState { isMounted: boolean; isLeaving: boolean; isUnmounting: boolean; leavingKNodes: Map<any, Record<string, KNode>>; } export declare function useTransitionState(): TransitionState; export declare const BaseTransitionPropsValidators: { mode: StringConstructor; appear: BooleanConstructor; persisted: BooleanConstructor; onBeforeEnter: (ArrayConstructor | FunctionConstructor)[]; onEnter: (ArrayConstructor | FunctionConstructor)[]; onAfterEnter: (ArrayConstructor | FunctionConstructor)[]; onEnterCancelled: (ArrayConstructor | FunctionConstructor)[]; onBeforeLeave: (ArrayConstructor | FunctionConstructor)[]; onLeave: (ArrayConstructor | FunctionConstructor)[]; onAfterLeave: (ArrayConstructor | FunctionConstructor)[]; onLeaveCancelled: (ArrayConstructor | FunctionConstructor)[]; onBeforeAppear: (ArrayConstructor | FunctionConstructor)[]; onAppear: (ArrayConstructor | FunctionConstructor)[]; onAfterAppear: (ArrayConstructor | FunctionConstructor)[]; onAppearCancelled: (ArrayConstructor | FunctionConstructor)[]; }; export declare const BaseTransition: new () => { $props: BaseTransitionProps<any>; $slots: { default(): KNode[]; }; }; export declare function resolveTransitionHooks(knode: KNode, props: BaseTransitionProps<any>, state: TransitionState, instance: ComponentInternalInstance): TransitionHooks; export declare function setTransitionHooks(knode: KNode, hooks: TransitionHooks): void; export declare function getTransitionRawChildren(children: KNode[], keepComment?: boolean, parentKey?: KNode['key']): KNode[]; export interface Renderer<HostElement = RendererElement> { render: RootRenderFunction<HostElement>; createApp: CreateAppFunction<HostElement>; } export interface HydrationRenderer extends Renderer<Element | ShadowRoot> { hydrate: RootHydrateFunction; } export type ElementNamespace = 'svg' | 'mathml' | undefined; export type RootRenderFunction<HostElement = RendererElement> = (knode: KNode | null, container: HostElement, namespace?: ElementNamespace) => void; export interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> { patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, prevChildren?: KNode<HostNode, HostElement>[], parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, unmountChildren?: UnmountChildrenFn): void; insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void; remove(el: HostNode): void; createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, knodeProps?: (KNodeProps & { [key: string]: any; }) | null): HostElement; createText(text: string): HostNode; createComment(text: string): HostNode; setText(node: HostNode, text: string): void; setElementText(node: HostElement, text: string): void; parentNode(node: HostNode): HostElement | null; nextSibling(node: HostNode): HostNode | null; querySelector?(selector: string): HostElement | null; setScopeId?(el: HostElement, id: string): void; cloneNode?(node: HostNode): HostNode; insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode]; } export interface RendererNode { [key: string]: any; } export interface RendererElement extends RendererNode { } interface RendererInternals<HostNode = RendererNode, HostElement = RendererElement> { p: PatchFn; um: UnmountFn; r: RemoveFn; m: MoveFn; mt: MountComponentFn; mc: MountChildrenFn; pc: PatchChildrenFn; pbc: PatchBlockChildrenFn; n: NextFn; o: RendererOptions<HostNode, HostElement>; } type PatchFn = (n1: KNode | null, // null means this is a mount n2: KNode, container: RendererElement, anchor?: RendererNode | null, parentComponent?: ComponentInternalInstance | null, parentSuspense?: SuspenseBoundary | null, namespace?: ElementNamespace, slotScopeIds?: string[] | null, optimized?: boolean) => void; type MountChildrenFn = (children: KNodeArrayChildren, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, start?: number) => void; type PatchChildrenFn = (n1: KNode | null, n2: KNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean) => void; type PatchBlockChildrenFn = (oldChildren: KNode[], newChildren: KNode[], fallbackContainer: RendererElement, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null) => void; type MoveFn = (knode: KNode, container: RendererElement, anchor: RendererNode | null, type: MoveType, parentSuspense?: SuspenseBoundary | null) => void; type NextFn = (knode: KNode) => RendererNode | null; type UnmountFn = (knode: KNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void; type RemoveFn = (knode: KNode) => void; type UnmountChildrenFn = (children: KNode[], parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean, start?: number) => void; type MountComponentFn = (initialKNode: KNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void; type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialKNode: KNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void; declare enum MoveType { ENTER = 0, LEAVE = 1, REORDER = 2 } /** * The createRenderer function accepts two generic arguments: * HostNode and HostElement, corresponding to Node and Element types in the * host environment. For example, for runtime-dom, HostNode would be the DOM * `Node` interface and HostElement would be the DOM `Element` interface. * * Custom renderers can pass in the platform specific types like this: * * ``` js * const { render, createApp } = createRenderer<Node, Element>({ * patchProp, * ...nodeOps * }) * ``` */ export declare function createRenderer<HostNode = RendererNode, HostElement = RendererElement>(options: RendererOptions<HostNode, HostElement>): Renderer<HostElement>; export declare function createHydrationRenderer(options: RendererOptions<Node, Element>): HydrationRenderer; type MatchPattern = string | RegExp | (string | RegExp)[]; export interface KeepAliveProps { include?: MatchPattern; exclude?: MatchPattern; max?: number | string; } export declare const KeepAlive: { new (): { $props: KNodeProps & KeepAliveProps; $slots: { default(): KNode[]; }; }; __isKeepAlive: true; }; export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void; export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void; export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) => void; export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) => void; type DebuggerHook = (e: DebuggerEvent) => void; export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => void; export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => void; type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void; export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void; export type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[]; export type ComponentObjectPropsOptions<P = Data> = { [K in keyof P]: Prop<P[K]> | null; }; export type Prop<T, D = T> = PropOptions<T, D> | PropType<T>; type DefaultFactory<T> = (props: Data) => T | null | undefined; interface PropOptions<T = any, D = T> { type?: PropType<T> | true | null; required?: boolean; default?: D | DefaultFactory<D> | null | undefined | object; validator?(value: unknown, props: Data): boolean; } export type PropType<T> = PropConstructor<T> | PropConstructor<T>[]; type PropConstructor<T = any> = { new (...args: any[]): T & {}; } | { (): T; } | PropMethod<T>; type PropMethod<T, TConstructor = any> = [T] extends [ ((...args: any) => any) | undefined ] ? { new (): TConstructor; (): T; readonly prototype: TConstructor; } : never; type RequiredKeys<T> = { [K in keyof T]: T[K] extends { required: true; } | { default: any; } | BooleanConstructor | { type: BooleanConstructor; } ? T[K] extends { default: undefined | (() => undefined); } ? never : K : never; }[keyof T]; type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>; type DefaultKeys<T> = { [K in keyof T]: T[K] extends { default: any; } | BooleanConstructor | { type: BooleanConstructor; } ? T[K] extends { type: BooleanConstructor; required: true; } ? never : K : never; }[keyof T]; type InferPropType<T> = [T] extends [null] ? any : [T] extends [{ type: null | true; }] ? any : [T] extends [ObjectConstructor | { type: ObjectConstructor; }] ? Record<string, any> : [T] extends [BooleanConstructor | { type: BooleanConstructor; }] ? boolean : [T] extends [DateConstructor | { type: DateConstructor; }] ? Date : [T] extends [(infer U)[] | { type: (infer U)[]; }] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T; /** * Extract prop types from a runtime props options object. * The extracted types are **internal** - i.e. the resolved props received by * the component. * - Boolean props are always present * - Props with default values are always present * * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}. */ export type ExtractPropTypes<O> = { [K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>; } & { [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>; }; type PublicRequiredKeys<T> = { [K in keyof T]: T[K] extends { required: true; } ? K : never; }[keyof T]; type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>; /** * Extract prop types from a runtime props options object. * The extracted types are **public** - i.e. the expected props that can be * passed to component. */ export type ExtractPublicPropTypes<O> = { [K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>; } & { [K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>; }; export type ExtractDefaultPropTypes<O> = O extends object ? { [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>; } : {}; /** Runtime helper for applying directives to a knode. Example usage: const comp = resolveComponent('comp') const foo = resolveDirective('foo') const bar = resolveDirective('bar') return withDirectives(h(comp), [ [foo, this.x], [bar, this.y] ]) */ export interface DirectiveBinding<V = any> { instance: ComponentPublicInstance | null; value: V; oldValue: V | null; arg?: string; modifiers: DirectiveModifiers; dir: ObjectDirective<any, V>; } export type DirectiveHook<T = any, Prev = KNode<any, T> | null, V = any> = (el: T, binding: DirectiveBinding<V>, knode: KNode<any, T>, prevKNode: Prev) => void; type SSRDirectiveHook<V> = (binding: DirectiveBinding<V>, knode: KNode) => Data | undefined; export interface ObjectDirective<T = any, V = any> { created?: DirectiveHook<T, null, V>; beforeMount?: DirectiveHook<T, null, V>; mounted?: DirectiveHook<T, null, V>; beforeUpdate?: DirectiveHook<T, KNode<any, T>, V>; updated?: DirectiveHook<T, KNode<any, T>, V>; beforeUnmount?: DirectiveHook<T, null, V>; unmounted?: DirectiveHook<T, null, V>; getSSRProps?: SSRDirectiveHook<V>; deep?: boolean; } export type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>; export type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>; type DirectiveModifiers = Record<string, boolean>; export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string, DirectiveModifiers]>; /** * Adds directives to a KNode. */ export declare function withDirectives<T extends KNode>(knode: T, directives: DirectiveArguments): T; declare enum DeprecationTypes$1 { GLOBAL_MOUNT = "GLOBAL_MOUNT", GLOBAL_MOUNT_CONTAINER = "GLOBAL_MOUNT_CONTAINER", GLOBAL_EXTEND = "GLOBAL_EXTEND", GLOBAL_PROTOTYPE = "GLOBAL_PROTOTYPE", GLOBAL_SET = "GLOBAL_SET", GLOBAL_DELETE = "GLOBAL_DELETE", GLOBAL_OBSERVABLE = "GLOBAL_OBSERVABLE", GLOBAL_PRIVATE_UTIL = "GLOBAL_PRIVATE_UTIL", CONFIG_SILENT = "CONFIG_SILENT", CONFIG_DEVTOOLS = "CONFIG_DEVTOOLS", CONFIG_KEY_CODES = "CONFIG_KEY_CODES", CONFIG_PRODUCTION_TIP = "CONFIG_PRODUCTION_TIP", CONFIG_IGNORED_ELEMENTS = "CONFIG_IGNORED_ELEMENTS", CONFIG_WHITESPACE = "CONFIG_WHITESPACE", CONFIG_OPTION_MERGE_STRATS = "CONFIG_OPTION_MERGE_STRATS", INSTANCE_SET = "INSTANCE_SET", INSTANCE_DELETE = "INSTANCE_DELETE", INSTANCE_DESTROY = "INSTANCE_DESTROY", INSTANCE_EVENT_EMITTER = "INSTANCE_EVENT_EMITTER", INSTANCE_EVENT_HOOKS = "INSTANCE_EVENT_HOOKS", INSTANCE_CHILDREN = "INSTANCE_CHILDREN", INSTANCE_LISTENERS = "INSTANCE_LISTENERS", INSTANCE_SCOPED_SLOTS = "INSTANCE_SCOPED_SLOTS", INSTANCE_ATTRS_CLASS_STYLE = "INSTANCE_ATTRS_CLASS_STYLE", OPTIONS_DATA_FN = "OPTIONS_DATA_FN", OPTIONS_DATA_MERGE = "OPTIONS_DATA_MERGE", OPTIONS_BEFORE_DESTROY = "OPTIONS_BEFORE_DESTROY", OPTIONS_DESTROYED = "OPTIONS_DESTROYED", WATCH_ARRAY = "WATCH_ARRAY", PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS", K_ON_KEYCODE_MODIFIER = "K_ON_KEYCODE_MODIFIER", CUSTOM_DIR = "CUSTOM_DIR", ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE", ATTR_ENUMERATED_COERCION = "ATTR_ENUMERATED_COERCION", TRANSITION_CLASSES = "TRANSITION_CLASSES", TRANSITION_GROUP_ROOT = "TRANSITION_GROUP_ROOT", COMPONENT_ASYNC = "COMPONENT_ASYNC", COMPONENT_FUNCTIONAL = "COMPONENT_FUNCTIONAL", COMPONENT_K_MODEL = "COMPONENT_K_MODEL", RENDER_FUNCTION = "RENDER_FUNCTION", FILTERS = "FILTERS", PRIVATE_APIS = "PRIVATE_APIS" } type CompatConfig = Partial<Record<DeprecationTypes$1, boolean | 'suppress-warning'>> & { MODE?: 2 | 3 | ((comp: Component | null) => 2 | 3); }; declare function configureCompat(config: CompatConfig): void; /** * Interface for declaring custom options. * * @example * ```ts * declare module '@kdujs/runtime-core' { * interface ComponentCustomOptions { * beforeRouteUpdate?( * to: Route, * from: Route, * next: () => void * ): void * } * } * ``` */ export interface ComponentCustomOptions { } export type RenderFunction = () => KNodeChild; export interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II>, ComponentInternalOptions, ComponentCustomOptions { setup?: (this: void, props: LooseRequired<Props & Prettify<UnwrapMixinsType<IntersectionMixin<Mixin> & IntersectionMixin<Extends>, 'P'>>>, ctx: SetupContext<E, S>) => Promise<RawBindings> | RawBindings | RenderFunction | void; name?: string; template?: string | object; render?: Function; components?: Record<string, Component>; directives?: Record<string, Directive>; inheritAttrs?: boolean; emits?: (E | EE[]) & ThisType<void>; slots?: S; expose?: string[]; serverPrefetch?(): void | Promise<any>; compilerOptions?: RuntimeCompilerOptions; call?: (this: unknown, ...args: unknown[]) => never; __isFragment?: never; __isTeleport?: never; __isSuspense?: never; __defaults?: Defaults; } /** * Subset of compiler options that makes sense for the runtime. */ export interface RuntimeCompilerOptions { isCustomElement?: (tag: string) => boolean; whitespace?: 'preserve' | 'condense'; comments?: boolean; delimiters?: [string, string]; } export type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, PE = Props & EmitsToProps<E>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & { props?: undefined; } & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I, S>>; export type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, Props = Prettify<Readonly<{ [key in PropNames]?: any; } & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S> & { props: PropNames[]; } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S>>; export type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, Props = Prettify<Readonly<ExtractPropTypes<PropsOptions> & EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S> & { props: PropsOptions & ThisType<void>; } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S>>; export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, S extends SlotsType = any> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, string, S> & ThisType<CreateComponentPublicInstance<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>>>; export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any>; export type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>; export interface MethodOptions { [key: string]: Function; } type ExtractComputedReturns<T extends any> = { [key in keyof T]: T[key] extends { get: (...args: any[]) => infer TReturn; } ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never; }; type ObjectWatchOptionItem = { handler: WatchCallback | string; } & WatchOptions; type WatchOptionItem = string | WatchCallback | ObjectWatchOptionItem; type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[]; type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>; export type ComponentProvideOptions = ObjectProvideOptions | Function; type ObjectProvideOptions = Record<string | symbol, unknown>; export type ComponentInjectOptions = string[] | ObjectInjectOptions; type ObjectInjectOptions = Record<string | symbol, string | symbol | { from?: string | symbol; default?: unknown; }>; type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? { [K in T[number]]?: unknown; } : T extends ObjectInjectOptions ? { [K in keyof T]?: unknown; } : never; interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> { compatConfig?: CompatConfig; [key: string]: any; data?: (this: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D; computed?: C; methods?: M; watch?: ComponentWatchOptions; provide?: ComponentProvideOptions; inject?: I | II[]; filters?: Record<string, Function>; mixins?: Mixin[]; extends?: Extends; beforeCreate?(): void; created?(): void; beforeMount?(): void; mounted?(): void; beforeUpdate?(): void; updated?(): void; activated?(): void; deactivated?(): void; /** @deprecated use `beforeUnmount` instead */ beforeDestroy?(): void; beforeUnmount?(): void; /** @deprecated use `unmounted` instead */ destroyed?(): void; unmounted?(): void; renderTracked?: DebuggerHook; renderTriggered?: DebuggerHook; errorCaptured?: ErrorCapturedHook; /** * runtime compile only * @deprecated use `compilerOptions.delimiters` instead. */ delimiters?: [string, string]; /** * #3468 * * type-only, used to assist Mixin's type inference, * typescript will try to simplify the inferred `Mixin` type, * with the `__differentiator`, typescript won't be able to combine different mixins, * because the `__differentiator` will be different */ __differentiator?: keyof D | keyof C | keyof M; } type MergedHook<T = () => void> = T | T[]; type MergedComponentOptionsOverride = { beforeCreate?: MergedHook; created?: MergedHook; beforeMount?: MergedHook; mounted?: MergedHook; beforeUpdate?: MergedHook; updated?: MergedHook; activated?: MergedHook; deactivated?: MergedHook; /** @deprecated use `beforeUnmount` instead */ beforeDestroy?: MergedHook; beforeUnmount?: MergedHook; /** @deprecated use `unmounted` instead */ destroyed?: MergedHook; unmounted?: MergedHook; renderTracked?: MergedHook<DebuggerHook>; renderTriggered?: MergedHook<DebuggerHook>; errorCaptured?: MergedHook<ErrorCapturedHook>; }; type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' | 'Defaults'; type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Defaults = {}> = { P: P; B: B; D: D; C: C; M: M; Defaults: Defaults; }; export interface InjectionKey<T> extends Symbol { } export declare function provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): void; export declare function inject<T>(key: InjectionKey<T> | string): T | undefined; export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T; export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T | (() => T), treatDefaultAsFactory: true): T; /** * Returns true if `inject()` can be used without warning about being called in the wrong place (e.g. outside of * setup()). This is used by libraries that want to use `inject()` internally without triggering a warning to the end * user. One example is `useRoute()` in `kdu-router`. */ export declare function hasInjectionContext(): boolean; export type PublicProps = KNodeProps & AllowedComponentProps & ComponentCustomProps; type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>); export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, true, {}, S>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S> & PP; export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) => CreateComponentPublicInstance<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, E, PP, {}, false, {}, S>; export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & { props?: (keyof Props)[]; emits?: E | EE[]; slots?: S; }): DefineSetupFnComponent<Props, E, S>; export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & { props?: ComponentObjectPropsOptions<Props>; emits?: E | EE[]; slots?: S; }): DefineSetupFnComponent<Props, E, S>; export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>; export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<{ [key in PropNames]?: any; }>>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>; export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<PropsOptions, E>, ExtractDefaultPropTypes<PropsOptions>, S>; export interface App<HostElement = any> { version: string; config: AppConfig; use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): this; use<Options>(plugin: Plugin<Options>, options: Options): this; mixin(mixin: ComponentOptions): this; component(name: string): Component | undefined; component(name: string, component: Component | DefineComponent): this; directive<T = any, V = any>(name: string): Directive<T, V> | undefined; directive<T = any, V = any>(name: string, directive: Directive<T, V>): this; mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance; unmount(): void; provide<T>(key: InjectionKey<T> | string, value: T): this; /** * Runs a function with the app as active instance. This allows using of `inject()` within the function to get access * to variables provided via `app.provide()`. * * @param fn - function to run with the app as active instance */ runWithContext<T>(fn: () => T): T; _uid: number; _component: ConcreteComponent; _props: Data | null; _container: HostElement | null; _context: AppContext; _instance: ComponentInternalInstance | null; /** * v2 compat only */ filter?(name: string): Function | undefined; filter?(name: string, filter: Function): this; } export type OptionMergeFunction = (to: unknown, from: unknown) => any; export interface AppConfig { readonly isNativeTag: (tag: string) => boolean; performance: boolean; optionMergeStrategies: Record<string, OptionMergeFunction>; globalProperties: ComponentCustomProperties & Record<string, any>; errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void; warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void; /** * Options to pass to `@kdujs/compiler-dom`. * Only supported in runtime compiler build. */ compilerOptions: RuntimeCompilerOptions; /** * @deprecated use config.compilerOptions.isCustomElement */ isCustomElement?: (tag: string) => boolean; /** * TODO document for 3.5 * Enable warnings for computed getters that recursively trigger itself. */ warnRecursiveComputed?: boolean; } export interface AppContext { app: App; config: AppConfig; mixins: ComponentOptions[]; components: Record<string, Component>; directives: Record<string, Directive>; provides: Record<string | symbol, any>; } type PluginInstallFunction<Options = any[]> = Options extends unknown[] ? (app: App, ...options: Options) => any : (app: App, options: Options) => any; export type ObjectPlugin<Options = any[]> = { install: PluginInstallFunction<Options>; }; export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>; export type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>; export type CreateAppFunction<HostElement> = (rootComponent: Component, rootProps?: Data | null) => App<HostElement>; type TeleportKNode = KNode<RendererNode, RendererElement, TeleportProps>; export interface TeleportProps { to: string | RendererElement | null | undefined; disabled?: boolean; } declare const TeleportImpl: { name: string; __isTeleport: boolean; process(n1: TeleportKNode | null, n2: TeleportKNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void; remove(knode: KNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void; move: typeof moveTeleport; hydrate: typeof hydrateTeleport; }; declare enum TeleportMoveTypes { TARGET_CHANGE = 0, TOGGLE = 1,// enable / disable REORDER = 2 } declare function moveTeleport(knode: KNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void; declare function hydrateTeleport(node: Node, knode: TeleportKNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, knode: KNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null; export declare const Teleport: { new (): { $props: KNodeProps & TeleportProps; $slots: { default(): KNode[]; }; }; __isTeleport: true; }; /** * @private */ export declare function resolveComponent(name: string, maybeSelfReference?: boolean): ConcreteComponent | string; declare const NULL_DYNAMIC_COMPONENT: unique symbol; /** * @private */ export declare function resolveDynamicComponent(component: unknown): KNodeTypes; /** * @private */ export declare function resolveDirective(name: string): Directive | undefined; export declare const Fragment: { new (): { $props: KNodeProps; }; __isFragment: true; }; export declare const Text: unique symbol; export declare const Comment: unique symbol; export declare const Static: unique symbol; export type KNodeTypes = string | KNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl; export type KNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void); type KNodeNormalizedRefAtom = { i: ComponentInternalInstance; r: KNodeRef; k?: string; f?: boolean; }; type KNodeNormalizedRef = KNodeNormalizedRefAtom | KNodeNormalizedRefAtom[]; type KNodeMountHook = (knode: KNode) => void; type KNodeUpdateHook = (knode: KNode, oldKNode: KNode) => void;