跳到主要内容

ui

ui

导入自 @norbital-ai/ui

@norbital-ai/ui (§3.6, Appendix D.2): the views, the field kinds and inputs, Form/Field, and the primitives. Layout is ./layout; CaptureKit is ./capture, so its face engine loads only in pages that import it. The views of §3.6 over $bolt. The shell provides bolt (and the representation registry) once per page. A collection-backed view is exported typed by what its naked prop names (Workspace in ./collection/types.ts): the component is Svelte's generic-component shape over its own name-erased implementation. Live collection rows grouped into state, enum or relation lanes; dragging a card updates its lane field under the viewer's grants.

Accordion namespace

namespace Accordion

Collapsible sections: Accordion.Root holds Accordion.Items, each a Trigger and its Content.

源码: packages/ui/src/primitives/accordion/index.ts:1

Alert namespace

namespace Alert

A message box in a tone: Alert.Root with Alert.Title and Alert.Description.

源码: packages/ui/src/primitives/alert/index.ts:1

ApprovalPanel component

component ApprovalPanel(props: $$ComponentProps)

An approval request: its full timeline (every transition, comment, reason, resubmit and rollback result), the records its provisional change holds, and the moves the host's state machine allows this viewer — the buttons are exactly those.

属性

名称类型说明
requestIdstring
revision?number
onOutcome?(outcome: Outcome) => void

源码: packages/ui/src/approval/ApprovalPanel.svelte:1

ApprovalView type

type ApprovalView = {
    id: string;
    collection: string;
    record: string;
    action: string;
    at: string;
    /** ONGOING, CHANGES_REQUESTED, APPROVED, REJECTED, WITHDRAWN or SUPERSEDED. */
    status: string;
    step: number;
    steps: readonly (readonly string[])[];
    superseded_by: readonly string[];
    /** Current source labels; captured handles and native eligibility remain authoritative. */
    teamNames: Readonly<Record<string, string>>;
    requestor: ApprovalWho;
    /** Every interaction, oldest first: the request, each transition, each comment, with what a rollback did. */
    log: readonly {
        move: 'request' | 'approve' | 'reject' | 'requestChanges' | 'resubmit' | 'withdraw' | 'supersede' | 'comment' | 'close';
        by: ApprovalWho;
        at: string;
        from: string | null;
        to: string;
        step: number;
        reason: string | null;
        rolledBack?: readonly {
            collection: string;
            id: string;
            action: 'restored' | 'removed' | 'recreated';
        }[] | undefined;
        skipped?: readonly {
            collection: string;
            id: string;
            field: string;
            reason: string;
        }[] | undefined;
    }[];
    /** The records the provisional change holds: committed already, rolled back on rejection or withdrawal. */
    records: readonly {
        collection: string;
        id: string;
        op: 'create' | 'update' | 'delete';
    }[];
    /** The m…

One approval request as its participants and authorized record readers see it; the host decides every move.

成员

名称类型说明
idstring
collectionstring
recordstring
actionstring
atstring
statusstring

ONGOING, CHANGES_REQUESTED, APPROVED, REJECTED, WITHDRAWN or SUPERSEDED.

stepnumber
stepsreadonly (readonly string[])[]
superseded_byreadonly string[]
teamNamesReadonly<Record<string, string>>

Current source labels; captured handles and native eligibility remain authoritative.

requestorApprovalWho
logreadonly { move: 'request' | 'approve' | 'reject' | 'requestChanges' | 'resubmit' | 'withdraw' | 'supersede' | 'comment' | 'close'; by: ApprovalWho; at: string; from: string | null; to: string; step: number; reason: string | null; rolledBack?: readonly { collection: string; id: string; action: 'restored' | 'removed' | 'recreated'; }[] | undefined; skipped?: readonly { collection: string; id: stri…

Every interaction, oldest first: the request, each transition, each comment, with what a rollback did.

recordsreadonly { collection: string; id: string; op: 'create' | 'update' | 'delete'; }[]

The records the provisional change holds: committed already, rolled back on rejection or withdrawal.

movesreadonly { status: ApprovalStatus; reason: 'required' | 'optional'; }[]

The moves this viewer may take now, straight from the host's transition table.

mineboolean
participantboolean

源码: packages/ui/src/client/contract.ts:102

BUILTIN_FIELDS const

const BUILTIN_FIELDS: { readonly [name: string]: CustomFieldEntry; }

The host's built-in custom fields (money, file, point, phone), rendered like a tenant's own; a tenant field of the same name wins.

源码: packages/ui/src/kinds/builtin/index.ts:14

Badge component

component Badge(props: $$ComponentProps)

A small label pill in a colour variant.

属性

名称类型说明
variant?BadgeVariant

源码: packages/ui/src/primitives/badge/badge.svelte:1

BadgeVariant type

type BadgeVariant = VariantProps<typeof badgeVariants>['variant'];

The colour variants of Badge.

源码: packages/ui/src/primitives/badge/badge.svelte:29

Board component

component Board(props: BoardProps<C, FieldOf<C>, RecordFieldOf<C>>)

Live collection rows grouped into state, enum or relation lanes; dragging a card updates its lane field under the viewer's grants.

属性

名称类型说明
ofC
byF

The lane field: a state, an enum or a relation.

cardreadonly [] | readonly [K] | readonly [K, K] | readonly [K, K, K] | readonly [K, K, K, K] | Snippet<[{ row: RowOf<C>; }]>

At most four fields (a heavy one is then read), or a snippet (final-ui I7).

lanes?readonly Lane[]

Required for a relation by; otherwise the lanes the aggregate finds, in value order.

columns?number

Lanes per row. Unset is the horizontal reel, which scrolls sideways; a count lays the lanes out in a grid of that many columns whose rows share the board's height.

where?WhereOf<C>

The author's fixed scope (never clearable); the viewer's filter is ANDed under it.

initialFilter?WhereOf<C>

Seed rows of the view popover the viewer may edit or clear.

orderBy?OrderByOf<C>

The cards' order within each lane; a viewer's sort replaces it (lane order stays the lanes').

pageSize?number
toolbar?Toolbar<RowOf<C>>

The chrome (ViewToolbar): title, description, search, filter and sort (a sort orders the cards within each lane), actions, New.

key?string

The URL parameter prefix; defaults to of.

源码: packages/ui/src/board/Board.svelte:1

BoardProps type

type BoardProps<C = CollectionKey, F = FieldOf<C>, K = RecordFieldOf<C>> = {
    of: C;
    /** The lane field: a `state`, an `enum` or a relation. */
    by: F;
    /** At most four fields (a heavy one is then read), or a snippet (final-ui I7). */
    card: readonly [] | readonly [K] | readonly [K, K] | readonly [K, K, K] | readonly [K, K, K, K] | Snippet<[{
        row: RowOf<C>;
    }]>;
    /** Required for a relation `by`; otherwise the lanes the aggregate finds, in value order. */
    lanes?: readonly Lane[];
    /**
     * Lanes per row. Unset is the horizontal reel, which scrolls sideways; a count lays the lanes
     * out in a grid of that many columns whose rows share the board's height.
     */
    columns?: number;
    /** The author's fixed scope (never clearable); the viewer's filter is ANDed under it. */
    where?: WhereOf<C>;
    /** Seed rows of the view popover the viewer may edit or clear. */
    initialFilter?: WhereOf<C>;
    /** The cards' order within each lane; a viewer's sort replaces it (lane order stays the lanes'). */
    orderBy?: OrderByOf<C>;
    pageSize?: number;
    /** The chrome (`ViewToolbar`): title, description, search, filter and sort (a sort orders the cards within each lane), actions, New. */
    toolbar?: Toolbar<RowOf<C>>;
    /** The URL parameter prefix; defaults to `of`. */
    key?: string;
};

The props of Board, typed by the collection of.

成员

名称类型说明
ofC
byF

The lane field: a state, an enum or a relation.

cardreadonly [] | readonly [K] | readonly [K, K] | readonly [K, K, K] | readonly [K, K, K, K] | Snippet<[{ row: RowOf<C>; }]>

At most four fields (a heavy one is then read), or a snippet (final-ui I7).

lanes?readonly Lane[]

Required for a relation by; otherwise the lanes the aggregate finds, in value order.

columns?number

Lanes per row. Unset is the horizontal reel, which scrolls sideways; a count lays the lanes out in a grid of that many columns whose rows share the board's height.

where?WhereOf<C>

The author's fixed scope (never clearable); the viewer's filter is ANDed under it.

initialFilter?WhereOf<C>

Seed rows of the view popover the viewer may edit or clear.

orderBy?OrderByOf<C>

The cards' order within each lane; a viewer's sort replaces it (lane order stays the lanes').

pageSize?number
toolbar?Toolbar<RowOf<C>>

The chrome (ViewToolbar): title, description, search, filter and sort (a sort orders the cards within each lane), actions, New.

key?string

The URL parameter prefix; defaults to of.

源码: packages/ui/src/board/Board.svelte:20

Button component

component Button(props: ButtonProps)

A button (or a link, with href) in a variant and size.

属性

名称类型说明
variant?ButtonVariant
size?ButtonSize
readonly?boolean
haptic?HapticKind

A tick on tap where the device has a motor; for decisions, not for every button.

hint?string
disabledMessage?string
readonlyMessage?string

示例

<Button variant="outline" size="sm" onclick={save}>Save</Button>

源码: packages/ui/src/primitives/button/button.svelte:1

ButtonProps type

type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
    variant?: ButtonVariant;
    size?: ButtonSize;
    readonly?: boolean;
    /** A tick on tap where the device has a motor; for decisions, not for every button. */
    haptic?: HapticKind;
    hint?: string;
    disabledMessage?: string;
    readonlyMessage?: string;
};

The props of Button: the button's (or link's) attributes, variant, size and haptic.

成员

名称类型说明
variant?ButtonVariant
size?ButtonSize
readonly?boolean
haptic?HapticKind

A tick on tap where the device has a motor; for decisions, not for every button.

hint?string
disabledMessage?string
readonlyMessage?string

源码: packages/ui/src/primitives/button/button.svelte:44

CalendarEvent type

type CalendarEvent = {
    id: string | number;
    start: Date;
    end: Date;
    title: string;
    allDay?: boolean;
    /** A CSS colour for the event's accent; the brand colour by default. */
    color?: string;
    /** `false` locks a timed event against moving and resizing; `lockedReason` is its tooltip. */
    editable?: boolean;
    lockedReason?: string;
};

One calendar event: id, start and end, title, all-day flag, accent colour, and whether it may be moved.

成员

名称类型说明
idstring | number
startDate
endDate
titlestring
allDay?boolean
color?string

A CSS colour for the event's accent; the brand colour by default.

editable?boolean

false locks a timed event against moving and resizing; lockedReason is its tooltip.

lockedReason?string

源码: packages/ui/src/event-calendar/calendar.ts:5

CalendarView type

type CalendarView = 'day' | 'week' | 'month';

An EventCalendar view: one day, a week or a month.

源码: packages/ui/src/event-calendar/calendar.ts:3

CameraCapture component

component CameraCapture(props: CameraCaptureProps)

Takes a photo with the device camera (front or back) and hands it to onCapture as a File.

属性

名称类型说明
facing?'user' | 'environment'
onCapture(file: File) => void
label?string

源码: packages/ui/src/capture/CameraCapture.svelte:1

CameraCaptureProps type

type CameraCaptureProps = {
    facing?: 'user' | 'environment';
    onCapture: (file: File) => void;
    label?: string;
};

The props of CameraCapture.

成员

名称类型说明
facing?'user' | 'environment'
onCapture(file: File) => void
label?string

源码: packages/ui/src/capture/CameraCapture.svelte:7

Chart component

component Chart(props: ChartProps)

A bar, line, area or donut chart over an aggregate, a read, a collection query or rows: x names the category, y the numbers (count, sum.amount).

属性

名称类型说明
ofViewSource
xstring
ystring | readonly string[]
kind?'bar' | 'line' | 'area' | 'donut' | 'scatter'
interpolation?'linear' | 'step'

Hold each value until the next x position. Applies to line charts.

orientation?'horizontal' | 'vertical'
stack?boolean
title?string
every?string

示例

<Chart of={bolt.aggregate('jobs', { count: true, by: 'status', limit: 20 })} x="status" y="count" kind="bar" />

源码: packages/ui/src/chart/Chart.svelte:1

ChartProps type

type ChartProps = {
    of: ViewSource;
    x: string;
    y: string | readonly string[];
    kind?: 'bar' | 'line' | 'area' | 'donut' | 'scatter';
    /** Hold each value until the next x position. Applies to line charts. */
    interpolation?: 'linear' | 'step';
    orientation?: 'horizontal' | 'vertical';
    stack?: boolean;
    title?: string;
    every?: string;
};

of is an aggregate, a read, a collection query or rows; y names numbers (count, sum.amount).

成员

名称类型说明
ofViewSource
xstring
ystring | readonly string[]
kind?'bar' | 'line' | 'area' | 'donut' | 'scatter'
interpolation?'linear' | 'step'

Hold each value until the next x position. Applies to line charts.

orientation?'horizontal' | 'vertical'
stack?boolean
title?string
every?string

源码: packages/ui/src/chart/Chart.svelte:11

Checkbox component

component Checkbox(props: $$ComponentProps)

A checkbox, bindable checked (and indeterminate). readonly (or an enclosing readonly form) shows Yes/No as text; disabled keeps the box, muted.

属性

名称类型说明
readonly?boolean

Whether the checkbox is read only.

源码: packages/ui/src/primitives/checkbox/checkbox.svelte:1

ChildGrid component

component ChildGrid(props: ChildGridProps)

A related-record grid with explicit child operations, original revisions and parent or independent saves.

属性

名称类型说明
ofstring
relationstring
id?string
save?'parent' | 'independent'
columns?readonly Col<Row>[]
where?Json

源码: packages/ui/src/relations/ChildGrid.svelte:1

ChildGridProps type

type ChildGridProps = {
    of: string;
    relation: string;
    id?: string;
    save?: 'parent' | 'independent';
    columns?: readonly Col<Row>[];
    where?: Json;
};

The parent collection and inverse relation, with an explicit save scope and optional display columns/filter.

成员

名称类型说明
ofstring
relationstring
id?string
save?'parent' | 'independent'
columns?readonly Col<Row>[]
where?Json

源码: packages/ui/src/relations/ChildGrid.svelte:10

CodeEditor component

component CodeEditor(props: CodeEditorProps)

A CodeMirror code editor for JavaScript (also CEL and TypeScript expressions), JSON or plain text.

属性

名称类型说明
valuestring
onChange?((next: string) => void) | undefined
language?CodeEditorLanguage
readonly?boolean
invalid?boolean
minHeight?string

CSS min-height of the editing area; one line is 2.25rem (a field's height).

wrap?boolean

Long lines wrap at the editor's width instead of scrolling sideways (an expression, prose).

id?string
class?string
aria-label?string
aria-labelledby?string

源码: packages/ui/src/editors/code-editor.svelte:1

CodeEditorLanguage type

type CodeEditorLanguage = 'javascript' | 'json' | 'plaintext';

Code in CodeMirror: javascript (also CEL and TypeScript expressions), json, or plaintext.

源码: packages/ui/src/editors/code-editor.svelte:10

CodeEditorProps type

type CodeEditorProps = {
    value: string;
    onChange?(next: string): void;
    language?: CodeEditorLanguage;
    readonly?: boolean;
    invalid?: boolean;
    /** CSS min-height of the editing area; one line is `2.25rem` (a field's height). */
    minHeight?: string;
    /** Long lines wrap at the editor's width instead of scrolling sideways (an expression, prose). */
    wrap?: boolean;
    id?: string;
    class?: string;
    'aria-label'?: string;
    'aria-labelledby'?: string;
};

The props of CodeEditor: the text and onChange, the language, read-only and invalid states, and the minimum height.

成员

名称类型说明
valuestring
onChange?((next: string) => void) | undefined
language?CodeEditorLanguage
readonly?boolean
invalid?boolean
minHeight?string

CSS min-height of the editing area; one line is 2.25rem (a field's height).

wrap?boolean

Long lines wrap at the editor's width instead of scrolling sideways (an expression, prose).

id?string
class?string
aria-label?string
aria-labelledby?string

源码: packages/ui/src/editors/code-editor.svelte:14

CodeSession type

type CodeSession = {
    sendCode(address: string): Said;
    verify(address: string, code: string): Said;
};

What sends a code to a number and proves it.

成员

名称类型说明
sendCode(address: string) => Said
verify(address: string, code: string) => Said

源码: packages/ui/src/pin-input/phone-verify.svelte:11

Col type

type Col<R = Row, K = R> = {
    [F in keyof K & string]: F | ColumnDefinition<R, K, F>;
}[keyof K & string];

A column's field name or configuration, preserving that field's type in a custom cell snippet. Without a custom cell, the kind renderer shows scalar values and relations show their target labels.

源码: packages/ui/src/table/Table.svelte:80

CollectionExposure type

type CollectionExposure = {
    /** The model's `label` fields: a record's title and the picker's search fallback. */
    label: readonly string[];
    /** Search fields when the model declares `search.text`; else the picker searches `label`'s text fields. */
    search?: readonly string[];
    /** The model declares `search.semantic` (text or file fields on an embedding model): the toolbar offers `/semantic`. */
    semantic?: true;
    /** The named similarity searches the caller reads, by their typed `input`: the toolbar offers each as `/<name>`. */
    similarity?: {
        readonly [name: string]: {
            input: Fields;
            description: string;
        };
    };
    /** The collection's named queries the caller holds, by their typed `input` and `output`: the toolbar offers each as `/<query>`. */
    queries?: {
        readonly [query: string]: {
            input: Fields;
            output: Kind;
            description: string;
        };
    };
    /** Model fields the caller may read (hidden ones included; `hidden` renders nothing). */
    fields: Fields;
    /** One-relations as FK columns: `holder` → `employees`. A polymorphic ref lists every target. */
    relations?: {
        readonly [fk: string]: {
            targets: readonly string[];
            optional?: true;
            label?: string;
            inverse?: string;
            /** The relationship's static `where`: a picker offers only the records a write would accept. */
            w…

One collection as a form and a picker need it (generated from +collection.ts and the model).

成员

名称类型说明
labelreadonly string[]

The model's label fields: a record's title and the picker's search fallback.

search?readonly string[]

Search fields when the model declares search.text; else the picker searches label's text fields.

semantic?true

The model declares search.semantic (text or file fields on an embedding model): the toolbar offers /semantic.

similarity?{ readonly [name: string]: { input: Fields; description: string; }; }

The named similarity searches the caller reads, by their typed input: the toolbar offers each as /<name>.

queries?{ readonly [query: string]: { input: Fields; output: Kind; description: string; }; }

The collection's named queries the caller holds, by their typed input and output: the toolbar offers each as /<query>.

fieldsFields

Model fields the caller may read (hidden ones included; hidden renders nothing).

relations?{ readonly [fk: string]: { targets: readonly string[]; optional?: true; label?: string; inverse?: string; /** The relationship's static `where`: a picker offers only the records a write would accept. */ where?: Where; }; }

One-relations as FK columns: holder → employees. A polymorphic ref lists every target.

many?readonly string[]

Many-relations (inverses) the collection exposes; each child is the collection whose relation names it as inverse.

children?Readonly<Record<string, Pick<ChildInput, 'collection' | 'parent' | 'owned'>>>

Read-side inverse identities; each child is read independently through its own policy.

masked?readonly string[]

Fields masked to this caller (rule 14): shown locked, never offered to filter or sort.

create?{ columns: readonly string[]; filled?: readonly string[]; proposalOnly?: true; with?: Readonly<Record<string, ChildInput>>; }
update?{ columns: readonly string[]; with?: Readonly<Record<string, ChildInput>>; }
readonlyFields?{ readonly [field: string]: 'integrationOwned' | 'ownedParent'; }

Host-declared field restrictions, in addition to ordinary write grants.

actions?{ readonly [action: string]: { input: Fields; target?: 'record'; description?: string; }; }
description?string

The view toolbar's info text: the collection's declared description, else its model's.

delete?true

The caller holds a delete arm.

integration?string

The declared feed run (<definition>.<feed>) the caller may start for this collection.

pipeline?{ import?: string; export?: string; }

The <c>.pipeline import and export the caller may run, by their declared description.

源码: packages/ui/src/kinds/context.ts:28

ColumnsIn type

type ColumnsIn<S> = S extends string ? RecordOf<S> & {
    readonly [M in ManyOf<S>]: readonly Row[];
} : RowIn<S>;

The fields a column may name: a collection's whole record (a heavy field is then read) and its many-relations (the related records, each { id, …label }), else the row's.

源码: packages/ui/src/table/Table.svelte:61

Combobox component

component Combobox(props: ComboboxCommonProps<V> & { multiple?: M | undefined; } & { value: M extends true ? readonly V[] : V | null; onChange(next: M extends true ? readonly V[] : V | null): void; })

The kit's select: a field-like trigger and a searchable option list in a popover, filtered locally or through onSearch.

属性

名称类型说明
optionsreadonly ComboboxOption<V>[]
clearable?boolean

Offer a "none" row that clears the value.

placeholder?string
display?string

The trigger's text when value is not among options (a picker's chosen row on another page).

searchable?boolean

Show the search box; default when there are more than 8 options or onSearch is given.

onSearch?((query: string) => void) | undefined
onOpenChange?((open: boolean) => void) | undefined
loading?boolean
failed?boolean
size?'sm' | 'default'
variant?'default' | 'ghost'

ghost: no border, fill or shadow, small text; for a combobox in chrome or a toolbar, not a form.

id?string
readonly?boolean

Shows the chosen label as copyable text, no trigger; an enclosing readonly form sets it.

disabled?boolean

The trigger stays, muted and inert; an enclosing disabled form sets it.

invalid?boolean
class?string
aria-label?string
multiple?M
valueM extends true ? readonly V[] : V | null
onChange(next: M extends true ? readonly V[] : V | null) => void

源码: packages/ui/src/primitives/combobox/combobox.svelte:1

ComboboxOption type

type ComboboxOption<V extends string = string> = {
    value: V;
    label: string;
    description?: string;
    icon?: string;
    group?: string;
    keywords?: string;
};

One choice: label is shown and searched (with keywords); group heads a section.

成员

名称类型说明
valueV
labelstring
description?string
icon?string
group?string
keywords?string

源码: packages/ui/src/primitives/combobox/combobox.svelte:7

ComboboxProps type

type ComboboxProps<V extends string = string, M extends boolean = false> = ComboboxCommonProps<V> & {
    multiple?: M;
} & {
    value: M extends true ? readonly V[] : V | null;
    onChange(next: M extends true ? readonly V[] : V | null): void;
};

A searchable choice field; multiple: true toggles an array of choices while keeping the list open.

成员

名称类型说明
optionsreadonly ComboboxOption<V>[]
clearable?boolean

Offer a "none" row that clears the value.

placeholder?string
display?string

The trigger's text when value is not among options (a picker's chosen row on another page).

searchable?boolean

Show the search box; default when there are more than 8 options or onSearch is given.

onSearch?((query: string) => void) | undefined
onOpenChange?((open: boolean) => void) | undefined
loading?boolean
failed?boolean
size?'sm' | 'default'
variant?'default' | 'ghost'

ghost: no border, fill or shadow, small text; for a combobox in chrome or a toolbar, not a form.

id?string
readonly?boolean

Shows the chosen label as copyable text, no trigger; an enclosing readonly form sets it.

disabled?boolean

The trigger stays, muted and inert; an enclosing disabled form sets it.

invalid?boolean
class?string
aria-label?string
multiple?M
valueM extends true ? readonly V[] : V | null
onChange(next: M extends true ? readonly V[] : V | null) => void

源码: packages/ui/src/primitives/combobox/combobox.svelte:45

CommandItem type

type CommandItem = {
    id: string;
    label: string;
    description?: string;
    icon?: string;
    group?: string;
    /** The text that replaces `<char><query>`; default `<char><label> `. `run` alone removes the trigger text. */
    insert?: string;
    /** Keep the menu open after inserting: a drill-down (`@employees/` then its records). */
    keep?: boolean;
    run?(): void;
};

One row of the menu. Picking it replaces the trigger and its query with insert, or runs run, or both.

成员

名称类型说明
idstring
labelstring
description?string
icon?string
group?string
insert?string

The text that replaces <char><query>; default <char><label> . run alone removes the trigger text.

keep?boolean

Keep the menu open after inserting: a drill-down (@employees/ then its records).

run?(() => void) | undefined

源码: packages/ui/src/editors/command-menu.ts:8

CommandMenu component

component CommandMenu(props: CommandMenuProps)

A keyboard-driven menu at a textarea's caret, opened by trigger characters (/ commands, @ mentions); a pick rewrites the text.

属性

名称类型说明
textareaHTMLTextAreaElement | null
triggersreadonly CommandTrigger[]

源码: packages/ui/src/editors/command-menu.svelte:1

CommandMenuProps type

type CommandMenuProps = {
    textarea: HTMLTextAreaElement | null;
    triggers: readonly CommandTrigger[];
};

A filtered, keyboard-driven list anchored at a textarea's caret, opened by trigger characters (/ commands, @ mentions). It listens on the textarea it is given, so any textarea gets it: ↑/↓ move, Enter or Tab picks, Esc closes; the pick rewrites the text and dispatches input, so bind:value follows.

成员

名称类型说明
textareaHTMLTextAreaElement | null
triggersreadonly CommandTrigger[]

源码: packages/ui/src/editors/command-menu.svelte:13

CommandTrigger type

type CommandTrigger = {
    char: string;
    start: 'text' | 'line' | 'word';
    items(query: string): Effect.Effect<readonly CommandItem[], ReadError | Error>;
};

A character that opens the menu. start is where it counts: text only as the first character (an agent command), line at a line's start, word after whitespace or at the start (a mention; never inside an email).

成员

名称类型说明
charstring
start'text' | 'line' | 'word'
items(query: string) => Effect.Effect<readonly CommandItem[], ReadError | Error>

源码: packages/ui/src/editors/command-menu.ts:24

ConfirmOptions type

type ConfirmOptions = {
    title: string;
    body?: string | undefined;
    /** The accept button's label: the action itself ("Disconnect"), never a bare "OK". */
    confirmLabel: string;
    /** Defaults to the UI kit's "Cancel". */
    cancelLabel?: string | undefined;
    /** Draws the accept button as destructive. */
    destructive?: boolean | undefined;
};

An in-app confirmation (never window.confirm, which WebViews suppress): an Effect answering whether it was confirmed.

成员

名称类型说明
titlestring
body?string | undefined
confirmLabelstring

The accept button's label: the action itself ("Disconnect"), never a bare "OK".

cancelLabel?string | undefined

Defaults to the UI kit's "Cancel".

destructive?boolean | undefined

Draws the accept button as destructive.

源码: packages/ui/src/primitives/dialog/confirm.ts:8

Controls type

type Controls = {
    readonly readonly: boolean;
    readonly disabled: boolean;
};

How the controls beneath render: readonly shows each value as copyable text (no field chrome); disabled keeps the field, muted and unfocusable. Readonly wins when both hold.

成员

名称类型说明
readonlyboolean
disabledboolean

源码: packages/ui/src/primitives/utils.ts:167

CreateSlot type

type CreateSlot = {
    start: Date;
    end: Date;
};

The time range a drag on empty grid selected, for creating an event.

成员

名称类型说明
startDate
endDate

源码: packages/ui/src/event-calendar/calendar.ts:20

CustomField type

type CustomField<R> = (keyof R & string) | {
    field: keyof R & string;
    label: string;
};

A field the toolbar searches, filters and sorts on: its name, or { field, label }.

源码: packages/ui/src/collection/CustomView.svelte:13

CustomFieldEntry type

type CustomFieldEntry = {
    shape: Kind;
    label?: string;
    renderer?: Component<{
        view: CustomFieldView;
    }>;
};

A custom field as the ui renders it: its shape, label and optional renderer component; built-ins and tenant fields alike.

成员

名称类型说明
shapeKind
label?string
renderer?Component<{ view: CustomFieldView; }>

源码: packages/ui/src/kinds/context.ts:101

CustomFieldView type

type CustomFieldView<V = Value> = (ViewCommon<V> & {
    mode: 'show';
    dense?: true;
}) | (ViewCommon<V> & {
    mode: 'edit';
    disabled: boolean;
    error?: string;
    onChange(next: V | null): void;
});

What a custom field's renderer receives: its value and, in edit mode, onChange, disabled and the field's error.

源码: packages/ui/src/kinds/context.ts:92

CustomView component

component CustomView(props: CustomViewProps<R>)

The standard toolbar over a custom view (a roster grid, a calendar, cards): title and description, search, the filter and sort popover over the page's own rows, the actions menu and the page's scope controls. The body gets the rows they leave.

属性

名称类型说明
ofreadonly R[]

The rows the custom view draws; the toolbar narrows and orders them.

fieldsreadonly CustomField<R>[]
keystring

The URL prefix of the viewer's filter and sort.

toolbar?Exclude<Toolbar<R>, false>

Title, description, actions, controls, new; export: true adds "Export CSV" of the rows shown.

childrenSnippet<[readonly R[]]>

The custom view, over the rows the search, filter and sort leave.

empty?Snippet | false

No rows: the kit's EmptyState by default, this snippet instead, or false to draw the view empty (a calendar).

collection?string

The collection the view draws (a roster grid of roster_entry): its pipeline's import and export join the actions menu, scoped by toolbar.context.

源码: packages/ui/src/collection/CustomView.svelte:1

CustomViewProps type

type CustomViewProps<R extends Values = Row> = {
    /** The rows the custom view draws; the toolbar narrows and orders them. */
    of: readonly R[];
    fields: readonly CustomField<R>[];
    /** The URL prefix of the viewer's filter and sort. */
    key: string;
    /** Title, description, `actions`, `controls`, `new`; `export: true` adds "Export CSV" of the rows shown. */
    toolbar?: Exclude<Toolbar<R>, false>;
    /** The custom view, over the rows the search, filter and sort leave. */
    children: Snippet<[readonly R[]]>;
    /** No rows: the kit's `EmptyState` by default, this snippet instead, or `false` to draw the view empty (a calendar). */
    empty?: Snippet | false;
    /** The collection the view draws (a roster grid of `roster_entry`): its pipeline's import and export join the actions menu, scoped by `toolbar.context`. */
    collection?: string;
};

The props of CustomView.

成员

名称类型说明
ofreadonly R[]

The rows the custom view draws; the toolbar narrows and orders them.

fieldsreadonly CustomField<R>[]
keystring

The URL prefix of the viewer's filter and sort.

toolbar?Exclude<Toolbar<R>, false>

Title, description, actions, controls, new; export: true adds "Export CSV" of the rows shown.

childrenSnippet<[readonly R[]]>

The custom view, over the rows the search, filter and sort leave.

empty?Snippet | false

No rows: the kit's EmptyState by default, this snippet instead, or false to draw the view empty (a calendar).

collection?string

The collection the view draws (a roster grid of roster_entry): its pipeline's import and export join the actions menu, scoped by toolbar.context.

源码: packages/ui/src/collection/CustomView.svelte:15

DEFAULT_BASEMAP const

const DEFAULT_BASEMAP: { url: string; attribution: string; }

The keyless OpenStreetMap tile template used when the host names no basemap.

成员

名称类型说明
urlstring
attributionstring

源码: packages/ui/src/kinds/context.ts:157

DatePrecision type

type DatePrecision = 'year' | 'month' | 'week' | 'day';

The unit a date is picked in and snapped to, with weeks beginning on Monday.

源码: packages/std/src/kind.ts:12

Dialog namespace

namespace Dialog

A modal dialog: Dialog.Root, its Trigger, and Content with a header, title, description and footer.

源码: packages/ui/src/primitives/dialog/index.ts:1

Drawer component

component Drawer(props: DrawerProps)

The mobile navigation drawer: a Sheet (the phone's bottom drawer, a left panel on a wide screen) that closes when the route changes. It has no header: the navigation, flush to its edges in the sidebar's one tone, is the whole drawer.

属性

名称类型说明
actions?Snippet

Header content beside the close button (record actions).

title?string

The heading and accessible name.

class?string
open?boolean
onOpenChange?(open: boolean) => void
header?Snippet

Replaces the heading (a record label with badges); the close button stays.

childrenSnippet
pathstring

The current route (pathname + search); the drawer closes when it changes.

源码: packages/ui/src/primitives/sheet/drawer.svelte:1

DrawerProps type

type DrawerProps = Omit<SheetProps, 'side'> & {
    /** The current route (pathname + search); the drawer closes when it changes. */
    path: string;
};

The mobile nav drawer: a left Sheet that also closes on navigation.

成员

名称类型说明
actions?Snippet

Header content beside the close button (record actions).

title?string

The heading and accessible name.

class?string
open?boolean
onOpenChange?(open: boolean) => void
header?Snippet

Replaces the heading (a record label with badges); the close button stays.

childrenSnippet
pathstring

The current route (pathname + search); the drawer closes when it changes.

源码: packages/ui/src/primitives/sheet/drawer.svelte:10

Editor component

component Editor(props: EditorProps)

The editor of one value by its field kind: every kind's input in one component (derived kinds read-only).

属性

名称类型说明
kindKind
jsonSchema?JsonSchema

JSON Schema for the next-generation JSON editor; omitted retains the raw editor.

valueValue
onChange(next: Value) => void
namestring

The field's name (file uploads, custom renderers) and the dotted path errors are keyed by.

id?string
labelledby?string

The label naming a control that has no single input to point at (a group of boxes).

readonly?boolean

Shows the value as copyable text (Show); an enclosing readonly Form, Fieldset or Field sets it.

disabled?boolean

The editor stays, muted and inert; an enclosing disabled Form, Fieldset or Field sets it.

errors?ReadonlyMap<string, string>

Problems by dotted path under name (lines.0.amount), as a refusal or decode reports them.

row?{ readonly [f: string]: Value; }

The row being edited: a money field's currency sibling.

address?string

A point field's address sibling: its name in row (shown in the search box) and the writer of what is typed or found.

onAddress?((address: string | null) => void) | undefined
relation?{ targets: readonly string[]; where?: Where | undefined; }

One-relation target(s), when kind is the FK column of a relationship.

源码: packages/ui/src/kinds/editor.svelte:1

EditorProps type

type EditorProps = {
    kind: Kind;
    /** JSON Schema for the next-generation JSON editor; omitted retains the raw editor. */
    jsonSchema?: JsonSchema;
    value: Value;
    onChange(next: Value): void;
    /** The field's name (file uploads, custom renderers) and the dotted path errors are keyed by. */
    name: string;
    id?: string;
    /** The label naming a control that has no single input to point at (a group of boxes). */
    labelledby?: string;
    /** Shows the value as copyable text (`Show`); an enclosing readonly `Form`, `Fieldset` or `Field` sets it. */
    readonly?: boolean;
    /** The editor stays, muted and inert; an enclosing disabled `Form`, `Fieldset` or `Field` sets it. */
    disabled?: boolean;
    /** Problems by dotted path under `name` (`lines.0.amount`), as a refusal or decode reports them. */
    errors?: ReadonlyMap<string, string>;
    /** The row being edited: a money field's currency sibling. */
    row?: {
        readonly [f: string]: Value;
    };
    /** A `point` field's address sibling: its name in `row` (shown in the search box) and the writer of what is typed or found. */
    address?: string;
    onAddress?(address: string | null): void;
    /** One-relation target(s), when `kind` is the FK column of a relationship. */
    relation?: {
        targets: readonly string[];
        where?: Where | undefined;
    };
};

The editor of one value by its kind (every §3.3.2 kind; derived kinds render read-only).

成员

名称类型说明
kindKind
jsonSchema?JsonSchema

JSON Schema for the next-generation JSON editor; omitted retains the raw editor.

valueValue
onChange(next: Value) => void
namestring

The field's name (file uploads, custom renderers) and the dotted path errors are keyed by.

id?string
labelledby?string

The label naming a control that has no single input to point at (a group of boxes).

readonly?boolean

Shows the value as copyable text (Show); an enclosing readonly Form, Fieldset or Field sets it.

disabled?boolean

The editor stays, muted and inert; an enclosing disabled Form, Fieldset or Field sets it.

errors?ReadonlyMap<string, string>

Problems by dotted path under name (lines.0.amount), as a refusal or decode reports them.

row?{ readonly [f: string]: Value; }

The row being edited: a money field's currency sibling.

address?string

A point field's address sibling: its name in row (shown in the search box) and the writer of what is typed or found.

onAddress?((address: string | null) => void) | undefined
relation?{ targets: readonly string[]; where?: Where | undefined; }

One-relation target(s), when kind is the FK column of a relationship.

源码: packages/ui/src/kinds/editor.svelte:12

EmptyState component

component EmptyState(props: $$ComponentProps)

A view's empty, no-access or failed state: an icon, a title, a hint and the way forward.

属性

名称类型说明
titlestring
hint?string
icon?GlyphName
tone?'muted' | 'danger'
variant?'page' | 'inset' | 'card'
children?Snippet
read?string

源码: packages/ui/src/primitives/empty-state/EmptyState.svelte:1

EnumScope type

type EnumScope = {
    t?: (key: string) => string;
    collection?: string;
    field?: string;
};

Where an enum or state value's catalog key is: models.<collection>.fields.<field>.<value>, read through t.

成员

名称类型说明
t?(key: string) => string
collection?string
field?string

源码: packages/ui/src/kinds/kind.ts:128

EventCalendar component

component EventCalendar(props: EventCalendarProps)

Events on a day, week or month grid: timed boxes, all-day bars, month pills; dragging creates, moves and resizes, and the caller writes the change.

属性

名称类型说明
eventsreadonly CalendarEvent[]
view?CalendarView
views?readonly CalendarView[]
date?Date

The day shown first; navigation moves away from it until it changes.

startHour?number
endHour?number
hourHeight?number

Pixels per hour on the time grid.

snapMinutes?number
colWidth?number

The narrowest a week column gets before the grid scrolls sideways.

readonly?boolean
onViewChange?((view: CalendarView) => void) | undefined
onDateChange?((date: Date) => void) | undefined
onEventClick?((event: CalendarEvent) => void) | undefined
onEventCreate?((slot: CreateSlot) => void) | undefined
onEventMove?((event: CalendarEvent, start: Date, end: Date) => void) | undefined
eventContent?Snippet<[CalendarEvent, EventRenderContext]>

An event's body in place of its title (and time, on a box).

actions?Snippet

Connection or other calendar actions beside the displayed date.

class?string

源码: packages/ui/src/event-calendar/event-calendar.svelte:1

EventCalendarProps type

type EventCalendarProps = {
    events: readonly CalendarEvent[];
    view?: CalendarView;
    views?: readonly CalendarView[];
    /** The day shown first; navigation moves away from it until it changes. */
    date?: Date;
    startHour?: number;
    endHour?: number;
    /** Pixels per hour on the time grid. */
    hourHeight?: number;
    snapMinutes?: number;
    /** The narrowest a week column gets before the grid scrolls sideways. */
    colWidth?: number;
    readonly?: boolean;
    onViewChange?(view: CalendarView): void;
    onDateChange?(date: Date): void;
    onEventClick?(event: CalendarEvent): void;
    onEventCreate?(slot: CreateSlot): void;
    onEventMove?(event: CalendarEvent, start: Date, end: Date): void;
    /** An event's body in place of its title (and time, on a box). */
    eventContent?: Snippet<[CalendarEvent, EventRenderContext]>;
    /** Connection or other calendar actions beside the displayed date. */
    actions?: Snippet;
    class?: string;
};

Events on a day, week or month grid. Timed events are boxes placed by the clock (overlaps share the column in lanes); all-day and multi-day events are bars above the grid; a month cell shows three pills and "+N more". Unless readonly, dragging an empty slot creates, dragging a box moves it (across days in the week) and its lower edge resizes it; the calendar only reports: the caller writes and hands back new events.

成员

名称类型说明
eventsreadonly CalendarEvent[]
view?CalendarView
views?readonly CalendarView[]
date?Date

The day shown first; navigation moves away from it until it changes.

startHour?number
endHour?number
hourHeight?number

Pixels per hour on the time grid.

snapMinutes?number
colWidth?number

The narrowest a week column gets before the grid scrolls sideways.

readonly?boolean
onViewChange?((view: CalendarView) => void) | undefined
onDateChange?((date: Date) => void) | undefined
onEventClick?((event: CalendarEvent) => void) | undefined
onEventCreate?((slot: CreateSlot) => void) | undefined
onEventMove?((event: CalendarEvent, start: Date, end: Date) => void) | undefined
eventContent?Snippet<[CalendarEvent, EventRenderContext]>

An event's body in place of its title (and time, on a box).

actions?Snippet

Connection or other calendar actions beside the displayed date.

class?string

源码: packages/ui/src/event-calendar/event-calendar.svelte:15

EventRenderContext type

type EventRenderContext = {
    view: CalendarView;
    mode: 'box' | 'bar' | 'pill';
};

Where an event is drawn: a timed box, an all-day or multi-day bar, or a month cell's pill.

成员

名称类型说明
viewCalendarView
mode'box' | 'bar' | 'pill'

源码: packages/ui/src/event-calendar/calendar.ts:18

Field component

component Field(props: FieldProps)

One field of the enclosing Form by name: its label, help, the kind's editor (or an editor snippet) and its error. Readonly, it is a label over the value as copyable text: no field chrome, and no editor snippet.

属性

名称类型说明
namestring
label?string | undefined
help?string
helpPosition?'below' | 'label'
editor?Snippet<[FieldEditor]>
address?string
class?string
readonly?boolean

Overrides the enclosing Form/Fieldset; a field the viewer cannot write (no update grant, a state lock) is readonly whatever this says.

disabled?boolean

Overrides the enclosing Form/Fieldset: the editor stays, muted and inert.

dense?true

A table cell keeps its accessible field name while the column heading supplies its visible label.

源码: packages/ui/src/form/field.svelte:1

FieldEditor type

type FieldEditor = {
    value: Value;
    kind: Kind;
    name: string;
    disabled: boolean;
    error?: string;
    onChange(next: Value): void;
    /** The id the field's label points at: give it to the control the snippet renders, so it is named by the label. */
    id: string;
};

What a Field editor snippet receives: the field's value and kind, typed by context in the generated alias.

成员

名称类型说明
valueValue
kindKind
namestring
disabledboolean
error?string
onChange(next: Value) => void
idstring

The id the field's label points at: give it to the control the snippet renders, so it is named by the label.

源码: packages/ui/src/form/field.svelte:11

FieldProps type

type FieldProps = {
    name: string;
    label?: string | undefined;
    help?: string;
    helpPosition?: 'below' | 'label';
    editor?: Snippet<[FieldEditor]>;
    address?: string;
    class?: string;
    /** Overrides the enclosing `Form`/`Fieldset`; a field the viewer cannot write (no update grant, a state lock) is readonly whatever this says. */
    readonly?: boolean;
    /** Overrides the enclosing `Form`/`Fieldset`: the editor stays, muted and inert. */
    disabled?: boolean;
    /** A table cell keeps its accessible field name while the column heading supplies its visible label. */
    dense?: true;
};

One field of the enclosing Form, by its exposed name (§3.6). Without an editor it renders the kind's editor; address names the text field a point field's geocoded address is written to.

成员

名称类型说明
namestring
label?string | undefined
help?string
helpPosition?'below' | 'label'
editor?Snippet<[FieldEditor]>
address?string
class?string
readonly?boolean

Overrides the enclosing Form/Fieldset; a field the viewer cannot write (no update grant, a state lock) is readonly whatever this says.

disabled?boolean

Overrides the enclosing Form/Fieldset: the editor stays, muted and inert.

dense?true

A table cell keeps its accessible field name while the column heading supplies its visible label.

源码: packages/ui/src/form/field.svelte:25

Fields type

type Fields = {
    readonly [name: string]: Kind;
};

Named kinds: an object's, an input's or a custom field's fields.

源码: packages/std/src/kind.ts:90

Fieldset component

component Fieldset(props: FieldsetProps)

A group of fields and inputs that share one mode: readonly or disabled set here reaches every control beneath through context (a Field may still override it). Unset inherits the enclosing Form or Fieldset.

属性

名称类型说明
readonly?boolean

Every control beneath shows its value as copyable text, no field chrome.

disabled?boolean

Every control beneath stays, muted and inert (the native <fieldset disabled>).

legend?string
class?string
childrenSnippet

源码: packages/ui/src/form/fieldset.svelte:1

FieldsetProps type

type FieldsetProps = {
    /** Every control beneath shows its value as copyable text, no field chrome. */
    readonly?: boolean;
    /** Every control beneath stays, muted and inert (the native `<fieldset disabled>`). */
    disabled?: boolean;
    legend?: string;
    class?: string;
    children: Snippet;
};

The props of Fieldset: the mode its controls share, an optional legend, and its content.

成员

名称类型说明
readonly?boolean

Every control beneath shows its value as copyable text, no field chrome.

disabled?boolean

Every control beneath stays, muted and inert (the native <fieldset disabled>).

legend?string
class?string
childrenSnippet

源码: packages/ui/src/form/fieldset.svelte:10

FileInput component

component FileInput(props: FileInputProps)

A file field's input, the height of a text input: "Add file(s)" when empty, else the files as chips (each opening its preview, Download and Remove) and a "+" while there is room. Uploads go through the host first (accept and size checked; the limits are the trigger's hint); files dropped anywhere on the field upload too.

属性

名称类型说明
kindKindOf<'file'>
valueValue
onChange(next: Value) => void
namestring

The field name the upload is checked against.

id?string
disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/file-input.svelte:1

FileInputProps type

type FileInputProps = {
    kind: KindOf<'file'>;
    value: Value;
    onChange(next: Value): void;
    /** The field name the upload is checked against. */
    name: string;
    id?: string;
    disabled?: boolean;
    invalid?: boolean;
};

A file field: bytes go to the host first (bolt.upload, accept and max checked before), the draft holds refs.

成员

名称类型说明
kindKindOf<'file'>
valueValue
onChange(next: Value) => void
namestring

The field name the upload is checked against.

id?string
disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/file-input.svelte:12

FileRef type

type FileRef = {
    readonly id: string;
    readonly name: string;
    readonly mime: string;
    readonly size?: number;
};

A stored file's handle: id, name, MIME type, and its size when known.

成员

名称类型说明
idstring
namestring
mimestring
size?number

源码: packages/std/src/kind.ts:96

Form component

component Form(props: FormProps<S>)

Edits a collection row or an action's typed input using permitted fields; drafts survive pending work and updates submit only changed values.

属性

名称类型说明
ofS
mode?'view' | 'edit' | 'create' | 'update'
id?IdOf<Target<S>>

The row an update edits, or a record action's target.

record?(S extends string ? RecordOf<S> : Row) | null

The stored row, when the page already reads it; else the enclosing RecordShell's shown row (the scrubbed revision while one is picked) when it is this record, else the form reads it once.

values?S extends { action: infer A; } ? ActionValues<ActionInputOf<A>> : Partial<InsertOf<S>>

Create and action forms start from these values over the defaults; a record action's from its input.

fields?readonly (S extends string ? RecordFieldOf<S> : string)[]

A subset and order of the generated fields.

sections?readonly RecordSection[]

The generated fields grouped into collapsible Sections, in order; fields no section lists follow, untitled.

submit?string
readonly?boolean

Every field shows its value as copyable text, no field chrome, and no submit: the form as a view of the row. It reaches every Field and input beneath through context (a Field or Fieldset may override it). An update the viewer cannot make (no update grant) is readonly whatever this says. A form never inherits an outer mode.

disabled?boolean

Every field stays an editor, muted and inert, and the submit is disabled; a Field or Fieldset may override it.

onOutcome?((outcome: Outcome) => void) | undefined
children?Snippet<[FormState]>
actions?Snippet<[FormState]>

Extra buttons beside submit.

class?string

源码: packages/ui/src/form/form.svelte:1

FormProps type

type FormProps<S = FormSource> = {
    of: S;
    mode?: 'view' | 'edit' | 'create' | 'update';
    /** The row an update edits, or a record action's target. */
    id?: IdOf<Target<S>>;
    /** The stored row, when the page already reads it; else the enclosing `RecordShell`'s shown row (the scrubbed revision while one is picked) when it is this record, else the form reads it once. */
    record?: (S extends string ? RecordOf<S> : Row) | null;
    /** Create and action forms start from these values over the defaults; a record action's from its `input`. */
    values?: S extends {
        action: infer A;
    } ? ActionValues<ActionInputOf<A>> : Partial<InsertOf<S>>;
    /** A subset and order of the generated fields. */
    fields?: readonly (S extends string ? RecordFieldOf<S> : string)[];
    /** The generated fields grouped into collapsible `Section`s, in order; fields no section lists follow, untitled. */
    sections?: readonly RecordSection[];
    submit?: string;
    /**
     * Every field shows its value as copyable text, no field chrome, and no submit: the form as a view of the row. It
     * reaches every `Field` and input beneath through context (a `Field` or `Fieldset` may override it). An update the
     * viewer cannot make (no update grant) is readonly whatever this says. A form never inherits an outer mode.
     */
    readonly?: boolean;
    /** Every field stays an editor, muted and inert, and the submit is disabled; a `Field` or `Fieldset` may override it.…

The props of Form: what it edits (of), create or update, the row id, and the layout of its fields.

成员

名称类型说明
ofS
mode?'view' | 'edit' | 'create' | 'update'
id?IdOf<Target<S>>

The row an update edits, or a record action's target.

record?(S extends string ? RecordOf<S> : Row) | null

The stored row, when the page already reads it; else the enclosing RecordShell's shown row (the scrubbed revision while one is picked) when it is this record, else the form reads it once.

values?S extends { action: infer A; } ? ActionValues<ActionInputOf<A>> : Partial<InsertOf<S>>

Create and action forms start from these values over the defaults; a record action's from its input.

fields?readonly (S extends string ? RecordFieldOf<S> : string)[]

A subset and order of the generated fields.

sections?readonly RecordSection[]

The generated fields grouped into collapsible Sections, in order; fields no section lists follow, untitled.

submit?string
readonly?boolean

Every field shows its value as copyable text, no field chrome, and no submit: the form as a view of the row. It reaches every Field and input beneath through context (a Field or Fieldset may override it). An update the viewer cannot make (no update grant) is readonly whatever this says. A form never inherits an outer mode.

disabled?boolean

Every field stays an editor, muted and inert, and the submit is disabled; a Field or Fieldset may override it.

onOutcome?((outcome: Outcome) => void) | undefined
children?Snippet<[FormState]>
actions?Snippet<[FormState]>

Extra buttons beside submit.

class?string

源码: packages/ui/src/form/form.svelte:30

FormSource type

type FormSource = CollectionKey | {
    [A in ActionKey]: {
        action: A;
    };
}[ActionKey];

What a form edits: a collection's row, or an action's input.

源码: packages/ui/src/form/form.svelte:23

FormState class

class FormState {
    #private;
    spec: FormSpec;
    mode: "view" | "edit" | "create";
    base: Record<string, Value>;
    values: Record<string, Value>;
    errors: Map<string, string>;
    notice: {
        tone: "info" | "danger" | "warning";
        text: string;
    } | null;
    pending: boolean;
    capabilities: RecordCapabilities | null | undefined;
    children: Record<string, readonly ChildOperation[]>;
    /** Native child controllers survive a custom body or historical snapshot unmounting. */
    childForms: Map<string, FormState>;
    /** Fields the row's state lock leaves read-only (advice; the host enforces). */
    locked: (field: string) => boolean;
    readonly dirty: boolean;
    readonly row: Row;
    /** Every registered rule's current issues; kept apart from `errors` so fixing a value clears its issue at once. */
    readonly semanticErrors: readonly SemanticIssue[];
    constructor(spec: FormSpec, record: Row | null, prefill: Row, act: Act, text: NoticeText, locked?: (field: string) => boolean);
    /** A view refreshes from the current row; editing keeps its original revision and draft. */
    refresh(record: Row): void;
    prefill(values: Row): void;
    edit(): void;
    view(): void;
    expectCapabilities(): void;
    get canSubmit(): boolean;
    /** Permission plus validity: Save stays disabled while any error or broken invariant remains. */
    get canSave(): boolean;
    /** Registers a synchronous invariant rule, re-evaluated reactively…

The draft of one mounted Form: values, errors, notice and pending state, shared with its Fields; values survive a field unmounting.

成员

名称类型说明
#privateany
specFormSpec
mode"view" | "edit" | "create"
baseRecord<string, Value>
valuesRecord<string, Value>
errorsMap<string, string>
notice{ tone: "info" | "danger" | "warning"; text: string; } | null
pendingboolean
capabilitiesRecordCapabilities | null | undefined
childrenRecord<string, readonly ChildOperation[]>
childFormsMap<string, FormState>

Native child controllers survive a custom body or historical snapshot unmounting.

locked(field: string) => boolean

Fields the row's state lock leaves read-only (advice; the host enforces).

dirtyboolean
rowRow
semanticErrorsreadonly SemanticIssue[]

Every registered rule's current issues; kept apart from errors so fixing a value clears its issue at once.

refresh(record: Row) => void

A view refreshes from the current row; editing keeps its original revision and draft.

prefill(values: Row) => void
edit() => void
view() => void
expectCapabilities() => void
canSubmitboolean
canSaveboolean

Permission plus validity: Save stays disabled while any error or broken invariant remains.

addValidation(rule: () => readonly SemanticIssue[]) => () => void

Registers a synchronous invariant rule, re-evaluated reactively; returns its unregister.

semanticError(field: string) => string | undefined

The first broken invariant's message for exactly this key.

requestingApprovalboolean
readable(field: string) => boolean
restrictions(field: string) => readonly RecordRestriction[]
get(name: string) => Value
id<C extends string>(name: string) => IdOf<C> | null
set(name: string, value: Value) => void
track<A, E extends Error>(work: Effect.Effect<A, E>) => Effect.Effect<A, E>

Holds a submit until work (an upload writing its ref into the draft) settles.

onOutcome(receive: (outcome: Outcome) => void) => () => void
onReset(reset: () => void) => () => void
beforeOutcome(receive: (outcome: Outcome) => void) => () => void
beforeSubmit(validate: () => Effect.Effect<boolean>) => () => void
revisionnumber | undefined
queueChildren(relation: string, operations: readonly ChildOperation[]) => void
validate() => boolean
prepare() => Effect.Effect<boolean>
accept(outcome: Outcome, sent?: Row) => void

A parent transaction settles the same native child draft without submitting it separately.

submit() => Effect.Effect<Outcome | null>

Sends the draft; the draft stays until the outcome settles it (rule 67). Resolves null when nothing was sent.

reset() => void

源码: packages/ui/src/form/form-state.svelte.ts:35

Geocoder type

type Geocoder = {
    /** `region`: the workspace's country (ISO 3166 alpha-2, from its locale); its places rank first. */
    search(query: string, options?: {
        region?: string;
    }): Effect.Effect<readonly {
        point: Point;
        address: string;
    }[], Error>;
    reverse?(point: Point): Effect.Effect<string | null, Error>;
};

The host's address search (and reverse lookup) a PointInput uses when present.

成员

名称类型说明
search(query: string, options?: { region?: string; }) => Effect.Effect<readonly { point: Point; address: string; }[], Error>

region: the workspace's country (ISO 3166 alpha-2, from its locale); its places rank first.

reverse?((point: Point) => Effect.Effect<string | null, Error>) | undefined

源码: packages/ui/src/kinds/context.ts:107

Icon component

component Icon(props: $$ComponentProps)

An icon by Iconify name (lucide:users).

属性

名称类型说明
namestring
class?string

源码: packages/ui/src/primitives/icon/icon-wrapper.svelte:1

Image component

component Image(props: ImageProps)

A native image with an animated pending mosaic and a short dissolve when ready. An absent src/srcset stays pending without requesting a placeholder. class reserves the outer span's size; imageClass controls the image's fit. Native dimensions, responsive sources and loading attributes pass through; provide alt="" for decorative images.

属性

名称类型说明
altstring
imageClass?HTMLImgAttributes['class']

源码: packages/ui/src/primitives/image/image.svelte:1

ImageProps type

type ImageProps = Omit<HTMLImgAttributes, 'alt'> & {
    alt: string;
    imageClass?: HTMLImgAttributes['class'];
};

Native image attributes with required alternative text and separate container/image styling.

成员

名称类型说明
altstring
imageClass?HTMLImgAttributes['class']

源码: packages/ui/src/primitives/image/image.svelte:11

Input component

component Input(props: Props)

A text input (every <input> type), bindable value. type="file" binds files (or onFiles) instead: a file input's value is not writable. readonly (or an enclosing readonly form) shows the value as copyable text, no field chrome; disabled (or an enclosing disabled form) keeps the box, muted.

属性

名称类型说明
files?FileList | undefined | null
type?'file'
onFiles?(files: FileList | null) => void
ref?U | null

源码: packages/ui/src/primitives/input/input.svelte:1

InsertOf type

type InsertOf<C> = C extends keyof Collections ? Collections[C]['insert'] : Values;

A collection's create input.

源码: packages/ui/src/collection/types.ts:57

Json type

type Json = null | boolean | number | string | readonly Json[] | {
    readonly [key: string]: Json;
};

A JSON value.

源码: packages/std/src/wire.ts:8

JsonSchema type

type JsonSchema = boolean | {
    readonly [keyword: string]: unknown;
    readonly $ref?: string;
    readonly type?: string | readonly string[];
    readonly title?: string;
    readonly description?: string;
    readonly properties?: Readonly<Record<string, JsonSchema>>;
    readonly required?: readonly string[];
    readonly items?: JsonSchema;
    readonly enum?: readonly Json[];
    readonly const?: Json;
    readonly default?: Json;
    readonly readOnly?: boolean;
    readonly 'x-norbital'?: {
        readonly datatype?: string;
        readonly section?: string;
        readonly advanced?: boolean;
        readonly order?: number;
    };
};

JSON Schema is data, never executable code. Remote references are deliberately not fetched.

源码: packages/ui/src/kinds/json-schema.ts:5

JsonSchemaForm component

component JsonSchemaForm(props: JsonSchemaFormProps)

Edits a JSON Schema value compactly, laid out by the schema itself: an object is a column of label | control rows, a nested object an indented group of its own rows, an array of flat objects an editable table (a column per property, a row per item) and any other array a numbered list. Leaves dispatch through Editor and the workspace datatype registry; unsupported shapes keep the raw JSON editor.

属性

名称类型说明
schemaJsonSchema
valueValue
onChange(next: Value) => void
name?string
id?string
disabled?boolean
readonly?boolean
errors?ReadonlyMap<string, string>

Server/validator errors by dotted path, matching Editor/Form.

root?JsonSchema

Internal reference root; normally omitted.

depth?number

源码: packages/ui/src/kinds/json-schema-form.svelte:1

JsonSchemaFormProps type

type JsonSchemaFormProps = {
    schema: JsonSchema;
    value: Value;
    onChange(next: Value): void;
    name?: string;
    id?: string;
    disabled?: boolean;
    readonly?: boolean;
    /** Server/validator errors by dotted path, matching Editor/Form. */
    errors?: ReadonlyMap<string, string>;
    /** Internal reference root; normally omitted. */
    root?: JsonSchema;
    depth?: number;
};

JSON Schema, draft value, edit callback and inherited controls for a generated input form.

成员

名称类型说明
schemaJsonSchema
valueValue
onChange(next: Value) => void
name?string
id?string
disabled?boolean
readonly?boolean
errors?ReadonlyMap<string, string>

Server/validator errors by dotted path, matching Editor/Form.

root?JsonSchema

Internal reference root; normally omitted.

depth?number

源码: packages/ui/src/kinds/json-schema-form.svelte:14

KINDS const

const KINDS: { text: Presentation; int: Presentation; number: Presentation; decimal: Presentation; money: Presentation; duration: Presentation; currency: Presentation; bool: Presentation; date: Presentation; instant: Presentation; time: Presentation; period: Presentation; enum: Presentation; state: Presentation; seq: Presentation; sum: Presentation; count: Presentation; vector: Presentation; id: Presentation; json: Presentation; custom: Presentation; file: Presentation; point: Presentation; object: Presentation; list: Presentation; union: Presentation; record: Presentation; }

Presentation decisions share the canonical kind traits.

成员

名称类型说明
textPresentation
intPresentation
numberPresentation
decimalPresentation
moneyPresentation
durationPresentation
currencyPresentation
boolPresentation
datePresentation
instantPresentation
timePresentation
periodPresentation
enumPresentation
statePresentation
seqPresentation
sumPresentation
countPresentation
vectorPresentation
idPresentation
jsonPresentation
customPresentation
filePresentation
pointPresentation
objectPresentation
listPresentation
unionPresentation
recordPresentation

源码: packages/ui/src/kinds/registry.ts:34

Kind type

type Kind = Common & ({
    readonly kind: 'text';
    readonly format?: 'email' | 'phone' | 'url' | 'zone' | 'markdown' | 'cel' | 'team';
    readonly max?: number;
    readonly many?: true;
} | ({
    readonly kind: 'int';
} & Range) | ({
    readonly kind: 'number';
} & Range) | ({
    readonly kind: 'decimal';
    readonly scale: number;
    readonly precision?: number;
} & Range) | {
    readonly kind: 'money';
    readonly currency?: string;
    readonly scale?: number;
} | {
    readonly kind: 'currency';
} | {
    readonly kind: 'bool';
} | {
    readonly kind: 'duration';
} | {
    readonly kind: 'point';
} | {
    readonly kind: 'date';
    readonly precision?: DatePrecision;
} | {
    readonly kind: 'instant';
    readonly precision?: Precision;
} | {
    readonly kind: 'time';
    readonly precision?: TimePrecision;
} | {
    readonly kind: 'period';
    readonly of: 'date';
    readonly precision?: DatePrecision;
} | {
    readonly kind: 'period';
    readonly of: 'instant';
    readonly precision?: Precision;
} | {
    readonly kind: 'enum';
    readonly values: readonly string[];
    readonly many?: true;
} | {
    readonly kind: 'state';
    readonly initial: string;
    readonly states: {
        readonly [state: string]: {
            readonly to?: readonly string[];
            readonly edit?: 'all' | 'none' | readonly string[];
        };
    };
} | {
    readonly kind: 'seq';
    readonly pattern?: string;
    readonly per?: readonly string[];
} | {
    …

A kind literal: every stored and input kind with its options, one arm per kind.

源码: packages/std/src/kind.ts:28

KindOf type

type KindOf<K extends FieldKind> = Extract<Kind, {
    readonly kind: K;
}>;

The literal of one kind.

源码: packages/std/src/kind.ts:94

KindsHost type

type KindsHost = {
    catalog?: {
        readonly [collection: string]: CollectionExposure;
    } | undefined;
    customFields?: {
        readonly [name: string]: CustomFieldEntry;
    } | undefined;
    /** `bolt.upload`; without it a file field is read-only. */
    upload?(file: File, field: string): Effect.Effect<FileRef, Extract<ActFailure, {
        _tag: 'ActRefused';
    }> | Extract<ReadError, {
        _tag: 'TransportFailed';
    }>>;
    fileUrl?(ref: FileRef, options?: FileUrlOptions): string;
    /** The host's geocoder (P19); without one, address search uses the keyless `photonGeocoder`. */
    geocoder?: Geocoder;
    /** A keyless tile template; the host may override the OpenStreetMap default. */
    basemap?: {
        url: string;
        attribution: string;
    };
    /** The `read` a picker pages through: `bolt.read`. Without it an `id` is typed. */
    read?(collection: string, options: Json): Effect.Effect<{
        rows: readonly ({
            readonly id: string;
        } & {
            readonly [f: string]: Value;
        })[];
        next: string | null;
    }, ReadError>;
    locale?: string | undefined;
    zone?: string | undefined;
    /** The workspace default currency for a money field without one (X-8). */
    currency?: string | undefined;
};

What the kind editors take from the host: the catalog, custom fields, uploads and file URLs, the geocoder and basemap, the picker's read, locale, zone and default currency.

成员

名称类型说明
catalog?{ readonly [collection: string]: CollectionExposure; } | undefined
customFields?{ readonly [name: string]: CustomFieldEntry; } | undefined
upload?((file: File, field: string) => Effect.Effect<FileRef, Extract<ActFailure, { _tag: "ActRefused"; }> | Extract<ReadError, { _tag: "TransportFailed"; }>>) | undefined

bolt.upload; without it a file field is read-only.

fileUrl?((ref: FileRef, options?: FileUrlOptions) => string) | undefined
geocoder?Geocoder

The host's geocoder (P19); without one, address search uses the keyless photonGeocoder.

basemap?{ url: string; attribution: string; }

A keyless tile template; the host may override the OpenStreetMap default.

read?((collection: string, options: Json) => Effect.Effect<{ rows: readonly ({ readonly id: string; } & { readonly [f: string]: Value; })[]; next: string | null; }, ReadError>) | undefined

The read a picker pages through: bolt.read. Without it an id is typed.

locale?string | undefined
zone?string | undefined
currency?string | undefined

The workspace default currency for a money field without one (X-8).

源码: packages/ui/src/kinds/context.ts:118

LOG_LEVELS const

const LOG_LEVELS: readonly ["debug", "info", "warn", "error"]

The log levels, least severe first.

源码: packages/ui/src/logs/logs.ts:4

Label component

component Label(props: LabelPrimitive.RootProps)

A form label.

源码: packages/ui/src/primitives/label/label.svelte:1

Lane type

type Lane = import('@norbital-ai/std/kind').Value | {
    value: import('@norbital-ai/std/kind').Value;
    label: string;
    where?: Json;
};

A lane: its by value (for a relation, the target id), a label, and for a relation its Where (default eq).

源码: packages/ui/src/board/Board.svelte:16

LogLevel type

type LogLevel = (typeof LOG_LEVELS)[number];

One log level.

源码: packages/ui/src/logs/logs.ts:6

LogLine type

type LogLine = {
    readonly id: string;
    readonly at: string | number;
    readonly level: LogLevel;
    readonly message: string;
    readonly source?: string;
};

One event; rows are oldest first.

成员

名称类型说明
idstring
atstring | number
levelLogLevel
messagestring
source?string

源码: packages/ui/src/logs/logs.ts:8

LogView component

component LogView(props: LogViewProps)

A dense, filterable log: one line per event, oldest first, following the tail and loading older pages on request.

属性

名称类型说明
rowsreadonly LogLine[]

Oldest first; new events append.

loadOlder?() => Effect.Effect<unknown, Error>

Loads the next older page (the caller holds the cursor) and prepends it to rows.

hasOlder?boolean
follow?boolean

Keep the newest line in view; scrolling up pauses it.

locale?string
class?string

源码: packages/ui/src/logs/LogView.svelte:1

LogViewProps type

type LogViewProps = {
    /** Oldest first; new events append. */
    rows: readonly LogLine[];
    /** Loads the next older page (the caller holds the cursor) and prepends it to `rows`. */
    loadOlder?: () => Effect.Effect<unknown, Error>;
    hasOlder?: boolean;
    /** Keep the newest line in view; scrolling up pauses it. */
    follow?: boolean;
    locale?: string;
    class?: string;
};

The props of LogView.

成员

名称类型说明
rowsreadonly LogLine[]

Oldest first; new events append.

loadOlder?() => Effect.Effect<unknown, Error>

Loads the next older page (the caller holds the cursor) and prepends it to rows.

hasOlder?boolean
follow?boolean

Keep the newest line in view; scrolling up pauses it.

locale?string
class?string

源码: packages/ui/src/logs/LogView.svelte:10

Map component

component Map(props: MapProps<C>)

Live collection points on the host's basemap, with labels, overlays and record opening; search and filters retain the viewer's read scope.

属性

名称类型说明
ofC
atFieldOf<C>
where?WhereOf<C>
label?RecordFieldOf<C>
interactive?boolean
limit?number
labels?'hover' | 'always'

always: each row's label sits beside its point instead of appearing on hover.

overlays?readonly MapOverlay[]

Marks the page computes (a destination, the route to it); they also widen the view to fit.

toolbar?Toolbar<RowOf<C>>

The chrome (ViewToolbar); search and filter narrow the places.

key?string

源码: packages/ui/src/map/Map.svelte:1

MapOverlay type

type MapOverlay = {
    lat: number;
    lng: number;
    text?: string;
    from?: {
        lat: number;
        lng: number;
    };
};

Extra marks drawn over the rows: a labelled point, and optionally a dashed line to it from from.

成员

名称类型说明
latnumber
lngnumber
text?string
from?{ lat: number; lng: number; }

源码: packages/ui/src/map/Map.svelte:11

MapProps type

type MapProps<C = CollectionKey> = {
    of: C;
    at: FieldOf<C>;
    where?: WhereOf<C>;
    label?: RecordFieldOf<C>;
    interactive?: boolean;
    limit?: number;
    /** `always`: each row's label sits beside its point instead of appearing on hover. */
    labels?: 'hover' | 'always';
    /** Marks the page computes (a destination, the route to it); they also widen the view to fit. */
    overlays?: readonly MapOverlay[];
    /** The chrome (`ViewToolbar`); search and filter narrow the places. */
    toolbar?: Toolbar<RowOf<C>>;
    key?: string;
};

Rows of of with a point field at, on the host's keyless basemap; a click opens the record.

成员

名称类型说明
ofC
atFieldOf<C>
where?WhereOf<C>
label?RecordFieldOf<C>
interactive?boolean
limit?number
labels?'hover' | 'always'

always: each row's label sits beside its point instead of appearing on hover.

overlays?readonly MapOverlay[]

Marks the page computes (a destination, the route to it); they also widen the view to fit.

toolbar?Toolbar<RowOf<C>>

The chrome (ViewToolbar); search and filter narrow the places.

key?string

源码: packages/ui/src/map/Map.svelte:18

MarkdownEditor component

component MarkdownEditor(props: MarkdownEditorProps)

Markdown as plain text with the / block menu and @ mentions, and an optional Write/Preview switch.

属性

名称类型说明
valuestring
onChange?((next: string) => void) | undefined
readonly?boolean
preview?boolean
commands?readonly CommandItem[]

The / rows; [] turns / off.

commandStart?'line' | 'text'

Where / counts: a line's start (Markdown blocks), or only as the text's first character (an agent command).

mentions?((query: string) => EffectType.Effect<readonly CommandItem[], ReadError | Error>) | undefined
placeholder?string
rows?number
id?string
disabled?boolean
invalid?boolean
class?string
aria-label?string
onkeydown?((event: KeyboardEvent) => void) | undefined
onpaste?((event: ClipboardEvent) => void) | undefined
textarea?HTMLTextAreaElement | null

The textarea, bindable: a page inserts at its caret (selectionStart) or focuses it.

源码: packages/ui/src/editors/markdown-editor.svelte:1

MarkdownEditorProps type

type MarkdownEditorProps = {
    value: string;
    onChange?(next: string): void;
    readonly?: boolean;
    preview?: boolean;
    /** The `/` rows; `[]` turns `/` off. */
    commands?: readonly CommandItem[];
    /** Where `/` counts: a line's start (Markdown blocks), or only as the text's first character (an agent command). */
    commandStart?: 'line' | 'text';
    mentions?(query: string): EffectType.Effect<readonly CommandItem[], ReadError | Error>;
    placeholder?: string;
    rows?: number;
    id?: string;
    disabled?: boolean;
    invalid?: boolean;
    class?: string;
    'aria-label'?: string;
    onkeydown?(event: KeyboardEvent): void;
    onpaste?(event: ClipboardEvent): void;
    /** The textarea, bindable: a page inserts at its caret (`selectionStart`) or focuses it. */
    textarea?: HTMLTextAreaElement | null;
};

Markdown as text (a textarea, no rich editor) with the command menu: / at a line's start offers commands (the Markdown blocks by default), @ offers mentions(query). preview adds a Write/Preview switch; readonly renders the text only (ReadonlyMarkdown).

成员

名称类型说明
valuestring
onChange?((next: string) => void) | undefined
readonly?boolean
preview?boolean
commands?readonly CommandItem[]

The / rows; [] turns / off.

commandStart?'line' | 'text'

Where / counts: a line's start (Markdown blocks), or only as the text's first character (an agent command).

mentions?((query: string) => EffectType.Effect<readonly CommandItem[], ReadError | Error>) | undefined
placeholder?string
rows?number
id?string
disabled?boolean
invalid?boolean
class?string
aria-label?string
onkeydown?((event: KeyboardEvent) => void) | undefined
onpaste?((event: ClipboardEvent) => void) | undefined
textarea?HTMLTextAreaElement | null

The textarea, bindable: a page inserts at its caret (selectionStart) or focuses it.

源码: packages/ui/src/editors/markdown-editor.svelte:15

Matrix component

component Matrix(props: MatrixProps)

A grid of rows records by cols values (dates or a relation) whose cells hold the matching items of of, with optional background marks, create on an empty cell and drag to move.

属性

名称类型说明
rowsstring

The row collection, paged 50 at a time by its rowLabel (final-ui 29b).

rowLabelstring
rowWhere?Json
ofstring

The item collection; row is its relation to rows, col its date or relation field.

rowstring
colstring
colsreadonly (Json | { value: Json; label: string; })[]
selectreadonly string[]

The cell fields (required: never the whole row).

colWidthnumber

Column width in px (required: memory matrix-columns-default-150px).

where?Json
toolbar?Toolbar

Optional native view toolbar; omitted keeps the matrix without toolbar chrome.

marks?MatrixMark
columnHeader?Snippet<[{ col: Json; label: string; }]>

An optional control in each column heading (for example an editable repayment date).

cell?Snippet<[{ row: Row; col: Json; items: readonly Row[]; marks: readonly Row[]; }]>
edit?true

A click on an empty cell opens the create view with { [row], [col] }.

move?true

Dragging an item to another cell updates its row and col.

selection?readonly { label: string; run: (cells: readonly MatrixCell[]) => void; }[]

Multi-cell selection actions.

源码: packages/ui/src/matrix/Matrix.svelte:1

MatrixCell type

type MatrixCell = {
    row: string;
    col: Json;
};

A matrix cell: its row id and column value.

成员

名称类型说明
rowstring
colJson

源码: packages/ui/src/matrix/Matrix.svelte:14

MatrixMark type

type MatrixMark = {
    of: string;
    at: string;
    row?: string;
    label: string;
};

A background overlay per column (holidays, closures), optionally per row (M3).

成员

名称类型说明
ofstring
atstring
row?string
labelstring

源码: packages/ui/src/matrix/Matrix.svelte:12

MatrixProps type

type MatrixProps = {
    /** The row collection, paged 50 at a time by its `rowLabel` (final-ui 29b). */
    rows: string;
    rowLabel: string;
    rowWhere?: Json;
    /** The item collection; `row` is its relation to `rows`, `col` its date or relation field. */
    of: string;
    row: string;
    col: string;
    cols: readonly (Json | {
        value: Json;
        label: string;
    })[];
    /** The cell fields (required: never the whole row). */
    select: readonly string[];
    /** Column width in px (required: memory matrix-columns-default-150px). */
    colWidth: number;
    where?: Json;
    /** Optional native view toolbar; omitted keeps the matrix without toolbar chrome. */
    toolbar?: Toolbar;
    marks?: MatrixMark;
    /** An optional control in each column heading (for example an editable repayment date). */
    columnHeader?: Snippet<[{
        col: Json;
        label: string;
    }]>;
    cell?: Snippet<[{
        row: Row;
        col: Json;
        items: readonly Row[];
        marks: readonly Row[];
    }]>;
    /** A click on an empty cell opens the create view with `{ [row], [col] }`. */
    edit?: true;
    /** Dragging an item to another cell updates its `row` and `col`. */
    move?: true;
    /** Multi-cell selection actions. */
    selection?: readonly {
        label: string;
        run: (cells: readonly MatrixCell[]) => void;
    }[];
};

The props of Matrix.

成员

名称类型说明
rowsstring

The row collection, paged 50 at a time by its rowLabel (final-ui 29b).

rowLabelstring
rowWhere?Json
ofstring

The item collection; row is its relation to rows, col its date or relation field.

rowstring
colstring
colsreadonly (Json | { value: Json; label: string; })[]
selectreadonly string[]

The cell fields (required: never the whole row).

colWidthnumber

Column width in px (required: memory matrix-columns-default-150px).

where?Json
toolbar?Toolbar

Optional native view toolbar; omitted keeps the matrix without toolbar chrome.

marks?MatrixMark
columnHeader?Snippet<[{ col: Json; label: string; }]>

An optional control in each column heading (for example an editable repayment date).

cell?Snippet<[{ row: Row; col: Json; items: readonly Row[]; marks: readonly Row[]; }]>
edit?true

A click on an empty cell opens the create view with { [row], [col] }.

move?true

Dragging an item to another cell updates its row and col.

selection?readonly { label: string; run: (cells: readonly MatrixCell[]) => void; }[]

Multi-cell selection actions.

源码: packages/ui/src/matrix/Matrix.svelte:16

MoneyInput component

component MoneyInput(props: MoneyInputProps)

An exact money amount in currency: the currency as the box's leading affix, the amount typed plain and shown grouped in the currency's minor digits once the box loses focus. Kept as an exact Decimal.

属性

名称类型说明
valueValue
onChange(next: Value) => void
currency?string
scale?number
id?string
readonly?boolean
disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/money-input.svelte:1

MoneyInputProps type

type MoneyInputProps = {
    value: Value;
    onChange(next: Value): void;
    currency?: string;
    scale?: number;
    id?: string;
    readonly?: boolean;
    disabled?: boolean;
    invalid?: boolean;
};

An exact amount in currency, typed to at most its minor digits (or scale).

成员

名称类型说明
valueValue
onChange(next: Value) => void
currency?string
scale?number
id?string
readonly?boolean
disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/money-input.svelte:10

NumberTuple component

component NumberTuple(props: NumberTupleProps)

Several named numbers typed in one segmented field (feet and inches, a blood pressure).

属性

名称类型说明
segmentsreadonly NumberTupleSegment[]
valueNumberTupleValue
onChange(next: NumberTupleValue) => void
readonly?boolean

Shows the numbers as copyable text; an enclosing readonly form sets it.

disabled?boolean
invalid?boolean
size?'sm' | 'md'
class?string
id?string

The first cell's id, so a <label for> reaches the field.

源码: packages/ui/src/kinds/number-tuple.svelte:1

NumberTupleProps type

type NumberTupleProps = {
    segments: readonly NumberTupleSegment[];
    value: NumberTupleValue;
    onChange(next: NumberTupleValue): void;
    /** Shows the numbers as copyable text; an enclosing readonly form sets it. */
    readonly?: boolean;
    disabled?: boolean;
    invalid?: boolean;
    size?: 'sm' | 'md';
    class?: string;
    /** The first cell's id, so a `<label for>` reaches the field. */
    id?: string;
};

The props of NumberTuple.

成员

名称类型说明
segmentsreadonly NumberTupleSegment[]
valueNumberTupleValue
onChange(next: NumberTupleValue) => void
readonly?boolean

Shows the numbers as copyable text; an enclosing readonly form sets it.

disabled?boolean
invalid?boolean
size?'sm' | 'md'
class?string
id?string

The first cell's id, so a <label for> reaches the field.

源码: packages/ui/src/kinds/number-tuple.svelte:18

NumberTupleSegment type

type NumberTupleSegment = {
    readonly name: string;
    readonly label: string;
    readonly min?: number;
    readonly max?: number;
    readonly step?: number;
    readonly placeholder?: string;
};

One number of a tuple: what it is called and what it accepts.

成员

名称类型说明
namestring
labelstring
min?number
max?number
step?number
placeholder?string

源码: packages/ui/src/kinds/number-tuple.svelte:7

NumberTupleValue type

type NumberTupleValue = Readonly<Record<string, number | null>>;

A NumberTuple's value: each segment's number (or null) by name.

源码: packages/ui/src/kinds/number-tuple.svelte:16

Outcome type

type Outcome = {
    kind: 'committed';
    output: Value;
    records: readonly {
        collection: string;
        id: string;
        revision: number;
    }[];
} | {
    kind: 'pendingApproval';
    requestId: string;
    records: readonly {
        collection: string;
        id: string;
        revision: number;
    }[];
} | {
    kind: 'refused';
    code: string;
    message: string;
    field?: string;
    row?: number;
} | {
    kind: 'conflict';
    records: readonly {
        collection: string;
        id: string;
        fields: readonly string[];
    }[];
} | {
    kind: 'unknown';
    invocation: string;
};

A write outcome as a form settles it: committed, pending approval, refused, conflict or unknown.

源码: packages/ui/src/form/draft.ts:13

PhoneInput component

component PhoneInput(props: PhoneInputProps)

A phone number: a country calling-code picker (flag and code) joined to the number box; the value is E.164.

属性

名称类型说明
valueValue
onChange(next: Value) => void
id?string
disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/phone-input.svelte:1

PhoneInputProps type

type PhoneInputProps = {
    value: Value;
    onChange(next: Value): void;
    id?: string;
    disabled?: boolean;
    invalid?: boolean;
};

A phone number (E.164, +6591234567): the calling code is picked, the national digits typed and grouped as they read.

成员

名称类型说明
valueValue
onChange(next: Value) => void
id?string
disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/phone-input.svelte:9

PhoneVerify component

component PhoneVerify(props: PhoneVerifyProps)

A mobile number proven on the page: the number and "Send code" side by side; the six-digit code opens in a popover beneath them, and the sixth digit verifies. session sends and checks the code (a Bolt page passes bolt.session, which signs the viewer in, signing a newcomer up where the workspace allows it, and reloads the page as them).

属性

名称类型说明
sessionCodeSession
label?string

The number's label; the kit's "Mobile number" by default.

id?string

源码: packages/ui/src/pin-input/phone-verify.svelte:1

PhoneVerifyProps interface

interface PhoneVerifyProps {
    session: CodeSession;
    /** The number's label; the kit's "Mobile number" by default. */
    label?: string;
    id?: string;
}

The props of PhoneVerify.

成员

名称类型说明
sessionCodeSession
label?string

The number's label; the kit's "Mobile number" by default.

id?string

源码: packages/ui/src/pin-input/phone-verify.svelte:16

Picker component

component Picker(props: PickerProps<C>)

A relation/id picker that searches only rows and labels the viewer may read, displays the chosen record's label, and emits its typed id.

属性

名称类型说明
ofC
valuestring | null

The chosen id; any text is shown as not found, never trusted.

onChange(next: IdOf<C> | null) => void
label?readonly FieldOf<C>[]
where?WhereOf<C> & Json
orderBy?OrderByOf<C> & Json
limit?number
id?string
readonly?boolean

Shows the chosen row's label as copyable text; an enclosing readonly form sets it.

disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/picker.svelte:1

PickerProps type

type PickerProps<C = CollectionKey> = {
    of: C;
    /** The chosen id; any text is shown as not found, never trusted. */
    value: string | null;
    onChange(next: IdOf<C> | null): void;
    label?: readonly FieldOf<C>[];
    where?: WhereOf<C> & Json;
    orderBy?: OrderByOf<C> & Json;
    limit?: number;
    id?: string;
    /** Shows the chosen row's label as copyable text; an enclosing readonly form sets it. */
    readonly?: boolean;
    disabled?: boolean;
    invalid?: boolean;
};

Edits a relation or an id input (§3.6): searches the target collection through the caller's own read grant, so it lists only rows (and fields) the viewer may read. label defaults to the target model's label; a target without search is searched over its label's text and patterned seq fields. Each keystroke is a server search, so limit is the page shown, never the rows searched; rows sort by orderBy, else by the label.

成员

名称类型说明
ofC
valuestring | null

The chosen id; any text is shown as not found, never trusted.

onChange(next: IdOf<C> | null) => void
label?readonly FieldOf<C>[]
where?WhereOf<C> & Json
orderBy?OrderByOf<C> & Json
limit?number
id?string
readonly?boolean

Shows the chosen row's label as copyable text; an enclosing readonly form sets it.

disabled?boolean
invalid?boolean

源码: packages/ui/src/kinds/picker.svelte:12

PinInput component

component PinInput(props: Props)

A one-time code in separate cells (bits-ui PinInput): the sign-in code step.

属性

名称类型说明
maxlength?number
cellClass?string

源码: packages/ui/src/pin-input/pin-input.svelte:1

Pivot component

component Pivot(props: PivotProps<C>)

A live count or sum grouped by row and optional column fields, displayed as a pivot grid with totals and scoped filters.

属性

名称类型说明
ofC
rowsFieldOf<C>
cols?FieldOf<C>
valuePivotValue<FieldOf<C>>
where?WhereOf<C>
every?string
toolbar?Toolbar

The chrome (ViewToolbar); the filter narrows what is counted. Search, which an aggregate has not, is off.

key?string

源码: packages/ui/src/pivot/Pivot.svelte:1

PivotProps type

type PivotProps<C = CollectionKey> = {
    of: C;
    rows: FieldOf<C>;
    cols?: FieldOf<C>;
    value: PivotValue<FieldOf<C>>;
    where?: WhereOf<C>;
    every?: string;
    /** The chrome (`ViewToolbar`); the filter narrows what is counted. Search, which an aggregate has not, is off. */
    toolbar?: Toolbar;
    key?: string;
};

The props of Pivot, typed by the collection of.

成员

名称类型说明
ofC
rowsFieldOf<C>
cols?FieldOf<C>
valuePivotValue<FieldOf<C>>
where?WhereOf<C>
every?string
toolbar?Toolbar

The chrome (ViewToolbar); the filter narrows what is counted. Search, which an aggregate has not, is off.

key?string

源码: packages/ui/src/pivot/Pivot.svelte:6

Point type

type Point = {
    readonly lat: number;
    readonly lng: number;
};

A latitude and longitude in degrees.

成员

名称类型说明
latnumber
lngnumber

源码: packages/std/src/kind.ts:105

PointInput component

component PointInput(props: PointInputProps)

Edits a point: a compact trigger opens address suggestions and the map. Typed coordinates, a map click or marker drag, and the browser's location also set the point.

属性

名称类型说明
valueValue
onChange(next: Point | null) => void
address?string | null
onAddress?((address: string | null) => void) | undefined
id?string
disabled?boolean
invalid?boolean
map?boolean

Show the map (default true).

源码: packages/ui/src/kinds/point-input.svelte:1

PointInputProps type

type PointInputProps = {
    value: Value;
    onChange(next: Point | null): void;
    address?: string | null;
    onAddress?(address: string | null): void;
    id?: string;
    disabled?: boolean;
    invalid?: boolean;
    /** Show the map (default true). */
    map?: boolean;
};

A point field (P19, rule 69). Typing an address geocodes it (the host's geocoder, else the keyless default) and the map and value follow the best match; typed "lat, lng" is taken as is. A pick on the map, a marker drag or "use my location" set the point and look up its address. address is the sibling text field's value, shown in the trigger; onAddress receives what the box holds (Field address="<field>" wires both).

成员

名称类型说明
valueValue
onChange(next: Point | null) => void
address?string | null
onAddress?((address: string | null) => void) | undefined
id?string
disabled?boolean
invalid?boolean
map?boolean

Show the map (default true).

源码: packages/ui/src/kinds/point-input.svelte:15

Popover namespace

namespace Popover

Floating content anchored to a trigger: Popover.Root, Popover.Trigger, Popover.Content.

源码: packages/ui/src/primitives/popover/index.ts:1

Precision type

type Precision = DatePrecision | TimePrecision;

Calendar or clock granularity for an instant field, selecting the unit its picker offers and snaps values to.

源码: packages/std/src/kind.ts:16

Progress component

component Progress(props: Omit<Omit<ProgressPrimitive.RootProps, "child">, "children">)

A progress bar of value out of max.

源码: packages/ui/src/primitives/progress/progress.svelte:1

Qr component

component Qr(props: $$ComponentProps)

A scannable code. value is the payload the provider published; the matrix is drawn from it here, so nothing is fetched and nothing leaves the browser. Colours are fixed rather than themed: a code is read by a camera, not by a person, and a low-contrast code in dark mode is one that simply does not scan.

属性

名称类型说明
valuestring
size?number

The rendered pixel size; the code keeps its own quiet zone.

alt?string
class?string

源码: packages/ui/src/primitives/qr/qr.svelte:1

ReadonlyMarkdown component

component ReadonlyMarkdown(props: $$ComponentProps)

Renders Markdown text for reading.

属性

名称类型说明
valuestring
class?string

源码: packages/ui/src/editors/readonly-markdown.svelte:1

RecordCapabilities type

type RecordCapabilities = {
    collection: string;
    id: string;
    revision: number;
    fields: Readonly<Record<string, {
        writable: boolean;
        proposal: boolean;
        reasons: readonly RecordRestriction[];
    }>>;
    update: {
        allowed: boolean;
        proposal: boolean;
        reasons: readonly RecordRestriction[];
    };
    delete: {
        allowed: boolean;
        proposal: boolean;
        reasons: readonly RecordRestriction[];
    };
    moves: Readonly<Record<string, readonly string[]>>;
    proposalMoves: Readonly<Record<string, readonly string[]>>;
};

Read-filtered field and operation permissions, proposal eligibility and restriction reasons for one revision.

成员

名称类型说明
collectionstring
idstring
revisionnumber
fieldsReadonly<Record<string, { writable: boolean; proposal: boolean; reasons: readonly RecordRestriction[]; }>>
update{ allowed: boolean; proposal: boolean; reasons: readonly RecordRestriction[]; }
delete{ allowed: boolean; proposal: boolean; reasons: readonly RecordRestriction[]; }
movesReadonly<Record<string, readonly string[]>>
proposalMovesReadonly<Record<string, readonly string[]>>

源码: packages/ui/src/record/types.ts:21

RecordControllerScope type

type RecordControllerScope = {
    readonly current: FormState | null;
    readonly historical?: boolean;
};

The enclosing record's shared form state and historical-view guard.

成员

名称类型说明
currentFormState | null
historical?boolean

源码: packages/ui/src/form/form-state.svelte.ts:395

RecordHistoryConfig type

type RecordHistoryConfig = {
    fields?: readonly string[];
    sources?: readonly RecordHistorySource[];
};

One record's history plus optional related-record history; no separate event store.

成员

名称类型说明
fields?readonly string[]
sources?readonly RecordHistorySource[]

源码: packages/ui/src/record/history.ts:9

RecordHistorySource type

type RecordHistorySource = {
    of: string;
    query: Json;
    fields?: readonly string[];
};

A related collection's records, selected through the viewer's ordinary scoped read query.

成员

名称类型说明
ofstring
queryJson
fields?readonly string[]

源码: packages/ui/src/record/history.ts:7

RecordOf type

type RecordOf<C> = C extends keyof Collections ? Collections[C]['record'] : Row;

A collection's whole row as a record view reads it.

源码: packages/ui/src/collection/types.ts:49

RecordParentContext type

type RecordParentContext = {
    collection: string;
    id: string;
    relation: string;
    revision: number;
};

A nested edit uses one declared parent relation and the parent's observed revision.

成员

名称类型说明
collectionstring
idstring
relationstring
revisionnumber

源码: packages/ui/src/record/types.ts:14

RecordRestriction type

type RecordRestriction = 'noGrant' | 'stateLocked' | 'integrationOwned' | 'ownedParent' | 'ownedParentLocked'
/** An open approval request holds the record; only its current approvers or (changes requested) its requester edit. */
 | 'underApproval';

Native advisory capabilities of the current record; saving always rechecks the backend rules.

源码: packages/ui/src/record/types.ts:5

RecordSection type

type RecordSection = {
    /** The stable key the open state is remembered under. */
    name: string;
    title?: string;
    hint?: string;
    fields: readonly string[];
    defaultOpen?: boolean;
    summary?: string | ((row: {
        readonly [field: string]: unknown;
    }) => string);
};

A declared section of a generated record view or form (RecordShell/Form sections): its fields, in order. Its title and summary arrive translated; summary may read the row shown (the draft while editing).

成员

名称类型说明
namestring

The stable key the open state is remembered under.

title?string
hint?string
fieldsreadonly string[]
defaultOpen?boolean
summary?string | ((row: { readonly [field: string]: unknown; }) => string)

源码: packages/ui/src/form/section.svelte:38

RecordShell component

component RecordShell(props: RecordShellProps<C>)

A record frame with its label, permissions, approvals, revision history and authored tabs; renders the registered representation or generated form.

属性

名称类型说明
ofC
id?FormProps<C>['id']

The stored row; absent with mode="create".

mode?'view' | 'edit' | 'create'
values?FormProps<C>['values']

Create mode: the pre-filled values ({ [row], [col] } from a Matrix cell, a page's scope).

fields?FormProps<C>['fields']

Generated view: create offers these beyond values' keys; update shows only these, in this order (else every field).

sections?readonly RecordSection[]

Generated view (read, edit, create): the fields grouped into collapsible Sections, in order; fields no section lists follow in one untitled, always-open group. Titles and summaries arrive translated.

title?string

The heading; default the record's label fields by kind (a create: "New ").

subtitle?string | readonly string[]

A line under the heading: text, or field names shown by kind (['customer', 'due_on'] → Acme · Jan 2, 2026).

icon?string

Iconify id inside the state pill.

badge?string

The state pill's text.

hint?string

One sentence behind the pill.

actions?Snippet

Placed in the record header (serial-pcn's "Approve as FAE").

trailing?Snippet

Beside the label in the chrome (color-matching's timeline trigger).

tabs?readonly RecordTab[]
history?RecordHistoryConfig

Related records included in the native History popover, scoped by read queries.

runs?readonly RunsForProps[]

Runs whose subject is this record, shown as a Runs tab.

children?Snippet<[RecordView]>

The representation's body; absent → the representation registered for of, else the generated view. It receives the record shown — the scrubbed revision while one is picked — as useRecordView() also does beneath.

onDone?(outcome: Outcome) => void

源码: packages/ui/src/record/RecordShell.svelte:1

RecordShellProps type

type RecordShellProps<C = CollectionKey> = {
    of: C;
    /** The stored row; absent with `mode="create"`. */
    id?: FormProps<C>['id'];
    mode?: 'view' | 'edit' | 'create';
    /** Create mode: the pre-filled values (`{ [row], [col] }` from a Matrix cell, a page's scope). */
    values?: FormProps<C>['values'];
    /** Generated view: create offers these beyond `values`' keys; update shows only these, in this order (else every field). */
    fields?: FormProps<C>['fields'];
    /**
     * Generated view (read, edit, create): the fields grouped into collapsible `Section`s, in order; fields no section
     * lists follow in one untitled, always-open group. Titles and summaries arrive translated.
     */
    sections?: readonly RecordSection[];
    /** The heading; default the record's label fields by kind (a create: "New <singular>"). */
    title?: string;
    /** A line under the heading: text, or field names shown by kind (`['customer', 'due_on']` → `Acme · Jan 2, 2026`). */
    subtitle?: string | readonly string[];
    /** Iconify id inside the state pill. */
    icon?: string;
    /** The state pill's text. */
    badge?: string;
    /** One sentence behind the pill. */
    hint?: string;
    /** Placed in the record header (serial-pcn's "Approve as FAE"). */
    actions?: Snippet;
    /** Beside the label in the chrome (color-matching's timeline trigger). */
    trailing?: Snippet;
    tabs?: readonly RecordTab[];
    /** Related records included in the native Hi…

The props of RecordShell, typed by the collection of.

成员

名称类型说明
ofC
id?FormProps<C>['id']

The stored row; absent with mode="create".

mode?'view' | 'edit' | 'create'
values?FormProps<C>['values']

Create mode: the pre-filled values ({ [row], [col] } from a Matrix cell, a page's scope).

fields?FormProps<C>['fields']

Generated view: create offers these beyond values' keys; update shows only these, in this order (else every field).

sections?readonly RecordSection[]

Generated view (read, edit, create): the fields grouped into collapsible Sections, in order; fields no section lists follow in one untitled, always-open group. Titles and summaries arrive translated.

title?string

The heading; default the record's label fields by kind (a create: "New ").

subtitle?string | readonly string[]

A line under the heading: text, or field names shown by kind (['customer', 'due_on'] → Acme · Jan 2, 2026).

icon?string

Iconify id inside the state pill.

badge?string

The state pill's text.

hint?string

One sentence behind the pill.

actions?Snippet

Placed in the record header (serial-pcn's "Approve as FAE").

trailing?Snippet

Beside the label in the chrome (color-matching's timeline trigger).

tabs?readonly RecordTab[]
history?RecordHistoryConfig

Related records included in the native History popover, scoped by read queries.

runs?readonly RunsForProps[]

Runs whose subject is this record, shown as a Runs tab.

children?Snippet<[RecordView]>

The representation's body; absent → the representation registered for of, else the generated view. It receives the record shown — the scrubbed revision while one is picked — as useRecordView() also does beneath.

onDone?(outcome: Outcome) => void

源码: packages/ui/src/record/RecordShell.svelte:20

RecordTab type

type RecordTab = {
    name: string;
    title: string;
    body: Snippet;
    icon?: string;
    keepAlive?: true;
};

An authored tab; a keepAlive tab stays mounted while hidden, so a form inside it keeps its state.

成员

名称类型说明
namestring
titlestring
bodySnippet
icon?string
keepAlive?true

源码: packages/ui/src/record/RecordShell.svelte:12

RecordView type

type RecordView<C extends string = string> = {
    collection: C;
    mode: 'view' | 'edit';
    record: RecordOf<C>;
    capabilities?: RecordCapabilities;
} | {
    collection: C;
    mode: 'create';
    values: Partial<InsertOf<C>>;
};

X-20: what a +representation.svelte receives, { view: RecordView<'<collection>'> }.

源码: packages/ui/src/record/types.ts:49

RepresentationLoader type

type RepresentationLoader = () => Promise<{
    default: Component<{
        view: RecordView;
    }>;
}>;

A collection's +representation.svelte, loaded on first use (its module may import $bolt).

源码: packages/ui/src/record/types.ts:53

RestorePreview type

type RestorePreview = {
    collection: string;
    record: string;
    revision: number;
    live: number;
    changes: readonly {
        field: string;
        current: Json;
        restored: Json;
        approval: boolean;
    }[];
    skipped: readonly {
        field: string;
        reason: RestoreSkip;
        current: Json;
        restored: Json;
    }[];
};

history.preview: what restoring past revision would write over the live record (live), field by field, and what it leaves alone and why. approval: that field's write routes to an approval rather than committing.

成员

名称类型说明
collectionstring
recordstring
revisionnumber
livenumber
changesreadonly { field: string; current: Json; restored: Json; approval: boolean; }[]
skippedreadonly { field: string; reason: RestoreSkip; current: Json; restored: Json; }[]

源码: packages/ui/src/record/types.ts:40

RestoreSkip type

type RestoreSkip = 'deletedTarget' | 'readOnly' | 'noGrant' | 'stateLocked' | 'masked' | 'definitionChanged';

Why a past value is not written back by a per-record restore.

源码: packages/ui/src/record/types.ts:34

ReviewBanner component

component ReviewBanner(props: ReviewBannerProps)

The approval proposals for a record (or for a request id) with the decisions the viewer may take.

属性

名称类型说明
target{ collection: string; id: string; } | string

源码: packages/ui/src/approval/ReviewBanner.svelte:1

ReviewBannerProps type

type ReviewBannerProps = {
    target: {
        collection: string;
        id: string;
    } | string;
};

A stored record, or the request id a pendingApproval outcome carries.

成员

名称类型说明
target{ collection: string; id: string; } | string

源码: packages/ui/src/approval/ReviewBanner.svelte:7

Row type

type Row = {
    readonly [field: string]: Value;
};

A row's values by field name.

源码: packages/ui/src/form/draft.ts:11

RowAction type

type RowAction<R = Row> = {
    [A in ActionKey]: {
        action: A;
        input?: (row: R) => ActionInputOf<A>;
        confirm?: string;
        label?: string;
    };
}[ActionKey];

A row action literal: { action: '<c>.<a>', input?, confirm? }; the default input targets the row.

成员

名称类型说明
actionA
input?(row: R) => ActionInputOf<A>
confirm?string
label?string

源码: packages/ui/src/table/Table.svelte:84

RowIn type

type RowIn<S> = S extends string ? RowOf<S> & Values : S extends {
    query: infer N;
} ? PageRow<QueryOutputOf<N>> : S extends Q<infer T> ? PageRow<T> : S extends readonly (infer R extends Values)[] ? R : Values;

The row a source yields: the collection's caller row, the query's or read's rows, or the array's element.

源码: packages/ui/src/table/Table.svelte:50

RowOf type

type RowOf<C> = C extends keyof Collections ? Collections[C]['row'] : Row;

A collection's row as a view's read returns it (json, custom and file fields only when selected), its whole row as a record view reads it, its create input, its filter and its sort.

源码: packages/ui/src/collection/types.ts:47

Rows component

component Rows(props: RowsProps)

An editable list of child rows inside a parent's form: add, edit and remove rows, reported as the relation operations of the parent's one act.

属性

名称类型说明
rowsreadonly Row[]

The child rows as loaded (empty on create).

columnsreadonly Col[]
add() => Row

A new child row's initial values.

min?number
max?number
onChange(ops: RowsOps, current: readonly Row[]) => void

Each edit: the explicit relation ops for the parent's one act, and the rows as shown.

源码: packages/ui/src/relations/Rows.svelte:1

RowsProps type

type RowsProps = {
    /** The child rows as loaded (empty on create). */
    rows: readonly Row[];
    columns: readonly Col[];
    /** A new child row's initial values. */
    add: () => Row;
    min?: number;
    max?: number;
    /** Each edit: the explicit relation ops for the parent's one act, and the rows as shown. */
    onChange: (ops: RowsOps, current: readonly Row[]) => void;
};

The props of Rows.

成员

名称类型说明
rowsreadonly Row[]

The child rows as loaded (empty on create).

columnsreadonly Col[]
add() => Row

A new child row's initial values.

min?number
max?number
onChange(ops: RowsOps, current: readonly Row[]) => void

Each edit: the explicit relation ops for the parent's one act, and the rows as shown.

源码: packages/ui/src/relations/Rows.svelte:10

RunStatus component

component RunStatus(props: RunStatusProps)

The live status of one automation run: queued, running with its progress, or its result or error.

属性

名称类型说明
automationstring
runstring | { readonly id: string; } | RunRow
title?string

The automation's name; else its catalog label (automations.<key>.label), else its name in words (jobs.send_pdf → Send pdf).

download?boolean

Download the run's files once when it succeeds: a run the person just started to get a file (a template, an export).

源码: packages/ui/src/runs/RunStatus.svelte:1

RunStatusProps type

type RunStatusProps = {
    automation: string;
    run: string | {
        readonly id: string;
    } | RunRow;
    /** The automation's name; else its catalog label (`automations.<key>.label`), else its name in words (`jobs.send_pdf` → `Send pdf`). */
    title?: string;
    /** Download the run's files once when it succeeds: a run the person just started to get a file (a template, an export). */
    download?: boolean;
};

run is a run id, a RunHandle, or a row already read (RunsFor), which is shown without a second read.

成员

名称类型说明
automationstring
runstring | { readonly id: string; } | RunRow
title?string

The automation's name; else its catalog label (automations.<key>.label), else its name in words (jobs.send_pdf → Send pdf).

download?boolean

Download the run's files once when it succeeds: a run the person just started to get a file (a template, an export).

源码: packages/ui/src/runs/RunStatus.svelte:8

RunsFor component

component RunsFor(props: RunsForProps)

The latest runs of one automation matching where, newest first, each with its RunStatus.

属性

名称类型说明
automationstring
title?string
where?Json
limit?number

源码: packages/ui/src/runs/RunsFor.svelte:1

RunsForProps type

type RunsForProps = {
    automation: string;
    title?: string;
    where?: Json;
    limit?: number;
};

The latest runs of one automation that match where (e.g. those started for a record), newest first; title names the automation (else its catalog label automations.<key>.label, else its name in words).

成员

名称类型说明
automationstring
title?string
where?Json
limit?number

源码: packages/ui/src/runs/RunsFor.svelte:9

SchemaEditor component

component SchemaEditor(props: SchemaEditorProps)

Edits a structured value by its kind literal: an object's fields, a list's items, a tagged union's arm, a record's entries.

属性

名称类型说明
kindKind
valueValue
onChange(next: Value) => void
name?string

This value's dotted path; problems are looked up under it (lines.0.amount).

disabled?boolean
errors?ReadonlyMap<string, string>

源码: packages/ui/src/kinds/schema-editor.svelte:1

SchemaEditorProps type

type SchemaEditorProps = {
    kind: Kind;
    value: Value;
    onChange(next: Value): void;
    /** This value's dotted path; problems are looked up under it (`lines.0.amount`). */
    name?: string;
    disabled?: boolean;
    errors?: ReadonlyMap<string, string>;
};

Edits a structured value by its kind literal (§3.6 SchemaEditor): an object's fields, a list's items (add, remove, reorder), a tagged union (the tag picks the arm) and a string-keyed record. Leaves are the kind editors, so a json shape, a custom field's shape and an action's input all edit the same way.

成员

名称类型说明
kindKind
valueValue
onChange(next: Value) => void
name?string

This value's dotted path; problems are looked up under it (lines.0.amount).

disabled?boolean
errors?ReadonlyMap<string, string>

源码: packages/ui/src/kinds/schema-editor.svelte:15

Section component

component Section(props: SectionProps)

One titled section of a form or record body: a heading row (title, an optional ⓘ hint, a mark, actions) over its content. A titled section collapses from its heading; the body is hidden, never unmounted, so every field in it still saves. Closed, the heading shows summary so nothing important is out of sight. The viewer's open state is remembered per collection and section; a section holding a field with an error opens itself.

属性

名称类型说明
title?string

The heading. Without one the section is plain content, always open.

hint?string

One sentence saying what the section decides, behind an info icon beside the title.

name?string

The stable key the open state is remembered under (default title, which changes with the locale).

first?boolean

No rule above: the first section of a body.

collapsible?boolean

Default true for a titled section.

defaultOpen?boolean

Open until the viewer chooses otherwise. Default true: a secondary section passes false.

summary?string | Snippet

Shown beside the title while collapsed ("3 files", "Not set").

trailing?Snippet

A mark on the title row — a state badge, never a control.

actions?Snippet

Controls that act on the section, at the end of the title row.

class?string
childrenSnippet

源码: packages/ui/src/form/section.svelte:1

SectionProps type

type SectionProps = {
    /** The heading. Without one the section is plain content, always open. */
    title?: string;
    /** One sentence saying what the section decides, behind an info icon beside the title. */
    hint?: string;
    /** The stable key the open state is remembered under (default `title`, which changes with the locale). */
    name?: string;
    /** No rule above: the first section of a body. */
    first?: boolean;
    /** Default true for a titled section. */
    collapsible?: boolean;
    /** Open until the viewer chooses otherwise. Default true: a secondary section passes `false`. */
    defaultOpen?: boolean;
    /** Shown beside the title while collapsed ("3 files", "Not set"). */
    summary?: string | Snippet;
    /** A mark on the title row — a state badge, never a control. */
    trailing?: Snippet;
    /** Controls that act on the section, at the end of the title row. */
    actions?: Snippet;
    class?: string;
    children: Snippet;
};

The props of Section.

成员

名称类型说明
title?string

The heading. Without one the section is plain content, always open.

hint?string

One sentence saying what the section decides, behind an info icon beside the title.

name?string

The stable key the open state is remembered under (default title, which changes with the locale).

first?boolean

No rule above: the first section of a body.

collapsible?boolean

Default true for a titled section.

defaultOpen?boolean

Open until the viewer chooses otherwise. Default true: a secondary section passes false.

summary?string | Snippet

Shown beside the title while collapsed ("3 files", "Not set").

trailing?Snippet

A mark on the title row — a state badge, never a control.

actions?Snippet

Controls that act on the section, at the end of the title row.

class?string
childrenSnippet

源码: packages/ui/src/form/section.svelte:12

SemanticIssue type

type SemanticIssue = {
    readonly field: string;
    readonly message: string;
};

One invariant a registered rule finds broken: field is any key the rule chooses (repayments.3.amount).

成员

名称类型说明
fieldstring
messagestring

源码: packages/ui/src/form/form-state.svelte.ts:30

Sheet component

component Sheet(props: SheetProps)

A panel sliding in from an edge over the page, with a heading, header actions and a close button. On a phone every sheet is the same bottom drawer: rounded on top, its grabber dragged to resize it or tapped to expand it up to the shell's top bar (--shell-header-height). On a wide screen a right sheet drags wider or narrower by its left edge and goes full screen from its header.

属性

名称类型说明
open?boolean
onOpenChange?(open: boolean) => void
side?'left' | 'right'
title?string

The heading and accessible name.

header?Snippet

Replaces the heading (a record label with badges); the close button stays.

actions?Snippet

Header content beside the close button (record actions).

childrenSnippet
class?string

源码: packages/ui/src/primitives/sheet/sheet.svelte:1

SheetProps type

type SheetProps = {
    open?: boolean;
    onOpenChange?: (open: boolean) => void;
    side?: 'left' | 'right';
    /** The heading and accessible name. */
    title?: string;
    /** Replaces the heading (a record label with badges); the close button stays. */
    header?: Snippet;
    /** Header content beside the close button (record actions). */
    actions?: Snippet;
    children: Snippet;
    class?: string;
};

The props of Sheet: open, the side, the title or header, actions and body.

成员

名称类型说明
open?boolean
onOpenChange?(open: boolean) => void
side?'left' | 'right'
title?string

The heading and accessible name.

header?Snippet

Replaces the heading (a record label with badges); the close button stays.

actions?Snippet

Header content beside the close button (record actions).

childrenSnippet
class?string

源码: packages/ui/src/primitives/sheet/sheet.svelte:12

Show component

component Show(props: ShowProps)

Shows any stored or input value by its kind; readonly form values stay copyable.

属性

名称类型说明
kindKind
valueValue | undefined
name?string
row?{ readonly [field: string]: Value; }
class?string
readonly?boolean
relation?{ targets: readonly string[]; }
address?string
id?string

源码: packages/ui/src/kinds/show.svelte:1

ShowOptions type

type ShowOptions = EnumScope & {
    locale?: string;
    currency?: string;
    zone?: string;
};

How format renders a value: the enum's collection and field for catalog labels, the locale, the default currency and the zone.

成员

名称类型说明
t?(key: string) => string
collection?string
field?string
locale?string
currency?string
zone?string

源码: packages/ui/src/kinds/kind.ts:155

ShowProps type

type ShowProps = {
    kind: Kind;
    value: Value | undefined;
    name?: string;
    row?: {
        readonly [field: string]: Value;
    };
    class?: string;
    readonly?: boolean;
    relation?: {
        targets: readonly string[];
    };
    address?: string;
    id?: string;
};

A value and its declared kind, with optional row/relation context for labels and currency; readonly output remains copyable and masked values stay hidden.

成员

名称类型说明
kindKind
valueValue | undefined
name?string
row?{ readonly [field: string]: Value; }
class?string
readonly?boolean
relation?{ targets: readonly string[]; }
address?string
id?string

源码: packages/ui/src/kinds/show.svelte:10

Spinner component

component Spinner(props: $$ComponentProps)

A loading spinner.

属性

名称类型说明
class?string
label?string

源码: packages/ui/src/primitives/spinner/spinner.svelte:1

StateBadge component

component StateBadge(props: StateBadgeProps)

A state field's value as a coloured pill, in its words (label, else the catalog's, else the value humanized).

属性

名称类型说明
statestring
label?string
class?string

源码: packages/ui/src/kinds/state-badge.svelte:1

StateBadgeProps type

type StateBadgeProps = {
    state: string;
    label?: string;
    class?: string;
};

The props of StateBadge.

成员

名称类型说明
statestring
label?string
class?string

源码: packages/ui/src/kinds/state-badge.svelte:7

TAB_LEVEL const

const TAB_LEVEL: typeof TAB_LEVEL

The context key carrying the enclosing Tabs level; an overlay (a sheet) clears it to start a new hierarchy.

源码: packages/ui/src/primitives/tabs/level.ts:4

TabItem type

type TabItem = {
    name: string;
    title: string;
    body: Snippet;
    icon?: string;
    keepAlive?: true;
    disabled?: boolean;
};

One tab (§3.6 RecordTab): a keepAlive tab stays mounted while hidden, so a form inside keeps its state.

成员

名称类型说明
namestring
titlestring
bodySnippet
icon?string
keepAlive?true
disabled?boolean

源码: packages/ui/src/primitives/tabs/tabs.svelte:10

Table component

component Table(props: TableProps<S, RowIn<S>, ColumnsIn<S>>)

A typed table over collection rows, a query/read or local values, with kind-aware cells, paging, filters, sorting and permitted row actions.

属性

名称类型说明
ofS & TableSource<R & Partial<K>>
columnsreadonly Col<R, K>[]
where?S extends string ? WhereOf<S> : Where

The author's fixed scope: ANDed under every viewer filter, shown read-only in the view popover, never clearable.

initialFilter?S extends string ? WhereOf<S> : Where

Seed rows of the view popover the viewer may edit or clear; a cleared choice is kept in the URL.

orderBy?S extends string ? OrderByOf<S> : OrderBy

The initial sort; a viewer's sort replaces it and clearing restores it.

pageSize?10 | 25 | 50 | 100 | 200
layout?'responsive' | 'grid'

Financial reports retain a horizontally scrollable grid on narrow screens.

toolbar?Toolbar<R>

The chrome: title, description, search, filter and sort, the actions menu and New (ViewToolbar).

actions?readonly RowAction<R>[]
key?string

The URL parameter prefix; defaults to the source's name.

every?string

A clock query's refresh (every, rule 64).

empty?Snippet
onOpen?(row: R) => void
onChange?(next: R[]) => void

Local arrays only: editable when given; each change is a fresh array.

add?() => R
remove?boolean

源码: packages/ui/src/table/Table.svelte:1

TableProps type

type TableProps<S = TableSource, R extends Values = RowIn<S>, K = ColumnsIn<S>> = {
    of: S & TableSource<R & Partial<K>>;
    columns: readonly Col<R, K>[];
    /** The author's fixed scope: ANDed under every viewer filter, shown read-only in the view popover, never clearable. */
    where?: S extends string ? WhereOf<S> : Where;
    /** Seed rows of the view popover the viewer may edit or clear; a cleared choice is kept in the URL. */
    initialFilter?: S extends string ? WhereOf<S> : Where;
    /** The initial sort; a viewer's sort replaces it and clearing restores it. */
    orderBy?: S extends string ? OrderByOf<S> : OrderBy;
    pageSize?: 10 | 25 | 50 | 100 | 200;
    /** Financial reports retain a horizontally scrollable grid on narrow screens. */
    layout?: 'responsive' | 'grid';
    /** The chrome: title, description, search, filter and sort, the actions menu and New (`ViewToolbar`). */
    toolbar?: Toolbar<R>;
    actions?: readonly RowAction<R>[];
    /** The URL parameter prefix; defaults to the source's name. */
    key?: string;
    /** A clock query's refresh (`every`, rule 64). */
    every?: string;
    empty?: Snippet;
    onOpen?: (row: R) => void;
    /** Local arrays only: editable when given; each change is a fresh array. */
    onChange?: (next: R[]) => void;
    add?: () => R;
    remove?: boolean;
};

Typed by the source of names, including the native row and authored column field types.

成员

名称类型说明
ofS & TableSource<R & Partial<K>>
columnsreadonly Col<R, K>[]
where?S extends string ? WhereOf<S> : Where

The author's fixed scope: ANDed under every viewer filter, shown read-only in the view popover, never clearable.

initialFilter?S extends string ? WhereOf<S> : Where

Seed rows of the view popover the viewer may edit or clear; a cleared choice is kept in the URL.

orderBy?S extends string ? OrderByOf<S> : OrderBy

The initial sort; a viewer's sort replaces it and clearing restores it.

pageSize?10 | 25 | 50 | 100 | 200
layout?'responsive' | 'grid'

Financial reports retain a horizontally scrollable grid on narrow screens.

toolbar?Toolbar<R>

The chrome: title, description, search, filter and sort, the actions menu and New (ViewToolbar).

actions?readonly RowAction<R>[]
key?string

The URL parameter prefix; defaults to the source's name.

every?string

A clock query's refresh (every, rule 64).

empty?Snippet
onOpen?(row: R) => void
onChange?(next: R[]) => void

Local arrays only: editable when given; each change is a fresh array.

add?() => R
remove?boolean

源码: packages/ui/src/table/Table.svelte:93

TableSource type

type TableSource<R extends Values = Values> = CollectionKey | {
    [N in QueryKey]: {
        query: N;
        input?: QueryInputOf<N>;
        on?: readonly CollectionKey[];
    };
}[QueryKey] | Q<TableData<R>> | readonly R[];

A table's source: a collection name, a named collection query, a native read/query Effect, or a local row array.

源码: packages/ui/src/table/Table.svelte:37

Tabs component

component Tabs(props: TabsProps)

A tab strip with the selected tab's body; keepAlive tabs stay mounted while hidden.

属性

名称类型说明
tabsreadonly TabItem[]
value?string
onValueChange?(value: string) => void
class?string
trailing?Snippet

Rendered at the list's end (a toolbar, a trailing action).

leading?Snippet

Rendered before the list (a scope picker the tabs read): the tabs then sit flush right, wrapping below on narrow.

level?TabLevel

The hierarchy level: 1 segmented (top), 2 underline, 3 chips. Omitted, it is one below the enclosing Tabs (1 at the top); an explicit level out of that order warns in the console.

orientation?'horizontal' | 'vertical'

vertical: a rail of tabs on the left, the body on the right (a compact scroller on a narrow container). Omitted, a nested strip (level 2 or deeper) of more than two tabs is vertical; a top strip, or two tabs, is horizontal.

源码: packages/ui/src/primitives/tabs/tabs.svelte:1

TabsProps type

type TabsProps = {
    tabs: readonly TabItem[];
    value?: string;
    onValueChange?: (value: string) => void;
    class?: string;
    /** Rendered at the list's end (a toolbar, a trailing action). */
    trailing?: Snippet;
    /** Rendered before the list (a scope picker the tabs read): the tabs then sit flush right, wrapping below on narrow. */
    leading?: Snippet;
    /**
     * The hierarchy level: 1 `segmented` (top), 2 `underline`, 3 `chips`. Omitted, it is one below the enclosing
     * `Tabs` (1 at the top); an explicit level out of that order warns in the console.
     */
    level?: TabLevel;
    /**
     * `vertical`: a rail of tabs on the left, the body on the right (a compact scroller on a narrow container). Omitted,
     * a nested strip (level 2 or deeper) of more than two tabs is vertical; a top strip, or two tabs, is horizontal.
     */
    orientation?: 'horizontal' | 'vertical';
};

The props of Tabs: the tabs, the bindable selected value, and trailing content.

成员

名称类型说明
tabsreadonly TabItem[]
value?string
onValueChange?(value: string) => void
class?string
trailing?Snippet

Rendered at the list's end (a toolbar, a trailing action).

leading?Snippet

Rendered before the list (a scope picker the tabs read): the tabs then sit flush right, wrapping below on narrow.

level?TabLevel

The hierarchy level: 1 segmented (top), 2 underline, 3 chips. Omitted, it is one below the enclosing Tabs (1 at the top); an explicit level out of that order warns in the console.

orientation?'horizontal' | 'vertical'

vertical: a rail of tabs on the left, the body on the right (a compact scroller on a narrow container). Omitted, a nested strip (level 2 or deeper) of more than two tabs is vertical; a top strip, or two tabs, is horizontal.

源码: packages/ui/src/primitives/tabs/tabs.svelte:19

Textarea component

component Textarea(props: Omit<WithElementRef<HTMLTextareaAttributes>, "children">)

A multi-line text input, bindable value. readonly (or an enclosing readonly form) shows the text, copyable, with no field chrome; disabled keeps the box, muted.

属性

名称类型说明
ref?U | null

源码: packages/ui/src/primitives/textarea/textarea.svelte:1

TimeInput component

component TimeInput(props: TimeInputProps<TimeValue>)

Edits dates, instants or clocks, singly or as an array.

属性

名称类型说明
id?string
max?string
min?string
precision?Precision

The unit picked and emitted, snapped to its start (a field's declared precision): year, month and week (from Monday) pick from a unit grid, day from the calendar, hour a day and an hour; minute (the default of an instant or a time) as typed. An instant snaps in the viewer's zone (rule 68).

readonly?boolean

Shows the value as copyable text; an enclosing readonly form sets it.

invalid?boolean
disabled?boolean
of?'date' | 'instant' | 'time'
valuestring | null
onChange((next: string | null) => void) | ((next: readonly (string | null)[]) => void)

源码: packages/ui/src/kinds/time-input.svelte:1

TimeInputProps type

type TimeInputProps<V extends TimeValue = TimeValue> = Common & (V extends readonly (string | null)[] ? {
    value: readonly (string | null)[];
    onChange(next: readonly (string | null)[]): void;
} : {
    value: string | null;
    onChange(next: string | null): void;
});

Date/instant/time editor options with a value and change callback of matching scalar or array shape; array mode offers adding and removing entries.

源码: packages/ui/src/kinds/time-input.svelte:11

TimePrecision type

type TimePrecision = 'hour' | 'minute';

The unit a time is picked in and snapped to.

源码: packages/std/src/kind.ts:14

TimeRangeInput component

component TimeRangeInput(props: TimeRangeInputProps)

Edits date, instant or clock ranges, singly or as an array, at the requested precision.

属性

名称类型说明
id?string
precision?Precision

The unit both ends are picked in (a field's declared precision), snapped: a date period runs from the first day of its first unit to the last day of its last; an instant period from the start of its first unit to the start of the unit after its last (closed-open). year, month, week pick from unit grids; day and hour from the calendar.

readonly?boolean

Shows the value as copyable text; an enclosing readonly form sets it.

invalid?boolean
disabled?boolean
variant?'picker' | 'input'

A range summary trigger; use input for directly editable date/time segments.

of'date' | 'instant' | 'time'
valueValue
onChange(next: Value) => void
aria-label?string

源码: packages/ui/src/kinds/time-range-input.svelte:1

TimeRangeInputProps type

type TimeRangeInputProps = Omit<PeriodInputProps, 'of' | 'value' | 'onChange'> & {
    of: 'date' | 'instant' | 'time';
    value: Value;
    onChange(next: Value): void;
    'aria-label'?: string;
};

The datatype, precision and controlled scalar or array ranges of TimeRangeInput.

成员

名称类型说明
id?string
precision?Precision

The unit both ends are picked in (a field's declared precision), snapped: a date period runs from the first day of its first unit to the last day of its last; an instant period from the start of its first unit to the start of the unit after its last (closed-open). year, month, week pick from unit grids; day and hour from the calendar.

readonly?boolean

Shows the value as copyable text; an enclosing readonly form sets it.

invalid?boolean
disabled?boolean
variant?'picker' | 'input'

A range summary trigger; use input for directly editable date/time segments.

of'date' | 'instant' | 'time'
valueValue
onChange(next: Value) => void
aria-label?string

源码: packages/ui/src/kinds/time-range-input.svelte:10

TimeValue type

type TimeValue = string | null | readonly (string | null)[];

A date, instant or clock value as text, an empty value, or an ordered array of those values.

源码: packages/ui/src/kinds/time-input.svelte:6

ToastItem type

type ToastItem = {
    readonly id: number;
    readonly text: string;
    readonly description?: string;
    readonly tone: ToastTone;
};

A queued toast.

成员

名称类型说明
idnumber
textstring
description?string
toneToastTone

源码: packages/ui/src/toast/toast.svelte.ts:7

ToastOptions type

type ToastOptions = {
    description?: string;
    duration?: number;
};

description is a second, muted line; duration (ms) defaults to 4 s, 6 s for an error.

成员

名称类型说明
description?string
duration?number

源码: packages/ui/src/toast/toast.svelte.ts:14

ToastTone type

type ToastTone = 'default' | 'success' | 'info' | 'warning' | 'error';

A toast's colour and icon.

源码: packages/ui/src/toast/toast.svelte.ts:5

Toaster component

component Toaster(props: { $$events?: { [evt: string]: CustomEvent<any>; } | undefined; $$slots?: {} | undefined; })

The page's toasts, bottom right (bottom centre on a phone, above the safe area). Mount one, in the shell.

源码: packages/ui/src/toast/toaster.svelte:1

Toolbar type

type Toolbar<R = Row> = false | {
    /** Default: the collection's label. */
    title?: string | false;
    /** Behind the info icon. Default: the collection's declared description, else its model's. */
    description?: string | false;
    /** Default on where the collection declares search fields. */
    search?: boolean;
    /** The filter-and-sort popover (rule 16b). Default on. */
    filter?: boolean;
    /** Author items in the actions menu, in a group of their own; `false` hides the menu. */
    actions?: readonly ToolbarItem<R>[] | false;
    /** "Export CSV" of the rows in view. Default on; replaced by "Export" when the collection declares an export pipeline. */
    export?: boolean;
    /** "Delete selected records" when the collection declares delete and the viewer may delete (turns selection on). Default on. */
    delete?: boolean;
    /** Record checkboxes (`Table` and `Board`). Default: on for permitted bulk edits, deletes or selection actions. */
    select?: boolean;
    /** The New button: the record sheet in create mode, or the author's own (a prefilled create). Default: the viewer may create. */
    new?: boolean | (() => void);
    /** The page's own scope controls (a period picker, an entity picker), placed in the toolbar before search. Never actions. */
    controls?: Snippet;
    /** Compact task controls at the right edge, before New. */
    trailing?: Snippet;
    /**
     * What the view is scoped to (`{ company_id, period }`), handed to the col…

A view's whole chrome, one shape on Table, Board, Map and Pivot. Every key defaults from the collection's declaration and the viewer's grants; toolbar={false} renders none.

源码: packages/ui/src/collection/ViewToolbar.svelte:66

ToolbarItem type

type ToolbarItem<R = Row> = {
    /** An Iconify id (`lucide:upload`). */
    icon: string;
    name: string;
    /** One line under the name. */
    description?: string;
    run: (selected: IdIn<R>[]) => Effect.Effect<unknown, Error> | void;
    /** Turns row selection on; the item is disabled until records are selected. */
    requiresSelection?: true;
    /** Why the item cannot run now (over this selection), or null when it can; shown instead of `description`. */
    disabled?: (selected: IdIn<R>[]) => string | null;
};

An author's actions-menu item (§3.6): an icon, a name, a line of description and the handler itself. The menu owns the rest: a promise the handler returns is the item's pending state, a rejection or a refused outcome its error (in place and as a toast), an Outcome (bolt.act) is toasted, and a run handle (bolt.start) shows its run under the toolbar. A handler that returns nothing closes the menu (it opened a sheet or a file picker of its own).

成员

名称类型说明
iconstring

An Iconify id (lucide:upload).

namestring
description?string

One line under the name.

run(selected: IdIn<R>[]) => Effect.Effect<unknown, Error> | void
requiresSelection?true

Turns row selection on; the item is disabled until records are selected.

disabled?(selected: IdIn<R>[]) => string | null

Why the item cannot run now (over this selection), or null when it can; shown instead of description.

源码: packages/ui/src/collection/ViewToolbar.svelte:50

Tooltip component

component Tooltip(props: $$ComponentProps)

A tooltip on hover or focus of its trigger, with a text or snippet body.

属性

名称类型说明
delayDuration?number

Hover open delay in ms. The delay in milliseconds before the tooltip opens.

disabled?boolean

When true, renders the trigger without a tooltip. When true, the tooltip will be disabled and will not open.

ignoreNonKeyboardFocus?boolean

When true, focus from dialog autofocus / mouse click does not open the tooltip — only keyboard focus does.

side?ContentProps['side'] | undefined
sideOffset?ContentProps['sideOffset']
align?ContentProps['align'] | undefined
avoidCollisions?ContentProps['avoidCollisions']

Let Floating UI flip/shift the content to keep it on screen. Bits UI defaults this to true, but leaves collisionPadding at 0; we default to an 8px gutter instead.

collisionPadding?ContentProps['collisionPadding']
text?string | undefined

Simple string body. Prefer content for richer markup.

contentClass?string
arrowClasses?string

Text-color class for the SVG arrow; match this when overriding the content surface.

triggerSnippet<[{ props: Record<string, unknown>; }]>
content?Snippet

源码: packages/ui/src/primitives/tooltip/tooltip.svelte:1

UiTextKey type

type UiTextKey = keyof typeof UI_TEXT;

A key of the kit's own chrome strings.

源码: packages/ui/src/primitives/utils.ts:142

Value type

type Value = null | boolean | number | string | Decimal | readonly Value[] | {
    readonly [key: string]: Value;
};

A decoded value: JSON, with std's Decimal for a decimal, money or sum value.

源码: packages/std/src/kind.ts:109

ViewBolt type

type ViewBolt = {
    read<T = Page>(collection: string, options: Value): Q<T>;
    /** `{ revision }`: the record as of that revision (L-BOLT-181), for the record shell's scrubber. */
    get<T = Row | null>(collection: string, id: string, select?: Json, options?: {
        revision?: number;
    }): Q<T>;
    aggregate<T = readonly Values[]>(collection: string, options: Value): Q<T>;
    history<T = Json>(collection: string, id: string, options?: {
        at?: Json;
    }): Q<T>;
    query<T = Json>(name: string, input: Value): Q<T>;
    /** A named similarity search (§3.3.4): `similar(c, '<name>', input, { where?, select?, limit })`, nearest first. */
    similar?<T = readonly Row[]>(collection: string, search: string, input: Value, options: Value): Q<T>;
    live<T>(q: Q<T>, options?: {
        every?: string;
        on?: readonly string[];
    }): Live<T>;
    recordCapabilities?(collection: string, id: string, parent?: RecordParentContext): Effect.Effect<RecordCapabilities | null, Error>;
    act(callable: string, input: Value, options?: {
        key?: string;
        observed?: Readonly<Record<string, number>>;
    }): Effect.Effect<ActSuccess, ActFailure>;
    /**
     * Per-record restore (rule 17): `preview` says what taking a live record's own fields back to a past revision would
     * write; `run` writes it as one update observed at `live`, recorded in history as restored from that revision.
     */
    restore?: {
        preview(collection: string, record: …

The client a view reads and acts through (the page's $bolt), as provideBolt hands it to the views.

成员

名称类型说明
read<T = Page>(collection: string, options: Value) => Q<T>
get<T = Row | null>(collection: string, id: string, select?: Json, options?: { revision?: number; }) => Q<T>

{ revision }: the record as of that revision (L-BOLT-181), for the record shell's scrubber.

aggregate<T = readonly Values[]>(collection: string, options: Value) => Q<T>
history<T = Json>(collection: string, id: string, options?: { at?: Json; }) => Q<T>
query<T = Json>(name: string, input: Value) => Q<T>
similar?(<T = readonly Row[]>(collection: string, search: string, input: Value, options: Value) => Q<T>) | undefined

A named similarity search (§3.3.4): similar(c, '<name>', input, { where?, select?, limit }), nearest first.

live<T>(q: Q<T>, options?: { every?: string; on?: readonly string[]; }) => Live<T>
recordCapabilities?((collection: string, id: string, parent?: RecordParentContext) => Effect.Effect<RecordCapabilities | null, Error>) | undefined
act(callable: string, input: Value, options?: { key?: string; observed?: Readonly<Record<string, number>>; }) => Effect.Effect<ActSuccess, ActFailure>
restore?{ preview(collection: string, record: string, revision: number): Effect.Effect<RestorePreview, Error>; run(collection: string, record: string, revision: number, live: number): Effect.Effect<ActSuccess, ActFailure>; }

Per-record restore (rule 17): preview says what taking a live record's own fields back to a past revision would write; run writes it as one update observed at live, recorded in history as restored from that revision.

start(automation: string, input: Value | readonly Value[]) => RunHandle
runs?((automation: string, options: { where?: Json; limit: number; }) => Live<Page<RunRow>>) | undefined

§3.5 runs(automation, { where?, limit }); absent until the client serves it (views then say so).

fileUrl(ref: Pick<FileRef, "id">, options?: FileUrlOptions) => string
decode?((collection: string, q: { where?: Json; orderBy?: Json; }) => { where: Json; orderBy?: Json; dropped: readonly { path: string; message: string; }[]; }) | undefined

§3.5 rule 11a in the browser: each top-level condition and sort key kept or dropped alone. Absent → the view's own check.

describe?((collection: string, text: string, fields?: readonly { name: string; label: string; kind: 'text' | 'number' | 'bool'; optional?: boolean; }[]) => Effect.Effect<{ where: Json; orderBy?: Json; }, Error>) | undefined

Rule 16a filter.describe: present only when the host binds decisions or ai (P19); rejects when no filter could be built.

options?((collection: string, fields?: readonly { name: string; label: string; kind: "text" | "number" | "bool"; optional?: boolean; }[]) => Effect.Effect<{ fields: readonly Offer[]; }, Error>) | undefined

Rule 16b filter.options: the same condition catalogue a description is offered, so the builder renders exactly what it may author.

approvals{ /** One move of the request's state machine; `reason` is the decision's reason, the comment or the resubmit note. */ process(requestId: string, decision: { status: ApprovalStatus; reason?: string; }): Effect.Effect<ActSuccess, ActFailure>; /** The approval view (§3.8): the request, its flow and decisions, and what the viewer may do; `null` when not visible. */ get?(requestId: string): Effect.Ef…
actorJson
localestring
t(key: string, vars?: { readonly [name: string]: string | number; }) => string

源码: packages/ui/src/client/contract.ts:157

Virtual type

type Virtual = ReturnType<typeof virtualList>;

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

成员

名称类型说明
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.

源码: packages/ui/src/primitives/virtual/virtual.svelte.ts:27

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;
};

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

成员

名称类型说明
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).

源码: packages/ui/src/primitives/virtual/virtual.svelte.ts:15

Workspace interface

interface Workspace {
}

The workspace's names as its views see them. Empty here, so ui stays workspace-agnostic: @norbital-ai/bolt fills names from the workspace's generated index, and of, columns, values, record and ids are then checked per collection. Unfilled (a host, ui's own tests), any name and any row goes.

成员

名称类型说明
namesViewNames

源码: packages/ui/src/collection/types.ts:13

beginWorkspaceNavigation function

function beginWorkspaceNavigation(message: string): () => void

Report a normal workspace handoff without replacing its current screen or moving focus.

参数

名称类型说明
messagestring

源码: packages/ui/src/utilities/workspace-navigation.ts:2

carriedContexts function

function carriedContexts(collection: string, id: string): ReadonlyMap<unknown, unknown> | undefined

The contexts the last openRecord of this record carried, taken once: the shell's sheet sets them above its RecordShell; an opening that carried none (a reload, a link) takes the page's own (pageContexts).

参数

名称类型说明
collectionstring
idstring

源码: packages/ui/src/record/navigation.ts:55

cn function

function cn(...inputs: ClassValue[]): string

Joins class names and merges conflicting Tailwind classes (the last wins).

参数

名称类型说明
inputsClassValue[]

源码: packages/ui/src/primitives/utils.ts:7

confirmAction function

function confirmAction(options: ConfirmOptions): Effect.Effect<boolean>

true when the person confirmed; false on cancel, Escape or dismissal.

参数

名称类型说明
optionsConfirmOptions
  • title: string
  • body?: string | undefined
  • confirmLabel: string

    The accept button's label: the action itself ("Disconnect"), never a bare "OK".

  • cancelLabel?: string | undefined

    Defaults to the UI kit's "Cancel".

  • destructive?: boolean | undefined

    Draws the accept button as destructive.

源码: packages/ui/src/primitives/dialog/confirm.ts:20

downloadTextFiles function

function downloadTextFiles(files: readonly { name: string; content: string; }[], archiveName?: string): void

One text file downloads directly; a batch downloads as one ZIP, retaining duplicate names.

参数

名称类型说明
filesreadonly { name: string; content: string; }[]
archiveName?string

源码: packages/ui/src/utilities/download.ts:10

enumText function

function enumText(value: string, o?: EnumScope): string

An enum or state value as words: its catalog key, else humanized (not_sent → Not sent, PENDING_REVIEW → Pending review). An upper-case word without a vowel or with a digit stays an acronym (SG_CPF → SG CPF), as does an upper-case word inside a lower-case value (sent_to_HR).

参数

名称类型说明
valuestring
o?EnumScope

源码: packages/ui/src/kinds/kind.ts:134

fieldEntry function

function fieldEntry(kind: Kind, host: KindsHost): { entry: CustomFieldEntry; kind: Kind; } | undefined

The custom field a kind renders through (the host's, else a built-in), and the kind its renderer reads: a custom reference's shape, else the field's own literal.

参数

名称类型说明
kindKind
hostKindsHost
  • catalog?: { readonly [collection: string]: CollectionExposure; } | undefined
  • customFields?: { readonly [name: string]: CustomFieldEntry; } | undefined
  • upload?: ((file: File, field: string) => Effect<FileRef, Extract<ActFailure, { _tag: "ActRefused"; }> | Extract<ReadError, { _tag: "TransportFailed"; }>>) | undefined

    bolt.upload; without it a file field is read-only.

  • fileUrl?: ((ref: FileRef, options?: FileUrlOptions) => string) | undefined
  • geocoder?: Geocoder

    The host's geocoder (P19); without one, address search uses the keyless photonGeocoder.

  • basemap?: { url: string; attribution: string; }

    A keyless tile template; the host may override the OpenStreetMap default.

  • read?: ((collection: string, options: Json) => Effect<{ rows: readonly ({ readonly id: string; } & { readonly [f: string]: Value; })[]; next: string | null; }, ReadError>) | undefined

    The read a picker pages through: bolt.read. Without it an id is typed.

  • locale?: string | undefined
  • zone?: string | undefined
  • currency?: string | undefined

    The workspace default currency for a money field without one (X-8).

源码: packages/ui/src/kinds/builtin/index.ts:26

fieldName function

function fieldName(kind: Kind): string | undefined

The custom renderer registered for a built-in or tenant field.

参数

名称类型说明
kindKind

源码: packages/ui/src/kinds/kind.ts:15

fieldsText function

function fieldsText(fields: Fields, row: { readonly [f: string]: unknown; }, names: readonly string[], o?: ShowOptions): string

Named fields of a row as one line by kind (a record's title, a subtitle): Q-1 · Jan 2, 2026 · On hold; empties left out.

参数

名称类型说明
fieldsFields
row{ readonly [f: string]: unknown; }
namesreadonly string[]
o?ShowOptions

源码: packages/ui/src/kinds/kind.ts:167

filesSummary function

function filesSummary(bolt: Text, ...values: readonly unknown[]): string

"No files" / "1 file" / "3 files" over every file field given (one file, a list, or nothing).

参数

名称类型说明
boltText
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string
valuesreadonly unknown[]

源码: packages/ui/src/utilities/summary.ts:22

filterLogs function

function filterLogs(rows: readonly LogLine[], hidden: Partial<Record<LogLevel, boolean>>, q: string): readonly LogLine[]

The lines whose level is not hidden and whose message or source contains q (case-insensitive).

参数

名称类型说明
rowsreadonly LogLine[]
hiddenPartial<Record<LogLevel, boolean>>
qstring

源码: packages/ui/src/logs/logs.ts:20

format function

function format(kind: Kind, value: unknown, o?: ShowOptions): string

One value as text in the viewer's locale; '' for none. Structured values render through Show, this is their summary.

参数

名称类型说明
kindKind
valueunknown
o?ShowOptions

源码: packages/ui/src/kinds/kind.ts:187

formatFileSize function

function formatFileSize(bytes: number): string

A byte count as short text in binary units (512.0 B, 12.0 KB, 3.4 MB); 0 B for none.

参数

名称类型说明
bytesnumber

源码: packages/ui/src/primitives/utils.ts:12

formatHandle function

function formatHandle(transport: string | null, handle: string, name?: string | null): string

A message sender or recipient for reading: its display name when there is one; a WhatsApp number (a JID such as 6591234567:14@s.whatsapp.net, the device suffix dropped; Twilio's whatsapp:+6591234567; bare digits on whatsapp) as its phone (+65 9123 4567, +<digits> for an unknown calling code); anything else (email, Telegram, Slack, Discord and WeChat ids, a @lid or group JID) as given.

参数

名称类型说明
transportstring | null
handlestring
name?string | null

源码: packages/ui/src/kinds/phone.ts:76

formatValue function

function formatValue(value: unknown, locale?: string): string

One native value as text, shared by views and kind renderers.

参数

名称类型说明
valueunknown
locale?string

源码: packages/ui/src/kinds/kind.ts:280

idsOf function

function idsOf<C extends string>(ids: readonly string[]): readonly IdOf<C>[]

Narrows string ids to a collection's id type (e.g. for where: { id: { in: … } }).

参数

名称类型说明
idsreadonly string[]

源码: packages/ui/src/form/form-state.svelte.ts:23

isJsonSchema function

function isJsonSchema(value: unknown): value is JsonSchema

Whether a stored value is a JSON Schema in the keywords this renderer reads: decode once where a schema enters a page.

参数

名称类型说明
valueunknown

源码: packages/ui/src/kinds/json-schema.ts:36

joinedSummary function

function joinedSummary(bolt: Text, values: readonly unknown[]): string

The set values joined by ·, or "Not set".

参数

名称类型说明
boltText
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string
valuesreadonly unknown[]

源码: packages/ui/src/utilities/summary.ts:9

jsonSchemaKind function

function jsonSchemaKind(schema: JsonSchema): Kind

A conservative rendering plan. Validation remains the caller/server's JSON Schema validator.

参数

名称类型说明
schemaJsonSchema

源码: packages/ui/src/kinds/json-schema.ts:147

label function

function label(bolt: Pick<ViewBolt, "t">, collection: string, field?: string, declared?: string): string

A collection's or field's label: the catalog key, else the field's declared label, else the humanized name (final-ui rule 32); a FK names its target (project_id → Project).

参数

名称类型说明
boltPick<ViewBolt, 't'>
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string
collectionstring
field?string
declared?string

源码: packages/ui/src/text/messages.ts:23

markdownHtml function

function markdownHtml(text: string): string

Markdown to HTML with ReadonlyMarkdown's settings: raw HTML shown as text, links only to http(s), mailto or relative.

参数

名称类型说明
textstring

源码: packages/ui/src/editors/markdown.ts:20

notesSummary function

function notesSummary(bolt: Text, value: unknown): string

A text's first 60 characters (an ellipsis past them), or "None".

参数

名称类型说明
boltText
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string
valueunknown

源码: packages/ui/src/utilities/summary.ts:15

notifyOutcome function

function notifyOutcome<O extends OutcomeFeedback>(bolt: Pick<ViewBolt, "t">, o: O, saved?: string): void

Toasts o; saved replaces the generic "Saved" (a delete says "Deleted").

参数

名称类型说明
boltPick<ViewBolt, 't'>
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string
oO
saved?string

源码: packages/ui/src/actions/notify.ts:1

onPageContexts function

function onPageContexts(listener: () => void): () => void

Subscribes to a view offering its contexts after a reader asked; the returned function unsubscribes.

参数

名称类型说明
listener() => void

源码: packages/ui/src/record/navigation.ts:47

openRecord function

function openRecord(collection: string, id: string | "new", contexts?: ReadonlyMap<unknown, unknown>): void

Opens the shell's record sheet: ?record=<collection>/<id|new>, the form the shell's bolt.href writes and reads, stacked on any sheet already open. The sheet mounts outside the page, so contexts (the opener's getAllContexts(), taken at its init) carry the page's scope into it: a create opened from a scoped page keeps its presets and narrowed pickers. They live in memory only.

参数

名称类型说明
collectionstring
idstring | 'new'
contexts?ReadonlyMap<unknown, unknown>

源码: packages/ui/src/record/navigation.ts:8

pageContexts function

function pageContexts(collection: string): ReadonlyMap<unknown, unknown> | undefined

The page's contexts for collection: a view's own collection first; else the page's ('*', offered by AppShell).

参数

名称类型说明
collectionstring

源码: packages/ui/src/record/navigation.ts:45

photonGeocoder const

const photonGeocoder: { search: (q: string, options?: { region?: string; }) => Effect.Effect<{ point: Point; address: string; }[], Schema.SchemaError | HttpClientError.HttpClientError, never>; reverse: ({ lat, lng }: Point) => Effect.Effect<string, Schema.SchemaError | HttpClientError.HttpClientError, never>; }

The keyless geocoder as Effects: a worldwide search ranks a famous street abroad above the one next door ("40 Wilkinson Road" is London's first), so with the workspace's region the query is also asked with that country's name (both at once), and its places come first.

成员

名称类型说明
search(q: string, options?: { region?: string; }) => Effect.Effect<{ point: Point; address: string; }[], Schema.SchemaError | HttpClientError.HttpClientError, never>
reverse({ lat, lng }: Point) => Effect.Effect<string, Schema.SchemaError | HttpClientError.HttpClientError, never>

源码: packages/ui/src/kinds/context.ts:246

pickerRead function

function pickerRead(target: { readonly search?: readonly string[]; readonly fields: Fields; } | undefined, labels: readonly string[], o: { where?: Json | undefined; orderBy?: Json | undefined; limit: number; }, q: string): { readonly [k: string]: Json; }

A picker's page read (§3.6): the target's search.text when it declares one, else like over the label's text and patterned seq fields; sorted by orderBy, else by the first sortable label field (a typed search ranks instead).

参数

名称类型说明
target{ readonly search?: readonly string[]; readonly fields: Fields; } | undefined
labelsreadonly string[]
o{ where?: Json | undefined; orderBy?: Json | undefined; limit: number; }
  • where?: Json | undefined
  • orderBy?: Json | undefined
  • limit: number
qstring

源码: packages/ui/src/kinds/kind.ts:600

presentation function

function presentation(kind: Kind): Presentation

Select the editor for a declared kind, including text formats, many-valued enums and shaped JSON, while retaining canonical numeric, sortable and derived traits.

参数

名称类型说明
kindKind

源码: packages/ui/src/kinds/registry.ts:65

provideBolt function

function provideBolt(bolt: ViewBolt): ViewBolt

Hands the page's client to every view beneath; the shell calls it once per page.

参数

名称类型说明
boltViewBolt
  • read: <T = Page>(collection: string, options: Value) => Q<T>
  • get: <T = Row | null>(collection: string, id: string, select?: Json, options?: { revision?: number; }) => Q<T>

    { revision }: the record as of that revision (L-BOLT-181), for the record shell's scrubber.

  • aggregate: <T = readonly Values[]>(collection: string, options: Value) => Q<T>
  • history: <T = Json>(collection: string, id: string, options?: { at?: Json; }) => Q<T>
  • query: <T = Json>(name: string, input: Value) => Q<T>
  • similar?: (<T = readonly Row[]>(collection: string, search: string, input: Value, options: Value) => Q<T>) | undefined

    A named similarity search (§3.3.4): similar(c, '<name>', input, { where?, select?, limit }), nearest first.

  • live: <T>(q: Q<T>, options?: { every?: string; on?: readonly string[]; }) => Live<T>
  • recordCapabilities?: ((collection: string, id: string, parent?: RecordParentContext) => Effect<RecordCapabilities | null, Error>) | undefined
  • act: (callable: string, input: Value, options?: { key?: string; observed?: Readonly<Record<string, number>>; }) => Effect<ActSuccess, ActFailure>
  • restore?: { preview(collection: string, record: string, revision: number): Effect.Effect<RestorePreview, Error>; run(collection: string, record: string, revision: number, live: number): Effect.Effect<ActSuccess, ActFailure>; }

    Per-record restore (rule 17): preview says what taking a live record's own fields back to a past revision would write; run writes it as one update observed at live, recorded in history as restored from that revision.

  • start: (automation: string, input: Value | readonly Value[]) => RunHandle
  • runs?: ((automation: string, options: { where?: Json; limit: number; }) => Live<Page<RunRow>>) | undefined

    §3.5 runs(automation, { where?, limit }); absent until the client serves it (views then say so).

  • fileUrl: (ref: Pick<FileRef, "id">, options?: FileUrlOptions) => string
  • decode?: ((collection: string, q: { where?: Json; orderBy?: Json; }) => { where: Json; orderBy?: Json; dropped: readonly { path: string; message: string; }[]; }) | undefined

    §3.5 rule 11a in the browser: each top-level condition and sort key kept or dropped alone. Absent → the view's own check.

  • describe?: ((collection: string, text: string, fields?: readonly { name: string; label: string; kind: 'text' | 'number' | 'bool'; optional?: boolean; }[]) => Effect.Effect<{ where: Json; orderBy?: Json; }, Error>) | undefined

    Rule 16a filter.describe: present only when the host binds decisions or ai (P19); rejects when no filter could be built.

  • options?: ((collection: string, fields?: readonly { name: string; label: string; kind: "text" | "number" | "bool"; optional?: boolean; }[]) => Effect<{ fields: readonly Offer[]; }, Error>) | undefined

    Rule 16b filter.options: the same condition catalogue a description is offered, so the builder renders exactly what it may author.

  • approvals: { /** One move of the request's state machine; `reason` is the decision's reason, the comment or the resubmit note. */ process(requestId: string, decision: { status: ApprovalStatus; reason?: string; }): Effect.Effect<ActSuccess, ActFailure>; /** The approval view (§3.8): the request, its flow and decisions, and what the viewer may do; `null` when not visible. */ get?(requestId: string): Effect.Ef…
  • actor: Json
  • locale: string
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string

源码: packages/ui/src/client/context.ts:5

provideCollection function

function provideCollection(of: () => string): () => string

The collection the values beneath belong to (a Table's, a record's, a Form's): their enum words read its catalog keys.

参数

名称类型说明
of() => string

源码: packages/ui/src/collection/context.ts:8

provideKinds function

function provideKinds(host: KindsHost): KindsHost

Hands the host's KindsHost to every kind editor beneath; the shell calls it once.

参数

名称类型说明
hostKindsHost
  • catalog?: { readonly [collection: string]: CollectionExposure; } | undefined
  • customFields?: { readonly [name: string]: CustomFieldEntry; } | undefined
  • upload?: ((file: File, field: string) => Effect.Effect<FileRef, Extract<ActFailure, { _tag: "ActRefused"; }> | Extract<ReadError, { _tag: "TransportFailed"; }>>) | undefined

    bolt.upload; without it a file field is read-only.

  • fileUrl?: ((ref: FileRef, options?: FileUrlOptions) => string) | undefined
  • geocoder?: Geocoder

    The host's geocoder (P19); without one, address search uses the keyless photonGeocoder.

  • basemap?: { url: string; attribution: string; }

    A keyless tile template; the host may override the OpenStreetMap default.

  • read?: ((collection: string, options: Json) => Effect.Effect<{ rows: readonly ({ readonly id: string; } & { readonly [f: string]: Value; })[]; next: string | null; }, ReadError>) | undefined

    The read a picker pages through: bolt.read. Without it an id is typed.

  • locale?: string | undefined
  • zone?: string | undefined
  • currency?: string | undefined

    The workspace default currency for a money field without one (X-8).

源码: packages/ui/src/kinds/context.ts:153

provideRepresentations function

function provideRepresentations(map: { readonly [collection: string]: RepresentationLoader; }): { readonly [collection: string]: RepresentationLoader; }

The workspace's representations per collection (the generated registry), set by the shell above every page.

参数

名称类型说明
map{ readonly [collection: string]: RepresentationLoader; }

源码: packages/ui/src/record/context.ts:12

resolveJsonSchema function

function resolveJsonSchema(schema: JsonSchema, root?: JsonSchema): JsonSchema

Resolve local JSON Pointers, with cycle detection. Unsupported references keep their JSON editor.

参数

名称类型说明
schemaJsonSchema
root?JsonSchema

源码: packages/ui/src/kinds/json-schema.ts:112

setUiText function

function setUiText(text: Partial<Record<UiTextKey, string>>): Partial<Record<"code" | "currency" | "kind" | "field" | "year" | "month" | "week" | "day" | "to" | "from" | "unknown" | "optional" | "today" | "required" | "none" | "select" | "search" | "noGrant" | "stateLocked" | "integrationOwned" | "ownedParent" | "ownedParentLocked" | "underApproval" | "create" | "pendingApproval" | "conflict" | "close" | "next" | "fields" | "expand" | "collapse" | "resize" | "save" | "saving" | "requestApproval" | "cancel" | "add" | "remove" | "yes" | "no" | "upload" | "uploading" | "useMyLocation" | "latitude" | "longitude" | "searchAddress" | "pickOnMap" | "mapUnavailable" | "addressSearchUnavailable" | "locationDenied" | "openEnded" | "noResults" | "optionsUnavailable" | "invalid" | "noAccess" | "notFound" | "previous" | "more" | "openCalendar" | "notifications" | "fullScreen" | "exitFullScreen" | "createdAt" | "updatedAt" | "unsaved" | "discard" | "discardDraft" | "copy" | "copied" | "addFiles" | "addFile" | "upToFiles" | "fileSize" | "fileType" | "uploaded" | "uploadedBy" | "sizeEach" | "fileCount" | "download" | "preview" | "retry" | "uploadFailed" | "countryCode" | "invalidPhone" | "mobileNumber" | "sendCode" | "resendCode" | "verify" | "codeSent" | "enterCode" | "changeNumber" | "searchMeaning" | "searchPick" | "searchClear" | "searchRun" | "searchRaw" | "searchView" | "searchNone" | "searchFields" | "searchCommands", string>>

Sets the kit's chrome strings for everything beneath (the shell passes the workspace locale's text once).

参数

名称类型说明
textPartial<Record<UiTextKey, string>>

源码: packages/ui/src/primitives/utils.ts:145

singular function

function singular(bolt: Pick<ViewBolt, "t">, collection: string): string

One record of a collection: the catalog's models.<c>.singular, else its label made singular (Categories → Category).

参数

名称类型说明
boltPick<ViewBolt, 't'>
  • t: (key: string, vars?: { readonly [name: string]: string | number; }) => string
collectionstring

源码: packages/ui/src/text/messages.ts:38

sortable function

function sortable(kind: Kind): boolean

Lists and many-valued fields have no scalar ordering.

参数

名称类型说明
kindKind

源码: packages/ui/src/kinds/registry.ts:87

splitNumbers function

function splitNumbers(text: string): readonly string[]

Splits pasted or typed text on the delimiters a person puts between numbers.

参数

名称类型说明
textstring

源码: packages/ui/src/kinds/number-tuple.svelte:32

toast const

const toast: ((text: string, options?: ToastOptions) => number) & { success: (text: string, options?: ToastOptions) => number; info: (text: string, options?: ToastOptions) => number; warning: (text: string, options?: ToastOptions) => number; error: (text: string, options?: ToastOptions) => number; dismiss: typeof dismiss; }

Shows a toast; toast.success, .info, .warning and .error pick its tone. Returns its id (dismiss).

成员

名称类型说明
success(text: string, options?: ToastOptions) => number
info(text: string, options?: ToastOptions) => number
warning(text: string, options?: ToastOptions) => number
error(text: string, options?: ToastOptions) => number
dismisstypeof dismiss

源码: packages/ui/src/toast/toast.svelte.ts:46

uiText function

function uiText(): (key: UiTextKey) => string

Resolve once per component (it reads context); returns t(key).

源码: packages/ui/src/primitives/utils.ts:147

useBolt function

function useBolt(): ViewBolt

The shell client for native reads, actions and translated text. Capture it during component initialization; eagerly registered renderers can avoid importing $bolt before boot.

源码: packages/ui/src/client/context.ts:7

useControls function

function useControls(): Controls

The enclosing Form's, Fieldset's or Field's control mode; editable outside any.

源码: packages/ui/src/primitives/utils.ts:171

useEnumText function

function useEnumText(): (value: string, field?: string) => string

An enum or state value's words beneath a view: models.<c>.fields.<field>.<value> through the page's t when a shell and a collection are above, else the value in words (enumText). Call it at a component's init.

源码: packages/ui/src/collection/context.ts:16

useForm function

function useForm(): FormState | undefined

The enclosing Form's state, or undefined outside a form.

源码: packages/ui/src/form/form-state.svelte.ts:391

useKinds function

function useKinds(): KindsHost

The KindsHost provided above, or an empty host.

源码: packages/ui/src/kinds/context.ts:155

useRecordController function

function useRecordController(): RecordControllerScope | undefined

The enclosing native record controller; check historical before refreshing or entering edit mode after an action.

源码: packages/ui/src/form/form-state.svelte.ts:402

useRecordView function

function useRecordView(): { readonly current: RecordView | null; } | undefined

The record the nearest RecordShell shows (current is the scrubbed revision while one is picked); absent outside one.

源码: packages/ui/src/record/context.ts:8

virtualList function

function virtualList(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.

参数

名称类型说明
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).

源码: packages/ui/src/primitives/virtual/virtual.svelte.ts:34

workspaceNavigation function

function workspaceNavigation(node: HTMLAnchorElement, message: string): { update(next: string): void; destroy(): void; }

A normal link retains its browser navigation, modifiers and cancellation; only its waiting state changes.

参数

名称类型说明
nodeHTMLAnchorElement
messagestring

源码: packages/ui/src/utilities/workspace-navigation.ts:52