@svgrid/grid 2.6.20 → 2.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +22 -0
  3. package/dist/GridMenus.svelte +17 -12
  4. package/dist/SvGrid.controller.svelte.d.ts +14 -8
  5. package/dist/SvGrid.controller.svelte.js +214 -74
  6. package/dist/SvGrid.css +1 -1
  7. package/dist/SvGrid.svelte +112 -57
  8. package/dist/SvGrid.types.d.ts +191 -1
  9. package/dist/ai.d.ts +28 -0
  10. package/dist/ai.js +6 -0
  11. package/dist/cdn/{GridMenus-B0F9iBrG.js → GridMenus-BuoBPqxx.js} +137 -132
  12. package/dist/cdn/GridMenus-n4llxoOI.js +494 -0
  13. package/dist/cdn/column-resize-DsfNXMom.js +102 -0
  14. package/dist/cdn/row-resize-BRcimkUT.js +95 -0
  15. package/dist/cdn/{src-Cd0tearp.js → src-C9Hihx1W.js} +3497 -3487
  16. package/dist/cdn/{src-B1TdiyS8.js → src-D1lXwq1l.js} +8258 -8248
  17. package/dist/cdn/svgrid.js +10 -8
  18. package/dist/cdn/svgrid.svelte-external.js +10 -8
  19. package/dist/cdn/validate-_CDJzgIo.js +75 -0
  20. package/dist/cell-formatting.d.ts +2 -0
  21. package/dist/cell-formatting.js +2 -0
  22. package/dist/chart-export.d.ts +1 -0
  23. package/dist/chart.d.ts +31 -5
  24. package/dist/chart.js +9 -3
  25. package/dist/column-groups.js +1 -1
  26. package/dist/column-resize.d.ts +46 -0
  27. package/dist/column-resize.js +205 -0
  28. package/dist/columns.d.ts +0 -3
  29. package/dist/columns.js +0 -57
  30. package/dist/core.d.ts +216 -4
  31. package/dist/core.js +532 -119
  32. package/dist/createTree.svelte.d.ts +3 -0
  33. package/dist/createTree.svelte.js +1 -0
  34. package/dist/datetime/date-core.d.ts +2 -0
  35. package/dist/datetime/date-restrict.d.ts +1 -0
  36. package/dist/datetime/timezone.d.ts +1 -0
  37. package/dist/dock-manager-model.d.ts +3 -0
  38. package/dist/dock-manager-model.js +1 -0
  39. package/dist/dock-model.d.ts +6 -0
  40. package/dist/dock-model.js +3 -0
  41. package/dist/editor-contract.d.ts +1 -0
  42. package/dist/filtering/excel-filters.js +28 -0
  43. package/dist/group-display.d.ts +1 -1
  44. package/dist/index.d.ts +2 -1
  45. package/dist/index.js +6 -0
  46. package/dist/list-option.d.ts +1 -0
  47. package/dist/menus.js +1 -1
  48. package/dist/positioning.d.ts +2 -0
  49. package/dist/row-resize.d.ts +11 -0
  50. package/dist/row-resize.js +7 -1
  51. package/dist/scheduler-ical.d.ts +1 -0
  52. package/dist/scheduler-model.d.ts +1 -0
  53. package/dist/selection.js +9 -0
  54. package/dist/spreadsheet.d.ts +1 -1
  55. package/dist/spreadsheet.js +1 -1
  56. package/dist/summaries.js +22 -0
  57. package/dist/svgrid-wrapper.types.d.ts +5 -0
  58. package/dist/toast-store.svelte.d.ts +4 -0
  59. package/dist/validate.d.ts +50 -0
  60. package/dist/validate.js +187 -0
  61. package/package.json +4 -1
  62. package/src/GridMenus.svelte +17 -12
  63. package/src/SvGrid.controller.svelte.ts +223 -76
  64. package/src/SvGrid.css +1 -1
  65. package/src/SvGrid.svelte +112 -57
  66. package/src/SvGrid.types.ts +191 -1
  67. package/src/ai.ts +28 -0
  68. package/src/cell-formatting.ts +2 -0
  69. package/src/chart-export.ts +1 -0
  70. package/src/chart.ts +31 -5
  71. package/src/column-groups.ts +1 -1
  72. package/src/column-resize.test.ts +381 -0
  73. package/src/column-resize.ts +227 -0
  74. package/src/columns.test.ts +0 -103
  75. package/src/columns.ts +0 -58
  76. package/src/core.aggregate.test.ts +134 -0
  77. package/src/core.filter.test.ts +156 -0
  78. package/src/core.grouping.test.ts +146 -0
  79. package/src/core.row-shape.test.ts +119 -0
  80. package/src/core.rowmodel-cache.test.ts +121 -0
  81. package/src/core.sort.test.ts +293 -0
  82. package/src/core.ts +723 -119
  83. package/src/createTree.svelte.ts +3 -0
  84. package/src/datetime/date-core.ts +2 -0
  85. package/src/datetime/date-restrict.ts +1 -0
  86. package/src/datetime/timezone.ts +1 -0
  87. package/src/dock-manager-model.ts +3 -0
  88. package/src/dock-model.ts +6 -0
  89. package/src/editor-contract.ts +1 -0
  90. package/src/filtering/excel-filters.ts +30 -0
  91. package/src/filtering/normalize-fast-path.test.ts +104 -0
  92. package/src/group-display.ts +1 -1
  93. package/src/index.ts +12 -1
  94. package/src/list-option.ts +1 -0
  95. package/src/menus.ts +1 -1
  96. package/src/positioning.ts +2 -0
  97. package/src/resize-props.test.ts +361 -0
  98. package/src/row-resize.test.ts +31 -0
  99. package/src/row-resize.ts +21 -3
  100. package/src/scheduler-ical.ts +1 -0
  101. package/src/scheduler-model.ts +1 -0
  102. package/src/selection.ts +9 -0
  103. package/src/spreadsheet.ts +1 -1
  104. package/src/summaries.ts +21 -0
  105. package/src/svgrid-wrapper.types.ts +5 -0
  106. package/src/svgrid.summaries.test.ts +217 -0
  107. package/src/toast-store.svelte.ts +4 -0
  108. package/src/validate.test.ts +207 -0
  109. package/src/validate.ts +269 -0
  110. package/dist/cdn/GridMenus-IHK_l7m6.js +0 -489
package/dist/core.d.ts CHANGED
@@ -1,35 +1,74 @@
1
1
  import type { SparklineConfig } from './sparkline.js';
2
+ /**
3
+ * The constraint every row type satisfies: an object keyed by string. Your own
4
+ * row type (`type Person = { name: string }`) is what flows through the generics
5
+ * below; this is only the lower bound they are declared against.
6
+ */
2
7
  export type RowData = Record<string, unknown>;
8
+ /**
9
+ * A new value, or a function that derives it from the previous one - the shape
10
+ * every `set*` on the grid accepts, so callers can update state without first
11
+ * reading it.
12
+ *
13
+ * api.setSorting([{ id: 'name', desc: false }])
14
+ * api.setSorting((prev) => [...prev, { id: 'age', desc: true }])
15
+ */
3
16
  export type Updater<T> = T | ((prev: T) => T);
17
+ /** Active sort clauses, outermost first. `desc: false` is ascending. */
4
18
  export type SortingState = Array<{
5
19
  id: string;
6
20
  desc: boolean;
7
21
  }>;
22
+ /**
23
+ * One column's filter: the column `id`, the `value` being matched, and
24
+ * optionally which comparison to use. `fn` defaults to the column's own type -
25
+ * see {@link filterFns} for the available names.
26
+ */
8
27
  export type ColumnFilter = {
9
28
  id: string;
10
29
  value: unknown;
11
30
  fn?: keyof typeof filterFns;
12
31
  };
32
+ /** Every active column filter. A column with no entry here is unfiltered. */
13
33
  export type ColumnFiltersState = Array<ColumnFilter>;
34
+ /** Current page position. `pageIndex` is 0-based, so page 1 is index 0. */
14
35
  export type PaginationState = {
15
36
  pageIndex: number;
16
37
  pageSize: number;
17
38
  };
39
+ /** Column ids the rows are grouped by, outermost first. */
18
40
  export type GroupingState = Array<string>;
41
+ /** Which rows are expanded, keyed by row id. Absent means collapsed. */
19
42
  export type ExpandedState = Record<string, boolean>;
43
+ /** Which rows are selected, keyed by row id. Absent means unselected. */
20
44
  export type RowSelectionState = Record<string, boolean>;
45
+ /**
46
+ * Where keyboard focus sits. The indices address the *displayed* grid (after
47
+ * sorting, filtering and paging), not the source data.
48
+ */
21
49
  export type ActiveCellState = {
22
50
  rowIndex: number;
23
51
  colIndex: number;
24
52
  cellId: string | null;
25
53
  };
54
+ /**
55
+ * The set of features a grid has registered, as built by {@link tableFeatures}.
56
+ * Deliberately open: a feature is identified by its key, so the type carries
57
+ * which ones are on without enumerating them.
58
+ */
26
59
  export type TableFeatures = Record<string, unknown>;
60
+ /** A cell's value. Unconstrained - a column can hold anything. */
27
61
  export type CellData = unknown;
62
+ /** What a column's `header` render function receives. */
28
63
  export type HeaderContext<TData extends RowData> = {
29
64
  header: Header<TData>;
30
65
  column: Column<TData>;
31
66
  table: SvGrid<TData>;
32
67
  };
68
+ /**
69
+ * What a column's `cell` render function receives. `getValue()` applies the
70
+ * column's accessor (`field` or `fieldFn`); `row.original` is the raw object.
71
+ */
33
72
  export type CellContext<TData extends RowData> = {
34
73
  cell: Cell<TData>;
35
74
  row: Row<TData>;
@@ -86,6 +125,11 @@ export type EditorContext<TData extends RowData> = CellContext<TData> & {
86
125
  commit: (next?: unknown) => void;
87
126
  cancel: () => void;
88
127
  };
128
+ /**
129
+ * Declarative cell formatting, applied through `Intl` - number, currency,
130
+ * percent, date and datetime. Prefer this over a `formatter` function: it is
131
+ * locale-aware, and export and the clipboard reuse the same configuration.
132
+ */
89
133
  export type CellFormatConfig = {
90
134
  type: 'number';
91
135
  locales?: string | Array<string>;
@@ -116,12 +160,17 @@ export type CellFormatConfig = {
116
160
  pattern?: string;
117
161
  options?: Intl.DateTimeFormatOptions;
118
162
  };
163
+ /**
164
+ * A column's custom display function, for anything {@link CellFormatConfig}
165
+ * cannot express. Returns a string - to render markup, use `cell` instead.
166
+ */
119
167
  export type CellFormatter<TData extends RowData> = (context: {
120
168
  value: unknown;
121
169
  row: Row<TData>;
122
170
  column: Column<TData>;
123
171
  table: SvGrid<TData>;
124
172
  }) => string;
173
+ /** A header or cell slot: a literal string, or a function returning renderable content. */
125
174
  export type ColumnDefTemplate<TContext> = string | ((context: TContext) => unknown);
126
175
  /**
127
176
  * How a column's value is aggregated for a group row when `columnGrouping`
@@ -152,7 +201,7 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
152
201
  columns?: Array<ColumnDef<TFeatures, TData>>;
153
202
  /**
154
203
  * Declarative cell spanning (merged cells). Return how many COLUMNS this
155
- * cell spans to the right (1 = no span). Value-driven, AG-Grid-style. Feed
204
+ * cell spans to the right (1 = no span). Value-driven. Feed
156
205
  * `spansToMerges(rows, columns)` into `spreadsheetLayout` to apply - it uses
157
206
  * the same real `colspan`/`rowspan` merge engine (no separate code path).
158
207
  */
@@ -191,7 +240,7 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
191
240
  columnGroupShow?: 'open' | 'closed';
192
241
  /**
193
242
  * For a GROUP column (one with `columns: [...]`): start the group expanded.
194
- * Defaults to `false` (collapsed), matching AG Grid - so only the always-on
243
+ * Defaults to `false` (collapsed), the conventional default - so only the always-on
195
244
  * and `columnGroupShow: 'closed'` children show until the user expands it.
196
245
  */
197
246
  openByDefault?: boolean;
@@ -214,7 +263,7 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
214
263
  */
215
264
  tooltip?: string | ((ctx: CellContext<TData>) => string | null | undefined);
216
265
  /**
217
- * Declarative per-cell validation (Handsontable-style). Runs for EVERY
266
+ * Declarative per-cell validation. Runs for EVERY
218
267
  * rendered cell - including values already present in `data` on load, not
219
268
  * just on edit - so bad data is flagged immediately. Invalid cells get the
220
269
  * `sv-grid-cell-invalid` class (red highlight) and the returned message as
@@ -253,7 +302,7 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
253
302
  * Transform the committed edit value before it is written to the row.
254
303
  * Runs after the built-in per-`editorType` coercion, so `newValue` is
255
304
  * already type-parsed; return the final value to store (e.g. round a
256
- * number, uppercase a code, look up an id). AG-Grid-style `valueParser`.
305
+ * number, uppercase a code, look up an id). A `valueParser` hook.
257
306
  */
258
307
  valueParser?: (params: ValueParserParams<TData>) => unknown;
259
308
  /**
@@ -310,6 +359,20 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
310
359
  * is formatted with this column's `format` and shown in the group header.
311
360
  */
312
361
  aggregate?: GroupAggregator<TData>;
362
+ /**
363
+ * What this column contributes to the grid's footer summary row (the one
364
+ * turned on with `summary` / `enableRowSummaries`). Takes the same
365
+ * aggregators as {@link aggregate}, and the result is formatted with this
366
+ * column's `format`.
367
+ *
368
+ * Without it the footer falls back to its default: the sum of a numeric
369
+ * column, `Count: N` otherwise. Set `false` to leave the cell blank, which is
370
+ * usually what an actions or checkbox column wants.
371
+ *
372
+ * { field: 'amount', summary: 'avg' }
373
+ * { id: 'actions', summary: false }
374
+ */
375
+ summary?: GroupAggregator<TData> | false;
313
376
  /**
314
377
  * Render the cell as an in-cell sparkline chart. The cell value should be
315
378
  * an array of numbers (or a comma/space separated string). Mutually
@@ -325,6 +388,21 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
325
388
  sparkline?: SparklineConfig;
326
389
  /** Initial column width in pixels. Falls back to the grid's `columnWidth` prop. */
327
390
  width?: number;
391
+ /**
392
+ * Whether the user may resize this column. Only consulted when the grid has
393
+ * `columnResize` on - it narrows that, it does not enable anything.
394
+ *
395
+ * `false` removes the column's drag handle entirely, so pointer drag, the
396
+ * keyboard arrows and double-click-to-autosize are all gone with it, and the
397
+ * column menu drops its Autosize item. Use it for the columns whose width is
398
+ * part of the layout rather than a preference: a row-number gutter, a
399
+ * checkbox column, a fixed icon column.
400
+ *
401
+ * Programmatic sizing is unaffected - `api.autosizeColumn()`,
402
+ * `api.setColumnWidth()` and `fitColumns` all still apply, the same way they
403
+ * do when `columnResize` is off. This governs the user affordance only.
404
+ */
405
+ resizable?: boolean;
328
406
  /**
329
407
  * Initial visibility. Set `false` to start the column hidden while still
330
408
  * listing it in the Choose Columns UI for the user to re-enable. Applied
@@ -371,6 +449,12 @@ export type ColumnDef<TFeatures extends TableFeatures, TData extends RowData> =
371
449
  export type GridColumnDef<TData extends RowData = RowData> = ColumnDef<TableFeatures, TData>;
372
450
  /** An array of {@link GridColumnDef} - what you pass to `<SvGrid columns={...}>`. */
373
451
  export type GridColumns<TData extends RowData = RowData> = Array<GridColumnDef<TData>>;
452
+ /**
453
+ * A resolved column: your {@link ColumnDef} plus everything the grid computed
454
+ * from it - its id, its depth under any group header, and the sort handlers a
455
+ * header needs. This is what you receive in render contexts; the `ColumnDef`
456
+ * is what you wrote.
457
+ */
374
458
  export type Column<TData extends RowData> = {
375
459
  id: string;
376
460
  columnDef: ColumnDef<any, TData>;
@@ -381,6 +465,11 @@ export type Column<TData extends RowData> = {
381
465
  getIsSorted: () => false | 'asc' | 'desc';
382
466
  getToggleSortingHandler: () => () => void;
383
467
  };
468
+ /**
469
+ * One header cell. `colSpan` is how many leaf columns it covers, and
470
+ * `isPlaceholder` marks the empty cells that pad a group-header row so the
471
+ * levels line up.
472
+ */
384
473
  export type Header<TData extends RowData> = {
385
474
  id: string;
386
475
  isPlaceholder: boolean;
@@ -388,10 +477,12 @@ export type Header<TData extends RowData> = {
388
477
  column: Column<TData>;
389
478
  getContext: () => HeaderContext<TData>;
390
479
  };
480
+ /** One row of header cells. A grid with grouped columns has several, outermost first. */
391
481
  export type HeaderGroup<TData extends RowData> = {
392
482
  id: string;
393
483
  headers: Array<Header<TData>>;
394
484
  };
485
+ /** One cell: the intersection of a {@link Row} and a {@link Column}. */
395
486
  export type Cell<TData extends RowData> = {
396
487
  id: string;
397
488
  row: Row<TData>;
@@ -399,6 +490,13 @@ export type Cell<TData extends RowData> = {
399
490
  getValue: () => unknown;
400
491
  getContext: () => CellContext<TData>;
401
492
  };
493
+ /**
494
+ * A row in the display model. `original` is your untouched data object;
495
+ * everything else is grid-computed. `index` is the position in the displayed
496
+ * set, so it shifts as sorting and filtering change - key on `id`, not index.
497
+ *
498
+ * Group rows and tree parents carry `subRows`; a plain data row does not.
499
+ */
402
500
  export type Row<TData extends RowData> = {
403
501
  id: string;
404
502
  index: number;
@@ -415,50 +513,126 @@ export type Row<TData extends RowData> = {
415
513
  getAllCells: () => Array<Cell<TData>>;
416
514
  getCellValueByColumnId: (columnId: string) => unknown;
417
515
  };
516
+ /** The output of the row pipeline: the rows to display, in order. */
418
517
  export type RowModel<TData extends RowData> = {
419
518
  rows: Array<Row<TData>>;
420
519
  };
520
+ /**
521
+ * The minimal reactive store behind the headless core - read `state`, write
522
+ * through `setState`, and `subscribe` for changes. Deliberately framework
523
+ * free, which is what lets the core run under plain Node.
524
+ *
525
+ * In Svelte you rarely touch this: `subscribeGrid` wraps it with fine-grained
526
+ * selectors so a component only re-runs for the slice it read.
527
+ */
421
528
  export type Store<T> = {
422
529
  readonly state: T;
423
530
  setState: (updater: (prev: T) => T) => void;
424
531
  subscribe: (listener: () => void) => () => void;
425
532
  };
533
+ /**
534
+ * Click-to-sort. Injected by the `sortable` shortcut.
535
+ *
536
+ * This and the five features below are opaque markers: pass the ones you want
537
+ * to {@link tableFeatures} and the grid wires up the matching row model. With
538
+ * `<SvGrid>` you rarely name them - the boolean shortcuts (`sortable`,
539
+ * `filterable`, `pageable`, `groupable`) inject them for you. Reach for them
540
+ * directly when driving the headless core, or when you want a feature on
541
+ * without its UI.
542
+ *
543
+ * The names match TanStack Table v9, so a features object written for it works
544
+ * here unchanged.
545
+ */
426
546
  export declare const rowSortingFeature: {
427
547
  key: string;
428
548
  };
549
+ /** Per-column filtering. Injected by the `filterable` shortcut. */
429
550
  export declare const columnFilteringFeature: {
430
551
  key: string;
431
552
  };
553
+ /** Paging of the row model. Injected by the `pageable` shortcut. */
432
554
  export declare const rowPaginationFeature: {
433
555
  key: string;
434
556
  };
557
+ /** Row grouping with aggregation. Injected by the `groupable` shortcut. */
435
558
  export declare const columnGroupingFeature: {
436
559
  key: string;
437
560
  };
561
+ /** Row selection state (the checkbox column reads it). */
438
562
  export declare const rowSelectionFeature: {
439
563
  key: string;
440
564
  };
565
+ /** Expand / collapse, for tree rows and master-detail. */
441
566
  export declare const rowExpandingFeature: {
442
567
  key: string;
443
568
  };
569
+ /**
570
+ * Declare which features a grid uses. Identity at runtime - its whole job is to
571
+ * capture the exact set in the type, so `ColumnDef<typeof features, Row>` knows
572
+ * what is registered and anything you did not register is tree-shaken out.
573
+ *
574
+ * ```ts
575
+ * const features = tableFeatures({ rowSortingFeature, columnFilteringFeature })
576
+ * ```
577
+ *
578
+ * Same call signature as TanStack Table v9, so a features object written for it
579
+ * transfers unchanged.
580
+ */
444
581
  export declare function tableFeatures<T extends TableFeatures>(features: T): T;
582
+ /**
583
+ * Built-in comparators, chosen per column by its data type. `auto` compares as
584
+ * text; set a column's type or supply your own comparator to override.
585
+ */
445
586
  export declare const sortFns: {
446
587
  auto: (a: unknown, b: unknown) => number;
447
588
  number: (a: unknown, b: unknown) => number;
448
589
  date: (a: unknown, b: unknown) => number;
449
590
  };
591
+ /**
592
+ * Built-in match functions, named by {@link ColumnFilter}'s `fn`.
593
+ * `includesString` is case-insensitive substring; `equals` is strict identity.
594
+ */
450
595
  export declare const filterFns: {
451
596
  includesString: (value: unknown, query: string) => boolean;
452
597
  equals: (value: unknown, query: unknown) => boolean;
453
598
  };
599
+ /**
600
+ * One stage of the row pipeline: takes the rows produced so far and returns the
601
+ * next set. Stages compose in the order given to `_rowModels`, so filtering
602
+ * before sorting sorts only what survived the filter.
603
+ */
454
604
  export type RowModelFactory<TData extends RowData> = (args: {
455
605
  table: SvGrid<TData>;
456
606
  rows: Array<Row<TData>>;
457
607
  }) => Array<Row<TData>>;
608
+ /**
609
+ * The identity stage that starts every pipeline. Always required, even when no
610
+ * other stage is: it is what turns your data into rows.
611
+ */
458
612
  export declare function createCoreRowModel<TData extends RowData>(): RowModelFactory<TData>;
613
+ /**
614
+ * Drops rows that fail the active {@link ColumnFiltersState}. Pairs with
615
+ * `columnFilteringFeature`; without it there are no filters to apply.
616
+ */
459
617
  export declare function createFilteredRowModel<TData extends RowData>(): RowModelFactory<TData>;
618
+ /**
619
+ * Narrows the rows to the current page. Put it LAST: anything after it would
620
+ * only ever see one page of data.
621
+ */
460
622
  export declare function createPaginatedRowModel<TData extends RowData>(): RowModelFactory<TData>;
623
+ /**
624
+ * Buckets rows by the active {@link GroupingState} and inserts a group row
625
+ * ahead of each bucket, carrying that bucket's aggregates.
626
+ */
461
627
  export declare function createGroupedRowModel<TData extends RowData>(): RowModelFactory<TData>;
628
+ /**
629
+ * How to read a hierarchy out of FLAT rows: each row names its parent, and the
630
+ * grid reconstructs the tree. Rows whose parent id matches nothing become roots
631
+ * rather than disappearing.
632
+ *
633
+ * For nested source data (`children: [...]`), flatten it first with
634
+ * {@link flattenTreeData}.
635
+ */
462
636
  export type TreeRowModelOptions = {
463
637
  /** Field holding each row's parent id. Rows with no parent are roots. */
464
638
  parentField: string;
@@ -481,6 +655,11 @@ export type TreeRowModelOptions = {
481
655
  * data row for a full-width group banner.
482
656
  */
483
657
  export declare function createTreeRowModel<TData extends RowData>(options: TreeRowModelOptions): RowModelFactory<TData>;
658
+ /**
659
+ * How to flatten NESTED source data into the parent-id shape tree rows need.
660
+ * `parentField` is written onto each row, so point `treeData.parentField` at
661
+ * the same name afterwards.
662
+ */
484
663
  export type FlattenTreeOptions = {
485
664
  /** Field holding an array of child objects. */
486
665
  childrenField: string;
@@ -498,8 +677,25 @@ export type FlattenTreeOptions = {
498
677
  * (harmless, and callers often still want it); only the parent link is added.
499
678
  */
500
679
  export declare function flattenTreeData<T extends RowData>(data: ReadonlyArray<T>, options: FlattenTreeOptions): T[];
680
+ /**
681
+ * Hides the descendants of collapsed rows. Needed for grouping, tree data and
682
+ * master-detail alike - all three are the same expand/collapse mechanism.
683
+ */
501
684
  export declare function createExpandedRowModel<TData extends RowData>(): RowModelFactory<TData>;
685
+ /**
686
+ * Orders rows by the active {@link SortingState}. Pass your own comparators to
687
+ * override the built-in {@link sortFns} - useful for locale-aware or
688
+ * domain-specific ordering.
689
+ */
502
690
  export declare function createSortedRowModel<TData extends RowData>(localSortFns?: typeof sortFns): RowModelFactory<TData>;
691
+ /**
692
+ * Everything {@link createSvGridCore} accepts: the data and columns, the
693
+ * features and row models that make up the pipeline, and an `on*Change`
694
+ * callback per piece of state for controlled use.
695
+ *
696
+ * `<SvGrid>` builds this for you from its props - you only construct it
697
+ * directly when driving the headless core.
698
+ */
503
699
  export type SvGridOptions<TFeatures extends TableFeatures, TData extends RowData> = {
504
700
  _features: TFeatures;
505
701
  _rowModels?: {
@@ -528,6 +724,13 @@ export type SvGridOptions<TFeatures extends TableFeatures, TData extends RowData
528
724
  onRowSelectionChange?: (updater: Updater<RowSelectionState>) => void;
529
725
  onActiveCellChange?: (updater: Updater<ActiveCellState>) => void;
530
726
  };
727
+ /**
728
+ * The headless grid instance: the state stores plus the read methods a renderer
729
+ * needs (`getHeaderGroups()`, `getRowModel()`, the `set*` writers).
730
+ *
731
+ * Framework free by design - `<SvGrid>` is one renderer over this, and you can
732
+ * write another. See the "Why headless?" guide.
733
+ */
531
734
  export type SvGrid<TData extends RowData> = {
532
735
  store: Store<Record<string, any>>;
533
736
  optionsStore: Store<Record<string, any>>;
@@ -549,5 +752,14 @@ export type SvGrid<TData extends RowData> = {
549
752
  getFooterGroups: () => Array<HeaderGroup<TData>>;
550
753
  getRowModel: () => RowModel<TData>;
551
754
  };
755
+ /**
756
+ * Build a headless grid: state, the row pipeline, and the read methods, with no
757
+ * DOM and no Svelte. This is the engine `<SvGrid>` renders.
758
+ *
759
+ * Most callers want `createSvGrid` (the runes-aware wrapper) or the component
760
+ * itself; reach for this when you are writing your own renderer or running the
761
+ * pipeline outside a browser.
762
+ */
552
763
  export declare function createSvGridCore<TFeatures extends TableFeatures, TData extends RowData>(options: SvGridOptions<TFeatures, TData>): SvGrid<TData>;
764
+ /** Narrowing helper for the many options that accept a value or a function. */
553
765
  export declare function isFunction(value: unknown): value is (...args: Array<any>) => any;