- Name
disabled- Kind
- property
- Type
boolean- Requirement
- required
- Description
- —
DocsAPI referenceHeadlesstypes
types headless API
The core connector and vanilla mount are always visible. Use the framework choice to inspect native composition, props, outputs, context and hooks for the selected adapter.
@grassroot/ui-headless-core/types
Core connector and vanilla API
CommandRunner
typeResolves UI command intents through a mounted part scope. Unresolvable commands (unmounted part, SSR) are silent no-ops — machines never learn about the DOM. Announcements are delegated to the provided announcer.
type CommandRunner = (command: UiCommand, scope: PartScope, options?: { announce?: (key: string, params: { readonly [key: string]: string | number | null; }, politeness: "polite" | "assertive") => void;}) => void;MergeProps
typeThe locked mergeProps rule (platform plan, verbatim): consumer handlers run first; `preventDefault()` suppresses the internal handler; refs are composed; class/style values are merged; machine-owned IDs and ARIA references cannot be silently overwritten. Signature: internal (machine-owned) props first, consumer overrides second. Returns one merged bag. `id`, `aria-*` relationship attributes (`aria-labelledby`, `aria-describedby`, `aria-controls`, `aria-activedescendant`) from the internal bag win over consumer values; a consumer attempt to override them is reported via the optional `onProtectedOverride` hook (development aid) and ignored.
type MergeProps = (internal: PartProps, consumer: PartProps, options?: { onProtectedOverride?: (key: string) => void;}) => PartProps;PartProps
interfaceFramework-neutral prop bag. Event handlers are `on`-prefixed functions; `ref` is a composition-ready callback; everything else is a plain attribute/property value.
interface PartProps { readonly [key: string]: unknown;}PartScope
interfaceCore platform contracts for `@grassroot/ui-headless-core` — frozen by the orchestrator before implementation (phase 3). Implementations must satisfy these shapes exactly; changing this file is a contract change and stops dependent work. The platform plan's explicit part scope. No global getElementById lookups.
interface PartScope { /** Stable, SSR-safe id for a part (optionally keyed, e.g. items). */ id(part: string, key?: string): string; /** Ref callback that registers/unregisters the part's element. */ register(part: string, key?: string): (node: Element | null) => void; /** Scoped lookup — never a document-wide query. */ get(part: string, key?: string): Element | null; /** * Subscribe to registration changes. The returned cleanup is idempotent; * registration callbacks invoke listeners only after the scoped registry * has actually changed. */ subscribe(listener: () => void): () => void; /** The root the scope is mounted under (document, shadow root or element). */ root(): Document | ShadowRoot | HTMLElement | null;}get(part: string, key?: string) => Element | nullid(part: string, key?: string) => stringregister(part: string, key?: string) => (node: Element | null) => voidroot() => Document | ShadowRoot | HTMLElement | nullsubscribe(listener: () => void) => () => void- Name
get- Kind
- method
- Type
(part: string, key?: string) => Element | null- Requirement
- required
- Description
- Scoped lookup — never a document-wide query.
- Name
id- Kind
- method
- Type
(part: string, key?: string) => string- Requirement
- required
- Description
- Stable, SSR-safe id for a part (optionally keyed, e.g. items).
- Name
register- Kind
- method
- Type
(part: string, key?: string) => (node: Element | null) => void- Requirement
- required
- Description
- Ref callback that registers/unregisters the part's element.
- Name
root- Kind
- method
- Type
() => Document | ShadowRoot | HTMLElement | null- Requirement
- required
- Description
- The root the scope is mounted under (document, shadow root or element).
- Name
subscribe- Kind
- method
- Type
(listener: () => void) => () => void- Requirement
- required
- Description
- Subscribe to registration changes. The returned cleanup is idempotent; registration callbacks invoke listeners only after the scoped registry has actually changed.
UiCommand
typeUI command intents resolved by the headless command runner (Select set).
type UiCommand = { readonly type: "FOCUS_PART"; readonly part: string;} | { readonly type: "FOCUS_ITEM"; readonly key: string;} | { readonly type: "SCROLL_ITEM_INTO_VIEW"; readonly key: string;} | { readonly type: "ANNOUNCE"; readonly key: string; readonly params: { readonly [key: string]: string | number | null; }; readonly politeness: "polite" | "assertive";};Framework adapters
Each panel keeps its adapter's public vocabulary. React compound exports, Vue composables, standalone Angular declarations, Svelte components, and Solid hooks stay native to their framework.
This entry is core-only. No framework adapter package ships for types yet — mount it through the vanilla API above.