@surface/custom-element
Version:
Provides support of directives and data binding on custom elements.
26 lines (25 loc) • 1.03 kB
TypeScript
import type { Constructor } from "@surface/core";
import type ICustomElement from "./interfaces/custom-element";
import type { DirectiveConstructor, DirectiveFactory } from "./types";
declare const CUSTOM_ELEMENT: unique symbol;
export default class CustomElement extends HTMLElement implements ICustomElement {
static readonly [CUSTOM_ELEMENT]: boolean;
shadowRoot: ShadowRoot;
constructor();
private static applyMetadata;
static [Symbol.hasInstance](instance: object): boolean;
/**
* Extends a HTML element.
* @param base Element to be extended.
*/
static as<T extends Constructor<HTMLElement>>(base: T): T & Constructor<ICustomElement>;
/**
* Registers a custom directive.
* @param name Custom directive name.
* @param handler An directive constructor or factory.
*/
static registerDirective(name: string, handler: DirectiveConstructor | DirectiveFactory): void;
/** Disposes resources. */
dispose(): void;
}
export {};