@superdoc-dev/cli 0.2.0-next.21 → 0.2.0-next.22

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 (2) hide show
  1. package/dist/index.js +43 -18
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -93077,9 +93077,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
93077
93077
  init_remark_gfm_z_sDF4ss_es();
93078
93078
  });
93079
93079
 
93080
- // ../../packages/superdoc/dist/chunks/src-DEQEar7E.es.js
93081
- var exports_src_DEQEar7E_es = {};
93082
- __export(exports_src_DEQEar7E_es, {
93080
+ // ../../packages/superdoc/dist/chunks/src-DCn8o9a0.es.js
93081
+ var exports_src_DCn8o9a0_es = {};
93082
+ __export(exports_src_DCn8o9a0_es, {
93083
93083
  zt: () => defineMark,
93084
93084
  z: () => cM,
93085
93085
  yt: () => removeAwarenessStates,
@@ -143435,13 +143435,29 @@ var Node$13 = class Node$14 {
143435
143435
  day: "2-digit",
143436
143436
  year: "numeric"
143437
143437
  });
143438
- }, AnnotatorHelpers, updateYdocDocxData = async (editor, ydoc) => {
143438
+ }, AnnotatorHelpers, inFlightUpdates, updateYdocDocxData = (editor, ydoc) => {
143439
+ ydoc = ydoc || editor?.options?.ydoc;
143440
+ if (!ydoc || ydoc.isDestroyed)
143441
+ return Promise.resolve();
143442
+ if (!editor || editor.isDestroyed)
143443
+ return Promise.resolve();
143444
+ let ydocMap = inFlightUpdates.get(editor);
143445
+ if (!ydocMap) {
143446
+ ydocMap = /* @__PURE__ */ new WeakMap;
143447
+ inFlightUpdates.set(editor, ydocMap);
143448
+ }
143449
+ const existing = ydocMap.get(ydoc);
143450
+ if (existing)
143451
+ return existing;
143452
+ const promise = _doUpdateYdocDocxData(editor, ydoc).finally(() => {
143453
+ const map$22 = inFlightUpdates.get(editor);
143454
+ if (map$22 && map$22.get(ydoc) === promise)
143455
+ map$22.delete(ydoc);
143456
+ });
143457
+ ydocMap.set(ydoc, promise);
143458
+ return promise;
143459
+ }, _doUpdateYdocDocxData = async (editor, ydoc) => {
143439
143460
  try {
143440
- ydoc = ydoc || editor?.options?.ydoc;
143441
- if (!ydoc || ydoc.isDestroyed)
143442
- return;
143443
- if (!editor || editor.isDestroyed)
143444
- return;
143445
143461
  const metaMap = ydoc.getMap("meta");
143446
143462
  const docxValue = metaMap.get("docx");
143447
143463
  let docx = [];
@@ -143558,10 +143574,15 @@ var Node$13 = class Node$14 {
143558
143574
  if (value instanceof Set && value.has("docx"))
143559
143575
  return true;
143560
143576
  return false;
143577
+ }, debouncedDocxUpdateByEditor, cancelDebouncedDocxUpdate = (editor) => {
143578
+ const cancel = debouncedDocxUpdateByEditor.get(editor);
143579
+ if (cancel)
143580
+ cancel();
143561
143581
  }, initDocumentListener = ({ ydoc, editor }) => {
143562
143582
  const debouncedUpdate = debounce$2((editor$1) => {
143563
143583
  updateYdocDocxData(editor$1);
143564
143584
  }, 30000, { maxWait: 60000 });
143585
+ debouncedDocxUpdateByEditor.set(editor, () => debouncedUpdate.cancel());
143565
143586
  const afterTransactionHandler = (transaction) => {
143566
143587
  const { local } = transaction;
143567
143588
  if (!checkDocxChanged(transaction) && transaction.changed?.size && local)
@@ -143571,6 +143592,7 @@ var Node$13 = class Node$14 {
143571
143592
  return () => {
143572
143593
  ydoc.off("afterTransaction", afterTransactionHandler);
143573
143594
  debouncedUpdate.cancel();
143595
+ debouncedDocxUpdateByEditor.delete(editor);
143574
143596
  };
143575
143597
  }, debounce$2 = (fn, wait, { maxWait } = {}) => {
143576
143598
  let timeout$1 = null;
@@ -162519,7 +162541,7 @@ var Node$13 = class Node$14 {
162519
162541
  trackedChanges: context.trackedChanges ?? []
162520
162542
  });
162521
162543
  }, _hoisted_1$6, _hoisted_2$1, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
162522
- var init_src_DEQEar7E_es = __esm(() => {
162544
+ var init_src_DCn8o9a0_es = __esm(() => {
162523
162545
  init_rolldown_runtime_B2q5OVn9_es();
162524
162546
  init_SuperConverter_BJBbuXuZ_es();
162525
162547
  init_jszip_ChlR43oI_es();
@@ -170442,6 +170464,7 @@ function print() { __p += __j.call(arguments, '') }
170442
170464
  annotateHeadersAndFooters,
170443
170465
  getAllHeaderFooterEditors
170444
170466
  };
170467
+ inFlightUpdates = /* @__PURE__ */ new WeakMap;
170445
170468
  new PluginKey("collaboration");
170446
170469
  headlessBindingStateByEditor = /* @__PURE__ */ new WeakMap;
170447
170470
  headlessCleanupRegisteredEditors = /* @__PURE__ */ new WeakSet;
@@ -170528,6 +170551,7 @@ function print() { __p += __j.call(arguments, '') }
170528
170551
  } };
170529
170552
  }
170530
170553
  });
170554
+ debouncedDocxUpdateByEditor = /* @__PURE__ */ new WeakMap;
170531
170555
  isHighContrastMode = ref2(false);
170532
170556
  ({ findChildren: findChildren$4 } = helpers_exports);
170533
170557
  ({ findChildren: findChildren$3 } = helpers_exports);
@@ -175518,7 +175542,8 @@ function print() { __p += __j.call(arguments, '') }
175518
175542
  this.#initMedia();
175519
175543
  this.initDefaultStyles();
175520
175544
  if (this.options.ydoc && this.options.collaborationProvider) {
175521
- updateYdocDocxData(this, this.options.ydoc);
175545
+ cancelDebouncedDocxUpdate(this);
175546
+ await updateYdocDocxData(this, this.options.ydoc);
175522
175547
  this.initializeCollaborationData();
175523
175548
  } else
175524
175549
  this.#insertNewFileData();
@@ -196055,8 +196080,8 @@ function print() { __p += __j.call(arguments, '') }
196055
196080
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
196056
196081
  };
196057
196082
  stubFalse_default = stubFalse;
196058
- freeExports$2 = typeof exports_src_DEQEar7E_es == "object" && exports_src_DEQEar7E_es && !exports_src_DEQEar7E_es.nodeType && exports_src_DEQEar7E_es;
196059
- freeModule$2 = freeExports$2 && typeof module_src_DEQEar7E_es == "object" && module_src_DEQEar7E_es && !module_src_DEQEar7E_es.nodeType && module_src_DEQEar7E_es;
196083
+ freeExports$2 = typeof exports_src_DCn8o9a0_es == "object" && exports_src_DCn8o9a0_es && !exports_src_DCn8o9a0_es.nodeType && exports_src_DCn8o9a0_es;
196084
+ freeModule$2 = freeExports$2 && typeof module_src_DCn8o9a0_es == "object" && module_src_DCn8o9a0_es && !module_src_DCn8o9a0_es.nodeType && module_src_DCn8o9a0_es;
196060
196085
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
196061
196086
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
196062
196087
  typedArrayTags = {};
@@ -196064,8 +196089,8 @@ function print() { __p += __j.call(arguments, '') }
196064
196089
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
196065
196090
  _baseIsTypedArray_default = baseIsTypedArray;
196066
196091
  _baseUnary_default = baseUnary;
196067
- freeExports$1 = typeof exports_src_DEQEar7E_es == "object" && exports_src_DEQEar7E_es && !exports_src_DEQEar7E_es.nodeType && exports_src_DEQEar7E_es;
196068
- freeModule$1 = freeExports$1 && typeof module_src_DEQEar7E_es == "object" && module_src_DEQEar7E_es && !module_src_DEQEar7E_es.nodeType && module_src_DEQEar7E_es;
196092
+ freeExports$1 = typeof exports_src_DCn8o9a0_es == "object" && exports_src_DCn8o9a0_es && !exports_src_DCn8o9a0_es.nodeType && exports_src_DCn8o9a0_es;
196093
+ freeModule$1 = freeExports$1 && typeof module_src_DCn8o9a0_es == "object" && module_src_DCn8o9a0_es && !module_src_DCn8o9a0_es.nodeType && module_src_DCn8o9a0_es;
196069
196094
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
196070
196095
  _nodeUtil_default = function() {
196071
196096
  try {
@@ -196170,8 +196195,8 @@ function print() { __p += __j.call(arguments, '') }
196170
196195
  Stack.prototype.has = _stackHas_default;
196171
196196
  Stack.prototype.set = _stackSet_default;
196172
196197
  _Stack_default = Stack;
196173
- freeExports = typeof exports_src_DEQEar7E_es == "object" && exports_src_DEQEar7E_es && !exports_src_DEQEar7E_es.nodeType && exports_src_DEQEar7E_es;
196174
- freeModule = freeExports && typeof module_src_DEQEar7E_es == "object" && module_src_DEQEar7E_es && !module_src_DEQEar7E_es.nodeType && module_src_DEQEar7E_es;
196198
+ freeExports = typeof exports_src_DCn8o9a0_es == "object" && exports_src_DCn8o9a0_es && !exports_src_DCn8o9a0_es.nodeType && exports_src_DCn8o9a0_es;
196199
+ freeModule = freeExports && typeof module_src_DCn8o9a0_es == "object" && module_src_DCn8o9a0_es && !module_src_DCn8o9a0_es.nodeType && module_src_DCn8o9a0_es;
196175
196200
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
196176
196201
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
196177
196202
  _cloneBuffer_default = cloneBuffer;
@@ -203823,7 +203848,7 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
203823
203848
 
203824
203849
  // ../../packages/superdoc/dist/super-editor.es.js
203825
203850
  var init_super_editor_es = __esm(() => {
203826
- init_src_DEQEar7E_es();
203851
+ init_src_DCn8o9a0_es();
203827
203852
  init_SuperConverter_BJBbuXuZ_es();
203828
203853
  init_jszip_ChlR43oI_es();
203829
203854
  init_xml_js_DLE8mr0n_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.21",
3
+ "version": "0.2.0-next.22",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -28,11 +28,11 @@
28
28
  "access": "public"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.21",
32
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.21",
33
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.21",
34
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.21",
35
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.21"
31
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.22",
32
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.22",
33
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.22",
34
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.22",
35
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.22"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "bun run src/index.ts",