/** What every framework adapter shares: how a spec's attributes, live properties and events become a framework's props, how values are written as attributes, and the tag prefix. */ import { type AttributeType, type DefineOptions, type ElementAttributes, type ElementProperties } from "./define.js"; /** The runtime parts of an element spec an adapter reads. */ export interface ComponentSpec { name: string; /** `false`: the server never marks the host. */ ssr?: boolean | ((host: HTMLElement) => boolean); /** The prefix-independent attribute the element's host carries once connected (`data-mtrl-icon-button`). */ marker?: string; attributes?: Record; properties?: Record; events?: Record; slot?: { attribute: string; }; slots?: readonly string[]; form?: unknown; model?: string; } /** A declaration child (``): attributes and children only, no behaviour. */ export interface DeclarationSpec { name: string; attributes: Record; } export type Pascal = S extends `${infer H}-${infer T}` ? `${Capitalize}${Pascal}` : Capitalize; /** An attribute a live property shadows is set through `default`. */ export type DefaultProps = { [K in keyof ElementProperties & keyof ElementAttributes & string as `default${Capitalize}`]?: ElementAttributes[K]; }; /** Events a component had in 0.10 and material 3.0.0 removed: the icon button's `toggle`. */ export type RetiredEvents = [ S ] extends [ import("./icon-button.js").IconButtonSpec ] ? [ import("./icon-button.js").IconButtonSpec ] extends [ S ] ? "toggle" : never : never; /** A form-associated element takes `name`. */ export type FormProps = S extends { form: unknown; } ? { name?: string; } : Record; /** The live property a framework's two-way binding (`v-model`, `bind:`) drives. */ export type ModelOf = S extends { model: infer M extends keyof ElementProperties & string; } ? M : never; export declare const camel: (name: string) => string; export declare const pascal: (name: string) => string; /** An attribute value as a framework should render it. */ export declare const toAttribute: (type: AttributeType, value: unknown) => string | undefined; export interface AttributeProp { /** The attribute's name on the element. */ name: string; type: AttributeType; /** A live property of the same name exists; this prop is its `default*`. */ shadowed: boolean; } /** A spec, read once into the maps an adapter needs. */ export interface Described { /** Prop name (camelCase, or `default` when shadowed) to attribute. */ attributes: Map; /** Live-state property names. */ properties: string[]; /** Event names, as the element dispatches them. */ events: string[]; /** The property two-way binding drives, if any. */ model: string | undefined; form: boolean; /** Live property name to the attribute it shadows (`checked` → the `checked` attribute). */ shadowedBy: Map; /** The named slots, as `slot="…"` names them. */ slots: readonly string[]; } export declare const describe: (spec: ComponentSpec) => Described; export declare const writeDefaults: (element: HTMLElement, described: Described, read: (prop: string) => unknown) => void; export declare const writeLive: (element: HTMLElement, described: Described, read: (property: string) => unknown) => void; export declare const serverDefaults: (described: Described, read: (property: string) => unknown) => Array<[ string, string ]>; export declare const describeDeclaration: (spec: DeclarationSpec) => Map; /** The tag prefix adapters render. */ export declare const getPrefix: () => string; /** Sets the tag prefix every adapter renders. */ export declare const configure: (options: DefineOptions) => void; export declare const isBrowser: boolean;