@harbour-enterprises/superdoc 0.28.0-next.16 → 0.28.0-next.18

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 (34) hide show
  1. package/dist/chunks/{PdfViewer-qq7VuheG.cjs → PdfViewer-Dh7WsKri.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-511UYFts.es.js → PdfViewer-lJ94RgIW.es.js} +1 -1
  3. package/dist/chunks/{index-QrjpYZxu.es.js → index-CKuWGcpN.es.js} +2 -2
  4. package/dist/chunks/{index-DXsRgDI8.cjs → index-Cvt_Mp7t.cjs} +2 -2
  5. package/dist/chunks/{index-R92AJa-b-814itwOQ.cjs → index-cOCdMICZ-BikinkL4.cjs} +1 -1
  6. package/dist/chunks/{index-R92AJa-b-BK_BPu-7.es.js → index-cOCdMICZ-_r2V8YNJ.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-C7rGSq3G.cjs → super-editor.es-CJXnWitG.cjs} +70 -16
  8. package/dist/chunks/{super-editor.es-DmerK7HX.es.js → super-editor.es-DAv4HIUO.es.js} +70 -16
  9. package/dist/core/types/index.d.ts.map +1 -1
  10. package/dist/style.css +10 -0
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-DCADSoU6.js → converter-DxFe92HN.js} +42 -10
  13. package/dist/super-editor/chunks/{docx-zipper-DiRUh82P.js → docx-zipper-cuctY57Z.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-S-V_9zg8.js → editor-BTSjpY4Y.js} +30 -8
  15. package/dist/super-editor/chunks/{index-R92AJa-b.js → index-cOCdMICZ.js} +1 -1
  16. package/dist/super-editor/chunks/{toolbar-CKze0avT.js → toolbar-Gu_ZGybk.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/v2/importer/listImporter.d.ts +1 -1
  23. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/numberingCache.d.ts +2 -2
  24. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
  25. package/dist/super-editor/super-editor/src/utils/styleIsolation.d.ts +2 -0
  26. package/dist/super-editor/super-editor.es.js +6 -6
  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 +71 -17
  33. package/dist/superdoc.umd.js.map +1 -1
  34. 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-DKMj1I9B.cjs");
4
- const superdoc = require("./index-DXsRgDI8.cjs");
4
+ const superdoc = require("./index-Cvt_Mp7t.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-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-QrjpYZxu.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-CKuWGcpN.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -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-DmerK7HX.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-DAv4HIUO.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";
@@ -17156,7 +17156,7 @@ const _sfc_main = {
17156
17156
  __name: "SuperDoc",
17157
17157
  emits: ["selection-update"],
17158
17158
  setup(__props, { emit: __emit }) {
17159
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-511UYFts.es.js"));
17159
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-lJ94RgIW.es.js"));
17160
17160
  const superdocStore = useSuperdocStore();
17161
17161
  const commentsStore = useCommentsStore();
17162
17162
  const {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-C7rGSq3G.cjs");
2
+ const superEditor_es = require("./super-editor.es-CJXnWitG.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");
@@ -17173,7 +17173,7 @@ const _sfc_main = {
17173
17173
  __name: "SuperDoc",
17174
17174
  emits: ["selection-update"],
17175
17175
  setup(__props, { emit: __emit }) {
17176
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-qq7VuheG.cjs")));
17176
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Dh7WsKri.cjs")));
17177
17177
  const superdocStore = useSuperdocStore();
17178
17178
  const commentsStore = useCommentsStore();
17179
17179
  const {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-C7rGSq3G.cjs");
3
+ const superEditor_es = require("./super-editor.es-CJXnWitG.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DmerK7HX.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DAv4HIUO.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -20608,7 +20608,23 @@ const baseNumbering = {
20608
20608
  ]
20609
20609
  };
20610
20610
  const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
20611
+ const NUMBERING_CACHE_KEY = "numbering-cache";
20611
20612
  const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
20613
+ const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
20614
+ const clearConverterCache = (converter) => {
20615
+ if (!converter) return;
20616
+ delete converter[NUMBERING_CACHE_KEY];
20617
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20618
+ };
20619
+ const setConverterCache = (converter, cache2, docx) => {
20620
+ if (!converter) return;
20621
+ converter[NUMBERING_CACHE_KEY] = cache2;
20622
+ if (docx && typeof docx === "object") {
20623
+ converter[NUMBERING_CACHE_DOCX_KEY] = docx;
20624
+ } else {
20625
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20626
+ }
20627
+ };
20612
20628
  const createEmptyCache = () => ({
20613
20629
  numToAbstractId: /* @__PURE__ */ new Map(),
20614
20630
  abstractById: /* @__PURE__ */ new Map(),
@@ -20680,12 +20696,27 @@ const buildNumberingCache = (docx) => {
20680
20696
  }
20681
20697
  return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
20682
20698
  };
20683
- const ensureNumberingCache = (docx) => {
20699
+ const ensureNumberingCache = (docx, converter) => {
20700
+ if (converter?.[NUMBERING_CACHE_KEY]) {
20701
+ const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
20702
+ if (docx && cachedDocx && cachedDocx !== docx) {
20703
+ clearConverterCache(converter);
20704
+ } else {
20705
+ return converter[NUMBERING_CACHE_KEY];
20706
+ }
20707
+ }
20684
20708
  if (!docx || typeof docx !== "object") return createEmptyCache();
20685
20709
  const existingCache = docxNumberingCacheStore.get(docx);
20686
- if (existingCache) return existingCache;
20710
+ if (existingCache) {
20711
+ setConverterCache(converter, existingCache, docx);
20712
+ return existingCache;
20713
+ }
20687
20714
  const cache2 = buildNumberingCache(docx);
20688
- docxNumberingCacheStore.set(docx, cache2);
20715
+ if (converter) {
20716
+ setConverterCache(converter, cache2, docx);
20717
+ } else {
20718
+ docxNumberingCacheStore.set(docx, cache2);
20719
+ }
20689
20720
  return cache2;
20690
20721
  };
20691
20722
  const handleListNode = (params2) => {
@@ -20942,11 +20973,11 @@ const getListNumIdFromStyleRef = (styleId, docx) => {
20942
20973
  }
20943
20974
  return { numId, ilvl };
20944
20975
  };
20945
- const getAbstractDefinition = (numId, docx) => {
20976
+ const getAbstractDefinition = (numId, docx, converter) => {
20946
20977
  const numberingXml = docx["word/numbering.xml"];
20947
20978
  if (!numberingXml) return {};
20948
20979
  if (numId == null) return void 0;
20949
- const cache2 = ensureNumberingCache(docx);
20980
+ const cache2 = ensureNumberingCache(docx, converter);
20950
20981
  const numKey = String(numId);
20951
20982
  let listDefinitionForThisNumId = cache2.numToDefinition.get(numKey);
20952
20983
  if (!listDefinitionForThisNumId) {
@@ -24459,10 +24490,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
24459
24490
  if (typeof numId === "string") numId = Number(numId);
24460
24491
  if (typeof level === "string") level = Number(level);
24461
24492
  const docx = editor?.converter?.convertedXml;
24462
- const numbering = editor?.converter?.numbering;
24493
+ const converter = editor?.converter;
24494
+ const numbering = converter?.numbering;
24463
24495
  const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
24464
24496
  const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
24465
- let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
24497
+ let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
24466
24498
  if (!abstractDefinition) {
24467
24499
  const listDef = numbering?.definitions?.[numId];
24468
24500
  const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
@@ -33563,7 +33595,7 @@ const createDocumentJson = (docx, converter, editor) => {
33563
33595
  comments,
33564
33596
  inlineDocumentFonts,
33565
33597
  linkedStyles: getStyleDefinitions(docx),
33566
- numbering: getNumberingDefinitions(docx)
33598
+ numbering: getNumberingDefinitions(docx, converter)
33567
33599
  };
33568
33600
  }
33569
33601
  return null;
@@ -33962,8 +33994,8 @@ function filterOutRootInlineNodes(content = []) {
33962
33994
  ]);
33963
33995
  return content.filter((node) => node && typeof node.type === "string" && !INLINE_TYPES.has(node.type));
33964
33996
  }
33965
- function getNumberingDefinitions(docx) {
33966
- const cache2 = ensureNumberingCache(docx);
33997
+ function getNumberingDefinitions(docx, converter) {
33998
+ const cache2 = ensureNumberingCache(docx, converter);
33967
33999
  const abstractDefinitions = {};
33968
34000
  cache2.abstractById.forEach((value, key2) => {
33969
34001
  const numericKey = Number(key2);
@@ -49764,10 +49796,12 @@ const _ExtensionService = class _ExtensionService2 {
49764
49796
  type: getNodeType(extension.name, this.schema)
49765
49797
  };
49766
49798
  const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
49767
- if (!addNodeView) return [];
49799
+ if (!addNodeView) return null;
49800
+ const nodeViewFunction = addNodeView();
49801
+ if (!nodeViewFunction) return null;
49768
49802
  const nodeview = (node, _view, getPos, decorations) => {
49769
49803
  const htmlAttributes = Attribute2.getAttributesToRender(node, extensionAttrs);
49770
- return addNodeView()({
49804
+ return nodeViewFunction({
49771
49805
  editor,
49772
49806
  node,
49773
49807
  getPos,
@@ -49777,7 +49811,7 @@ const _ExtensionService = class _ExtensionService2 {
49777
49811
  });
49778
49812
  };
49779
49813
  return [extension.name, nodeview];
49780
- });
49814
+ }).filter(Boolean);
49781
49815
  return Object.fromEntries(entries);
49782
49816
  }
49783
49817
  };
@@ -50432,6 +50466,11 @@ const updateYdocDocxData = async (editor, ydoc) => {
50432
50466
  { event: "docx-update", user: editor.options.user }
50433
50467
  );
50434
50468
  };
50469
+ const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
50470
+ const applyStyleIsolationClass = (target) => {
50471
+ if (!target || !target.classList) return;
50472
+ target.classList.add(STYLE_ISOLATION_CLASS);
50473
+ };
50435
50474
  const PaginationPluginKey = new PluginKey("paginationPlugin");
50436
50475
  const initPaginationData = async (editor) => {
50437
50476
  if (!editor.converter) return;
@@ -50467,6 +50506,7 @@ const getSectionHeight = async (editor, data) => {
50467
50506
  return new Promise((resolve) => {
50468
50507
  const editorContainer = document.createElement("div");
50469
50508
  editorContainer.className = "super-editor";
50509
+ applyStyleIsolationClass(editorContainer);
50470
50510
  editorContainer.style.padding = "0";
50471
50511
  editorContainer.style.margin = "0";
50472
50512
  const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
@@ -50494,6 +50534,7 @@ const createHeaderFooterEditor = ({
50494
50534
  const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
50495
50535
  const fontSizeInPixles = fontSizePt * 1.3333;
50496
50536
  const lineHeight2 = fontSizeInPixles * 1.2;
50537
+ applyStyleIsolationClass(editorContainer);
50497
50538
  Object.assign(editorContainer.style, {
50498
50539
  padding: "0",
50499
50540
  margin: "0",
@@ -53746,7 +53787,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53746
53787
  { default: remarkStringify },
53747
53788
  { default: remarkGfm }
53748
53789
  ] = await Promise.all([
53749
- Promise.resolve().then(() => require("./index-R92AJa-b-814itwOQ.cjs")),
53790
+ Promise.resolve().then(() => require("./index-cOCdMICZ-BikinkL4.cjs")),
53750
53791
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
53751
53792
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
53752
53793
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -54155,7 +54196,12 @@ initContainerElement_fn = function(options) {
54155
54196
  options.element.classList.add("sd-super-editor-html");
54156
54197
  }
54157
54198
  }
54158
- options.element = options.isHeadless ? null : options.element || document.createElement("div");
54199
+ if (options.isHeadless) {
54200
+ options.element = null;
54201
+ return;
54202
+ }
54203
+ options.element = options.element || document.createElement("div");
54204
+ applyStyleIsolationClass(options.element);
54159
54205
  };
54160
54206
  init_fn = function() {
54161
54207
  __privateMethod$1(this, _Editor_instances, createExtensionService_fn).call(this);
@@ -59038,6 +59084,9 @@ function orderedListSync(editor) {
59038
59084
  }
59039
59085
  });
59040
59086
  }
59087
+ const shouldSkipNodeView = (editor) => {
59088
+ return editor.options.isHeadless;
59089
+ };
59041
59090
  const ListItem = Node$1.create({
59042
59091
  name: "listItem",
59043
59092
  content: "paragraph* block*",
@@ -59064,9 +59113,11 @@ const ListItem = Node$1.create({
59064
59113
  },
59065
59114
  /**
59066
59115
  * Important: The listItem node uses a custom node view.
59067
- * @returns {import('@core/NodeView.js').NodeView}
59116
+ * Skip node view in headless mode for performance.
59117
+ * @returns {import('@core/NodeView.js').NodeView|null}
59068
59118
  */
59069
59119
  addNodeView() {
59120
+ if (shouldSkipNodeView(this.editor)) return null;
59070
59121
  return ({ node, editor, getPos, decorations }) => {
59071
59122
  return new ListItemNodeView(node, getPos, decorations, editor);
59072
59123
  };
@@ -74178,6 +74229,7 @@ class Popover {
74178
74229
  this.view = view;
74179
74230
  this.popover = document.createElement("div");
74180
74231
  this.popover.className = "sd-editor-popover";
74232
+ applyStyleIsolationClass(this.popover);
74181
74233
  document.body.appendChild(this.popover);
74182
74234
  this.tippyInstance = tippy(this.popover, {
74183
74235
  trigger: "manual",
@@ -75594,6 +75646,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
75594
75646
  const tempContainer = editor.options.element.cloneNode();
75595
75647
  if (!tempContainer) return [];
75596
75648
  tempContainer.className = "temp-container super-editor";
75649
+ applyStyleIsolationClass(tempContainer);
75597
75650
  const HIDDEN_EDITOR_OFFSET_TOP = 0;
75598
75651
  const HIDDEN_EDITOR_OFFSET_LEFT = 0;
75599
75652
  tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
@@ -76642,6 +76695,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
76642
76695
  handleEl.style.pointerEvents = "auto";
76643
76696
  resizeContainer.appendChild(handleEl);
76644
76697
  }
76698
+ applyStyleIsolationClass(resizeContainer);
76645
76699
  document.body.appendChild(resizeContainer);
76646
76700
  updateHandlePositions(wrapper.firstElementChild);
76647
76701
  }
@@ -20591,7 +20591,23 @@ const baseNumbering = {
20591
20591
  ]
20592
20592
  };
20593
20593
  const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
20594
+ const NUMBERING_CACHE_KEY = "numbering-cache";
20594
20595
  const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
20596
+ const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
20597
+ const clearConverterCache = (converter) => {
20598
+ if (!converter) return;
20599
+ delete converter[NUMBERING_CACHE_KEY];
20600
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20601
+ };
20602
+ const setConverterCache = (converter, cache2, docx) => {
20603
+ if (!converter) return;
20604
+ converter[NUMBERING_CACHE_KEY] = cache2;
20605
+ if (docx && typeof docx === "object") {
20606
+ converter[NUMBERING_CACHE_DOCX_KEY] = docx;
20607
+ } else {
20608
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20609
+ }
20610
+ };
20595
20611
  const createEmptyCache = () => ({
20596
20612
  numToAbstractId: /* @__PURE__ */ new Map(),
20597
20613
  abstractById: /* @__PURE__ */ new Map(),
@@ -20663,12 +20679,27 @@ const buildNumberingCache = (docx) => {
20663
20679
  }
20664
20680
  return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
20665
20681
  };
20666
- const ensureNumberingCache = (docx) => {
20682
+ const ensureNumberingCache = (docx, converter) => {
20683
+ if (converter?.[NUMBERING_CACHE_KEY]) {
20684
+ const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
20685
+ if (docx && cachedDocx && cachedDocx !== docx) {
20686
+ clearConverterCache(converter);
20687
+ } else {
20688
+ return converter[NUMBERING_CACHE_KEY];
20689
+ }
20690
+ }
20667
20691
  if (!docx || typeof docx !== "object") return createEmptyCache();
20668
20692
  const existingCache = docxNumberingCacheStore.get(docx);
20669
- if (existingCache) return existingCache;
20693
+ if (existingCache) {
20694
+ setConverterCache(converter, existingCache, docx);
20695
+ return existingCache;
20696
+ }
20670
20697
  const cache2 = buildNumberingCache(docx);
20671
- docxNumberingCacheStore.set(docx, cache2);
20698
+ if (converter) {
20699
+ setConverterCache(converter, cache2, docx);
20700
+ } else {
20701
+ docxNumberingCacheStore.set(docx, cache2);
20702
+ }
20672
20703
  return cache2;
20673
20704
  };
20674
20705
  const handleListNode = (params2) => {
@@ -20925,11 +20956,11 @@ const getListNumIdFromStyleRef = (styleId, docx) => {
20925
20956
  }
20926
20957
  return { numId, ilvl };
20927
20958
  };
20928
- const getAbstractDefinition = (numId, docx) => {
20959
+ const getAbstractDefinition = (numId, docx, converter) => {
20929
20960
  const numberingXml = docx["word/numbering.xml"];
20930
20961
  if (!numberingXml) return {};
20931
20962
  if (numId == null) return void 0;
20932
- const cache2 = ensureNumberingCache(docx);
20963
+ const cache2 = ensureNumberingCache(docx, converter);
20933
20964
  const numKey = String(numId);
20934
20965
  let listDefinitionForThisNumId = cache2.numToDefinition.get(numKey);
20935
20966
  if (!listDefinitionForThisNumId) {
@@ -24442,10 +24473,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
24442
24473
  if (typeof numId === "string") numId = Number(numId);
24443
24474
  if (typeof level === "string") level = Number(level);
24444
24475
  const docx = editor?.converter?.convertedXml;
24445
- const numbering = editor?.converter?.numbering;
24476
+ const converter = editor?.converter;
24477
+ const numbering = converter?.numbering;
24446
24478
  const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
24447
24479
  const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
24448
- let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
24480
+ let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
24449
24481
  if (!abstractDefinition) {
24450
24482
  const listDef = numbering?.definitions?.[numId];
24451
24483
  const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
@@ -33546,7 +33578,7 @@ const createDocumentJson = (docx, converter, editor) => {
33546
33578
  comments,
33547
33579
  inlineDocumentFonts,
33548
33580
  linkedStyles: getStyleDefinitions(docx),
33549
- numbering: getNumberingDefinitions(docx)
33581
+ numbering: getNumberingDefinitions(docx, converter)
33550
33582
  };
33551
33583
  }
33552
33584
  return null;
@@ -33945,8 +33977,8 @@ function filterOutRootInlineNodes(content = []) {
33945
33977
  ]);
33946
33978
  return content.filter((node) => node && typeof node.type === "string" && !INLINE_TYPES.has(node.type));
33947
33979
  }
33948
- function getNumberingDefinitions(docx) {
33949
- const cache2 = ensureNumberingCache(docx);
33980
+ function getNumberingDefinitions(docx, converter) {
33981
+ const cache2 = ensureNumberingCache(docx, converter);
33950
33982
  const abstractDefinitions = {};
33951
33983
  cache2.abstractById.forEach((value, key2) => {
33952
33984
  const numericKey = Number(key2);
@@ -49747,10 +49779,12 @@ const _ExtensionService = class _ExtensionService2 {
49747
49779
  type: getNodeType(extension.name, this.schema)
49748
49780
  };
49749
49781
  const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
49750
- if (!addNodeView) return [];
49782
+ if (!addNodeView) return null;
49783
+ const nodeViewFunction = addNodeView();
49784
+ if (!nodeViewFunction) return null;
49751
49785
  const nodeview = (node, _view, getPos, decorations) => {
49752
49786
  const htmlAttributes = Attribute2.getAttributesToRender(node, extensionAttrs);
49753
- return addNodeView()({
49787
+ return nodeViewFunction({
49754
49788
  editor,
49755
49789
  node,
49756
49790
  getPos,
@@ -49760,7 +49794,7 @@ const _ExtensionService = class _ExtensionService2 {
49760
49794
  });
49761
49795
  };
49762
49796
  return [extension.name, nodeview];
49763
- });
49797
+ }).filter(Boolean);
49764
49798
  return Object.fromEntries(entries);
49765
49799
  }
49766
49800
  };
@@ -50415,6 +50449,11 @@ const updateYdocDocxData = async (editor, ydoc) => {
50415
50449
  { event: "docx-update", user: editor.options.user }
50416
50450
  );
50417
50451
  };
50452
+ const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
50453
+ const applyStyleIsolationClass = (target) => {
50454
+ if (!target || !target.classList) return;
50455
+ target.classList.add(STYLE_ISOLATION_CLASS);
50456
+ };
50418
50457
  const PaginationPluginKey = new PluginKey("paginationPlugin");
50419
50458
  const initPaginationData = async (editor) => {
50420
50459
  if (!editor.converter) return;
@@ -50450,6 +50489,7 @@ const getSectionHeight = async (editor, data) => {
50450
50489
  return new Promise((resolve) => {
50451
50490
  const editorContainer = document.createElement("div");
50452
50491
  editorContainer.className = "super-editor";
50492
+ applyStyleIsolationClass(editorContainer);
50453
50493
  editorContainer.style.padding = "0";
50454
50494
  editorContainer.style.margin = "0";
50455
50495
  const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
@@ -50477,6 +50517,7 @@ const createHeaderFooterEditor = ({
50477
50517
  const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
50478
50518
  const fontSizeInPixles = fontSizePt * 1.3333;
50479
50519
  const lineHeight2 = fontSizeInPixles * 1.2;
50520
+ applyStyleIsolationClass(editorContainer);
50480
50521
  Object.assign(editorContainer.style, {
50481
50522
  padding: "0",
50482
50523
  margin: "0",
@@ -53729,7 +53770,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53729
53770
  { default: remarkStringify },
53730
53771
  { default: remarkGfm }
53731
53772
  ] = await Promise.all([
53732
- import("./index-R92AJa-b-BK_BPu-7.es.js"),
53773
+ import("./index-cOCdMICZ-_r2V8YNJ.es.js"),
53733
53774
  import("./index-DRCvimau-Cw339678.es.js"),
53734
53775
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
53735
53776
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -54138,7 +54179,12 @@ initContainerElement_fn = function(options) {
54138
54179
  options.element.classList.add("sd-super-editor-html");
54139
54180
  }
54140
54181
  }
54141
- options.element = options.isHeadless ? null : options.element || document.createElement("div");
54182
+ if (options.isHeadless) {
54183
+ options.element = null;
54184
+ return;
54185
+ }
54186
+ options.element = options.element || document.createElement("div");
54187
+ applyStyleIsolationClass(options.element);
54142
54188
  };
54143
54189
  init_fn = function() {
54144
54190
  __privateMethod$1(this, _Editor_instances, createExtensionService_fn).call(this);
@@ -59021,6 +59067,9 @@ function orderedListSync(editor) {
59021
59067
  }
59022
59068
  });
59023
59069
  }
59070
+ const shouldSkipNodeView = (editor) => {
59071
+ return editor.options.isHeadless;
59072
+ };
59024
59073
  const ListItem = Node$1.create({
59025
59074
  name: "listItem",
59026
59075
  content: "paragraph* block*",
@@ -59047,9 +59096,11 @@ const ListItem = Node$1.create({
59047
59096
  },
59048
59097
  /**
59049
59098
  * Important: The listItem node uses a custom node view.
59050
- * @returns {import('@core/NodeView.js').NodeView}
59099
+ * Skip node view in headless mode for performance.
59100
+ * @returns {import('@core/NodeView.js').NodeView|null}
59051
59101
  */
59052
59102
  addNodeView() {
59103
+ if (shouldSkipNodeView(this.editor)) return null;
59053
59104
  return ({ node, editor, getPos, decorations }) => {
59054
59105
  return new ListItemNodeView(node, getPos, decorations, editor);
59055
59106
  };
@@ -74161,6 +74212,7 @@ class Popover {
74161
74212
  this.view = view;
74162
74213
  this.popover = document.createElement("div");
74163
74214
  this.popover.className = "sd-editor-popover";
74215
+ applyStyleIsolationClass(this.popover);
74164
74216
  document.body.appendChild(this.popover);
74165
74217
  this.tippyInstance = tippy(this.popover, {
74166
74218
  trigger: "manual",
@@ -75577,6 +75629,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
75577
75629
  const tempContainer = editor.options.element.cloneNode();
75578
75630
  if (!tempContainer) return [];
75579
75631
  tempContainer.className = "temp-container super-editor";
75632
+ applyStyleIsolationClass(tempContainer);
75580
75633
  const HIDDEN_EDITOR_OFFSET_TOP = 0;
75581
75634
  const HIDDEN_EDITOR_OFFSET_LEFT = 0;
75582
75635
  tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
@@ -76625,6 +76678,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
76625
76678
  handleEl.style.pointerEvents = "auto";
76626
76679
  resizeContainer.appendChild(handleEl);
76627
76680
  }
76681
+ applyStyleIsolationClass(resizeContainer);
76628
76682
  document.body.appendChild(resizeContainer);
76629
76683
  updateHandlePositions(wrapper.firstElementChild);
76630
76684
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.js"],"names":[],"mappings":";;;;;;;UAEc,MAAM;;;;WACN,MAAM;;;;YACN,MAAM,GAAG,IAAI;;;;;;;;;cAKb,OAAO;;;;iBACP,MAAM;;;;eACN,MAAM;;;;sBACN,MAAM;;;;;;SAKN,MAAM;;;;UACN,MAAM;;;;WACN,IAAI,GAAG,IAAI,GAAG,IAAI;;;;WAClB,MAAM;;;;UACN,MAAM;;;;gBACN,OAAO;;;;WACP,OAAO,KAAK,EAAE,GAAG;;;;eACjB,OAAO,sBAAsB,EAAE,kBAAkB;;;;;;eAM5D;QAQqC,kBAAkB,GAR5C,CAAC,MAAM,EAAE;YAClB,UAAU,EAAE,MAAM,CAAC;YACnB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,UAAU,CAAC,EAAE,OAAO,CAAC;YACrB,OAAO,CAAC,EAAE,MAAS,IAAI,CAAC;YACxB,aAAa,CAAC,EAAE,MAAS,IAAI,CAAC;YAC9B,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;YAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;SAC5B,KAAK,OAAO,GAAG,SAAS;KACzB;;;;SACA;QAAuB,MAAM,GAAlB,MAAM;QACM,QAAQ,GAApB,MAAM;KACjB;;;;;;;;;;;;gBAGA;QAA6B,WAAW;QACR,YAAY;QACb,mBAAmB,GAAvC,OAAO;KACpB;;;;;;;;;;;;;;sBA0F4q1f,aAAa;;;;;;;;;;;yBAA4uJ,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAA44a,aAAa;sBAA/vuB,aAAa;8CAAizX,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAA86tB,U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M;;;;cACN,OAAO"}
package/dist/style.css CHANGED
@@ -785,6 +785,16 @@ to {
785
785
  :root {
786
786
  /* CSS variables */
787
787
  }
788
+ .sd-editor-scoped,
789
+ .sd-editor-scoped :where(*),
790
+ .sd-editor-scoped :where(*::before),
791
+ .sd-editor-scoped :where(*::after) {
792
+ all: revert;
793
+ box-sizing: border-box;
794
+ }
795
+ .sd-editor-scoped {
796
+ display: block;
797
+ }
788
798
  .sd-input-active {
789
799
  border: 1px solid #1355ff !important;
790
800
  }
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-DCADSoU6.js";
3
- import { _ as _export_sfc } from "./chunks/editor-S-V_9zg8.js";
2
+ import { T as TextSelection } from "./chunks/converter-DxFe92HN.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-BTSjpY4Y.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -20589,7 +20589,23 @@ const baseNumbering = {
20589
20589
  ]
20590
20590
  };
20591
20591
  const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
20592
+ const NUMBERING_CACHE_KEY = "numbering-cache";
20592
20593
  const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
20594
+ const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
20595
+ const clearConverterCache = (converter) => {
20596
+ if (!converter) return;
20597
+ delete converter[NUMBERING_CACHE_KEY];
20598
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20599
+ };
20600
+ const setConverterCache = (converter, cache, docx) => {
20601
+ if (!converter) return;
20602
+ converter[NUMBERING_CACHE_KEY] = cache;
20603
+ if (docx && typeof docx === "object") {
20604
+ converter[NUMBERING_CACHE_DOCX_KEY] = docx;
20605
+ } else {
20606
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20607
+ }
20608
+ };
20593
20609
  const createEmptyCache = () => ({
20594
20610
  numToAbstractId: /* @__PURE__ */ new Map(),
20595
20611
  abstractById: /* @__PURE__ */ new Map(),
@@ -20661,12 +20677,27 @@ const buildNumberingCache = (docx) => {
20661
20677
  }
20662
20678
  return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
20663
20679
  };
20664
- const ensureNumberingCache = (docx) => {
20680
+ const ensureNumberingCache = (docx, converter) => {
20681
+ if (converter?.[NUMBERING_CACHE_KEY]) {
20682
+ const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
20683
+ if (docx && cachedDocx && cachedDocx !== docx) {
20684
+ clearConverterCache(converter);
20685
+ } else {
20686
+ return converter[NUMBERING_CACHE_KEY];
20687
+ }
20688
+ }
20665
20689
  if (!docx || typeof docx !== "object") return createEmptyCache();
20666
20690
  const existingCache = docxNumberingCacheStore.get(docx);
20667
- if (existingCache) return existingCache;
20691
+ if (existingCache) {
20692
+ setConverterCache(converter, existingCache, docx);
20693
+ return existingCache;
20694
+ }
20668
20695
  const cache = buildNumberingCache(docx);
20669
- docxNumberingCacheStore.set(docx, cache);
20696
+ if (converter) {
20697
+ setConverterCache(converter, cache, docx);
20698
+ } else {
20699
+ docxNumberingCacheStore.set(docx, cache);
20700
+ }
20670
20701
  return cache;
20671
20702
  };
20672
20703
  const handleListNode = (params) => {
@@ -20923,11 +20954,11 @@ const getListNumIdFromStyleRef = (styleId, docx) => {
20923
20954
  }
20924
20955
  return { numId, ilvl };
20925
20956
  };
20926
- const getAbstractDefinition = (numId, docx) => {
20957
+ const getAbstractDefinition = (numId, docx, converter) => {
20927
20958
  const numberingXml = docx["word/numbering.xml"];
20928
20959
  if (!numberingXml) return {};
20929
20960
  if (numId == null) return void 0;
20930
- const cache = ensureNumberingCache(docx);
20961
+ const cache = ensureNumberingCache(docx, converter);
20931
20962
  const numKey = String(numId);
20932
20963
  let listDefinitionForThisNumId = cache.numToDefinition.get(numKey);
20933
20964
  if (!listDefinitionForThisNumId) {
@@ -24440,10 +24471,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
24440
24471
  if (typeof numId === "string") numId = Number(numId);
24441
24472
  if (typeof level === "string") level = Number(level);
24442
24473
  const docx = editor?.converter?.convertedXml;
24443
- const numbering = editor?.converter?.numbering;
24474
+ const converter = editor?.converter;
24475
+ const numbering = converter?.numbering;
24444
24476
  const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
24445
24477
  const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
24446
- let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
24478
+ let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
24447
24479
  if (!abstractDefinition) {
24448
24480
  const listDef = numbering?.definitions?.[numId];
24449
24481
  const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
@@ -33553,7 +33585,7 @@ const createDocumentJson = (docx, converter, editor) => {
33553
33585
  comments,
33554
33586
  inlineDocumentFonts,
33555
33587
  linkedStyles: getStyleDefinitions(docx),
33556
- numbering: getNumberingDefinitions(docx)
33588
+ numbering: getNumberingDefinitions(docx, converter)
33557
33589
  };
33558
33590
  }
33559
33591
  return null;
@@ -33952,8 +33984,8 @@ function filterOutRootInlineNodes(content = []) {
33952
33984
  ]);
33953
33985
  return content.filter((node) => node && typeof node.type === "string" && !INLINE_TYPES.has(node.type));
33954
33986
  }
33955
- function getNumberingDefinitions(docx) {
33956
- const cache = ensureNumberingCache(docx);
33987
+ function getNumberingDefinitions(docx, converter) {
33988
+ const cache = ensureNumberingCache(docx, converter);
33957
33989
  const abstractDefinitions = {};
33958
33990
  cache.abstractById.forEach((value, key) => {
33959
33991
  const numericKey = Number(key);