@toclocoinc/lattice-grid 1.31.1 → 1.33.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 (59) hide show
  1. package/README.md +1 -1
  2. package/docs/API.html +240 -3
  3. package/docs/api-detail.html +3 -2
  4. package/lattice-grid.d.ts +364 -4
  5. package/lattice-grid.esm.min.js +4 -4
  6. package/lattice-grid.min.cjs +4 -4
  7. package/lattice-grid.min.js +4 -4
  8. package/modules/angular.esm.min.js +2 -2
  9. package/modules/angular.min.cjs +2 -2
  10. package/modules/angular.min.js +2 -2
  11. package/modules/chart-alluvial.esm.min.js +143 -0
  12. package/modules/chart-arc.esm.min.js +102 -0
  13. package/modules/chart-bubblemap.esm.min.js +86 -0
  14. package/modules/chart-bump.esm.min.js +105 -0
  15. package/modules/chart-calendar.esm.min.js +124 -0
  16. package/modules/chart-decomposition.esm.min.js +127 -0
  17. package/modules/chart-diverging.esm.min.js +99 -0
  18. package/modules/chart-dumbbell.esm.min.js +110 -0
  19. package/modules/chart-fan.esm.min.js +135 -0
  20. package/modules/chart-hexbin.esm.min.js +144 -0
  21. package/modules/chart-hexmap.esm.min.js +120 -0
  22. package/modules/chart-icicle.esm.min.js +92 -0
  23. package/modules/chart-parallel.esm.min.js +114 -0
  24. package/modules/chart-ridgeline.esm.min.js +114 -0
  25. package/modules/chart-roc.esm.min.js +177 -0
  26. package/modules/chart-slope.esm.min.js +95 -0
  27. package/modules/chart-splom.esm.min.js +120 -0
  28. package/modules/chart-waffle.esm.min.js +92 -0
  29. package/modules/charts.esm.min.js +107 -9
  30. package/modules/charts.min.cjs +105 -9
  31. package/modules/charts.min.js +105 -9
  32. package/modules/data-router.esm.min.js +2048 -24
  33. package/modules/data-router.min.cjs +2048 -24
  34. package/modules/data-router.min.js +2048 -24
  35. package/modules/devtools.esm.min.js +2 -2
  36. package/modules/devtools.min.cjs +2 -2
  37. package/modules/devtools.min.js +2 -2
  38. package/modules/dhtmlx-compat.esm.min.js +4 -4
  39. package/modules/dhtmlx-compat.min.cjs +4 -4
  40. package/modules/dhtmlx-compat.min.js +4 -4
  41. package/modules/htmx.esm.min.js +4 -4
  42. package/modules/htmx.min.cjs +4 -4
  43. package/modules/htmx.min.js +4 -4
  44. package/modules/mock-socket.esm.min.js +242 -0
  45. package/modules/mock-socket.min.cjs +242 -0
  46. package/modules/mock-socket.min.js +242 -0
  47. package/modules/react.esm.min.js +2 -2
  48. package/modules/react.min.cjs +2 -2
  49. package/modules/react.min.js +2 -2
  50. package/modules/svelte.esm.min.js +2 -2
  51. package/modules/svelte.min.cjs +2 -2
  52. package/modules/svelte.min.js +2 -2
  53. package/modules/vue.esm.min.js +2 -2
  54. package/modules/vue.min.cjs +2 -2
  55. package/modules/vue.min.js +2 -2
  56. package/modules/webcomponent.esm.min.js +4 -4
  57. package/modules/webcomponent.min.cjs +4 -4
  58. package/modules/webcomponent.min.js +4 -4
  59. package/package.json +1 -1
package/lattice-grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.31.1, type declarations
2
+ * Lattice Grid 1.33.0, type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -5863,9 +5863,244 @@ declare module 'lattice-grid/modules/charts' {
5863
5863
  export function resolveScheme(spec?: object): object;
5864
5864
  export function schemeNames(): string[];
5865
5865
  export function setDefaultScheme(name: string): void;
5866
+ /**
5867
+ * The definition an extension chart type registers (BACKLOG-0000886). `draw`
5868
+ * receives the base drawing context — `plot`, `bound`, `groups`, `scheme`,
5869
+ * `typography`, `fontSize`, `labels`, `grid`, `spec`, `doc` — plus
5870
+ * `ctx.helpers`, the base's own toolkit of primitives (element factory, scales,
5871
+ * axes, mark pool, distribution kernels), and appends its marks to the layer
5872
+ * groups. `bind` optionally supplies the bound data (default: the by-series
5873
+ * binder); `freeform` lays the chart out without axis gutters; `labelled`
5874
+ * declares that `labels` applies.
5875
+ */
5876
+ interface ChartTypeDefinition {
5877
+ draw: (ctx: object) => object;
5878
+ bind?: (grid: Grid, spec: ChartSpec) => object;
5879
+ freeform?: boolean;
5880
+ labelled?: boolean;
5881
+ }
5882
+ /**
5883
+ * Register an extension chart type so `createChart({ type })` can draw it
5884
+ * (BACKLOG-0000886). Extension types ship as their own opt-in modules, so the
5885
+ * base charts bundle does not grow for a type a caller never imports — you pay
5886
+ * only for the charts you use.
5887
+ */
5888
+ export function registerChartType(name: string, def: ChartTypeDefinition): void;
5889
+ /** Every registered extension chart-type name, in registration order. */
5890
+ export function registeredChartTypes(): string[];
5866
5891
  export { Chart };
5867
5892
  }
5868
5893
 
5894
+ declare module 'lattice-grid/modules/chart-ridgeline' {
5895
+ /**
5896
+ * The ridgeline (joy plot) extension chart type (BACKLOG-0000886). Importing
5897
+ * this module registers `ridgeline` with the base charts module; the base
5898
+ * bundle does not include it unless a caller imports it. Draws one
5899
+ * kernel-density ridge per category (`x`), stacked and overlapping, over the
5900
+ * distribution of a measure (`y`); `spec.overlap` sets the vertical overlap.
5901
+ */
5902
+ export function drawRidgeline(ctx: object): object;
5903
+ export default drawRidgeline;
5904
+ }
5905
+
5906
+ declare module 'lattice-grid/modules/chart-calendar' {
5907
+ /**
5908
+ * The calendar-heatmap extension chart type (BACKLOG-0000886). Importing this
5909
+ * module registers `calendar`. Draws value-by-day as a GitHub-style grid: `x`
5910
+ * is a date column, `y` the measure summed per day.
5911
+ */
5912
+ export function drawCalendar(ctx: object): object;
5913
+ export default drawCalendar;
5914
+ }
5915
+
5916
+ declare module 'lattice-grid/modules/chart-splom' {
5917
+ /**
5918
+ * The scatter-plot-matrix (SPLOM) extension chart type (BACKLOG-0000886).
5919
+ * Importing this module registers `splom`. Crosses every pair of the numeric
5920
+ * `columns` (2–6) as a matrix of scatters, naming each variable on the
5921
+ * diagonal.
5922
+ */
5923
+ export function drawSplom(ctx: object): object;
5924
+ /** The SPLOM binding: reads the numeric `columns` off the grid's visible rows. */
5925
+ export function bindSplom(grid: Grid, spec: object): object;
5926
+ export default drawSplom;
5927
+ }
5928
+
5929
+ declare module 'lattice-grid/modules/chart-hexbin' {
5930
+ /**
5931
+ * The hexbin / 2D-density extension chart type (BACKLOG-0000886). Importing
5932
+ * this module registers `hexbin`. Bins `x`/`y` points into hexagons shaded by
5933
+ * count, so a large scatter reads as a density field rather than overplotting.
5934
+ */
5935
+ export function drawHexbin(ctx: object): object;
5936
+ /** The hexbin binding: reads the numeric `x` and `y` columns off the grid's rows. */
5937
+ export function bindHexbin(grid: Grid, spec: object): object;
5938
+ export default drawHexbin;
5939
+ }
5940
+
5941
+ declare module 'lattice-grid/modules/chart-roc' {
5942
+ /**
5943
+ * The ROC / PR / calibration extension chart type (BACKLOG-0000886). Importing
5944
+ * this module registers `roc`. `spec.curve` chooses `'roc'` (default, with the
5945
+ * chance diagonal and AUC), `'pr'`, or `'calibration'`; `label` is the outcome
5946
+ * column (positive when truthy or equal to `spec.positive`), `score` the model
5947
+ * score.
5948
+ */
5949
+ export function drawRoc(ctx: object): object;
5950
+ /** The ROC binding: reads the outcome and score off the grid's rows. */
5951
+ export function bindRoc(grid: Grid, spec: object): object;
5952
+ export default drawRoc;
5953
+ }
5954
+
5955
+ declare module 'lattice-grid/modules/chart-fan' {
5956
+ /**
5957
+ * The fan / forecast extension chart type (BACKLOG-0000886). Importing this
5958
+ * module registers `fan`. Draws `y` (history) as a solid line, `forecast` as a
5959
+ * dashed continuation, and the `lower`/`upper` interval as a widening band.
5960
+ */
5961
+ export function drawFan(ctx: object): object;
5962
+ /** The fan binding: reads the history, forecast and interval columns in row order. */
5963
+ export function bindFan(grid: Grid, spec: object): object;
5964
+ export default drawFan;
5965
+ }
5966
+
5967
+ declare module 'lattice-grid/modules/chart-decomposition' {
5968
+ /**
5969
+ * The seasonal-decomposition panel extension chart type (BACKLOG-0000886),
5970
+ * companion to the `tsTrend`/`tsSeasonal`/`tsResidual` shadow columns.
5971
+ * Importing this module registers `decomposition`. Draws a stacked panel per
5972
+ * named component column (`observed`/`trend`/`seasonal`/`residual`) sharing one
5973
+ * x axis.
5974
+ */
5975
+ export function drawDecomposition(ctx: object): object;
5976
+ /** The decomposition binding: reads the named component columns in row order. */
5977
+ export function bindDecomposition(grid: Grid, spec: object): object;
5978
+ export default drawDecomposition;
5979
+ }
5980
+
5981
+ declare module 'lattice-grid/modules/chart-slope' {
5982
+ /**
5983
+ * The slope-chart extension type (BACKLOG-0000886). Importing this module
5984
+ * registers `slope`. One line per `series` connecting its `y` across the `x`
5985
+ * periods — before/after comparison read from the slopes.
5986
+ */
5987
+ export function drawSlope(ctx: object): object;
5988
+ export default drawSlope;
5989
+ }
5990
+
5991
+ declare module 'lattice-grid/modules/chart-dumbbell' {
5992
+ /**
5993
+ * The dumbbell / connected-dot extension type (BACKLOG-0000886). Importing
5994
+ * this module registers `dumbbell`. Two dots (`start`, `end`) joined by a bar
5995
+ * per `x` category — the gap is the bar's length.
5996
+ */
5997
+ export function drawDumbbell(ctx: object): object;
5998
+ /** The dumbbell binding: reads the category and its two numeric columns. */
5999
+ export function bindDumbbell(grid: Grid, spec: object): object;
6000
+ export default drawDumbbell;
6001
+ }
6002
+
6003
+ declare module 'lattice-grid/modules/chart-bump' {
6004
+ /**
6005
+ * The bump-chart extension type (BACKLOG-0000886). Importing this module
6006
+ * registers `bump`. One line per `series` plotted by its rank of `y` within
6007
+ * each `x` period — rank-over-time, where crossings are the story.
6008
+ */
6009
+ export function drawBump(ctx: object): object;
6010
+ export default drawBump;
6011
+ }
6012
+
6013
+ declare module 'lattice-grid/modules/chart-diverging' {
6014
+ /**
6015
+ * The diverging-bar extension type (BACKLOG-0000886). Importing this module
6016
+ * registers `diverging`. Horizontal bars growing left/right from a central
6017
+ * zero over a signed `y`, on a symmetric scale.
6018
+ */
6019
+ export function drawDiverging(ctx: object): object;
6020
+ export default drawDiverging;
6021
+ }
6022
+
6023
+ declare module 'lattice-grid/modules/chart-parallel' {
6024
+ /**
6025
+ * The parallel-coordinates extension type (BACKLOG-0000886). Importing this
6026
+ * module registers `parallel`. One polyline per row across the numeric
6027
+ * `columns`, each a vertical axis with its own scale; `spec.colourBy` colours
6028
+ * by a category.
6029
+ */
6030
+ export function drawParallel(ctx: object): object;
6031
+ /** The parallel-coordinates binding: reads the dimension columns off the rows. */
6032
+ export function bindParallel(grid: Grid, spec: object): object;
6033
+ export default drawParallel;
6034
+ }
6035
+
6036
+ declare module 'lattice-grid/modules/chart-icicle' {
6037
+ /**
6038
+ * The icicle extension type (BACKLOG-0000886). Importing this module registers
6039
+ * `icicle`. A hierarchy (the grid's group tree) as nested rectangles in rows,
6040
+ * sized by `y`; drills like the built-in hierarchical types.
6041
+ */
6042
+ export function drawIcicle(ctx: object): object;
6043
+ export default drawIcicle;
6044
+ }
6045
+
6046
+ declare module 'lattice-grid/modules/chart-waffle' {
6047
+ /**
6048
+ * The waffle / dot-matrix extension type (BACKLOG-0000886). Importing this
6049
+ * module registers `waffle`. Proportion as counted squares (default 100), one
6050
+ * colour per `x` category sized by `y`.
6051
+ */
6052
+ export function drawWaffle(ctx: object): object;
6053
+ export default drawWaffle;
6054
+ }
6055
+
6056
+ declare module 'lattice-grid/modules/chart-alluvial' {
6057
+ /**
6058
+ * The alluvial extension type (BACKLOG-0000886). Importing this module
6059
+ * registers `alluvial`. Ribbons from `source` categories to `target`
6060
+ * categories sized by `value` — categorical flow between two dimensions.
6061
+ */
6062
+ export function drawAlluvial(ctx: object): object;
6063
+ /** The alluvial binding: aggregates source→target flows off the grid's rows. */
6064
+ export function bindAlluvial(grid: Grid, spec: object): object;
6065
+ export default drawAlluvial;
6066
+ }
6067
+
6068
+ declare module 'lattice-grid/modules/chart-arc' {
6069
+ /**
6070
+ * The arc-diagram extension type (BACKLOG-0000886). Importing this module
6071
+ * registers `arc`. Nodes on a baseline with `source`→`target` relationships as
6072
+ * semicircular arcs, thickness by `value`.
6073
+ */
6074
+ export function drawArc(ctx: object): object;
6075
+ /** The arc-diagram binding: collects nodes and edges off the grid's rows. */
6076
+ export function bindArc(grid: Grid, spec: object): object;
6077
+ export default drawArc;
6078
+ }
6079
+
6080
+ declare module 'lattice-grid/modules/chart-bubblemap' {
6081
+ /**
6082
+ * The symbol / bubble-map extension type (BACKLOG-0000886). Importing this
6083
+ * module registers `bubblemap`. Points placed by `lon`/`lat`, each a bubble
6084
+ * with a square-root radius from `size`; needs no outlines and fetches nothing.
6085
+ */
6086
+ export function drawBubbleMap(ctx: object): object;
6087
+ /** The bubble-map binding: reads the coordinate and size columns off the rows. */
6088
+ export function bindBubbleMap(grid: Grid, spec: object): object;
6089
+ export default drawBubbleMap;
6090
+ }
6091
+
6092
+ declare module 'lattice-grid/modules/chart-hexmap' {
6093
+ /**
6094
+ * The hexbin-map extension type (BACKLOG-0000886). Importing this module
6095
+ * registers `hexmap`. `lon`/`lat` points binned into hexagons shaded by count,
6096
+ * so a geographic density reads without overplotting or outlines.
6097
+ */
6098
+ export function drawHexMap(ctx: object): object;
6099
+ /** The hexbin-map binding: reads the coordinate columns off the grid's rows. */
6100
+ export function bindHexMap(grid: Grid, spec: object): object;
6101
+ export default drawHexMap;
6102
+ }
6103
+
5869
6104
  declare module 'lattice-grid/modules/react' {
5870
6105
  /**
5871
6106
  * Build the React component.
@@ -5961,6 +6196,19 @@ declare module 'lattice-grid/modules/data-router' {
5961
6196
  /** A predicate: a property value (`row[key] === value`) or a `fn(row)`. */
5962
6197
  type RoutePredicate = unknown | ((row: RouterRecord) => boolean);
5963
6198
 
6199
+ /**
6200
+ * Per-route reshaping options (v3, BACKLOG-0000887): `transform` maps/renames/
6201
+ * derives each row before the grid sees it; `filter` gives the grid only the
6202
+ * rows it admits; `sort` (a comparator or `{ key, dir }`) orders what the grid
6203
+ * receives. `rowKey` overrides the router default. All optional.
6204
+ */
6205
+ interface RouteOptions {
6206
+ rowKey?: (string | ((row: RouterRecord) => unknown));
6207
+ transform?: (row: RouterRecord) => RouterRecord;
6208
+ filter?: (row: RouterRecord) => boolean;
6209
+ sort?: (((a: RouterRecord, b: RouterRecord) => number) | { key: string; dir?: 'asc' | 'desc' });
6210
+ }
6211
+
5964
6212
  /**
5965
6213
  * A cross-grid selection relation (v2, BACKLOG-0000880): a key map (target
5966
6214
  * rows whose `to` value is among the selected source rows' `from` values — an
@@ -5980,10 +6228,10 @@ declare module 'lattice-grid/modules/data-router' {
5980
6228
  * update or remove in place by `rowKey`, preserving selection and scroll.
5981
6229
  */
5982
6230
  interface DataRouter {
5983
- /** Attach a grid behind a predicate; `rowKey` overrides the router default. */
5984
- attach(grid: unknown, predicate: RoutePredicate, opts?: { rowKey?: (string | ((row: RouterRecord) => unknown)) }): DataRouter;
6231
+ /** Attach a grid behind a predicate; `opts` may reshape/filter/sort the route (v3). */
6232
+ attach(grid: unknown, predicate: RoutePredicate, opts?: RouteOptions): DataRouter;
5985
6233
  /** Attach the "rest" sink for records no explicit route matched. */
5986
- attachDefault(grid: unknown, opts?: { rowKey?: (string | ((row: RouterRecord) => unknown)) }): DataRouter;
6234
+ attachDefault(grid: unknown, opts?: RouteOptions): DataRouter;
5987
6235
  /** Detach a grid; the host still owns and destroys it. */
5988
6236
  detach(grid: unknown): DataRouter;
5989
6237
  /** Apply a full snapshot as a keyed diff per grid; returns per-route counts. */
@@ -6136,3 +6384,115 @@ declare module 'lattice-grid/modules/devtools' {
6136
6384
  export const CONSOLE_ACTIVATION: string;
6137
6385
  export default createDevtools;
6138
6386
  }
6387
+
6388
+ declare module 'lattice-grid/modules/mock-socket' {
6389
+ /** One record on a feed: any object. Its partition comes from a property and its identity from `rowKey`. */
6390
+ type FeedRow = Record<string, unknown>;
6391
+
6392
+ /** One change in a delta batch, in the shape the data router applies. */
6393
+ interface FeedChange { op: 'upsert' | 'delete'; row: FeedRow }
6394
+
6395
+ /**
6396
+ * A message on the wire. A snapshot carries the full opening set; a delta
6397
+ * carries the changes since. The reader parses `event.data` and switches on
6398
+ * `kind`, exactly as against a real feed that framed its messages the same way.
6399
+ */
6400
+ interface FeedMessage {
6401
+ kind: 'snapshot' | 'delta';
6402
+ /** Present on a snapshot: the full opening set of rows. */
6403
+ rows?: FeedRow[];
6404
+ /** Present on a delta: the changes to apply. */
6405
+ changes?: FeedChange[];
6406
+ }
6407
+
6408
+ /** A feed: any iterator that yields a snapshot first, then deltas forever. */
6409
+ type Feed = Iterator<FeedMessage>;
6410
+
6411
+ /**
6412
+ * A serverless stand-in for a live `WebSocket`. It presents the same surface
6413
+ * as the browser's `WebSocket` — `readyState` and the state constants,
6414
+ * `onopen`/`onmessage`/`onclose`/`onerror`, `addEventListener`, `send` and
6415
+ * `close` — so the code that reads it does not change when it is swapped for a
6416
+ * real socket. It opens after a short delay, emits the feed's first value as a
6417
+ * snapshot, then pumps one value per tick as a delta.
6418
+ */
6419
+ export class MockWebSocket {
6420
+ static readonly CONNECTING: 0;
6421
+ static readonly OPEN: 1;
6422
+ static readonly CLOSING: 2;
6423
+ static readonly CLOSED: 3;
6424
+ readonly CONNECTING: 0;
6425
+ readonly OPEN: 1;
6426
+ readonly CLOSING: 2;
6427
+ readonly CLOSED: 3;
6428
+ readyState: number;
6429
+ url: string;
6430
+ onopen: ((event: { type: string }) => void) | null;
6431
+ onmessage: ((event: { type: string; data: string }) => void) | null;
6432
+ onclose: ((event: { type: string; code: number; reason: string; wasClean: boolean }) => void) | null;
6433
+ onerror: ((event: { type: string; error: unknown }) => void) | null;
6434
+ /**
6435
+ * @param init the feed and its timing: `feed` (snapshot first, then deltas);
6436
+ * `rate` ms between deltas (default 1000); `jitter` random plus-or-minus ms
6437
+ * per gap (default 0); `seed` for that jitter (default 1); `snapshotDelay`
6438
+ * ms before opening (default 60); `pauseWhenHidden` stops while the tab is
6439
+ * hidden (default true); `url` a cosmetic address.
6440
+ */
6441
+ constructor(init: {
6442
+ feed: Feed;
6443
+ rate?: number;
6444
+ jitter?: number;
6445
+ seed?: number;
6446
+ snapshotDelay?: number;
6447
+ pauseWhenHidden?: boolean;
6448
+ url?: string;
6449
+ });
6450
+ addEventListener(type: string, fn: (event: unknown) => void): void;
6451
+ removeEventListener(type: string, fn: (event: unknown) => void): void;
6452
+ /** A real socket sends upstream; here it is accepted and ignored. */
6453
+ send(data?: unknown): void;
6454
+ /** Stop the feed until `resume()`; the socket stays open (a demo/test affordance). */
6455
+ pause(): void;
6456
+ /** Resume a paused feed. */
6457
+ resume(): void;
6458
+ /** Close the socket, stop the feed and emit a clean `close`. */
6459
+ close(): void;
6460
+ }
6461
+
6462
+ /**
6463
+ * mulberry32: a small seeded pseudo-random generator, so a custom feed can be
6464
+ * seeded the same way the shipped ones are. The same seed yields the same
6465
+ * sequence of values in `[0, 1)`.
6466
+ */
6467
+ export function rng(seed: number): () => number;
6468
+
6469
+ /**
6470
+ * A mixed operations feed — orders, shipments and incidents across three
6471
+ * regions plus a throughput rollup — the Data Router tutorial partitions
6472
+ * across several grids and a chart from one source. Yields a snapshot, then
6473
+ * deltas forever. Seedable for a repeatable stream.
6474
+ */
6475
+ export function opsFeed(options?: {
6476
+ seed?: number;
6477
+ orders?: number;
6478
+ shipments?: number;
6479
+ incidents?: number;
6480
+ batch?: number;
6481
+ }): Generator<FeedMessage>;
6482
+
6483
+ /**
6484
+ * A market-data feed: instruments whose prices random-walk each tick, each
6485
+ * record carrying `type: 'price'`, `symbol`, `last`, `chg` and a bid/ask. The
6486
+ * price/random-walk feed behind the trading-terminal tutorial. Yields a
6487
+ * snapshot, then deltas forever. Seedable for a repeatable stream.
6488
+ */
6489
+ export function priceFeed(options?: {
6490
+ seed?: number;
6491
+ symbols?: { symbol: string; last: number }[];
6492
+ move?: number;
6493
+ batch?: number;
6494
+ spread?: number;
6495
+ }): Generator<FeedMessage>;
6496
+
6497
+ export default MockWebSocket;
6498
+ }