import { type ListenerConfig } from "./events.js"; import type { HTML as HTMLNamespace } from "./HTML.js"; import { type Constructor } from "./helpers.js"; import { type PropertyConfig } from "./property.js"; /** * Check if a node is a component. * @param node The node to check. * @returns True if element is a custom element. */ export declare const isComponent: (node: T | Node) => node is T; /** * Check if a constructor is a component constructor. * @param ctr The constructor to check. * @returns True if the constructor is a component class. */ export declare const isComponentConstructor: (ctr: Constructor) => ctr is ComponentConstructor; /** * Create a base Component class which extends a native constructor. * @param ctor The base HTMLElement constructor to extend. * @returns The extend class. */ export declare const extend: < T extends HTMLElement, C extends Constructor >(ctor: C) => BaseComponentConstructor; /** * A collection of extended builtin HTML constructors. */ export declare const HTML: typeof HTMLNamespace; /** * The DNA base Component constructor, a Custom Element constructor with * declarative properties and event delegations, custom template and * a complete lifecycle implementation. * All DNA components **must** extends this class. */ export declare const Component: (typeof HTMLNamespace)["Element"]; /** * The basic DNA Component interface. * It's a Custom Element, but with some extra useful method. * @see [W3C specification]{@link https://w3c.github.io/webcomponents/spec/custom/}. */ export type ComponentInstance = InstanceType; /** * Base Component constructor. */ export interface BaseComponentConstructor { /** * Metadata for decorators. */ readonly [Symbol.metadata]?: DecoratorMetadataObject | null; /** * The tag name of the extended builtin element. */ readonly tagName?: string; /** * An array containing the names of the attributes to observe. */ readonly observedAttributes?: string[]; /** * Component stylesheets. */ readonly globalStyles?: string | CSSStyleSheet | (CSSStyleSheet | string)[]; /** * Define component properties. */ readonly properties?: { [key: string]: PropertyConfig; }; /** * Define component listeners. */ readonly listeners?: { [key: string]: ListenerConfig; }; /** * Create a new Component instance. * @param node Instantiate the element using the given node instead of creating a new one. * @param properties A set of initial properties for the element. */ new (...args: any[]): T; prototype: T; } /** * The basic DNA Component constructor. */ export type ComponentConstructor = BaseComponentConstructor; /** * Check if a component has been constructed. * @param element The element to check. * @returns True if the element has been constructed. */ export declare const isInitialized: (element: ComponentInstance) => boolean;