@toclocoinc/lattice-grid 1.18.1 → 1.20.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.
package/lattice-grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.18.1, type declarations
2
+ * Lattice Grid 1.20.0, type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -1303,6 +1303,92 @@ export interface GridConfig {
1303
1303
  gap?: number;
1304
1304
  };
1305
1305
 
1306
+ /**
1307
+ * Present rows as a gallery of tiles (§7.12).
1308
+ *
1309
+ * The tiled card layout with a size-driven column count: tiles as wide as
1310
+ * `tileWidth` allows, as many across as the container holds, laid out by the
1311
+ * same 2-D virtualisation the grid already runs. `true` draws a tile per row
1312
+ * generated from the columns; an object sizes them or supplies a template.
1313
+ * Presentation only — sort, filter, group and the data pipeline are unchanged.
1314
+ */
1315
+ gallery?: boolean | {
1316
+ /** The tile layout. Generated from the columns when omitted. */
1317
+ template?: string;
1318
+ /** How wide a tile aims to be; the count across follows the container. 240 by default. */
1319
+ tileWidth?: number;
1320
+ /** How tall a tile is. 180 by default. */
1321
+ tileHeight?: number;
1322
+ /** A fixed number of tiles on a line, instead of `tileWidth`. Does not reflow. */
1323
+ cardsPerRow?: number;
1324
+ /** Space between tiles, in pixels. 8 by default. */
1325
+ gap?: number;
1326
+ /** A class of your own on every tile, alongside the grid's. */
1327
+ className?: string;
1328
+ /** The layer's role. `list` by default; `listbox` for a selectable set. */
1329
+ role?: string;
1330
+ /** Each tile's role. `listitem` by default. */
1331
+ itemRole?: string;
1332
+ };
1333
+
1334
+ /**
1335
+ * Present each row as a record card — a form of label/value pairs (§7.11).
1336
+ *
1337
+ * For a screen where reading one record matters more than comparing many.
1338
+ * `true` draws a card per row generated from the columns, each column a
1339
+ * labelled line in display order, showing the same text the table shows. An
1340
+ * object supplies a template or sizes the card. A card list underneath, so it
1341
+ * inherits the virtualisation and every interaction a card carries.
1342
+ * Presentation only — sort, filter, group and the data pipeline are unchanged.
1343
+ */
1344
+ recordCard?: boolean | {
1345
+ /** The card layout. Generated from the columns as label/value pairs when omitted. */
1346
+ template?: string;
1347
+ /** How tall a card is. 200 by default; a form needs room per field. */
1348
+ cardHeight?: number;
1349
+ /** A class of your own on every card, alongside the grid's. */
1350
+ className?: string;
1351
+ /** The layer's role. `list` by default. */
1352
+ role?: string;
1353
+ /** Each card's role. `listitem` by default. */
1354
+ itemRole?: string;
1355
+ };
1356
+
1357
+ /**
1358
+ * Present rows as a board — a kanban of grouped lanes of cards (§7.14).
1359
+ *
1360
+ * The top-level group becomes a lane and every leaf under it becomes a card
1361
+ * stacked in that lane: a pipeline by stage, a task list by status, a backlog
1362
+ * by owner. `true` draws a card per row generated from the columns; an object
1363
+ * sizes the lanes and cards or supplies a template. Group the grid to give the
1364
+ * board its lanes; an ungrouped board is a single lane of every card.
1365
+ *
1366
+ * A card is drawn through the same code the other card presentations use, so a
1367
+ * board card is still a row: it clicks, selects and drags through the grid's
1368
+ * own handlers, masks protected columns, and shows the same text the table
1369
+ * shows. Both axes are virtualised — the lanes across and the cards down each —
1370
+ * so a board of many long lanes renders only what is on screen. Presentation
1371
+ * only: sort, filter, group and the data pipeline are unchanged.
1372
+ */
1373
+ board?: boolean | {
1374
+ /** The card layout. Generated from the columns as a tile when omitted. */
1375
+ template?: string;
1376
+ /** How wide a lane is, in pixels. 280 by default. */
1377
+ laneWidth?: number;
1378
+ /** How tall a card is, in pixels. 120 by default. */
1379
+ cardHeight?: number;
1380
+ /** Space between lanes, in pixels. 16 by default. */
1381
+ laneGap?: number;
1382
+ /** Space around a card within its lane, in pixels. 8 by default. */
1383
+ gap?: number;
1384
+ /** A class of your own on every card, alongside the grid's. */
1385
+ className?: string;
1386
+ /** The board's role. `list` by default; `listbox` for a selectable set. */
1387
+ role?: string;
1388
+ /** Each card's role. `listitem` by default. */
1389
+ itemRole?: string;
1390
+ };
1391
+
1306
1392
  /**
1307
1393
  * Present rows as cards when the grid's container is too narrow to be a
1308
1394
  * table honestly, a phone, or a narrow panel on a wide screen.
@@ -1477,11 +1563,17 @@ export interface GridConfig {
1477
1563
  hostFilter?: { active(): boolean; passes(row: Row): boolean };
1478
1564
  /** Anything of yours, passed untouched to renderers, editors and sources. */
1479
1565
  context?: unknown;
1480
- /** Row count above which a column distribution is computed in a Worker. */
1566
+ /**
1567
+ * Row count above which eligible work is computed in a Worker: column
1568
+ * distributions, and a portable sort (a built-in collation with no custom
1569
+ * comparator). Below it, everything runs on the main thread.
1570
+ */
1481
1571
  workerThreshold?: number;
1482
1572
  /**
1483
- * Compute column distributions off the main thread. Sorting, filtering and
1484
- * grouping run on the main thread; see the reference for why.
1573
+ * Compute eligible work off the main thread: column distributions, and a
1574
+ * portable sort above {@link GridConfig.workerThreshold} (a re-sort recomputes
1575
+ * off-thread while the grid keeps showing the prior order, then swaps to the
1576
+ * new one when it lands). Filtering and grouping still run on the main thread.
1485
1577
  */
1486
1578
  useWorker?: boolean;
1487
1579
  /** Where to load the worker kernel from, when hosting it yourself. */
@@ -1833,6 +1925,15 @@ export interface ColumnState {
1833
1925
  groupTotal?: TotalName | null;
1834
1926
  /** The grand-total override, when one differs from `total`. */
1835
1927
  grandTotal?: TotalName | null;
1928
+ /**
1929
+ * The column's runtime decoration (BACKLOG-0000723), present only when the
1930
+ * column carries one, so a `columns.decorate()` survives a saved view and
1931
+ * participates in undo/redo. Absent means "not recorded"; an explicit `null`
1932
+ * on an undo patch clears a decoration back to plain text.
1933
+ */
1934
+ decoration?: DecorationName | DecorationSpec | null;
1935
+ /** The variant set alongside the decoration, when one is present. */
1936
+ variant?: VariantSpec | null;
1836
1937
  }
1837
1938
 
1838
1939
  export interface GridState {
@@ -2121,6 +2222,13 @@ export interface StatisticsApi {
2121
2222
  reduce(colId: string, fn: string): unknown;
2122
2223
  /** Everything worth knowing about one column, in one pass each. */
2123
2224
  profile(colId: string): ColumnProfile | null;
2225
+ /**
2226
+ * Which columns differ most between the filtered subset and the whole
2227
+ * population it was drawn from, ranked by effect size — never by a p-value.
2228
+ * The measure is stated per column; a numeric and a categorical column are put
2229
+ * on one bounded scale so they rank against each other.
2230
+ */
2231
+ subsetVsPopulation(opts?: { columns?: string[] }): SubsetComparison;
2124
2232
  /** Pearson's correlation between two columns. */
2125
2233
  correlation(a: string, b: string): number | null;
2126
2234
  /** Covariance, a correlation before the scales are divided out. */
@@ -2170,6 +2278,57 @@ export interface StatisticsApi {
2170
2278
  keyOf(data: unknown): string | null;
2171
2279
  /** Which reductions can be maintained against a change, and which rescan. */
2172
2280
  readonly maintenance: Readonly<Record<string, 'maintained' | 'rescan'>>;
2281
+ /**
2282
+ * The approximate tier: kernels a sketch maintains in constant time per tick,
2283
+ * keyed by kernel name, each carrying the sketch that backs it and the error
2284
+ * bound that sketch is verified to meet.
2285
+ */
2286
+ readonly approximate: Readonly<Record<string, ApproximateEntry>>;
2287
+ /**
2288
+ * The honest tier for one kernel across both the exact and approximate maps:
2289
+ * its exact tier and, when one exists, the approximate alternative and bound.
2290
+ */
2291
+ maintenanceTier(fn: string): MaintenanceTier;
2292
+ }
2293
+
2294
+ /** How an approximate reduction's error bound holds, and what it measures. */
2295
+ export interface ErrorBound {
2296
+ /** `deterministic` every run, `probabilistic` in expectation, `exact` to float rounding. */
2297
+ kind: 'deterministic' | 'probabilistic' | 'exact';
2298
+ /** What the number measures. `rank` is a fraction of the rank, for quantiles. */
2299
+ metric: 'absolute' | 'relative' | 'rank' | 'none';
2300
+ /** The bound itself, in the unit `metric` names. */
2301
+ value: number;
2302
+ /** A one-line human reading of the guarantee. */
2303
+ statement: string;
2304
+ }
2305
+
2306
+ /** One entry of the approximate maintenance tier. */
2307
+ export interface ApproximateEntry {
2308
+ /** The sketch that backs this kernel: `HyperLogLog`, `KLL`, `SpaceSaving`. */
2309
+ sketch: string;
2310
+ /** The error bound the sketch is verified to meet. */
2311
+ bound: ErrorBound;
2312
+ }
2313
+
2314
+ /** The maintenance label for one kernel across both tiers. */
2315
+ export interface MaintenanceTier {
2316
+ /** The kernel name. */
2317
+ stat: string;
2318
+ /** Its exact tier, or null when it is not an exact kernel. */
2319
+ exact: 'maintained' | 'rescan' | null;
2320
+ /** The approximate alternative and bound, or null when none exists. */
2321
+ approximate: ApproximateEntry | null;
2322
+ }
2323
+
2324
+ /** The window a windowed aggregate was computed over. */
2325
+ export interface WindowSpec {
2326
+ /** Which window: last N ticks, last N ms, or the session. */
2327
+ kind: 'count' | 'time' | 'session';
2328
+ /** The size: N ticks, N ms, or the session duration in ms. */
2329
+ span: number;
2330
+ /** How many values actually fell inside the window. */
2331
+ size: number;
2173
2332
  }
2174
2333
 
2175
2334
  export type ShadowKind =
@@ -2272,6 +2431,49 @@ export interface HistogramBin {
2272
2431
  count: number;
2273
2432
  }
2274
2433
 
2434
+ /** How one column differs between the filtered subset and its population. */
2435
+ export interface ColumnDifference {
2436
+ /** The column id. */
2437
+ column: string;
2438
+ /** The column's display name, or its id. */
2439
+ name: string;
2440
+ /**
2441
+ * The effect size reported for this column's family: the standardized mean
2442
+ * difference for a numeric column, the total variation of the category mix for
2443
+ * a categorical one. Never a p-value.
2444
+ */
2445
+ measure: 'standardizedMeanDifference' | 'categoricalTotalVariation';
2446
+ /** The effect size in its own terms, or null when it has no scale here. */
2447
+ magnitude: number | null;
2448
+ /**
2449
+ * The total variation distance between subset and population, 0 to 1 — the
2450
+ * common scale both families reduce to, and what the ranking sorts by.
2451
+ */
2452
+ distance: number;
2453
+ /** +1 when the subset sits above the population, −1 below, 0 for a mix. */
2454
+ direction: number;
2455
+ /** How many rows the subset comparison stood on. */
2456
+ subsetN: number;
2457
+ /** How many rows the population comparison stood on. */
2458
+ populationN: number;
2459
+ /** False when the subset is too small to read the difference from. */
2460
+ reliable: boolean;
2461
+ }
2462
+
2463
+ /** The subset-vs-population ranking (BACKLOG-0000653). */
2464
+ export interface SubsetComparison {
2465
+ /** Every compared column, largest difference first. */
2466
+ ranked: ColumnDifference[];
2467
+ /** How many rows the filtered subset holds. */
2468
+ subsetN: number;
2469
+ /** How many rows the whole population holds. */
2470
+ populationN: number;
2471
+ /** Whether a filter is actually narrowing the set. */
2472
+ filtered: boolean;
2473
+ /** The measure each family reports, and the common scale, named for a legend. */
2474
+ measures: { numeric: string; categorical: string; common: string };
2475
+ }
2476
+
2275
2477
  export interface FormattingApi {
2276
2478
  list(scope?: FormattingScope): FormattingRule[];
2277
2479
  all(): Record<FormattingScope, FormattingRule[]>;
@@ -2436,10 +2638,41 @@ export interface CsvExportOptions {
2436
2638
  download?: boolean;
2437
2639
  }
2438
2640
 
2641
+ /** A conditional-formatting rule's rendering, returned by `cellStyle`. */
2642
+ export interface ExcelCellStyle {
2643
+ bold?: boolean;
2644
+ italic?: boolean;
2645
+ /** Font colour as 6- or 8-digit hex/ARGB, e.g. 'FFFF0000'. `color` is an alias. */
2646
+ colour?: string;
2647
+ color?: string;
2648
+ /** Solid fill colour as 6- or 8-digit hex/ARGB. */
2649
+ fill?: string;
2650
+ }
2651
+
2652
+ /** A cell border, per edge. `true` means a thin line; a string names the style. */
2653
+ export interface ExcelBorderSpec {
2654
+ left?: boolean | string;
2655
+ right?: boolean | string;
2656
+ top?: boolean | string;
2657
+ bottom?: boolean | string;
2658
+ }
2659
+
2439
2660
  export interface ExcelExportOptions extends Omit<CsvExportOptions, 'delimiter' | 'quote' | 'lineEnding'> {
2440
2661
  sheetName?: string;
2441
2662
  freezePanes?: boolean;
2442
2663
  variantFills?: boolean;
2664
+ /**
2665
+ * Draw cell borders on the data grid. `false` (default) is borderless; `true`
2666
+ * draws a thin box; a string names the line style; an object picks edges.
2667
+ */
2668
+ borders?: boolean | string | ExcelBorderSpec;
2669
+ /**
2670
+ * What to do with grid-hidden columns. `'omit'` (default) drops them;
2671
+ * `'hidden'` keeps them as Excel-hidden columns for round-trip fidelity.
2672
+ */
2673
+ hiddenColumns?: 'omit' | 'hidden';
2674
+ /** Explicit merged body ranges in A1 form, e.g. ['A3:A4']. */
2675
+ merges?: string[];
2443
2676
  onProgress?: (p: { written: number; total: number }) => void;
2444
2677
  }
2445
2678