@toclocoinc/lattice-grid 1.11.0 → 1.12.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,10 +1,10 @@
1
1
  /*!
2
- * Lattice Grid 1.11.0 — type declarations
2
+ * Lattice Grid 1.12.0, type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
6
  /**
7
- * Lattice Grid — public type declarations.
7
+ * Lattice Grid: public type declarations.
8
8
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
9
9
  *
10
10
  * These declarations describe the public API of the vanilla-JavaScript
@@ -19,30 +19,30 @@
19
19
  export type TypeName =
20
20
  | 'text' | 'number' | 'boolean' | 'date' | 'dateString' | 'object' | 'lookup'
21
21
  | 'image'
22
- // Extended catalogue. Never inferred — a column asks for these by name.
22
+ // Extended catalogue. Never inferred, a column asks for these by name.
23
23
  | 'time' | 'datetime' | 'duration'
24
24
  | 'ipv4' | 'ipv6' | 'cidr'
25
25
  | 'json' | 'secret'
26
26
  | 'hex' | 'hex8' | 'hex16' | 'hex32' | 'binary' | 'binary8' | 'octal'
27
27
  | 'decibel' | 'decibelAmplitude' | 'ratio' | 'percentRate'
28
- // Units — computing
28
+ // Units: computing
29
29
  | 'bytes' | 'megabytes' | 'gigabytes' | 'bitrate' | 'gigabits'
30
- // Units — physical
30
+ // Units: physical
31
31
  | 'metres' | 'millimetres' | 'kilometres'
32
32
  | 'grams' | 'kilograms' | 'tonnes'
33
33
  | 'seconds' | 'milliseconds' | 'hours'
34
- // Units — engineering
34
+ // Units: engineering
35
35
  | 'speed' | 'kph' | 'mph' | 'knots' | 'acceleration'
36
36
  | 'area' | 'hectares' | 'volume' | 'cubicMetres'
37
37
  | 'energy' | 'kilowattHours' | 'power' | 'kilowatts' | 'force'
38
38
  | 'pressure' | 'bar' | 'psi' | 'torque' | 'density'
39
39
  | 'flow' | 'litresPerMinute' | 'radians' | 'degrees'
40
- // Units — electrical and scientific
40
+ // Units: electrical and scientific
41
41
  | 'voltage' | 'current' | 'resistance' | 'capacitance' | 'inductance'
42
42
  | 'charge' | 'conductance' | 'fluxDensity' | 'luminousFlux' | 'illuminance'
43
43
  | 'substance' | 'absorbedDose' | 'equivalentDose' | 'radioactivity' | 'frequency'
44
44
  | 'luminousIntensity' | 'doseRate'
45
- // Units — rate, ratio and process
45
+ // Units: rate, ratio and process
46
46
  | 'rpm' | 'angularVelocity' | 'ppm' | 'ppb' | 'basisPoints'
47
47
  | 'molarity' | 'massFlow' | 'tonnesPerHour'
48
48
  | 'viscosity' | 'kinematicViscosity' | 'thermalConductivity' | 'specificHeat'
@@ -65,7 +65,7 @@ export type Align = 'start' | 'center' | 'end' | 'left' | 'right' | 'centre';
65
65
  */
66
66
  export type Density = 'compact' | 'standard' | 'comfortable' | 'spacious' | number;
67
67
  /**
68
- * A shipped theme, or your own name — the value is written to `data-theme` on
68
+ * A shipped theme, or your own name, the value is written to `data-theme` on
69
69
  * the grid's root, so `.lattice[data-theme="mine"]` is all a custom one needs.
70
70
  * Unset follows the viewer's `prefers-color-scheme`.
71
71
  */
@@ -82,29 +82,47 @@ export interface CellStyle { [cssProperty: string]: string | number | null | und
82
82
  // ---------------------------------------------------------------------------
83
83
 
84
84
  export interface Row {
85
+ /** What identifies the row. Selection, expansion and edits are all keyed on it. */
85
86
  key: string;
87
+ /** The object you supplied. Null on a group heading, which is a product of the grouping rather than a record. */
86
88
  data: unknown | null;
89
+ /** Depth in a tree or a grouping. Zero at the top. */
87
90
  level: number;
91
+ /** The row above it in a tree or grouping, or null at the top. */
88
92
  parent: Row | null;
93
+ /** Every child, before filtering. */
89
94
  children?: Row[];
95
+ /** The children the filters left. */
90
96
  filteredChildren?: Row[];
97
+ /** The children in display order. */
91
98
  sortedChildren?: Row[];
99
+ /** Whether this is a group heading rather than a record. A heading carries no data and must be skipped when totalling. */
92
100
  group: boolean;
101
+ /** Whether its children are showing. */
93
102
  expanded: boolean;
103
+ /** How many records sit beneath it, at any depth. */
94
104
  leafCount: number;
105
+ /** The group's own reductions, by column id. */
95
106
  totals?: Record<string, unknown>;
107
+ /** Whether this row is the expanded detail panel of the one above. */
96
108
  detail?: boolean;
109
+ /** Whether this row has a detail panel. */
97
110
  master?: boolean;
111
+ /** The row's height in pixels, as measured or configured. */
98
112
  height: number;
113
+ /** Position in the display order, or null when off screen. */
99
114
  index: number | null;
115
+ /** Selection state. `partial` is a group some but not all of whose children are selected. */
100
116
  selected: boolean | 'partial';
101
117
  /** Physical index into the ColumnStore. Null for synthetic rows. */
102
118
  physical?: number | null;
103
119
  /** Group rows only: the column id this level groups on, and the group value. */
104
120
  groupColumn?: string;
121
+ /** The value this group heading stands for. */
105
122
  groupValue?: unknown;
106
123
  /** Stable path of group keys from root to this row. */
107
124
  groupPath?: string[];
125
+ /** Whether children exist, which a lazily loaded tree knows before it has them. */
108
126
  hasChildren?: boolean;
109
127
  /**
110
128
  * Which sticky strip this row is pinned in, when it is one the host pinned
@@ -125,7 +143,7 @@ export interface RejectedRow {
125
143
  operation: 'add' | 'update' | 'remove';
126
144
  id: string;
127
145
  /**
128
- * `unknown-id` — no row with that key. `duplicate-id` — a row with that key
146
+ * `unknown-id`, no row with that key. `duplicate-id`, a row with that key
129
147
  * already exists; admitting a second would corrupt every structure that
130
148
  * resolves one key to one row.
131
149
  */
@@ -193,6 +211,7 @@ export interface NumberFormat {
193
211
  suffix?: string;
194
212
  zeroDisplay?: string;
195
213
  nullDisplay?: string;
214
+ /** The locale for number, date and text formatting. The page's by default. */
196
215
  locale?: string;
197
216
  /**
198
217
  * A partial message catalogue laid over the built-in British English one.
@@ -205,7 +224,7 @@ export interface NumberFormat {
205
224
  messages?: Record<string, string | Record<string, string>>;
206
225
  /**
207
226
  * Writing direction. Omit to settle it from the element's own `dir` and then
208
- * from `locale` — `ar`, `he`, `fa` and the rest resolve to `rtl`.
227
+ * from `locale`: `ar`, `he`, `fa` and the rest resolve to `rtl`.
209
228
  */
210
229
  direction?: 'ltr' | 'rtl';
211
230
  scale?: number;
@@ -488,7 +507,7 @@ export interface ColumnFilterSpec {
488
507
 
489
508
  export interface ColumnLayoutSpec {
490
509
  /**
491
- * A pixel width, or a percentage of the grid's inner width as a string —
510
+ * A pixel width, or a percentage of the grid's inner width as a string ,
492
511
  * `'25%'`.
493
512
  *
494
513
  * A percentage is a share of the *whole* grid. `flex` divides only the space
@@ -528,24 +547,48 @@ export interface Column {
528
547
  * Free-form labels for grouping columns together. A bare string is
529
548
  * accepted for a single tag.
530
549
  *
531
- * Used by the column tag bar to show and hide sets of columns — tag sixty
550
+ * Used by the column tag bar to show and hide sets of columns: tag sixty
532
551
  * monthly columns with their year, and a user can switch to one year.
533
552
  */
534
553
  tags?: string | string[];
554
+ /** The column's own identity. Defaults to `field`; needed explicitly when two
555
+ * columns read the same field, as a value and its running total do. */
535
556
  id?: string;
557
+ /** The property to read from each row. Dotted paths reach into nested data. */
536
558
  field?: string;
559
+ /** The heading. Defaults to a readable form of `field`. */
537
560
  title?: string;
561
+ /**
562
+ * The data type, which decides parsing, formatting, sorting, the default
563
+ * editor and the default filter together. `false` turns inference off and
564
+ * treats the values as opaque.
565
+ */
538
566
  type?: TypeName | false;
567
+ /** Named column presets to merge in first, so a house style is declared once. */
539
568
  preset?: string | string[];
569
+ /** How a value is rendered as text. A string is a shorthand mask. */
540
570
  format?: FormatSpec | string;
571
+ /** Display a stored code as a label, and edit it as a list. */
541
572
  lookup?: LookupSpec;
573
+ /** A computed value, with the columns it depends on, in place of a stored one. */
542
574
  value?: ColumnValueSpec;
575
+ /** The renderer, and what it is given. A string names a registered renderer. */
543
576
  cell?: ColumnCellSpec | string;
577
+ /** Whether and how the cell can be edited. A string names an editor. */
544
578
  edit?: ColumnEditSpec | boolean | string;
579
+ /** Whether the column sorts, and by what comparison. `false` refuses it. */
545
580
  sort?: ColumnSortSpec | boolean;
581
+ /** Whether the column filters, and with which filter. A string names one. */
546
582
  filter?: ColumnFilterSpec | boolean | FilterName;
583
+ /**
584
+ * Row grouping by this column. `index` fixes its place among several;
585
+ * `explode` gives a multi-value cell one group per value rather than one
586
+ * group for the combination.
587
+ */
547
588
  group?: { enabled?: boolean; index?: number; explode?: boolean } | boolean;
589
+ /** Use this column as a pivot dimension, and where it sits among several. */
548
590
  pivot?: { enabled?: boolean; index?: number } | boolean;
591
+ /** The reduction shown in the totals row and in group footers. */
549
592
  total?: TotalName | TotalFn;
550
593
  /**
551
594
  * A value the grid maintains about this column's own history, rather than a
@@ -567,10 +610,11 @@ export interface Column {
567
610
  * A running total down the grid **as it is currently ordered**.
568
611
  *
569
612
  * The one derived value that depends on the display order: sort differently
570
- * and every value changes. That is why it is not a shadow kind — every shadow
613
+ * and every value changes. That is why it is not a shadow kind: every shadow
571
614
  * reads the same however the rows are arranged.
572
615
  */
573
- running?: 'total' | 'percent' | { of?: string; kind?: 'total' | 'percent' };
616
+ running?: 'total' | 'percent' | 'delta'
617
+ | { of?: string; kind?: 'total' | 'percent' | 'delta' };
574
618
  /**
575
619
  * The customer's tolerance, for process capability and control charts.
576
620
  * Declared here rather than passed to each call so the capability figures,
@@ -578,12 +622,19 @@ export interface Column {
578
622
  * disagree about what the tolerance is.
579
623
  */
580
624
  spec?: { lower?: number; upper?: number; target?: number };
625
+ /** Width, pinning and flex. A bare number is the width in pixels. */
581
626
  layout?: ColumnLayoutSpec | number;
627
+ /** The header cell: its text, tooltip, menu and any header chart. */
582
628
  header?: ColumnHeaderSpec | string;
629
+ /** How the column leaves the grid, where that differs from how it is shown. */
583
630
  export?: ColumnExportSpec;
631
+ /** Whether the user may group by this column from the interface. */
584
632
  allowGroup?: boolean;
633
+ /** Whether the user may pivot on it. */
585
634
  allowPivot?: boolean;
635
+ /** Whether the user may put a total on it. */
586
636
  allowTotal?: boolean;
637
+ /** Whether an empty value is a legitimate value rather than a gap. */
587
638
  nullable?: boolean;
588
639
  }
589
640
 
@@ -749,7 +800,7 @@ export interface StreamSourceConfig {
749
800
  * overnight; this makes it a sliding window and the oldest rows are dropped.
750
801
  * Omit for no limit.
751
802
  *
752
- * Set on the source, not passed to `open` — it bounds what the grid retains
803
+ * Set on the source, not passed to `open`, it bounds what the grid retains
753
804
  * rather than what the producer sends.
754
805
  */
755
806
  maxRows?: number;
@@ -761,19 +812,19 @@ export interface StreamSourceConfig {
761
812
  export interface DerivedSelect {
762
813
  /** The column to reduce, as a field name or a dotted path. Omit for `count`. */
763
814
  of?: string;
764
- /** A key of `TOTAL_FNS` — `sum`, `avg`, `median`, `p95`, `distinct` and the rest. */
815
+ /** A key of `TOTAL_FNS`: `sum`, `avg`, `median`, `p95`, `distinct` and the rest. */
765
816
  fn?: TotalName;
766
817
  }
767
818
 
768
819
  /**
769
820
  * A grid whose rows are derived from another grid: aggregated, unnested,
770
- * filtered, ranked or profiled. Read-only — write to the source instead.
821
+ * filtered, ranked or profiled. Read-only: write to the source instead.
771
822
  */
772
823
  export interface DerivedSourceConfig {
773
824
  mode: 'derived';
774
825
  /**
775
826
  * A derived grid keys on `__key`, which the source writes onto every row it
776
- * produces — the group value, the profiled column, or the source row's own
827
+ * produces, the group value, the profiled column, or the source row's own
777
828
  * key when nothing is grouped. `config.rowKey` defaults to it, so it need not
778
829
  * be set; an explicit `rowKey` still wins.
779
830
  */
@@ -786,8 +837,8 @@ export interface DerivedSourceConfig {
786
837
  unnest?: string;
787
838
  /**
788
839
  * Match each row against a second grid on a shared key, and bring some of its
789
- * fields across. Runs after `unnest` and before `where`, so a condition — and
790
- * a grouping, and a total — can read a field the join produced.
840
+ * fields across. Runs after `unnest` and before `where`, so a condition: and
841
+ * a grouping, and a total: can read a field the join produced.
791
842
  */
792
843
  join?: DerivedJoin;
793
844
  /** A row predicate, applied before grouping. */
@@ -812,7 +863,7 @@ export interface DerivedSourceConfig {
812
863
  /** With `profile`, emit one row per statistic instead of one per column. */
813
864
  orient?: 'columns' | 'metrics';
814
865
 
815
- /** When to re-derive. `idle` by default — coalesced to a frame. */
866
+ /** When to re-derive. `idle` by default: coalesced to a frame. */
816
867
  refresh?: 'live' | 'idle' | 'manual' | number;
817
868
 
818
869
  /**
@@ -890,7 +941,7 @@ export interface DetailConfig {
890
941
  onCreate?: (grid: Grid, masterRow: Row) => void;
891
942
  /**
892
943
  * The property of the master's record the detail rows live on, so an edit in
893
- * the detail is reported as a path on the master — `ports.1.vlan`. Inferred
944
+ * the detail is reported as a path on the master: `ports.1.vlan`. Inferred
894
945
  * by identity when `rows(row)` returns an array already on the record, which
895
946
  * is the usual shape; set this when it does not.
896
947
  */
@@ -945,13 +996,25 @@ export interface PaginationConfig {
945
996
  }
946
997
 
947
998
  export interface GridConfig {
999
+ /** The columns, in order. A group nests columns under one heading. */
948
1000
  columns?: (Column | ColumnGroup)[];
1001
+ /** Header groups declared separately from the columns they contain. */
949
1002
  columnGroups?: ColumnGroup[];
1003
+ /** The data, for a memory grid. Use `source` for anything fetched. */
950
1004
  rows?: unknown[];
1005
+ /**
1006
+ * What identifies a row. Everything that survives a refresh (selection,
1007
+ * expansion, and edits in flight) is keyed on it, so it must be stable and
1008
+ * unique. A derived grid defaults to its own derived key.
1009
+ */
951
1010
  rowKey?: string | ((row: unknown) => string);
1011
+ /** Where rows come from: memory, paged, remote, stream or derived. */
952
1012
  source?: SourceConfig;
1013
+ /** Applied to every column before its own settings. */
953
1014
  columnDefaults?: Column;
1015
+ /** Named bundles of column settings, referenced by a column's `preset`. */
954
1016
  columnPresets?: Record<string, Column>;
1017
+ /** Your own data types, alongside the built-in catalogue. */
955
1018
  dataTypes?: Record<string, DataType>;
956
1019
  /** Values sampled per undeclared column when inferring its type. Default 100. */
957
1020
  sampleSize?: number;
@@ -961,14 +1024,23 @@ export interface GridConfig {
961
1024
  * coarse-pointer rule that would otherwise apply it.
962
1025
  */
963
1026
  targetSize?: 'default' | 'large';
1027
+ /** Your own renderers, editors and filters, registered by name. */
964
1028
  components?: Record<string, RendererCtor | EditorCtor | FilterCtor>;
1029
+ /** Named text transforms usable from a format mask or a template. */
965
1030
  pipes?: Record<string, (value: unknown, ...args: string[]) => string>;
1031
+ /** Your own reductions, alongside the built-in ones. */
966
1032
  totalFns?: Record<string, TotalFn>;
1033
+ /** Named appearance variants a row or cell can be switched into by a rule. */
967
1034
  variants?: Record<string, VariantDefinition>;
1035
+ /** Hierarchical rows: where the parent link or the path lives. */
968
1036
  tree?: TreeConfig;
1037
+ /** The expandable panel beneath a row. */
969
1038
  detail?: DetailConfig;
1039
+ /** What the user may select, and how selection behaves across groups. */
970
1040
  selection?: SelectionConfig | 'single' | 'multiple' | 'none';
1041
+ /** Editing, and how a change is committed and validated. */
971
1042
  edit?: EditConfig | boolean;
1043
+ /** Page the rows rather than scrolling them. */
972
1044
  pagination?: PaginationConfig | boolean;
973
1045
  locale?: string;
974
1046
  /**
@@ -976,7 +1048,9 @@ export interface GridConfig {
976
1048
  * Omit to use each viewer's own zone. A column's own `format.timeZone` wins.
977
1049
  */
978
1050
  timeZone?: string;
1051
+ /** The visual theme. */
979
1052
  theme?: Theme;
1053
+ /** Row height and padding as a named step, rather than pixel by pixel. */
980
1054
  density?: Density;
981
1055
 
982
1056
  /**
@@ -986,7 +1060,7 @@ export interface GridConfig {
986
1060
  * help the eye track along a row, vertical ones stop adjacent values running
987
1061
  * together. `false` or `'none'` draws neither.
988
1062
  *
989
- * Only the rules *between data* are affected — the header's underline, the
1063
+ * Only the rules *between data* are affected, the header's underline, the
990
1064
  * pinned seams and the totals separator are structure, not grid lines.
991
1065
  */
992
1066
  gridLines?: boolean | 'both' | 'horizontal' | 'vertical' | 'none' | 'rows' | 'columns';
@@ -1017,13 +1091,13 @@ export interface GridConfig {
1017
1091
  * `mode` is a right-hand `'drawer'` (the default) or a centred `'dialog'`.
1018
1092
  *
1019
1093
  * Without `load` the form shows the grid's own columns, edited with the same
1020
- * editors the cells use. With `load` it shows whatever that returns — the
1021
- * grid rarely displays everything a record has — and then `fields` is
1094
+ * editors the cells use. With `load` it shows whatever that returns: the
1095
+ * grid rarely displays everything a record has, and then `fields` is
1022
1096
  * required, because nothing here knows the shape of a record it has not seen.
1023
1097
  *
1024
1098
  * The panel opens immediately and fills in when the record arrives; a failure
1025
1099
  * offers a retry inside the panel. Save collects the changed fields, writes
1026
- * the ones that map to columns, and emits `form:saved` with the lot —
1100
+ * the ones that map to columns, and emits `form:saved` with the lot ,
1027
1101
  * persisting is yours.
1028
1102
  *
1029
1103
  * `trigger: false` leaves opening to `grid.form.open(key)`.
@@ -1033,7 +1107,7 @@ export interface GridConfig {
1033
1107
  *
1034
1108
  * A card list, a feed, a search-result list. The template is the same
1035
1109
  * declarative string a cell template is, and compiles once at configuration
1036
- * time — there is deliberately no per-row callback, because one would be used
1110
+ * time: there is deliberately no per-row callback, because one would be used
1037
1111
  * to allocate DOM per row and the virtualisation would stop paying for
1038
1112
  * itself. Bind with `{{data.field}}`.
1039
1113
  *
@@ -1073,7 +1147,7 @@ export interface GridConfig {
1073
1147
 
1074
1148
  /**
1075
1149
  * Present rows as cards when the grid's container is too narrow to be a
1076
- * table honestly — a phone, or a narrow panel on a wide screen.
1150
+ * table honestly, a phone, or a narrow panel on a wide screen.
1077
1151
  *
1078
1152
  * Measured on the container, not the viewport, so a grid in a sidebar
1079
1153
  * collapses and a grid filling a small tablet does not. Sorting, filtering
@@ -1085,7 +1159,7 @@ export interface GridConfig {
1085
1159
  maxWidth?: number;
1086
1160
  /** The card layout, as `rowTemplate` takes it. */
1087
1161
  template: string | object;
1088
- /** How tall a collapsed card is. 64 by default — a table row is too short. */
1162
+ /** How tall a collapsed card is. 64 by default, a table row is too short. */
1089
1163
  rowHeight?: number;
1090
1164
  };
1091
1165
 
@@ -1128,6 +1202,11 @@ export interface GridConfig {
1128
1202
  * reachable through the API, the keyboard and the tool panel.
1129
1203
  */
1130
1204
  showColumnFunctions?: boolean;
1205
+ /**
1206
+ * Row height in pixels, or a function of the row. A function makes the
1207
+ * grid measure rather than assume, which costs a pass over what is on
1208
+ * screen: worth it for wrapped text, wasteful for a uniform grid.
1209
+ */
1131
1210
  rowHeight?: number | ((row: Row) => number);
1132
1211
  /**
1133
1212
  * A caption for the grid, drawn above the column headings.
@@ -1141,7 +1220,7 @@ export interface GridConfig {
1141
1220
  * Draw the column headings at all.
1142
1221
  *
1143
1222
  * `true` by default. `false` removes the row, and removes it from the
1144
- * accessibility tree rather than only from view — a heading a screen reader
1223
+ * accessibility tree rather than only from view, a heading a screen reader
1145
1224
  * still announces is invisible, not hidden. What a small dashboard tile
1146
1225
  * wants when its `title` already says what the panel is.
1147
1226
  *
@@ -1149,12 +1228,15 @@ export interface GridConfig {
1149
1228
  * only the sort, filter and menu controls inside them.
1150
1229
  */
1151
1230
  showHeader?: boolean;
1231
+ /** Header height in pixels. */
1152
1232
  headerHeight?: number;
1233
+ /** How many rows to render beyond the viewport. More costs memory and
1234
+ * smooths fast scrolling; fewer is lighter and can show a gap. */
1153
1235
  overscan?: number;
1154
1236
  /**
1155
1237
  * Size rows to their content rather than to the density token.
1156
1238
  *
1157
- * Only rows that are actually rendered are ever measured, in both settings —
1239
+ * Only rows that are actually rendered are ever measured, in both settings ,
1158
1240
  * the grid does not lay out rows you cannot see. The difference is what
1159
1241
  * happens on a large grid: `true` gives up above ten thousand rows and falls
1160
1242
  * back to fixed heights, because a cumulative offset array being patched as
@@ -1166,11 +1248,19 @@ export interface GridConfig {
1166
1248
  * measured; it is about whether the ceiling applies.
1167
1249
  */
1168
1250
  autoHeight?: boolean | 'visible';
1251
+ /** Sort, filters, grouping, widths and the rest, restored at construction. */
1169
1252
  state?: GridState;
1253
+ /** Your licence key. Without one the grid renders in full and watermarks off localhost. */
1170
1254
  licence?: string;
1255
+ /** Offer a full-screen control. */
1171
1256
  maximise?: boolean;
1172
1257
  /** Extra functions a formula may call, on top of the built-in library. */
1173
1258
  formulaFunctions?: Record<string, (args: unknown[]) => unknown>;
1259
+ /**
1260
+ * Permit raw HTML from a template without sanitising it. Off, and worth
1261
+ * leaving off: a template usually interpolates data, and data is where
1262
+ * injected markup arrives from.
1263
+ */
1174
1264
  allowUnsafeTemplates?: boolean;
1175
1265
  /**
1176
1266
  * Caps on the change log behind `grid.updates` and `grid.timeline`.
@@ -1219,7 +1309,10 @@ export interface GridConfig {
1219
1309
  * no grid should pay without asking. Per-column settings layer over these.
1220
1310
  */
1221
1311
  facets?: FacetConfig | boolean;
1312
+ /** A filter your application owns, applied alongside the grid's own and
1313
+ * invisible to its filter UI. */
1222
1314
  hostFilter?: { active(): boolean; passes(row: Row): boolean };
1315
+ /** Anything of yours, passed untouched to renderers, editors and sources. */
1223
1316
  context?: unknown;
1224
1317
  /** Row count above which a column distribution is computed in a Worker. */
1225
1318
  workerThreshold?: number;
@@ -1228,8 +1321,11 @@ export interface GridConfig {
1228
1321
  * grouping run on the main thread; see the reference for why.
1229
1322
  */
1230
1323
  useWorker?: boolean;
1324
+ /** Where to load the worker kernel from, when hosting it yourself. */
1231
1325
  workerUrl?: string;
1326
+ /** Use a shared buffer for the worker, where the page's headers allow it. */
1232
1327
  sharedMemory?: boolean;
1328
+ /** A totals line at the foot of each group as well as the grid. */
1233
1329
  groupFooter?: boolean;
1234
1330
  /**
1235
1331
  * Where the grand total goes.
@@ -1256,7 +1352,7 @@ export interface GridConfig {
1256
1352
 
1257
1353
  /**
1258
1354
  * Rows drawn as a single band across every column instead of being divided
1259
- * into them — a section banner, a note, a "load more" affordance.
1355
+ * into them, a section banner, a note, a "load more" affordance.
1260
1356
  *
1261
1357
  * `when` picks the rows; `render` fills them. A full-width row is still one
1262
1358
  * of your data rows: counted by `rows.count()`, sorted, filtered and
@@ -1268,18 +1364,23 @@ export interface GridConfig {
1268
1364
  /**
1269
1365
  * Return a string for text, or a node for content. Return nothing and
1270
1366
  * write into `params.element` yourself. An HTML string is deliberately not
1271
- * accepted — see `allowUnsafeTemplates` for that decision elsewhere.
1367
+ * accepted: see `allowUnsafeTemplates` for that decision elsewhere.
1272
1368
  */
1273
1369
  render(params: FullWidthParams): string | Node | void;
1274
1370
  };
1371
+ /** Total what the filters left rather than the whole set. */
1275
1372
  totalFilteredOnly?: boolean;
1373
+ /** On a change, recompute only the totals whose column moved. */
1276
1374
  totalOnlyChangedColumns?: boolean;
1375
+ /** Put the total in the header rather than a footer row. */
1277
1376
  showTotalInHeader?: boolean;
1377
+ /** Render only the visible columns once there are more than this many. */
1278
1378
  columnVirtualisationAbove?: number;
1379
+ /** The bar beneath the grid, and which panels it carries. */
1279
1380
  statusBar?: boolean | { panels?: string[] };
1280
1381
  /**
1281
1382
  * The cell right-click menu. A function supplies custom items; `false`
1282
- * suppresses it entirely, which is what a read-only grid wants — the default
1383
+ * suppresses it entirely, which is what a read-only grid wants, the default
1283
1384
  * menu offers Paste, Clear and Fill down.
1284
1385
  */
1285
1386
  contextMenu?: boolean | ((p: CellMenuParams, defaults: MenuItem[]) => MenuItem[] | void);
@@ -1305,7 +1406,7 @@ export interface GridConfig {
1305
1406
  * persisting it is yours, and `rows.data()` afterwards is the new order.
1306
1407
  *
1307
1408
  * Refused, with a reason announced, while a sort, filter or grouping is
1308
- * active — the position a row is dropped at has no single meaning in the
1409
+ * active, the position a row is dropped at has no single meaning in the
1309
1410
  * underlying order then.
1310
1411
  */
1311
1412
  rowReorder?: boolean | { column?: string };
@@ -1318,7 +1419,7 @@ export interface GridConfig {
1318
1419
  * to undo.
1319
1420
  *
1320
1421
  * `send` and `receive` are both on when the option is present, so one-way is
1321
- * expressed by turning off the direction you do not want — a source grid is
1422
+ * expressed by turning off the direction you do not want, a source grid is
1322
1423
  * `{ receive: false }` and a target is `{ send: false }`.
1323
1424
  *
1324
1425
  * `mode: 'copy'` leaves the row where it was. `group` restricts exchange to
@@ -1340,7 +1441,7 @@ export interface GridConfig {
1340
1441
  *
1341
1442
  * Column widths, order, visibility and pinning are shared, and horizontal
1342
1443
  * scrolling moves them together. Sort, filters, selection, grouping and the
1343
- * rows themselves stay independent — sharing those would make one grid with
1444
+ * rows themselves stay independent: sharing those would make one grid with
1344
1445
  * extra steps rather than two aligned ones.
1345
1446
  *
1346
1447
  * Declared on the grid created last, since it is the only one that can name
@@ -1353,7 +1454,7 @@ export interface GridConfig {
1353
1454
  * scrolling inside a group.
1354
1455
  *
1355
1456
  * On by default, stacking at most two. `false` turns it off; a number, or
1356
- * `{ depth }`, sets how many may stack — each costs a row of viewport, so a
1457
+ * `{ depth }`, sets how many may stack: each costs a row of viewport, so a
1357
1458
  * deep grouping would otherwise spend the screen describing itself.
1358
1459
  */
1359
1460
  stickyGroupHeaders?: boolean | number | { depth?: number };
@@ -1402,10 +1503,11 @@ export interface GridConfig {
1402
1503
  /** File name for the export action, without the extension. */
1403
1504
  exportName?: string;
1404
1505
  };
1506
+ /** The quick filter's initial text. */
1405
1507
  quickFilterText?: string;
1406
1508
  /**
1407
1509
  * Per-column read/write/hidden policy. A usability control, not a
1408
- * security boundary — hidden data is still resident in the store. Enforce the
1510
+ * security boundary: hidden data is still resident in the store. Enforce the
1409
1511
  * same policy server-side with `permittedColumns` / `permittedExport`.
1410
1512
  */
1411
1513
  permissions?: PermissionPolicy;
@@ -1418,7 +1520,7 @@ export interface GridConfig {
1418
1520
  * Whether a row present in the snapshot but gone from the data is shown,
1419
1521
  * and whether it counts as data when it is.
1420
1522
  *
1421
- * `false` — the default — leaves it out entirely. `'pinned'` shows it
1523
+ * `false` (the default) leaves it out entirely. `'pinned'` shows it
1422
1524
  * beneath the rows, struck through: visible history that is not part of the
1423
1525
  * row set, so it is excluded from `rows.count()`, from exports and from
1424
1526
  * selection. `'data'` appends it to the row set instead, so it *is*
@@ -1426,7 +1528,7 @@ export interface GridConfig {
1426
1528
  *
1427
1529
  * Neither is sorted or filtered among the live rows: a removed row's values
1428
1530
  * are the snapshot's, and ordering yesterday's numbers among today's would
1429
- * present two data sets as one. Neither can be edited — there is nothing
1531
+ * present two data sets as one. Neither can be edited: there is nothing
1430
1532
  * left to write to.
1431
1533
  */
1432
1534
  removedRows?: false | 'pinned' | 'data';
@@ -1443,7 +1545,7 @@ export interface GridConfig {
1443
1545
  ask(p: {
1444
1546
  /** The full text to send: the schema description and the question together. */
1445
1547
  prompt: string;
1446
- /** The grid's schema as data — columns, types and operators. No row values. */
1548
+ /** The grid's schema as data: columns, types and operators. No row values. */
1447
1549
  schema: unknown;
1448
1550
  /** The same schema rendered as text, which is what `prompt` embeds. */
1449
1551
  schemaText: string;
@@ -1459,7 +1561,7 @@ export interface GridConfig {
1459
1561
  pivot?: {
1460
1562
  enabled?: boolean;
1461
1563
  /**
1462
- * Add a column group totalling every value column across all pivot values —
1564
+ * Add a column group totalling every value column across all pivot values ,
1463
1565
  * the grand total beside the pivoted ones. `'before'` places it at the near
1464
1566
  * edge, `'after'` at the far edge. Omitted or `false` adds none.
1465
1567
  */
@@ -1543,7 +1645,7 @@ export interface StateApplyReport {
1543
1645
  export interface FormattingCondition {
1544
1646
  /**
1545
1647
  * A filter operator compared against `value`, or a distribution operator
1546
- * whose threshold comes from the column itself — `{op: 'topPercent', value: 10}`,
1648
+ * whose threshold comes from the column itself: `{op: 'topPercent', value: 10}`,
1547
1649
  * `{op: 'outlier'}`. Distribution thresholds are pinned when the rules
1548
1650
  * compile; `grid.formatting.restat()` moves them.
1549
1651
  */
@@ -1572,7 +1674,7 @@ export interface FormattingScale {
1572
1674
  /**
1573
1675
  * One rule. Either a condition and the styling it produces, or a colour scale.
1574
1676
  * A rule held as runtime state must be JSON, so `style` may not be a function
1575
- * there — config-time `cell.style` still accepts one.
1677
+ * there: config-time `cell.style` still accepts one.
1576
1678
  */
1577
1679
  export interface FormattingRule {
1578
1680
  id?: string;
@@ -1589,12 +1691,42 @@ export interface FormattingRule {
1589
1691
  /** A column id, or `'*'` for every column. */
1590
1692
  export type FormattingScope = string;
1591
1693
 
1694
+ /** An interval for an estimated figure, at a stated level. */
1695
+ export interface ConfidenceInterval {
1696
+ mean: number;
1697
+ lower: number;
1698
+ upper: number;
1699
+ margin: number;
1700
+ n: number;
1701
+ /** The level the bounds were computed at, 0 to 1. */
1702
+ confidence: number;
1703
+ }
1704
+
1705
+ /** A Wilson score interval for a rate. Stays inside 0 to 1 at the extremes. */
1706
+ export interface ProportionInterval {
1707
+ proportion: number;
1708
+ lower: number;
1709
+ upper: number;
1710
+ n: number;
1711
+ confidence: number;
1712
+ }
1713
+
1714
+ /** An interval for a capability index, by Bissell's approximation. */
1715
+ export interface CapabilityInterval {
1716
+ index: number;
1717
+ lower: number;
1718
+ upper: number;
1719
+ margin: number;
1720
+ n: number;
1721
+ confidence: number;
1722
+ }
1723
+
1592
1724
  export interface StatisticsApi {
1593
1725
  /** One shadow value for one row, by the column it shadows and the kind. */
1594
1726
  shadow(colId: string, kind: ShadowKind, rowKey: string, scope?: 'all' | 'filtered'): unknown;
1595
1727
  /** A running total at one row, down the grid as it is currently ordered. */
1596
1728
  running(colId: string, kind: 'total' | 'percent', rowKey: string): number | null;
1597
- /** Make the current values the new baseline — "mark all". */
1729
+ /** Make the current values the new baseline: "mark all". */
1598
1730
  rebase(colId?: string): void;
1599
1731
  /** What the shadow histories are costing. */
1600
1732
  tracking(): { columns: string[]; rows: number; forgotten: number };
@@ -1604,7 +1736,7 @@ export interface StatisticsApi {
1604
1736
  profile(colId: string): ColumnProfile | null;
1605
1737
  /** Pearson's correlation between two columns. */
1606
1738
  correlation(a: string, b: string): number | null;
1607
- /** Covariance — a correlation before the scales are divided out. */
1739
+ /** Covariance, a correlation before the scales are divided out. */
1608
1740
  covariance(a: string, b: string, opts?: { population?: boolean }): number | null;
1609
1741
  /** Least-squares fit of `b` on `a`: in finance, beta and alpha. */
1610
1742
  regression(a: string, b: string): RegressionFit | null;
@@ -1622,9 +1754,26 @@ export interface StatisticsApi {
1622
1754
  */
1623
1755
  capability(colId: string, opts?: {
1624
1756
  lower?: number; upper?: number; target?: number; by?: string; baseline?: number;
1757
+ /** Which rule set the violations are judged against. Western Electric by default. */
1758
+ rules?: 'westernElectric' | 'nelson';
1759
+ /** The level for the capability interval. 0.95 by default. */
1760
+ confidence?: number;
1625
1761
  }): ProcessCapability | null;
1626
1762
  /**
1627
- * How a column varies along an ordering. `by` is required and never guessed —
1763
+ * A confidence interval for what a column measures, the range the estimate
1764
+ * pins the figure down to, not a verdict about it.
1765
+ *
1766
+ * Reads the rows the filters left, so an interval narrows as the grid does:
1767
+ * it describes the filtered population, not the whole table.
1768
+ */
1769
+ interval(colId: string, opts?: {
1770
+ kind?: 'mean' | 'proportion';
1771
+ confidence?: number;
1772
+ /** Which rows count as successes, for a proportion. Truthiness by default. */
1773
+ where?: (value: unknown, row: Row) => boolean;
1774
+ }): ConfidenceInterval | ProportionInterval | null;
1775
+ /**
1776
+ * How a column varies along an ordering. `by` is required and never guessed ,
1628
1777
  * kernels see rows in the order they arrived, which is not the grid's sort.
1629
1778
  */
1630
1779
  series(colId: string, opts: { by: string; periodsPerYear?: number }): SeriesStats | null;
@@ -1668,7 +1817,7 @@ export interface ProcessCapability {
1668
1817
  cp: number | null;
1669
1818
  /** Capability allowing for where the process is centred. */
1670
1819
  cpk: number | null;
1671
- /** Cp over the overall spread — what the process actually delivered. */
1820
+ /** Cp over the overall spread: what the process actually delivered. */
1672
1821
  pp: number | null;
1673
1822
  /** Cpk over the overall spread. Well below Cpk means the process drifted. */
1674
1823
  ppk: number | null;
@@ -1678,7 +1827,16 @@ export interface ProcessCapability {
1678
1827
  limits: { centre: number; upper: number; lower: number; sigma: number } | null;
1679
1828
  /** How many leading readings set the limits. */
1680
1829
  baseline?: number;
1830
+ /** Which rule set `violations` were judged against, they number differently. */
1831
+ ruleSet?: 'westernElectric' | 'nelson';
1681
1832
  violations: { index: number; rule: number; description: string }[];
1833
+ /**
1834
+ * A confidence interval for `cpk`. A study that reports the point estimate
1835
+ * alone overstates itself: 1.35 from thirty parts has a lower bound below 1.
1836
+ */
1837
+ interval?: CapabilityInterval | null;
1838
+ /** The same, for `ppk`. */
1839
+ intervalPp?: CapabilityInterval | null;
1682
1840
  }
1683
1841
 
1684
1842
  export interface SeriesStats {
@@ -1771,7 +1929,7 @@ export interface ColumnDistribution {
1771
1929
  /**
1772
1930
  * Every event the grid emits.
1773
1931
  *
1774
- * Complete, and checked against the runtime by `tools/check.js` — an `emit()`
1932
+ * Complete, and checked against the runtime by `tools/check.js`, an `emit()`
1775
1933
  * call with no entry here fails the build. It was not complete before: fifty-one
1776
1934
  * events were emitted and undeclared, so subscribing to any of them from
1777
1935
  * TypeScript was a compile error on an event the grid genuinely raises.
@@ -1921,7 +2079,7 @@ export interface RowsApi {
1921
2079
  /** Every row in the data, before any filter. Leaf rows, in physical order. */
1922
2080
  forEachAll(fn: (row: Row, index: number) => void): void;
1923
2081
  /**
1924
- * Visit the rows surviving every filter except one column's own — the
2082
+ * Visit the rows surviving every filter except one column's own: the
1925
2083
  * faceting question, asked of the rows.
1926
2084
  */
1927
2085
  forEachExcept(colId: string, fn: (row: Row, index: number) => void): void;
@@ -2003,7 +2161,7 @@ export interface SelectionApi {
2003
2161
  /** Drop every range, leaving the row and cell selection alone. */
2004
2162
  clearRange(): void;
2005
2163
  /**
2006
- * Everything worth knowing about the selected cells — what `summary()`
2164
+ * Everything worth knowing about the selected cells: what `summary()`
2007
2165
  * reports plus median, quartiles, deviation, distinct and outliers. Over the
2008
2166
  * cells rather than a column, so a rectangle spanning three columns is one
2009
2167
  * set of numbers. Null with nothing selected.
@@ -2100,7 +2258,7 @@ export interface ViewStorage {
2100
2258
  /** Load the user's views. Called at construction and by `views.reload()`. */
2101
2259
  read(): SavedView[];
2102
2260
  /**
2103
- * Mirror the views somewhere synchronous — `localStorage`, an in-memory
2261
+ * Mirror the views somewhere synchronous: `localStorage`, an in-memory
2104
2262
  * cache. For a server, listen for `view:saved` / `view:removed` and do the
2105
2263
  * write yourself: the grid does not make network calls and does not want to
2106
2264
  * know whether yours succeeded.
@@ -2131,7 +2289,7 @@ export interface RowStyleParams {
2131
2289
  */
2132
2290
  /**
2133
2291
  * Rendering the grid to a still image. `scale` multiplies the pixel dimensions
2134
- * — 2 for a retina still, 3 or 4 for a slide. `background` fills behind the
2292
+ *: 2 for a retina still, 3 or 4 for a slide. `background` fills behind the
2135
2293
  * grid so a PNG dropped into a deck does not show it through.
2136
2294
  */
2137
2295
  export interface CaptureOptions {
@@ -2142,7 +2300,7 @@ export interface CaptureOptions {
2142
2300
  }
2143
2301
 
2144
2302
  /**
2145
- * The presenter's drawing layer. Pixels over the grid — it never reads or
2303
+ * The presenter's drawing layer. Pixels over the grid, it never reads or
2146
2304
  * writes data, and it is inert until a tool is chosen, so scrolling and
2147
2305
  * selection pass straight through. Marks are held in content coordinates, so
2148
2306
  * they stay with the cells they annotate when the grid scrolls, and are
@@ -2159,7 +2317,7 @@ export interface AnnotationApi {
2159
2317
 
2160
2318
  /**
2161
2319
  * Holding incoming updates, and the counters describing what they cost.
2162
- * Pausing is explicit — a button, not a guess at whether the user is busy.
2320
+ * Pausing is explicit, a button, not a guess at whether the user is busy.
2163
2321
  */
2164
2322
  /** One thing the grid has flagged as probably a mistake. */
2165
2323
  export interface DiagnosticWarning {
@@ -2297,7 +2455,7 @@ export interface Comment {
2297
2455
  can?: { edit?: boolean; delete?: boolean; resolve?: boolean };
2298
2456
  }
2299
2457
 
2300
- /** Counts for one cell. Never bodies — this is consulted on every repaint. */
2458
+ /** Counts for one cell. Never bodies: this is consulted on every repaint. */
2301
2459
  export interface CommentDescriptor {
2302
2460
  count: number;
2303
2461
  unresolved: number;
@@ -2494,7 +2652,7 @@ export interface UpdatesApi {
2494
2652
  * Moving the grid through recent data changes. Reads the change log rather
2495
2653
  * than the undo history: history records what the *user* did, and the question
2496
2654
  * on a live grid is what the *data* did. Nothing is scrubbable until
2497
- * `attach()` — what a value used to be is not recoverable after the fact.
2655
+ * `attach()`: what a value used to be is not recoverable after the fact.
2498
2656
  */
2499
2657
  export interface TimelineApi {
2500
2658
  readonly attached: boolean;
@@ -2672,7 +2830,7 @@ export interface AiApi {
2672
2830
  /** The same schema as a tool definition. */
2673
2831
  tool(opts?: { maxColumns?: number; maxRows?: number }): Record<string, unknown>;
2674
2832
  /**
2675
- * The prompt describing this grid — its columns, types and operators — for
2833
+ * The prompt describing this grid (its columns, types and operators) for
2676
2834
  * sending to a model. It carries no row values.
2677
2835
  *
2678
2836
  * It does not take the user's question: compose that yourself alongside the
@@ -2797,50 +2955,84 @@ export interface MaximiseApi {
2797
2955
  }
2798
2956
 
2799
2957
  export interface Grid {
2958
+ /** The data: reading it, changing it, walking it. */
2800
2959
  readonly rows: RowsApi;
2960
+ /** The columns: order, width, visibility, grouping and pivoting. */
2801
2961
  readonly columns: ColumnsApi;
2962
+ /** What is selected, and the range the user has marked. */
2802
2963
  readonly selection: SelectionApi;
2964
+ /** The filter tree, however it was set. */
2803
2965
  readonly filters: FiltersApi;
2966
+ /** The sort, in priority order. */
2804
2967
  readonly sort: SortApi;
2968
+ /** Editing sessions: starting, committing and cancelling them. */
2805
2969
  readonly edit: EditApi;
2970
+ /** Where the viewport is, and moving it. */
2806
2971
  readonly scroll: ScrollApi;
2972
+ /** CSV, Excel and clipboard. */
2807
2973
  readonly export: ExportApi;
2974
+ /** Everything the user arranged, as a serialisable object. */
2808
2975
  readonly state: StateApi;
2976
+ /** The loading, empty and error surfaces drawn over the grid. */
2809
2977
  readonly overlay: OverlayApi;
2978
+ /** Undo and redo over edits and structural changes. */
2810
2979
  readonly history: HistoryApi;
2980
+ /** Saved arrangements the user can switch between. */
2811
2981
  readonly views: ViewsApi;
2982
+ /** What changed against a baseline, cell by cell. */
2812
2983
  readonly diff: DiffApi;
2984
+ /** Who may see, edit and export what. */
2813
2985
  readonly permissions: PermissionsApi;
2986
+ /** A machine-readable description of the grid, for a model to read. */
2814
2987
  readonly ai: AiApi;
2988
+ /** Translation: the catalogue and the active locale. */
2815
2989
  readonly messages: MessagesApi;
2990
+ /** Licence state, and setting a key after construction. */
2816
2991
  readonly licence: LicenceApi;
2992
+ /** Pages, where the grid is paged rather than scrolled. */
2817
2993
  readonly pagination: PaginationApi;
2994
+ /** Transient emphasis on a row, column or cell. */
2818
2995
  readonly highlight: HighlightApi;
2996
+ /** Values hidden from view and from export. */
2819
2997
  readonly redaction: RedactionApi;
2998
+ /** An image of the grid as drawn, where the module is installed. */
2820
2999
  capture?(opts?: CaptureOptions): Promise<Blob>;
3000
+ /** Drawing over the grid, where the module is installed. */
2821
3001
  annotate?: AnnotationApi;
3002
+ /** Full screen, scaling and chrome suppression. */
2822
3003
  readonly presentation: PresentationApi;
3004
+ /** The live feed: pausing it, flushing it, and what it has done. */
2823
3005
  readonly updates: UpdatesApi;
3006
+ /** Replaying the changes the grid has seen. */
2824
3007
  readonly timeline: TimelineApi;
2825
- /** Cross-filtering — a derived grid filtering the grid it derives from. */
3008
+ /** Cross-filtering, a derived grid filtering the grid it derives from. */
2826
3009
  readonly crossFilter: CrossFilter;
3010
+ /** Header distributions, and the filters clicking one creates. */
2827
3011
  readonly facets: FacetsApi;
3012
+ /** The expandable panel beneath a row. */
2828
3013
  readonly detail: DetailApi;
3014
+ /** Threads attached to rows and cells. */
2829
3015
  readonly comments: CommentsApi;
3016
+ /** Who else is looking, and where. */
2830
3017
  readonly presence: PresenceApi;
3018
+ /** What the grid is doing, for when it is doing it slowly. */
2831
3019
  readonly diagnostics: DiagnosticsApi;
3020
+ /** Reductions, profiles, correlations, capability and intervals. */
2832
3021
  readonly statistics: StatisticsApi;
3022
+ /** Formatting a value as the grid would, outside a cell. */
2833
3023
  readonly formatting: FormattingApi;
3024
+ /** Full-screen control, where it is enabled. */
2834
3025
  readonly maximise?: MaximiseApi;
2835
3026
  /**
2836
3027
  * The element you passed to `createGrid`, not the grid's own root.
2837
3028
  *
2838
3029
  * The grid builds its `.lattice` root *inside* that element, so
2839
3030
  * `el.closest('.lattice')` never matches this, and a theme attribute set on
2840
- * it has no effect — the theme is read from the root within. Use
3031
+ * it has no effect, the theme is read from the root within. Use
2841
3032
  * `element.querySelector('.lattice')` for the grid's own root.
2842
3033
  */
2843
3034
  readonly element: HTMLElement | null;
3035
+ /** Whether `destroy` has run. Every other member is inert afterwards. */
2844
3036
  readonly destroyed: boolean;
2845
3037
  /** False until the first render has been laid out. */
2846
3038
  readonly ready: boolean;
@@ -2849,11 +3041,16 @@ export interface Grid {
2849
3041
  config(): GridConfig;
2850
3042
  get<K extends keyof GridConfig>(key: K): GridConfig[K];
2851
3043
  set<K extends keyof GridConfig>(key: K, value: GridConfig[K]): void;
3044
+ /** Apply several configuration changes as one update rather than several. */
2852
3045
  setAll(values: Partial<GridConfig>): void;
2853
3046
 
3047
+ /** Listen. Returns the function that stops listening. */
2854
3048
  on(event: EventName, handler: EventHandler): Unsubscribe;
3049
+ /** Listen until it fires once. */
2855
3050
  once(event: EventName, handler: EventHandler): Unsubscribe;
3051
+ /** Stop listening. */
2856
3052
  off(event: EventName, handler: EventHandler): void;
3053
+ /** Raise an event of your own on the grid's bus. */
2857
3054
  emit(event: string, payload?: Record<string, unknown>): void;
2858
3055
 
2859
3056
  /**
@@ -2862,7 +3059,7 @@ export interface Grid {
2862
3059
  * The rows render through the ordinary column pipeline but are not part of
2863
3060
  * the data: not counted, sorted, filtered, grouped, selectable or exported.
2864
3061
  *
2865
- * Pass a new array rather than mutating the one you passed before — array
3062
+ * Pass a new array rather than mutating the one you passed before: array
2866
3063
  * identity is how the grid knows the pinned rows have changed.
2867
3064
  */
2868
3065
  setPinnedRows(rows: unknown[], opts?: { edge?: 'top' | 'bottom' }): void;
@@ -2873,7 +3070,9 @@ export interface Grid {
2873
3070
  /** The row form. Declines when `rowForm` is not configured. */
2874
3071
  readonly form: RowFormApi;
2875
3072
 
3073
+ /** The library version. */
2876
3074
  getVersion(): string;
3075
+ /** Release everything: listeners, timers, workers and the DOM the grid made. */
2877
3076
  destroy(): void;
2878
3077
  }
2879
3078
 
@@ -2923,12 +3122,12 @@ export const UNIT_SYSTEMS: Record<string, readonly UnitDescriptor[]>;
2923
3122
  export interface StatValueSpec {
2924
3123
  /** The column to reduce, as a field name or a dotted path. Omit for `count`. */
2925
3124
  of?: string;
2926
- /** A key of `TOTAL_FNS` — `sum`, `avg`, `median`, `p95`, `gini` and the rest. */
3125
+ /** A key of `TOTAL_FNS`: `sum`, `avg`, `median`, `p95`, `gini` and the rest. */
2927
3126
  fn?: TotalName;
2928
3127
  /**
2929
3128
  * Report this column from the row holding the extreme, rather than the
2930
3129
  * extreme itself: `{ of: 'sales', fn: 'max', show: 'rep' }` is the *name* of
2931
- * the best rep. Needs `min` or `max` — no single row holds an average.
3130
+ * the best rep. Needs `min` or `max`, no single row holds an average.
2932
3131
  */
2933
3132
  show?: string;
2934
3133
  }
@@ -2952,13 +3151,26 @@ export interface StatConfig extends StatValueSpec {
2952
3151
  baseline?: number | ((grid: Grid) => number);
2953
3152
  /** Whether a rise is good news. `up` by default. */
2954
3153
  goodWhen?: 'up' | 'down' | 'neither';
3154
+ /**
3155
+ * Thresholds the value itself is judged against, setting `data-tone` on the
3156
+ * tile. Separate from `goodWhen`, which judges the *change*: a Cpk of 0.9 is
3157
+ * bad news whether it rose or fell to get there.
3158
+ */
3159
+ bands?: { good?: number; warn?: number; direction?: 'up' | 'down' }
3160
+ | ((value: unknown, grid: Grid) => 'good' | 'warn' | 'bad' | null);
3161
+ /**
3162
+ * An interval to show under the value: how much to trust it. Return
3163
+ * whichever of the grid's intervals belongs to this tile.
3164
+ */
3165
+ interval?: (value: unknown, grid: Grid) =>
3166
+ { lower: number; upper: number; confidence?: number } | null;
2955
3167
  /** Which rows feed the value. `filtered` by default. */
2956
3168
  scope?: 'filtered' | 'all' | 'selected';
2957
3169
  /** `false` stops the tile following the grid; `refresh()` still works. */
2958
3170
  live?: boolean;
2959
3171
  /** Override the formatting the column's type would apply. */
2960
3172
  format?: (value: unknown, grid: Grid) => string;
2961
- /** Shown when there is no value. `—` by default. */
3173
+ /** Shown when there is no value. `, ` by default. */
2962
3174
  empty?: string;
2963
3175
  /** Fraction digits for a value whose reduction changed the unit. 2 by default. */
2964
3176
  decimals?: number;
@@ -2998,7 +3210,7 @@ export const licenseState: typeof licenceState;
2998
3210
  /**
2999
3211
  * Compile a formatting rule list into a style function.
3000
3212
  *
3001
- * `stats` supplies the column summary the distribution operators need — the
3213
+ * `stats` supplies the column summary the distribution operators need: the
3002
3214
  * top decile, the outliers, two deviations from the mean. Without it those
3003
3215
  * rules cannot be answered and are skipped.
3004
3216
  */
@@ -3010,8 +3222,8 @@ export function compileRules(
3010
3222
  /**
3011
3223
  * Browser-storage backing for saved views.
3012
3224
  *
3013
- * Returns null where no usable storage exists — a private window, or a browser
3014
- * with site data blocked — so a caller can fall back rather than throw.
3225
+ * Returns null where no usable storage exists, a private window, or a browser
3226
+ * with site data blocked, so a caller can fall back rather than throw.
3015
3227
  */
3016
3228
  export function createLocalViewStorage(opts?: {
3017
3229
  key?: string;
@@ -3134,7 +3346,7 @@ export function resolveCatalogue(tag?: string): Record<string, unknown> | null;
3134
3346
  * Declarations for everything under `lattice-grid/modules/`.
3135
3347
  *
3136
3348
  * The package exports these subpaths at runtime but declared none of them, so a
3137
- * TypeScript caller importing the React adapter — or any other module — got an
3349
+ * TypeScript caller importing the React adapter (or any other module) got an
3138
3350
  * implicit `any` and, under `strict`, an error. The grid advertises complete
3139
3351
  * declarations; these are the rest of them.
3140
3352
  *
@@ -3150,6 +3362,7 @@ export type ChartType =
3150
3362
  | 'scatter' | 'bubble'
3151
3363
  | 'combo' | 'pareto'
3152
3364
  | 'histogram' | 'boxplot' | 'heatmap'
3365
+ | 'qq' | 'ecdf' | 'lorenz' | 'correlogram' | 'control' | 'capability' | 'movingRange'
3153
3366
  | 'pie' | 'donut' | 'sunburst' | 'treemap'
3154
3367
  | 'radar' | 'gauge' | 'funnel' | 'candlestick' | 'geomap'
3155
3368
  | 'sankey' | 'chord' | 'network' | 'stream' | 'marimekko' | 'violin' | 'gantt';
@@ -3210,6 +3423,21 @@ export interface ChartSpec {
3210
3423
  font?: object;
3211
3424
  margin?: number | { top?: number; right?: number; bottom?: number; left?: number };
3212
3425
  /** Horizontal reference lines. */
3426
+ /**
3427
+ * A least-squares line through a scatter or bubble chart, one per series.
3428
+ * `true` draws the line and its R²; `'line'` draws the line alone.
3429
+ *
3430
+ * Only where the x axis is numeric: on a band scale the positions are
3431
+ * categories in an arbitrary order, and a slope through them would be a slope
3432
+ * through the order they happened to be listed in.
3433
+ */
3434
+ fit?: boolean | 'line';
3435
+ /**
3436
+ * Whiskers showing the uncertainty in each mark. `true` computes a confidence
3437
+ * interval from the readings behind the mark; `of` takes a symmetric margin
3438
+ * from another column instead.
3439
+ */
3440
+ error?: boolean | { of?: string; confidence?: number };
3213
3441
  reference?: { value: number; label?: string }[];
3214
3442
  /** Bins for a histogram; the default is twelve. */
3215
3443
  buckets?: number;
@@ -3224,13 +3452,57 @@ export interface ChartSpec {
3224
3452
  canvas?: boolean | number;
3225
3453
  downsample?: number;
3226
3454
  emptyText?: string;
3455
+
3456
+ /** A second line under the title. */
3457
+ subtitle?: string;
3458
+ /** A note under the plot, a source, a caveat, a unit. */
3459
+ footnote?: string;
3460
+ /** `false` turns the hover tooltip off. */
3461
+ tooltip?: boolean;
3462
+ /** Draw the grid's selected rows emphasised, and follow the selection. */
3463
+ selection?: boolean;
3464
+ /** Clicking a group drills into it. */
3465
+ drill?: boolean;
3466
+ /** Clicking a mark filters the grid to it. */
3467
+ filterOnClick?: boolean;
3468
+ /** Stack the series rather than drawing them side by side. */
3469
+ stack?: boolean;
3470
+ /** Overlay a kernel density curve on a histogram. */
3471
+ curve?: boolean;
3472
+ /** An alias for `y`, where "the measure" reads better than "the y axis". */
3473
+ measure?: string;
3474
+ /** Bubble charts: the column driving the radius, and the largest it may be. */
3475
+ size?: string;
3476
+ maxRadius?: number;
3477
+ /** Fix the measure axis rather than taking it from the data. */
3478
+ min?: number;
3479
+ max?: number;
3480
+ /** A geomap's ISO code column. An alias for `x`. */
3481
+ code?: string;
3482
+ /** Correlogram: which columns to correlate, how, and whether to print them. */
3483
+ columns?: string[];
3484
+ method?: 'pearson' | 'spearman' | 'kendall';
3485
+ values?: boolean;
3486
+ /** Network layouts: how many relaxation passes to run. */
3487
+ iterations?: number;
3488
+
3489
+ /**
3490
+ * Control and capability charts: a tolerance overriding the column's own
3491
+ * `spec`, how many leading readings fix the control limits, which rule set
3492
+ * the violations are judged against, and the level for the capability
3493
+ * interval.
3494
+ */
3495
+ spec?: { lower?: number; upper?: number; target?: number };
3496
+ baseline?: number;
3497
+ rules?: 'westernElectric' | 'nelson';
3498
+ confidence?: number;
3227
3499
  }
3228
3500
 
3229
3501
  /**
3230
3502
  * The events a chart raises.
3231
3503
  *
3232
3504
  * A chart's own, not the grid's: `grid.on` takes {@link EventName} and knows
3233
- * nothing about these. `point:click` is the one most callers want — it is how a
3505
+ * nothing about these. `point:click` is the one most callers want, it is how a
3234
3506
  * click on a mark becomes a filter on the grid.
3235
3507
  */
3236
3508
  export type ChartEventName =
@@ -3275,7 +3547,7 @@ declare module 'lattice-grid/modules/react' {
3275
3547
  * Build the React component.
3276
3548
  *
3277
3549
  * A factory rather than a component, because the adapter imports neither
3278
- * React nor the grid — you pass both in. That is what keeps the package's
3550
+ * React nor the grid: you pass both in. That is what keeps the package's
3279
3551
  * promise of no runtime dependencies, and what stops an adapter disagreeing
3280
3552
  * with the grid version already loaded.
3281
3553
  */
@@ -3322,7 +3594,7 @@ declare module 'lattice-grid/modules/webcomponent' {
3322
3594
 
3323
3595
  declare module 'lattice-grid/modules/htmx' {
3324
3596
  /**
3325
- * The htmx integration, which re-exports the base API alongside its own —
3597
+ * The htmx integration, which re-exports the base API alongside its own ,
3326
3598
  * a page using it imports this and never the base package as well.
3327
3599
  */
3328
3600
  export function createGrid(element: Element, config: GridConfig): Grid;