@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.
Files changed (46) hide show
  1. package/Readme.md +21 -6
  2. package/dist/cjs/helpers-v5.d.ts +11 -11
  3. package/dist/cjs/helpers-v5.d.ts.map +1 -1
  4. package/dist/cjs/helpers-v5.js +46 -33
  5. package/dist/cjs/helpers.d.ts +17 -19
  6. package/dist/cjs/helpers.d.ts.map +1 -1
  7. package/dist/cjs/helpers.js +89 -86
  8. package/dist/cjs/observables.d.ts +7 -7
  9. package/dist/cjs/observables.d.ts.map +1 -1
  10. package/dist/cjs/observables.js +34 -46
  11. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  12. package/dist/cjs/types.d.ts +96 -19
  13. package/dist/cjs/types.d.ts.map +1 -1
  14. package/dist/cjs/use-yspreadsheet-v2.d.ts +11 -10
  15. package/dist/cjs/use-yspreadsheet-v2.d.ts.map +1 -1
  16. package/dist/cjs/use-yspreadsheet-v2.js +79 -90
  17. package/dist/cjs/use-yspreadsheet.d.ts +6 -6
  18. package/dist/cjs/use-yspreadsheet.d.ts.map +1 -1
  19. package/dist/cjs/use-yspreadsheet.js +38 -74
  20. package/dist/cjs/yjs-runtime.js +5 -5
  21. package/dist/cjs/ynodes.d.ts +61 -0
  22. package/dist/cjs/ynodes.d.ts.map +1 -0
  23. package/dist/cjs/ynodes.js +224 -0
  24. package/dist/esm/helpers-v5.d.ts +11 -11
  25. package/dist/esm/helpers-v5.d.ts.map +1 -1
  26. package/dist/esm/helpers-v5.js +46 -33
  27. package/dist/esm/helpers.d.ts +17 -19
  28. package/dist/esm/helpers.d.ts.map +1 -1
  29. package/dist/esm/helpers.js +90 -87
  30. package/dist/esm/observables.d.ts +7 -7
  31. package/dist/esm/observables.d.ts.map +1 -1
  32. package/dist/esm/observables.js +21 -25
  33. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  34. package/dist/esm/types.d.ts +96 -19
  35. package/dist/esm/types.d.ts.map +1 -1
  36. package/dist/esm/use-yspreadsheet-v2.d.ts +11 -10
  37. package/dist/esm/use-yspreadsheet-v2.d.ts.map +1 -1
  38. package/dist/esm/use-yspreadsheet-v2.js +76 -88
  39. package/dist/esm/use-yspreadsheet.d.ts +6 -6
  40. package/dist/esm/use-yspreadsheet.d.ts.map +1 -1
  41. package/dist/esm/use-yspreadsheet.js +17 -43
  42. package/dist/esm/yjs-runtime.js +5 -5
  43. package/dist/esm/ynodes.d.ts +61 -0
  44. package/dist/esm/ynodes.d.ts.map +1 -0
  45. package/dist/esm/ynodes.js +146 -0
  46. package/package.json +9 -8
@@ -7,6 +7,7 @@ var immer_1 = require("immer");
7
7
  var uniqBy_1 = tslib_1.__importDefault(require("lodash/uniqBy"));
8
8
  var react_1 = require("react");
9
9
  var yjs_runtime_1 = require("./yjs-runtime");
10
+ var ynodes_1 = require("./ynodes");
10
11
  var getStateVector = function (doc, yjs) {
11
12
  return yjs.encodeStateVector(doc);
12
13
  };
@@ -29,52 +30,31 @@ var useYSpreadsheet = function (_a) {
29
30
  var previousStateVectorRef = (0, react_1.useRef)(undefined);
30
31
  var currentStateVectorRef = (0, react_1.useRef)(undefined);
31
32
  // Recalc cells
32
- var yRecalcCells = (0, react_1.useMemo)(function () { return doc.getArray("recalcCells"); }, [doc]);
33
- var yDisableRecalc = doc.getMap("disableRecalc");
33
+ var yRecalcCells = (0, react_1.useMemo)(function () { return doc.get("recalcCells"); }, [doc]);
34
+ var yDisableRecalc = doc.get("disableRecalc");
34
35
  // Counter
35
36
  // Create a counter to keep track of when the last sync was done
36
37
  var docSyncCounterRef = (0, react_1.useRef)(new Map());
37
38
  // Create a doc map
38
39
  var docMap = (0, react_1.useMemo)(function () {
39
40
  var docMap = new Map([
40
- [
41
- "sheets",
42
- [doc.getArray("sheets"), onChangeSheets, "sheetId"],
43
- ],
44
- [
45
- "sheetData",
46
- [doc.getArray("sheetData"), onChangeSheetData],
47
- ],
48
- ["tables", [doc.getArray("tables"), onChangeTables, "id"]],
49
- ["embeds", [doc.getArray("embeds"), onChangeEmbeds, "id"]],
50
- ["charts", [doc.getArray("charts"), onChangeCharts, "id"]],
41
+ ["sheets", [doc.get("sheets"), onChangeSheets, "sheetId"]],
42
+ ["sheetData", [doc.get("sheetData"), onChangeSheetData]],
43
+ ["tables", [doc.get("tables"), onChangeTables, "id"]],
44
+ ["embeds", [doc.get("embeds"), onChangeEmbeds, "id"]],
45
+ ["charts", [doc.get("charts"), onChangeCharts, "id"]],
51
46
  [
52
47
  "conditionalFormats",
53
- [
54
- doc.getArray("conditionalFormats"),
55
- onChangeConditionalFormats,
56
- "id",
57
- ],
48
+ [doc.get("conditionalFormats"), onChangeConditionalFormats, "id"],
58
49
  ],
59
50
  [
60
51
  "dataValidations",
61
- [
62
- doc.getArray("dataValidations"),
63
- onChangeDataValidations,
64
- "id",
65
- ],
66
- ],
67
- [
68
- "namedRanges",
69
- [doc.getArray("namedRanges"), onChangeNamedRanges, "id"],
52
+ [doc.get("dataValidations"), onChangeDataValidations, "id"],
70
53
  ],
54
+ ["namedRanges", [doc.get("namedRanges"), onChangeNamedRanges, "id"]],
71
55
  [
72
56
  "protectedRanges",
73
- [
74
- doc.getArray("protectedRanges"),
75
- onChangeProtectedRanges,
76
- "id",
77
- ],
57
+ [doc.get("protectedRanges"), onChangeProtectedRanges, "id"],
78
58
  ],
79
59
  ]);
80
60
  return docMap;
@@ -132,7 +112,7 @@ var useYSpreadsheet = function (_a) {
132
112
  };
133
113
  var _loop_1 = function (mappingKey, _1, setStateFn, idKey) {
134
114
  var startCounter = (_b = docSyncCounterRef.current.get(mappingKey)) !== null && _b !== void 0 ? _b : 0;
135
- var _e = tslib_1.__read(getInitialPatches(syncedDoc.getArray(mappingKey), startCounter), 2), patches = _e[0], endCounter = _e[1];
115
+ var _e = tslib_1.__read(getInitialPatches(syncedDoc.get(mappingKey), startCounter), 2), patches = _e[0], endCounter = _e[1];
136
116
  if (patches.length) {
137
117
  docSyncCounterRef.current.set(mappingKey, endCounter);
138
118
  setStateFn === null || setStateFn === void 0 ? void 0 : setStateFn(function (prev) {
@@ -239,47 +219,31 @@ var useYSpreadsheet = function (_a) {
239
219
  (0, spreadsheet_1.useIsomorphicLayoutEffect)(function () {
240
220
  var e_4, _a;
241
221
  var getPatchDeltasFromEvent = function (event) {
242
- var e_5, _a, e_6, _b, e_7, _c;
222
+ var e_5, _a, e_6, _b;
243
223
  var patches = [];
244
224
  if (event.transaction.origin !== "locale") {
245
225
  try {
246
- for (var _d = tslib_1.__values(event.changes.delta), _e = _d.next(); !_e.done; _e = _d.next()) {
247
- var changes = _e.value;
248
- for (var type in changes) {
249
- if (type === "insert" && changes[type] !== undefined) {
250
- try {
251
- for (var _f = (e_6 = void 0, tslib_1.__values(changes[type])), _g = _f.next(); !_g.done; _g = _f.next()) {
252
- var userPatches = _g.value.patches;
253
- try {
254
- for (var userPatches_2 = (e_7 = void 0, tslib_1.__values(userPatches)), userPatches_2_1 = userPatches_2.next(); !userPatches_2_1.done; userPatches_2_1 = userPatches_2.next()) {
255
- var patch = userPatches_2_1.value;
256
- patches.push(patch);
257
- }
258
- }
259
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
260
- finally {
261
- try {
262
- if (userPatches_2_1 && !userPatches_2_1.done && (_c = userPatches_2.return)) _c.call(userPatches_2);
263
- }
264
- finally { if (e_7) throw e_7.error; }
265
- }
266
- }
267
- }
268
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
269
- finally {
270
- try {
271
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
272
- }
273
- finally { if (e_6) throw e_6.error; }
274
- }
226
+ for (var _c = tslib_1.__values((0, ynodes_1.insertedValues)(event)), _d = _c.next(); !_d.done; _d = _c.next()) {
227
+ var userPatches = _d.value.patches;
228
+ try {
229
+ for (var userPatches_2 = (e_6 = void 0, tslib_1.__values(userPatches)), userPatches_2_1 = userPatches_2.next(); !userPatches_2_1.done; userPatches_2_1 = userPatches_2.next()) {
230
+ var patch = userPatches_2_1.value;
231
+ patches.push(patch);
232
+ }
233
+ }
234
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
235
+ finally {
236
+ try {
237
+ if (userPatches_2_1 && !userPatches_2_1.done && (_b = userPatches_2.return)) _b.call(userPatches_2);
275
238
  }
239
+ finally { if (e_6) throw e_6.error; }
276
240
  }
277
241
  }
278
242
  }
279
243
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
280
244
  finally {
281
245
  try {
282
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
246
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
283
247
  }
284
248
  finally { if (e_5) throw e_5.error; }
285
249
  }
@@ -287,7 +251,7 @@ var useYSpreadsheet = function (_a) {
287
251
  return patches;
288
252
  };
289
253
  var syncRecalcCells = function (recalcCells) {
290
- var e_8, _a;
254
+ var e_7, _a;
291
255
  try {
292
256
  for (var recalcCells_1 = tslib_1.__values(recalcCells), recalcCells_1_1 = recalcCells_1.next(); !recalcCells_1_1.done; recalcCells_1_1 = recalcCells_1.next()) {
293
257
  var _b = tslib_1.__read(recalcCells_1_1.value, 2), _3 = _b[0], position = _b[1];
@@ -297,12 +261,12 @@ var useYSpreadsheet = function (_a) {
297
261
  });
298
262
  }
299
263
  }
300
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
264
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
301
265
  finally {
302
266
  try {
303
267
  if (recalcCells_1_1 && !recalcCells_1_1.done && (_a = recalcCells_1.return)) _a.call(recalcCells_1);
304
268
  }
305
- finally { if (e_8) throw e_8.error; }
269
+ finally { if (e_7) throw e_7.error; }
306
270
  }
307
271
  };
308
272
  // Trigger cell recalcs
@@ -318,7 +282,7 @@ var useYSpreadsheet = function (_a) {
318
282
  var _loop_2 = function (_4, doc_1, setStateFn) {
319
283
  var callback = function (event) {
320
284
  var patches = getPatchDeltasFromEvent(event);
321
- var disableRecalc = yDisableRecalc.get("disableRecalc");
285
+ var disableRecalc = yDisableRecalc.getAttr("disableRecalc");
322
286
  if (event.transaction.origin !== "local" && disableRecalc !== true) {
323
287
  if (patches.length) {
324
288
  setStateFn === null || setStateFn === void 0 ? void 0 : setStateFn(function (prev) {
@@ -364,14 +328,14 @@ var useYSpreadsheet = function (_a) {
364
328
  // Broadcast patch
365
329
  var onBroadcastPatch = (0, react_1.useCallback)(function (patches) {
366
330
  doc.transact(function () {
367
- var e_9, _a, e_10, _b;
331
+ var e_8, _a, e_9, _b;
368
332
  var _c, _d;
369
333
  try {
370
334
  for (var patches_1 = tslib_1.__values(patches), patches_1_1 = patches_1.next(); !patches_1_1.done; patches_1_1 = patches_1.next()) {
371
335
  var _e = tslib_1.__read(patches_1_1.value, 2), patch = _e[0], _f = _e[1], type = _f === void 0 ? "redo" : _f;
372
336
  var patchKey = type === "redo" ? "patches" : "inversePatches";
373
337
  try {
374
- for (var docMap_3 = (e_10 = void 0, tslib_1.__values(docMap)), docMap_3_1 = docMap_3.next(); !docMap_3_1.done; docMap_3_1 = docMap_3.next()) {
338
+ for (var docMap_3 = (e_9 = void 0, tslib_1.__values(docMap)), docMap_3_1 = docMap_3.next(); !docMap_3_1.done; docMap_3_1 = docMap_3.next()) {
375
339
  var _g = tslib_1.__read(docMap_3_1.value, 2), mappingKey = _g[0], _h = tslib_1.__read(_g[1], 1), doc_2 = _h[0];
376
340
  var currentPatch = patch[mappingKey];
377
341
  var patches_2 = currentPatch === null || currentPatch === void 0 ? void 0 : currentPatch[patchKey];
@@ -388,12 +352,12 @@ var useYSpreadsheet = function (_a) {
388
352
  }
389
353
  }
390
354
  }
391
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
355
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
392
356
  finally {
393
357
  try {
394
358
  if (docMap_3_1 && !docMap_3_1.done && (_b = docMap_3.return)) _b.call(docMap_3);
395
359
  }
396
- finally { if (e_10) throw e_10.error; }
360
+ finally { if (e_9) throw e_9.error; }
397
361
  }
398
362
  if ((_d = patch.recalcCells) === null || _d === void 0 ? void 0 : _d[type]) {
399
363
  yRecalcCells.push([
@@ -405,12 +369,12 @@ var useYSpreadsheet = function (_a) {
405
369
  }
406
370
  }
407
371
  }
408
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
372
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
409
373
  finally {
410
374
  try {
411
375
  if (patches_1_1 && !patches_1_1.done && (_a = patches_1.return)) _a.call(patches_1);
412
376
  }
413
- finally { if (e_9) throw e_9.error; }
377
+ finally { if (e_8) throw e_8.error; }
414
378
  }
415
379
  }, "local");
416
380
  }, [userId, docMap, doc, yRecalcCells, yDisableRecalc]);
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveYjsRuntime = exports.setDefaultYjsRuntime = void 0;
4
4
  /**
5
5
  * y-spreadsheet does not import a Yjs implementation: every helper and hook
6
- * takes the namespace of the implementation the document belongs to (`yjs`,
7
- * or a yjs-13-compatible layer over `@y/y` 14). A host that always works with
8
- * one implementation can register it once here instead of passing it on every
9
- * call; a runtime passed to a call wins over the registered one.
6
+ * takes the host's node operations for the `@y/y` 14 document it works on
7
+ * (`YjsRuntime`). A host that always works with one runtime can register it
8
+ * once here instead of passing it on every call; a runtime passed to a call
9
+ * wins over the registered one.
10
10
  */
11
11
  var defaultYjsRuntime;
12
12
  /** Registers (or, with `undefined`, clears) the runtime used when a call passes none. */
@@ -18,7 +18,7 @@ exports.setDefaultYjsRuntime = setDefaultYjsRuntime;
18
18
  var resolveYjsRuntime = function (runtime) {
19
19
  var resolved = runtime !== null && runtime !== void 0 ? runtime : defaultYjsRuntime;
20
20
  if (!resolved) {
21
- throw new Error("@rowsncolumns/y-spreadsheet: no Yjs runtime. Pass `yjs` (the namespace of the Yjs implementation the document belongs to, e.g. `import * as Y from \"yjs\"`) or register one with setDefaultYjsRuntime(Y). The package does not import yjs itself.");
21
+ throw new Error("@rowsncolumns/y-spreadsheet: no Yjs runtime. Pass `yjs` (the host's YjsRuntime for its @y/y 14 documents: createMap / createArray / isMap / isArray, getPathTo, Doc and the update functions) or register one with setDefaultYjsRuntime(runtime). The package does not import a Yjs implementation itself.");
22
22
  }
23
23
  return resolved;
24
24
  };
@@ -0,0 +1,61 @@
1
+ import type { YEvent, YjsRuntime, YNode, YTransaction } from "./types";
2
+ /** Inserts `items` at `index`; nothing at all for no items (as Yjs 13's `Y.Array#insert`). */
3
+ export declare const listInsert: (node: YNode, index: number, items: readonly unknown[]) => void;
4
+ /** Deletes `length` items from `index`; nothing at all for a length of 0. */
5
+ export declare const listDelete: (node: YNode, index: number, length: number) => void;
6
+ /** Calls `callback` with each entry of a map node (its attributes), in insertion order. */
7
+ export declare const forEachEntry: (node: YNode, callback: (value: any, key: string) => void) => void;
8
+ /** Whether a map node holds any entry (without counting them all). */
9
+ export declare const hasEntries: (node: YNode) => boolean;
10
+ /**
11
+ * A stored value as Yjs 13's `toJSON` rendered it: a map node as an object of
12
+ * its entries, an array node as an array of its items (nested nodes rendered
13
+ * the same way), told apart by the host's `isMap` / `isArray` (their Yjs 13
14
+ * type reference). Anything else is returned as it is; a node of another kind
15
+ * (a text, XML) as its own `toJSON()`.
16
+ */
17
+ export declare const nodeJson: (value: unknown, runtime: YjsRuntime) => unknown;
18
+ /** A map node (or a root read as a map) as Yjs 13's `Y.Map#toJSON`: its entries in insertion order. */
19
+ export declare const mapJson: (node: YNode, runtime: YjsRuntime) => Record<string, any>;
20
+ /** An array node (or a root read as an array) as Yjs 13's `Y.Array#toJSON`. */
21
+ export declare const arrayJson: (node: YNode, runtime: YjsRuntime) => any[];
22
+ /** A changed descendant of an observed node, with its path from that node. */
23
+ export type YDeepEvent = {
24
+ event: YEvent;
25
+ path: Array<string | number>;
26
+ };
27
+ /**
28
+ * What Yjs 13's `observeDeep` delivered for `node` in `transaction`: an event
29
+ * per changed type at or below `node` that is still in the document, each with
30
+ * its path from `node`, top level first. `@y/y` calls a deep observer once per
31
+ * transaction and keeps the per-type events on the transaction, including the
32
+ * types the transaction deleted (Yjs 13 left those out: their paths name
33
+ * positions the deleted types no longer hold).
34
+ */
35
+ export declare const liveDeepEvents: (node: YNode, transaction: YTransaction, runtime: YjsRuntime) => YDeepEvent[];
36
+ /** One operation of a change to a node's children, as Yjs 13's `event.changes.delta` reported it. */
37
+ export type YjsDeltaOp = {
38
+ insert?: any[] | string;
39
+ delete?: number;
40
+ retain?: number;
41
+ };
42
+ /**
43
+ * The change `event` made to its target's children in Yjs 13's delta form:
44
+ * runs of kept (`retain`), removed (`delete`) and inserted (`insert`, the
45
+ * values) children. A child whose own content changed is kept, as Yjs 13
46
+ * counted it. Empty when only attributes changed. Read inside the observer.
47
+ */
48
+ export declare const childDelta: (event: YEvent) => YjsDeltaOp[];
49
+ /** The values `event` inserted into its target's children, in order. Read inside the observer. */
50
+ export declare const insertedValues: (event: YEvent) => unknown[];
51
+ /**
52
+ * The keys `event` changed on its target with the action Yjs 13 reported for
53
+ * them (`event.changes.keys`), read off the event's delta: a key it set is an
54
+ * `"update"` (an add too: neither the delta nor the package tells them apart),
55
+ * a key it removed a `"delete"`, and a key it set and removed again is left
56
+ * out, as Yjs 13 left it out. Read inside the observer.
57
+ */
58
+ export declare const changedKeys: (event: YEvent) => Map<string, {
59
+ action: "add" | "update" | "delete";
60
+ }>;
61
+ //# sourceMappingURL=ynodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ynodes.d.ts","sourceRoot":"","sources":["../../ynodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvE,8FAA8F;AAC9F,eAAO,MAAM,UAAU,GACrB,MAAM,KAAK,EACX,OAAO,MAAM,EACb,OAAO,SAAS,OAAO,EAAE,KACxB,IAEF,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,UAAU,GAAI,MAAM,KAAK,EAA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;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,KACZ,GAAG,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAAE,CAOrD,CAAC"}
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.changedKeys = exports.insertedValues = exports.childDelta = exports.liveDeepEvents = exports.arrayJson = exports.mapJson = exports.nodeJson = exports.hasEntries = exports.forEachEntry = exports.listDelete = exports.listInsert = void 0;
4
+ var tslib_1 = require("tslib");
5
+ // Reads and writes over `@y/y` 14 nodes shared by the helpers and the hooks.
6
+ // Every function reads integrated nodes only: `@y/y` keeps a node's content to
7
+ // itself until the node is inserted into a document.
8
+ /** Inserts `items` at `index`; nothing at all for no items (as Yjs 13's `Y.Array#insert`). */
9
+ var listInsert = function (node, index, items) {
10
+ if (items.length > 0)
11
+ node.insert(index, tslib_1.__spreadArray([], tslib_1.__read(items), false));
12
+ };
13
+ exports.listInsert = listInsert;
14
+ /** Deletes `length` items from `index`; nothing at all for a length of 0. */
15
+ var listDelete = function (node, index, length) {
16
+ if (length > 0)
17
+ node.delete(index, length);
18
+ };
19
+ exports.listDelete = listDelete;
20
+ /** Calls `callback` with each entry of a map node (its attributes), in insertion order. */
21
+ var forEachEntry = function (node, callback) {
22
+ node.forEachAttr(callback);
23
+ };
24
+ exports.forEachEntry = forEachEntry;
25
+ /** Whether a map node holds any entry (without counting them all). */
26
+ var hasEntries = function (node) {
27
+ return !node.attrKeys().next().done;
28
+ };
29
+ exports.hasEntries = hasEntries;
30
+ /** Whether `value` is a `@y/y` node of a kind the host does not map (neither a map nor an array). */
31
+ var isOtherNode = function (value) {
32
+ return typeof value === "object" &&
33
+ value !== null &&
34
+ typeof value.observe === "function" &&
35
+ typeof value.toJSON === "function";
36
+ };
37
+ /**
38
+ * A stored value as Yjs 13's `toJSON` rendered it: a map node as an object of
39
+ * its entries, an array node as an array of its items (nested nodes rendered
40
+ * the same way), told apart by the host's `isMap` / `isArray` (their Yjs 13
41
+ * type reference). Anything else is returned as it is; a node of another kind
42
+ * (a text, XML) as its own `toJSON()`.
43
+ */
44
+ var nodeJson = function (value, runtime) {
45
+ if (runtime.isMap(value))
46
+ return (0, exports.mapJson)(value, runtime);
47
+ if (runtime.isArray(value))
48
+ return (0, exports.arrayJson)(value, runtime);
49
+ if (isOtherNode(value))
50
+ return value.toJSON();
51
+ return value;
52
+ };
53
+ exports.nodeJson = nodeJson;
54
+ /** A map node (or a root read as a map) as Yjs 13's `Y.Map#toJSON`: its entries in insertion order. */
55
+ var mapJson = function (node, runtime) {
56
+ var out = {};
57
+ node.forEachAttr(function (value, key) {
58
+ out[String(key)] = (0, exports.nodeJson)(value, runtime);
59
+ });
60
+ return out;
61
+ };
62
+ exports.mapJson = mapJson;
63
+ /** An array node (or a root read as an array) as Yjs 13's `Y.Array#toJSON`. */
64
+ var arrayJson = function (node, runtime) {
65
+ return node.toArray().map(function (value) { return (0, exports.nodeJson)(value, runtime); });
66
+ };
67
+ exports.arrayJson = arrayJson;
68
+ /** The node `path` leads to from `node` (attribute keys and child indexes), or undefined. */
69
+ var resolvePath = function (node, path) {
70
+ var e_1, _a;
71
+ var current = node;
72
+ try {
73
+ for (var path_1 = tslib_1.__values(path), path_1_1 = path_1.next(); !path_1_1.done; path_1_1 = path_1.next()) {
74
+ var segment = path_1_1.value;
75
+ if (!isOtherNode(current))
76
+ return undefined;
77
+ current =
78
+ typeof segment === "number"
79
+ ? current.get(segment)
80
+ : current.getAttr(segment);
81
+ }
82
+ }
83
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
84
+ finally {
85
+ try {
86
+ if (path_1_1 && !path_1_1.done && (_a = path_1.return)) _a.call(path_1);
87
+ }
88
+ finally { if (e_1) throw e_1.error; }
89
+ }
90
+ return current;
91
+ };
92
+ /**
93
+ * What Yjs 13's `observeDeep` delivered for `node` in `transaction`: an event
94
+ * per changed type at or below `node` that is still in the document, each with
95
+ * its path from `node`, top level first. `@y/y` calls a deep observer once per
96
+ * transaction and keeps the per-type events on the transaction, including the
97
+ * types the transaction deleted (Yjs 13 left those out: their paths name
98
+ * positions the deleted types no longer hold).
99
+ */
100
+ var liveDeepEvents = function (node, transaction, runtime) {
101
+ var e_2, _a;
102
+ var _b;
103
+ var out = [];
104
+ try {
105
+ for (var _c = tslib_1.__values((_b = transaction.changedParentTypes.get(node)) !== null && _b !== void 0 ? _b : []), _d = _c.next(); !_d.done; _d = _c.next()) {
106
+ var event_1 = _d.value;
107
+ var path = void 0;
108
+ try {
109
+ path = runtime.getPathTo(node, event_1.target);
110
+ }
111
+ catch (_e) {
112
+ continue;
113
+ }
114
+ if (resolvePath(node, path) !== event_1.target)
115
+ continue;
116
+ out.push({ event: event_1, path: path });
117
+ }
118
+ }
119
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
120
+ finally {
121
+ try {
122
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
123
+ }
124
+ finally { if (e_2) throw e_2.error; }
125
+ }
126
+ return out.sort(function (a, b) { return a.path.length - b.path.length; });
127
+ };
128
+ exports.liveDeepEvents = liveDeepEvents;
129
+ var childOps = function (event) { var _a, _b; return (_b = (_a = event.delta) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []; };
130
+ /**
131
+ * The change `event` made to its target's children in Yjs 13's delta form:
132
+ * runs of kept (`retain`), removed (`delete`) and inserted (`insert`, the
133
+ * values) children. A child whose own content changed is kept, as Yjs 13
134
+ * counted it. Empty when only attributes changed. Read inside the observer.
135
+ */
136
+ var childDelta = function (event) {
137
+ var e_3, _a;
138
+ var out = [];
139
+ var retain = function (count) {
140
+ var last = out[out.length - 1];
141
+ if (last && last.retain !== undefined)
142
+ last.retain += count;
143
+ else
144
+ out.push({ retain: count });
145
+ };
146
+ try {
147
+ for (var _b = tslib_1.__values(childOps(event)), _c = _b.next(); !_c.done; _c = _b.next()) {
148
+ var op = _c.value;
149
+ if (Array.isArray(op.insert) || typeof op.insert === "string") {
150
+ out.push({ insert: op.insert });
151
+ }
152
+ else if (typeof op.delete === "number") {
153
+ out.push({ delete: op.delete });
154
+ }
155
+ else if (typeof op.retain === "number") {
156
+ retain(op.retain);
157
+ }
158
+ else {
159
+ // A child whose content changed (`modify`) is one kept child.
160
+ retain(1);
161
+ }
162
+ }
163
+ }
164
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
165
+ finally {
166
+ try {
167
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
168
+ }
169
+ finally { if (e_3) throw e_3.error; }
170
+ }
171
+ return out;
172
+ };
173
+ exports.childDelta = childDelta;
174
+ /** The values `event` inserted into its target's children, in order. Read inside the observer. */
175
+ var insertedValues = function (event) {
176
+ var e_4, _a;
177
+ var out = [];
178
+ try {
179
+ for (var _b = tslib_1.__values(childOps(event)), _c = _b.next(); !_c.done; _c = _b.next()) {
180
+ var op = _c.value;
181
+ if (Array.isArray(op.insert))
182
+ out.push.apply(out, tslib_1.__spreadArray([], tslib_1.__read(op.insert), false));
183
+ }
184
+ }
185
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
186
+ finally {
187
+ try {
188
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
189
+ }
190
+ finally { if (e_4) throw e_4.error; }
191
+ }
192
+ return out;
193
+ };
194
+ exports.insertedValues = insertedValues;
195
+ /**
196
+ * The keys `event` changed on its target with the action Yjs 13 reported for
197
+ * them (`event.changes.keys`), read off the event's delta: a key it set is an
198
+ * `"update"` (an add too: neither the delta nor the package tells them apart),
199
+ * a key it removed a `"delete"`, and a key it set and removed again is left
200
+ * out, as Yjs 13 left it out. Read inside the observer.
201
+ */
202
+ var changedKeys = function (event) {
203
+ var e_5, _a;
204
+ var _b, _c;
205
+ var out = new Map();
206
+ try {
207
+ for (var _d = tslib_1.__values((_c = (_b = event.delta) === null || _b === void 0 ? void 0 : _b.attrs) !== null && _c !== void 0 ? _c : []), _e = _d.next(); !_e.done; _e = _d.next()) {
208
+ var op = _e.value;
209
+ if (op.type === "insert")
210
+ out.set(String(op.key), { action: "update" });
211
+ else if (op.type === "delete")
212
+ out.set(String(op.key), { action: "delete" });
213
+ }
214
+ }
215
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
216
+ finally {
217
+ try {
218
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
219
+ }
220
+ finally { if (e_5) throw e_5.error; }
221
+ }
222
+ return out;
223
+ };
224
+ exports.changedKeys = changedKeys;
@@ -1,7 +1,7 @@
1
1
  import type { CellData, CellFormat } from "@rowsncolumns/spreadsheet";
2
2
  import type { SheetData } from "@rowsncolumns/spreadsheet-state";
3
3
  import type { Patch } from "immer";
4
- import type * as Y from "yjs";
4
+ import type { YDoc } from "./types";
5
5
  /** A parsed v5 cell key; line ids as decimal strings (an id can exceed 2^53). */
6
6
  export type ParsedCellKeyV5 = {
7
7
  sheetId: number;
@@ -14,7 +14,7 @@ export type StyleOverlayV5 = Map<string, CellFormat>;
14
14
  * A sheet's line ids in grid order (position = index + 1), as decimal strings.
15
15
  * Later duplicates and non-id values are skipped, as the engine's index does.
16
16
  */
17
- export declare const readLineIds: (doc: Y.Doc, sheetId: number, axis: "row" | "column") => string[];
17
+ export declare const readLineIds: (doc: YDoc, sheetId: number, axis: "row" | "column") => string[];
18
18
  /** The `rncCells` / `rncNotes` key of a cell by its line ids. */
19
19
  export declare const createCellKeyV5: (sheetId: number, rowId: string, colId: string) => string;
20
20
  /** Parse a v5 key `"{sheetId}:{rowId}:{colId}"`; null when malformed. */
@@ -24,26 +24,26 @@ export declare const parseCellKeyV5: (key: string) => ParsedCellKeyV5 | null;
24
24
  * `rncCellStyles` seed (`"{sheetId}!{A1}"`, the client-0 ids of that position)
25
25
  * with every `rncCellStylesLog` buffer folded on in array order. Walks the log.
26
26
  */
27
- export declare const readStyleOverlayV5: (doc: Y.Doc) => StyleOverlayV5;
27
+ export declare const readStyleOverlayV5: (doc: YDoc) => StyleOverlayV5;
28
28
  /**
29
29
  * A v5 doc as V2 `SheetData` (same shape as `sheetDataV3ToV2`), hot plane only:
30
30
  * every key of `rncCells`, `rncNotes` and the composed style plane composed as
31
31
  * `composeCell` does (tombstones and orphans skipped).
32
32
  */
33
- export declare const sheetDataV5ToV2: <T extends CellData>(doc: Y.Doc, styles?: ReadonlyMap<string, CellFormat>) => SheetData<T>;
33
+ export declare const sheetDataV5ToV2: <T extends CellData>(doc: YDoc, styles?: ReadonlyMap<string, CellFormat>) => SheetData<T>;
34
34
  /**
35
35
  * A reader of the cell at a 1-based position (`composeCell`), line ids read once
36
36
  * per sheet. Undefined when nothing is there or the line is unnamed.
37
37
  */
38
- export declare const createCellReaderV5: <T extends CellData = CellData>(doc: Y.Doc, styles?: ReadonlyMap<string, CellFormat>) => (sheetId: number, rowIndex: number, columnIndex: number) => T | undefined;
38
+ export declare const createCellReaderV5: <T extends CellData = CellData>(doc: YDoc, styles?: ReadonlyMap<string, CellFormat>) => (sheetId: number, rowIndex: number, columnIndex: number) => T | undefined;
39
39
  /** `createCellReaderV5` for one cell (reads both id arrays: O(lines)). */
40
- export declare const getCellV5: <T extends CellData = CellData>(doc: Y.Doc, sheetId: number, rowIndex: number, columnIndex: number, styles?: ReadonlyMap<string, CellFormat>) => T | undefined;
40
+ export declare const getCellV5: <T extends CellData = CellData>(doc: YDoc, sheetId: number, rowIndex: number, columnIndex: number, styles?: ReadonlyMap<string, CellFormat>) => T | undefined;
41
41
  /**
42
42
  * Apply changed `rncCells` / `rncNotes` keys to `currentSheetData` (copy-on-write,
43
43
  * like `processSheetDataEventsV3`), `uf` from `styles`. Only valid while no id
44
44
  * array and no style changed (those need `sheetDataV5ToV2`). Null when nothing changed.
45
45
  */
46
- export declare const processSheetDataChangesV5: <T extends CellData>(changedKeys: Iterable<string>, currentSheetData: SheetData<T>, doc: Y.Doc, styles?: ReadonlyMap<string, CellFormat>) => SheetData<T> | null;
46
+ export declare const processSheetDataChangesV5: <T extends CellData>(changedKeys: Iterable<string>, currentSheetData: SheetData<T>, doc: YDoc, styles?: ReadonlyMap<string, CellFormat>) => SheetData<T> | null;
47
47
  /**
48
48
  * Apply immer `SheetData` patches to a v5 doc in one transaction (`origin`, the
49
49
  * caller's; nested in an open transaction it joins that one). Positional, like
@@ -54,11 +54,11 @@ export declare const processSheetDataChangesV5: <T extends CellData>(changedKeys
54
54
  * inline on the cell. `styles`, when given, is the caller's composed style plane
55
55
  * (`readStyleOverlayV5`), used instead of folding the log and updated in place.
56
56
  */
57
- export declare const addSheetDataPatchesV5: (doc: Y.Doc, patches: Patch[] | undefined, origin?: unknown, styles?: StyleOverlayV5) => void;
57
+ export declare const addSheetDataPatchesV5: (doc: YDoc, patches: Patch[] | undefined, origin?: unknown, styles?: StyleOverlayV5) => void;
58
58
  /** Set one cell of a v5 doc (see `addSheetDataPatchesV5`). */
59
- export declare const setCellV5: (doc: Y.Doc, sheetId: number, rowIndex: number, columnIndex: number, value: CellData) => void;
59
+ export declare const setCellV5: (doc: YDoc, sheetId: number, rowIndex: number, columnIndex: number, value: CellData) => void;
60
60
  /** Remove one cell of a v5 doc (see `addSheetDataPatchesV5`). */
61
- export declare const deleteCellV5: (doc: Y.Doc, sheetId: number, rowIndex: number, columnIndex: number) => void;
61
+ export declare const deleteCellV5: (doc: YDoc, sheetId: number, rowIndex: number, columnIndex: number) => void;
62
62
  /** Remove every cell of a sheet of a v5 doc; its line ids and dimensions stay. */
63
- export declare const deleteSheetV5: (doc: Y.Doc, sheetId: number) => void;
63
+ export declare const deleteSheetV5: (doc: YDoc, sheetId: number) => void;
64
64
  //# sourceMappingURL=helpers-v5.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers-v5.d.ts","sourceRoot":"","sources":["../../helpers-v5.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;A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