@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,4 +1,4 @@
1
- import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DCADSoU6.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DxFe92HN.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-DCADSoU6.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-DxFe92HN.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-DiRUh82P.js";
17
+ import { D as DocxZipper } from "./docx-zipper-cuctY57Z.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -11017,10 +11017,12 @@ const _ExtensionService = class _ExtensionService {
11017
11017
  type: getNodeType(extension.name, this.schema)
11018
11018
  };
11019
11019
  const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
11020
- if (!addNodeView) return [];
11020
+ if (!addNodeView) return null;
11021
+ const nodeViewFunction = addNodeView();
11022
+ if (!nodeViewFunction) return null;
11021
11023
  const nodeview = (node, _view, getPos, decorations) => {
11022
11024
  const htmlAttributes = Attribute.getAttributesToRender(node, extensionAttrs);
11023
- return addNodeView()({
11025
+ return nodeViewFunction({
11024
11026
  editor,
11025
11027
  node,
11026
11028
  getPos,
@@ -11030,7 +11032,7 @@ const _ExtensionService = class _ExtensionService {
11030
11032
  });
11031
11033
  };
11032
11034
  return [extension.name, nodeview];
11033
- });
11035
+ }).filter(Boolean);
11034
11036
  return Object.fromEntries(entries);
11035
11037
  }
11036
11038
  };
@@ -11694,6 +11696,11 @@ const updateYdocDocxData = async (editor, ydoc) => {
11694
11696
  { event: "docx-update", user: editor.options.user }
11695
11697
  );
11696
11698
  };
11699
+ const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
11700
+ const applyStyleIsolationClass = (target) => {
11701
+ if (!target || !target.classList) return;
11702
+ target.classList.add(STYLE_ISOLATION_CLASS);
11703
+ };
11697
11704
  const PaginationPluginKey = new PluginKey("paginationPlugin");
11698
11705
  const initPaginationData = async (editor) => {
11699
11706
  if (!editor.converter) return;
@@ -11729,6 +11736,7 @@ const getSectionHeight = async (editor, data) => {
11729
11736
  return new Promise((resolve) => {
11730
11737
  const editorContainer = document.createElement("div");
11731
11738
  editorContainer.className = "super-editor";
11739
+ applyStyleIsolationClass(editorContainer);
11732
11740
  editorContainer.style.padding = "0";
11733
11741
  editorContainer.style.margin = "0";
11734
11742
  const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
@@ -11756,6 +11764,7 @@ const createHeaderFooterEditor = ({
11756
11764
  const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
11757
11765
  const fontSizeInPixles = fontSizePt * 1.3333;
11758
11766
  const lineHeight = fontSizeInPixles * 1.2;
11767
+ applyStyleIsolationClass(editorContainer);
11759
11768
  Object.assign(editorContainer.style, {
11760
11769
  padding: "0",
11761
11770
  margin: "0",
@@ -15055,7 +15064,7 @@ const _Editor = class _Editor extends EventEmitter {
15055
15064
  { default: remarkStringify },
15056
15065
  { default: remarkGfm }
15057
15066
  ] = await Promise.all([
15058
- import("./index-R92AJa-b.js"),
15067
+ import("./index-cOCdMICZ.js"),
15059
15068
  import("./index-DRCvimau.js"),
15060
15069
  import("./index-C_x_N6Uh.js"),
15061
15070
  import("./index-D_sWOSiG.js"),
@@ -15469,7 +15478,12 @@ initContainerElement_fn = function(options) {
15469
15478
  options.element.classList.add("sd-super-editor-html");
15470
15479
  }
15471
15480
  }
15472
- options.element = options.isHeadless ? null : options.element || document.createElement("div");
15481
+ if (options.isHeadless) {
15482
+ options.element = null;
15483
+ return;
15484
+ }
15485
+ options.element = options.element || document.createElement("div");
15486
+ applyStyleIsolationClass(options.element);
15473
15487
  };
15474
15488
  /**
15475
15489
  * Initialize the editor with the given options
@@ -20468,6 +20482,9 @@ function orderedListSync(editor) {
20468
20482
  }
20469
20483
  });
20470
20484
  }
20485
+ const shouldSkipNodeView = (editor) => {
20486
+ return editor.options.isHeadless;
20487
+ };
20471
20488
  const ListItem = Node$1.create({
20472
20489
  name: "listItem",
20473
20490
  content: "paragraph* block*",
@@ -20494,9 +20511,11 @@ const ListItem = Node$1.create({
20494
20511
  },
20495
20512
  /**
20496
20513
  * Important: The listItem node uses a custom node view.
20497
- * @returns {import('@core/NodeView.js').NodeView}
20514
+ * Skip node view in headless mode for performance.
20515
+ * @returns {import('@core/NodeView.js').NodeView|null}
20498
20516
  */
20499
20517
  addNodeView() {
20518
+ if (shouldSkipNodeView(this.editor)) return null;
20500
20519
  return ({ node, editor, getPos, decorations }) => {
20501
20520
  return new ListItemNodeView(node, getPos, decorations, editor);
20502
20521
  };
@@ -35608,6 +35627,7 @@ class Popover {
35608
35627
  this.view = view;
35609
35628
  this.popover = document.createElement("div");
35610
35629
  this.popover.className = "sd-editor-popover";
35630
+ applyStyleIsolationClass(this.popover);
35611
35631
  document.body.appendChild(this.popover);
35612
35632
  this.tippyInstance = tippy(this.popover, {
35613
35633
  trigger: "manual",
@@ -37024,6 +37044,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
37024
37044
  const tempContainer = editor.options.element.cloneNode();
37025
37045
  if (!tempContainer) return [];
37026
37046
  tempContainer.className = "temp-container super-editor";
37047
+ applyStyleIsolationClass(tempContainer);
37027
37048
  const HIDDEN_EDITOR_OFFSET_TOP = 0;
37028
37049
  const HIDDEN_EDITOR_OFFSET_LEFT = 0;
37029
37050
  tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
@@ -38072,6 +38093,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
38072
38093
  handleEl.style.pointerEvents = "auto";
38073
38094
  resizeContainer.appendChild(handleEl);
38074
38095
  }
38096
+ applyStyleIsolationClass(resizeContainer);
38075
38097
  document.body.appendChild(resizeContainer);
38076
38098
  updateHandlePositions(wrapper.firstElementChild);
38077
38099
  }
@@ -1,4 +1,4 @@
1
- import { aA as getDefaultExportFromCjs } from "./converter-DCADSoU6.js";
1
+ import { aA as getDefaultExportFromCjs } from "./converter-DxFe92HN.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-DCADSoU6.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-S-V_9zg8.js";
2
+ import { p as process$1 } from "./converter-DxFe92HN.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BTSjpY4Y.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-DCADSoU6.js";
1
+ import { a5 } from "./chunks/converter-DxFe92HN.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DCADSoU6.js";
2
- import { D } from "./chunks/docx-zipper-DiRUh82P.js";
1
+ import "./chunks/converter-DxFe92HN.js";
2
+ import { D } from "./chunks/docx-zipper-cuctY57Z.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-S-V_9zg8.js";
2
- import "./chunks/converter-DCADSoU6.js";
3
- import "./chunks/docx-zipper-DiRUh82P.js";
1
+ import { E } from "./chunks/editor-BTSjpY4Y.js";
2
+ import "./chunks/converter-DxFe92HN.js";
3
+ import "./chunks/docx-zipper-cuctY57Z.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-DiRUh82P.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-cuctY57Z.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -411,6 +411,16 @@ to {
411
411
  :root {
412
412
  /* CSS variables */
413
413
  }
414
+ .sd-editor-scoped,
415
+ .sd-editor-scoped :where(*),
416
+ .sd-editor-scoped :where(*::before),
417
+ .sd-editor-scoped :where(*::after) {
418
+ all: revert;
419
+ box-sizing: border-box;
420
+ }
421
+ .sd-editor-scoped {
422
+ display: block;
423
+ }
414
424
  .sd-input-active {
415
425
  border: 1px solid #1355ff !important;
416
426
  }
@@ -107,7 +107,7 @@ export const handleListNode: any;
107
107
  * @type {import("docxImporter").NodeHandlerEntry}
108
108
  */
109
109
  export const listHandlerEntity: any;
110
- export function getAbstractDefinition(numId: any, docx: any): import("./numberingCache.js").DocxXmlElement;
110
+ export function getAbstractDefinition(numId: any, docx: any, converter: any): import("./numberingCache.js").DocxXmlElement;
111
111
  export function generateListPath(level: any, numId: any, styleId: any, levels: any, docx: any): any[];
112
112
  export function getListLevelDefinitionTag(numId: string, level: string, pStyleId: any, docx: any): any;
113
113
  export namespace docxNumberingHelpers {
@@ -3,8 +3,8 @@ export const NUMBERING_CACHE_KEY: "numbering-cache";
3
3
  /** Symbol used to memoize level lookups on abstract numbering elements. */
4
4
  export const LEVELS_MAP_KEY: unique symbol;
5
5
  export function buildNumberingCache(docx: DocxPackage | null | undefined): NumberingCache;
6
- export function ensureNumberingCache(docx: DocxPackage | null | undefined): NumberingCache;
7
- export function getNumberingCache(docx: DocxPackage | null | undefined): NumberingCache;
6
+ export function ensureNumberingCache(docx: DocxPackage | null | undefined, converter?: any): NumberingCache;
7
+ export function getNumberingCache(converterOrDocx: any): NumberingCache;
8
8
  export type DocxXmlElement = {
9
9
  name?: string;
10
10
  attributes?: Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export function shouldSkipNodeView(editor: import("../core/Editor.js").Editor): boolean;
@@ -0,0 +1,2 @@
1
+ export const STYLE_ISOLATION_CLASS: "sd-editor-scoped";
2
+ export function applyStyleIsolationClass(target: HTMLElement): void;
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
12
- import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-DCADSoU6.js";
13
- import { c1, a5, i, a2 } from "./chunks/converter-DCADSoU6.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as collectTargetListItemPositions, d as getFileOpener, e as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, f as uploadAndInsertImage, h as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, j as undoDepth, k as redoDepth, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, m as getStarterExtensions, P as Placeholder, n as getRichTextExtensions, D as DecorationSet, o as Decoration, M as Mark, p as Extension, A as Attribute, N as Node } from "./chunks/editor-S-V_9zg8.js";
15
- import { v, C, w, T, q, x, t } from "./chunks/editor-S-V_9zg8.js";
12
+ import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-DxFe92HN.js";
13
+ import { c1, a5, i, a2 } from "./chunks/converter-DxFe92HN.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as collectTargetListItemPositions, d as getFileOpener, e as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, f as uploadAndInsertImage, h as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, j as undoDepth, k as redoDepth, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, m as getStarterExtensions, P as Placeholder, n as getRichTextExtensions, D as DecorationSet, o as Decoration, M as Mark, p as Extension, A as Attribute, N as Node } from "./chunks/editor-BTSjpY4Y.js";
15
+ import { v, C, w, T, q, x, t } from "./chunks/editor-BTSjpY4Y.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CKze0avT.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-Gu_ZGybk.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-DiRUh82P.js";
19
+ import { D } from "./chunks/docx-zipper-cuctY57Z.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-CKze0avT.js";
3
- import "./chunks/editor-S-V_9zg8.js";
2
+ import { T } from "./chunks/toolbar-Gu_ZGybk.js";
3
+ import "./chunks/editor-BTSjpY4Y.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-C7rGSq3G.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CJXnWitG.cjs");
4
4
  require("./chunks/vue-DKMj1I9B.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DmerK7HX.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DAv4HIUO.es.js";
2
2
  import "./chunks/vue-ZWZLQtoU.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-C7rGSq3G.cjs");
4
- const superdoc = require("./chunks/index-DXsRgDI8.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CJXnWitG.cjs");
4
+ const superdoc = require("./chunks/index-Cvt_Mp7t.cjs");
5
5
  require("./chunks/vue-DKMj1I9B.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DmerK7HX.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-QrjpYZxu.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DAv4HIUO.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-CKuWGcpN.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  export {
@@ -28333,7 +28333,23 @@
28333
28333
  ]
28334
28334
  };
28335
28335
  const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
28336
+ const NUMBERING_CACHE_KEY = "numbering-cache";
28336
28337
  const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
28338
+ const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
28339
+ const clearConverterCache = (converter) => {
28340
+ if (!converter) return;
28341
+ delete converter[NUMBERING_CACHE_KEY];
28342
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
28343
+ };
28344
+ const setConverterCache = (converter, cache2, docx) => {
28345
+ if (!converter) return;
28346
+ converter[NUMBERING_CACHE_KEY] = cache2;
28347
+ if (docx && typeof docx === "object") {
28348
+ converter[NUMBERING_CACHE_DOCX_KEY] = docx;
28349
+ } else {
28350
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
28351
+ }
28352
+ };
28337
28353
  const createEmptyCache = () => ({
28338
28354
  numToAbstractId: /* @__PURE__ */ new Map(),
28339
28355
  abstractById: /* @__PURE__ */ new Map(),
@@ -28405,12 +28421,27 @@
28405
28421
  }
28406
28422
  return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
28407
28423
  };
28408
- const ensureNumberingCache = (docx) => {
28424
+ const ensureNumberingCache = (docx, converter) => {
28425
+ if (converter?.[NUMBERING_CACHE_KEY]) {
28426
+ const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
28427
+ if (docx && cachedDocx && cachedDocx !== docx) {
28428
+ clearConverterCache(converter);
28429
+ } else {
28430
+ return converter[NUMBERING_CACHE_KEY];
28431
+ }
28432
+ }
28409
28433
  if (!docx || typeof docx !== "object") return createEmptyCache();
28410
28434
  const existingCache = docxNumberingCacheStore.get(docx);
28411
- if (existingCache) return existingCache;
28435
+ if (existingCache) {
28436
+ setConverterCache(converter, existingCache, docx);
28437
+ return existingCache;
28438
+ }
28412
28439
  const cache2 = buildNumberingCache(docx);
28413
- docxNumberingCacheStore.set(docx, cache2);
28440
+ if (converter) {
28441
+ setConverterCache(converter, cache2, docx);
28442
+ } else {
28443
+ docxNumberingCacheStore.set(docx, cache2);
28444
+ }
28414
28445
  return cache2;
28415
28446
  };
28416
28447
  const handleListNode = (params2) => {
@@ -28667,11 +28698,11 @@
28667
28698
  }
28668
28699
  return { numId, ilvl };
28669
28700
  };
28670
- const getAbstractDefinition = (numId, docx) => {
28701
+ const getAbstractDefinition = (numId, docx, converter) => {
28671
28702
  const numberingXml = docx["word/numbering.xml"];
28672
28703
  if (!numberingXml) return {};
28673
28704
  if (numId == null) return void 0;
28674
- const cache2 = ensureNumberingCache(docx);
28705
+ const cache2 = ensureNumberingCache(docx, converter);
28675
28706
  const numKey = String(numId);
28676
28707
  let listDefinitionForThisNumId = cache2.numToDefinition.get(numKey);
28677
28708
  if (!listDefinitionForThisNumId) {
@@ -32184,10 +32215,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32184
32215
  if (typeof numId === "string") numId = Number(numId);
32185
32216
  if (typeof level === "string") level = Number(level);
32186
32217
  const docx = editor?.converter?.convertedXml;
32187
- const numbering = editor?.converter?.numbering;
32218
+ const converter = editor?.converter;
32219
+ const numbering = converter?.numbering;
32188
32220
  const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
32189
32221
  const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
32190
- let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
32222
+ let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
32191
32223
  if (!abstractDefinition) {
32192
32224
  const listDef = numbering?.definitions?.[numId];
32193
32225
  const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
@@ -41261,7 +41293,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41261
41293
  comments,
41262
41294
  inlineDocumentFonts,
41263
41295
  linkedStyles: getStyleDefinitions(docx),
41264
- numbering: getNumberingDefinitions(docx)
41296
+ numbering: getNumberingDefinitions(docx, converter)
41265
41297
  };
41266
41298
  }
41267
41299
  return null;
@@ -41660,8 +41692,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41660
41692
  ]);
41661
41693
  return content2.filter((node2) => node2 && typeof node2.type === "string" && !INLINE_TYPES.has(node2.type));
41662
41694
  }
41663
- function getNumberingDefinitions(docx) {
41664
- const cache2 = ensureNumberingCache(docx);
41695
+ function getNumberingDefinitions(docx, converter) {
41696
+ const cache2 = ensureNumberingCache(docx, converter);
41665
41697
  const abstractDefinitions = {};
41666
41698
  cache2.abstractById.forEach((value, key2) => {
41667
41699
  const numericKey = Number(key2);
@@ -57462,10 +57494,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57462
57494
  type: getNodeType(extension.name, this.schema)
57463
57495
  };
57464
57496
  const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
57465
- if (!addNodeView) return [];
57497
+ if (!addNodeView) return null;
57498
+ const nodeViewFunction = addNodeView();
57499
+ if (!nodeViewFunction) return null;
57466
57500
  const nodeview = (node2, _view, getPos, decorations) => {
57467
57501
  const htmlAttributes = Attribute.getAttributesToRender(node2, extensionAttrs);
57468
- return addNodeView()({
57502
+ return nodeViewFunction({
57469
57503
  editor,
57470
57504
  node: node2,
57471
57505
  getPos,
@@ -57475,7 +57509,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57475
57509
  });
57476
57510
  };
57477
57511
  return [extension.name, nodeview];
57478
- });
57512
+ }).filter(Boolean);
57479
57513
  return Object.fromEntries(entries);
57480
57514
  }
57481
57515
  };
@@ -58130,6 +58164,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58130
58164
  { event: "docx-update", user: editor.options.user }
58131
58165
  );
58132
58166
  };
58167
+ const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
58168
+ const applyStyleIsolationClass = (target) => {
58169
+ if (!target || !target.classList) return;
58170
+ target.classList.add(STYLE_ISOLATION_CLASS);
58171
+ };
58133
58172
  const PaginationPluginKey = new PluginKey("paginationPlugin");
58134
58173
  const initPaginationData = async (editor) => {
58135
58174
  if (!editor.converter) return;
@@ -58165,6 +58204,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58165
58204
  return new Promise((resolve2) => {
58166
58205
  const editorContainer = document.createElement("div");
58167
58206
  editorContainer.className = "super-editor";
58207
+ applyStyleIsolationClass(editorContainer);
58168
58208
  editorContainer.style.padding = "0";
58169
58209
  editorContainer.style.margin = "0";
58170
58210
  const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
@@ -58192,6 +58232,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58192
58232
  const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
58193
58233
  const fontSizeInPixles = fontSizePt * 1.3333;
58194
58234
  const lineHeight2 = fontSizeInPixles * 1.2;
58235
+ applyStyleIsolationClass(editorContainer);
58195
58236
  Object.assign(editorContainer.style, {
58196
58237
  padding: "0",
58197
58238
  margin: "0",
@@ -61444,7 +61485,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61444
61485
  { default: remarkStringify2 },
61445
61486
  { default: remarkGfm2 }
61446
61487
  ] = await Promise.all([
61447
- Promise.resolve().then(() => indexR92AJaB),
61488
+ Promise.resolve().then(() => indexCOCdMICZ),
61448
61489
  Promise.resolve().then(() => indexDRCvimau),
61449
61490
  Promise.resolve().then(() => indexC_x_N6Uh),
61450
61491
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -61853,7 +61894,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61853
61894
  options.element.classList.add("sd-super-editor-html");
61854
61895
  }
61855
61896
  }
61856
- options.element = options.isHeadless ? null : options.element || document.createElement("div");
61897
+ if (options.isHeadless) {
61898
+ options.element = null;
61899
+ return;
61900
+ }
61901
+ options.element = options.element || document.createElement("div");
61902
+ applyStyleIsolationClass(options.element);
61857
61903
  };
61858
61904
  init_fn = function() {
61859
61905
  __privateMethod$1(this, _Editor_instances, createExtensionService_fn).call(this);
@@ -66736,6 +66782,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66736
66782
  }
66737
66783
  });
66738
66784
  }
66785
+ const shouldSkipNodeView = (editor) => {
66786
+ return editor.options.isHeadless;
66787
+ };
66739
66788
  const ListItem = Node$1.create({
66740
66789
  name: "listItem",
66741
66790
  content: "paragraph* block*",
@@ -66762,9 +66811,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66762
66811
  },
66763
66812
  /**
66764
66813
  * Important: The listItem node uses a custom node view.
66765
- * @returns {import('@core/NodeView.js').NodeView}
66814
+ * Skip node view in headless mode for performance.
66815
+ * @returns {import('@core/NodeView.js').NodeView|null}
66766
66816
  */
66767
66817
  addNodeView() {
66818
+ if (shouldSkipNodeView(this.editor)) return null;
66768
66819
  return ({ node: node2, editor, getPos, decorations }) => {
66769
66820
  return new ListItemNodeView(node2, getPos, decorations, editor);
66770
66821
  };
@@ -81876,6 +81927,7 @@ ${l}
81876
81927
  this.view = view;
81877
81928
  this.popover = document.createElement("div");
81878
81929
  this.popover.className = "sd-editor-popover";
81930
+ applyStyleIsolationClass(this.popover);
81879
81931
  document.body.appendChild(this.popover);
81880
81932
  this.tippyInstance = tippy(this.popover, {
81881
81933
  trigger: "manual",
@@ -83292,6 +83344,7 @@ ${l}
83292
83344
  const tempContainer = editor.options.element.cloneNode();
83293
83345
  if (!tempContainer) return [];
83294
83346
  tempContainer.className = "temp-container super-editor";
83347
+ applyStyleIsolationClass(tempContainer);
83295
83348
  const HIDDEN_EDITOR_OFFSET_TOP = 0;
83296
83349
  const HIDDEN_EDITOR_OFFSET_LEFT = 0;
83297
83350
  tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
@@ -84340,6 +84393,7 @@ ${l}
84340
84393
  handleEl.style.pointerEvents = "auto";
84341
84394
  resizeContainer.appendChild(handleEl);
84342
84395
  }
84396
+ applyStyleIsolationClass(resizeContainer);
84343
84397
  document.body.appendChild(resizeContainer);
84344
84398
  updateHandlePositions(wrapper.firstElementChild);
84345
84399
  }
@@ -119960,7 +120014,7 @@ ${style2}
119960
120014
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
119961
120015
  );
119962
120016
  }
119963
- const indexR92AJaB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120017
+ const indexCOCdMICZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119964
120018
  __proto__: null,
119965
120019
  unified
119966
120020
  }, Symbol.toStringTag, { value: "Module" }));