@harbour-enterprises/superdoc 0.24.0-next.4 → 0.24.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 (33) hide show
  1. package/dist/chunks/{PdfViewer-D7C8g2G4.es.js → PdfViewer-BiHh3x6b.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-kOVuv-4I.cjs → PdfViewer-qk_hITc5.cjs} +1 -1
  3. package/dist/chunks/{index-BFKwBQjS.cjs → index-Di6nG2sc.cjs} +66 -10
  4. package/dist/chunks/{index-CnEAVnHQ.es.js → index-aMnFs35I.es.js} +66 -10
  5. package/dist/chunks/{super-editor.es-BmGTQ05x.cjs → super-editor.es-BKZvTraR.cjs} +579 -137
  6. package/dist/chunks/{super-editor.es-CBPoWvjs.es.js → super-editor.es-Dz7y81Yr.es.js} +579 -137
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/core/helpers/export.d.ts +1 -1
  9. package/dist/core/helpers/export.d.ts.map +1 -1
  10. package/dist/core/types/index.d.ts.map +1 -1
  11. package/dist/style.css +10 -0
  12. package/dist/super-editor/ai-writer.es.js +2 -2
  13. package/dist/super-editor/chunks/{converter-DpPj67OW.js → converter-CI3WqmGV.js} +514 -197
  14. package/dist/super-editor/chunks/{docx-zipper-6Kc95yG-.js → docx-zipper-D4fk50d9.js} +1 -1
  15. package/dist/super-editor/chunks/{editor-Dx6AhT5N.js → editor-DC6pZVp1.js} +170 -43
  16. package/dist/super-editor/chunks/{toolbar-CXSg2lJ9.js → toolbar-DMobfM6u.js} +2 -2
  17. package/dist/super-editor/converter.es.js +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/style.css +10 -0
  22. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +1 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-helpers.d.ts +16 -0
  24. package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts +1 -1
  25. package/dist/super-editor/super-editor.es.js +7 -7
  26. package/dist/super-editor/toolbar.es.js +2 -2
  27. package/dist/super-editor.cjs +1 -1
  28. package/dist/super-editor.es.js +1 -1
  29. package/dist/superdoc.cjs +2 -2
  30. package/dist/superdoc.es.js +2 -2
  31. package/dist/superdoc.umd.js +643 -145
  32. package/dist/superdoc.umd.js.map +1 -1
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CnEAVnHQ.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-aMnFs35I.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-BFKwBQjS.cjs");
4
+ const superdoc = require("./index-Di6nG2sc.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-BmGTQ05x.cjs");
2
+ const superEditor_es = require("./super-editor.es-BKZvTraR.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
@@ -17116,7 +17116,7 @@ const _sfc_main = {
17116
17116
  __name: "SuperDoc",
17117
17117
  emits: ["selection-update"],
17118
17118
  setup(__props, { emit: __emit }) {
17119
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-kOVuv-4I.cjs")));
17119
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-qk_hITc5.cjs")));
17120
17120
  const superdocStore = useSuperdocStore();
17121
17121
  const commentsStore = useCommentsStore();
17122
17122
  const {
@@ -17718,17 +17718,62 @@ const createSuperdocVueApp = () => {
17718
17718
  const highContrastModeStore = useHighContrastMode();
17719
17719
  return { app, pinia, superdocStore, commentsStore, highContrastModeStore };
17720
17720
  };
17721
- const createDownload = (blob, name, extension) => {
17721
+ const MIME_TYPES = {
17722
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
17723
+ pdf: "application/pdf",
17724
+ zip: "application/zip",
17725
+ html: "text/html",
17726
+ txt: "text/plain;charset=utf-8",
17727
+ json: "application/json"
17728
+ };
17729
+ const getMimeType = (extension) => {
17730
+ if (!extension || typeof extension.toLowerCase !== "function") return "application/octet-stream";
17731
+ return MIME_TYPES[extension.toLowerCase()] || "application/octet-stream";
17732
+ };
17733
+ const ensureBlob = (data, extension) => {
17734
+ if (data instanceof Blob) return data;
17735
+ const mimeType = getMimeType(extension);
17736
+ if (data instanceof ArrayBuffer) {
17737
+ return new Blob([data], { type: mimeType });
17738
+ }
17739
+ if (ArrayBuffer.isView(data)) {
17740
+ const { buffer, byteOffset, byteLength } = data;
17741
+ const slice = buffer.slice(byteOffset, byteOffset + byteLength);
17742
+ return new Blob([slice], { type: mimeType });
17743
+ }
17744
+ if (typeof data === "string") {
17745
+ return new Blob([data], { type: mimeType });
17746
+ }
17747
+ if (data == null) {
17748
+ throw new TypeError("createDownload requires a Blob, ArrayBuffer, or ArrayBufferView.");
17749
+ }
17750
+ throw new TypeError(`Cannot create download from value of type ${typeof data}`);
17751
+ };
17752
+ const createDownload = (data, name, extension) => {
17753
+ const blob = ensureBlob(data, extension);
17754
+ if (typeof URL === "undefined" || typeof URL.createObjectURL !== "function") return blob;
17755
+ if (typeof document === "undefined" || typeof document.createElement !== "function") return blob;
17722
17756
  const url = URL.createObjectURL(blob);
17723
17757
  const a = document.createElement("a");
17724
17758
  a.href = url;
17725
17759
  a.download = `${name}.${extension}`;
17760
+ const shouldAppend = document.body && typeof document.body.appendChild === "function";
17761
+ if (shouldAppend) document.body.appendChild(a);
17726
17762
  a.click();
17763
+ if (shouldAppend) document.body.removeChild(a);
17764
+ if (typeof URL.revokeObjectURL === "function") {
17765
+ setTimeout(() => URL.revokeObjectURL(url), 0);
17766
+ }
17767
+ return blob;
17727
17768
  };
17728
17769
  const cleanName = (currentName) => {
17729
- if (currentName.toLowerCase().endsWith(".docx") || currentName.toLowerCase().endsWith(".pdf")) {
17770
+ const lowerName = currentName.toLowerCase();
17771
+ if (lowerName.endsWith(".docx")) {
17730
17772
  return currentName.slice(0, -5);
17731
17773
  }
17774
+ if (lowerName.endsWith(".pdf")) {
17775
+ return currentName.slice(0, -4);
17776
+ }
17732
17777
  return currentName;
17733
17778
  };
17734
17779
  class SuperDoc extends eventemitter3.EventEmitter {
@@ -18346,14 +18391,25 @@ class SuperDoc extends eventemitter3.EventEmitter {
18346
18391
  comments.push(...this.commentsStore.translateCommentsForExport());
18347
18392
  }
18348
18393
  }
18349
- const docxPromises = [];
18350
- this.superdocStore.documents.forEach((doc) => {
18351
- const editor = doc.getEditor();
18352
- if (editor) {
18353
- docxPromises.push(editor.exportDocx({ isFinalDoc, comments, commentsType, fieldsHighlightColor }));
18394
+ const docxPromises = this.superdocStore.documents.map(async (doc) => {
18395
+ if (!doc || doc.type !== DOCX) return null;
18396
+ const editor = typeof doc.getEditor === "function" ? doc.getEditor() : null;
18397
+ const fallbackDocx = () => {
18398
+ if (!doc.data) return null;
18399
+ if (doc.data.type && doc.data.type !== DOCX) return null;
18400
+ return doc.data;
18401
+ };
18402
+ if (!editor) return fallbackDocx();
18403
+ try {
18404
+ const exported = await editor.exportDocx({ isFinalDoc, comments, commentsType, fieldsHighlightColor });
18405
+ if (exported) return exported;
18406
+ } catch (error) {
18407
+ this.emit("exception", { error, document: doc });
18354
18408
  }
18409
+ return fallbackDocx();
18355
18410
  });
18356
- return await Promise.all(docxPromises);
18411
+ const docxFiles = await Promise.all(docxPromises);
18412
+ return docxFiles.filter(Boolean);
18357
18413
  }
18358
18414
  /**
18359
18415
  * Request an immediate save from all collaboration documents
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-CBPoWvjs.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-Dz7y81Yr.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
@@ -17099,7 +17099,7 @@ const _sfc_main = {
17099
17099
  __name: "SuperDoc",
17100
17100
  emits: ["selection-update"],
17101
17101
  setup(__props, { emit: __emit }) {
17102
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D7C8g2G4.es.js"));
17102
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BiHh3x6b.es.js"));
17103
17103
  const superdocStore = useSuperdocStore();
17104
17104
  const commentsStore = useCommentsStore();
17105
17105
  const {
@@ -17701,17 +17701,62 @@ const createSuperdocVueApp = () => {
17701
17701
  const highContrastModeStore = useHighContrastMode();
17702
17702
  return { app, pinia, superdocStore, commentsStore, highContrastModeStore };
17703
17703
  };
17704
- const createDownload = (blob, name, extension) => {
17704
+ const MIME_TYPES = {
17705
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
17706
+ pdf: "application/pdf",
17707
+ zip: "application/zip",
17708
+ html: "text/html",
17709
+ txt: "text/plain;charset=utf-8",
17710
+ json: "application/json"
17711
+ };
17712
+ const getMimeType = (extension) => {
17713
+ if (!extension || typeof extension.toLowerCase !== "function") return "application/octet-stream";
17714
+ return MIME_TYPES[extension.toLowerCase()] || "application/octet-stream";
17715
+ };
17716
+ const ensureBlob = (data, extension) => {
17717
+ if (data instanceof Blob) return data;
17718
+ const mimeType = getMimeType(extension);
17719
+ if (data instanceof ArrayBuffer) {
17720
+ return new Blob([data], { type: mimeType });
17721
+ }
17722
+ if (ArrayBuffer.isView(data)) {
17723
+ const { buffer, byteOffset, byteLength } = data;
17724
+ const slice = buffer.slice(byteOffset, byteOffset + byteLength);
17725
+ return new Blob([slice], { type: mimeType });
17726
+ }
17727
+ if (typeof data === "string") {
17728
+ return new Blob([data], { type: mimeType });
17729
+ }
17730
+ if (data == null) {
17731
+ throw new TypeError("createDownload requires a Blob, ArrayBuffer, or ArrayBufferView.");
17732
+ }
17733
+ throw new TypeError(`Cannot create download from value of type ${typeof data}`);
17734
+ };
17735
+ const createDownload = (data, name, extension) => {
17736
+ const blob = ensureBlob(data, extension);
17737
+ if (typeof URL === "undefined" || typeof URL.createObjectURL !== "function") return blob;
17738
+ if (typeof document === "undefined" || typeof document.createElement !== "function") return blob;
17705
17739
  const url = URL.createObjectURL(blob);
17706
17740
  const a = document.createElement("a");
17707
17741
  a.href = url;
17708
17742
  a.download = `${name}.${extension}`;
17743
+ const shouldAppend = document.body && typeof document.body.appendChild === "function";
17744
+ if (shouldAppend) document.body.appendChild(a);
17709
17745
  a.click();
17746
+ if (shouldAppend) document.body.removeChild(a);
17747
+ if (typeof URL.revokeObjectURL === "function") {
17748
+ setTimeout(() => URL.revokeObjectURL(url), 0);
17749
+ }
17750
+ return blob;
17710
17751
  };
17711
17752
  const cleanName = (currentName) => {
17712
- if (currentName.toLowerCase().endsWith(".docx") || currentName.toLowerCase().endsWith(".pdf")) {
17753
+ const lowerName = currentName.toLowerCase();
17754
+ if (lowerName.endsWith(".docx")) {
17713
17755
  return currentName.slice(0, -5);
17714
17756
  }
17757
+ if (lowerName.endsWith(".pdf")) {
17758
+ return currentName.slice(0, -4);
17759
+ }
17715
17760
  return currentName;
17716
17761
  };
17717
17762
  class SuperDoc extends EventEmitter {
@@ -18329,14 +18374,25 @@ class SuperDoc extends EventEmitter {
18329
18374
  comments.push(...this.commentsStore.translateCommentsForExport());
18330
18375
  }
18331
18376
  }
18332
- const docxPromises = [];
18333
- this.superdocStore.documents.forEach((doc) => {
18334
- const editor = doc.getEditor();
18335
- if (editor) {
18336
- docxPromises.push(editor.exportDocx({ isFinalDoc, comments, commentsType, fieldsHighlightColor }));
18377
+ const docxPromises = this.superdocStore.documents.map(async (doc) => {
18378
+ if (!doc || doc.type !== DOCX) return null;
18379
+ const editor = typeof doc.getEditor === "function" ? doc.getEditor() : null;
18380
+ const fallbackDocx = () => {
18381
+ if (!doc.data) return null;
18382
+ if (doc.data.type && doc.data.type !== DOCX) return null;
18383
+ return doc.data;
18384
+ };
18385
+ if (!editor) return fallbackDocx();
18386
+ try {
18387
+ const exported = await editor.exportDocx({ isFinalDoc, comments, commentsType, fieldsHighlightColor });
18388
+ if (exported) return exported;
18389
+ } catch (error) {
18390
+ this.emit("exception", { error, document: doc });
18337
18391
  }
18392
+ return fallbackDocx();
18338
18393
  });
18339
- return await Promise.all(docxPromises);
18394
+ const docxFiles = await Promise.all(docxPromises);
18395
+ return docxFiles.filter(Boolean);
18340
18396
  }
18341
18397
  /**
18342
18398
  * Request an immediate save from all collaboration documents