- Name
deleteId- Kind
- property
- Type
string- Requirement
- optional
DocsAPI referenceUI machinesthread-list
thread-list machine
The public state machine contract for @grassroot/ui-machines/thread-list. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/thread-list
Package
Service example
thread-list.tsts
import { createService } from "@grassroot/statechart";import { threadListMachine } from "@grassroot/ui-machines/thread-list"; const service = createService(threadListMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();16 of 16
Exports
ThreadListCommand
typeThreadListCommandts
type ThreadListCommand = (CommandObject & { readonly type: "LOAD_REQUEST";}) | (CommandObject & { readonly type: "LOAD_MORE_REQUEST"; readonly after: string;}) | (CommandObject & { readonly type: "SELECT_REQUEST"; readonly id: string | null;}) | (CommandObject & { readonly type: "RENAME_REQUEST"; readonly id: string; readonly title: string;}) | (CommandObject & { readonly type: "DELETE_REQUEST"; readonly id: string;}) | (CommandObject & { readonly type: "RESTORE_REQUEST"; readonly id: string;}) | ScheduleCommand<ThreadListEvent> | CancelCommand;ThreadListContext
typeThreadListContextts
type ThreadListContext = { readonly threads: readonly ThreadListItem[]; readonly selectedThreadId: string | null; readonly renameId?: string; readonly renameTitle?: string; readonly deleteId?: string; readonly undo?: ThreadListUndo; readonly nextCursor?: string; readonly error?: unknown;};Name
Kind
Type
Requirement
deleteIdproperty
stringoptional
errorproperty
unknownoptional
nextCursorproperty
stringoptional
renameIdproperty
stringoptional
renameTitleproperty
stringoptional
selectedThreadIdproperty
string | nullrequired
threadsproperty
readonly ThreadListItem[]required
undoproperty
ThreadListUndooptional
- Name
error- Kind
- property
- Type
unknown- Requirement
- optional
- Name
nextCursor- Kind
- property
- Type
string- Requirement
- optional
- Name
renameId- Kind
- property
- Type
string- Requirement
- optional
- Name
renameTitle- Kind
- property
- Type
string- Requirement
- optional
- Name
selectedThreadId- Kind
- property
- Type
string | null- Requirement
- required
- Name
threads- Kind
- property
- Type
readonly ThreadListItem[]- Requirement
- required
- Name
undo- Kind
- property
- Type
ThreadListUndo- Requirement
- optional
ThreadListDiagnosticCodests
export declare const ThreadListDiagnosticCodes: readonly DiagnosticCatalogueEntry[];ThreadListEvent
typeThreadListEventts
type ThreadListEvent = { readonly type: "LOAD";} | { readonly type: "LOAD_SUCCEEDED"; readonly threads: readonly ThreadListItem[]; readonly nextCursor?: string;} | { readonly type: "LOAD_FAILED"; readonly error?: JsonValue;} | { readonly type: "LOAD_MORE";} | { readonly type: "LOAD_MORE_SUCCEEDED"; readonly threads: readonly ThreadListItem[]; readonly nextCursor?: string;} | { readonly type: "LOAD_MORE_FAILED"; readonly error?: JsonValue;} | { readonly type: "SET_THREADS"; readonly threads: readonly ThreadListItem[]; readonly nextCursor?: string;} | { readonly type: "SELECT"; readonly id: string | null;} | { readonly type: "BEGIN_RENAME"; readonly id: string;} | { readonly type: "SET_RENAME_TITLE"; readonly title: string;} | { readonly type: "COMMIT_RENAME"; readonly title?: string;} | { readonly type: "CANCEL_RENAME";} | { readonly type: "BEGIN_DELETE"; readonly id: string;} | { readonly type: "CANCEL_DELETE";} | { readonly type: "DELETE";} | { readonly type: "UNDO_DELETE";} | { readonly type: "DELETE_UNDO_EXPIRED"; readonly id: string;} | { readonly type: "RESET";};ThreadListInput
typeThreadListInputts
type ThreadListInput = { readonly threads?: readonly ThreadListItem[]; readonly defaultThreads?: readonly ThreadListItem[]; readonly selectedThreadId?: string | null; readonly defaultSelectedThreadId?: string | null; readonly undoDelayMs?: number;};Name
Kind
Type
Requirement
defaultSelectedThreadIdproperty
string | nulloptional
defaultThreadsproperty
readonly ThreadListItem[]optional
selectedThreadIdproperty
string | nulloptional
threadsproperty
readonly ThreadListItem[]optional
undoDelayMsproperty
numberoptional
- Name
defaultSelectedThreadId- Kind
- property
- Type
string | null- Requirement
- optional
- Name
defaultThreads- Kind
- property
- Type
readonly ThreadListItem[]- Requirement
- optional
- Name
selectedThreadId- Kind
- property
- Type
string | null- Requirement
- optional
- Name
threads- Kind
- property
- Type
readonly ThreadListItem[]- Requirement
- optional
- Name
undoDelayMs- Kind
- property
- Type
number- Requirement
- optional
ThreadListItem
typeThreadListItemts
type ThreadListItem = { readonly id: string; readonly remoteId?: string; readonly externalId?: string; readonly status: ThreadListItemStatus; readonly title?: string; readonly custom?: Readonly<Record<string, JsonValue>>;};Name
Kind
Type
Requirement
customproperty
Readonly<Record<string, JsonValue>>optional
externalIdproperty
stringoptional
idproperty
stringrequired
remoteIdproperty
stringoptional
statusproperty
ThreadListItemStatusrequired
titleproperty
stringoptional
- Name
custom- Kind
- property
- Type
Readonly<Record<string, JsonValue>>- Requirement
- optional
- Name
externalId- Kind
- property
- Type
string- Requirement
- optional
- Name
id- Kind
- property
- Type
string- Requirement
- required
- Name
remoteId- Kind
- property
- Type
string- Requirement
- optional
- Name
status- Kind
- property
- Type
ThreadListItemStatus- Requirement
- required
- Name
title- Kind
- property
- Type
string- Requirement
- optional
ThreadListItemStatus
typeThreadListItemStatusts
type ThreadListItemStatus = "regular" | "archived";ThreadListLoadState
typeThreadListLoadStatets
type ThreadListLoadState = "idle" | "loading" | "loadingMore";threadListMachine
valuethreadListMachinets
export declare const threadListMachine: ThreadListMachine;ThreadListMachine
typeThreadListMachinets
type ThreadListMachine = Machine<ThreadListInput, ThreadListStateValue, ThreadListContext, ThreadListEvent, ThreadListCommand>;ThreadListMode
typeThreadListModets
type ThreadListMode = "browsing" | "renaming" | "confirming-delete";threadListReplaySequence
valuethreadListReplaySequencets
export declare const threadListReplaySequence: readonly ThreadListEvent[];threadListSelectors
valuethreadListSelectorsts
export declare const threadListSelectors: { mode: (snapshot: ThreadListSnapshot) => ThreadListMode; load: (snapshot: ThreadListSnapshot) => ThreadListLoadState; threads: (snapshot: ThreadListSnapshot) => readonly ThreadListItem[]; selectedThreadId: (snapshot: ThreadListSnapshot) => string | null; isLoading: (snapshot: ThreadListSnapshot) => boolean; hasMore: (snapshot: ThreadListSnapshot) => boolean; isRenaming: (snapshot: ThreadListSnapshot) => boolean; isConfirmingDelete: (snapshot: ThreadListSnapshot) => boolean; undo: (snapshot: ThreadListSnapshot) => ThreadListUndo | undefined;};Name
Kind
Type
Requirement
hasMoreproperty
(snapshot: ThreadListSnapshot) => booleanrequired
isConfirmingDeleteproperty
(snapshot: ThreadListSnapshot) => booleanrequired
isLoadingproperty
(snapshot: ThreadListSnapshot) => booleanrequired
isRenamingproperty
(snapshot: ThreadListSnapshot) => booleanrequired
loadproperty
(snapshot: ThreadListSnapshot) => ThreadListLoadStaterequired
modeproperty
(snapshot: ThreadListSnapshot) => ThreadListModerequired
selectedThreadIdproperty
(snapshot: ThreadListSnapshot) => string | nullrequired
threadsproperty
(snapshot: ThreadListSnapshot) => readonly ThreadListItem[]required
undoproperty
(snapshot: ThreadListSnapshot) => ThreadListUndo | undefinedrequired
- Name
hasMore- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => boolean- Requirement
- required
- Name
isConfirmingDelete- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => boolean- Requirement
- required
- Name
isLoading- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => boolean- Requirement
- required
- Name
isRenaming- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => boolean- Requirement
- required
- Name
load- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => ThreadListLoadState- Requirement
- required
- Name
mode- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => ThreadListMode- Requirement
- required
- Name
selectedThreadId- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => string | null- Requirement
- required
- Name
threads- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => readonly ThreadListItem[]- Requirement
- required
- Name
undo- Kind
- property
- Type
(snapshot: ThreadListSnapshot) => ThreadListUndo | undefined- Requirement
- required
ThreadListSnapshot
typeThreadListSnapshotts
type ThreadListSnapshot = Snapshot<ThreadListStateValue, ThreadListContext>;ThreadListStateValue
typeThreadListStateValuets
type ThreadListStateValue = { readonly mode: ThreadListMode; readonly load: ThreadListLoadState;};Name
Kind
Type
Requirement
loadproperty
ThreadListLoadStaterequired
modeproperty
ThreadListModerequired
- Name
load- Kind
- property
- Type
ThreadListLoadState- Requirement
- required
- Name
mode- Kind
- property
- Type
ThreadListMode- Requirement
- required
ThreadListUndo
typeThreadListUndots
type ThreadListUndo = { readonly thread: ThreadListItem; readonly index: number;};Name
Kind
Type
Requirement
indexproperty
numberrequired
threadproperty
ThreadListItemrequired
- Name
index- Kind
- property
- Type
number- Requirement
- required
- Name
thread- Kind
- property
- Type
ThreadListItem- Requirement
- required