@pretable/core 0.0.1 → 0.0.2

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/dist/index.d.cts CHANGED
@@ -1,7 +1,18 @@
1
- interface LayoutSpan {
1
+ /**
2
+ * Half-open row index range — `start` inclusive, `end` exclusive — used to
3
+ * describe the visible row window in {@link PretableGridSnapshot.visibleRange}.
4
+ *
5
+ * @public
6
+ */
7
+ interface PretableRowRange {
2
8
  start: number;
3
9
  end: number;
4
10
  }
11
+ /**
12
+ * Tuning knobs for column autosize calculations.
13
+ *
14
+ * @public
15
+ */
5
16
  interface AutosizeOptions {
6
17
  maxWidthPx?: number;
7
18
  minWidthPx?: number;
@@ -9,9 +20,24 @@ interface AutosizeOptions {
9
20
  cellPaddingPx?: number;
10
21
  }
11
22
 
12
- type GridCoreRow = Record<string, unknown>;
13
- type GridCoreSortDirection = "asc" | "desc" | null;
14
- interface GridCoreColumn<TRow extends GridCoreRow = GridCoreRow> {
23
+ /**
24
+ * Base row constraint — every row is at minimum a string-keyed record.
25
+ *
26
+ * @public
27
+ */
28
+ type PretableRow = Record<string, unknown>;
29
+ /**
30
+ * Sort direction — `null` means unsorted.
31
+ *
32
+ * @public
33
+ */
34
+ type PretableSortDirection = "asc" | "desc" | null;
35
+ /**
36
+ * Engine-level column definition. `@pretable/react` extends this with React-specific render fields.
37
+ *
38
+ * @public
39
+ */
40
+ interface PretableColumn<TRow extends PretableRow = PretableRow> {
15
41
  id: string;
16
42
  header?: string;
17
43
  wrap?: boolean;
@@ -19,82 +45,207 @@ interface GridCoreColumn<TRow extends GridCoreRow = GridCoreRow> {
19
45
  pinned?: "left";
20
46
  sortable?: boolean;
21
47
  filterable?: boolean;
22
- getValue?: (row: TRow) => unknown;
48
+ value?: (row: TRow) => unknown;
49
+ format?: (input: PretableFormatInput<TRow>) => string;
50
+ minWidthPx?: number;
51
+ maxWidthPx?: number;
52
+ resizable?: boolean;
53
+ reorderable?: boolean;
23
54
  }
24
- interface GridCoreOptions<TRow extends GridCoreRow = GridCoreRow> {
25
- columns: GridCoreColumn<TRow>[];
55
+ /**
56
+ * Input passed to a column's `format` function.
57
+ *
58
+ * @public
59
+ */
60
+ interface PretableFormatInput<TRow extends PretableRow = PretableRow> {
61
+ value: unknown;
62
+ row: TRow;
63
+ column: PretableColumn<TRow>;
64
+ }
65
+ /**
66
+ * Options accepted by `createGrid`.
67
+ *
68
+ * @public
69
+ */
70
+ interface PretableGridOptions<TRow extends PretableRow = PretableRow> {
71
+ columns: PretableColumn<TRow>[];
26
72
  rows: TRow[];
27
73
  getRowId?: (row: TRow, index: number) => string;
28
74
  autosize?: boolean | AutosizeOptions;
29
75
  }
30
- interface GridCoreSortState {
76
+ /**
77
+ * Active sort. `columnId` is null when no column is sorted.
78
+ *
79
+ * @public
80
+ */
81
+ interface PretableSortState {
31
82
  columnId: string | null;
32
- direction: GridCoreSortDirection;
83
+ direction: PretableSortDirection;
84
+ }
85
+ /**
86
+ * Cell address — the (rowId, columnId) pair that uniquely identifies a cell.
87
+ *
88
+ * @public
89
+ */
90
+ interface PretableCellAddress {
91
+ rowId: string;
92
+ columnId: string;
93
+ }
94
+ /**
95
+ * Inclusive cell range — both bounds (start and end) are inside the selection.
96
+ *
97
+ * @public
98
+ */
99
+ interface PretableCellRange {
100
+ startRowId: string;
101
+ endRowId: string;
102
+ startColumnId: string;
103
+ endColumnId: string;
33
104
  }
34
- interface GridCoreSelectionState {
35
- rowIds: string[];
36
- anchorRowId: string | null;
105
+ /**
106
+ * Cell-range selection state including the optional anchor for shift-extension.
107
+ *
108
+ * @public
109
+ */
110
+ interface PretableSelectionState {
111
+ ranges: PretableCellRange[];
112
+ anchor: PretableCellAddress | null;
37
113
  }
38
- interface GridCoreFocusState {
114
+ /**
115
+ * Currently focused cell — both fields are null when nothing is focused.
116
+ *
117
+ * @public
118
+ */
119
+ interface PretableFocusState {
39
120
  rowId: string | null;
40
121
  columnId: string | null;
41
122
  }
42
- interface GridCoreViewportState {
123
+ /**
124
+ * Viewport-level scroll + size state.
125
+ *
126
+ * @public
127
+ */
128
+ interface PretableViewportState {
43
129
  scrollTop: number;
44
130
  scrollLeft: number;
45
131
  height: number;
46
132
  width: number;
47
133
  }
48
- interface GridCoreTransaction<TRow extends GridCoreRow = GridCoreRow> {
134
+ /**
135
+ * Streaming transaction — incremental row mutations applied via `PretableGrid.applyTransaction`.
136
+ *
137
+ * @public
138
+ */
139
+ interface PretableTransaction<TRow extends PretableRow = PretableRow> {
49
140
  add?: TRow[];
50
141
  update?: Partial<TRow>[];
51
142
  remove?: string[];
52
143
  }
53
- interface GridCoreRowModel<TRow extends GridCoreRow = GridCoreRow> {
144
+ /**
145
+ * A row currently in the visible window — includes its source-array index for stable identity.
146
+ *
147
+ * @public
148
+ */
149
+ interface PretableVisibleRow<TRow extends PretableRow = PretableRow> {
54
150
  id: string;
55
151
  row: TRow;
56
152
  sourceIndex: number;
57
153
  }
58
- interface GridCoreSnapshot<TRow extends GridCoreRow = GridCoreRow> {
59
- viewport: GridCoreViewportState;
60
- sort: GridCoreSortState;
154
+ /**
155
+ * Read-only state observed via `PretableGrid.getSnapshot`.
156
+ *
157
+ * @public
158
+ */
159
+ interface PretableGridSnapshot<TRow extends PretableRow = PretableRow> {
160
+ viewport: PretableViewportState;
161
+ sort: PretableSortState;
61
162
  filters: Record<string, string>;
62
- selection: GridCoreSelectionState;
63
- focus: GridCoreFocusState;
163
+ selection: PretableSelectionState;
164
+ focus: PretableFocusState;
64
165
  totalRowCount: number;
65
- visibleRows: GridCoreRowModel<TRow>[];
66
- visibleRange: LayoutSpan;
166
+ visibleRows: PretableVisibleRow<TRow>[];
167
+ visibleRange: PretableRowRange;
67
168
  }
68
- interface GridCoreStore<TRow extends GridCoreRow = GridCoreRow> {
69
- options: GridCoreOptions<TRow>;
169
+ /**
170
+ * Direction passed to `PretableGrid.moveFocus`.
171
+ *
172
+ * @public
173
+ */
174
+ type PretableFocusDirection = "up" | "down" | "left" | "right";
175
+ /**
176
+ * Optional behavior modifiers for `PretableGrid.moveFocus`.
177
+ *
178
+ * @public
179
+ */
180
+ interface PretableMoveFocusOptions {
181
+ extend?: boolean;
182
+ jumpToEdge?: boolean;
183
+ byPage?: boolean;
184
+ }
185
+
186
+ /**
187
+ * Per-row selection state — "selected" means fully, "indeterminate" means partial.
188
+ *
189
+ * @public
190
+ */
191
+ type PretableRowSelectionTriState = "selected" | "indeterminate";
192
+
193
+ /**
194
+ * Public handle returned by {@link createGrid}. Exposes every action and
195
+ * observation pretable promises to support; does not extend the internal
196
+ * engine type, so private methods cannot leak through the public surface.
197
+ *
198
+ * @public
199
+ */
200
+ interface PretableGrid<TRow extends PretableRow = PretableRow> {
201
+ /** Discriminator — distinguishes `PretableGrid` from arbitrary objects. */
202
+ readonly kind: "pretable-grid";
203
+ /** The options the grid was constructed with. */
204
+ readonly options: PretableGridOptions<TRow>;
205
+ /** Subscribe to grid mutations. Returns an unsubscribe function. */
70
206
  subscribe(listener: () => void): () => void;
71
- getSnapshot(): GridCoreSnapshot<TRow>;
72
- setSort(columnId: string | null, direction: GridCoreSortDirection): void;
207
+ /** Read the current snapshot. Stable reference until the next mutation. */
208
+ getSnapshot(): PretableGridSnapshot<TRow>;
209
+ setSort(columnId: string | null, direction: PretableSortDirection): void;
73
210
  setFilter(columnId: string, value: string): void;
74
211
  clearFilters(): void;
75
212
  replaceFilters(nextFilters: Record<string, string>): void;
76
- selectRow(rowId: string | null): void;
77
- setFocus(rowId: string | null, columnId: string | null): void;
78
- moveFocus(delta: number): void;
79
- setViewport(viewport: GridCoreViewportState): void;
80
- autosizeColumns(autosizeOptions?: AutosizeOptions): void;
81
- applyTransaction(transaction: GridCoreTransaction<TRow>): void;
82
- }
83
-
84
- type PretableRow = Record<string, unknown>;
85
-
86
- type PretableColumn<TRow extends PretableRow = PretableRow> = GridCoreColumn<TRow>;
87
- type PretableGridOptions<TRow extends PretableRow = PretableRow> = GridCoreOptions<TRow>;
88
- type PretableTransaction<TRow extends PretableRow = PretableRow> = GridCoreTransaction<TRow>;
89
- interface PretableGrid<TRow extends PretableRow = PretableRow> extends Omit<GridCoreStore<TRow>, "options"> {
90
- kind: "pretable-grid";
91
- options: PretableGridOptions<TRow>;
92
- getSnapshot(): GridCoreSnapshot<TRow>;
93
- setSort(columnId: string | null, direction: GridCoreSortDirection): void;
213
+ setSelection(state: PretableSelectionState): void;
214
+ selectAll(): void;
215
+ clearSelection(): void;
216
+ addRange(range: PretableCellRange): void;
217
+ extendRangeFromAnchor(addr: PretableCellAddress): void;
218
+ toggleRowSelection(rowId: string): void;
219
+ setSelectAllVisible(checked: boolean): void;
220
+ setFocus(addr: PretableCellAddress | null): void;
221
+ moveFocus(direction: PretableFocusDirection, options?: PretableMoveFocusOptions): void;
222
+ setViewport(viewport: PretableViewportState): void;
94
223
  autosizeColumns(options?: AutosizeOptions): void;
224
+ setColumnWidth(columnId: string, width: number): void;
225
+ moveColumn(columnId: string, toIndex: number): void;
226
+ setColumnPinned(columnId: string, pinned: "left" | null): void;
227
+ autosizeColumn(columnId: string, options?: AutosizeOptions): void;
228
+ resetColumnLayout(): void;
229
+ mergeColumnsFromProps(nextColumns: PretableColumn<TRow>[]): void;
95
230
  applyTransaction(transaction: PretableTransaction<TRow>): void;
96
231
  }
97
232
 
98
- declare function createGrid<TRow extends Record<string, unknown>>(options: PretableGridOptions<TRow>): PretableGrid<TRow>;
233
+ /**
234
+ * Create a pretable grid instance. Returns a {@link PretableGrid} handle
235
+ * that exposes every action and observation pretable supports.
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * const grid = createGrid({
240
+ * columns: [{ id: "name" }, { id: "age" }],
241
+ * rows: [{ id: "1", name: "Ada", age: 36 }],
242
+ * });
243
+ * grid.setSort("age", "desc");
244
+ * const snapshot = grid.getSnapshot();
245
+ * ```
246
+ *
247
+ * @public
248
+ */
249
+ declare function createGrid<TRow extends PretableRow = PretableRow>(options: PretableGridOptions<TRow>): PretableGrid<TRow>;
99
250
 
100
- export { type AutosizeOptions, type PretableColumn, type GridCoreFocusState as PretableFocusState, type PretableGrid, type PretableGridOptions, type GridCoreSnapshot as PretableGridSnapshot, type PretableRow, type GridCoreSelectionState as PretableSelectionState, type GridCoreSortDirection as PretableSortDirection, type GridCoreSortState as PretableSortState, type PretableTransaction, type GridCoreViewportState as PretableViewportState, type GridCoreRowModel as PretableVisibleRow, createGrid };
251
+ export { type AutosizeOptions, type PretableCellAddress, type PretableCellRange, type PretableColumn, type PretableFocusDirection, type PretableFocusState, type PretableFormatInput, type PretableGrid, type PretableGridOptions, type PretableGridSnapshot, type PretableMoveFocusOptions, type PretableRow, type PretableRowRange, type PretableRowSelectionTriState, type PretableSelectionState, type PretableSortDirection, type PretableSortState, type PretableTransaction, type PretableViewportState, type PretableVisibleRow, createGrid };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,18 @@
1
- interface LayoutSpan {
1
+ /**
2
+ * Half-open row index range — `start` inclusive, `end` exclusive — used to
3
+ * describe the visible row window in {@link PretableGridSnapshot.visibleRange}.
4
+ *
5
+ * @public
6
+ */
7
+ interface PretableRowRange {
2
8
  start: number;
3
9
  end: number;
4
10
  }
11
+ /**
12
+ * Tuning knobs for column autosize calculations.
13
+ *
14
+ * @public
15
+ */
5
16
  interface AutosizeOptions {
6
17
  maxWidthPx?: number;
7
18
  minWidthPx?: number;
@@ -9,9 +20,24 @@ interface AutosizeOptions {
9
20
  cellPaddingPx?: number;
10
21
  }
11
22
 
12
- type GridCoreRow = Record<string, unknown>;
13
- type GridCoreSortDirection = "asc" | "desc" | null;
14
- interface GridCoreColumn<TRow extends GridCoreRow = GridCoreRow> {
23
+ /**
24
+ * Base row constraint — every row is at minimum a string-keyed record.
25
+ *
26
+ * @public
27
+ */
28
+ type PretableRow = Record<string, unknown>;
29
+ /**
30
+ * Sort direction — `null` means unsorted.
31
+ *
32
+ * @public
33
+ */
34
+ type PretableSortDirection = "asc" | "desc" | null;
35
+ /**
36
+ * Engine-level column definition. `@pretable/react` extends this with React-specific render fields.
37
+ *
38
+ * @public
39
+ */
40
+ interface PretableColumn<TRow extends PretableRow = PretableRow> {
15
41
  id: string;
16
42
  header?: string;
17
43
  wrap?: boolean;
@@ -19,82 +45,207 @@ interface GridCoreColumn<TRow extends GridCoreRow = GridCoreRow> {
19
45
  pinned?: "left";
20
46
  sortable?: boolean;
21
47
  filterable?: boolean;
22
- getValue?: (row: TRow) => unknown;
48
+ value?: (row: TRow) => unknown;
49
+ format?: (input: PretableFormatInput<TRow>) => string;
50
+ minWidthPx?: number;
51
+ maxWidthPx?: number;
52
+ resizable?: boolean;
53
+ reorderable?: boolean;
23
54
  }
24
- interface GridCoreOptions<TRow extends GridCoreRow = GridCoreRow> {
25
- columns: GridCoreColumn<TRow>[];
55
+ /**
56
+ * Input passed to a column's `format` function.
57
+ *
58
+ * @public
59
+ */
60
+ interface PretableFormatInput<TRow extends PretableRow = PretableRow> {
61
+ value: unknown;
62
+ row: TRow;
63
+ column: PretableColumn<TRow>;
64
+ }
65
+ /**
66
+ * Options accepted by `createGrid`.
67
+ *
68
+ * @public
69
+ */
70
+ interface PretableGridOptions<TRow extends PretableRow = PretableRow> {
71
+ columns: PretableColumn<TRow>[];
26
72
  rows: TRow[];
27
73
  getRowId?: (row: TRow, index: number) => string;
28
74
  autosize?: boolean | AutosizeOptions;
29
75
  }
30
- interface GridCoreSortState {
76
+ /**
77
+ * Active sort. `columnId` is null when no column is sorted.
78
+ *
79
+ * @public
80
+ */
81
+ interface PretableSortState {
31
82
  columnId: string | null;
32
- direction: GridCoreSortDirection;
83
+ direction: PretableSortDirection;
84
+ }
85
+ /**
86
+ * Cell address — the (rowId, columnId) pair that uniquely identifies a cell.
87
+ *
88
+ * @public
89
+ */
90
+ interface PretableCellAddress {
91
+ rowId: string;
92
+ columnId: string;
93
+ }
94
+ /**
95
+ * Inclusive cell range — both bounds (start and end) are inside the selection.
96
+ *
97
+ * @public
98
+ */
99
+ interface PretableCellRange {
100
+ startRowId: string;
101
+ endRowId: string;
102
+ startColumnId: string;
103
+ endColumnId: string;
33
104
  }
34
- interface GridCoreSelectionState {
35
- rowIds: string[];
36
- anchorRowId: string | null;
105
+ /**
106
+ * Cell-range selection state including the optional anchor for shift-extension.
107
+ *
108
+ * @public
109
+ */
110
+ interface PretableSelectionState {
111
+ ranges: PretableCellRange[];
112
+ anchor: PretableCellAddress | null;
37
113
  }
38
- interface GridCoreFocusState {
114
+ /**
115
+ * Currently focused cell — both fields are null when nothing is focused.
116
+ *
117
+ * @public
118
+ */
119
+ interface PretableFocusState {
39
120
  rowId: string | null;
40
121
  columnId: string | null;
41
122
  }
42
- interface GridCoreViewportState {
123
+ /**
124
+ * Viewport-level scroll + size state.
125
+ *
126
+ * @public
127
+ */
128
+ interface PretableViewportState {
43
129
  scrollTop: number;
44
130
  scrollLeft: number;
45
131
  height: number;
46
132
  width: number;
47
133
  }
48
- interface GridCoreTransaction<TRow extends GridCoreRow = GridCoreRow> {
134
+ /**
135
+ * Streaming transaction — incremental row mutations applied via `PretableGrid.applyTransaction`.
136
+ *
137
+ * @public
138
+ */
139
+ interface PretableTransaction<TRow extends PretableRow = PretableRow> {
49
140
  add?: TRow[];
50
141
  update?: Partial<TRow>[];
51
142
  remove?: string[];
52
143
  }
53
- interface GridCoreRowModel<TRow extends GridCoreRow = GridCoreRow> {
144
+ /**
145
+ * A row currently in the visible window — includes its source-array index for stable identity.
146
+ *
147
+ * @public
148
+ */
149
+ interface PretableVisibleRow<TRow extends PretableRow = PretableRow> {
54
150
  id: string;
55
151
  row: TRow;
56
152
  sourceIndex: number;
57
153
  }
58
- interface GridCoreSnapshot<TRow extends GridCoreRow = GridCoreRow> {
59
- viewport: GridCoreViewportState;
60
- sort: GridCoreSortState;
154
+ /**
155
+ * Read-only state observed via `PretableGrid.getSnapshot`.
156
+ *
157
+ * @public
158
+ */
159
+ interface PretableGridSnapshot<TRow extends PretableRow = PretableRow> {
160
+ viewport: PretableViewportState;
161
+ sort: PretableSortState;
61
162
  filters: Record<string, string>;
62
- selection: GridCoreSelectionState;
63
- focus: GridCoreFocusState;
163
+ selection: PretableSelectionState;
164
+ focus: PretableFocusState;
64
165
  totalRowCount: number;
65
- visibleRows: GridCoreRowModel<TRow>[];
66
- visibleRange: LayoutSpan;
166
+ visibleRows: PretableVisibleRow<TRow>[];
167
+ visibleRange: PretableRowRange;
67
168
  }
68
- interface GridCoreStore<TRow extends GridCoreRow = GridCoreRow> {
69
- options: GridCoreOptions<TRow>;
169
+ /**
170
+ * Direction passed to `PretableGrid.moveFocus`.
171
+ *
172
+ * @public
173
+ */
174
+ type PretableFocusDirection = "up" | "down" | "left" | "right";
175
+ /**
176
+ * Optional behavior modifiers for `PretableGrid.moveFocus`.
177
+ *
178
+ * @public
179
+ */
180
+ interface PretableMoveFocusOptions {
181
+ extend?: boolean;
182
+ jumpToEdge?: boolean;
183
+ byPage?: boolean;
184
+ }
185
+
186
+ /**
187
+ * Per-row selection state — "selected" means fully, "indeterminate" means partial.
188
+ *
189
+ * @public
190
+ */
191
+ type PretableRowSelectionTriState = "selected" | "indeterminate";
192
+
193
+ /**
194
+ * Public handle returned by {@link createGrid}. Exposes every action and
195
+ * observation pretable promises to support; does not extend the internal
196
+ * engine type, so private methods cannot leak through the public surface.
197
+ *
198
+ * @public
199
+ */
200
+ interface PretableGrid<TRow extends PretableRow = PretableRow> {
201
+ /** Discriminator — distinguishes `PretableGrid` from arbitrary objects. */
202
+ readonly kind: "pretable-grid";
203
+ /** The options the grid was constructed with. */
204
+ readonly options: PretableGridOptions<TRow>;
205
+ /** Subscribe to grid mutations. Returns an unsubscribe function. */
70
206
  subscribe(listener: () => void): () => void;
71
- getSnapshot(): GridCoreSnapshot<TRow>;
72
- setSort(columnId: string | null, direction: GridCoreSortDirection): void;
207
+ /** Read the current snapshot. Stable reference until the next mutation. */
208
+ getSnapshot(): PretableGridSnapshot<TRow>;
209
+ setSort(columnId: string | null, direction: PretableSortDirection): void;
73
210
  setFilter(columnId: string, value: string): void;
74
211
  clearFilters(): void;
75
212
  replaceFilters(nextFilters: Record<string, string>): void;
76
- selectRow(rowId: string | null): void;
77
- setFocus(rowId: string | null, columnId: string | null): void;
78
- moveFocus(delta: number): void;
79
- setViewport(viewport: GridCoreViewportState): void;
80
- autosizeColumns(autosizeOptions?: AutosizeOptions): void;
81
- applyTransaction(transaction: GridCoreTransaction<TRow>): void;
82
- }
83
-
84
- type PretableRow = Record<string, unknown>;
85
-
86
- type PretableColumn<TRow extends PretableRow = PretableRow> = GridCoreColumn<TRow>;
87
- type PretableGridOptions<TRow extends PretableRow = PretableRow> = GridCoreOptions<TRow>;
88
- type PretableTransaction<TRow extends PretableRow = PretableRow> = GridCoreTransaction<TRow>;
89
- interface PretableGrid<TRow extends PretableRow = PretableRow> extends Omit<GridCoreStore<TRow>, "options"> {
90
- kind: "pretable-grid";
91
- options: PretableGridOptions<TRow>;
92
- getSnapshot(): GridCoreSnapshot<TRow>;
93
- setSort(columnId: string | null, direction: GridCoreSortDirection): void;
213
+ setSelection(state: PretableSelectionState): void;
214
+ selectAll(): void;
215
+ clearSelection(): void;
216
+ addRange(range: PretableCellRange): void;
217
+ extendRangeFromAnchor(addr: PretableCellAddress): void;
218
+ toggleRowSelection(rowId: string): void;
219
+ setSelectAllVisible(checked: boolean): void;
220
+ setFocus(addr: PretableCellAddress | null): void;
221
+ moveFocus(direction: PretableFocusDirection, options?: PretableMoveFocusOptions): void;
222
+ setViewport(viewport: PretableViewportState): void;
94
223
  autosizeColumns(options?: AutosizeOptions): void;
224
+ setColumnWidth(columnId: string, width: number): void;
225
+ moveColumn(columnId: string, toIndex: number): void;
226
+ setColumnPinned(columnId: string, pinned: "left" | null): void;
227
+ autosizeColumn(columnId: string, options?: AutosizeOptions): void;
228
+ resetColumnLayout(): void;
229
+ mergeColumnsFromProps(nextColumns: PretableColumn<TRow>[]): void;
95
230
  applyTransaction(transaction: PretableTransaction<TRow>): void;
96
231
  }
97
232
 
98
- declare function createGrid<TRow extends Record<string, unknown>>(options: PretableGridOptions<TRow>): PretableGrid<TRow>;
233
+ /**
234
+ * Create a pretable grid instance. Returns a {@link PretableGrid} handle
235
+ * that exposes every action and observation pretable supports.
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * const grid = createGrid({
240
+ * columns: [{ id: "name" }, { id: "age" }],
241
+ * rows: [{ id: "1", name: "Ada", age: 36 }],
242
+ * });
243
+ * grid.setSort("age", "desc");
244
+ * const snapshot = grid.getSnapshot();
245
+ * ```
246
+ *
247
+ * @public
248
+ */
249
+ declare function createGrid<TRow extends PretableRow = PretableRow>(options: PretableGridOptions<TRow>): PretableGrid<TRow>;
99
250
 
100
- export { type AutosizeOptions, type PretableColumn, type GridCoreFocusState as PretableFocusState, type PretableGrid, type PretableGridOptions, type GridCoreSnapshot as PretableGridSnapshot, type PretableRow, type GridCoreSelectionState as PretableSelectionState, type GridCoreSortDirection as PretableSortDirection, type GridCoreSortState as PretableSortState, type PretableTransaction, type GridCoreViewportState as PretableViewportState, type GridCoreRowModel as PretableVisibleRow, createGrid };
251
+ export { type AutosizeOptions, type PretableCellAddress, type PretableCellRange, type PretableColumn, type PretableFocusDirection, type PretableFocusState, type PretableFormatInput, type PretableGrid, type PretableGridOptions, type PretableGridSnapshot, type PretableMoveFocusOptions, type PretableRow, type PretableRowRange, type PretableRowSelectionTriState, type PretableSelectionState, type PretableSortDirection, type PretableSortState, type PretableTransaction, type PretableViewportState, type PretableVisibleRow, createGrid };