import { Context } from './context.ts'; import type { WriteableSignal } from 'kloen'; type PropValue = ((value?: string) => unknown) | string | number | boolean | null | undefined; type Resolve = V extends StringConstructor ? string : V extends NumberConstructor ? number : V extends BooleanConstructor ? boolean : V extends (...args: any[]) => infer R ? R : V; type PropSignals

= { [K in keyof P]: WriteableSignal>; }; declare const propRegistry: unique symbol; export type PropMap = Record; declare class CustomElementBase extends HTMLElement { #private; static [propRegistry]: PropMap; static props: PropMap; static style: CSSStyleSheet; static get observedAttributes(): string[]; static finalize(): void; constructor(); attributeChangedCallback(name: string, _oldValue: string, newValue: string): void; connectedCallback(): void; disconnectedCallback(): void; /** * Consume a reactive value from the nearest provider for this ContextKey. */ consume(key: Context, defaultValue?: T): import("kloen").ComputedSignal; /** * Provide a reactive value to alle consumers of the given ContextKey within * this element's subtree. * * NOTE: use strings for the key, only if the lifetime of the value is the * same as the lifetime of the session as it won't be garbage collected. * Otherwise use `createContext` to create a unique key. */ provide(key: Context, value: T): WriteableSignal; /** * Put your render logic here. * * This method will be called whenever a reactive value that is used in the * render method changes. This method should return a html template. * * render(self: typeof this) { * return html`` * } * */ render(self: typeof this): import("lit-html").TemplateResult<1>; /** * @experimental * * Setup is called once from the constructor. It can be async and should be * used to setup any initial state or side effects. * If you return a promise, the element will not be considered "ready" * until the promise resolves. However, the element will still be connected * to the DOM, but it will not call mount() nor will it call render() until * the promise resolves. Instead it will call fallback(). * * You can check if the setup is done by checking the setupDone property. */ setup(): void | Promise; /** * Mount is called when the element is connected to the DOM. Convenience to * avoid having to call super() in the connectedCallback - and faster to type * You can return a cleanup function that will be called when the element is * disconnected from the DOM - use this for `unmount` logic. */ mount(): void | (() => void); /** * Dispatch a custom event with the given type and detail. */ dispatch(type: E, detail: T): void; /** * Convenience method to add an event listener that is removed when the element is * disconnected from the DOM. To be used in mount() */ on(type: string, handler: (e: CustomEvent) => void): void; } export type CustomElement

= CustomElementBase & PropSignals

; export declare const CustomElement: { new

(): CustomElement

; } & { [K in keyof typeof CustomElementBase]: (typeof CustomElementBase)[K]; }; export {};