@rowsncolumns/y-spreadsheet 14.0.32
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/LICENSE.md +100 -0
- package/Readme.md +77 -0
- package/dist/cjs/helpers.d.ts +179 -0
- package/dist/cjs/helpers.d.ts.map +1 -0
- package/dist/cjs/helpers.js +1635 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/observables.d.ts +10 -0
- package/dist/cjs/observables.d.ts.map +1 -0
- package/dist/cjs/observables.js +90 -0
- package/dist/cjs/profiling/batch-profile.spec.d.ts +2 -0
- package/dist/cjs/profiling/batch-profile.spec.d.ts.map +1 -0
- package/dist/cjs/profiling/batch-profile.spec.js +175 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/cjs/types.d.ts +62 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/use-yspreadsheet-v2.d.ts +152 -0
- package/dist/cjs/use-yspreadsheet-v2.d.ts.map +1 -0
- package/dist/cjs/use-yspreadsheet-v2.js +980 -0
- package/dist/cjs/use-yspreadsheet.d.ts +39 -0
- package/dist/cjs/use-yspreadsheet.d.ts.map +1 -0
- package/dist/cjs/use-yspreadsheet.js +430 -0
- package/dist/cjs/vitest.config.d.ts +3 -0
- package/dist/cjs/vitest.config.d.ts.map +1 -0
- package/dist/cjs/vitest.config.js +23 -0
- package/dist/esm/helpers.d.ts +179 -0
- package/dist/esm/helpers.d.ts.map +1 -0
- package/dist/esm/helpers.js +1346 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/observables.d.ts +10 -0
- package/dist/esm/observables.d.ts.map +1 -0
- package/dist/esm/observables.js +51 -0
- package/dist/esm/profiling/batch-profile.spec.d.ts +2 -0
- package/dist/esm/profiling/batch-profile.spec.d.ts.map +1 -0
- package/dist/esm/profiling/batch-profile.spec.js +131 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/esm/types.d.ts +62 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/use-yspreadsheet-v2.d.ts +152 -0
- package/dist/esm/use-yspreadsheet-v2.d.ts.map +1 -0
- package/dist/esm/use-yspreadsheet-v2.js +814 -0
- package/dist/esm/use-yspreadsheet.d.ts +39 -0
- package/dist/esm/use-yspreadsheet.d.ts.map +1 -0
- package/dist/esm/use-yspreadsheet.js +304 -0
- package/dist/esm/vitest.config.d.ts +3 -0
- package/dist/esm/vitest.config.d.ts.map +1 -0
- package/dist/esm/vitest.config.js +21 -0
- package/package.json +54 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Rows n' Columns Commercial License Agreement
|
|
2
|
+
|
|
3
|
+
This Rows n' Columns Commercial License Agreement (the "Agreement") governs
|
|
4
|
+
the use of the Rows n' Columns software packages published under the
|
|
5
|
+
`@rowsncolumns` npm scope, including associated JavaScript, WebAssembly
|
|
6
|
+
binaries, stylesheets, type definitions and documentation (the "Software").
|
|
7
|
+
|
|
8
|
+
The Software is **not** open source. Downloading or installing the Software
|
|
9
|
+
from a public package registry does not grant any right to use it beyond the
|
|
10
|
+
evaluation use described below.
|
|
11
|
+
|
|
12
|
+
## 1. Definitions
|
|
13
|
+
|
|
14
|
+
- **"Licensor"** means Rows n' Columns (rowsncolumns.app).
|
|
15
|
+
- **"Licensee"** means the individual or legal entity identified in an Order.
|
|
16
|
+
- **"Order"** means a purchase of a license for the Software from Licensor,
|
|
17
|
+
identified by an order ID and associated with a License Key.
|
|
18
|
+
- **"License Key"** means the signed key issued by Licensor that identifies
|
|
19
|
+
the Licensee, license tier, and Update Window.
|
|
20
|
+
- **"Update Window"** means the period stated in the Order during which
|
|
21
|
+
Software versions released by Licensor are covered by the License Key.
|
|
22
|
+
|
|
23
|
+
## 2. License Grant
|
|
24
|
+
|
|
25
|
+
Subject to payment of the applicable fees and compliance with this Agreement,
|
|
26
|
+
Licensor grants Licensee a non-exclusive, non-transferable, worldwide license
|
|
27
|
+
to use, and to distribute in compiled form as an embedded component of
|
|
28
|
+
Licensee's own applications, any version of the Software released during the
|
|
29
|
+
Update Window, in accordance with the license tier stated in the Order.
|
|
30
|
+
|
|
31
|
+
This grant is perpetual for versions released during the Update Window:
|
|
32
|
+
Licensee may continue to use those versions after the Update Window ends.
|
|
33
|
+
Versions released after the Update Window ends require a new or renewed
|
|
34
|
+
Order.
|
|
35
|
+
|
|
36
|
+
## 3. Evaluation Use
|
|
37
|
+
|
|
38
|
+
The Software may be used without a License Key solely for internal
|
|
39
|
+
evaluation and development purposes. Evaluation use in production, or
|
|
40
|
+
removal or suppression of evaluation notices, is not permitted.
|
|
41
|
+
|
|
42
|
+
## 4. Restrictions
|
|
43
|
+
|
|
44
|
+
Except as expressly permitted by this Agreement or by applicable law that
|
|
45
|
+
cannot be contractually waived, Licensee shall not:
|
|
46
|
+
|
|
47
|
+
1. redistribute, resell, sublicense, or otherwise make the Software
|
|
48
|
+
available as a standalone product, library, or development component;
|
|
49
|
+
2. use the Software to build a product that competes with the Software;
|
|
50
|
+
3. remove, alter, or circumvent License Key validation, evaluation notices,
|
|
51
|
+
watermarks, or copyright notices in the Software;
|
|
52
|
+
4. share License Keys with any third party, or use a License Key outside
|
|
53
|
+
the scope of the tier stated in the Order;
|
|
54
|
+
5. reverse engineer, decompile, or disassemble the Software except to the
|
|
55
|
+
extent permitted by applicable law.
|
|
56
|
+
|
|
57
|
+
## 5. Ownership
|
|
58
|
+
|
|
59
|
+
The Software is licensed, not sold. Licensor and its licensors retain all
|
|
60
|
+
right, title, and interest in and to the Software, including all
|
|
61
|
+
intellectual property rights.
|
|
62
|
+
|
|
63
|
+
## 6. Third-Party Components
|
|
64
|
+
|
|
65
|
+
The Software may include third-party open-source components. Those
|
|
66
|
+
components remain governed by their own license terms, which are included
|
|
67
|
+
with the applicable component and are not limited by this Agreement.
|
|
68
|
+
|
|
69
|
+
## 7. Termination
|
|
70
|
+
|
|
71
|
+
This Agreement terminates automatically upon material breach by Licensee
|
|
72
|
+
that remains uncured 30 days after written notice. Upon termination,
|
|
73
|
+
Licensee must cease use and distribution of the Software, except that
|
|
74
|
+
end-user copies of Licensee applications already distributed in compliance
|
|
75
|
+
with this Agreement are unaffected.
|
|
76
|
+
|
|
77
|
+
## 8. Warranty Disclaimer
|
|
78
|
+
|
|
79
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
80
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
81
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
82
|
+
|
|
83
|
+
## 9. Limitation of Liability
|
|
84
|
+
|
|
85
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL LICENSOR BE LIABLE
|
|
86
|
+
FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES,
|
|
87
|
+
OR ANY LOSS OF PROFITS, DATA, OR GOODWILL, ARISING OUT OF OR RELATED TO THIS
|
|
88
|
+
AGREEMENT, AND LICENSOR'S AGGREGATE LIABILITY SHALL NOT EXCEED THE FEES PAID
|
|
89
|
+
BY LICENSEE IN THE TWELVE MONTHS PRECEDING THE CLAIM.
|
|
90
|
+
|
|
91
|
+
## 10. General
|
|
92
|
+
|
|
93
|
+
This Agreement constitutes the entire agreement between the parties
|
|
94
|
+
concerning the Software and supersedes any prior agreements. If any
|
|
95
|
+
provision is held unenforceable, the remainder remains in effect. Failure to
|
|
96
|
+
enforce a provision is not a waiver.
|
|
97
|
+
|
|
98
|
+
For licensing inquiries, visit <https://www.rowsncolumns.app/pricing>.
|
|
99
|
+
|
|
100
|
+
Copyright © Rows n' Columns. All rights reserved.
|
package/Readme.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
## Collaborative Spreadsheet with YJS
|
|
2
|
+
|
|
3
|
+
[https://github.com/yjs/yjs](https://github.com/yjs/yjs)
|
|
4
|
+
|
|
5
|
+
YJS provides a CRDT datastructure to collaborate between users
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
You will still need to save data in the database. YJS does not persist data in your custom MySQL or NoSQL databases
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Setup
|
|
12
|
+
|
|
13
|
+
Run a yjs server locally
|
|
14
|
+
|
|
15
|
+
````
|
|
16
|
+
HOST=localhost PORT=1234 npx y-websocket
|
|
17
|
+
````
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
````javascript
|
|
22
|
+
import { useSpreadsheetState } from "@rowsncolumns/spreadsheet-state";
|
|
23
|
+
import { useYSpreadsheet } from "@rowsncolumns/spreadsheet-yjs";
|
|
24
|
+
import * as Y from "yjs";
|
|
25
|
+
import { WebsocketProvider } from "y-websocket";
|
|
26
|
+
|
|
27
|
+
const version = "v4";
|
|
28
|
+
const yDoc = new Y.Doc();
|
|
29
|
+
const yWebsocketProvider = new WebsocketProvider(
|
|
30
|
+
"ws://localhost:1234",
|
|
31
|
+
`y-spreadsheet-${version}`,
|
|
32
|
+
yDoc,
|
|
33
|
+
{
|
|
34
|
+
connect: true,
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// Setup local state
|
|
39
|
+
const [sheets, onChangeSheets] = useState<Sheet[]>(mockSheets);
|
|
40
|
+
const [sheetData, onChangeSheetData] =
|
|
41
|
+
useState<SheetData<CellData>>(mockSheetData);
|
|
42
|
+
const [tables, onChangeTables] = useState<TableView[]>(mockTables);
|
|
43
|
+
|
|
44
|
+
// Setup spreadsheet hook
|
|
45
|
+
const { enqueueCalculation, activeSheetId, ... } = useSpreadsheetState({
|
|
46
|
+
onChangeHistory(patch, type) {
|
|
47
|
+
onBroadcastPatch(patch, type);
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// Setup YJS
|
|
53
|
+
const { users, onBroadcastPatch } = useYSpreadsheet({
|
|
54
|
+
provider: yWebsocketProvider,
|
|
55
|
+
doc: yDoc,
|
|
56
|
+
onChangeSheetData,
|
|
57
|
+
onChangeSheets,
|
|
58
|
+
onChangeTables,
|
|
59
|
+
enqueueCalculation(operation) {
|
|
60
|
+
enqueueCalculation(operation);
|
|
61
|
+
},
|
|
62
|
+
sheetId: activeSheetId,
|
|
63
|
+
activeCell,
|
|
64
|
+
|
|
65
|
+
// User info
|
|
66
|
+
userId,
|
|
67
|
+
title: `User ${String(userId).slice(0, 5)}`,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<CanvasGrid
|
|
73
|
+
userId={userId}
|
|
74
|
+
users={users}
|
|
75
|
+
>
|
|
76
|
+
)
|
|
77
|
+
````
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type CellData, type CellFormat, type Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import { type HistoryType, type SheetData, type SpreadsheetPatch } from "@rowsncolumns/spreadsheet-state";
|
|
3
|
+
import type { Patch } from "immer";
|
|
4
|
+
import * as Y from "yjs";
|
|
5
|
+
import type { YRowData, YSheetData } from "./use-yspreadsheet-v2";
|
|
6
|
+
import type { CellKeyV3, CellDataV3, ParsedCellKeyV3 } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* Simplified structure to pass event data synchronously
|
|
9
|
+
*/
|
|
10
|
+
export type SheetDataEvent = {
|
|
11
|
+
path: (string | number)[];
|
|
12
|
+
delta?: {
|
|
13
|
+
insert?: any[] | number | string;
|
|
14
|
+
delete?: number;
|
|
15
|
+
retain?: number;
|
|
16
|
+
}[];
|
|
17
|
+
isYArrayEvent: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Apply patches to yjs
|
|
21
|
+
* @param doc
|
|
22
|
+
* @param userId
|
|
23
|
+
* @param patches
|
|
24
|
+
* @param source
|
|
25
|
+
* @param sheetDataVersion - Version of sheet data format ("v2" or "v3"). Falls back to docMeta if undefined.
|
|
26
|
+
*/
|
|
27
|
+
export declare const applyPatchesToYDoc: (doc: Y.Doc, userId: string | number, patches: [patch: SpreadsheetPatch<Patch>, type?: HistoryType | undefined | null][], source?: "agent" | "user" | "backend", sheetDataVersion?: "v2" | "v3") => void;
|
|
28
|
+
/**
|
|
29
|
+
* Add sheet data to a yjs map using immer patches
|
|
30
|
+
*
|
|
31
|
+
* Optimized for bulk operations (paste, import) by consolidating cell-level
|
|
32
|
+
* patches before applying to Y.js. This reduces overhead by:
|
|
33
|
+
* 1. Deduplicating patches targeting the same cell (later patches win)
|
|
34
|
+
* 2. Grouping updates by sheet/row for efficient batch application
|
|
35
|
+
*/
|
|
36
|
+
export declare const addSheetDataPatches: (ySheetData: Y.Map<YSheetData>, patches: Patch[]) => void;
|
|
37
|
+
export declare const getSheetFromYSheetData: (ySheetData: Y.Map<YSheetData>, sheetId: string | number) => YSheetData;
|
|
38
|
+
export declare const deleteSheetFromYSheetData: (ySheetData: Y.Map<YSheetData>, sheetId: string | number) => void;
|
|
39
|
+
export declare const getRowDataFromSheet: (ysheet: Y.Array<YRowData | null>, rowIndex: number | string) => Y.Array<CellData | null>;
|
|
40
|
+
export declare const setCellDataInRowData: (rowData: Y.Array<CellData | null>, columnIndex: number | string, cellData?: CellData | null) => void;
|
|
41
|
+
export declare const removeRowData: (ysheet: Y.Array<YRowData | null>, rowIndex: number | string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Read a cell's data from the V2 Y.js structure without creating any
|
|
44
|
+
* missing sheet/row/values containers (unlike getSheetFromYSheetData /
|
|
45
|
+
* getRowDataFromSheet, which lazily create them).
|
|
46
|
+
*/
|
|
47
|
+
export declare const getCellDataFromYSheetData: (ySheetData: Y.Map<YSheetData>, sheetId: string | number, rowIndex: number | string, columnIndex: number | string) => CellData | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Extract the error effective value from cell data, if any.
|
|
50
|
+
* SheetCell.setErrorValue persists formula errors as
|
|
51
|
+
* `ev.ev = { type: "Error", name, message }` (legacy long form:
|
|
52
|
+
* `effectiveValue.errorValue`).
|
|
53
|
+
*/
|
|
54
|
+
export declare const getCellDataErrorValue: (cellData?: CellData | null) => Record<string, any> | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Keep only the cell-level sheetData patches
|
|
57
|
+
* (`[sheetId, rowIndex, "values", columnIndex]`) whose new cell data carries
|
|
58
|
+
* an error effective value (#VALUE!, #NAME?, …). Used to let calc-result
|
|
59
|
+
* errors bypass the leader gate: errors must reach the Y.Doc even from
|
|
60
|
+
* non-leader clients, otherwise they render blank after reload.
|
|
61
|
+
*/
|
|
62
|
+
export declare const filterErrorCellPatches: (patches: Patch[]) => Patch[];
|
|
63
|
+
/**
|
|
64
|
+
* Containment guard for the non-leader error-persistence path
|
|
65
|
+
* (use-yspreadsheet-v2 onBroadcastPatch, gated disableRecalc branch).
|
|
66
|
+
* A gated error cell patch may be written ONLY when all of these hold:
|
|
67
|
+
*
|
|
68
|
+
* 1. The incoming cell data carries an error effective value.
|
|
69
|
+
* 2. The current doc cell holds no effective value at all (the
|
|
70
|
+
* blank-after-reload case) or its effective value is itself an error.
|
|
71
|
+
* A non-error result (number/string/bool/formula result) is never
|
|
72
|
+
* overwritten — a stale non-leader error must not clobber a newer
|
|
73
|
+
* leader-written success.
|
|
74
|
+
* 3. If the doc cell exists, its user-entered value (`ue`, short or legacy
|
|
75
|
+
* key shape) matches the incoming patch's — a cell edited after the
|
|
76
|
+
* calculation started is never touched.
|
|
77
|
+
* 4. The persisted error differs from the incoming one (identical errors
|
|
78
|
+
* are dropped so concurrent non-leaders don't append redundant
|
|
79
|
+
* Y.js updates).
|
|
80
|
+
*/
|
|
81
|
+
export declare const shouldPersistErrorCellPatch: (currentCellData: CellData | null | undefined, incomingCellData: CellData | null | undefined) => boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Build the cell data to write for a gated error patch that passed
|
|
84
|
+
* shouldPersistErrorCellPatch. If the doc cell doesn't exist yet there is
|
|
85
|
+
* nothing to destroy and the incoming cell data is written as-is. If it
|
|
86
|
+
* does exist, ONLY the error effective value is merged in — every other
|
|
87
|
+
* field of the doc cell (ue, formats, notes, …) is preserved so this write
|
|
88
|
+
* path can never remove doc state it didn't produce. The effective value is
|
|
89
|
+
* written into whichever key shape(s) the doc cell already uses (short `ev`
|
|
90
|
+
* by default).
|
|
91
|
+
*/
|
|
92
|
+
export declare const mergeErrorEffectiveValueIntoCellData: (currentCellData: CellData | null | undefined, incomingCellData: CellData) => CellData;
|
|
93
|
+
/**
|
|
94
|
+
* Update array type with immer patches
|
|
95
|
+
*/
|
|
96
|
+
export declare const updateArrayType: (yarray: Y.Array<any>, patches: Patch[]) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Validate and clean sheets data
|
|
99
|
+
*/
|
|
100
|
+
export declare const validateSheets: <S extends Sheet>(sheets: S[]) => S[];
|
|
101
|
+
/**
|
|
102
|
+
* Map operations
|
|
103
|
+
*/
|
|
104
|
+
export declare const applyMapPatches: <T = CellFormat>(yMap: Y.Map<T>, patches: Patch[]) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Process events to find changes in sheet data
|
|
107
|
+
* Returns a new sheet data object with only the changes applied if possible, or null if a full reload is needed
|
|
108
|
+
*/
|
|
109
|
+
export declare const processSheetDataEvents: (events: SheetDataEvent[], currentSheetData: SheetData<any>, ySheetDataV2: Y.Map<YSheetData>) => SheetData<any> | null;
|
|
110
|
+
/**
|
|
111
|
+
* Create a V3 cell key from sheet ID, row and column indices
|
|
112
|
+
* Format: `${sheetId}!${A1Address}` (e.g., "1!A1", "2!B5")
|
|
113
|
+
*/
|
|
114
|
+
export declare const createCellKeyV3: (sheetId: number, rowIndex: number, columnIndex: number) => CellKeyV3;
|
|
115
|
+
/**
|
|
116
|
+
* Parse a V3 cell key to extract sheet ID and position information
|
|
117
|
+
* Example: parseCellKeyV3("1!A1") => { sheetId: 1, address: "A1", rowIndex: 1, columnIndex: 1 }
|
|
118
|
+
*/
|
|
119
|
+
export declare const parseCellKeyV3: (cellKey: CellKeyV3) => ParsedCellKeyV3 | null;
|
|
120
|
+
/**
|
|
121
|
+
* Create a CellDataV3 object with position and sheetId
|
|
122
|
+
*/
|
|
123
|
+
export declare const createCellDataV3: <T extends CellData>(value: T, sheetId: number, rowIndex: number, columnIndex: number) => CellDataV3<T>;
|
|
124
|
+
/**
|
|
125
|
+
* Type for Y.Map storing V3 cell data (flat structure)
|
|
126
|
+
* Key format: `${sheetId}!${A1Address}` (e.g., "1!A1", "2!B5")
|
|
127
|
+
*/
|
|
128
|
+
export type YSheetDataV3 = Y.Map<CellDataV3>;
|
|
129
|
+
/**
|
|
130
|
+
* Convert V2 SheetData to V3 flat Map format
|
|
131
|
+
* V2: { sheetId: [rows with values arrays] }
|
|
132
|
+
* V3: Map<cellKey, CellDataV3>
|
|
133
|
+
*/
|
|
134
|
+
export declare const sheetDataV2ToV3: <T extends CellData>(v2Data: SheetData<T>) => Map<string, CellDataV3<T>>;
|
|
135
|
+
/**
|
|
136
|
+
* Convert V3 flat Map format to V2 SheetData
|
|
137
|
+
* V3: Map<cellKey, CellDataV3>
|
|
138
|
+
* V2: { sheetId: [rows with values arrays] }
|
|
139
|
+
*/
|
|
140
|
+
export declare const sheetDataV3ToV2: <T extends CellData>(v3Data: Map<string, CellDataV3<T>>) => SheetData<T>;
|
|
141
|
+
/**
|
|
142
|
+
* Get a cell from V3 flat structure
|
|
143
|
+
*/
|
|
144
|
+
export declare const getCellV3: (ySheetDataV3: YSheetDataV3, sheetId: number, rowIndex: number, columnIndex: number) => CellDataV3 | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Set a cell in V3 flat structure
|
|
147
|
+
*/
|
|
148
|
+
export declare const setCellV3: (ySheetDataV3: YSheetDataV3, sheetId: number, rowIndex: number, columnIndex: number, value: CellData) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Delete a cell from V3 flat structure
|
|
151
|
+
*/
|
|
152
|
+
export declare const deleteCellV3: (ySheetDataV3: YSheetDataV3, sheetId: number, rowIndex: number, columnIndex: number) => void;
|
|
153
|
+
/**
|
|
154
|
+
* Delete all cells for a sheet from V3 flat structure
|
|
155
|
+
*/
|
|
156
|
+
export declare const deleteSheetV3: (ySheetDataV3: YSheetDataV3, sheetId: number) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Get V3 sheet data map from Y.Doc
|
|
159
|
+
*/
|
|
160
|
+
export declare const getSheetDataV3: (doc: Y.Doc) => YSheetDataV3;
|
|
161
|
+
/**
|
|
162
|
+
* Apply immer patches to V3 sheet data (flat map structure)
|
|
163
|
+
*
|
|
164
|
+
* Optimized for bulk operations (paste, import) by consolidating cell-level
|
|
165
|
+
* patches before applying to Y.js. This reduces overhead by:
|
|
166
|
+
* 1. Deduplicating patches targeting the same cell (later patches win)
|
|
167
|
+
* 2. Processing all cell updates in a single pass
|
|
168
|
+
*/
|
|
169
|
+
export declare const addSheetDataPatchesV3: (ySheetDataV3: YSheetDataV3, patches: Patch[]) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Process V3 events and return updated sheet data
|
|
172
|
+
* @param changedKeys - Pre-extracted changes from Yjs event
|
|
173
|
+
* @param currentSheetData - Current sheet data state
|
|
174
|
+
* @param ySheetDataV3 - The Y.Map for V3 data
|
|
175
|
+
*/
|
|
176
|
+
export declare const processSheetDataEventsV3: <T extends CellData>(changedKeys: Map<string, {
|
|
177
|
+
action: "add" | "update" | "delete";
|
|
178
|
+
}>, currentSheetData: SheetData<T>, ySheetDataV3: YSheetDataV3) => SheetData<T> | null;
|
|
179
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../helpers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