import { computed } from "alien-signals"; import { HTMLElement as HTMLElement$1 } from "server-dom-shim"; //#region src/define-props.d.ts /** * @internal */ type AnyProps = Record; /** * Declare a property. */ interface PropDeclaration { /** * The default value of the property. It must not be `undefined`. Use `null` if you want to indicate that the default value is empty. */ default: T; /** * The attribute name associated with the property, or `false` to not associate an attribute. */ attribute: string | false; /** * How the property is converted to and from an attribute string. This is not used when `attribute` is `false`. The default value is `"json"`. */ type?: 'boolean' | 'string' | 'number' | 'json'; } /** * Declare a set of properties. */ type PropsDeclaration = Readonly<{ [K in keyof Props]: PropDeclaration }>; /** * Define a set of properties. */ declare function defineProps(props: PropsDeclaration): PropsDeclaration; //#endregion //#region src/reactive-controller.d.ts interface ReactiveControllerHost { addController(controller: ReactiveController): void; removeController(controller: ReactiveController): void; } interface ReactiveController { hostConnected?(): void; hostDisconnected?(): void; } //#endregion //#region src/host-element.d.ts declare class HostElement extends HTMLElement$1 implements ReactiveControllerHost { private _controllers; private _connected; addController(controller: ReactiveController): void; removeController(controller: ReactiveController): void; connectedCallback(): void; disconnectedCallback(): void; } //#endregion //#region src/signal.d.ts /** * A reactive signal. */ interface Signal { get: () => T; set: (value: T) => void; } /** * Create a reactive signal. * * @internal */ declare function createSignal(initialValue: T): Signal; //#endregion //#region src/store.d.ts /** * A state is simply a collection of signals. */ type State = { [Key in keyof Props]: Signal }; /** * @internal */ declare function createState(propsDeclaration: PropsDeclaration): State; //#endregion //#region src/attribute.d.ts /** * @internal */ declare function usePropertiesToAttributes(element: HostElement, store: State, declarations: PropsDeclaration): void; /** * @internal */ declare function handleAttributeChanged(store: State, declarations: PropsDeclaration, attributeNameToPropertyName: Map, attributeName: string, attributeValue: string | null | undefined): void; /** * @internal */ declare function createAttributePropertyNameMap(declarations: PropsDeclaration): Map; //#endregion //#region src/context.d.ts type ContextCallback = (value: T) => void; declare class ContextRequestEvent extends Event { readonly key: string | symbol; readonly callback: ContextCallback; constructor(key: string | symbol, callback: ContextCallback); } declare class ContextProviderEvent extends Event { readonly key: string | symbol; constructor(key: string | symbol); } declare global { interface HTMLElementEventMap { 'aria-ui:context-request': ContextRequestEvent; 'aria-ui:context-provider': ContextProviderEvent; } } /** * A context is a way to provide and consume signals in a HTML tree. * * @group Contexts */ interface Context { /** * Provides a signal to all children of the element. */ provide(element: HTMLElement, value: T): void; /** * Receives the signal from a parent element. */ consume(element: HTMLElement): () => T | undefined; } /** * Creates a new context. * * @param key The key to use for the context. * @param defaultValue The default value to return if the signal is not provided. * * @group Contexts */ declare function createContext(key: string | symbol): Context; //#endregion //#region src/define-custom-element.d.ts /** * @internal */ type HostElementConstructor = new () => HostElement & Props; type SetupFunction = (host: HostElement, props: State) => void; declare function defineCustomElement(setup: SetupFunction, props: PropsDeclaration): HostElementConstructor; //#endregion //#region src/on-mount.d.ts declare function onMount(host: HostElement, callback: () => VoidFunction | void): VoidFunction; //#endregion //#region src/register-custom-element.d.ts /** * Adds the given custom element to the custom element registry. */ declare function registerCustomElement(name: string, constructor: CustomElementConstructor): void; //#endregion //#region src/use-effect.d.ts declare function useEffect(host: HostElement, callback: () => VoidFunction | void): VoidFunction; //#endregion export { type AnyProps, type Context, HostElement, type HostElementConstructor, type PropDeclaration, type PropsDeclaration, type Signal, type State, computed, createAttributePropertyNameMap, createContext, createSignal, createState, defineCustomElement, defineProps, handleAttributeChanged, onMount, registerCustomElement, useEffect, usePropertiesToAttributes }; //# sourceMappingURL=index.d.ts.map