microboard-temp 0.5.126 → 0.5.127

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.
@@ -46,13 +46,13 @@ var require_extend = __commonJS((exports2, module2) => {
46
46
  var toStr = Object.prototype.toString;
47
47
  var defineProperty = Object.defineProperty;
48
48
  var gOPD = Object.getOwnPropertyDescriptor;
49
- var isArray = function isArray(arr2) {
49
+ var isArray = function isArray2(arr2) {
50
50
  if (typeof Array.isArray === "function") {
51
51
  return Array.isArray(arr2);
52
52
  }
53
53
  return toStr.call(arr2) === "[object Array]";
54
54
  };
55
- var isPlainObject2 = function isPlainObject(obj) {
55
+ var isPlainObject2 = function isPlainObject3(obj) {
56
56
  if (!obj || toStr.call(obj) !== "[object Object]") {
57
57
  return false;
58
58
  }
@@ -65,7 +65,7 @@ var require_extend = __commonJS((exports2, module2) => {
65
65
  for (key in obj) {}
66
66
  return typeof key === "undefined" || hasOwn.call(obj, key);
67
67
  };
68
- var setProperty = function setProperty(target, options) {
68
+ var setProperty = function setProperty2(target, options) {
69
69
  if (defineProperty && options.name === "__proto__") {
70
70
  defineProperty(target, options.name, {
71
71
  enumerable: true,
@@ -77,7 +77,7 @@ var require_extend = __commonJS((exports2, module2) => {
77
77
  target[options.name] = options.newValue;
78
78
  }
79
79
  };
80
- var getProperty = function getProperty(obj, name) {
80
+ var getProperty = function getProperty2(obj, name) {
81
81
  if (name === "__proto__") {
82
82
  if (!hasOwn.call(obj, name)) {
83
83
  return;
@@ -6623,7 +6623,7 @@ var Browser = /* @__PURE__ */ function() {
6623
6623
  }
6624
6624
  _createClass(Browser2, [{
6625
6625
  key: "init",
6626
- value: function init(services) {
6626
+ value: function init2(services) {
6627
6627
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6628
6628
  var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6629
6629
  this.services = services || {
@@ -6678,7 +6678,7 @@ var Browser = /* @__PURE__ */ function() {
6678
6678
  }
6679
6679
  }, {
6680
6680
  key: "cacheUserLanguage",
6681
- value: function cacheUserLanguage(lng, caches) {
6681
+ value: function cacheUserLanguage4(lng, caches) {
6682
6682
  var _this2 = this;
6683
6683
  if (!caches)
6684
6684
  caches = this.options.caches;
@@ -17226,7 +17226,7 @@ function persistLeafFormats(children) {
17226
17226
  }, {});
17227
17227
  }
17228
17228
  function plugin(opts) {
17229
- var compiler2 = function compiler(node2) {
17229
+ var compiler2 = function compiler3(node2) {
17230
17230
  return node2.children.map(function(c) {
17231
17231
  return deserialize(c, opts);
17232
17232
  });
@@ -56326,6 +56326,9 @@ function expandEvents(events) {
56326
56326
 
56327
56327
  // src/Events/Log/insertEventsFromOtherConnectionsIntoList.ts
56328
56328
  function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56329
+ console.log("[Debug-OT] Start insertEvents. Events count:", Array.isArray(value) ? value.length : 1);
56330
+ if (!board)
56331
+ console.error("[Debug-OT] CRITICAL: Board is undefined!");
56329
56332
  const eventArray = Array.isArray(value) ? value : [value];
56330
56333
  if (eventArray.length === 0) {
56331
56334
  return;
@@ -56346,12 +56349,24 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56346
56349
  list6.revertUnconfirmed(filter);
56347
56350
  const transformed = transformConflictingEvents(events, list6);
56348
56351
  const mergedEvents = mergeEvents(transformed);
56352
+ console.log(`[Debug-OT] Merged events to apply: ${mergedEvents.length}`);
56349
56353
  for (const event of mergedEvents) {
56350
- const command = createCommand(board, event.body.operation);
56351
- const record = { event, command };
56352
- command.apply();
56353
- list6.addConfirmedRecords([record]);
56354
- list6.justConfirmed.push(record);
56354
+ console.log("[Debug-OT] Processing Event:", JSON.stringify(event.body.operation).substring(0, 200));
56355
+ try {
56356
+ const command = createCommand(board, event.body.operation);
56357
+ if (!command) {
56358
+ console.warn("[Debug-OT] createCommand returned undefined/null for event:", event.body.operation);
56359
+ }
56360
+ const record = { event, command };
56361
+ command.apply();
56362
+ list6.addConfirmedRecords([record]);
56363
+ list6.justConfirmed.push(record);
56364
+ } catch (e) {
56365
+ console.error("[Debug-OT] !!! CRASH inside loop !!!");
56366
+ console.error("[Debug-OT] Failed Event Operation:", JSON.stringify(event.body.operation));
56367
+ console.error("[Debug-OT] Error details:", e);
56368
+ throw e;
56369
+ }
56355
56370
  }
56356
56371
  list6.applyUnconfirmed(filter);
56357
56372
  const hasAnyOverlap = (arr1, arr2) => {
@@ -56362,6 +56377,7 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56362
56377
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
56363
56378
  board.selection.applyMemoizedCaretOrRange();
56364
56379
  }
56380
+ console.log("[Debug-OT] insertEvents finished successfully.");
56365
56381
  }
56366
56382
  function transformConflictingEvents(events, list6) {
56367
56383
  const transformed = [];
package/dist/cjs/index.js CHANGED
@@ -46,13 +46,13 @@ var require_extend = __commonJS((exports2, module2) => {
46
46
  var toStr = Object.prototype.toString;
47
47
  var defineProperty = Object.defineProperty;
48
48
  var gOPD = Object.getOwnPropertyDescriptor;
49
- var isArray = function isArray(arr2) {
49
+ var isArray = function isArray2(arr2) {
50
50
  if (typeof Array.isArray === "function") {
51
51
  return Array.isArray(arr2);
52
52
  }
53
53
  return toStr.call(arr2) === "[object Array]";
54
54
  };
55
- var isPlainObject2 = function isPlainObject(obj) {
55
+ var isPlainObject2 = function isPlainObject3(obj) {
56
56
  if (!obj || toStr.call(obj) !== "[object Object]") {
57
57
  return false;
58
58
  }
@@ -65,7 +65,7 @@ var require_extend = __commonJS((exports2, module2) => {
65
65
  for (key in obj) {}
66
66
  return typeof key === "undefined" || hasOwn.call(obj, key);
67
67
  };
68
- var setProperty = function setProperty(target, options) {
68
+ var setProperty = function setProperty2(target, options) {
69
69
  if (defineProperty && options.name === "__proto__") {
70
70
  defineProperty(target, options.name, {
71
71
  enumerable: true,
@@ -77,7 +77,7 @@ var require_extend = __commonJS((exports2, module2) => {
77
77
  target[options.name] = options.newValue;
78
78
  }
79
79
  };
80
- var getProperty = function getProperty(obj, name) {
80
+ var getProperty = function getProperty2(obj, name) {
81
81
  if (name === "__proto__") {
82
82
  if (!hasOwn.call(obj, name)) {
83
83
  return;
@@ -6623,7 +6623,7 @@ var Browser = /* @__PURE__ */ function() {
6623
6623
  }
6624
6624
  _createClass(Browser2, [{
6625
6625
  key: "init",
6626
- value: function init(services) {
6626
+ value: function init2(services) {
6627
6627
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6628
6628
  var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6629
6629
  this.services = services || {
@@ -6678,7 +6678,7 @@ var Browser = /* @__PURE__ */ function() {
6678
6678
  }
6679
6679
  }, {
6680
6680
  key: "cacheUserLanguage",
6681
- value: function cacheUserLanguage(lng, caches) {
6681
+ value: function cacheUserLanguage4(lng, caches) {
6682
6682
  var _this2 = this;
6683
6683
  if (!caches)
6684
6684
  caches = this.options.caches;
@@ -17226,7 +17226,7 @@ function persistLeafFormats(children) {
17226
17226
  }, {});
17227
17227
  }
17228
17228
  function plugin(opts) {
17229
- var compiler2 = function compiler(node2) {
17229
+ var compiler2 = function compiler3(node2) {
17230
17230
  return node2.children.map(function(c) {
17231
17231
  return deserialize(c, opts);
17232
17232
  });
@@ -56326,6 +56326,9 @@ function expandEvents(events) {
56326
56326
 
56327
56327
  // src/Events/Log/insertEventsFromOtherConnectionsIntoList.ts
56328
56328
  function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56329
+ console.log("[Debug-OT] Start insertEvents. Events count:", Array.isArray(value) ? value.length : 1);
56330
+ if (!board)
56331
+ console.error("[Debug-OT] CRITICAL: Board is undefined!");
56329
56332
  const eventArray = Array.isArray(value) ? value : [value];
56330
56333
  if (eventArray.length === 0) {
56331
56334
  return;
@@ -56346,12 +56349,24 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56346
56349
  list6.revertUnconfirmed(filter);
56347
56350
  const transformed = transformConflictingEvents(events, list6);
56348
56351
  const mergedEvents = mergeEvents(transformed);
56352
+ console.log(`[Debug-OT] Merged events to apply: ${mergedEvents.length}`);
56349
56353
  for (const event of mergedEvents) {
56350
- const command = createCommand(board, event.body.operation);
56351
- const record = { event, command };
56352
- command.apply();
56353
- list6.addConfirmedRecords([record]);
56354
- list6.justConfirmed.push(record);
56354
+ console.log("[Debug-OT] Processing Event:", JSON.stringify(event.body.operation).substring(0, 200));
56355
+ try {
56356
+ const command = createCommand(board, event.body.operation);
56357
+ if (!command) {
56358
+ console.warn("[Debug-OT] createCommand returned undefined/null for event:", event.body.operation);
56359
+ }
56360
+ const record = { event, command };
56361
+ command.apply();
56362
+ list6.addConfirmedRecords([record]);
56363
+ list6.justConfirmed.push(record);
56364
+ } catch (e) {
56365
+ console.error("[Debug-OT] !!! CRASH inside loop !!!");
56366
+ console.error("[Debug-OT] Failed Event Operation:", JSON.stringify(event.body.operation));
56367
+ console.error("[Debug-OT] Error details:", e);
56368
+ throw e;
56369
+ }
56355
56370
  }
56356
56371
  list6.applyUnconfirmed(filter);
56357
56372
  const hasAnyOverlap = (arr1, arr2) => {
@@ -56362,6 +56377,7 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56362
56377
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
56363
56378
  board.selection.applyMemoizedCaretOrRange();
56364
56379
  }
56380
+ console.log("[Debug-OT] insertEvents finished successfully.");
56365
56381
  }
56366
56382
  function transformConflictingEvents(events, list6) {
56367
56383
  const transformed = [];
package/dist/cjs/node.js CHANGED
@@ -142,7 +142,7 @@ var require_dist = __commonJS((exports2) => {
142
142
  if (it)
143
143
  o = it;
144
144
  var i = 0;
145
- var F = function F() {};
145
+ var F = function F2() {};
146
146
  return { s: F, n: function n() {
147
147
  if (i >= o.length)
148
148
  return { done: true };
@@ -194,7 +194,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
194
194
  arr22[i] = arr2[i];
195
195
  return arr22;
196
196
  }
197
- var withHistory = function withHistory(editor) {
197
+ var withHistory = function withHistory2(editor) {
198
198
  var e = editor;
199
199
  var apply = e.apply;
200
200
  e.history = {
@@ -301,7 +301,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
301
301
  };
302
302
  return e;
303
303
  };
304
- var shouldMerge = function shouldMerge(op, prev) {
304
+ var shouldMerge = function shouldMerge2(op, prev) {
305
305
  if (prev && op.type === "insert_text" && prev.type === "insert_text" && op.offset === prev.offset + prev.text.length && slate.Path.equals(op.path, prev.path)) {
306
306
  return true;
307
307
  }
@@ -310,7 +310,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
310
310
  }
311
311
  return false;
312
312
  };
313
- var shouldSave = function shouldSave(op, prev) {
313
+ var shouldSave = function shouldSave2(op, prev) {
314
314
  if (op.type === "set_selection") {
315
315
  return false;
316
316
  }
@@ -331,13 +331,13 @@ var require_extend = __commonJS((exports2, module2) => {
331
331
  var toStr = Object.prototype.toString;
332
332
  var defineProperty = Object.defineProperty;
333
333
  var gOPD = Object.getOwnPropertyDescriptor;
334
- var isArray = function isArray(arr2) {
334
+ var isArray = function isArray2(arr2) {
335
335
  if (typeof Array.isArray === "function") {
336
336
  return Array.isArray(arr2);
337
337
  }
338
338
  return toStr.call(arr2) === "[object Array]";
339
339
  };
340
- var isPlainObject = function isPlainObject(obj) {
340
+ var isPlainObject = function isPlainObject2(obj) {
341
341
  if (!obj || toStr.call(obj) !== "[object Object]") {
342
342
  return false;
343
343
  }
@@ -350,7 +350,7 @@ var require_extend = __commonJS((exports2, module2) => {
350
350
  for (key in obj) {}
351
351
  return typeof key === "undefined" || hasOwn.call(obj, key);
352
352
  };
353
- var setProperty = function setProperty(target, options) {
353
+ var setProperty = function setProperty2(target, options) {
354
354
  if (defineProperty && options.name === "__proto__") {
355
355
  defineProperty(target, options.name, {
356
356
  enumerable: true,
@@ -362,7 +362,7 @@ var require_extend = __commonJS((exports2, module2) => {
362
362
  target[options.name] = options.newValue;
363
363
  }
364
364
  };
365
- var getProperty = function getProperty(obj, name) {
365
+ var getProperty = function getProperty2(obj, name) {
366
366
  if (name === "__proto__") {
367
367
  if (!hasOwn.call(obj, name)) {
368
368
  return;
@@ -1344,7 +1344,7 @@ var require_remark_slate_cjs_development = __commonJS((exports2) => {
1344
1344
  };
1345
1345
  }
1346
1346
  }
1347
- var forceLeafNode = function forceLeafNode(children) {
1347
+ var forceLeafNode = function forceLeafNode2(children) {
1348
1348
  return {
1349
1349
  text: children.map(function(k) {
1350
1350
  return k === null || k === undefined ? undefined : k.text;
@@ -1361,7 +1361,7 @@ var require_remark_slate_cjs_development = __commonJS((exports2) => {
1361
1361
  return acc;
1362
1362
  }, {});
1363
1363
  }
1364
- var isLeafNode = function isLeafNode(node2) {
1364
+ var isLeafNode = function isLeafNode2(node2) {
1365
1365
  return typeof node2.text === "string";
1366
1366
  };
1367
1367
  var VOID_ELEMENTS = ["thematic_break", "image"];
@@ -1496,11 +1496,11 @@ var require_remark_slate_cjs_development = __commonJS((exports2) => {
1496
1496
  var formattedString = format + children + reverseStr(format);
1497
1497
  return string3.replace(frozenString, formattedString);
1498
1498
  }
1499
- var reverseStr = function reverseStr(string3) {
1499
+ var reverseStr = function reverseStr2(string3) {
1500
1500
  return string3.split("").reverse().join("");
1501
1501
  };
1502
1502
  function plugin(opts) {
1503
- var compiler2 = function compiler(node2) {
1503
+ var compiler2 = function compiler3(node2) {
1504
1504
  return node2.children.map(function(c) {
1505
1505
  return deserialize(c, opts);
1506
1506
  });
@@ -1525,7 +1525,7 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1525
1525
  (function(global2, factory) {
1526
1526
  typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = global2 || self, global2.TinyQueue = factory());
1527
1527
  })(exports2, function() {
1528
- var TinyQueue = function TinyQueue(data, compare) {
1528
+ var TinyQueue = function TinyQueue2(data, compare) {
1529
1529
  if (data === undefined)
1530
1530
  data = [];
1531
1531
  if (compare === undefined)
@@ -1539,7 +1539,7 @@ var require_tinyqueue = __commonJS((exports2, module2) => {
1539
1539
  }
1540
1540
  }
1541
1541
  };
1542
- TinyQueue.prototype.push = function push(item) {
1542
+ TinyQueue.prototype.push = function push2(item) {
1543
1543
  this.data.push(item);
1544
1544
  this.length++;
1545
1545
  this._up(this.length - 1);
@@ -7660,7 +7660,7 @@ var Browser = /* @__PURE__ */ function() {
7660
7660
  }
7661
7661
  _createClass(Browser2, [{
7662
7662
  key: "init",
7663
- value: function init(services) {
7663
+ value: function init2(services) {
7664
7664
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7665
7665
  var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
7666
7666
  this.services = services || {
@@ -7715,7 +7715,7 @@ var Browser = /* @__PURE__ */ function() {
7715
7715
  }
7716
7716
  }, {
7717
7717
  key: "cacheUserLanguage",
7718
- value: function cacheUserLanguage(lng, caches) {
7718
+ value: function cacheUserLanguage4(lng, caches) {
7719
7719
  var _this2 = this;
7720
7720
  if (!caches)
7721
7721
  caches = this.options.caches;
@@ -58799,6 +58799,9 @@ function expandEvents(events) {
58799
58799
 
58800
58800
  // src/Events/Log/insertEventsFromOtherConnectionsIntoList.ts
58801
58801
  function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58802
+ console.log("[Debug-OT] Start insertEvents. Events count:", Array.isArray(value) ? value.length : 1);
58803
+ if (!board)
58804
+ console.error("[Debug-OT] CRITICAL: Board is undefined!");
58802
58805
  const eventArray = Array.isArray(value) ? value : [value];
58803
58806
  if (eventArray.length === 0) {
58804
58807
  return;
@@ -58819,12 +58822,24 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58819
58822
  list6.revertUnconfirmed(filter);
58820
58823
  const transformed = transformConflictingEvents(events, list6);
58821
58824
  const mergedEvents = mergeEvents(transformed);
58825
+ console.log(`[Debug-OT] Merged events to apply: ${mergedEvents.length}`);
58822
58826
  for (const event of mergedEvents) {
58823
- const command = createCommand(board, event.body.operation);
58824
- const record = { event, command };
58825
- command.apply();
58826
- list6.addConfirmedRecords([record]);
58827
- list6.justConfirmed.push(record);
58827
+ console.log("[Debug-OT] Processing Event:", JSON.stringify(event.body.operation).substring(0, 200));
58828
+ try {
58829
+ const command = createCommand(board, event.body.operation);
58830
+ if (!command) {
58831
+ console.warn("[Debug-OT] createCommand returned undefined/null for event:", event.body.operation);
58832
+ }
58833
+ const record = { event, command };
58834
+ command.apply();
58835
+ list6.addConfirmedRecords([record]);
58836
+ list6.justConfirmed.push(record);
58837
+ } catch (e) {
58838
+ console.error("[Debug-OT] !!! CRASH inside loop !!!");
58839
+ console.error("[Debug-OT] Failed Event Operation:", JSON.stringify(event.body.operation));
58840
+ console.error("[Debug-OT] Error details:", e);
58841
+ throw e;
58842
+ }
58828
58843
  }
58829
58844
  list6.applyUnconfirmed(filter);
58830
58845
  const hasAnyOverlap = (arr1, arr2) => {
@@ -58835,6 +58850,7 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58835
58850
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
58836
58851
  board.selection.applyMemoizedCaretOrRange();
58837
58852
  }
58853
+ console.log("[Debug-OT] insertEvents finished successfully.");
58838
58854
  }
58839
58855
  function transformConflictingEvents(events, list6) {
58840
58856
  const transformed = [];
@@ -38,13 +38,13 @@ var require_extend = __commonJS((exports, module) => {
38
38
  var toStr = Object.prototype.toString;
39
39
  var defineProperty = Object.defineProperty;
40
40
  var gOPD = Object.getOwnPropertyDescriptor;
41
- var isArray = function isArray(arr2) {
41
+ var isArray = function isArray2(arr2) {
42
42
  if (typeof Array.isArray === "function") {
43
43
  return Array.isArray(arr2);
44
44
  }
45
45
  return toStr.call(arr2) === "[object Array]";
46
46
  };
47
- var isPlainObject2 = function isPlainObject(obj) {
47
+ var isPlainObject2 = function isPlainObject3(obj) {
48
48
  if (!obj || toStr.call(obj) !== "[object Object]") {
49
49
  return false;
50
50
  }
@@ -57,7 +57,7 @@ var require_extend = __commonJS((exports, module) => {
57
57
  for (key in obj) {}
58
58
  return typeof key === "undefined" || hasOwn.call(obj, key);
59
59
  };
60
- var setProperty = function setProperty(target, options) {
60
+ var setProperty = function setProperty2(target, options) {
61
61
  if (defineProperty && options.name === "__proto__") {
62
62
  defineProperty(target, options.name, {
63
63
  enumerable: true,
@@ -69,7 +69,7 @@ var require_extend = __commonJS((exports, module) => {
69
69
  target[options.name] = options.newValue;
70
70
  }
71
71
  };
72
- var getProperty = function getProperty(obj, name) {
72
+ var getProperty = function getProperty2(obj, name) {
73
73
  if (name === "__proto__") {
74
74
  if (!hasOwn.call(obj, name)) {
75
75
  return;
@@ -6460,7 +6460,7 @@ var Browser = /* @__PURE__ */ function() {
6460
6460
  }
6461
6461
  _createClass(Browser2, [{
6462
6462
  key: "init",
6463
- value: function init(services) {
6463
+ value: function init2(services) {
6464
6464
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6465
6465
  var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6466
6466
  this.services = services || {
@@ -6515,7 +6515,7 @@ var Browser = /* @__PURE__ */ function() {
6515
6515
  }
6516
6516
  }, {
6517
6517
  key: "cacheUserLanguage",
6518
- value: function cacheUserLanguage(lng, caches) {
6518
+ value: function cacheUserLanguage4(lng, caches) {
6519
6519
  var _this2 = this;
6520
6520
  if (!caches)
6521
6521
  caches = this.options.caches;
@@ -17072,7 +17072,7 @@ function persistLeafFormats(children) {
17072
17072
  }, {});
17073
17073
  }
17074
17074
  function plugin(opts) {
17075
- var compiler2 = function compiler(node2) {
17075
+ var compiler2 = function compiler3(node2) {
17076
17076
  return node2.children.map(function(c) {
17077
17077
  return deserialize(c, opts);
17078
17078
  });
@@ -56172,6 +56172,9 @@ function expandEvents(events) {
56172
56172
 
56173
56173
  // src/Events/Log/insertEventsFromOtherConnectionsIntoList.ts
56174
56174
  function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56175
+ console.log("[Debug-OT] Start insertEvents. Events count:", Array.isArray(value) ? value.length : 1);
56176
+ if (!board)
56177
+ console.error("[Debug-OT] CRITICAL: Board is undefined!");
56175
56178
  const eventArray = Array.isArray(value) ? value : [value];
56176
56179
  if (eventArray.length === 0) {
56177
56180
  return;
@@ -56192,12 +56195,24 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56192
56195
  list6.revertUnconfirmed(filter);
56193
56196
  const transformed = transformConflictingEvents(events, list6);
56194
56197
  const mergedEvents = mergeEvents(transformed);
56198
+ console.log(`[Debug-OT] Merged events to apply: ${mergedEvents.length}`);
56195
56199
  for (const event of mergedEvents) {
56196
- const command = createCommand(board, event.body.operation);
56197
- const record = { event, command };
56198
- command.apply();
56199
- list6.addConfirmedRecords([record]);
56200
- list6.justConfirmed.push(record);
56200
+ console.log("[Debug-OT] Processing Event:", JSON.stringify(event.body.operation).substring(0, 200));
56201
+ try {
56202
+ const command = createCommand(board, event.body.operation);
56203
+ if (!command) {
56204
+ console.warn("[Debug-OT] createCommand returned undefined/null for event:", event.body.operation);
56205
+ }
56206
+ const record = { event, command };
56207
+ command.apply();
56208
+ list6.addConfirmedRecords([record]);
56209
+ list6.justConfirmed.push(record);
56210
+ } catch (e) {
56211
+ console.error("[Debug-OT] !!! CRASH inside loop !!!");
56212
+ console.error("[Debug-OT] Failed Event Operation:", JSON.stringify(event.body.operation));
56213
+ console.error("[Debug-OT] Error details:", e);
56214
+ throw e;
56215
+ }
56201
56216
  }
56202
56217
  list6.applyUnconfirmed(filter);
56203
56218
  const hasAnyOverlap = (arr1, arr2) => {
@@ -56208,6 +56223,7 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56208
56223
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
56209
56224
  board.selection.applyMemoizedCaretOrRange();
56210
56225
  }
56226
+ console.log("[Debug-OT] insertEvents finished successfully.");
56211
56227
  }
56212
56228
  function transformConflictingEvents(events, list6) {
56213
56229
  const transformed = [];
package/dist/esm/index.js CHANGED
@@ -31,13 +31,13 @@ var require_extend = __commonJS((exports, module) => {
31
31
  var toStr = Object.prototype.toString;
32
32
  var defineProperty = Object.defineProperty;
33
33
  var gOPD = Object.getOwnPropertyDescriptor;
34
- var isArray = function isArray(arr2) {
34
+ var isArray = function isArray2(arr2) {
35
35
  if (typeof Array.isArray === "function") {
36
36
  return Array.isArray(arr2);
37
37
  }
38
38
  return toStr.call(arr2) === "[object Array]";
39
39
  };
40
- var isPlainObject2 = function isPlainObject(obj) {
40
+ var isPlainObject2 = function isPlainObject3(obj) {
41
41
  if (!obj || toStr.call(obj) !== "[object Object]") {
42
42
  return false;
43
43
  }
@@ -50,7 +50,7 @@ var require_extend = __commonJS((exports, module) => {
50
50
  for (key in obj) {}
51
51
  return typeof key === "undefined" || hasOwn.call(obj, key);
52
52
  };
53
- var setProperty = function setProperty(target, options) {
53
+ var setProperty = function setProperty2(target, options) {
54
54
  if (defineProperty && options.name === "__proto__") {
55
55
  defineProperty(target, options.name, {
56
56
  enumerable: true,
@@ -62,7 +62,7 @@ var require_extend = __commonJS((exports, module) => {
62
62
  target[options.name] = options.newValue;
63
63
  }
64
64
  };
65
- var getProperty = function getProperty(obj, name) {
65
+ var getProperty = function getProperty2(obj, name) {
66
66
  if (name === "__proto__") {
67
67
  if (!hasOwn.call(obj, name)) {
68
68
  return;
@@ -6453,7 +6453,7 @@ var Browser = /* @__PURE__ */ function() {
6453
6453
  }
6454
6454
  _createClass(Browser2, [{
6455
6455
  key: "init",
6456
- value: function init(services) {
6456
+ value: function init2(services) {
6457
6457
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6458
6458
  var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6459
6459
  this.services = services || {
@@ -6508,7 +6508,7 @@ var Browser = /* @__PURE__ */ function() {
6508
6508
  }
6509
6509
  }, {
6510
6510
  key: "cacheUserLanguage",
6511
- value: function cacheUserLanguage(lng, caches) {
6511
+ value: function cacheUserLanguage4(lng, caches) {
6512
6512
  var _this2 = this;
6513
6513
  if (!caches)
6514
6514
  caches = this.options.caches;
@@ -17065,7 +17065,7 @@ function persistLeafFormats(children) {
17065
17065
  }, {});
17066
17066
  }
17067
17067
  function plugin(opts) {
17068
- var compiler2 = function compiler(node2) {
17068
+ var compiler2 = function compiler3(node2) {
17069
17069
  return node2.children.map(function(c) {
17070
17070
  return deserialize(c, opts);
17071
17071
  });
@@ -56165,6 +56165,9 @@ function expandEvents(events) {
56165
56165
 
56166
56166
  // src/Events/Log/insertEventsFromOtherConnectionsIntoList.ts
56167
56167
  function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56168
+ console.log("[Debug-OT] Start insertEvents. Events count:", Array.isArray(value) ? value.length : 1);
56169
+ if (!board)
56170
+ console.error("[Debug-OT] CRITICAL: Board is undefined!");
56168
56171
  const eventArray = Array.isArray(value) ? value : [value];
56169
56172
  if (eventArray.length === 0) {
56170
56173
  return;
@@ -56185,12 +56188,24 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56185
56188
  list6.revertUnconfirmed(filter);
56186
56189
  const transformed = transformConflictingEvents(events, list6);
56187
56190
  const mergedEvents = mergeEvents(transformed);
56191
+ console.log(`[Debug-OT] Merged events to apply: ${mergedEvents.length}`);
56188
56192
  for (const event of mergedEvents) {
56189
- const command = createCommand(board, event.body.operation);
56190
- const record = { event, command };
56191
- command.apply();
56192
- list6.addConfirmedRecords([record]);
56193
- list6.justConfirmed.push(record);
56193
+ console.log("[Debug-OT] Processing Event:", JSON.stringify(event.body.operation).substring(0, 200));
56194
+ try {
56195
+ const command = createCommand(board, event.body.operation);
56196
+ if (!command) {
56197
+ console.warn("[Debug-OT] createCommand returned undefined/null for event:", event.body.operation);
56198
+ }
56199
+ const record = { event, command };
56200
+ command.apply();
56201
+ list6.addConfirmedRecords([record]);
56202
+ list6.justConfirmed.push(record);
56203
+ } catch (e) {
56204
+ console.error("[Debug-OT] !!! CRASH inside loop !!!");
56205
+ console.error("[Debug-OT] Failed Event Operation:", JSON.stringify(event.body.operation));
56206
+ console.error("[Debug-OT] Error details:", e);
56207
+ throw e;
56208
+ }
56194
56209
  }
56195
56210
  list6.applyUnconfirmed(filter);
56196
56211
  const hasAnyOverlap = (arr1, arr2) => {
@@ -56201,6 +56216,7 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
56201
56216
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
56202
56217
  board.selection.applyMemoizedCaretOrRange();
56203
56218
  }
56219
+ console.log("[Debug-OT] insertEvents finished successfully.");
56204
56220
  }
56205
56221
  function transformConflictingEvents(events, list6) {
56206
56222
  const transformed = [];
package/dist/esm/node.js CHANGED
@@ -63,13 +63,13 @@ var require_extend = __commonJS((exports, module) => {
63
63
  var toStr = Object.prototype.toString;
64
64
  var defineProperty = Object.defineProperty;
65
65
  var gOPD = Object.getOwnPropertyDescriptor;
66
- var isArray = function isArray(arr2) {
66
+ var isArray = function isArray2(arr2) {
67
67
  if (typeof Array.isArray === "function") {
68
68
  return Array.isArray(arr2);
69
69
  }
70
70
  return toStr.call(arr2) === "[object Array]";
71
71
  };
72
- var isPlainObject2 = function isPlainObject(obj) {
72
+ var isPlainObject2 = function isPlainObject3(obj) {
73
73
  if (!obj || toStr.call(obj) !== "[object Object]") {
74
74
  return false;
75
75
  }
@@ -82,7 +82,7 @@ var require_extend = __commonJS((exports, module) => {
82
82
  for (key in obj) {}
83
83
  return typeof key === "undefined" || hasOwn.call(obj, key);
84
84
  };
85
- var setProperty = function setProperty(target, options) {
85
+ var setProperty = function setProperty2(target, options) {
86
86
  if (defineProperty && options.name === "__proto__") {
87
87
  defineProperty(target, options.name, {
88
88
  enumerable: true,
@@ -94,7 +94,7 @@ var require_extend = __commonJS((exports, module) => {
94
94
  target[options.name] = options.newValue;
95
95
  }
96
96
  };
97
- var getProperty = function getProperty(obj, name) {
97
+ var getProperty = function getProperty2(obj, name) {
98
98
  if (name === "__proto__") {
99
99
  if (!hasOwn.call(obj, name)) {
100
100
  return;
@@ -1076,7 +1076,7 @@ var require_remark_slate_cjs_development = __commonJS((exports) => {
1076
1076
  };
1077
1077
  }
1078
1078
  }
1079
- var forceLeafNode = function forceLeafNode(children) {
1079
+ var forceLeafNode = function forceLeafNode2(children) {
1080
1080
  return {
1081
1081
  text: children.map(function(k) {
1082
1082
  return k === null || k === undefined ? undefined : k.text;
@@ -1093,7 +1093,7 @@ var require_remark_slate_cjs_development = __commonJS((exports) => {
1093
1093
  return acc;
1094
1094
  }, {});
1095
1095
  }
1096
- var isLeafNode = function isLeafNode(node2) {
1096
+ var isLeafNode = function isLeafNode2(node2) {
1097
1097
  return typeof node2.text === "string";
1098
1098
  };
1099
1099
  var VOID_ELEMENTS = ["thematic_break", "image"];
@@ -1228,11 +1228,11 @@ var require_remark_slate_cjs_development = __commonJS((exports) => {
1228
1228
  var formattedString = format + children + reverseStr(format);
1229
1229
  return string3.replace(frozenString, formattedString);
1230
1230
  }
1231
- var reverseStr = function reverseStr(string3) {
1231
+ var reverseStr = function reverseStr2(string3) {
1232
1232
  return string3.split("").reverse().join("");
1233
1233
  };
1234
1234
  function plugin(opts) {
1235
- var compiler2 = function compiler(node2) {
1235
+ var compiler2 = function compiler3(node2) {
1236
1236
  return node2.children.map(function(c) {
1237
1237
  return deserialize(c, opts);
1238
1238
  });
@@ -1257,7 +1257,7 @@ var require_tinyqueue = __commonJS((exports, module) => {
1257
1257
  (function(global2, factory) {
1258
1258
  typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = global2 || self, global2.TinyQueue = factory());
1259
1259
  })(exports, function() {
1260
- var TinyQueue = function TinyQueue(data, compare) {
1260
+ var TinyQueue = function TinyQueue2(data, compare) {
1261
1261
  if (data === undefined)
1262
1262
  data = [];
1263
1263
  if (compare === undefined)
@@ -1271,7 +1271,7 @@ var require_tinyqueue = __commonJS((exports, module) => {
1271
1271
  }
1272
1272
  }
1273
1273
  };
1274
- TinyQueue.prototype.push = function push(item) {
1274
+ TinyQueue.prototype.push = function push2(item) {
1275
1275
  this.data.push(item);
1276
1276
  this.length++;
1277
1277
  this._up(this.length - 1);
@@ -7237,7 +7237,7 @@ var Browser = /* @__PURE__ */ function() {
7237
7237
  }
7238
7238
  _createClass(Browser2, [{
7239
7239
  key: "init",
7240
- value: function init(services) {
7240
+ value: function init2(services) {
7241
7241
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7242
7242
  var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
7243
7243
  this.services = services || {
@@ -7292,7 +7292,7 @@ var Browser = /* @__PURE__ */ function() {
7292
7292
  }
7293
7293
  }, {
7294
7294
  key: "cacheUserLanguage",
7295
- value: function cacheUserLanguage(lng, caches) {
7295
+ value: function cacheUserLanguage4(lng, caches) {
7296
7296
  var _this2 = this;
7297
7297
  if (!caches)
7298
7298
  caches = this.options.caches;
@@ -11012,7 +11012,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
11012
11012
  if (it)
11013
11013
  o = it;
11014
11014
  var i = 0;
11015
- var F = function F() {};
11015
+ var F = function F2() {};
11016
11016
  return { s: F, n: function n() {
11017
11017
  if (i >= o.length)
11018
11018
  return { done: true };
@@ -58633,6 +58633,9 @@ function expandEvents(events) {
58633
58633
 
58634
58634
  // src/Events/Log/insertEventsFromOtherConnectionsIntoList.ts
58635
58635
  function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58636
+ console.log("[Debug-OT] Start insertEvents. Events count:", Array.isArray(value) ? value.length : 1);
58637
+ if (!board)
58638
+ console.error("[Debug-OT] CRITICAL: Board is undefined!");
58636
58639
  const eventArray = Array.isArray(value) ? value : [value];
58637
58640
  if (eventArray.length === 0) {
58638
58641
  return;
@@ -58653,12 +58656,24 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58653
58656
  list6.revertUnconfirmed(filter);
58654
58657
  const transformed = transformConflictingEvents(events, list6);
58655
58658
  const mergedEvents = mergeEvents(transformed);
58659
+ console.log(`[Debug-OT] Merged events to apply: ${mergedEvents.length}`);
58656
58660
  for (const event of mergedEvents) {
58657
- const command = createCommand(board, event.body.operation);
58658
- const record = { event, command };
58659
- command.apply();
58660
- list6.addConfirmedRecords([record]);
58661
- list6.justConfirmed.push(record);
58661
+ console.log("[Debug-OT] Processing Event:", JSON.stringify(event.body.operation).substring(0, 200));
58662
+ try {
58663
+ const command = createCommand(board, event.body.operation);
58664
+ if (!command) {
58665
+ console.warn("[Debug-OT] createCommand returned undefined/null for event:", event.body.operation);
58666
+ }
58667
+ const record = { event, command };
58668
+ command.apply();
58669
+ list6.addConfirmedRecords([record]);
58670
+ list6.justConfirmed.push(record);
58671
+ } catch (e) {
58672
+ console.error("[Debug-OT] !!! CRASH inside loop !!!");
58673
+ console.error("[Debug-OT] Failed Event Operation:", JSON.stringify(event.body.operation));
58674
+ console.error("[Debug-OT] Error details:", e);
58675
+ throw e;
58676
+ }
58662
58677
  }
58663
58678
  list6.applyUnconfirmed(filter);
58664
58679
  const hasAnyOverlap = (arr1, arr2) => {
@@ -58669,6 +58684,7 @@ function insertEventsFromOtherConnectionsIntoList(value, list6, board) {
58669
58684
  if (hasAnyOverlap(currSelection, createdItems) || hasAnyOverlap(currSelection, updatedText)) {
58670
58685
  board.selection.applyMemoizedCaretOrRange();
58671
58686
  }
58687
+ console.log("[Debug-OT] insertEvents finished successfully.");
58672
58688
  }
58673
58689
  function transformConflictingEvents(events, list6) {
58674
58690
  const transformed = [];
@@ -1,13 +1,4 @@
1
1
  import { Board } from "../../Board";
2
2
  import { SyncEvent } from "../Events";
3
3
  import { EventsList } from "./createEventsList";
4
- /**
5
- * Inserts events from other connections into the events list. This function is
6
- * a core part of the Operational Transformation (OT) conflict resolution system
7
- * and it handles synchronization of events across multiple connections.
8
- *
9
- * @param value - A single SyncEvent or an array of SyncEvents to be inserted
10
- * @param list - The EventsList to insert the events into
11
- * @param board - The Board instance that the events will be applied to
12
- */
13
4
  export declare function insertEventsFromOtherConnectionsIntoList(value: SyncEvent | SyncEvent[], list: EventsList, board: Board): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.126",
3
+ "version": "0.5.127",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",