@harbour-enterprises/superdoc 0.23.0-next.4 → 0.23.0-next.6

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 (41) hide show
  1. package/dist/chunks/{PdfViewer-vQ-IdNED.es.js → PdfViewer-BlOezZGN.es.js} +2 -2
  2. package/dist/chunks/{PdfViewer-D9qubRJ_.cjs → PdfViewer-D89-VJvM.cjs} +2 -2
  3. package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
  4. package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
  5. package/dist/chunks/{index-BTv5rNmt.cjs → index-9hY1WuxT.cjs} +30 -13
  6. package/dist/chunks/{index-DGxFKkbG.es.js → index-DTw4eF5D.es.js} +30 -13
  7. package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
  8. package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-wyeeDloA.cjs → super-editor.es-C8gNFcB_.cjs} +34 -32
  10. package/dist/chunks/{super-editor.es-DRBPtyog.es.js → super-editor.es-C9Ql0kHS.es.js} +34 -32
  11. package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
  12. package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
  13. package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
  14. package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
  15. package/dist/core/SuperDoc.d.ts.map +1 -1
  16. package/dist/core/types/index.d.ts.map +1 -1
  17. package/dist/stores/superdoc-store.d.ts.map +1 -1
  18. package/dist/style.css +31 -27
  19. package/dist/super-editor/ai-writer.es.js +2 -2
  20. package/dist/super-editor/chunks/{converter-BVirrB35.js → converter-ClnqoStR.js} +16 -18
  21. package/dist/super-editor/chunks/{docx-zipper-Cpb9d2an.js → docx-zipper-DC28ucAi.js} +1 -1
  22. package/dist/super-editor/chunks/{editor-CqnpAm6f.js → editor-DLan-MJ6.js} +19 -15
  23. package/dist/super-editor/chunks/{toolbar-DnEbb4lv.js → toolbar-CekMv4Mk.js} +2 -2
  24. package/dist/super-editor/converter.es.js +1 -1
  25. package/dist/super-editor/docx-zipper.es.js +2 -2
  26. package/dist/super-editor/editor.es.js +3 -3
  27. package/dist/super-editor/file-zipper.es.js +1 -1
  28. package/dist/super-editor/src/core/Attribute.d.ts +2 -2
  29. package/dist/super-editor/src/core/Schema.d.ts +2 -2
  30. package/dist/super-editor/style.css +4 -0
  31. package/dist/super-editor/super-editor.es.js +6 -6
  32. package/dist/super-editor/toolbar.es.js +2 -2
  33. package/dist/super-editor.cjs +2 -2
  34. package/dist/super-editor.es.js +2 -2
  35. package/dist/superdoc.cjs +4 -4
  36. package/dist/superdoc.es.js +4 -4
  37. package/dist/superdoc.umd.js +92 -73
  38. package/dist/superdoc.umd.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
  41. package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
@@ -20,7 +20,7 @@
20
20
  }
21
21
  const Y__namespace = /* @__PURE__ */ _interopNamespaceDefault(Y);
22
22
  /**
23
- * @vue/shared v3.5.21
23
+ * @vue/shared v3.5.22
24
24
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
25
25
  * @license MIT
26
26
  **/
@@ -915,7 +915,7 @@
915
915
  iter._next = iter.next;
916
916
  iter.next = () => {
917
917
  const result = iter._next();
918
- if (result.value) {
918
+ if (!result.done) {
919
919
  result.value = wrapValue(result.value);
920
920
  }
921
921
  return result;
@@ -1041,7 +1041,8 @@
1041
1041
  return res;
1042
1042
  }
1043
1043
  if (isRef(res)) {
1044
- return targetIsArray && isIntegerKey(key2) ? res : res.value;
1044
+ const value = targetIsArray && isIntegerKey(key2) ? res : res.value;
1045
+ return isReadonly2 && isObject$3(value) ? readonly(value) : value;
1045
1046
  }
1046
1047
  if (isObject$3(res)) {
1047
1048
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2214,9 +2215,6 @@
2214
2215
  insert(mainAnchor, container, anchor);
2215
2216
  const mount2 = (container2, anchor2) => {
2216
2217
  if (shapeFlag & 16) {
2217
- if (parentComponent && parentComponent.isCE) {
2218
- parentComponent.ce._teleportTarget = container2;
2219
- }
2220
2218
  mountChildren(
2221
2219
  children,
2222
2220
  container2,
@@ -2238,6 +2236,9 @@
2238
2236
  } else if (namespace2 !== "mathml" && isTargetMathML(target)) {
2239
2237
  namespace2 = "mathml";
2240
2238
  }
2239
+ if (parentComponent && parentComponent.isCE) {
2240
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2241
+ }
2241
2242
  if (!disabled) {
2242
2243
  mount2(target, targetAnchor);
2243
2244
  updateCssVars(n2, false);
@@ -3326,11 +3327,12 @@
3326
3327
  }
3327
3328
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3328
3329
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
3330
+ const hasProps = Object.keys(props).length > 0;
3329
3331
  return openBlock(), createBlock(
3330
3332
  Fragment$1,
3331
3333
  null,
3332
3334
  [createVNode("slot", props, fallback)],
3333
- 64
3335
+ hasProps ? -2 : 64
3334
3336
  );
3335
3337
  }
3336
3338
  let slot = slots[name];
@@ -6720,34 +6722,31 @@
6720
6722
  return c2;
6721
6723
  };
6722
6724
  function h$1(type2, propsOrChildren, children) {
6723
- const doCreateVNode = (type22, props, children2) => {
6725
+ try {
6724
6726
  setBlockTracking(-1);
6725
- try {
6726
- return createVNode(type22, props, children2);
6727
- } finally {
6728
- setBlockTracking(1);
6729
- }
6730
- };
6731
- const l = arguments.length;
6732
- if (l === 2) {
6733
- if (isObject$3(propsOrChildren) && !isArray$3(propsOrChildren)) {
6734
- if (isVNode(propsOrChildren)) {
6735
- return doCreateVNode(type2, null, [propsOrChildren]);
6727
+ const l = arguments.length;
6728
+ if (l === 2) {
6729
+ if (isObject$3(propsOrChildren) && !isArray$3(propsOrChildren)) {
6730
+ if (isVNode(propsOrChildren)) {
6731
+ return createVNode(type2, null, [propsOrChildren]);
6732
+ }
6733
+ return createVNode(type2, propsOrChildren);
6734
+ } else {
6735
+ return createVNode(type2, null, propsOrChildren);
6736
6736
  }
6737
- return doCreateVNode(type2, propsOrChildren);
6738
6737
  } else {
6739
- return doCreateVNode(type2, null, propsOrChildren);
6740
- }
6741
- } else {
6742
- if (l > 3) {
6743
- children = Array.prototype.slice.call(arguments, 2);
6744
- } else if (l === 3 && isVNode(children)) {
6745
- children = [children];
6738
+ if (l > 3) {
6739
+ children = Array.prototype.slice.call(arguments, 2);
6740
+ } else if (l === 3 && isVNode(children)) {
6741
+ children = [children];
6742
+ }
6743
+ return createVNode(type2, propsOrChildren, children);
6746
6744
  }
6747
- return doCreateVNode(type2, propsOrChildren, children);
6745
+ } finally {
6746
+ setBlockTracking(1);
6748
6747
  }
6749
6748
  }
6750
- const version$1 = "3.5.21";
6749
+ const version$1 = "3.5.22";
6751
6750
  let policy = void 0;
6752
6751
  const tt = typeof window !== "undefined" && window.trustedTypes;
6753
6752
  if (tt) {
@@ -6953,11 +6952,11 @@
6953
6952
  const resolve2 = () => finishLeave(el, done);
6954
6953
  addTransitionClass(el, leaveFromClass);
6955
6954
  if (!el._enterCancelled) {
6956
- forceReflow();
6955
+ forceReflow(el);
6957
6956
  addTransitionClass(el, leaveActiveClass);
6958
6957
  } else {
6959
6958
  addTransitionClass(el, leaveActiveClass);
6960
- forceReflow();
6959
+ forceReflow(el);
6961
6960
  }
6962
6961
  nextFrame(() => {
6963
6962
  if (!el._isLeaving) {
@@ -7100,8 +7099,9 @@
7100
7099
  if (s === "auto") return 0;
7101
7100
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
7102
7101
  }
7103
- function forceReflow() {
7104
- return document.body.offsetHeight;
7102
+ function forceReflow(el) {
7103
+ const targetDocument = el ? el.ownerDocument : document;
7104
+ return targetDocument.body.offsetHeight;
7105
7105
  }
7106
7106
  function patchClass(el, value, isSVG2) {
7107
7107
  const transitionClasses = el[vtcKey];
@@ -7487,7 +7487,7 @@
7487
7487
  prevChildren.forEach(callPendingCbs);
7488
7488
  prevChildren.forEach(recordPosition);
7489
7489
  const movedChildren = prevChildren.filter(applyTranslation);
7490
- forceReflow();
7490
+ forceReflow(instance.vnode.el);
7491
7491
  movedChildren.forEach((c2) => {
7492
7492
  const el = c2.el;
7493
7493
  const style2 = el.style;
@@ -12836,6 +12836,19 @@
12836
12836
  };
12837
12837
  return safeRegexTest;
12838
12838
  }
12839
+ var generatorFunction;
12840
+ var hasRequiredGeneratorFunction;
12841
+ function requireGeneratorFunction() {
12842
+ if (hasRequiredGeneratorFunction) return generatorFunction;
12843
+ hasRequiredGeneratorFunction = 1;
12844
+ const cached = (
12845
+ /** @type {GeneratorFunctionConstructor} */
12846
+ function* () {
12847
+ }.constructor
12848
+ );
12849
+ generatorFunction = () => cached;
12850
+ return generatorFunction;
12851
+ }
12839
12852
  var isGeneratorFunction;
12840
12853
  var hasRequiredIsGeneratorFunction;
12841
12854
  function requireIsGeneratorFunction() {
@@ -12848,16 +12861,7 @@
12848
12861
  var getProto2 = requireGetProto();
12849
12862
  var toStr = callBound2("Object.prototype.toString");
12850
12863
  var fnToStr = callBound2("Function.prototype.toString");
12851
- var getGeneratorFunc = function() {
12852
- if (!hasToStringTag) {
12853
- return false;
12854
- }
12855
- try {
12856
- return Function("return function*() {}")();
12857
- } catch (e) {
12858
- }
12859
- };
12860
- var GeneratorFunction;
12864
+ var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
12861
12865
  isGeneratorFunction = function isGeneratorFunction2(fn) {
12862
12866
  if (typeof fn !== "function") {
12863
12867
  return false;
@@ -12872,14 +12876,8 @@
12872
12876
  if (!getProto2) {
12873
12877
  return false;
12874
12878
  }
12875
- if (typeof GeneratorFunction === "undefined") {
12876
- var generatorFunc = getGeneratorFunc();
12877
- GeneratorFunction = generatorFunc ? (
12878
- /** @type {GeneratorFunctionConstructor} */
12879
- getProto2(generatorFunc)
12880
- ) : false;
12881
- }
12882
- return getProto2(fn) === GeneratorFunction;
12879
+ var GeneratorFunction = getGeneratorFunction();
12880
+ return GeneratorFunction && getProto2(fn) === GeneratorFunction.prototype;
12883
12881
  };
12884
12882
  return isGeneratorFunction;
12885
12883
  }
@@ -49790,8 +49788,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49790
49788
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
49791
49789
  let $fromA = doc2.resolve(change.start);
49792
49790
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
49793
- let nextSel;
49794
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
49791
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
49795
49792
  view.input.lastIOSEnter = 0;
49796
49793
  return;
49797
49794
  }
@@ -62054,10 +62051,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62054
62051
  return true;
62055
62052
  },
62056
62053
  /**
62057
- * Updates a structured content attributes or content.
62054
+ * Updates a single structured content field by its unique ID.
62055
+ * IDs are unique identifiers, so this will update at most one field.
62058
62056
  * If the updated node does not match the schema, it will not be updated.
62059
62057
  * @category Command
62060
- * @param {string} id
62058
+ * @param {string} id - Unique identifier of the field
62061
62059
  * @param {StructuredContentUpdate} options
62062
62060
  */
62063
62061
  updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -62098,10 +62096,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62098
62096
  return true;
62099
62097
  },
62100
62098
  /**
62101
- * Updates a structured content attributes or content by alias.
62102
- * If the updated node does not match the schema, it will not be updated.
62099
+ * Updates all structured content fields with the same alias.
62100
+ * Unlike IDs (which are unique), aliases can be shared across multiple fields.
62101
+ * This will update every field that matches the given alias.
62102
+ * If any updated node does not match the schema, no updates will be applied.
62103
62103
  * @category Command
62104
- * @param {string} alias
62104
+ * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
62105
62105
  * @param {StructuredContentUpdate} options
62106
62106
  */
62107
62107
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -62110,11 +62110,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62110
62110
  return true;
62111
62111
  }
62112
62112
  const { schema } = editor;
62113
- if (dispatch) {
62114
- const structuredContent = structuredContentTags[0];
62115
- const { pos, node } = structuredContent;
62116
- const posFrom = pos;
62117
- const posTo = pos + node.nodeSize;
62113
+ const updates = [];
62114
+ for (const { pos, node } of structuredContentTags) {
62118
62115
  let content = null;
62119
62116
  if (options.text) {
62120
62117
  content = schema.text(options.text);
@@ -62133,11 +62130,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62133
62130
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
62134
62131
  try {
62135
62132
  updatedNode.check();
62133
+ updates.push({ pos, node: updatedNode, size: node.nodeSize });
62136
62134
  } catch {
62137
62135
  console.error("Updated node does not conform to the schema");
62138
62136
  return false;
62139
62137
  }
62140
- tr.replaceWith(posFrom, posTo, updatedNode);
62138
+ }
62139
+ if (dispatch) {
62140
+ updates.reverse().forEach(({ pos, node, size: size2 }) => {
62141
+ tr.replaceWith(pos, pos + size2, node);
62142
+ });
62141
62143
  }
62142
62144
  return true;
62143
62145
  },
@@ -97513,6 +97515,9 @@ ${reason}`);
97513
97515
  documentUsers.value = configUsers || [];
97514
97516
  Object.assign(user, configUser);
97515
97517
  Object.assign(modules, configModules);
97518
+ if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
97519
+ modules.comments = {};
97520
+ }
97516
97521
  if (!configDocs?.length && !config2.modules.collaboration) {
97517
97522
  const newDoc = await getFileObject(BlankDOCX, "blank.docx", DOCX);
97518
97523
  const newDocConfig = {
@@ -111103,6 +111108,11 @@ ${style2}
111103
111108
  const { proxy } = getCurrentInstance();
111104
111109
  commentsStore.proxy = proxy;
111105
111110
  const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
111111
+ const commentsModuleConfig = computed(() => {
111112
+ const config2 = modules.comments;
111113
+ if (config2 === false || config2 == null) return null;
111114
+ return config2;
111115
+ });
111106
111116
  const layers = ref$1(null);
111107
111117
  const commentsLayer = ref$1(null);
111108
111118
  const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
@@ -111250,7 +111260,7 @@ ${style2}
111250
111260
  rulers: doc2.rulers,
111251
111261
  isInternal: proxy.$superdoc.config.isInternal,
111252
111262
  annotations: proxy.$superdoc.config.annotations,
111253
- isCommentsEnabled: proxy.$superdoc.config.modules?.comments,
111263
+ isCommentsEnabled: Boolean(commentsModuleConfig.value),
111254
111264
  isAiEnabled: proxy.$superdoc.config.modules?.ai,
111255
111265
  slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
111256
111266
  onBeforeCreate: onEditorBeforeCreate,
@@ -111281,7 +111291,8 @@ ${style2}
111281
111291
  return options;
111282
111292
  };
111283
111293
  const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
111284
- if (!proxy.$superdoc.config.modules?.comments) return;
111294
+ const commentsConfig = proxy.$superdoc.config.modules?.comments;
111295
+ if (!commentsConfig || commentsConfig === false) return;
111285
111296
  handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
111286
111297
  };
111287
111298
  const onEditorCommentsUpdate = (params2 = {}) => {
@@ -111303,7 +111314,7 @@ ${style2}
111303
111314
  proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
111304
111315
  }
111305
111316
  };
111306
- const isCommentsEnabled = computed(() => "comments" in modules);
111317
+ const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
111307
111318
  const showCommentsSidebar = computed(() => {
111308
111319
  return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
111309
111320
  });
@@ -111313,13 +111324,14 @@ ${style2}
111313
111324
  });
111314
111325
  computed(() => {
111315
111326
  if (!isCommentsEnabled.value) return false;
111316
- !getConfig?.readOnly && selectionPosition.value;
111327
+ return !getConfig.value?.readOnly && selectionPosition.value;
111317
111328
  });
111318
111329
  watch(showCommentsSidebar, (value) => {
111319
111330
  proxy.$superdoc.broadcastSidebarToggle(value);
111320
111331
  });
111321
111332
  const scrollToComment = (commentId) => {
111322
- if (!proxy.$superdoc.config?.modules?.comments) return;
111333
+ const commentsConfig = proxy.$superdoc.config?.modules?.comments;
111334
+ if (!commentsConfig || commentsConfig === false) return;
111323
111335
  const element = document.querySelector(`[data-thread-id=${commentId}]`);
111324
111336
  if (element) {
111325
111337
  element.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -111327,7 +111339,8 @@ ${style2}
111327
111339
  }
111328
111340
  };
111329
111341
  onMounted(() => {
111330
- if (isCommentsEnabled.value && !modules.comments.readOnly) {
111342
+ const config2 = commentsModuleConfig.value;
111343
+ if (config2 && !config2.readOnly) {
111331
111344
  document.addEventListener("mousedown", handleDocumentMouseDown);
111332
111345
  }
111333
111346
  });
@@ -111449,6 +111462,7 @@ ${style2}
111449
111462
  };
111450
111463
  const shouldShowSelection = computed(() => {
111451
111464
  const config2 = proxy.$superdoc.config.modules?.comments;
111465
+ if (!config2 || config2 === false) return false;
111452
111466
  return !config2.readOnly;
111453
111467
  });
111454
111468
  const handleSuperEditorPageMarginsChange = (doc2, params2) => {
@@ -111615,7 +111629,7 @@ ${style2}
111615
111629
  };
111616
111630
  }
111617
111631
  };
111618
- const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3f71b1bf"]]);
111632
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-45f44b6e"]]);
111619
111633
  const createSuperdocVueApp = () => {
111620
111634
  const app = createApp(App);
111621
111635
  const pinia = createPinia();
@@ -111714,6 +111728,10 @@ ${style2}
111714
111728
  ...this.config,
111715
111729
  ...config2
111716
111730
  };
111731
+ this.config.modules = this.config.modules || {};
111732
+ if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
111733
+ this.config.modules.comments = {};
111734
+ }
111717
111735
  this.config.colors = shuffleArray(this.config.colors);
111718
111736
  this.userColorMap = /* @__PURE__ */ new Map();
111719
111737
  this.colorIndex = 0;
@@ -111848,7 +111866,8 @@ ${style2}
111848
111866
  this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
111849
111867
  }
111850
111868
  this.superdocStore.init(this.config);
111851
- this.commentsStore.init(this.config.modules.comments);
111869
+ const commentsModuleConfig = this.config.modules.comments;
111870
+ this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
111852
111871
  }
111853
111872
  #initListeners() {
111854
111873
  this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);