- Name
input- Kind
- parameter
- Type
GanttInput- Requirement
- required
DocsAPI referenceUI machinesgantt
gantt machine
The public state machine contract for @grassroot/ui-machines/gantt. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/gantt
Package
Service example
gantt.tsts
import { createService } from "@grassroot/statechart";import { ganttMachine } from "@grassroot/ui-machines/gantt"; const service = createService(ganttMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();24 of 24
Exports
blockedGanttIds
functionEmpty and duplicate ids are blocked. All ids are blocked when step is invalid.
blockedGanttIdsts
declare function blockedGanttIds(input: GanttInput): ReadonlySet<string>;Name
Kind
Type
Requirement
inputparameter
GanttInputrequired
returnreturn value
ReadonlySet<string>n/a
- Name
return- Kind
- return value
- Type
ReadonlySet<string>- Requirement
- n/a
clampGanttRange
functionTranslate a range by preserving width and clamping to `[0, columnCount]`. Returns `null` when the bar is wider than the domain (cannot move).
clampGanttRangets
declare function clampGanttRange(start: number, end: number, columnCount: number): { readonly start: number; readonly end: number;} | null;Name
Kind
Type
Requirement
startparameter
numberrequired
endparameter
numberrequired
columnCountparameter
numberrequired
returnreturn value
{
readonly start: number;
readonly end: number;
} | nulln/a
- Name
start- Kind
- parameter
- Type
number- Requirement
- required
- Name
end- Kind
- parameter
- Type
number- Requirement
- required
- Name
columnCount- Kind
- parameter
- Type
number- Requirement
- required
- Name
return- Kind
- return value
- Type
{ readonly start: number; readonly end: number; } | null- Requirement
- n/a
columnCountOf
functioncolumnCountOfts
declare function columnCountOf(input: GanttInput): number;Name
Kind
Type
Requirement
inputparameter
GanttInputrequired
returnreturn value
numbern/a
- Name
input- Kind
- parameter
- Type
GanttInput- Requirement
- required
- Name
return- Kind
- return value
- Type
number- Requirement
- n/a
GANTT_DEFAULT_COLUMN_COUNTts
export declare const GANTT_DEFAULT_COLUMN_COUNT: 4;GANTT_DEFAULT_STEP
valueGANTT_DEFAULT_STEPts
export declare const GANTT_DEFAULT_STEP: 1;GanttBarRange
typeGanttBarRangets
type GanttBarRange = { readonly id: string; readonly start: number; readonly end: number;};Name
Kind
Type
Requirement
endproperty
numberrequired
idproperty
stringrequired
startproperty
numberrequired
- Name
end- Kind
- property
- Type
number- Requirement
- required
- Name
id- Kind
- property
- Type
string- Requirement
- required
- Name
start- Kind
- property
- Type
number- Requirement
- required
GanttChangeReason
typeGanttChangeReasonts
type GanttChangeReason = "pointer" | "keyboard";GanttCommand
typeGanttCommandts
type GanttCommand = CommandObject & { readonly type: "BAR_RANGE_CHANGE_REQUEST"; readonly id: string; readonly start: number; readonly end: number; readonly reason: GanttChangeReason;};Name
Kind
Type
Requirement
endproperty
numberrequired
idproperty
stringrequired
reasonproperty
GanttChangeReasonrequired
startproperty
numberrequired
typeproperty
stringrequired
- Name
end- Kind
- property
- Type
number- Requirement
- required
- Name
id- Kind
- property
- Type
string- Requirement
- required
- Name
reason- Kind
- property
- Type
GanttChangeReason- Requirement
- required
- Name
start- Kind
- property
- Type
number- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
GanttContext
typeGanttContextts
type GanttContext = { readonly focusedId: string | null; readonly activeId: string | null; readonly originStart: number | null; readonly originEnd: number | null; readonly draftStart: number | null; readonly draftEnd: number | null; readonly reason: GanttChangeReason | null;};Name
Kind
Type
Requirement
activeIdproperty
string | nullrequired
draftEndproperty
number | nullrequired
draftStartproperty
number | nullrequired
focusedIdproperty
string | nullrequired
originEndproperty
number | nullrequired
originStartproperty
number | nullrequired
reasonproperty
GanttChangeReason | nullrequired
- Name
activeId- Kind
- property
- Type
string | null- Requirement
- required
- Name
draftEnd- Kind
- property
- Type
number | null- Requirement
- required
- Name
draftStart- Kind
- property
- Type
number | null- Requirement
- required
- Name
focusedId- Kind
- property
- Type
string | null- Requirement
- required
- Name
originEnd- Kind
- property
- Type
number | null- Requirement
- required
- Name
originStart- Kind
- property
- Type
number | null- Requirement
- required
- Name
reason- Kind
- property
- Type
GanttChangeReason | null- Requirement
- required
GanttDiagnosticCodes
valueGanttDiagnosticCodests
export declare const GanttDiagnosticCodes: readonly DiagnosticCatalogueEntry[];GanttEvent
typeGanttEventts
type GanttEvent = { readonly type: "FOCUS"; readonly id: string;} | { readonly type: "BLUR"; readonly id: string;} | { readonly type: "GRAB"; readonly id: string; readonly start: number; readonly end: number; readonly reason: GanttChangeReason;} | { readonly type: "NUDGE"; readonly direction: -1 | 1;} | { readonly type: "DRAG"; readonly start: number; readonly end: number;} | { readonly type: "DROP";} | { readonly type: "CANCEL";};GanttInput
typeGanttInputts
type GanttInput = { /** Host-owned ranges. The machine never writes these back. */ readonly bars?: readonly GanttBarRange[]; /** Axis unit count. @default 4 */ readonly columnCount?: number; /** Positive finite axis unit. @default 1 */ readonly step?: number; /** * When false, the shell is inert (live default). Styled callers without * `getRowId` and a range callback pass false. */ readonly interactive?: boolean;};Name
Kind
Type
Requirement
Description
barsproperty
readonly GanttBarRange[]optional
Host-owned ranges. The machine never writes these back.
columnCountproperty
numberoptional
Axis unit count.
interactiveproperty
booleanoptional
When false, the shell is inert (live default). Styled callers without `getRowId` and a range callback pass false.
stepproperty
numberoptional
Positive finite axis unit.
- Name
bars- Kind
- property
- Type
readonly GanttBarRange[]- Requirement
- optional
- Description
- Host-owned ranges. The machine never writes these back.
- Name
columnCount- Kind
- property
- Type
number- Requirement
- optional
- Description
- Axis unit count.
- Name
interactive- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- When false, the shell is inert (live default). Styled callers without `getRowId` and a range callback pass false.
- Name
step- Kind
- property
- Type
number- Requirement
- optional
- Description
- Positive finite axis unit.
ganttMachine
valueganttMachinets
export declare const ganttMachine: GanttMachine;GanttMachine
typeGanttMachinets
type GanttMachine = Machine<GanttInput, GanttStateValue, GanttContext, GanttEvent, GanttCommand>;ganttReplaySequence
valueganttReplaySequencets
export declare const ganttReplaySequence: readonly GanttEvent[];ganttSelectors
valueganttSelectorsts
export declare const ganttSelectors: { value: (snapshot: GanttSnapshot) => GanttStateValue; focusedId: (snapshot: GanttSnapshot) => string | null; activeId: (snapshot: GanttSnapshot) => string | null; draftStart: (snapshot: GanttSnapshot) => number | null; draftEnd: (snapshot: GanttSnapshot) => number | null;};Name
Kind
Type
Requirement
activeIdproperty
(snapshot: GanttSnapshot) => string | nullrequired
draftEndproperty
(snapshot: GanttSnapshot) => number | nullrequired
draftStartproperty
(snapshot: GanttSnapshot) => number | nullrequired
focusedIdproperty
(snapshot: GanttSnapshot) => string | nullrequired
valueproperty
(snapshot: GanttSnapshot) => GanttStateValuerequired
- Name
activeId- Kind
- property
- Type
(snapshot: GanttSnapshot) => string | null- Requirement
- required
- Name
draftEnd- Kind
- property
- Type
(snapshot: GanttSnapshot) => number | null- Requirement
- required
- Name
draftStart- Kind
- property
- Type
(snapshot: GanttSnapshot) => number | null- Requirement
- required
- Name
focusedId- Kind
- property
- Type
(snapshot: GanttSnapshot) => string | null- Requirement
- required
- Name
value- Kind
- property
- Type
(snapshot: GanttSnapshot) => GanttStateValue- Requirement
- required
GanttSnapshot
typeGanttSnapshotts
type GanttSnapshot = Snapshot<GanttStateValue, GanttContext>;GanttStateValue
typeGanttStateValuets
type GanttStateValue = "idle" | "grabbed" | "dragging";isGanttIdInteractive
functionisGanttIdInteractivets
declare function isGanttIdInteractive(input: GanttInput, id: string): boolean;Name
Kind
Type
Requirement
inputparameter
GanttInputrequired
idparameter
stringrequired
returnreturn value
booleann/a
- Name
input- Kind
- parameter
- Type
GanttInput- Requirement
- required
- Name
id- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
isGanttInteractive
functionisGanttInteractivets
declare function isGanttInteractive(input: GanttInput): boolean;Name
Kind
Type
Requirement
inputparameter
GanttInputrequired
returnreturn value
booleann/a
- Name
input- Kind
- parameter
- Type
GanttInput- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
isGanttStepValid
functionisGanttStepValidts
declare function isGanttStepValid(step: number | undefined): boolean;Name
Kind
Type
Requirement
stepparameter
number | undefinedrequired
returnreturn value
booleann/a
- Name
step- Kind
- parameter
- Type
number | undefined- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
projectGanttBars
functionprojectGanttBarsts
declare function projectGanttBars<T extends { readonly start: number; readonly end: number;}>(rows: readonly T[], getRowId?: (row: T, index: number) => string): GanttBarRange[];Name
Kind
Type
Requirement
rowsparameter
readonly T[]required
getRowIdparameter
(row: T, index: number) => stringoptional
returnreturn value
GanttBarRange[]n/a
- Name
rows- Kind
- parameter
- Type
readonly T[]- Requirement
- required
- Name
getRowId- Kind
- parameter
- Type
(row: T, index: number) => string- Requirement
- optional
- Name
return- Kind
- return value
- Type
GanttBarRange[]- Requirement
- n/a
roundGanttUnit
functionroundGanttUnitts
declare function roundGanttUnit(value: number): number;Name
Kind
Type
Requirement
valueparameter
numberrequired
returnreturn value
numbern/a
- Name
value- Kind
- parameter
- Type
number- Requirement
- required
- Name
return- Kind
- return value
- Type
number- Requirement
- n/a
stepOf
functionstepOfts
declare function stepOf(input: GanttInput): number;Name
Kind
Type
Requirement
inputparameter
GanttInputrequired
returnreturn value
numbern/a
- Name
input- Kind
- parameter
- Type
GanttInput- Requirement
- required
- Name
return- Kind
- return value
- Type
number- Requirement
- n/a