zubin-grid 0.4.13 → 0.42.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +171 -36
  2. package/dist/adaptors/react/index.d.ts +71 -0
  3. package/dist/adaptors/react/index.d.ts.map +1 -0
  4. package/dist/adaptors/react/index.js +249 -0
  5. package/dist/adaptors/react/index.js.map +1 -0
  6. package/dist/core/cell.d.ts +17 -8
  7. package/dist/core/cell.d.ts.map +1 -1
  8. package/dist/core/cell.js +57 -39
  9. package/dist/core/cell.js.map +1 -1
  10. package/dist/core/grid-id.d.ts +7 -0
  11. package/dist/core/grid-id.d.ts.map +1 -0
  12. package/dist/core/grid-id.js +51 -0
  13. package/dist/core/grid-id.js.map +1 -0
  14. package/dist/core/grid.d.ts +9 -9
  15. package/dist/core/grid.d.ts.map +1 -1
  16. package/dist/core/grid.js +608 -199
  17. package/dist/core/grid.js.map +1 -1
  18. package/dist/core/head.d.ts +6 -12
  19. package/dist/core/head.d.ts.map +1 -1
  20. package/dist/core/head.js +20 -69
  21. package/dist/core/head.js.map +1 -1
  22. package/dist/core/helpers.d.ts +3 -3
  23. package/dist/core/helpers.d.ts.map +1 -1
  24. package/dist/core/helpers.js +5 -2
  25. package/dist/core/helpers.js.map +1 -1
  26. package/dist/core/persist.d.ts.map +1 -1
  27. package/dist/core/persist.js +53 -42
  28. package/dist/core/persist.js.map +1 -1
  29. package/dist/core/tail.d.ts +5 -10
  30. package/dist/core/tail.d.ts.map +1 -1
  31. package/dist/core/tail.js +7 -32
  32. package/dist/core/tail.js.map +1 -1
  33. package/dist/core/types/grid.types.d.ts +79 -32
  34. package/dist/core/types/grid.types.d.ts.map +1 -1
  35. package/dist/core/types/head.types.d.ts +7 -6
  36. package/dist/core/types/head.types.d.ts.map +1 -1
  37. package/dist/core/types/persist.types.d.ts +2 -0
  38. package/dist/core/types/persist.types.d.ts.map +1 -1
  39. package/dist/core/types/tail.types.d.ts +3 -2
  40. package/dist/core/types/tail.types.d.ts.map +1 -1
  41. package/dist/index.d.ts +7 -7
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +5 -5
  44. package/dist/index.js.map +1 -1
  45. package/package.json +5 -1
  46. package/dist/core/gridPersist.d.ts +0 -3
  47. package/dist/core/gridPersist.d.ts.map +0 -1
  48. package/dist/core/gridPersist.js +0 -2
  49. package/dist/core/gridPersist.js.map +0 -1
  50. package/dist/core/types/gridPersist.types.d.ts +0 -2
  51. package/dist/core/types/gridPersist.types.d.ts.map +0 -1
  52. package/dist/core/types/gridPersist.types.js +0 -2
  53. package/dist/core/types/gridPersist.types.js.map +0 -1
package/README.md CHANGED
@@ -4,10 +4,14 @@ A lightweight grid state manager for React and TypeScript.
4
4
 
5
5
  `zubin-grid` helps you model a 2D grid of reactive cells, update row and column headers, and compute derived row or column summaries with simple hooks.
6
6
 
7
+ The root package now stays framework-agnostic. React hooks live on the `zubin-grid/adaptors/react` subpath.
8
+
7
9
  ## Why use it?
8
10
 
9
11
  - Reactive cell store with subscriptions
12
+ - Flexible row and column ids with `string`, `number`, `boolean`, or `Date`
10
13
  - Typed grid API for rows, columns, heads, and tails
14
+ - Row-bound and column-bound dimension grids for axis metadata
11
15
  - React hooks for reading and updating state
12
16
  - Row and column reordering helpers
13
17
  - JSON-friendly initialization with typed row, column, and cell records
@@ -22,7 +26,7 @@ npm install zubin-grid react
22
26
 
23
27
  ## Local example app
24
28
 
25
- This repository also includes a small Vite + React playground under `examples/` so you can try the JSON-friendly grid API, persistence, and the demo controls locally.
29
+ This repository also includes a small Vite + React playground under `examples/` so you can try the JSON-friendly grid API, sparse-cell editing, elastic row/column resizing, persistence, demo controls, and a Conway's Game of Life reactivity showcase locally.
26
30
 
27
31
  ```bash
28
32
  npm install
@@ -80,7 +84,8 @@ console.log(salesGrid.getValue('north', 'jan'))
80
84
  Create the grid once outside render, or memoize it if you build it inside a component.
81
85
 
82
86
  ```tsx
83
- import { grid, useCell } from 'zubin-grid'
87
+ import { grid } from 'zubin-grid'
88
+ import { useCell } from 'zubin-grid/adaptors/react'
84
89
 
85
90
  type BudgetRowId = 'marketing' | 'ops'
86
91
  type BudgetColumnId = 'planned' | 'actual'
@@ -119,29 +124,55 @@ const budgetGrid = grid<BudgetSchema>(
119
124
  )
120
125
 
121
126
  export function BudgetCell(props: {
122
- rowId: BudgetRowId
123
- columnId: BudgetColumnId
127
+ row: number
128
+ col: number
124
129
  }) {
125
- const [value, setValue] = useCell(budgetGrid, props.rowId, props.columnId)
130
+ const [value, setValue, meta] = useCell(
131
+ budgetGrid,
132
+ { row: props.row, col: props.col },
133
+ {
134
+ placeholder: ({ rowId, columnId }) => ({
135
+ rowId,
136
+ columnId,
137
+ value: 0,
138
+ }),
139
+ },
140
+ )
126
141
 
127
142
  return (
128
- <input
129
- type="number"
130
- value={value}
131
- onChange={(event) => setValue(Number(event.target.value))}
132
- />
143
+ <label>
144
+ <input
145
+ type="number"
146
+ value={value.value}
147
+ onChange={(event) =>
148
+ setValue({
149
+ ...value,
150
+ value: Number(event.target.value),
151
+ })
152
+ }
153
+ />
154
+
155
+ <small>{meta.existsInDb ? 'stored' : 'placeholder'}</small>
156
+ </label>
133
157
  )
134
158
  }
135
159
  ```
136
160
 
137
- `useCell(grid, rowId, columnId)` returns a React-friendly setter for that cell. Outside React, mutate store cells with `grid.upsertCell(...)` or `grid.upsertCells(...)` rather than a store-level `setValue(...)` helper.
161
+ `useCell(...)` now returns `[value, setValue, meta]`.
162
+
163
+ - `meta.existsInDb` tells you whether the sparse store currently has a persisted cell for that coordinate.
164
+ - `meta.isDirty` tells you whether the cell differs from the last hydrated or persisted snapshot.
165
+ - Passing a `placeholder` keeps the UI dense even when the store is sparse.
166
+ - Calling `setValue(undefined)` removes that sparse cell entry again.
167
+
168
+ For row-bound and column-bound dimension grids, pass `{ row }` or `{ col }` respectively. `useCellValue(...)` follows the same sparse read rules but returns only the current value.
138
169
 
139
170
  ## Working with heads
140
171
 
141
172
  Headers are stored separately from cell values, so labels and order can change without rebuilding the grid.
142
173
 
143
174
  ```tsx
144
- import { useColumnHead, useRowHead } from 'zubin-grid'
175
+ import { useColumnHead, useRowHead } from 'zubin-grid/adaptors/react'
145
176
 
146
177
  export function HeaderControls() {
147
178
  const { head: rowHead, updateLabel } = useRowHead(budgetGrid, 'marketing')
@@ -166,7 +197,7 @@ export function HeaderControls() {
166
197
  Tails let you compute summaries such as totals.
167
198
 
168
199
  ```tsx
169
- import { useRowTail } from 'zubin-grid'
200
+ import { useRowTail } from 'zubin-grid/adaptors/react'
170
201
 
171
202
  export function MarketingRowTotal() {
172
203
  const total = useRowTail(budgetGrid, 'marketing', (cells) => {
@@ -179,10 +210,10 @@ export function MarketingRowTotal() {
179
210
 
180
211
  ## Reordering rows and columns
181
212
 
182
- `useGrid` now stays focused on reading the ordered row and column ids. Mutating helpers such as `reorderRow` and `reorderColumn` live on the `zubin-grid/helpers` subpath so the root package stays focused on the core store and hook primitives.
213
+ `useGrid` now stays focused on reading the ordered row and column ids. Mutating helpers such as `reorderRow` and `reorderColumn` live on the `zubin-grid/helpers` subpath, and the React hooks themselves live on `zubin-grid/adaptors/react`.
183
214
 
184
215
  ```tsx
185
- import { useGrid } from 'zubin-grid'
216
+ import { useGrid } from 'zubin-grid/adaptors/react'
186
217
  import { reorderColumn, reorderRow } from 'zubin-grid/helpers'
187
218
 
188
219
  export function GridToolbar() {
@@ -308,6 +339,35 @@ const bootstrappedSalesGrid = grid<SalesSchema>({}, {
308
339
  })
309
340
  ```
310
341
 
342
+ ## Flexible row and column ids
343
+
344
+ `zubin-grid` exports `GridId` as `string | number | boolean | Date`.
345
+
346
+ Each row id must still be unique within the row axis, and each column id must be unique within the column axis. `Date` ids are compared by timestamp rather than object identity, so recreating the same date value still points at the same row or column.
347
+
348
+ ```ts
349
+ const april14 = new Date('2026-04-14T00:00:00.000Z')
350
+
351
+ const availabilityGrid = grid({
352
+ rows: [
353
+ { id: true, label: 'Available' },
354
+ { id: false, label: 'Unavailable' },
355
+ ],
356
+ columns: [
357
+ { id: april14, label: 'April 14' },
358
+ ],
359
+ cells: [
360
+ { rowId: true, columnId: april14, value: 'x' },
361
+ ],
362
+ }, {
363
+ rowHeaders: ['id', 'rowId'],
364
+ colHeaders: ['id', 'columnId'],
365
+ })
366
+
367
+ availabilityGrid.getValue(true, new Date('2026-04-14T00:00:00.000Z'))
368
+ // 'x'
369
+ ```
370
+
311
371
  ## Non-reactive snapshots and upserts
312
372
 
313
373
  `grid.getState()` returns a plain snapshot of the current rows, columns, and cells without subscribing React to anything.
@@ -315,36 +375,88 @@ const bootstrappedSalesGrid = grid<SalesSchema>({}, {
315
375
  ```ts
316
376
  const snapshot = salesGrid.getState()
317
377
 
378
+ const northFebruary = salesGrid.readCell('north', 'feb')
379
+ // { value: undefined, meta: { existsInDb: false, isDirty: false } }
380
+
318
381
  salesGrid.upsertRows([{ id: 'west', label: 'West' }])
319
382
  salesGrid.upsertColumns([{ id: 'mar', label: 'March' }])
320
383
  salesGrid.upsertCell({ rowId: 'west', columnId: 'mar', value: 21 })
384
+ salesGrid.setCell('west', 'apr', { rowId: 'west', columnId: 'apr', value: 13 })
385
+ salesGrid.setCell('west', 'apr', undefined)
386
+ ```
387
+
388
+ `readCell(rowId, columnId)` is the sparse-aware getter, and `setCell(rowId, columnId, nextValue)` lazily creates or removes sparse cell entries. `getValue`, `getRowHead`, and `getColumnHead` remain strict non-reactive getters when you only need an already-materialized cell or a targeted header read.
389
+
390
+ ## Dimension grids
391
+
392
+ Use `createDimensionGrid` when you want one reactive cell per row or one reactive cell per column instead of a full row/column matrix. This is handy for statuses, visibility flags, notes, or other metadata attached to a single axis.
393
+
394
+ ```tsx
395
+ import { createDimensionGrid } from 'zubin-grid'
396
+ import { useCell } from 'zubin-grid/adaptors/react'
397
+
398
+ type ShipmentStatus = 'pending' | 'packed' | 'shipped'
399
+
400
+ const rowStatusGrid = createDimensionGrid<ShipmentStatus>(salesGrid, [], 'rows')
401
+ const columnStatusGrid = createDimensionGrid<ShipmentStatus>(
402
+ salesGrid,
403
+ ['pending'],
404
+ 'columns',
405
+ { persist: false },
406
+ )
407
+
408
+ rowStatusGrid.getValue(0)
409
+ rowStatusGrid.setGrid(['packed', 'shipped'], 'update')
410
+
411
+ function RowStatus(props: { row: number }) {
412
+ const [status, setStatus] = useCell(rowStatusGrid, { row: props.row })
413
+
414
+ return (
415
+ <select
416
+ value={status ?? ''}
417
+ onChange={(event) => setStatus(event.target.value as ShipmentStatus)}
418
+ >
419
+ <option value="">Unset</option>
420
+ <option value="pending">Pending</option>
421
+ <option value="packed">Packed</option>
422
+ <option value="shipped">Shipped</option>
423
+ </select>
424
+ )
425
+ }
321
426
  ```
322
427
 
323
- `getValue`, `getRowHead`, and `getColumnHead` are also non-reactive getters when you only need a targeted read.
428
+ `createDimensionGrid(parentGrid, initialCells, 'rows' | 'columns', options?)` keeps its size and ordering in sync with the chosen parent axis.
429
+
430
+ - Row dimension grids use `useCell(rowDimensionGrid, { row })`.
431
+ - Column dimension grids use `useCell(columnDimensionGrid, { col })`.
432
+ - `setGrid(...)` accepts either a plain array or `{ dimension, cells }`.
433
+ - Persistence inherits from the parent by default, can be disabled with `persist: false`, or overridden with `persist: ['your-key']`.
324
434
 
325
435
  ## Sub grids
326
436
 
327
437
  Use `createSubGrid` when you want a second grid layer that reuses the parent grid's row and column dimensions, but stores a different cell shape.
328
438
 
329
439
  ```ts
330
- import { createSubGrid, useCell } from 'zubin-grid'
440
+ import { createSubGrid } from 'zubin-grid'
441
+ import { useCell } from 'zubin-grid/adaptors/react'
331
442
 
332
443
  type SalesNoteCell = {
333
444
  note: string
334
445
  dirty?: boolean
335
446
  }
336
447
 
337
- const salesNotesGrid = createSubGrid<SalesNoteCell>(salesGrid, [], ['sales-notes'])
448
+ const salesNotesGrid = createSubGrid<SalesNoteCell>(salesGrid, [], {
449
+ persist: ['sales-notes'],
450
+ })
338
451
 
339
452
  function SalesNote(props: {
340
- rowId: 'north' | 'south'
341
- columnId: 'jan' | 'feb'
453
+ row: number
454
+ col: number
342
455
  }) {
343
- const [noteCell, setNoteCell] = useCell(
344
- salesNotesGrid,
345
- props.rowId,
346
- props.columnId,
347
- )
456
+ const [noteCell, setNoteCell] = useCell(salesNotesGrid, {
457
+ row: props.row,
458
+ col: props.col,
459
+ })
348
460
 
349
461
  return (
350
462
  <input
@@ -365,16 +477,17 @@ Sub grids behave like normal grids for cell and hook usage, with a few important
365
477
 
366
478
  - They inherit the parent grid's row ids, column ids, row heads, and column heads.
367
479
  - Parent row and column changes stay in sync, including upserts, label changes, order changes, `setGrid(...)`, and `clearGrid()`.
368
- - `useCell`, `useCellValue`, `useGrid`, `useRowHead`, `useColumnHead`, `useRowTail`, and `useColumnTail` all work with sub grids.
369
- - Persistence is independent, so a sub grid can keep its own snapshot with `persist: ['your-key']`.
480
+ - `useCell`, `useCellValue`, `useGrid`, `useRowHead`, `useColumnHead`, `useRowTail`, and `useColumnTail` from `zubin-grid/adaptors/react` all work with sub grids.
481
+ - Persistence inherits from the parent when omitted, can be disabled with `persist: false`, or can use a custom key with `persist: ['your-key']`.
370
482
  - Row and column mutations called on a sub grid are forwarded to the parent grid.
371
483
  - `clearGrid()` on a sub grid clears the sub grid's own cells while keeping the inherited parent dimensions intact.
372
484
 
373
- You can also pass an options object when you want cells plus persistence together in a single argument:
485
+ Pass seeded cells as the second argument and persistence as the optional third argument:
374
486
 
375
487
  ```ts
376
- const salesFlagsGrid = createSubGrid<SalesNoteCell>(salesGrid, {
377
- cells: [{ rowId: 'north', columnId: 'jan', value: { note: 'Review' } }],
488
+ const salesFlagsGrid = createSubGrid<SalesNoteCell>(salesGrid, [
489
+ { rowId: 'north', columnId: 'jan', value: { note: 'Review' } },
490
+ ], {
378
491
  persist: ['sales-flags'],
379
492
  })
380
493
  ```
@@ -419,14 +532,19 @@ const persistedWithCustomAdapter = grid<SalesSchema>(initialState, {
419
532
  - `cell(initialValue)` - creates a reactive cell
420
533
  - `grid({ rows, columns, cells }, options)` - creates a grid from JSON-friendly state
421
534
  - `grid(() => ({ rows, columns, cells }), options)` - lazily creates typed grid state
422
- - `createSubGrid(parentGrid, cellsOrOptions?, persist?)` - creates a child grid with its own cells while inheriting the parent grid dimensions
535
+ - `createDimensionGrid(parentGrid, initialCells, dimension, options?)` - creates a row-bound or column-bound grid that stays synced with the parent axis
536
+ - `createSubGrid(parentGrid, initialCells?, options?)` - creates a child grid with its own cells while inheriting the parent grid dimensions
423
537
 
424
538
  ### Cell hooks
425
539
 
426
540
  - `useCell(cell)`
427
- - `useCell(grid, rowId, columnId)`
541
+ - `useCell(grid, { row, col })`
542
+ - `useCell(rowDimensionGrid, { row })`
543
+ - `useCell(columnDimensionGrid, { col })`
428
544
  - `useCellValue(...)`
429
545
 
546
+ All React hooks are exported from `zubin-grid/adaptors/react`, not the root package.
547
+
430
548
  ### Head hooks
431
549
 
432
550
  - `useRowHead(grid, rowId)`
@@ -439,10 +557,11 @@ const persistedWithCustomAdapter = grid<SalesSchema>(initialState, {
439
557
 
440
558
  ### Grid helpers
441
559
 
442
- - `useGrid(grid, { onGridUpdate })` - reads the current ordered row and column ids and can subscribe to every grid mutation
443
560
  - `createGridKey(rowId, columnId)`
444
561
  - `grid.getState()`
562
+ - `grid.readCell(rowId, columnId)`
445
563
  - `grid.setGrid(nextState, mode?)`
564
+ - `grid.setCell(rowId, columnId, nextValue)`
446
565
  - `grid.upsertRow(...)`
447
566
  - `grid.upsertRows(...)`
448
567
  - `grid.upsertColumn(...)`
@@ -458,15 +577,31 @@ const persistedWithCustomAdapter = grid<SalesSchema>(initialState, {
458
577
  - `reorderRow(grid, activeRowId, overRowId)` from `zubin-grid/helpers`
459
578
  - `reorderColumn(grid, activeColumnId, overColumnId)` from `zubin-grid/helpers`
460
579
 
580
+ ### React adaptor
581
+
582
+ - `useCell(...)` from `zubin-grid/adaptors/react`
583
+ - `useCellValue(...)` from `zubin-grid/adaptors/react`
584
+ - `useGrid(grid, { onGridUpdate })` from `zubin-grid/adaptors/react`
585
+ - `useRowHead(...)` / `useColumnHead(...)` from `zubin-grid/adaptors/react`
586
+ - `useRowTail(...)` / `useColumnTail(...)` from `zubin-grid/adaptors/react`
587
+
461
588
  ## Imports
462
589
 
463
- Use the root package for most cases:
590
+ Use the root package for framework-agnostic state primitives:
464
591
 
465
592
  ```ts
466
593
  import {
467
594
  cell,
595
+ createDimensionGrid,
468
596
  createSubGrid,
469
597
  grid,
598
+ } from 'zubin-grid'
599
+ ```
600
+
601
+ Use the React adaptor for hooks:
602
+
603
+ ```ts
604
+ import {
470
605
  useCell,
471
606
  useCellValue,
472
607
  useRowHead,
@@ -474,7 +609,7 @@ import {
474
609
  useRowTail,
475
610
  useColumnTail,
476
611
  useGrid,
477
- } from 'zubin-grid'
612
+ } from 'zubin-grid/adaptors/react'
478
613
  ```
479
614
 
480
615
  Subpath imports are also available:
@@ -482,7 +617,7 @@ Subpath imports are also available:
482
617
  ```ts
483
618
  import { grid } from 'zubin-grid/grid'
484
619
  import { reorderColumn, reorderRow } from 'zubin-grid/helpers'
485
- import { useRowTail } from 'zubin-grid/tail'
620
+ import { useRowTail } from 'zubin-grid/adaptors/react'
486
621
  ```
487
622
 
488
623
  ## Links
@@ -0,0 +1,71 @@
1
+ import type { Cell, Updater } from "../../core/types/cell.types.js";
2
+ import type { DimensionGrid, DimensionGridPosition, Grid, GridAxisIds, GridCellMeta, GridCellPosition, GridDimension, GridState, GridSubscriber } from "../../core/types/grid.types.js";
3
+ import type { GridHead, GridHeadHookResult, GridId } from "../../core/types/head.types.js";
4
+ import type { GridAxisTailUpdater, GridTailHookValue } from "../../core/types/tail.types.js";
5
+ export type { GridCellMeta } from "../../core/types/grid.types.js";
6
+ export type { GridHeadHookResult } from "../../core/types/head.types.js";
7
+ export type { GridTailHookValue } from "../../core/types/tail.types.js";
8
+ export interface UseGridOptions<TCell, TRowId extends GridId = GridId, TColumnId extends GridId = GridId, TRowHead extends GridHead<TRowId> = GridHead<TRowId>, TColumnHead extends GridHead<TColumnId> = GridHead<TColumnId>, TStateCell = unknown, TState extends GridState<TStateCell, TRowHead, TColumnHead> = GridState<TStateCell, TRowHead, TColumnHead>> {
9
+ onGridUpdate?: GridSubscriber<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>;
10
+ }
11
+ export type UseCellPlaceholder<TValue, TContext> = TValue | ((context: TContext) => TValue);
12
+ export interface GridCellPlaceholderContext<TRowId extends GridId = GridId, TColumnId extends GridId = GridId> {
13
+ row: number;
14
+ col: number;
15
+ rowId: TRowId;
16
+ columnId: TColumnId;
17
+ meta: GridCellMeta;
18
+ }
19
+ export interface DimensionCellPlaceholderContext<TDimension extends GridDimension = GridDimension, TRowId extends GridId = GridId, TColumnId extends GridId = GridId> {
20
+ dimension: TDimension;
21
+ index: number;
22
+ row?: number;
23
+ col?: number;
24
+ rowId?: TRowId;
25
+ columnId?: TColumnId;
26
+ meta: GridCellMeta;
27
+ }
28
+ export interface UseCellOptions<TValue, TContext> {
29
+ placeholder?: UseCellPlaceholder<TValue, TContext>;
30
+ }
31
+ export declare function useGrid<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, options?: UseGridOptions<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>): GridAxisIds<TRowId, TColumnId>;
32
+ export declare function useRowHead<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, rowId: TRowId): GridHeadHookResult<TRowHead>;
33
+ export declare function useColumnHead<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, columnId: TColumnId): GridHeadHookResult<TColumnHead>;
34
+ export declare const useColHead: typeof useColumnHead;
35
+ export declare function useRowTail<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>, TTail = void>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, rowId: TRowId, onRowUpdate?: GridAxisTailUpdater<TCell, TRowId, TColumnId, TTail>): GridTailHookValue<TTail>;
36
+ export declare function useColumnTail<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>, TTail = void>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, columnId: TColumnId, onColumnUpdate?: GridAxisTailUpdater<TCell, TRowId, TColumnId, TTail>): GridTailHookValue<TTail>;
37
+ export declare function useCell<TCell>(currentCell: Cell<TCell>): readonly [TCell, (newValue: Updater<TCell>) => void, GridCellMeta];
38
+ export declare function useCell<TCell, TDimension extends GridDimension, TRowId extends GridId, TColumnId extends GridId>(currentGrid: DimensionGrid<TCell, TDimension, TRowId, TColumnId>, position: DimensionGridPosition<TDimension>): readonly [
39
+ TCell | undefined,
40
+ (newValue: Updater<TCell | undefined>) => void,
41
+ GridCellMeta
42
+ ];
43
+ export declare function useCell<TCell, TDimension extends GridDimension, TRowId extends GridId, TColumnId extends GridId>(currentGrid: DimensionGrid<TCell, TDimension, TRowId, TColumnId>, position: DimensionGridPosition<TDimension>, options: UseCellOptions<TCell, DimensionCellPlaceholderContext<TDimension, TRowId, TColumnId>> & {
44
+ placeholder: UseCellPlaceholder<TCell, DimensionCellPlaceholderContext<TDimension, TRowId, TColumnId>>;
45
+ }): readonly [
46
+ TCell,
47
+ (newValue: TCell | undefined | ((currentValue: TCell) => TCell | undefined)) => void,
48
+ GridCellMeta
49
+ ];
50
+ export declare function useCell<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, position: GridCellPosition): readonly [
51
+ TCell | undefined,
52
+ (newValue: Updater<TCell | undefined>) => void,
53
+ GridCellMeta
54
+ ];
55
+ export declare function useCell<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, position: GridCellPosition, options: UseCellOptions<TCell, GridCellPlaceholderContext<TRowId, TColumnId>> & {
56
+ placeholder: UseCellPlaceholder<TCell, GridCellPlaceholderContext<TRowId, TColumnId>>;
57
+ }): readonly [
58
+ TCell,
59
+ (newValue: TCell | undefined | ((currentValue: TCell) => TCell | undefined)) => void,
60
+ GridCellMeta
61
+ ];
62
+ export declare function useCellValue<TCell>(currentCell: Cell<TCell>): TCell;
63
+ export declare function useCellValue<TCell, TDimension extends GridDimension, TRowId extends GridId, TColumnId extends GridId>(currentGrid: DimensionGrid<TCell, TDimension, TRowId, TColumnId>, position: DimensionGridPosition<TDimension>): TCell | undefined;
64
+ export declare function useCellValue<TCell, TDimension extends GridDimension, TRowId extends GridId, TColumnId extends GridId>(currentGrid: DimensionGrid<TCell, TDimension, TRowId, TColumnId>, position: DimensionGridPosition<TDimension>, options: UseCellOptions<TCell, DimensionCellPlaceholderContext<TDimension, TRowId, TColumnId>> & {
65
+ placeholder: UseCellPlaceholder<TCell, DimensionCellPlaceholderContext<TDimension, TRowId, TColumnId>>;
66
+ }): TCell;
67
+ export declare function useCellValue<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, position: GridCellPosition): TCell | undefined;
68
+ export declare function useCellValue<TCell, TRowId extends GridId, TColumnId extends GridId, TRowHead extends GridHead<TRowId>, TColumnHead extends GridHead<TColumnId>, TStateCell, TState extends GridState<TStateCell, TRowHead, TColumnHead>>(currentGrid: Grid<TCell, TRowId, TColumnId, TRowHead, TColumnHead, TStateCell, TState>, position: GridCellPosition, options: UseCellOptions<TCell, GridCellPlaceholderContext<TRowId, TColumnId>> & {
69
+ placeholder: UseCellPlaceholder<TCell, GridCellPlaceholderContext<TRowId, TColumnId>>;
70
+ }): TCell;
71
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../adaptors/react/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAc,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACP,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AAExC,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,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