@tanstack/table-core 9.0.0-beta.64 → 9.0.0-beta.68

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 (144) hide show
  1. package/README.md +3 -1
  2. package/dist/core/cells/constructCell.d.ts +0 -1
  3. package/dist/core/cells/coreCellsFeature.d.ts +0 -1
  4. package/dist/core/cells/coreCellsFeature.types.d.ts +0 -1
  5. package/dist/core/cells/coreCellsFeature.utils.d.ts +1 -0
  6. package/dist/core/columns/constructColumn.d.ts +0 -1
  7. package/dist/core/columns/coreColumnsFeature.d.ts +0 -1
  8. package/dist/core/columns/coreColumnsFeature.types.d.ts +5 -6
  9. package/dist/core/columns/coreColumnsFeature.utils.d.ts +0 -1
  10. package/dist/core/coreFeatures.d.ts +1 -0
  11. package/dist/core/headers/buildHeaderGroups.d.ts +0 -1
  12. package/dist/core/headers/constructHeader.d.ts +0 -1
  13. package/dist/core/headers/coreHeadersFeature.d.ts +0 -1
  14. package/dist/core/headers/coreHeadersFeature.types.d.ts +0 -1
  15. package/dist/core/headers/coreHeadersFeature.utils.d.ts +1 -0
  16. package/dist/core/reactivity/coreReactivityFeature.types.d.ts +0 -1
  17. package/dist/core/reactivity/coreReactivityFeature.utils.d.ts +0 -1
  18. package/dist/core/reactivity/renderPhaseReactivity.d.ts +0 -1
  19. package/dist/core/row-models/coreRowModelsFeature.d.ts +0 -1
  20. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +0 -1
  21. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +0 -1
  22. package/dist/core/row-models/createCoreRowModel.d.ts +0 -1
  23. package/dist/core/rows/constructRow.d.ts +0 -1
  24. package/dist/core/rows/coreRowsFeature.d.ts +0 -1
  25. package/dist/core/rows/coreRowsFeature.types.d.ts +0 -1
  26. package/dist/core/rows/coreRowsFeature.utils.d.ts +0 -1
  27. package/dist/core/table/constructTable.d.ts +0 -1
  28. package/dist/core/table/coreTablesFeature.d.ts +0 -1
  29. package/dist/core/table/coreTablesFeature.types.d.ts +6 -7
  30. package/dist/core/table/coreTablesFeature.utils.d.ts +0 -1
  31. package/dist/features/cell-selection/cellSelectionFeature.d.ts +0 -1
  32. package/dist/features/cell-selection/cellSelectionFeature.types.d.ts +30 -16
  33. package/dist/features/cell-selection/cellSelectionFeature.utils.d.ts +9 -10
  34. package/dist/features/cell-selection/cellSelectionFeature.utils.js +37 -24
  35. package/dist/features/cell-selection/cellSelectionGeometry.js +90 -0
  36. package/dist/features/column-faceting/columnFacetingFeature.d.ts +0 -1
  37. package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +0 -1
  38. package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +0 -1
  39. package/dist/features/column-faceting/createFacetedMinMaxValues.d.ts +0 -1
  40. package/dist/features/column-faceting/createFacetedRowModel.d.ts +0 -1
  41. package/dist/features/column-faceting/createFacetedUniqueValues.d.ts +0 -1
  42. package/dist/features/column-filtering/columnFilteringFeature.d.ts +0 -1
  43. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +3 -4
  44. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +0 -1
  45. package/dist/features/column-filtering/createFilteredRowModel.d.ts +0 -1
  46. package/dist/features/column-filtering/filterFns.d.ts +0 -1
  47. package/dist/features/column-grouping/columnGroupingFeature.d.ts +0 -1
  48. package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +0 -1
  49. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +0 -1
  50. package/dist/features/column-grouping/createGroupedRowModel.d.ts +0 -1
  51. package/dist/features/column-ordering/columnOrderingFeature.d.ts +0 -1
  52. package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +0 -1
  53. package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +0 -1
  54. package/dist/features/column-pinning/columnPinningFeature.d.ts +0 -1
  55. package/dist/features/column-pinning/columnPinningFeature.types.d.ts +0 -1
  56. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +0 -1
  57. package/dist/features/column-resizing/columnResizingFeature.d.ts +0 -1
  58. package/dist/features/column-resizing/columnResizingFeature.types.d.ts +0 -1
  59. package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +0 -1
  60. package/dist/features/column-sizing/columnSizingFeature.d.ts +0 -1
  61. package/dist/features/column-sizing/columnSizingFeature.types.d.ts +0 -1
  62. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +0 -1
  63. package/dist/features/column-visibility/columnVisibilityFeature.d.ts +0 -1
  64. package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +0 -1
  65. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +1 -0
  66. package/dist/features/global-filtering/globalFilteringFeature.d.ts +0 -1
  67. package/dist/features/global-filtering/globalFilteringFeature.js +1 -1
  68. package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +0 -1
  69. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +1 -0
  70. package/dist/features/row-aggregation/aggregationFns.d.ts +0 -1
  71. package/dist/features/row-aggregation/rowAggregationFeature.d.ts +0 -1
  72. package/dist/features/row-aggregation/rowAggregationFeature.types.d.ts +1 -2
  73. package/dist/features/row-aggregation/rowAggregationFeature.utils.d.ts +0 -1
  74. package/dist/features/row-expanding/createExpandedRowModel.d.ts +0 -1
  75. package/dist/features/row-expanding/rowExpandingFeature.d.ts +0 -1
  76. package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +0 -1
  77. package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +0 -1
  78. package/dist/features/row-pagination/createPaginatedRowModel.d.ts +0 -1
  79. package/dist/features/row-pagination/rowPaginationFeature.d.ts +0 -1
  80. package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +0 -1
  81. package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +0 -1
  82. package/dist/features/row-pinning/rowPinningFeature.d.ts +0 -1
  83. package/dist/features/row-pinning/rowPinningFeature.types.d.ts +0 -1
  84. package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +0 -1
  85. package/dist/features/row-selection/rowSelectionFeature.d.ts +0 -1
  86. package/dist/features/row-selection/rowSelectionFeature.types.d.ts +2 -3
  87. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +3 -4
  88. package/dist/features/row-selection/rowSelectionFeature.utils.js +3 -3
  89. package/dist/features/row-sorting/createSortedRowModel.d.ts +0 -1
  90. package/dist/features/row-sorting/rowSortingFeature.d.ts +0 -1
  91. package/dist/features/row-sorting/rowSortingFeature.types.d.ts +0 -1
  92. package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +0 -1
  93. package/dist/features/row-sorting/sortFns.d.ts +0 -1
  94. package/dist/features/stockFeatures.d.ts +0 -1
  95. package/dist/flex-render.d.ts +0 -1
  96. package/dist/helpers/columnHelper.d.ts +0 -1
  97. package/dist/helpers/tableFeatures.d.ts +0 -1
  98. package/dist/helpers/tableOptions.d.ts +0 -1
  99. package/dist/index.d.ts +2 -2
  100. package/dist/store-reactivity-bindings.d.ts +0 -1
  101. package/dist/types/Cell.d.ts +0 -1
  102. package/dist/types/Column.d.ts +0 -1
  103. package/dist/types/ColumnDef.d.ts +0 -1
  104. package/dist/types/Header.d.ts +0 -1
  105. package/dist/types/HeaderGroup.d.ts +0 -1
  106. package/dist/types/Row.d.ts +0 -1
  107. package/dist/types/RowModel.d.ts +0 -1
  108. package/dist/types/RowModelFns.d.ts +0 -1
  109. package/dist/types/Table.d.ts +0 -1
  110. package/dist/types/TableFeatures.d.ts +1 -2
  111. package/dist/types/TableOptions.d.ts +1 -2
  112. package/dist/types/TableState.d.ts +0 -1
  113. package/dist/types/type-utils.d.ts +1 -1
  114. package/dist/utils.d.ts +2 -17
  115. package/dist/utils.js +3 -1
  116. package/dist/worker/createTableWorker.d.ts +2 -3
  117. package/dist/worker/createWorkerRowModel.d.ts +0 -1
  118. package/dist/worker/initTableWorker.d.ts +0 -1
  119. package/dist/worker/rebuildRowModel.d.ts +3 -0
  120. package/dist/worker/tableWorkerProtocol.d.ts +5 -4
  121. package/package.json +1 -1
  122. package/skills/aggregation/SKILL.md +1 -1
  123. package/skills/api-not-found/SKILL.md +1 -1
  124. package/skills/cell-selection/SKILL.md +33 -9
  125. package/skills/client-vs-server/SKILL.md +1 -1
  126. package/skills/column-faceting/SKILL.md +1 -1
  127. package/skills/column-filtering/SKILL.md +1 -1
  128. package/skills/column-ordering/SKILL.md +1 -1
  129. package/skills/column-pinning/SKILL.md +1 -1
  130. package/skills/column-resizing/SKILL.md +1 -1
  131. package/skills/column-sizing/SKILL.md +1 -1
  132. package/skills/column-visibility/SKILL.md +1 -1
  133. package/skills/core/SKILL.md +1 -1
  134. package/skills/custom-features/SKILL.md +1 -1
  135. package/skills/expanding/SKILL.md +1 -1
  136. package/skills/global-filtering/SKILL.md +1 -1
  137. package/skills/grouping/SKILL.md +1 -1
  138. package/skills/migrate-v8-to-v9/SKILL.md +3 -2
  139. package/skills/pagination/SKILL.md +1 -1
  140. package/skills/row-pinning/SKILL.md +1 -1
  141. package/skills/row-selection/SKILL.md +1 -1
  142. package/skills/sorting/SKILL.md +1 -1
  143. package/skills/table-features/SKILL.md +1 -1
  144. package/skills/typescript/SKILL.md +1 -1
package/README.md CHANGED
@@ -35,6 +35,8 @@
35
35
  >
36
36
  > - [Angular Table](https://tanstack.com/table/alpha/docs/framework/angular/angular-table)
37
37
  > - [Lit Table](https://tanstack.com/table/alpha/docs/framework/lit/lit-table)
38
+ > - [Octane Table](https://tanstack.com/table/beta/docs/framework/octane/quick-start)
39
+ > - [Preact Table](https://tanstack.com/table/beta/docs/framework/preact/quick-start)
38
40
  > - [React Table](https://tanstack.com/table/alpha/docs/framework/react/react-table)
39
41
  > - [Solid Table](https://tanstack.com/table/alpha/docs/framework/solid/solid-table)
40
42
  > - [Svelte Table](https://tanstack.com/table/alpha/docs/framework/svelte/svelte-table)
@@ -44,7 +46,7 @@
44
46
 
45
47
  A headless table library for building powerful datagrids with full control over markup, styles, and behavior.
46
48
 
47
- - Frameworkagnostic core with bindings for React, Vue & Solid
49
+ - Framework-agnostic core with bindings for React, Preact, Octane, Vue, Solid, Svelte, Angular, Ember, Lit, and Alpine
48
50
  - 100% customizable — bring your own UI, components, and styles
49
51
  - Sorting, filtering, grouping, aggregation & row selection
50
52
  - Lightweight, virtualizable & server‑side friendly
@@ -4,7 +4,6 @@ import { Column } from "../../types/Column.js";
4
4
  import { Row } from "../../types/Row.js";
5
5
  import { Cell } from "../../types/Cell.js";
6
6
  import { TableFeatures } from "../../types/TableFeatures.js";
7
-
8
7
  //#region src/core/cells/constructCell.d.ts
9
8
  /**
10
9
  * Constructs a cell instance from normalized table internals.
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/core/cells/coreCellsFeature.d.ts
4
3
  /**
5
4
  * Core feature that adds cell value, render, and context APIs.
@@ -4,7 +4,6 @@ import { Column } from "../../types/Column.js";
4
4
  import { Row } from "../../types/Row.js";
5
5
  import { Cell } from "../../types/Cell.js";
6
6
  import { TableFeatures } from "../../types/TableFeatures.js";
7
-
8
7
  //#region src/core/cells/coreCellsFeature.types.d.ts
9
8
  interface CellContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
10
9
  cell: Cell<TFeatures, TData, TValue>;
@@ -4,6 +4,7 @@ import { Column } from "../../types/Column.js";
4
4
  import { Row } from "../../types/Row.js";
5
5
  import { Cell } from "../../types/Cell.js";
6
6
  import { TableFeatures } from "../../types/TableFeatures.js";
7
+ import "../../index.js";
7
8
  //#region src/core/cells/coreCellsFeature.utils.d.ts
8
9
  /**
9
10
  * Reads this cell's accessor value from its owning row and column.
@@ -3,7 +3,6 @@ import { ColumnDef } from "../../types/ColumnDef.js";
3
3
  import { Table } from "../../types/Table.js";
4
4
  import { Column } from "../../types/Column.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/columns/constructColumn.d.ts
8
7
  /**
9
8
  * Constructs a column instance from normalized table internals.
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/core/columns/coreColumnsFeature.d.ts
4
3
  /**
5
4
  * Core feature that builds the column tree and exposes table/column column APIs.
@@ -3,7 +3,6 @@ import { AccessorFn, ColumnDef } from "../../types/ColumnDef.js";
3
3
  import { Table } from "../../types/Table.js";
4
4
  import { Column } from "../../types/Column.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/columns/coreColumnsFeature.types.d.ts
8
7
  interface Column_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
9
8
  /**
@@ -23,11 +22,11 @@ interface Column_CoreProperties<in out TFeatures extends TableFeatures, in out T
23
22
  */
24
23
  depth: number;
25
24
  /**
26
- * The resolved unique identifier for the column resolved in this priority:
27
- - A manual `id` property from the column def
28
- - The accessor key from the column def
29
- - The header string from the column def
30
- */
25
+ * The resolved unique identifier for the column resolved in this priority:
26
+ - A manual `id` property from the column def
27
+ - The accessor key from the column def
28
+ - The header string from the column def
29
+ */
31
30
  id: string;
32
31
  /**
33
32
  * The parent column for this column. Will be undefined if this is a root column.
@@ -3,7 +3,6 @@ import { ColumnDef } from "../../types/ColumnDef.js";
3
3
  import { Table } from "../../types/Table.js";
4
4
  import { Column } from "../../types/Column.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/columns/coreColumnsFeature.utils.d.ts
8
7
  /**
9
8
  * Flattens this column and every descendant column into a single array.
@@ -5,6 +5,7 @@ import { coreRowModelsFeature } from "./row-models/coreRowModelsFeature.js";
5
5
  import { coreRowsFeature } from "./rows/coreRowsFeature.js";
6
6
  import { coreTablesFeature } from "./table/coreTablesFeature.js";
7
7
  import { TableReactivityBindings } from "./reactivity/coreReactivityFeature.types.js";
8
+ import "../reactivity.js";
8
9
  //#region src/core/coreFeatures.d.ts
9
10
  interface CoreFeatures {
10
11
  coreReactivityFeature?: TableReactivityBindings;
@@ -3,7 +3,6 @@ import { HeaderGroup } from "../../types/HeaderGroup.js";
3
3
  import { Table } from "../../types/Table.js";
4
4
  import { Column } from "../../types/Column.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/headers/buildHeaderGroups.d.ts
8
7
  /**
9
8
  * Builds the nested header group structure for a table.
@@ -3,7 +3,6 @@ import { Header } from "../../types/Header.js";
3
3
  import { Table } from "../../types/Table.js";
4
4
  import { Column } from "../../types/Column.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/headers/constructHeader.d.ts
8
7
  /**
9
8
  * Constructs a header instance from normalized table internals.
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/core/headers/coreHeadersFeature.d.ts
4
3
  /**
5
4
  * Core feature that builds header groups and exposes header context APIs.
@@ -4,7 +4,6 @@ import { Header } from "../../types/Header.js";
4
4
  import { Table } from "../../types/Table.js";
5
5
  import { Column } from "../../types/Column.js";
6
6
  import { TableFeatures } from "../../types/TableFeatures.js";
7
-
8
7
  //#region src/core/headers/coreHeadersFeature.types.d.ts
9
8
  interface Table_Headers<in out TFeatures extends TableFeatures, in out TData extends RowData> {
10
9
  /**
@@ -4,6 +4,7 @@ import { Header } from "../../types/Header.js";
4
4
  import { Table } from "../../types/Table.js";
5
5
  import { Column } from "../../types/Column.js";
6
6
  import { TableFeatures } from "../../types/TableFeatures.js";
7
+ import "../../index.js";
7
8
  //#region src/core/headers/coreHeadersFeature.utils.d.ts
8
9
  /**
9
10
  * Walks a header tree and collects all descendant leaf headers.
@@ -1,5 +1,4 @@
1
1
  import { Atom, AtomOptions, ReadonlyAtom, Subscription } from "@tanstack/store";
2
-
3
2
  //#region src/core/reactivity/coreReactivityFeature.types.d.ts
4
3
  interface TableAtomOptions<T> extends AtomOptions<T> {
5
4
  /**
@@ -1,5 +1,4 @@
1
1
  import { Atom, ReadonlyAtom, ReadonlyStore, Store } from "@tanstack/store";
2
-
3
2
  //#region src/core/reactivity/coreReactivityFeature.utils.d.ts
4
3
  /**
5
4
  * Converts a writable atom to the store-compatible shape expected by core.
@@ -1,6 +1,5 @@
1
1
  import { TableReactivityBindings } from "./coreReactivityFeature.types.js";
2
2
  import { Atom, AtomOptions, ReadonlyAtom } from "@tanstack/store";
3
-
4
3
  //#region src/core/reactivity/renderPhaseReactivity.d.ts
5
4
  /**
6
5
  * Reactivity bindings for adapters whose options are plain values synchronized
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/core/row-models/coreRowModelsFeature.d.ts
4
3
  /**
5
4
  * Core feature that wires table row-model accessors and row-model caches.
@@ -7,7 +7,6 @@ import { Row } from "../../types/Row.js";
7
7
  import { Table_RowModels_Filtered } from "../../features/column-filtering/columnFilteringFeature.types.js";
8
8
  import { Table_RowModels_Grouped } from "../../features/column-grouping/columnGroupingFeature.types.js";
9
9
  import { TableFeatures } from "../../types/TableFeatures.js";
10
-
11
10
  //#region src/core/row-models/coreRowModelsFeature.types.d.ts
12
11
  interface RowModel<in out TFeatures extends TableFeatures, in out TData extends RowData> {
13
12
  rows: Array<Row<TFeatures, TData>>;
@@ -2,7 +2,6 @@ import { RowData } from "../../types/type-utils.js";
2
2
  import { Table } from "../../types/Table.js";
3
3
  import { RowModel } from "./coreRowModelsFeature.types.js";
4
4
  import { TableFeatures } from "../../types/TableFeatures.js";
5
-
6
5
  //#region src/core/row-models/coreRowModelsFeature.utils.d.ts
7
6
  /**
8
7
  * Resolves the table's unmodified core row model.
@@ -2,7 +2,6 @@ import { RowData } from "../../types/type-utils.js";
2
2
  import { Table } from "../../types/Table.js";
3
3
  import { RowModel } from "./coreRowModelsFeature.types.js";
4
4
  import { TableFeatures } from "../../types/TableFeatures.js";
5
-
6
5
  //#region src/core/row-models/createCoreRowModel.d.ts
7
6
  /**
8
7
  * Creates a memoized core row model factory.
@@ -2,7 +2,6 @@ import { RowData } from "../../types/type-utils.js";
2
2
  import { Table } from "../../types/Table.js";
3
3
  import { Row } from "../../types/Row.js";
4
4
  import { TableFeatures } from "../../types/TableFeatures.js";
5
-
6
5
  //#region src/core/rows/constructRow.d.ts
7
6
  /**
8
7
  * Constructs a row instance from normalized table internals.
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/core/rows/coreRowsFeature.d.ts
4
3
  /**
5
4
  * Core feature that creates row APIs for values, cells, and tree traversal.
@@ -4,7 +4,6 @@ import { Column } from "../../types/Column.js";
4
4
  import { Row } from "../../types/Row.js";
5
5
  import { Cell } from "../../types/Cell.js";
6
6
  import { TableFeatures } from "../../types/TableFeatures.js";
7
-
8
7
  //#region src/core/rows/coreRowsFeature.types.d.ts
9
8
  interface Row_CoreProperties<in out TFeatures extends TableFeatures, in out TData extends RowData> {
10
9
  _cellsCache?: WeakMap<Column<TFeatures, TData, unknown>, Cell<TFeatures, TData, unknown>>;
@@ -3,7 +3,6 @@ import { Table } from "../../types/Table.js";
3
3
  import { Row } from "../../types/Row.js";
4
4
  import { Cell } from "../../types/Cell.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/rows/coreRowsFeature.utils.d.ts
8
7
  /**
9
8
  * Returns this row's zero-based position in the current pre-pagination row
@@ -3,7 +3,6 @@ import { TableState } from "../../types/TableState.js";
3
3
  import { TableOptions } from "../../types/TableOptions.js";
4
4
  import { Table } from "../../types/Table.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/table/constructTable.d.ts
8
7
  /**
9
8
  * Builds the initial table state from registered features and user initial state.
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/core/table/coreTablesFeature.d.ts
4
3
  /**
5
4
  * Core feature that adds base table instance APIs such as reset and setOptions.
@@ -7,7 +7,6 @@ import { TableState, TableState_All } from "../../types/TableState.js";
7
7
  import { TableOptions } from "../../types/TableOptions.js";
8
8
  import { IsAny, TableFeature, TableFeatures, ValidateFeatureSlots } from "../../types/TableFeatures.js";
9
9
  import { Atom, ReadonlyAtom, ReadonlyStore } from "@tanstack/store";
10
-
11
10
  //#region src/core/table/coreTablesFeature.types.d.ts
12
11
  interface TableMeta<in out TFeatures extends TableFeatures, in out TData extends RowData> {}
13
12
  /**
@@ -25,7 +24,7 @@ type ExtractTableMeta<TFeatures extends TableFeatures, TData extends RowData> =
25
24
  * A map of writable atoms, one per `TableState` slice. These are the internal
26
25
  * writable atoms that the library always writes to via `makeStateUpdater`.
27
26
  */
28
- type BaseAtoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: Atom<TableState<TFeatures>[K]> };
27
+ type BaseAtoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: Atom<TableState<TFeatures>[K]>; };
29
28
  /**
30
29
  * A map of readonly derived atoms, one per `TableState` slice. Each derives
31
30
  * from its corresponding `baseAtom` plus, optionally, a per-slice external
@@ -33,13 +32,13 @@ type BaseAtoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeat
33
32
  *
34
33
  * Precedence: `options.atoms[key]` > `options.state[key]` > `baseAtoms[key]`.
35
34
  */
36
- type Atoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: ReadonlyAtom<TableState<TFeatures>[K]> };
35
+ type Atoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: ReadonlyAtom<TableState<TFeatures>[K]>; };
37
36
  /**
38
37
  * A map of optional external atoms, one per `TableState` slice. Consumers can
39
38
  * provide their own writable atom for any state slice to take over ownership
40
39
  * of that slice.
41
40
  */
42
- type ExternalAtoms<TFeatures extends TableFeatures> = Partial<{ [K in keyof TableState<TFeatures>]: Atom<TableState<TFeatures>[K]> }>;
41
+ type ExternalAtoms<TFeatures extends TableFeatures> = Partial<{ [K in keyof TableState<TFeatures>]: Atom<TableState<TFeatures>[K]>; }>;
43
42
  /**
44
43
  * Internal "all features" flat variants of the atom types. `Table`
45
44
  * uses these so feature code (written generically over `TFeatures`) can access
@@ -50,9 +49,9 @@ type ExternalAtoms<TFeatures extends TableFeatures> = Partial<{ [K in keyof Tabl
50
49
  * but those slices may not be registered on the current table. Consumers must
51
50
  * use optional chaining (`table.atoms.columnPinning?.get() ?? default`).
52
51
  */
53
- type BaseAtoms_All = { [K in keyof TableState_All]?: Atom<Exclude<TableState_All[K], undefined>> };
54
- type Atoms_All = { [K in keyof TableState_All]?: ReadonlyAtom<TableState_All[K]> };
55
- type ExternalAtoms_All = Partial<{ [K in keyof TableState_All]: Atom<Exclude<TableState_All[K], undefined>> }>;
52
+ type BaseAtoms_All = { [K in keyof TableState_All]?: Atom<Exclude<TableState_All[K], undefined>>; };
53
+ type Atoms_All = { [K in keyof TableState_All]?: ReadonlyAtom<TableState_All[K]>; };
54
+ type ExternalAtoms_All = Partial<{ [K in keyof TableState_All]: Atom<Exclude<TableState_All[K], undefined>>; }>;
56
55
  interface TableOptions_Table<in out TFeatures extends TableFeatures, in out TData extends RowData> {
57
56
  /**
58
57
  * The feature modules registered on this table instance.
@@ -3,7 +3,6 @@ import { TableState } from "../../types/TableState.js";
3
3
  import { TableOptions } from "../../types/TableOptions.js";
4
4
  import { Table } from "../../types/Table.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/core/table/coreTablesFeature.utils.d.ts
8
7
  /**
9
8
  * Synchronizes externally controlled state slices into the table's base atoms.
@@ -1,5 +1,4 @@
1
1
  import { TableFeature } from "../../types/TableFeatures.js";
2
-
3
2
  //#region src/features/cell-selection/cellSelectionFeature.d.ts
4
3
  /**
5
4
  * Feature that adds spreadsheet-style cell range selection state and APIs.
@@ -1,7 +1,6 @@
1
1
  import { CellData, OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
2
2
  import { Cell } from "../../types/Cell.js";
3
3
  import { TableFeatures } from "../../types/TableFeatures.js";
4
-
5
4
  //#region src/features/cell-selection/cellSelectionFeature.types.d.ts
6
5
  /**
7
6
  * A single rectangular cell selection, stored as its two defining corners.
@@ -17,10 +16,16 @@ interface CellSelectionRange {
17
16
  anchorRowId: string;
18
17
  focusColumnId: string;
19
18
  focusRowId: string;
19
+ /**
20
+ * How this range changes the selection produced by the ranges before it.
21
+ * Defaults to `include`.
22
+ */
23
+ operation?: CellSelectionRangeOperation;
20
24
  }
25
+ type CellSelectionRangeOperation = 'include' | 'exclude';
21
26
  /**
22
- * The selected rectangles. The last entry is the active one that shift-extend
23
- * and drag operate on.
27
+ * Ordered range operations that produce the final selection. The last entry is
28
+ * the active operation that shift-extend and drag operate on.
24
29
  *
25
30
  * A bare array, matching `SortingState` and `ColumnFiltersState`. Drag session
26
31
  * state deliberately lives outside this slice as non-reactive instance data, so
@@ -52,10 +57,18 @@ interface CellSelectionEdges {
52
57
  top: boolean;
53
58
  }
54
59
  type CellSelectionDirection = 'up' | 'down' | 'left' | 'right';
60
+ type CellSelectionRangeMode = 'replace' | 'include' | 'exclude';
55
61
  interface SelectCellRangeOptions {
62
+ /**
63
+ * Whether to replace the selection, add the range, or subtract the range.
64
+ * Defaults to `replace`.
65
+ */
66
+ mode?: CellSelectionRangeMode;
56
67
  /**
57
68
  * Whether the range should be added alongside existing ranges rather than
58
69
  * replacing them. Defaults to `false`.
70
+ *
71
+ * @deprecated Use `mode: 'include'` instead.
59
72
  */
60
73
  additive?: boolean;
61
74
  }
@@ -87,8 +100,7 @@ interface TableOptions_CellSelection<in out TFeatures extends TableFeatures, in
87
100
  */
88
101
  enableCellSelectionDrag?: boolean;
89
102
  /**
90
- * Allows multiple disjoint rectangles to be selected at once. Defaults to
91
- * `true`.
103
+ * Allows modifier interactions to add or subtract ranges. Defaults to `true`.
92
104
  */
93
105
  enableMultiCellRangeSelection?: boolean;
94
106
  /**
@@ -100,8 +112,8 @@ interface TableOptions_CellSelection<in out TFeatures extends TableFeatures, in
100
112
  */
101
113
  isCellRangeSelectionEvent?: (event: unknown) => boolean;
102
114
  /**
103
- * Determines whether a selection-start event should add a new rectangle
104
- * alongside the existing ones.
115
+ * Determines whether a selection-start event should add or subtract a new
116
+ * rectangle. The operation depends on whether the starting cell is selected.
105
117
  *
106
118
  * By default, events with `ctrlKey` or `metaKey` directly on the event or on
107
119
  * `event.nativeEvent` are treated as multi-range events.
@@ -134,7 +146,7 @@ interface Cell_CellSelection {
134
146
  */
135
147
  getIsFocused: () => boolean;
136
148
  /**
137
- * Checks whether this cell falls inside any selected range.
149
+ * Checks whether this cell falls inside the final positive selection.
138
150
  */
139
151
  getIsSelected: () => boolean;
140
152
  /**
@@ -192,7 +204,8 @@ interface Table_CellSelection<in out TFeatures extends TableFeatures, in out TDa
192
204
  */
193
205
  extendCellSelection: (direction: CellSelectionDirection) => void;
194
206
  /**
195
- * Returns the selected ranges resolved into inclusive display-order indexes.
207
+ * Returns the final positive selection as disjoint, inclusive display-order
208
+ * index rectangles after all include and exclude operations are applied.
196
209
  *
197
210
  * This is the memoized cache every per-cell read goes through. Ranges whose
198
211
  * corners no longer resolve are omitted.
@@ -216,14 +229,15 @@ interface Table_CellSelection<in out TFeatures extends TableFeatures, in out TDa
216
229
  */
217
230
  getCellSelectionRowIds: () => Array<string>;
218
231
  /**
219
- * Returns the active cell, i.e. the anchor of the most recent range.
232
+ * Returns the active cell, i.e. the anchor of the most recent operation.
233
+ * An exclusion's active cell is focused even though it is not selected.
220
234
  */
221
235
  getFocusedCell: () => Cell<TFeatures, TData, any> | undefined;
222
236
  /**
223
237
  * Returns the number of selected cells.
224
238
  *
225
- * Computed as rectangle arithmetic for one range. Falls back to enumerating
226
- * cells for overlapping ranges or a per-cell `enableCellSelection` predicate.
239
+ * Computed with rectangle arithmetic unless a per-cell
240
+ * `enableCellSelection` predicate requires enumeration.
227
241
  */
228
242
  getSelectedCellCount: () => number;
229
243
  /**
@@ -234,9 +248,9 @@ interface Table_CellSelection<in out TFeatures extends TableFeatures, in out TDa
234
248
  */
235
249
  getSelectedCellIds: () => Array<string>;
236
250
  /**
237
- * Returns each selected range's values as a row-major grid.
251
+ * Returns each final positive selection region's values as a row-major grid.
238
252
  *
239
- * Indexed as `[rangeIndex][rowIndex][columnIndex]`. Serializing this to
253
+ * Indexed as `[regionIndex][rowIndex][columnIndex]`. Serializing this to
240
254
  * clipboard text is left to userland, since the delimiter, the null
241
255
  * representation, and any quoting rules are application decisions.
242
256
  */
@@ -257,7 +271,7 @@ interface Table_CellSelection<in out TFeatures extends TableFeatures, in out TDa
257
271
  */
258
272
  selectAllCells: () => void;
259
273
  /**
260
- * Selects a rectangle, replacing the current selection unless `additive`.
274
+ * Selects a rectangle using the requested replace/include/exclude mode.
261
275
  */
262
276
  selectCellRange: (range: CellSelectionRange, opts?: SelectCellRangeOptions) => void;
263
277
  /**
@@ -270,4 +284,4 @@ interface Table_CellSelection<in out TFeatures extends TableFeatures, in out TDa
270
284
  setFocusedCell: (rowId: string, columnId: string) => void;
271
285
  }
272
286
  //#endregion
273
- export { CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSelectionRange, CellSelectionState, Cell_CellSelection, ColumnDef_CellSelection, SelectCellRangeOptions, TableOptions_CellSelection, TableState_CellSelection, Table_CellSelection };
287
+ export { CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSelectionRange, CellSelectionRangeMode, CellSelectionRangeOperation, CellSelectionState, Cell_CellSelection, ColumnDef_CellSelection, SelectCellRangeOptions, TableOptions_CellSelection, TableState_CellSelection, Table_CellSelection };
@@ -3,7 +3,6 @@ import { CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSe
3
3
  import { Table } from "../../types/Table.js";
4
4
  import { Cell } from "../../types/Cell.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
-
7
6
  //#region src/features/cell-selection/cellSelectionFeature.utils.d.ts
8
7
  /**
9
8
  * Creates the default cell selection state.
@@ -70,7 +69,8 @@ declare function table_autoResetCellSelection<TFeatures extends TableFeatures, T
70
69
  */
71
70
  declare function table_getCellSelectionColumnIndexes<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Record<string, number>;
72
71
  /**
73
- * Resolves the selected ranges into inclusive display-order index rectangles.
72
+ * Resolves ordered range operations into disjoint, positive display-order
73
+ * index rectangles.
74
74
  *
75
75
  * This is the single cache every per-cell read goes through, so index lookups
76
76
  * happen once per invalidation rather than once per cell. A range whose corners
@@ -97,7 +97,7 @@ declare function table_getCellSelectionBounds<TFeatures extends TableFeatures, T
97
97
  */
98
98
  declare function cell_getCanSelect<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): boolean;
99
99
  /**
100
- * Checks whether this cell falls inside any selected range.
100
+ * Checks whether this cell falls inside the final positive selection.
101
101
  *
102
102
  * Deliberately not memoized. Registering this through `assignPrototypeAPIs`
103
103
  * with `memoDeps` would allocate a memo closure and dependency array per cell,
@@ -141,7 +141,7 @@ declare function cell_getTabIndex<TFeatures extends TableFeatures, TData extends
141
141
  */
142
142
  declare function cell_getSelectionEdges<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): CellSelectionEdges;
143
143
  /**
144
- * Returns the active cell, i.e. the anchor of the most recent range.
144
+ * Returns the active cell, i.e. the anchor of the most recent operation.
145
145
  *
146
146
  * Focus is derived rather than stored: in spreadsheet semantics, dragging from
147
147
  * A1 to C5 leaves the active cell at A1, so the active range's anchor already
@@ -163,11 +163,11 @@ declare function table_getFocusedCell<TFeatures extends TableFeatures, TData ext
163
163
  */
164
164
  declare function table_setFocusedCell<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, rowId: string, columnId: string): void;
165
165
  /**
166
- * Selects a rectangle, replacing the current selection unless `additive`.
166
+ * Selects a rectangle using replace, include, or exclude semantics.
167
167
  *
168
168
  * @example
169
169
  * ```ts
170
- * table_selectCellRange(table, range, { additive: true })
170
+ * table_selectCellRange(table, range, { mode: 'exclude' })
171
171
  * ```
172
172
  */
173
173
  declare function table_selectCellRange<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, range: CellSelectionRange, opts?: SelectCellRangeOptions): void;
@@ -214,7 +214,7 @@ declare function table_extendCellSelection<TFeatures extends TableFeatures, TDat
214
214
  */
215
215
  declare function table_getSelectedCellIds<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<string>;
216
216
  /**
217
- * Returns each selected range's values as a row-major grid.
217
+ * Returns each final positive region's values as a row-major grid.
218
218
  *
219
219
  * This is the raw material for clipboard export. Serializing it to text is left
220
220
  * to userland, since the delimiter, the null representation, and whether values
@@ -229,9 +229,8 @@ declare function table_getSelectedCellRangesData<TFeatures extends TableFeatures
229
229
  /**
230
230
  * Returns the number of selected cells.
231
231
  *
232
- * Uses rectangle arithmetic for a single range, which needs no expansion.
233
- * Multiple ranges are enumerated so overlapping cells are counted once. A
234
- * per-cell `enableCellSelection` predicate also requires enumeration.
232
+ * Uses rectangle arithmetic over the normalized, disjoint positive regions.
233
+ * A per-cell `enableCellSelection` predicate requires enumeration.
235
234
  *
236
235
  * @example
237
236
  * ```ts