foldkit-data-grid 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2228 @@
1
+ import { a as CellEditor, c as ColumnId, d as EditValue, f as EditableId, i as addressableRows, l as ColumnSpec, n as RowModel, o as Column, r as RowStatus, s as ColumnEdit, t as RowCount, u as Columns } from "./rows-Dz9f6hWJ.mjs";
2
+ import { Option, Schema } from "effect";
3
+ import { Bundle } from "foldkit-bundle";
4
+ import * as Mount from "foldkit/mount";
5
+ import { KeyboardModifiers } from "foldkit/html";
6
+ import { Command } from "foldkit/command";
7
+ //#region src/layout.d.ts
8
+ /**
9
+ * Where each column stands: the start, center and end regions in display
10
+ * order, and which columns are hidden. Hiding keeps a column's place, so
11
+ * showing it again puts it back where it was. The grid owns this state; it
12
+ * holds column ids only, so it can be saved and restored.
13
+ */
14
+ export interface ColumnLayout<Id extends string> {
15
+ /** Pinned to the start edge, outside horizontal scrolling. */
16
+ readonly start: ReadonlyArray<Id>;
17
+ readonly center: ReadonlyArray<Id>;
18
+ /** Pinned to the end edge, outside horizontal scrolling. */
19
+ readonly end: ReadonlyArray<Id>;
20
+ readonly hidden: ReadonlyArray<Id>;
21
+ }
22
+ export declare const ColumnLayout: {
23
+ /** The layout the columns declare: definition order, each in its `pinned` region. */
24
+ initial: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(columns: Columns<Row, Specs>) => ColumnLayout<keyof Specs & string>;
25
+ };
26
+ //#endregion
27
+ //#region src/projection.d.ts
28
+ /** A cell named by identity, so it stays the same cell through a sort or a reorder. */
29
+ export interface CellAddress<Id extends string> {
30
+ readonly row: string;
31
+ readonly column: Id;
32
+ }
33
+ export declare const CellAddress: {
34
+ /**
35
+ * An address as stored or sent: the row key as text, and the column as one
36
+ * of these columns' ids, so a saved address naming a removed column fails
37
+ * to decode instead of naming nothing.
38
+ */
39
+ schema: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(columns: Columns<Row, Specs>) => Schema.Struct<{
40
+ readonly row: Schema.String;
41
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
42
+ }>;
43
+ };
44
+ /** Where a cell is drawn now: its row index, and its column's index in display order. */
45
+ interface CellPosition {
46
+ readonly row: number;
47
+ readonly column: number;
48
+ }
49
+ /** A rectangle of cells: row indexes `[start, end)` and the columns it spans, in display order. */
50
+ interface CellBox<Id extends string> {
51
+ readonly rows: {
52
+ readonly start: number;
53
+ readonly end: number;
54
+ };
55
+ readonly columns: ReadonlyArray<Id>;
56
+ }
57
+ interface CellOffset {
58
+ readonly rows?: number;
59
+ readonly columns?: number;
60
+ }
61
+ /**
62
+ * The grid as presented: rows in the application's order, crossed with the
63
+ * visible columns in display order. It is the one source of geometry for
64
+ * focus, selection, virtualization and the clipboard; none of them reads
65
+ * positions from the DOM. A pure value, cheap to rebuild: it reads the
66
+ * column layout once and asks the row model for rows only on lookup.
67
+ *
68
+ * Every lookup is an `Option`. A cell is absent when its column is hidden,
69
+ * its row is gone, or its row is in range but not loaded yet.
70
+ */
71
+ export interface GridProjection<Row, Id extends string> {
72
+ readonly rows: RowModel<Row>;
73
+ readonly rowCount: RowCount;
74
+ /** Visible columns in display order: the start region, the center, the end. */
75
+ readonly columns: ReadonlyArray<Id>;
76
+ /** The visible columns of each region, in display order. */
77
+ readonly start: ReadonlyArray<Id>;
78
+ readonly center: ReadonlyArray<Id>;
79
+ readonly end: ReadonlyArray<Id>;
80
+ columnIndex(id: Id): Option.Option<number>;
81
+ rowIndex(key: string): Option.Option<number>;
82
+ cellAt(position: CellPosition): Option.Option<CellAddress<Id>>;
83
+ positionOf(address: CellAddress<Id>): Option.Option<CellPosition>;
84
+ /**
85
+ * The cell `offset` away, stopping at the grid's edges. A fractional offset
86
+ * (a page of rows worked out from a height) drops its fraction.
87
+ */
88
+ moveBy(address: CellAddress<Id>, offset: CellOffset): Option.Option<CellAddress<Id>>;
89
+ rowStart(address: CellAddress<Id>): Option.Option<CellAddress<Id>>;
90
+ rowEnd(address: CellAddress<Id>): Option.Option<CellAddress<Id>>;
91
+ first(): Option.Option<CellAddress<Id>>;
92
+ last(): Option.Option<CellAddress<Id>>;
93
+ /** The rectangle two cells span, in either order. */
94
+ box(anchor: CellAddress<Id>, focus: CellAddress<Id>): Option.Option<CellBox<Id>>;
95
+ }
96
+ interface ProjectionOptions<Row, Specs extends Record<string, ColumnSpec<Row, unknown>>> {
97
+ readonly rows: RowModel<Row>;
98
+ readonly columns: Columns<Row, Specs>;
99
+ readonly layout: ColumnLayout<keyof Specs & string>;
100
+ }
101
+ export declare const GridProjection: {
102
+ /**
103
+ * Projects rows through a column layout. A layout saved before a column
104
+ * was added does not mention it, so the column joins the center region in
105
+ * definition order; an id the columns do not define, or one named twice,
106
+ * keeps only its first place.
107
+ */
108
+ make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(options: ProjectionOptions<Row, Specs>) => GridProjection<Row, keyof Specs & string>;
109
+ };
110
+ //#endregion
111
+ //#region src/clipboard.d.ts
112
+ /** One cell's text in a paste, by identity: what the grid hands the application. */
113
+ interface CellText<Id extends string> {
114
+ readonly row: string;
115
+ readonly column: Id;
116
+ readonly text: string;
117
+ }
118
+ /** A pasted cell, with the text it showed before, so an unchanged one is no edit. */
119
+ interface PastedCell<Id extends string> extends CellText<Id> {
120
+ readonly from: string;
121
+ }
122
+ export declare const Clipboard: {
123
+ toTsv: (rows: ReadonlyArray<ReadonlyArray<string>>) => string;
124
+ parseTsv: (text: string) => ReadonlyArray<ReadonlyArray<string>>;
125
+ copy: <Row, Id extends string>(projection: GridProjection<Row, Id>, box: CellBox<Id>, textOf: (address: CellAddress<Id>) => string) => string;
126
+ pasteAt: <Row, Id extends string>(projection: GridProjection<Row, Id>, anchor: CellAddress<Id>, matrix: ReadonlyArray<ReadonlyArray<string>>, cells: {
127
+ readonly editable: (column: Id) => boolean;
128
+ readonly from: (address: CellAddress<Id>) => string;
129
+ }) => ReadonlyArray<PastedCell<Id>>;
130
+ };
131
+ //#endregion
132
+ //#region src/fill.d.ts
133
+ /** A fill: the range whose cells are carried on, and the cell it was carried to. */
134
+ interface FillRequest<Id extends string> {
135
+ readonly source: {
136
+ readonly anchor: CellAddress<Id>;
137
+ readonly focus: CellAddress<Id>;
138
+ };
139
+ readonly to: CellAddress<Id>;
140
+ }
141
+ /**
142
+ * Where a fill lands: the source's box, and the box it fills beyond it, down,
143
+ * up, right or left, whichever way `to` lies further outside the source. A
144
+ * fill carries on along one axis only, as spreadsheets do.
145
+ */
146
+ interface FillPlan<Id extends string> {
147
+ readonly source: CellBox<Id>;
148
+ readonly target: CellBox<Id>;
149
+ /** Rows (`down`/`up`) or columns (`right`/`left`), away from the source. */
150
+ readonly toward: 'down' | 'up' | 'right' | 'left';
151
+ }
152
+ export declare const Fill: {
153
+ series: (source: ReadonlyArray<string>, count: number, backward: boolean) => ReadonlyArray<string>;
154
+ plan: <Row, Id extends string>(projection: GridProjection<Row, Id>, request: FillRequest<Id>) => Option.Option<FillPlan<Id>>;
155
+ cells: <Row, Id extends string>(projection: GridProjection<Row, Id>, fill: FillPlan<Id>, options: {
156
+ readonly editable: (column: Id) => boolean;
157
+ readonly from: (address: CellAddress<Id>) => string;
158
+ }) => ReadonlyArray<PastedCell<Id>>;
159
+ };
160
+ //#endregion
161
+ //#region src/columnState.d.ts
162
+ type Region = 'start' | 'center' | 'end';
163
+ /**
164
+ * Where each column stands and how wide the resized ones are. Widths list only
165
+ * the columns resized; the rest take their spec's. The grid owns it, and it is
166
+ * plain data, so an application can save it and restore it.
167
+ */
168
+ export interface ColumnState<Id extends string> extends ColumnLayout<Id> {
169
+ readonly widths: ReadonlyArray<{
170
+ readonly column: Id;
171
+ readonly width: number;
172
+ }>;
173
+ }
174
+ /** What `restore` made of a saved state: the state, and the ids it had to drop. */
175
+ interface Restored<Id extends string> {
176
+ readonly state: ColumnState<Id>;
177
+ /** Ids the saved state named that these columns do not define, or named twice. */
178
+ readonly dropped: ReadonlyArray<string>;
179
+ }
180
+ export declare const ColumnState: {
181
+ make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(columns: Columns<Row, Specs>) => {
182
+ Model: Schema.Struct<{
183
+ readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
184
+ readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
185
+ readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
186
+ readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
187
+ readonly widths: Schema.$Array<Schema.Struct<{
188
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
189
+ readonly width: Schema.Number;
190
+ }>>;
191
+ }>;
192
+ initial: () => ColumnState<keyof Specs & string>;
193
+ widthOf: (state: ColumnState<keyof Specs & string>) => ((id: keyof Specs & string) => number);
194
+ regionOf: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => Region;
195
+ resize: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, width: number) => ColumnState<keyof Specs & string>;
196
+ hide: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
197
+ show: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
198
+ move: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, region: Region, index: number) => ColumnState<keyof Specs & string>;
199
+ dropAt: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, delta: number) => number;
200
+ restore: (saved: unknown) => Restored<keyof Specs & string>;
201
+ };
202
+ };
203
+ //#endregion
204
+ //#region src/virtual.d.ts
205
+ /** The scroll container's offsets and size, in pixels. */
206
+ interface Viewport {
207
+ readonly top: number;
208
+ readonly left: number;
209
+ readonly width: number;
210
+ readonly height: number;
211
+ }
212
+ /** Rendered items `[start, end)` on one axis, with the space the rest take before and after. */
213
+ interface AxisWindow {
214
+ readonly start: number;
215
+ readonly end: number;
216
+ readonly before: number;
217
+ readonly after: number;
218
+ }
219
+ interface GridWindow<Id extends string> {
220
+ /** Row indexes to render; every row is `rowHeight` tall. */
221
+ readonly rows: AxisWindow;
222
+ /** Center columns to render, as indexes into `projection.center`. */
223
+ readonly center: AxisWindow;
224
+ /** The center columns in that window, in display order. */
225
+ readonly centerColumns: ReadonlyArray<Id>;
226
+ /** Pinned columns are always rendered: they never scroll horizontally. */
227
+ readonly start: ReadonlyArray<Id>;
228
+ readonly end: ReadonlyArray<Id>;
229
+ /** The scrollable content's full size. */
230
+ readonly width: number;
231
+ readonly height: number;
232
+ }
233
+ interface Geometry<Row, Id extends string> {
234
+ readonly projection: GridProjection<Row, Id>;
235
+ readonly rowHeight: number;
236
+ /** Width of each visible column. */
237
+ readonly width: (column: NoInfer<Id>) => number;
238
+ /** Height of the header rows inside the scroll container, above the body. */
239
+ readonly headerHeight?: number;
240
+ }
241
+ interface WindowOptions<Row, Id extends string> extends Geometry<Row, Id> {
242
+ readonly viewport: Viewport;
243
+ /** Extra rows and columns rendered beyond each edge, so a fast scroll shows no gap. */
244
+ readonly overscan?: {
245
+ readonly rows?: number;
246
+ readonly columns?: number;
247
+ };
248
+ }
249
+ interface RevealOptions<Row, Id extends string> extends Geometry<Row, Id> {
250
+ readonly viewport: Viewport;
251
+ readonly position: CellPosition;
252
+ }
253
+ export declare const VirtualGrid: {
254
+ window: <Row, Id extends string>(options: WindowOptions<Row, Id>) => GridWindow<Id>;
255
+ reveal: <Row, Id extends string>(options: RevealOptions<Row, Id>) => Option.Option<{
256
+ readonly top: number;
257
+ readonly left: number;
258
+ }>;
259
+ };
260
+ //#endregion
261
+ //#region src/grid.d.ts
262
+ /**
263
+ * One grid's interaction state: focus, the viewport and the column state, as
264
+ * one Bundle. Its update is the parts' own, joined: a key that moves focus
265
+ * off screen carries the scroll that reveals the cell, and the grid issues it.
266
+ *
267
+ * `id` names the grid in the DOM: the scroll container's id, and the prefix
268
+ * of every cell's id (`GridFocus.cellId`). Selection is opt-in:
269
+ * `rowSelection` lets rows be selected one at a time or several, and
270
+ * `cellSelection` lets a rectangle of cells be selected; without them their
271
+ * Messages change nothing.
272
+ */
273
+ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(options: {
274
+ readonly id: string;
275
+ readonly columns: Columns<Row, Specs>;
276
+ readonly rowSelection?: "single" | "multiple";
277
+ readonly cellSelection?: boolean;
278
+ }) => {
279
+ id: string;
280
+ matchEdit: <const Handlers extends { readonly [K in EditableId<Specs>]: (edited: {
281
+ readonly row: string;
282
+ readonly value: EditValue<Specs[K]>;
283
+ }) => unknown; }>(cell: {
284
+ readonly row: string;
285
+ readonly column: keyof Specs & string;
286
+ readonly text: string;
287
+ }, handlers: Handlers & { readonly [K in Exclude<keyof Handlers, EditableId<Specs>>]: never; }) => ReturnType<Handlers[EditableId<Specs>]>;
288
+ editorFor: (column: keyof Specs & string) => Option.Option<CellEditor>;
289
+ MenuItem: import("foldkit/schema").TaggedUnion<{
290
+ readonly Pin: {
291
+ readonly region: Schema.Literals<readonly ["start", "center", "end"]>;
292
+ };
293
+ readonly Hide: {};
294
+ readonly Show: {
295
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
296
+ };
297
+ }>;
298
+ menuItems: (state: {
299
+ readonly start: readonly (keyof Specs & string)[];
300
+ readonly center: readonly (keyof Specs & string)[];
301
+ readonly end: readonly (keyof Specs & string)[];
302
+ readonly hidden: readonly (keyof Specs & string)[];
303
+ readonly widths: readonly {
304
+ readonly column: keyof Specs & string;
305
+ readonly width: number;
306
+ }[];
307
+ }, column: keyof Specs & string) => ReadonlyArray<{
308
+ readonly _tag: "Pin";
309
+ readonly region: "start" | "center" | "end";
310
+ } | {
311
+ readonly _tag: "Hide";
312
+ } | {
313
+ readonly _tag: "Show";
314
+ readonly column: keyof Specs & string;
315
+ }>;
316
+ columns: Columns<Row, Specs>;
317
+ rowSelection: "single" | "multiple" | undefined;
318
+ cellSelection: boolean;
319
+ focus: {
320
+ Address: Schema.Struct<{
321
+ readonly row: Schema.String;
322
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
323
+ }>;
324
+ Model: Schema.Struct<{
325
+ readonly current: Schema.OptionFromNullOr<Schema.Struct<{
326
+ readonly row: Schema.String;
327
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
328
+ }>>;
329
+ readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
330
+ }>;
331
+ Message: import("foldkit/message").MessageUnion<{
332
+ readonly Focused: {
333
+ readonly address: Schema.Struct<{
334
+ readonly row: Schema.String;
335
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
336
+ }>;
337
+ };
338
+ readonly HeaderFocused: {
339
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
340
+ };
341
+ }>;
342
+ bundle: Bundle.Bundle<"GridFocus", void, {
343
+ readonly current: Option.Option<{
344
+ readonly row: string;
345
+ readonly column: keyof Specs & string;
346
+ }>;
347
+ readonly header: Option.Option<keyof Specs & string>;
348
+ }, {
349
+ readonly _tag: "Focused";
350
+ readonly address: {
351
+ readonly row: string;
352
+ readonly column: keyof Specs & string;
353
+ };
354
+ } | {
355
+ readonly _tag: "HeaderFocused";
356
+ readonly column: keyof Specs & string;
357
+ }, never, never, never, void, {}, {}>;
358
+ };
359
+ columnState: {
360
+ Model: Schema.Struct<{
361
+ readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
362
+ readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
363
+ readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
364
+ readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
365
+ readonly widths: Schema.$Array<Schema.Struct<{
366
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
367
+ readonly width: Schema.Number;
368
+ }>>;
369
+ }>;
370
+ initial: () => ColumnState<keyof Specs & string>;
371
+ widthOf: (state: ColumnState<keyof Specs & string>) => (id: keyof Specs & string) => number;
372
+ regionOf: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => Region;
373
+ resize: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, width: number) => ColumnState<keyof Specs & string>;
374
+ hide: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
375
+ show: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
376
+ move: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, region: Region, index: number) => ColumnState<keyof Specs & string>;
377
+ dropAt: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, delta: number) => number;
378
+ restore: (saved: unknown) => Restored<keyof Specs & string>;
379
+ };
380
+ project: (rows: RowModel<Row>, state: {
381
+ readonly start: readonly (keyof Specs & string)[];
382
+ readonly center: readonly (keyof Specs & string)[];
383
+ readonly end: readonly (keyof Specs & string)[];
384
+ readonly hidden: readonly (keyof Specs & string)[];
385
+ readonly widths: readonly {
386
+ readonly column: keyof Specs & string;
387
+ readonly width: number;
388
+ }[];
389
+ }) => GridProjection<Row, keyof Specs & string>;
390
+ window: (input: {
391
+ readonly rows: RowModel<Row>;
392
+ readonly state: {
393
+ readonly viewport: Viewport;
394
+ readonly columns: {
395
+ readonly start: readonly (keyof Specs & string)[];
396
+ readonly center: readonly (keyof Specs & string)[];
397
+ readonly end: readonly (keyof Specs & string)[];
398
+ readonly hidden: readonly (keyof Specs & string)[];
399
+ readonly widths: readonly {
400
+ readonly column: keyof Specs & string;
401
+ readonly width: number;
402
+ }[];
403
+ };
404
+ };
405
+ readonly rowHeight: number;
406
+ readonly headerHeight: number;
407
+ readonly overscan?: {
408
+ readonly rows?: number;
409
+ readonly columns?: number;
410
+ };
411
+ }) => GridWindow<keyof Specs & string>;
412
+ fill: (rows: RowModel<Row>, state: {
413
+ readonly columns: {
414
+ readonly start: readonly (keyof Specs & string)[];
415
+ readonly center: readonly (keyof Specs & string)[];
416
+ readonly end: readonly (keyof Specs & string)[];
417
+ readonly hidden: readonly (keyof Specs & string)[];
418
+ readonly widths: readonly {
419
+ readonly column: keyof Specs & string;
420
+ readonly width: number;
421
+ }[];
422
+ };
423
+ }, request: {
424
+ readonly source: {
425
+ readonly anchor: {
426
+ readonly row: string;
427
+ readonly column: keyof Specs & string;
428
+ };
429
+ readonly focus: {
430
+ readonly row: string;
431
+ readonly column: keyof Specs & string;
432
+ };
433
+ };
434
+ readonly to: {
435
+ readonly row: string;
436
+ readonly column: keyof Specs & string;
437
+ };
438
+ }) => {
439
+ accepted: {
440
+ readonly row: string;
441
+ readonly column: keyof Specs & string;
442
+ readonly text: string;
443
+ }[];
444
+ refused: ({
445
+ readonly row: string;
446
+ readonly column: keyof Specs & string;
447
+ readonly text: string;
448
+ } & {
449
+ readonly error: string;
450
+ })[];
451
+ };
452
+ draftOf: (projection: GridProjection<Row, keyof Specs & string>, address: {
453
+ readonly row: string;
454
+ readonly column: keyof Specs & string;
455
+ }) => string;
456
+ Out: import("foldkit/schema").TaggedUnion<{
457
+ readonly Edited: {
458
+ readonly row: Schema.String;
459
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
460
+ readonly text: Schema.String;
461
+ };
462
+ /** The cells their columns accepted, and those they refused, with why. */
463
+ readonly Pasted: {
464
+ readonly accepted: Schema.$Array<Schema.Struct<{
465
+ readonly row: Schema.String;
466
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
467
+ readonly text: Schema.String;
468
+ }>>;
469
+ readonly refused: Schema.$Array<Schema.Struct<{
470
+ readonly error: Schema.String;
471
+ readonly row: Schema.String;
472
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
473
+ readonly text: Schema.String;
474
+ }>>;
475
+ };
476
+ readonly UndoRequested: {};
477
+ readonly RedoRequested: {};
478
+ /**
479
+ * A fill: carry `source` on to `to`. What it writes is worked out from the
480
+ * rows by `fill`, which the application holds.
481
+ */
482
+ readonly Filled: {
483
+ readonly source: Schema.Struct<{
484
+ readonly anchor: Schema.Struct<{
485
+ readonly row: Schema.String;
486
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
487
+ }>;
488
+ readonly focus: Schema.Struct<{
489
+ readonly row: Schema.String;
490
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
491
+ }>;
492
+ }>;
493
+ readonly to: Schema.Struct<{
494
+ readonly row: Schema.String;
495
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
496
+ }>;
497
+ };
498
+ }>;
499
+ Model: Schema.Struct<{
500
+ readonly focus: Schema.Struct<{
501
+ readonly current: Schema.OptionFromNullOr<Schema.Struct<{
502
+ readonly row: Schema.String;
503
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
504
+ }>>;
505
+ readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
506
+ }>;
507
+ readonly viewport: Schema.Struct<{
508
+ readonly top: Schema.Number;
509
+ readonly left: Schema.Number;
510
+ readonly width: Schema.Number;
511
+ readonly height: Schema.Number;
512
+ }>;
513
+ readonly columns: Schema.Struct<{
514
+ readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
515
+ readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
516
+ readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
517
+ readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
518
+ readonly widths: Schema.$Array<Schema.Struct<{
519
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
520
+ readonly width: Schema.Number;
521
+ }>>;
522
+ }>;
523
+ /** A column being resized by the pointer, and its width when the drag began. */
524
+ readonly resizing: Schema.OptionFromNullOr<Schema.Struct<{
525
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
526
+ readonly from: Schema.Number;
527
+ }>>;
528
+ /**
529
+ * A column header being dragged by the pointer, and how far toward its
530
+ * region's end. Where it lands is worked out when it is let go.
531
+ */
532
+ readonly dragging: Schema.OptionFromNullOr<Schema.Struct<{
533
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
534
+ readonly delta: Schema.Number;
535
+ }>>;
536
+ /** The column whose menu is open, and the item the keyboard is on (`menuItems`). */
537
+ readonly menu: Schema.OptionFromNullOr<Schema.Struct<{
538
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
539
+ readonly active: Schema.Number;
540
+ }>>;
541
+ /**
542
+ * A fill being dragged from the range's handle: the range, and the cell
543
+ * the pointer is over. What it writes is worked out when it is let go.
544
+ */
545
+ readonly filling: Schema.OptionFromNullOr<Schema.Struct<{
546
+ readonly source: Schema.Struct<{
547
+ readonly anchor: Schema.Struct<{
548
+ readonly row: Schema.String;
549
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
550
+ }>;
551
+ readonly focus: Schema.Struct<{
552
+ readonly row: Schema.String;
553
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
554
+ }>;
555
+ }>;
556
+ readonly to: Schema.Struct<{
557
+ readonly row: Schema.String;
558
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
559
+ }>;
560
+ }>>;
561
+ readonly selection: Schema.Struct<{
562
+ readonly rows: import("foldkit/schema").TaggedUnion<{
563
+ readonly Keys: {
564
+ readonly keys: Schema.$Array<Schema.String>;
565
+ };
566
+ readonly AllExcept: {
567
+ readonly except: Schema.$Array<Schema.String>;
568
+ };
569
+ }>;
570
+ /** Where the last plain row selection happened; a Shift range extends from it. */
571
+ readonly anchor: Schema.OptionFromNullOr<Schema.String>;
572
+ /** A rectangle of cells, by its corners; a single focused cell is none. */
573
+ readonly cells: Schema.OptionFromNullOr<Schema.Struct<{
574
+ readonly anchor: Schema.Struct<{
575
+ readonly row: Schema.String;
576
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
577
+ }>;
578
+ readonly focus: Schema.Struct<{
579
+ readonly row: Schema.String;
580
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
581
+ }>;
582
+ }>>;
583
+ }>;
584
+ /**
585
+ * The cell being edited, the text it began from, its draft, and the error
586
+ * that refused it, if one did.
587
+ */
588
+ readonly editing: Schema.OptionFromNullOr<Schema.Struct<{
589
+ readonly address: Schema.Struct<{
590
+ readonly row: Schema.String;
591
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
592
+ }>;
593
+ readonly from: Schema.String;
594
+ readonly draft: Schema.String;
595
+ readonly error: Schema.OptionFromNullOr<Schema.String>;
596
+ }>>;
597
+ }>;
598
+ Message: import("foldkit/message").MessageUnion<{
599
+ /** The pointer or the browser focused a cell. */
600
+ readonly Focused: {
601
+ readonly address: Schema.Struct<{
602
+ readonly row: Schema.String;
603
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
604
+ }>;
605
+ };
606
+ /**
607
+ * A key moved focus. `reveal` is the scroll that brings the cell into
608
+ * view, worked out by the view from the viewport it drew, or none when
609
+ * the cell is shown.
610
+ */
611
+ readonly Moved: {
612
+ readonly address: Schema.Struct<{
613
+ readonly row: Schema.String;
614
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
615
+ }>;
616
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
617
+ readonly top: Schema.Number;
618
+ readonly left: Schema.Number;
619
+ }>>;
620
+ };
621
+ /** A key moved focus up to a column's header, revealing it when scrolled away. */
622
+ readonly HeaderFocused: {
623
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
624
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
625
+ readonly top: Schema.Number;
626
+ readonly left: Schema.Number;
627
+ }>>;
628
+ };
629
+ /** The scroll container moved or changed size: `GridViewport.Measure` reports it. */
630
+ readonly Measured: {
631
+ readonly width: Schema.Number;
632
+ readonly height: Schema.Number;
633
+ readonly top: Schema.Number;
634
+ readonly left: Schema.Number;
635
+ };
636
+ /** The reveal a `Moved` asked for has scrolled the container. */
637
+ readonly Revealed: {
638
+ readonly top: Schema.Number;
639
+ readonly left: Schema.Number;
640
+ };
641
+ /** A column was resized; the width is clamped to its limits. */
642
+ readonly ColumnResized: {
643
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
644
+ readonly width: Schema.Number;
645
+ };
646
+ readonly ColumnHidden: {
647
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
648
+ };
649
+ readonly ColumnShown: {
650
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
651
+ };
652
+ /** A column moved to `index` in `region`: a reorder, a pin or an unpin. */
653
+ readonly ColumnMoved: {
654
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
655
+ readonly region: Schema.Literals<readonly ["start", "center", "end"]>;
656
+ readonly index: Schema.Number;
657
+ };
658
+ /** The pointer went down on a column's resize handle. */
659
+ readonly ResizeStarted: {
660
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
661
+ };
662
+ /**
663
+ * The pointer moved `delta` pixels toward the column's end edge since the
664
+ * resize began: positive widens it, in either direction of text.
665
+ */
666
+ readonly ResizeMoved: {
667
+ readonly delta: Schema.Number;
668
+ };
669
+ /** The pointer let go, or the drag was cancelled and the width goes back. */
670
+ readonly ResizeEnded: {
671
+ readonly completed: Schema.Boolean;
672
+ };
673
+ /**
674
+ * The pointer began dragging the column header whose DOM id is `header`
675
+ * (`GridFocus.headerId`). The id comes from the page, so one that is not
676
+ * a shown column of this grid changes nothing.
677
+ */
678
+ readonly ColumnDragStarted: {
679
+ readonly header: Schema.String;
680
+ };
681
+ /** The pointer is `delta` pixels toward the region's end from where the drag began. */
682
+ readonly ColumnDragged: {
683
+ readonly delta: Schema.Number;
684
+ };
685
+ /**
686
+ * The pointer let go and the column moves where it was dropped
687
+ * (`ColumnState.dropAt`), or the drag was cancelled and nothing moves.
688
+ */
689
+ readonly ColumnDragEnded: {
690
+ readonly completed: Schema.Boolean;
691
+ };
692
+ /**
693
+ * A column's menu opened, from its button or a key on its header; focus
694
+ * goes to the header, so closing the menu returns there.
695
+ */
696
+ readonly MenuOpened: {
697
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
698
+ };
699
+ /** The keyboard moved to item `active` of the open menu. */
700
+ readonly MenuMoved: {
701
+ readonly active: Schema.Number;
702
+ };
703
+ /**
704
+ * Item `index` of the open menu was chosen. It is read from the menu as
705
+ * it stands now, and the menu closes.
706
+ */
707
+ readonly MenuChosen: {
708
+ readonly index: Schema.Number;
709
+ };
710
+ readonly MenuClosed: {};
711
+ /** A row was chosen: in single mode it is the selection, in multiple it toggles. */
712
+ readonly RowSelected: {
713
+ readonly row: Schema.String;
714
+ };
715
+ /** A Shift range of rows, worked out by the view from the projection it drew. */
716
+ readonly RowsExtended: {
717
+ readonly rows: Schema.$Array<Schema.String>;
718
+ readonly to: Schema.String;
719
+ };
720
+ readonly AllRowsSelected: {};
721
+ readonly RowsCleared: {};
722
+ /**
723
+ * A rectangle of cells, from Shift with a key. `reveal` scrolls its far
724
+ * corner into view, as `Moved`'s does for a focused cell.
725
+ */
726
+ readonly CellsSelected: {
727
+ readonly anchor: Schema.Struct<{
728
+ readonly row: Schema.String;
729
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
730
+ }>;
731
+ readonly focus: Schema.Struct<{
732
+ readonly row: Schema.String;
733
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
734
+ }>;
735
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
736
+ readonly top: Schema.Number;
737
+ readonly left: Schema.Number;
738
+ }>>;
739
+ };
740
+ /**
741
+ * The pointer pressed the cell whose DOM id is `cell` (`GridFocus.cellId`).
742
+ * With Shift it spans a range from the focused cell, with Ctrl or Meta it
743
+ * toggles the cell's row, and plainly it focuses the cell. The id comes
744
+ * from the page, so one that is not this grid's cell changes nothing.
745
+ */
746
+ readonly CellPressed: {
747
+ readonly cell: Schema.String;
748
+ readonly shiftKey: Schema.Boolean;
749
+ readonly toggleKey: Schema.Boolean;
750
+ };
751
+ readonly CellsCleared: {};
752
+ /** An edit began on an editable cell, with the text it starts from. */
753
+ readonly EditStarted: {
754
+ readonly address: Schema.Struct<{
755
+ readonly row: Schema.String;
756
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
757
+ }>;
758
+ readonly draft: Schema.String;
759
+ };
760
+ /**
761
+ * A key typed on the grid itself, over an editable cell: it starts an
762
+ * edit with the text, or, when that cell's edit is already open (the
763
+ * keys came faster than the editor took focus), adds to its draft.
764
+ * On a choice it picks the next option starting with the key instead,
765
+ * after the draft's, as a select finds one. `from` is the text the cell
766
+ * showed, which a new edit began from.
767
+ */
768
+ readonly EditTyped: {
769
+ readonly address: Schema.Struct<{
770
+ readonly row: Schema.String;
771
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
772
+ }>;
773
+ readonly text: Schema.String;
774
+ readonly from: Schema.String;
775
+ };
776
+ readonly EditChanged: {
777
+ readonly draft: Schema.String;
778
+ };
779
+ /**
780
+ * A choice's draft moved through its column's options: the next or
781
+ * previous, the first or last, or a page of ten either way, stopping at
782
+ * the ends. The view sends the step; `update` works out the option from
783
+ * the draft as it is. On a column that is no choice it changes nothing.
784
+ */
785
+ readonly EditStepped: {
786
+ readonly by: Schema.Literals<readonly ["next", "previous", "first", "last", "pageNext", "pagePrevious"]>;
787
+ };
788
+ /** A pointer chose one of a choice's options: it is the draft, committed in place. */
789
+ readonly EditChosen: {
790
+ readonly draft: Schema.String;
791
+ };
792
+ /**
793
+ * The draft is to be kept. When the column accepts it the edit ends, focus
794
+ * goes to `next` (the cell below, or beside, worked out by the view), and
795
+ * the grid reports `Out.Edited`, unless the draft is the text the edit
796
+ * began from or decodes to the same value; when it refuses it, the edit
797
+ * stays with the error.
798
+ */
799
+ readonly EditCommitted: {
800
+ readonly next: Schema.OptionFromNullOr<Schema.Struct<{
801
+ readonly row: Schema.String;
802
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
803
+ }>>;
804
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
805
+ readonly top: Schema.Number;
806
+ readonly left: Schema.Number;
807
+ }>>;
808
+ };
809
+ readonly EditCancelled: {};
810
+ /**
811
+ * Text pasted, or a cut's cleared cells, laid onto editable cells by the
812
+ * view (`Clipboard.pasteAt`). A cell its text leaves unchanged (as an
813
+ * edit judges it, against `from`) is dropped; the rest are checked against
814
+ * their columns and reported as one `Pasted`, or nothing when none is left.
815
+ */
816
+ readonly Pasted: {
817
+ readonly cells: Schema.$Array<Schema.Struct<{
818
+ readonly from: Schema.String;
819
+ readonly row: Schema.String;
820
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
821
+ readonly text: Schema.String;
822
+ }>>;
823
+ };
824
+ /**
825
+ * Ctrl or Meta with Z on the grid, or with Shift (or Ctrl+Y) for redo.
826
+ * An open edit keeps them, since the editor's own undo is the field's.
827
+ */
828
+ readonly UndoRequested: {};
829
+ readonly RedoRequested: {};
830
+ /** Ctrl+D or Ctrl+R over a range, worked out by the view: carry `source` on to `to`. */
831
+ readonly FillRequested: {
832
+ readonly source: Schema.Struct<{
833
+ readonly anchor: Schema.Struct<{
834
+ readonly row: Schema.String;
835
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
836
+ }>;
837
+ readonly focus: Schema.Struct<{
838
+ readonly row: Schema.String;
839
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
840
+ }>;
841
+ }>;
842
+ readonly to: Schema.Struct<{
843
+ readonly row: Schema.String;
844
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
845
+ }>;
846
+ };
847
+ /** The range's fill handle was pressed and moved: a fill begins from the range. */
848
+ readonly FillStarted: {};
849
+ /** The pointer, filling, is over the cell whose DOM id is `cell`. */
850
+ readonly FillDragged: {
851
+ readonly cell: Schema.String;
852
+ };
853
+ /** The fill handle was let go, or the drag cancelled (`completed` false). */
854
+ readonly FillEnded: {
855
+ readonly completed: Schema.Boolean;
856
+ };
857
+ }>;
858
+ bundle: Bundle.Bundle<"DataGrid", void, {
859
+ readonly focus: {
860
+ readonly current: Option.Option<{
861
+ readonly row: string;
862
+ readonly column: keyof Specs & string;
863
+ }>;
864
+ readonly header: Option.Option<keyof Specs & string>;
865
+ };
866
+ readonly viewport: {
867
+ readonly top: number;
868
+ readonly left: number;
869
+ readonly width: number;
870
+ readonly height: number;
871
+ };
872
+ readonly columns: {
873
+ readonly start: readonly (keyof Specs & string)[];
874
+ readonly center: readonly (keyof Specs & string)[];
875
+ readonly end: readonly (keyof Specs & string)[];
876
+ readonly hidden: readonly (keyof Specs & string)[];
877
+ readonly widths: readonly {
878
+ readonly column: keyof Specs & string;
879
+ readonly width: number;
880
+ }[];
881
+ };
882
+ readonly resizing: Option.Option<{
883
+ readonly column: keyof Specs & string;
884
+ readonly from: number;
885
+ }>;
886
+ readonly dragging: Option.Option<{
887
+ readonly column: keyof Specs & string;
888
+ readonly delta: number;
889
+ }>;
890
+ readonly menu: Option.Option<{
891
+ readonly column: keyof Specs & string;
892
+ readonly active: number;
893
+ }>;
894
+ readonly filling: Option.Option<{
895
+ readonly source: {
896
+ readonly anchor: {
897
+ readonly row: string;
898
+ readonly column: keyof Specs & string;
899
+ };
900
+ readonly focus: {
901
+ readonly row: string;
902
+ readonly column: keyof Specs & string;
903
+ };
904
+ };
905
+ readonly to: {
906
+ readonly row: string;
907
+ readonly column: keyof Specs & string;
908
+ };
909
+ }>;
910
+ readonly selection: {
911
+ readonly rows: {
912
+ readonly _tag: "Keys";
913
+ readonly keys: readonly string[];
914
+ } | {
915
+ readonly _tag: "AllExcept";
916
+ readonly except: readonly string[];
917
+ };
918
+ readonly anchor: Option.Option<string>;
919
+ readonly cells: Option.Option<{
920
+ readonly anchor: {
921
+ readonly row: string;
922
+ readonly column: keyof Specs & string;
923
+ };
924
+ readonly focus: {
925
+ readonly row: string;
926
+ readonly column: keyof Specs & string;
927
+ };
928
+ }>;
929
+ };
930
+ readonly editing: Option.Option<{
931
+ readonly address: {
932
+ readonly row: string;
933
+ readonly column: keyof Specs & string;
934
+ };
935
+ readonly from: string;
936
+ readonly draft: string;
937
+ readonly error: Option.Option<string>;
938
+ }>;
939
+ }, {
940
+ readonly _tag: "Focused";
941
+ readonly address: {
942
+ readonly row: string;
943
+ readonly column: keyof Specs & string;
944
+ };
945
+ } | {
946
+ readonly _tag: "HeaderFocused";
947
+ readonly column: keyof Specs & string;
948
+ readonly reveal: Option.Option<{
949
+ readonly top: number;
950
+ readonly left: number;
951
+ }>;
952
+ } | {
953
+ readonly _tag: "Measured";
954
+ readonly width: number;
955
+ readonly height: number;
956
+ readonly top: number;
957
+ readonly left: number;
958
+ } | {
959
+ readonly _tag: "Revealed";
960
+ readonly top: number;
961
+ readonly left: number;
962
+ } | {
963
+ readonly _tag: "Pasted";
964
+ readonly cells: readonly {
965
+ readonly from: string;
966
+ readonly row: string;
967
+ readonly column: keyof Specs & string;
968
+ readonly text: string;
969
+ }[];
970
+ } | {
971
+ readonly _tag: "UndoRequested";
972
+ } | {
973
+ readonly _tag: "RedoRequested";
974
+ } | {
975
+ readonly _tag: "Moved";
976
+ readonly address: {
977
+ readonly row: string;
978
+ readonly column: keyof Specs & string;
979
+ };
980
+ readonly reveal: Option.Option<{
981
+ readonly top: number;
982
+ readonly left: number;
983
+ }>;
984
+ } | {
985
+ readonly _tag: "ColumnResized";
986
+ readonly column: keyof Specs & string;
987
+ readonly width: number;
988
+ } | {
989
+ readonly _tag: "ColumnHidden";
990
+ readonly column: keyof Specs & string;
991
+ } | {
992
+ readonly _tag: "ColumnShown";
993
+ readonly column: keyof Specs & string;
994
+ } | {
995
+ readonly _tag: "ColumnMoved";
996
+ readonly column: keyof Specs & string;
997
+ readonly region: "start" | "center" | "end";
998
+ readonly index: number;
999
+ } | {
1000
+ readonly _tag: "ResizeStarted";
1001
+ readonly column: keyof Specs & string;
1002
+ } | {
1003
+ readonly _tag: "ResizeMoved";
1004
+ readonly delta: number;
1005
+ } | {
1006
+ readonly _tag: "ResizeEnded";
1007
+ readonly completed: boolean;
1008
+ } | {
1009
+ readonly _tag: "ColumnDragStarted";
1010
+ readonly header: string;
1011
+ } | {
1012
+ readonly _tag: "ColumnDragged";
1013
+ readonly delta: number;
1014
+ } | {
1015
+ readonly _tag: "ColumnDragEnded";
1016
+ readonly completed: boolean;
1017
+ } | {
1018
+ readonly _tag: "MenuOpened";
1019
+ readonly column: keyof Specs & string;
1020
+ } | {
1021
+ readonly _tag: "MenuMoved";
1022
+ readonly active: number;
1023
+ } | {
1024
+ readonly _tag: "MenuChosen";
1025
+ readonly index: number;
1026
+ } | {
1027
+ readonly _tag: "MenuClosed";
1028
+ } | {
1029
+ readonly _tag: "RowSelected";
1030
+ readonly row: string;
1031
+ } | {
1032
+ readonly _tag: "RowsExtended";
1033
+ readonly rows: readonly string[];
1034
+ readonly to: string;
1035
+ } | {
1036
+ readonly _tag: "AllRowsSelected";
1037
+ } | {
1038
+ readonly _tag: "RowsCleared";
1039
+ } | {
1040
+ readonly _tag: "CellsSelected";
1041
+ readonly anchor: {
1042
+ readonly row: string;
1043
+ readonly column: keyof Specs & string;
1044
+ };
1045
+ readonly focus: {
1046
+ readonly row: string;
1047
+ readonly column: keyof Specs & string;
1048
+ };
1049
+ readonly reveal: Option.Option<{
1050
+ readonly top: number;
1051
+ readonly left: number;
1052
+ }>;
1053
+ } | {
1054
+ readonly _tag: "CellPressed";
1055
+ readonly cell: string;
1056
+ readonly shiftKey: boolean;
1057
+ readonly toggleKey: boolean;
1058
+ } | {
1059
+ readonly _tag: "CellsCleared";
1060
+ } | {
1061
+ readonly _tag: "EditStarted";
1062
+ readonly address: {
1063
+ readonly row: string;
1064
+ readonly column: keyof Specs & string;
1065
+ };
1066
+ readonly draft: string;
1067
+ } | {
1068
+ readonly _tag: "EditTyped";
1069
+ readonly address: {
1070
+ readonly row: string;
1071
+ readonly column: keyof Specs & string;
1072
+ };
1073
+ readonly text: string;
1074
+ readonly from: string;
1075
+ } | {
1076
+ readonly _tag: "EditChanged";
1077
+ readonly draft: string;
1078
+ } | {
1079
+ readonly _tag: "EditStepped";
1080
+ readonly by: "next" | "previous" | "first" | "last" | "pageNext" | "pagePrevious";
1081
+ } | {
1082
+ readonly _tag: "EditChosen";
1083
+ readonly draft: string;
1084
+ } | {
1085
+ readonly _tag: "EditCommitted";
1086
+ readonly next: Option.Option<{
1087
+ readonly row: string;
1088
+ readonly column: keyof Specs & string;
1089
+ }>;
1090
+ readonly reveal: Option.Option<{
1091
+ readonly top: number;
1092
+ readonly left: number;
1093
+ }>;
1094
+ } | {
1095
+ readonly _tag: "EditCancelled";
1096
+ } | {
1097
+ readonly _tag: "FillStarted";
1098
+ } | {
1099
+ readonly _tag: "FillDragged";
1100
+ readonly cell: string;
1101
+ } | {
1102
+ readonly _tag: "FillEnded";
1103
+ readonly completed: boolean;
1104
+ } | {
1105
+ readonly _tag: "FillRequested";
1106
+ readonly source: {
1107
+ readonly anchor: {
1108
+ readonly row: string;
1109
+ readonly column: keyof Specs & string;
1110
+ };
1111
+ readonly focus: {
1112
+ readonly row: string;
1113
+ readonly column: keyof Specs & string;
1114
+ };
1115
+ };
1116
+ readonly to: {
1117
+ readonly row: string;
1118
+ readonly column: keyof Specs & string;
1119
+ };
1120
+ }, {
1121
+ readonly _tag: "UndoRequested";
1122
+ } | {
1123
+ readonly _tag: "RedoRequested";
1124
+ } | {
1125
+ readonly _tag: "Edited";
1126
+ readonly row: string;
1127
+ readonly column: keyof Specs & string;
1128
+ readonly text: string;
1129
+ } | {
1130
+ readonly _tag: "Pasted";
1131
+ readonly accepted: readonly {
1132
+ readonly row: string;
1133
+ readonly column: keyof Specs & string;
1134
+ readonly text: string;
1135
+ }[];
1136
+ readonly refused: readonly {
1137
+ readonly error: string;
1138
+ readonly row: string;
1139
+ readonly column: keyof Specs & string;
1140
+ readonly text: string;
1141
+ }[];
1142
+ } | {
1143
+ readonly _tag: "Filled";
1144
+ readonly source: {
1145
+ readonly anchor: {
1146
+ readonly row: string;
1147
+ readonly column: keyof Specs & string;
1148
+ };
1149
+ readonly focus: {
1150
+ readonly row: string;
1151
+ readonly column: keyof Specs & string;
1152
+ };
1153
+ };
1154
+ readonly to: {
1155
+ readonly row: string;
1156
+ readonly column: keyof Specs & string;
1157
+ };
1158
+ }, never, never, void, {}, {}>;
1159
+ };
1160
+ export declare const DataGrid: {
1161
+ make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(options: {
1162
+ readonly id: string;
1163
+ readonly columns: Columns<Row, Specs>;
1164
+ readonly rowSelection?: "single" | "multiple";
1165
+ readonly cellSelection?: boolean;
1166
+ }) => {
1167
+ id: string;
1168
+ matchEdit: <const Handlers extends { readonly [K in EditableId<Specs>]: (edited: {
1169
+ readonly row: string;
1170
+ readonly value: EditValue<Specs[K]>;
1171
+ }) => unknown; }>(cell: {
1172
+ readonly row: string;
1173
+ readonly column: keyof Specs & string;
1174
+ readonly text: string;
1175
+ }, handlers: Handlers & { readonly [K in Exclude<keyof Handlers, EditableId<Specs>>]: never; }) => ReturnType<Handlers[EditableId<Specs>]>;
1176
+ editorFor: (column: keyof Specs & string) => Option.Option<CellEditor>;
1177
+ MenuItem: import("foldkit/schema").TaggedUnion<{
1178
+ readonly Pin: {
1179
+ readonly region: Schema.Literals<readonly ["start", "center", "end"]>;
1180
+ };
1181
+ readonly Hide: {};
1182
+ readonly Show: {
1183
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1184
+ };
1185
+ }>;
1186
+ menuItems: (state: {
1187
+ readonly start: readonly (keyof Specs & string)[];
1188
+ readonly center: readonly (keyof Specs & string)[];
1189
+ readonly end: readonly (keyof Specs & string)[];
1190
+ readonly hidden: readonly (keyof Specs & string)[];
1191
+ readonly widths: readonly {
1192
+ readonly column: keyof Specs & string;
1193
+ readonly width: number;
1194
+ }[];
1195
+ }, column: keyof Specs & string) => ReadonlyArray<{
1196
+ readonly _tag: "Pin";
1197
+ readonly region: "start" | "center" | "end";
1198
+ } | {
1199
+ readonly _tag: "Hide";
1200
+ } | {
1201
+ readonly _tag: "Show";
1202
+ readonly column: keyof Specs & string;
1203
+ }>;
1204
+ columns: Columns<Row, Specs>;
1205
+ rowSelection: "single" | "multiple" | undefined;
1206
+ cellSelection: boolean;
1207
+ focus: {
1208
+ Address: Schema.Struct<{
1209
+ readonly row: Schema.String;
1210
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1211
+ }>;
1212
+ Model: Schema.Struct<{
1213
+ readonly current: Schema.OptionFromNullOr<Schema.Struct<{
1214
+ readonly row: Schema.String;
1215
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1216
+ }>>;
1217
+ readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
1218
+ }>;
1219
+ Message: import("foldkit/message").MessageUnion<{
1220
+ readonly Focused: {
1221
+ readonly address: Schema.Struct<{
1222
+ readonly row: Schema.String;
1223
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1224
+ }>;
1225
+ };
1226
+ readonly HeaderFocused: {
1227
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1228
+ };
1229
+ }>;
1230
+ bundle: Bundle.Bundle<"GridFocus", void, {
1231
+ readonly current: Option.Option<{
1232
+ readonly row: string;
1233
+ readonly column: keyof Specs & string;
1234
+ }>;
1235
+ readonly header: Option.Option<keyof Specs & string>;
1236
+ }, {
1237
+ readonly _tag: "Focused";
1238
+ readonly address: {
1239
+ readonly row: string;
1240
+ readonly column: keyof Specs & string;
1241
+ };
1242
+ } | {
1243
+ readonly _tag: "HeaderFocused";
1244
+ readonly column: keyof Specs & string;
1245
+ }, never, never, never, void, {}, {}>;
1246
+ };
1247
+ columnState: {
1248
+ Model: Schema.Struct<{
1249
+ readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1250
+ readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1251
+ readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1252
+ readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1253
+ readonly widths: Schema.$Array<Schema.Struct<{
1254
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1255
+ readonly width: Schema.Number;
1256
+ }>>;
1257
+ }>;
1258
+ initial: () => ColumnState<keyof Specs & string>;
1259
+ widthOf: (state: ColumnState<keyof Specs & string>) => (id: keyof Specs & string) => number;
1260
+ regionOf: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => Region;
1261
+ resize: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, width: number) => ColumnState<keyof Specs & string>;
1262
+ hide: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
1263
+ show: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
1264
+ move: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, region: Region, index: number) => ColumnState<keyof Specs & string>;
1265
+ dropAt: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, delta: number) => number;
1266
+ restore: (saved: unknown) => Restored<keyof Specs & string>;
1267
+ };
1268
+ project: (rows: RowModel<Row>, state: {
1269
+ readonly start: readonly (keyof Specs & string)[];
1270
+ readonly center: readonly (keyof Specs & string)[];
1271
+ readonly end: readonly (keyof Specs & string)[];
1272
+ readonly hidden: readonly (keyof Specs & string)[];
1273
+ readonly widths: readonly {
1274
+ readonly column: keyof Specs & string;
1275
+ readonly width: number;
1276
+ }[];
1277
+ }) => GridProjection<Row, keyof Specs & string>;
1278
+ window: (input: {
1279
+ readonly rows: RowModel<Row>;
1280
+ readonly state: {
1281
+ readonly viewport: Viewport;
1282
+ readonly columns: {
1283
+ readonly start: readonly (keyof Specs & string)[];
1284
+ readonly center: readonly (keyof Specs & string)[];
1285
+ readonly end: readonly (keyof Specs & string)[];
1286
+ readonly hidden: readonly (keyof Specs & string)[];
1287
+ readonly widths: readonly {
1288
+ readonly column: keyof Specs & string;
1289
+ readonly width: number;
1290
+ }[];
1291
+ };
1292
+ };
1293
+ readonly rowHeight: number;
1294
+ readonly headerHeight: number;
1295
+ readonly overscan?: {
1296
+ readonly rows?: number;
1297
+ readonly columns?: number;
1298
+ };
1299
+ }) => GridWindow<keyof Specs & string>;
1300
+ fill: (rows: RowModel<Row>, state: {
1301
+ readonly columns: {
1302
+ readonly start: readonly (keyof Specs & string)[];
1303
+ readonly center: readonly (keyof Specs & string)[];
1304
+ readonly end: readonly (keyof Specs & string)[];
1305
+ readonly hidden: readonly (keyof Specs & string)[];
1306
+ readonly widths: readonly {
1307
+ readonly column: keyof Specs & string;
1308
+ readonly width: number;
1309
+ }[];
1310
+ };
1311
+ }, request: {
1312
+ readonly source: {
1313
+ readonly anchor: {
1314
+ readonly row: string;
1315
+ readonly column: keyof Specs & string;
1316
+ };
1317
+ readonly focus: {
1318
+ readonly row: string;
1319
+ readonly column: keyof Specs & string;
1320
+ };
1321
+ };
1322
+ readonly to: {
1323
+ readonly row: string;
1324
+ readonly column: keyof Specs & string;
1325
+ };
1326
+ }) => {
1327
+ accepted: {
1328
+ readonly row: string;
1329
+ readonly column: keyof Specs & string;
1330
+ readonly text: string;
1331
+ }[];
1332
+ refused: ({
1333
+ readonly row: string;
1334
+ readonly column: keyof Specs & string;
1335
+ readonly text: string;
1336
+ } & {
1337
+ readonly error: string;
1338
+ })[];
1339
+ };
1340
+ draftOf: (projection: GridProjection<Row, keyof Specs & string>, address: {
1341
+ readonly row: string;
1342
+ readonly column: keyof Specs & string;
1343
+ }) => string;
1344
+ Out: import("foldkit/schema").TaggedUnion<{
1345
+ readonly Edited: {
1346
+ readonly row: Schema.String;
1347
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1348
+ readonly text: Schema.String;
1349
+ };
1350
+ /** The cells their columns accepted, and those they refused, with why. */
1351
+ readonly Pasted: {
1352
+ readonly accepted: Schema.$Array<Schema.Struct<{
1353
+ readonly row: Schema.String;
1354
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1355
+ readonly text: Schema.String;
1356
+ }>>;
1357
+ readonly refused: Schema.$Array<Schema.Struct<{
1358
+ readonly error: Schema.String;
1359
+ readonly row: Schema.String;
1360
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1361
+ readonly text: Schema.String;
1362
+ }>>;
1363
+ };
1364
+ readonly UndoRequested: {};
1365
+ readonly RedoRequested: {};
1366
+ /**
1367
+ * A fill: carry `source` on to `to`. What it writes is worked out from the
1368
+ * rows by `fill`, which the application holds.
1369
+ */
1370
+ readonly Filled: {
1371
+ readonly source: Schema.Struct<{
1372
+ readonly anchor: Schema.Struct<{
1373
+ readonly row: Schema.String;
1374
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1375
+ }>;
1376
+ readonly focus: Schema.Struct<{
1377
+ readonly row: Schema.String;
1378
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1379
+ }>;
1380
+ }>;
1381
+ readonly to: Schema.Struct<{
1382
+ readonly row: Schema.String;
1383
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1384
+ }>;
1385
+ };
1386
+ }>;
1387
+ Model: Schema.Struct<{
1388
+ readonly focus: Schema.Struct<{
1389
+ readonly current: Schema.OptionFromNullOr<Schema.Struct<{
1390
+ readonly row: Schema.String;
1391
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1392
+ }>>;
1393
+ readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
1394
+ }>;
1395
+ readonly viewport: Schema.Struct<{
1396
+ readonly top: Schema.Number;
1397
+ readonly left: Schema.Number;
1398
+ readonly width: Schema.Number;
1399
+ readonly height: Schema.Number;
1400
+ }>;
1401
+ readonly columns: Schema.Struct<{
1402
+ readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1403
+ readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1404
+ readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1405
+ readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
1406
+ readonly widths: Schema.$Array<Schema.Struct<{
1407
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1408
+ readonly width: Schema.Number;
1409
+ }>>;
1410
+ }>;
1411
+ /** A column being resized by the pointer, and its width when the drag began. */
1412
+ readonly resizing: Schema.OptionFromNullOr<Schema.Struct<{
1413
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1414
+ readonly from: Schema.Number;
1415
+ }>>;
1416
+ /**
1417
+ * A column header being dragged by the pointer, and how far toward its
1418
+ * region's end. Where it lands is worked out when it is let go.
1419
+ */
1420
+ readonly dragging: Schema.OptionFromNullOr<Schema.Struct<{
1421
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1422
+ readonly delta: Schema.Number;
1423
+ }>>;
1424
+ /** The column whose menu is open, and the item the keyboard is on (`menuItems`). */
1425
+ readonly menu: Schema.OptionFromNullOr<Schema.Struct<{
1426
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1427
+ readonly active: Schema.Number;
1428
+ }>>;
1429
+ /**
1430
+ * A fill being dragged from the range's handle: the range, and the cell
1431
+ * the pointer is over. What it writes is worked out when it is let go.
1432
+ */
1433
+ readonly filling: Schema.OptionFromNullOr<Schema.Struct<{
1434
+ readonly source: Schema.Struct<{
1435
+ readonly anchor: Schema.Struct<{
1436
+ readonly row: Schema.String;
1437
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1438
+ }>;
1439
+ readonly focus: Schema.Struct<{
1440
+ readonly row: Schema.String;
1441
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1442
+ }>;
1443
+ }>;
1444
+ readonly to: Schema.Struct<{
1445
+ readonly row: Schema.String;
1446
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1447
+ }>;
1448
+ }>>;
1449
+ readonly selection: Schema.Struct<{
1450
+ readonly rows: import("foldkit/schema").TaggedUnion<{
1451
+ readonly Keys: {
1452
+ readonly keys: Schema.$Array<Schema.String>;
1453
+ };
1454
+ readonly AllExcept: {
1455
+ readonly except: Schema.$Array<Schema.String>;
1456
+ };
1457
+ }>;
1458
+ /** Where the last plain row selection happened; a Shift range extends from it. */
1459
+ readonly anchor: Schema.OptionFromNullOr<Schema.String>;
1460
+ /** A rectangle of cells, by its corners; a single focused cell is none. */
1461
+ readonly cells: Schema.OptionFromNullOr<Schema.Struct<{
1462
+ readonly anchor: Schema.Struct<{
1463
+ readonly row: Schema.String;
1464
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1465
+ }>;
1466
+ readonly focus: Schema.Struct<{
1467
+ readonly row: Schema.String;
1468
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1469
+ }>;
1470
+ }>>;
1471
+ }>;
1472
+ /**
1473
+ * The cell being edited, the text it began from, its draft, and the error
1474
+ * that refused it, if one did.
1475
+ */
1476
+ readonly editing: Schema.OptionFromNullOr<Schema.Struct<{
1477
+ readonly address: Schema.Struct<{
1478
+ readonly row: Schema.String;
1479
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1480
+ }>;
1481
+ readonly from: Schema.String;
1482
+ readonly draft: Schema.String;
1483
+ readonly error: Schema.OptionFromNullOr<Schema.String>;
1484
+ }>>;
1485
+ }>;
1486
+ Message: import("foldkit/message").MessageUnion<{
1487
+ /** The pointer or the browser focused a cell. */
1488
+ readonly Focused: {
1489
+ readonly address: Schema.Struct<{
1490
+ readonly row: Schema.String;
1491
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1492
+ }>;
1493
+ };
1494
+ /**
1495
+ * A key moved focus. `reveal` is the scroll that brings the cell into
1496
+ * view, worked out by the view from the viewport it drew, or none when
1497
+ * the cell is shown.
1498
+ */
1499
+ readonly Moved: {
1500
+ readonly address: Schema.Struct<{
1501
+ readonly row: Schema.String;
1502
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1503
+ }>;
1504
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
1505
+ readonly top: Schema.Number;
1506
+ readonly left: Schema.Number;
1507
+ }>>;
1508
+ };
1509
+ /** A key moved focus up to a column's header, revealing it when scrolled away. */
1510
+ readonly HeaderFocused: {
1511
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1512
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
1513
+ readonly top: Schema.Number;
1514
+ readonly left: Schema.Number;
1515
+ }>>;
1516
+ };
1517
+ /** The scroll container moved or changed size: `GridViewport.Measure` reports it. */
1518
+ readonly Measured: {
1519
+ readonly width: Schema.Number;
1520
+ readonly height: Schema.Number;
1521
+ readonly top: Schema.Number;
1522
+ readonly left: Schema.Number;
1523
+ };
1524
+ /** The reveal a `Moved` asked for has scrolled the container. */
1525
+ readonly Revealed: {
1526
+ readonly top: Schema.Number;
1527
+ readonly left: Schema.Number;
1528
+ };
1529
+ /** A column was resized; the width is clamped to its limits. */
1530
+ readonly ColumnResized: {
1531
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1532
+ readonly width: Schema.Number;
1533
+ };
1534
+ readonly ColumnHidden: {
1535
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1536
+ };
1537
+ readonly ColumnShown: {
1538
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1539
+ };
1540
+ /** A column moved to `index` in `region`: a reorder, a pin or an unpin. */
1541
+ readonly ColumnMoved: {
1542
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1543
+ readonly region: Schema.Literals<readonly ["start", "center", "end"]>;
1544
+ readonly index: Schema.Number;
1545
+ };
1546
+ /** The pointer went down on a column's resize handle. */
1547
+ readonly ResizeStarted: {
1548
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1549
+ };
1550
+ /**
1551
+ * The pointer moved `delta` pixels toward the column's end edge since the
1552
+ * resize began: positive widens it, in either direction of text.
1553
+ */
1554
+ readonly ResizeMoved: {
1555
+ readonly delta: Schema.Number;
1556
+ };
1557
+ /** The pointer let go, or the drag was cancelled and the width goes back. */
1558
+ readonly ResizeEnded: {
1559
+ readonly completed: Schema.Boolean;
1560
+ };
1561
+ /**
1562
+ * The pointer began dragging the column header whose DOM id is `header`
1563
+ * (`GridFocus.headerId`). The id comes from the page, so one that is not
1564
+ * a shown column of this grid changes nothing.
1565
+ */
1566
+ readonly ColumnDragStarted: {
1567
+ readonly header: Schema.String;
1568
+ };
1569
+ /** The pointer is `delta` pixels toward the region's end from where the drag began. */
1570
+ readonly ColumnDragged: {
1571
+ readonly delta: Schema.Number;
1572
+ };
1573
+ /**
1574
+ * The pointer let go and the column moves where it was dropped
1575
+ * (`ColumnState.dropAt`), or the drag was cancelled and nothing moves.
1576
+ */
1577
+ readonly ColumnDragEnded: {
1578
+ readonly completed: Schema.Boolean;
1579
+ };
1580
+ /**
1581
+ * A column's menu opened, from its button or a key on its header; focus
1582
+ * goes to the header, so closing the menu returns there.
1583
+ */
1584
+ readonly MenuOpened: {
1585
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1586
+ };
1587
+ /** The keyboard moved to item `active` of the open menu. */
1588
+ readonly MenuMoved: {
1589
+ readonly active: Schema.Number;
1590
+ };
1591
+ /**
1592
+ * Item `index` of the open menu was chosen. It is read from the menu as
1593
+ * it stands now, and the menu closes.
1594
+ */
1595
+ readonly MenuChosen: {
1596
+ readonly index: Schema.Number;
1597
+ };
1598
+ readonly MenuClosed: {};
1599
+ /** A row was chosen: in single mode it is the selection, in multiple it toggles. */
1600
+ readonly RowSelected: {
1601
+ readonly row: Schema.String;
1602
+ };
1603
+ /** A Shift range of rows, worked out by the view from the projection it drew. */
1604
+ readonly RowsExtended: {
1605
+ readonly rows: Schema.$Array<Schema.String>;
1606
+ readonly to: Schema.String;
1607
+ };
1608
+ readonly AllRowsSelected: {};
1609
+ readonly RowsCleared: {};
1610
+ /**
1611
+ * A rectangle of cells, from Shift with a key. `reveal` scrolls its far
1612
+ * corner into view, as `Moved`'s does for a focused cell.
1613
+ */
1614
+ readonly CellsSelected: {
1615
+ readonly anchor: Schema.Struct<{
1616
+ readonly row: Schema.String;
1617
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1618
+ }>;
1619
+ readonly focus: Schema.Struct<{
1620
+ readonly row: Schema.String;
1621
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1622
+ }>;
1623
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
1624
+ readonly top: Schema.Number;
1625
+ readonly left: Schema.Number;
1626
+ }>>;
1627
+ };
1628
+ /**
1629
+ * The pointer pressed the cell whose DOM id is `cell` (`GridFocus.cellId`).
1630
+ * With Shift it spans a range from the focused cell, with Ctrl or Meta it
1631
+ * toggles the cell's row, and plainly it focuses the cell. The id comes
1632
+ * from the page, so one that is not this grid's cell changes nothing.
1633
+ */
1634
+ readonly CellPressed: {
1635
+ readonly cell: Schema.String;
1636
+ readonly shiftKey: Schema.Boolean;
1637
+ readonly toggleKey: Schema.Boolean;
1638
+ };
1639
+ readonly CellsCleared: {};
1640
+ /** An edit began on an editable cell, with the text it starts from. */
1641
+ readonly EditStarted: {
1642
+ readonly address: Schema.Struct<{
1643
+ readonly row: Schema.String;
1644
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1645
+ }>;
1646
+ readonly draft: Schema.String;
1647
+ };
1648
+ /**
1649
+ * A key typed on the grid itself, over an editable cell: it starts an
1650
+ * edit with the text, or, when that cell's edit is already open (the
1651
+ * keys came faster than the editor took focus), adds to its draft.
1652
+ * On a choice it picks the next option starting with the key instead,
1653
+ * after the draft's, as a select finds one. `from` is the text the cell
1654
+ * showed, which a new edit began from.
1655
+ */
1656
+ readonly EditTyped: {
1657
+ readonly address: Schema.Struct<{
1658
+ readonly row: Schema.String;
1659
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1660
+ }>;
1661
+ readonly text: Schema.String;
1662
+ readonly from: Schema.String;
1663
+ };
1664
+ readonly EditChanged: {
1665
+ readonly draft: Schema.String;
1666
+ };
1667
+ /**
1668
+ * A choice's draft moved through its column's options: the next or
1669
+ * previous, the first or last, or a page of ten either way, stopping at
1670
+ * the ends. The view sends the step; `update` works out the option from
1671
+ * the draft as it is. On a column that is no choice it changes nothing.
1672
+ */
1673
+ readonly EditStepped: {
1674
+ readonly by: Schema.Literals<readonly ["next", "previous", "first", "last", "pageNext", "pagePrevious"]>;
1675
+ };
1676
+ /** A pointer chose one of a choice's options: it is the draft, committed in place. */
1677
+ readonly EditChosen: {
1678
+ readonly draft: Schema.String;
1679
+ };
1680
+ /**
1681
+ * The draft is to be kept. When the column accepts it the edit ends, focus
1682
+ * goes to `next` (the cell below, or beside, worked out by the view), and
1683
+ * the grid reports `Out.Edited`, unless the draft is the text the edit
1684
+ * began from or decodes to the same value; when it refuses it, the edit
1685
+ * stays with the error.
1686
+ */
1687
+ readonly EditCommitted: {
1688
+ readonly next: Schema.OptionFromNullOr<Schema.Struct<{
1689
+ readonly row: Schema.String;
1690
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1691
+ }>>;
1692
+ readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
1693
+ readonly top: Schema.Number;
1694
+ readonly left: Schema.Number;
1695
+ }>>;
1696
+ };
1697
+ readonly EditCancelled: {};
1698
+ /**
1699
+ * Text pasted, or a cut's cleared cells, laid onto editable cells by the
1700
+ * view (`Clipboard.pasteAt`). A cell its text leaves unchanged (as an
1701
+ * edit judges it, against `from`) is dropped; the rest are checked against
1702
+ * their columns and reported as one `Pasted`, or nothing when none is left.
1703
+ */
1704
+ readonly Pasted: {
1705
+ readonly cells: Schema.$Array<Schema.Struct<{
1706
+ readonly from: Schema.String;
1707
+ readonly row: Schema.String;
1708
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1709
+ readonly text: Schema.String;
1710
+ }>>;
1711
+ };
1712
+ /**
1713
+ * Ctrl or Meta with Z on the grid, or with Shift (or Ctrl+Y) for redo.
1714
+ * An open edit keeps them, since the editor's own undo is the field's.
1715
+ */
1716
+ readonly UndoRequested: {};
1717
+ readonly RedoRequested: {};
1718
+ /** Ctrl+D or Ctrl+R over a range, worked out by the view: carry `source` on to `to`. */
1719
+ readonly FillRequested: {
1720
+ readonly source: Schema.Struct<{
1721
+ readonly anchor: Schema.Struct<{
1722
+ readonly row: Schema.String;
1723
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1724
+ }>;
1725
+ readonly focus: Schema.Struct<{
1726
+ readonly row: Schema.String;
1727
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1728
+ }>;
1729
+ }>;
1730
+ readonly to: Schema.Struct<{
1731
+ readonly row: Schema.String;
1732
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
1733
+ }>;
1734
+ };
1735
+ /** The range's fill handle was pressed and moved: a fill begins from the range. */
1736
+ readonly FillStarted: {};
1737
+ /** The pointer, filling, is over the cell whose DOM id is `cell`. */
1738
+ readonly FillDragged: {
1739
+ readonly cell: Schema.String;
1740
+ };
1741
+ /** The fill handle was let go, or the drag cancelled (`completed` false). */
1742
+ readonly FillEnded: {
1743
+ readonly completed: Schema.Boolean;
1744
+ };
1745
+ }>;
1746
+ bundle: Bundle.Bundle<"DataGrid", void, {
1747
+ readonly focus: {
1748
+ readonly current: Option.Option<{
1749
+ readonly row: string;
1750
+ readonly column: keyof Specs & string;
1751
+ }>;
1752
+ readonly header: Option.Option<keyof Specs & string>;
1753
+ };
1754
+ readonly viewport: {
1755
+ readonly top: number;
1756
+ readonly left: number;
1757
+ readonly width: number;
1758
+ readonly height: number;
1759
+ };
1760
+ readonly columns: {
1761
+ readonly start: readonly (keyof Specs & string)[];
1762
+ readonly center: readonly (keyof Specs & string)[];
1763
+ readonly end: readonly (keyof Specs & string)[];
1764
+ readonly hidden: readonly (keyof Specs & string)[];
1765
+ readonly widths: readonly {
1766
+ readonly column: keyof Specs & string;
1767
+ readonly width: number;
1768
+ }[];
1769
+ };
1770
+ readonly resizing: Option.Option<{
1771
+ readonly column: keyof Specs & string;
1772
+ readonly from: number;
1773
+ }>;
1774
+ readonly dragging: Option.Option<{
1775
+ readonly column: keyof Specs & string;
1776
+ readonly delta: number;
1777
+ }>;
1778
+ readonly menu: Option.Option<{
1779
+ readonly column: keyof Specs & string;
1780
+ readonly active: number;
1781
+ }>;
1782
+ readonly filling: Option.Option<{
1783
+ readonly source: {
1784
+ readonly anchor: {
1785
+ readonly row: string;
1786
+ readonly column: keyof Specs & string;
1787
+ };
1788
+ readonly focus: {
1789
+ readonly row: string;
1790
+ readonly column: keyof Specs & string;
1791
+ };
1792
+ };
1793
+ readonly to: {
1794
+ readonly row: string;
1795
+ readonly column: keyof Specs & string;
1796
+ };
1797
+ }>;
1798
+ readonly selection: {
1799
+ readonly rows: {
1800
+ readonly _tag: "Keys";
1801
+ readonly keys: readonly string[];
1802
+ } | {
1803
+ readonly _tag: "AllExcept";
1804
+ readonly except: readonly string[];
1805
+ };
1806
+ readonly anchor: Option.Option<string>;
1807
+ readonly cells: Option.Option<{
1808
+ readonly anchor: {
1809
+ readonly row: string;
1810
+ readonly column: keyof Specs & string;
1811
+ };
1812
+ readonly focus: {
1813
+ readonly row: string;
1814
+ readonly column: keyof Specs & string;
1815
+ };
1816
+ }>;
1817
+ };
1818
+ readonly editing: Option.Option<{
1819
+ readonly address: {
1820
+ readonly row: string;
1821
+ readonly column: keyof Specs & string;
1822
+ };
1823
+ readonly from: string;
1824
+ readonly draft: string;
1825
+ readonly error: Option.Option<string>;
1826
+ }>;
1827
+ }, {
1828
+ readonly _tag: "Focused";
1829
+ readonly address: {
1830
+ readonly row: string;
1831
+ readonly column: keyof Specs & string;
1832
+ };
1833
+ } | {
1834
+ readonly _tag: "HeaderFocused";
1835
+ readonly column: keyof Specs & string;
1836
+ readonly reveal: Option.Option<{
1837
+ readonly top: number;
1838
+ readonly left: number;
1839
+ }>;
1840
+ } | {
1841
+ readonly _tag: "Measured";
1842
+ readonly width: number;
1843
+ readonly height: number;
1844
+ readonly top: number;
1845
+ readonly left: number;
1846
+ } | {
1847
+ readonly _tag: "Revealed";
1848
+ readonly top: number;
1849
+ readonly left: number;
1850
+ } | {
1851
+ readonly _tag: "Pasted";
1852
+ readonly cells: readonly {
1853
+ readonly from: string;
1854
+ readonly row: string;
1855
+ readonly column: keyof Specs & string;
1856
+ readonly text: string;
1857
+ }[];
1858
+ } | {
1859
+ readonly _tag: "UndoRequested";
1860
+ } | {
1861
+ readonly _tag: "RedoRequested";
1862
+ } | {
1863
+ readonly _tag: "Moved";
1864
+ readonly address: {
1865
+ readonly row: string;
1866
+ readonly column: keyof Specs & string;
1867
+ };
1868
+ readonly reveal: Option.Option<{
1869
+ readonly top: number;
1870
+ readonly left: number;
1871
+ }>;
1872
+ } | {
1873
+ readonly _tag: "ColumnResized";
1874
+ readonly column: keyof Specs & string;
1875
+ readonly width: number;
1876
+ } | {
1877
+ readonly _tag: "ColumnHidden";
1878
+ readonly column: keyof Specs & string;
1879
+ } | {
1880
+ readonly _tag: "ColumnShown";
1881
+ readonly column: keyof Specs & string;
1882
+ } | {
1883
+ readonly _tag: "ColumnMoved";
1884
+ readonly column: keyof Specs & string;
1885
+ readonly region: "start" | "center" | "end";
1886
+ readonly index: number;
1887
+ } | {
1888
+ readonly _tag: "ResizeStarted";
1889
+ readonly column: keyof Specs & string;
1890
+ } | {
1891
+ readonly _tag: "ResizeMoved";
1892
+ readonly delta: number;
1893
+ } | {
1894
+ readonly _tag: "ResizeEnded";
1895
+ readonly completed: boolean;
1896
+ } | {
1897
+ readonly _tag: "ColumnDragStarted";
1898
+ readonly header: string;
1899
+ } | {
1900
+ readonly _tag: "ColumnDragged";
1901
+ readonly delta: number;
1902
+ } | {
1903
+ readonly _tag: "ColumnDragEnded";
1904
+ readonly completed: boolean;
1905
+ } | {
1906
+ readonly _tag: "MenuOpened";
1907
+ readonly column: keyof Specs & string;
1908
+ } | {
1909
+ readonly _tag: "MenuMoved";
1910
+ readonly active: number;
1911
+ } | {
1912
+ readonly _tag: "MenuChosen";
1913
+ readonly index: number;
1914
+ } | {
1915
+ readonly _tag: "MenuClosed";
1916
+ } | {
1917
+ readonly _tag: "RowSelected";
1918
+ readonly row: string;
1919
+ } | {
1920
+ readonly _tag: "RowsExtended";
1921
+ readonly rows: readonly string[];
1922
+ readonly to: string;
1923
+ } | {
1924
+ readonly _tag: "AllRowsSelected";
1925
+ } | {
1926
+ readonly _tag: "RowsCleared";
1927
+ } | {
1928
+ readonly _tag: "CellsSelected";
1929
+ readonly anchor: {
1930
+ readonly row: string;
1931
+ readonly column: keyof Specs & string;
1932
+ };
1933
+ readonly focus: {
1934
+ readonly row: string;
1935
+ readonly column: keyof Specs & string;
1936
+ };
1937
+ readonly reveal: Option.Option<{
1938
+ readonly top: number;
1939
+ readonly left: number;
1940
+ }>;
1941
+ } | {
1942
+ readonly _tag: "CellPressed";
1943
+ readonly cell: string;
1944
+ readonly shiftKey: boolean;
1945
+ readonly toggleKey: boolean;
1946
+ } | {
1947
+ readonly _tag: "CellsCleared";
1948
+ } | {
1949
+ readonly _tag: "EditStarted";
1950
+ readonly address: {
1951
+ readonly row: string;
1952
+ readonly column: keyof Specs & string;
1953
+ };
1954
+ readonly draft: string;
1955
+ } | {
1956
+ readonly _tag: "EditTyped";
1957
+ readonly address: {
1958
+ readonly row: string;
1959
+ readonly column: keyof Specs & string;
1960
+ };
1961
+ readonly text: string;
1962
+ readonly from: string;
1963
+ } | {
1964
+ readonly _tag: "EditChanged";
1965
+ readonly draft: string;
1966
+ } | {
1967
+ readonly _tag: "EditStepped";
1968
+ readonly by: "next" | "previous" | "first" | "last" | "pageNext" | "pagePrevious";
1969
+ } | {
1970
+ readonly _tag: "EditChosen";
1971
+ readonly draft: string;
1972
+ } | {
1973
+ readonly _tag: "EditCommitted";
1974
+ readonly next: Option.Option<{
1975
+ readonly row: string;
1976
+ readonly column: keyof Specs & string;
1977
+ }>;
1978
+ readonly reveal: Option.Option<{
1979
+ readonly top: number;
1980
+ readonly left: number;
1981
+ }>;
1982
+ } | {
1983
+ readonly _tag: "EditCancelled";
1984
+ } | {
1985
+ readonly _tag: "FillStarted";
1986
+ } | {
1987
+ readonly _tag: "FillDragged";
1988
+ readonly cell: string;
1989
+ } | {
1990
+ readonly _tag: "FillEnded";
1991
+ readonly completed: boolean;
1992
+ } | {
1993
+ readonly _tag: "FillRequested";
1994
+ readonly source: {
1995
+ readonly anchor: {
1996
+ readonly row: string;
1997
+ readonly column: keyof Specs & string;
1998
+ };
1999
+ readonly focus: {
2000
+ readonly row: string;
2001
+ readonly column: keyof Specs & string;
2002
+ };
2003
+ };
2004
+ readonly to: {
2005
+ readonly row: string;
2006
+ readonly column: keyof Specs & string;
2007
+ };
2008
+ }, {
2009
+ readonly _tag: "UndoRequested";
2010
+ } | {
2011
+ readonly _tag: "RedoRequested";
2012
+ } | {
2013
+ readonly _tag: "Edited";
2014
+ readonly row: string;
2015
+ readonly column: keyof Specs & string;
2016
+ readonly text: string;
2017
+ } | {
2018
+ readonly _tag: "Pasted";
2019
+ readonly accepted: readonly {
2020
+ readonly row: string;
2021
+ readonly column: keyof Specs & string;
2022
+ readonly text: string;
2023
+ }[];
2024
+ readonly refused: readonly {
2025
+ readonly error: string;
2026
+ readonly row: string;
2027
+ readonly column: keyof Specs & string;
2028
+ readonly text: string;
2029
+ }[];
2030
+ } | {
2031
+ readonly _tag: "Filled";
2032
+ readonly source: {
2033
+ readonly anchor: {
2034
+ readonly row: string;
2035
+ readonly column: keyof Specs & string;
2036
+ };
2037
+ readonly focus: {
2038
+ readonly row: string;
2039
+ readonly column: keyof Specs & string;
2040
+ };
2041
+ };
2042
+ readonly to: {
2043
+ readonly row: string;
2044
+ readonly column: keyof Specs & string;
2045
+ };
2046
+ }, never, never, void, {}, {}>;
2047
+ };
2048
+ };
2049
+ /** What `DataGrid.make` returns for these columns: the grid a view draws. */
2050
+ type DataGridOf<Row, Specs extends Record<string, ColumnSpec<Row, unknown>>> = ReturnType<typeof make<Row, Specs>>;
2051
+ //#endregion
2052
+ //#region src/focus.d.ts
2053
+ type Direction = 'ltr' | 'rtl';
2054
+ interface KeyOptions<Id extends string> {
2055
+ readonly current: Option.Option<CellAddress<Id>>;
2056
+ readonly key: string;
2057
+ readonly modifiers: KeyboardModifiers;
2058
+ /** Default `'ltr'`; under `'rtl'` the left and right arrows swap. */
2059
+ readonly direction?: Direction;
2060
+ /** How many rows PageUp and PageDown move: the rows a viewport shows. */
2061
+ readonly pageRows: number;
2062
+ }
2063
+ export declare const GridFocus: {
2064
+ make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(columns: Columns<Row, Specs>) => {
2065
+ Address: Schema.Struct<{
2066
+ readonly row: Schema.String;
2067
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
2068
+ }>;
2069
+ Model: Schema.Struct<{
2070
+ /** The focused cell; stored as `null` when none is. */
2071
+ readonly current: Schema.OptionFromNullOr<Schema.Struct<{
2072
+ readonly row: Schema.String;
2073
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
2074
+ }>>;
2075
+ /**
2076
+ * The column header focus is on, when it is on the header row. The cell
2077
+ * focused before stays in `current`, so going back down returns to it.
2078
+ */
2079
+ readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
2080
+ }>;
2081
+ Message: import("foldkit/message").MessageUnion<{
2082
+ /** A cell became current: the user focused it, or a key moved there. */
2083
+ readonly Focused: {
2084
+ readonly address: Schema.Struct<{
2085
+ readonly row: Schema.String;
2086
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
2087
+ }>;
2088
+ };
2089
+ /** Focus went up to a column's header. */
2090
+ readonly HeaderFocused: {
2091
+ readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
2092
+ };
2093
+ }>;
2094
+ bundle: Bundle.Bundle<"GridFocus", void, {
2095
+ readonly current: Option.Option<{
2096
+ readonly row: string;
2097
+ readonly column: keyof Specs & string;
2098
+ }>;
2099
+ readonly header: Option.Option<keyof Specs & string>;
2100
+ }, {
2101
+ readonly _tag: "Focused";
2102
+ readonly address: {
2103
+ readonly row: string;
2104
+ readonly column: keyof Specs & string;
2105
+ };
2106
+ } | {
2107
+ readonly _tag: "HeaderFocused";
2108
+ readonly column: keyof Specs & string;
2109
+ }, never, never, never, void, {}, {}>;
2110
+ };
2111
+ target: <Row, Id extends string>(projection: GridProjection<Row, Id>, options: KeyOptions<Id>) => Option.Option<CellAddress<Id>>;
2112
+ tabStop: <Row, Id extends string>(projection: GridProjection<Row, Id>, current: Option.Option<CellAddress<Id>>) => Option.Option<CellAddress<Id>>;
2113
+ cellId: <Id extends string>(grid: string, address: CellAddress<Id>) => string;
2114
+ cellOf: (grid: string, id: string) => Option.Option<{
2115
+ readonly row: string;
2116
+ readonly column: string;
2117
+ }>;
2118
+ headerId: (grid: string, column: string) => string;
2119
+ headerOf: (grid: string, id: string) => Option.Option<string>;
2120
+ };
2121
+ //#endregion
2122
+ //#region src/selection.d.ts
2123
+ /**
2124
+ * Which rows are selected. `Keys` names them; `AllExcept` is every row but
2125
+ * these, so select-all holds whatever the rows are, loaded or not, and
2126
+ * however many there turn out to be.
2127
+ */
2128
+ export declare const RowSelection: import("foldkit/schema").TaggedUnion<{
2129
+ readonly Keys: {
2130
+ readonly keys: Schema.$Array<Schema.String>;
2131
+ };
2132
+ readonly AllExcept: {
2133
+ readonly except: Schema.$Array<Schema.String>;
2134
+ };
2135
+ }>;
2136
+ export type RowSelection = typeof RowSelection.Type;
2137
+ /** A rectangle of cells, named by its corners, so it survives a re-sort as two cells. */
2138
+ interface CellRange<Id extends string> {
2139
+ readonly anchor: CellAddress<Id>;
2140
+ readonly focus: CellAddress<Id>;
2141
+ }
2142
+ interface ExtendOptions<Id extends string> {
2143
+ readonly range: Option.Option<CellRange<Id>>;
2144
+ /** The focused cell: a range grows from it when there is none. */
2145
+ readonly current: Option.Option<CellAddress<Id>>;
2146
+ readonly key: string;
2147
+ readonly modifiers: KeyboardModifiers;
2148
+ readonly pageRows: number;
2149
+ readonly direction?: Direction;
2150
+ }
2151
+ export declare const GridSelection: {
2152
+ none: {
2153
+ readonly _tag: "Keys";
2154
+ readonly keys: readonly string[];
2155
+ };
2156
+ isSelected: (selection: RowSelection) => ((key: string) => boolean);
2157
+ toggle: (selection: RowSelection, key: string) => RowSelection;
2158
+ add: (selection: RowSelection, keys: ReadonlyArray<string>) => RowSelection;
2159
+ rowsBetween: <Row, Id extends string>(projection: GridProjection<Row, Id>, from: string, to: string) => ReadonlyArray<string>;
2160
+ boxOf: <Row, Id extends string>(projection: GridProjection<Row, Id>, range: CellRange<Id>) => Option.Option<CellBox<Id>>;
2161
+ extend: <Row, Id extends string>(projection: GridProjection<Row, Id>, options: ExtendOptions<Id>) => Option.Option<CellRange<Id>>;
2162
+ };
2163
+ //#endregion
2164
+ //#region src/viewport.d.ts
2165
+ declare const Message: import("foldkit/message").MessageUnion<{
2166
+ /** The scroll container moved or changed size; the Mount reports it. */
2167
+ readonly Measured: {
2168
+ readonly top: Schema.Number;
2169
+ readonly left: Schema.Number;
2170
+ readonly width: Schema.Number;
2171
+ readonly height: Schema.Number;
2172
+ };
2173
+ /** A reveal set the scroll offsets; the container's own scroll event confirms it later. */
2174
+ readonly Revealed: {
2175
+ readonly top: Schema.Number;
2176
+ readonly left: Schema.Number;
2177
+ };
2178
+ }>;
2179
+ type Message = typeof Message.Type;
2180
+ export declare const GridViewport: {
2181
+ Model: Schema.Struct<{
2182
+ readonly top: Schema.Number;
2183
+ readonly left: Schema.Number;
2184
+ readonly width: Schema.Number;
2185
+ readonly height: Schema.Number;
2186
+ }>;
2187
+ Message: import("foldkit/message").MessageUnion<{
2188
+ /** The scroll container moved or changed size; the Mount reports it. */
2189
+ readonly Measured: {
2190
+ readonly top: Schema.Number;
2191
+ readonly left: Schema.Number;
2192
+ readonly width: Schema.Number;
2193
+ readonly height: Schema.Number;
2194
+ };
2195
+ /** A reveal set the scroll offsets; the container's own scroll event confirms it later. */
2196
+ readonly Revealed: {
2197
+ readonly top: Schema.Number;
2198
+ readonly left: Schema.Number;
2199
+ };
2200
+ }>;
2201
+ bundle: Bundle.Bundle<"GridViewport", void, {
2202
+ readonly top: number;
2203
+ readonly left: number;
2204
+ readonly width: number;
2205
+ readonly height: number;
2206
+ }, {
2207
+ readonly _tag: "Measured";
2208
+ readonly top: number;
2209
+ readonly left: number;
2210
+ readonly width: number;
2211
+ readonly height: number;
2212
+ } | {
2213
+ readonly _tag: "Revealed";
2214
+ readonly top: number;
2215
+ readonly left: number;
2216
+ }, never, never, never, void, {}, {}>;
2217
+ Measure: Mount.MountDefinitionNoArgs<"GridViewportMeasure", {
2218
+ readonly _tag: "Measured";
2219
+ readonly top: number;
2220
+ readonly left: number;
2221
+ readonly width: number;
2222
+ readonly height: number;
2223
+ }>;
2224
+ scrollTo: (viewportId: string, offsets: Pick<Viewport, "top" | "left">) => Command<Message>;
2225
+ };
2226
+ //#endregion
2227
+ export { type AxisWindow, type CellBox, CellEditor, type CellOffset, type CellPosition, type CellRange, type CellText, type Column, type ColumnEdit, type ColumnId, type ColumnSpec, Columns, type DataGridOf, type Direction, type ExtendOptions, type FillPlan, type FillRequest, type Geometry, type GridWindow, type KeyOptions, type PastedCell, type ProjectionOptions, type Region, type Restored, type RevealOptions, RowCount, RowModel, RowStatus, type Viewport, type WindowOptions, addressableRows };
2228
+ //# sourceMappingURL=index.d.mts.map