@harbour-enterprises/superdoc 0.19.0-next.4 → 0.19.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 (62) hide show
  1. package/dist/chunks/{PdfViewer-DmC4Qg1S.cjs → PdfViewer-BlV8_l4e.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-Df9H8xeA.es.js → PdfViewer-oqYWe1FJ.es.js} +1 -1
  3. package/dist/chunks/{index-C_oHQN7n.es.js → index-CeockUQz.es.js} +35 -3
  4. package/dist/chunks/{index-CWQGBk3Z.cjs → index-DHyh73q4.cjs} +35 -3
  5. package/dist/chunks/{super-editor.es-C2QwEj1z.es.js → super-editor.es-BRBU19lM.es.js} +614 -295
  6. package/dist/chunks/{super-editor.es-B_u6OGsf.cjs → super-editor.es-bu-RKSWh.cjs} +614 -295
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/stores/superdoc-store.d.ts +3 -0
  9. package/dist/stores/superdoc-store.d.ts.map +1 -1
  10. package/dist/style.css +6 -6
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-CMajoq-M.js → converter-BFq1XXek.js} +472 -208
  13. package/dist/super-editor/chunks/{docx-zipper-C5rg6GNf.js → docx-zipper-BahUy6FS.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-CH3sE8Fq.js → editor-BdLd21gy.js} +135 -85
  15. package/dist/super-editor/chunks/{toolbar-BHnLBr61.js → toolbar-DoJY1zlM.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/super-converter/exporter.d.ts +0 -7
  21. package/dist/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +0 -22
  22. package/dist/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +37 -0
  23. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cantSplit/cantSplit-translator.d.ts +6 -0
  24. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cantSplit/index.d.ts +1 -0
  25. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cnfStyle/cnfStyle-translator.d.ts +7 -0
  26. package/dist/super-editor/src/core/super-converter/v3/handlers/w/cnfStyle/index.d.ts +1 -0
  27. package/dist/super-editor/src/core/super-converter/v3/handlers/w/divId/divId-translator.d.ts +6 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/w/divId/index.d.ts +1 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridAfter/gridAfter-translator.d.ts +6 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridAfter/index.d.ts +1 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridBefore/gridBefore-translator.d.ts +6 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridBefore/index.d.ts +1 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/w/hidden/hidden-translator.d.ts +6 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/hidden/index.d.ts +1 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/index.d.ts +1 -0
  36. package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/jc-translator.d.ts +6 -0
  37. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellSpacing/index.d.ts +1 -0
  38. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellSpacing/tblCellSpacing-translator.d.ts +6 -0
  39. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblHeader/index.d.ts +1 -0
  40. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblHeader/tblHeader-translator.d.ts +6 -0
  41. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tr/index.d.ts +1 -0
  42. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-translator.d.ts +7 -0
  43. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trHeight/index.d.ts +1 -0
  44. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trHeight/trHeight-translator.d.ts +6 -0
  45. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trPr/index.d.ts +1 -0
  46. package/dist/super-editor/src/core/super-converter/v3/handlers/w/trPr/trPr-translator.d.ts +5 -0
  47. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wAfter/index.d.ts +1 -0
  48. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wAfter/wAfter-translator.d.ts +6 -0
  49. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wBefore/index.d.ts +1 -0
  50. package/dist/super-editor/src/core/super-converter/v3/handlers/w/wBefore/wBefore-translator.d.ts +6 -0
  51. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
  52. package/dist/super-editor/src/extensions/table-row/table-row.d.ts +149 -0
  53. package/dist/super-editor/style.css +6 -6
  54. package/dist/super-editor/super-editor.es.js +13 -8
  55. package/dist/super-editor/toolbar.es.js +2 -2
  56. package/dist/super-editor.cjs +1 -1
  57. package/dist/super-editor.es.js +1 -1
  58. package/dist/superdoc.cjs +2 -2
  59. package/dist/superdoc.es.js +2 -2
  60. package/dist/superdoc.umd.js +647 -296
  61. package/dist/superdoc.umd.js.map +1 -1
  62. package/package.json +1 -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-CWQGBk3Z.cjs");
4
+ const superdoc = require("./index-DHyh73q4.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-C_oHQN7n.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-CeockUQz.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-C2QwEj1z.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-BRBU19lM.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";
@@ -3959,6 +3959,7 @@ function useDocument(params2, superdocConfig) {
3959
3959
  }
3960
3960
  const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
3961
3961
  const currentConfig = ref(null);
3962
+ let exceptionHandler = null;
3962
3963
  const commentsStore = useCommentsStore();
3963
3964
  const documents = ref([]);
3964
3965
  const documentBounds = ref([]);
@@ -3993,6 +3994,13 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
3993
3994
  scrollTop: 0,
3994
3995
  scrollLeft: 0
3995
3996
  });
3997
+ const setExceptionHandler = (handler) => {
3998
+ exceptionHandler = typeof handler === "function" ? handler : null;
3999
+ };
4000
+ const emitException = (payload) => {
4001
+ const handler = exceptionHandler || currentConfig.value?.onException;
4002
+ if (typeof handler === "function") handler(payload);
4003
+ };
3996
4004
  const init2 = async (config) => {
3997
4005
  reset();
3998
4006
  currentConfig.value = config;
@@ -4018,11 +4026,30 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4018
4026
  const initializeDocuments = async (docsToProcess = []) => {
4019
4027
  if (!docsToProcess) return [];
4020
4028
  for (let doc of docsToProcess) {
4029
+ if (!doc) {
4030
+ emitException({
4031
+ error: new Error("Received empty document entry during initialization."),
4032
+ stage: "document-init",
4033
+ document: doc
4034
+ });
4035
+ console.warn("[superdoc] Skipping empty document entry.");
4036
+ continue;
4037
+ }
4021
4038
  try {
4022
4039
  let docWithData = await _initializeDocumentData(doc);
4040
+ if (!docWithData) {
4041
+ emitException({
4042
+ error: new Error("Document could not be initialized with the provided configuration."),
4043
+ stage: "document-init",
4044
+ document: doc
4045
+ });
4046
+ console.warn("[superdoc] Skipping document due to invalid configuration:", doc);
4047
+ continue;
4048
+ }
4023
4049
  const smartDoc = useDocument(docWithData, currentConfig.value);
4024
4050
  documents.value.push(smartDoc);
4025
4051
  } catch (e) {
4052
+ emitException({ error: e, stage: "document-init", document: doc });
4026
4053
  console.warn("[superdoc] Error initializing document:", doc, "with error:", e, "Skipping document.");
4027
4054
  }
4028
4055
  }
@@ -4066,7 +4093,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4066
4093
  const fileObject = await getFileObject(doc.url, doc.name || "document", doc.type);
4067
4094
  return { ...doc, data: fileObject };
4068
4095
  }
4069
- throw new Error("Document could not be initialized:", doc);
4096
+ return null;
4070
4097
  };
4071
4098
  const areDocumentsReady = computed(() => {
4072
4099
  for (let obj of documents.value.filter((doc) => doc.type === "pdf")) {
@@ -4116,6 +4143,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4116
4143
  areDocumentsReady,
4117
4144
  // Actions
4118
4145
  init: init2,
4146
+ setExceptionHandler,
4119
4147
  reset,
4120
4148
  handlePageReady,
4121
4149
  getDocument,
@@ -17341,7 +17369,7 @@ const _sfc_main = {
17341
17369
  __name: "SuperDoc",
17342
17370
  emits: ["selection-update"],
17343
17371
  setup(__props, { emit: __emit }) {
17344
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Df9H8xeA.es.js"));
17372
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-oqYWe1FJ.es.js"));
17345
17373
  const superdocStore = useSuperdocStore();
17346
17374
  const commentsStore = useCommentsStore();
17347
17375
  const {
@@ -18092,6 +18120,9 @@ class SuperDoc extends EventEmitter {
18092
18120
  this.superdocStore = superdocStore;
18093
18121
  this.commentsStore = commentsStore;
18094
18122
  this.highContrastModeStore = highContrastModeStore;
18123
+ if (typeof this.superdocStore.setExceptionHandler === "function") {
18124
+ this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
18125
+ }
18095
18126
  this.superdocStore.init(this.config);
18096
18127
  this.commentsStore.init(this.config.modules.comments);
18097
18128
  }
@@ -18287,6 +18318,7 @@ class SuperDoc extends EventEmitter {
18287
18318
  };
18288
18319
  this.toolbar = new SuperToolbar(config);
18289
18320
  this.toolbar.on("superdoc-command", this.onToolbarCommand.bind(this));
18321
+ this.toolbar.on("exception", this.config.onException);
18290
18322
  this.once("editorCreate", () => this.toolbar.updateToolbarState());
18291
18323
  }
18292
18324
  /**
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-B_u6OGsf.cjs");
2
+ const superEditor_es = require("./super-editor.es-bu-RKSWh.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");
@@ -3976,6 +3976,7 @@ function useDocument(params2, superdocConfig) {
3976
3976
  }
3977
3977
  const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
3978
3978
  const currentConfig = vue.ref(null);
3979
+ let exceptionHandler = null;
3979
3980
  const commentsStore = useCommentsStore();
3980
3981
  const documents = vue.ref([]);
3981
3982
  const documentBounds = vue.ref([]);
@@ -4010,6 +4011,13 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4010
4011
  scrollTop: 0,
4011
4012
  scrollLeft: 0
4012
4013
  });
4014
+ const setExceptionHandler = (handler) => {
4015
+ exceptionHandler = typeof handler === "function" ? handler : null;
4016
+ };
4017
+ const emitException = (payload) => {
4018
+ const handler = exceptionHandler || currentConfig.value?.onException;
4019
+ if (typeof handler === "function") handler(payload);
4020
+ };
4013
4021
  const init2 = async (config) => {
4014
4022
  reset();
4015
4023
  currentConfig.value = config;
@@ -4035,11 +4043,30 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4035
4043
  const initializeDocuments = async (docsToProcess = []) => {
4036
4044
  if (!docsToProcess) return [];
4037
4045
  for (let doc of docsToProcess) {
4046
+ if (!doc) {
4047
+ emitException({
4048
+ error: new Error("Received empty document entry during initialization."),
4049
+ stage: "document-init",
4050
+ document: doc
4051
+ });
4052
+ console.warn("[superdoc] Skipping empty document entry.");
4053
+ continue;
4054
+ }
4038
4055
  try {
4039
4056
  let docWithData = await _initializeDocumentData(doc);
4057
+ if (!docWithData) {
4058
+ emitException({
4059
+ error: new Error("Document could not be initialized with the provided configuration."),
4060
+ stage: "document-init",
4061
+ document: doc
4062
+ });
4063
+ console.warn("[superdoc] Skipping document due to invalid configuration:", doc);
4064
+ continue;
4065
+ }
4040
4066
  const smartDoc = useDocument(docWithData, currentConfig.value);
4041
4067
  documents.value.push(smartDoc);
4042
4068
  } catch (e) {
4069
+ emitException({ error: e, stage: "document-init", document: doc });
4043
4070
  console.warn("[superdoc] Error initializing document:", doc, "with error:", e, "Skipping document.");
4044
4071
  }
4045
4072
  }
@@ -4083,7 +4110,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4083
4110
  const fileObject = await getFileObject(doc.url, doc.name || "document", doc.type);
4084
4111
  return { ...doc, data: fileObject };
4085
4112
  }
4086
- throw new Error("Document could not be initialized:", doc);
4113
+ return null;
4087
4114
  };
4088
4115
  const areDocumentsReady = vue.computed(() => {
4089
4116
  for (let obj of documents.value.filter((doc) => doc.type === "pdf")) {
@@ -4133,6 +4160,7 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4133
4160
  areDocumentsReady,
4134
4161
  // Actions
4135
4162
  init: init2,
4163
+ setExceptionHandler,
4136
4164
  reset,
4137
4165
  handlePageReady,
4138
4166
  getDocument,
@@ -17358,7 +17386,7 @@ const _sfc_main = {
17358
17386
  __name: "SuperDoc",
17359
17387
  emits: ["selection-update"],
17360
17388
  setup(__props, { emit: __emit }) {
17361
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DmC4Qg1S.cjs")));
17389
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BlV8_l4e.cjs")));
17362
17390
  const superdocStore = useSuperdocStore();
17363
17391
  const commentsStore = useCommentsStore();
17364
17392
  const {
@@ -18109,6 +18137,9 @@ class SuperDoc extends eventemitter3.EventEmitter {
18109
18137
  this.superdocStore = superdocStore;
18110
18138
  this.commentsStore = commentsStore;
18111
18139
  this.highContrastModeStore = highContrastModeStore;
18140
+ if (typeof this.superdocStore.setExceptionHandler === "function") {
18141
+ this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
18142
+ }
18112
18143
  this.superdocStore.init(this.config);
18113
18144
  this.commentsStore.init(this.config.modules.comments);
18114
18145
  }
@@ -18304,6 +18335,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18304
18335
  };
18305
18336
  this.toolbar = new superEditor_es.SuperToolbar(config);
18306
18337
  this.toolbar.on("superdoc-command", this.onToolbarCommand.bind(this));
18338
+ this.toolbar.on("exception", this.config.onException);
18307
18339
  this.once("editorCreate", () => this.toolbar.updateToolbarState());
18308
18340
  }
18309
18341
  /**