@harbour-enterprises/superdoc 0.21.0-next.8 → 0.21.1

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 (35) hide show
  1. package/dist/chunks/{PdfViewer-BR9iwva-.cjs → PdfViewer-B507M2sz.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CwVW7MVJ.es.js → PdfViewer-DCKxnML6.es.js} +1 -1
  3. package/dist/chunks/{index-CjQDYBP2.es.js → index-DWR8syta.es.js} +40 -20
  4. package/dist/chunks/{index-BNA5J__D.cjs → index-djqw1MEc.cjs} +40 -20
  5. package/dist/chunks/{super-editor.es-C5dhT0uU.es.js → super-editor.es-D__G4K0i.es.js} +429 -115
  6. package/dist/chunks/{super-editor.es-Ct59l8tt.cjs → super-editor.es-HekVJogH.cjs} +429 -115
  7. package/dist/core/SuperDoc.d.ts +5 -0
  8. package/dist/core/SuperDoc.d.ts.map +1 -1
  9. package/dist/core/types/index.d.ts +4 -4
  10. package/dist/core/types/index.d.ts.map +1 -1
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-DYAHhSrg.js → converter-B_pO-5Ls.js} +291 -67
  13. package/dist/super-editor/chunks/{docx-zipper-BDbCmfbE.js → docx-zipper-WaO3WaIz.js} +73 -12
  14. package/dist/super-editor/chunks/{editor-B1W7AdgQ.js → editor-DInvq7gF.js} +68 -30
  15. package/dist/super-editor/chunks/{toolbar-CCvglB_X.js → toolbar-C15EomPB.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/src/core/DocxZipper.d.ts +1 -1
  21. package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +1 -13
  22. package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -0
  23. package/dist/super-editor/src/core/super-converter/helpers/tableFallbackHelpers.d.ts +24 -0
  24. package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -1
  25. package/dist/super-editor/src/utils/contextmenu-helpers.d.ts +24 -0
  26. package/dist/super-editor/super-editor.es.js +7 -15
  27. package/dist/super-editor/toolbar.es.js +2 -2
  28. package/dist/super-editor.cjs +1 -1
  29. package/dist/super-editor.es.js +1 -1
  30. package/dist/superdoc.cjs +2 -2
  31. package/dist/superdoc.es.js +2 -2
  32. package/dist/superdoc.umd.js +467 -133
  33. package/dist/superdoc.umd.js.map +1 -1
  34. package/package.json +2 -5
  35. package/dist/super-editor/src/components/slash-menu/contextmenu-helpers.d.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DWle4Cai.cjs");
4
- const superdoc = require("./index-BNA5J__D.cjs");
4
+ const superdoc = require("./index-djqw1MEc.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -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-CXxsqYcP.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-CjQDYBP2.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-DWR8syta.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index$1, 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-C5dhT0uU.es.js";
1
+ import { q as index$1, 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-D__G4K0i.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-CXxsqYcP.es.js";
3
3
  import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
4
4
  import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
@@ -17392,7 +17392,7 @@ const _sfc_main = {
17392
17392
  __name: "SuperDoc",
17393
17393
  emits: ["selection-update"],
17394
17394
  setup(__props, { emit: __emit }) {
17395
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CwVW7MVJ.es.js"));
17395
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DCKxnML6.es.js"));
17396
17396
  const superdocStore = useSuperdocStore();
17397
17397
  const commentsStore = useCommentsStore();
17398
17398
  const {
@@ -18037,7 +18037,7 @@ class SuperDoc extends EventEmitter {
18037
18037
  this.config.colors = shuffleArray(this.config.colors);
18038
18038
  this.userColorMap = /* @__PURE__ */ new Map();
18039
18039
  this.colorIndex = 0;
18040
- this.version = "0.20.2";
18040
+ this.version = "0.21.1";
18041
18041
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18042
18042
  this.superdocId = config.superdocId || v4();
18043
18043
  this.colors = this.config.colors;
@@ -18052,6 +18052,9 @@ class SuperDoc extends EventEmitter {
18052
18052
  this.isDev = this.config.isDev || false;
18053
18053
  this.activeEditor = null;
18054
18054
  this.comments = [];
18055
+ if (!this.config.selector) {
18056
+ throw new Error("SuperDoc: selector is required");
18057
+ }
18055
18058
  this.app.mount(this.config.selector);
18056
18059
  this.readyEditors = 0;
18057
18060
  this.isLocked = this.config.isLocked || false;
@@ -18071,6 +18074,16 @@ class SuperDoc extends EventEmitter {
18071
18074
  users: this.users
18072
18075
  };
18073
18076
  }
18077
+ /**
18078
+ * Get the SuperDoc container element
18079
+ * @returns {HTMLElement | null}
18080
+ */
18081
+ get element() {
18082
+ if (typeof this.config.selector === "string") {
18083
+ return document.querySelector(this.config.selector);
18084
+ }
18085
+ return this.config.selector;
18086
+ }
18074
18087
  #patchNaiveUIStyles() {
18075
18088
  const cspNonce = this.config.cspNonce;
18076
18089
  const originalCreateElement = document.createElement;
@@ -18094,10 +18107,16 @@ class SuperDoc extends EventEmitter {
18094
18107
  }
18095
18108
  if (hasDocumentConfig) {
18096
18109
  const normalized = normalizeDocumentEntry(this.config.document);
18097
- this.config.documents = [normalized];
18110
+ this.config.documents = [
18111
+ {
18112
+ id: v4(),
18113
+ ...normalized
18114
+ }
18115
+ ];
18098
18116
  } else if (hasDocumentUrl) {
18099
18117
  this.config.documents = [
18100
18118
  {
18119
+ id: v4(),
18101
18120
  type: DOCX,
18102
18121
  url: this.config.document,
18103
18122
  name: "document.docx",
@@ -18105,33 +18124,34 @@ class SuperDoc extends EventEmitter {
18105
18124
  }
18106
18125
  ];
18107
18126
  } else if (hasDocumentFile) {
18127
+ const normalized = normalizeDocumentEntry(this.config.document);
18108
18128
  this.config.documents = [
18109
18129
  {
18110
- type: this.config.document.type,
18111
- data: this.config.document,
18112
- name: this.config.document.name,
18113
- isNewFile: true
18130
+ id: v4(),
18131
+ ...normalized
18114
18132
  }
18115
18133
  ];
18116
18134
  } else if (hasDocumentBlob) {
18117
- const docType = this.config.document.type || DOCX;
18118
- let extension = ".docx";
18119
- if (docType === PDF) {
18120
- extension = ".pdf";
18121
- } else if (docType === HTML) {
18122
- extension = ".html";
18123
- }
18135
+ const normalized = normalizeDocumentEntry(this.config.document);
18124
18136
  this.config.documents = [
18125
18137
  {
18126
- type: docType,
18127
- data: this.config.document,
18128
- name: `document${extension}`,
18129
- isNewFile: true
18138
+ id: v4(),
18139
+ ...normalized
18130
18140
  }
18131
18141
  ];
18132
18142
  }
18133
18143
  if (Array.isArray(this.config.documents) && this.config.documents.length > 0) {
18134
- this.config.documents = this.config.documents.map((d) => normalizeDocumentEntry(d));
18144
+ this.config.documents = this.config.documents.map((d) => {
18145
+ const normalized = normalizeDocumentEntry(d);
18146
+ if (!normalized || typeof normalized !== "object") {
18147
+ return normalized;
18148
+ }
18149
+ const existingId = typeof normalized === "object" && "id" in normalized && normalized.id || d && typeof d === "object" && "id" in d && d.id;
18150
+ return {
18151
+ ...normalized,
18152
+ id: existingId || v4()
18153
+ };
18154
+ });
18135
18155
  }
18136
18156
  }
18137
18157
  #initVueApp() {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-Ct59l8tt.cjs");
2
+ const superEditor_es = require("./super-editor.es-HekVJogH.cjs");
3
3
  const vue = require("./vue-DWle4Cai.cjs");
4
4
  const jszip = require("./jszip-b7l8QkfH.cjs");
5
5
  const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
@@ -17409,7 +17409,7 @@ const _sfc_main = {
17409
17409
  __name: "SuperDoc",
17410
17410
  emits: ["selection-update"],
17411
17411
  setup(__props, { emit: __emit }) {
17412
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BR9iwva-.cjs")));
17412
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-B507M2sz.cjs")));
17413
17413
  const superdocStore = useSuperdocStore();
17414
17414
  const commentsStore = useCommentsStore();
17415
17415
  const {
@@ -18054,7 +18054,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18054
18054
  this.config.colors = shuffleArray(this.config.colors);
18055
18055
  this.userColorMap = /* @__PURE__ */ new Map();
18056
18056
  this.colorIndex = 0;
18057
- this.version = "0.20.2";
18057
+ this.version = "0.21.1";
18058
18058
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18059
18059
  this.superdocId = config.superdocId || uuid.v4();
18060
18060
  this.colors = this.config.colors;
@@ -18069,6 +18069,9 @@ class SuperDoc extends eventemitter3.EventEmitter {
18069
18069
  this.isDev = this.config.isDev || false;
18070
18070
  this.activeEditor = null;
18071
18071
  this.comments = [];
18072
+ if (!this.config.selector) {
18073
+ throw new Error("SuperDoc: selector is required");
18074
+ }
18072
18075
  this.app.mount(this.config.selector);
18073
18076
  this.readyEditors = 0;
18074
18077
  this.isLocked = this.config.isLocked || false;
@@ -18088,6 +18091,16 @@ class SuperDoc extends eventemitter3.EventEmitter {
18088
18091
  users: this.users
18089
18092
  };
18090
18093
  }
18094
+ /**
18095
+ * Get the SuperDoc container element
18096
+ * @returns {HTMLElement | null}
18097
+ */
18098
+ get element() {
18099
+ if (typeof this.config.selector === "string") {
18100
+ return document.querySelector(this.config.selector);
18101
+ }
18102
+ return this.config.selector;
18103
+ }
18091
18104
  #patchNaiveUIStyles() {
18092
18105
  const cspNonce = this.config.cspNonce;
18093
18106
  const originalCreateElement = document.createElement;
@@ -18111,10 +18124,16 @@ class SuperDoc extends eventemitter3.EventEmitter {
18111
18124
  }
18112
18125
  if (hasDocumentConfig) {
18113
18126
  const normalized = normalizeDocumentEntry(this.config.document);
18114
- this.config.documents = [normalized];
18127
+ this.config.documents = [
18128
+ {
18129
+ id: uuid.v4(),
18130
+ ...normalized
18131
+ }
18132
+ ];
18115
18133
  } else if (hasDocumentUrl) {
18116
18134
  this.config.documents = [
18117
18135
  {
18136
+ id: uuid.v4(),
18118
18137
  type: DOCX,
18119
18138
  url: this.config.document,
18120
18139
  name: "document.docx",
@@ -18122,33 +18141,34 @@ class SuperDoc extends eventemitter3.EventEmitter {
18122
18141
  }
18123
18142
  ];
18124
18143
  } else if (hasDocumentFile) {
18144
+ const normalized = normalizeDocumentEntry(this.config.document);
18125
18145
  this.config.documents = [
18126
18146
  {
18127
- type: this.config.document.type,
18128
- data: this.config.document,
18129
- name: this.config.document.name,
18130
- isNewFile: true
18147
+ id: uuid.v4(),
18148
+ ...normalized
18131
18149
  }
18132
18150
  ];
18133
18151
  } else if (hasDocumentBlob) {
18134
- const docType = this.config.document.type || DOCX;
18135
- let extension = ".docx";
18136
- if (docType === PDF) {
18137
- extension = ".pdf";
18138
- } else if (docType === HTML) {
18139
- extension = ".html";
18140
- }
18152
+ const normalized = normalizeDocumentEntry(this.config.document);
18141
18153
  this.config.documents = [
18142
18154
  {
18143
- type: docType,
18144
- data: this.config.document,
18145
- name: `document${extension}`,
18146
- isNewFile: true
18155
+ id: uuid.v4(),
18156
+ ...normalized
18147
18157
  }
18148
18158
  ];
18149
18159
  }
18150
18160
  if (Array.isArray(this.config.documents) && this.config.documents.length > 0) {
18151
- this.config.documents = this.config.documents.map((d) => normalizeDocumentEntry(d));
18161
+ this.config.documents = this.config.documents.map((d) => {
18162
+ const normalized = normalizeDocumentEntry(d);
18163
+ if (!normalized || typeof normalized !== "object") {
18164
+ return normalized;
18165
+ }
18166
+ const existingId = typeof normalized === "object" && "id" in normalized && normalized.id || d && typeof d === "object" && "id" in d && d.id;
18167
+ return {
18168
+ ...normalized,
18169
+ id: existingId || uuid.v4()
18170
+ };
18171
+ });
18152
18172
  }
18153
18173
  }
18154
18174
  #initVueApp() {