@harbour-enterprises/superdoc 1.0.0-beta.93 → 1.0.0-beta.95

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-DbMCgjlc.cjs → PdfViewer--l9mxuw6.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DDlUqq8s.es.js → PdfViewer-DC5ZtOHL.es.js} +1 -1
  3. package/dist/chunks/{index-CIyFPdjr.cjs → index-DA6_gKCn.cjs} +3 -3
  4. package/dist/chunks/{index-Cyp2JwAE-BDSzsvVr.cjs → index-DJD7xO_i-CVT8OSh8.cjs} +1 -1
  5. package/dist/chunks/{index-Cyp2JwAE-C4V2XscX.es.js → index-DJD7xO_i-DlZGZmeW.es.js} +1 -1
  6. package/dist/chunks/{index-D1G3HZnw.es.js → index-D_AIVJix.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-CZ_EMz2h.cjs → super-editor.es-DLfNMkAR.cjs} +188 -23
  8. package/dist/chunks/{super-editor.es-BLW0IRfr.es.js → super-editor.es-L0F8-awY.es.js} +188 -23
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CvPb50HR.js → converter-CAiO-oW4.js} +26 -2
  11. package/dist/super-editor/chunks/{docx-zipper-BWUuyGDp.js → docx-zipper-DRP7HhmI.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CsWOz21v.js → editor-D5oQ83xJ.js} +164 -23
  13. package/dist/super-editor/chunks/{index-Cyp2JwAE.js → index-DJD7xO_i.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DjWypz4_.js → toolbar-ax2sbcF_.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +190 -25
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { aK as getDefaultExportFromCjs } from "./converter-CvPb50HR.js";
1
+ import { aK as getDefaultExportFromCjs } from "./converter-CAiO-oW4.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, onMounted, onBeforeUnmount, createVNode, readonly, watch, 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-CvPb50HR.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CsWOz21v.js";
2
+ import { p as process$1 } from "./converter-CAiO-oW4.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-D5oQ83xJ.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 { ac } from "./chunks/converter-CvPb50HR.js";
1
+ import { ac } from "./chunks/converter-CAiO-oW4.js";
2
2
  export {
3
3
  ac as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-CvPb50HR.js";
2
- import { D } from "./chunks/docx-zipper-BWUuyGDp.js";
1
+ import "./chunks/converter-CAiO-oW4.js";
2
+ import { D } from "./chunks/docx-zipper-DRP7HhmI.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-CsWOz21v.js";
2
- import "./chunks/converter-CvPb50HR.js";
3
- import "./chunks/docx-zipper-BWUuyGDp.js";
1
+ import { E } from "./chunks/editor-D5oQ83xJ.js";
2
+ import "./chunks/converter-CAiO-oW4.js";
3
+ import "./chunks/docx-zipper-DRP7HhmI.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-BWUuyGDp.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-DRP7HhmI.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -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 _MARK_TOGGLE_NAMES, _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn, syncStickyMarksFromState_fn, restoreStickyMarksIfNeeded_fn, ensureStoredMarksForMarkToggle_fn;
12
- import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-CvPb50HR.js";
13
- import { ac, i, a9, aQ } from "./chunks/converter-CvPb50HR.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as generateRulerDefinition, n as clampHandlePosition, o as calculateMarginFromHandle, p as measureCache, q as isHeadless, E as Editor, t as getStarterExtensions, P as PresentationEditor, v as Placeholder, w as getRichTextExtensions, D as DecorationSet, x as Decoration, M as Mark, z as Extension, A as Attribute, N as Node } from "./chunks/editor-CsWOz21v.js";
15
- import { F, I, G, T, B, H, C } from "./chunks/editor-CsWOz21v.js";
12
+ import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-CAiO-oW4.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-CAiO-oW4.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as generateRulerDefinition, n as clampHandlePosition, o as calculateMarginFromHandle, p as measureCache, q as isHeadless, E as Editor, t as getStarterExtensions, P as PresentationEditor, v as Placeholder, w as getRichTextExtensions, D as DecorationSet, x as Decoration, M as Mark, z as Extension, A as Attribute, N as Node } from "./chunks/editor-D5oQ83xJ.js";
15
+ import { F, I, G, T, B, H, C } from "./chunks/editor-D5oQ83xJ.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, defineComponent, reactive, onUnmounted, renderSlot, useCssVars, shallowRef, createBlock, Teleport, 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-DjWypz4_.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-ax2sbcF_.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-BWUuyGDp.js";
19
+ import { D } from "./chunks/docx-zipper-DRP7HhmI.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-DjWypz4_.js";
3
- import "./chunks/editor-CsWOz21v.js";
2
+ import { T } from "./chunks/toolbar-ax2sbcF_.js";
3
+ import "./chunks/editor-D5oQ83xJ.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-CZ_EMz2h.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DLfNMkAR.cjs");
4
4
  require("./chunks/vue-jWLMl8Ts.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, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-BLW0IRfr.es.js";
1
+ import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-L0F8-awY.es.js";
2
2
  import "./chunks/vue-Dysv_7z5.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-CZ_EMz2h.cjs");
4
- const superdoc = require("./chunks/index-CIyFPdjr.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DLfNMkAR.cjs");
4
+ const superdoc = require("./chunks/index-DA6_gKCn.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BLW0IRfr.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-D1G3HZnw.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-L0F8-awY.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-D_AIVJix.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -42236,6 +42236,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42236
42236
  }
42237
42237
  return false;
42238
42238
  }
42239
+ /**
42240
+ * Extracts the namespace prefix from an element name.
42241
+ *
42242
+ * @private
42243
+ * @static
42244
+ * @param {string} elementName - The element name (may include namespace prefix, e.g., 'op:Properties')
42245
+ * @returns {string} The namespace prefix (e.g., 'op') or empty string if no prefix
42246
+ *
42247
+ * @example
42248
+ * _extractNamespacePrefix('op:Properties') // => 'op'
42249
+ * _extractNamespacePrefix('Properties') // => ''
42250
+ * _extractNamespacePrefix('custom:property') // => 'custom'
42251
+ */
42252
+ static _extractNamespacePrefix(elementName) {
42253
+ if (!elementName || typeof elementName !== "string") return "";
42254
+ const colonIndex = elementName.indexOf(":");
42255
+ return colonIndex > 0 ? elementName.slice(0, colonIndex) : "";
42256
+ }
42239
42257
  /**
42240
42258
  * Generic method to get a stored custom property from docx.
42241
42259
  * Supports both standard and custom namespace prefixes (e.g., 'op:Properties', 'custom:property').
@@ -42334,6 +42352,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42334
42352
  const properties = customXml.elements?.find((el) => _SuperConverter2._matchesElementName(el.name, "Properties"));
42335
42353
  if (!properties) return null;
42336
42354
  if (!properties.elements) properties.elements = [];
42355
+ const namespacePrefix = _SuperConverter2._extractNamespacePrefix(properties.name);
42356
+ const propertyElementName = namespacePrefix ? `${namespacePrefix}:property` : "property";
42337
42357
  let property2 = properties.elements.find(
42338
42358
  (el) => _SuperConverter2._matchesElementName(el.name, "property") && el.attributes?.name === propertyName
42339
42359
  );
@@ -42350,7 +42370,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42350
42370
  const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
42351
42371
  property2 = {
42352
42372
  type: "element",
42353
- name: "property",
42373
+ name: propertyElementName,
42354
42374
  attributes: {
42355
42375
  name: propertyName,
42356
42376
  fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
@@ -42371,6 +42391,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42371
42391
  };
42372
42392
  properties.elements.push(property2);
42373
42393
  } else {
42394
+ const existingPropertyPrefix = _SuperConverter2._extractNamespacePrefix(property2.name);
42395
+ if (existingPropertyPrefix !== namespacePrefix) {
42396
+ property2.name = propertyElementName;
42397
+ }
42374
42398
  if (!property2.elements?.[0]?.elements?.[0]) {
42375
42399
  console.warn(`Malformed property structure for "${propertyName}", recreating structure`);
42376
42400
  property2.elements = [
@@ -42398,7 +42422,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42398
42422
  static getStoredSuperdocVersion(docx) {
42399
42423
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42400
42424
  }
42401
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.93") {
42425
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.95") {
42402
42426
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42403
42427
  }
42404
42428
  /**
@@ -64405,12 +64429,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64405
64429
  const { doc: doc2 } = tr;
64406
64430
  const startPos = Math.max(from2 - offset2, 0);
64407
64431
  const endPos = Math.min(to + offset2, doc2.content.size);
64408
- let markFound;
64409
- doc2.nodesBetween(startPos, endPos, (node2, pos) => {
64432
+ let markFound = null;
64433
+ const tryMatch = (node2, pos) => {
64410
64434
  if (!node2 || node2?.nodeSize === void 0) {
64411
64435
  return;
64412
64436
  }
64413
- const mark2 = node2.marks.find(
64437
+ const mark2 = node2.marks?.find(
64414
64438
  (mark22) => mark22.type.name === markName && Object.keys(attrs).every((attr) => mark22.attrs[attr] === attrs[attr])
64415
64439
  );
64416
64440
  if (mark2 && !markFound) {
@@ -64419,24 +64443,36 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64419
64443
  to: pos + node2.nodeSize,
64420
64444
  mark: mark2
64421
64445
  };
64446
+ return false;
64422
64447
  }
64448
+ };
64449
+ doc2.nodesBetween(startPos, endPos, (node2, pos) => {
64450
+ return tryMatch(node2, pos);
64423
64451
  });
64424
- const nodeAtEndPosition = doc2.nodeAt(endPos);
64425
- if (nodeAtEndPosition?.type?.name === "run") {
64426
- const node2 = nodeAtEndPosition.content?.content?.[0];
64427
- const isTextNode = node2?.type?.name === "text";
64428
- if (isTextNode) {
64429
- const mark2 = node2.marks.find(
64430
- (mark22) => mark22.type.name === markName && Object.keys(attrs).every((attr) => mark22.attrs[attr] === attrs[attr])
64431
- );
64432
- if (mark2 && !markFound) {
64433
- markFound = {
64434
- from: endPos,
64435
- to: endPos + node2.nodeSize,
64436
- mark: mark2
64437
- };
64452
+ const inspectAroundPosition = (pos) => {
64453
+ if (pos < 0 || pos > doc2.content.size) {
64454
+ return;
64455
+ }
64456
+ const resolved = doc2.resolve(pos);
64457
+ const before = resolved.nodeBefore;
64458
+ if (before?.type?.name === "run") {
64459
+ const beforeStart = Math.max(pos - before.nodeSize, 0);
64460
+ const node2 = before.content?.content?.[0];
64461
+ if (node2?.type?.name === "text") {
64462
+ tryMatch(node2, beforeStart);
64438
64463
  }
64439
64464
  }
64465
+ const after = resolved.nodeAfter;
64466
+ if (after?.type?.name === "run") {
64467
+ const node2 = after.content?.content?.[0];
64468
+ if (node2?.type?.name === "text") {
64469
+ tryMatch(node2, pos);
64470
+ }
64471
+ }
64472
+ };
64473
+ if (!markFound) {
64474
+ inspectAroundPosition(startPos);
64475
+ inspectAroundPosition(endPos);
64440
64476
  }
64441
64477
  return markFound;
64442
64478
  };
@@ -67461,7 +67497,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67461
67497
  const shouldSkipNodeView = (editor) => {
67462
67498
  return isHeadless(editor);
67463
67499
  };
67464
- const summaryVersion = "1.0.0-beta.93";
67500
+ const summaryVersion = "1.0.0-beta.95";
67465
67501
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67466
67502
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67467
67503
  function mapAttributes(attrs) {
@@ -68250,7 +68286,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68250
68286
  { default: remarkStringify2 },
68251
68287
  { default: remarkGfm2 }
68252
68288
  ] = await Promise.all([
68253
- Promise.resolve().then(() => indexCyp2JwAE),
68289
+ Promise.resolve().then(() => indexDJD7xO_i),
68254
68290
  Promise.resolve().then(() => indexDRCvimau),
68255
68291
  Promise.resolve().then(() => indexC_x_N6Uh),
68256
68292
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68455,7 +68491,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68455
68491
  * Process collaboration migrations
68456
68492
  */
68457
68493
  processCollaborationMigrations() {
68458
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.93");
68494
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.95");
68459
68495
  if (!this.options.ydoc) return;
68460
68496
  const metaMap = this.options.ydoc.getMap("meta");
68461
68497
  let docVersion = metaMap.get("version");
@@ -85332,7 +85368,9 @@ ${l}
85332
85368
  textRun.letterSpacing != null ? textRun.letterSpacing : "",
85333
85369
  textRun.pmStart ?? "",
85334
85370
  textRun.pmEnd ?? "",
85335
- textRun.token ?? ""
85371
+ textRun.token ?? "",
85372
+ // Tracked changes - force re-render when added or removed tracked change
85373
+ textRun.trackedChange ? 1 : 0
85336
85374
  ].join(",");
85337
85375
  }).join("|");
85338
85376
  const attrs = block.attrs;
@@ -92882,6 +92920,104 @@ ${l}
92882
92920
  const wordStartChar = charPosInRun;
92883
92921
  const wordEndNoSpace = charPosInRun + word.length;
92884
92922
  const wordEndWithSpace = charPosInRun + (isLastWord ? word.length : word.length + 1);
92923
+ const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
92924
+ if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
92925
+ if (currentLine && currentLine.width > 0 && currentLine.segments.length > 0) {
92926
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
92927
+ const { spaceCount: _sc, ...lineBase } = currentLine;
92928
+ const completedLine = { ...lineBase, ...metrics };
92929
+ addBarTabsToLine(completedLine);
92930
+ lines.push(completedLine);
92931
+ tabStopCursor = 0;
92932
+ pendingTabAlignment = null;
92933
+ currentLine = null;
92934
+ }
92935
+ const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
92936
+ const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
92937
+ const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
92938
+ const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
92939
+ const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX, font, ctx2, run2);
92940
+ let chunkCharOffset = wordStartChar;
92941
+ for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
92942
+ const chunk = chunks[chunkIndex];
92943
+ const chunkStartChar = chunkCharOffset;
92944
+ const chunkEndChar = chunkCharOffset + chunk.text.length;
92945
+ const isLastChunk = chunkIndex === chunks.length - 1;
92946
+ const isFirstChunk = chunkIndex === 0;
92947
+ if (isFirstChunk && hasTabOnlyLine && currentLine) {
92948
+ currentLine.toRun = runIndex;
92949
+ currentLine.toChar = chunkEndChar;
92950
+ currentLine.width = roundValue(currentLine.width + chunk.width);
92951
+ currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
92952
+ currentLine.maxFontInfo = getFontInfoFromRun(run2);
92953
+ currentLine.segments.push({
92954
+ runIndex,
92955
+ fromChar: chunkStartChar,
92956
+ toChar: chunkEndChar,
92957
+ width: chunk.width
92958
+ });
92959
+ if (isLastChunk) {
92960
+ const ls = run2.letterSpacing ?? 0;
92961
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
92962
+ currentLine.toChar = wordEndWithSpace;
92963
+ currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
92964
+ charPosInRun = wordEndWithSpace;
92965
+ currentLine.spaceCount += 1;
92966
+ } else {
92967
+ charPosInRun = wordEndWithSpace;
92968
+ }
92969
+ } else {
92970
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
92971
+ const { spaceCount: _sc, ...lineBase } = currentLine;
92972
+ const completedLine = { ...lineBase, ...metrics };
92973
+ addBarTabsToLine(completedLine);
92974
+ lines.push(completedLine);
92975
+ tabStopCursor = 0;
92976
+ pendingTabAlignment = null;
92977
+ currentLine = null;
92978
+ }
92979
+ } else if (isLastChunk) {
92980
+ currentLine = {
92981
+ fromRun: runIndex,
92982
+ fromChar: chunkStartChar,
92983
+ toRun: runIndex,
92984
+ toChar: chunkEndChar,
92985
+ width: chunk.width,
92986
+ maxFontSize: run2.fontSize,
92987
+ maxFontInfo: getFontInfoFromRun(run2),
92988
+ maxWidth: getEffectiveWidth(contentWidth),
92989
+ segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
92990
+ spaceCount: 0
92991
+ };
92992
+ const ls = run2.letterSpacing ?? 0;
92993
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
92994
+ currentLine.toChar = wordEndWithSpace;
92995
+ currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
92996
+ charPosInRun = wordEndWithSpace;
92997
+ currentLine.spaceCount += 1;
92998
+ } else {
92999
+ charPosInRun = wordEndWithSpace;
93000
+ }
93001
+ } else {
93002
+ const chunkLineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
93003
+ const metrics = calculateTypographyMetrics(run2.fontSize, spacing, getFontInfoFromRun(run2));
93004
+ const chunkLine = {
93005
+ fromRun: runIndex,
93006
+ fromChar: chunkStartChar,
93007
+ toRun: runIndex,
93008
+ toChar: chunkEndChar,
93009
+ width: chunk.width,
93010
+ maxWidth: chunkLineMaxWidth,
93011
+ segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
93012
+ ...metrics
93013
+ };
93014
+ addBarTabsToLine(chunkLine);
93015
+ lines.push(chunkLine);
93016
+ }
93017
+ chunkCharOffset = chunkEndChar;
93018
+ }
93019
+ continue;
93020
+ }
92885
93021
  if (!currentLine) {
92886
93022
  currentLine = {
92887
93023
  fromRun: runIndex,
@@ -93460,6 +93596,35 @@ ${l}
93460
93596
  const width = getMeasuredTextWidth(text2, font, letterSpacing, ctx2);
93461
93597
  return roundValue(width);
93462
93598
  };
93599
+ const breakWordIntoChunks = (word, maxWidth, font, ctx2, run2) => {
93600
+ const chunks = [];
93601
+ if (maxWidth <= 0) {
93602
+ for (const char of word) {
93603
+ const charWidth = measureRunWidth(char, font, ctx2, run2);
93604
+ chunks.push({ text: char, width: charWidth });
93605
+ }
93606
+ return chunks;
93607
+ }
93608
+ let currentChunk = "";
93609
+ let currentWidth = 0;
93610
+ for (let i2 = 0; i2 < word.length; i2++) {
93611
+ const char = word[i2];
93612
+ const testChunk = currentChunk + char;
93613
+ const testWidth = measureRunWidth(testChunk, font, ctx2, run2);
93614
+ if (testWidth > maxWidth && currentChunk.length > 0) {
93615
+ chunks.push({ text: currentChunk, width: currentWidth });
93616
+ currentChunk = char;
93617
+ currentWidth = measureRunWidth(char, font, ctx2, run2);
93618
+ } else {
93619
+ currentChunk = testChunk;
93620
+ currentWidth = testWidth;
93621
+ }
93622
+ }
93623
+ if (currentChunk.length > 0) {
93624
+ chunks.push({ text: currentChunk, width: currentWidth });
93625
+ }
93626
+ return chunks;
93627
+ };
93463
93628
  const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
93464
93629
  if (!segments) return;
93465
93630
  const last = segments[segments.length - 1];
@@ -151785,7 +151950,7 @@ ${style2}
151785
151950
  this.config.colors = shuffleArray(this.config.colors);
151786
151951
  this.userColorMap = /* @__PURE__ */ new Map();
151787
151952
  this.colorIndex = 0;
151788
- this.version = "1.0.0-beta.93";
151953
+ this.version = "1.0.0-beta.95";
151789
151954
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151790
151955
  this.superdocId = config2.superdocId || v4();
151791
151956
  this.colors = this.config.colors;
@@ -154257,7 +154422,7 @@ ${style2}
154257
154422
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
154258
154423
  );
154259
154424
  }
154260
- const indexCyp2JwAE = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154425
+ const indexDJD7xO_i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154261
154426
  __proto__: null,
154262
154427
  unified
154263
154428
  }, Symbol.toStringTag, { value: "Module" }));