@toclocoinc/lattice-grid 1.10.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.10.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
  */
@@ -784,6 +835,12 @@ export interface DerivedSourceConfig {
784
835
 
785
836
  /** An array property to expand, one row per element, before anything else. */
786
837
  unnest?: string;
838
+ /**
839
+ * Match each row against a second grid on a shared key, and bring some of its
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.
842
+ */
843
+ join?: DerivedJoin;
787
844
  /** A row predicate, applied before grouping. */
788
845
  where?: (row: unknown) => boolean;
789
846
  /** Round a date column down to a period, and group on that. */
@@ -806,8 +863,44 @@ export interface DerivedSourceConfig {
806
863
  /** With `profile`, emit one row per statistic instead of one per column. */
807
864
  orient?: 'columns' | 'metrics';
808
865
 
809
- /** When to re-derive. `idle` by default — coalesced to a frame. */
866
+ /** When to re-derive. `idle` by default: coalesced to a frame. */
810
867
  refresh?: 'live' | 'idle' | 'manual' | number;
868
+
869
+ /**
870
+ * Let this grid filter the grid it derives from. `true` cross-filters through
871
+ * whatever it groups by; a string names a different source column.
872
+ */
873
+ crossFilter?: boolean | string | { col?: string };
874
+ }
875
+
876
+ export interface DerivedJoin {
877
+ /** The grid holding the other side. */
878
+ with: Grid;
879
+ /** The shared key: one field name when both sides use it, or one each. */
880
+ on: string | { left?: string; right?: string };
881
+ /** `inner` keeps only rows that matched; `left` keeps them all. */
882
+ type?: 'inner' | 'left';
883
+ /** Which of the partner's fields to bring across. All of them by default. */
884
+ select?: string[];
885
+ /** Rename the brought-across fields, when both sides have one worth keeping. */
886
+ prefix?: string;
887
+ /** Which of the partner's rows to read. `all` by default. */
888
+ follow?: 'all' | 'filtered';
889
+ }
890
+
891
+ export interface CrossFilter {
892
+ /** Whether this grid can cross-filter a source. */
893
+ enabled(): boolean;
894
+ /** The source column the filter is pushed onto. */
895
+ column(): string | null;
896
+ /** The keys currently filtering the source. */
897
+ get(): string[];
898
+ /** Filter the source to these derived rows. */
899
+ set(keys: string | string[] | null): void;
900
+ /** Add or remove one key, for click-to-filter. */
901
+ toggle(key: string): void;
902
+ /** Take this grid's filter off its source. */
903
+ clear(): void;
811
904
  }
812
905
 
813
906
  export type SourceConfig =
@@ -848,7 +941,7 @@ export interface DetailConfig {
848
941
  onCreate?: (grid: Grid, masterRow: Row) => void;
849
942
  /**
850
943
  * The property of the master's record the detail rows live on, so an edit in
851
- * 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
852
945
  * by identity when `rows(row)` returns an array already on the record, which
853
946
  * is the usual shape; set this when it does not.
854
947
  */
@@ -903,13 +996,25 @@ export interface PaginationConfig {
903
996
  }
904
997
 
905
998
  export interface GridConfig {
999
+ /** The columns, in order. A group nests columns under one heading. */
906
1000
  columns?: (Column | ColumnGroup)[];
1001
+ /** Header groups declared separately from the columns they contain. */
907
1002
  columnGroups?: ColumnGroup[];
1003
+ /** The data, for a memory grid. Use `source` for anything fetched. */
908
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
+ */
909
1010
  rowKey?: string | ((row: unknown) => string);
1011
+ /** Where rows come from: memory, paged, remote, stream or derived. */
910
1012
  source?: SourceConfig;
1013
+ /** Applied to every column before its own settings. */
911
1014
  columnDefaults?: Column;
1015
+ /** Named bundles of column settings, referenced by a column's `preset`. */
912
1016
  columnPresets?: Record<string, Column>;
1017
+ /** Your own data types, alongside the built-in catalogue. */
913
1018
  dataTypes?: Record<string, DataType>;
914
1019
  /** Values sampled per undeclared column when inferring its type. Default 100. */
915
1020
  sampleSize?: number;
@@ -919,14 +1024,23 @@ export interface GridConfig {
919
1024
  * coarse-pointer rule that would otherwise apply it.
920
1025
  */
921
1026
  targetSize?: 'default' | 'large';
1027
+ /** Your own renderers, editors and filters, registered by name. */
922
1028
  components?: Record<string, RendererCtor | EditorCtor | FilterCtor>;
1029
+ /** Named text transforms usable from a format mask or a template. */
923
1030
  pipes?: Record<string, (value: unknown, ...args: string[]) => string>;
1031
+ /** Your own reductions, alongside the built-in ones. */
924
1032
  totalFns?: Record<string, TotalFn>;
1033
+ /** Named appearance variants a row or cell can be switched into by a rule. */
925
1034
  variants?: Record<string, VariantDefinition>;
1035
+ /** Hierarchical rows: where the parent link or the path lives. */
926
1036
  tree?: TreeConfig;
1037
+ /** The expandable panel beneath a row. */
927
1038
  detail?: DetailConfig;
1039
+ /** What the user may select, and how selection behaves across groups. */
928
1040
  selection?: SelectionConfig | 'single' | 'multiple' | 'none';
1041
+ /** Editing, and how a change is committed and validated. */
929
1042
  edit?: EditConfig | boolean;
1043
+ /** Page the rows rather than scrolling them. */
930
1044
  pagination?: PaginationConfig | boolean;
931
1045
  locale?: string;
932
1046
  /**
@@ -934,7 +1048,9 @@ export interface GridConfig {
934
1048
  * Omit to use each viewer's own zone. A column's own `format.timeZone` wins.
935
1049
  */
936
1050
  timeZone?: string;
1051
+ /** The visual theme. */
937
1052
  theme?: Theme;
1053
+ /** Row height and padding as a named step, rather than pixel by pixel. */
938
1054
  density?: Density;
939
1055
 
940
1056
  /**
@@ -944,7 +1060,7 @@ export interface GridConfig {
944
1060
  * help the eye track along a row, vertical ones stop adjacent values running
945
1061
  * together. `false` or `'none'` draws neither.
946
1062
  *
947
- * 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
948
1064
  * pinned seams and the totals separator are structure, not grid lines.
949
1065
  */
950
1066
  gridLines?: boolean | 'both' | 'horizontal' | 'vertical' | 'none' | 'rows' | 'columns';
@@ -975,13 +1091,13 @@ export interface GridConfig {
975
1091
  * `mode` is a right-hand `'drawer'` (the default) or a centred `'dialog'`.
976
1092
  *
977
1093
  * Without `load` the form shows the grid's own columns, edited with the same
978
- * editors the cells use. With `load` it shows whatever that returns — the
979
- * 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
980
1096
  * required, because nothing here knows the shape of a record it has not seen.
981
1097
  *
982
1098
  * The panel opens immediately and fills in when the record arrives; a failure
983
1099
  * offers a retry inside the panel. Save collects the changed fields, writes
984
- * 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 ,
985
1101
  * persisting is yours.
986
1102
  *
987
1103
  * `trigger: false` leaves opening to `grid.form.open(key)`.
@@ -991,7 +1107,7 @@ export interface GridConfig {
991
1107
  *
992
1108
  * A card list, a feed, a search-result list. The template is the same
993
1109
  * declarative string a cell template is, and compiles once at configuration
994
- * 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
995
1111
  * to allocate DOM per row and the virtualisation would stop paying for
996
1112
  * itself. Bind with `{{data.field}}`.
997
1113
  *
@@ -1031,7 +1147,7 @@ export interface GridConfig {
1031
1147
 
1032
1148
  /**
1033
1149
  * Present rows as cards when the grid's container is too narrow to be a
1034
- * 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.
1035
1151
  *
1036
1152
  * Measured on the container, not the viewport, so a grid in a sidebar
1037
1153
  * collapses and a grid filling a small tablet does not. Sorting, filtering
@@ -1043,7 +1159,7 @@ export interface GridConfig {
1043
1159
  maxWidth?: number;
1044
1160
  /** The card layout, as `rowTemplate` takes it. */
1045
1161
  template: string | object;
1046
- /** 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. */
1047
1163
  rowHeight?: number;
1048
1164
  };
1049
1165
 
@@ -1086,6 +1202,11 @@ export interface GridConfig {
1086
1202
  * reachable through the API, the keyboard and the tool panel.
1087
1203
  */
1088
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
+ */
1089
1210
  rowHeight?: number | ((row: Row) => number);
1090
1211
  /**
1091
1212
  * A caption for the grid, drawn above the column headings.
@@ -1099,7 +1220,7 @@ export interface GridConfig {
1099
1220
  * Draw the column headings at all.
1100
1221
  *
1101
1222
  * `true` by default. `false` removes the row, and removes it from the
1102
- * 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
1103
1224
  * still announces is invisible, not hidden. What a small dashboard tile
1104
1225
  * wants when its `title` already says what the panel is.
1105
1226
  *
@@ -1107,12 +1228,15 @@ export interface GridConfig {
1107
1228
  * only the sort, filter and menu controls inside them.
1108
1229
  */
1109
1230
  showHeader?: boolean;
1231
+ /** Header height in pixels. */
1110
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. */
1111
1235
  overscan?: number;
1112
1236
  /**
1113
1237
  * Size rows to their content rather than to the density token.
1114
1238
  *
1115
- * 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 ,
1116
1240
  * the grid does not lay out rows you cannot see. The difference is what
1117
1241
  * happens on a large grid: `true` gives up above ten thousand rows and falls
1118
1242
  * back to fixed heights, because a cumulative offset array being patched as
@@ -1124,11 +1248,19 @@ export interface GridConfig {
1124
1248
  * measured; it is about whether the ceiling applies.
1125
1249
  */
1126
1250
  autoHeight?: boolean | 'visible';
1251
+ /** Sort, filters, grouping, widths and the rest, restored at construction. */
1127
1252
  state?: GridState;
1253
+ /** Your licence key. Without one the grid renders in full and watermarks off localhost. */
1128
1254
  licence?: string;
1255
+ /** Offer a full-screen control. */
1129
1256
  maximise?: boolean;
1130
1257
  /** Extra functions a formula may call, on top of the built-in library. */
1131
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
+ */
1132
1264
  allowUnsafeTemplates?: boolean;
1133
1265
  /**
1134
1266
  * Caps on the change log behind `grid.updates` and `grid.timeline`.
@@ -1177,7 +1309,10 @@ export interface GridConfig {
1177
1309
  * no grid should pay without asking. Per-column settings layer over these.
1178
1310
  */
1179
1311
  facets?: FacetConfig | boolean;
1312
+ /** A filter your application owns, applied alongside the grid's own and
1313
+ * invisible to its filter UI. */
1180
1314
  hostFilter?: { active(): boolean; passes(row: Row): boolean };
1315
+ /** Anything of yours, passed untouched to renderers, editors and sources. */
1181
1316
  context?: unknown;
1182
1317
  /** Row count above which a column distribution is computed in a Worker. */
1183
1318
  workerThreshold?: number;
@@ -1186,8 +1321,11 @@ export interface GridConfig {
1186
1321
  * grouping run on the main thread; see the reference for why.
1187
1322
  */
1188
1323
  useWorker?: boolean;
1324
+ /** Where to load the worker kernel from, when hosting it yourself. */
1189
1325
  workerUrl?: string;
1326
+ /** Use a shared buffer for the worker, where the page's headers allow it. */
1190
1327
  sharedMemory?: boolean;
1328
+ /** A totals line at the foot of each group as well as the grid. */
1191
1329
  groupFooter?: boolean;
1192
1330
  /**
1193
1331
  * Where the grand total goes.
@@ -1214,7 +1352,7 @@ export interface GridConfig {
1214
1352
 
1215
1353
  /**
1216
1354
  * Rows drawn as a single band across every column instead of being divided
1217
- * into them — a section banner, a note, a "load more" affordance.
1355
+ * into them, a section banner, a note, a "load more" affordance.
1218
1356
  *
1219
1357
  * `when` picks the rows; `render` fills them. A full-width row is still one
1220
1358
  * of your data rows: counted by `rows.count()`, sorted, filtered and
@@ -1226,18 +1364,23 @@ export interface GridConfig {
1226
1364
  /**
1227
1365
  * Return a string for text, or a node for content. Return nothing and
1228
1366
  * write into `params.element` yourself. An HTML string is deliberately not
1229
- * accepted — see `allowUnsafeTemplates` for that decision elsewhere.
1367
+ * accepted: see `allowUnsafeTemplates` for that decision elsewhere.
1230
1368
  */
1231
1369
  render(params: FullWidthParams): string | Node | void;
1232
1370
  };
1371
+ /** Total what the filters left rather than the whole set. */
1233
1372
  totalFilteredOnly?: boolean;
1373
+ /** On a change, recompute only the totals whose column moved. */
1234
1374
  totalOnlyChangedColumns?: boolean;
1375
+ /** Put the total in the header rather than a footer row. */
1235
1376
  showTotalInHeader?: boolean;
1377
+ /** Render only the visible columns once there are more than this many. */
1236
1378
  columnVirtualisationAbove?: number;
1379
+ /** The bar beneath the grid, and which panels it carries. */
1237
1380
  statusBar?: boolean | { panels?: string[] };
1238
1381
  /**
1239
1382
  * The cell right-click menu. A function supplies custom items; `false`
1240
- * 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
1241
1384
  * menu offers Paste, Clear and Fill down.
1242
1385
  */
1243
1386
  contextMenu?: boolean | ((p: CellMenuParams, defaults: MenuItem[]) => MenuItem[] | void);
@@ -1263,7 +1406,7 @@ export interface GridConfig {
1263
1406
  * persisting it is yours, and `rows.data()` afterwards is the new order.
1264
1407
  *
1265
1408
  * Refused, with a reason announced, while a sort, filter or grouping is
1266
- * 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
1267
1410
  * underlying order then.
1268
1411
  */
1269
1412
  rowReorder?: boolean | { column?: string };
@@ -1276,7 +1419,7 @@ export interface GridConfig {
1276
1419
  * to undo.
1277
1420
  *
1278
1421
  * `send` and `receive` are both on when the option is present, so one-way is
1279
- * 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
1280
1423
  * `{ receive: false }` and a target is `{ send: false }`.
1281
1424
  *
1282
1425
  * `mode: 'copy'` leaves the row where it was. `group` restricts exchange to
@@ -1298,7 +1441,7 @@ export interface GridConfig {
1298
1441
  *
1299
1442
  * Column widths, order, visibility and pinning are shared, and horizontal
1300
1443
  * scrolling moves them together. Sort, filters, selection, grouping and the
1301
- * rows themselves stay independent — sharing those would make one grid with
1444
+ * rows themselves stay independent: sharing those would make one grid with
1302
1445
  * extra steps rather than two aligned ones.
1303
1446
  *
1304
1447
  * Declared on the grid created last, since it is the only one that can name
@@ -1311,7 +1454,7 @@ export interface GridConfig {
1311
1454
  * scrolling inside a group.
1312
1455
  *
1313
1456
  * On by default, stacking at most two. `false` turns it off; a number, or
1314
- * `{ 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
1315
1458
  * deep grouping would otherwise spend the screen describing itself.
1316
1459
  */
1317
1460
  stickyGroupHeaders?: boolean | number | { depth?: number };
@@ -1360,10 +1503,11 @@ export interface GridConfig {
1360
1503
  /** File name for the export action, without the extension. */
1361
1504
  exportName?: string;
1362
1505
  };
1506
+ /** The quick filter's initial text. */
1363
1507
  quickFilterText?: string;
1364
1508
  /**
1365
1509
  * Per-column read/write/hidden policy. A usability control, not a
1366
- * 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
1367
1511
  * same policy server-side with `permittedColumns` / `permittedExport`.
1368
1512
  */
1369
1513
  permissions?: PermissionPolicy;
@@ -1376,7 +1520,7 @@ export interface GridConfig {
1376
1520
  * Whether a row present in the snapshot but gone from the data is shown,
1377
1521
  * and whether it counts as data when it is.
1378
1522
  *
1379
- * `false` — the default — leaves it out entirely. `'pinned'` shows it
1523
+ * `false` (the default) leaves it out entirely. `'pinned'` shows it
1380
1524
  * beneath the rows, struck through: visible history that is not part of the
1381
1525
  * row set, so it is excluded from `rows.count()`, from exports and from
1382
1526
  * selection. `'data'` appends it to the row set instead, so it *is*
@@ -1384,7 +1528,7 @@ export interface GridConfig {
1384
1528
  *
1385
1529
  * Neither is sorted or filtered among the live rows: a removed row's values
1386
1530
  * are the snapshot's, and ordering yesterday's numbers among today's would
1387
- * 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
1388
1532
  * left to write to.
1389
1533
  */
1390
1534
  removedRows?: false | 'pinned' | 'data';
@@ -1401,7 +1545,7 @@ export interface GridConfig {
1401
1545
  ask(p: {
1402
1546
  /** The full text to send: the schema description and the question together. */
1403
1547
  prompt: string;
1404
- /** 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. */
1405
1549
  schema: unknown;
1406
1550
  /** The same schema rendered as text, which is what `prompt` embeds. */
1407
1551
  schemaText: string;
@@ -1417,7 +1561,7 @@ export interface GridConfig {
1417
1561
  pivot?: {
1418
1562
  enabled?: boolean;
1419
1563
  /**
1420
- * 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 ,
1421
1565
  * the grand total beside the pivoted ones. `'before'` places it at the near
1422
1566
  * edge, `'after'` at the far edge. Omitted or `false` adds none.
1423
1567
  */
@@ -1501,7 +1645,7 @@ export interface StateApplyReport {
1501
1645
  export interface FormattingCondition {
1502
1646
  /**
1503
1647
  * A filter operator compared against `value`, or a distribution operator
1504
- * whose threshold comes from the column itself — `{op: 'topPercent', value: 10}`,
1648
+ * whose threshold comes from the column itself: `{op: 'topPercent', value: 10}`,
1505
1649
  * `{op: 'outlier'}`. Distribution thresholds are pinned when the rules
1506
1650
  * compile; `grid.formatting.restat()` moves them.
1507
1651
  */
@@ -1530,7 +1674,7 @@ export interface FormattingScale {
1530
1674
  /**
1531
1675
  * One rule. Either a condition and the styling it produces, or a colour scale.
1532
1676
  * A rule held as runtime state must be JSON, so `style` may not be a function
1533
- * there — config-time `cell.style` still accepts one.
1677
+ * there: config-time `cell.style` still accepts one.
1534
1678
  */
1535
1679
  export interface FormattingRule {
1536
1680
  id?: string;
@@ -1547,12 +1691,42 @@ export interface FormattingRule {
1547
1691
  /** A column id, or `'*'` for every column. */
1548
1692
  export type FormattingScope = string;
1549
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
+
1550
1724
  export interface StatisticsApi {
1551
1725
  /** One shadow value for one row, by the column it shadows and the kind. */
1552
1726
  shadow(colId: string, kind: ShadowKind, rowKey: string, scope?: 'all' | 'filtered'): unknown;
1553
1727
  /** A running total at one row, down the grid as it is currently ordered. */
1554
1728
  running(colId: string, kind: 'total' | 'percent', rowKey: string): number | null;
1555
- /** Make the current values the new baseline — "mark all". */
1729
+ /** Make the current values the new baseline: "mark all". */
1556
1730
  rebase(colId?: string): void;
1557
1731
  /** What the shadow histories are costing. */
1558
1732
  tracking(): { columns: string[]; rows: number; forgotten: number };
@@ -1562,7 +1736,7 @@ export interface StatisticsApi {
1562
1736
  profile(colId: string): ColumnProfile | null;
1563
1737
  /** Pearson's correlation between two columns. */
1564
1738
  correlation(a: string, b: string): number | null;
1565
- /** Covariance — a correlation before the scales are divided out. */
1739
+ /** Covariance, a correlation before the scales are divided out. */
1566
1740
  covariance(a: string, b: string, opts?: { population?: boolean }): number | null;
1567
1741
  /** Least-squares fit of `b` on `a`: in finance, beta and alpha. */
1568
1742
  regression(a: string, b: string): RegressionFit | null;
@@ -1580,9 +1754,26 @@ export interface StatisticsApi {
1580
1754
  */
1581
1755
  capability(colId: string, opts?: {
1582
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;
1583
1761
  }): ProcessCapability | null;
1584
1762
  /**
1585
- * 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 ,
1586
1777
  * kernels see rows in the order they arrived, which is not the grid's sort.
1587
1778
  */
1588
1779
  series(colId: string, opts: { by: string; periodsPerYear?: number }): SeriesStats | null;
@@ -1626,7 +1817,7 @@ export interface ProcessCapability {
1626
1817
  cp: number | null;
1627
1818
  /** Capability allowing for where the process is centred. */
1628
1819
  cpk: number | null;
1629
- /** Cp over the overall spread — what the process actually delivered. */
1820
+ /** Cp over the overall spread: what the process actually delivered. */
1630
1821
  pp: number | null;
1631
1822
  /** Cpk over the overall spread. Well below Cpk means the process drifted. */
1632
1823
  ppk: number | null;
@@ -1636,7 +1827,16 @@ export interface ProcessCapability {
1636
1827
  limits: { centre: number; upper: number; lower: number; sigma: number } | null;
1637
1828
  /** How many leading readings set the limits. */
1638
1829
  baseline?: number;
1830
+ /** Which rule set `violations` were judged against, they number differently. */
1831
+ ruleSet?: 'westernElectric' | 'nelson';
1639
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;
1640
1840
  }
1641
1841
 
1642
1842
  export interface SeriesStats {
@@ -1729,7 +1929,7 @@ export interface ColumnDistribution {
1729
1929
  /**
1730
1930
  * Every event the grid emits.
1731
1931
  *
1732
- * 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()`
1733
1933
  * call with no entry here fails the build. It was not complete before: fifty-one
1734
1934
  * events were emitted and undeclared, so subscribing to any of them from
1735
1935
  * TypeScript was a compile error on an event the grid genuinely raises.
@@ -1878,6 +2078,11 @@ export interface RowsApi {
1878
2078
  forEach(fn: (row: Row, index: number) => void): void;
1879
2079
  /** Every row in the data, before any filter. Leaf rows, in physical order. */
1880
2080
  forEachAll(fn: (row: Row, index: number) => void): void;
2081
+ /**
2082
+ * Visit the rows surviving every filter except one column's own: the
2083
+ * faceting question, asked of the rows.
2084
+ */
2085
+ forEachExcept(colId: string, fn: (row: Row, index: number) => void): void;
1881
2086
  value(key: string, colId: string): unknown;
1882
2087
  text(key: string, colId: string): string;
1883
2088
  values(key: string): Record<string, unknown>;
@@ -1956,7 +2161,7 @@ export interface SelectionApi {
1956
2161
  /** Drop every range, leaving the row and cell selection alone. */
1957
2162
  clearRange(): void;
1958
2163
  /**
1959
- * Everything worth knowing about the selected cells — what `summary()`
2164
+ * Everything worth knowing about the selected cells: what `summary()`
1960
2165
  * reports plus median, quartiles, deviation, distinct and outliers. Over the
1961
2166
  * cells rather than a column, so a rectangle spanning three columns is one
1962
2167
  * set of numbers. Null with nothing selected.
@@ -2053,7 +2258,7 @@ export interface ViewStorage {
2053
2258
  /** Load the user's views. Called at construction and by `views.reload()`. */
2054
2259
  read(): SavedView[];
2055
2260
  /**
2056
- * Mirror the views somewhere synchronous — `localStorage`, an in-memory
2261
+ * Mirror the views somewhere synchronous: `localStorage`, an in-memory
2057
2262
  * cache. For a server, listen for `view:saved` / `view:removed` and do the
2058
2263
  * write yourself: the grid does not make network calls and does not want to
2059
2264
  * know whether yours succeeded.
@@ -2084,7 +2289,7 @@ export interface RowStyleParams {
2084
2289
  */
2085
2290
  /**
2086
2291
  * Rendering the grid to a still image. `scale` multiplies the pixel dimensions
2087
- * — 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
2088
2293
  * grid so a PNG dropped into a deck does not show it through.
2089
2294
  */
2090
2295
  export interface CaptureOptions {
@@ -2095,7 +2300,7 @@ export interface CaptureOptions {
2095
2300
  }
2096
2301
 
2097
2302
  /**
2098
- * 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
2099
2304
  * writes data, and it is inert until a tool is chosen, so scrolling and
2100
2305
  * selection pass straight through. Marks are held in content coordinates, so
2101
2306
  * they stay with the cells they annotate when the grid scrolls, and are
@@ -2112,7 +2317,7 @@ export interface AnnotationApi {
2112
2317
 
2113
2318
  /**
2114
2319
  * Holding incoming updates, and the counters describing what they cost.
2115
- * 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.
2116
2321
  */
2117
2322
  /** One thing the grid has flagged as probably a mistake. */
2118
2323
  export interface DiagnosticWarning {
@@ -2250,7 +2455,7 @@ export interface Comment {
2250
2455
  can?: { edit?: boolean; delete?: boolean; resolve?: boolean };
2251
2456
  }
2252
2457
 
2253
- /** 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. */
2254
2459
  export interface CommentDescriptor {
2255
2460
  count: number;
2256
2461
  unresolved: number;
@@ -2447,7 +2652,7 @@ export interface UpdatesApi {
2447
2652
  * Moving the grid through recent data changes. Reads the change log rather
2448
2653
  * than the undo history: history records what the *user* did, and the question
2449
2654
  * on a live grid is what the *data* did. Nothing is scrubbable until
2450
- * `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.
2451
2656
  */
2452
2657
  export interface TimelineApi {
2453
2658
  readonly attached: boolean;
@@ -2625,7 +2830,7 @@ export interface AiApi {
2625
2830
  /** The same schema as a tool definition. */
2626
2831
  tool(opts?: { maxColumns?: number; maxRows?: number }): Record<string, unknown>;
2627
2832
  /**
2628
- * The prompt describing this grid — its columns, types and operators — for
2833
+ * The prompt describing this grid (its columns, types and operators) for
2629
2834
  * sending to a model. It carries no row values.
2630
2835
  *
2631
2836
  * It does not take the user's question: compose that yourself alongside the
@@ -2750,48 +2955,84 @@ export interface MaximiseApi {
2750
2955
  }
2751
2956
 
2752
2957
  export interface Grid {
2958
+ /** The data: reading it, changing it, walking it. */
2753
2959
  readonly rows: RowsApi;
2960
+ /** The columns: order, width, visibility, grouping and pivoting. */
2754
2961
  readonly columns: ColumnsApi;
2962
+ /** What is selected, and the range the user has marked. */
2755
2963
  readonly selection: SelectionApi;
2964
+ /** The filter tree, however it was set. */
2756
2965
  readonly filters: FiltersApi;
2966
+ /** The sort, in priority order. */
2757
2967
  readonly sort: SortApi;
2968
+ /** Editing sessions: starting, committing and cancelling them. */
2758
2969
  readonly edit: EditApi;
2970
+ /** Where the viewport is, and moving it. */
2759
2971
  readonly scroll: ScrollApi;
2972
+ /** CSV, Excel and clipboard. */
2760
2973
  readonly export: ExportApi;
2974
+ /** Everything the user arranged, as a serialisable object. */
2761
2975
  readonly state: StateApi;
2976
+ /** The loading, empty and error surfaces drawn over the grid. */
2762
2977
  readonly overlay: OverlayApi;
2978
+ /** Undo and redo over edits and structural changes. */
2763
2979
  readonly history: HistoryApi;
2980
+ /** Saved arrangements the user can switch between. */
2764
2981
  readonly views: ViewsApi;
2982
+ /** What changed against a baseline, cell by cell. */
2765
2983
  readonly diff: DiffApi;
2984
+ /** Who may see, edit and export what. */
2766
2985
  readonly permissions: PermissionsApi;
2986
+ /** A machine-readable description of the grid, for a model to read. */
2767
2987
  readonly ai: AiApi;
2988
+ /** Translation: the catalogue and the active locale. */
2768
2989
  readonly messages: MessagesApi;
2990
+ /** Licence state, and setting a key after construction. */
2769
2991
  readonly licence: LicenceApi;
2992
+ /** Pages, where the grid is paged rather than scrolled. */
2770
2993
  readonly pagination: PaginationApi;
2994
+ /** Transient emphasis on a row, column or cell. */
2771
2995
  readonly highlight: HighlightApi;
2996
+ /** Values hidden from view and from export. */
2772
2997
  readonly redaction: RedactionApi;
2998
+ /** An image of the grid as drawn, where the module is installed. */
2773
2999
  capture?(opts?: CaptureOptions): Promise<Blob>;
3000
+ /** Drawing over the grid, where the module is installed. */
2774
3001
  annotate?: AnnotationApi;
3002
+ /** Full screen, scaling and chrome suppression. */
2775
3003
  readonly presentation: PresentationApi;
3004
+ /** The live feed: pausing it, flushing it, and what it has done. */
2776
3005
  readonly updates: UpdatesApi;
3006
+ /** Replaying the changes the grid has seen. */
2777
3007
  readonly timeline: TimelineApi;
3008
+ /** Cross-filtering, a derived grid filtering the grid it derives from. */
3009
+ readonly crossFilter: CrossFilter;
3010
+ /** Header distributions, and the filters clicking one creates. */
2778
3011
  readonly facets: FacetsApi;
3012
+ /** The expandable panel beneath a row. */
2779
3013
  readonly detail: DetailApi;
3014
+ /** Threads attached to rows and cells. */
2780
3015
  readonly comments: CommentsApi;
3016
+ /** Who else is looking, and where. */
2781
3017
  readonly presence: PresenceApi;
3018
+ /** What the grid is doing, for when it is doing it slowly. */
2782
3019
  readonly diagnostics: DiagnosticsApi;
3020
+ /** Reductions, profiles, correlations, capability and intervals. */
2783
3021
  readonly statistics: StatisticsApi;
3022
+ /** Formatting a value as the grid would, outside a cell. */
2784
3023
  readonly formatting: FormattingApi;
3024
+ /** Full-screen control, where it is enabled. */
2785
3025
  readonly maximise?: MaximiseApi;
2786
3026
  /**
2787
3027
  * The element you passed to `createGrid`, not the grid's own root.
2788
3028
  *
2789
3029
  * The grid builds its `.lattice` root *inside* that element, so
2790
3030
  * `el.closest('.lattice')` never matches this, and a theme attribute set on
2791
- * 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
2792
3032
  * `element.querySelector('.lattice')` for the grid's own root.
2793
3033
  */
2794
3034
  readonly element: HTMLElement | null;
3035
+ /** Whether `destroy` has run. Every other member is inert afterwards. */
2795
3036
  readonly destroyed: boolean;
2796
3037
  /** False until the first render has been laid out. */
2797
3038
  readonly ready: boolean;
@@ -2800,11 +3041,16 @@ export interface Grid {
2800
3041
  config(): GridConfig;
2801
3042
  get<K extends keyof GridConfig>(key: K): GridConfig[K];
2802
3043
  set<K extends keyof GridConfig>(key: K, value: GridConfig[K]): void;
3044
+ /** Apply several configuration changes as one update rather than several. */
2803
3045
  setAll(values: Partial<GridConfig>): void;
2804
3046
 
3047
+ /** Listen. Returns the function that stops listening. */
2805
3048
  on(event: EventName, handler: EventHandler): Unsubscribe;
3049
+ /** Listen until it fires once. */
2806
3050
  once(event: EventName, handler: EventHandler): Unsubscribe;
3051
+ /** Stop listening. */
2807
3052
  off(event: EventName, handler: EventHandler): void;
3053
+ /** Raise an event of your own on the grid's bus. */
2808
3054
  emit(event: string, payload?: Record<string, unknown>): void;
2809
3055
 
2810
3056
  /**
@@ -2813,7 +3059,7 @@ export interface Grid {
2813
3059
  * The rows render through the ordinary column pipeline but are not part of
2814
3060
  * the data: not counted, sorted, filtered, grouped, selectable or exported.
2815
3061
  *
2816
- * 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
2817
3063
  * identity is how the grid knows the pinned rows have changed.
2818
3064
  */
2819
3065
  setPinnedRows(rows: unknown[], opts?: { edge?: 'top' | 'bottom' }): void;
@@ -2824,7 +3070,9 @@ export interface Grid {
2824
3070
  /** The row form. Declines when `rowForm` is not configured. */
2825
3071
  readonly form: RowFormApi;
2826
3072
 
3073
+ /** The library version. */
2827
3074
  getVersion(): string;
3075
+ /** Release everything: listeners, timers, workers and the DOM the grid made. */
2828
3076
  destroy(): void;
2829
3077
  }
2830
3078
 
@@ -2874,12 +3122,12 @@ export const UNIT_SYSTEMS: Record<string, readonly UnitDescriptor[]>;
2874
3122
  export interface StatValueSpec {
2875
3123
  /** The column to reduce, as a field name or a dotted path. Omit for `count`. */
2876
3124
  of?: string;
2877
- /** 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. */
2878
3126
  fn?: TotalName;
2879
3127
  /**
2880
3128
  * Report this column from the row holding the extreme, rather than the
2881
3129
  * extreme itself: `{ of: 'sales', fn: 'max', show: 'rep' }` is the *name* of
2882
- * 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.
2883
3131
  */
2884
3132
  show?: string;
2885
3133
  }
@@ -2903,13 +3151,26 @@ export interface StatConfig extends StatValueSpec {
2903
3151
  baseline?: number | ((grid: Grid) => number);
2904
3152
  /** Whether a rise is good news. `up` by default. */
2905
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;
2906
3167
  /** Which rows feed the value. `filtered` by default. */
2907
3168
  scope?: 'filtered' | 'all' | 'selected';
2908
3169
  /** `false` stops the tile following the grid; `refresh()` still works. */
2909
3170
  live?: boolean;
2910
3171
  /** Override the formatting the column's type would apply. */
2911
3172
  format?: (value: unknown, grid: Grid) => string;
2912
- /** Shown when there is no value. `—` by default. */
3173
+ /** Shown when there is no value. `, ` by default. */
2913
3174
  empty?: string;
2914
3175
  /** Fraction digits for a value whose reduction changed the unit. 2 by default. */
2915
3176
  decimals?: number;
@@ -2949,7 +3210,7 @@ export const licenseState: typeof licenceState;
2949
3210
  /**
2950
3211
  * Compile a formatting rule list into a style function.
2951
3212
  *
2952
- * `stats` supplies the column summary the distribution operators need — the
3213
+ * `stats` supplies the column summary the distribution operators need: the
2953
3214
  * top decile, the outliers, two deviations from the mean. Without it those
2954
3215
  * rules cannot be answered and are skipped.
2955
3216
  */
@@ -2961,8 +3222,8 @@ export function compileRules(
2961
3222
  /**
2962
3223
  * Browser-storage backing for saved views.
2963
3224
  *
2964
- * Returns null where no usable storage exists — a private window, or a browser
2965
- * 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.
2966
3227
  */
2967
3228
  export function createLocalViewStorage(opts?: {
2968
3229
  key?: string;
@@ -3085,7 +3346,7 @@ export function resolveCatalogue(tag?: string): Record<string, unknown> | null;
3085
3346
  * Declarations for everything under `lattice-grid/modules/`.
3086
3347
  *
3087
3348
  * The package exports these subpaths at runtime but declared none of them, so a
3088
- * 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
3089
3350
  * implicit `any` and, under `strict`, an error. The grid advertises complete
3090
3351
  * declarations; these are the rest of them.
3091
3352
  *
@@ -3101,6 +3362,7 @@ export type ChartType =
3101
3362
  | 'scatter' | 'bubble'
3102
3363
  | 'combo' | 'pareto'
3103
3364
  | 'histogram' | 'boxplot' | 'heatmap'
3365
+ | 'qq' | 'ecdf' | 'lorenz' | 'correlogram' | 'control' | 'capability' | 'movingRange'
3104
3366
  | 'pie' | 'donut' | 'sunburst' | 'treemap'
3105
3367
  | 'radar' | 'gauge' | 'funnel' | 'candlestick' | 'geomap'
3106
3368
  | 'sankey' | 'chord' | 'network' | 'stream' | 'marimekko' | 'violin' | 'gantt';
@@ -3161,6 +3423,21 @@ export interface ChartSpec {
3161
3423
  font?: object;
3162
3424
  margin?: number | { top?: number; right?: number; bottom?: number; left?: number };
3163
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 };
3164
3441
  reference?: { value: number; label?: string }[];
3165
3442
  /** Bins for a histogram; the default is twelve. */
3166
3443
  buckets?: number;
@@ -3175,13 +3452,57 @@ export interface ChartSpec {
3175
3452
  canvas?: boolean | number;
3176
3453
  downsample?: number;
3177
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;
3178
3499
  }
3179
3500
 
3180
3501
  /**
3181
3502
  * The events a chart raises.
3182
3503
  *
3183
3504
  * A chart's own, not the grid's: `grid.on` takes {@link EventName} and knows
3184
- * 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
3185
3506
  * click on a mark becomes a filter on the grid.
3186
3507
  */
3187
3508
  export type ChartEventName =
@@ -3226,7 +3547,7 @@ declare module 'lattice-grid/modules/react' {
3226
3547
  * Build the React component.
3227
3548
  *
3228
3549
  * A factory rather than a component, because the adapter imports neither
3229
- * 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
3230
3551
  * promise of no runtime dependencies, and what stops an adapter disagreeing
3231
3552
  * with the grid version already loaded.
3232
3553
  */
@@ -3273,7 +3594,7 @@ declare module 'lattice-grid/modules/webcomponent' {
3273
3594
 
3274
3595
  declare module 'lattice-grid/modules/htmx' {
3275
3596
  /**
3276
- * 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 ,
3277
3598
  * a page using it imports this and never the base package as well.
3278
3599
  */
3279
3600
  export function createGrid(element: Element, config: GridConfig): Grid;