@superdoc-dev/cli 0.16.0-next.12 → 0.16.0-next.14

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 (2) hide show
  1. package/dist/index.js +247 -50
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68110,7 +68110,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68110
68110
  emptyOptions2 = {};
68111
68111
  });
68112
68112
 
68113
- // ../../packages/superdoc/dist/chunks/SuperConverter-BoqEhvrr.es.js
68113
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CcHCWpfX.es.js
68114
68114
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68115
68115
  const fieldValue = extension$1.config[field];
68116
68116
  if (typeof fieldValue === "function")
@@ -104611,9 +104611,15 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
104611
104611
  else {
104612
104612
  const run$1 = inlineConverter(inlineConverterParams);
104613
104613
  if (run$1) {
104614
- currentRuns.push(run$1);
104615
- if (node3.type === "tab")
104614
+ if (node3.type === "tab") {
104615
+ const tabRun = run$1;
104616
+ if (tabRun.fontSize == null)
104617
+ tabRun.fontSize = defaultSize;
104618
+ if (tabRun.fontFamily == null)
104619
+ tabRun.fontFamily = defaultFont;
104616
104620
  tabOrdinal += 1;
104621
+ }
104622
+ currentRuns.push(run$1);
104617
104623
  }
104618
104624
  }
104619
104625
  } catch (error3) {
@@ -130800,7 +130806,7 @@ var isRegExp = (value) => {
130800
130806
  state.kern = kernNode.attributes["w:val"];
130801
130807
  }
130802
130808
  }, SuperConverter;
130803
- var init_SuperConverter_BoqEhvrr_es = __esm(() => {
130809
+ var init_SuperConverter_CcHCWpfX_es = __esm(() => {
130804
130810
  init_rolldown_runtime_Bg48TavK_es();
130805
130811
  init_jszip_C49i9kUs_es();
130806
130812
  init_xml_js_CqGKpaft_es();
@@ -169574,7 +169580,7 @@ var init_SuperConverter_BoqEhvrr_es = __esm(() => {
169574
169580
  };
169575
169581
  });
169576
169582
 
169577
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BrbwjtJZ.es.js
169583
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DKwoydAR.es.js
169578
169584
  function parseSizeUnit(val = "0") {
169579
169585
  const length3 = val.toString() || "0";
169580
169586
  const value = Number.parseFloat(length3);
@@ -179905,8 +179911,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
179905
179911
  }
179906
179912
  };
179907
179913
  };
179908
- var init_create_headless_toolbar_BrbwjtJZ_es = __esm(() => {
179909
- init_SuperConverter_BoqEhvrr_es();
179914
+ var init_create_headless_toolbar_DKwoydAR_es = __esm(() => {
179915
+ init_SuperConverter_CcHCWpfX_es();
179910
179916
  init_uuid_qzgm05fK_es();
179911
179917
  init_constants_D_X7xF4s_es();
179912
179918
  init_dist_B8HfvhaK_es();
@@ -229069,7 +229075,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
229069
229075
  init_remark_gfm_BhnWr3yf_es();
229070
229076
  });
229071
229077
 
229072
- // ../../packages/superdoc/dist/chunks/src-HGVtAenV.es.js
229078
+ // ../../packages/superdoc/dist/chunks/src-BAgFSihz.es.js
229073
229079
  function deleteProps(obj, propOrProps) {
229074
229080
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
229075
229081
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -283532,8 +283538,8 @@ async function measureParagraphBlock(block, maxWidth) {
283532
283538
  const ctx$1 = getCanvasContext();
283533
283539
  const wordLayout = block.attrs?.wordLayout;
283534
283540
  const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
283535
- const fallbackFontSize = normalizeFontSize2(firstTextRunWithSize?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
283536
- const fallbackFontFamily = block.runs.find((run2) => isTextRun$22(run2) && typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0)?.fontFamily ?? DEFAULT_PARAGRAPH_FONT_FAMILY;
283541
+ const fallbackFontSize = normalizeFontSize2((firstTextRunWithSize ?? block.runs.find((run2) => typeof run2.fontSize === "number" && run2.fontSize > 0))?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
283542
+ const fallbackFontFamily = (block.runs.find((run2) => isTextRun$22(run2) && typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0) ?? block.runs.find((run2) => typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0))?.fontFamily ?? DEFAULT_PARAGRAPH_FONT_FAMILY;
283537
283543
  const normalizedRuns = normalizeRunsForMeasurement(block.runs, fallbackFontSize, fallbackFontFamily);
283538
283544
  const markerInfo = wordLayout?.marker ? (() => {
283539
283545
  const { font: markerFont } = buildFontString({
@@ -283970,7 +283976,7 @@ async function measureParagraphBlock(block, maxWidth) {
283970
283976
  toChar: 1,
283971
283977
  width: 0,
283972
283978
  maxFontSize: lastFontSize,
283973
- maxFontInfo: hasSeenTextRun ? undefined : fallbackFontInfo,
283979
+ maxFontInfo: hasSeenTextRun ? undefined : fallbackFontInfo ?? getFontInfoFromRun(run2),
283974
283980
  maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
283975
283981
  segments: [],
283976
283982
  spaceCount: 0
@@ -295407,6 +295413,34 @@ var Node$13 = class Node$14 {
295407
295413
  if (left$1)
295408
295414
  return left$1;
295409
295415
  return ctx$1.graph.segments.find((segment) => segment.side === SegmentSide.Inserted && segment.from === pos && isSameUserForRefinement(ctx$1, segment)) ?? null;
295416
+ }, findAdjacentDeletedSegment = (ctx$1, from$1, to) => {
295417
+ const sameUserDeleted = (segment) => segment.side === SegmentSide.Deleted && !segment.attrs?.replacementGroupId && !segment.attrs?.overlapParentId && isSameUserForRefinement(ctx$1, segment);
295418
+ const exactLeft = ctx$1.graph.segments.find((segment) => sameUserDeleted(segment) && segment.to === from$1);
295419
+ if (exactLeft)
295420
+ return exactLeft;
295421
+ const exactRight = ctx$1.graph.segments.find((segment) => sameUserDeleted(segment) && segment.from === to);
295422
+ if (exactRight)
295423
+ return exactRight;
295424
+ let nearest = null;
295425
+ let nearestDistance = Infinity;
295426
+ for (const segment of ctx$1.graph.segments) {
295427
+ if (!sameUserDeleted(segment))
295428
+ continue;
295429
+ if (segment.from > to) {
295430
+ const distance2 = segment.from - to;
295431
+ if (distance2 < nearestDistance && isCoalescibleDeletionGap(ctx$1, to, segment.from)) {
295432
+ nearest = segment;
295433
+ nearestDistance = distance2;
295434
+ }
295435
+ } else if (segment.to < from$1) {
295436
+ const distance2 = from$1 - segment.to;
295437
+ if (distance2 < nearestDistance && isCoalescibleDeletionGap(ctx$1, segment.to, from$1)) {
295438
+ nearest = segment;
295439
+ nearestDistance = distance2;
295440
+ }
295441
+ }
295442
+ }
295443
+ return nearest;
295410
295444
  }, isEmptyStructuralGap = (ctx$1, from$1, to) => {
295411
295445
  if (to <= from$1)
295412
295446
  return false;
@@ -295426,6 +295460,25 @@ var Node$13 = class Node$14 {
295426
295460
  }
295427
295461
  });
295428
295462
  return !hasInlineLeaf;
295463
+ }, ZERO_WIDTH_ANCHOR_NODE_NAMES, isCoalescibleDeletionGap = (ctx$1, from$1, to) => {
295464
+ if (to <= from$1)
295465
+ return false;
295466
+ if (!sharesTextblock(ctx$1.tr.doc, from$1, to))
295467
+ return false;
295468
+ if (ctx$1.graph.segmentsInRange(from$1, to).length)
295469
+ return false;
295470
+ if (ctx$1.tr.doc.textBetween(from$1, to, "", ""))
295471
+ return false;
295472
+ let blocked = false;
295473
+ ctx$1.tr.doc.nodesBetween(from$1, to, (node3, pos) => {
295474
+ if (pos < from$1 || pos >= to)
295475
+ return;
295476
+ if (node3.isInline && node3.isLeaf && !ZERO_WIDTH_ANCHOR_NODE_NAMES.has(node3.type.name)) {
295477
+ blocked = true;
295478
+ return false;
295479
+ }
295480
+ });
295481
+ return !blocked;
295429
295482
  }, sharesTextblock = (doc$12, from$1, to) => {
295430
295483
  const left$1 = textblockStart(doc$12, from$1);
295431
295484
  const right$1 = textblockStart(doc$12, to);
@@ -295577,15 +295630,19 @@ var Node$13 = class Node$14 {
295577
295630
  return failure$3("INVALID_TARGET", `text-delete range [${intent.from}, ${intent.to}] out of bounds.`);
295578
295631
  if (intent.from === intent.to)
295579
295632
  return failure$3("INVALID_TARGET", "text-delete requires a non-empty range.");
295633
+ const coalesceTarget = intent.replacementGroupHint || intent.preserveExistingReviewState ? null : findAdjacentDeletedSegment(ctx$1, intent.from, intent.to);
295634
+ const sharedDeletionId = intent.replacementGroupHint || coalesceTarget?.changeId || null;
295580
295635
  const result = applyTrackedDelete(ctx$1, intent.from, intent.to, {
295581
295636
  replacementGroupId: "",
295582
295637
  replacementSideId: "",
295583
- sharedDeletionId: intent.replacementGroupHint || null,
295638
+ sharedDeletionId,
295584
295639
  recordSharedDeletionId: Boolean(intent.replacementGroupHint),
295585
295640
  reassignExistingDeletions: intent.source !== "native" && !intent.preserveExistingReviewState ? "different-user" : false
295586
295641
  });
295587
295642
  if (result.ok === false)
295588
295643
  return result;
295644
+ if (coalesceTarget && !ctx$1.updatedChangeIds.includes(coalesceTarget.changeId))
295645
+ ctx$1.updatedChangeIds.push(coalesceTarget.changeId);
295589
295646
  return {
295590
295647
  ok: true,
295591
295648
  tr: ctx$1.tr,
@@ -309204,7 +309261,7 @@ menclose::after {
309204
309261
  const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
309205
309262
  console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
309206
309263
  }
309207
- }, registriesByFontSet, domlessRegistry = null, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
309264
+ }, registriesByFontSet, domlessRegistry = null, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, underlineThicknessPx = (fontSize) => Math.max(1, Math.round(fontSize / 14)), hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
309208
309265
  if (hasVerticalPositioning(run2))
309209
309266
  element3.style.lineHeight = "1";
309210
309267
  const explicitBaselineShift = normalizeBaselineShift(run2.baselineShift);
@@ -309246,6 +309303,7 @@ menclose::after {
309246
309303
  decorations.push("underline");
309247
309304
  const u = run2.underline;
309248
309305
  element3.style.textDecorationStyle = u.style && u.style !== "single" ? u.style : "solid";
309306
+ element3.style.textDecorationThickness = `${underlineThicknessPx(run2.fontSize)}px`;
309249
309307
  if (u.color)
309250
309308
  element3.style.textDecorationColor = u.color;
309251
309309
  }
@@ -310004,15 +310062,39 @@ menclose::after {
310004
310062
  if (!("text" in run2) || !run2.text)
310005
310063
  return null;
310006
310064
  return renderTextRun(run2, context, renderContext, trackedConfig);
310007
- }, renderInlineTabRun = (run2, line, doc$12, layoutEpoch, styleId) => {
310065
+ }, getRunUnderline = (run2) => ("underline" in run2) ? run2.underline : undefined, getRunFontSize = (run2) => ("fontSize" in run2) && typeof run2.fontSize === "number" ? run2.fontSize : 16, getRunColor = (run2) => ("color" in run2) && typeof run2.color === "string" ? run2.color : undefined, underlineStyleForRun = (run2) => getRunUnderline(run2)?.style ?? "single", canPaintUnderlineAsBorder = (run2) => {
310066
+ if (!getRunUnderline(run2))
310067
+ return false;
310068
+ const style2 = underlineStyleForRun(run2);
310069
+ return style2 !== "none" && style2 !== "words";
310070
+ }, canPaintUnderlineOverlay = (run2) => {
310071
+ if (!canPaintUnderlineAsBorder(run2))
310072
+ return false;
310073
+ const style2 = underlineStyleForRun(run2);
310074
+ return style2 === "single" || style2 === "double" || style2 === "dotted" || style2 === "dashed";
310075
+ }, underlineBorderForRun = (run2) => {
310076
+ if (!canPaintUnderlineAsBorder(run2))
310077
+ return;
310078
+ const underlineStyle = underlineStyleForRun(run2);
310079
+ const borderStyle = underlineStyle === "double" || underlineStyle === "dotted" || underlineStyle === "dashed" ? underlineStyle : "solid";
310080
+ const underlineColor = getRunUnderline(run2)?.color ?? getRunColor(run2) ?? "#000000";
310081
+ return `${underlineThicknessPx(getRunFontSize(run2))}px ${borderStyle} ${underlineColor}`;
310082
+ }, renderInlineTabRun = (run2, line, doc$12, layoutEpoch, styleId, paintUnderline = true) => {
310008
310083
  const tabEl = doc$12.createElement("span");
310009
310084
  tabEl.classList.add("superdoc-tab");
310010
310085
  const tabWidth = run2.width ?? 48;
310011
310086
  tabEl.style.display = "inline-block";
310012
310087
  tabEl.style.width = `${tabWidth}px`;
310013
- tabEl.style.height = `${line.lineHeight}px`;
310014
- tabEl.style.verticalAlign = "bottom";
310015
- applyTabUnderline(tabEl, run2);
310088
+ const shouldPaintUnderline = paintUnderline && canPaintUnderlineAsBorder(run2);
310089
+ if (shouldPaintUnderline) {
310090
+ tabEl.style.height = `${underlineOffsetFromLineTop(line)}px`;
310091
+ tabEl.style.verticalAlign = "top";
310092
+ } else {
310093
+ tabEl.style.height = `${line.lineHeight}px`;
310094
+ tabEl.style.verticalAlign = "bottom";
310095
+ }
310096
+ if (shouldPaintUnderline)
310097
+ applyTabUnderlineBorder(tabEl, run2);
310016
310098
  if (styleId)
310017
310099
  tabEl.setAttribute("styleid", styleId);
310018
310100
  if (run2.pmStart != null)
@@ -310021,7 +310103,7 @@ menclose::after {
310021
310103
  tabEl.dataset.pmEnd = String(run2.pmEnd);
310022
310104
  tabEl.dataset.layoutEpoch = String(layoutEpoch);
310023
310105
  return tabEl;
310024
- }, renderPositionedTabRun = (run2, line, doc$12, layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId) => {
310106
+ }, renderPositionedTabRun = (run2, line, doc$12, layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId, paintUnderline = true) => {
310025
310107
  const measuredTabEndX = tabStartX + (run2.width ?? 0);
310026
310108
  const tabEndX = immediateNextSegment?.precedingTabEndX ?? immediateNextSegment?.x ?? measuredTabEndX;
310027
310109
  const actualTabWidth = tabEndX - tabStartX;
@@ -310030,12 +310112,14 @@ menclose::after {
310030
310112
  tabEl.style.left = `${tabStartX + indentOffset}px`;
310031
310113
  tabEl.style.top = "0px";
310032
310114
  tabEl.style.width = `${actualTabWidth}px`;
310033
- tabEl.style.height = `${line.lineHeight}px`;
310115
+ const shouldPaintUnderline = paintUnderline && canPaintUnderlineAsBorder(run2);
310116
+ tabEl.style.height = shouldPaintUnderline ? `${underlineOffsetFromLineTop(line)}px` : `${line.lineHeight}px`;
310034
310117
  tabEl.style.display = "inline-block";
310035
310118
  tabEl.style.pointerEvents = "none";
310036
310119
  tabEl.style.zIndex = "1";
310037
- applyTabUnderline(tabEl, run2);
310038
- if (!run2.underline)
310120
+ if (shouldPaintUnderline)
310121
+ applyTabUnderlineBorder(tabEl, run2);
310122
+ else
310039
310123
  tabEl.style.visibility = "hidden";
310040
310124
  if (styleId)
310041
310125
  tabEl.setAttribute("styleid", styleId);
@@ -310049,13 +310133,13 @@ menclose::after {
310049
310133
  tabEndX,
310050
310134
  actualTabWidth
310051
310135
  };
310052
- }, applyTabUnderline = (tabEl, run2) => {
310053
- if (run2.underline) {
310054
- const underlineStyle = run2.underline.style ?? "single";
310055
- const underlineColor = run2.underline.color ?? "#000000";
310056
- const borderStyle = underlineStyle === "double" ? "double" : "solid";
310057
- tabEl.style.borderBottom = `1px ${borderStyle} ${underlineColor}`;
310058
- }
310136
+ }, underlineOffsetFromLineTop = (line) => {
310137
+ return Math.max(0, (line.lineHeight - line.ascent - line.descent) / 2) + line.ascent + Math.min(line.descent, line.lineHeight * 0.08);
310138
+ }, applyTabUnderlineBorder = (tabEl, run2) => {
310139
+ const border = underlineBorderForRun(run2);
310140
+ if (!border)
310141
+ return;
310142
+ tabEl.style.borderBottom = border;
310059
310143
  }, applyStyles$1 = (el, styles) => {
310060
310144
  Object.entries(styles).forEach(([key2, value]) => {
310061
310145
  if (value != null && value !== "" && key2 in el.style)
@@ -310160,6 +310244,73 @@ menclose::after {
310160
310244
  break;
310161
310245
  }
310162
310246
  return merged;
310247
+ }, isTextRun$5 = (run2) => (run2.kind === "text" || run2.kind === undefined) && ("text" in run2), isOverlaySafeRunKind = (run2) => {
310248
+ const kind = run2.kind ?? "text";
310249
+ return kind === "text" || kind === "tab" || kind === "lineBreak" || kind === "break";
310250
+ }, shouldUseLineUnderlineOverlay = (runsForLine) => runsForLine.every(isOverlaySafeRunKind) && runsForLine.some((run2) => run2.kind === "tab" && canPaintUnderlineOverlay(run2)), cloneRunWithoutUnderline = (run2) => ({
310251
+ ...run2,
310252
+ underline: undefined
310253
+ }), appendUnderlineOverlaySpan = (spans, from$1, to, border) => {
310254
+ if (!border || to <= from$1)
310255
+ return;
310256
+ const last2 = spans[spans.length - 1];
310257
+ if (last2 && last2.border === border && Math.abs(last2.to - from$1) < 0.5) {
310258
+ last2.to = to;
310259
+ return;
310260
+ }
310261
+ spans.push({
310262
+ from: from$1,
310263
+ to,
310264
+ border
310265
+ });
310266
+ }, runInlinePaintWidth = (run2, runIndex, segmentsByRun, spacingPerSpace) => {
310267
+ if (run2.kind === "tab")
310268
+ return run2.width ?? 48;
310269
+ const segments = segmentsByRun.get(runIndex);
310270
+ if (segments?.length)
310271
+ return segments.reduce((sum, segment) => {
310272
+ const text5 = isTextRun$5(run2) ? (run2.text ?? "").slice(segment.fromChar, segment.toChar) : "";
310273
+ return sum + segment.width + spacingPerSpace * countSpaces$1(text5);
310274
+ }, 0);
310275
+ if ("width" in run2 && typeof run2.width === "number")
310276
+ return run2.width;
310277
+ return 0;
310278
+ }, buildInlineUnderlineSpans = (block, line, spacingPerSpace, lineTextStartOffsetPx) => {
310279
+ const segmentsByRun = /* @__PURE__ */ new Map;
310280
+ line.segments?.forEach((segment) => {
310281
+ const segments = segmentsByRun.get(segment.runIndex);
310282
+ if (segments)
310283
+ segments.push(segment);
310284
+ else
310285
+ segmentsByRun.set(segment.runIndex, [segment]);
310286
+ });
310287
+ const spans = [];
310288
+ let currentX = lineTextStartOffsetPx;
310289
+ for (let runIndex = line.fromRun;runIndex <= line.toRun; runIndex += 1) {
310290
+ const run2 = block.runs[runIndex];
310291
+ if (!run2)
310292
+ continue;
310293
+ const width = runInlinePaintWidth(run2, runIndex, segmentsByRun, spacingPerSpace);
310294
+ if (canPaintUnderlineOverlay(run2))
310295
+ appendUnderlineOverlaySpan(spans, currentX, currentX + width, underlineBorderForRun(run2));
310296
+ currentX += width;
310297
+ }
310298
+ return spans;
310299
+ }, renderUnderlineSpans = (spans, top$1, el, doc$12) => {
310300
+ spans.forEach((span) => {
310301
+ const overlay = doc$12.createElement("div");
310302
+ overlay.classList.add("superdoc-underline-overlay");
310303
+ overlay.setAttribute("aria-hidden", "true");
310304
+ overlay.style.position = "absolute";
310305
+ overlay.style.left = `${span.from}px`;
310306
+ overlay.style.top = `${top$1}px`;
310307
+ overlay.style.width = `${Math.max(0, span.to - span.from)}px`;
310308
+ overlay.style.height = "0px";
310309
+ overlay.style.borderTop = span.border;
310310
+ overlay.style.pointerEvents = "none";
310311
+ overlay.style.zIndex = "2";
310312
+ el.appendChild(overlay);
310313
+ });
310163
310314
  }, renderLine = ({ block, line, context, availableWidthOverride, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride, paragraphMarkLeftOffsetOverride, runContext }) => {
310164
310315
  const expandedBlock = {
310165
310316
  ...block,
@@ -310254,6 +310405,11 @@ menclose::after {
310254
310405
  shouldJustify: justifyShouldApply
310255
310406
  });
310256
310407
  const lineContainsInlineImage = runsForLine.some((run2) => isImageRun$1(run2));
310408
+ const useSegmentPositioning = shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl);
310409
+ const overlayAlignment = block.attrs?.alignment;
310410
+ const overlayIndent = block.attrs?.indent;
310411
+ const inlineOverlayOriginMatchesContent = overlayAlignment !== "center" && overlayAlignment !== "right" && (overlayIndent?.hanging ?? 0) === 0 && (overlayIndent?.left ?? 0) >= 0;
310412
+ const useLineUnderlineOverlay = Boolean(line.segments) && !isRtl && shouldUseLineUnderlineOverlay(runsForLine) && (useSegmentPositioning || inlineOverlayOriginMatchesContent);
310257
310413
  const resolveLineIndentOffset = () => {
310258
310414
  if (indentOffsetOverride != null)
310259
310415
  return indentOffsetOverride;
@@ -310273,7 +310429,8 @@ menclose::after {
310273
310429
  const paragraphMarkLeftOffsetPx = lineTextStartOffsetPx;
310274
310430
  if (spacingPerSpace !== 0)
310275
310431
  el.style.wordSpacing = `${spacingPerSpace}px`;
310276
- if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl))
310432
+ const underlineSpans = [];
310433
+ if (useSegmentPositioning)
310277
310434
  renderExplicitlyPositionedRuns({
310278
310435
  block,
310279
310436
  line,
@@ -310284,9 +310441,11 @@ menclose::after {
310284
310441
  styleId,
310285
310442
  runContext,
310286
310443
  trackedConfig,
310287
- lineContainsInlineImage
310444
+ lineContainsInlineImage,
310445
+ useLineUnderlineOverlay,
310446
+ underlineSpanCollector: useLineUnderlineOverlay ? underlineSpans : undefined
310288
310447
  });
310289
- else
310448
+ else {
310290
310449
  renderInlineRuns({
310291
310450
  runsForLine,
310292
310451
  line,
@@ -310295,8 +310454,14 @@ menclose::after {
310295
310454
  styleId,
310296
310455
  runContext,
310297
310456
  trackedConfig,
310298
- lineContainsInlineImage
310457
+ lineContainsInlineImage,
310458
+ useLineUnderlineOverlay
310299
310459
  });
310460
+ if (useLineUnderlineOverlay)
310461
+ underlineSpans.push(...buildInlineUnderlineSpans(expandedBlock, line, spacingPerSpace, lineTextStartOffsetPx));
310462
+ }
310463
+ if (useLineUnderlineOverlay && underlineSpans.length > 0)
310464
+ renderUnderlineSpans(underlineSpans, underlineOffsetFromLineTop(line), el, runContext.doc);
310300
310465
  appendFormattingParagraphMark(el, line, expandedBlock.runs, paragraphMarkLeftOffsetPx, availableWidth, hasExplicitPositioning ?? false, runContext.doc, runContext.showFormattingMarks);
310301
310466
  el.querySelectorAll("a[href]").forEach((anchor) => {
310302
310467
  const pendingTooltip = runContext.pendingTooltips.get(anchor);
@@ -310306,7 +310471,7 @@ menclose::after {
310306
310471
  }
310307
310472
  });
310308
310473
  return el;
310309
- }, renderExplicitlyPositionedRuns = ({ block, line, context, el, lineTextStartOffsetPx, spacingPerSpace, styleId, runContext, trackedConfig, lineContainsInlineImage }) => {
310474
+ }, renderExplicitlyPositionedRuns = ({ block, line, context, el, lineTextStartOffsetPx, spacingPerSpace, styleId, runContext, trackedConfig, lineContainsInlineImage, useLineUnderlineOverlay, underlineSpanCollector }) => {
310310
310475
  const indentOffset = lineTextStartOffsetPx;
310311
310476
  let cumulativeX = 0;
310312
310477
  const segments = line.segments;
@@ -310375,8 +310540,11 @@ menclose::after {
310375
310540
  if (baseRun.kind === "tab") {
310376
310541
  const immediateNextSegment = findImmediateNextSegment(runIndex);
310377
310542
  const tabStartX = cumulativeX;
310378
- const { element: tabEl, tabEndX, actualTabWidth } = renderPositionedTabRun(baseRun, line, runContext.doc, runContext.layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId);
310543
+ const coveredByOverlay$1 = useLineUnderlineOverlay && canPaintUnderlineOverlay(baseRun);
310544
+ const { element: tabEl, tabEndX, actualTabWidth } = renderPositionedTabRun(baseRun, line, runContext.doc, runContext.layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId, !coveredByOverlay$1);
310379
310545
  appendToLineGeo(tabEl, baseRun, tabStartX + indentOffset, actualTabWidth);
310546
+ if (coveredByOverlay$1 && underlineSpanCollector)
310547
+ appendUnderlineOverlaySpan(underlineSpanCollector, tabStartX + indentOffset, tabStartX + indentOffset + actualTabWidth, underlineBorderForRun(baseRun));
310380
310548
  cumulativeX = tabEndX;
310381
310549
  continue;
310382
310550
  }
@@ -310455,6 +310623,7 @@ menclose::after {
310455
310623
  const baseText = baseRun.text ?? "";
310456
310624
  const runPmStart = baseRun.pmStart ?? null;
310457
310625
  const fallbackPmEnd = runPmStart != null && baseRun.pmEnd == null ? runPmStart + baseText.length : baseRun.pmEnd ?? null;
310626
+ const coveredByOverlay = useLineUnderlineOverlay && canPaintUnderlineOverlay(baseRun);
310458
310627
  runSegments.forEach((segment) => {
310459
310628
  const segmentText = baseText.slice(segment.fromChar, segment.toChar);
310460
310629
  if (!segmentText)
@@ -310465,10 +310634,13 @@ menclose::after {
310465
310634
  ...baseRun,
310466
310635
  text: segmentText,
310467
310636
  pmStart: pmSliceStart,
310468
- pmEnd: pmSliceEnd
310637
+ pmEnd: pmSliceEnd,
310638
+ ...coveredByOverlay ? { underline: undefined } : {}
310469
310639
  };
310470
310640
  const elem = renderRun(segmentRun, context, runContext, trackedConfig);
310471
310641
  if (elem) {
310642
+ if (coveredByOverlay)
310643
+ elem.style.textDecorationLine = segmentRun.strike ? "line-through" : "none";
310472
310644
  if (styleId)
310473
310645
  elem.setAttribute("styleid", styleId);
310474
310646
  alignNormalTextBesideInlineImage(elem, segmentRun, lineContainsInlineImage);
@@ -310478,6 +310650,8 @@ menclose::after {
310478
310650
  elem.style.left = `${xPos}px`;
310479
310651
  appendToLineGeo(elem, segmentRun, xPos, segment.width);
310480
310652
  const visualWidth = segment.width + (spacingPerSpace !== 0 ? spacingPerSpace * countSpaces$1(segmentText) : 0);
310653
+ if (coveredByOverlay && underlineSpanCollector)
310654
+ appendUnderlineOverlaySpan(underlineSpanCollector, xPos, xPos + visualWidth, underlineBorderForRun(baseRun));
310481
310655
  cumulativeX = baseX + visualWidth;
310482
310656
  if (geoSdtWrapper)
310483
310657
  geoSdtMaxRight = Math.max(geoSdtMaxRight, xPos + visualWidth);
@@ -310485,7 +310659,7 @@ menclose::after {
310485
310659
  });
310486
310660
  }
310487
310661
  closeGeoSdtWrapper();
310488
- }, renderInlineRuns = ({ runsForLine, line, context, el, styleId, runContext, trackedConfig, lineContainsInlineImage }) => {
310662
+ }, renderInlineRuns = ({ runsForLine, line, context, el, styleId, runContext, trackedConfig, lineContainsInlineImage, useLineUnderlineOverlay }) => {
310489
310663
  let currentInlineSdtWrapper = null;
310490
310664
  let currentInlineSdtId = null;
310491
310665
  const closeCurrentWrapper = () => {
@@ -310500,11 +310674,15 @@ menclose::after {
310500
310674
  const runSdtId = resolved?.sdtId ?? null;
310501
310675
  if (runSdtId !== currentInlineSdtId)
310502
310676
  closeCurrentWrapper();
310503
- const elem = run2.kind === "tab" ? renderInlineTabRun(run2, line, runContext.doc, runContext.layoutEpoch, styleId) : renderRun(run2, context, runContext, trackedConfig);
310677
+ const suppressUnderline = useLineUnderlineOverlay && canPaintUnderlineOverlay(run2);
310678
+ const runForRender = suppressUnderline ? cloneRunWithoutUnderline(run2) : run2;
310679
+ const elem = run2.kind === "tab" ? renderInlineTabRun(runForRender, line, runContext.doc, runContext.layoutEpoch, styleId, !suppressUnderline) : renderRun(runForRender, context, runContext, trackedConfig);
310504
310680
  if (elem) {
310681
+ if (suppressUnderline && run2.kind !== "tab")
310682
+ elem.style.textDecorationLine = "strike" in runForRender && runForRender.strike ? "line-through" : "none";
310505
310683
  if (styleId)
310506
310684
  elem.setAttribute("styleid", styleId);
310507
- alignNormalTextBesideInlineImage(elem, run2, lineContainsInlineImage);
310685
+ alignNormalTextBesideInlineImage(elem, runForRender, lineContainsInlineImage);
310508
310686
  if (resolved) {
310509
310687
  if (!currentInlineSdtWrapper) {
310510
310688
  currentInlineSdtWrapper = runContext.createInlineSdtWrapper(resolved.sdt);
@@ -313359,7 +313537,18 @@ menclose::after {
313359
313537
  if (run2.kind === "lineBreak")
313360
313538
  return "linebreak";
313361
313539
  if (run2.kind === "tab")
313362
- return [run2.text ?? "", "tab"].join(",");
313540
+ return [
313541
+ run2.text ?? "",
313542
+ "tab",
313543
+ run2.underline?.style ?? "",
313544
+ run2.underline?.color ?? "",
313545
+ run2.fontSize ?? "",
313546
+ run2.fontFamily ?? "",
313547
+ run2.bold ? 1 : 0,
313548
+ run2.italic ? 1 : 0,
313549
+ getFontConfigVersion(),
313550
+ run2.color ?? ""
313551
+ ].join(",");
313363
313552
  if (run2.kind === "fieldAnnotation") {
313364
313553
  const fieldRun = run2;
313365
313554
  const size$1 = fieldRun.size ? `${fieldRun.size.width ?? ""}x${fieldRun.size.height ?? ""}` : "";
@@ -322193,13 +322382,13 @@ menclose::after {
322193
322382
  return;
322194
322383
  console.log(...args$1);
322195
322384
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
322196
- var init_src_HGVtAenV_es = __esm(() => {
322385
+ var init_src_BAgFSihz_es = __esm(() => {
322197
322386
  init_rolldown_runtime_Bg48TavK_es();
322198
- init_SuperConverter_BoqEhvrr_es();
322387
+ init_SuperConverter_CcHCWpfX_es();
322199
322388
  init_jszip_C49i9kUs_es();
322200
322389
  init_xml_js_CqGKpaft_es();
322201
322390
  init_uuid_qzgm05fK_es();
322202
- init_create_headless_toolbar_BrbwjtJZ_es();
322391
+ init_create_headless_toolbar_DKwoydAR_es();
322203
322392
  init_constants_D_X7xF4s_es();
322204
322393
  init_dist_B8HfvhaK_es();
322205
322394
  init_unified_Dsuw2be5_es();
@@ -339188,6 +339377,14 @@ function print() { __p += __j.call(arguments, '') }
339188
339377
  "format-apply",
339189
339378
  "format-remove"
339190
339379
  ]);
339380
+ ZERO_WIDTH_ANCHOR_NODE_NAMES = new Set([
339381
+ "commentRangeStart",
339382
+ "commentRangeEnd",
339383
+ "commentReference",
339384
+ "bookmarkEnd",
339385
+ "permStart",
339386
+ "permEnd"
339387
+ ]);
339191
339388
  COMPOSITION_INPUT_TYPES = new Set(["insertCompositionText", "deleteCompositionText"]);
339192
339389
  COMBINING_MARK_REGEX = /^\p{Mark}$/u;
339193
339390
  graphemeSegmenter = typeof Intl !== "undefined" && typeof Intl.Segmenter === "function" ? new Intl.Segmenter(undefined, { granularity: "grapheme" }) : null;
@@ -356541,11 +356738,11 @@ function print() { __p += __j.call(arguments, '') }
356541
356738
  ]);
356542
356739
  });
356543
356740
 
356544
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-SRtgJ7Vz.es.js
356741
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CEjelItp.es.js
356545
356742
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
356546
- var init_create_super_doc_ui_SRtgJ7Vz_es = __esm(() => {
356547
- init_SuperConverter_BoqEhvrr_es();
356548
- init_create_headless_toolbar_BrbwjtJZ_es();
356743
+ var init_create_super_doc_ui_CEjelItp_es = __esm(() => {
356744
+ init_SuperConverter_CcHCWpfX_es();
356745
+ init_create_headless_toolbar_DKwoydAR_es();
356549
356746
  MOD_ALIASES = new Set([
356550
356747
  "Mod",
356551
356748
  "Meta",
@@ -356587,16 +356784,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
356587
356784
 
356588
356785
  // ../../packages/superdoc/dist/super-editor.es.js
356589
356786
  var init_super_editor_es = __esm(() => {
356590
- init_src_HGVtAenV_es();
356591
- init_SuperConverter_BoqEhvrr_es();
356787
+ init_src_BAgFSihz_es();
356788
+ init_SuperConverter_CcHCWpfX_es();
356592
356789
  init_jszip_C49i9kUs_es();
356593
356790
  init_xml_js_CqGKpaft_es();
356594
- init_create_headless_toolbar_BrbwjtJZ_es();
356791
+ init_create_headless_toolbar_DKwoydAR_es();
356595
356792
  init_constants_D_X7xF4s_es();
356596
356793
  init_dist_B8HfvhaK_es();
356597
356794
  init_unified_Dsuw2be5_es();
356598
356795
  init_DocxZipper_nv_KfOqb_es();
356599
- init_create_super_doc_ui_SRtgJ7Vz_es();
356796
+ init_create_super_doc_ui_CEjelItp_es();
356600
356797
  init_ui_C5PAS9hY_es();
356601
356798
  init_eventemitter3_BnGqBE_Q_es();
356602
356799
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.12",
3
+ "version": "0.16.0-next.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,19 +25,19 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "superdoc": "1.38.0",
29
- "@superdoc/super-editor": "0.0.1"
28
+ "@superdoc/super-editor": "0.0.1",
29
+ "superdoc": "1.38.0"
30
30
  },
31
31
  "module": "src/index.ts",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.12",
37
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.12",
38
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.12",
39
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.12",
40
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.12"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.14",
37
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.14",
38
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.14",
39
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.14",
40
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.14"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",