- Name
return- Kind
- return value
- Type
KanbanDragState- Requirement
- n/a
DocsAPI referenceUI machineskanban
kanban machine
The public state machine contract for @grassroot/ui-machines/kanban. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/kanban
Package
Service example
kanban.tsts
import { createService } from "@grassroot/statechart";import { kanbanMachine } from "@grassroot/ui-machines/kanban"; const service = createService(kanbanMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();39 of 39
Exports
createKanbanDragState
functionDuplicate of frozen `createKanbanDragState`.
createKanbanDragStatets
declare function createKanbanDragState(): KanbanDragState;Name
Kind
Type
Requirement
returnreturn value
KanbanDragStaten/a
EMPTY_KANBAN_PLACEMENTS
valueEMPTY_KANBAN_PLACEMENTSts
export declare const EMPTY_KANBAN_PLACEMENTS: readonly KanbanPlacement[];EMPTY_SELECTION_IDS
valueEMPTY_SELECTION_IDSts
export declare const EMPTY_SELECTION_IDS: SelectionValue;KanbanAnnounceCommandts
type KanbanAnnounceCommand = { readonly type: "ANNOUNCE"; readonly key: KanbanAnnounceKey; readonly cardId?: string; readonly columnId?: string; readonly fromColumnId?: string; readonly toColumnId?: string;};Name
Kind
Type
Requirement
cardIdproperty
stringoptional
columnIdproperty
stringoptional
fromColumnIdproperty
stringoptional
keyproperty
KanbanAnnounceKeyrequired
toColumnIdproperty
stringoptional
typeproperty
"ANNOUNCE"required
- Name
cardId- Kind
- property
- Type
string- Requirement
- optional
- Name
columnId- Kind
- property
- Type
string- Requirement
- optional
- Name
fromColumnId- Kind
- property
- Type
string- Requirement
- optional
- Name
key- Kind
- property
- Type
KanbanAnnounceKey- Requirement
- required
- Name
toColumnId- Kind
- property
- Type
string- Requirement
- optional
- Name
type- Kind
- property
- Type
"ANNOUNCE"- Requirement
- required
KanbanAnnounceDetail
typeKanbanAnnounceDetailts
type KanbanAnnounceDetail = { readonly key: KanbanAnnounceKey; readonly cardId?: string; readonly columnId?: string; readonly fromColumnId?: string; readonly toColumnId?: string;};Name
Kind
Type
Requirement
cardIdproperty
stringoptional
columnIdproperty
stringoptional
fromColumnIdproperty
stringoptional
keyproperty
KanbanAnnounceKeyrequired
toColumnIdproperty
stringoptional
- Name
cardId- Kind
- property
- Type
string- Requirement
- optional
- Name
columnId- Kind
- property
- Type
string- Requirement
- optional
- Name
fromColumnId- Kind
- property
- Type
string- Requirement
- optional
- Name
key- Kind
- property
- Type
KanbanAnnounceKey- Requirement
- required
- Name
toColumnId- Kind
- property
- Type
string- Requirement
- optional
KanbanAnnounceKey
typeKanbanAnnounceKeyts
type KanbanAnnounceKey = "kanban.grabbed" | "kanban.column" | "kanban.dropped" | "kanban.cancelled";KanbanCommand
typeKanbanCommandts
type KanbanCommand = KanbanMoveCommand | KanbanAnnounceCommand | SelectionCommand;KanbanContext
typeKanbanContextts
type KanbanContext = { readonly mode: BindingMode; readonly placements: readonly KanbanPlacement[]; readonly dragStatus: KanbanDragStatus; readonly sourceCardId: string | null; readonly sourceColumnId: string | null; readonly targetColumnId: string | null; readonly selection: SelectionMachineState;};Name
Kind
Type
Requirement
dragStatusproperty
KanbanDragStatusrequired
modeproperty
BindingModerequired
placementsproperty
readonly KanbanPlacement[]required
selectionproperty
SelectionMachineStaterequired
sourceCardIdproperty
string | nullrequired
sourceColumnIdproperty
string | nullrequired
targetColumnIdproperty
string | nullrequired
- Name
dragStatus- Kind
- property
- Type
KanbanDragStatus- Requirement
- required
- Name
mode- Kind
- property
- Type
BindingMode- Requirement
- required
- Name
placements- Kind
- property
- Type
readonly KanbanPlacement[]- Requirement
- required
- Name
selection- Kind
- property
- Type
SelectionMachineState- Requirement
- required
- Name
sourceCardId- Kind
- property
- Type
string | null- Requirement
- required
- Name
sourceColumnId- Kind
- property
- Type
string | null- Requirement
- required
- Name
targetColumnId- Kind
- property
- Type
string | null- Requirement
- required
KanbanDiagnosticCodes
valueKanbanDiagnosticCodests
export declare const KanbanDiagnosticCodes: readonly DiagnosticCatalogueEntry[];KanbanDragAction
typeDuplicate of frozen `KanbanDragAction`.
KanbanDragActionts
type KanbanDragAction = { readonly type: "dragStart"; readonly cardId: string;} | { readonly type: "dragOverColumn"; readonly columnId: string;} | { readonly type: "dragLeaveColumn"; readonly columnId: string;} | { readonly type: "dragEnd";} | { readonly type: "drop";};KanbanDragState
typeDuplicate of frozen `KanbanDragState`.
KanbanDragStatets
type KanbanDragState = { readonly draggingId: string | null; readonly overColumn: string | null;};Name
Kind
Type
Requirement
draggingIdproperty
string | nullrequired
overColumnproperty
string | nullrequired
- Name
draggingId- Kind
- property
- Type
string | null- Requirement
- required
- Name
overColumn- Kind
- property
- Type
string | null- Requirement
- required
KanbanDragStatus
typeKanbanDragStatusts
type KanbanDragStatus = "idle" | "grabbed" | "dragging";KanbanEvent
typeKanbanEventts
type KanbanEvent = { readonly type: "POINTER_DRAG_START"; readonly cardId: string;} | { readonly type: "POINTER_DRAG_OVER"; readonly columnId: string;} | { readonly type: "POINTER_DRAG_LEAVE"; readonly columnId: string;} | { readonly type: "POINTER_DROP"; readonly columnId: string; readonly reason: KanbanMoveReason;} | { readonly type: "POINTER_DRAG_END";} | { readonly type: "KEYBOARD_GRAB"; readonly cardId: string;} | { readonly type: "KEYBOARD_MOVE"; readonly toColumnId: string;} | { readonly type: "KEYBOARD_DROP"; readonly reason: "keyboard";} | { readonly type: "KEYBOARD_CANCEL";} | { readonly type: "MOVE"; readonly cardId: string; readonly toColumnId: string; readonly reason: KanbanMoveReason;} | SelectionEvent;KanbanInput
typeKanbanInputts
type KanbanInput = { readonly cards?: readonly KanbanPlacement[]; readonly defaultCards?: readonly KanbanPlacement[]; readonly columnIds?: readonly string[]; readonly disableDrag?: boolean; readonly selectionMode?: SelectionMode; readonly selectedIds?: SelectionValue; readonly defaultSelectedIds?: SelectionValue; readonly orderedIds?: readonly string[]; readonly disabledIds?: readonly string[];};Name
Kind
Type
Requirement
cardsproperty
readonly KanbanPlacement[]optional
columnIdsproperty
readonly string[]optional
defaultCardsproperty
readonly KanbanPlacement[]optional
defaultSelectedIdsproperty
SelectionValueoptional
disabledIdsproperty
readonly string[]optional
disableDragproperty
booleanoptional
orderedIdsproperty
readonly string[]optional
selectedIdsproperty
SelectionValueoptional
selectionModeproperty
SelectionModeoptional
- Name
cards- Kind
- property
- Type
readonly KanbanPlacement[]- Requirement
- optional
- Name
columnIds- Kind
- property
- Type
readonly string[]- Requirement
- optional
- Name
defaultCards- Kind
- property
- Type
readonly KanbanPlacement[]- Requirement
- optional
- Name
defaultSelectedIds- Kind
- property
- Type
SelectionValue- Requirement
- optional
- Name
disabledIds- Kind
- property
- Type
readonly string[]- Requirement
- optional
- Name
disableDrag- Kind
- property
- Type
boolean- Requirement
- optional
- Name
orderedIds- Kind
- property
- Type
readonly string[]- Requirement
- optional
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- optional
- Name
selectionMode- Kind
- property
- Type
SelectionMode- Requirement
- optional
kanbanMachine
valuekanbanMachinets
export declare const kanbanMachine: KanbanMachine;KanbanMachine
typeKanbanMachinets
type KanbanMachine = Machine<KanbanInput, KanbanStateValue, KanbanContext, KanbanEvent, KanbanCommand>;KanbanMachineState
typeKanbanMachineStatets
type KanbanMachineState = MachineState<KanbanStateValue, KanbanContext>;KanbanMoveCommand
typeKanbanMoveCommandts
type KanbanMoveCommand = { readonly type: "CARD_MOVE_REQUEST"; readonly cardId: string; readonly fromColumnId: string; readonly toColumnId: string; readonly reason: KanbanMoveReason;};Name
Kind
Type
Requirement
cardIdproperty
stringrequired
fromColumnIdproperty
stringrequired
reasonproperty
KanbanMoveReasonrequired
toColumnIdproperty
stringrequired
typeproperty
"CARD_MOVE_REQUEST"required
- Name
cardId- Kind
- property
- Type
string- Requirement
- required
- Name
fromColumnId- Kind
- property
- Type
string- Requirement
- required
- Name
reason- Kind
- property
- Type
KanbanMoveReason- Requirement
- required
- Name
toColumnId- Kind
- property
- Type
string- Requirement
- required
- Name
type- Kind
- property
- Type
"CARD_MOVE_REQUEST"- Requirement
- required
KanbanMoveDetail
typeKanbanMoveDetailts
type KanbanMoveDetail = { readonly cardId: string; readonly fromColumnId: string; readonly toColumnId: string; readonly reason: KanbanMoveReason;};Name
Kind
Type
Requirement
cardIdproperty
stringrequired
fromColumnIdproperty
stringrequired
reasonproperty
KanbanMoveReasonrequired
toColumnIdproperty
stringrequired
- Name
cardId- Kind
- property
- Type
string- Requirement
- required
- Name
fromColumnId- Kind
- property
- Type
string- Requirement
- required
- Name
reason- Kind
- property
- Type
KanbanMoveReason- Requirement
- required
- Name
toColumnId- Kind
- property
- Type
string- Requirement
- required
KanbanMoveReason
typeKanbanMoveReasonts
type KanbanMoveReason = "pointer" | "keyboard" | "programmatic";KanbanPlacement
typeKanbanPlacementts
type KanbanPlacement = { readonly cardId: string; readonly columnId: string;};Name
Kind
Type
Requirement
cardIdproperty
stringrequired
columnIdproperty
stringrequired
- Name
cardId- Kind
- property
- Type
string- Requirement
- required
- Name
columnId- Kind
- property
- Type
string- Requirement
- required
kanbanReplaySequence
valuekanbanReplaySequencets
export declare const kanbanReplaySequence: readonly KanbanEvent[];kanbanSelectors
valuekanbanSelectorsts
export declare const kanbanSelectors: { mode: (snapshot: KanbanSnapshot) => BindingMode; placements: (snapshot: KanbanSnapshot) => readonly KanbanPlacement[]; dragStatus: (snapshot: KanbanSnapshot) => KanbanDragStatus; sourceCardId: (snapshot: KanbanSnapshot) => string | null; sourceColumnId: (snapshot: KanbanSnapshot) => string | null; targetColumnId: (snapshot: KanbanSnapshot) => string | null; draggingId: (snapshot: KanbanSnapshot) => string | null; overColumn: (snapshot: KanbanSnapshot) => string | null; selectedIds: (snapshot: KanbanSnapshot) => SelectionValue; selection: (snapshot: KanbanSnapshot) => SelectionMachineState; cardsInColumn: (snapshot: KanbanSnapshot, columnId: string) => readonly KanbanPlacement[];};Name
Kind
Type
Requirement
cardsInColumnproperty
(snapshot: KanbanSnapshot, columnId: string) => readonly KanbanPlacement[]required
draggingIdproperty
(snapshot: KanbanSnapshot) => string | nullrequired
dragStatusproperty
(snapshot: KanbanSnapshot) => KanbanDragStatusrequired
modeproperty
(snapshot: KanbanSnapshot) => BindingModerequired
overColumnproperty
(snapshot: KanbanSnapshot) => string | nullrequired
placementsproperty
(snapshot: KanbanSnapshot) => readonly KanbanPlacement[]required
selectedIdsproperty
(snapshot: KanbanSnapshot) => SelectionValuerequired
selectionproperty
(snapshot: KanbanSnapshot) => SelectionMachineStaterequired
sourceCardIdproperty
(snapshot: KanbanSnapshot) => string | nullrequired
sourceColumnIdproperty
(snapshot: KanbanSnapshot) => string | nullrequired
targetColumnIdproperty
(snapshot: KanbanSnapshot) => string | nullrequired
- Name
cardsInColumn- Kind
- property
- Type
(snapshot: KanbanSnapshot, columnId: string) => readonly KanbanPlacement[]- Requirement
- required
- Name
draggingId- Kind
- property
- Type
(snapshot: KanbanSnapshot) => string | null- Requirement
- required
- Name
dragStatus- Kind
- property
- Type
(snapshot: KanbanSnapshot) => KanbanDragStatus- Requirement
- required
- Name
mode- Kind
- property
- Type
(snapshot: KanbanSnapshot) => BindingMode- Requirement
- required
- Name
overColumn- Kind
- property
- Type
(snapshot: KanbanSnapshot) => string | null- Requirement
- required
- Name
placements- Kind
- property
- Type
(snapshot: KanbanSnapshot) => readonly KanbanPlacement[]- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
(snapshot: KanbanSnapshot) => SelectionValue- Requirement
- required
- Name
selection- Kind
- property
- Type
(snapshot: KanbanSnapshot) => SelectionMachineState- Requirement
- required
- Name
sourceCardId- Kind
- property
- Type
(snapshot: KanbanSnapshot) => string | null- Requirement
- required
- Name
sourceColumnId- Kind
- property
- Type
(snapshot: KanbanSnapshot) => string | null- Requirement
- required
- Name
targetColumnId- Kind
- property
- Type
(snapshot: KanbanSnapshot) => string | null- Requirement
- required
KanbanSnapshot
typeKanbanSnapshotts
type KanbanSnapshot = Snapshot<KanbanStateValue, KanbanContext>;KanbanStateValue
typeKanbanStateValuets
type KanbanStateValue = "active";moveKanbanPlacement
functionDuplicate of frozen `moveCard` over placements (cardId, not full card objects).
moveKanbanPlacementts
declare function moveKanbanPlacement(placements: readonly KanbanPlacement[], cardId: string, toColumnId: string): readonly KanbanPlacement[];Name
Kind
Type
Requirement
placementsparameter
readonly KanbanPlacement[]required
cardIdparameter
stringrequired
toColumnIdparameter
stringrequired
returnreturn value
readonly KanbanPlacement[]n/a
- Name
placements- Kind
- parameter
- Type
readonly KanbanPlacement[]- Requirement
- required
- Name
cardId- Kind
- parameter
- Type
string- Requirement
- required
- Name
toColumnId- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly KanbanPlacement[]- Requirement
- n/a
placementsByColumn
functionDuplicate of frozen `cardsByColumn`.
placementsByColumnts
declare function placementsByColumn(placements: readonly KanbanPlacement[], columnId: string): readonly KanbanPlacement[];Name
Kind
Type
Requirement
placementsparameter
readonly KanbanPlacement[]required
columnIdparameter
stringrequired
returnreturn value
readonly KanbanPlacement[]n/a
- Name
placements- Kind
- parameter
- Type
readonly KanbanPlacement[]- Requirement
- required
- Name
columnId- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly KanbanPlacement[]- Requirement
- n/a
projectKanbanPlacements
functionprojectKanbanPlacementsts
declare function projectKanbanPlacements(cards: readonly { readonly id: string; readonly columnId: string;}[]): readonly KanbanPlacement[];Name
Kind
Type
Requirement
cardsparameter
readonly {
readonly id: string;
readonly columnId: string;
}[]required
returnreturn value
readonly KanbanPlacement[]n/a
- Name
cards- Kind
- parameter
- Type
readonly { readonly id: string; readonly columnId: string; }[]- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly KanbanPlacement[]- Requirement
- n/a
reduceKanbanDrag
functionDuplicate of frozen `reduceKanbanDrag`.
reduceKanbanDragts
declare function reduceKanbanDrag(state: KanbanDragState, action: KanbanDragAction): KanbanDragState;Name
Kind
Type
Requirement
stateparameter
KanbanDragStaterequired
actionparameter
KanbanDragActionrequired
returnreturn value
KanbanDragStaten/a
- Name
state- Kind
- parameter
- Type
KanbanDragState- Requirement
- required
- Name
action- Kind
- parameter
- Type
KanbanDragAction- Requirement
- required
- Name
return- Kind
- return value
- Type
KanbanDragState- Requirement
- n/a
sameKanbanPlacements
functionsameKanbanPlacementsts
declare function sameKanbanPlacements(left: readonly KanbanPlacement[], right: readonly KanbanPlacement[]): boolean;Name
Kind
Type
Requirement
leftparameter
readonly KanbanPlacement[]required
rightparameter
readonly KanbanPlacement[]required
returnreturn value
booleann/a
- Name
left- Kind
- parameter
- Type
readonly KanbanPlacement[]- Requirement
- required
- Name
right- Kind
- parameter
- Type
readonly KanbanPlacement[]- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
sameSelectionIds
functionsameSelectionIdsts
declare function sameSelectionIds(left: SelectionValue, right: SelectionValue): boolean;Name
Kind
Type
Requirement
leftparameter
SelectionValuerequired
rightparameter
SelectionValuerequired
returnreturn value
booleann/a
- Name
left- Kind
- parameter
- Type
SelectionValue- Requirement
- required
- Name
right- Kind
- parameter
- Type
SelectionValue- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
SelectionChangeDetailts
type SelectionChangeDetail = { readonly selectedIds: SelectionValue; readonly reason: SelectionChangeReason;};Name
Kind
Type
Requirement
reasonproperty
SelectionChangeReasonrequired
selectedIdsproperty
SelectionValuerequired
- Name
reason- Kind
- property
- Type
SelectionChangeReason- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- required
SelectionChangeReasonts
type SelectionChangeReason = "pointer" | "keyboard" | "programmatic";SelectionCommand
typeSelectionCommandts
type SelectionCommand = CommandObject & { readonly type: "SELECTION_CHANGE_REQUEST"; readonly selectedIds: SelectionValue; readonly reason: SelectionChangeReason;};Name
Kind
Type
Requirement
reasonproperty
SelectionChangeReasonrequired
selectedIdsproperty
SelectionValuerequired
typeproperty
stringrequired
- Name
reason- Kind
- property
- Type
SelectionChangeReason- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
selectionInputFromKanban
functionselectionInputFromKanbants
declare function selectionInputFromKanban(input: KanbanInput): SelectionInput;Name
Kind
Type
Requirement
inputparameter
KanbanInputrequired
returnreturn value
SelectionInputn/a
- Name
input- Kind
- parameter
- Type
KanbanInput- Requirement
- required
- Name
return- Kind
- return value
- Type
SelectionInput- Requirement
- n/a
selectionMachine
valueselectionMachinets
export declare const selectionMachine: SelectionMachine;SelectionMode
typeSelectionModets
type SelectionMode = "none" | "single" | "multiple";selectionSelectors
valueselectionSelectorsts
export declare const selectionSelectors: { selectedIds: (snapshot: SelectionSnapshot) => SelectionValue; anchorId: (snapshot: SelectionSnapshot) => string | null; bindingMode: (snapshot: SelectionSnapshot) => BindingMode; isSelected: (snapshot: SelectionSnapshot, id: string) => boolean;};Name
Kind
Type
Requirement
anchorIdproperty
(snapshot: SelectionSnapshot) => string | nullrequired
bindingModeproperty
(snapshot: SelectionSnapshot) => BindingModerequired
isSelectedproperty
(snapshot: SelectionSnapshot, id: string) => booleanrequired
selectedIdsproperty
(snapshot: SelectionSnapshot) => SelectionValuerequired
- Name
anchorId- Kind
- property
- Type
(snapshot: SelectionSnapshot) => string | null- Requirement
- required
- Name
bindingMode- Kind
- property
- Type
(snapshot: SelectionSnapshot) => BindingMode- Requirement
- required
- Name
isSelected- Kind
- property
- Type
(snapshot: SelectionSnapshot, id: string) => boolean- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
(snapshot: SelectionSnapshot) => SelectionValue- Requirement
- required
SelectionValue
typeSelectionValuets
type SelectionValue = readonly string[];