Askr documentation
Generated API snapshot

@askrjs/askr/foundations/utilities

Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.

Exports

This entrypoint publishes 16 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

ariaDisabledtype

ariaDisabled: (disabled?: boolean) => { "aria-disabled"?: "true"; }

Build an `aria-disabled` prop object; omitted entirely when `disabled` is falsy.

ariaExpandedtype

ariaExpanded: (expanded?: boolean) => { "aria-expanded"?: "true" | "false"; }

Build an `aria-expanded` prop object; omitted when `expanded` is `undefined`.

ariaSelectedtype

ariaSelected: (selected?: boolean) => { "aria-selected"?: "true" | "false"; }

Build an `aria-selected` prop object; omitted when `selected` is `undefined`.

composeHandlerstype

composeHandlers: <A extends readonly unknown[]>(first?: (...args: A) => void, second?: (...args: A) => void, options?: ComposeHandlersOptions) => (...args: A) => void

Compose two optional event handlers into one, running `first` then `second` unless `first` marked the event as default-prevented.

ComposeHandlersOptionstype

ComposeHandlersOptions: any

Options for {@link composeHandlers}.

checkDefaultPrevented
When true (default), do not run the second handler if the first prevented default. When false, always run both handlers.

composeRefstype

composeRefs: <T>(...refs: Array<Ref<T>>) => (value: T | null) => void

Combine multiple refs into one callback ref that writes to all of them.

DefaultPreventabletype

DefaultPreventable: any

Minimal shape of an event that can be prevented from its default action.

defaultPrevented
defaultPrevented?: boolean;
preventDefault
preventDefault?: () => void;

FocusLikeEventtype

FocusLikeEvent: any

Structural subset of a focus event, for handlers that accept native or synthetic events.

relatedTarget
relatedTarget?: unknown;

formatIdtype

formatId: (options: FormatIdOptions) => string

formatId Formats a stable ID from a caller-provided identity. - Pure and deterministic (no time/randomness/global counters) - SSR-safe POLICY DECISIONS (LOCKED): 1. No Auto-Generation Caller must provide the `id`. No random/sequential generation. This ensures determinism and SSR safety. 2. Format Convention IDs are formatted as `{prefix}-{id}`. Default prefix is "askr". 3. Type Coercion Numbers are coerced to strings via String(). This is deterministic and consistent.

FormatIdOptionstype

FormatIdOptions: any

Options for {@link formatId}.

prefix
Defaults to 'askr'
id
Stable, caller-provided identity

KeyboardLikeEventtype

KeyboardLikeEvent: any

Structural subset of a keyboard event, for handlers that accept native or synthetic events.

key
key: string;
currentTarget
currentTarget?: unknown;
target
target?: unknown;

mergePropstype

mergeProps: <TBase extends object, TInjected extends object>(base: TBase, injected: TInjected) => TInjected & TBase

Merge `base` props over `injected` props: non-handler keys in `base` win, and matching event handlers are composed (`injected` runs first).

PointerLikeEventtype

PointerLikeEvent: any

Structural subset of a pointer event, for handlers that accept native or synthetic events.

target
target?: unknown;

PropagationStoppabletype

PropagationStoppable: any

Minimal shape of an event whose propagation can be stopped.

stopPropagation
stopPropagation?: () => void;

Reftype

Ref: ((value: T | null) => void) | {
  current: T | null;
} | null | undefined

A callback ref, an object ref, or a nullish value (no-op).

setReftype

setRef: <T>(ref: Ref<T>, value: T | null) => void

Write `value` to a {@link Ref}, ignoring failures on readonly object refs.