y-mxgraph 0.5.7 → 0.6.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/y-mxgraph.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const transformer = require("./index-Dpa3-atS.cjs");
3
+ const transform = require("./index-CcOHH2TY.cjs");
4
4
  const Y = require("yjs");
5
5
  const colord = require("colord");
6
6
  function _interopNamespaceDefault(e) {
@@ -20,6 +20,25 @@ function _interopNamespaceDefault(e) {
20
20
  return Object.freeze(n);
21
21
  }
22
22
  const Y__namespace = /* @__PURE__ */ _interopNamespaceDefault(Y);
23
+ var __defProp$1 = Object.defineProperty;
24
+ var __defProps = Object.defineProperties;
25
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
26
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
27
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
28
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
29
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30
+ var __spreadValues$1 = (a, b) => {
31
+ for (var prop in b || (b = {}))
32
+ if (__hasOwnProp$1.call(b, prop))
33
+ __defNormalProp$1(a, prop, b[prop]);
34
+ if (__getOwnPropSymbols$1)
35
+ for (var prop of __getOwnPropSymbols$1(b)) {
36
+ if (__propIsEnum$1.call(b, prop))
37
+ __defNormalProp$1(a, prop, b[prop]);
38
+ }
39
+ return a;
40
+ };
41
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
42
  const DIFF_INSERT = "i";
24
43
  const DIFF_REMOVE = "r";
25
44
  const DIFF_UPDATE = "u";
@@ -55,11 +74,11 @@ function ensureUniqueOrder(orderArr) {
55
74
  }
56
75
  function applyFilePatch(doc, patch, options) {
57
76
  doc.transact(() => {
58
- const mxfile = doc.getMap(transformer.key);
77
+ const mxfile = doc.getMap(transform.key);
59
78
  if (patch[DIFF_REMOVE]) {
60
- const diagramsMap = mxfile.get(transformer.key$1);
79
+ const diagramsMap = mxfile.get(transform.key$1);
61
80
  const orderArr = mxfile.get(
62
- transformer.diagramOrderKey
81
+ transform.diagramOrderKey
63
82
  );
64
83
  ensureUniqueOrder(orderArr);
65
84
  const orderList = orderArr.toArray();
@@ -71,9 +90,9 @@ function applyFilePatch(doc, patch, options) {
71
90
  }
72
91
  }
73
92
  if (patch[DIFF_INSERT]) {
74
- const diagramsMap = mxfile.get(transformer.key$1);
93
+ const diagramsMap = mxfile.get(transform.key$1);
75
94
  const orderArr = mxfile.get(
76
- transformer.diagramOrderKey
95
+ transform.diagramOrderKey
77
96
  );
78
97
  ensureUniqueOrder(orderArr);
79
98
  const currentOrder = orderArr.toArray();
@@ -86,9 +105,9 @@ function applyFilePatch(doc, patch, options) {
86
105
  const existingIndex = /* @__PURE__ */ new Map();
87
106
  existingIds.forEach((id, idx) => existingIndex.set(id, idx));
88
107
  const inserts = patch[DIFF_INSERT].map((item, order) => {
89
- const object = transformer.parse(item.data);
108
+ const object = transform.parse(item.data);
90
109
  const diagramObj = Array.isArray(object == null ? void 0 : object.diagram) ? object.diagram[0] : object == null ? void 0 : object.diagram;
91
- const diagramElement = transformer.parse$1(
110
+ const diagramElement = transform.parse$1(
92
111
  diagramObj
93
112
  );
94
113
  return {
@@ -126,7 +145,7 @@ function applyFilePatch(doc, patch, options) {
126
145
  }
127
146
  return { anchorId, depth };
128
147
  };
129
- const enriched = inserts.map((i) => ({ ...i, ...computeAnchor(i) }));
148
+ const enriched = inserts.map((i) => __spreadValues$1(__spreadValues$1({}, i), computeAnchor(i)));
130
149
  enriched.sort((a, b) => {
131
150
  const aIdx = a.anchorId ? existingIndex.get(a.anchorId) : -1;
132
151
  const bIdx = b.anchorId ? existingIndex.get(b.anchorId) : -1;
@@ -142,7 +161,7 @@ function applyFilePatch(doc, patch, options) {
142
161
  if (patch[DIFF_UPDATE]) {
143
162
  Object.keys(patch[DIFF_UPDATE]).forEach((id) => {
144
163
  const diagramsMap = mxfile.get(
145
- transformer.key$1
164
+ transform.key$1
146
165
  );
147
166
  const diagram = diagramsMap.get(id);
148
167
  if (diagram) {
@@ -154,10 +173,10 @@ function applyFilePatch(doc, patch, options) {
154
173
  );
155
174
  }
156
175
  if (update.cells) {
157
- const yMxGraphModel = diagram.get(transformer.key$2);
176
+ const yMxGraphModel = diagram.get(transform.key$2);
158
177
  if (!yMxGraphModel) return;
159
- const cellsMap = yMxGraphModel.get(transformer.key$3);
160
- const orderArr = yMxGraphModel.get(transformer.mxCellOrderKey);
178
+ const cellsMap = yMxGraphModel.get(transform.key$3);
179
+ const orderArr = yMxGraphModel.get(transform.mxCellOrderKey);
161
180
  if (!cellsMap || !orderArr) return;
162
181
  ensureUniqueOrder(orderArr);
163
182
  if (update.cells[DIFF_REMOVE] && update.cells[DIFF_REMOVE].length) {
@@ -277,7 +296,7 @@ function applyFilePatch(doc, patch, options) {
277
296
  if ("previous" in update) {
278
297
  const previous = update.previous || null;
279
298
  const orderArr = mxfile.get(
280
- transformer.diagramOrderKey
299
+ transform.diagramOrderKey
281
300
  );
282
301
  ensureUniqueOrder(orderArr);
283
302
  insertAfterUnique(orderArr, id, previous, false);
@@ -289,9 +308,9 @@ function applyFilePatch(doc, patch, options) {
289
308
  }
290
309
  function initDocSnapshot(doc, resetSnapshot = false) {
291
310
  try {
292
- const mxfile = doc.getMap(transformer.key);
293
- const diagramsMap = mxfile.get(transformer.key$1);
294
- const orderArr = mxfile.get(transformer.diagramOrderKey);
311
+ const mxfile = doc.getMap(transform.key);
312
+ const diagramsMap = mxfile.get(transform.key$1);
313
+ const orderArr = mxfile.get(transform.diagramOrderKey);
295
314
  const orderIds = orderArr ? orderArr.toArray() : [];
296
315
  const allDiagramIds = orderIds.length > 0 ? orderIds : diagramsMap ? Array.from(diagramsMap.keys()) : [];
297
316
  const diagramOrder = resetSnapshot ? [] : allDiagramIds.slice();
@@ -304,12 +323,12 @@ function initDocSnapshot(doc, resetSnapshot = false) {
304
323
  for (const d of diagrams) {
305
324
  const did = d.get("id") || "";
306
325
  if (!did) continue;
307
- const gm = d.get(transformer.key$2);
326
+ const gm = d.get(transform.key$2);
308
327
  if (gm) {
309
- const order = gm.get(transformer.mxCellOrderKey);
328
+ const order = gm.get(transform.mxCellOrderKey);
310
329
  const ids = order ? order.toArray().slice() : [];
311
330
  snap.cellsOrder.set(did, ids);
312
- const cellsMap = gm.get(transformer.key$3);
331
+ const cellsMap = gm.get(transform.key$3);
313
332
  const attrMap = /* @__PURE__ */ new Map();
314
333
  if (cellsMap) {
315
334
  for (const cid of ids) {
@@ -334,14 +353,14 @@ function initDocSnapshot(doc, resetSnapshot = false) {
334
353
  }
335
354
  }
336
355
  function generatePatch(events, explicitDoc) {
337
- var _a, _b;
356
+ var _a, _b, _c, _d, _e;
338
357
  const patch = {};
339
358
  const doc = (_b = (_a = events[0]) == null ? void 0 : _a.transaction) == null ? void 0 : _b.doc;
340
359
  if (!doc) return patch;
341
360
  if (!events || events.length === 0) return patch;
342
- const mxfile = doc.getMap(transformer.key);
343
- const diagramsMap = mxfile.get(transformer.key$1);
344
- const orderArr = mxfile.get(transformer.diagramOrderKey);
361
+ const mxfile = doc.getMap(transform.key);
362
+ const diagramsMap = mxfile.get(transform.key$1);
363
+ const orderArr = mxfile.get(transform.diagramOrderKey);
345
364
  let snap = docSnapshots.get(doc);
346
365
  if (!snap) {
347
366
  snap = {
@@ -364,7 +383,7 @@ function generatePatch(events, explicitDoc) {
364
383
  u.cells = u.cells || {};
365
384
  return u.cells;
366
385
  };
367
- const orderIds = (orderArr == null ? void 0 : orderArr.toArray()) ?? [];
386
+ const orderIds = (_c = orderArr == null ? void 0 : orderArr.toArray()) != null ? _c : [];
368
387
  const currDiagramOrder = orderIds.length > 0 ? orderIds : diagramsMap ? Array.from(diagramsMap.keys()) : [];
369
388
  const diagramsList = currDiagramOrder.map((id) => diagramsMap.get(id)).filter((d) => !!d);
370
389
  const currCellsOrder = /* @__PURE__ */ new Map();
@@ -372,10 +391,10 @@ function generatePatch(events, explicitDoc) {
372
391
  for (const d of diagramsList) {
373
392
  const did = d.get("id") || "";
374
393
  const attrs = /* @__PURE__ */ new Map();
375
- const gm = d.get(transformer.key$2);
394
+ const gm = d.get(transform.key$2);
376
395
  if (gm) {
377
- const cellsMap = gm.get(transformer.key$3);
378
- const orderArr2 = gm.get(transformer.mxCellOrderKey);
396
+ const cellsMap = gm.get(transform.key$3);
397
+ const orderArr2 = gm.get(transform.mxCellOrderKey);
379
398
  if (cellsMap && orderArr2) {
380
399
  const ids = orderArr2.toArray();
381
400
  currCellsOrder.set(did, ids);
@@ -412,7 +431,7 @@ function generatePatch(events, explicitDoc) {
412
431
  const previous = index <= 0 ? "" : currDiagramOrder[index - 1];
413
432
  const yDiagram = diagramsMap.get(id);
414
433
  if (!yDiagram) continue;
415
- const data = transformer.serializer({ diagram: transformer.serialize(yDiagram) });
434
+ const data = transform.serializer({ diagram: transform.serialize(yDiagram) });
416
435
  patch[DIFF_INSERT].push({ id, previous, data });
417
436
  insertedDiagramIdGlobal.add(id);
418
437
  }
@@ -460,10 +479,9 @@ function generatePatch(events, explicitDoc) {
460
479
  const attrs = attrsMap.get(cid) || {};
461
480
  const index = currCells.indexOf(cid);
462
481
  const previous = index <= 0 ? "" : currCells[index - 1];
463
- cells[DIFF_INSERT].push({
464
- ...attrs,
482
+ cells[DIFF_INSERT].push(__spreadProps(__spreadValues$1({}, attrs), {
465
483
  previous
466
- });
484
+ }));
467
485
  insertedCellIdGlobal.add(cid);
468
486
  }
469
487
  }
@@ -551,8 +569,8 @@ function generatePatch(events, explicitDoc) {
551
569
  const cellUpdate = updateBucket[cid] = updateBucket[cid] || {};
552
570
  let changed = false;
553
571
  for (const k of keys) {
554
- const pv = prevAttrs[k] ?? "";
555
- const cv = currAttrs[k] ?? "";
572
+ const pv = (_d = prevAttrs[k]) != null ? _d : "";
573
+ const cv = (_e = currAttrs[k]) != null ? _e : "";
556
574
  if (pv !== cv) {
557
575
  cellUpdate[k] = cv;
558
576
  changed = true;
@@ -575,7 +593,7 @@ function generatePatch(events, explicitDoc) {
575
593
  for (const [did, attrsMap] of cellAttrMap.entries()) {
576
594
  const copy = /* @__PURE__ */ new Map();
577
595
  for (const [cid, attrs] of attrsMap.entries()) {
578
- copy.set(cid, { ...attrs });
596
+ copy.set(cid, __spreadValues$1({}, attrs));
579
597
  }
580
598
  newCellsAttrs.set(did, copy);
581
599
  }
@@ -621,8 +639,8 @@ function bindUndoManager(doc, file, yUndo) {
621
639
  this.eventListeners.push(name, fn);
622
640
  },
623
641
  fireEvent(evt) {
624
- var _a;
625
- const eventName = (evt == null ? void 0 : evt.name) || (((_a = evt == null ? void 0 : evt.getName) == null ? void 0 : _a.call(evt)) ?? "");
642
+ var _a, _b;
643
+ const eventName = (evt == null ? void 0 : evt.name) || ((_b = (_a = evt == null ? void 0 : evt.getName) == null ? void 0 : _a.call(evt)) != null ? _b : "");
626
644
  for (let i = 0; i + 1 < this.eventListeners.length; i += 2) {
627
645
  const key = this.eventListeners[i];
628
646
  const listener = this.eventListeners[i + 1];
@@ -734,6 +752,22 @@ function bindUndoManager(doc, file, yUndo) {
734
752
  };
735
753
  return destroy;
736
754
  }
755
+ var __defProp = Object.defineProperty;
756
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
757
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
758
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
759
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
760
+ var __spreadValues = (a, b) => {
761
+ for (var prop in b || (b = {}))
762
+ if (__hasOwnProp.call(b, prop))
763
+ __defNormalProp(a, prop, b[prop]);
764
+ if (__getOwnPropSymbols)
765
+ for (var prop of __getOwnPropSymbols(b)) {
766
+ if (__propIsEnum.call(b, prop))
767
+ __defNormalProp(a, prop, b[prop]);
768
+ }
769
+ return a;
770
+ };
737
771
  function getAwarenessStateValue(awareness, key, clientId) {
738
772
  const states = awareness.getStates();
739
773
  const id = clientId != null ? Number(clientId) : awareness.clientID;
@@ -766,7 +800,7 @@ function setAwarenessStateValue(awareness, key, value, clientId) {
766
800
  }
767
801
  function setByPath(obj, path, value) {
768
802
  const parts = path.split(".");
769
- const root = Array.isArray(obj) ? obj.slice() : { ...obj };
803
+ const root = Array.isArray(obj) ? obj.slice() : __spreadValues({}, obj);
770
804
  let cur = root;
771
805
  for (let i = 0; i < parts.length; i++) {
772
806
  const part = parts[i];
@@ -781,7 +815,7 @@ function setByPath(obj, path, value) {
781
815
  if (next == null) {
782
816
  next = nextIsIndex ? [] : {};
783
817
  } else {
784
- next = Array.isArray(next) ? next.slice() : { ...next };
818
+ next = Array.isArray(next) ? next.slice() : __spreadValues({}, next);
785
819
  }
786
820
  cur[key] = next;
787
821
  cur = next;
@@ -907,9 +941,10 @@ function createCursorEl(color, username) {
907
941
  return cursor;
908
942
  }
909
943
  function bindCursor(file, options) {
944
+ var _a;
910
945
  const graph = options.graph || file.getUi().editor.graph;
911
946
  const awareness = options.awareness;
912
- const mouseMoveThrottle = options.mouseMoveThrottle ?? 100;
947
+ const mouseMoveThrottle = (_a = options.mouseMoveThrottle) != null ? _a : 100;
913
948
  const listener = {
914
949
  startX: 0,
915
950
  startY: 0,
@@ -920,7 +955,7 @@ function bindCursor(file, options) {
920
955
  mouseUp: function() {
921
956
  },
922
957
  mouseMove: throttle(function(_sender, event) {
923
- var _a;
958
+ var _a2;
924
959
  const containerRect = graph.container.getBoundingClientRect();
925
960
  const { translate, scale } = graph.view;
926
961
  const x = Math.round(
@@ -932,17 +967,17 @@ function bindCursor(file, options) {
932
967
  awareness.setLocalStateField("cursor", {
933
968
  x,
934
969
  y,
935
- pageId: (_a = file.getUi().currentPage) == null ? void 0 : _a.getId()
970
+ pageId: (_a2 = file.getUi().currentPage) == null ? void 0 : _a2.getId()
936
971
  });
937
972
  }, mouseMoveThrottle)
938
973
  };
939
974
  graph.addMouseListener(listener);
940
975
  const handleMouseLeave = () => {
941
- var _a;
976
+ var _a2;
942
977
  awareness.setLocalStateField("cursor", {
943
978
  x: 0,
944
979
  y: 0,
945
- pageId: (_a = file.getUi().currentPage) == null ? void 0 : _a.getId(),
980
+ pageId: (_a2 = file.getUi().currentPage) == null ? void 0 : _a2.getId(),
946
981
  hide: true
947
982
  });
948
983
  };
@@ -1096,16 +1131,17 @@ function renderRemoteSelections(ui, remotes) {
1096
1131
  if (!currentPageRemotes.length) return;
1097
1132
  const graph = ui.editor.graph;
1098
1133
  currentPageRemotes.forEach(({ clientId, selectionState, userColor }) => {
1134
+ var _a2;
1099
1135
  let highlightCellMap = cache.get(clientId);
1100
1136
  if (!highlightCellMap) {
1101
1137
  highlightCellMap = /* @__PURE__ */ new Map();
1102
1138
  cache.set(clientId, highlightCellMap);
1103
1139
  }
1104
- const currentIds = new Set((selectionState == null ? void 0 : selectionState.ids) ?? []);
1140
+ const currentIds = new Set((_a2 = selectionState == null ? void 0 : selectionState.ids) != null ? _a2 : []);
1105
1141
  Array.from(highlightCellMap.keys()).forEach((id) => {
1106
- var _a2;
1142
+ var _a3;
1107
1143
  if (!currentIds.has(id)) {
1108
- (_a2 = highlightCellMap.get(id)) == null ? void 0 : _a2.destroy();
1144
+ (_a3 = highlightCellMap.get(id)) == null ? void 0 : _a3.destroy();
1109
1145
  highlightCellMap.delete(id);
1110
1146
  }
1111
1147
  });
@@ -1128,9 +1164,10 @@ function renderRemoteSelections(ui, remotes) {
1128
1164
  const DEFAULT_USER_NAME_KEY = "user.name";
1129
1165
  const DEFAULT_USER_COLOR_KEY = "user.color";
1130
1166
  function bindCollaborator(file, options) {
1167
+ var _a, _b;
1131
1168
  const graph = options.graph || file.getUi().editor.graph;
1132
1169
  const awareness = options.awareness;
1133
- const mouseMoveThrottle = options.mouseMoveThrottle ?? 100;
1170
+ const mouseMoveThrottle = (_a = options.mouseMoveThrottle) != null ? _a : 100;
1134
1171
  const cursorOption = options.cursor;
1135
1172
  const userNameKey = typeof cursorOption === "object" && (cursorOption == null ? void 0 : cursorOption.userNameKey) ? cursorOption.userNameKey : DEFAULT_USER_NAME_KEY;
1136
1173
  const userColorKey = typeof cursorOption === "object" && (cursorOption == null ? void 0 : cursorOption.userColorKey) ? cursorOption.userColorKey : DEFAULT_USER_COLOR_KEY;
@@ -1153,7 +1190,7 @@ function bindCollaborator(file, options) {
1153
1190
  awareness,
1154
1191
  graph
1155
1192
  });
1156
- const showCursor = options.cursor ?? true;
1193
+ const showCursor = (_b = options.cursor) != null ? _b : true;
1157
1194
  let cleanupAwareness;
1158
1195
  if (typeof showCursor === "boolean" && showCursor) {
1159
1196
  const awarenessHandler = (update) => {
@@ -1199,7 +1236,7 @@ const defaultApplyFileData = (file, xml) => {
1199
1236
  function mergeFileIntoDoc(doc, fileXml, strategy) {
1200
1237
  let parsed;
1201
1238
  try {
1202
- parsed = transformer.parse(fileXml);
1239
+ parsed = transform.parse(fileXml);
1203
1240
  } catch (err) {
1204
1241
  console.warn(
1205
1242
  "[y-mxgraph] 合并失败,file XML 解析异常,回退到 replace:",
@@ -1214,9 +1251,9 @@ function mergeFileIntoDoc(doc, fileXml, strategy) {
1214
1251
  );
1215
1252
  return false;
1216
1253
  }
1217
- const mxfileMap = doc.getMap(transformer.key);
1218
- const diagramMap = mxfileMap.get(transformer.key$1);
1219
- const diagramOrder = mxfileMap.get(transformer.diagramOrderKey);
1254
+ const mxfileMap = doc.getMap(transform.key);
1255
+ const diagramMap = mxfileMap.get(transform.key$1);
1256
+ const diagramOrder = mxfileMap.get(transform.diagramOrderKey);
1220
1257
  if (!diagramMap || !diagramOrder) {
1221
1258
  console.warn("[y-mxgraph] 合并失败,doc 结构不完整,回退到 replace");
1222
1259
  return false;
@@ -1230,7 +1267,7 @@ function mergeFileIntoDoc(doc, fileXml, strategy) {
1230
1267
  if (docHas && strategy === "merge-remote") {
1231
1268
  continue;
1232
1269
  }
1233
- const yDiagram = transformer.parse$1(
1270
+ const yDiagram = transform.parse$1(
1234
1271
  diagram
1235
1272
  );
1236
1273
  diagramMap.set(id, yDiagram);
@@ -1242,13 +1279,13 @@ function mergeFileIntoDoc(doc, fileXml, strategy) {
1242
1279
  return true;
1243
1280
  }
1244
1281
  function reconcileInitialContent(doc, file, strategy, applyFileData) {
1245
- const mxfileMap = doc.getMap(transformer.key);
1282
+ const mxfileMap = doc.getMap(transform.key);
1246
1283
  const docHasData = mxfileMap.size > 0;
1247
1284
  const fileHasAnyData = !!file.data;
1248
1285
  const fileHasDiagrams = fileHasAnyData && file.data.includes("<diagram");
1249
1286
  if (strategy === "replace") {
1250
1287
  if (docHasData) {
1251
- const xml2 = transformer.ydoc2xml(doc);
1288
+ const xml2 = transform.ydoc2xml(doc);
1252
1289
  if (xml2 && xml2.includes("<diagram")) {
1253
1290
  applyFileData(file, xml2);
1254
1291
  } else if (!fileHasAnyData) {
@@ -1268,7 +1305,7 @@ function reconcileInitialContent(doc, file, strategy, applyFileData) {
1268
1305
  if (!docHasData && fileHasDiagrams) {
1269
1306
  try {
1270
1307
  doc.transact(() => {
1271
- transformer.xml2ydoc(file.data, doc);
1308
+ transform.xml2ydoc(file.data, doc);
1272
1309
  });
1273
1310
  return true;
1274
1311
  } catch (err) {
@@ -1281,7 +1318,7 @@ function reconcileInitialContent(doc, file, strategy, applyFileData) {
1281
1318
  }
1282
1319
  }
1283
1320
  if (docHasData && !fileHasDiagrams) {
1284
- const xml2 = transformer.ydoc2xml(doc);
1321
+ const xml2 = transform.ydoc2xml(doc);
1285
1322
  if (xml2 && xml2.includes("<diagram")) {
1286
1323
  applyFileData(file, xml2);
1287
1324
  } else if (!fileHasAnyData) {
@@ -1291,11 +1328,11 @@ function reconcileInitialContent(doc, file, strategy, applyFileData) {
1291
1328
  }
1292
1329
  const ok = mergeFileIntoDoc(doc, file.data, strategy);
1293
1330
  if (!ok) {
1294
- const xml2 = transformer.ydoc2xml(doc);
1331
+ const xml2 = transform.ydoc2xml(doc);
1295
1332
  if (xml2 && xml2.includes("<diagram")) applyFileData(file, xml2);
1296
1333
  return mxfileMap.size > 0;
1297
1334
  }
1298
- const xml = transformer.ydoc2xml(doc);
1335
+ const xml = transform.ydoc2xml(doc);
1299
1336
  if (xml && xml.includes("<diagram")) applyFileData(file, xml);
1300
1337
  return true;
1301
1338
  }
@@ -1349,7 +1386,7 @@ class Binding {
1349
1386
  if (patchKeys.length === 0) return;
1350
1387
  if (!this.docInitialized) {
1351
1388
  doc.transact(() => {
1352
- transformer.xml2ydoc(file.data, doc);
1389
+ transform.xml2ydoc(file.data, doc);
1353
1390
  initDocSnapshot(doc, false);
1354
1391
  });
1355
1392
  this.docInitialized = true;
@@ -1365,10 +1402,10 @@ class Binding {
1365
1402
  return;
1366
1403
  }
1367
1404
  if (this.shouldReplaceWhenDocHasData && !transaction.local) {
1368
- const mxfileMap = doc.getMap(transformer.key);
1369
- const diagramMap = mxfileMap.get(transformer.key$1);
1405
+ const mxfileMap = doc.getMap(transform.key);
1406
+ const diagramMap = mxfileMap.get(transform.key$1);
1370
1407
  if (diagramMap && diagramMap.size > 0) {
1371
- const xml = transformer.ydoc2xml(doc);
1408
+ const xml = transform.ydoc2xml(doc);
1372
1409
  if (xml && xml.includes("<diagram")) {
1373
1410
  this.suppressLocalApply = true;
1374
1411
  try {
@@ -1398,12 +1435,12 @@ class Binding {
1398
1435
  this.suppressLocalApply = false;
1399
1436
  }
1400
1437
  };
1401
- doc.getMap(transformer.key).observeDeep(this.docObserver);
1438
+ doc.getMap(transform.key).observeDeep(this.docObserver);
1402
1439
  if (awareness) {
1403
1440
  this.cleanupCollaborator = bindCollaborator(file, {
1404
1441
  awareness,
1405
1442
  graph,
1406
- cursor: cursor ?? true,
1443
+ cursor: cursor != null ? cursor : true,
1407
1444
  mouseMoveThrottle
1408
1445
  });
1409
1446
  }
@@ -1433,7 +1470,7 @@ class Binding {
1433
1470
  destroy(deep = false) {
1434
1471
  var _a, _b;
1435
1472
  this.mxGraphModel.removeListener("change", this.mxListener);
1436
- this.doc.getMap(transformer.key).unobserveDeep(this.docObserver);
1473
+ this.doc.getMap(transform.key).unobserveDeep(this.docObserver);
1437
1474
  if (deep) {
1438
1475
  (_a = this.cleanupCollaborator) == null ? void 0 : _a.call(this);
1439
1476
  (_b = this.cleanupUndoManager) == null ? void 0 : _b.call(this);
@@ -1474,8 +1511,8 @@ class Binding {
1474
1511
  return new Binding(file, options);
1475
1512
  }
1476
1513
  }
1477
- exports.xml2ydoc = transformer.xml2ydoc;
1478
- exports.ydoc2xml = transformer.ydoc2xml;
1514
+ exports.xml2ydoc = transform.xml2ydoc;
1515
+ exports.ydoc2xml = transform.ydoc2xml;
1479
1516
  exports.Binding = Binding;
1480
1517
  exports.DEFAULT_USER_COLOR_KEY = DEFAULT_USER_COLOR_KEY;
1481
1518
  exports.DEFAULT_USER_NAME_KEY = DEFAULT_USER_NAME_KEY;