@toclocoinc/lattice-grid 1.58.0 → 1.60.0

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.
Files changed (113) hide show
  1. package/README.md +3 -3
  2. package/docs/API.html +1773 -73
  3. package/docs/api-detail.html +321 -5
  4. package/lattice-grid.d.ts +281 -2842
  5. package/lattice-grid.esm.min.js +879 -148
  6. package/lattice-grid.min.cjs +879 -148
  7. package/lattice-grid.min.css +1 -1
  8. package/lattice-grid.min.js +879 -148
  9. package/modules/ai.d.ts +401 -0
  10. package/modules/ai.esm.min.js +25 -6
  11. package/modules/ai.min.cjs +25 -6
  12. package/modules/ai.min.js +25 -6
  13. package/modules/angular.d.ts +31 -0
  14. package/modules/angular.esm.min.js +3 -2
  15. package/modules/angular.min.cjs +3 -2
  16. package/modules/angular.min.js +3 -2
  17. package/modules/chart-alluvial.d.ts +18 -0
  18. package/modules/chart-alluvial.esm.min.js +1 -1
  19. package/modules/chart-arc.d.ts +18 -0
  20. package/modules/chart-arc.esm.min.js +1 -1
  21. package/modules/chart-bubblemap.d.ts +18 -0
  22. package/modules/chart-bubblemap.esm.min.js +1 -1
  23. package/modules/chart-bump.d.ts +12 -0
  24. package/modules/chart-bump.esm.min.js +1 -1
  25. package/modules/chart-calendar.d.ts +12 -0
  26. package/modules/chart-calendar.esm.min.js +1 -1
  27. package/modules/chart-decomposition.d.ts +20 -0
  28. package/modules/chart-decomposition.esm.min.js +1 -1
  29. package/modules/chart-diverging.d.ts +12 -0
  30. package/modules/chart-diverging.esm.min.js +1 -1
  31. package/modules/chart-dumbbell.d.ts +18 -0
  32. package/modules/chart-dumbbell.esm.min.js +1 -1
  33. package/modules/chart-fan.d.ts +18 -0
  34. package/modules/chart-fan.esm.min.js +1 -1
  35. package/modules/chart-hexbin.d.ts +18 -0
  36. package/modules/chart-hexbin.esm.min.js +1 -1
  37. package/modules/chart-hexmap.d.ts +18 -0
  38. package/modules/chart-hexmap.esm.min.js +1 -1
  39. package/modules/chart-icicle.d.ts +12 -0
  40. package/modules/chart-icicle.esm.min.js +1 -1
  41. package/modules/chart-parallel.d.ts +19 -0
  42. package/modules/chart-parallel.esm.min.js +1 -1
  43. package/modules/chart-ridgeline.d.ts +14 -0
  44. package/modules/chart-ridgeline.esm.min.js +1 -1
  45. package/modules/chart-roc.d.ts +20 -0
  46. package/modules/chart-roc.esm.min.js +1 -1
  47. package/modules/chart-slope.d.ts +12 -0
  48. package/modules/chart-slope.esm.min.js +1 -1
  49. package/modules/chart-splom.d.ts +19 -0
  50. package/modules/chart-splom.esm.min.js +1 -1
  51. package/modules/chart-waffle.d.ts +12 -0
  52. package/modules/chart-waffle.esm.min.js +1 -1
  53. package/modules/charts.d.ts +122 -0
  54. package/modules/charts.esm.min.js +4 -4
  55. package/modules/charts.min.cjs +4 -4
  56. package/modules/charts.min.js +4 -4
  57. package/modules/data-router.d.ts +91 -0
  58. package/modules/data-router.esm.min.js +109 -17
  59. package/modules/data-router.min.cjs +109 -17
  60. package/modules/data-router.min.js +109 -17
  61. package/modules/devtools.d.ts +28 -0
  62. package/modules/devtools.esm.min.js +2 -2
  63. package/modules/devtools.min.cjs +2 -2
  64. package/modules/devtools.min.js +2 -2
  65. package/modules/dhtmlx-compat.d.ts +19 -0
  66. package/modules/dhtmlx-compat.esm.min.js +4 -4
  67. package/modules/dhtmlx-compat.min.cjs +4 -4
  68. package/modules/dhtmlx-compat.min.js +4 -4
  69. package/modules/gantt.d.ts +515 -0
  70. package/modules/gantt.esm.min.js +109 -33
  71. package/modules/gantt.min.cjs +109 -33
  72. package/modules/gantt.min.js +109 -33
  73. package/modules/htmx.d.ts +176 -0
  74. package/modules/htmx.esm.min.js +879 -148
  75. package/modules/htmx.min.cjs +879 -148
  76. package/modules/htmx.min.js +879 -148
  77. package/modules/kanban.d.ts +492 -0
  78. package/modules/kanban.esm.min.js +4 -4
  79. package/modules/kanban.min.cjs +4 -4
  80. package/modules/kanban.min.js +4 -4
  81. package/modules/kpi.d.ts +255 -0
  82. package/modules/kpi.esm.min.js +40 -7
  83. package/modules/kpi.min.cjs +40 -7
  84. package/modules/kpi.min.js +40 -7
  85. package/modules/layout.d.ts +332 -0
  86. package/modules/layout.esm.min.js +59 -6
  87. package/modules/layout.min.cjs +59 -6
  88. package/modules/layout.min.js +59 -6
  89. package/modules/mock-socket.d.ts +114 -0
  90. package/modules/mock-socket.esm.min.js +2 -2
  91. package/modules/mock-socket.min.cjs +2 -2
  92. package/modules/mock-socket.min.js +2 -2
  93. package/modules/react.d.ts +25 -0
  94. package/modules/react.esm.min.js +3 -2
  95. package/modules/react.min.cjs +3 -2
  96. package/modules/react.min.js +3 -2
  97. package/modules/svelte.d.ts +26 -0
  98. package/modules/svelte.esm.min.js +3 -2
  99. package/modules/svelte.min.cjs +3 -2
  100. package/modules/svelte.min.js +3 -2
  101. package/modules/tabs.d.ts +133 -0
  102. package/modules/tabs.esm.min.js +411 -9
  103. package/modules/tabs.min.cjs +411 -9
  104. package/modules/tabs.min.js +411 -9
  105. package/modules/vue.d.ts +24 -0
  106. package/modules/vue.esm.min.js +3 -2
  107. package/modules/vue.min.cjs +3 -2
  108. package/modules/vue.min.js +3 -2
  109. package/modules/webcomponent.d.ts +47 -0
  110. package/modules/webcomponent.esm.min.js +879 -148
  111. package/modules/webcomponent.min.cjs +879 -148
  112. package/modules/webcomponent.min.js +879 -148
  113. package/package.json +2 -2
@@ -0,0 +1,255 @@
1
+ /*!
2
+ * Lattice Grid 1.60.0, kpi module type declarations
3
+ * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
+ * https://latticegrid.dev
5
+ */
6
+ /** A row backing a KPI aggregate: any object. Its identity comes from `rowKey`. */
7
+ type KPIRow = Record<string, unknown>;
8
+
9
+ /** The aggregation kinds a tile can compute. `custom` is a host reducer over the rows. */
10
+ type KPIAggregation = 'sum' | 'avg' | 'min' | 'max' | 'count' | 'countDistinct' | 'custom';
11
+
12
+ /** Number formatting for a tile value. `percent` treats the value as a ratio (0.42 → 42%). */
13
+ type KPIFormat =
14
+ | 'number' | 'currency' | 'percent' | 'compact'
15
+ | { type?: 'number' | 'currency' | 'percent' | 'compact'; decimals?: number; currency?: string; locale?: string };
16
+
17
+ /**
18
+ * A semantic threshold: two cut points and a direction. `higherIsBetter` (the
19
+ * default) makes a value at/above `warn` good, at/above `critical` a warning,
20
+ * below it critical; `lowerIsBetter` mirrors it. Colour is a host concern.
21
+ */
22
+ interface KPIThresholds {
23
+ warn: number;
24
+ critical: number;
25
+ direction?: 'higherIsBetter' | 'lowerIsBetter';
26
+ }
27
+
28
+ /** An explicit band: the `status` of the first band whose half-open `[min, max)` contains the value. */
29
+ interface KPIBand {
30
+ min?: number;
31
+ max?: number;
32
+ status: 'good' | 'warn' | 'critical';
33
+ }
34
+
35
+ /** An optional sparkline series: the `y` field plotted in order of the `x` field (or insertion). */
36
+ interface KPISparkline {
37
+ x?: string;
38
+ y: string | ((row: KPIRow) => unknown);
39
+ }
40
+
41
+ /** One tile: an aggregate over the routed rows, with optional filter, format, threshold and trend. */
42
+ interface KPITile {
43
+ /** A stable identity for the tile (defaults to the label, then the index). */
44
+ id?: string;
45
+ /** The tile's accessible label. */
46
+ label?: string;
47
+ /** The aggregation kind, or a reducer `(rows, tile) => value` for a custom tile. */
48
+ aggregation?: KPIAggregation | ((rows: KPIRow[], tile: object) => unknown);
49
+ /** The reducer for a `custom` aggregation, when `aggregation` is the string `'custom'`. */
50
+ compute?: (rows: KPIRow[], tile: object) => unknown;
51
+ /** The field the aggregation reads (a path or accessor). Ignored by `count`. */
52
+ field?: string | ((row: KPIRow) => unknown);
53
+ /** A predicate limiting the rows this tile aggregates. */
54
+ filter?: (row: KPIRow) => boolean;
55
+ /** Value formatting. */
56
+ format?: KPIFormat;
57
+ /** A comparison target rendered alongside the value. */
58
+ target?: number;
59
+ /** A baseline the tile's delta is measured against. */
60
+ baseline?: number;
61
+ /** Threshold bands, either two cut points or an explicit band list. */
62
+ thresholds?: KPIThresholds;
63
+ /** Explicit status bands (an alternative to `thresholds`). */
64
+ bands?: KPIBand[];
65
+ /** A trend sparkline series. */
66
+ sparkline?: KPISparkline | string;
67
+ }
68
+
69
+ /**
70
+ * The hierarchy a KPI panel arranges its tiles into (BACKLOG-0001059): a rail
71
+ * of top-level items that expand to the indicators beneath them, each parent
72
+ * highlighted with the worst status below it.
73
+ *
74
+ * The shape is declared with `path` or `parentKey` — the same two shapes the
75
+ * grid's tree data and the tree-select editor take — over the **tile specs**,
76
+ * not the rows. With neither declared, one is derived by splitting the tile
77
+ * ids on `separator`, so `system.compute.cpu` files itself under Compute
78
+ * under System. A panel whose ids carry no separator stays flat, and `false`
79
+ * keeps it flat whatever they look like.
80
+ *
81
+ * A tile's `field` is never a source: a dot there already means a nested
82
+ * object property.
83
+ */
84
+ interface KPITreeConfig {
85
+ /** The tile's own place in the hierarchy, its own segment last. */
86
+ path?: (tile: KPITile) => (string | number)[];
87
+ /** The id of the tile this one sits under, or a reader for it. */
88
+ parentKey?: string | ((tile: KPITile) => unknown);
89
+ /** The heading tiles whose parent is not in the panel are gathered under. */
90
+ orphans?: 'root' | string;
91
+ /** The separator a derived hierarchy splits a tile id on. Defaults to `.`. */
92
+ separator?: string;
93
+ /** Which branches start open: every one (`true`), or these node keys. */
94
+ expanded?: true | string[];
95
+ }
96
+
97
+ /**
98
+ * One node of the rail.
99
+ *
100
+ * **No value rolls up.** `value` and `formatted` are the node's own tile's
101
+ * reading, and are `null` on a level the hierarchy synthesised, because the
102
+ * running accumulators cannot be composed without a rescan.
103
+ *
104
+ * **Severity does.** `rollup` is the worst status at or below the node, which
105
+ * is what a collapsed branch reports. `unknown` is excluded from it on
106
+ * purpose — ranking "nothing was measured" as the worst would hide a real
107
+ * warning underneath it — and is surfaced as `unknown`, a count of the
108
+ * descendants that measured nothing, so neither can pass unnoticed.
109
+ */
110
+ interface KPINodeModel {
111
+ /** The node's stable identity: the tile id, or the path of a synthesised level. */
112
+ key: string;
113
+ /** The tile id, or null on a synthesised level. */
114
+ id: string | null;
115
+ label: string;
116
+ /** Depth, 0 at the top level. */
117
+ level: number;
118
+ /** Its place among its siblings, from 1, and how many there are. */
119
+ posinset: number;
120
+ setsize: number;
121
+ hasChildren: boolean;
122
+ expanded: boolean;
123
+ children: KPINodeModel[];
124
+ /** The node's own tile, or null on a synthesised level. */
125
+ tile: KPITileModel | null;
126
+ value: unknown;
127
+ formatted: string | null;
128
+ /** The node's own status. */
129
+ status: 'good' | 'warn' | 'critical' | 'unknown' | null;
130
+ /** The worst status at or below the node. Never `unknown`. */
131
+ rollup: 'good' | 'warn' | 'critical' | null;
132
+ /** How many tiles at or below the node measured nothing. */
133
+ unknown: number;
134
+ /** How many tiles are at or below the node. */
135
+ items: number;
136
+ }
137
+
138
+ /** A computed tile, as it appears in the model. */
139
+ interface KPITileModel {
140
+ id: string;
141
+ label: string;
142
+ aggregation: string;
143
+ field?: string;
144
+ value: unknown;
145
+ formatted: string;
146
+ /**
147
+ * The tile's semantic band, or `unknown` when the tile measured nothing.
148
+ * `unknown` is decided from data presence before any threshold is
149
+ * consulted: an aggregation over nothing returns the identity of its
150
+ * operation (`sum` and `count` return 0), and 0 is a number a threshold
151
+ * grades, so without it an empty panel would report as a healthy one.
152
+ *
153
+ * Two things make a tile `unknown`: the panel holds no rows at all, or the
154
+ * tile's `field` names no column on the bound grid, so it never read a cell
155
+ * to reduce over. A tile whose `filter` matches none of the rows the panel
156
+ * *does* hold is neither — it has measured a real zero and is banded
157
+ * normally. `null` means the tile has no thresholds or bands configured.
158
+ */
159
+ status: 'good' | 'warn' | 'critical' | 'unknown' | null;
160
+ target?: number;
161
+ baseline?: number;
162
+ delta: number | null;
163
+ deltaPercent: number | null;
164
+ deltaFormatted?: string;
165
+ count: number;
166
+ sparkline: number[] | null;
167
+ }
168
+
169
+ /** The payload every tile event carries. */
170
+ interface KPIEvent {
171
+ tile: KPITileModel;
172
+ id: string;
173
+ originalEvent?: unknown;
174
+ }
175
+
176
+ /** KPI panel configuration. */
177
+ interface KPIConfig {
178
+ rows?: KPIRow[];
179
+ grid?: unknown;
180
+ rowKey?: string | ((row: KPIRow) => unknown);
181
+ /**
182
+ * Extra columns of the bound `grid` to project onto the rows a tile `filter`
183
+ * sees, beyond the fields the tiles themselves declare. A grid-bound panel
184
+ * hands a filter a projection, not a whole grid row, so a filter over a
185
+ * column no tile names would otherwise read `undefined` and report a
186
+ * confident zero. Ignored on a panel over a plain `rows` array.
187
+ */
188
+ fields?: string[];
189
+ tiles?: KPITile[];
190
+ columns?: number;
191
+ ariaLabel?: string;
192
+ nullText?: string;
193
+ /** Arrange the tiles as a hierarchy; `false` keeps the panel flat. */
194
+ tree?: KPITreeConfig | false;
195
+ /**
196
+ * The catalogue the panel's own text is read from. A panel routinely has no
197
+ * grid to borrow one off — two of its three input modes have none — so this
198
+ * is the first-class way to translate it. A grid's own `messages` satisfies
199
+ * the shape; a key it does not carry falls back to English.
200
+ */
201
+ messages?: { t(key: string, params?: Record<string, unknown>): string };
202
+ onTileClick?: (event: KPIEvent) => void;
203
+ onTileDblClick?: (event: KPIEvent) => void;
204
+ onTileContextMenu?: (event: KPIEvent) => void;
205
+ onNodeToggle?: (event: { key: string; expanded: boolean; node?: KPINodeModel }) => void;
206
+ onChange?: (event: { model: { tiles: KPITileModel[]; nodes?: KPINodeModel[] } }) => void;
207
+ }
208
+
209
+ /** The keyed-diff consumer surface a KPI panel shares with a grid, so a Data Router routes to it directly. */
210
+ interface KPIRows {
211
+ apply(change: { add?: KPIRow[]; update?: KPIRow[]; remove?: unknown[] }): void;
212
+ forEach(fn: (row: KPIRow, key: unknown) => void): void;
213
+ readonly count: number;
214
+ }
215
+
216
+ /**
217
+ * A KPI / stat-tile panel: a grid of aggregate tiles over a dataset. It
218
+ * consumes data through the same keyed-diff `rows.apply` contract a grid
219
+ * exposes, so `dataRouter.attach(value, kpi)` drives it like any other viewer,
220
+ * updating each tile incrementally from the routed delta.
221
+ */
222
+ interface KPI {
223
+ readonly el: unknown | null;
224
+ readonly rowKey: string | ((row: KPIRow) => unknown);
225
+ /** Whether the panel renders as a hierarchy rather than a flat tile grid. */
226
+ readonly tree: boolean;
227
+ rows: KPIRows;
228
+ tiles(): KPITileModel[];
229
+ tile(id: string): KPITileModel | undefined;
230
+ value(id: string): unknown;
231
+ /** The top-level nodes of the hierarchy. Empty on a flat panel. */
232
+ nodes(): KPINodeModel[];
233
+ /** One node by its key, at any depth. */
234
+ node(key: string): KPINodeModel | undefined;
235
+ /** The nodes on screen: the roots, plus the children of every open branch. */
236
+ visibleNodes(): KPINodeModel[];
237
+ expand(key: string): KPI;
238
+ collapse(key: string): KPI;
239
+ toggle(key: string): KPI;
240
+ setRows(rows: KPIRow[]): KPI;
241
+ refresh(): KPI;
242
+ getState(): object;
243
+ setState(snapshot: object): KPI;
244
+ on(name: string, fn: (event: KPIEvent) => void): () => void;
245
+ off(name: string, fn: (event: KPIEvent) => void): void;
246
+ destroy(): void;
247
+ }
248
+
249
+ /**
250
+ * Create a KPI / stat-tile panel over rows or a bound grid. Pass a DOM element
251
+ * to render into, or `null` for a headless panel that computes the same tile
252
+ * model without a DOM.
253
+ */
254
+ export function createKPI(el: HTMLElement | null, config?: KPIConfig): KPI;
255
+ export default createKPI;