/** What every generated Svelte component (`dist/svelte/*.svelte`) runs. */ import type { Snippet } from "svelte"; import type { Action } from "svelte/action"; import type { HTMLAttributes } from "svelte/elements"; import type { DefineOptions, ElementEvents, ElementProperties, ElementProps, ElementSlotProp } from "../elements/index.js"; import { type ComponentSpec, type DeclarationSpec, type DefaultProps, type FormProps, type RetiredEvents } from "../elements/adapter.js"; export { configure } from "../elements/adapter.js"; /** `change` → `onchange`, as Svelte 5 names event props, typed with the element's event. */ export type EventProps = { [K in keyof ElementEvents & string as `on${K}`]?: (event: ElementEvents[K]) => void; }; type BaseProps = ElementProps & DefaultProps & FormProps & EventProps; /** Each named slot as a snippet prop (`{#snippet actions()}`); a text prop of the same name (`headline`) takes its text or a snippet. */ type SnippetProps = { [K in ElementSlotProp]?: (K extends keyof P ? Exclude : never) | Snippet; }; type OwnProps = Omit, ElementSlotProp> & SnippetProps>; /** `nonce` is global; Svelte types it on script and style only. */ type SvelteHostGaps = { nonce?: string; }; type Missing = { [K in Exclude]?: K extends keyof Extra ? Extra[K] : never; }; type SvelteHostAttributes = HTMLAttributes & Missing, SvelteHostGaps>; /** Props of a generated component: the element's own, plus any HTML attribute for the host. */ export type SvelteProps = OwnProps & Omit | "children" | RetiredProps> & { [K in RetiredProps]?: `${K} was removed in material 3.0.0: use onchange`; } & { children?: Snippet; }; /** The handler props of events material 3.0.0 removed (`ontoggle` on the icon button): refused, see `RetiredEvents`. */ type RetiredProps = `on${RetiredEvents}`; /** The live properties a generated component binds (`bind:checked`). */ export type Bindable = keyof ElementProperties & string; export type DeclarationProps = A & Omit & { children?: Snippet; }; /** What a generated component passes its action on every update. */ export interface Binding { /** The component's props other than the bindable ones and `children`. */ props: Record; /** The bindable props' current values. */ live: Record; /** Writes a bindable prop back, for `bind:`. */ set: Record void>; } export interface Adapter { tag: string; attributes: (props: Record, live: Record, shadow?: string) => Record; snippets: (props: Record) => Array<[ slot: string, snippet: Snippet ]>; action: Action; } export declare const adapter: (spec: ComponentSpec, define: (options?: DefineOptions) => string) => Adapter; export declare const declaration: (spec: DeclarationSpec) => { tag: string; attributes: (props: Record) => Record; }; export type SvelteShadowRenderer = (tag: string, attributes: Record, children: Snippet | undefined, slots: Array<[ slot: string, snippet: Snippet ]>, prefix: string) => string; export declare const shadowMarkup: (runtime: Adapter, props: Record, children: Snippet | undefined, live: Record) => string;