@skirtle/vue-vnode-utils
Version:
Utilities for manipulating Vue 3 VNodes
82 lines (56 loc) • 3.42 kB
TypeScript
import { Comment as Comment_2 } from 'vue';
import { Component } from 'vue';
import { ComponentOptions } from 'vue';
import { Fragment } from 'vue';
import { FunctionalComponent } from 'vue';
import { Static } from 'vue';
import { Text as Text_2 } from 'vue';
import { VNode } from 'vue';
import { VNodeArrayChildren } from 'vue';
export declare const addProps: (children: VNodeArrayChildren, callback: (vnode: VNode) => (Record<string, unknown> | null | void), options?: IterationOptions) => VNodeArrayChildren;
export declare const ALL_VNODES: IterationOptions;
export declare const betweenChildren: (children: VNodeArrayChildren, callback: (previousVNode: VNode, nextVNode: VNode) => (VNode | VNodeArrayChildren | string | number | void), options?: IterationOptions) => VNodeArrayChildren;
export declare const COMPONENTS_AND_ELEMENTS: IterationOptions;
export declare const eachChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => void, options?: IterationOptions) => void;
export declare const everyChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => unknown, options?: IterationOptions) => boolean;
export declare const extractSingleChild: (children: VNodeArrayChildren) => VNode | undefined;
export declare const findChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => unknown, options?: IterationOptions) => (VNode | undefined);
export declare const getText: (vnode: VNode | string | number) => string | undefined;
export declare const getType: (vnode: unknown) => "comment" | "text" | "fragment" | "static" | "element" | "component" | undefined;
export declare const isComment: (vnode: unknown) => vnode is (null | undefined | boolean | (VNode & {
type: typeof Comment_2;
}));
export declare const isComponent: (vnode: unknown) => vnode is (VNode & {
type: Component;
});
export declare const isElement: (vnode: unknown) => vnode is (VNode & {
type: string;
});
export declare const isEmpty: (children: VNodeArrayChildren) => boolean;
export declare const isFragment: (vnode: unknown) => vnode is ((VNode & {
type: typeof Fragment;
}) | VNodeArrayChildren);
export declare const isFunctionalComponent: (vnode: unknown) => vnode is (VNode & {
type: FunctionalComponent;
});
export declare const isStatefulComponent: (vnode: unknown) => vnode is (VNode & {
type: ComponentOptions;
});
export declare const isStatic: (vnode: unknown) => vnode is (VNode & {
type: typeof Static;
});
export declare const isText: (vnode: unknown) => vnode is (string | number | (VNode & {
type: typeof Text_2;
}));
export declare type IterationOptions = {
element?: boolean;
component?: boolean;
comment?: boolean;
text?: boolean;
static?: boolean;
};
export declare const reduceChildren: <R>(children: VNodeArrayChildren, callback: (previousValue: R, vnode: VNode) => R, initialValue: R, options?: IterationOptions) => R;
export declare const replaceChildren: (children: VNodeArrayChildren, callback: (vnode: VNode) => (VNode | VNodeArrayChildren | string | number | void), options?: IterationOptions) => VNodeArrayChildren;
export declare const SKIP_COMMENTS: IterationOptions;
export declare const someChild: (children: VNodeArrayChildren, callback: (vnode: VNode) => unknown, options?: IterationOptions) => boolean;
export { }