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 9 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

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.

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

MergedPropstype

MergedProps: HasIndexSignature<TBase> extends true
    ? TInjected & TBase
    : HasIndexSignature<TInjected> extends true
      ? TInjected & TBase
      : Omit<TInjected, keyof TBase> & {
          [
            K in keyof TBase as K extends RequiredKeys<TInjected> ? K : never
          ]-?: MergedValue<TBase[K], TInjected[K & keyof TInjected]>;
        } & {
          [
            K in keyof TBase as K extends RequiredKeys<TInjected> ? never : K
          ]: MergedValue<
            TBase[K],
            K extends keyof TInjected ? TInjected[K] : undefined
          >;
        }

The props {@link mergeProps} returns: base keys win unless undefined, and a base key is required when the injected props always supply it. Props with an index signature fall back to the intersection of both sides.

mergePropstype

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

Merge base props over injected props: non-handler keys in base win, and matching event handlers are composed (injected runs first). base values that are undefined are treated as absent and never overwrite an injected value; use null to clear one explicitly.

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.