@wikimedia/codex
Version:
Codex Design System for Wikimedia
29 lines (28 loc) • 1.37 kB
TypeScript
import { VNode } from 'vue';
export declare function flattenSlotContents(slotContents: VNode[]): (VNode | string)[];
/**
* Check whether a given node represents a component. Optionally check whether it represents an
* instance of a specific component.
*
* isComponentVNode( node ) checks whether node is a component node of any type. To check whether
* node is a component node that is an instance of e.g. the CdxIcon component, use
* isComponentVNode( node, CdxIcon.name )
*
* @param node VNode to test
* @param componentName If set, check whether the component node has this name. Where possible,
* import the component and pass CdxFooBar.name, rather than passing a hard-coded string like
* 'CdxFooBar'
* @return Whether node is a component node; and, if componentName is set, whether it represents
* an instance of the component with that name.
*/
export declare function isComponentVNode(node: VNode, componentName?: string): boolean;
/**
* Check whether a given node represents an HTML tag. Optionally check whether it represents
* a specific tag.
*
* @param node VNode to test
* @param tagName If set, check whether the node represents this HTML tag
* @return Whether node is an HTML tag node; and, if tagName is set, whether it's that specific
* HTML tag.
*/
export declare function isTagVNode(node: VNode, tagName?: string): boolean;