@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) => voidCompose two optional event handlers into one, running `first` then `second` unless `first` marked the event as default-prevented.
ComposeHandlersOptionstype
ComposeHandlersOptions: anyOptions 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) => voidCombine multiple refs into one callback ref that writes to all of them.
DefaultPreventabletype
DefaultPreventable: anyMinimal shape of an event that can be prevented from its default action.
defaultPrevented- defaultPrevented?: boolean;
preventDefault- preventDefault?: () => void;
FocusLikeEventtype
FocusLikeEvent: anyStructural subset of a focus event, for handlers that accept native or synthetic events.
relatedTarget- relatedTarget?: unknown;
formatIdtype
formatId: (options: FormatIdOptions) => stringformatId 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: anyOptions for {@link formatId}.
prefix- Defaults to 'askr'
id- Stable, caller-provided identity
KeyboardLikeEventtype
KeyboardLikeEvent: anyStructural 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 & TBaseMerge `base` props over `injected` props: non-handler keys in `base` win, and matching event handlers are composed (`injected` runs first).
PointerLikeEventtype
PointerLikeEvent: anyStructural subset of a pointer event, for handlers that accept native or synthetic events.
target- target?: unknown;
PropagationStoppabletype
PropagationStoppable: anyMinimal shape of an event whose propagation can be stopped.
stopPropagation- stopPropagation?: () => void;
Reftype
Ref: ((value: T | null) => void) | {
current: T | null;
} | null | undefinedA callback ref, an object ref, or a nullish value (no-op).
setReftype
setRef: <T>(ref: Ref<T>, value: T | null) => voidWrite `value` to a {@link Ref}, ignoring failures on readonly object refs.