@toclocoinc/lattice-grid 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lattice-grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.8.0 — type declarations
2
+ * Lattice Grid 1.9.1 — type declarations
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -41,6 +41,11 @@ export type TypeName =
41
41
  | 'voltage' | 'current' | 'resistance' | 'capacitance' | 'inductance'
42
42
  | 'charge' | 'conductance' | 'fluxDensity' | 'luminousFlux' | 'illuminance'
43
43
  | 'substance' | 'absorbedDose' | 'equivalentDose' | 'radioactivity' | 'frequency'
44
+ | 'luminousIntensity' | 'doseRate'
45
+ // Units — rate, ratio and process
46
+ | 'rpm' | 'angularVelocity' | 'ppm' | 'ppb' | 'basisPoints'
47
+ | 'molarity' | 'massFlow' | 'tonnesPerHour'
48
+ | 'viscosity' | 'kinematicViscosity' | 'thermalConductivity' | 'specificHeat'
44
49
  // Temperature, which is affine rather than multiplicative
45
50
  | 'celsius' | 'fahrenheit' | 'kelvin'
46
51
  | (string & {});
@@ -542,6 +547,37 @@ export interface Column {
542
547
  group?: { enabled?: boolean; index?: number; explode?: boolean } | boolean;
543
548
  pivot?: { enabled?: boolean; index?: number } | boolean;
544
549
  total?: TotalName | TotalFn;
550
+ /**
551
+ * A value the grid maintains about this column's own history, rather than a
552
+ * field in the data. `{of: 'price', kind: 'delta'}`, or the bare kind to
553
+ * shadow the column it sits beside.
554
+ */
555
+ shadow?: ShadowKind | {
556
+ of?: string;
557
+ kind: ShadowKind;
558
+ depth?: number;
559
+ /**
560
+ * For a positional kind, what to rank against. `'all'` (the default) uses
561
+ * every tracked row, so a rank does not move when the grid is filtered;
562
+ * `'filtered'` ranks within what the filters left.
563
+ */
564
+ scope?: 'all' | 'filtered';
565
+ };
566
+ /**
567
+ * A running total down the grid **as it is currently ordered**.
568
+ *
569
+ * 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
571
+ * reads the same however the rows are arranged.
572
+ */
573
+ running?: 'total' | 'percent' | { of?: string; kind?: 'total' | 'percent' };
574
+ /**
575
+ * The customer's tolerance, for process capability and control charts.
576
+ * Declared here rather than passed to each call so the capability figures,
577
+ * a control chart and any rule marking an out-of-tolerance cell cannot
578
+ * disagree about what the tolerance is.
579
+ */
580
+ spec?: { lower?: number; upper?: number; target?: number };
545
581
  layout?: ColumnLayoutSpec | number;
546
582
  header?: ColumnHeaderSpec | string;
547
583
  export?: ColumnExportSpec;
@@ -1439,7 +1475,9 @@ export type FormattingScope = string;
1439
1475
 
1440
1476
  export interface StatisticsApi {
1441
1477
  /** One shadow value for one row, by the column it shadows and the kind. */
1442
- shadow(colId: string, kind: ShadowKind, rowKey: string): unknown;
1478
+ shadow(colId: string, kind: ShadowKind, rowKey: string, scope?: 'all' | 'filtered'): unknown;
1479
+ /** A running total at one row, down the grid as it is currently ordered. */
1480
+ running(colId: string, kind: 'total' | 'percent', rowKey: string): number | null;
1443
1481
  /** Make the current values the new baseline — "mark all". */
1444
1482
  rebase(colId?: string): void;
1445
1483
  /** What the shadow histories are costing. */
@@ -1450,6 +1488,30 @@ export interface StatisticsApi {
1450
1488
  profile(colId: string): ColumnProfile | null;
1451
1489
  /** Pearson's correlation between two columns. */
1452
1490
  correlation(a: string, b: string): number | null;
1491
+ /** Covariance — a correlation before the scales are divided out. */
1492
+ covariance(a: string, b: string, opts?: { population?: boolean }): number | null;
1493
+ /** Least-squares fit of `b` on `a`: in finance, beta and alpha. */
1494
+ regression(a: string, b: string): RegressionFit | null;
1495
+ /** Spearman's rank correlation, which one outlier cannot drag. */
1496
+ spearman(a: string, b: string): number | null;
1497
+ /** Kendall's tau-b. Null past 5,000 rows: it is quadratic. */
1498
+ kendall(a: string, b: string): number | null;
1499
+ /** A quantile of one column weighted by another; the median by default. */
1500
+ weightedQuantile(colId: string, weightId: string, p?: number): number | null;
1501
+ /**
1502
+ * Process capability against the column's `spec`, with control limits and the
1503
+ * Western Electric rule breaks. `baseline` fixes the limits over the first N
1504
+ * readings, which is how a shift is found rather than hidden by the limits it
1505
+ * widened.
1506
+ */
1507
+ capability(colId: string, opts?: {
1508
+ lower?: number; upper?: number; target?: number; by?: string; baseline?: number;
1509
+ }): ProcessCapability | null;
1510
+ /**
1511
+ * How a column varies along an ordering. `by` is required and never guessed —
1512
+ * kernels see rows in the order they arrived, which is not the grid's sort.
1513
+ */
1514
+ series(colId: string, opts: { by: string; periodsPerYear?: number }): SeriesStats | null;
1453
1515
  /** A weighted average of one column by another. */
1454
1516
  weightedAverage(colId: string, weightId: string): number | null;
1455
1517
  /** The key a row's data resolves to. */
@@ -1465,6 +1527,66 @@ export type ShadowKind =
1465
1527
  | 'rank' | 'rankAsc' | 'rankChange' | 'percentile' | 'quartile'
1466
1528
  | 'zScore' | 'shareOfTotal';
1467
1529
 
1530
+ export interface RegressionFit {
1531
+ slope: number;
1532
+ intercept: number;
1533
+ /** The square of Pearson's r: how much of the response the fit accounts for. */
1534
+ r2: number;
1535
+ /** Standard error of the slope, which is what says it differs from zero. */
1536
+ stdError: number;
1537
+ /** Pairs that survived pairwise deletion, not rows scanned. */
1538
+ n: number;
1539
+ }
1540
+
1541
+ export interface ProcessCapability {
1542
+ n: number;
1543
+ mean: number;
1544
+ lower: number | null;
1545
+ upper: number | null;
1546
+ target: number | null;
1547
+ /** Short-term variation, from the moving range: what Cp and Cpk use. */
1548
+ sigmaWithin: number | null;
1549
+ /** Overall variation: what Pp and Ppk use. */
1550
+ sigmaOverall: number | null;
1551
+ /** Potential capability. Null for a one-sided specification. */
1552
+ cp: number | null;
1553
+ /** Capability allowing for where the process is centred. */
1554
+ cpk: number | null;
1555
+ /** Cp over the overall spread — what the process actually delivered. */
1556
+ pp: number | null;
1557
+ /** Cpk over the overall spread. Well below Cpk means the process drifted. */
1558
+ ppk: number | null;
1559
+ outOfSpec: number;
1560
+ defectRate: number | null;
1561
+ /** Three sigma either side of the process mean, from the moving range. */
1562
+ limits: { centre: number; upper: number; lower: number; sigma: number } | null;
1563
+ /** How many leading readings set the limits. */
1564
+ baseline?: number;
1565
+ violations: { index: number; rule: number; description: string }[];
1566
+ }
1567
+
1568
+ export interface SeriesStats {
1569
+ n: number;
1570
+ first: number;
1571
+ last: number;
1572
+ change: number;
1573
+ changePercent: number | null;
1574
+ /** Standard deviation of period-on-period returns. */
1575
+ volatility: number | null;
1576
+ /** The same, times the root of `periodsPerYear`; null unless one was given. */
1577
+ annualisedVolatility: number | null;
1578
+ /** Compound growth per period, annualised when `periodsPerYear` is given. */
1579
+ growth: number | null;
1580
+ /** The largest peak-to-trough fall, as a fraction. */
1581
+ maxDrawdown: number | null;
1582
+ maxDrawdownFrom: number;
1583
+ maxDrawdownTo: number;
1584
+ /** Lag-1: positive is momentum, negative is mean reversion. */
1585
+ autocorrelation: number | null;
1586
+ upDays: number;
1587
+ downDays: number;
1588
+ }
1589
+
1468
1590
  export interface ColumnProfile {
1469
1591
  column: string;
1470
1592
  rows: number;
@@ -1530,18 +1652,62 @@ export interface ColumnDistribution {
1530
1652
  // Events (spec 18.4)
1531
1653
  // ---------------------------------------------------------------------------
1532
1654
 
1655
+ /**
1656
+ * Every event the grid emits.
1657
+ *
1658
+ * Complete, and checked against the runtime by `tools/check.js` — an `emit()`
1659
+ * call with no entry here fails the build. It was not complete before: fifty-one
1660
+ * events were emitted and undeclared, so subscribing to any of them from
1661
+ * TypeScript was a compile error on an event the grid genuinely raises.
1662
+ *
1663
+ * Grouped by the subsystem that raises them, which is also how the reference
1664
+ * lists them.
1665
+ */
1533
1666
  export type EventName =
1534
- | 'ready' | 'destroy' | 'render:first' | 'model:changed' | 'rows:changed' | 'rows:queued'
1667
+ /* Lifecycle */
1668
+ | 'ready' | 'destroy' | 'render:first' | 'render:done' | 'config:changed'
1669
+ | 'licence:changed' | 'environment:changed'
1670
+ /* Data */
1671
+ | 'model:changed' | 'rows:changed' | 'rows:queued' | 'rows:deferred'
1672
+ | 'rows:paused' | 'rows:resumed' | 'row:received' | 'row:sent' | 'row:copied'
1673
+ | 'row:moved' | 'source:error' | 'stream:chunk' | 'stream:end' | 'stream:evicted'
1674
+ /* Cells and editing */
1535
1675
  | 'cell:changed' | 'cell:pending' | 'cell:confirmed' | 'cell:reverted'
1536
1676
  | 'cell:clicked' | 'cell:dblclicked' | 'cell:contextmenu'
1537
1677
  | 'cell:edit:start' | 'cell:edit:end' | 'row:edit:start' | 'row:edit:end'
1538
- | 'row:clicked' | 'row:dblclicked' | 'group:toggled'
1539
- | 'sort:changed' | 'filter:changed'
1678
+ | 'row:clicked' | 'row:dblclicked'
1679
+ | 'form:opened' | 'form:closed' | 'form:saved' | 'form:error'
1680
+ /* Query */
1681
+ | 'sort:changed' | 'filter:changed' | 'group:toggled'
1682
+ | 'facet:computed' | 'facet:filtered' | 'facet:expanded' | 'facet:failed'
1683
+ /* Columns */
1540
1684
  | 'column:moved' | 'column:resized' | 'column:visible' | 'column:pinned'
1541
- | 'column:grouped' | 'column:pivoted'
1542
- | 'selection:changed' | 'range:changed'
1685
+ | 'column:grouped' | 'column:pivoted' | 'column:filter:open' | 'column:menu:open'
1686
+ | 'columns:changed' | 'columns:tagged' | 'header:contextmenu'
1687
+ /* Selection and view */
1688
+ | 'selection:changed' | 'range:changed' | 'clipboard:copy'
1543
1689
  | 'page:changed' | 'scroll' | 'scroll:end' | 'size:changed'
1544
- | 'state:changed' | 'stream:chunk' | 'stream:end' | 'source:error'
1690
+ | 'detail:toggled' | 'toolpanel:focus' | 'highlight:changed'
1691
+ /* Tree data */
1692
+ | 'tree:loading' | 'tree:loaded' | 'tree:loadFailed' | 'tree:loadAborted'
1693
+ /* State, history and views */
1694
+ | 'state:changed' | 'state:reset' | 'history:changed' | 'history:applied'
1695
+ | 'views:changed' | 'view:applied' | 'view:saved' | 'view:removed'
1696
+ | 'view:renamed' | 'view:default'
1697
+ /* Formatting and presentation */
1698
+ | 'formatting:changed' | 'redaction:changed' | 'permissions:changed'
1699
+ | 'presentation:changed' | 'presentation:ended' | 'presentation:view'
1700
+ | 'presentation:scale' | 'presentation:spotlight' | 'presentation:captured'
1701
+ /* Collaboration */
1702
+ | 'comment:added' | 'comment:edited' | 'comment:deleted' | 'comment:failed'
1703
+ | 'comment:threadOpened' | 'comment:threadClosed' | 'comment:indexLoaded'
1704
+ | 'presence:published' | 'presence:left' | 'presence:failed' | 'presence:lockRefused'
1705
+ /* Comparison and time */
1706
+ | 'diff:changed' | 'diff:swapped'
1707
+ | 'timeline:attached' | 'timeline:detached' | 'timeline:seek' | 'timeline:seeking'
1708
+ /* Export */
1709
+ | 'export:progress'
1710
+ /* Every event at once, for logging and debugging. */
1545
1711
  | '*';
1546
1712
 
1547
1713
  export interface GridEvent {
@@ -1659,6 +1825,10 @@ export interface RowsApi {
1659
1825
  }
1660
1826
 
1661
1827
  export interface ColumnsApi {
1828
+ /** Set or clear a column's totals-row reduction. */
1829
+ setTotal(id: string, fn: TotalName | TotalFn | null): void;
1830
+ /** Every distinct value in a column, from the dictionary where there is one. */
1831
+ distinct(id: string): unknown[];
1662
1832
  get(id: string): ResolvedColumn | undefined;
1663
1833
  all(): ResolvedColumn[];
1664
1834
  visible(): ResolvedColumn[];
@@ -1709,6 +1879,15 @@ export interface DetailApi {
1709
1879
  }
1710
1880
 
1711
1881
  export interface SelectionApi {
1882
+ /** Drop every range, leaving the row and cell selection alone. */
1883
+ clearRange(): void;
1884
+ /**
1885
+ * Everything worth knowing about the selected cells — what `summary()`
1886
+ * reports plus median, quartiles, deviation, distinct and outliers. Over the
1887
+ * cells rather than a column, so a rectangle spanning three columns is one
1888
+ * set of numbers. Null with nothing selected.
1889
+ */
1890
+ statistics(): object | null;
1712
1891
  rows(): Row[];
1713
1892
  keys(): string[];
1714
1893
  set(keys: string[]): void;
@@ -1732,6 +1911,8 @@ export interface CellRange {
1732
1911
  }
1733
1912
 
1734
1913
  export interface FiltersApi {
1914
+ /** The quick filter's text and match mode, for restoring a control. */
1915
+ quickState(): { text: string; mode: string };
1735
1916
  get(): FilterSet;
1736
1917
  set(filters: FilterSet): void;
1737
1918
  clear(): void;
@@ -1772,6 +1953,8 @@ export interface ScrollApi {
1772
1953
  }
1773
1954
 
1774
1955
  export interface ExportApi {
1956
+ /** The selected range as tab-separated text, the shape a spreadsheet pastes. */
1957
+ rangeText(opts?: object): string;
1775
1958
  csv(opts?: CsvExportOptions): string | Promise<Blob>;
1776
1959
  excel(opts?: ExcelExportOptions): Promise<Blob>;
1777
1960
  clipboard(opts?: ClipboardOptions): Promise<void>;
@@ -2327,6 +2510,8 @@ export interface ViewsApi {
2327
2510
  }
2328
2511
 
2329
2512
  export interface DiffApi {
2513
+ /** Exchange the baseline and the current rows. Returns false with nothing to swap. */
2514
+ swap(): boolean;
2330
2515
  readonly enabled: boolean;
2331
2516
  /** Set the baseline every row is compared against. */
2332
2517
  setSnapshot(rows: unknown[] | null): void;
@@ -2573,6 +2758,44 @@ export interface Grid {
2573
2758
  // Entry points
2574
2759
  // ---------------------------------------------------------------------------
2575
2760
 
2761
+ /** One unit descriptor: a symbol and how many base quantities it is worth. */
2762
+ export interface UnitDescriptor {
2763
+ symbol: string;
2764
+ factor: number;
2765
+ aliases: readonly string[];
2766
+ binary: boolean;
2767
+ prefix: string | null;
2768
+ auto: boolean;
2769
+ }
2770
+
2771
+ /** How a column stores, parses and renders a quantity. */
2772
+ export interface UnitConfig {
2773
+ system?: string;
2774
+ unit?: string;
2775
+ binary?: boolean;
2776
+ decimals?: number;
2777
+ minDecimals?: number;
2778
+ maxDecimals?: number;
2779
+ display?: string;
2780
+ locale?: string;
2781
+ group?: boolean;
2782
+ space?: string;
2783
+ placement?: 'suffix' | 'prefix';
2784
+ }
2785
+
2786
+ export function defineUnit(
2787
+ symbol: string,
2788
+ factor: number,
2789
+ aliases?: readonly string[],
2790
+ opts?: { binary?: boolean; prefix?: string; auto?: boolean },
2791
+ ): UnitDescriptor;
2792
+ /** Registers a system of your own. Throws rather than shadowing an existing name. */
2793
+ export function registerUnitSystem(name: string, units: readonly UnitDescriptor[]): string;
2794
+ export function createUnitType(config?: UnitConfig): DataType;
2795
+ export function parseUnit(text: string | number, opts?: UnitConfig): number | null;
2796
+ export function formatUnit(value: number | null | undefined, opts?: UnitConfig): string;
2797
+ export const UNIT_SYSTEMS: Record<string, readonly UnitDescriptor[]>;
2798
+
2576
2799
  export function createGrid(element: HTMLElement, config?: GridConfig): Grid;
2577
2800
  export function createHeadlessGrid(config?: GridConfig): Grid;
2578
2801
  export function registerModules(modules: GridModule[], opts?: { licence?: string }): void;
@@ -2585,6 +2808,12 @@ export const LatticeGrid: {
2585
2808
  registerModules: typeof registerModules;
2586
2809
  setLicence: typeof setLicence;
2587
2810
  version: typeof version;
2811
+ createUnitType: typeof createUnitType;
2812
+ registerUnitSystem: typeof registerUnitSystem;
2813
+ defineUnit: typeof defineUnit;
2814
+ parseUnit: typeof parseUnit;
2815
+ formatUnit: typeof formatUnit;
2816
+ UNIT_SYSTEMS: typeof UNIT_SYSTEMS;
2588
2817
  };
2589
2818
 
2590
2819
  export default LatticeGrid;
@@ -2645,3 +2874,252 @@ export function formatList(items: string[], locale?: string, type?: 'conjunction
2645
2874
  export function resolveLocale(configured: string | undefined, declared?: string, fallback?: string): string;
2646
2875
  /** Find the catalogue for a tag, falling back to the base language. */
2647
2876
  export function resolveCatalogue(tag?: string): Record<string, unknown> | null;
2877
+
2878
+ // ---------------------------------------------------------------------------
2879
+ // The optional modules (spec 20)
2880
+ // ---------------------------------------------------------------------------
2881
+
2882
+ /**
2883
+ * Declarations for everything under `lattice-grid/modules/`.
2884
+ *
2885
+ * The package exports these subpaths at runtime but declared none of them, so a
2886
+ * TypeScript caller importing the React adapter — or any other module — got an
2887
+ * implicit `any` and, under `strict`, an error. The grid advertises complete
2888
+ * declarations; these are the rest of them.
2889
+ *
2890
+ * Each module is declared where its subpath resolves. The `./modules/*` export
2891
+ * carries a `types` condition pointing back at this file, which is what lets
2892
+ * these blocks be found at all.
2893
+ */
2894
+
2895
+ /** One of the thirty chart types `createChart` accepts. */
2896
+ export type ChartType =
2897
+ | 'line' | 'step' | 'area' | 'rangeArea'
2898
+ | 'bar' | 'horizontalBar' | 'waterfall'
2899
+ | 'scatter' | 'bubble'
2900
+ | 'combo' | 'pareto'
2901
+ | 'histogram' | 'boxplot' | 'heatmap'
2902
+ | 'pie' | 'donut' | 'sunburst' | 'treemap'
2903
+ | 'radar' | 'gauge' | 'funnel' | 'candlestick' | 'geomap'
2904
+ | 'sankey' | 'chord' | 'network' | 'stream' | 'marimekko' | 'violin' | 'gantt';
2905
+
2906
+ /** A measure a chart reduces, when the chart is not given a bare `y`. */
2907
+ export interface ChartMeasure {
2908
+ col: string;
2909
+ /** A reduction name, as the totals row uses. */
2910
+ fn?: TotalName;
2911
+ /** The mark this measure draws with, on a combo chart. */
2912
+ type?: 'bar' | 'line' | 'area';
2913
+ /** Which axis it belongs to, on a combo chart. */
2914
+ axis?: 'left' | 'right';
2915
+ title?: string;
2916
+ }
2917
+
2918
+ /** Data labels beside each mark. */
2919
+ export interface ChartLabels {
2920
+ position?: 'outside' | 'inside' | 'auto';
2921
+ /** A format mask, or a function of the value. */
2922
+ format?: string | ((value: unknown, point?: unknown) => string);
2923
+ /** Pixels two labels must leave between them before both are kept. */
2924
+ minGap?: number;
2925
+ }
2926
+
2927
+ /**
2928
+ * What a chart draws and how.
2929
+ *
2930
+ * `grid` and `container` are required; everything else describes the chart.
2931
+ * A chart reads the grid's *filtered* rows, so it follows the grid without
2932
+ * being told to.
2933
+ */
2934
+ export interface ChartSpec {
2935
+ grid: Grid;
2936
+ container: Element | string;
2937
+ type: ChartType;
2938
+ /** The category column. */
2939
+ x?: string;
2940
+ /** The measure column, for the types that take one. */
2941
+ y?: string;
2942
+ /** Splits the measure into one series per distinct value. */
2943
+ series?: string;
2944
+ /** Several measures at once, for combo and candlestick. */
2945
+ measures?: ChartMeasure[];
2946
+ /** Endpoints, for sankey, chord and network. */
2947
+ source?: string;
2948
+ target?: string;
2949
+ /** Row label and dates, for gantt. */
2950
+ label?: string;
2951
+ start?: string;
2952
+ end?: string;
2953
+ title?: string;
2954
+ /** A named scheme, or an array of colours. */
2955
+ scheme?: string | string[];
2956
+ legend?: boolean | { position?: 'top' | 'bottom' | 'left' | 'right'; isolate?: boolean };
2957
+ labels?: boolean | ChartLabels;
2958
+ axis?: object;
2959
+ font?: object;
2960
+ margin?: number | { top?: number; right?: number; bottom?: number; left?: number };
2961
+ /** Horizontal reference lines. */
2962
+ reference?: { value: number; label?: string }[];
2963
+ /** Bins for a histogram; the default is twelve. */
2964
+ buckets?: number;
2965
+ /** A diverging colour ramp, for heatmap and geomap. */
2966
+ diverging?: boolean;
2967
+ /** Country outlines, for a geomap drawing countries rather than continents. */
2968
+ shapes?: unknown;
2969
+ codeProperty?: string;
2970
+ /** One chart per distinct value of this column. */
2971
+ multiples?: string;
2972
+ /** Draw to canvas past this many points. */
2973
+ canvas?: boolean | number;
2974
+ downsample?: number;
2975
+ emptyText?: string;
2976
+ }
2977
+
2978
+ /**
2979
+ * The events a chart raises.
2980
+ *
2981
+ * A chart's own, not the grid's: `grid.on` takes {@link EventName} and knows
2982
+ * nothing about these. `point:click` is the one most callers want — it is how a
2983
+ * click on a mark becomes a filter on the grid.
2984
+ */
2985
+ export type ChartEventName =
2986
+ | 'click' | 'hover' | 'leave' | 'focus'
2987
+ | 'draw' | 'drill' | 'brush' | 'legend';
2988
+
2989
+ /** A live chart. */
2990
+ export interface Chart {
2991
+ readonly element: SVGElement;
2992
+ /** Redraw now. */
2993
+ draw(): void;
2994
+ /** Change the spec and redraw; unnamed keys keep their values. */
2995
+ update(spec: Partial<ChartSpec>): void;
2996
+ /** The data the chart last bound. */
2997
+ data(): object | null;
2998
+ /** Go up one level, on a drillable hierarchy. */
2999
+ ascend(levels?: number): void;
3000
+ on(event: ChartEventName, handler: (payload: unknown) => void): () => void;
3001
+ emit(event: ChartEventName, payload?: unknown): void;
3002
+ toSVG(opts?: object): string;
3003
+ toPNG(opts?: { scale?: number; background?: string }): Promise<Blob>;
3004
+ toCSV(): string;
3005
+ destroy(): void;
3006
+ }
3007
+
3008
+ declare module 'lattice-grid/modules/charts' {
3009
+ /** Every type name `createChart` accepts. */
3010
+ export const TYPES: readonly ChartType[];
3011
+ /** The built-in colour schemes, by name. */
3012
+ export const SCHEMES: Readonly<Record<string, readonly string[]>>;
3013
+ export const PALETTE: readonly string[];
3014
+ export function createChart(spec: ChartSpec): Chart;
3015
+ export function registerScheme(name: string, colours: readonly string[]): void;
3016
+ export function resolveScheme(spec?: object): object;
3017
+ export function schemeNames(): string[];
3018
+ export function setDefaultScheme(name: string): void;
3019
+ export { Chart };
3020
+ }
3021
+
3022
+ declare module 'lattice-grid/modules/react' {
3023
+ /**
3024
+ * Build the React component.
3025
+ *
3026
+ * A factory rather than a component, because the adapter imports neither
3027
+ * React nor the grid — you pass both in. That is what keeps the package's
3028
+ * promise of no runtime dependencies, and what stops an adapter disagreeing
3029
+ * with the grid version already loaded.
3030
+ */
3031
+ export function createLatticeGrid(deps: { React: unknown; createGrid: unknown }): unknown;
3032
+ /** Every grid event, as the prop name a React caller writes. */
3033
+ export const EVENT_NAMES: readonly string[];
3034
+ export function handlerName(event: string): string;
3035
+ export default createLatticeGrid;
3036
+ }
3037
+
3038
+ declare module 'lattice-grid/modules/vue' {
3039
+ export function createLatticeGrid(deps: { Vue?: unknown; createGrid: unknown }): unknown;
3040
+ export const EVENT_NAMES: readonly string[];
3041
+ export function dashedName(event: string): string;
3042
+ export default createLatticeGrid;
3043
+ }
3044
+
3045
+ declare module 'lattice-grid/modules/svelte' {
3046
+ /** A Svelte action: `use:lattice={config}`. */
3047
+ export function createLatticeAction(deps: { createGrid: unknown }): unknown;
3048
+ export const EVENT_NAMES: readonly string[];
3049
+ export function dashedName(event: string): string;
3050
+ export default createLatticeAction;
3051
+ }
3052
+
3053
+ declare module 'lattice-grid/modules/webcomponent' {
3054
+ /**
3055
+ * Register `<lattice-grid>`.
3056
+ *
3057
+ * This module carries the grid inside it. Use it *or* `createGrid` in one
3058
+ * page, never both: two copies keep separate registries, and a renderer
3059
+ * registered through one will not appear in the other.
3060
+ */
3061
+ export function defineLatticeGrid(tag?: string): void;
3062
+ export function createLatticeGridElement(deps?: object): unknown;
3063
+ export const TAG_NAME: string;
3064
+ export const EVENT_PREFIX: string;
3065
+ export const ATTRIBUTE_CONFIG: Readonly<Record<string, unknown>>;
3066
+ export function observedAttributeNames(): string[];
3067
+ export function domEventName(event: string): string;
3068
+ export class GridElementController {}
3069
+ export default defineLatticeGrid;
3070
+ }
3071
+
3072
+ declare module 'lattice-grid/modules/htmx' {
3073
+ /**
3074
+ * The htmx integration, which re-exports the base API alongside its own —
3075
+ * a page using it imports this and never the base package as well.
3076
+ */
3077
+ export function createGrid(element: Element, config: GridConfig): Grid;
3078
+ export function autoInit(root?: ParentNode): Grid[];
3079
+ export function attach(element: Element, config?: GridConfig): Grid;
3080
+ export function initWithin(root: ParentNode): Grid[];
3081
+ export function destroyWithin(root: ParentNode): void;
3082
+ export function gridElementsWithin(root: ParentNode): Element[];
3083
+ export function hydrateTable(table: Element, config?: GridConfig): Grid;
3084
+ export function readTable(table: Element): { columns: Column[]; rows: unknown[] };
3085
+ export function rowsFromFragment(fragment: ParentNode): unknown[];
3086
+ export function rowsFromJson(text: string): unknown[];
3087
+ export function ingestResponse(grid: Grid, response: unknown): void;
3088
+ export function driveServerMode(grid: Grid, opts?: object): () => void;
3089
+ export function driveInfiniteScroll(grid: Grid, opts?: object): () => void;
3090
+ export function driveOobUpdates(grid: Grid, opts?: object): () => void;
3091
+ export function serialiseState(grid: Grid): string;
3092
+ export function restoreState(grid: Grid, state: string): void;
3093
+ export function saveStateWithin(root: ParentNode): void;
3094
+ export function restoreStateWithin(root: ParentNode): void;
3095
+ export function queryParams(grid: Grid): Record<string, string>;
3096
+ export function warnIfLargeHtmlPayload(rows: number): void;
3097
+ export const QUERY_CHANGED_EVENT: string;
3098
+ export const SCROLL_NEAR_END_EVENT: string;
3099
+ export const HTML_ROW_WARNING_THRESHOLD: number;
3100
+ }
3101
+
3102
+ declare module 'lattice-grid/modules/dhtmlx-compat' {
3103
+ /** A dhtmlx Grid-shaped API over Lattice, for migrating a piece at a time. */
3104
+ export class Grid {
3105
+ constructor(container: Element | string, config?: object);
3106
+ }
3107
+ export default Grid;
3108
+ }
3109
+
3110
+ declare module 'lattice-grid/modules/devtools' {
3111
+ /**
3112
+ * The devtools panel, including the accessibility checks.
3113
+ *
3114
+ * The grid is handed in rather than imported: a module may depend on nothing
3115
+ * in core, or the bundler inlines the whole grid into it.
3116
+ */
3117
+ export function createDevtools(opts: { grid: Grid; container?: Element }): {
3118
+ element: Element;
3119
+ refresh(): void;
3120
+ destroy(): void;
3121
+ };
3122
+ export function expose(grid: Grid, name?: string): void;
3123
+ export const CONSOLE_ACTIVATION: string;
3124
+ export default createDevtools;
3125
+ }