UNPKG

@lifeart/gxt

Version:

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

121 lines (120 loc) • 6.88 kB
import { type ComponentReturnType, type Slots, type Component } from './component'; import { Cell, MergedCell } from './reactive'; import { DestructorFn, Destructors } from './glimmer/destroyable'; import { api as HTMLAPI } from './dom-api'; import { RENDERING_CONTEXT_PROPERTY, RENDERED_NODES_PROPERTY, COMPONENT_ID_PROPERTY } from './shared'; import { SVGProvider, HTMLProvider, MathMLProvider } from './provider'; type RenderableType = Node | ComponentReturnType | string | number; type ModifierFn = (element: HTMLElement, ...args: unknown[]) => void | DestructorFn; type Attr = MergedCell | Cell | string | ((element: HTMLElement, attribute: string) => void); type TagAttr = [string, Attr]; type TagProp = [string, Attr]; type TagEvent = [string, EventListener | ModifierFn]; type FwType = [TagProp[], TagAttr[], TagEvent[]]; type Props = [TagProp[], TagAttr[], TagEvent[], FwType?]; type Fn = () => unknown; type InElementFnArg = () => HTMLElement; type BranchCb = () => ComponentReturnType | Node; export declare const $_edp: Props; export declare const $_emptySlot: Readonly<{}>; export declare const $SLOTS_SYMBOL: unique symbol; export declare const $PROPS_SYMBOL: unique symbol; export declare const $_SVGProvider: typeof SVGProvider; export declare const $_HTMLProvider: typeof HTMLProvider; export declare const $_MathMLProvider: typeof MathMLProvider; export declare class Root { [RENDERED_NODES_PROPERTY]: never[]; [COMPONENT_ID_PROPERTY]: number; [RENDERING_CONTEXT_PROPERTY]: undefined | typeof HTMLAPI; constructor(); } export declare const $_MANAGERS: { component: { canHandle(component: any): boolean; handle(component: any, args: any, fw: any, ctx: any): ComponentReturnType | Component; }; modifier: { canHandle(modifier: any): boolean; handle(modifier: any, element: Element, props: unknown[], args: () => Record<string, unknown>): void; }; helper: { canHandle(helper: any): boolean; handle(helper: any, params: any, hash: any): void; }; }; export declare function $_TO_VALUE(reference: unknown): unknown; export declare function $_componentHelper(params: any, hash: any): (args: any) => any; export declare function $_modifierHelper(params: any, hash: any): (node: any, _params: any, _hash: any) => any; export declare function $_helperHelper(params: any, hash: any): void | ((_params: any, _hash: any) => any); export declare function createRoot(): Root; export declare function resetRoot(): void; export declare function setRoot(root: Root): void; export declare function getRoot(): Root | null; export declare function resolveRenderable(child: Function, debugName?: string): RenderableType | MergedCell | Cell; export declare function incrementNodeCounter(): void; export declare function resetNodeCounter(): void; export declare function getNodeCounter(): number; export declare function $_hasBlock(slots: Record<string, unknown>, name?: string): boolean; export declare function $_hasBlockParams(slots: Record<string, unknown>, slotName?: string): unknown; declare function _DOM(tag: string, tagProps: Props, children: (ComponentReturnType | string | Cell | MergedCell | Function)[], ctx: any): Node; export declare function $_inElement(elementRef: HTMLElement | Cell<HTMLElement> | InElementFnArg, roots: (context: Component<any>) => (Node | ComponentReturnType)[], ctx: any): any; export declare function $_ucw(roots: (context: Component<any>) => (Node | ComponentReturnType)[], ctx: any): any; export declare function $_GET_SCOPES(hash: Record<string, unknown>): any; export declare const $_maybeHelper: (value: any, args: any[], _hash: Record<string, unknown>) => any; declare function component(comp: ComponentReturnType | Component, args: Record<string, unknown>, ctx: Component<any>): any; declare function slot(name: string, params: () => unknown[], $slot: Slots, ctx: any): Comment | { nodes: (Node | ComponentReturnType)[]; ctx: Component<any>; }; export declare function cellToText(api: typeof HTMLAPI, cell: Cell | MergedCell, destructors: Destructors): Text; declare function text(api: typeof HTMLAPI, text: string | number | null | Cell | MergedCell | Fn | RenderableType, destructors: Destructors): Text; declare function ifCond(cell: Cell<boolean>, trueBranch: BranchCb, falseBranch: BranchCb, ctx: Component<any>): HTMLElement | DocumentFragment | { ctx: any; nodes: ChildNode[]; }; export declare function $_eachSync<T extends { id: number; }>(items: Cell<T[]> | MergedCell, fn: (item: T) => Array<ComponentReturnType | Node>, key: string | null | undefined, ctx: Component<any>): HTMLElement | DocumentFragment | { ctx: any; nodes: ChildNode[]; }; export declare function $_each<T extends { id: number; }>(items: Cell<T[]> | MergedCell, fn: (item: T) => Array<ComponentReturnType | Node>, key: string | null | undefined, ctx: Component<any>): HTMLElement | DocumentFragment | { ctx: any; nodes: ChildNode[]; }; export declare function $_GET_ARGS(ctx: any, args: any): void; export declare function $_GET_SLOTS(ctx: any, args: any): any; export declare function $_GET_FW(ctx: any, args: any): any; export declare function $_args(args: Record<string, unknown>, slots: Record<string, () => Array<ComponentReturnType | Node>> | false, props: FwType): {}; export declare const $_if: typeof ifCond; export declare const $_slot: typeof slot; export declare const $_c: typeof component; export declare function $_dc(comp: () => ComponentReturnType | Component, args: Record<string, unknown>, ctx: Component<any>): { readonly ctx: Component<any> | null; nodes: Node[]; }; export declare const $_component: (component: any) => any; export declare const $_maybeModifier: (modifier: any, element: HTMLElement, props: any[], hashArgs: () => Record<string, unknown>) => any; export declare const $_helper: (helper: any) => any; export declare const $_text: typeof text; export declare const $_tag: typeof _DOM; export declare const $_api: (ctx: any) => { toString(): string; addEventListener(node: Node, eventName: string, fn: EventListener): (() => void) | undefined; attr(element: HTMLElement, name: string, value: string | null): void; prop(element: HTMLElement, name: string, value: any): any; comment(text?: string): Comment; text(text?: string | number): Text; textContent(node: Node, text: string): void; fragment(): DocumentFragment; element(tagName?: string): HTMLElement; append(parent: Node | HTMLElement, child: Node | HTMLElement, targetIndex?: number): void; insert(parent: Node | HTMLElement, child: Node | HTMLElement, anchor?: Node | HTMLElement | null | undefined): void; }; export declare function $_fin(roots: Array<ComponentReturnType | Node>, ctx: Component<any>): { nodes: (Node | ComponentReturnType)[]; ctx: Component<any>; }; export {};