Askr documentation
Generated API snapshot

@askrjs/askr/foundations

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

Exports

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

DefaultPortaltype

DefaultPortal: Portal<RenderableChild>

The implicit portal channel that {@link Portal} writes to and that any host rendered without an explicit portal falls back to.

definePortaltype

definePortal: <T extends RenderableChild = RenderableChild>() => Portal<T>

Create a new named {@link Portal} channel with its own host and content.

JSXElementtype

JSXElement: any

The vnode shape produced by JSX/`jsx()` calls.

$typeof
Internal element marker
type
Element type: string, component, Fragment, etc
props
Props bag
key
Optional key (normalized by runtime)

layouttype

layout: <P = object>(Layout: LayoutComponent<P>) => (children?: RenderableChild, props?: P) => unknown

Wrap a {@link LayoutComponent} so it can be invoked as `(children, props)`, matching route layout conventions.

LayoutComponenttype

LayoutComponent: (props: P & {
  children?: RenderableChild;
}) => unknown

A component that receives its route children via `props.children`.

Portaltype

Portal: (props: PortalProps) => JSXElement | null

Write children to the {@link DefaultPortal} host wherever it is rendered. A named portal channel created by {@link definePortal}: call it as a component to render the host, and call `.render(props)` to write content.

PortalPropstype

PortalProps: any

Props for the {@link Portal} component.

children
children?: RenderableChild;

Presencetype

Presence: ({ present, children }: PresenceProps) => JSXElement | null

Presence Structural policy primitive for conditional mount/unmount. - No timers - No animation coupling - No DOM side-effects POLICY DECISIONS (LOCKED): 1. Present as Function Accepts boolean OR function to support lazy evaluation patterns. Function is called once per render. Use boolean form for static values. 2. Children Type Presence forwards normal renderable child content only. Imperative DOM nodes are not part of the public contract. 3. Immediate Mount/Unmount No exit animations or transitions. When `present` becomes false, children are removed immediately. Animation must be layered above this primitive.

PresencePropstype

PresenceProps: any

Props for {@link Presence}.

children
children?: RenderableChild;
present
Whether the children should be mounted, or a function returning it.

Slottype

Slot: (props: SlotProps) => JSXElement | null

Slot Structural primitive for prop forwarding patterns. POLICY DECISIONS (LOCKED): 1. asChild Pattern When asChild=true, merges props into the single child element. Child must be a valid JSXElement; non-element children return null. **Slot props override child props** (injection pattern). 2. Fallback Behavior When asChild=false, returns a Fragment (structural no-op). No DOM element is introduced. 3. Type Safety asChild=true requires exactly one JSXElement child (enforced by type). Runtime validates with isElement() check.

SlotPropstype

SlotProps: {
  asChild: true;
  children: JSXElement;
  [key: string]: unknown;
} | {
  asChild?: false;
  children?: RenderableChild;
}

Props for {@link Slot}: `asChild` selects prop-merging vs. fragment mode.

asChild
asChild?: boolean | undefined;
children
children?: RenderableChild;