@lifeart/gxt
Version:
<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">
30 lines (28 loc) • 1.25 kB
TypeScript
import { TemplateContext, Context, Invoke, ComponentReturn } from '@glint/template/-private/integration';
import { DOMApi, RENDERING_CONTEXT_PROPERTY, RENDERED_NODES_PROPERTY, COMPONENT_ID_PROPERTY } from './types';
export type Props = Record<string, unknown>;
type Get<T, K, Otherwise = {}> = K extends keyof T ? Exclude<T[K], undefined> : Otherwise;
/**
* Base Component class for building UI components.
*/
export declare class Component<T extends Props = any> {
args: Get<T, 'Args'>;
[RENDERING_CONTEXT_PROPERTY]: undefined | DOMApi;
[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: Component<any>;
}
/**
* Component return type (alias for backward compatibility)
*/
export type ComponentReturnType = Component<any>;
/**
* TOC (Template-Only Component) type
*/
export type TOC<S extends Props = {}> = (args?: Get<S, 'Args'>) => ComponentReturn<Get<S, 'Blocks'>, Get<S, 'Element', null>>;
export {};