import { PatchFlags, SlotFlags } from './tsutils'; import type { Component, VNodeProps, VNode, VNodeChild, VNodeArrayChildren, HTMLAttributes, Slots, CSSProperties } from 'vue'; import type { IntrinsicElementAttributes, ElementClassSet, ElementStyleSet, SpecificVNode, Merge } from './tsutils'; declare type ComponentProps = (T & Record & VNodeProps & Partial<{ class: ElementClassSet; style: ElementStyleSet; }>) | null; declare type ElementProps = (IntrinsicElementAttributes[T] & Record & VNodeProps) | null; declare type ComponentChildren = SlotChildren | ArrayChildren | null; declare type SlotChildren = Partial VNodeChild>, { _: SlotFlags; }>>; declare type ArrayChildren = unknown[]; interface DirectivesConfig { condition?: boolean; node: VNodeChild | (() => VNodeChild); commentText?: string; } /** * 创建组件VNode * @param type 自定义组件 * @param props 组件Props * @param children * @param patchFlag PatchFlags * @param dynamicProps * @returns VNode */ export declare function createComponentVNode(type: Component, props?: ComponentProps, children?: ComponentChildren, patchFlag?: PatchFlags, dynamicProps?: (keyof (T & HTMLAttributes & VNodeProps))[] | null): SpecificVNode; /** * 创建内置Dom元素VNode * @param type 元素类型 * @param props 内置Props * @param children * @param patchFlag PatchFlags * @param dynamicProps * @returns VNode */ export declare function createElementVNode(type: T, props?: ElementProps, children?: unknown, patchFlag?: PatchFlags, dynamicProps?: (keyof (IntrinsicElementAttributes[T] & VNodeProps))[] | null): VNode; /** * 创建文本VNode */ export declare function createTextVNode(source: string | object | unknown, patch?: boolean): VNode; /** * 创建Fragment * @param children Array * @param patchFlag 64 | 128 | 256 * @returns Fragment VNode * @example * ```html *
{{ item.id }}
* ``` * * ```ts * createFragment( * renderList(data, item => createElementVNode('div', null, item.id, PatchFlags.TEXT)), * PatchFlags.UNKEYED_FRAGMENT * ) * ``` */ export declare function createFragment(children?: unknown[], patchFlag?: PatchFlags.STABLE_FRAGMENT | PatchFlags.KEYED_FRAGMENT | PatchFlags.UNKEYED_FRAGMENT): VNode; /** * 创建基础过渡效果 * @param name * @param effect * @param slots * @returns */ export declare function createTransition(name: string, effect: CSSProperties, slots: SlotChildren<'default'>): SpecificVNode<{ name: string; enterFrom: CSSProperties; leaveTo: CSSProperties; }>; export declare function renderSlot(slots: Slots, name: string, props?: Record, fallback?: () => VNodeArrayChildren, noSlotted?: boolean): VNode; /** * 通过 `v-for` `v-if` `v-show` 指令创建VNode * @param type * @param config */ export declare function createDirectives(type: 'v-if' | 'v-show', config: DirectivesConfig): VNodeChild; export declare function createDirectives(type: 'v-for', source: S[], cb: (value: S, index: number) => VNodeChild, keyed?: boolean): VNodeChild; export {};