@toclocoinc/lattice-grid 1.52.0 → 1.54.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 (77) hide show
  1. package/README.md +2 -1
  2. package/docs/API.html +91 -2
  3. package/docs/api-detail.html +14 -2
  4. package/lattice-grid.d.ts +336 -7
  5. package/lattice-grid.esm.min.js +76 -26
  6. package/lattice-grid.min.cjs +76 -26
  7. package/lattice-grid.min.js +76 -26
  8. package/modules/ai.esm.min.js +24 -4
  9. package/modules/ai.min.cjs +24 -4
  10. package/modules/ai.min.js +24 -4
  11. package/modules/angular.esm.min.js +2 -2
  12. package/modules/angular.min.cjs +2 -2
  13. package/modules/angular.min.js +2 -2
  14. package/modules/chart-alluvial.esm.min.js +1 -1
  15. package/modules/chart-arc.esm.min.js +1 -1
  16. package/modules/chart-bubblemap.esm.min.js +1 -1
  17. package/modules/chart-bump.esm.min.js +1 -1
  18. package/modules/chart-calendar.esm.min.js +1 -1
  19. package/modules/chart-decomposition.esm.min.js +1 -1
  20. package/modules/chart-diverging.esm.min.js +1 -1
  21. package/modules/chart-dumbbell.esm.min.js +1 -1
  22. package/modules/chart-fan.esm.min.js +1 -1
  23. package/modules/chart-hexbin.esm.min.js +1 -1
  24. package/modules/chart-hexmap.esm.min.js +1 -1
  25. package/modules/chart-icicle.esm.min.js +1 -1
  26. package/modules/chart-parallel.esm.min.js +1 -1
  27. package/modules/chart-ridgeline.esm.min.js +1 -1
  28. package/modules/chart-roc.esm.min.js +1 -1
  29. package/modules/chart-slope.esm.min.js +1 -1
  30. package/modules/chart-splom.esm.min.js +1 -1
  31. package/modules/chart-waffle.esm.min.js +1 -1
  32. package/modules/charts.esm.min.js +143 -17
  33. package/modules/charts.min.cjs +143 -17
  34. package/modules/charts.min.js +143 -17
  35. package/modules/data-router.esm.min.js +4 -4
  36. package/modules/data-router.min.cjs +4 -4
  37. package/modules/data-router.min.js +4 -4
  38. package/modules/devtools.esm.min.js +2 -2
  39. package/modules/devtools.min.cjs +2 -2
  40. package/modules/devtools.min.js +2 -2
  41. package/modules/dhtmlx-compat.esm.min.js +4 -4
  42. package/modules/dhtmlx-compat.min.cjs +4 -4
  43. package/modules/dhtmlx-compat.min.js +4 -4
  44. package/modules/gantt.esm.min.js +63 -4
  45. package/modules/gantt.min.cjs +63 -4
  46. package/modules/gantt.min.js +63 -4
  47. package/modules/htmx.esm.min.js +76 -26
  48. package/modules/htmx.min.cjs +76 -26
  49. package/modules/htmx.min.js +76 -26
  50. package/modules/kanban.esm.min.js +4 -4
  51. package/modules/kanban.min.cjs +4 -4
  52. package/modules/kanban.min.js +4 -4
  53. package/modules/kpi.esm.min.js +277 -28
  54. package/modules/kpi.min.cjs +277 -28
  55. package/modules/kpi.min.js +277 -28
  56. package/modules/layout.esm.min.js +2103 -0
  57. package/modules/layout.min.cjs +2106 -0
  58. package/modules/layout.min.js +2106 -0
  59. package/modules/mock-socket.esm.min.js +2 -2
  60. package/modules/mock-socket.min.cjs +2 -2
  61. package/modules/mock-socket.min.js +2 -2
  62. package/modules/react.esm.min.js +2 -2
  63. package/modules/react.min.cjs +2 -2
  64. package/modules/react.min.js +2 -2
  65. package/modules/svelte.esm.min.js +2 -2
  66. package/modules/svelte.min.cjs +2 -2
  67. package/modules/svelte.min.js +2 -2
  68. package/modules/tabs.esm.min.js +5 -4
  69. package/modules/tabs.min.cjs +5 -4
  70. package/modules/tabs.min.js +5 -4
  71. package/modules/vue.esm.min.js +2 -2
  72. package/modules/vue.min.cjs +2 -2
  73. package/modules/vue.min.js +2 -2
  74. package/modules/webcomponent.esm.min.js +76 -26
  75. package/modules/webcomponent.min.cjs +76 -26
  76. package/modules/webcomponent.min.js +76 -26
  77. package/package.json +1 -1
package/lattice-grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.52.0, type declarations
2
+ * Lattice Grid 1.54.0, type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -8715,14 +8715,17 @@ declare module 'lattice-grid/modules/kpi' {
8715
8715
  value: unknown;
8716
8716
  formatted: string;
8717
8717
  /**
8718
- * The tile's semantic band, or `unknown` when the panel holds no rows at
8719
- * all. `unknown` is decided from data presence before any threshold is
8718
+ * The tile's semantic band, or `unknown` when the tile measured nothing.
8719
+ * `unknown` is decided from data presence before any threshold is
8720
8720
  * consulted: an aggregation over nothing returns the identity of its
8721
8721
  * operation (`sum` and `count` return 0), and 0 is a number a threshold
8722
- * grades, so without it an empty panel would report as a healthy one. A
8723
- * tile whose `filter` matches none of the rows the panel *does* hold has
8724
- * measured a real zero and is banded normally. `null` means the tile has no
8725
- * thresholds or bands configured.
8722
+ * grades, so without it an empty panel would report as a healthy one.
8723
+ *
8724
+ * Two things make a tile `unknown`: the panel holds no rows at all, or the
8725
+ * tile's `field` names no column on the bound grid, so it never read a cell
8726
+ * to reduce over. A tile whose `filter` matches none of the rows the panel
8727
+ * *does* hold is neither — it has measured a real zero and is banded
8728
+ * normally. `null` means the tile has no thresholds or bands configured.
8726
8729
  */
8727
8730
  status: 'good' | 'warn' | 'critical' | 'unknown' | null;
8728
8731
  target?: number;
@@ -8746,6 +8749,14 @@ declare module 'lattice-grid/modules/kpi' {
8746
8749
  rows?: KPIRow[];
8747
8750
  grid?: unknown;
8748
8751
  rowKey?: string | ((row: KPIRow) => unknown);
8752
+ /**
8753
+ * Extra columns of the bound `grid` to project onto the rows a tile `filter`
8754
+ * sees, beyond the fields the tiles themselves declare. A grid-bound panel
8755
+ * hands a filter a projection, not a whole grid row, so a filter over a
8756
+ * column no tile names would otherwise read `undefined` and report a
8757
+ * confident zero. Ignored on a panel over a plain `rows` array.
8758
+ */
8759
+ fields?: string[];
8749
8760
  tiles?: KPITile[];
8750
8761
  columns?: number;
8751
8762
  ariaLabel?: string;
@@ -9318,3 +9329,321 @@ declare module 'lattice-grid/modules/tabs' {
9318
9329
  export function createTabs(el: HTMLElement, config: TabsConfig): Tabs;
9319
9330
  export default createTabs;
9320
9331
  }
9332
+
9333
+ declare module 'lattice-grid/modules/layout' {
9334
+ /**
9335
+ * One window on the cell grid.
9336
+ *
9337
+ * Deliberately **not** named `WindowSpec`: that name is already taken by the
9338
+ * rolling-statistics window (`{ kind: 'count'|'time'|'session', span, size }`)
9339
+ * and reusing it would put `kind: 'session'` next to a dashboard pane.
9340
+ */
9341
+ interface LayoutWindow {
9342
+ /** A stable, unique id. Required. */
9343
+ id: string;
9344
+ /** The 1-based column the window starts in. Auto-placed when omitted. */
9345
+ xPos?: number;
9346
+ /** The 1-based row the window starts in. Auto-placed when omitted. */
9347
+ yPos?: number;
9348
+ /** How many columns it spans (default 1). */
9349
+ xSize?: number;
9350
+ /** How many rows it spans (default 1). */
9351
+ ySize?: number;
9352
+ /** The title shown in the chrome bar, and the name every control takes. */
9353
+ title?: string;
9354
+ /** Whether to draw the title bar (default `true`). */
9355
+ chrome?: boolean;
9356
+ /** Whether to offer a close button (default `false`). */
9357
+ closable?: boolean;
9358
+ /** Whether the window can be moved by drag or keyboard (default `false`). */
9359
+ movable?: boolean;
9360
+ /** Whether the window can be resized by drag or keyboard (default `false`). */
9361
+ resizable?: boolean;
9362
+ /**
9363
+ * Whether to offer a maximise control in the chrome (default `false`).
9364
+ *
9365
+ * Maximising fills the **layout host**, not the browser window, and hides
9366
+ * every other window for the duration. Escape restores it, unless a payload
9367
+ * has already claimed the key.
9368
+ */
9369
+ maximisable?: boolean;
9370
+ /**
9371
+ * Whether to offer a minimise control in the chrome (default `false`).
9372
+ *
9373
+ * A window with `chrome: false` cannot be minimised whatever this says:
9374
+ * there would be nothing left on screen to restore it with.
9375
+ */
9376
+ minimisable?: boolean;
9377
+ /** Padding inside the window; the layout's `padding` (default `'5px'`) otherwise. */
9378
+ padding?: number | string;
9379
+ /** The `id` given to the payload container (default `` `${id}-body` ``). */
9380
+ payloadId?: string;
9381
+ /** The window's accessible name, when the title alone is not enough context. */
9382
+ ariaLabel?: string;
9383
+ }
9384
+
9385
+ /**
9386
+ * The three capabilities a layout-level default and `setInteractive()` cover.
9387
+ *
9388
+ * These are the layout **defaults**, not the per-window resolution: a window
9389
+ * that declared `movable: false` stays pinned whatever these say.
9390
+ *
9391
+ * Three values, not two. `undefined` means no layout-level default is in force
9392
+ * and each window's own flag decides; `true` unlocks everything that did not
9393
+ * opt out; `false` is an active lock. Reporting `undefined` as `false` would
9394
+ * read correctly and round-trip wrongly, so it is reported as it is.
9395
+ */
9396
+ interface LayoutInteractive {
9397
+ movable: boolean | undefined;
9398
+ resizable: boolean | undefined;
9399
+ closable: boolean | undefined;
9400
+ }
9401
+
9402
+ /** The plain, JSON-safe arrangement `getLayout()` returns and `setLayout()` takes. */
9403
+ interface LayoutSnapshot {
9404
+ columns: number;
9405
+ rows: number;
9406
+ windows: { id: string; xPos: number; yPos: number; xSize: number; ySize: number }[];
9407
+ }
9408
+
9409
+ /** A cell placement, as carried on the move and resize events. */
9410
+ interface LayoutPlacement {
9411
+ xPos: number;
9412
+ yPos: number;
9413
+ xSize: number;
9414
+ ySize: number;
9415
+ }
9416
+
9417
+ /** The payload of `window:moved`, `beforeWindowMove`, `beforeWindowResize`. */
9418
+ interface LayoutMoveEvent {
9419
+ id: string;
9420
+ from: LayoutPlacement;
9421
+ /** Where the window was asked to go. */
9422
+ to: LayoutPlacement;
9423
+ /** Where it actually ended up, which under `compact: 'vertical'` may differ. */
9424
+ landed?: LayoutPlacement;
9425
+ origin?: 'api' | 'user' | 'init';
9426
+ reason?: string | null;
9427
+ /** Cancel the action (only meaningful on a `before*` event). */
9428
+ preventDefault?: (reason?: string) => void;
9429
+ defaultPrevented?: boolean;
9430
+ }
9431
+
9432
+ /**
9433
+ * The payload of `window:resized` — the measured **content box** of the
9434
+ * payload container, not a cell count. Emitted when the container genuinely
9435
+ * changes size, including on the opening frame; never with a zero box.
9436
+ */
9437
+ interface LayoutResizeEvent {
9438
+ id: string;
9439
+ payloadId: string;
9440
+ /** The payload container itself, so a host can act on it directly. */
9441
+ payload: HTMLElement;
9442
+ width: number;
9443
+ height: number;
9444
+ xPos: number;
9445
+ yPos: number;
9446
+ xSize: number;
9447
+ ySize: number;
9448
+ }
9449
+
9450
+ /** The payload of `window:closed` and `beforeWindowClose`. */
9451
+ interface LayoutCloseEvent {
9452
+ id: string;
9453
+ payloadId: string;
9454
+ /** The payload container, handed back so the host can destroy what it mounted. */
9455
+ payload?: HTMLElement;
9456
+ origin?: 'api' | 'user';
9457
+ reason?: string | null;
9458
+ preventDefault?: (reason?: string) => void;
9459
+ defaultPrevented?: boolean;
9460
+ }
9461
+
9462
+ /** The payload of `layout:changed`: the whole arrangement, plus what moved it. */
9463
+ interface LayoutChangedEvent extends LayoutSnapshot {
9464
+ cause: string;
9465
+ }
9466
+
9467
+ /** Dashboard layout configuration. */
9468
+ interface LayoutConfig {
9469
+ /** Cell columns across the mounted element (default 12). */
9470
+ columns?: number;
9471
+ /** Cell rows down the mounted element (default 6). */
9472
+ rows?: number;
9473
+ /** Horizontal overflow (default `'static'`). */
9474
+ overflowX?: 'static' | 'scroll';
9475
+ /** Vertical overflow (default `'static'`). */
9476
+ overflowY?: 'static' | 'scroll';
9477
+ /** Fixed column track size, used only when `overflowX` is `'scroll'` (default `'240px'`). */
9478
+ columnWidth?: number | string;
9479
+ /** Fixed row track size, used only when `overflowY` is `'scroll'` (default `'160px'`). */
9480
+ rowHeight?: number | string;
9481
+ /** The gap between cells (default `'8px'`). */
9482
+ gap?: number | string;
9483
+ /** The default padding inside a window (default `'5px'`). */
9484
+ padding?: number | string;
9485
+ /** Rearrangement (default `'vertical'`): push displaced windows down, then pull up. */
9486
+ compact?: 'vertical' | 'none';
9487
+ /**
9488
+ * The default `movable` for every window that does not declare its own
9489
+ * (default `false`). This states a default, so `false` takes nothing away
9490
+ * from a window that declared `movable: true`; `setInteractive(false)` is
9491
+ * the active lock that does.
9492
+ */
9493
+ movable?: boolean;
9494
+ /** The default `resizable` for windows that declare none (default `false`); see `movable`. */
9495
+ resizable?: boolean;
9496
+ /** The default `closable` for windows that declare none (default `false`); see `movable`. */
9497
+ closable?: boolean;
9498
+ /**
9499
+ * The default `maximisable` for windows that declare none (default `false`).
9500
+ *
9501
+ * Not touched by `setInteractive()`: a display mode neither moves nor resizes
9502
+ * a window in the arrangement, so a locked dashboard can still be blown up
9503
+ * to read.
9504
+ */
9505
+ maximisable?: boolean;
9506
+ /** The default `minimisable` for windows that declare none (default `false`); see `maximisable`. */
9507
+ minimisable?: boolean;
9508
+ /** The windows, in mount order. */
9509
+ windows?: LayoutWindow[];
9510
+ /** An arrangement to apply at mount, as produced by `getLayout()`. */
9511
+ layout?: LayoutSnapshot;
9512
+ /** The layout region's accessible name. */
9513
+ ariaLabel?: string;
9514
+ /** A message catalogue, e.g. `grid.messages`; built-in English seeds otherwise. */
9515
+ messages?: { t(key: string, params?: Record<string, unknown>): string };
9516
+ onWindowMoved?: (event: LayoutMoveEvent) => void;
9517
+ onWindowResized?: (event: LayoutResizeEvent) => void;
9518
+ onWindowClosed?: (event: LayoutCloseEvent) => void;
9519
+ onLayoutChanged?: (event: LayoutChangedEvent) => void;
9520
+ onBeforeWindowMove?: (event: LayoutMoveEvent) => boolean | void | Promise<boolean>;
9521
+ onBeforeWindowResize?: (event: LayoutMoveEvent) => boolean | void | Promise<boolean>;
9522
+ onBeforeWindowClose?: (event: LayoutCloseEvent) => boolean | void | Promise<boolean>;
9523
+ onWindowMoveCancelled?: (event: LayoutMoveEvent) => void;
9524
+ onWindowResizeCancelled?: (event: LayoutMoveEvent) => void;
9525
+ onWindowCloseCancelled?: (event: LayoutCloseEvent) => void;
9526
+ }
9527
+
9528
+ /**
9529
+ * A reconfigurable dashboard: a cell grid inside an element, and a set of
9530
+ * windows on it that a user can move, resize and close by pointer or by
9531
+ * keyboard (BACKLOG-0001108).
9532
+ *
9533
+ * The module is **payload-agnostic**: a window body is a container with an id,
9534
+ * which this module creates and sizes and never reads. It tells a payload it
9535
+ * was resized by emitting `window:resized`; it never calls into one, because it
9536
+ * cannot know what one is.
9537
+ */
9538
+ interface Layout {
9539
+ readonly el: HTMLElement;
9540
+ /** The window ids, in mount order. */
9541
+ windows(): string[];
9542
+ /** The payload container for a window, or `null`. */
9543
+ payload(id: string): HTMLElement | null;
9544
+ /** A copy of one window's current descriptor, or `null`. */
9545
+ window(id: string): LayoutWindow | null;
9546
+ /** Add a window after mount; returns its payload container. */
9547
+ add(spec: LayoutWindow): HTMLElement;
9548
+ /** Move or resize a window, through the same before-events the drag uses. */
9549
+ move(id: string, to: Partial<LayoutPlacement>): boolean | Promise<boolean>;
9550
+ /** Close a window through `beforeWindowClose`; the payload is not destroyed. */
9551
+ close(id: string): boolean | Promise<boolean>;
9552
+ /**
9553
+ * Blow one window up to fill the layout host, hiding the rest.
9554
+ *
9555
+ * It fills the **host element**, not the browser window, so there is no
9556
+ * `position: fixed` (whose containing block is the nearest ancestor carrying
9557
+ * a `transform` or a `contain`, which is why the same rule fills the screen
9558
+ * on one page and lands in a 300px box on the next), no reparenting and
9559
+ * nothing that can disturb the page around the dashboard.
9560
+ *
9561
+ * **Nothing moves**: no compaction runs, no placement changes, and the
9562
+ * payload container is the same DOM node throughout. **Escape restores it**,
9563
+ * from anywhere inside the layout, unless a payload has already claimed the
9564
+ * key — a grid marks every Escape as handled, at two independent sites (a
9565
+ * focused body cell and a focused header cell), so from inside a maximised
9566
+ * grid the way back is the restore control. A minimised window is expanded first,
9567
+ * and maximising a second window restores the first.
9568
+ */
9569
+ maximise(id: string): boolean;
9570
+ /**
9571
+ * Collapse one window to a single row: its payload is hidden and its chrome
9572
+ * stays, carrying the control that brings it back.
9573
+ *
9574
+ * On screen it becomes one row and the windows below pull up into the space
9575
+ * under `compact: 'vertical'`. In the arrangement nothing moves at all — the
9576
+ * collapse is a projection of it — so `restore()` gives back exactly the
9577
+ * arrangement that was there, in **any** order and with any number of other
9578
+ * windows still collapsed.
9579
+ *
9580
+ * A window with `chrome: false` is refused, with a warning naming it.
9581
+ */
9582
+ minimise(id: string): boolean;
9583
+ /** Leave whichever display mode a window is in; `false` when it was in none. */
9584
+ restore(id: string): boolean;
9585
+ /** The id of the window filling the host, or `null`. At most one. */
9586
+ maximised(): string | null;
9587
+ /** The ids of every currently minimised window, in mount order. */
9588
+ minimised(): string[];
9589
+ /**
9590
+ * The full current arrangement.
9591
+ *
9592
+ * **A mode is not an arrangement**: this reports the *underlying* placement
9593
+ * of a maximised or minimised window — where it will be when restored — never
9594
+ * the geometry it is drawn at.
9595
+ */
9596
+ getLayout(): LayoutSnapshot;
9597
+ /** Restore an arrangement; never throws on garbage. */
9598
+ setLayout(incoming: LayoutSnapshot | LayoutWindow[]): number;
9599
+ /** A versioned snapshot, following core's and gantt's shape. */
9600
+ getState(): { version: number; layout: LayoutSnapshot };
9601
+ /** Restore a `getState()` snapshot; never throws on garbage. */
9602
+ setState(snapshot: unknown): number;
9603
+ /**
9604
+ * Lock or unlock the dashboard at runtime — the "Edit layout" button. A
9605
+ * boolean sets all three capabilities; an object sets only the keys it
9606
+ * carries. Nothing is destroyed, so every payload survives the toggle.
9607
+ *
9608
+ * The asymmetry is deliberate: **you can always take a capability away; you
9609
+ * can never grant one where the developer said no.** `setInteractive(false)`
9610
+ * locks every window, including one whose own spec says `movable: true`;
9611
+ * `setInteractive(true)` unlocks only the windows that never opted out.
9612
+ *
9613
+ * `config.movable: false` and `setInteractive(false)` are deliberately not
9614
+ * the same thing: the config states the *default* for windows that declare
9615
+ * nothing (and `false` is already that default, so it takes nothing away from
9616
+ * a window that opted in), while this is an *active lock*.
9617
+ *
9618
+ * A key carrying `undefined` is treated as absent, so
9619
+ * `setInteractive(getInteractive())` is a no-op in every state.
9620
+ *
9621
+ * A locked layout is not a read-only dashboard: this module never reads or
9622
+ * writes a payload, so a grid inside a window is made read-only with the
9623
+ * grid's own settings.
9624
+ */
9625
+ setInteractive(value: boolean | Partial<LayoutInteractive>): LayoutInteractive;
9626
+ /**
9627
+ * The layout-level interactivity now in force, as a copy — `undefined` where
9628
+ * no layout-level default is set, so the result round-trips through
9629
+ * `setInteractive`.
9630
+ */
9631
+ getInteractive(): LayoutInteractive;
9632
+ /** Re-measure every window and emit `window:resized` for those that changed. */
9633
+ refresh(): number;
9634
+ on(
9635
+ name: 'window:moved' | 'window:resized' | 'window:closed' | 'layout:changed'
9636
+ | 'beforeWindowMove' | 'beforeWindowResize' | 'beforeWindowClose'
9637
+ | 'windowMove:cancelled' | 'windowResize:cancelled' | 'windowClose:cancelled'
9638
+ | '*' | string,
9639
+ fn: (event: any) => unknown,
9640
+ ): () => void;
9641
+ off(name: string, fn: (event: any) => unknown): void;
9642
+ /** Tear the layout down; whatever the host mounted in a payload is the host's to destroy. */
9643
+ destroy(): void;
9644
+ }
9645
+
9646
+ /** Create a reconfigurable dashboard layout over a host element. */
9647
+ export function createLayout(el: HTMLElement, config?: LayoutConfig): Layout;
9648
+ export default createLayout;
9649
+ }