@toclocoinc/lattice-grid 1.65.0 → 1.67.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 (177) hide show
  1. package/README.md +6 -4
  2. package/angular/LICENSE +111 -0
  3. package/angular/README.md +78 -0
  4. package/angular/fesm2022/toclocoinc-lattice-grid-angular.mjs +2843 -0
  5. package/angular/package.json +16 -0
  6. package/angular/types/toclocoinc-lattice-grid-angular.d.ts +1366 -0
  7. package/docs/API.html +741 -27
  8. package/docs/api-detail.html +137 -4
  9. package/lattice-grid.d.ts +9 -6
  10. package/lattice-grid.esm.min.js +26 -10
  11. package/lattice-grid.min.cjs +26 -10
  12. package/lattice-grid.min.css +1 -1
  13. package/lattice-grid.min.js +26 -10
  14. package/modules/ai.d.ts +1 -1
  15. package/modules/ai.esm.min.js +3 -3
  16. package/modules/ai.min.cjs +3 -3
  17. package/modules/ai.min.js +3 -3
  18. package/modules/angular.d.ts +1 -1
  19. package/modules/angular.esm.min.js +7 -7
  20. package/modules/angular.min.cjs +7 -7
  21. package/modules/angular.min.js +7 -7
  22. package/modules/chart-alluvial.d.ts +1 -1
  23. package/modules/chart-alluvial.esm.min.js +1 -1
  24. package/modules/chart-alluvial.min.cjs +1 -1
  25. package/modules/chart-alluvial.min.js +1 -1
  26. package/modules/chart-arc.d.ts +1 -1
  27. package/modules/chart-arc.esm.min.js +1 -1
  28. package/modules/chart-arc.min.cjs +1 -1
  29. package/modules/chart-arc.min.js +1 -1
  30. package/modules/chart-bubblemap.d.ts +1 -1
  31. package/modules/chart-bubblemap.esm.min.js +1 -1
  32. package/modules/chart-bubblemap.min.cjs +1 -1
  33. package/modules/chart-bubblemap.min.js +1 -1
  34. package/modules/chart-bump.d.ts +1 -1
  35. package/modules/chart-bump.esm.min.js +1 -1
  36. package/modules/chart-bump.min.cjs +1 -1
  37. package/modules/chart-bump.min.js +1 -1
  38. package/modules/chart-calendar.d.ts +1 -1
  39. package/modules/chart-calendar.esm.min.js +1 -1
  40. package/modules/chart-calendar.min.cjs +1 -1
  41. package/modules/chart-calendar.min.js +1 -1
  42. package/modules/chart-decomposition.d.ts +1 -1
  43. package/modules/chart-decomposition.esm.min.js +1 -1
  44. package/modules/chart-decomposition.min.cjs +1 -1
  45. package/modules/chart-decomposition.min.js +1 -1
  46. package/modules/chart-diverging.d.ts +1 -1
  47. package/modules/chart-diverging.esm.min.js +1 -1
  48. package/modules/chart-diverging.min.cjs +1 -1
  49. package/modules/chart-diverging.min.js +1 -1
  50. package/modules/chart-dumbbell.d.ts +1 -1
  51. package/modules/chart-dumbbell.esm.min.js +1 -1
  52. package/modules/chart-dumbbell.min.cjs +1 -1
  53. package/modules/chart-dumbbell.min.js +1 -1
  54. package/modules/chart-fan.d.ts +1 -1
  55. package/modules/chart-fan.esm.min.js +1 -1
  56. package/modules/chart-fan.min.cjs +1 -1
  57. package/modules/chart-fan.min.js +1 -1
  58. package/modules/chart-hexbin.d.ts +1 -1
  59. package/modules/chart-hexbin.esm.min.js +1 -1
  60. package/modules/chart-hexbin.min.cjs +1 -1
  61. package/modules/chart-hexbin.min.js +1 -1
  62. package/modules/chart-hexmap.d.ts +1 -1
  63. package/modules/chart-hexmap.esm.min.js +1 -1
  64. package/modules/chart-hexmap.min.cjs +1 -1
  65. package/modules/chart-hexmap.min.js +1 -1
  66. package/modules/chart-icicle.d.ts +1 -1
  67. package/modules/chart-icicle.esm.min.js +1 -1
  68. package/modules/chart-icicle.min.cjs +1 -1
  69. package/modules/chart-icicle.min.js +1 -1
  70. package/modules/chart-markermap.d.ts +1 -1
  71. package/modules/chart-markermap.esm.min.js +1 -1
  72. package/modules/chart-markermap.min.cjs +1 -1
  73. package/modules/chart-markermap.min.js +1 -1
  74. package/modules/chart-parallel.d.ts +1 -1
  75. package/modules/chart-parallel.esm.min.js +1 -1
  76. package/modules/chart-parallel.min.cjs +1 -1
  77. package/modules/chart-parallel.min.js +1 -1
  78. package/modules/chart-ridgeline.d.ts +1 -1
  79. package/modules/chart-ridgeline.esm.min.js +1 -1
  80. package/modules/chart-ridgeline.min.cjs +1 -1
  81. package/modules/chart-ridgeline.min.js +1 -1
  82. package/modules/chart-roc.d.ts +1 -1
  83. package/modules/chart-roc.esm.min.js +1 -1
  84. package/modules/chart-roc.min.cjs +1 -1
  85. package/modules/chart-roc.min.js +1 -1
  86. package/modules/chart-slope.d.ts +1 -1
  87. package/modules/chart-slope.esm.min.js +1 -1
  88. package/modules/chart-slope.min.cjs +1 -1
  89. package/modules/chart-slope.min.js +1 -1
  90. package/modules/chart-splom.d.ts +1 -1
  91. package/modules/chart-splom.esm.min.js +1 -1
  92. package/modules/chart-splom.min.cjs +1 -1
  93. package/modules/chart-splom.min.js +1 -1
  94. package/modules/chart-waffle.d.ts +1 -1
  95. package/modules/chart-waffle.esm.min.js +1 -1
  96. package/modules/chart-waffle.min.cjs +1 -1
  97. package/modules/chart-waffle.min.js +1 -1
  98. package/modules/charts.d.ts +1 -1
  99. package/modules/charts.esm.min.js +261 -48
  100. package/modules/charts.min.cjs +261 -48
  101. package/modules/charts.min.js +261 -48
  102. package/modules/data-router.d.ts +8 -3
  103. package/modules/data-router.esm.min.js +28 -6
  104. package/modules/data-router.min.cjs +28 -6
  105. package/modules/data-router.min.js +28 -6
  106. package/modules/devtools.d.ts +1 -1
  107. package/modules/devtools.esm.min.js +1 -1
  108. package/modules/devtools.min.cjs +1 -1
  109. package/modules/devtools.min.js +1 -1
  110. package/modules/dhtmlx-compat.d.ts +1 -1
  111. package/modules/dhtmlx-compat.esm.min.js +3 -3
  112. package/modules/dhtmlx-compat.min.cjs +3 -3
  113. package/modules/dhtmlx-compat.min.js +3 -3
  114. package/modules/gantt.d.ts +8 -3
  115. package/modules/gantt.esm.min.js +27 -4
  116. package/modules/gantt.min.cjs +27 -4
  117. package/modules/gantt.min.js +27 -4
  118. package/modules/geo-europe-nuts.d.ts +1 -1
  119. package/modules/geo-europe-nuts.esm.min.js +1 -1
  120. package/modules/geo-uk.d.ts +1 -1
  121. package/modules/geo-uk.esm.min.js +1 -1
  122. package/modules/geo-us-states.d.ts +1 -1
  123. package/modules/geo-us-states.esm.min.js +1 -1
  124. package/modules/geo-world-110m.d.ts +1 -1
  125. package/modules/geo-world-110m.esm.min.js +1 -1
  126. package/modules/geo-world-50m.d.ts +1 -1
  127. package/modules/geo-world-50m.esm.min.js +1 -1
  128. package/modules/htmx.d.ts +1 -1
  129. package/modules/htmx.esm.min.js +26 -10
  130. package/modules/htmx.min.cjs +26 -10
  131. package/modules/htmx.min.js +26 -10
  132. package/modules/kanban.d.ts +10 -3
  133. package/modules/kanban.esm.min.js +24 -4
  134. package/modules/kanban.min.cjs +24 -4
  135. package/modules/kanban.min.js +24 -4
  136. package/modules/kpi.d.ts +10 -3
  137. package/modules/kpi.esm.min.js +27 -4
  138. package/modules/kpi.min.cjs +27 -4
  139. package/modules/kpi.min.js +27 -4
  140. package/modules/layout.d.ts +1 -1
  141. package/modules/layout.esm.min.js +3 -3
  142. package/modules/layout.min.cjs +3 -3
  143. package/modules/layout.min.js +3 -3
  144. package/modules/mock-socket.d.ts +1 -1
  145. package/modules/mock-socket.esm.min.js +1 -1
  146. package/modules/mock-socket.min.cjs +1 -1
  147. package/modules/mock-socket.min.js +1 -1
  148. package/modules/react.d.ts +1 -1
  149. package/modules/react.esm.min.js +3 -3
  150. package/modules/react.min.cjs +3 -3
  151. package/modules/react.min.js +3 -3
  152. package/modules/svelte.d.ts +251 -2
  153. package/modules/svelte.esm.min.js +960 -6
  154. package/modules/svelte.min.cjs +942 -5
  155. package/modules/svelte.min.js +942 -5
  156. package/modules/tabs.d.ts +1 -1
  157. package/modules/tabs.esm.min.js +3 -3
  158. package/modules/tabs.min.cjs +3 -3
  159. package/modules/tabs.min.js +3 -3
  160. package/modules/vue.d.ts +398 -9
  161. package/modules/vue.esm.min.js +1163 -31
  162. package/modules/vue.min.cjs +1147 -30
  163. package/modules/vue.min.js +1147 -30
  164. package/modules/webcomponent.d.ts +233 -1
  165. package/modules/webcomponent.esm.min.js +1274 -41
  166. package/modules/webcomponent.min.cjs +1256 -41
  167. package/modules/webcomponent.min.js +1256 -41
  168. package/package.json +27 -2
  169. package/svelte/Chart.svelte +34 -0
  170. package/svelte/Gantt.svelte +34 -0
  171. package/svelte/Grid.svelte +30 -0
  172. package/svelte/GridProvider.svelte +13 -0
  173. package/svelte/KPI.svelte +34 -0
  174. package/svelte/Kanban.svelte +34 -0
  175. package/svelte/Layout.svelte +34 -0
  176. package/svelte/Router.svelte +16 -0
  177. package/svelte/Tabs.svelte +53 -0
@@ -1,9 +1,14 @@
1
1
  /*!
2
- * Lattice Grid 1.65.0, svelte module type declarations
2
+ * Lattice Grid 1.67.0, svelte module type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
6
  import type {
7
+ EventName,
8
+ Grid,
9
+ GridConfig,
10
+ GridEvent,
11
+ Row,
7
12
  createGrid,
8
13
  } from '../lattice-grid.js';
9
14
 
@@ -18,8 +23,252 @@ import type {
18
23
  * `detail`, so `on:ready={(e) => e.detail.grid}` hands you the same `Grid` a
19
24
  * turn after construction. Use `onGrid` when you need the instance during the
20
25
  * first render.
26
+ *
27
+ * The action is unchanged by the v2 components and stays
28
+ * supported: a host that wants a grid on an element it already owns needs
29
+ * nothing more, and no Svelte compiler is involved.
30
+ */
31
+ export function createLatticeAction(deps: {
32
+ createGrid: (el: unknown, config: GridConfig) => Grid;
33
+ CustomEvent?: unknown;
34
+ }): (node: unknown, params?: Record<string, unknown>) => {
35
+ update: (next: Record<string, unknown>) => void;
36
+ destroy: () => void;
37
+ };
38
+
39
+ /**
40
+ * An event name as the callback prop a Svelte 5 component takes:
41
+ * `'cell:changed'` becomes `'CellChanged'`, so the prop is `onCellChanged`.
42
+ *
43
+ * Svelte 5 removed component events — `createEventDispatcher` is deprecated
44
+ * and `on:` no longer applies to a component — so an instance event reaches a
45
+ * host as a callback prop. The all-lowercase spelling (`oncellchanged`) is
46
+ * accepted at runtime too, for hosts that prefer Svelte's DOM attribute
47
+ * style; only the canonical one is typed, because a union of both would make
48
+ * every misspelling type-check.
49
+ */
50
+ export type CamelJoin<E extends string> =
51
+ E extends `${infer Head}:${infer Tail}`
52
+ ? `${Capitalize<Head>}${CamelJoin<Tail>}`
53
+ : Capitalize<E>;
54
+
55
+ /** Every event of a set, as the optional callback props a caller may bind. */
56
+ export type LatticeSvelteCallbacks<Events extends string, Payload> = {
57
+ [E in Events as `on${CamelJoin<E>}`]?: (payload: Payload) => void;
58
+ };
59
+
60
+ /** Host-element bindings every component here puts on its wrapper `div`. */
61
+ export type LatticeSvelteHostProps = {
62
+ /** Applied to the host element rather than to the viewer. */
63
+ class?: string;
64
+ /** Applied to the host element rather than to the viewer. */
65
+ style?: string;
66
+ /** Applied to the host element rather than to the viewer. */
67
+ id?: string;
68
+ };
69
+
70
+ /**
71
+ * What `<LatticeGrid>` (`@toclocoinc/lattice-grid/svelte/Grid.svelte`) takes.
72
+ *
73
+ * Generic over the row type, so `rows`, `predicates` and the keyed-diff prop
74
+ * are checked against the host's own record shape rather than `unknown`.
75
+ *
76
+ * Every **grid configuration key** is accepted and diffed with `Object.is`:
77
+ * an inline `columns={[{ field: 'a' }]}` is a new array on every render and
78
+ * reconfigures the grid every time, so hoist it or hold it in `$state.raw`.
79
+ * `sort`, `filters`, `quickFilter` and `selectedKeys` are query and selection
80
+ * state rather than configuration and go through their own setters.
81
+ *
82
+ * The component types themselves are not declared here: a `.svelte` file is
83
+ * the source of its own component type, and Svelte's language tooling derives
84
+ * the props of `Grid.svelte` from the file the package ships. These are the
85
+ * prop *shapes*, for a host that wants to name them.
86
+ */
87
+ export type LatticeSvelteGridProps<Row = unknown> =
88
+ Omit<GridConfig, 'rows'> & LatticeSvelteHostProps
89
+ & LatticeSvelteCallbacks<EventName, GridEvent> & {
90
+ /** The rows the grid holds. A new array replaces them; the same array is a no-op. */
91
+ rows?: Row[];
92
+ /** The name this grid publishes itself under in the registry. Mount-time. */
93
+ name?: string;
94
+ /** A keyed diff applied through `rows.apply()` whenever the object's identity changes. */
95
+ rowUpdates?: {
96
+ add?: Row[]; update?: Row[]; remove?: Array<string | Row>;
97
+ };
98
+ /** Named predicates, registered through `filters.where` so they compose with the reader's own filter. */
99
+ predicates?: Record<string, ((row: Row) => boolean) | null>;
100
+ /** The Data Router route this grid is attached to, when a `Router.svelte` is above it. */
101
+ route?: unknown;
102
+ /** Per-route options passed with `route`. */
103
+ routeOptions?: Record<string, unknown>;
104
+ /** Called once with the live grid, as soon as it exists. */
105
+ onGridReady?: (grid: Grid) => void;
106
+ /** Called as the component unmounts, before the grid is destroyed. */
107
+ onGridDestroyed?: () => void;
108
+ };
109
+
110
+ /** What a grid-bound viewer component takes, on top of its own configuration. */
111
+ export type LatticeSvelteViewerProps<Events extends string = string> =
112
+ LatticeSvelteHostProps & LatticeSvelteCallbacks<Events, unknown> & {
113
+ /** The grid to build against, when the host holds one itself. */
114
+ grid?: Grid;
115
+ /** Which published grid to take from the registry; the default name when absent. */
116
+ gridName?: string;
117
+ /** Called once with the live viewer, as soon as it is built. */
118
+ onReady?: (instance: unknown) => void;
119
+ /** Called when the viewer is torn down, including a rebuild onto a new grid. */
120
+ onDestroyed?: () => void;
121
+ };
122
+
123
+ /** The registry `GridProvider.svelte` puts in context and every viewer reads. */
124
+ export type LatticeSvelteGridRegistry = {
125
+ /** Publish a grid under a name, or withdraw it with `null`. */
126
+ publish: (name: string, grid: Grid | null) => void;
127
+ /** The grid published under a name, or null. */
128
+ get: (name?: string) => Grid | null;
129
+ /** Every published name. */
130
+ names: () => string[];
131
+ /** Hear about every publish and withdrawal; the return value unsubscribes. */
132
+ subscribe: (fn: () => void) => () => void;
133
+ };
134
+
135
+ /** The router handle `Router.svelte` puts in context. */
136
+ export type LatticeSvelteRouterHandle = {
137
+ /** The live router, built on the first grid that asks to be routed. */
138
+ readonly router: unknown;
139
+ /** Attach a grid to a route. */
140
+ attach: (grid: Grid, route: unknown, routeOptions?: Record<string, unknown>) => void;
141
+ /** Detach a grid, before it is destroyed. */
142
+ detach: (grid: Grid) => void;
143
+ /** Destroy the router with the component that provided it. */
144
+ destroy: () => void;
145
+ };
146
+
147
+ /** The context key a grid registry is published under. */
148
+ export const GRID_REGISTRY_KEY: symbol;
149
+ /** The context key a Data Router handle is published under. */
150
+ export const ROUTER_KEY: symbol;
151
+ /** The name a grid publishes itself under when the host does not choose one. */
152
+ export const DEFAULT_GRID_NAME: string;
153
+
154
+ /**
155
+ * Own one grid for the life of a component: build once, diff props into the
156
+ * live instance, publish into the registry, attach to the router, and detach
157
+ * before destroying.
158
+ */
159
+ export function bindGrid(opts: {
160
+ createGrid: (el: unknown, config: GridConfig) => Grid;
161
+ element: unknown;
162
+ props?: Record<string, unknown>;
163
+ registry?: LatticeSvelteGridRegistry | null;
164
+ router?: LatticeSvelteRouterHandle | null;
165
+ }): {
166
+ grid: Grid;
167
+ update: (next: Record<string, unknown>) => void;
168
+ destroy: (props?: Record<string, unknown>) => void;
169
+ };
170
+
171
+ /**
172
+ * Own one viewer — KPI panel, chart, board, plan or layout — for the life of
173
+ * a component. `sync` builds it when everything it needs has arrived, pushes
174
+ * changed props into it, and rebuilds it onto a different grid.
175
+ */
176
+ export function bindViewer(opts: {
177
+ viewer: 'kpi' | 'chart' | 'kanban' | 'gantt' | 'layout';
178
+ factory: (...args: never[]) => unknown;
179
+ element: unknown;
180
+ registry?: LatticeSvelteGridRegistry | null;
181
+ }): {
182
+ readonly instance: unknown;
183
+ sync: (props: Record<string, unknown>) => void;
184
+ destroy: () => void;
185
+ };
186
+
187
+ /**
188
+ * Own one tab strip whose panels hold Svelte-rendered content. `place` moves
189
+ * a tab's `display: contents` holder into the panel the module made, which is
190
+ * how a snippet's content becomes a real child of the tab panel without a
191
+ * portal API Svelte does not have.
21
192
  */
22
- export function createLatticeAction(deps: { createGrid: unknown }): unknown;
193
+ export function bindTabs(opts: {
194
+ createTabs: (el: unknown, config: Record<string, unknown>) => unknown;
195
+ element: unknown;
196
+ createGrid?: (el: unknown, config: GridConfig) => Grid;
197
+ onPanels?: (ids: string[]) => void;
198
+ }): {
199
+ readonly instance: unknown;
200
+ sync: (props: Record<string, unknown>) => void;
201
+ place: (id: string, holder: unknown) => void;
202
+ destroy: (props?: Record<string, unknown>) => void;
203
+ };
204
+
205
+ /** A registry of live grids, keyed by the name each publishes itself under. */
206
+ export function createGridRegistry(): LatticeSvelteGridRegistry;
207
+
208
+ /**
209
+ * Own a Data Router for the life of the component that provides it: built on
210
+ * the first routed grid, destroyed with the component.
211
+ */
212
+ export function createRouterHandle(opts: {
213
+ createDataRouter: (config: Record<string, unknown>) => unknown;
214
+ config?: Record<string, unknown> | (() => Record<string, unknown>);
215
+ }): LatticeSvelteRouterHandle;
216
+
217
+ /**
218
+ * Split a component's props into the configuration the instance gets and the
219
+ * props the adapter consumes itself, normalising either callback spelling.
220
+ */
221
+ export function adaptProps(kind: string, props: Record<string, unknown>): {
222
+ config: Record<string, unknown>;
223
+ own: Record<string, unknown>;
224
+ };
225
+
226
+ /** A callback prop, accepted as `onCellChanged` or as `oncellchanged`. */
227
+ export function pickCallback(
228
+ props: Record<string, unknown>, camel: string,
229
+ ): ((...args: never[]) => void) | null;
230
+
231
+ /** The `(element, config)` call each module's factory actually wants. */
232
+ export function viewerMount(
233
+ viewer: string, factory: (...args: never[]) => unknown,
234
+ ): (el: unknown, config: Record<string, unknown>) => unknown;
235
+
236
+ /**
237
+ * Which tabs the host declared content for: the ids whose snippet prop is a
238
+ * function, in declaration order.
239
+ */
240
+ export function snippetTabIds(
241
+ tabs: unknown, props: Record<string, unknown>,
242
+ ): string[];
243
+
244
+ /** How each viewer is wired: its label, what it requires, and where its grid goes. */
245
+ export const VIEWER_BINDING: Readonly<Record<string, {
246
+ label: string; requires: readonly string[]; fromContext: string | null;
247
+ }>>;
248
+
249
+ /** Every grid event name. */
23
250
  export const EVENT_NAMES: readonly string[];
251
+ /** `cell:edit:start` → `cell-edit-start`, the name the action dispatches under. */
24
252
  export function dashedName(event: string): string;
253
+ /** Every event each non-grid viewer emits, keyed by viewer name. */
254
+ export const VIEWER_EVENTS: Readonly<Record<string, readonly string[]>>;
255
+ /** The props each viewer can take live, and the instance call each becomes. */
256
+ export const VIEWER_APPLY: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
257
+ /** `card:move` → `onCardMove`, the handler key the shared controller dispatches on. */
258
+ export function viewerHandlerName(event: string): string;
259
+ /**
260
+ * The framework-free viewer lifecycle every adapter drives an instance
261
+ * through: mount once, push changed props into the live instance, destroy.
262
+ */
263
+ export function createViewerController(opts: {
264
+ viewer: string;
265
+ mount: (el: unknown, config: Record<string, unknown>) => unknown;
266
+ element: unknown;
267
+ props?: Record<string, unknown>;
268
+ name?: string;
269
+ }): {
270
+ instance: unknown;
271
+ update: (next: Record<string, unknown>) => void;
272
+ destroy: () => void;
273
+ };
25
274
  export default createLatticeAction;