@harbour-enterprises/superdoc 1.0.0-beta.92 → 1.0.0-beta.94

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-CrMwuKcn.es.js → PdfViewer-BR7hR5hX.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-BYKB8fT_.cjs → PdfViewer-CC_fv7lS.cjs} +1 -1
  3. package/dist/chunks/{index-CqnVFwjL-zbanjw1O.cjs → index-BstIHBcW-6lPNsqaA.cjs} +1 -1
  4. package/dist/chunks/{index-CqnVFwjL-DJT5AqWq.es.js → index-BstIHBcW-BxKvjs-R.es.js} +1 -1
  5. package/dist/chunks/{index-BZloH4nq.cjs → index-DHRt1tCk.cjs} +3 -3
  6. package/dist/chunks/{index-CUUqzJ4M.es.js → index-JAE9iqTX.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-ALp2ApyE.es.js → super-editor.es-C1RjP_IO.es.js} +333 -24
  8. package/dist/chunks/{super-editor.es-DvpDTsC4.cjs → super-editor.es-DXKgM3JR.cjs} +333 -24
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CpOA_SSA.js → converter-CIgfC-et.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-zilXqAq6.js → docx-zipper-AQa91HPZ.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-DvF9Gp0h.js → editor-6Tyu_6Nf.js} +334 -25
  13. package/dist/super-editor/chunks/{index-CqnVFwjL.js → index-BstIHBcW.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-BVOTlKFf.js → toolbar-yzD6N9Br.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 +335 -26
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42398,7 +42398,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42398
42398
  static getStoredSuperdocVersion(docx) {
42399
42399
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42400
42400
  }
42401
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.92") {
42401
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.94") {
42402
42402
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42403
42403
  }
42404
42404
  /**
@@ -64405,12 +64405,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64405
64405
  const { doc: doc2 } = tr;
64406
64406
  const startPos = Math.max(from2 - offset2, 0);
64407
64407
  const endPos = Math.min(to + offset2, doc2.content.size);
64408
- let markFound;
64409
- doc2.nodesBetween(startPos, endPos, (node2, pos) => {
64408
+ let markFound = null;
64409
+ const tryMatch = (node2, pos) => {
64410
64410
  if (!node2 || node2?.nodeSize === void 0) {
64411
64411
  return;
64412
64412
  }
64413
- const mark2 = node2.marks.find(
64413
+ const mark2 = node2.marks?.find(
64414
64414
  (mark22) => mark22.type.name === markName && Object.keys(attrs).every((attr) => mark22.attrs[attr] === attrs[attr])
64415
64415
  );
64416
64416
  if (mark2 && !markFound) {
@@ -64419,24 +64419,36 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64419
64419
  to: pos + node2.nodeSize,
64420
64420
  mark: mark2
64421
64421
  };
64422
+ return false;
64422
64423
  }
64424
+ };
64425
+ doc2.nodesBetween(startPos, endPos, (node2, pos) => {
64426
+ return tryMatch(node2, pos);
64423
64427
  });
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
- };
64428
+ const inspectAroundPosition = (pos) => {
64429
+ if (pos < 0 || pos > doc2.content.size) {
64430
+ return;
64431
+ }
64432
+ const resolved = doc2.resolve(pos);
64433
+ const before = resolved.nodeBefore;
64434
+ if (before?.type?.name === "run") {
64435
+ const beforeStart = Math.max(pos - before.nodeSize, 0);
64436
+ const node2 = before.content?.content?.[0];
64437
+ if (node2?.type?.name === "text") {
64438
+ tryMatch(node2, beforeStart);
64439
+ }
64440
+ }
64441
+ const after = resolved.nodeAfter;
64442
+ if (after?.type?.name === "run") {
64443
+ const node2 = after.content?.content?.[0];
64444
+ if (node2?.type?.name === "text") {
64445
+ tryMatch(node2, pos);
64438
64446
  }
64439
64447
  }
64448
+ };
64449
+ if (!markFound) {
64450
+ inspectAroundPosition(startPos);
64451
+ inspectAroundPosition(endPos);
64440
64452
  }
64441
64453
  return markFound;
64442
64454
  };
@@ -67461,7 +67473,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67461
67473
  const shouldSkipNodeView = (editor) => {
67462
67474
  return isHeadless(editor);
67463
67475
  };
67464
- const summaryVersion = "1.0.0-beta.92";
67476
+ const summaryVersion = "1.0.0-beta.94";
67465
67477
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67466
67478
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67467
67479
  function mapAttributes(attrs) {
@@ -68250,7 +68262,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68250
68262
  { default: remarkStringify2 },
68251
68263
  { default: remarkGfm2 }
68252
68264
  ] = await Promise.all([
68253
- Promise.resolve().then(() => indexCqnVFwjL),
68265
+ Promise.resolve().then(() => indexBstIHBcW),
68254
68266
  Promise.resolve().then(() => indexDRCvimau),
68255
68267
  Promise.resolve().then(() => indexC_x_N6Uh),
68256
68268
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68455,7 +68467,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68455
68467
  * Process collaboration migrations
68456
68468
  */
68457
68469
  processCollaborationMigrations() {
68458
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.92");
68470
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.94");
68459
68471
  if (!this.options.ydoc) return;
68460
68472
  const metaMap = this.options.ydoc.getMap("meta");
68461
68473
  let docVersion = metaMap.get("version");
@@ -85332,10 +85344,31 @@ ${l}
85332
85344
  textRun.letterSpacing != null ? textRun.letterSpacing : "",
85333
85345
  textRun.pmStart ?? "",
85334
85346
  textRun.pmEnd ?? "",
85335
- textRun.token ?? ""
85347
+ textRun.token ?? "",
85348
+ // Tracked changes - force re-render when added or removed tracked change
85349
+ textRun.trackedChange ? 1 : 0
85336
85350
  ].join(",");
85337
85351
  }).join("|");
85338
- return markerVersion ? `${markerVersion}|${runsVersion}` : runsVersion;
85352
+ const attrs = block.attrs;
85353
+ const paragraphAttrsVersion = attrs ? [
85354
+ attrs.alignment ?? "",
85355
+ attrs.spacing?.before ?? "",
85356
+ attrs.spacing?.after ?? "",
85357
+ attrs.spacing?.line ?? "",
85358
+ attrs.spacing?.lineRule ?? "",
85359
+ attrs.indent?.left ?? "",
85360
+ attrs.indent?.right ?? "",
85361
+ attrs.indent?.firstLine ?? "",
85362
+ attrs.indent?.hanging ?? "",
85363
+ attrs.borders ? JSON.stringify(attrs.borders) : "",
85364
+ attrs.shading?.fill ?? "",
85365
+ attrs.shading?.color ?? "",
85366
+ attrs.direction ?? "",
85367
+ attrs.rtl ? "1" : "",
85368
+ attrs.tabs?.length ? JSON.stringify(attrs.tabs) : ""
85369
+ ].join(":") : "";
85370
+ const parts = [markerVersion, runsVersion, paragraphAttrsVersion].filter(Boolean);
85371
+ return parts.join("|");
85339
85372
  }
85340
85373
  if (block.kind === "list") {
85341
85374
  return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
@@ -89082,6 +89115,33 @@ ${l}
89082
89115
  const BYTES_PER_ENTRY_ESTIMATE = 5e3;
89083
89116
  const NORMALIZED_WHITESPACE = /\s+/g;
89084
89117
  const normalizeText = (text2) => text2.replace(NORMALIZED_WHITESPACE, " ");
89118
+ const hashParagraphBorder = (border) => {
89119
+ const parts = [];
89120
+ if (border.style !== void 0) parts.push(`s:${border.style}`);
89121
+ if (border.width !== void 0) parts.push(`w:${border.width}`);
89122
+ if (border.color !== void 0) parts.push(`c:${border.color}`);
89123
+ if (border.space !== void 0) parts.push(`sp:${border.space}`);
89124
+ return parts.join(",");
89125
+ };
89126
+ const hashParagraphBorders = (borders) => {
89127
+ const parts = [];
89128
+ if (borders.top) parts.push(`t:[${hashParagraphBorder(borders.top)}]`);
89129
+ if (borders.right) parts.push(`r:[${hashParagraphBorder(borders.right)}]`);
89130
+ if (borders.bottom) parts.push(`b:[${hashParagraphBorder(borders.bottom)}]`);
89131
+ if (borders.left) parts.push(`l:[${hashParagraphBorder(borders.left)}]`);
89132
+ return parts.join(";");
89133
+ };
89134
+ const hashParagraphFrame = (frame) => {
89135
+ const parts = [];
89136
+ if (frame.wrap !== void 0) parts.push(`w:${frame.wrap}`);
89137
+ if (frame.x !== void 0) parts.push(`x:${frame.x}`);
89138
+ if (frame.y !== void 0) parts.push(`y:${frame.y}`);
89139
+ if (frame.xAlign !== void 0) parts.push(`xa:${frame.xAlign}`);
89140
+ if (frame.yAlign !== void 0) parts.push(`ya:${frame.yAlign}`);
89141
+ if (frame.hAnchor !== void 0) parts.push(`ha:${frame.hAnchor}`);
89142
+ if (frame.vAnchor !== void 0) parts.push(`va:${frame.vAnchor}`);
89143
+ return parts.join(",");
89144
+ };
89085
89145
  const hashRuns = (block) => {
89086
89146
  if (block.kind === "table") {
89087
89147
  const tableBlock = block;
@@ -89177,7 +89237,59 @@ ${l}
89177
89237
  numberingKey = `|num:${np.numId ?? ""}:${np.ilvl ?? 0}:${markerTextKey}`;
89178
89238
  }
89179
89239
  }
89180
- return `${trackedMode}:${trackedEnabled ? "on" : "off"}|${runsHash}${numberingKey}`;
89240
+ let paragraphAttrsKey = "";
89241
+ if (block.attrs) {
89242
+ const attrs = block.attrs;
89243
+ const parts = [];
89244
+ if (attrs.alignment) parts.push(`al:${attrs.alignment}`);
89245
+ if (attrs.spacing) {
89246
+ const s2 = attrs.spacing;
89247
+ if (s2.before !== void 0) parts.push(`sb:${s2.before}`);
89248
+ if (s2.after !== void 0) parts.push(`sa:${s2.after}`);
89249
+ if (s2.line !== void 0) parts.push(`sl:${s2.line}`);
89250
+ if (s2.lineRule) parts.push(`sr:${s2.lineRule}`);
89251
+ }
89252
+ if (attrs.indent) {
89253
+ const ind = attrs.indent;
89254
+ if (ind.left !== void 0) parts.push(`il:${ind.left}`);
89255
+ if (ind.right !== void 0) parts.push(`ir:${ind.right}`);
89256
+ if (ind.firstLine !== void 0) parts.push(`if:${ind.firstLine}`);
89257
+ if (ind.hanging !== void 0) parts.push(`ih:${ind.hanging}`);
89258
+ }
89259
+ if (attrs.borders) {
89260
+ parts.push(`br:${hashParagraphBorders(attrs.borders)}`);
89261
+ }
89262
+ if (attrs.shading) {
89263
+ const sh = attrs.shading;
89264
+ if (sh.fill) parts.push(`shf:${sh.fill}`);
89265
+ if (sh.color) parts.push(`shc:${sh.color}`);
89266
+ }
89267
+ if (attrs.tabs && attrs.tabs.length > 0) {
89268
+ const tabsHash = attrs.tabs.map((t) => `${t.val ?? ""}:${t.pos ?? ""}:${t.leader ?? ""}`).join(",");
89269
+ parts.push(`tb:${tabsHash}`);
89270
+ }
89271
+ if (attrs.direction) parts.push(`dir:${attrs.direction}`);
89272
+ if (attrs.rtl) parts.push("rtl");
89273
+ if (attrs.keepNext) parts.push("kn");
89274
+ if (attrs.keepLines) parts.push("kl");
89275
+ if (attrs.floatAlignment) parts.push(`fa:${attrs.floatAlignment}`);
89276
+ if (attrs.contextualSpacing) parts.push("cs");
89277
+ if (attrs.suppressFirstLineIndent) parts.push("sfi");
89278
+ if (attrs.dropCap) parts.push(`dc:${attrs.dropCap}`);
89279
+ if (attrs.dropCapDescriptor) {
89280
+ const dcd = attrs.dropCapDescriptor;
89281
+ parts.push(`dcd:${dcd.mode ?? ""}:${dcd.lines ?? ""}`);
89282
+ }
89283
+ if (attrs.frame) {
89284
+ parts.push(`fr:${hashParagraphFrame(attrs.frame)}`);
89285
+ }
89286
+ if (attrs.tabIntervalTwips !== void 0) parts.push(`ti:${attrs.tabIntervalTwips}`);
89287
+ if (attrs.decimalSeparator) parts.push(`ds:${attrs.decimalSeparator}`);
89288
+ if (parts.length > 0) {
89289
+ paragraphAttrsKey = `|pa:${parts.join(":")}`;
89290
+ }
89291
+ }
89292
+ return `${trackedMode}:${trackedEnabled ? "on" : "off"}|${runsHash}${numberingKey}${paragraphAttrsKey}`;
89181
89293
  };
89182
89294
  const createStats = () => ({
89183
89295
  hits: 0,
@@ -90062,6 +90174,75 @@ ${l}
90062
90174
  }
90063
90175
  return "";
90064
90176
  };
90177
+ const paragraphSpacingEqual = (a2, b2) => {
90178
+ if (a2 === b2) return true;
90179
+ if (!a2 || !b2) return !a2 && !b2;
90180
+ return a2.before === b2.before && a2.after === b2.after && a2.line === b2.line && a2.lineRule === b2.lineRule && a2.beforeAutospacing === b2.beforeAutospacing && a2.afterAutospacing === b2.afterAutospacing;
90181
+ };
90182
+ const paragraphIndentEqual = (a2, b2) => {
90183
+ if (a2 === b2) return true;
90184
+ if (!a2 || !b2) return !a2 && !b2;
90185
+ return a2.left === b2.left && a2.right === b2.right && a2.firstLine === b2.firstLine && a2.hanging === b2.hanging;
90186
+ };
90187
+ const paragraphBorderEqual = (a2, b2) => {
90188
+ if (a2 === b2) return true;
90189
+ if (!a2 || !b2) return !a2 && !b2;
90190
+ return a2.style === b2.style && a2.width === b2.width && a2.color === b2.color && a2.space === b2.space;
90191
+ };
90192
+ const paragraphBordersEqual = (a2, b2) => {
90193
+ if (a2 === b2) return true;
90194
+ if (!a2 || !b2) return !a2 && !b2;
90195
+ return paragraphBorderEqual(a2.top, b2.top) && paragraphBorderEqual(a2.right, b2.right) && paragraphBorderEqual(a2.bottom, b2.bottom) && paragraphBorderEqual(a2.left, b2.left);
90196
+ };
90197
+ const paragraphShadingEqual = (a2, b2) => {
90198
+ if (a2 === b2) return true;
90199
+ if (!a2 || !b2) return !a2 && !b2;
90200
+ return a2.fill === b2.fill && a2.color === b2.color && a2.val === b2.val && a2.themeColor === b2.themeColor && a2.themeFill === b2.themeFill && a2.themeFillShade === b2.themeFillShade && a2.themeFillTint === b2.themeFillTint && a2.themeShade === b2.themeShade && a2.themeTint === b2.themeTint;
90201
+ };
90202
+ const tabStopEqual = (a2, b2) => {
90203
+ return a2.val === b2.val && a2.pos === b2.pos && a2.leader === b2.leader;
90204
+ };
90205
+ const tabStopsEqual = (a2, b2) => {
90206
+ if (a2 === b2) return true;
90207
+ if (!a2 || !b2) return !a2 && !b2;
90208
+ if (a2.length !== b2.length) return false;
90209
+ for (let i2 = 0; i2 < a2.length; i2 += 1) {
90210
+ if (!tabStopEqual(a2[i2], b2[i2])) return false;
90211
+ }
90212
+ return true;
90213
+ };
90214
+ const paragraphFrameEqual = (a2, b2) => {
90215
+ if (a2 === b2) return true;
90216
+ if (!a2 || !b2) return !a2 && !b2;
90217
+ return a2.wrap === b2.wrap && a2.x === b2.x && a2.y === b2.y && a2.xAlign === b2.xAlign && a2.yAlign === b2.yAlign && a2.hAnchor === b2.hAnchor && a2.vAnchor === b2.vAnchor;
90218
+ };
90219
+ const dropCapDescriptorEqual = (a2, b2) => {
90220
+ if (a2 === b2) return true;
90221
+ if (!a2 || !b2) return !a2 && !b2;
90222
+ if (a2.mode !== b2.mode || a2.lines !== b2.lines) return false;
90223
+ const runA = a2.run;
90224
+ const runB = b2.run;
90225
+ if (!runA || !runB) return !runA && !runB;
90226
+ if (runA.text !== runB.text || runA.fontFamily !== runB.fontFamily || runA.fontSize !== runB.fontSize || runA.bold !== runB.bold || runA.italic !== runB.italic || runA.color !== runB.color) {
90227
+ return false;
90228
+ }
90229
+ return true;
90230
+ };
90231
+ const paragraphAttrsEqual = (a2, b2) => {
90232
+ if (a2 === b2) return true;
90233
+ if (!a2 || !b2) return !a2 && !b2;
90234
+ if (a2.alignment !== b2.alignment || a2.contextualSpacing !== b2.contextualSpacing || a2.suppressFirstLineIndent !== b2.suppressFirstLineIndent || a2.dropCap !== b2.dropCap || a2.decimalSeparator !== b2.decimalSeparator || a2.tabIntervalTwips !== b2.tabIntervalTwips || a2.keepNext !== b2.keepNext || a2.keepLines !== b2.keepLines || a2.direction !== b2.direction || a2.rtl !== b2.rtl || a2.floatAlignment !== b2.floatAlignment) {
90235
+ return false;
90236
+ }
90237
+ if (!paragraphSpacingEqual(a2.spacing, b2.spacing)) return false;
90238
+ if (!paragraphIndentEqual(a2.indent, b2.indent)) return false;
90239
+ if (!paragraphBordersEqual(a2.borders, b2.borders)) return false;
90240
+ if (!paragraphShadingEqual(a2.shading, b2.shading)) return false;
90241
+ if (!tabStopsEqual(a2.tabs, b2.tabs)) return false;
90242
+ if (!paragraphFrameEqual(a2.frame, b2.frame)) return false;
90243
+ if (!dropCapDescriptorEqual(a2.dropCapDescriptor, b2.dropCapDescriptor)) return false;
90244
+ return true;
90245
+ };
90065
90246
  const paragraphBlocksEqual = (a2, b2) => {
90066
90247
  const aMode = a2.attrs?.trackedChangesMode ?? "review";
90067
90248
  const bMode = b2.attrs?.trackedChangesMode ?? "review";
@@ -90069,6 +90250,7 @@ ${l}
90069
90250
  const aEnabled = resolveTrackedChangesEnabled(a2.attrs, true);
90070
90251
  const bEnabled = resolveTrackedChangesEnabled(b2.attrs, true);
90071
90252
  if (aEnabled !== bEnabled) return false;
90253
+ if (!paragraphAttrsEqual(a2.attrs, b2.attrs)) return false;
90072
90254
  if (a2.runs.length !== b2.runs.length) return false;
90073
90255
  for (let i2 = 0; i2 < a2.runs.length; i2 += 1) {
90074
90256
  const runA = a2.runs[i2];
@@ -92714,6 +92896,104 @@ ${l}
92714
92896
  const wordStartChar = charPosInRun;
92715
92897
  const wordEndNoSpace = charPosInRun + word.length;
92716
92898
  const wordEndWithSpace = charPosInRun + (isLastWord ? word.length : word.length + 1);
92899
+ const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
92900
+ if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
92901
+ if (currentLine && currentLine.width > 0 && currentLine.segments.length > 0) {
92902
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
92903
+ const { spaceCount: _sc, ...lineBase } = currentLine;
92904
+ const completedLine = { ...lineBase, ...metrics };
92905
+ addBarTabsToLine(completedLine);
92906
+ lines.push(completedLine);
92907
+ tabStopCursor = 0;
92908
+ pendingTabAlignment = null;
92909
+ currentLine = null;
92910
+ }
92911
+ const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
92912
+ const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
92913
+ const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
92914
+ const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
92915
+ const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX, font, ctx2, run2);
92916
+ let chunkCharOffset = wordStartChar;
92917
+ for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
92918
+ const chunk = chunks[chunkIndex];
92919
+ const chunkStartChar = chunkCharOffset;
92920
+ const chunkEndChar = chunkCharOffset + chunk.text.length;
92921
+ const isLastChunk = chunkIndex === chunks.length - 1;
92922
+ const isFirstChunk = chunkIndex === 0;
92923
+ if (isFirstChunk && hasTabOnlyLine && currentLine) {
92924
+ currentLine.toRun = runIndex;
92925
+ currentLine.toChar = chunkEndChar;
92926
+ currentLine.width = roundValue(currentLine.width + chunk.width);
92927
+ currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
92928
+ currentLine.maxFontInfo = getFontInfoFromRun(run2);
92929
+ currentLine.segments.push({
92930
+ runIndex,
92931
+ fromChar: chunkStartChar,
92932
+ toChar: chunkEndChar,
92933
+ width: chunk.width
92934
+ });
92935
+ if (isLastChunk) {
92936
+ const ls = run2.letterSpacing ?? 0;
92937
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
92938
+ currentLine.toChar = wordEndWithSpace;
92939
+ currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
92940
+ charPosInRun = wordEndWithSpace;
92941
+ currentLine.spaceCount += 1;
92942
+ } else {
92943
+ charPosInRun = wordEndWithSpace;
92944
+ }
92945
+ } else {
92946
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
92947
+ const { spaceCount: _sc, ...lineBase } = currentLine;
92948
+ const completedLine = { ...lineBase, ...metrics };
92949
+ addBarTabsToLine(completedLine);
92950
+ lines.push(completedLine);
92951
+ tabStopCursor = 0;
92952
+ pendingTabAlignment = null;
92953
+ currentLine = null;
92954
+ }
92955
+ } else if (isLastChunk) {
92956
+ currentLine = {
92957
+ fromRun: runIndex,
92958
+ fromChar: chunkStartChar,
92959
+ toRun: runIndex,
92960
+ toChar: chunkEndChar,
92961
+ width: chunk.width,
92962
+ maxFontSize: run2.fontSize,
92963
+ maxFontInfo: getFontInfoFromRun(run2),
92964
+ maxWidth: getEffectiveWidth(contentWidth),
92965
+ segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
92966
+ spaceCount: 0
92967
+ };
92968
+ const ls = run2.letterSpacing ?? 0;
92969
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
92970
+ currentLine.toChar = wordEndWithSpace;
92971
+ currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
92972
+ charPosInRun = wordEndWithSpace;
92973
+ currentLine.spaceCount += 1;
92974
+ } else {
92975
+ charPosInRun = wordEndWithSpace;
92976
+ }
92977
+ } else {
92978
+ const chunkLineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
92979
+ const metrics = calculateTypographyMetrics(run2.fontSize, spacing, getFontInfoFromRun(run2));
92980
+ const chunkLine = {
92981
+ fromRun: runIndex,
92982
+ fromChar: chunkStartChar,
92983
+ toRun: runIndex,
92984
+ toChar: chunkEndChar,
92985
+ width: chunk.width,
92986
+ maxWidth: chunkLineMaxWidth,
92987
+ segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
92988
+ ...metrics
92989
+ };
92990
+ addBarTabsToLine(chunkLine);
92991
+ lines.push(chunkLine);
92992
+ }
92993
+ chunkCharOffset = chunkEndChar;
92994
+ }
92995
+ continue;
92996
+ }
92717
92997
  if (!currentLine) {
92718
92998
  currentLine = {
92719
92999
  fromRun: runIndex,
@@ -93292,6 +93572,35 @@ ${l}
93292
93572
  const width = getMeasuredTextWidth(text2, font, letterSpacing, ctx2);
93293
93573
  return roundValue(width);
93294
93574
  };
93575
+ const breakWordIntoChunks = (word, maxWidth, font, ctx2, run2) => {
93576
+ const chunks = [];
93577
+ if (maxWidth <= 0) {
93578
+ for (const char of word) {
93579
+ const charWidth = measureRunWidth(char, font, ctx2, run2);
93580
+ chunks.push({ text: char, width: charWidth });
93581
+ }
93582
+ return chunks;
93583
+ }
93584
+ let currentChunk = "";
93585
+ let currentWidth = 0;
93586
+ for (let i2 = 0; i2 < word.length; i2++) {
93587
+ const char = word[i2];
93588
+ const testChunk = currentChunk + char;
93589
+ const testWidth = measureRunWidth(testChunk, font, ctx2, run2);
93590
+ if (testWidth > maxWidth && currentChunk.length > 0) {
93591
+ chunks.push({ text: currentChunk, width: currentWidth });
93592
+ currentChunk = char;
93593
+ currentWidth = measureRunWidth(char, font, ctx2, run2);
93594
+ } else {
93595
+ currentChunk = testChunk;
93596
+ currentWidth = testWidth;
93597
+ }
93598
+ }
93599
+ if (currentChunk.length > 0) {
93600
+ chunks.push({ text: currentChunk, width: currentWidth });
93601
+ }
93602
+ return chunks;
93603
+ };
93295
93604
  const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
93296
93605
  if (!segments) return;
93297
93606
  const last = segments[segments.length - 1];
@@ -151617,7 +151926,7 @@ ${style2}
151617
151926
  this.config.colors = shuffleArray(this.config.colors);
151618
151927
  this.userColorMap = /* @__PURE__ */ new Map();
151619
151928
  this.colorIndex = 0;
151620
- this.version = "1.0.0-beta.92";
151929
+ this.version = "1.0.0-beta.94";
151621
151930
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151622
151931
  this.superdocId = config2.superdocId || v4();
151623
151932
  this.colors = this.config.colors;
@@ -154089,7 +154398,7 @@ ${style2}
154089
154398
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
154090
154399
  );
154091
154400
  }
154092
- const indexCqnVFwjL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154401
+ const indexBstIHBcW = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154093
154402
  __proto__: null,
154094
154403
  unified
154095
154404
  }, Symbol.toStringTag, { value: "Module" }));