@grafloria/element 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  export { bindDashboardGrid, type DashboardGridApi, type DashboardGridOptions, type DashboardGridHandle, type DashboardResponsiveOptions, } from './grid-binder.js';
2
+ export { bindDashboardSplit, SetSplitTreeCommand, SPLIT_TREE_KEY, type DashboardSplitOptions, type DashboardSplitHandle, } from './split-binder.js';
3
+ export { projectSplit, dividersOf, addSplitLeaf, removeSplitLeaf, insertSplitLeaf, moveSplitDivider, splitFromCells, cellsFromSplit, splitLeaves, type SplitNode, type SplitGroup, type SplitLeaf, type SplitDir, type SplitSide, type SplitDivider, } from './split-layout.js';
2
4
  export { rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, spanWidthPx, gridItemFromCell, cellFromGridItem, buildCommitCommands, type CellRect, type WorldRect, type DashboardGridGeometry, type TileDelta, } from './grid-mapping.js';
3
5
  export { ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID } from './styles.js';
4
6
  export { dashboard, type DashboardOptions, type DashboardSpec, type DashboardSnapshot, type DashboardHandle, type DashboardViewSpec, type DashboardWidgetSpec, type WidgetHandle, } from './dashboard.js';
@@ -1,4 +1,6 @@
1
1
  export { bindDashboardGrid, } from './grid-binder.js';
2
+ export { bindDashboardSplit, SetSplitTreeCommand, SPLIT_TREE_KEY, } from './split-binder.js';
3
+ export { projectSplit, dividersOf, addSplitLeaf, removeSplitLeaf, insertSplitLeaf, moveSplitDivider, splitFromCells, cellsFromSplit, splitLeaves, } from './split-layout.js';
2
4
  export { rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, spanWidthPx, gridItemFromCell, cellFromGridItem, buildCommitCommands, } from './grid-mapping.js';
3
5
  export { ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID } from './styles.js';
4
6
  // The DATA-FIRST authoring API (the erDiagram/umlDiagram equivalent).
@@ -0,0 +1,69 @@
1
+ /**
2
+ * SPLIT BINDER — a board laid out as a splitter tree (see split-layout.ts),
3
+ * bound to a group the way `bindDashboardGrid` binds a grid: it implements the
4
+ * same `DashboardGridHandle`, so `dashboard()`, `fromDocument()` and the
5
+ * history plumbing drive it without knowing which layout a view runs.
6
+ *
7
+ * THE MODEL (measured on the DevExpress designer, 6 Sep 2026):
8
+ * - the board is always covered: one widget fills it, the next halves the
9
+ * largest one along its longer axis, a removed widget's slot goes to its
10
+ * siblings;
11
+ * - a DIVIDER between two siblings drags as a PERCENTAGE of their group; a
12
+ * widget alone in its group has no divider on that axis;
13
+ * - a DRAG lifts the widget out at once (its siblings take the slot live), an
14
+ * INSERTION LINE on the nearest edge of the widget under the pointer says
15
+ * where it will land, and the drop splits that widget's slot on that side.
16
+ *
17
+ * THE UNDO STORY is one command: `SetSplitTreeCommand` swaps the whole tree
18
+ * (plain JSON on the group as `dashboardTree`). A gesture, a keyboard step, an
19
+ * add and a removal are each one tree write, so one undo is always one thing.
20
+ *
21
+ * Sizing is always 'fit': the tree is a division of the frame. On a fluid
22
+ * board the frame follows the container (both axes); on a fixed board it is
23
+ * the authored size.
24
+ */
25
+ import { Command, type GroupModel } from '@grafloria/engine';
26
+ import type { DashboardGridApi, DashboardGridHandle, DashboardGridOptions } from './grid-binder.js';
27
+ import { type SplitNode } from './split-layout.js';
28
+ /** Group metadata key the tree persists under. */
29
+ export declare const SPLIT_TREE_KEY = "dashboardTree";
30
+ export interface DashboardSplitOptions extends Pick<DashboardGridOptions, 'columns' | 'gap' | 'padding' | 'rtl' | 'fluid' | 'static' | 'designHeight' | 'baseRowHeight' | 'dragOut' | 'removeZone' | 'onRemoveRequest' | 'onDropIn' | 'onGesture'> {
31
+ /** An authored tree. Default: the persisted one, else derived from the members' cells. */
32
+ tree?: SplitNode | null;
33
+ }
34
+ /** The split handle is the grid handle plus the tree itself. */
35
+ export interface DashboardSplitHandle extends DashboardGridHandle {
36
+ getSplitTree(): SplitNode | null;
37
+ /** Replace the tree through the history (one undoable step). */
38
+ setSplitTree(tree: SplitNode | null): Promise<void>;
39
+ }
40
+ /**
41
+ * Undoable whole-tree write. Everything a split board does to its layout is
42
+ * one of these — a gesture, a keyboard step, an add, a removal — so one undo
43
+ * is always exactly one thing, and a batch that removes a node can fold the
44
+ * tree-without-it in beside the node removal.
45
+ */
46
+ export declare class SetSplitTreeCommand extends Command {
47
+ private readonly groupId;
48
+ private readonly before;
49
+ private readonly after;
50
+ constructor(groupId: string, before: SplitNode | null, after: SplitNode | null);
51
+ private apply;
52
+ execute(context: {
53
+ diagram?: unknown;
54
+ }): void;
55
+ undo(context: {
56
+ diagram?: unknown;
57
+ }): void;
58
+ serialize(): {
59
+ id: string;
60
+ name: string;
61
+ timestamp: number;
62
+ data: {
63
+ groupId: string;
64
+ before: SplitNode | null;
65
+ after: SplitNode | null;
66
+ };
67
+ };
68
+ }
69
+ export declare function bindDashboardSplit(api: DashboardGridApi, group: GroupModel, options?: DashboardSplitOptions): DashboardSplitHandle;