@rowsncolumns/y-spreadsheet 16.1.0 → 17.0.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.
- package/Readme.md +21 -6
- package/dist/cjs/helpers-v5.d.ts +11 -11
- package/dist/cjs/helpers-v5.d.ts.map +1 -1
- package/dist/cjs/helpers-v5.js +46 -33
- package/dist/cjs/helpers.d.ts +17 -19
- package/dist/cjs/helpers.d.ts.map +1 -1
- package/dist/cjs/helpers.js +89 -86
- package/dist/cjs/observables.d.ts +7 -7
- package/dist/cjs/observables.d.ts.map +1 -1
- package/dist/cjs/observables.js +34 -46
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +96 -19
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/use-yspreadsheet-v2.d.ts +11 -10
- package/dist/cjs/use-yspreadsheet-v2.d.ts.map +1 -1
- package/dist/cjs/use-yspreadsheet-v2.js +79 -90
- package/dist/cjs/use-yspreadsheet.d.ts +6 -6
- package/dist/cjs/use-yspreadsheet.d.ts.map +1 -1
- package/dist/cjs/use-yspreadsheet.js +38 -74
- package/dist/cjs/yjs-runtime.js +5 -5
- package/dist/cjs/ynodes.d.ts +61 -0
- package/dist/cjs/ynodes.d.ts.map +1 -0
- package/dist/cjs/ynodes.js +224 -0
- package/dist/esm/helpers-v5.d.ts +11 -11
- package/dist/esm/helpers-v5.d.ts.map +1 -1
- package/dist/esm/helpers-v5.js +46 -33
- package/dist/esm/helpers.d.ts +17 -19
- package/dist/esm/helpers.d.ts.map +1 -1
- package/dist/esm/helpers.js +90 -87
- package/dist/esm/observables.d.ts +7 -7
- package/dist/esm/observables.d.ts.map +1 -1
- package/dist/esm/observables.js +21 -25
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +96 -19
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/use-yspreadsheet-v2.d.ts +11 -10
- package/dist/esm/use-yspreadsheet-v2.d.ts.map +1 -1
- package/dist/esm/use-yspreadsheet-v2.js +76 -88
- package/dist/esm/use-yspreadsheet.d.ts +6 -6
- package/dist/esm/use-yspreadsheet.d.ts.map +1 -1
- package/dist/esm/use-yspreadsheet.js +17 -43
- package/dist/esm/yjs-runtime.js +5 -5
- package/dist/esm/ynodes.d.ts +61 -0
- package/dist/esm/ynodes.d.ts.map +1 -0
- package/dist/esm/ynodes.js +146 -0
- package/package.json +9 -8
package/dist/esm/helpers-v5.js
CHANGED
|
@@ -20,6 +20,7 @@ import cloneDeep from "lodash/cloneDeep";
|
|
|
20
20
|
import isEqual from "lodash/isEqual";
|
|
21
21
|
import set from "lodash/set";
|
|
22
22
|
import unset from "lodash/unset";
|
|
23
|
+
import { forEachEntry } from "./ynodes";
|
|
23
24
|
const CELLS_V5 = "rncCells"; // RNC_CELLS
|
|
24
25
|
const NOTES_V5 = "rncNotes"; // NOTES
|
|
25
26
|
const DIMS_V5 = "rncDimensions"; // DIMS
|
|
@@ -34,6 +35,7 @@ const STYLE_LOG_V2 = 2; // STYLE_LOG_V2
|
|
|
34
35
|
const CELL_KEY_V5 = /^(-?\d+):(-?\d+):(-?\d+)$/; // cell_key
|
|
35
36
|
const BLOCK_KEY_V5 = /^(-?\d+):(-?\d+):(\d+)$/; // block_key
|
|
36
37
|
const DIM_KEY_V5 = /^(-?\d+):([RC]):(-?\d+)$/; // dim_id_key
|
|
38
|
+
const DIM_STRIPE_KEY_V5 = /^(-?\d+):([RC]):k(\d+)$/; // dim_c0_stripe_key
|
|
37
39
|
const SEED_KEY = /^(-?\d+)!([A-Z]+)(\d+)$/; // `"{sheetId}!{A1}"`, parse_a1
|
|
38
40
|
// ── ids (axis.rs: make_id, id_client, id_counter) ───────────────────────────
|
|
39
41
|
const idCounter = (id) => Number((BigInt.asUintN(64, id) >> BigInt(32)) & BigInt(0xffffffff));
|
|
@@ -67,7 +69,7 @@ export const readLineIds = (doc, sheetId, axis) => {
|
|
|
67
69
|
return [];
|
|
68
70
|
const ids = [];
|
|
69
71
|
const seen = new Set();
|
|
70
|
-
for (const value of doc.
|
|
72
|
+
for (const value of doc.get(name).toArray()) {
|
|
71
73
|
const id = lineIdText(value);
|
|
72
74
|
if (id === null || seen.has(id))
|
|
73
75
|
continue;
|
|
@@ -204,7 +206,7 @@ const foldStyleBuffer = (overlay, buf) => {
|
|
|
204
206
|
export const readStyleOverlayV5 = (doc) => {
|
|
205
207
|
const overlay = new Map();
|
|
206
208
|
if (doc.share.has(STYLES_SEED_V5)) {
|
|
207
|
-
doc.
|
|
209
|
+
forEachEntry(doc.get(STYLES_SEED_V5), (value, key) => {
|
|
208
210
|
const match = SEED_KEY.exec(key);
|
|
209
211
|
if (!match || !isPlainObject(value))
|
|
210
212
|
return;
|
|
@@ -214,7 +216,7 @@ export const readStyleOverlayV5 = (doc) => {
|
|
|
214
216
|
});
|
|
215
217
|
}
|
|
216
218
|
if (doc.share.has(STYLES_LOG_V5)) {
|
|
217
|
-
for (const buf of doc.
|
|
219
|
+
for (const buf of doc.get(STYLES_LOG_V5).toArray()) {
|
|
218
220
|
if (buf instanceof Uint8Array)
|
|
219
221
|
foldStyleBuffer(overlay, buf);
|
|
220
222
|
}
|
|
@@ -267,7 +269,7 @@ const coldCellExists = (doc, cache, sheetId, rowId, colId) => {
|
|
|
267
269
|
const key = `${sheetId}:${colId}:${Math.floor((counter - 1) / BLOCK_ROWS)}`;
|
|
268
270
|
let offsets = cache.get(key);
|
|
269
271
|
if (!offsets) {
|
|
270
|
-
const buf = doc.
|
|
272
|
+
const buf = doc.get(BLOCKS_V5).getAttr(key);
|
|
271
273
|
offsets = new Set(buf instanceof Uint8Array ? blockRowOffsets(buf) : []);
|
|
272
274
|
cache.set(key, offsets);
|
|
273
275
|
}
|
|
@@ -281,12 +283,12 @@ const coldCellExists = (doc, cache, sheetId, rowId, colId) => {
|
|
|
281
283
|
*/
|
|
282
284
|
const composeCell = (doc, key, styles) => {
|
|
283
285
|
let cell = doc.share.has(CELLS_V5)
|
|
284
|
-
? cellDataV5(doc.
|
|
286
|
+
? cellDataV5(doc.get(CELLS_V5).getAttr(key))
|
|
285
287
|
: null;
|
|
286
288
|
const uf = styles.get(key);
|
|
287
289
|
if (uf)
|
|
288
290
|
cell = { ...cell, uf };
|
|
289
|
-
const note = doc.share.has(NOTES_V5) ? doc.
|
|
291
|
+
const note = doc.share.has(NOTES_V5) ? doc.get(NOTES_V5).getAttr(key) : undefined;
|
|
290
292
|
if (typeof note === "string")
|
|
291
293
|
cell = { ...cell, note };
|
|
292
294
|
return cell;
|
|
@@ -301,9 +303,10 @@ export const sheetDataV5ToV2 = (doc, styles = readStyleOverlayV5(doc)) => {
|
|
|
301
303
|
const cache = new Map();
|
|
302
304
|
const keys = new Set(styles.keys());
|
|
303
305
|
for (const name of [CELLS_V5, NOTES_V5]) {
|
|
304
|
-
if (doc.share.has(name))
|
|
305
|
-
for (const key of doc.
|
|
306
|
+
if (doc.share.has(name)) {
|
|
307
|
+
for (const key of doc.get(name).attrKeys())
|
|
306
308
|
keys.add(key);
|
|
309
|
+
}
|
|
307
310
|
}
|
|
308
311
|
for (const key of keys) {
|
|
309
312
|
const parsed = parseCellKeyV5(key);
|
|
@@ -403,7 +406,8 @@ const writerAxis = (w, sheetId, isRow) => {
|
|
|
403
406
|
/**
|
|
404
407
|
* `YrsStore::c0_floor` of every sheet and axis, keyed by `axisKey`: the highest
|
|
405
408
|
* client-0 counter any hot key (tombstones and orphans too), composed style,
|
|
406
|
-
* note, dimension or cold block references. One
|
|
409
|
+
* note, dimension (line entry or counter stripe) or cold block references. One
|
|
410
|
+
* pass over the keys.
|
|
407
411
|
*/
|
|
408
412
|
const c0Floors = (doc, styles) => {
|
|
409
413
|
const floors = new Map();
|
|
@@ -421,21 +425,30 @@ const c0Floors = (doc, styles) => {
|
|
|
421
425
|
};
|
|
422
426
|
for (const name of [CELLS_V5, NOTES_V5]) {
|
|
423
427
|
if (doc.share.has(name))
|
|
424
|
-
doc.
|
|
428
|
+
forEachEntry(doc.get(name), (_v, key) => cellKey(key));
|
|
425
429
|
}
|
|
426
430
|
styles.forEach((_v, key) => cellKey(key));
|
|
427
431
|
if (doc.share.has(DIMS_V5)) {
|
|
428
|
-
doc.
|
|
432
|
+
forEachEntry(doc.get(DIMS_V5), (value, key) => {
|
|
429
433
|
const match = DIM_KEY_V5.exec(key);
|
|
430
434
|
if (match && idCounter(BigInt(match[3])) !== 0) {
|
|
431
435
|
raise(match[1], match[2] === "R", c0Counter(match[3]));
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
// A counter stripe (`dim_stripe_c0_max`): the counter of its last entry, orphans included.
|
|
439
|
+
const stripe = DIM_STRIPE_KEY_V5.exec(key);
|
|
440
|
+
if (stripe && value instanceof Uint8Array) {
|
|
441
|
+
const offsets = blockRowOffsets(value);
|
|
442
|
+
if (offsets.length) {
|
|
443
|
+
raise(stripe[1], stripe[2] === "R", Number(stripe[3]) * BLOCK_ROWS + Math.max(...offsets) + 1);
|
|
444
|
+
}
|
|
432
445
|
}
|
|
433
446
|
});
|
|
434
447
|
}
|
|
435
448
|
if (doc.share.has(BLOCKS_V5)) {
|
|
436
449
|
// Rows: the last offset of each column's highest block (`block_c0_max`).
|
|
437
450
|
const top = new Map();
|
|
438
|
-
doc.
|
|
451
|
+
forEachEntry(doc.get(BLOCKS_V5), (value, key) => {
|
|
439
452
|
const match = BLOCK_KEY_V5.exec(key);
|
|
440
453
|
if (!match || idCounter(BigInt(match[2])) === 0)
|
|
441
454
|
return;
|
|
@@ -467,7 +480,7 @@ const ensureLine = (w, sheetId, isRow, pos) => {
|
|
|
467
480
|
const start = Math.max(axis.maxC0, w.floors.get(axisKey(sheetId, isRow)) ?? 0) + 1;
|
|
468
481
|
const counters = Array.from({ length: pos - axis.ids.length }, (_, i) => start + i);
|
|
469
482
|
w.doc
|
|
470
|
-
.
|
|
483
|
+
.get(lineIdsRootName(sheetId, isRow ? "row" : "column"))
|
|
471
484
|
.push(counters.map(idValue));
|
|
472
485
|
axis.ids.push(...counters.map(c0Id));
|
|
473
486
|
axis.maxC0 = start + counters.length - 1;
|
|
@@ -497,7 +510,7 @@ const writeCell = (w, sheetId, row, col, cell) => {
|
|
|
497
510
|
const rowId = ensureLine(w, sheetId, true, row);
|
|
498
511
|
const colId = ensureLine(w, sheetId, false, col);
|
|
499
512
|
const key = createCellKeyV5(sheetId, rowId, colId);
|
|
500
|
-
const stored = cellDataV5(w.cells.
|
|
513
|
+
const stored = cellDataV5(w.cells.getAttr(key));
|
|
501
514
|
const format = normalizedFormat(getCellUserEnteredFormat(cell));
|
|
502
515
|
const storedFormat = normalizedFormat(writerStyles(w).get(key) ?? getCellUserEnteredFormat(stored));
|
|
503
516
|
if (!isEqual(format, storedFormat)) {
|
|
@@ -507,20 +520,20 @@ const writeCell = (w, sheetId, row, col, cell) => {
|
|
|
507
520
|
}
|
|
508
521
|
}
|
|
509
522
|
let next = cell;
|
|
510
|
-
const notes = w.doc.share.has(NOTES_V5) ? w.doc.
|
|
511
|
-
if (notes?.
|
|
523
|
+
const notes = w.doc.share.has(NOTES_V5) ? w.doc.get(NOTES_V5) : null;
|
|
524
|
+
if (notes?.hasAttr(key)) {
|
|
512
525
|
const { note, ...rest } = cell;
|
|
513
526
|
if (typeof note === "string" && note) {
|
|
514
|
-
if (notes.
|
|
515
|
-
notes.
|
|
527
|
+
if (notes.getAttr(key) !== note)
|
|
528
|
+
notes.setAttr(key, note);
|
|
516
529
|
}
|
|
517
530
|
else {
|
|
518
|
-
notes.
|
|
531
|
+
notes.deleteAttr(key);
|
|
519
532
|
}
|
|
520
533
|
next = rest;
|
|
521
534
|
}
|
|
522
535
|
if (!stored || !isEqual(stored, next))
|
|
523
|
-
w.cells.
|
|
536
|
+
w.cells.setAttr(key, next);
|
|
524
537
|
};
|
|
525
538
|
/**
|
|
526
539
|
* Removes the cell at a position (`remove_cell`): a hot `null` when a cold block
|
|
@@ -536,18 +549,18 @@ const removeCell = (w, sheetId, row, col) => {
|
|
|
536
549
|
return;
|
|
537
550
|
const key = createCellKeyV5(sheetId, rowId, colId);
|
|
538
551
|
if (coldCellExists(w.doc, w.offsets, sheetId, rowId, colId)) {
|
|
539
|
-
if (w.cells.
|
|
540
|
-
w.cells.
|
|
552
|
+
if (w.cells.getAttr(key) !== null)
|
|
553
|
+
w.cells.setAttr(key, null);
|
|
541
554
|
}
|
|
542
|
-
else if (w.cells.
|
|
543
|
-
w.cells.
|
|
555
|
+
else if (w.cells.hasAttr(key)) {
|
|
556
|
+
w.cells.deleteAttr(key);
|
|
544
557
|
}
|
|
545
558
|
if (writerStyles(w).has(key))
|
|
546
559
|
queueStyle(w, sheetId, rowId, colId, null);
|
|
547
560
|
if (w.doc.share.has(NOTES_V5)) {
|
|
548
|
-
const notes = w.doc.
|
|
549
|
-
if (notes.
|
|
550
|
-
notes.
|
|
561
|
+
const notes = w.doc.get(NOTES_V5);
|
|
562
|
+
if (notes.hasAttr(key))
|
|
563
|
+
notes.deleteAttr(key);
|
|
551
564
|
}
|
|
552
565
|
};
|
|
553
566
|
/** The cells of a row value (`{ values }`), by 1-based column. */
|
|
@@ -591,10 +604,10 @@ const clearSheets = (w, match) => {
|
|
|
591
604
|
const drop = (name) => {
|
|
592
605
|
if (!w.doc.share.has(name))
|
|
593
606
|
return;
|
|
594
|
-
const map = w.doc.
|
|
595
|
-
for (const key of Array.from(map.
|
|
607
|
+
const map = w.doc.get(name);
|
|
608
|
+
for (const key of Array.from(map.attrKeys())) {
|
|
596
609
|
if (match(sheetOf(key)))
|
|
597
|
-
map.
|
|
610
|
+
map.deleteAttr(key);
|
|
598
611
|
}
|
|
599
612
|
};
|
|
600
613
|
drop(CELLS_V5);
|
|
@@ -616,7 +629,7 @@ const nestedBase = (w, sheetId, row, col) => {
|
|
|
616
629
|
if (rowId === undefined || colId === undefined)
|
|
617
630
|
return {};
|
|
618
631
|
const key = createCellKeyV5(sheetId, rowId, colId);
|
|
619
|
-
if (!w.cells.
|
|
632
|
+
if (!w.cells.hasAttr(key) && coldCellExists(w.doc, w.offsets, sheetId, rowId, colId)) {
|
|
620
633
|
return null;
|
|
621
634
|
}
|
|
622
635
|
return composeCell(w.doc, key, writerStyles(w)) ?? {};
|
|
@@ -685,7 +698,7 @@ export const addSheetDataPatchesV5 = (doc, patches, origin = null, styles) => {
|
|
|
685
698
|
doc.transact(() => {
|
|
686
699
|
const w = {
|
|
687
700
|
doc,
|
|
688
|
-
cells: doc.
|
|
701
|
+
cells: doc.get(CELLS_V5),
|
|
689
702
|
axes: new Map(),
|
|
690
703
|
floors: null,
|
|
691
704
|
styles: styles ?? null,
|
|
@@ -717,7 +730,7 @@ export const addSheetDataPatchesV5 = (doc, patches, origin = null, styles) => {
|
|
|
717
730
|
}
|
|
718
731
|
flush();
|
|
719
732
|
if (w.ops.length) {
|
|
720
|
-
doc.
|
|
733
|
+
doc.get(STYLES_LOG_V5).push([encodeStyleOps(w.ops)]);
|
|
721
734
|
}
|
|
722
735
|
}, origin);
|
|
723
736
|
};
|
package/dist/esm/helpers.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type CellData, type CellFormat, type Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
2
|
import { type HistoryType, type SheetData, type SpreadsheetPatch } from "@rowsncolumns/spreadsheet-state";
|
|
3
3
|
import type { Patch } from "immer";
|
|
4
|
-
import type
|
|
5
|
-
import type { YRowData, YSheetData } from "./use-yspreadsheet-v2";
|
|
6
|
-
import type { CellKeyV3, CellDataV3, ParsedCellKeyV3, YjsRuntime } from "./types";
|
|
4
|
+
import type { CellKeyV3, CellDataV3, ParsedCellKeyV3, YDoc, YjsRuntime, YNode } from "./types";
|
|
7
5
|
export * from "./helpers-v5";
|
|
8
6
|
/**
|
|
9
7
|
* Simplified structure to pass event data synchronously
|
|
@@ -25,7 +23,7 @@ export type SheetDataEvent = {
|
|
|
25
23
|
* @param source
|
|
26
24
|
* @param sheetDataVersion - Version of sheet data format ("v2", "v3" or "v5"). Falls back to docMeta if undefined.
|
|
27
25
|
*/
|
|
28
|
-
export declare const applyPatchesToYDoc: (doc:
|
|
26
|
+
export declare const applyPatchesToYDoc: (doc: YDoc, userId: string | number, patches: [patch: SpreadsheetPatch<Patch>, type?: HistoryType | undefined | null][], source?: "agent" | "user" | "backend", sheetDataVersion?: "v2" | "v3" | "v5", yjsRuntime?: YjsRuntime) => void;
|
|
29
27
|
/**
|
|
30
28
|
* Add sheet data to a yjs map using immer patches
|
|
31
29
|
*
|
|
@@ -34,18 +32,18 @@ export declare const applyPatchesToYDoc: (doc: Y.Doc, userId: string | number, p
|
|
|
34
32
|
* 1. Deduplicating patches targeting the same cell (later patches win)
|
|
35
33
|
* 2. Grouping updates by sheet/row for efficient batch application
|
|
36
34
|
*/
|
|
37
|
-
export declare const addSheetDataPatches: (ySheetData:
|
|
38
|
-
export declare const getSheetFromYSheetData: (ySheetData:
|
|
39
|
-
export declare const deleteSheetFromYSheetData: (ySheetData:
|
|
40
|
-
export declare const getRowDataFromSheet: (ysheet:
|
|
41
|
-
export declare const setCellDataInRowData: (rowData:
|
|
42
|
-
export declare const removeRowData: (ysheet:
|
|
35
|
+
export declare const addSheetDataPatches: (ySheetData: YNode, patches: Patch[], yjsRuntime?: YjsRuntime) => void;
|
|
36
|
+
export declare const getSheetFromYSheetData: (ySheetData: YNode, sheetId: string | number, yjsRuntime?: YjsRuntime) => YNode;
|
|
37
|
+
export declare const deleteSheetFromYSheetData: (ySheetData: YNode, sheetId: string | number) => void;
|
|
38
|
+
export declare const getRowDataFromSheet: (ysheet: YNode, rowIndex: number | string, yjsRuntime?: YjsRuntime) => YNode;
|
|
39
|
+
export declare const setCellDataInRowData: (rowData: YNode, columnIndex: number | string, cellData?: CellData | null) => void;
|
|
40
|
+
export declare const removeRowData: (ysheet: YNode, rowIndex: number | string) => void;
|
|
43
41
|
/**
|
|
44
42
|
* Read a cell's data from the V2 Y.js structure without creating any
|
|
45
43
|
* missing sheet/row/values containers (unlike getSheetFromYSheetData /
|
|
46
44
|
* getRowDataFromSheet, which lazily create them).
|
|
47
45
|
*/
|
|
48
|
-
export declare const getCellDataFromYSheetData: (ySheetData:
|
|
46
|
+
export declare const getCellDataFromYSheetData: (ySheetData: YNode, sheetId: string | number, rowIndex: number | string, columnIndex: number | string) => CellData | null | undefined;
|
|
49
47
|
/**
|
|
50
48
|
* Extract the error effective value from cell data, if any.
|
|
51
49
|
* SheetCell.setErrorValue persists formula errors as
|
|
@@ -94,7 +92,7 @@ export declare const mergeErrorEffectiveValueIntoCellData: (currentCellData: Cel
|
|
|
94
92
|
/**
|
|
95
93
|
* Update array type with immer patches
|
|
96
94
|
*/
|
|
97
|
-
export declare const updateArrayType: (yarray:
|
|
95
|
+
export declare const updateArrayType: (yarray: YNode, patches: Patch[]) => void;
|
|
98
96
|
/**
|
|
99
97
|
* Validate and clean sheets data
|
|
100
98
|
*/
|
|
@@ -102,12 +100,12 @@ export declare const validateSheets: <S extends Sheet>(sheets: S[]) => S[];
|
|
|
102
100
|
/**
|
|
103
101
|
* Map operations
|
|
104
102
|
*/
|
|
105
|
-
export declare const applyMapPatches: <T = CellFormat>(yMap:
|
|
103
|
+
export declare const applyMapPatches: <T = CellFormat>(yMap: YNode, patches: Patch[]) => void;
|
|
106
104
|
/**
|
|
107
105
|
* Process events to find changes in sheet data
|
|
108
106
|
* Returns a new sheet data object with only the changes applied if possible, or null if a full reload is needed
|
|
109
107
|
*/
|
|
110
|
-
export declare const processSheetDataEvents: (events: SheetDataEvent[], currentSheetData: SheetData<any>, ySheetDataV2:
|
|
108
|
+
export declare const processSheetDataEvents: (events: SheetDataEvent[], currentSheetData: SheetData<any>, ySheetDataV2: YNode, yjsRuntime?: YjsRuntime) => SheetData<any> | null;
|
|
111
109
|
/**
|
|
112
110
|
* Create a V3 cell key from sheet ID, row and column indices
|
|
113
111
|
* Format: `${sheetId}!${A1Address}` (e.g., "1!A1", "2!B5")
|
|
@@ -123,10 +121,10 @@ export declare const parseCellKeyV3: (cellKey: CellKeyV3) => ParsedCellKeyV3 | n
|
|
|
123
121
|
*/
|
|
124
122
|
export declare const createCellDataV3: <T extends CellData>(value: T, sheetId: number, rowIndex: number, columnIndex: number) => CellDataV3<T>;
|
|
125
123
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
124
|
+
* The map node storing V3 cell data (flat structure): `CellDataV3` values
|
|
125
|
+
* keyed `${sheetId}!${A1Address}` (e.g., "1!A1", "2!B5")
|
|
128
126
|
*/
|
|
129
|
-
export type YSheetDataV3 =
|
|
127
|
+
export type YSheetDataV3 = YNode;
|
|
130
128
|
/**
|
|
131
129
|
* Convert V2 SheetData to V3 flat Map format
|
|
132
130
|
* V2: { sheetId: [rows with values arrays] }
|
|
@@ -158,7 +156,7 @@ export declare const deleteSheetV3: (ySheetDataV3: YSheetDataV3, sheetId: number
|
|
|
158
156
|
/**
|
|
159
157
|
* Get V3 sheet data map from Y.Doc
|
|
160
158
|
*/
|
|
161
|
-
export declare const getSheetDataV3: (doc:
|
|
159
|
+
export declare const getSheetDataV3: (doc: YDoc) => YSheetDataV3;
|
|
162
160
|
/**
|
|
163
161
|
* Apply immer patches to V3 sheet data (flat map structure)
|
|
164
162
|
*
|
|
@@ -172,7 +170,7 @@ export declare const addSheetDataPatchesV3: (ySheetDataV3: YSheetDataV3, patches
|
|
|
172
170
|
* Process V3 events and return updated sheet data
|
|
173
171
|
* @param changedKeys - Pre-extracted changes from Yjs event
|
|
174
172
|
* @param currentSheetData - Current sheet data state
|
|
175
|
-
* @param ySheetDataV3 - The
|
|
173
|
+
* @param ySheetDataV3 - The map node for V3 data
|
|
176
174
|
*/
|
|
177
175
|
export declare const processSheetDataEventsV3: <T extends CellData>(changedKeys: Map<string, {
|
|
178
176
|
action: "add" | "update" | "delete";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,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