Skip to content

ui/behaviors

ui/behaviors

Import from @norbital-ai/ui/behaviors

Single-source composable Svelte-5 headless behavior primitives. Used directly by @norbital-ai/ui built-in components AND exported for tenants to compose custom widgets with identical keyboard navigation, ARIA, overflow, resizing, dismissal, focus management, shortcuts, selection, pagination, clipboard, floating, portals, dates, direct manipulation, canvas gestures, live announcements and agent observability hooks.

behaviors

Accordion type

type Accordion = ReturnType<typeof create_accordion>;

Return value of create_accordion.

Members

NameTypeDescription
openreadonly string[]
is_open(key: string) => boolean
toggle(key: string) => void
expand(key: string) => void
collapse(key: string) => void
item(key: string) => import("svelte/attachments").Attachment<HTMLElement>
root_attrs() => { onkeydown: (event: KeyboardEvent) => void; }
trigger_attrs(key: string) => { type: "button"; id: string; "aria-expanded": boolean; "aria-controls": string; "data-state": "open" | "closed"; disabled: true | undefined; tabindex: number | undefined; onfocus: () => void; onclick: () => void; }
content_attrs(key: string) => { id: string; role: "region"; "aria-labelledby": string; hidden: boolean; "data-state": "open" | "closed"; }

Source: packages/ui/src/behaviors/accordion.svelte.ts:32

AccordionMode type

type AccordionMode = 'single' | 'multiple';

Single or multiple expanded sections mode for create_accordion.

Source: packages/ui/src/behaviors/accordion.svelte.ts:9

AccordionOptions type

type AccordionOptions = {
    /** Item keys in visual order. */
    items: () => readonly string[];
    /** Single or multiple expanded sections (default `'single'`). */
    mode?: AccordionMode;
    /** In single mode, allow collapsing the only open item (default `true`). */
    collapsible?: boolean;
    /** Controlled open keys; omit for internal state. */
    open?: () => readonly string[];
    /** Initial open keys when uncontrolled. */
    default_open?: readonly string[];
    /** Called whenever expanded keys change. */
    on_change?: (open: readonly string[]) => void;
    /** Disabled predicate per item key. */
    disabled?: (key: string) => boolean;
    /** Optional semantic control id/label for Norbius's `page` bridge. */
    control?: {
        id: string;
        label?: string;
    };
};

Options for create_accordion.

Members

NameTypeDescription
items() => readonly string[]

Item keys in visual order.

mode?AccordionMode

Single or multiple expanded sections (default 'single').

collapsible?boolean

In single mode, allow collapsing the only open item (default true).

open?() => readonly string[]

Controlled open keys; omit for internal state.

default_open?readonly string[]

Initial open keys when uncontrolled.

on_change?(open: readonly string[]) => void

Called whenever expanded keys change.

disabled?(key: string) => boolean

Disabled predicate per item key.

control?{ id: string; label?: string; }

Optional semantic control id/label for Norbius's page bridge.

Source: packages/ui/src/behaviors/accordion.svelte.ts:12

AnnounceOptions type

type AnnounceOptions = {
    /** Announcement urgency (default `'polite'`). */
    readonly priority?: AnnouncePriority;
    /** Target document (defaults to global `document`). */
    readonly doc?: Document;
};

Options for announce.

Members

NameTypeDescription
priority?AnnouncePriority

Announcement urgency (default 'polite').

doc?Document

Target document (defaults to global document).

Source: packages/ui/src/behaviors/announce.svelte.ts:9

AnnouncePriority type

type AnnouncePriority = 'polite' | 'assertive';

Urgency of a screen-reader announcement ('polite' waits for idle, 'assertive' interrupts).

Source: packages/ui/src/behaviors/announce.svelte.ts:6

AreaBehavior type

type AreaBehavior = ReturnType<typeof create_area>;

Return value of create_area.

Members

NameTypeDescription
valueAreaValue
percent_xnumber
percent_ynumber
draggingboolean
set(next: AreaValue, commitNow?: boolean) => void
surfaceAttachment<HTMLElement>
thumb_attrs() => { role: "slider"; tabindex: number; "aria-label": string | undefined; "aria-valuetext": string; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/canvas.svelte.ts:131

AreaOptions type

type AreaOptions = {
    readonly value?: () => AreaValue;
    readonly default_value?: AreaValue;
    readonly on_change?: (value: AreaValue) => void;
    readonly on_commit?: (value: AreaValue) => void;
    readonly min_x?: number;
    readonly max_x?: number;
    readonly min_y?: number;
    readonly max_y?: number;
    readonly step_x?: number;
    readonly step_y?: number;
    readonly label?: string;
};

Options for create_area.

Members

NameTypeDescription
value?() => AreaValue
default_value?AreaValue
on_change?(value: AreaValue) => void
on_commit?(value: AreaValue) => void
min_x?number
max_x?number
min_y?number
max_y?number
step_x?number
step_y?number
label?string

Source: packages/ui/src/behaviors/canvas.svelte.ts:116

AreaValue type

type AreaValue = {
    readonly x: number;
    readonly y: number;
};

2D slider coordinates { x, y }.

Members

NameTypeDescription
xnumber
ynumber

Source: packages/ui/src/behaviors/canvas.svelte.ts:113

AriaPattern type

type AriaPattern = 'dialog' | 'menu' | 'menubar' | 'listbox' | 'combobox' | 'tabs' | 'accordion' | 'tree' | 'grid' | 'radiogroup' | 'toolbar' | 'switch' | 'slider' | 'carousel';

Supported WAI-ARIA Authoring Practices Guide widget patterns verified by check_pattern.

Source: packages/ui/src/behaviors/testing.ts:4

AsyncOptions type

type AsyncOptions<T> = ReturnType<typeof create_async_options<T>>;

Return value of create_async_options.

Members

NameTypeDescription
querystring
itemsreadonly T[]
statusAsyncOptionsStatus
loadingboolean
errorunknown
has_moreboolean
set_query(next: string, opts?: { immediate?: boolean; }) => void
load_more() => void
reload() => void
reset() => void
cancel() => void

Source: packages/ui/src/behaviors/async-options.svelte.ts:38

AsyncOptionsContext type

type AsyncOptionsContext = {
    /** Aborted automatically when a newer query or reset supersedes this request. */
    readonly signal: AbortSignal;
    /** Zero-based page index (`0` for fresh query, incremented by `load_more()`). */
    readonly page: number;
};

Context passed to AsyncOptionsOptions.load.

Members

NameTypeDescription
signalAbortSignal

Aborted automatically when a newer query or reset supersedes this request.

pagenumber

Zero-based page index (0 for fresh query, incremented by load_more()).

Source: packages/ui/src/behaviors/async-options.svelte.ts:18

AsyncOptionsOptions type

type AsyncOptionsOptions<T> = {
    /** Fetches matching items for `query` and `ctx.page`, honoring `ctx.signal`. */
    readonly load: (query: string, ctx: AsyncOptionsContext) => Promise<AsyncOptionsPage<T>>;
    /** Initial query (default `''`). */
    readonly initial_query?: string;
    /** Typing debounce window in ms (default `200`). */
    readonly debounce_ms?: number;
    /** Fetch immediately for `initial_query` on mount (default `false`). */
    readonly immediate?: boolean;
};

Options for create_async_options.

Members

NameTypeDescription
load(query: string, ctx: AsyncOptionsContext) => Promise<AsyncOptionsPage<T>>

Fetches matching items for query and ctx.page, honoring ctx.signal.

initial_query?string

Initial query (default '').

debounce_ms?number

Typing debounce window in ms (default 200).

immediate?boolean

Fetch immediately for initial_query on mount (default false).

Source: packages/ui/src/behaviors/async-options.svelte.ts:26

AsyncOptionsPage type

type AsyncOptionsPage<T> = readonly T[] | {
    readonly items: readonly T[];
    readonly has_more?: boolean;
};

Page payload returned by AsyncOptionsOptions.load.

Source: packages/ui/src/behaviors/async-options.svelte.ts:10

AsyncOptionsStatus type

type AsyncOptionsStatus = 'idle' | 'loading' | 'error';

Load lifecycle state of create_async_options.

Source: packages/ui/src/behaviors/async-options.svelte.ts:7

AutoScroll type

type AutoScroll = ReturnType<typeof create_auto_scroll>;

Return value of create_auto_scroll.

Members

NameTypeDescription
update(x: number, y: number) => void
stop() => void

Source: packages/ui/src/behaviors/drag.svelte.ts:164

AutoScrollOptions type

type AutoScrollOptions = {
    /** Edge proximity threshold in px where scrolling begins (default `48`). */
    readonly edge?: number;
    /** Maximum scroll speed in px/frame at the edge (default `18`). */
    readonly speed?: number;
    /** Called after each scrolled frame so drag hit-testing updates under a stationary pointer. */
    readonly on_scroll?: () => void;
    /** Optional element to ignore when hit-testing scrollers underneath the pointer. */
    readonly ignore?: () => Element | null | undefined;
};

Options for create_auto_scroll.

Members

NameTypeDescription
edge?number

Edge proximity threshold in px where scrolling begins (default 48).

speed?number

Maximum scroll speed in px/frame at the edge (default 18).

on_scroll?() => void

Called after each scrolled frame so drag hit-testing updates under a stationary pointer.

ignore?() => Element | null | undefined

Optional element to ignore when hit-testing scrollers underneath the pointer.

Source: packages/ui/src/behaviors/drag.svelte.ts:152

BindDragOptions type

type BindDragOptions = {
    /** Movement in CSS px before `on_start`/`on_move` fire (default `DRAG_THRESHOLD`). */
    readonly threshold?: number;
    /** Return `false` to reject starting the drag. */
    readonly on_start?: (event: PointerEvent) => boolean | void;
    /** Called at most once per animation frame with latest pointer coordinates. */
    readonly on_move: (sample: PointerSample) => void;
    /** Called when the pointer lifts, cancels, or Escape aborts. */
    readonly on_end?: (event: PointerEvent | KeyboardEvent, canceled: boolean) => void;
    /** Cancel active drag on Escape (default `true`). */
    readonly cancel_on_escape?: boolean;
    /** Stop `pointerdown` propagation so nested drag surfaces do not both capture the gesture. */
    readonly stop_propagation?: boolean;
    /** Disable dragging reactively. */
    readonly disabled?: () => boolean;
};

Options for bind_drag.

Members

NameTypeDescription
threshold?number

Movement in CSS px before on_start/on_move fire (default DRAG_THRESHOLD).

on_start?(event: PointerEvent) => boolean | void

Return false to reject starting the drag.

on_move(sample: PointerSample) => void

Called at most once per animation frame with latest pointer coordinates.

on_end?(event: PointerEvent | KeyboardEvent, canceled: boolean) => void

Called when the pointer lifts, cancels, or Escape aborts.

cancel_on_escape?boolean

Cancel active drag on Escape (default true).

stop_propagation?boolean

Stop pointerdown propagation so nested drag surfaces do not both capture the gesture.

disabled?() => boolean

Disable dragging reactively.

Source: packages/ui/src/behaviors/drag.svelte.ts:21

BindHoldOptions type

type BindHoldOptions = {
    /** Hold duration in ms before `on_hold` fires (default `500`). */
    readonly delay?: number;
    /** Max pointer drift in px before canceling (default `8`). */
    readonly tolerance?: number;
    /** Keys that start a keyboard hold (default `[' ', 'Enter']`). */
    readonly keys?: readonly string[];
    /** Called when press starts. */
    readonly on_start?: (details: {
        readonly event: PointerEvent | KeyboardEvent;
        readonly input: HoldInput;
    }) => void;
    /** Called once the press crosses `delay`. */
    readonly on_hold: (details: {
        readonly event: PointerEvent | KeyboardEvent;
        readonly input: HoldInput;
    }) => void;
    /** Called when the press lifts or cancels. */
    readonly on_end?: (details: {
        readonly event: Event;
        readonly input: HoldInput;
        readonly held: boolean;
        readonly canceled: boolean;
    }) => void;
    /** Disable reactively. */
    readonly disabled?: () => boolean;
};

Options for bind_hold.

Members

NameTypeDescription
delay?number

Hold duration in ms before on_hold fires (default 500).

tolerance?number

Max pointer drift in px before canceling (default 8).

keys?readonly string[]

Keys that start a keyboard hold (default [' ', 'Enter']).

on_start?(details: { readonly event: PointerEvent | KeyboardEvent; readonly input: HoldInput; }) => void

Called when press starts.

on_hold(details: { readonly event: PointerEvent | KeyboardEvent; readonly input: HoldInput; }) => void

Called once the press crosses delay.

on_end?(details: { readonly event: Event; readonly input: HoldInput; readonly held: boolean; readonly canceled: boolean; }) => void

Called when the press lifts or cancels.

disabled?() => boolean

Disable reactively.

Source: packages/ui/src/behaviors/micro.svelte.ts:199

BindRepeatOptions type

type BindRepeatOptions = {
    /** Called immediately on press and repeatedly while held. */
    readonly on_step: (count: number) => void;
    /** Called when the repeating press stops. */
    readonly on_end?: (count: number) => void;
    /** Delay before repeating begins in ms (default `400`). */
    readonly delay?: number;
    /** Interval between repeated steps in ms (default `60`). */
    readonly interval?: number;
    /** Disable reactively. */
    readonly disabled?: () => boolean;
};

Options for bind_repeat.

Members

NameTypeDescription
on_step(count: number) => void

Called immediately on press and repeatedly while held.

on_end?(count: number) => void

Called when the repeating press stops.

delay?number

Delay before repeating begins in ms (default 400).

interval?number

Interval between repeated steps in ms (default 60).

disabled?() => boolean

Disable reactively.

Source: packages/ui/src/behaviors/micro.svelte.ts:334

CalendarBehavior type

type CalendarBehavior = ReturnType<typeof create_calendar>;

Return value of create_calendar.

Members

NameTypeDescription
placeholderCalendarDate
monthsreadonly CalendarMonth[]
weekdaysreadonly string[]
set_placeholder(next: DateValue) => void
prev_month() => void
next_month() => void
reset_pending() => void
focusedCalendarDate
focus_day(target: CalendarDate) => void
day_ref(date: CalendarDate) => Attachment<HTMLElement>
day_attrs(date: CalendarDate, month: CalendarDate) => { role: "button"; tabindex: number; "data-value": string; "data-selected": string | undefined; "data-selection-start": string | undefined; "data-selection-end": string | undefined; "data-today": string | undefined; "data-outside-month": string | undefined; "data-disabled": string | undefined; "aria-disabled": true | undefined; "aria-selected": boolean;…

Source: packages/ui/src/behaviors/date-time.svelte.ts:121

CalendarMode type

type CalendarMode = 'single' | 'range';

Selection mode for create_calendar.

Source: packages/ui/src/behaviors/date-time.svelte.ts:74

CalendarMonth type

type CalendarMonth = {
    /** First day of this month. */
    readonly value: CalendarDate;
    /** Rows of 7 `CalendarDate` cells (including leading/trailing outside-month days). */
    readonly weeks: readonly (readonly CalendarDate[])[];
};

One month grid returned by create_calendar.

Members

NameTypeDescription
valueCalendarDate

First day of this month.

weeksreadonly (readonly CalendarDate[])[]

Rows of 7 CalendarDate cells (including leading/trailing outside-month days).

Source: packages/ui/src/behaviors/date-time.svelte.ts:85

CalendarOptions type

type CalendarOptions = {
    /** Single-day or date-range selection mode (default `'single'`). */
    readonly mode?: CalendarMode | (() => CalendarMode);
    /** Selected single date when `mode === 'single'`. */
    readonly value?: () => DateValue | undefined;
    /** Selected range when `mode === 'range'`. */
    readonly range?: () => CalendarRange;
    /** Called on single-day selection. */
    readonly on_select?: (date: DateValue) => void;
    /** Called when range selection updates (with `{ start, end }`). */
    readonly on_range_change?: (range: CalendarRange) => void;
    /** Controlled visible anchor month. */
    readonly placeholder?: () => DateValue | undefined;
    /** Called when the visible month changes. */
    readonly on_placeholder_change?: (next: DateValue) => void;
    /** Number of side-by-side months to build (default `1`). */
    readonly number_of_months?: () => number;
    /** BCP-47 locale for weekday order and names (default `'en-US'`). */
    readonly locale?: () => string | undefined;
    /** Minimum selectable date. */
    readonly min?: () => DateValue | undefined;
    /** Maximum selectable date. */
    readonly max?: () => DateValue | undefined;
    /** Disabled state. */
    readonly disabled?: () => boolean;
};

Options for create_calendar.

Members

NameTypeDescription
mode?CalendarMode | (() => CalendarMode)

Single-day or date-range selection mode (default 'single').

value?() => DateValue | undefined

Selected single date when mode === 'single'.

range?() => CalendarRange

Selected range when mode === 'range'.

on_select?(date: DateValue) => void

Called on single-day selection.

on_range_change?(range: CalendarRange) => void

Called when range selection updates (with { start, end }).

placeholder?() => DateValue | undefined

Controlled visible anchor month.

on_placeholder_change?(next: DateValue) => void

Called when the visible month changes.

number_of_months?() => number

Number of side-by-side months to build (default 1).

locale?() => string | undefined

BCP-47 locale for weekday order and names (default 'en-US').

min?() => DateValue | undefined

Minimum selectable date.

max?() => DateValue | undefined

Maximum selectable date.

disabled?() => boolean

Disabled state.

Source: packages/ui/src/behaviors/date-time.svelte.ts:93

CalendarRange type

type CalendarRange = {
    /** First selected date, if any. */
    readonly start: DateValue | undefined;
    /** Last selected date, if any. */
    readonly end: DateValue | undefined;
};

Start and end of a calendar date range.

Members

NameTypeDescription
startDateValue | undefined

First selected date, if any.

endDateValue | undefined

Last selected date, if any.

Source: packages/ui/src/behaviors/date-time.svelte.ts:77

CarouselBehavior type

type CarouselBehavior = ReturnType<typeof create_carousel>;

Return value of create_carousel.

Members

NameTypeDescription
indexnumber
countnumber
can_prevboolean
can_nextboolean
pausedboolean
go_to(next: number) => void
next() => void
prev() => void
set_paused(p: boolean) => void
rootAttachment<HTMLElement>
trackAttachment<HTMLElement>
root_attrs() => { role: "region"; "aria-roledescription": string; "aria-label": string; onpointerenter: () => boolean; onpointerleave: () => boolean; onfocusin: () => boolean; onfocusout: () => boolean; onkeydown: (event: KeyboardEvent) => void; }
slide_attrs(i: number) => { role: "group"; "aria-roledescription": string; "aria-label": string; "aria-hidden": true | undefined; "data-active": string | undefined; }
dot_attrs(i: number) => { type: "button"; "aria-label": string; "aria-current": "true" | undefined; "data-active": string | undefined; onclick: () => void; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:240

CarouselOptions type

type CarouselOptions = {
    readonly count: () => number;
    readonly index?: () => number;
    readonly default_index?: number;
    readonly on_change?: (index: number) => void;
    readonly loop?: boolean;
    readonly autoplay_ms?: number;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_carousel.

Members

NameTypeDescription
count() => number
index?() => number
default_index?number
on_change?(index: number) => void
loop?boolean
autoplay_ms?number
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:228

CellBounds type

type CellBounds = {
    readonly top: number;
    readonly left: number;
    readonly bottom: number;
    readonly right: number;
};

Normalized inclusive rectangular bounds of a CellRange.

Members

NameTypeDescription
topnumber
leftnumber
bottomnumber
rightnumber

Source: packages/ui/src/behaviors/grid.svelte.ts:15

CellRange type

type CellRange = {
    readonly anchor: GridCell;
    readonly end: GridCell;
};

Rectangular cell range from anchor to end.

Members

NameTypeDescription
anchorGridCell
endGridCell

Source: packages/ui/src/behaviors/grid.svelte.ts:12

CellRangeBehavior type

type CellRangeBehavior = ReturnType<typeof create_cell_range>;

Return value of create_cell_range.

Members

NameTypeDescription
rangeCellRange | null
boundsCellBounds | null
draggingboolean
start(cell: GridCell) => void
extend(to: GridCell, from?: GridCell, notify?: boolean) => void
select_row(row: number) => void
select_col(col: number) => void
clear() => void
contains(cell: GridCell) => boolean
to_text(read: (cell: GridCell) => string) => string
cell_attrs(cell: GridCell) => { "aria-selected": boolean; "data-in-range": string | undefined; onpointerdown: (event: PointerEvent) => void; onpointerenter: () => void; }

Source: packages/ui/src/behaviors/grid.svelte.ts:253

CellRangeOptions type

type CellRangeOptions = {
    /** Total row count. */
    readonly rows: () => number;
    /** Total column count. */
    readonly cols: () => number;
    /** Controlled range; omit for internal state. */
    readonly range?: () => CellRange | null;
    /** Called when the selected cell range changes. */
    readonly on_change?: (range: CellRange | null) => void;
    /** Optional live-region message formatter on range updates. */
    readonly message?: (bounds: CellBounds) => string;
};

Options for create_cell_range.

Members

NameTypeDescription
rows() => number

Total row count.

cols() => number

Total column count.

range?() => CellRange | null

Controlled range; omit for internal state.

on_change?(range: CellRange | null) => void

Called when the selected cell range changes.

message?(bounds: CellBounds) => string

Optional live-region message formatter on range updates.

Source: packages/ui/src/behaviors/grid.svelte.ts:239

ChangeSource type

type ChangeSource = 'pointer' | 'keyboard' | 'agent' | 'programmatic';

Who initiated a UI change.

Source: packages/ui/src/behaviors/controls.svelte.ts:7

CheckboxGroup type

type CheckboxGroup = ReturnType<typeof create_checkbox_group>;

Return value of create_checkbox_group.

Members

NameTypeDescription
checkedreadonly string[]
all_stateboolean | "indeterminate"
is_checked(key: string) => boolean
toggle(key: string) => void
toggle_all() => void
group_attrs() => { role: "group"; "aria-label": string | undefined; }
all_attrs() => { type: "checkbox"; checked: boolean; "aria-checked": boolean | "mixed"; onchange: () => void; }
item_attrs(key: string) => { type: "checkbox"; checked: boolean; disabled: true | undefined; onchange: () => void; }

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:621

CheckboxGroupOptions type

type CheckboxGroupOptions = {
    /** All selectable item keys. */
    readonly items: () => readonly string[];
    /** Controlled checked keys; omit for internal state. */
    readonly value?: () => readonly string[];
    /** Initial checked keys when uncontrolled. */
    readonly default_value?: readonly string[];
    /** Called when checked keys change. */
    readonly on_change?: (next: readonly string[]) => void;
    /** Per-item disabled predicate. */
    readonly disabled?: (key: string) => boolean;
    /** Accessible label for the group. */
    readonly label?: string;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_checkbox_group.

Members

NameTypeDescription
items() => readonly string[]

All selectable item keys.

value?() => readonly string[]

Controlled checked keys; omit for internal state.

default_value?readonly string[]

Initial checked keys when uncontrolled.

on_change?(next: readonly string[]) => void

Called when checked keys change.

disabled?(key: string) => boolean

Per-item disabled predicate.

label?string

Accessible label for the group.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:603

Clipboard type

type Clipboard = ReturnType<typeof create_clipboard>;

Return value of create_clipboard.

Members

NameTypeDescription
copiedboolean
copy(override?: string) => Promise<boolean>
reset() => void

Source: packages/ui/src/behaviors/clipboard.svelte.ts:16

ClipboardOptions type

type ClipboardOptions = {
    /** Text to copy (reactive getter or static string). */
    text: string | (() => string);
    /** How long `copied` stays `true` in ms (default `1500`). */
    timeout_ms?: number;
    /** Optional callback after a copy attempt completes. */
    on_copy?: (ok: boolean, value: string) => void;
};

Options for create_clipboard.

Members

NameTypeDescription
textstring | (() => string)

Text to copy (reactive getter or static string).

timeout_ms?number

How long copied stays true in ms (default 1500).

on_copy?(ok: boolean, value: string) => void

Optional callback after a copy attempt completes.

Source: packages/ui/src/behaviors/clipboard.svelte.ts:6

ColorPickerBehavior type

type ColorPickerBehavior = ReturnType<typeof create_color_picker>;

Return value of create_color_picker.

Members

NameTypeDescription
valuestring
rgbaRgbaColor
hsvHsvaColor
plane{ readonly value: import("./canvas.svelte.js").AreaValue; readonly percent_x: number; readonly percent_y: number; readonly dragging: boolean; set: (next: import("./canvas.svelte.js").AreaValue, commitNow?: boolean) => void; surface: Attachment<HTMLElement>; thumb_attrs(): { role: "slider"; tabindex: number; 'aria-label': string | undefined; 'aria-valuetext': string; 'data-dragging': string | unde…
hue{ readonly value: number; readonly values: readonly number[]; readonly percent: number; readonly percents: number[]; readonly dragging: boolean; readonly active_thumb: number; set(next: number, index?: number): void; track: Attachment<HTMLElement>; thumb_attrs(index?: number): { role: "slider"; 'aria-orientation': "horizontal" | "vertical"; 'aria-label': string | undefined; 'aria-valuemin': numbe…
alpha{ readonly value: number; readonly values: readonly number[]; readonly percent: number; readonly percents: number[]; readonly dragging: boolean; readonly active_thumb: number; set(next: number, index?: number): void; track: Attachment<HTMLElement>; thumb_attrs(index?: number): { role: "slider"; 'aria-orientation': "horizontal" | "vertical"; 'aria-label': string | undefined; 'aria-valuemin': numbe…
set_text(text: string) => boolean
set_rgba(next: RgbaColor) => void

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:987

ColorPickerOptions type

type ColorPickerOptions = {
    readonly value?: () => string;
    readonly default_value?: string;
    readonly on_change?: (hex: string, rgba: RgbaColor) => void;
    readonly format?: 'hex' | 'rgb' | 'hsl';
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_color_picker.

Members

NameTypeDescription
value?() => string
default_value?string
on_change?(hex: string, rgba: RgbaColor) => void
format?'hex' | 'rgb' | 'hsl'
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:977

ColorSchemeOptions type

type ColorSchemeOptions = {
    readonly storage_key?: string;
    readonly default_value?: ColorSchemePreference;
    readonly apply_class?: boolean;
};

Options for create_color_scheme.

Members

NameTypeDescription
storage_key?string
default_value?ColorSchemePreference
apply_class?boolean

Source: packages/ui/src/behaviors/platform.svelte.ts:165

ColorSchemePreference type

type ColorSchemePreference = 'light' | 'dark' | 'system';

User color-scheme preference.

Source: packages/ui/src/behaviors/platform.svelte.ts:153

ConnectBehavior type

type ConnectBehavior = ReturnType<typeof create_connect>;

Return value of create_connect.

Members

NameTypeDescription
draftConnectDraft | null
pending_fromstring | null
port(id: string) => Attachment<HTMLElement>
port_attrs(id: string) => { tabindex: number; 'data-connecting': string | undefined; 'data-connect-target': string | undefined; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/canvas.svelte.ts:635

ConnectDraft type

type ConnectDraft = {
    readonly from: string;
    readonly x: number;
    readonly y: number;
    readonly over: string | null;
};

Active wire being dragged from a source port to pointer coordinates.

Members

NameTypeDescription
fromstring
xnumber
ynumber
overstring | null

Source: packages/ui/src/behaviors/canvas.svelte.ts:621

ConnectOptions type

type ConnectOptions = {
    readonly can_connect?: (from: string, to: string) => boolean;
    readonly on_connect: (from: string, to: string) => void;
};

Options for create_connect.

Members

NameTypeDescription
can_connect?(from: string, to: string) => boolean
on_connect(from: string, to: string) => void

Source: packages/ui/src/behaviors/canvas.svelte.ts:629

ControlAction type

type ControlAction = (...args: readonly unknown[]) => void;

Semantic action callback registered on a live UI control.

Source: packages/ui/src/behaviors/controls.svelte.ts:10

ControlChange type

type ControlChange = {
    readonly id: string;
    readonly kind: string;
    readonly label?: string;
    readonly key: string;
    readonly previous: unknown;
    readonly value: unknown;
    readonly source: ChangeSource;
    readonly reason: string;
    readonly redacted?: boolean;
    readonly committed: boolean;
};

Emitted change record for observe_controls and create_ui_history.

Members

NameTypeDescription
idstring
kindstring
label?string
keystring
previousunknown
valueunknown
sourceChangeSource
reasonstring
redacted?boolean
committedboolean

Source: packages/ui/src/behaviors/controls.svelte.ts:74

ControlChoice type

type ControlChoice = {
    readonly value: string;
    readonly label: string;
};

Choice exposed by a selectable control (tabs, combobox, menu, radio group, tree).

Members

NameTypeDescription
valuestring
labelstring

Source: packages/ui/src/behaviors/controls.svelte.ts:13

ControlDescriptor type

type ControlDescriptor = {
    /** Stable semantic identifier, e.g. `'tabs:settings'` or `'combobox:status'`. */
    readonly id: string;
    /** Component kind, e.g. `'tabs'`, `'combobox'`, `'dialog'`, `'input'`, `'checkbox'`, `'menu'`. */
    readonly kind: string;
    /** Optional human-readable label (falls back to accessible name of `element`). */
    readonly label?: string;
    /** Optional root/interactive DOM element for scope filtering and `data-agent-*` marks. */
    readonly element?: () => HTMLElement | null | undefined;
    /** Live snapshot of state (active tab, open state, value, selected count, etc.). */
    readonly state: () => Record<string, unknown>;
    /** Optional choices accepted by selection actions. */
    readonly items?: () => readonly ControlChoice[];
    /** Named semantic actions callable by the host/agent bridge. */
    readonly actions?: Readonly<Record<string, ControlAction>>;
    /** Whether the control is currently disabled or read-only (hides callable actions). */
    readonly disabled?: () => boolean;
    /** Explicit confirmation prompt describing why a person must approve agent actions. */
    readonly confirm?: string | (() => string | undefined);
    /** Marks values as secret (writable by agent, always redacted in snapshots/observations). */
    readonly secret?: boolean | (() => boolean);
    /** Hides this control from agent snapshots and invocation. */
    readonly hidden?: boolean | (() => boolean);
};

Registration descriptor for a live interactive UI control.

Members

NameTypeDescription
idstring

Stable semantic identifier, e.g. 'tabs:settings' or 'combobox:status'.

kindstring

Component kind, e.g. 'tabs', 'combobox', 'dialog', 'input', 'checkbox', 'menu'.

label?string

Optional human-readable label (falls back to accessible name of element).

element?() => HTMLElement | null | undefined

Optional root/interactive DOM element for scope filtering and data-agent-* marks.

state() => Record<string, unknown>

Live snapshot of state (active tab, open state, value, selected count, etc.).

items?() => readonly ControlChoice[]

Optional choices accepted by selection actions.

actions?Readonly<Record<string, ControlAction>>

Named semantic actions callable by the host/agent bridge.

disabled?() => boolean

Whether the control is currently disabled or read-only (hides callable actions).

confirm?string | (() => string | undefined)

Explicit confirmation prompt describing why a person must approve agent actions.

secret?boolean | (() => boolean)

Marks values as secret (writable by agent, always redacted in snapshots/observations).

hidden?boolean | (() => boolean)

Hides this control from agent snapshots and invocation.

Source: packages/ui/src/behaviors/controls.svelte.ts:16

ControlInvokeResult type

type ControlInvokeResult = {
    readonly ok: boolean;
    readonly id?: string;
    readonly label?: string;
    readonly confirm?: string;
    readonly error?: string;
};

Structured result returned by invoke_control.

Members

NameTypeDescription
okboolean
id?string
label?string
confirm?string
error?string

Source: packages/ui/src/behaviors/controls.svelte.ts:65

ControlSnapshot type

type ControlSnapshot = {
    readonly id: string;
    readonly kind: string;
    readonly label?: string;
    readonly state: Record<string, unknown>;
    readonly actions: readonly string[];
    readonly items?: readonly ControlChoice[];
    readonly confirm?: string;
    readonly secret?: boolean;
    readonly disabled?: boolean;
};

Read-only snapshot of a registered UI control's current state, safety marks and actions.

Members

NameTypeDescription
idstring
kindstring
label?string
stateRecord<string, unknown>
actionsreadonly string[]
items?readonly ControlChoice[]
confirm?string
secret?boolean
disabled?boolean

Source: packages/ui/src/behaviors/controls.svelte.ts:42

CookieStorageOptions type

type CookieStorageOptions = {
    readonly path?: string;
    readonly max_age?: number;
    readonly same_site?: 'Lax' | 'Strict' | 'None';
    readonly secure?: boolean;
};

Options for create_cookie_storage.

Members

NameTypeDescription
path?string
max_age?number
same_site?'Lax' | 'Strict' | 'None'
secure?boolean

Source: packages/ui/src/behaviors/platform.svelte.ts:398

CropRect type

type CropRect = {
    readonly x: number;
    readonly y: number;
    readonly width: number;
    readonly height: number;
};

Normalized (0..1) crop rectangle over an image.

Members

NameTypeDescription
xnumber
ynumber
widthnumber
heightnumber

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1086

DRAG_THRESHOLD const

const DRAG_THRESHOLD: 4

Default movement threshold in CSS px before a press becomes a drag.

Source: packages/ui/src/behaviors/drag.svelte.ts:7

DateFieldBehavior type

type DateFieldBehavior = ReturnType<typeof create_date_field>;

Return value of create_date_field.

Members

NameTypeDescription
segmentsreadonly DateTimeSegment[]
segment_ref(part: SegmentPart) => Attachment<HTMLElement>
segment_attrs(seg: DateTimeSegment) => { "aria-hidden": true; "data-segment": "literal"; role?: undefined; tabindex?: undefined; "aria-label"?: undefined; "aria-valuemin"?: undefined; "aria-valuemax"?: undefined; "aria-valuenow"?: undefined; "aria-valuetext"?: undefined; "aria-disabled"?: undefined; onkeydown?: undefined; onblur?: undefined; } | { role: "spinbutton"; tabindex: number | undefined; "data-segmen…

Source: packages/ui/src/behaviors/date-time.svelte.ts:56

DateFieldOptions type

type DateFieldOptions = {
    /** Controlled `DateValue` getter. */
    readonly value: () => DateValue | undefined;
    /** Called when the complete date/time value changes (or clears to `undefined`). */
    readonly on_change: (next: DateValue | undefined) => void;
    /** Editing precision: `'day'` (date only), `'hour'` (date + hour), or `'minute'` (date + hour + minute). */
    readonly granularity?: () => 'day' | 'hour' | 'minute';
    /** BCP-47 locale for segment order and separators (default `'en-US'`). */
    readonly locale?: () => string | undefined;
    /** Disabled state. */
    readonly disabled?: () => boolean;
    /** Minimum allowed date value. */
    readonly min?: () => DateValue | undefined;
    /** Maximum allowed date value. */
    readonly max?: () => DateValue | undefined;
};

Options for create_date_field.

Members

NameTypeDescription
value() => DateValue | undefined

Controlled DateValue getter.

on_change(next: DateValue | undefined) => void

Called when the complete date/time value changes (or clears to undefined).

granularity?() => 'day' | 'hour' | 'minute'

Editing precision: 'day' (date only), 'hour' (date + hour), or 'minute' (date + hour + minute).

locale?() => string | undefined

BCP-47 locale for segment order and separators (default 'en-US').

disabled?() => boolean

Disabled state.

min?() => DateValue | undefined

Minimum allowed date value.

max?() => DateValue | undefined

Maximum allowed date value.

Source: packages/ui/src/behaviors/date-time.svelte.ts:38

DateTimeSegment type

type DateTimeSegment = {
    /** Segment type (`'year'`, `'month'`, `'day'`, `'hour'`, `'minute'`, or `'literal'`). */
    readonly part: SegmentPart;
    /** Displayed text (zero-padded value, placeholder token or separator). */
    readonly value: string;
    /** Whether the segment is currently showing its placeholder rather than a set value. */
    readonly placeholder: boolean;
};

One rendered segment of a segmented date or time field.

Members

NameTypeDescription
partSegmentPart

Segment type ('year', 'month', 'day', 'hour', 'minute', or 'literal').

valuestring

Displayed text (zero-padded value, placeholder token or separator).

placeholderboolean

Whether the segment is currently showing its placeholder rather than a set value.

Source: packages/ui/src/behaviors/date-time.svelte.ts:28

Debounced class

class Debounced<T> {
    #private;
    constructor(getter: () => T, wait?: number | (() => number));
    /** The latest settled value. */
    get current(): T;
    /** Immediately sets the value and cancels any pending debounce timer. */
    updateImmediately: (value: T) => void;
    /** Cancels any pending scheduled update. */
    cancel: () => void;
}

Reactive debounced value mirroring getter() after wait ms of inactivity.

Members

NameTypeDescription
#privateany
currentT

The latest settled value.

updateImmediately(value: T) => void

Immediately sets the value and cancels any pending debounce timer.

cancel() => void

Cancels any pending scheduled update.

Source: packages/ui/src/behaviors/reactive.svelte.ts:112

Disclosure type

type Disclosure = ReturnType<typeof create_disclosure>;

Return value of create_disclosure.

Members

NameTypeDescription
openboolean
disabledboolean
state"open" | "closed"
set_open(next: boolean) => void
toggle() => void
show() => void
hide() => void
trigger_attrs() => { type: "button"; "aria-expanded": boolean; "aria-controls": string; "data-state": "open" | "closed"; disabled: true | undefined; onclick: () => void; }

Spread onto the trigger button (type, aria-expanded, aria-controls, data-state, disabled, onclick).

content_attrs() => { id: string; hidden: boolean; "data-state": "open" | "closed"; }

Spread onto the collapsible content element (id, hidden, data-state).

Source: packages/ui/src/behaviors/disclosure.svelte.ts:21

DisclosureOptions type

type DisclosureOptions = {
    /** Controlled open state; omit for internal state. */
    open?: () => boolean;
    /** Initial open state when uncontrolled (default `false`). */
    default_open?: boolean;
    /** Called whenever the disclosure opens or closes. */
    on_open_change?: (open: boolean) => void;
    /** Whether interaction is disabled. */
    disabled?: () => boolean;
    /** Stable id prefix for `aria-controls`; auto-generated when omitted. */
    id?: string;
};

Options for create_disclosure.

Members

NameTypeDescription
open?() => boolean

Controlled open state; omit for internal state.

default_open?boolean

Initial open state when uncontrolled (default false).

on_open_change?(open: boolean) => void

Called whenever the disclosure opens or closes.

disabled?() => boolean

Whether interaction is disabled.

id?string

Stable id prefix for aria-controls; auto-generated when omitted.

Source: packages/ui/src/behaviors/disclosure.svelte.ts:7

DismissLayer type

type DismissLayer = ReturnType<typeof create_dismiss>;

Return value of create_dismiss.

Members

NameTypeDescription
depthnumber
topmostboolean
surfaceAttachment<HTMLElement>

Source: packages/ui/src/behaviors/dismiss.svelte.ts:24

DismissOptions type

type DismissOptions = {
    /** Whether this layer is currently active/open. */
    open: () => boolean;
    /** Called when the topmost layer should close. */
    on_dismiss: (reason: DismissReason, event: KeyboardEvent | PointerEvent) => void;
    /** Close on Escape key (default `true`). */
    escape?: boolean | (() => boolean);
    /** Close on pointerdown outside the attached surface (default `true`). */
    outside?: boolean | (() => boolean);
    /** Extra elements treated as inside (e.g. an anchor trigger button). */
    ignore?: () => readonly (Element | null | undefined)[];
};

Options for create_dismiss.

Members

NameTypeDescription
open() => boolean

Whether this layer is currently active/open.

on_dismiss(reason: DismissReason, event: KeyboardEvent | PointerEvent) => void

Called when the topmost layer should close.

escape?boolean | (() => boolean)

Close on Escape key (default true).

outside?boolean | (() => boolean)

Close on pointerdown outside the attached surface (default true).

ignore?() => readonly (Element | null | undefined)[]

Extra elements treated as inside (e.g. an anchor trigger button).

Source: packages/ui/src/behaviors/dismiss.svelte.ts:10

DismissReason type

type DismissReason = 'escape' | 'outside';

Why a dismissible layer was closed ('escape' or 'outside').

Source: packages/ui/src/behaviors/dismiss.svelte.ts:7

DragPreviewOptions type

type DragPreviewOptions = {
    /** Reactive active drag coordinates (`null` when not dragging). */
    readonly point: () => {
        readonly x: number;
        readonly y: number;
    } | null;
    /** Offset in px relative to pointer (default `{ x: 12, y: 12 }`). */
    readonly offset?: {
        readonly x: number;
        readonly y: number;
    };
};

Options for bind_drag_preview.

Members

NameTypeDescription
point() => { readonly x: number; readonly y: number; } | null

Reactive active drag coordinates (null when not dragging).

offset?{ readonly x: number; readonly y: number; }

Offset in px relative to pointer (default { x: 12, y: 12 }).

Source: packages/ui/src/behaviors/platform.svelte.ts:294

DrawerBehavior type

type DrawerBehavior = ReturnType<typeof create_drawer>;

Return value of create_drawer.

Members

NameTypeDescription
openboolean
draggingboolean
offsetnumber
snap_indexnumber
snap_fractionnumber
set_open(next: boolean) => void
set_snap(idx: number) => void
surfaceAttachment<HTMLElement>
handleAttachment<HTMLElement>
surface_attrs() => { role: "dialog"; "aria-modal": true | undefined; "aria-label": string | undefined; "data-side": DrawerSide; "data-dragging": string | undefined; "data-state": "open" | "closed"; style: string | undefined; }

Source: packages/ui/src/behaviors/motion.svelte.ts:122

DrawerOptions type

type DrawerOptions = {
    /** Controlled open state; omit for internal state. */
    readonly open?: () => boolean;
    /** Called when open state changes. */
    readonly on_open_change?: (open: boolean) => void;
    /** Edge the drawer slides from (default `'bottom'`). */
    readonly side?: DrawerSide;
    /** Fractional snap points in `(0, 1]` (default `[1]`, e.g. `[0.4, 0.9]`). */
    readonly snap_points?: readonly number[];
    /** Active snap point index (0-based). */
    readonly active_snap?: () => number;
    /** Called when the active snap point changes. */
    readonly on_snap_change?: (index: number) => void;
    /** Whether dragging past the dismissal threshold closes the drawer (default `true`). */
    readonly dismissible?: boolean;
    /** Trap focus and mark background inert while open (default `true`). */
    readonly modal?: boolean;
    /** Accessible label for the drawer surface. */
    readonly label?: string;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_drawer.

Members

NameTypeDescription
open?() => boolean

Controlled open state; omit for internal state.

on_open_change?(open: boolean) => void

Called when open state changes.

side?DrawerSide

Edge the drawer slides from (default 'bottom').

snap_points?readonly number[]

Fractional snap points in (0, 1] (default [1], e.g. [0.4, 0.9]).

active_snap?() => number

Active snap point index (0-based).

on_snap_change?(index: number) => void

Called when the active snap point changes.

dismissible?boolean

Whether dragging past the dismissal threshold closes the drawer (default true).

modal?boolean

Trap focus and mark background inert while open (default true).

label?string

Accessible label for the drawer surface.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/motion.svelte.ts:98

DrawerSide type

type DrawerSide = 'bottom' | 'top' | 'left' | 'right';

Side from which a swipeable drawer slides in.

Source: packages/ui/src/behaviors/motion.svelte.ts:95

EnterKeyHint type

type EnterKeyHint = 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';

Label shown on mobile virtual keyboard Return keys (enterkeyhint).

Source: packages/ui/src/behaviors/micro.svelte.ts:432

FieldBehavior type

type FieldBehavior = ReturnType<typeof create_field>;

Return value of create_field.

Members

NameTypeDescription
idstring
invalidboolean
errorstring | undefined
label_attrs() => { for: string; "data-required": string | undefined; "data-invalid": string | undefined; "data-disabled": string | undefined; }
control_attrs() => { id: string; "aria-describedby": string | undefined; "aria-invalid": true | undefined; "aria-required": true | undefined; disabled: true | undefined; readonly: true | undefined; }
description_attrs() => { id: string; }
error_attrs() => { id: string; role: "alert"; }

Source: packages/ui/src/behaviors/field.svelte.ts:23

FieldBehaviorOptions type

type FieldBehaviorOptions = {
    /** Optional stable id prefix; auto-generated when omitted. */
    id?: string;
    /** Whether a helper description element is rendered. */
    has_description?: () => boolean;
    /** Current validation error message (non-empty marks the control invalid). */
    error?: () => string | undefined | null;
    /** Whether the field is required. */
    required?: () => boolean;
    /** Whether the field is disabled. */
    disabled?: () => boolean;
    /** Whether the field is read-only. */
    readonly?: () => boolean;
};

Options for create_field.

Members

NameTypeDescription
id?string

Optional stable id prefix; auto-generated when omitted.

has_description?() => boolean

Whether a helper description element is rendered.

error?() => string | undefined | null

Current validation error message (non-empty marks the control invalid).

required?() => boolean

Whether the field is required.

disabled?() => boolean

Whether the field is disabled.

readonly?() => boolean

Whether the field is read-only.

Source: packages/ui/src/behaviors/field.svelte.ts:7

FileDropzone type

type FileDropzone = ReturnType<typeof create_file_dropzone>;

Return value of create_file_dropzone.

Members

NameTypeDescription
draggingboolean
disabledboolean
open() => void
process(list: FileList | readonly File[]) => void
zoneAttachment<HTMLElement>
inputAttachment<HTMLInputElement>
input_attrs() => { type: "file"; accept: string | undefined; multiple: boolean | undefined; disabled: true | undefined; onchange: (event: Event) => void; }

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:740

FileDropzoneOptions type

type FileDropzoneOptions = {
    /** Accepted MIME types or extensions (e.g. `['image/*', '.pdf']`). */
    readonly accept?: readonly string[];
    /** Maximum file size in bytes. */
    readonly max_bytes?: number;
    /** Maximum number of files accepted in one drop/selection (default unlimited). */
    readonly max_files?: number;
    /** Disabled state. */
    readonly disabled?: () => boolean;
    /** Called with validated accepted and rejected files. */
    readonly on_files: (result: {
        readonly accepted: readonly File[];
        readonly rejected: readonly RejectedFile[];
    }) => void;
};

Options for create_file_dropzone.

Members

NameTypeDescription
accept?readonly string[]

Accepted MIME types or extensions (e.g. ['image/*', '.pdf']).

max_bytes?number

Maximum file size in bytes.

max_files?number

Maximum number of files accepted in one drop/selection (default unlimited).

disabled?() => boolean

Disabled state.

on_files(result: { readonly accepted: readonly File[]; readonly rejected: readonly RejectedFile[]; }) => void

Called with validated accepted and rejected files.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:726

FindableOptions type

type FindableOptions = {
    /** Whether the panel is currently open/visible. */
    readonly open: () => boolean;
    /** Whether closed content remains findable via browser Ctrl/Cmd+F (default `true`). */
    readonly findable?: () => boolean;
    /** Called when browser find-in-page matches text inside the closed panel (`beforematch`). */
    readonly on_reveal: (event: Event) => void;
};

Options for bind_findable.

Members

NameTypeDescription
open() => boolean

Whether the panel is currently open/visible.

findable?() => boolean

Whether closed content remains findable via browser Ctrl/Cmd+F (default true).

on_reveal(event: Event) => void

Called when browser find-in-page matches text inside the closed panel (beforematch).

Source: packages/ui/src/behaviors/presence.svelte.ts:217

FlatTreeRow type

type FlatTreeRow<T = unknown> = {
    readonly id: string;
    readonly label: string;
    readonly depth: number;
    readonly parent: string | null;
    readonly expandable: boolean;
    readonly expanded: boolean;
    readonly disabled: boolean;
    readonly node: TreeNode<T>;
};

Flattened visible row produced by create_tree with depth and expansion state.

Members

NameTypeDescription
idstring
labelstring
depthnumber
parentstring | null
expandableboolean
expandedboolean
disabledboolean
nodeTreeNode<T>

Source: packages/ui/src/behaviors/tree.svelte.ts:19

Floating type

type Floating = ReturnType<typeof create_floating>;

Return value of create_floating.

Members

NameTypeDescription
xnumber
ynumber
sideFloatingSide
anchor_widthnumber
available_widthnumber
available_heightnumber
positionedboolean
stylestring
set_anchor(next: FloatingAnchor | null) => void

Sets a programmatic element or virtual { x, y } / DOMRect anchor.

update() => void
anchorAttachment<HTMLElement>
contentAttachment<HTMLElement>

Source: packages/ui/src/behaviors/floating.svelte.ts:57

FloatingAlign type

type FloatingAlign = 'start' | 'center' | 'end';

Cross-axis alignment relative to the anchor edge.

Source: packages/ui/src/behaviors/floating.svelte.ts:10

FloatingAnchor type

type FloatingAnchor = HTMLElement | VirtualAnchor;

Either a live DOM element or a virtual point/rectangle anchor.

Source: packages/ui/src/behaviors/floating.svelte.ts:28

FloatingOptions type

type FloatingOptions = {
    /** Whether the floating surface is open. */
    readonly open: () => boolean;
    /** Called when Escape or an outside pointer press dismisses the surface. */
    readonly on_dismiss?: (reason: DismissReason) => void;
    /** Optional reactive anchor element or virtual anchor getter. */
    readonly anchor?: () => FloatingAnchor | null;
    /** Preferred side relative to the anchor (default `'bottom'`). */
    readonly side?: FloatingSide | (() => FloatingSide);
    /** Cross-axis alignment relative to the anchor (default `'center'`). */
    readonly align?: FloatingAlign | (() => FloatingAlign);
    /** Gap between anchor and floating surface in px (default `4`). */
    readonly side_offset?: number | (() => number);
    /** Shift along the cross axis in px (default `0`). */
    readonly align_offset?: number | (() => number);
    /** Viewport edge padding in px (default `8`). */
    readonly padding?: number | (() => number);
    /** Flip to the opposite side when viewport room is insufficient (default `true`). */
    readonly flip?: boolean | (() => boolean);
    /** Close on Escape key (default `true`). */
    readonly escape?: boolean | (() => boolean);
    /** Close on outside pointer press (default `true`). */
    readonly outside?: boolean | (() => boolean);
};

Options for create_floating.

Members

NameTypeDescription
open() => boolean

Whether the floating surface is open.

on_dismiss?(reason: DismissReason) => void

Called when Escape or an outside pointer press dismisses the surface.

anchor?() => FloatingAnchor | null

Optional reactive anchor element or virtual anchor getter.

side?FloatingSide | (() => FloatingSide)

Preferred side relative to the anchor (default 'bottom').

align?FloatingAlign | (() => FloatingAlign)

Cross-axis alignment relative to the anchor (default 'center').

side_offset?number | (() => number)

Gap between anchor and floating surface in px (default 4).

align_offset?number | (() => number)

Shift along the cross axis in px (default 0).

padding?number | (() => number)

Viewport edge padding in px (default 8).

flip?boolean | (() => boolean)

Flip to the opposite side when viewport room is insufficient (default true).

escape?boolean | (() => boolean)

Close on Escape key (default true).

outside?boolean | (() => boolean)

Close on outside pointer press (default true).

Source: packages/ui/src/behaviors/floating.svelte.ts:31

FloatingSide type

type FloatingSide = 'top' | 'bottom' | 'left' | 'right';

Preferred side of the anchor where the floating surface opens.

Source: packages/ui/src/behaviors/floating.svelte.ts:8

FocusRecovery type

type FocusRecovery<T = unknown> = ReturnType<typeof create_focus_recovery<T>>;

Return value of create_focus_recovery.

Members

NameTypeDescription
item(key: string, data?: T) => Attachment<HTMLElement>

Source: packages/ui/src/behaviors/focus-recovery.svelte.ts:23

FocusRecoveryOptions type

type FocusRecoveryOptions<T = unknown> = {
    /** Returns the next element to focus when a bound item unmounts with focus, or null/undefined. */
    readonly fallback: (lost: LostFocus<T>) => HTMLElement | null | undefined;
};

Options for create_focus_recovery.

Members

NameTypeDescription
fallback(lost: LostFocus<T>) => HTMLElement | null | undefined

Returns the next element to focus when a bound item unmounts with focus, or null/undefined.

Source: packages/ui/src/behaviors/focus-recovery.svelte.ts:17

FocusTrap type

type FocusTrap = ReturnType<typeof create_focus_trap>;

Return value of create_focus_trap.

Members

NameTypeDescription
containerAttachment<HTMLElement>

Source: packages/ui/src/behaviors/focus-trap.svelte.ts:48

FocusTrapOptions type

type FocusTrapOptions = {
    /** Whether focus trapping is active. */
    readonly active: () => boolean;
    /** Automatically move focus into the container when activated (default `true`). */
    readonly auto_focus?: boolean | (() => boolean);
    /** Restore focus to the previously active element on close (default `true`). */
    readonly restore_focus?: boolean | (() => boolean);
    /** Keep Tab / focusin strictly contained inside the container (default `true`). */
    readonly trap?: boolean | (() => boolean);
    /** Mark background siblings `inert` while active (default `false`; set `true` on modal dialogs). */
    readonly modal?: boolean | (() => boolean);
    /** Apply ref-counted document scroll lock while active (default `false`). */
    readonly prevent_scroll?: boolean | (() => boolean);
    /** Optional predicate gating focus-trap listeners to only the topmost stacked layer. */
    readonly topmost?: () => boolean;
    /** Cancelable hook invoked before initial autofocus runs. */
    readonly on_open_auto_focus?: (event: Event) => void;
    /** Cancelable hook invoked before focus returns to the previous element on close. */
    readonly on_close_auto_focus?: (event: Event) => void;
    /** Called when focus escapes outside the container while active. */
    readonly on_focus_outside?: (event: FocusEvent) => void;
};

Options for create_focus_trap.

Members

NameTypeDescription
active() => boolean

Whether focus trapping is active.

auto_focus?boolean | (() => boolean)

Automatically move focus into the container when activated (default true).

restore_focus?boolean | (() => boolean)

Restore focus to the previously active element on close (default true).

trap?boolean | (() => boolean)

Keep Tab / focusin strictly contained inside the container (default true).

modal?boolean | (() => boolean)

Mark background siblings inert while active (default false; set true on modal dialogs).

prevent_scroll?boolean | (() => boolean)

Apply ref-counted document scroll lock while active (default false).

topmost?() => boolean

Optional predicate gating focus-trap listeners to only the topmost stacked layer.

on_open_auto_focus?(event: Event) => void

Cancelable hook invoked before initial autofocus runs.

on_close_auto_focus?(event: Event) => void

Cancelable hook invoked before focus returns to the previous element on close.

on_focus_outside?(event: FocusEvent) => void

Called when focus escapes outside the container while active.

Source: packages/ui/src/behaviors/focus-trap.svelte.ts:24

GridCell type

type GridCell = {
    readonly row: number;
    readonly col: number;
};

Zero-based (row, col) coordinate in a 2D grid.

Members

NameTypeDescription
rownumber
colnumber

Source: packages/ui/src/behaviors/grid.svelte.ts:9

GridFocus type

type GridFocus = ReturnType<typeof create_grid_focus>;

Return value of create_grid_focus.

Members

NameTypeDescription
activeGridCell | null
focus(cell: GridCell, shift?: boolean) => void
cell(cell: GridCell) => Attachment<HTMLElement>
grid_attrs() => { role: "grid"; "aria-rowcount": number; "aria-colcount": number; onkeydown: (event: KeyboardEvent) => void; }
cell_attrs(cell: GridCell) => { role: "gridcell"; "aria-rowindex": number; "aria-colindex": number; "aria-disabled": true | undefined; "data-active": string | undefined; tabindex: number | undefined; onfocus: () => void; }

Source: packages/ui/src/behaviors/grid.svelte.ts:41

GridFocusOptions type

type GridFocusOptions = {
    /** Total row count. */
    readonly rows: () => number;
    /** Total column count. */
    readonly cols: () => number;
    /** Controlled active cell; omit for internal state. */
    readonly active?: () => GridCell | null;
    /** Called whenever the active cell moves. */
    readonly on_move?: (cell: GridCell, details: {
        readonly from: GridCell | null;
        readonly shift: boolean;
    }) => void;
    /** Rows skipped by PageUp / PageDown (default `10`). */
    readonly page_size?: number | (() => number);
    /** Skip cells matching this predicate. */
    readonly disabled?: (cell: GridCell) => boolean;
    /** Scroll an unrendered virtualized cell into view before focusing. */
    readonly reveal?: (cell: GridCell) => void;
};

Options for create_grid_focus.

Members

NameTypeDescription
rows() => number

Total row count.

cols() => number

Total column count.

active?() => GridCell | null

Controlled active cell; omit for internal state.

on_move?(cell: GridCell, details: { readonly from: GridCell | null; readonly shift: boolean; }) => void

Called whenever the active cell moves.

page_size?number | (() => number)

Rows skipped by PageUp / PageDown (default 10).

disabled?(cell: GridCell) => boolean

Skip cells matching this predicate.

reveal?(cell: GridCell) => void

Scroll an unrendered virtualized cell into view before focusing.

Source: packages/ui/src/behaviors/grid.svelte.ts:23

HoldInput type

type HoldInput = 'mouse' | 'touch' | 'pen' | 'keyboard';

Input modality that started a hold gesture.

Source: packages/ui/src/behaviors/micro.svelte.ts:196

HoverCardBehavior type

type HoverCardBehavior = ReturnType<typeof create_hover_card>;

Return value of create_hover_card.

Members

NameTypeDescription
openboolean
presentboolean
floating{ readonly x: number; readonly y: number; readonly side: FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: import("./floating.svelte.js").FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Attachment<HTMLElement>; }
set_open(next: boolean) => void
triggerAttachment<HTMLElement>
contentAttachment<HTMLElement>
trigger_attrs() => { "aria-expanded": boolean; onpointerenter: (e: PointerEvent) => void; onpointerleave: (e: PointerEvent) => void; onfocus: () => void; onblur: () => void; }
content_attrs() => { "data-state": "open" | "closed"; style: string; onpointerenter: (e: PointerEvent) => void; onpointerleave: (e: PointerEvent) => void; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:686

HoverCardOptions type

type HoverCardOptions = {
    readonly open?: () => boolean;
    readonly on_open_change?: (open: boolean) => void;
    readonly open_delay?: number;
    readonly close_delay?: number;
    readonly side?: FloatingSide;
    readonly align?: FloatingAlign;
    readonly group?: string;
};

Options for create_hover_card.

Members

NameTypeDescription
open?() => boolean
on_open_change?(open: boolean) => void
open_delay?number
close_delay?number
side?FloatingSide
align?FloatingAlign
group?string

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:675

HoverIntent type

type HoverIntent = ReturnType<typeof create_hover_intent>;

Return value of create_hover_intent.

Members

NameTypeDescription
enter(event?: PointerEvent, isTrigger?: boolean) => void
leave(event?: PointerEvent) => void
clear() => void
open_now() => void
close_now() => void

Source: packages/ui/src/behaviors/hover-intent.svelte.ts:116

HoverIntentOptions type

type HoverIntentOptions = {
    /** Trigger element getter. */
    readonly trigger: () => HTMLElement | null | undefined;
    /** Popup element getter. */
    readonly popup: () => HTMLElement | null | undefined;
    /** Whether the popup is currently open. */
    readonly open: () => boolean;
    /** Opens the popup. */
    readonly on_open: () => void;
    /** Closes the popup. */
    readonly on_close: () => void;
    /** Open delay in ms when cold (default `120`). */
    readonly open_delay?: number | (() => number);
    /** Close delay in ms after leaving the safe corridor (default `80`). */
    readonly close_delay?: number | (() => number);
    /** Shared warm-group key (default `'tooltip'`; pass `null` to opt out). */
    readonly group?: string | null;
    /** Warm window in ms during which sibling hovers open immediately (default `250`). */
    readonly warm_ms?: number;
    /** Allow pointer to travel into popup content without closing (default `true`). */
    readonly hoverable?: boolean | (() => boolean);
};

Options for create_hover_intent.

Members

NameTypeDescription
trigger() => HTMLElement | null | undefined

Trigger element getter.

popup() => HTMLElement | null | undefined

Popup element getter.

open() => boolean

Whether the popup is currently open.

on_open() => void

Opens the popup.

on_close() => void

Closes the popup.

open_delay?number | (() => number)

Open delay in ms when cold (default 120).

close_delay?number | (() => number)

Close delay in ms after leaving the safe corridor (default 80).

group?string | null

Shared warm-group key (default 'tooltip'; pass null to opt out).

warm_ms?number

Warm window in ms during which sibling hovers open immediately (default 250).

hoverable?boolean | (() => boolean)

Allow pointer to travel into popup content without closing (default true).

Source: packages/ui/src/behaviors/hover-intent.svelte.ts:92

HslaColor type

type HslaColor = {
    readonly h: number;
    readonly s: number;
    readonly l: number;
    readonly a: number;
};

HSLA color representation (h in 0..360, s,l in 0..100, a in 0..1).

Members

NameTypeDescription
hnumber
snumber
lnumber
anumber

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:789

HsvaColor type

type HsvaColor = {
    readonly h: number;
    readonly s: number;
    readonly v: number;
    readonly a: number;
};

HSVA color representation (h in 0..360, s,v in 0..100, a in 0..1).

Members

NameTypeDescription
hnumber
snumber
vnumber
anumber

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:797

ImageCropperBehavior type

type ImageCropperBehavior = ReturnType<typeof create_image_cropper>;

Return value of create_image_cropper.

Members

NameTypeDescription
cropCropRect
zoomnumber
rotationnumber
mover{ readonly dragging: boolean; handle: Attachment<HTMLElement>; handle_attrs(): { tabindex: number; 'aria-label': string | undefined; 'data-dragging': string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }
resizer{ readonly dragging: boolean; handle_attrs: (mode: "x" | "y" | "xy", label?: string) => { role: "separator"; tabindex: number; 'aria-label': string | undefined; 'data-dragging': string | undefined; onpointerdown: (down: PointerEvent) => void; onkeydown: (event: KeyboardEvent) => void; }; }
set_crop(next: CropRect) => void
set_zoom(next: number) => void
rotate(deg?: number) => void
pixel_crop(naturalWidth: number, naturalHeight: number) => { x: number; y: number; width: number; height: number; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1104

ImageCropperOptions type

type ImageCropperOptions = {
    readonly default_crop?: CropRect;
    readonly aspect?: () => number | undefined;
    readonly min_size?: number;
    readonly on_change?: (crop: CropRect, meta: {
        readonly zoom: number;
        readonly rotation: number;
    }) => void;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_image_cropper.

Members

NameTypeDescription
default_crop?CropRect
aspect?() => number | undefined
min_size?number
on_change?(crop: CropRect, meta: { readonly zoom: number; readonly rotation: number; }) => void
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1094

InertHandle type

type InertHandle = (() => void) & {
    /** Exempts an additional element (e.g. a popover portaled into `document.body`) while active. */
    readonly keep: (el: HTMLElement) => () => void;
};

Handle returned by inert_outside allowing portaled child popups to stay interactive.

Members

NameTypeDescription
keep(el: HTMLElement) => () => void

Exempts an additional element (e.g. a popover portaled into document.body) while active.

Source: packages/ui/src/behaviors/modal.svelte.ts:95

InlineEdit type

type InlineEdit = ReturnType<typeof create_inline_edit>;

Return value of create_inline_edit.

Members

NameTypeDescription
editingstring | null
draftstring
is_editing(id: string) => boolean
begin(id: string, reason: InlineEditReason, initial?: string, origin?: HTMLElement | null) => void
commit(reason?: InlineEditReason) => boolean
cancel(reason?: InlineEditReason) => void
inputAttachment<HTMLInputElement | HTMLTextAreaElement>
cell_attrs(id: string) => { "data-editing": string | undefined; ondblclick: (event: MouseEvent) => void; onkeydown: (event: KeyboardEvent) => void; }
input_attrs() => { value: string; oninput: (event: Event) => void; onkeydown: (event: KeyboardEvent) => void; onblur: () => void; }

Source: packages/ui/src/behaviors/grid.svelte.ts:387

InlineEditOptions type

type InlineEditOptions = {
    /** Reads the current text for `id` when editing starts. */
    readonly value: (id: string) => string;
    /** Persists the edited text; return `false` to keep editing (e.g. validation error). */
    readonly commit: (id: string, text: string, reason: InlineEditReason) => boolean | void;
    /** Optional disabled predicate per id. */
    readonly disabled?: (id: string) => boolean;
    /** Called when Tab commits so an enclosing grid can advance to the next/previous cell. */
    readonly on_tab?: (id: string, direction: 1 | -1) => void;
};

Options for create_inline_edit.

Members

NameTypeDescription
value(id: string) => string

Reads the current text for id when editing starts.

commit(id: string, text: string, reason: InlineEditReason) => boolean | void

Persists the edited text; return false to keep editing (e.g. validation error).

disabled?(id: string) => boolean

Optional disabled predicate per id.

on_tab?(id: string, direction: 1 | -1) => void

Called when Tab commits so an enclosing grid can advance to the next/previous cell.

Source: packages/ui/src/behaviors/grid.svelte.ts:375

InlineEditReason type

type InlineEditReason = 'edit-key' | 'type' | 'double-click' | 'enter-key' | 'escape-key' | 'focus-out' | 'tab-key' | 'imperative';

Why an inline edit started or finished.

Source: packages/ui/src/behaviors/grid.svelte.ts:364

InputHintKind type

type InputHintKind = 'search' | 'email' | 'tel' | 'url' | 'one-time-code' | 'numeric' | 'decimal' | 'name' | 'username' | 'current-password' | 'new-password' | 'postal-code' | 'message';

Supported semantic input hint presets.

Source: packages/ui/src/behaviors/micro.svelte.ts:435

InputHints type

type InputHints = {
    readonly inputmode?: 'search' | 'email' | 'tel' | 'url' | 'numeric' | 'decimal';
    readonly enterkeyhint?: EnterKeyHint;
    readonly autocomplete?: string;
    readonly autocapitalize?: 'none' | 'sentences' | 'words' | 'characters';
    readonly autocorrect?: 'on' | 'off';
    readonly spellcheck?: boolean;
};

HTML input hint attributes returned by input_hints.

Members

NameTypeDescription
inputmode?'search' | 'email' | 'tel' | 'url' | 'numeric' | 'decimal'
enterkeyhint?EnterKeyHint
autocomplete?string
autocapitalize?'none' | 'sentences' | 'words' | 'characters'
autocorrect?'on' | 'off'
spellcheck?boolean

Source: packages/ui/src/behaviors/micro.svelte.ts:451

InputHistory type

type InputHistory<T = string> = ReturnType<typeof create_input_history<T>>;

Return value of create_input_history.

Members

NameTypeDescription
indexnumber | null
browsingboolean
onkeydown(event: KeyboardEvent) => void
reset() => void

Source: packages/ui/src/behaviors/micro.svelte.ts:22

InputHistoryOptions type

type InputHistoryOptions<T = string> = {
    /** Past entries, oldest first. */
    readonly entries: () => readonly T[];
    /** Reads the current composer value. */
    readonly read: () => T;
    /** Writes a recalled value into the composer; return `false` to cancel navigation. */
    readonly write: (value: T, event: KeyboardEvent) => boolean | void;
    /** Custom edge detector; defaults to first/last line of `<textarea>` or anywhere in `<input>`. */
    readonly at_edge?: (direction: 'up' | 'down', event: KeyboardEvent) => boolean;
};

Options for create_input_history.

Members

NameTypeDescription
entries() => readonly T[]

Past entries, oldest first.

read() => T

Reads the current composer value.

write(value: T, event: KeyboardEvent) => boolean | void

Writes a recalled value into the composer; return false to cancel navigation.

at_edge?(direction: 'up' | 'down', event: KeyboardEvent) => boolean

Custom edge detector; defaults to first/last line of <textarea> or anywhere in <input>.

Source: packages/ui/src/behaviors/micro.svelte.ts:10

InputModality type

type InputModality = 'keyboard' | 'pointer';

Input interaction modality ('keyboard' vs 'pointer').

Source: packages/ui/src/behaviors/platform.svelte.ts:239

LassoBehavior type

type LassoBehavior = ReturnType<typeof create_lasso>;

Return value of create_lasso.

Members

NameTypeDescription
rectLassoRect | null
activeboolean
surfaceAttachment<HTMLElement>
item(key: string) => Attachment<HTMLElement>

Source: packages/ui/src/behaviors/canvas.svelte.ts:435

LassoOptions type

type LassoOptions = {
    /** Called continuously as the marquee rectangle changes with intersecting item keys. */
    readonly on_change: (keys: readonly string[], rect: LassoRect) => void;
    /** Called when the marquee drag finishes. */
    readonly on_commit?: (keys: readonly string[]) => void;
};

Options for create_lasso.

Members

NameTypeDescription
on_change(keys: readonly string[], rect: LassoRect) => void

Called continuously as the marquee rectangle changes with intersecting item keys.

on_commit?(keys: readonly string[]) => void

Called when the marquee drag finishes.

Source: packages/ui/src/behaviors/canvas.svelte.ts:427

LassoRect type

type LassoRect = {
    readonly x: number;
    readonly y: number;
    readonly width: number;
    readonly height: number;
};

Marquee rectangle in container-relative coordinates.

Members

NameTypeDescription
xnumber
ynumber
widthnumber
heightnumber

Source: packages/ui/src/behaviors/canvas.svelte.ts:424

Listbox type

type Listbox<T extends ListboxItem = ListboxItem> = ReturnType<typeof create_listbox<T>>;

Return value of create_listbox.

Members

NameTypeDescription
idstring
querystring
itemsreadonly T[]
activestring
active_idstring | undefined
selectedreadonly string[]
countnumber
is_selected(key: string) => boolean
choose(key: string) => void
toggle(key: string) => void
toggle_all() => void
clear() => void
focus(key: string) => void
highlight(key: string) => void
activate_active() => void
item(key: string) => import("svelte/attachments").Attachment<HTMLElement>
input_attrs(open?: boolean) => { role: "combobox"; "aria-autocomplete": "list"; "aria-expanded": boolean; "aria-controls": string; "aria-activedescendant": string | undefined; onkeydown: (event: KeyboardEvent) => void; }

Spread onto a search/combobox <input> in 'virtual' focus mode (aria-activedescendant, aria-controls, keyboard nav).

list_attrs() => { id: string; role: "listbox"; "aria-multiselectable": true | undefined; onkeydown: (event: KeyboardEvent) => void; }

Spread onto the listbox container (id, role="listbox", aria-multiselectable, keyboard handler).

option_attrs(value: string) => { id: string; role: "option"; "aria-selected": boolean; "aria-disabled": true | undefined; "data-selected": string | undefined; "data-highlighted": string | undefined; tabindex: number | undefined; onfocus: (() => void) | undefined; onpointerdown: ((event: PointerEvent) => void) | undefined; onpointermove: () => void; onclick: (event: MouseEvent) => void; }

Spread onto each option element (id, role="option", aria-selected, data-highlighted, click/hover/focus).

Source: packages/ui/src/behaviors/listbox.svelte.ts:47

ListboxFocusMode type

type ListboxFocusMode = 'dom' | 'virtual';

Focus strategy: 'dom' moves real focus across options; 'virtual' keeps focus in a search input via aria-activedescendant.

Source: packages/ui/src/behaviors/listbox.svelte.ts:18

ListboxItem type

type ListboxItem = {
    readonly value: string;
    readonly label: string;
    readonly keywords?: string;
    readonly disabled?: boolean;
};

One selectable option inside create_listbox.

Members

NameTypeDescription
valuestring
labelstring
keywords?string
disabled?boolean

Source: packages/ui/src/behaviors/listbox.svelte.ts:10

ListboxOptions type

type ListboxOptions<T extends ListboxItem = ListboxItem> = {
    /** All items in visual order. */
    readonly items: () => readonly T[];
    /** Selection mode (default `'single'`). */
    readonly mode?: SelectionMode | (() => SelectionMode);
    /** Focus strategy: `'dom'` (default) or `'virtual'` (`aria-activedescendant`). */
    readonly focus?: ListboxFocusMode;
    /** Controlled selected values; omit for internal state. */
    readonly selected?: () => readonly string[];
    /** Initial selected values when uncontrolled. */
    readonly default_selected?: readonly string[];
    /** Called when selection changes. */
    readonly on_change?: (values: readonly string[]) => void;
    /** Called when an item is explicitly activated (Enter / click in single mode). */
    readonly on_activate?: (item: T) => void;
    /** Optional custom filter; defaults to case-insensitive substring match on label + keywords. Pass `false` for externally filtered/async lists. */
    readonly filter?: false | ((item: T, query: string) => boolean);
    /** Enable incremental typeahead when not typing in a search input (default `true` in `'dom'` mode, `false` in `'virtual'` mode). */
    readonly typeahead?: boolean;
    /** Wrap arrow navigation at list ends (default `true`). */
    readonly loop?: boolean;
    /** Optional stable id prefix for `aria-controls` / `aria-activedescendant`. */
    readonly id?: string;
};

Options for create_listbox.

Members

NameTypeDescription
items() => readonly T[]

All items in visual order.

mode?SelectionMode | (() => SelectionMode)

Selection mode (default 'single').

focus?ListboxFocusMode

Focus strategy: 'dom' (default) or 'virtual' (aria-activedescendant).

selected?() => readonly string[]

Controlled selected values; omit for internal state.

default_selected?readonly string[]

Initial selected values when uncontrolled.

on_change?(values: readonly string[]) => void

Called when selection changes.

on_activate?(item: T) => void

Called when an item is explicitly activated (Enter / click in single mode).

filter?false | ((item: T, query: string) => boolean)

Optional custom filter; defaults to case-insensitive substring match on label + keywords. Pass false for externally filtered/async lists.

typeahead?boolean

Enable incremental typeahead when not typing in a search input (default true in 'dom' mode, false in 'virtual' mode).

loop?boolean

Wrap arrow navigation at list ends (default true).

id?string

Optional stable id prefix for aria-controls / aria-activedescendant.

Source: packages/ui/src/behaviors/listbox.svelte.ts:21

LostFocus type

type LostFocus<T = unknown> = {
    /** Stable key of the removed item. */
    readonly key: string;
    /** Optional caller metadata attached to the item. */
    readonly data: T | undefined;
    /** The removed DOM element. */
    readonly element: HTMLElement;
};

Info about a bound element that left the DOM while holding focus.

Members

NameTypeDescription
keystring

Stable key of the removed item.

dataT | undefined

Optional caller metadata attached to the item.

elementHTMLElement

The removed DOM element.

Source: packages/ui/src/behaviors/focus-recovery.svelte.ts:7

MatchRange type

type MatchRange = {
    readonly start: number;
    readonly end: number;
};

Half-open character range [start, end) inside the original text string.

Members

NameTypeDescription
startnumber
endnumber

Source: packages/ui/src/behaviors/text-match.ts:5

MatchSegment type

type MatchSegment = {
    readonly text: string;
    readonly matched: boolean;
};

One contiguous highlighted or plain text segment produced by match_segments.

Members

NameTypeDescription
textstring
matchedboolean

Source: packages/ui/src/behaviors/text-match.ts:11

MatchShortcutOptions type

type MatchShortcutOptions = {
    /** When `true`, `'mod'` only matches `Meta` on Apple platforms and `Control` elsewhere (default `false`). */
    readonly strict_platform?: boolean;
};

Options for matches_shortcut.

Members

NameTypeDescription
strict_platform?boolean

When true, 'mod' only matches Meta on Apple platforms and Control elsewhere (default false).

Source: packages/ui/src/behaviors/shortcuts.svelte.ts:81

type Menu<T extends MenuItem = MenuItem> = ReturnType<typeof create_menu<T>>;

Return value of create_menu.

Members

NameTypeDescription
openboolean
activestring
floating{ readonly x: number; readonly y: number; readonly side: FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: import("./floating.svelte.js").FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Attachment<HTMLElement>; }
open_at(point: { x: number; y: number; }) => void
open_menu() => void
close() => void
toggle() => void
triggerAttachment<HTMLElement>
contentAttachment<HTMLElement>
context_areaAttachment<HTMLElement>
item(key: string) => Attachment<HTMLElement>
trigger_attrs() => { type: "button"; "aria-haspopup": "menu"; "aria-expanded": boolean; "aria-controls": string | undefined; "data-state": "open" | "closed"; onclick: () => void; onkeydown: (event: KeyboardEvent) => void; }
menu_attrs() => { id: string; role: "menu"; "aria-label": string | undefined; "data-state": "open" | "closed"; "data-side": FloatingSide; style: string; onkeydown: (event: KeyboardEvent) => void; }
item_attrs(id: string) => { role: "menuitem" | "menuitemcheckbox" | "menuitemradio"; "aria-disabled": true | undefined; "aria-checked": boolean | undefined; "data-highlighted": string | undefined; "data-disabled": string | undefined; tabindex: number | undefined; onfocus: () => void; onpointermove: () => void; onclick: (event: MouseEvent) => void; }

Source: packages/ui/src/behaviors/menu.svelte.ts:45

type MenuItem = {
    readonly id: string;
    readonly label: string;
    readonly disabled?: boolean;
    readonly role?: 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
    readonly checked?: boolean;
    readonly on_select?: () => void;
};

One menu item descriptor for create_menu.

Members

NameTypeDescription
idstring
labelstring
disabled?boolean
role?'menuitem' | 'menuitemcheckbox' | 'menuitemradio'
checked?boolean
on_select?() => void

Source: packages/ui/src/behaviors/menu.svelte.ts:13

type MenuOptions<T extends MenuItem = MenuItem> = {
    /** Ordered menu items. */
    readonly items: () => readonly T[];
    /** Controlled open state; omit for internal state. */
    readonly open?: () => boolean;
    /** Called when open state changes. */
    readonly on_open_change?: (open: boolean) => void;
    /** Called when any enabled menu item is activated. */
    readonly on_select?: (item: T) => void;
    /** Close the menu after selecting a regular `menuitem` (default `true`). */
    readonly close_on_select?: boolean;
    /** Preferred side relative to trigger (default `'bottom'`). */
    readonly side?: FloatingSide;
    /** Cross-axis alignment relative to trigger (default `'start'`). */
    readonly align?: FloatingAlign;
    /** Accessible name for the menu. */
    readonly label?: string;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_menu.

Members

NameTypeDescription
items() => readonly T[]

Ordered menu items.

open?() => boolean

Controlled open state; omit for internal state.

on_open_change?(open: boolean) => void

Called when open state changes.

on_select?(item: T) => void

Called when any enabled menu item is activated.

close_on_select?boolean

Close the menu after selecting a regular menuitem (default true).

side?FloatingSide

Preferred side relative to trigger (default 'bottom').

align?FloatingAlign

Cross-axis alignment relative to trigger (default 'start').

label?string

Accessible name for the menu.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/menu.svelte.ts:23

type MenubarBehavior = ReturnType<typeof create_menubar>;

Return value of create_menubar.

Members

NameTypeDescription
open_menustring | null
is_open(id: string) => boolean
open(id: string) => void
close() => void
rootAttachment<HTMLElement>
item(key: string) => Attachment<HTMLElement>
root_attrs() => { role: "menubar"; "aria-label": string; onkeydown: (event: KeyboardEvent) => void; }
trigger_attrs(id: string) => { type: "button"; role: "menuitem"; "aria-haspopup": "menu"; "aria-expanded": boolean; "data-state": "open" | "closed"; tabindex: number | undefined; onfocus: () => void; onclick: () => void; onpointerenter: () => void; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:406

type MenubarOptions = {
    readonly menus: () => readonly string[];
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_menubar.

Members

NameTypeDescription
menus() => readonly string[]
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:399

MoveBehavior type

type MoveBehavior = ReturnType<typeof create_move>;

Return value of create_move.

Members

NameTypeDescription
draggingboolean
handleAttachment<HTMLElement>
handle_attrs() => { tabindex: number; "aria-label": string | undefined; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/canvas.svelte.ts:30

MoveOptions type

type MoveOptions = {
    readonly position: () => MovePoint;
    readonly on_change: (next: MovePoint) => void;
    readonly on_commit?: (final: MovePoint) => void;
    readonly step?: number;
    readonly grid?: number;
    readonly bounds?: () => {
        readonly min_x: number;
        readonly max_x: number;
        readonly min_y: number;
        readonly max_y: number;
    };
    readonly scale?: () => number;
    readonly label?: string;
};

Options for create_move.

Members

NameTypeDescription
position() => MovePoint
on_change(next: MovePoint) => void
on_commit?(final: MovePoint) => void
step?number
grid?number
bounds?() => { readonly min_x: number; readonly max_x: number; readonly min_y: number; readonly max_y: number; }
scale?() => number
label?string

Source: packages/ui/src/behaviors/canvas.svelte.ts:18

MovePoint type

type MovePoint = {
    readonly x: number;
    readonly y: number;
};

2D coordinate point.

Members

NameTypeDescription
xnumber
ynumber

Source: packages/ui/src/behaviors/canvas.svelte.ts:15

type NavigationMenuBehavior = ReturnType<typeof create_navigation_menu>;

Return value of create_navigation_menu.

Members

NameTypeDescription
activestring | null
is_open(id: string) => boolean
open(id: string) => void
close() => void
rootAttachment<HTMLElement>
item(key: string) => Attachment<HTMLElement>
root_attrs() => { "aria-label": string; onpointerleave: () => void; onkeydown: (event: KeyboardEvent) => void; }
trigger_attrs(id: string) => { type: "button"; "aria-expanded": boolean; "data-state": "open" | "closed"; tabindex: number | undefined; onfocus: () => void; onpointerenter: () => void; onclick: () => void; }
content_attrs() => { onpointerenter: () => void; onpointerleave: () => void; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:529

type NavigationMenuOptions = {
    readonly items: () => readonly string[];
    readonly open_delay?: number;
    readonly close_delay?: number;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_navigation_menu.

Members

NameTypeDescription
items() => readonly string[]
open_delay?number
close_delay?number
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:520

NumberInputOptions type

type NumberInputOptions = {
    readonly value?: () => number | null;
    readonly default_value?: number | null;
    readonly on_change?: (value: number | null) => void;
    readonly min?: number;
    readonly max?: number;
    readonly step?: number;
    readonly locale?: string;
    readonly disabled?: () => boolean;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_number_input.

Members

NameTypeDescription
value?() => number | null
default_value?number | null
on_change?(value: number | null) => void
min?number
max?number
step?number
locale?string
disabled?() => boolean
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:261

Overflow type

type Overflow<T> = ReturnType<typeof create_overflow<T>>;

Return value of create_overflow.

Members

NameTypeDescription
fitnumber
visiblereadonly T[]
hiddenreadonly T[]
has_overflowboolean
active_in_hiddenboolean
more_openboolean
listAttachment<HTMLElement>
measureAttachment<HTMLElement>

Source: packages/ui/src/behaviors/overflow.svelte.ts:18

OverflowOptions type

type OverflowOptions<T> = {
    /** All items in display order. */
    items: () => readonly T[];
    /** Key extractor for checking whether the active item is currently inside the overflow menu. */
    key?: (item: T) => string;
    /** Currently active key (optional). */
    active?: () => string | undefined;
};

Options for create_overflow.

Members

NameTypeDescription
items() => readonly T[]

All items in display order.

key?(item: T) => string

Key extractor for checking whether the active item is currently inside the overflow menu.

active?() => string | undefined

Currently active key (optional).

Source: packages/ui/src/behaviors/overflow.svelte.ts:8

OverlayEntry type

type OverlayEntry<Payload, Result = unknown> = {
    readonly id: string;
    readonly payload: Payload;
    readonly resolve: (result: Result | undefined) => void;
};

One entry in an imperative create_overlay_stack.

Members

NameTypeDescription
idstring
payloadPayload
resolve(result: Result | undefined) => void

Source: packages/ui/src/behaviors/platform.svelte.ts:448

PageControlsOptions type

type PageControlsOptions = {
    /** Only return controls whose `element()` sits inside this container. */
    readonly within?: Element | null;
    /** Optional substring filter over id, kind, or label. */
    readonly query?: string;
    /** Maximum number of controls to return. */
    readonly limit?: number;
};

Options for filtering page_controls.

Members

NameTypeDescription
within?Element | null

Only return controls whose element() sits inside this container.

query?string

Optional substring filter over id, kind, or label.

limit?number

Maximum number of controls to return.

Source: packages/ui/src/behaviors/controls.svelte.ts:55

Pagination type

type Pagination = ReturnType<typeof create_pagination>;

Return value of create_pagination.

Members

NameTypeDescription
pagenumber
pagesnumber | null
has_previousboolean
has_nextboolean
rangePaginationEntry[]
go(target: number) => void
previous() => void
next() => void
first() => void
last() => void

Source: packages/ui/src/behaviors/pagination.svelte.ts:29

PaginationEntry type

type PaginationEntry = number | 'ellipsis';

One entry in a compact pagination window: a 1-based page number or 'ellipsis'.

Source: packages/ui/src/behaviors/pagination.svelte.ts:6

PaginationOptions type

type PaginationOptions = {
    /** Current 1-based page number (controlled getter, or omit for internal state). */
    page?: () => number;
    /** Initial 1-based page when uncontrolled (default `1`). */
    default_page?: number;
    /** Total page count (`null` when unknown / keyset-paged). */
    total_pages: () => number | null;
    /** Explicit previous availability override (for cursor/keyset pagination). */
    has_previous?: () => boolean;
    /** Explicit next availability override (for cursor/keyset pagination). */
    has_next?: () => boolean;
    /** Called when the page changes. */
    on_page_change?: (page: number) => void;
    /** Sibling pages shown on each side of the current page in `range` (default `1`). */
    siblings?: number;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    control?: {
        id: string;
        label?: string;
    };
};

Options for create_pagination.

Members

NameTypeDescription
page?() => number

Current 1-based page number (controlled getter, or omit for internal state).

default_page?number

Initial 1-based page when uncontrolled (default 1).

total_pages() => number | null

Total page count (null when unknown / keyset-paged).

has_previous?() => boolean

Explicit previous availability override (for cursor/keyset pagination).

has_next?() => boolean

Explicit next availability override (for cursor/keyset pagination).

on_page_change?(page: number) => void

Called when the page changes.

siblings?number

Sibling pages shown on each side of the current page in range (default 1).

control?{ id: string; label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/pagination.svelte.ts:9

PanelGroup type

type PanelGroup = ReturnType<typeof create_panel_group>;

Return value of create_panel_group.

Members

NameTypeDescription
sizesreadonly number[]
draggingnumber | null
size_of(index: number) => number
reset() => void
containerAttachment<HTMLElement>
handle(handleIndex: number) => Attachment<HTMLElement>
handle_attrs(handleIndex: number) => { role: "separator"; tabindex: number; "aria-orientation": "horizontal" | "vertical"; "aria-valuenow": number; "aria-valuemin": number; "aria-valuemax": number; "data-dragging": string | undefined; ondblclick: () => void; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:42

PanelGroupOptions type

type PanelGroupOptions = {
    readonly panels: readonly PanelSpec[];
    readonly direction?: 'horizontal' | 'vertical';
    readonly storage_key?: string;
    readonly on_layout?: (sizes: readonly number[]) => void;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_panel_group.

Members

NameTypeDescription
panelsreadonly PanelSpec[]
direction?'horizontal' | 'vertical'
storage_key?string
on_layout?(sizes: readonly number[]) => void
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:33

PanelSpec type

type PanelSpec = {
    readonly id: string;
    readonly default_size: number;
    readonly min_size?: number;
    readonly max_size?: number;
    readonly collapsible?: boolean;
};

Configuration for one pane inside create_panel_group.

Members

NameTypeDescription
idstring
default_sizenumber
min_size?number
max_size?number
collapsible?boolean

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:24

PasswordInput type

type PasswordInput = ReturnType<typeof create_password_input>;

Return value of create_password_input.

Members

NameTypeDescription
visibleboolean
caps_lockboolean
toggle() => void
set_visible(next: boolean) => void
inputAttachment<HTMLInputElement>
input_attrs() => { type: "text" | "password"; "data-agent-secret": string; "aria-label": string | undefined; onkeydown: (event: KeyboardEvent) => void; onkeyup: (event: KeyboardEvent) => void; }
toggle_attrs() => { type: "button"; "aria-pressed": boolean; "aria-label": string; onclick: () => void; }

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:882

PasswordInputOptions type

type PasswordInputOptions = {
    /** Initial visibility (default `false`). */
    readonly default_visible?: boolean;
    /** Accessible label for the password input. */
    readonly label?: string;
    /** Optional semantic control registration (always marked `secret: true`). */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_password_input.

Members

NameTypeDescription
default_visible?boolean

Initial visibility (default false).

label?string

Accessible label for the password input.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration (always marked secret: true).

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:872

PatternViolation type

type PatternViolation = {
    readonly rule: string;
    readonly message: string;
    readonly element?: Element;
};

One contract violation detected by check_pattern or check_direction.

Members

NameTypeDescription
rulestring
messagestring
element?Element

Source: packages/ui/src/behaviors/testing.ts:21

PersistedState class

class PersistedState<T> {
    #private;
    constructor(key: string, initialValue: T, options?: PersistedStateOptions<T>);
    /** Current persisted value. */
    get current(): T;
    set current(value: T);
}

Reactive state synchronized with localStorage or sessionStorage with safe fallback when storage is unavailable or contains malformed JSON.

Members

NameTypeDescription
#privateany
currentT

Current persisted value.

Source: packages/ui/src/behaviors/reactive.svelte.ts:213

PersistedStateOptions type

type PersistedStateOptions<T> = {
    /** Browser storage backend (`'local'` default, or `'session'`). */
    readonly storage?: 'local' | 'session';
    /** Custom serializer; defaults to JSON. */
    readonly serializer?: {
        readonly serialize: (value: T) => string;
        readonly deserialize: (raw: string) => T;
    };
};

Storage options for PersistedState.

Members

NameTypeDescription
storage?'local' | 'session'

Browser storage backend ('local' default, or 'session').

serializer?{ readonly serialize: (value: T) => string; readonly deserialize: (raw: string) => T; }

Custom serializer; defaults to JSON.

Source: packages/ui/src/behaviors/reactive.svelte.ts:195

PinCell type

type PinCell = {
    /** Zero-based index of this cell. */
    readonly index: number;
    /** Character currently in this cell, or `null` when empty. */
    readonly char: string | null;
    /** Whether this cell holds the active caret position. */
    readonly is_active: boolean;
    /** Whether to draw a blinking caret inside this empty active cell. */
    readonly has_fake_caret: boolean;
};

One visual cell of a PIN / OTP code.

Members

NameTypeDescription
indexnumber

Zero-based index of this cell.

charstring | null

Character currently in this cell, or null when empty.

is_activeboolean

Whether this cell holds the active caret position.

has_fake_caretboolean

Whether to draw a blinking caret inside this empty active cell.

Source: packages/ui/src/behaviors/pin.svelte.ts:6

PinInputBehavior type

type PinInputBehavior = ReturnType<typeof create_pin_input>;

Return value of create_pin_input.

Members

NameTypeDescription
valuestring
cellsreadonly PinCell[]
focusedboolean
set_value(raw: string) => void
input_attrs() => { value: string; maxlength: number; disabled: true | undefined; onfocus: (event: FocusEvent) => void; onblur: () => void; oninput: (event: Event) => void; onkeyup: (event: KeyboardEvent) => void; onselect: (event: Event) => void; }

Spread onto the underlying <input> element that owns focus, typing, paste and autofill.

Source: packages/ui/src/behaviors/pin.svelte.ts:43

PinInputOptions type

type PinInputOptions = {
    /** Number of cells (e.g. `6`). */
    readonly length: number | (() => number);
    /** Controlled value getter; omit for internal state. */
    readonly value?: () => string;
    /** Initial value when uncontrolled. */
    readonly default_value?: string;
    /** Called whenever the sanitized value changes. */
    readonly on_value_change?: (value: string) => void;
    /** Called when the value reaches `length` characters. */
    readonly on_complete?: (value: string) => void;
    /** Allowed character filter regex (default digits only `/^\d+$/`). */
    readonly pattern?: RegExp;
    /** Disabled state. */
    readonly disabled?: () => boolean;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
        readonly secret?: boolean;
        readonly element?: () => HTMLElement | null;
    };
};

Options for create_pin_input.

Members

NameTypeDescription
lengthnumber | (() => number)

Number of cells (e.g. 6).

value?() => string

Controlled value getter; omit for internal state.

default_value?string

Initial value when uncontrolled.

on_value_change?(value: string) => void

Called whenever the sanitized value changes.

on_complete?(value: string) => void

Called when the value reaches length characters.

pattern?RegExp

Allowed character filter regex (default digits only /^\d+$/).

disabled?() => boolean

Disabled state.

control?{ readonly id: string; readonly label?: string; readonly secret?: boolean; readonly element?: () => HTMLElement | null; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/pin.svelte.ts:18

PointerKindState type

type PointerKindState = {
    readonly precision: PointerPrecision;
    readonly hover: boolean;
};

Current device pointer capabilities.

Members

NameTypeDescription
precisionPointerPrecision
hoverboolean

Source: packages/ui/src/behaviors/platform.svelte.ts:104

PointerPrecision type

type PointerPrecision = 'coarse' | 'fine';

Primary pointer precision ('coarse' touch vs 'fine' mouse/trackpad).

Source: packages/ui/src/behaviors/platform.svelte.ts:101

PointerSample type

type PointerSample = {
    readonly x: number;
    readonly y: number;
    readonly start_x: number;
    readonly start_y: number;
    readonly dx: number;
    readonly dy: number;
    readonly event: PointerEvent;
};

Live pointer position and delta reported by bind_drag.

Members

NameTypeDescription
xnumber
ynumber
start_xnumber
start_ynumber
dxnumber
dynumber
eventPointerEvent

Source: packages/ui/src/behaviors/drag.svelte.ts:10

PortalOptions type

type PortalOptions = {
    /** Mount element, CSS selector, or `null` to render in place. */
    readonly to?: PortalTarget;
    /** When `true`, keeps the element in place instead of teleporting it. */
    readonly disabled?: boolean;
};

Options object accepted by portal(...).

Members

NameTypeDescription
to?PortalTarget

Mount element, CSS selector, or null to render in place.

disabled?boolean

When true, keeps the element in place instead of teleporting it.

Source: packages/ui/src/behaviors/portal.svelte.ts:13

PortalTarget type

type PortalTarget = HTMLElement | string | null | undefined;

Target element, CSS selector or null to disable teleporting and render in place.

Source: packages/ui/src/behaviors/portal.svelte.ts:10

Presence type

type Presence = ReturnType<typeof create_presence>;

Return value of create_presence.

Members

NameTypeDescription
presentboolean
statePresenceState
exitingboolean
attachAttachment<HTMLElement>

Source: packages/ui/src/behaviors/presence.svelte.ts:18

PresenceOptions type

type PresenceOptions = {
    /** Reactive open getter. */
    readonly open: () => boolean;
    /** Called once enter or exit settles. */
    readonly on_complete?: (open: boolean) => void;
};

Options for create_presence.

Members

NameTypeDescription
open() => boolean

Reactive open getter.

on_complete?(open: boolean) => void

Called once enter or exit settles.

Source: packages/ui/src/behaviors/presence.svelte.ts:10

PresenceState type

type PresenceState = 'entering' | 'open' | 'exiting' | 'closed';

Lifecycle phase of a presence-managed element.

Source: packages/ui/src/behaviors/presence.svelte.ts:7

PreviewOptions type

type PreviewOptions<T> = {
    /** Committed authoritative value. */
    readonly value: () => T;
    /** Called when a preview is explicitly committed. */
    readonly on_commit: (value: T) => void;
};

Options for create_preview.

Members

NameTypeDescription
value() => T

Committed authoritative value.

on_commit(value: T) => void

Called when a preview is explicitly committed.

Source: packages/ui/src/behaviors/platform.svelte.ts:325

PreviewState type

type PreviewState<T> = ReturnType<typeof create_preview<T>>;

Return value of create_preview.

Members

NameTypeDescription
currentT
previewingboolean
update(next: T) => void
commit(finalValue?: T) => void
cancel() => void

Source: packages/ui/src/behaviors/platform.svelte.ts:333

RadioGroupOptions type

type RadioGroupOptions = {
    readonly items: () => readonly string[];
    readonly value?: () => string | undefined;
    readonly default_value?: string;
    readonly on_change?: (value: string) => void;
    readonly orientation?: RovingOrientation;
    readonly disabled?: (value: string) => boolean;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_radio_group.

Members

NameTypeDescription
items() => readonly string[]
value?() => string | undefined
default_value?string
on_change?(value: string) => void
orientation?RovingOrientation
disabled?(value: string) => boolean
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:86

RatingOptions type

type RatingOptions = {
    readonly max?: number;
    readonly value?: () => number;
    readonly default_value?: number;
    readonly on_change?: (value: number) => void;
    readonly disabled?: () => boolean;
    readonly label?: string;
};

Options for create_rating.

Members

NameTypeDescription
max?number
value?() => number
default_value?number
on_change?(value: number) => void
disabled?() => boolean
label?string

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:414

RejectedFile type

type RejectedFile = {
    readonly file: File;
    readonly reason: 'type' | 'size' | 'count';
};

One rejected file from create_file_dropzone validation.

Members

NameTypeDescription
fileFile
reason'type' | 'size' | 'count'

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:720

Reorder type

type Reorder = ReturnType<typeof create_reorder>;

Return value of create_reorder.

Members

NameTypeDescription
draggingstring | null
overstring | null
move(fromIndex: number, toIndex: number) => void
move_by(key: string, delta: number) => void
item(key: string) => Attachment<HTMLElement>

Optional pointer-capture drag attachment (works cleanly on touch & supports edge auto-scroll + Escape cancel).

item_attrs(key: string) => { draggable: boolean; "data-dragging": string | undefined; "data-drop-target": string | undefined; ondragstart: (event: DragEvent) => void; ondragover: (event: DragEvent) => void; ondragleave: () => void; ondrop: (event: DragEvent) => void; ondragend: () => void; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/reorder.svelte.ts:26

ReorderOptions type

type ReorderOptions = {
    /** Ordered item keys. */
    readonly items: () => readonly string[];
    /** Invoked with `(fromIndex, toIndex, nextOrder)` when an item moves. */
    readonly on_reorder: (from: number, to: number, next: readonly string[]) => void;
    /** Axis for movement (default `'vertical'`). */
    readonly orientation?: ReorderOrientation;
    /** Disable reordering globally or for a specific key. */
    readonly disabled?: boolean | ((key: string) => boolean);
    /** Optional human-readable label per key for live announcements. */
    readonly label?: (key: string) => string;
};

Options for create_reorder.

Members

NameTypeDescription
items() => readonly string[]

Ordered item keys.

on_reorder(from: number, to: number, next: readonly string[]) => void

Invoked with (fromIndex, toIndex, nextOrder) when an item moves.

orientation?ReorderOrientation

Axis for movement (default 'vertical').

disabled?boolean | ((key: string) => boolean)

Disable reordering globally or for a specific key.

label?(key: string) => string

Optional human-readable label per key for live announcements.

Source: packages/ui/src/behaviors/reorder.svelte.ts:12

ReorderOrientation type

type ReorderOrientation = 'vertical' | 'horizontal';

Axis for keyboard and pointer reordering ('vertical' or 'horizontal').

Source: packages/ui/src/behaviors/reorder.svelte.ts:9

Resize type

type Resize = ReturnType<typeof create_resize>;

Return value of create_resize.

Members

NameTypeDescription
draggingboolean
handle_attrs() => { role: "separator"; "aria-orientation": "horizontal" | "vertical"; "aria-label": string | undefined; "aria-valuenow": number; "aria-valuemin": number; "aria-valuemax": number | undefined; tabindex: number; "data-dragging": string | undefined; onpointerdown: (event: PointerEvent) => void; onkeydown: (event: KeyboardEvent) => void; }

Spread onto the resize handle element (role="separator", aria-value*, pointer & keyboard handlers).

Source: packages/ui/src/behaviors/resize.svelte.ts:36

ResizeAxis type

type ResizeAxis = 'horizontal' | 'vertical' | 'both';

Axis of pointer/keyboard resizing ('horizontal', 'vertical', or 2D 'both').

Source: packages/ui/src/behaviors/resize.svelte.ts:6

ResizeBox type

type ResizeBox = {
    readonly width: number;
    readonly height: number;
};

2D dimensions used when axis === 'both' or via create_resize_2d.

Members

NameTypeDescription
widthnumber
heightnumber

Source: packages/ui/src/behaviors/resize.svelte.ts:9

ResizeBoxOptions type

type ResizeBoxOptions = {
    readonly size: () => ResizeBox;
    readonly on_change: (next: ResizeBox) => void;
    readonly on_commit?: (final: ResizeBox) => void;
    readonly min_width?: number;
    readonly max_width?: number;
    readonly min_height?: number;
    readonly max_height?: number;
    readonly scale?: () => number;
    readonly step?: number;
};

Options for 2D create_resize_box (edge & corner handles for preview frames, cards, canvases).

Members

NameTypeDescription
size() => ResizeBox
on_change(next: ResizeBox) => void
on_commit?(final: ResizeBox) => void
min_width?number
max_width?number
min_height?number
max_height?number
scale?() => number
step?number

Source: packages/ui/src/behaviors/resize.svelte.ts:147

ResizeOptions type

type ResizeOptions = {
    /** Current size in pixels (reactive getter). */
    readonly value: () => number;
    /** Called with the clamped pixel size during drag and keyboard nudges. */
    readonly on_change: (next: number) => void;
    /** Called once when a pointer drag finishes. */
    readonly on_commit?: (final: number) => void;
    /** Axis of drag movement (default `'horizontal'`). */
    readonly axis?: 'horizontal' | 'vertical';
    /** Invert drag delta (e.g. dragging a right-docked sheet's left edge leftward widens it). */
    readonly invert?: boolean;
    /** Minimum size in pixels (default `120`). */
    readonly min?: number | (() => number);
    /** Maximum size in pixels (default `Infinity`). */
    readonly max?: number | (() => number);
    /** Optional zoom divisor for scaled canvases/preview frames (default `1`). */
    readonly scale?: number | (() => number);
    /** Keyboard Arrow nudge increment in pixels (default `24`). */
    readonly step?: number;
    /** Accessible label for the separator handle. */
    readonly label?: string;
};

Options for create_resize.

Members

NameTypeDescription
value() => number

Current size in pixels (reactive getter).

on_change(next: number) => void

Called with the clamped pixel size during drag and keyboard nudges.

on_commit?(final: number) => void

Called once when a pointer drag finishes.

axis?'horizontal' | 'vertical'

Axis of drag movement (default 'horizontal').

invert?boolean

Invert drag delta (e.g. dragging a right-docked sheet's left edge leftward widens it).

min?number | (() => number)

Minimum size in pixels (default 120).

max?number | (() => number)

Maximum size in pixels (default Infinity).

scale?number | (() => number)

Optional zoom divisor for scaled canvases/preview frames (default 1).

step?number

Keyboard Arrow nudge increment in pixels (default 24).

label?string

Accessible label for the separator handle.

Source: packages/ui/src/behaviors/resize.svelte.ts:12

ResolvedColorScheme type

type ResolvedColorScheme = 'light' | 'dark';

Resolved concrete color scheme.

Source: packages/ui/src/behaviors/platform.svelte.ts:156

RgbaColor type

type RgbaColor = {
    readonly r: number;
    readonly g: number;
    readonly b: number;
    readonly a: number;
};

RGBA color representation with channels r,g,b in 0..255 and alpha a in 0..1.

Members

NameTypeDescription
rnumber
gnumber
bnumber
anumber

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:781

RovingFocus type

type RovingFocus = ReturnType<typeof create_roving_focus>;

Return value of create_roving_focus.

Members

NameTypeDescription
activestring
focus(key: string) => void
next() => void
prev() => void
item(key: string) => Attachment<HTMLElement>

Attach to each focusable item for arrow focus & unmount focus recovery.

root_attrs() => { onkeydown: (event: KeyboardEvent) => void; }

Spread onto the container element to handle arrow/Home/End keyboard navigation.

item_attrs(key: string) => { tabindex: number | undefined; "data-roving-active": string | undefined; onfocus: () => void; }

Spread onto each item for roving tabindex, focus syncing and data-roving-active state.

Source: packages/ui/src/behaviors/roving-focus.svelte.ts:29

RovingFocusOptions type

type RovingFocusOptions = {
    /** Keys in navigation order. */
    readonly items: () => readonly string[];
    /** Controlled active key; omit for internal focus tracking. */
    readonly active?: () => string | undefined;
    /** Called when keyboard navigation moves focus to a key. */
    readonly on_active_change?: (key: string) => void;
    /** Axis of arrow navigation (default `'horizontal'`). */
    readonly orientation?: RovingOrientation | (() => RovingOrientation);
    /** Wrap from last back to first and vice versa (default `true`). */
    readonly loop?: boolean;
    /** Skip disabled keys during keyboard movement. */
    readonly disabled?: (key: string) => boolean;
    /** Optional callback invoked when Space or Enter activates the focused item. */
    readonly on_activate?: (key: string) => void;
};

Options for create_roving_focus.

Members

NameTypeDescription
items() => readonly string[]

Keys in navigation order.

active?() => string | undefined

Controlled active key; omit for internal focus tracking.

on_active_change?(key: string) => void

Called when keyboard navigation moves focus to a key.

orientation?RovingOrientation | (() => RovingOrientation)

Axis of arrow navigation (default 'horizontal').

loop?boolean

Wrap from last back to first and vice versa (default true).

disabled?(key: string) => boolean

Skip disabled keys during keyboard movement.

on_activate?(key: string) => void

Optional callback invoked when Space or Enter activates the focused item.

Source: packages/ui/src/behaviors/roving-focus.svelte.ts:11

RovingOrientation type

type RovingOrientation = 'horizontal' | 'vertical' | 'both';

Arrow-key navigation axis ('horizontal', 'vertical', or 'both').

Source: packages/ui/src/behaviors/roving-focus.svelte.ts:8

ScrollPickerOptions type

type ScrollPickerOptions = {
    /** Called when the centered option changes after scrolling settles. */
    readonly on_select: (index: number) => void;
    /** Scroll axis (default `'vertical'`). */
    readonly orientation?: 'vertical' | 'horizontal';
};

Options for bind_scroll_picker.

Members

NameTypeDescription
on_select(index: number) => void

Called when the centered option changes after scrolling settles.

orientation?'vertical' | 'horizontal'

Scroll axis (default 'vertical').

Source: packages/ui/src/behaviors/canvas.svelte.ts:835

SegmentPart type

type SegmentPart = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'literal';

Editable or literal segment kind inside a segmented date or time field.

Source: packages/ui/src/behaviors/date-time.svelte.ts:25

Selection type

type Selection = ReturnType<typeof create_selection>;

Return value of create_selection.

Members

NameTypeDescription
selectedreadonly string[]
countnumber
all_selectedboolean
some_selectedboolean
is_selected(key: string) => boolean
choose(key: string) => void
toggle(key: string) => void
extend(to: string, opts?: { from?: string | null; additive?: boolean; }) => void
toggle_all() => void
clear() => void
item_attrs(key: string) => { "aria-selected": boolean; "data-selected": string | undefined; "aria-disabled": true | undefined; onclick: (event: MouseEvent) => void; }

Spread onto each selectable item for aria-selected, data-selected and click/Shift/Cmd handling.

Source: packages/ui/src/behaviors/selection.svelte.ts:24

SelectionMode type

type SelectionMode = 'single' | 'multiple';

Single or multiple item selection mode.

Source: packages/ui/src/behaviors/selection.svelte.ts:5

SelectionOptions type

type SelectionOptions = {
    /** Keys in visual order (used for Shift ranges and select-all). */
    order: () => readonly string[];
    /** Single or multiple selection (default `'single'`). */
    mode?: SelectionMode | (() => SelectionMode);
    /** Controlled selected keys; omit for internal state. */
    selected?: () => readonly string[];
    /** Initial selected keys when uncontrolled. */
    default_selected?: readonly string[];
    /** Called with the next selection whenever it changes. */
    on_change?: (keys: readonly string[]) => void;
    /** Whether a key may be selected (default every key). */
    selectable?: (key: string) => boolean;
};

Options for create_selection.

Members

NameTypeDescription
order() => readonly string[]

Keys in visual order (used for Shift ranges and select-all).

mode?SelectionMode | (() => SelectionMode)

Single or multiple selection (default 'single').

selected?() => readonly string[]

Controlled selected keys; omit for internal state.

default_selected?readonly string[]

Initial selected keys when uncontrolled.

on_change?(keys: readonly string[]) => void

Called with the next selection whenever it changes.

selectable?(key: string) => boolean

Whether a key may be selected (default every key).

Source: packages/ui/src/behaviors/selection.svelte.ts:8

ShortcutBinding type

type ShortcutBinding = {
    /** Shortcut spec such as `'mod+k'`, `'escape'`, `'shift+alt+p'`, `'/'`, or chord `'g i'`. */
    readonly keys: string;
    /** Handler invoked when matched. */
    readonly handler: (event: KeyboardEvent) => void;
    /** Allow firing while focus is inside an input, textarea, select or contenteditable (default `false`). */
    readonly allow_in_input?: boolean;
    /** Call `event.preventDefault()` on match (default `true`). */
    readonly prevent_default?: boolean;
    /** Temporarily disable this shortcut. */
    readonly enabled?: boolean | (() => boolean);
};

One declarative keyboard shortcut binding for create_shortcuts.

Members

NameTypeDescription
keysstring

Shortcut spec such as 'mod+k', 'escape', 'shift+alt+p', '/', or chord 'g i'.

handler(event: KeyboardEvent) => void

Handler invoked when matched.

allow_in_input?boolean

Allow firing while focus is inside an input, textarea, select or contenteditable (default false).

prevent_default?boolean

Call event.preventDefault() on match (default true).

enabled?boolean | (() => boolean)

Temporarily disable this shortcut.

Source: packages/ui/src/behaviors/shortcuts.svelte.ts:6

Slider type

type Slider = ReturnType<typeof create_slider>;

Return value of create_slider.

Members

NameTypeDescription
valuenumber
valuesreadonly number[]
percentnumber
percentsnumber[]
draggingboolean
active_thumbnumber
set(next: number, index?: number) => void
trackAttachment<HTMLElement>
thumb_attrs(index?: number) => { role: "slider"; "aria-orientation": "horizontal" | "vertical"; "aria-label": string | undefined; "aria-valuemin": number; "aria-valuemax": number; "aria-valuenow": number; "aria-disabled": true | undefined; tabindex: number | undefined; "data-dragging": string | undefined; onfocus: () => void; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/slider.svelte.ts:42

SliderOptions type

type SliderOptions = {
    /** Controlled numeric value (single-thumb mode); omit for internal state. */
    readonly value?: () => number;
    /** Initial value when uncontrolled (default `min`). */
    readonly default_value?: number;
    /** Called when the quantized value changes (single-thumb mode). */
    readonly on_change?: (value: number) => void;
    /** Called once when a drag or key adjustment settles (single-thumb mode). */
    readonly on_commit?: (value: number) => void;
    /** Controlled multi-thumb values (range slider mode). */
    readonly values?: () => readonly number[];
    /** Initial multi-thumb values when uncontrolled. */
    readonly default_values?: readonly number[];
    /** Called when multi-thumb values change. */
    readonly on_values_change?: (values: readonly number[]) => void;
    /** Called once when a multi-thumb drag or key adjustment settles. */
    readonly on_values_commit?: (values: readonly number[]) => void;
    /** Minimum value (default `0`). */
    readonly min?: number | (() => number);
    /** Maximum value (default `100`). */
    readonly max?: number | (() => number);
    /** Step increment (default `1`). */
    readonly step?: number | (() => number);
    /** Orientation (`'horizontal'` default, or `'vertical'`). */
    readonly orientation?: 'horizontal' | 'vertical';
    /** Disabled state. */
    readonly disabled?: () => boolean;
    /** Accessible label. */
    readonly label?: string;
    /** Optional semantic contr…

Options for create_slider.

Members

NameTypeDescription
value?() => number

Controlled numeric value (single-thumb mode); omit for internal state.

default_value?number

Initial value when uncontrolled (default min).

on_change?(value: number) => void

Called when the quantized value changes (single-thumb mode).

on_commit?(value: number) => void

Called once when a drag or key adjustment settles (single-thumb mode).

values?() => readonly number[]

Controlled multi-thumb values (range slider mode).

default_values?readonly number[]

Initial multi-thumb values when uncontrolled.

on_values_change?(values: readonly number[]) => void

Called when multi-thumb values change.

on_values_commit?(values: readonly number[]) => void

Called once when a multi-thumb drag or key adjustment settles.

min?number | (() => number)

Minimum value (default 0).

max?number | (() => number)

Maximum value (default 100).

step?number | (() => number)

Step increment (default 1).

orientation?'horizontal' | 'vertical'

Orientation ('horizontal' default, or 'vertical').

disabled?() => boolean

Disabled state.

label?string

Accessible label.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/slider.svelte.ts:8

Span type

type Span = {
    readonly id: string;
    readonly track: string;
    readonly start: number;
    readonly end: number;
};

A range placed on a named track (calendar event, Gantt bar, room booking).

Members

NameTypeDescription
idstring
trackstring
startnumber
endnumber

Source: packages/ui/src/behaviors/canvas.svelte.ts:263

SpansBehavior type

type SpansBehavior<S extends Span = Span> = ReturnType<typeof create_spans<S>>;

Return value of create_spans.

Members

NameTypeDescription
spansreadonly S[]
activestring | null
update_span(id: string, patch: Partial<Pick<Span, "track" | "start" | "end">>, action: "move" | "resize", commitNow?: boolean) => void
create(track: string, start: number, end: number) => void
remove(id: string) => void
cancel() => void
span_attrs(span: S) => { tabindex: number; 'data-span-id': string; 'data-dragging': string | undefined; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/canvas.svelte.ts:318

SpansOptions type

type SpansOptions<S extends Span = Span> = {
    readonly tracks: () => readonly string[];
    readonly spans: () => readonly S[];
    readonly min: number;
    readonly max: number;
    readonly step?: number;
    readonly min_duration?: number;
    readonly on_commit: (next: readonly S[], action: 'draw' | 'move' | 'resize' | 'delete', id: string) => void;
    readonly create_span?: (draft: Span) => S;
};

Options for create_spans.

Members

NameTypeDescription
tracks() => readonly string[]
spans() => readonly S[]
minnumber
maxnumber
step?number
min_duration?number
on_commit(next: readonly S[], action: 'draw' | 'move' | 'resize' | 'delete', id: string) => void
create_span?(draft: Span) => S

Source: packages/ui/src/behaviors/canvas.svelte.ts:306

SpatialDirection type

type SpatialDirection = 'up' | 'down' | 'left' | 'right';

Cardinal direction for nearest_in_direction / spatial_move.

Source: packages/ui/src/behaviors/micro.svelte.ts:493

SpatialRect type

type SpatialRect = {
    readonly left: number;
    readonly top: number;
    readonly width: number;
    readonly height: number;
};

Bounding box used by geometric spatial navigation.

Members

NameTypeDescription
leftnumber
topnumber
widthnumber
heightnumber

Source: packages/ui/src/behaviors/micro.svelte.ts:485

SpringState type

type SpringState = {
    readonly position: number;
    readonly velocity: number;
    readonly settled: boolean;
};

Spring state for one-dimensional spring integration.

Members

NameTypeDescription
positionnumber
velocitynumber
settledboolean

Source: packages/ui/src/behaviors/motion.svelte.ts:69

StickToBottom type

type StickToBottom = ReturnType<typeof create_stick_to_bottom>;

Return value of create_stick_to_bottom.

Members

NameTypeDescription
stuckboolean
scroll_to_bottom(behavior?: ScrollBehavior) => void
viewportAttachment<HTMLElement>

Source: packages/ui/src/behaviors/stick-to-bottom.svelte.ts:15

StickToBottomOptions type

type StickToBottomOptions = {
    /** Pixel distance from the bottom edge still considered latched (default `32`). */
    threshold?: number;
    /** Start latched to the bottom (default `true`). */
    initial?: boolean;
};

Options for create_stick_to_bottom.

Members

NameTypeDescription
threshold?number

Pixel distance from the bottom edge still considered latched (default 32).

initial?boolean

Start latched to the bottom (default true).

Source: packages/ui/src/behaviors/stick-to-bottom.svelte.ts:7

SwipeActions type

type SwipeActions = ReturnType<typeof create_swipe_actions>;

Return value of create_swipe_actions.

Members

NameTypeDescription
openSwipeOpen | null
offset{ readonly key: string; readonly x: number; } | null
close() => void
row(key: string) => Attachment<HTMLElement>
row_attrs(key: string) => { 'data-swipe-open': SwipeSide | undefined; style: string; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/canvas.svelte.ts:741

SwipeActionsOptions type

type SwipeActionsOptions = {
    /** Width in px of revealed action tray (default `120`). */
    readonly tray_width?: number;
    /** Fraction of tray width needed to snap open (default `0.5`). */
    readonly open_ratio?: number;
    /** Distance in px triggering immediate full-swipe action (default `220`). */
    readonly full_swipe_px?: number;
    /** Optional full-swipe callback (e.g. archive/delete). */
    readonly on_full_swipe?: (key: string, side: SwipeSide) => void;
};

Options for create_swipe_actions.

Members

NameTypeDescription
tray_width?number

Width in px of revealed action tray (default 120).

open_ratio?number

Fraction of tray width needed to snap open (default 0.5).

full_swipe_px?number

Distance in px triggering immediate full-swipe action (default 220).

on_full_swipe?(key: string, side: SwipeSide) => void

Optional full-swipe callback (e.g. archive/delete).

Source: packages/ui/src/behaviors/canvas.svelte.ts:729

SwipeOpen type

type SwipeOpen = {
    readonly key: string;
    readonly side: SwipeSide;
};

Currently revealed swipe row.

Members

NameTypeDescription
keystring
sideSwipeSide

Source: packages/ui/src/behaviors/canvas.svelte.ts:726

SwipeSide type

type SwipeSide = 'start' | 'end';

Side on which row swipe actions sit.

Source: packages/ui/src/behaviors/canvas.svelte.ts:723

SwitchOptions type

type SwitchOptions = {
    readonly checked?: () => boolean;
    readonly default_checked?: boolean;
    readonly on_change?: (checked: boolean) => void;
    readonly disabled?: () => boolean;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_switch.

Members

NameTypeDescription
checked?() => boolean
default_checked?boolean
on_change?(checked: boolean) => void
disabled?() => boolean
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:13

TimeFieldBehavior type

type TimeFieldBehavior = ReturnType<typeof create_time_field>;

Return value of create_time_field.

Members

NameTypeDescription
segmentsreadonly DateTimeSegment[]
segment_ref(part: SegmentPart) => Attachment<HTMLElement>
segment_attrs(seg: DateTimeSegment) => { "aria-hidden": true; "data-segment": "literal"; role?: undefined; tabindex?: undefined; "aria-label"?: undefined; "aria-valuemin"?: undefined; "aria-valuemax"?: undefined; "aria-valuenow"?: undefined; "aria-valuetext"?: undefined; "aria-disabled"?: undefined; onkeydown?: undefined; onblur?: undefined; } | { role: "spinbutton"; tabindex: number | undefined; "data-segmen…

Source: packages/ui/src/behaviors/date-time.svelte.ts:71

TimeFieldOptions type

type TimeFieldOptions = {
    /** Controlled `Time` getter. */
    readonly value: () => Time | undefined;
    /** Called when the time value changes (or clears to `undefined`). */
    readonly on_change: (next: Time | undefined) => void;
    /** Editing precision: `'hour'` or `'minute'` (default `'minute'`). */
    readonly granularity?: () => 'hour' | 'minute';
    /** Disabled state. */
    readonly disabled?: () => boolean;
};

Options for create_time_field.

Members

NameTypeDescription
value() => Time | undefined

Controlled Time getter.

on_change(next: Time | undefined) => void

Called when the time value changes (or clears to undefined).

granularity?() => 'hour' | 'minute'

Editing precision: 'hour' or 'minute' (default 'minute').

disabled?() => boolean

Disabled state.

Source: packages/ui/src/behaviors/date-time.svelte.ts:59

TimelineBehavior type

type TimelineBehavior = ReturnType<typeof create_timeline>;

Return value of create_timeline.

Members

NameTypeDescription
expandedreadonly string[]
is_expanded(id: string) => boolean
toggle(id: string) => void
item(key: string) => Attachment<HTMLElement>
root_attrs() => { role: "feed"; "aria-label": string; onkeydown: (event: KeyboardEvent) => void; }
item_attrs(id: string) => { role: "article"; "aria-expanded": boolean; "data-expanded": string | undefined; tabindex: number | undefined; onfocus: () => void; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1344

TimelineOptions type

type TimelineOptions = {
    readonly items: () => readonly string[];
    readonly default_expanded?: readonly string[];
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_timeline.

Members

NameTypeDescription
items() => readonly string[]
default_expanded?readonly string[]
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1336

ToggleGroupOptions type

type ToggleGroupOptions = {
    readonly items: () => readonly string[];
    readonly mode?: 'single' | 'multiple';
    readonly value?: () => readonly string[];
    readonly default_value?: readonly string[];
    readonly on_change?: (values: readonly string[]) => void;
    readonly orientation?: RovingOrientation;
    readonly disabled?: (key: string) => boolean;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_toggle_group.

Members

NameTypeDescription
items() => readonly string[]
mode?'single' | 'multiple'
value?() => readonly string[]
default_value?readonly string[]
on_change?(values: readonly string[]) => void
orientation?RovingOrientation
disabled?(key: string) => boolean
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:170

TokenInput type

type TokenInput = ReturnType<typeof create_token_input>;

Return value of create_token_input.

Members

NameTypeDescription
valuesreadonly string[]
input_textstring
active_indexnumber | null
editing_indexnumber | null
editing_textstring
errorstring | null
add(raw: string) => boolean
remove_at(index: number) => void
commit_input() => void
start_edit(index: number) => void
commit_edit() => void
cancel_edit() => void
inputAttachment<HTMLInputElement>
chip(index: number) => Attachment<HTMLElement>
input_attrs() => { value: string; disabled: true | undefined; "aria-label": string | undefined; onfocus: () => void; oninput: (event: Event) => void; onpaste: (event: ClipboardEvent) => void; onkeydown: (event: KeyboardEvent) => void; onblur: () => void; }
chip_attrs(index: number) => { tabindex: number; "data-active": string | undefined; "data-editing": string | undefined; onfocus: () => void; ondblclick: () => void; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:38

TokenInputOptions type

type TokenInputOptions = {
    /** Controlled tokens; omit for internal state. */
    readonly value?: () => readonly string[];
    /** Initial tokens when uncontrolled. */
    readonly default_value?: readonly string[];
    /** Called whenever tokens change. */
    readonly on_change?: (next: readonly string[]) => void;
    /** Delimiter characters that split tokens (default `[',']`). */
    readonly delimiters?: readonly string[];
    /** Allow duplicate tokens (default `false`). */
    readonly allow_duplicates?: boolean;
    /** Maximum token count (optional). */
    readonly max?: number;
    /** Optional validator returning an error message string when rejected, or `null`/`undefined` if valid. */
    readonly validate?: (token: string) => string | null | undefined;
    /** Disabled state. */
    readonly disabled?: () => boolean;
    /** Accessible label. */
    readonly label?: string;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_token_input.

Members

NameTypeDescription
value?() => readonly string[]

Controlled tokens; omit for internal state.

default_value?readonly string[]

Initial tokens when uncontrolled.

on_change?(next: readonly string[]) => void

Called whenever tokens change.

delimiters?readonly string[]

Delimiter characters that split tokens (default [',']).

allow_duplicates?boolean

Allow duplicate tokens (default false).

max?number

Maximum token count (optional).

validate?(token: string) => string | null | undefined

Optional validator returning an error message string when rejected, or null/undefined if valid.

disabled?() => boolean

Disabled state.

label?string

Accessible label.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:14

ToolbarOptions type

type ToolbarOptions = {
    readonly items: () => readonly string[];
    readonly orientation?: RovingOrientation;
    readonly disabled?: (key: string) => boolean;
    readonly label?: string;
};

Options for create_toolbar.

Members

NameTypeDescription
items() => readonly string[]
orientation?RovingOrientation
disabled?(key: string) => boolean
label?string

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:493

Transfer type

type Transfer = ReturnType<typeof create_transfer>;

Return value of create_transfer.

Members

NameTypeDescription
listsReadonly<Record<string, readonly string[]>>
draftTransferDraft | null
draggingstring | null
move(key: string, to: string, index: number, commitNow?: boolean) => void
container(id: string) => Attachment<HTMLElement>
item(key: string) => Attachment<HTMLElement>
item_attrs(key: string) => { "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/drag.svelte.ts:281

TransferDraft type

type TransferDraft = {
    readonly key: string;
    readonly from: string;
    readonly lists: TransferLists;
};

Live draft while an item is being transferred across containers.

Members

NameTypeDescription
keystring
fromstring
listsTransferLists

Source: packages/ui/src/behaviors/drag.svelte.ts:258

TransferLists type

type TransferLists = Readonly<Record<string, readonly string[]>>;

Map of container keys to their ordered item keys.

Source: packages/ui/src/behaviors/drag.svelte.ts:255

TransferOptions type

type TransferOptions = {
    /** Ordered container keys (e.g. Kanban lane ids). */
    readonly containers: () => readonly string[];
    /** Current lists per container. */
    readonly lists: () => TransferLists;
    /** Called once on drop or keyboard commit with the next container map. */
    readonly on_commit: (next: TransferLists, move: {
        readonly key: string;
        readonly from: string;
        readonly to: string;
        readonly index: number;
    }) => void;
    /** Optional predicate rejecting moves into a container. */
    readonly can_drop?: (key: string, toContainer: string) => boolean;
    /** Human-readable item label for screen-reader announcements. */
    readonly item_label?: (key: string) => string;
    /** Human-readable container label for screen-reader announcements. */
    readonly container_label?: (container: string) => string;
};

Options for create_transfer.

Members

NameTypeDescription
containers() => readonly string[]

Ordered container keys (e.g. Kanban lane ids).

lists() => TransferLists

Current lists per container.

on_commit(next: TransferLists, move: { readonly key: string; readonly from: string; readonly to: string; readonly index: number; }) => void

Called once on drop or keyboard commit with the next container map.

can_drop?(key: string, toContainer: string) => boolean

Optional predicate rejecting moves into a container.

item_label?(key: string) => string

Human-readable item label for screen-reader announcements.

container_label?(container: string) => string

Human-readable container label for screen-reader announcements.

Source: packages/ui/src/behaviors/drag.svelte.ts:265

Tree type

type Tree<T = unknown> = ReturnType<typeof create_tree<T>>;

Return value of create_tree.

Members

NameTypeDescription
rowsFlatTreeRow<T>[]
expandedreadonly string[]
selectedreadonly string[]
activestring
expand(id: string) => void
collapse(id: string) => void
toggle_expand(id: string) => void
is_expanded(id: string) => boolean
is_selected(key: string) => boolean
item(key: string) => import("svelte/attachments").Attachment<HTMLElement>
root_attrs() => { role: "tree"; onkeydown: (event: KeyboardEvent) => void; }
item_attrs(id: string) => { role: "treeitem"; "aria-level": number; "aria-expanded": boolean | undefined; "aria-selected": boolean; "aria-disabled": true | undefined; "data-selected": string | undefined; "data-expanded": string | undefined; tabindex: number | undefined; onfocus: () => void; onclick: (event: MouseEvent) => void; }

Source: packages/ui/src/behaviors/tree.svelte.ts:57

TreeCheckStrategy type

type TreeCheckStrategy = 'leaf' | 'trunk' | 'branch' | 'independent';

Tri-state checkbox cascade strategy for hierarchical trees.

Source: packages/ui/src/behaviors/tree.svelte.ts:31

TreeCheckedState type

type TreeCheckedState = boolean | 'indeterminate';

Tri-state checkbox value for one tree node.

Source: packages/ui/src/behaviors/tree.svelte.ts:34

TreeNode type

type TreeNode<T = unknown> = {
    readonly id: string;
    readonly label: string;
    readonly children?: readonly TreeNode<T>[];
    readonly disabled?: boolean;
    readonly data?: T;
};

One hierarchical node supplied to create_tree.

Members

NameTypeDescription
idstring
labelstring
children?readonly TreeNode<T>[]
disabled?boolean
data?T

Source: packages/ui/src/behaviors/tree.svelte.ts:10

TreeOptions type

type TreeOptions<T = unknown> = {
    /** Root tree nodes. */
    readonly nodes: () => readonly TreeNode<T>[];
    /** Initial expanded node ids. */
    readonly default_expanded?: readonly string[];
    /** Controlled expanded node ids. */
    readonly expanded?: () => readonly string[];
    /** Called when expanded node ids change. */
    readonly on_expanded_change?: (ids: readonly string[]) => void;
    /** Selection mode (default `'single'`). */
    readonly mode?: SelectionMode;
    /** Controlled selected ids. */
    readonly selected?: () => readonly string[];
    /** Called when selection changes. */
    readonly on_select?: (ids: readonly string[]) => void;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_tree.

Members

NameTypeDescription
nodes() => readonly TreeNode<T>[]

Root tree nodes.

default_expanded?readonly string[]

Initial expanded node ids.

expanded?() => readonly string[]

Controlled expanded node ids.

on_expanded_change?(ids: readonly string[]) => void

Called when expanded node ids change.

mode?SelectionMode

Selection mode (default 'single').

selected?() => readonly string[]

Controlled selected ids.

on_select?(ids: readonly string[]) => void

Called when selection changes.

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/tree.svelte.ts:37

TreePlace type

type TreePlace = {
    readonly target: string;
    readonly position: 'before' | 'inside' | 'after';
};

Drop placement relative to a target tree row.

Members

NameTypeDescription
targetstring
position'before' | 'inside' | 'after'

Source: packages/ui/src/behaviors/drag.svelte.ts:466

TreeReorder type

type TreeReorder = ReturnType<typeof create_tree_reorder>;

Return value of create_tree_reorder.

Members

NameTypeDescription
draggingstring | null
dropTreePlace | null
commit(id: string, place: TreePlace) => void
item(id: string) => Attachment<HTMLElement>
item_attrs(id: string) => { "data-dragging": string | undefined; "data-drop-position": "before" | "inside" | "after" | undefined; onkeydown: (event: KeyboardEvent) => void; }

Source: packages/ui/src/behaviors/drag.svelte.ts:491

TreeReorderOptions type

type TreeReorderOptions = {
    /** Visible pre-order tree rows. */
    readonly rows: () => readonly TreeReorderRow[];
    /** Invoked when a node (with its subtree) moves to `place`. */
    readonly on_move: (id: string, place: TreePlace) => void;
    /** Optional predicate forbidding drops into/around a target. */
    readonly can_drop?: (id: string, place: TreePlace) => boolean;
};

Options for create_tree_reorder.

Members

NameTypeDescription
rows() => readonly TreeReorderRow[]

Visible pre-order tree rows.

on_move(id: string, place: TreePlace) => void

Invoked when a node (with its subtree) moves to place.

can_drop?(id: string, place: TreePlace) => boolean

Optional predicate forbidding drops into/around a target.

Source: packages/ui/src/behaviors/drag.svelte.ts:481

TreeReorderRow type

type TreeReorderRow = {
    readonly id: string;
    readonly depth: number;
    readonly parent: string | null;
    readonly label?: string;
};

One flattened row accepted by create_tree_reorder.

Members

NameTypeDescription
idstring
depthnumber
parentstring | null
label?string

Source: packages/ui/src/behaviors/drag.svelte.ts:458

TriggerMatch type

type TriggerMatch = {
    readonly trigger: string;
    readonly query: string;
    readonly start: number;
    readonly end: number;
};

Active trigger match inside a text field.

Members

NameTypeDescription
triggerstring
querystring
startnumber
endnumber

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:348

TriggerMenu type

type TriggerMenu<T extends TriggerMenuItem = TriggerMenuItem> = ReturnType<typeof create_trigger_menu<T>>;

Return value of create_trigger_menu.

Members

NameTypeDescription
openboolean
matchTriggerMatch | null
itemsreadonly T[]
pathreadonly T[]
active_indexnumber
floating{ readonly x: number; readonly y: number; readonly side: import("./floating.svelte.js").FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: import("./floating.svelte.js").FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Att…
close() => void
select(item: T) => void
pop_level() => void
fieldAttachment<HTMLInputElement | HTMLTextAreaElement>
contentAttachment<HTMLElement>
input_attrs() => { "aria-expanded": boolean; "aria-haspopup": "listbox"; "aria-activedescendant": string | undefined; oninput: (event: Event) => void; onkeyup: (event: KeyboardEvent) => void; onkeydown: (event: KeyboardEvent) => void; }
option_attrs(item: T, index: number) => { id: string; role: "option"; "aria-selected": boolean; "aria-disabled": true | undefined; "data-highlighted": string | undefined; onpointerenter: () => void; onmousedown: (event: MouseEvent) => void; onclick: () => void; }

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:368

TriggerMenuItem type

type TriggerMenuItem = {
    readonly id: string;
    readonly label: string;
    readonly keywords?: string;
    readonly insert?: string;
    readonly disabled?: boolean;
    readonly children?: readonly TriggerMenuItem[];
};

One item offered by create_trigger_menu.

Members

NameTypeDescription
idstring
labelstring
keywords?string
insert?string
disabled?boolean
children?readonly TriggerMenuItem[]

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:338

TriggerMenuOptions type

type TriggerMenuOptions<T extends TriggerMenuItem = TriggerMenuItem> = {
    /** Trigger prefixes that open the menu (e.g. `['@', '/']`). */
    readonly triggers: readonly string[];
    /** Returns items for the active trigger & nested level stack. */
    readonly items: (trigger: string, query: string, path: readonly T[]) => readonly T[];
    /** Called when a leaf item is picked (receives item and replacement range). */
    readonly on_select: (item: T, match: TriggerMatch, insertText: string) => void;
    /** Optional semantic control registration for Norbius's `page` bridge. */
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_trigger_menu.

Members

NameTypeDescription
triggersreadonly string[]

Trigger prefixes that open the menu (e.g. ['@', '/']).

items(trigger: string, query: string, path: readonly T[]) => readonly T[]

Returns items for the active trigger & nested level stack.

on_select(item: T, match: TriggerMatch, insertText: string) => void

Called when a leaf item is picked (receives item and replacement range).

control?{ readonly id: string; readonly label?: string; }

Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:356

Typeahead type

type Typeahead = ReturnType<typeof create_typeahead>;

Return value of create_typeahead.

Members

NameTypeDescription
onkeydown(event: KeyboardEvent) => void
reset() => void
querystring

Source: packages/ui/src/behaviors/typeahead.svelte.ts:20

TypeaheadItem type

type TypeaheadItem = {
    key: string;
    text: string;
    disabled?: boolean;
};

One searchable item supplied to create_typeahead.

Members

NameTypeDescription
keystring
textstring
disabled?boolean

Source: packages/ui/src/behaviors/typeahead.svelte.ts:5

TypeaheadOptions type

type TypeaheadOptions = {
    /** Candidate items in visual order. */
    items: () => readonly TypeaheadItem[];
    /** Currently active key (search wraps starting after this item). */
    active?: () => string | undefined;
    /** Invoked with the matched item's key. */
    on_match: (key: string) => void;
    /** Buffer reset delay in ms (default `500`). */
    timeout_ms?: number;
};

Options for create_typeahead.

Members

NameTypeDescription
items() => readonly TypeaheadItem[]

Candidate items in visual order.

active?() => string | undefined

Currently active key (search wraps starting after this item).

on_match(key: string) => void

Invoked with the matched item's key.

timeout_ms?number

Buffer reset delay in ms (default 500).

Source: packages/ui/src/behaviors/typeahead.svelte.ts:8

UiHistory type

type UiHistory = ReturnType<typeof create_ui_history>;

Return value of create_ui_history.

Members

NameTypeDescription
entriesreadonly UiHistoryEntry[]
positionnumber
can_undoboolean
can_redoboolean
undo() => boolean
redo() => boolean
undo_source(source: ChangeSource) => number
destroy() => void

Source: packages/ui/src/behaviors/controls.svelte.ts:420

UiHistoryEntry type

type UiHistoryEntry = ControlChange & {
    readonly seq: number;
    readonly reverted?: boolean;
};

Recorded entry inside create_ui_history.

Members

NameTypeDescription
idstring
kindstring
label?string
keystring
previousunknown
valueunknown
sourceChangeSource
reasonstring
redacted?boolean
committedboolean
seqnumber
reverted?boolean

Source: packages/ui/src/behaviors/controls.svelte.ts:405

UiHistoryOptions type

type UiHistoryOptions = {
    readonly within?: Element | (() => Element | null | undefined);
    /** Only record state keys in this list (defaults to all keys). */
    readonly keys?: readonly string[];
    /** Coalesce consecutive edits to the same `(id, key, source)` within 500ms (default `true`). */
    readonly coalesce?: boolean;
};

Options for create_ui_history.

Members

NameTypeDescription
within?Element | (() => Element | null | undefined)
keys?readonly string[]

Only record state keys in this list (defaults to all keys).

coalesce?boolean

Coalesce consecutive edits to the same (id, key, source) within 500ms (default true).

Source: packages/ui/src/behaviors/controls.svelte.ts:411

UndoStack type

type UndoStack<T> = ReturnType<typeof create_undo_stack<T>>;

Return value of create_undo_stack.

Members

NameTypeDescription
currentT
can_undoboolean
can_redoboolean
lengthnumber
record(next: T, opts?: { readonly group?: string; readonly time?: number; }) => void
undo() => T
redo() => T
reset(value: T) => void

Source: packages/ui/src/behaviors/micro.svelte.ts:109

UndoStackOptions type

type UndoStackOptions = {
    /** Maximum history depth (default `100`). */
    readonly limit?: number;
    /** Coalescing window in ms for edits sharing the same `group` (default `500`). */
    readonly group_delay_ms?: number;
};

Options for create_undo_stack.

Members

NameTypeDescription
limit?number

Maximum history depth (default 100).

group_delay_ms?number

Coalescing window in ms for edits sharing the same group (default 500).

Source: packages/ui/src/behaviors/micro.svelte.ts:101

ViewportBehavior type

type ViewportBehavior = ReturnType<typeof create_viewport>;

Return value of create_viewport.

Members

NameTypeDescription
xnumber
ynumber
zoomnumber
panningboolean
transformstring
set_camera(next: Partial<ViewportCamera>) => void
zoom_at(factor: number, originX: number, originY: number) => void
reset() => void
surfaceAttachment<HTMLElement>

Source: packages/ui/src/behaviors/canvas.svelte.ts:528

ViewportCamera type

type ViewportCamera = {
    readonly x: number;
    readonly y: number;
    readonly zoom: number;
};

Camera state of a pan/zoom canvas viewport.

Members

NameTypeDescription
xnumber
ynumber
zoomnumber

Source: packages/ui/src/behaviors/canvas.svelte.ts:517

ViewportOptions type

type ViewportOptions = {
    readonly initial?: ViewportCamera;
    readonly min_zoom?: number;
    readonly max_zoom?: number;
    readonly on_change?: (camera: ViewportCamera) => void;
};

Options for create_viewport.

Members

NameTypeDescription
initial?ViewportCamera
min_zoom?number
max_zoom?number
on_change?(camera: ViewportCamera) => void

Source: packages/ui/src/behaviors/canvas.svelte.ts:520

ViewportState type

type ViewportState = {
    readonly width: number;
    readonly height: number;
    readonly offset_top: number;
    readonly offset_left: number;
    readonly scale: number;
    /** Estimated height in px occluded by an on-screen mobile keyboard (`0` on desktop). */
    readonly keyboard_height: number;
};

Live visual viewport & software keyboard metrics from bind_viewport.

Members

NameTypeDescription
widthnumber
heightnumber
offset_topnumber
offset_leftnumber
scalenumber
keyboard_heightnumber

Estimated height in px occluded by an on-screen mobile keyboard (0 on desktop).

Source: packages/ui/src/behaviors/platform.svelte.ts:8

primitives

Virtual type

type Virtual = ReturnType<typeof virtual_list>;

A windowed list: the slice of items to render, the spacers around it and the measure attachment.

Members

NameTypeDescription
onboolean
startnumber
endnumber
beforenumber

The top spacer's height.

afternumber

The bottom spacer's height.

slice<T>(items: readonly T[]) => readonly T[]

The rendered items; index j of the slice is item start + j.

anchor(el: HTMLElement) => () => void

On the top spacer: finds the clipping ancestors and follows every scroll and resize (one read per frame).

measure(key: string) => Attachment<Element>

On each rendered item: its height, margins included, cached under key.

reveal(index: number) => void

Scrolls the nearest scrolling ancestor (else the window) so item index shows; for keyboard focus on an unmounted row.

Source: packages/ui/src/primitives/virtual/virtual.svelte.ts:29

behaviors

VirtualAnchor type

type VirtualAnchor = {
    readonly x: number;
    readonly y: number;
} | {
    readonly getBoundingClientRect: () => VirtualRect;
};

Virtual anchor: either a { x, y } pointer coordinate or a getBoundingClientRect() provider.

Source: packages/ui/src/behaviors/floating.svelte.ts:23

primitives

VirtualOptions type

type VirtualOptions = {
    count: () => number;
    /** Stable identity of item `i` (its id): measured heights follow it. */
    key: (index: number) => string;
    /** An unmeasured item's height in px. */
    estimate: number;
    /** Render every item at or below this count (default 60). */
    threshold?: number;
    /** Items rendered beyond each edge of the visible band (default 8). */
    overscan?: number;
    /** Window the last visible rows while a bottom-origin viewport is latched to its tail. */
    tail?: () => boolean;
};

What virtual_list windows: the item count, each item's stable key, the estimated height, the threshold and the overscan.

Members

NameTypeDescription
count() => number
key(index: number) => string

Stable identity of item i (its id): measured heights follow it.

estimatenumber

An unmeasured item's height in px.

threshold?number

Render every item at or below this count (default 60).

overscan?number

Items rendered beyond each edge of the visible band (default 8).

tail?() => boolean

Window the last visible rows while a bottom-origin viewport is latched to its tail.

Source: packages/ui/src/primitives/virtual/virtual.svelte.ts:15

behaviors

VirtualRect type

type VirtualRect = {
    readonly left: number;
    readonly top: number;
    readonly right: number;
    readonly bottom: number;
    readonly width: number;
    readonly height: number;
};

Rect subset needed to position against a non-element virtual anchor.

Members

NameTypeDescription
leftnumber
topnumber
rightnumber
bottomnumber
widthnumber
heightnumber

Source: packages/ui/src/behaviors/floating.svelte.ts:13

WatchOptions type

type WatchOptions = {
    /** Skip the initial effect run and only invoke on subsequent changes (default `false`). */
    readonly lazy?: boolean;
    /** Stop reacting after the first invocation (default `false`). */
    readonly once?: boolean;
};

Options controlling whether watch skips its initial run (lazy) or only runs once (once).

Members

NameTypeDescription
lazy?boolean

Skip the initial effect run and only invoke on subsequent changes (default false).

once?boolean

Stop reacting after the first invocation (default false).

Source: packages/ui/src/behaviors/reactive.svelte.ts:6

WaterfallBehavior type

type WaterfallBehavior<T extends WaterfallItem = WaterfallItem> = ReturnType<typeof create_waterfall<T>>;

Return value of create_waterfall.

Members

NameTypeDescription
rowsimport("./tree.svelte.js").FlatTreeRow<T>[]
minnumber
maxnumber
view_startnumber
view_endnumber
tree{ readonly rows: import("./tree.svelte.js").FlatTreeRow<T>[]; readonly expanded: readonly string[]; readonly selected: readonly string[]; readonly active: string; expand: (id: string) => void; collapse: (id: string) => void; toggle_expand: (id: string) => void; is_expanded(id: string): boolean; is_selected: (key: string) => boolean; item: (key: string) => Attachment<HTMLElement>; root_attrs(): { …
bar_rect(item: WaterfallItem) => { readonly left_pct: number; readonly width_pct: number; }
zoom(start: number, end: number) => void
reset_zoom() => void

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1238

WaterfallItem type

type WaterfallItem = {
    readonly id: string;
    readonly label: string;
    readonly parent?: string | null;
    readonly start: number;
    readonly end: number;
};

One timed span item in create_waterfall.

Members

NameTypeDescription
idstring
labelstring
parent?string | null
startnumber
endnumber

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1221

WaterfallOptions type

type WaterfallOptions<T extends WaterfallItem = WaterfallItem> = {
    readonly items: () => readonly T[];
    readonly on_select?: (id: string) => void;
    readonly label?: string;
    readonly control?: {
        readonly id: string;
        readonly label?: string;
    };
};

Options for create_waterfall.

Members

NameTypeDescription
items() => readonly T[]
on_select?(id: string) => void
label?string
control?{ readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1230

act_on_control function

function act_on_control(id: string, action: string, args?: readonly unknown[]): boolean

Invokes a named semantic action on a registered control by id or label; returns whether it ran.

Parameters

NameTypeDescription
idstring
actionstring
args?readonly unknown[]

Source: packages/ui/src/behaviors/controls.svelte.ts:381

announce function

function announce(text: string, options?: AnnounceOptions): void

Announces text to assistive technologies. Repeating identical text still triggers a fresh reading by clearing the region before writing.

Parameters

NameTypeDescription
textstring
options?AnnounceOptions

Source: packages/ui/src/behaviors/announce.svelte.ts:61

aria_keyshortcuts function

function aria_keyshortcuts(spec: string, platform?: "mac" | "other"): string

Converts a shortcut spec into a WAI-ARIA aria-keyshortcuts attribute value (e.g. 'Meta+K' or 'Control+K').

Parameters

NameTypeDescription
specstring
platform?'mac' | 'other'

Source: packages/ui/src/behaviors/shortcuts.svelte.ts:104

bind_avoid_keyboard function

function bind_avoid_keyboard(options?: { readonly mode?: "padding" | "translate"; }): Attachment<HTMLElement>

Shifts a fixed bottom bar, composer or sheet above the mobile software keyboard using visualViewport keyboard-height measurements (padding-bottom or transform).

Parameters

NameTypeDescription
options?{ readonly mode?: 'padding' | 'translate'; }

Source: packages/ui/src/behaviors/platform.svelte.ts:80

bind_drag function

function bind_drag(options: BindDragOptions): Attachment<HTMLElement>

Pointer-capture drag attachment ({@attach bind_drag(...)}) with movement threshold, animation-frame batching and optional Escape cancellation.

Parameters

NameTypeDescription
optionsBindDragOptions
  • threshold?: number

    Movement in CSS px before on_start/on_move fire (default DRAG_THRESHOLD).

  • on_start?: (event: PointerEvent) => boolean | void

    Return false to reject starting the drag.

  • on_move: (sample: PointerSample) => void

    Called at most once per animation frame with latest pointer coordinates.

  • on_end?: (event: PointerEvent | KeyboardEvent, canceled: boolean) => void

    Called when the pointer lifts, cancels, or Escape aborts.

  • cancel_on_escape?: boolean

    Cancel active drag on Escape (default true).

  • stop_propagation?: boolean

    Stop pointerdown propagation so nested drag surfaces do not both capture the gesture.

  • disabled?: () => boolean

    Disable dragging reactively.

Source: packages/ui/src/behaviors/drag.svelte.ts:42

bind_drag_preview function

function bind_drag_preview(options: DragPreviewOptions): Attachment<HTMLElement>

Positions a custom floating drag-ghost element under the pointer without HTML5 drag ghost clipping.

Parameters

NameTypeDescription
optionsDragPreviewOptions
  • point: () => { readonly x: number; readonly y: number; } | null

    Reactive active drag coordinates (null when not dragging).

  • offset?: { readonly x: number; readonly y: number; }

    Offset in px relative to pointer (default { x: 12, y: 12 }).

Source: packages/ui/src/behaviors/platform.svelte.ts:304

bind_findable function

function bind_findable(options: FindableOptions): Attachment<HTMLElement>

Attachment keeping a closed panel discoverable by browser find-in-page (hidden="until-found"). When the user searches text inside the closed panel, on_reveal fires so the panel opens cleanly.

Parameters

NameTypeDescription
optionsFindableOptions
  • open: () => boolean

    Whether the panel is currently open/visible.

  • findable?: () => boolean

    Whether closed content remains findable via browser Ctrl/Cmd+F (default true).

  • on_reveal: (event: Event) => void

    Called when browser find-in-page matches text inside the closed panel (beforematch).

Source: packages/ui/src/behaviors/presence.svelte.ts:230

bind_hold function

function bind_hold(options: BindHoldOptions): Attachment<HTMLElement>

Long-press attachment ({@attach bind_hold(...)}) with movement tolerance, Escape/blur cancel and automatic click suppression after a completed hold.

Parameters

NameTypeDescription
optionsBindHoldOptions
  • delay?: number

    Hold duration in ms before on_hold fires (default 500).

  • tolerance?: number

    Max pointer drift in px before canceling (default 8).

  • keys?: readonly string[]

    Keys that start a keyboard hold (default [' ', 'Enter']).

  • on_start?: (details: { readonly event: PointerEvent | KeyboardEvent; readonly input: HoldInput; }) => void

    Called when press starts.

  • on_hold: (details: { readonly event: PointerEvent | KeyboardEvent; readonly input: HoldInput; }) => void

    Called once the press crosses delay.

  • on_end?: (details: { readonly event: Event; readonly input: HoldInput; readonly held: boolean; readonly canceled: boolean; }) => void

    Called when the press lifts or cancels.

  • disabled?: () => boolean

    Disable reactively.

Source: packages/ui/src/behaviors/micro.svelte.ts:220

bind_repeat function

function bind_repeat(options: BindRepeatOptions): Attachment<HTMLElement>

Press-and-hold repeating attachment ({@attach bind_repeat(...)}) for number-input steppers and scrub buttons. Fires once immediately, waits delay, then repeats every interval.

Parameters

NameTypeDescription
optionsBindRepeatOptions
  • on_step: (count: number) => void

    Called immediately on press and repeatedly while held.

  • on_end?: (count: number) => void

    Called when the repeating press stops.

  • delay?: number

    Delay before repeating begins in ms (default 400).

  • interval?: number

    Interval between repeated steps in ms (default 60).

  • disabled?: () => boolean

    Disable reactively.

Source: packages/ui/src/behaviors/micro.svelte.ts:351

bind_scroll_picker function

function bind_scroll_picker(options: ScrollPickerOptions): Attachment<HTMLElement>

Scroll-snap wheel picker attachment ({@attach bind_scroll_picker(...)}) that writes --picker-offset (-1..1 normalized distance from center) on each child option and reports the centered index on scroll settle.

Parameters

NameTypeDescription
optionsScrollPickerOptions
  • on_select: (index: number) => void

    Called when the centered option changes after scrolling settles.

  • orientation?: 'vertical' | 'horizontal'

    Scroll axis (default 'vertical').

Source: packages/ui/src/behaviors/canvas.svelte.ts:847

bind_viewport function

function bind_viewport(on_change?: (state: ViewportState) => void): Attachment<HTMLElement>

Tracks window.visualViewport resize/scroll changes and writes --viewport-height, --keyboard-height and --keyboard-inset CSS custom properties onto the bound element (or document.documentElement).

Parameters

NameTypeDescription
on_change?(state: ViewportState) => void

Source: packages/ui/src/behaviors/platform.svelte.ts:49

bridge_between function

function bridge_between(trigger: Rect, popup: Rect, pad?: number): (x: number, y: number) => boolean

Returns a point-in-corridor predicate spanning the convex hull of trigger and popup (padded slightly so hairline gaps never drop hover during diagonal transit).

Parameters

NameTypeDescription
triggerRect
popupRect
pad?number

Source: packages/ui/src/behaviors/hover-intent.svelte.ts:55

cell_bounds function

function cell_bounds(range: CellRange): CellBounds

Normalizes any CellRange into { top, left, bottom, right } inclusive bounds.

Parameters

NameTypeDescription
rangeCellRange
  • anchor: GridCell
  • end: GridCell

Source: packages/ui/src/behaviors/grid.svelte.ts:207

cells_to_text function

function cells_to_text(bounds: CellBounds, read: (cell: GridCell) => string): string

Serializes a 2D cell range to spreadsheet-compatible tab-separated text (TSV).

Parameters

NameTypeDescription
boundsCellBounds
  • top: number
  • left: number
  • bottom: number
  • right: number
read(cell: GridCell) => string

Source: packages/ui/src/behaviors/grid.svelte.ts:217

check_direction function

function check_direction(root: Element, expected: "ltr" | "rtl"): readonly PatternViolation[]

Verifies that an element resolves to the expected writing direction ('ltr' or 'rtl') via inherited dir attribute / computed style.

Parameters

NameTypeDescription
rootElement
expected'ltr' | 'rtl'

Source: packages/ui/src/behaviors/testing.ts:192

check_pattern function

function check_pattern(root: Element, pattern: AriaPattern): readonly PatternViolation[]

Audits a rendered DOM subtree against WAI-ARIA APG structural, naming and keyboard focus requirements for pattern. Returns an array of violations (empty means compliant).

Parameters

NameTypeDescription
rootElement
patternAriaPattern

Source: packages/ui/src/behaviors/testing.ts:59

color_scheme_of function

function color_scheme_of(): ResolvedColorScheme

Reads the operating system's current preferred color scheme.

Source: packages/ui/src/behaviors/platform.svelte.ts:159

color_scheme_script function

function color_scheme_script(storageKey: string): string

Generates a minimal inline script body to apply stored color scheme before first paint (no FOUC).

Parameters

NameTypeDescription
storageKeystring

Source: packages/ui/src/behaviors/platform.svelte.ts:233

contrast_ratio function

function contrast_ratio(a: RgbaColor, b: RgbaColor): number

Computes WCAG 2.1 contrast ratio (1..21) between two colors.

Parameters

NameTypeDescription
aRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number
bRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:957

create_accordion function

function create_accordion(options: AccordionOptions): { readonly open: readonly string[]; is_open(key: string): boolean; toggle: (key: string) => void; expand: (key: string) => void; collapse: (key: string) => void; item: (key: string) => import("svelte/attachments").Attachment<HTMLElement>; root_attrs: () => { onkeydown: (event: KeyboardEvent) => void; }; trigger_attrs(key: string): { type: "button"; id: string; "aria-expanded": boolean; "aria-controls": string; "data-state": "open" | "closed"; disabled: true | undefined; tabindex: number | undefined; onfocus: () => void; onclick: () => void; }; content_attrs(key: string): { id: string; role: "region"; "aria-labelledby": string; hidden: boolean; "data-state": "open" | "closed"; }; }

Headless composable accordion built on create_roving_focus + register_control.

Parameters

NameTypeDescription
optionsAccordionOptions
  • items: () => readonly string[]

    Item keys in visual order.

  • mode?: AccordionMode

    Single or multiple expanded sections (default 'single').

  • collapsible?: boolean

    In single mode, allow collapsing the only open item (default true).

  • open?: () => readonly string[]

    Controlled open keys; omit for internal state.

  • default_open?: readonly string[]

    Initial open keys when uncontrolled.

  • on_change?: (open: readonly string[]) => void

    Called whenever expanded keys change.

  • disabled?: (key: string) => boolean

    Disabled predicate per item key.

  • control?: { id: string; label?: string; }

    Optional semantic control id/label for Norbius's page bridge.

Source: packages/ui/src/behaviors/accordion.svelte.ts:37

create_area function

function create_area(options?: AreaOptions): { readonly value: AreaValue; readonly percent_x: number; readonly percent_y: number; readonly dragging: boolean; set: (next: AreaValue, commitNow?: boolean) => void; surface: Attachment<HTMLElement>; thumb_attrs(): { role: "slider"; tabindex: number; "aria-label": string | undefined; "aria-valuetext": string; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }

Headless 2D XY slider plane (e.g. color saturation/lightness picker or 2D joystick control).

Parameters

NameTypeDescription
options?AreaOptions

Source: packages/ui/src/behaviors/canvas.svelte.ts:143

create_async_options function

function create_async_options<T>(options: AsyncOptionsOptions<T>): { query: string; readonly items: readonly T[]; readonly status: AsyncOptionsStatus; readonly loading: boolean; readonly error: unknown; readonly has_more: boolean; set_query: (next: string, opts?: { immediate?: boolean; }) => void; load_more: () => void; reload: () => void; reset: () => void; cancel: () => void; }

Headless debounced, abortable, paginated async option loader.

Parameters

NameTypeDescription
optionsAsyncOptionsOptions<T>
  • load: (query: string, ctx: AsyncOptionsContext) => Promise<AsyncOptionsPage<T>>

    Fetches matching items for query and ctx.page, honoring ctx.signal.

  • initial_query?: string

    Initial query (default '').

  • debounce_ms?: number

    Typing debounce window in ms (default 200).

  • immediate?: boolean

    Fetch immediately for initial_query on mount (default false).

Source: packages/ui/src/behaviors/async-options.svelte.ts:48

create_auto_scroll function

function create_auto_scroll(options?: AutoScrollOptions): { update: (x: number, y: number) => void; stop: () => void; }

Scrolls the innermost scrollable container under a dragging pointer (falling back to the window) when the pointer approaches its edges.

Parameters

NameTypeDescription
options?AutoScrollOptions

Source: packages/ui/src/behaviors/drag.svelte.ts:184

create_calendar function

function create_calendar(options: CalendarOptions): { readonly placeholder: CalendarDate; readonly months: readonly CalendarMonth[]; readonly weekdays: readonly string[]; set_placeholder: (next: DateValue) => void; prev_month(): void; next_month(): void; reset_pending(): void; readonly focused: CalendarDate; focus_day: (target: CalendarDate) => void; day_ref(date: CalendarDate): Attachment<HTMLElement>; day_attrs(date: CalendarDate, month: CalendarDate): { role: "button"; tabindex: number; "data-value": string; "data-selected": string | undefined; "data-selection-start": string | undefined; "data-selection-end": string | undefined; "data-today": string | undefined; "data-outside-month": string | undefined; "data-disabled": string | undefined; "aria-disabled": true | undefined; "aria-selected": boolean; onfocus: () => void; onclick: () => void; onpointerenter: () => void; onkeydown: (e: KeyboardEvent) => void; }; }

Headless single-day and date-range calendar grid behavior over @internationalized/date. Builds localized month grids, weekday headers, prev/next month controls, range hover previews and keyboard Arrow/PageUp/PageDown day navigation.

Parameters

NameTypeDescription
optionsCalendarOptions
  • mode?: CalendarMode | (() => CalendarMode)

    Single-day or date-range selection mode (default 'single').

  • value?: () => DateValue | undefined

    Selected single date when mode === 'single'.

  • range?: () => CalendarRange

    Selected range when mode === 'range'.

  • on_select?: (date: DateValue) => void

    Called on single-day selection.

  • on_range_change?: (range: CalendarRange) => void

    Called when range selection updates (with { start, end }).

  • placeholder?: () => DateValue | undefined

    Controlled visible anchor month.

  • on_placeholder_change?: (next: DateValue) => void

    Called when the visible month changes.

  • number_of_months?: () => number

    Number of side-by-side months to build (default 1).

  • locale?: () => string | undefined

    BCP-47 locale for weekday order and names (default 'en-US').

  • min?: () => DateValue | undefined

    Minimum selectable date.

  • max?: () => DateValue | undefined

    Maximum selectable date.

  • disabled?: () => boolean

    Disabled state.

Source: packages/ui/src/behaviors/date-time.svelte.ts:648

function create_carousel(options: CarouselOptions): { readonly index: number; readonly count: number; readonly can_prev: boolean; readonly can_next: boolean; readonly paused: boolean; go_to: (next: number) => void; next: () => void; prev: () => void; set_paused(p: boolean): void; root: Attachment<HTMLElement>; track: Attachment<HTMLElement>; root_attrs(): { role: "region"; "aria-roledescription": string; "aria-label": string; onpointerenter: () => boolean; onpointerleave: () => boolean; onfocusin: () => boolean; onfocusout: () => boolean; onkeydown: (event: KeyboardEvent) => void; }; slide_attrs(i: number): { role: "group"; "aria-roledescription": string; "aria-label": string; "aria-hidden": true | undefined; "data-active": string | undefined; }; dot_attrs(i: number): { type: "button"; "aria-label": string; "aria-current": "true" | undefined; "data-active": string | undefined; onclick: () => void; }; }

Accessible slide carousel (aria-roledescription="carousel") with Arrow/Home/End navigation, optional looping, indicator dots, autoplay that pauses on hover/focus/reduced-motion, and control registration.

Parameters

NameTypeDescription
optionsCarouselOptions
  • count: () => number
  • index?: () => number
  • default_index?: number
  • on_change?: (index: number) => void
  • loop?: boolean
  • autoplay_ms?: number
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:246

create_cell_range function

function create_cell_range(options: CellRangeOptions): { readonly range: CellRange | null; readonly bounds: CellBounds | null; readonly dragging: boolean; start: (cell: GridCell) => void; extend: (to: GridCell, from?: GridCell, notify?: boolean) => void; select_row: (row: number) => void; select_col: (col: number) => void; clear: () => void; contains: (cell: GridCell) => boolean; to_text(read: (cell: GridCell) => string): string; cell_attrs(cell: GridCell): { "aria-selected": boolean; "data-in-range": string | undefined; onpointerdown: (event: PointerEvent) => void; onpointerenter: () => void; }; }

Rectangular spreadsheet cell-range selection with pointer drag painting, Shift-click/arrow extension, Ctrl+Space column / Shift+Space row selection, TSV copy/paste and screen-reader announcements.

Parameters

NameTypeDescription
optionsCellRangeOptions
  • rows: () => number

    Total row count.

  • cols: () => number

    Total column count.

  • range?: () => CellRange | null

    Controlled range; omit for internal state.

  • on_change?: (range: CellRange | null) => void

    Called when the selected cell range changes.

  • message?: (bounds: CellBounds) => string

    Optional live-region message formatter on range updates.

Source: packages/ui/src/behaviors/grid.svelte.ts:259

create_checkbox_group function

function create_checkbox_group(options: CheckboxGroupOptions): { readonly checked: readonly string[]; readonly all_state: boolean | "indeterminate"; is_checked(key: string): boolean; toggle: (key: string) => void; toggle_all: () => void; group_attrs(): { role: "group"; "aria-label": string | undefined; }; all_attrs(): { type: "checkbox"; checked: boolean; "aria-checked": boolean | "mixed"; onchange: () => void; }; item_attrs(key: string): { type: "checkbox"; checked: boolean; disabled: true | undefined; onchange: () => void; }; }

Headless flat checkbox group with tri-state Select All parent (true | false | 'indeterminate') and Norbius control registration.

Parameters

NameTypeDescription
optionsCheckboxGroupOptions
  • items: () => readonly string[]

    All selectable item keys.

  • value?: () => readonly string[]

    Controlled checked keys; omit for internal state.

  • default_value?: readonly string[]

    Initial checked keys when uncontrolled.

  • on_change?: (next: readonly string[]) => void

    Called when checked keys change.

  • disabled?: (key: string) => boolean

    Per-item disabled predicate.

  • label?: string

    Accessible label for the group.

  • control?: { readonly id: string; readonly label?: string; }

    Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:627

create_clipboard function

function create_clipboard(options: ClipboardOptions): { readonly copied: boolean; copy: (override?: string) => Promise<boolean>; reset(): void; }

Headless clipboard copy behavior with transient copied indicator and embedded-frame fallback.

Parameters

NameTypeDescription
optionsClipboardOptions
  • text: string | (() => string)

    Text to copy (reactive getter or static string).

  • timeout_ms?: number

    How long copied stays true in ms (default 1500).

  • on_copy?: (ok: boolean, value: string) => void

    Optional callback after a copy attempt completes.

Source: packages/ui/src/behaviors/clipboard.svelte.ts:39

create_color_picker function

function create_color_picker(options?: ColorPickerOptions): { readonly value: string; readonly rgba: RgbaColor; readonly hsv: HsvaColor; readonly plane: { readonly value: import("./canvas.svelte.js").AreaValue; readonly percent_x: number; readonly percent_y: number; readonly dragging: boolean; set: (next: import("./canvas.svelte.js").AreaValue, commitNow?: boolean) => void; surface: Attachment<HTMLElement>; thumb_attrs(): { role: "slider"; tabindex: number; "aria-label": string | undefined; "aria-valuetext": string; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }; readonly hue: { readonly value: number; readonly values: readonly number[]; readonly percent: number; readonly percents: number[]; readonly dragging: boolean; readonly active_thumb: number; set(next: number, index?: number): void; track: Attachment<HTMLElement>; thumb_attrs(index?: number): { role: "slider"; "aria-orientation": "horizontal" | "vertical"; "aria-label": string | undefined; "aria-valuemin": number; "aria-valuemax": number; "aria-valuenow": number; "aria-disabled": true | undefined; tabindex: number | undefined; "data-dragging": string | undefined; onfocus: () => void; onkeydown: (event: KeyboardEvent) => void; }; }; readonly alpha: { readonly value: number; readonly values: readonly number[]; readonly percent: number; readonly percents: number[]; readonly dragging: boolean; readonly active_thumb: number; set(next: number, index?: number): void; track: Attachment<HTMLElement>; thumb_attrs(index?: number): { role: "slider"; "aria-orientation": "horizontal" | "vertical"; "aria-label": string | undefined; "aria-valuemin": number; "aria-valuemax": number; "aria-valuenow": number; "aria-disabled": true | undefined; tabindex: number | undefined; "data-dragging": string | undefined; onfocus: () => void; onkeydown: (event: KeyboardEvent) => void; }; }; set_text: (text: string) => boolean; set_rgba: (next: RgbaColor) => void; }

Headless color picker composing 2D saturation/brightness create_area, hue & alpha create_slider, color parsing/formatting and Norbius control registration.

Parameters

NameTypeDescription
options?ColorPickerOptions

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:993

create_color_scheme function

function create_color_scheme(options?: ColorSchemeOptions): { readonly preference: ColorSchemePreference; readonly system: ResolvedColorScheme; readonly resolved: ResolvedColorScheme; set: (next: ColorSchemePreference) => void; }

Reactive color-scheme preference ('light' | 'dark' | 'system') synced with OS and optional storage.

Parameters

NameTypeDescription
options?ColorSchemeOptions

Source: packages/ui/src/behaviors/platform.svelte.ts:172

create_connect function

function create_connect(options: ConnectOptions): { readonly draft: ConnectDraft | null; readonly pending_from: string | null; port: (id: string) => Attachment<HTMLElement>; port_attrs: (id: string) => { tabindex: number; "data-connecting": string | undefined; "data-connect-target": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }

Headless node-graph port wiring behavior (pointer drag from port to port + keyboard Enter pick/connect).

Parameters

NameTypeDescription
optionsConnectOptions
  • can_connect?: (from: string, to: string) => boolean
  • on_connect: (from: string, to: string) => void

Source: packages/ui/src/behaviors/canvas.svelte.ts:640

function create_cookie_storage(options?: CookieStorageOptions): { get: (name: string) => string | null; set: (name: string, value: string) => void; remove: (name: string) => void; }

Simple browser cookie storage adapter (get, set, remove) for SSR-readable UI preferences.

Parameters

NameTypeDescription
options?CookieStorageOptions

Source: packages/ui/src/behaviors/platform.svelte.ts:406

create_date_field function

function create_date_field(options: DateFieldOptions): { readonly segments: readonly DateTimeSegment[]; segment_ref(part: SegmentPart): Attachment<HTMLElement>; segment_attrs(seg: DateTimeSegment): { "aria-hidden": true; "data-segment": "literal"; role?: undefined; tabindex?: undefined; "aria-label"?: undefined; "aria-valuemin"?: undefined; "aria-valuemax"?: undefined; "aria-valuenow"?: undefined; "aria-valuetext"?: undefined; "aria-disabled"?: undefined; onkeydown?: undefined; onblur?: undefined; } | { role: "spinbutton"; tabindex: number | undefined; "data-segment": "day" | "month" | "year" | "hour" | "minute"; "aria-label": "day" | "month" | "year" | "hour" | "minute"; "aria-valuemin": number; "aria-valuemax": number; "aria-valuenow": number | undefined; "aria-valuetext": string; "aria-disabled": true | undefined; onkeydown: (e: KeyboardEvent) => void; onblur: () => void; "aria-hidden"?: undefined; }; }

Headless locale-aware segmented date/instant field behavior. Supports multi-digit buffered typing (waiting for the full digit count before committing), ArrowUp/Down stepping, ArrowLeft/Right segment focus and Backspace clearing.

Parameters

NameTypeDescription
optionsDateFieldOptions
  • value: () => DateValue | undefined

    Controlled DateValue getter.

  • on_change: (next: DateValue | undefined) => void

    Called when the complete date/time value changes (or clears to undefined).

  • granularity?: () => 'day' | 'hour' | 'minute'

    Editing precision: 'day' (date only), 'hour' (date + hour), or 'minute' (date + hour + minute).

  • locale?: () => string | undefined

    BCP-47 locale for segment order and separators (default 'en-US').

  • disabled?: () => boolean

    Disabled state.

  • min?: () => DateValue | undefined

    Minimum allowed date value.

  • max?: () => DateValue | undefined

    Maximum allowed date value.

Source: packages/ui/src/behaviors/date-time.svelte.ts:222

create_disclosure function

function create_disclosure(options?: DisclosureOptions): { readonly open: boolean; readonly disabled: boolean; readonly state: "open" | "closed"; set_open: (next: boolean) => void; toggle: () => void; show: () => void; hide: () => void; trigger_attrs(): { type: "button"; "aria-expanded": boolean; "aria-controls": string; "data-state": "open" | "closed"; disabled: true | undefined; onclick: () => void; }; content_attrs(): { id: string; hidden: boolean; "data-state": "open" | "closed"; }; }

Headless disclosure state + ARIA attribute getters (trigger_attrs, content_attrs). Composes directly onto any button/panel without wrapper elements.

Parameters

NameTypeDescription
options?DisclosureOptions

Source: packages/ui/src/behaviors/disclosure.svelte.ts:27

create_dismiss function

function create_dismiss(options: DismissOptions): { readonly depth: number; readonly topmost: boolean; surface: Attachment<HTMLElement>; }

Headless LIFO overlay dismissal behavior. Attach surface to the floating/dialog element so nested overlays dismiss one layer at a time on Escape or outside click.

Parameters

NameTypeDescription
optionsDismissOptions
  • open: () => boolean

    Whether this layer is currently active/open.

  • on_dismiss: (reason: DismissReason, event: KeyboardEvent | PointerEvent) => void

    Called when the topmost layer should close.

  • escape?: boolean | (() => boolean)

    Close on Escape key (default true).

  • outside?: boolean | (() => boolean)

    Close on pointerdown outside the attached surface (default true).

  • ignore?: () => readonly (Element | null | undefined)[]

    Extra elements treated as inside (e.g. an anchor trigger button).

Source: packages/ui/src/behaviors/dismiss.svelte.ts:43

create_drawer function

function create_drawer(options?: DrawerOptions): { readonly open: boolean; readonly dragging: boolean; readonly offset: number; readonly snap_index: number; readonly snap_fraction: number; set_open: (next: boolean) => void; set_snap: (idx: number) => void; surface: Attachment<HTMLElement>; handle: Attachment<HTMLElement>; surface_attrs(): { role: "dialog"; "aria-modal": true | undefined; "aria-label": string | undefined; "data-side": DrawerSide; "data-dragging": string | undefined; "data-state": "open" | "closed"; style: string | undefined; }; }

Swipeable snap-point drawer / mobile bottom sheet with rubber-band overdrag, velocity fling dismissal, LIFO Escape/backdrop dismiss, modal focus trap + inert background and control registration.

Parameters

NameTypeDescription
options?DrawerOptions

Source: packages/ui/src/behaviors/motion.svelte.ts:128

create_field function

function create_field(options?: FieldBehaviorOptions): { readonly id: string; readonly invalid: boolean; readonly error: string | undefined; label_attrs(): { for: string; "data-required": string | undefined; "data-invalid": string | undefined; "data-disabled": string | undefined; }; control_attrs(): { id: string; "aria-describedby": string | undefined; "aria-invalid": true | undefined; "aria-required": true | undefined; disabled: true | undefined; readonly: true | undefined; }; description_attrs(): { id: string; }; error_attrs(): { id: string; role: "alert"; }; }

Headless field ARIA wiring (label_attrs, control_attrs, description_attrs, error_attrs).

Parameters

NameTypeDescription
options?FieldBehaviorOptions

Source: packages/ui/src/behaviors/field.svelte.ts:28

create_file_dropzone function

function create_file_dropzone(options: FileDropzoneOptions): { readonly dragging: boolean; readonly disabled: boolean; open(): void; process: (list: FileList | readonly File[]) => void; zone: Attachment<HTMLElement>; input: Attachment<HTMLInputElement>; input_attrs(): { type: "file"; accept: string | undefined; multiple: boolean | undefined; disabled: true | undefined; onchange: (event: Event) => void; }; }

Headless file dropzone & batch validator: depth-counted drag-over state (zero child flicker), accept MIME/extension, max size and max count filtering, and file-input bridge.

Parameters

NameTypeDescription
optionsFileDropzoneOptions
  • accept?: readonly string[]

    Accepted MIME types or extensions (e.g. ['image/*', '.pdf']).

  • max_bytes?: number

    Maximum file size in bytes.

  • max_files?: number

    Maximum number of files accepted in one drop/selection (default unlimited).

  • disabled?: () => boolean

    Disabled state.

  • on_files: (result: { readonly accepted: readonly File[]; readonly rejected: readonly RejectedFile[]; }) => void

    Called with validated accepted and rejected files.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:764

create_floating function

function create_floating(options: FloatingOptions): { readonly x: number; readonly y: number; readonly side: FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Attachment<HTMLElement>; }

Headless anchor-relative floating behavior with flip/shift collision avoidance, virtual anchors, --available-height/--available-width CSS variables and LIFO dismiss.

Parameters

NameTypeDescription
optionsFloatingOptions
  • open: () => boolean

    Whether the floating surface is open.

  • on_dismiss?: (reason: DismissReason) => void

    Called when Escape or an outside pointer press dismisses the surface.

  • anchor?: () => FloatingAnchor | null

    Optional reactive anchor element or virtual anchor getter.

  • side?: FloatingSide | (() => FloatingSide)

    Preferred side relative to the anchor (default 'bottom').

  • align?: FloatingAlign | (() => FloatingAlign)

    Cross-axis alignment relative to the anchor (default 'center').

  • side_offset?: number | (() => number)

    Gap between anchor and floating surface in px (default 4).

  • align_offset?: number | (() => number)

    Shift along the cross axis in px (default 0).

  • padding?: number | (() => number)

    Viewport edge padding in px (default 8).

  • flip?: boolean | (() => boolean)

    Flip to the opposite side when viewport room is insufficient (default true).

  • escape?: boolean | (() => boolean)

    Close on Escape key (default true).

  • outside?: boolean | (() => boolean)

    Close on outside pointer press (default true).

Source: packages/ui/src/behaviors/floating.svelte.ts:117

create_focus_recovery function

function create_focus_recovery<T = undefined>(options: FocusRecoveryOptions<T>): { item: (key: string, data?: T) => Attachment<HTMLElement>; }

Tracks focus across dynamically mounted items ({@attach recovery.item(key, data)}). When the currently focused item unmounts, fallback runs after removal settles and restores keyboard focus.

Parameters

NameTypeDescription
optionsFocusRecoveryOptions<T>
  • fallback: (lost: LostFocus<T>) => HTMLElement | null | undefined

    Returns the next element to focus when a bound item unmounts with focus, or null/undefined.

Source: packages/ui/src/behaviors/focus-recovery.svelte.ts:29

create_focus_trap function

function create_focus_trap(options: FocusTrapOptions): { container: Attachment<HTMLElement>; }

Headless focus trap + focus restoration + optional modal inert_outside & ref-counted lock_scroll attachment ({@attach trap.container}).

Parameters

NameTypeDescription
optionsFocusTrapOptions
  • active: () => boolean

    Whether focus trapping is active.

  • auto_focus?: boolean | (() => boolean)

    Automatically move focus into the container when activated (default true).

  • restore_focus?: boolean | (() => boolean)

    Restore focus to the previously active element on close (default true).

  • trap?: boolean | (() => boolean)

    Keep Tab / focusin strictly contained inside the container (default true).

  • modal?: boolean | (() => boolean)

    Mark background siblings inert while active (default false; set true on modal dialogs).

  • prevent_scroll?: boolean | (() => boolean)

    Apply ref-counted document scroll lock while active (default false).

  • topmost?: () => boolean

    Optional predicate gating focus-trap listeners to only the topmost stacked layer.

  • on_open_auto_focus?: (event: Event) => void

    Cancelable hook invoked before initial autofocus runs.

  • on_close_auto_focus?: (event: Event) => void

    Cancelable hook invoked before focus returns to the previous element on close.

  • on_focus_outside?: (event: FocusEvent) => void

    Called when focus escapes outside the container while active.

Source: packages/ui/src/behaviors/focus-trap.svelte.ts:57

create_grid_focus function

function create_grid_focus(options: GridFocusOptions): { readonly active: GridCell | null; focus: (cell: GridCell, shift?: boolean) => void; cell(cell: GridCell): Attachment<HTMLElement>; grid_attrs(): { role: "grid"; "aria-rowcount": number; "aria-colcount": number; onkeydown: (event: KeyboardEvent) => void; }; cell_attrs(cell: GridCell): { role: "gridcell"; "aria-rowindex": number; "aria-colindex": number; "aria-disabled": true | undefined; "data-active": string | undefined; tabindex: number | undefined; onfocus: () => void; }; }

Headless WAI-ARIA 2D grid roving focus manager supporting Arrow keys (RTL-aware), Home/End, Ctrl/Cmd+Home/End, PageUp/PageDown and virtualized row reveal.

Parameters

NameTypeDescription
optionsGridFocusOptions
  • rows: () => number

    Total row count.

  • cols: () => number

    Total column count.

  • active?: () => GridCell | null

    Controlled active cell; omit for internal state.

  • on_move?: (cell: GridCell, details: { readonly from: GridCell | null; readonly shift: boolean; }) => void

    Called whenever the active cell moves.

  • page_size?: number | (() => number)

    Rows skipped by PageUp / PageDown (default 10).

  • disabled?: (cell: GridCell) => boolean

    Skip cells matching this predicate.

  • reveal?: (cell: GridCell) => void

    Scroll an unrendered virtualized cell into view before focusing.

Source: packages/ui/src/behaviors/grid.svelte.ts:51

create_hover_card function

function create_hover_card(options?: HoverCardOptions): { readonly open: boolean; readonly present: boolean; readonly floating: { readonly x: number; readonly y: number; readonly side: FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: import("./floating.svelte.js").FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Attachment<HTMLElement>; }; set_open: (next: boolean) => void; trigger: Attachment<HTMLElement>; content: Attachment<HTMLElement>; trigger_attrs(): { "aria-expanded": boolean; onpointerenter: (e: PointerEvent) => void; onpointerleave: (e: PointerEvent) => void; onfocus: () => void; onblur: () => void; }; content_attrs(): { "data-state": "open" | "closed"; style: string; onpointerenter: (e: PointerEvent) => void; onpointerleave: (e: PointerEvent) => void; }; }

Rich non-modal hover preview card composing create_hover_intent, create_floating, create_presence and Escape dismissal (pointer safe-corridor keeps the card open while moving into it).

Parameters

NameTypeDescription
options?HoverCardOptions

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:692

create_hover_intent function

function create_hover_intent(options: HoverIntentOptions): { enter: (event?: PointerEvent, isTrigger?: boolean) => void; leave: (event?: PointerEvent) => void; clear: () => void; open_now: () => void; close_now: () => void; }

Headless hover-intent manager with safe-polygon pointer corridor and warm-group delay sharing.

Parameters

NameTypeDescription
optionsHoverIntentOptions
  • trigger: () => HTMLElement | null | undefined

    Trigger element getter.

  • popup: () => HTMLElement | null | undefined

    Popup element getter.

  • open: () => boolean

    Whether the popup is currently open.

  • on_open: () => void

    Opens the popup.

  • on_close: () => void

    Closes the popup.

  • open_delay?: number | (() => number)

    Open delay in ms when cold (default 120).

  • close_delay?: number | (() => number)

    Close delay in ms after leaving the safe corridor (default 80).

  • group?: string | null

    Shared warm-group key (default 'tooltip'; pass null to opt out).

  • warm_ms?: number

    Warm window in ms during which sibling hovers open immediately (default 250).

  • hoverable?: boolean | (() => boolean)

    Allow pointer to travel into popup content without closing (default true).

Source: packages/ui/src/behaviors/hover-intent.svelte.ts:121

create_image_cropper function

function create_image_cropper(options?: ImageCropperOptions): { readonly crop: CropRect; readonly zoom: number; readonly rotation: number; readonly mover: { readonly dragging: boolean; handle: Attachment<HTMLElement>; handle_attrs(): { tabindex: number; "aria-label": string | undefined; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }; readonly resizer: { readonly dragging: boolean; handle_attrs: (mode: "x" | "y" | "xy", label?: string) => { role: "separator"; tabindex: number; "aria-label": string | undefined; "data-dragging": string | undefined; onpointerdown: (down: PointerEvent) => void; onkeydown: (event: KeyboardEvent) => void; }; }; set_crop: (next: CropRect) => void; set_zoom: (next: number) => void; rotate: (deg?: number) => void; pixel_crop(naturalWidth: number, naturalHeight: number): { x: number; y: number; width: number; height: number; }; }

Headless image cropper with aspect-locked move & resize, zoom, rotation, pixel-crop export and Norbius control registration.

Parameters

NameTypeDescription
options?ImageCropperOptions

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1110

create_inline_edit function

function create_inline_edit(options: InlineEditOptions): { readonly editing: string | null; draft: string; is_editing(id: string): boolean; begin: (id: string, reason: InlineEditReason, initial?: string, origin?: HTMLElement | null) => void; commit: (reason?: InlineEditReason) => boolean; cancel: (reason?: InlineEditReason) => void; input: Attachment<HTMLInputElement | HTMLTextAreaElement>; cell_attrs(id: string): { "data-editing": string | undefined; ondblclick: (event: MouseEvent) => void; onkeydown: (event: KeyboardEvent) => void; }; input_attrs(): { value: string; oninput: (event: Event) => void; onkeydown: (event: KeyboardEvent) => void; onblur: () => void; }; }

Headless edit-in-place behavior for table cells, card titles and tree labels: Enter/F2/double-click edits preserving value, printable key replaces value, Enter/blur/Tab commits, Escape reverts and focus restores to the originating cell.

Parameters

NameTypeDescription
optionsInlineEditOptions
  • value: (id: string) => string

    Reads the current text for id when editing starts.

  • commit: (id: string, text: string, reason: InlineEditReason) => boolean | void

    Persists the edited text; return false to keep editing (e.g. validation error).

  • disabled?: (id: string) => boolean

    Optional disabled predicate per id.

  • on_tab?: (id: string, direction: 1 | -1) => void

    Called when Tab commits so an enclosing grid can advance to the next/previous cell.

Source: packages/ui/src/behaviors/grid.svelte.ts:394

create_input_history function

function create_input_history<T = string>(options: InputHistoryOptions<T>): { readonly index: number | null; readonly browsing: boolean; onkeydown: (event: KeyboardEvent) => void; reset: () => void; }

Terminal / chat-composer ArrowUp & ArrowDown history recall that preserves the user's unsent draft and only triggers when the caret sits on the first (ArrowUp) or last (ArrowDown) line.

Parameters

NameTypeDescription
optionsInputHistoryOptions<T>
  • entries: () => readonly T[]

    Past entries, oldest first.

  • read: () => T

    Reads the current composer value.

  • write: (value: T, event: KeyboardEvent) => boolean | void

    Writes a recalled value into the composer; return false to cancel navigation.

  • at_edge?: (direction: 'up' | 'down', event: KeyboardEvent) => boolean

    Custom edge detector; defaults to first/last line of <textarea> or anywhere in <input>.

Source: packages/ui/src/behaviors/micro.svelte.ts:40

create_lasso function

function create_lasso(options: LassoOptions): { readonly rect: LassoRect | null; readonly active: boolean; surface: Attachment<HTMLElement>; item: (key: string) => Attachment<HTMLElement>; }

Headless marquee / rubber-band drag selection over spatially positioned items.

Parameters

NameTypeDescription
optionsLassoOptions
  • on_change: (keys: readonly string[], rect: LassoRect) => void

    Called continuously as the marquee rectangle changes with intersecting item keys.

  • on_commit?: (keys: readonly string[]) => void

    Called when the marquee drag finishes.

Source: packages/ui/src/behaviors/canvas.svelte.ts:440

create_listbox function

function create_listbox<T extends ListboxItem = ListboxItem>(options: ListboxOptions<T>): { readonly id: string; query: string; readonly items: readonly T[]; readonly active: string; readonly active_id: string | undefined; readonly selected: readonly string[]; readonly count: number; is_selected: (key: string) => boolean; choose: (key: string) => void; toggle: (key: string) => void; toggle_all: () => void; clear: () => void; focus: (key: string) => void; highlight: (key: string) => void; activate_active(): void; item: (key: string) => import("svelte/attachments").Attachment<HTMLElement>; input_attrs(open?: boolean): { role: "combobox"; "aria-autocomplete": "list"; "aria-expanded": boolean; "aria-controls": string; "aria-activedescendant": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; list_attrs(): { id: string; role: "listbox"; "aria-multiselectable": true | undefined; onkeydown: (event: KeyboardEvent) => void; }; option_attrs(value: string): { id: string; role: "option"; "aria-selected": boolean; "aria-disabled": true | undefined; "data-selected": string | undefined; "data-highlighted": string | undefined; tabindex: number | undefined; onfocus: (() => void) | undefined; onpointerdown: ((event: PointerEvent) => void) | undefined; onpointermove: () => void; onclick: (event: MouseEvent) => void; }; }

Headless composable listbox combining create_selection, create_roving_focus (or virtual aria-activedescendant highlighting), create_typeahead and live query filtering.

Parameters

NameTypeDescription
optionsListboxOptions<T>
  • items: () => readonly T[]

    All items in visual order.

  • mode?: SelectionMode | (() => SelectionMode)

    Selection mode (default 'single').

  • focus?: ListboxFocusMode

    Focus strategy: 'dom' (default) or 'virtual' (aria-activedescendant).

  • selected?: () => readonly string[]

    Controlled selected values; omit for internal state.

  • default_selected?: readonly string[]

    Initial selected values when uncontrolled.

  • on_change?: (values: readonly string[]) => void

    Called when selection changes.

  • on_activate?: (item: T) => void

    Called when an item is explicitly activated (Enter / click in single mode).

  • filter?: false | ((item: T, query: string) => boolean)

    Optional custom filter; defaults to case-insensitive substring match on label + keywords. Pass false for externally filtered/async lists.

  • typeahead?: boolean

    Enable incremental typeahead when not typing in a search input (default true in 'dom' mode, false in 'virtual' mode).

  • loop?: boolean

    Wrap arrow navigation at list ends (default true).

  • id?: string

    Optional stable id prefix for aria-controls / aria-activedescendant.

Example

const lb = create_listbox({
  items: () => items.map((i) => ({ value: i.id, label: i.title })),
  on_activate: (item) => openItem(item.value)
});
// <input bind:value={lb.query} />
// <div {...lb.list_attrs()}>
//   {#each lb.items as item (item.value)}
//     <div {...lb.option_attrs(item.value)}>{item.label}</div>
//   {/each}
// </div>

Source: packages/ui/src/behaviors/listbox.svelte.ts:71

create_menu function

function create_menu<T extends MenuItem = MenuItem>(options: MenuOptions<T>): { readonly open: boolean; readonly active: string; readonly floating: { readonly x: number; readonly y: number; readonly side: FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: import("./floating.svelte.js").FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Attachment<HTMLElement>; }; open_at: (point: { x: number; y: number; }) => void; open_menu: () => void; close: () => void; toggle: () => void; trigger: Attachment<HTMLElement>; content: Attachment<HTMLElement>; context_area: Attachment<HTMLElement>; item: (key: string) => Attachment<HTMLElement>; trigger_attrs(): { type: "button"; "aria-haspopup": "menu"; "aria-expanded": boolean; "aria-controls": string | undefined; "data-state": "open" | "closed"; onclick: () => void; onkeydown: (event: KeyboardEvent) => void; }; menu_attrs(): { id: string; role: "menu"; "aria-label": string | undefined; "data-state": "open" | "closed"; "data-side": FloatingSide; style: string; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(id: string): { role: "menuitem" | "menuitemcheckbox" | "menuitemradio"; "aria-disabled": true | undefined; "aria-checked": boolean | undefined; "data-highlighted": string | undefined; "data-disabled": string | undefined; tabindex: number | undefined; onfocus: () => void; onpointermove: () => void; onclick: (event: MouseEvent) => void; }; }

Headless WAI-ARIA menu & context-menu behavior built on create_floating, create_roving_focus and create_typeahead.

Parameters

NameTypeDescription
optionsMenuOptions<T>
  • items: () => readonly T[]

    Ordered menu items.

  • open?: () => boolean

    Controlled open state; omit for internal state.

  • on_open_change?: (open: boolean) => void

    Called when open state changes.

  • on_select?: (item: T) => void

    Called when any enabled menu item is activated.

  • close_on_select?: boolean

    Close the menu after selecting a regular menuitem (default true).

  • side?: FloatingSide

    Preferred side relative to trigger (default 'bottom').

  • align?: FloatingAlign

    Cross-axis alignment relative to trigger (default 'start').

  • label?: string

    Accessible name for the menu.

  • control?: { readonly id: string; readonly label?: string; }

    Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/menu.svelte.ts:51

create_menubar function

function create_menubar(options: MenubarOptions): { readonly open_menu: string | null; is_open(id: string): boolean; open(id: string): void; close(): void; root: Attachment<HTMLElement>; item: (key: string) => Attachment<HTMLElement>; root_attrs(): { role: "menubar"; "aria-label": string; onkeydown: (event: KeyboardEvent) => void; }; trigger_attrs(id: string): { type: "button"; role: "menuitem"; "aria-haspopup": "menu"; "aria-expanded": boolean; "data-state": "open" | "closed"; tabindex: number | undefined; onfocus: () => void; onclick: () => void; onpointerenter: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Desktop application role="menubar" coordinator: horizontal roving focus across top-level menu triggers, hover-switch when any menu is open, cross-menu ArrowLeft/ArrowRight handoff and Escape close.

Parameters

NameTypeDescription
optionsMenubarOptions
  • menus: () => readonly string[]
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:412

create_move function

function create_move(options: MoveOptions): { readonly dragging: boolean; handle: Attachment<HTMLElement>; handle_attrs(): { tabindex: number; "aria-label": string | undefined; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }

Headless 2D free-move behavior (pointer drag + Arrow keys, optional grid snap & bounds).

Parameters

NameTypeDescription
optionsMoveOptions
  • position: () => MovePoint
  • on_change: (next: MovePoint) => void
  • on_commit?: (final: MovePoint) => void
  • step?: number
  • grid?: number
  • bounds?: () => { readonly min_x: number; readonly max_x: number; readonly min_y: number; readonly max_y: number; }
  • scale?: () => number
  • label?: string

Source: packages/ui/src/behaviors/canvas.svelte.ts:40

create_navigation_menu function

function create_navigation_menu(options: NavigationMenuOptions): { readonly active: string | null; is_open(id: string): boolean; open(id: string): void; close(): void; root: Attachment<HTMLElement>; item: (key: string) => Attachment<HTMLElement>; root_attrs(): { "aria-label": string; onpointerleave: () => void; onkeydown: (event: KeyboardEvent) => void; }; trigger_attrs(id: string): { type: "button"; "aria-expanded": boolean; "data-state": "open" | "closed"; tabindex: number | undefined; onfocus: () => void; onpointerenter: () => void; onclick: () => void; }; content_attrs(): { onpointerenter: () => void; onpointerleave: () => void; }; }

Site/app mega-menu navigation behavior: hover-intent opening with shared warm group, click toggle, keyboard roving focus across top-level triggers and Escape/outside dismissal.

Parameters

NameTypeDescription
optionsNavigationMenuOptions
  • items: () => readonly string[]
  • open_delay?: number
  • close_delay?: number
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:535

create_number_input function

function create_number_input(options?: NumberInputOptions): { readonly value: number | null; readonly text: string; set: (next: number | null) => void; increment: () => void; decrement: () => void; increment_button: import("svelte/attachments").Attachment<HTMLElement>; decrement_button: import("svelte/attachments").Attachment<HTMLElement>; input_attrs(): { role: "spinbutton"; inputmode: "decimal" | "numeric"; value: string; disabled: true | undefined; "aria-label": string | undefined; "aria-valuemin": number | undefined; "aria-valuemax": number | undefined; "aria-valuenow": number | undefined; oninput: (event: Event) => void; onblur: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless WAI-ARIA spinbutton number input with clamped stepping, Arrow/Page/Home/End keys, press-and-hold increment/decrement attachments (bind_repeat) and clean empty/numeric parsing.

Parameters

NameTypeDescription
options?NumberInputOptions

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:278

create_overflow function

function create_overflow<T>(options: OverflowOptions<T>): { readonly fit: number; readonly visible: readonly T[]; readonly hidden: readonly T[]; readonly has_overflow: boolean; readonly active_in_hidden: boolean; more_open: boolean; list: Attachment<HTMLElement>; measure: Attachment<HTMLElement>; }

Headless ResizeObserver-backed overflow behavior. Attach list to the visible strip and measure to an off-screen mirror containing every item plus the trailing overflow trigger; read visible, hidden and active_in_hidden reactively.

Parameters

NameTypeDescription
optionsOverflowOptions<T>
  • items: () => readonly T[]

    All items in display order.

  • key?: (item: T) => string

    Key extractor for checking whether the active item is currently inside the overflow menu.

  • active?: () => string | undefined

    Currently active key (optional).

Source: packages/ui/src/behaviors/overflow.svelte.ts:25

create_overlay_stack function

function create_overlay_stack<Payload, Result = unknown>(): { readonly stack: readonly OverlayEntry<Payload, Result>[]; readonly top: OverlayEntry<Payload, Result> | null; readonly count: number; open: (payload: Payload) => { readonly id: string; readonly promise: Promise<Result | undefined>; }; close: (id: string, result?: Result) => void; close_top: (result?: Result) => void; close_all: () => void; }

Imperative LIFO overlay/modal stack manager: open(payload) returns a Promise that settles when close(id, result) or Escape dismisses that overlay layer.

Source: packages/ui/src/behaviors/platform.svelte.ts:458

create_pagination function

function create_pagination(options: PaginationOptions): { readonly page: number; readonly pages: number | null; readonly has_previous: boolean; readonly has_next: boolean; readonly range: PaginationEntry[]; go: (target: number) => void; previous: () => void; next: () => void; first: () => void; last: () => void; }

Headless pagination behavior supporting both offset (total_pages) and keyset (has_previous/has_next) views.

Parameters

NameTypeDescription
optionsPaginationOptions
  • page?: () => number

    Current 1-based page number (controlled getter, or omit for internal state).

  • default_page?: number

    Initial 1-based page when uncontrolled (default 1).

  • total_pages: () => number | null

    Total page count (null when unknown / keyset-paged).

  • has_previous?: () => boolean

    Explicit previous availability override (for cursor/keyset pagination).

  • has_next?: () => boolean

    Explicit next availability override (for cursor/keyset pagination).

  • on_page_change?: (page: number) => void

    Called when the page changes.

  • siblings?: number

    Sibling pages shown on each side of the current page in range (default 1).

  • control?: { id: string; label?: string; }

    Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/pagination.svelte.ts:61

create_panel_group function

function create_panel_group(options: PanelGroupOptions): { readonly sizes: readonly number[]; readonly dragging: number | null; size_of(index: number): number; reset: () => void; container: Attachment<HTMLElement>; handle: (handleIndex: number) => Attachment<HTMLElement>; handle_attrs(handleIndex: number): { role: "separator"; tabindex: number; "aria-orientation": "horizontal" | "vertical"; "aria-valuenow": number; "aria-valuemin": number; "aria-valuemax": number; "data-dragging": string | undefined; ondblclick: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Multi-pane percentage resizable layout group (role="separator" handles between adjacent panes) with min/max clamping, collapsible snap-to-zero, double-click reset, keyboard stepping and optional persistence.

Parameters

NameTypeDescription
optionsPanelGroupOptions
  • panels: readonly PanelSpec[]
  • direction?: 'horizontal' | 'vertical'
  • storage_key?: string
  • on_layout?: (sizes: readonly number[]) => void
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:48

create_password_input function

function create_password_input(options?: PasswordInputOptions): { readonly visible: boolean; readonly caps_lock: boolean; toggle: () => void; set_visible(next: boolean): void; input: Attachment<HTMLInputElement>; input_attrs(): { type: "text" | "password"; "data-agent-secret": string; "aria-label": string | undefined; onkeydown: (event: KeyboardEvent) => void; onkeyup: (event: KeyboardEvent) => void; }; toggle_attrs(): { type: "button"; "aria-pressed": boolean; "aria-label": string; onclick: () => void; }; }

Headless password input behavior: visibility toggle, CapsLock warning detection and automatic data-agent-secret protection so secret values never leak into agent snapshots.

Parameters

NameTypeDescription
options?PasswordInputOptions

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:888

create_pin_input function

function create_pin_input(options: PinInputOptions): { readonly value: string; readonly cells: readonly PinCell[]; readonly focused: boolean; set_value: (raw: string) => void; input_attrs(): { value: string; maxlength: number; disabled: true | undefined; onfocus: (event: FocusEvent) => void; onblur: () => void; oninput: (event: Event) => void; onkeyup: (event: KeyboardEvent) => void; onselect: (event: Event) => void; }; }

Headless PIN / OTP input behavior exposing reactive cells, value and native input_attrs().

Parameters

NameTypeDescription
optionsPinInputOptions
  • length: number | (() => number)

    Number of cells (e.g. 6).

  • value?: () => string

    Controlled value getter; omit for internal state.

  • default_value?: string

    Initial value when uncontrolled.

  • on_value_change?: (value: string) => void

    Called whenever the sanitized value changes.

  • on_complete?: (value: string) => void

    Called when the value reaches length characters.

  • pattern?: RegExp

    Allowed character filter regex (default digits only /^\d+$/).

  • disabled?: () => boolean

    Disabled state.

  • control?: { readonly id: string; readonly label?: string; readonly secret?: boolean; readonly element?: () => HTMLElement | null; }

    Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/pin.svelte.ts:48

create_pointer_kind function

function create_pointer_kind(): { readonly precision: PointerPrecision; readonly hover: boolean; readonly coarse: boolean; }

Reactive primary pointer precision (coarse/fine) and hover capability store.

Source: packages/ui/src/behaviors/platform.svelte.ts:120

create_presence function

function create_presence(options: PresenceOptions): { readonly present: boolean; readonly state: PresenceState; readonly exiting: boolean; attach: Attachment<HTMLElement>; }

Keeps an element mounted while closing until its CSS/WAAPI exit animation finishes. Writes data-starting-style on the first frame after mount and data-ending-style during exit. In environments without animations (or under reduced motion), unmounts synchronously.

Parameters

NameTypeDescription
optionsPresenceOptions
  • open: () => boolean

    Reactive open getter.

  • on_complete?: (open: boolean) => void

    Called once enter or exit settles.

Source: packages/ui/src/behaviors/presence.svelte.ts:115

create_preview function

function create_preview<T>(options: PreviewOptions<T>): { readonly current: T; readonly previewing: boolean; update: (next: T) => void; commit: (finalValue?: T) => void; cancel: () => void; }

Holds a live transient pointer-drag/scrub preview value over an authoritative value, with clean commit() and cancel() transitions.

Parameters

NameTypeDescription
optionsPreviewOptions<T>
  • value: () => T

    Committed authoritative value.

  • on_commit: (value: T) => void

    Called when a preview is explicitly committed.

Source: packages/ui/src/behaviors/platform.svelte.ts:339

create_radio_group function

function create_radio_group(options: RadioGroupOptions): { readonly value: string | undefined; select: (next: string) => void; item: (key: string) => import("svelte/attachments").Attachment<HTMLElement>; root_attrs(): { role: "radiogroup"; "aria-label": string | undefined; "aria-orientation": "horizontal" | "vertical"; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(key: string): { type: "button"; role: "radio"; "aria-checked": boolean; "aria-disabled": true | undefined; "data-state": "checked" | "unchecked"; tabindex: number | undefined; onfocus: () => void; onclick: () => void; }; }

Headless WAI-ARIA radiogroup (also powers Segmented Controls): single tab stop, arrow keys move focus and select simultaneously.

Parameters

NameTypeDescription
optionsRadioGroupOptions
  • items: () => readonly string[]
  • value?: () => string | undefined
  • default_value?: string
  • on_change?: (value: string) => void
  • orientation?: RovingOrientation
  • disabled?: (value: string) => boolean
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:101

create_rating function

function create_rating(options?: RatingOptions): { readonly value: number; readonly hovered: number | null; readonly display: number; items: number[]; rate: (next: number) => void; item: (score: number) => import("svelte/attachments").Attachment<HTMLElement>; root_attrs(): { role: "radiogroup"; "aria-label": string; onpointerleave: () => void; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(score: number): { type: "button"; role: "radio"; "aria-checked": boolean; "aria-label": string; "data-filled": string | undefined; disabled: true | undefined; tabindex: number | undefined; onfocus: () => void; onpointerenter: () => void; onclick: () => void; }; }

Headless star/score rating picker (radiogroup, hover preview, Arrow/Home/End keys).

Parameters

NameTypeDescription
options?RatingOptions

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:424

create_reorder function

function create_reorder(options: ReorderOptions): { readonly dragging: string | null; readonly over: string | null; move(fromIndex: number, toIndex: number): void; move_by: (key: string, delta: number) => void; item(key: string): Attachment<HTMLElement>; item_attrs(key: string): { draggable: boolean; "data-dragging": string | undefined; "data-drop-target": string | undefined; ondragstart: (event: DragEvent) => void; ondragover: (event: DragEvent) => void; ondragleave: () => void; ondrop: (event: DragEvent) => void; ondragend: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless pointer + keyboard reordering behavior for queues, lanes, checklists and columns.

Parameters

NameTypeDescription
optionsReorderOptions
  • items: () => readonly string[]

    Ordered item keys.

  • on_reorder: (from: number, to: number, next: readonly string[]) => void

    Invoked with (fromIndex, toIndex, nextOrder) when an item moves.

  • orientation?: ReorderOrientation

    Axis for movement (default 'vertical').

  • disabled?: boolean | ((key: string) => boolean)

    Disable reordering globally or for a specific key.

  • label?: (key: string) => string

    Optional human-readable label per key for live announcements.

Source: packages/ui/src/behaviors/reorder.svelte.ts:42

create_resize function

function create_resize(options: ResizeOptions): { readonly dragging: boolean; handle_attrs(): { role: "separator"; "aria-orientation": "horizontal" | "vertical"; "aria-label": string | undefined; "aria-valuenow": number; "aria-valuemin": number; "aria-valuemax": number | undefined; tabindex: number; "data-dragging": string | undefined; onpointerdown: (event: PointerEvent) => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless 1D pointer + keyboard resize handle behavior (handle_attrs()).

Parameters

NameTypeDescription
optionsResizeOptions
  • value: () => number

    Current size in pixels (reactive getter).

  • on_change: (next: number) => void

    Called with the clamped pixel size during drag and keyboard nudges.

  • on_commit?: (final: number) => void

    Called once when a pointer drag finishes.

  • axis?: 'horizontal' | 'vertical'

    Axis of drag movement (default 'horizontal').

  • invert?: boolean

    Invert drag delta (e.g. dragging a right-docked sheet's left edge leftward widens it).

  • min?: number | (() => number)

    Minimum size in pixels (default 120).

  • max?: number | (() => number)

    Maximum size in pixels (default Infinity).

  • scale?: number | (() => number)

    Optional zoom divisor for scaled canvases/preview frames (default 1).

  • step?: number

    Keyboard Arrow nudge increment in pixels (default 24).

  • label?: string

    Accessible label for the separator handle.

Source: packages/ui/src/behaviors/resize.svelte.ts:41

create_resize_box function

function create_resize_box(options: ResizeBoxOptions): { readonly dragging: boolean; handle_attrs: (mode: "x" | "y" | "xy", label?: string) => { role: "separator"; tabindex: number; "aria-label": string | undefined; "data-dragging": string | undefined; onpointerdown: (down: PointerEvent) => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless 2D edge & corner resize behavior supporting 'x', 'y' and 'xy' handles with zoom scaling.

Parameters

NameTypeDescription
optionsResizeBoxOptions
  • size: () => ResizeBox
  • on_change: (next: ResizeBox) => void
  • on_commit?: (final: ResizeBox) => void
  • min_width?: number
  • max_width?: number
  • min_height?: number
  • max_height?: number
  • scale?: () => number
  • step?: number

Source: packages/ui/src/behaviors/resize.svelte.ts:162

create_roving_focus function

function create_roving_focus(options: RovingFocusOptions): { readonly active: string; focus(key: string): void; next(): void; prev(): void; item(key: string): Attachment<HTMLElement>; root_attrs(): { onkeydown: (event: KeyboardEvent) => void; }; item_attrs(key: string): { tabindex: number | undefined; "data-roving-active": string | undefined; onfocus: () => void; }; }

Headless roving-tabindex focus manager with automatic focus recovery when items leave the DOM.

Parameters

NameTypeDescription
optionsRovingFocusOptions
  • items: () => readonly string[]

    Keys in navigation order.

  • active?: () => string | undefined

    Controlled active key; omit for internal focus tracking.

  • on_active_change?: (key: string) => void

    Called when keyboard navigation moves focus to a key.

  • orientation?: RovingOrientation | (() => RovingOrientation)

    Axis of arrow navigation (default 'horizontal').

  • loop?: boolean

    Wrap from last back to first and vice versa (default true).

  • disabled?: (key: string) => boolean

    Skip disabled keys during keyboard movement.

  • on_activate?: (key: string) => void

    Optional callback invoked when Space or Enter activates the focused item.

Source: packages/ui/src/behaviors/roving-focus.svelte.ts:34

create_selection function

function create_selection(options: SelectionOptions): { readonly selected: readonly string[]; readonly count: number; readonly all_selected: boolean; readonly some_selected: boolean; is_selected(key: string): boolean; choose: (key: string) => void; toggle: (key: string) => void; extend: (to: string, opts?: { from?: string | null; additive?: boolean; }) => void; toggle_all: () => void; clear: () => void; item_attrs(key: string): { "aria-selected": boolean; "data-selected": string | undefined; "aria-disabled": true | undefined; onclick: (event: MouseEvent) => void; }; }

Headless single/multi/range selection behavior for lists, tables, boards, timelines and pickers. Spread item_attrs(key) onto each item to get aria-selected, data-selected and native click / Shift+click / Cmd+click handling automatically.

Parameters

NameTypeDescription
optionsSelectionOptions
  • order: () => readonly string[]

    Keys in visual order (used for Shift ranges and select-all).

  • mode?: SelectionMode | (() => SelectionMode)

    Single or multiple selection (default 'single').

  • selected?: () => readonly string[]

    Controlled selected keys; omit for internal state.

  • default_selected?: readonly string[]

    Initial selected keys when uncontrolled.

  • on_change?: (keys: readonly string[]) => void

    Called with the next selection whenever it changes.

  • selectable?: (key: string) => boolean

    Whether a key may be selected (default every key).

Source: packages/ui/src/behaviors/selection.svelte.ts:58

create_shortcuts function

function create_shortcuts(bindings: readonly ShortcutBinding[] | (() => readonly ShortcutBinding[]), options?: { readonly target?: () => EventTarget | null; readonly chord_timeout_ms?: number; }): void

Binds one or more keyboard shortcuts (including multi-key chord sequences like 'g i') while mounted, cleaning up automatically when the enclosing component tears down.

Parameters

NameTypeDescription
bindingsreadonly ShortcutBinding[] | (() => readonly ShortcutBinding[])
options?{ readonly target?: () => EventTarget | null; readonly chord_timeout_ms?: number; }

Source: packages/ui/src/behaviors/shortcuts.svelte.ts:153

create_slider function

function create_slider(options?: SliderOptions): { readonly value: number; readonly values: readonly number[]; readonly percent: number; readonly percents: number[]; readonly dragging: boolean; readonly active_thumb: number; set(next: number, index?: number): void; track: Attachment<HTMLElement>; thumb_attrs(index?: number): { role: "slider"; "aria-orientation": "horizontal" | "vertical"; "aria-label": string | undefined; "aria-valuemin": number; "aria-valuemax": number; "aria-valuenow": number; "aria-disabled": true | undefined; tabindex: number | undefined; "data-dragging": string | undefined; onfocus: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless single- or multi-thumb slider behavior (track attachment + thumb_attrs(index?)).

Parameters

NameTypeDescription
options?SliderOptions

Source: packages/ui/src/behaviors/slider.svelte.ts:54

create_spans function

function create_spans<S extends Span = Span>(options: SpansOptions<S>): { readonly spans: readonly S[]; readonly active: string | null; update_span: (id: string, patch: Partial<Pick<Span, "track" | "start" | "end">>, action: "move" | "resize", commitNow?: boolean) => void; create: (track: string, start: number, end: number) => void; remove: (id: string) => void; cancel(): void; span_attrs: (span: S) => { tabindex: number; "data-span-id": string; "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }

Headless track-span editor (week calendars, Gantt charts, room schedulers): move along or across tracks, resize start/end edges, draw new spans and delete — all snapped to step with keyboard support.

Parameters

NameTypeDescription
optionsSpansOptions<S>
  • tracks: () => readonly string[]
  • spans: () => readonly S[]
  • min: number
  • max: number
  • step?: number
  • min_duration?: number
  • on_commit: (next: readonly S[], action: 'draw' | 'move' | 'resize' | 'delete', id: string) => void
  • create_span?: (draft: Span) => S

Source: packages/ui/src/behaviors/canvas.svelte.ts:324

create_stick_to_bottom function

function create_stick_to_bottom(options?: StickToBottomOptions): { readonly stuck: boolean; scroll_to_bottom: (behavior?: ScrollBehavior) => void; viewport: Attachment<HTMLElement>; }

Headless tail-latching scroll attachment ({@attach tail.viewport}).

Parameters

NameTypeDescription
options?StickToBottomOptions

Source: packages/ui/src/behaviors/stick-to-bottom.svelte.ts:20

create_swipe_actions function

function create_swipe_actions(options?: SwipeActionsOptions): { readonly open: SwipeOpen | null; readonly offset: { readonly key: string; readonly x: number; } | null; close: () => void; row: (key: string) => Attachment<HTMLElement>; row_attrs: (key: string) => { "data-swipe-open": SwipeSide | undefined; style: string; onkeydown: (event: KeyboardEvent) => void; }; }

Mail-style row swipe-to-reveal actions with rubber-band resistance, full-swipe trigger and ArrowLeft/ArrowRight/Escape keyboard parity.

Parameters

NameTypeDescription
options?SwipeActionsOptions

Source: packages/ui/src/behaviors/canvas.svelte.ts:747

create_switch function

function create_switch(options?: SwitchOptions): { readonly checked: boolean; readonly disabled: boolean; set_checked: (next: boolean) => void; toggle: () => void; attrs(): { type: "button"; role: "switch"; "aria-checked": boolean; "aria-label": string | undefined; "data-state": "checked" | "unchecked"; disabled: true | undefined; onclick: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless WAI-ARIA switch behavior (role="switch", aria-checked, Space/Enter toggle).

Parameters

NameTypeDescription
options?SwitchOptions

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:23

create_time_field function

function create_time_field(options: TimeFieldOptions): { readonly segments: readonly DateTimeSegment[]; segment_ref(part: SegmentPart): Attachment<HTMLElement>; segment_attrs(seg: DateTimeSegment): { "aria-hidden": true; "data-segment": "literal"; role?: undefined; tabindex?: undefined; "aria-label"?: undefined; "aria-valuemin"?: undefined; "aria-valuemax"?: undefined; "aria-valuenow"?: undefined; "aria-valuetext"?: undefined; "aria-disabled"?: undefined; onkeydown?: undefined; onblur?: undefined; } | { role: "spinbutton"; tabindex: number | undefined; "data-segment": "hour" | "minute"; "aria-label": "hour" | "minute"; "aria-valuemin": number; "aria-valuemax": number; "aria-valuenow": number | undefined; "aria-valuetext": string; "aria-disabled": true | undefined; onkeydown: (e: KeyboardEvent) => void; onblur: () => void; "aria-hidden"?: undefined; }; }

Headless 24-hour segmented time-of-day field behavior (hour and optional minute).

Parameters

NameTypeDescription
optionsTimeFieldOptions
  • value: () => Time | undefined

    Controlled Time getter.

  • on_change: (next: Time | undefined) => void

    Called when the time value changes (or clears to undefined).

  • granularity?: () => 'hour' | 'minute'

    Editing precision: 'hour' or 'minute' (default 'minute').

  • disabled?: () => boolean

    Disabled state.

Source: packages/ui/src/behaviors/date-time.svelte.ts:437

create_timeline function

function create_timeline(options: TimelineOptions): { readonly expanded: readonly string[]; is_expanded(id: string): boolean; toggle: (id: string) => void; item: (key: string) => Attachment<HTMLElement>; root_attrs(): { role: "feed"; "aria-label": string; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(id: string): { role: "article"; "aria-expanded": boolean; "data-expanded": string | undefined; tabindex: number | undefined; onfocus: () => void; }; }

Accessible activity timeline behavior (role="feed" / ordered expandable entries) with vertical keyboard navigation, per-entry expand/collapse and Norbius control registration.

Parameters

NameTypeDescription
optionsTimelineOptions
  • items: () => readonly string[]
  • default_expanded?: readonly string[]
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1350

create_toggle_group function

function create_toggle_group(options: ToggleGroupOptions): { readonly pressed: readonly string[]; is_pressed(key: string): boolean; toggle: (key: string) => void; item: (key: string) => import("svelte/attachments").Attachment<HTMLElement>; root_attrs(): { role: "group"; "aria-label": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(key: string): { type: "button"; "aria-pressed": boolean; "data-state": "on" | "off"; disabled: true | undefined; tabindex: number | undefined; onfocus: () => void; onclick: () => void; }; }

Headless toggle button group (aria-pressed, single or multi-select, roving focus).

Parameters

NameTypeDescription
optionsToggleGroupOptions
  • items: () => readonly string[]
  • mode?: 'single' | 'multiple'
  • value?: () => readonly string[]
  • default_value?: readonly string[]
  • on_change?: (values: readonly string[]) => void
  • orientation?: RovingOrientation
  • disabled?: (key: string) => boolean
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:183

create_token_input function

function create_token_input(options?: TokenInputOptions): { readonly values: readonly string[]; input_text: string; readonly active_index: number | null; readonly editing_index: number | null; editing_text: string; readonly error: string | null; add: (raw: string) => boolean; remove_at: (index: number) => void; commit_input: () => void; start_edit: (index: number) => void; commit_edit: () => void; cancel_edit: () => void; input: Attachment<HTMLInputElement>; chip: (index: number) => Attachment<HTMLElement>; input_attrs(): { value: string; disabled: true | undefined; "aria-label": string | undefined; onfocus: () => void; oninput: (event: Event) => void; onpaste: (event: ClipboardEvent) => void; onkeydown: (event: KeyboardEvent) => void; onblur: () => void; }; chip_attrs(index: number): { tabindex: number; "data-active": string | undefined; "data-editing": string | undefined; onfocus: () => void; ondblclick: () => void; onkeydown: (event: KeyboardEvent) => void; }; }

Headless chip/tag/recipient token input: splits on delimiters & paste, navigates chips with ArrowLeft/ArrowRight/Home/End, Backspace selects/deletes the last chip, supports inline chip editing and registers with Norbius's control bridge.

Parameters

NameTypeDescription
options?TokenInputOptions

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:45

create_toolbar function

function create_toolbar(options: ToolbarOptions): { readonly active: string; focus: (key: string) => void; item: (key: string) => import("svelte/attachments").Attachment<HTMLElement>; root_attrs(): { role: "toolbar"; "aria-label": string | undefined; "aria-orientation": "horizontal" | "vertical"; onkeydown: (event: KeyboardEvent) => void; }; item_attrs: (key: string) => { tabindex: number | undefined; "data-roving-active": string | undefined; onfocus: () => void; }; }

Headless WAI-ARIA role="toolbar" single-tab-stop roving container.

Parameters

NameTypeDescription
optionsToolbarOptions
  • items: () => readonly string[]
  • orientation?: RovingOrientation
  • disabled?: (key: string) => boolean
  • label?: string

Source: packages/ui/src/behaviors/controls-extra.svelte.ts:501

create_transfer function

function create_transfer(options: TransferOptions): { readonly lists: Readonly<Record<string, readonly string[]>>; readonly draft: TransferDraft | null; readonly dragging: string | null; move: (key: string, to: string, index: number, commitNow?: boolean) => void; container(id: string): Attachment<HTMLElement>; item(key: string): Attachment<HTMLElement>; item_attrs(key: string): { "data-dragging": string | undefined; onkeydown: (event: KeyboardEvent) => void; }; }

Headless cross-container drag-and-drop + keyboard transfer (Kanban boards, folder lists, team rosters) with live draft preview, edge auto-scrolling and screen-reader announcements.

Parameters

NameTypeDescription
optionsTransferOptions
  • containers: () => readonly string[]

    Ordered container keys (e.g. Kanban lane ids).

  • lists: () => TransferLists

    Current lists per container.

  • on_commit: (next: TransferLists, move: { readonly key: string; readonly from: string; readonly to: string; readonly index: number; }) => void

    Called once on drop or keyboard commit with the next container map.

  • can_drop?: (key: string, toContainer: string) => boolean

    Optional predicate rejecting moves into a container.

  • item_label?: (key: string) => string

    Human-readable item label for screen-reader announcements.

  • container_label?: (container: string) => string

    Human-readable container label for screen-reader announcements.

Source: packages/ui/src/behaviors/drag.svelte.ts:299

create_tree function

function create_tree<T = unknown>(options: TreeOptions<T>): { readonly rows: FlatTreeRow<T>[]; readonly expanded: readonly string[]; readonly selected: readonly string[]; readonly active: string; expand: (id: string) => void; collapse: (id: string) => void; toggle_expand: (id: string) => void; is_expanded(id: string): boolean; is_selected: (key: string) => boolean; item: (key: string) => import("svelte/attachments").Attachment<HTMLElement>; root_attrs(): { role: "tree"; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(id: string): { role: "treeitem"; "aria-level": number; "aria-expanded": boolean | undefined; "aria-selected": boolean; "aria-disabled": true | undefined; "data-selected": string | undefined; "data-expanded": string | undefined; tabindex: number | undefined; onfocus: () => void; onclick: (event: MouseEvent) => void; }; }

Headless WAI-ARIA tree behavior with ArrowRight expand/descend, ArrowLeft collapse/ascend, typeahead, roving tabindex, focus recovery on collapse, selection and optional agent control registration.

Parameters

NameTypeDescription
optionsTreeOptions<T>
  • nodes: () => readonly TreeNode<T>[]

    Root tree nodes.

  • default_expanded?: readonly string[]

    Initial expanded node ids.

  • expanded?: () => readonly string[]

    Controlled expanded node ids.

  • on_expanded_change?: (ids: readonly string[]) => void

    Called when expanded node ids change.

  • mode?: SelectionMode

    Selection mode (default 'single').

  • selected?: () => readonly string[]

    Controlled selected ids.

  • on_select?: (ids: readonly string[]) => void

    Called when selection changes.

  • control?: { readonly id: string; readonly label?: string; }

    Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/tree.svelte.ts:240

create_tree_reorder function

function create_tree_reorder(options: TreeReorderOptions): { readonly dragging: string | null; readonly drop: TreePlace | null; commit: (id: string, place: TreePlace) => void; item(id: string): Attachment<HTMLElement>; item_attrs(id: string): { "data-dragging": string | undefined; "data-drop-position": "before" | "inside" | "after" | undefined; onkeydown: (event: KeyboardEvent) => void; }; }

Headless hierarchical tree reordering (pointer drop zones: top 25% before, middle 50% inside, bottom 25% after; plus Alt+ArrowUp/Down/Left/Right keyboard reparenting) with subtree cycle guard.

Parameters

NameTypeDescription
optionsTreeReorderOptions
  • rows: () => readonly TreeReorderRow[]

    Visible pre-order tree rows.

  • on_move: (id: string, place: TreePlace) => void

    Invoked when a node (with its subtree) moves to place.

  • can_drop?: (id: string, place: TreePlace) => boolean

    Optional predicate forbidding drops into/around a target.

Source: packages/ui/src/behaviors/drag.svelte.ts:497

create_trigger_menu function

function create_trigger_menu<T extends TriggerMenuItem = TriggerMenuItem>(options: TriggerMenuOptions<T>): { readonly open: boolean; readonly match: TriggerMatch | null; readonly items: readonly T[]; readonly path: readonly T[]; readonly active_index: number; readonly floating: { readonly x: number; readonly y: number; readonly side: import("./floating.svelte.js").FloatingSide; readonly anchor_width: number; readonly available_width: number; readonly available_height: number; readonly positioned: boolean; readonly style: string; set_anchor(next: import("./floating.svelte.js").FloatingAnchor | null): void; update: () => void; anchor: Attachment<HTMLElement>; content: Attachment<HTMLElement>; }; close: () => void; select: (item: T) => void; pop_level(): void; field: Attachment<HTMLInputElement | HTMLTextAreaElement>; content: Attachment<HTMLElement>; input_attrs(): { "aria-expanded": boolean; "aria-haspopup": "listbox"; "aria-activedescendant": string | undefined; oninput: (event: Event) => void; onkeyup: (event: KeyboardEvent) => void; onkeydown: (event: KeyboardEvent) => void; }; option_attrs(item: T, index: number): { id: string; role: "option"; "aria-selected": boolean; "aria-disabled": true | undefined; "data-highlighted": string | undefined; onpointerenter: () => void; onmousedown: (event: MouseEvent) => void; onclick: () => void; }; }

Inline @mention / / slash-command trigger menu for <input> and <textarea>: tracks caret trigger matches, fuzzy-filters items, supports nested sub-menus (children), keyboard navigation (ArrowUp/ArrowDown/Enter/Tab/Escape), floating anchor positioning and Norbius control registration.

Parameters

NameTypeDescription
optionsTriggerMenuOptions<T>
  • triggers: readonly string[]

    Trigger prefixes that open the menu (e.g. ['@', '/']).

  • items: (trigger: string, query: string, path: readonly T[]) => readonly T[]

    Returns items for the active trigger & nested level stack.

  • on_select: (item: T, match: TriggerMatch, insertText: string) => void

    Called when a leaf item is picked (receives item and replacement range).

  • control?: { readonly id: string; readonly label?: string; }

    Optional semantic control registration for Norbius's page bridge.

Source: packages/ui/src/behaviors/inputs-extra.svelte.ts:397

create_typeahead function

function create_typeahead(options: TypeaheadOptions): { onkeydown: (event: KeyboardEvent) => void; reset: () => void; readonly query: string; }

Headless incremental typeahead behavior. Pass onkeydown to any listbox, menu, rail or tab strip (composes directly alongside create_roving_focus).

Parameters

NameTypeDescription
optionsTypeaheadOptions
  • items: () => readonly TypeaheadItem[]

    Candidate items in visual order.

  • active?: () => string | undefined

    Currently active key (search wraps starting after this item).

  • on_match: (key: string) => void

    Invoked with the matched item's key.

  • timeout_ms?: number

    Buffer reset delay in ms (default 500).

Source: packages/ui/src/behaviors/typeahead.svelte.ts:28

create_ui_history function

function create_ui_history(options?: UiHistoryOptions): { readonly entries: readonly UiHistoryEntry[]; readonly position: number; readonly can_undo: boolean; readonly can_redo: boolean; undo: () => boolean; redo: () => boolean; undo_source: (source: ChangeSource) => number; destroy: () => void; }

Records live control changes via observe_controls and supports stepping backward/forward or reverting every non-redacted change made by one source (e.g. history.undo_source('agent')).

Parameters

NameTypeDescription
options?UiHistoryOptions

Source: packages/ui/src/behaviors/controls.svelte.ts:436

create_undo_stack function

function create_undo_stack<T>(initial: T, options?: UndoStackOptions): { readonly current: T; readonly can_undo: boolean; readonly can_redo: boolean; readonly length: number; record: (next: T, opts?: { readonly group?: string; readonly time?: number; }) => void; undo: () => T; redo: () => T; reset: (value: T) => void; }

Grouped undo/redo stack for any immutable state value. Consecutive edits with the same group arriving within group_delay_ms coalesce into one undo entry.

Parameters

NameTypeDescription
initialT
options?UndoStackOptions

Source: packages/ui/src/behaviors/micro.svelte.ts:115

create_velocity_tracker function

function create_velocity_tracker(): { add(position: number, time?: number): void; velocity(): number; reset(): void; }

Exponentially weighted pointer velocity tracker (pixels per millisecond).

Source: packages/ui/src/behaviors/motion.svelte.ts:18

create_viewport function

function create_viewport(options?: ViewportOptions): { readonly x: number; readonly y: number; readonly zoom: number; readonly panning: boolean; readonly transform: string; set_camera: (next: Partial<ViewportCamera>) => void; zoom_at: (factor: number, originX: number, originY: number) => void; reset(): void; surface: Attachment<HTMLElement>; }

Headless pan/zoom canvas viewport with pointer panning, wheel-to-zoom around cursor, fit and reset.

Parameters

NameTypeDescription
options?ViewportOptions

Source: packages/ui/src/behaviors/canvas.svelte.ts:533

create_waterfall function

function create_waterfall<T extends WaterfallItem = WaterfallItem>(options: WaterfallOptions<T>): { readonly rows: import("./tree.svelte.js").FlatTreeRow<T>[]; readonly min: number; readonly max: number; readonly view_start: number; readonly view_end: number; readonly tree: { readonly rows: import("./tree.svelte.js").FlatTreeRow<T>[]; readonly expanded: readonly string[]; readonly selected: readonly string[]; readonly active: string; expand: (id: string) => void; collapse: (id: string) => void; toggle_expand: (id: string) => void; is_expanded(id: string): boolean; is_selected: (key: string) => boolean; item: (key: string) => Attachment<HTMLElement>; root_attrs(): { role: "tree"; onkeydown: (event: KeyboardEvent) => void; }; item_attrs(id: string): { role: "treeitem"; "aria-level": number; "aria-expanded": boolean | undefined; "aria-selected": boolean; "aria-disabled": true | undefined; "data-selected": string | undefined; "data-expanded": string | undefined; tabindex: number | undefined; onfocus: () => void; onclick: (event: MouseEvent) => void; }; }; bar_rect: (item: WaterfallItem) => { readonly left_pct: number; readonly width_pct: number; }; zoom(start: number, end: number): void; reset_zoom(): void; }

Hierarchical trace/Gantt waterfall behavior composing create_tree with automatic time-domain bounds, zoomable [view_start, view_end] window and percentage bar placement (bar_rect).

Parameters

NameTypeDescription
optionsWaterfallOptions<T>
  • items: () => readonly T[]
  • on_select?: (id: string) => void
  • label?: string
  • control?: { readonly id: string; readonly label?: string; }

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:1244

current_modality function

function current_modality(): InputModality

Returns the current global input modality ('keyboard' or 'pointer').

Source: packages/ui/src/behaviors/platform.svelte.ts:270

current_source function

function current_source(): ChangeSource

Returns the currently attributed change source ('pointer' | 'keyboard' | 'agent' | 'programmatic').

Source: packages/ui/src/behaviors/controls.svelte.ts:108

describe_controls function

function describe_controls(options?: PageControlsOptions): string

Concise one-line summary of registered controls for Norbius's pageScreen() context.

Parameters

NameTypeDescription
options?PageControlsOptions

Source: packages/ui/src/behaviors/controls.svelte.ts:390

format_color function

function format_color(color: RgbaColor, format?: "hex" | "rgb" | "hsl"): string

Formats an RgbaColor as 'hex', 'rgb' or 'hsl'.

Parameters

NameTypeDescription
colorRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number
format?'hex' | 'rgb' | 'hsl'

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:929

format_shortcut function

function format_shortcut(spec: string, platform?: "mac" | "other"): string

Formats a shortcut spec for human-readable UI badges (e.g. '⌘K' on macOS, 'Ctrl+K' elsewhere).

Parameters

NameTypeDescription
specstring
platform?'mac' | 'other'

Source: packages/ui/src/behaviors/shortcuts.svelte.ts:122

fuzzy_score function

function fuzzy_score(query: string, text: string): number

Accent- and case-insensitive fuzzy match score for query against text. Returns 0 when query does not match, or a positive relevance score (higher is better).

Parameters

NameTypeDescription
querystring
textstring

Source: packages/ui/src/behaviors/text-match.ts:125

get_portal_target function

function get_portal_target(): PortalTarget

Reads the inherited portal target from context, if configured.

Source: packages/ui/src/behaviors/portal.svelte.ts:29

hsl_to_rgb function

function hsl_to_rgb(color: HslaColor): RgbaColor

Converts HSL (h: 0..360, s: 0..100, l: 0..100) to RGBA (0..255).

Parameters

NameTypeDescription
colorHslaColor
  • h: number
  • s: number
  • l: number
  • a: number

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:828

hsv_to_rgb function

function hsv_to_rgb(color: HsvaColor): RgbaColor

Converts HSV (h: 0..360, s: 0..100, v: 0..100) to RGBA (0..255).

Parameters

NameTypeDescription
colorHsvaColor
  • h: number
  • s: number
  • v: number
  • a: number

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:867

inert_outside function

function inert_outside(keep: HTMLElement | readonly HTMLElement[]): InertHandle

Marks every sibling tree outside keep as inert (ref-counted across nested modals) while keeping live announcer regions active. Call .keep(el) to exempt a portaled overlay opened inside.

Parameters

NameTypeDescription
keepHTMLElement | readonly HTMLElement[]

Source: packages/ui/src/behaviors/modal.svelte.ts:145

input_hints function

function input_hints(kind: InputHintKind, overrides?: { readonly enterkeyhint?: EnterKeyHint; }): InputHints

Returns consistent mobile keyboard, autocomplete and spellcheck attributes for a semantic field kind.

Parameters

NameTypeDescription
kindInputHintKind
overrides?{ readonly enterkeyhint?: EnterKeyHint; }

Source: packages/ui/src/behaviors/micro.svelte.ts:461

invoke_control function

function invoke_control(ref: string, action: string, args?: readonly unknown[], options?: { readonly within?: Element | null; readonly allow_confirm?: boolean; }): ControlInvokeResult

Invokes a named semantic action on a registered control by id or accessible label, attributing the change to 'agent' and enforcing disabled/hidden/confirmation guards.

Parameters

NameTypeDescription
refstring
actionstring
args?readonly unknown[]
options?{ readonly within?: Element | null; readonly allow_confirm?: boolean; }

Source: packages/ui/src/behaviors/controls.svelte.ts:328

is_focus_from_keyboard function

function is_focus_from_keyboard(): boolean

Returns whether the most recent user interaction was keyboard-driven (for focus-visible heuristics).

Source: packages/ui/src/behaviors/platform.svelte.ts:264

is_span_free function

function is_span_free(spans: readonly Span[], track: string, start: number, end: number, ignoreId?: string): boolean

Returns whether [start, end) overlaps no existing span on track (excluding ignoreId).

Parameters

NameTypeDescription
spansreadonly Span[]
trackstring
startnumber
endnumber
ignoreId?string

Source: packages/ui/src/behaviors/canvas.svelte.ts:271

keep_focus function

function keep_focus(): Attachment<HTMLElement>

Attachment ({@attach keep_focus()}) that prevents pointerdown / mousedown on a button or toolbar control from stealing DOM focus away from an active text editor or input.

Source: packages/ui/src/behaviors/platform.svelte.ts:279

lock_scroll function

function lock_scroll(doc?: Document | undefined): () => void

Reference-counted document scroll lock. The first holder freezes the scroller without horizontal gutter shift; only the last release restores styles. Safe to call release multiple times.

Parameters

NameTypeDescription
doc?Document | undefined

Source: packages/ui/src/behaviors/modal.svelte.ts:70

match_ranges function

function match_ranges(query: string, text: string): readonly MatchRange[]

Returns sorted, non-overlapping [start, end) highlight spans where query matches text, or an empty array when query is blank or does not match.

Parameters

NameTypeDescription
querystring
textstring

Source: packages/ui/src/behaviors/text-match.ts:133

match_segments function

function match_segments(query: string, text: string): readonly MatchSegment[]

Splits text into alternating plain and matched segments for rendering search highlights without injecting raw HTML.

Parameters

NameTypeDescription
querystring
textstring

Source: packages/ui/src/behaviors/text-match.ts:141

matches_shortcut function

function matches_shortcut(event: KeyboardEvent, spec: string, options?: MatchShortcutOptions): boolean

Returns whether event matches a single-step shortcut string such as 'mod+k' or 'shift+escape'.

Parameters

NameTypeDescription
eventKeyboardEvent
specstring
options?MatchShortcutOptions

Source: packages/ui/src/behaviors/shortcuts.svelte.ts:87

mix_colors function

function mix_colors(a: RgbaColor, b: RgbaColor, t: number): RgbaColor

Linearly mixes two RGBA colors (t = 0 -> a, t = 1 -> b).

Parameters

NameTypeDescription
aRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number
bRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number
tnumber

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:966

move_item function

function move_item<T>(list: readonly T[], from: number, to: number): T[]

Returns a new array with the item at from moved to to.

Parameters

NameTypeDescription
listreadonly T[]
fromnumber
tonumber

Source: packages/ui/src/behaviors/reorder.svelte.ts:29

nearest_in_direction function

function nearest_in_direction(from: SpatialRect, candidates: readonly SpatialRect[], direction: SpatialDirection): number

Returns the index of the nearest candidate rectangle strictly in direction from from, or -1.

Parameters

NameTypeDescription
fromSpatialRect
  • left: number
  • top: number
  • width: number
  • height: number
candidatesreadonly SpatialRect[]
directionSpatialDirection

Source: packages/ui/src/behaviors/micro.svelte.ts:496

nearest_snap_point function

function nearest_snap_point(position: number, velocity: number, points: readonly number[], options?: { readonly projection_ms?: number; }): number

Projects a position using release velocity and returns the nearest snap point.

Parameters

NameTypeDescription
positionnumber
velocitynumber
pointsreadonly number[]
options?{ readonly projection_ms?: number; }

Source: packages/ui/src/behaviors/motion.svelte.ts:45

notify_control_change function

function notify_control_change(change: { readonly id: string; readonly kind?: string; readonly label?: string; readonly key: string; readonly previous: unknown; readonly value: unknown; readonly reason?: string; readonly source?: ChangeSource; readonly committed?: boolean; }): void

Emits a structured UI state change to every matching observe_controls listener.

Parameters

NameTypeDescription
change{ readonly id: string; readonly kind?: string; readonly label?: string; readonly key: string; readonly previous: unknown; readonly value: unknown; readonly reason?: string; readonly source?: ChangeSource; readonly committed?: boolean; }
  • id: string
  • kind?: string
  • label?: string
  • key: string
  • previous: unknown
  • value: unknown
  • reason?: string
  • source?: ChangeSource
  • committed?: boolean

Source: packages/ui/src/behaviors/controls.svelte.ts:207

observe_controls function

function observe_controls(listener: (change: ControlChange) => void, options?: { readonly within?: Element | (() => Element | null | undefined); readonly live?: boolean; }): () => void

Subscribes to structured control state changes (settled commits by default; live: true for drag steps).

Parameters

NameTypeDescription
listener(change: ControlChange) => void
options?{ readonly within?: Element | (() => Element | null | undefined); readonly live?: boolean; }

Source: packages/ui/src/behaviors/controls.svelte.ts:250

page_controls function

function page_controls(options?: PageControlsOptions): ControlSnapshot[]

Returns a deterministic snapshot of registered visible UI controls on the current page.

Parameters

NameTypeDescription
options?PageControlsOptions

Source: packages/ui/src/behaviors/controls.svelte.ts:263

page_range function

function page_range(current: number, total: number, siblings?: number): PaginationEntry[]

Computes a compact 1-based page range with 'ellipsis' gaps.

Parameters

NameTypeDescription
currentnumber
totalnumber
siblings?number

Source: packages/ui/src/behaviors/pagination.svelte.ts:32

parse_color function

function parse_color(input: string): RgbaColor | null

Parses CSS #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(...) or hsl(...) strings into RgbaColor.

Parameters

NameTypeDescription
inputstring

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:887

pointer_kind_of function

function pointer_kind_of(): PointerKindState

Reads current device pointer precision and hover support synchronously.

Source: packages/ui/src/behaviors/platform.svelte.ts:110

portal function

function portal(target?: PortalTarget | PortalOptions): Attachment<HTMLElement>

Svelte attachment that moves the element into the resolved portal container while mounted and restores or removes it cleanly on teardown.

Parameters

NameTypeDescription
target?PortalTarget | PortalOptions

Source: packages/ui/src/behaviors/portal.svelte.ts:55

prepare_announcements function

function prepare_announcements(doc?: Document | undefined): void

Pre-creates polite and assertive live regions so the very first announcement is never dropped.

Parameters

NameTypeDescription
doc?Document | undefined

Source: packages/ui/src/behaviors/announce.svelte.ts:49

register_control function

function register_control(descriptor: ControlDescriptor): () => void

Registers a live UI control while mounted and returns its cleanup function. Designed for use inside $effect or Svelte attachments ({@attach ...}).

Parameters

NameTypeDescription
descriptorControlDescriptor
  • id: string

    Stable semantic identifier, e.g. 'tabs:settings' or 'combobox:status'.

  • kind: string

    Component kind, e.g. 'tabs', 'combobox', 'dialog', 'input', 'checkbox', 'menu'.

  • label?: string

    Optional human-readable label (falls back to accessible name of element).

  • element?: () => HTMLElement | null | undefined

    Optional root/interactive DOM element for scope filtering and data-agent-* marks.

  • state: () => Record<string, unknown>

    Live snapshot of state (active tab, open state, value, selected count, etc.).

  • items?: () => readonly ControlChoice[]

    Optional choices accepted by selection actions.

  • actions?: Readonly<Record<string, ControlAction>>

    Named semantic actions callable by the host/agent bridge.

  • disabled?: () => boolean

    Whether the control is currently disabled or read-only (hides callable actions).

  • confirm?: string | (() => string | undefined)

    Explicit confirmation prompt describing why a person must approve agent actions.

  • secret?: boolean | (() => boolean)

    Marks values as secret (writable by agent, always redacted in snapshots/observations).

  • hidden?: boolean | (() => boolean)

    Hides this control from agent snapshots and invocation.

Source: packages/ui/src/behaviors/controls.svelte.ts:197

reset_hover_group function

function reset_hover_group(group?: string): void

Clears warm-group state (handy between tests).

Parameters

NameTypeDescription
group?string

Source: packages/ui/src/behaviors/hover-intent.svelte.ts:87

resolve_control function

function resolve_control(ref: string, options?: { readonly within?: Element | null; }): { readonly entry: ControlDescriptor; readonly snapshot: ControlSnapshot; } | { readonly error: string; }

Resolves a registered control by exact id, exact label (case-insensitive), or unique label substring.

Parameters

NameTypeDescription
refstring
options?{ readonly within?: Element | null; }

Source: packages/ui/src/behaviors/controls.svelte.ts:284

rgb_to_hsl function

function rgb_to_hsl(color: RgbaColor): HslaColor

Converts RGB (0..255) + alpha (0..1) to HSL (h: 0..360, s: 0..100, l: 0..100).

Parameters

NameTypeDescription
colorRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:808

rgb_to_hsv function

function rgb_to_hsv(color: RgbaColor): HsvaColor

Converts RGB (0..255) to HSV (h: 0..360, s: 0..100, v: 0..100).

Parameters

NameTypeDescription
colorRgbaColor
  • r: number
  • g: number
  • b: number
  • a: number

Source: packages/ui/src/behaviors/widgets-extra.svelte.ts:848

rubber_band function

function rubber_band(offset: number, dimension: number, constant?: number): number

Applies iOS-style asymptotic rubber-band resistance beyond [0, limit].

Parameters

NameTypeDescription
offsetnumber
dimensionnumber
constant?number

Source: packages/ui/src/behaviors/motion.svelte.ts:10

set_announcer function

function set_announcer(fn: CustomAnnouncer | undefined): void

Replaces live-region output (useful in headless unit tests); pass undefined to restore.

Parameters

NameTypeDescription
fnCustomAnnouncer | undefined

Source: packages/ui/src/behaviors/announce.svelte.ts:23

set_portal_target function

function set_portal_target(target: PortalTarget | PortalGetter): void

Sets the default portal mount target for every descendant overlay.

Parameters

NameTypeDescription
targetPortalTarget | PortalGetter

Source: packages/ui/src/behaviors/portal.svelte.ts:23

settle_draft function

function settle_draft<T>(current: Readonly<Record<string, T>>, submitted: Readonly<Record<string, T>>, equals?: (a: T, b: T) => boolean): Record<string, T>

Race-safe optimistic draft settler: removes keys whose current draft value still equals the snapshot that just committed, while preserving newer edits typed while the save was in flight.

Parameters

NameTypeDescription
currentReadonly<Record<string, T>>
submittedReadonly<Record<string, T>>
equals?(a: T, b: T) => boolean

Source: packages/ui/src/behaviors/platform.svelte.ts:378

spatial_move function

function spatial_move(current: HTMLElement, elements: readonly HTMLElement[], direction: SpatialDirection): HTMLElement | null

Finds the nearest focusable element in direction from current among elements.

Parameters

NameTypeDescription
currentHTMLElement
elementsreadonly HTMLElement[]
directionSpatialDirection

Source: packages/ui/src/behaviors/micro.svelte.ts:529

stack_spans function

function stack_spans<S extends Span>(spans: readonly S[]): readonly (S & { readonly lane: number; readonly lanes: number; })[]

Packs overlapping spans on one track into non-overlapping visual lanes (lane index & lanes total).

Parameters

NameTypeDescription
spansreadonly S[]

Source: packages/ui/src/behaviors/canvas.svelte.ts:286

step_spring function

function step_spring(state: { readonly position: number; readonly velocity: number; }, target: number, config?: { readonly stiffness?: number; readonly damping?: number; readonly mass?: number; readonly precision?: number; }, dt?: number): SpringState

Advances a 1D damped harmonic spring by dt seconds toward target.

Parameters

NameTypeDescription
state{ readonly position: number; readonly velocity: number; }
  • position: number
  • velocity: number
targetnumber
config?{ readonly stiffness?: number; readonly damping?: number; readonly mass?: number; readonly precision?: number; }
dt?number

Source: packages/ui/src/behaviors/motion.svelte.ts:76

subtree_end function

function subtree_end(rows: readonly TreeReorderRow[], index: number): number

Returns the exclusive index past the subtree rooted at index in a pre-order flat row array.

Parameters

NameTypeDescription
rowsreadonly TreeReorderRow[]
indexnumber

Source: packages/ui/src/behaviors/drag.svelte.ts:472

supports_hidden_until_found function

function supports_hidden_until_found(): boolean

Whether this browser supports find-in-page revelation via hidden="until-found" and beforematch.

Source: packages/ui/src/behaviors/presence.svelte.ts:212

tabbable_elements function

function tabbable_elements(root: HTMLElement): HTMLElement[]

Returns all visible, enabled tabbable descendants inside root.

Parameters

NameTypeDescription
rootHTMLElement

Source: packages/ui/src/behaviors/focus-trap.svelte.ts:17

text_to_cells function

function text_to_cells(text: string): string[][]

Parses tab-separated clipboard text (TSV) into a 2D matrix of strings.

Parameters

NameTypeDescription
textstring

Source: packages/ui/src/behaviors/grid.svelte.ts:231

toggle_tree_checked function

function toggle_tree_checked<T>(nodes: readonly TreeNode<T>[], checked: readonly string[], id: string, strategy?: TreeCheckStrategy): string[]

Toggles id in a hierarchical tree checkbox model and returns the normalized checked id array for strategy.

Parameters

NameTypeDescription
nodesreadonly TreeNode<T>[]
checkedreadonly string[]
idstring
strategy?TreeCheckStrategy

Source: packages/ui/src/behaviors/tree.svelte.ts:168

tree_checked_states function

function tree_checked_states<T>(nodes: readonly TreeNode<T>[], checked: readonly string[], strategy?: TreeCheckStrategy): ReadonlyMap<string, TreeCheckedState>

Computes checked / unchecked / 'indeterminate' state for every node in nodes.

Parameters

NameTypeDescription
nodesreadonly TreeNode<T>[]
checkedreadonly string[]
strategy?TreeCheckStrategy

Source: packages/ui/src/behaviors/tree.svelte.ts:129

tree_from_paths function

function tree_from_paths(paths: readonly string[]): TreeNode<{ readonly dir: boolean; readonly path: string; }>[]

Builds a sorted directory-first TreeNode[] from slash-delimited file paths (e.g. Studio files).

Parameters

NameTypeDescription
pathsreadonly string[]

Source: packages/ui/src/behaviors/tree.svelte.ts:60

use_debounce function

function use_debounce<A extends readonly unknown[]>(callback: (...args: A) => void, wait?: number | (() => number)): ((...args: A) => void) & { readonly cancel: () => void; }

Debounced callback wrapper with .cancel() support for input-driven queries.

Parameters

NameTypeDescription
callback(...args: A) => void
wait?number | (() => number)

Source: packages/ui/src/behaviors/reactive.svelte.ts:169

primitives

virtual_list function

function virtual_list(o: VirtualOptions): { readonly on: boolean; readonly start: number; readonly end: number; readonly before: number; readonly after: number; slice<T>(items: readonly T[]): readonly T[]; anchor: (el: HTMLElement) => () => void; measure(key: string): Attachment<Element>; reveal(index: number): void; }

Windows a long list to the rows in view (measuring each row's height), so a page renders only what is visible; a short list renders whole.

Parameters

NameTypeDescription
oVirtualOptions
  • count: () => number
  • key: (index: number) => string

    Stable identity of item i (its id): measured heights follow it.

  • estimate: number

    An unmeasured item's height in px.

  • threshold?: number

    Render every item at or below this count (default 60).

  • overscan?: number

    Items rendered beyond each edge of the visible band (default 8).

  • tail?: () => boolean

    Window the last visible rows while a bottom-origin viewport is latched to its tail.

Source: packages/ui/src/primitives/virtual/virtual.svelte.ts:37

behaviors

watch const

const watch: typeof watch

Reactively watches one or more getter sources and invokes callback(current, previous) without tracking reads inside callback. Supports { lazy: true } and watch.pre(...).

Members

NameTypeDescription
pre{ <T>(source: Getter<T>, callback: WatchCallback<T>, options?: WatchOptions): void; <const S extends readonly Getter<unknown>[]>(source: S, callback: WatchCallback<GetterValues<S>>, options?: WatchOptions): void; }

Source: packages/ui/src/behaviors/reactive.svelte.ts:70

watch_pre function

function watch_pre<T>(source: Getter<T>, callback: WatchCallback<T>, options?: WatchOptions): void
function watch_pre<const S extends readonly Getter<unknown>[]>(source: S, callback: WatchCallback<GetterValues<S>>, options?: WatchOptions): void

Pre-DOM variant of watch backed by $effect.pre.

Parameters

NameTypeDescription
sourceGetter<T>
callbackWatchCallback<T>
options?WatchOptions

Source: packages/ui/src/behaviors/reactive.svelte.ts:89

with_source function

function with_source<T>(source: ChangeSource, fn: () => T): T

Runs fn with source attributed to any UI control changes emitted synchronously inside it.

Parameters

NameTypeDescription
sourceChangeSource
fn() => T

Source: packages/ui/src/behaviors/controls.svelte.ts:97