@muban/muban
Version:
Writing components for server-rendered HTML
31 lines (30 loc) • 1.91 kB
TypeScript
import type { ComponentFactory } from '../Component.types';
import type { RefElementType, ComponentRefItemCollection, ComponentRefItemComponent, ComponentRefItemComponentCollection, ComponentRefItemElement, RefOptions } from './refDefinitions.types';
declare module '@vue/reactivity' {
interface RefUnwrapBailTypes {
runtimeDOMBailTypes: Node | Window | HTMLElement;
}
}
/**
* Ensures that the passed element is a direct child of the parent, so that the
* parent is the "owner" of that child. If correct, return the element, otherwise
* return null.
* @param parent
* @param element
* @param ignoreGuard
*/
export declare function ensureElementIsComponentChild<T extends RefElementType>(parent: HTMLElement, element: T | null, ignoreGuard?: boolean): T | null;
export declare function refElement<T extends RefElementType = HTMLElement>(refIdOrQuery: string | ComponentRefItemElement<T>['queryRef'], { isRequired, ignoreGuard }?: RefOptions<{
isRequired?: boolean;
}>): ComponentRefItemElement<T>;
export declare function refCollection<T extends RefElementType = HTMLElement>(refIdOrQuery: string | ComponentRefItemCollection<T>['queryRef'], { minimumItemsRequired, ignoreGuard }?: RefOptions<{
minimumItemsRequired?: number;
}>): ComponentRefItemCollection<T>;
export declare function refComponent<T extends ComponentFactory<any>>(component: T | ReadonlyArray<T>, { ref: refIdOrQuery, isRequired, ignoreGuard, }?: RefOptions<{
ref?: string | ComponentRefItemComponent<T>['queryRef'];
isRequired?: boolean;
}>): ComponentRefItemComponent<T>;
export declare function refComponents<T extends ComponentFactory<any>>(component: T | ReadonlyArray<T>, { ref: refIdOrQuery, minimumItemsRequired, ignoreGuard, }?: RefOptions<{
ref?: string | ComponentRefItemComponentCollection<T>['queryRef'];
minimumItemsRequired?: number;
}>): ComponentRefItemComponentCollection<T>;