@toclocoinc/lattice-grid 1.46.0 → 1.47.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 (71) hide show
  1. package/README.md +131 -1
  2. package/docs/API.html +68 -4
  3. package/docs/api-detail.html +5 -2
  4. package/lattice-grid.d.ts +228 -6
  5. package/lattice-grid.esm.min.js +26 -5
  6. package/lattice-grid.min.cjs +26 -5
  7. package/lattice-grid.min.js +26 -5
  8. package/modules/ai.esm.min.js +195 -27
  9. package/modules/ai.min.cjs +193 -26
  10. package/modules/ai.min.js +193 -26
  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 +8 -3
  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 +225 -13
  33. package/modules/charts.min.cjs +225 -13
  34. package/modules/charts.min.js +225 -13
  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 +13 -4
  45. package/modules/gantt.min.cjs +13 -4
  46. package/modules/gantt.min.js +13 -4
  47. package/modules/htmx.esm.min.js +26 -5
  48. package/modules/htmx.min.cjs +26 -5
  49. package/modules/htmx.min.js +26 -5
  50. package/modules/kanban.esm.min.js +59 -8
  51. package/modules/kanban.min.cjs +59 -8
  52. package/modules/kanban.min.js +59 -8
  53. package/modules/kpi.esm.min.js +4 -4
  54. package/modules/kpi.min.cjs +4 -4
  55. package/modules/kpi.min.js +4 -4
  56. package/modules/mock-socket.esm.min.js +2 -2
  57. package/modules/mock-socket.min.cjs +2 -2
  58. package/modules/mock-socket.min.js +2 -2
  59. package/modules/react.esm.min.js +2 -2
  60. package/modules/react.min.cjs +2 -2
  61. package/modules/react.min.js +2 -2
  62. package/modules/svelte.esm.min.js +2 -2
  63. package/modules/svelte.min.cjs +2 -2
  64. package/modules/svelte.min.js +2 -2
  65. package/modules/vue.esm.min.js +2 -2
  66. package/modules/vue.min.cjs +2 -2
  67. package/modules/vue.min.js +2 -2
  68. package/modules/webcomponent.esm.min.js +26 -5
  69. package/modules/webcomponent.min.cjs +26 -5
  70. package/modules/webcomponent.min.js +26 -5
  71. package/package.json +1 -1
package/lattice-grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.46.0, type declarations
2
+ * Lattice Grid 1.47.0, type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -4096,9 +4096,12 @@ export interface ColumnsApi {
4096
4096
  * (BACKLOG-0000739). Header banding, not row grouping (see {@link group}); the
4097
4097
  * band is a {@link ColumnGroup} node so a drag-, keyboard- or config-built band
4098
4098
  * is the same tree, and it round-trips through a saved view. Emits
4099
- * `columngroup:changed`.
4099
+ * `columngroup:changed`. Pass `groupId` to add to the band already carrying
4100
+ * that id, or `id` (BACKLOG-0000985) to create a new band with a caller-chosen
4101
+ * stable id you can reference later; `groupId` wins if both are given and an
4102
+ * `id` already in use warns and no-ops.
4100
4103
  */
4101
- groupColumns(ids: string | string[], opts?: { title?: string; at?: number; groupId?: string }): string | null;
4104
+ groupColumns(ids: string | string[], opts?: { title?: string; at?: number; groupId?: string; id?: string }): string | null;
4102
4105
  /** Take a leaf out of its band; a band emptied by the move is dissolved. */
4103
4106
  ungroupColumn(id: string): void;
4104
4107
  /** Rename a banded header. */
@@ -6163,6 +6166,16 @@ export interface ChartTrend {
6163
6166
  alpha?: number;
6164
6167
  /** For Holt's exponential smoothing, the trend factor in `[0, 1]`; omit to fit it. */
6165
6168
  beta?: number;
6169
+ /**
6170
+ * The uncertainty band shaded around a linear `forecast` (BACKLOG-0000975).
6171
+ * The Student-t `prediction` band (a future observation) by default;
6172
+ * `confidence` shades the narrower mean-response band; `false` opts out and
6173
+ * leaves the bare dashed line. Ignored where there is no linear forecast to
6174
+ * put a band on.
6175
+ */
6176
+ band?: boolean | 'prediction' | 'confidence';
6177
+ /** The forecast band's confidence level in `(0, 1)`; 0.95 by default. */
6178
+ confidence?: number;
6166
6179
  /** `false` suppresses the R² label on a linear trend. */
6167
6180
  label?: boolean;
6168
6181
  }
@@ -7687,6 +7700,16 @@ declare module 'lattice-grid/modules/kanban' {
7687
7700
  color?: string;
7688
7701
  wipLimit?: number;
7689
7702
  collapsed?: boolean;
7703
+ /**
7704
+ * A per-column SLA override (BACKLOG-0000960): a lone threshold read as the
7705
+ * breach level, or a `{ warn, breach }` pair. Overrides the global `sla`
7706
+ * thresholds for cards in this column (precedence: lane → column → global).
7707
+ */
7708
+ sla?: KanbanSlaThreshold | { warn?: KanbanSlaThreshold; breach?: KanbanSlaThreshold };
7709
+ /** A per-column warn threshold — the shorthand for `sla: { warn }`. */
7710
+ slaWarn?: KanbanSlaThreshold;
7711
+ /** A per-column breach threshold — the shorthand for `sla: { breach }`. */
7712
+ slaBreach?: KanbanSlaThreshold;
7690
7713
  };
7691
7714
 
7692
7715
  /** A card field editor handle returned by a host editor factory. */
@@ -7732,6 +7755,112 @@ declare module 'lattice-grid/modules/kanban' {
7732
7755
  originalEvent?: unknown;
7733
7756
  }
7734
7757
 
7758
+ /**
7759
+ * A card-aging / SLA threshold (BACKLOG-0000960): a raw millisecond count, or
7760
+ * a `{ weeks, days, hours, minutes, seconds, ms }` spec whose fields are summed
7761
+ * (`{ days: 3, hours: 12 }` → 3.5 days). A negative or non-finite value means
7762
+ * "no threshold at this level".
7763
+ */
7764
+ type KanbanSlaThreshold = number | {
7765
+ weeks?: number; week?: number; w?: number;
7766
+ days?: number; day?: number; d?: number;
7767
+ hours?: number; hour?: number; h?: number;
7768
+ minutes?: number; minute?: number; m?: number; min?: number;
7769
+ seconds?: number; second?: number; s?: number; sec?: number;
7770
+ ms?: number; milliseconds?: number;
7771
+ };
7772
+
7773
+ /**
7774
+ * Card-aging / SLA configuration (BACKLOG-0000960). A card is measured against a
7775
+ * `warn` and a `breach` threshold; the view puts an age chip on aged cards and a
7776
+ * highlight on breached ones, and a rising crossing fires the `card:sla` event
7777
+ * and the matching `onWarn`/`onBreach` callback (signature `(level, rows)`, the
7778
+ * Data Router alert handler's). Thresholds resolve most-specific-first:
7779
+ * lane → column → global. Reached at runtime as {@link Kanban#sla}.
7780
+ */
7781
+ interface KanbanSlaConfig {
7782
+ /** The global warn threshold. */
7783
+ warn?: KanbanSlaThreshold;
7784
+ /** The global breach threshold. */
7785
+ breach?: KanbanSlaThreshold;
7786
+ /** Per-column overrides by column id (each a threshold or a `{ warn, breach }` pair). */
7787
+ columns?: Record<string, KanbanSlaThreshold | { warn?: KanbanSlaThreshold; breach?: KanbanSlaThreshold }>;
7788
+ /** Per-swimlane overrides by lane id (each a threshold or a `{ warn, breach }` pair). */
7789
+ lanes?: Record<string, KanbanSlaThreshold | { warn?: KanbanSlaThreshold; breach?: KanbanSlaThreshold }>;
7790
+ /**
7791
+ * Where the ageing clock starts: `'column'` (default) measures time in the
7792
+ * card's current column; `'board'` measures age since the card arrived/was
7793
+ * created.
7794
+ */
7795
+ basis?: 'column' | 'board';
7796
+ /** A row property holding the wall-clock time the card entered its column. */
7797
+ enteredProperty?: string;
7798
+ /** A row property holding the wall-clock time the card was created. */
7799
+ createdProperty?: string;
7800
+ /** Whether cards in a done column are exempt from ageing (default true). */
7801
+ ignoreDone?: boolean;
7802
+ /** Whether the flow transition log drives the ageing basis when present (default true). */
7803
+ useTransitionLog?: boolean;
7804
+ /** Show the age chip on every aged card (`'always'`), or only on warn/breach (`'threshold'`, default). */
7805
+ showAge?: 'always' | 'threshold';
7806
+ /** A wall-clock epoch clock, injectable for deterministic tests (default `Date.now`). */
7807
+ now?: () => number;
7808
+ /** A re-check interval in ms so a card breaching by sitting still still lights up (0 = off). */
7809
+ tick?: number;
7810
+ /** Called on a rising crossing to warn level, `(level, rows)` — the router alert handler's shape. */
7811
+ onWarn?: (level: 'warn' | 'breach', rows: KanbanRow[]) => void;
7812
+ /** Called on a rising crossing to breach level, `(level, rows)` — the router alert handler's shape. */
7813
+ onBreach?: (level: 'warn' | 'breach', rows: KanbanRow[]) => void;
7814
+ }
7815
+
7816
+ /** The computed SLA state of one card (BACKLOG-0000960). */
7817
+ interface KanbanSlaState {
7818
+ key: unknown;
7819
+ columnId: string | null;
7820
+ lane?: unknown;
7821
+ /** The ageing-clock start epoch (ms), or null when no time source could be resolved. */
7822
+ start: number | null;
7823
+ /** The card's age in ms, or null when unknown. */
7824
+ ageMs: number | null;
7825
+ /** A short human age label (`2d`, `5h`, …), '' when unknown. */
7826
+ ageText: string;
7827
+ /** The resolved warn threshold in ms, or null. */
7828
+ warnMs: number | null;
7829
+ /** The resolved breach threshold in ms, or null. */
7830
+ breachMs: number | null;
7831
+ /** The classified level, or null when the card cannot be aged. */
7832
+ level: 'ok' | 'warn' | 'breach' | null;
7833
+ /** True when `level` is `'breach'`. */
7834
+ breached: boolean;
7835
+ }
7836
+
7837
+ /**
7838
+ * The card-aging / SLA monitor (BACKLOG-0000960), reached as {@link Kanban#sla}
7839
+ * when a `sla` config is supplied. Pure and DOM-free: it computes each card's
7840
+ * ageing state from the board's card model and the flow transition log, and the
7841
+ * view paints it.
7842
+ */
7843
+ interface KanbanSla {
7844
+ /** The normalised SLA config (read-only). */
7845
+ readonly config: object;
7846
+ /** Recompute every card's SLA state without emitting anything. */
7847
+ sync(): KanbanSla;
7848
+ /** Recompute and fire `card:sla`/`onWarn`/`onBreach` on each rising crossing. */
7849
+ evaluate(opts?: { emit?: boolean }): KanbanSlaState[];
7850
+ /** Establish the baseline, notify on the current state, and start the optional tick. */
7851
+ start(): KanbanSla;
7852
+ /** The SLA state of one card (by card model or key), or null when unknown. */
7853
+ stateFor(cardOrKey: KanbanCard | unknown): KanbanSlaState | null;
7854
+ /** Every card's current SLA state. */
7855
+ states(): KanbanSlaState[];
7856
+ /** The cards currently at breach level. */
7857
+ breaches(): KanbanSlaState[];
7858
+ /** The cards currently at warn level (not yet breached). */
7859
+ warnings(): KanbanSlaState[];
7860
+ /** Stop the tick and drop the board subscriptions. */
7861
+ destroy(): void;
7862
+ }
7863
+
7735
7864
  /**
7736
7865
  * Kanban configuration. Every structural property is named here so the same
7737
7866
  * board maps DemandFlow (a status field, `points`, `sprint`, `epic`, a
@@ -7772,6 +7901,13 @@ declare module 'lattice-grid/modules/kanban' {
7772
7901
  children?: KanbanChildren;
7773
7902
  /** Card virtualization for tall columns: true, or `{ rowHeight, overscan, threshold, viewport }`. */
7774
7903
  virtualize?: boolean | { rowHeight?: number; overscan?: number; threshold?: number; viewport?: number };
7904
+ /**
7905
+ * Card aging / SLA highlighting (BACKLOG-0000960): warn/breach thresholds
7906
+ * (globally, per column and/or per lane) that age each card and fire
7907
+ * `card:sla` on a rising crossing. Opt-in; reached at runtime as
7908
+ * {@link Kanban#sla}. See {@link KanbanSlaConfig}.
7909
+ */
7910
+ sla?: KanbanSlaConfig;
7775
7911
  /** A saved board state (from `getState`) to restore on construction. */
7776
7912
  state?: object;
7777
7913
  /** Show a per-column add-card affordance. */
@@ -7872,6 +8008,8 @@ declare module 'lattice-grid/modules/kanban' {
7872
8008
  readonly el: unknown | null;
7873
8009
  readonly rowKey: string | ((row: KanbanRow) => unknown);
7874
8010
  rows: KanbanRows;
8011
+ /** The card-aging / SLA monitor, present only when a `sla` config was supplied (BACKLOG-0000960). */
8012
+ sla?: KanbanSla;
7875
8013
  columns(): KanbanColumn[];
7876
8014
  column(id: string): KanbanColumn | undefined;
7877
8015
  count(id: string): number;
@@ -8153,15 +8291,52 @@ declare module 'lattice-grid/modules/ai' {
8153
8291
  /**
8154
8292
  * A narrative target. `view` narrates the current filtered view; `column`
8155
8293
  * narrates one column's profile; `forecast` adds its projection; `kpi`/`chart`
8156
- * narrate figures the caller passes through in `facts`.
8294
+ * narrate figures the caller passes through in `facts`; `risk` assembles a
8295
+ * project RISK SUMMARY from the separate Gantt / Kanban modules' public outputs
8296
+ * (BACKLOG-0000979).
8157
8297
  */
8158
8298
  interface AITarget {
8159
- kind?: 'view' | 'column' | 'forecast' | 'kpi' | 'chart';
8299
+ kind?: 'view' | 'column' | 'forecast' | 'kpi' | 'chart' | 'risk';
8160
8300
  colId?: string;
8161
8301
  /** Forecast options, for `kind: 'forecast'`. */
8162
8302
  options?: object;
8163
8303
  /** Caller-supplied figures for a KPI/chart Explain, grounded like the rest. */
8164
8304
  facts?: Array<{ id?: string; label: string; value: unknown; display?: string; kind?: string; colId?: string }>;
8305
+ /**
8306
+ * For `kind: 'risk'`: a Gantt instance (from `createGantt`). Read duck-typed
8307
+ * for `earnedValue()` (SPI/CPI/variances) and `schedule` (critical path,
8308
+ * float). The AI bundle never imports the Gantt module.
8309
+ */
8310
+ gantt?: unknown;
8311
+ /**
8312
+ * For `kind: 'risk'`: a Kanban board (from `createKanban`). Read for its
8313
+ * `board.sla` monitor (breach / warning counts). The AI bundle never imports
8314
+ * the Kanban module.
8315
+ */
8316
+ board?: unknown;
8317
+ /** For `kind: 'risk'`: an SLA monitor, if not reached through `board`. */
8318
+ sla?: unknown;
8319
+ /** For `kind: 'risk'`: a precomputed `gantt.earnedValue()` result. */
8320
+ earnedValue?: object;
8321
+ /** For `kind: 'risk'`: a precomputed `gantt.schedule` result. */
8322
+ schedule?: object;
8323
+ /** For `kind: 'risk'`: precomputed SLA breach states. */
8324
+ breaches?: object[];
8325
+ /** For `kind: 'risk'`: precomputed SLA warning states. */
8326
+ warnings?: object[];
8327
+ /** For `kind: 'risk'`: options passed to `gantt.earnedValue()`. */
8328
+ evmOptions?: object;
8329
+ /**
8330
+ * For `kind: 'risk'`: expose the at-risk task NAMES (off by default — a risk
8331
+ * summary carries aggregates only unless the host opts in).
8332
+ */
8333
+ includeTaskNames?: boolean;
8334
+ /**
8335
+ * For `kind: 'risk'`: expose the money figures BAC/PV/EV/AC (off by default).
8336
+ */
8337
+ includeCost?: boolean;
8338
+ /** For `kind: 'risk'`: cap on named at-risk tasks (default 10). */
8339
+ maxTasks?: number;
8165
8340
  }
8166
8341
 
8167
8342
  /** The facts packet a narrative grounds on. */
@@ -8170,7 +8345,27 @@ declare module 'lattice-grid/modules/ai' {
8170
8345
  facts: AIFact[];
8171
8346
  /** The numeric values seeding the reconciliation registry. */
8172
8347
  groundedValues: number[];
8173
- meta: { kind: string; filtered: boolean; factCount: number; redacted?: boolean; colId?: string };
8348
+ meta: {
8349
+ kind: string; filtered: boolean; factCount: number; redacted?: boolean; colId?: string;
8350
+ /** For `kind: 'risk'`: which module sources resolved. */
8351
+ sources?: { schedule: boolean; earnedValue: boolean; sla: boolean };
8352
+ /** For `kind: 'risk'`: which opt-in exposures were honoured. */
8353
+ exposed?: { taskNames: boolean; cost: boolean };
8354
+ };
8355
+ }
8356
+
8357
+ /**
8358
+ * The risk facts a board / Gantt risk summary grounds on (BACKLOG-0000979),
8359
+ * from {@link buildRiskFacts}: the facts plus which module sources resolved and
8360
+ * which opt-in exposures (task names, cost) were honoured.
8361
+ */
8362
+ interface AIRiskFacts {
8363
+ facts: AIFact[];
8364
+ meta: {
8365
+ kind: 'risk';
8366
+ sources: { schedule: boolean; earnedValue: boolean; sla: boolean };
8367
+ exposed: { taskNames: boolean; cost: boolean };
8368
+ };
8174
8369
  }
8175
8370
 
8176
8371
  /** The result of a narrative: reconciled prose plus what grounded and what did not. */
@@ -8366,6 +8561,19 @@ declare module 'lattice-grid/modules/ai' {
8366
8561
  explain(target?: AITarget, opts?: object): Promise<AINarrative>;
8367
8562
  /** An alias for {@link AI.explain}. */
8368
8563
  narrate(target?: AITarget, opts?: object): Promise<AINarrative>;
8564
+ /**
8565
+ * Produce a grounded, reconciled board / Gantt RISK SUMMARY
8566
+ * (BACKLOG-0000979): a plain-language reading like "3 tasks at risk on the
8567
+ * critical path, SPI 0.67, 2 SLA breaches". A convenience over
8568
+ * `explain({ kind: 'risk', ... })`; the module sources go in `sources`
8569
+ * (`gantt`, `board`/`sla`, or precomputed outputs). Every figure runs through
8570
+ * the same reconciliation guard as {@link AI.explain}.
8571
+ */
8572
+ riskSummary(sources?: {
8573
+ gantt?: unknown; board?: unknown; sla?: unknown;
8574
+ earnedValue?: object; schedule?: object; breaches?: object[]; warnings?: object[];
8575
+ includeTaskNames?: boolean; includeCost?: boolean; maxTasks?: number; evmOptions?: object;
8576
+ }, opts?: object): Promise<AINarrative>;
8369
8577
  /** Mount (or re-target) the insights panel into an element. */
8370
8578
  insights(el?: HTMLElement, opts?: object): AI;
8371
8579
  /** Build an "Explain" button bound to a target. */
@@ -8422,5 +8630,19 @@ declare module 'lattice-grid/modules/ai' {
8422
8630
  * engine and calls only the host's `ask()`.
8423
8631
  */
8424
8632
  export function createAI(grid: unknown, config?: AIConfig): AI;
8633
+
8634
+ /**
8635
+ * Build the RISK-SUMMARY facts packet (BACKLOG-0000979) from the separate
8636
+ * Gantt / Kanban modules' public outputs — SPI/CPI and variances from
8637
+ * `gantt.earnedValue()`, tasks at risk / on the critical path from
8638
+ * `gantt.schedule`, and SLA breaches from `board.sla`. Reads the module
8639
+ * instances (or their precomputed outputs) duck-typed off `target`; the AI
8640
+ * bundle imports neither module. This is the exact grounded set
8641
+ * `explain({ kind: 'risk' })` would use, exposed for preview and testing.
8642
+ */
8643
+ export function buildRiskFacts(target: AITarget, opts?: {
8644
+ locale?: string; fmt?: (value: number) => string;
8645
+ }): AIRiskFacts;
8646
+
8425
8647
  export default createAI;
8426
8648
  }