UNPKG

@lifeart/gxt

Version:

<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">

37 lines (36 loc) • 2.75 kB
import type { TemplateContext, Context, Invoke, ComponentReturn } from '@glint/template/-private/integration'; import { api as DEFAULT_API } from './dom-api'; import { RENDERING_CONTEXT_PROPERTY, RENDERED_NODES_PROPERTY, COMPONENT_ID_PROPERTY } from './shared'; import { Root } from './dom'; import { MergedCell } from '.'; export type ComponentRenderTarget = HTMLElement | DocumentFragment | ComponentReturnType; export type GenericReturnType = ComponentReturnType | Node | Array<ComponentReturnType | Node> | null | null[]; type RenderableElement = GenericReturnType | Node | string | number | null | undefined; export declare function renderElement(api: typeof DEFAULT_API, ctx: Component<any>, target: Node, el: RenderableElement | RenderableElement[] | MergedCell, placeholder?: Comment | Node | null, skipRegistration?: boolean): void; export declare function renderComponent(component: ComponentReturnType, target: ComponentRenderTarget, owner?: any, skipRoot?: boolean): ComponentReturnType; export type Props = Record<string, unknown>; type Get<T, K, Otherwise = {}> = K extends keyof T ? Exclude<T[K], undefined> : Otherwise; export declare class Component<T extends Props = any> implements Omit<ComponentReturnType, 'ctx'> { args: Get<T, 'Args'>; [RENDERING_CONTEXT_PROPERTY]: undefined | typeof DEFAULT_API; [COMPONENT_ID_PROPERTY]: number; [RENDERED_NODES_PROPERTY]: Array<Node>; [Context]: TemplateContext<this, Get<T, 'Args'>, Get<T, 'Blocks'>, Get<T, 'Element', null>>; [Invoke]: (args?: Get<T, 'Args'>) => ComponentReturn<Get<T, 'Blocks'>, Get<T, 'Element', null>>; nodes: Node[]; $fw: unknown; constructor(props: Get<T, 'Args'>, fw?: unknown); template: ComponentReturnType; } export type TOC<S extends Props = {}> = (args?: Get<S, 'Args'>) => ComponentReturn<Get<S, 'Blocks'>, Get<S, 'Element', null>>; export declare function destroyElementSync(component: ComponentReturnType | Node | Array<ComponentReturnType | Node>, skipDom?: boolean): void; export declare function unregisterFromParent(component: ComponentReturnType | Node | Array<ComponentReturnType | Node>): void; export declare function destroyElement(component: ComponentReturnType | Node | Array<ComponentReturnType | Node>, skipDom?: boolean): Promise<void>; export declare function runDestructors(target: Component<any> | Root, promises?: Array<Promise<void>>, skipDom?: boolean): Array<Promise<void>>; export declare function targetFor(outlet: ComponentRenderTarget): HTMLElement | DocumentFragment; export type Slots = Record<string, (...params: unknown[]) => Array<ComponentReturnType | Node | Comment | string | number>>; export type ComponentReturnType = { nodes: Node[]; ctx: Component<any> | null; }; export {};