UNPKG

@skirtle/vue-vnode-utils

Version:
54 lines (53 loc) 3.44 kB
import { Comment, Component, ComponentOptions, Fragment, FunctionalComponent, Static, Text, VNode, VNodeArrayChildren } from "vue"; //#region src/base.d.ts declare const isComment: (vnode: unknown) => vnode is (null | undefined | boolean | (VNode & { type: typeof Comment; })); declare const isComponent: (vnode: unknown) => vnode is (VNode & { type: Component; }); declare const isElement: (vnode: unknown) => vnode is (VNode & { type: string; }); declare const isFragment: (vnode: unknown) => vnode is ((VNode & { type: typeof Fragment; }) | VNodeArrayChildren); declare const isFunctionalComponent: (vnode: unknown) => vnode is (VNode & { type: FunctionalComponent; }); declare const isStatefulComponent: (vnode: unknown) => vnode is (VNode & { type: ComponentOptions; }); declare const isStatic: (vnode: unknown) => vnode is (VNode & { type: typeof Static; }); declare const isText: (vnode: unknown) => vnode is (string | number | (VNode & { type: typeof Text; })); declare const getText: (vnode: VNode | string | number) => string | undefined; declare const getType: (vnode: unknown) => "comment" | "text" | "fragment" | "static" | "element" | "component" | undefined; //#endregion //#region src/iterators.d.ts type IterationOptions = { element?: boolean; component?: boolean; comment?: boolean; text?: boolean; static?: boolean; }; declare const COMPONENTS_AND_ELEMENTS: IterationOptions; declare const SKIP_COMMENTS: IterationOptions; declare const ALL_VNODES: IterationOptions; declare const addProps: (children: VNodeArrayChildren, callback: (vnode: VNode) => (Record<string, unknown> | null | void), options?: IterationOptions) => VNodeArrayChildren; declare const replaceChildren: (children: VNodeArrayChildren, callback: (vnode: VNode) => (VNode | VNodeArrayChildren | string | number | void), options?: IterationOptions) => VNodeArrayChildren; declare const betweenChildren: (children: VNodeArrayChildren, callback: (previousVNode: VNode, nextVNode: VNode) => (VNode | VNodeArrayChildren | string | number | void), options?: IterationOptions) => VNodeArrayChildren; declare const someChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => unknown, options?: IterationOptions) => boolean; declare const everyChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => unknown, options?: IterationOptions) => boolean; declare const eachChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => void, options?: IterationOptions) => void; declare const findChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => unknown, options?: IterationOptions) => (VNode | undefined); declare const reduceChildren: <R>(children: VNodeArrayChildren, callback: (previousValue: R, vnode: VNode) => R, initialValue: R, options?: IterationOptions) => R; declare const isEmpty: (children: VNodeArrayChildren) => boolean; declare const extractSingleChild: (children: VNodeArrayChildren) => VNode | undefined; declare const countChildren: (children: VNodeArrayChildren, options?: IterationOptions) => number; //#endregion export { ALL_VNODES, COMPONENTS_AND_ELEMENTS, type IterationOptions, SKIP_COMMENTS, addProps, betweenChildren, countChildren, eachChild, everyChild, extractSingleChild, findChild, getText, getType, isComment, isComponent, isElement, isEmpty, isFragment, isFunctionalComponent, isStatefulComponent, isStatic, isText, reduceChildren, replaceChildren, someChild };