trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
45 lines • 2.62 kB
TypeScript
/**
* Kanban core — dynamic board projection (ADR 0034 wedge 13).
*
* Framework-free, DOM-free, timer-free: a board projects a row set through
* one group field. The row model adopts `@tanstack/table-core` (same engine
* as table-core — filter/sort, no pagination); the group-field universe and
* card bucketing are the built layer (the board needs multi-valued
* membership and visible per-column buckets).
*
* - columns are the distinct values of the group field over the filtered
* row set, plus configured extras (select options, relation targets);
* the `none` column folds rows without a value (hideable);
* - cards are entity rows — moving a card writes the entity's group field
* (`onCardMove` → one EQL-S write = one op); `undoHistory` composes the
* transient layer, and the core projects `canUndo`/`canRedo`;
* - boards are pure JSON `BoardDescriptor` views — view-state edits apply
* live, `saveBoard` commits them; presets switch from the toolbar;
* - drag-and-drop input is adapter DOM glue; the core rides `dragState`
* and exposes `moveCard`/`reorderCard`/`moveColumn` as pure actions.
*
* const undo = createUndoHistoryCore();
* const board = createKanbanCore({
* data: tasks, columns,
* groupFields: [{ id: 'status', label: 'Status', affordance: 'select',
* options: [{ value: 'todo' }, { value: 'done' }] }],
* groupFieldId: 'status',
* undoHistory: undo,
* rankField: 'boardRank',
* onCardMove: (rowId, fieldId, value) => kernel.writeRow(rowId, { [fieldId]: value.value }),
* });
* board.actions.moveCard('t1', 'o:todo', 'o:done'); // one op
* board.actions.undo(); // local revert; op-log reverses durably
*
* Undo boundary: data-affecting card ops (`addCard`, `moveCard`,
* `reorderCard`, `removeCard`) push one step each; column/view-state ops
* are board-descriptor edits committed by `saveBoard` (matching Notion:
* reordering columns isn't an undo action; moving a task is).
*
* @module trellis/kanban
*/
import type { KanbanConfig, UseKanbanReturn } from './types.js';
export type { BoardDescriptor, KanbanActions, KanbanCardView, KanbanColumnSort, KanbanColumnView, KanbanConfig, KanbanDragState, KanbanFieldAffordance, KanbanGroupField, KanbanGroupValue, KanbanState, KanbanWriteHooks, UseKanbanReturn, } from './types.js';
export type { TableColumn } from '../../table/core/index.js';
export declare function createKanbanCore<T extends object>(config: KanbanConfig<T>): UseKanbanReturn<T>;
//# sourceMappingURL=index.d.ts.map