@superdoc-dev/cli 0.17.0-next.33 → 0.17.0-next.34

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 +442 -294
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -69059,7 +69059,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
69059
69059
  emptyOptions2 = {};
69060
69060
  });
69061
69061
 
69062
- // ../../packages/superdoc/dist/chunks/SuperConverter-BvXoKdBC.es.js
69062
+ // ../../packages/superdoc/dist/chunks/SuperConverter-0i3YuAr2.es.js
69063
69063
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
69064
69064
  const fieldValue = extension$1.config[field];
69065
69065
  if (typeof fieldValue === "function")
@@ -117449,7 +117449,7 @@ var isRegExp = (value) => {
117449
117449
  }, stampTrackedChangeColors = (blocks, resolve2) => {
117450
117450
  for (const block of blocks)
117451
117451
  stampBlockTrackedChangeColors(block, resolve2);
117452
- }, idlessSdtContainerKeys, nextIdlessSdtContainerKey = 0, MAX_BOOKMARK_MARKER_LEAD_DISTANCE = 3, engines_exports, EMPTY_SDT_PLACEHOLDER_TEXT = "Click or tap here to enter text", FONT_SLOT_THEME_PAIRS, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
117452
+ }, idlessSdtContainerKeys, nextIdlessSdtContainerKey = 0, MAX_BOOKMARK_MARKER_LEAD_DISTANCE = 3, DRAWING_DIAGNOSTIC_CODES, engines_exports, EMPTY_SDT_PLACEHOLDER_TEXT = "Click or tap here to enter text", FONT_SLOT_THEME_PAIRS, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
117453
117453
  return SuperConverter.toCssFontFamily;
117454
117454
  }, getSpacingStyle = (spacing, isListItem$1) => {
117455
117455
  let { before: before2, after: after2, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
@@ -136298,7 +136298,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136298
136298
  state.kern = kernNode.attributes["w:val"];
136299
136299
  }
136300
136300
  }, SuperConverter;
136301
- var init_SuperConverter_BvXoKdBC_es = __esm(() => {
136301
+ var init_SuperConverter_0i3YuAr2_es = __esm(() => {
136302
136302
  init_rolldown_runtime_Bg48TavK_es();
136303
136303
  init_jszip_C49i9kUs_es();
136304
136304
  init_xml_js_CqGKpaft_es();
@@ -140831,6 +140831,28 @@ var init_SuperConverter_BvXoKdBC_es = __esm(() => {
140831
140831
  ];
140832
140832
  SPACE_CHARS = new Set([" ", " "]);
140833
140833
  idlessSdtContainerKeys = /* @__PURE__ */ new WeakMap;
140834
+ DRAWING_DIAGNOSTIC_CODES = {
140835
+ externalImageDeferred: "render.media.external-image-deferred",
140836
+ missingRelationship: "render.drawing.missing-relationship",
140837
+ missingMediaPart: "render.media.missing-part",
140838
+ unsupportedRelationshipType: "render.drawing.unsupported-relationship-type",
140839
+ unsupportedMime: "render.media.unsupported-mime",
140840
+ imageTooLarge: "render.media.image-too-large",
140841
+ unsafeSvg: "render.media.unsafe-svg",
140842
+ unsupportedFormat: "render.media.unsupported-format",
140843
+ embeddedObjectNotSupported: "render.embedded-object-not-supported",
140844
+ unsupportedObject: "render.drawing.unsupported-object",
140845
+ vmlUnsupported: "render.drawing.vml-unsupported",
140846
+ vmlImageUnsupported: "render.drawing.vml-image-unsupported",
140847
+ unsupportedGeometryCommand: "render.drawing.unsupported-geometry-command",
140848
+ anchorUnsupported: "render.drawing.anchor-unsupported",
140849
+ wrapUnsupported: "render.drawing.wrap-unsupported",
140850
+ altContentNoSupportedChoice: "render.drawing.altcontent-no-supported-choice",
140851
+ groupChildUnsupported: "render.drawing.group-child-unsupported",
140852
+ chartNotSupported: "render.chart-not-supported"
140853
+ };
140854
+ DRAWING_DIAGNOSTIC_CODES.missingRelationship, DRAWING_DIAGNOSTIC_CODES.unsupportedRelationshipType, DRAWING_DIAGNOSTIC_CODES.unsupportedRelationshipType, DRAWING_DIAGNOSTIC_CODES.imageTooLarge, DRAWING_DIAGNOSTIC_CODES.missingMediaPart, DRAWING_DIAGNOSTIC_CODES.vmlUnsupported;
140855
+ DRAWING_DIAGNOSTIC_CODES.externalImageDeferred, DRAWING_DIAGNOSTIC_CODES.missingRelationship, DRAWING_DIAGNOSTIC_CODES.missingMediaPart, DRAWING_DIAGNOSTIC_CODES.unsupportedRelationshipType, DRAWING_DIAGNOSTIC_CODES.unsupportedMime, DRAWING_DIAGNOSTIC_CODES.imageTooLarge, DRAWING_DIAGNOSTIC_CODES.unsafeSvg, DRAWING_DIAGNOSTIC_CODES.unsupportedFormat, DRAWING_DIAGNOSTIC_CODES.embeddedObjectNotSupported, DRAWING_DIAGNOSTIC_CODES.unsupportedObject, DRAWING_DIAGNOSTIC_CODES.vmlUnsupported, DRAWING_DIAGNOSTIC_CODES.vmlImageUnsupported, DRAWING_DIAGNOSTIC_CODES.unsupportedGeometryCommand, DRAWING_DIAGNOSTIC_CODES.anchorUnsupported, DRAWING_DIAGNOSTIC_CODES.wrapUnsupported, DRAWING_DIAGNOSTIC_CODES.altContentNoSupportedChoice, DRAWING_DIAGNOSTIC_CODES.groupChildUnsupported, DRAWING_DIAGNOSTIC_CODES.chartNotSupported;
140834
140856
  engines_exports = /* @__PURE__ */ __export3({
140835
140857
  OOXML_PCT_DIVISOR: () => OOXML_PCT_DIVISOR,
140836
140858
  calculateTabWidth: () => calculateTabWidth,
@@ -165268,7 +165290,7 @@ var init_SuperConverter_BvXoKdBC_es = __esm(() => {
165268
165290
  };
165269
165291
  });
165270
165292
 
165271
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BVxCjzNG.es.js
165293
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DYCEnt7x.es.js
165272
165294
  function parseSizeUnit(val = "0") {
165273
165295
  const length3 = val.toString() || "0";
165274
165296
  const value = Number.parseFloat(length3);
@@ -175954,9 +175976,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
175954
175976
  }
175955
175977
  };
175956
175978
  };
175957
- var init_create_headless_toolbar_BVxCjzNG_es = __esm(() => {
175979
+ var init_create_headless_toolbar_DYCEnt7x_es = __esm(() => {
175958
175980
  init_rolldown_runtime_Bg48TavK_es();
175959
- init_SuperConverter_BvXoKdBC_es();
175981
+ init_SuperConverter_0i3YuAr2_es();
175960
175982
  init_jszip_C49i9kUs_es();
175961
175983
  init_uuid_B2wVPhPi_es();
175962
175984
  init_constants_D9qj59G2_es();
@@ -226050,7 +226072,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226050
226072
  init_remark_gfm_BUJjZJLy_es();
226051
226073
  });
226052
226074
 
226053
- // ../../packages/superdoc/dist/chunks/src-CzUaHQHM.es.js
226075
+ // ../../packages/superdoc/dist/chunks/src-COxdGpKV.es.js
226054
226076
  function deleteProps(obj, propOrProps) {
226055
226077
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226056
226078
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -266666,32 +266688,22 @@ function resolveListMarkerGeometry(wordLayout, indentLeft, firstLine, hanging, m
266666
266688
  textStartPx: markerContentEndPx + 4,
266667
266689
  suffixWidthPx: 4
266668
266690
  };
266669
- if (justification !== "left") {
266670
- const gutterWidthPx$1 = Math.max(getNonNegativeFiniteNumber(marker.gutterWidthPx) ?? 0, 8);
266691
+ if (wordLayout?.firstLineIndentMode === true) {
266692
+ const suffixWidthPx = computeTabWidth(justification === "right" ? anchorPx : markerContentEndPx, justification, wordLayout.tabsPx, hanging, firstLine, indentLeft);
266671
266693
  return {
266672
266694
  markerStartPx,
266673
266695
  markerTextWidthPx,
266674
- textStartPx: markerContentEndPx + gutterWidthPx$1,
266675
- suffixWidthPx: gutterWidthPx$1
266696
+ textStartPx: markerContentEndPx + suffixWidthPx,
266697
+ suffixWidthPx
266676
266698
  };
266677
266699
  }
266678
- if (wordLayout?.firstLineIndentMode === true) {
266679
- const explicitTabStopPx = getNextExplicitTabStopPx(wordLayout.tabsPx, markerContentEndPx);
266680
- const textStartTargetPx = getFirstLineTextStartTargetPx(wordLayout, marker);
266681
- let textStartPx$1;
266682
- if (explicitTabStopPx != null)
266683
- textStartPx$1 = explicitTabStopPx;
266684
- else if (textStartTargetPx != null && textStartTargetPx > markerContentEndPx)
266685
- textStartPx$1 = textStartTargetPx;
266686
- else
266687
- textStartPx$1 = markerContentEndPx + 8;
266688
- if (textStartPx$1 - markerContentEndPx < 8)
266689
- textStartPx$1 = markerContentEndPx + 8;
266700
+ if (justification !== "left") {
266701
+ const gutterWidthPx$1 = Math.max(getNonNegativeFiniteNumber(marker.gutterWidthPx) ?? 0, 8);
266690
266702
  return {
266691
266703
  markerStartPx,
266692
266704
  markerTextWidthPx,
266693
- textStartPx: textStartPx$1,
266694
- suffixWidthPx: textStartPx$1 - markerContentEndPx
266705
+ textStartPx: markerContentEndPx + gutterWidthPx$1,
266706
+ suffixWidthPx: gutterWidthPx$1
266695
266707
  };
266696
266708
  }
266697
266709
  const gutterWidthPx = Math.max(getNonNegativeFiniteNumber(marker.gutterWidthPx) ?? 0, 8);
@@ -275279,13 +275291,14 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
275279
275291
  applyTabLayoutToLines(lines, runs2, tabStops, decimalSeparator, indentLeft, baseFirstLineOffset);
275280
275292
  const totalHeight = lines.reduce((s2, l) => s2 + l.lineHeight, 0);
275281
275293
  const marker = wordLayout?.marker;
275294
+ const markerTextWidth = typeof marker?.glyphWidthPx === "number" && Number.isFinite(marker.glyphWidthPx) && marker.glyphWidthPx >= 0 ? marker.glyphWidthPx : measuredMarkerTextWidth ?? 0;
275282
275295
  return {
275283
275296
  kind: "paragraph",
275284
275297
  lines,
275285
275298
  totalHeight,
275286
275299
  marker: marker ? {
275287
275300
  markerWidth: indentHanging ?? 0,
275288
- markerTextWidth: measuredMarkerTextWidth ?? 0,
275301
+ markerTextWidth,
275289
275302
  indentLeft,
275290
275303
  gutterWidth: marker.gutterWidthPx
275291
275304
  } : undefined
@@ -276309,9 +276322,18 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276309
276322
  };
276310
276323
  const resolveFootnoteAssignments = (layoutForPages) => {
276311
276324
  const columns = resolvePageColumns(layoutForPages, options, currentBlocks);
276325
+ const paragraphMeasuresByBlockId = /* @__PURE__ */ new Map;
276326
+ const pairedLength = Math.min(currentBlocks.length, currentMeasures.length);
276327
+ for (let index2 = 0;index2 < pairedLength; index2 += 1) {
276328
+ const block = currentBlocks[index2];
276329
+ const measure = currentMeasures[index2];
276330
+ if (block?.kind !== "paragraph" || measure?.kind !== "paragraph")
276331
+ continue;
276332
+ paragraphMeasuresByBlockId.set(block.id, measure);
276333
+ }
276312
276334
  return {
276313
276335
  columns,
276314
- idsByColumn: assignFootnotesToColumns(layoutForPages, footnotesInput.refs, columns)
276336
+ idsByColumn: assignFootnotesToColumns(layoutForPages, footnotesInput.refs, columns, paragraphMeasuresByBlockId)
276315
276337
  };
276316
276338
  };
276317
276339
  let bodyHeightById = /* @__PURE__ */ new Map;
@@ -276376,6 +276398,25 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276376
276398
  bodyHeightById = totalMap;
276377
276399
  firstLineHeightById = firstLineMap;
276378
276400
  };
276401
+ const summarizeReserveTail = (values) => values.flatMap((value, index2) => {
276402
+ const normalized = Number.isFinite(value) ? Math.max(0, Math.round(value)) : 0;
276403
+ return normalized > 0 ? [`${index2 + 1}:${normalized}`] : [];
276404
+ }).slice(-8);
276405
+ const logFootnoteLayoutPhase = (label, layoutForPages, appliedReserves, plannedReserves, extra) => {
276406
+ if (!layoutDebugEnabled$1)
276407
+ return;
276408
+ console.log("[incrementalLayout] Footnote layout phase", {
276409
+ label,
276410
+ pageCount: layoutForPages.pages.length,
276411
+ appliedReservePages: appliedReserves.filter((value) => (value ?? 0) > 0).length,
276412
+ appliedReserveTail: summarizeReserveTail(appliedReserves),
276413
+ ...plannedReserves ? {
276414
+ plannedReservePages: plannedReserves.filter((value) => (value ?? 0) > 0).length,
276415
+ plannedReserveTail: summarizeReserveTail(plannedReserves)
276416
+ } : {},
276417
+ ...extra ?? {}
276418
+ });
276419
+ };
276379
276420
  const relayout = (footnoteReservedByPageIndex, plannerSeparatorSpacingBefore) => layoutDocument(currentBlocks, currentMeasures, {
276380
276421
  ...options,
276381
276422
  footnoteReservedByPageIndex,
@@ -276399,6 +276440,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276399
276440
  refreshBodyHeights(measuresById);
276400
276441
  let plan = computeFootnoteLayoutPlan(layout, idsByColumn, measuresById, [], pageColumns);
276401
276442
  let reserves = plan.reserves;
276443
+ logFootnoteLayoutPhase("initial-plan", layout, reserves, plan.reserves, { assignedFootnoteCount: collectFootnoteIdsByColumn(idsByColumn).size });
276402
276444
  if (reserves.some((h$2) => h$2 > 0)) {
276403
276445
  let reservesStabilized = false;
276404
276446
  const seenReserveVectors = [reserves.slice()];
@@ -276409,6 +276451,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276409
276451
  refreshBodyHeights(measuresById);
276410
276452
  plan = computeFootnoteLayoutPlan(layout, idsByColumn, measuresById, reserves, pageColumns);
276411
276453
  const nextReserves = plan.reserves;
276454
+ logFootnoteLayoutPhase(`reserve-loop-pass-${pass + 1}`, layout, reserves, nextReserves, { assignedFootnoteCount: collectFootnoteIdsByColumn(idsByColumn).size });
276412
276455
  if (nextReserves.length === reserves.length && nextReserves.every((h$2, i3) => (reserves[i3] ?? 0) === h$2) && reserves.every((h$2, i3) => (nextReserves[i3] ?? 0) === h$2)) {
276413
276456
  reserves = nextReserves;
276414
276457
  reservesStabilized = true;
@@ -276426,19 +276469,21 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276426
276469
  let { blocks: finalBlocks, measuresById: finalMeasuresById } = await measureFootnoteBlocks(collectFootnoteIdsByColumn(finalIdsByColumn));
276427
276470
  let finalPlan = computeFootnoteLayoutPlan(layout, finalIdsByColumn, finalMeasuresById, reserves, finalPageColumns);
276428
276471
  let reservesAppliedToLayout = reserves;
276472
+ logFootnoteLayoutPhase("post-reserve-loop", layout, reservesAppliedToLayout, finalPlan.reserves, { assignedFootnoteCount: collectFootnoteIdsByColumn(finalIdsByColumn).size });
276429
276473
  const vectorsEqual = (a2, b$1) => {
276430
276474
  for (let i3 = 0;i3 < Math.max(a2.length, b$1.length); i3 += 1)
276431
276475
  if ((a2[i3] ?? 0) !== (b$1[i3] ?? 0))
276432
276476
  return false;
276433
276477
  return true;
276434
276478
  };
276435
- const applyReserves = async (target) => {
276479
+ const applyReserves = async (target, label = "apply-reserves") => {
276436
276480
  layout = relayout(target, finalPlan.separatorSpacingBefore);
276437
276481
  reservesAppliedToLayout = target;
276438
276482
  ({ columns: finalPageColumns, idsByColumn: finalIdsByColumn } = resolveFootnoteAssignments(layout));
276439
276483
  ({ blocks: finalBlocks, measuresById: finalMeasuresById } = await measureFootnoteBlocks(allFootnoteIds));
276440
276484
  refreshBodyHeights(finalMeasuresById);
276441
276485
  finalPlan = computeFootnoteLayoutPlan(layout, finalIdsByColumn, finalMeasuresById, reservesAppliedToLayout, finalPageColumns);
276486
+ logFootnoteLayoutPhase(label, layout, reservesAppliedToLayout, finalPlan.reserves, { assignedFootnoteCount: collectFootnoteIdsByColumn(finalIdsByColumn).size });
276442
276487
  };
276443
276488
  const buildFootnoteLedgers = (plan$1, appliedReserves, pageCount) => {
276444
276489
  const ledgers = [];
@@ -276500,7 +276545,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276500
276545
  if (vectorsEqual(next2, reservesAppliedToLayout))
276501
276546
  return true;
276502
276547
  }
276503
- await applyReserves(next2);
276548
+ await applyReserves(next2, `grow-pass-${pass + 1}`);
276504
276549
  seen.push(next2);
276505
276550
  }
276506
276551
  return false;
@@ -276527,7 +276572,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276527
276572
  const trialReserves = beforeReserves.slice();
276528
276573
  const cappedPreferredReserve = capReserveForRelayout(targetReserve, candidate.pageIndex, beforeLayout, beforeReserves);
276529
276574
  trialReserves[candidate.pageIndex] = Math.max(trialReserves[candidate.pageIndex] ?? 0, cappedPreferredReserve);
276530
- await applyReserves(trialReserves);
276575
+ await applyReserves(trialReserves, `preferred-trial-page-${candidate.pageIndex + 1}-target-${Math.round(cappedPreferredReserve)}`);
276531
276576
  const trialConverged = await growReserves(GROW_MAX_PASSES);
276532
276577
  const afterLedgers = buildFootnoteLedgers(finalPlan, reservesAppliedToLayout, layout.pages.length);
276533
276578
  const score = scoreFootnoteWindow({
@@ -276557,7 +276602,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276557
276602
  trialConverged,
276558
276603
  score
276559
276604
  });
276560
- await applyReserves(beforeReserves);
276605
+ await applyReserves(beforeReserves, `preferred-revert-page-${candidate.pageIndex + 1}`);
276561
276606
  }
276562
276607
  if (acceptedCandidate) {
276563
276608
  if (acceptedPreferredTrials >= PREFERRED_RESERVE_MAX_ACCEPTED_CANDIDATES)
@@ -276618,9 +276663,9 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276618
276663
  const tightened = reservesAppliedToLayout.slice();
276619
276664
  for (const { i: i3, target } of pagesToTighten)
276620
276665
  tightened[i3] = target;
276621
- await applyReserves(tightened);
276666
+ await applyReserves(tightened, `tighten-pass-${iteration$1 + 1}`);
276622
276667
  if (!await growReserves(GROW_MAX_PASSES) || layout.pages.length > safePageCount) {
276623
- await applyReserves(safeApplied);
276668
+ await applyReserves(safeApplied, `tighten-revert-${iteration$1 + 1}`);
276624
276669
  break;
276625
276670
  }
276626
276671
  }
@@ -276643,9 +276688,10 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
276643
276688
  if (bumped === 0)
276644
276689
  return;
276645
276690
  const safeApplied = reservesAppliedToLayout.slice();
276646
- await applyReserves(target);
276647
- if (!await growReserves(GROW_MAX_PASSES))
276648
- await applyReserves(safeApplied);
276691
+ const safePageCount = layout.pages.length;
276692
+ await applyReserves(target, "widow-orphan-absorb");
276693
+ if (!await growReserves(GROW_MAX_PASSES) || layout.pages.length > safePageCount)
276694
+ await applyReserves(safeApplied, "widow-orphan-revert");
276649
276695
  };
276650
276696
  await runWidowOrphanAbsorb();
276651
276697
  await runPreferredReserveTrials();
@@ -306695,172 +306741,19 @@ var Node$13 = class Node$14 {
306695
306741
  boxShadow: merged.boxShadow,
306696
306742
  border: merged.border,
306697
306743
  margin: merged.margin,
306744
+ color: merged.color,
306698
306745
  overflow: "hidden"
306699
306746
  };
306700
306747
  }, fragmentStyles, lineStyles = (lineHeight) => ({
306701
306748
  lineHeight: `${lineHeight}px`,
306702
306749
  height: `${lineHeight}px`,
306703
306750
  fontSize: "0",
306751
+ color: "inherit",
306704
306752
  position: "relative",
306705
306753
  display: "block",
306706
306754
  whiteSpace: "pre",
306707
306755
  overflow: "visible"
306708
- }), PRINT_STYLES, LINK_AND_TOC_STYLES = `
306709
- /* Reset browser default link styling - allow run colors to show through from inline styles
306710
- *
306711
- * Note: !important was removed from these rules to allow inline styles to take precedence.
306712
- * This is necessary because OOXML hyperlink character styles apply colors via inline style
306713
- * attributes on the run elements. The CSS cascade ensures that inline styles (applied via
306714
- * element.style.color in applyRunStyles) override these class-based rules naturally.
306715
- *
306716
- * Implications:
306717
- * - OOXML hyperlink character styles will correctly display their assigned colors
306718
- * - Browser default link colors are still reset by these inherit rules
306719
- * - Inline color styles from run objects override the inherit value as expected
306720
- */
306721
- .superdoc-link {
306722
- color: inherit;
306723
- text-decoration: none;
306724
- }
306725
-
306726
- .superdoc-link:visited {
306727
- color: inherit;
306728
- }
306729
-
306730
- .superdoc-link:hover {
306731
- text-decoration: underline;
306732
- }
306733
-
306734
- /* Focus visible for keyboard navigation (WCAG 2.1 SC 2.4.7) */
306735
- .superdoc-link:focus-visible {
306736
- outline: 2px solid #0066cc;
306737
- outline-offset: 2px;
306738
- border-radius: 2px;
306739
- }
306740
-
306741
- /* Remove outline for mouse users */
306742
- .superdoc-link:focus:not(:focus-visible) {
306743
- outline: none;
306744
- }
306745
-
306746
- /* Active state */
306747
- .superdoc-link:active {
306748
- opacity: 0.8;
306749
- }
306750
-
306751
- /* Print mode: show URLs after links */
306752
- @media print {
306753
- .superdoc-link::after {
306754
- content: " (" attr(href) ")";
306755
- font-size: 0.9em;
306756
- color: #666;
306757
- }
306758
-
306759
- /* Don't show URL for anchor-only links */
306760
- .superdoc-link[href^="#"]::after {
306761
- content: "";
306762
- }
306763
- }
306764
-
306765
- /* High contrast mode support */
306766
- @media (prefers-contrast: high) {
306767
- .superdoc-link:focus-visible {
306768
- outline-width: 3px;
306769
- outline-offset: 3px;
306770
- }
306771
- }
306772
-
306773
- /* SD-2454: bookmark bracket indicators.
306774
- * When the showBookmarks layout option is enabled, the pm-adapter emits
306775
- * [ and ] marker TextRuns at bookmark start/end positions. Mirror Word's
306776
- * visual treatment: subtle gray, non-selectable so users can't accidentally
306777
- * include the brackets in copied text. The bookmark name is surfaced via
306778
- * the native title tooltip on the opening bracket. */
306779
- [data-bookmark-marker="start"],
306780
- [data-bookmark-marker="end"] {
306781
- color: #8b8b8b;
306782
- user-select: none;
306783
- cursor: default;
306784
- font-weight: normal;
306785
- }
306786
-
306787
-
306788
- /* Reduced motion support */
306789
- @media (prefers-reduced-motion: reduce) {
306790
- .superdoc-link {
306791
- transition: none;
306792
- }
306793
- }
306794
-
306795
- /* Screen reader only content (WCAG SC 1.3.1) */
306796
- .superdoc-sr-only {
306797
- position: absolute;
306798
- width: 1px;
306799
- height: 1px;
306800
- padding: 0;
306801
- margin: -1px;
306802
- overflow: hidden;
306803
- clip: rect(0, 0, 0, 0);
306804
- white-space: nowrap;
306805
- border: 0;
306806
- }
306807
-
306808
- /* TOC entry specific styles - prevent wrapping */
306809
- .superdoc-toc-entry {
306810
- white-space: nowrap !important;
306811
- }
306812
-
306813
- .superdoc-toc-entry .superdoc-link {
306814
- color: inherit !important;
306815
- text-decoration: none !important;
306816
- cursor: default;
306817
- /* Disable native link drag so our pointer loop can run text-selection. */
306818
- -webkit-user-drag: none;
306819
- user-drag: none;
306820
- }
306821
-
306822
- .superdoc-toc-entry .superdoc-link:hover {
306823
- text-decoration: none;
306824
- }
306825
-
306826
- /* Override focus styles for TOC links (they're not interactive) */
306827
- .superdoc-toc-entry .superdoc-link:focus-visible {
306828
- outline: none;
306829
- }
306830
-
306831
- /* TOC hover. .toc-group-hover is set by PresentationEditor on every entry
306832
- sharing a data-toc-id so the whole TOC greys out together. The ::after
306833
- stripe (height set via --toc-gap-below) fills the paragraph-spacing gap
306834
- between adjacent entries so the hover reads as one continuous block. */
306835
- .superdoc-toc-entry:hover,
306836
- .superdoc-toc-entry.toc-group-hover {
306837
- background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
306838
- }
306839
-
306840
- /* Pointer-events stay on (default) so the stripe extends the parent entry's
306841
- hit-test area through the paragraph-spacing gap. Without this, moving the
306842
- cursor between two adjacent entries fires mouseout on the upper entry with
306843
- relatedTarget = the page (not a TOC entry), the coordinator drops the
306844
- group-hover class, and the grey disappears for a frame before the next
306845
- entry's mouseover restores it — visible as a flicker. */
306846
- .superdoc-toc-entry.toc-group-hover::after {
306847
- content: '';
306848
- position: absolute;
306849
- left: 0;
306850
- right: 0;
306851
- top: 100%;
306852
- height: var(--toc-gap-below, 0px);
306853
- background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
306854
- }
306855
-
306856
- /* Remove focus outlines from layout engine elements */
306857
- .superdoc-layout,
306858
- .superdoc-page,
306859
- .superdoc-layout:focus,
306860
- .superdoc-page:focus {
306861
- outline: none !important;
306862
- }
306863
- `, TRACK_CHANGE_STYLES = `
306756
+ }), PRINT_STYLES, DOCUMENT_SURFACE_STYLES, LINK_AND_TOC_STYLES, TRACK_CHANGE_STYLES = `
306864
306757
  .superdoc-layout .track-insert-dec.hidden,
306865
306758
  .superdoc-layout .track-delete-dec.hidden {
306866
306759
  display: none;
@@ -307669,70 +307562,33 @@ menclose::after {
307669
307562
  pointer-events: none;
307670
307563
  background: var(--sd-menclose-h), var(--sd-menclose-v), var(--sd-menclose-up), var(--sd-menclose-down);
307671
307564
  }
307672
- `, printStylesInjected = false, linkStylesInjected = false, trackChangeStylesInjected = false, formattingMarksStylesInjected = false, sdtContainerStylesInjected = false, fieldAnnotationStylesInjected = false, imageSelectionStylesInjected = false, mathMencloseStylesInjected = false, ensurePrintStyles = (doc$12) => {
307673
- if (printStylesInjected || !doc$12)
307565
+ `, ensureStyleElement = (doc$12, markerAttribute, cssText) => {
307566
+ if (!doc$12?.head)
307674
307567
  return;
307675
- const styleEl = doc$12.createElement("style");
307676
- styleEl.setAttribute("data-superdoc-print-styles", "true");
307677
- styleEl.textContent = PRINT_STYLES;
307678
- doc$12.head?.appendChild(styleEl);
307679
- printStylesInjected = true;
307680
- }, ensureLinkStyles = (doc$12) => {
307681
- if (linkStylesInjected || !doc$12)
307568
+ if (doc$12.head.querySelector(`[${markerAttribute}="true"]`))
307682
307569
  return;
307683
307570
  const styleEl = doc$12.createElement("style");
307684
- styleEl.setAttribute("data-superdoc-link-styles", "true");
307685
- styleEl.textContent = LINK_AND_TOC_STYLES;
307686
- doc$12.head?.appendChild(styleEl);
307687
- linkStylesInjected = true;
307571
+ styleEl.setAttribute(markerAttribute, "true");
307572
+ styleEl.textContent = cssText;
307573
+ doc$12.head.appendChild(styleEl);
307574
+ }, ensurePrintStyles = (doc$12) => {
307575
+ ensureStyleElement(doc$12, "data-superdoc-print-styles", PRINT_STYLES);
307576
+ }, ensureDocumentSurfaceStyles = (doc$12) => {
307577
+ ensureStyleElement(doc$12, "data-superdoc-document-surface-styles", DOCUMENT_SURFACE_STYLES);
307578
+ }, ensureLinkStyles = (doc$12) => {
307579
+ ensureStyleElement(doc$12, "data-superdoc-link-styles", LINK_AND_TOC_STYLES);
307688
307580
  }, ensureTrackChangeStyles = (doc$12) => {
307689
- if (trackChangeStylesInjected || !doc$12)
307690
- return;
307691
- const styleEl = doc$12.createElement("style");
307692
- styleEl.setAttribute("data-superdoc-track-change-styles", "true");
307693
- styleEl.textContent = TRACK_CHANGE_STYLES;
307694
- doc$12.head?.appendChild(styleEl);
307695
- trackChangeStylesInjected = true;
307581
+ ensureStyleElement(doc$12, "data-superdoc-track-change-styles", TRACK_CHANGE_STYLES);
307696
307582
  }, ensureFormattingMarksStyles = (doc$12) => {
307697
- if (formattingMarksStylesInjected || !doc$12)
307698
- return;
307699
- const styleEl = doc$12.createElement("style");
307700
- styleEl.setAttribute("data-superdoc-formatting-marks-styles", "true");
307701
- styleEl.textContent = FORMATTING_MARKS_STYLES;
307702
- doc$12.head?.appendChild(styleEl);
307703
- formattingMarksStylesInjected = true;
307583
+ ensureStyleElement(doc$12, "data-superdoc-formatting-marks-styles", FORMATTING_MARKS_STYLES);
307704
307584
  }, ensureSdtContainerStyles = (doc$12) => {
307705
- if (sdtContainerStylesInjected || !doc$12)
307706
- return;
307707
- const styleEl = doc$12.createElement("style");
307708
- styleEl.setAttribute("data-superdoc-sdt-container-styles", "true");
307709
- styleEl.textContent = SDT_CONTAINER_STYLES;
307710
- doc$12.head?.appendChild(styleEl);
307711
- sdtContainerStylesInjected = true;
307585
+ ensureStyleElement(doc$12, "data-superdoc-sdt-container-styles", SDT_CONTAINER_STYLES);
307712
307586
  }, ensureFieldAnnotationStyles = (doc$12) => {
307713
- if (fieldAnnotationStylesInjected || !doc$12)
307714
- return;
307715
- const styleEl = doc$12.createElement("style");
307716
- styleEl.setAttribute("data-superdoc-field-annotation-styles", "true");
307717
- styleEl.textContent = FIELD_ANNOTATION_STYLES;
307718
- doc$12.head?.appendChild(styleEl);
307719
- fieldAnnotationStylesInjected = true;
307587
+ ensureStyleElement(doc$12, "data-superdoc-field-annotation-styles", FIELD_ANNOTATION_STYLES);
307720
307588
  }, ensureImageSelectionStyles = (doc$12) => {
307721
- if (imageSelectionStylesInjected || !doc$12)
307722
- return;
307723
- const styleEl = doc$12.createElement("style");
307724
- styleEl.setAttribute("data-superdoc-image-selection-styles", "true");
307725
- styleEl.textContent = IMAGE_SELECTION_STYLES;
307726
- doc$12.head?.appendChild(styleEl);
307727
- imageSelectionStylesInjected = true;
307589
+ ensureStyleElement(doc$12, "data-superdoc-image-selection-styles", IMAGE_SELECTION_STYLES);
307728
307590
  }, ensureMathMencloseStyles = (doc$12) => {
307729
- if (mathMencloseStylesInjected || !doc$12)
307730
- return;
307731
- const styleEl = doc$12.createElement("style");
307732
- styleEl.setAttribute("data-superdoc-math-menclose-styles", "true");
307733
- styleEl.textContent = MATH_MENCLOSE_STYLES;
307734
- doc$12.head?.appendChild(styleEl);
307735
- mathMencloseStylesInjected = true;
307591
+ ensureStyleElement(doc$12, "data-superdoc-math-menclose-styles", MATH_MENCLOSE_STYLES);
307736
307592
  }, gradientIdCounter = 0, clampNumber = (value, min$2, max$2) => Math.min(max$2, Math.max(min$2, value)), mergeSortedSegments = (segments) => {
307737
307593
  if (segments.length <= 1)
307738
307594
  return segments;
@@ -308563,14 +308419,6 @@ menclose::after {
308563
308419
  if (justification === "center")
308564
308420
  return anchorPx - markerTextWidthPx / 2;
308565
308421
  return anchorPx;
308566
- }, getNextExplicitTabStopPx = (tabsPx, currentPosPx) => {
308567
- if (!Array.isArray(tabsPx))
308568
- return;
308569
- for (const tabPx of tabsPx)
308570
- if (typeof tabPx === "number" && Number.isFinite(tabPx) && tabPx > currentPosPx)
308571
- return tabPx;
308572
- }, getFirstLineTextStartTargetPx = (wordLayout, marker) => {
308573
- return getFiniteNumber(marker.textStartX) ?? getFiniteNumber(wordLayout?.textStartPx);
308574
308422
  }, getNextDefaultTabStopPx = (currentPosPx) => {
308575
308423
  const remainderPx = currentPosPx % 48;
308576
308424
  if (remainderPx === 0)
@@ -310053,6 +309901,8 @@ menclose::after {
310053
309901
  elem.dataset.trackChangeAuthorEmail = meta2.authorEmail;
310054
309902
  if (meta2.authorImage)
310055
309903
  elem.dataset.trackChangeAuthorImage = meta2.authorImage;
309904
+ if (meta2.color)
309905
+ elem.dataset.trackChangeAuthorColor = meta2.color;
310056
309906
  if (meta2.date)
310057
309907
  elem.dataset.trackChangeDate = meta2.date;
310058
309908
  }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, nextRowLeavesRightGap, deferTopToAboveCell, nextRowSuppressesSharedTop }) => {
@@ -311068,10 +310918,11 @@ menclose::after {
311068
310918
  return "";
311069
310919
  if (!runToken)
311070
310920
  return run2.text ?? "";
310921
+ const pageNumberFieldFormat = "pageNumberFieldFormat" in run2 ? run2.pageNumberFieldFormat : undefined;
311071
310922
  if (runToken === "pageNumber") {
311072
- if (run2.pageNumberFieldFormat)
310923
+ if (pageNumberFieldFormat)
311073
310924
  return formatChapterPageNumberText({
311074
- pageComponent: formatPageNumberFieldValue(context.displayPageNumber ?? context.pageNumber, run2.pageNumberFieldFormat),
310925
+ pageComponent: formatPageNumberFieldValue(context.displayPageNumber ?? context.pageNumber, pageNumberFieldFormat),
311075
310926
  chapterNumberText: context.pageNumberChapterText,
311076
310927
  chapterSeparator: context.pageNumberChapterSeparator
311077
310928
  });
@@ -311085,16 +310936,16 @@ menclose::after {
311085
310936
  return context.pageNumberText ?? String(context.pageNumber);
311086
310937
  }
311087
310938
  if (runToken === "totalPageCount") {
311088
- if (run2.pageNumberFieldFormat)
311089
- return formatPageNumberFieldValue(context.totalPages || 1, run2.pageNumberFieldFormat);
310939
+ if (pageNumberFieldFormat)
310940
+ return formatPageNumberFieldValue(context.totalPages || 1, pageNumberFieldFormat);
311090
310941
  return context.totalPages ? String(context.totalPages) : run2.text ?? "";
311091
310942
  }
311092
310943
  if (runToken === "sectionPageCount") {
311093
310944
  const sectionPageCount = context.sectionPageCount;
311094
310945
  if (sectionPageCount == null)
311095
310946
  return run2.text ?? "";
311096
- if (run2.pageNumberFieldFormat)
311097
- return formatPageNumberFieldValue(sectionPageCount, run2.pageNumberFieldFormat);
310947
+ if (pageNumberFieldFormat)
310948
+ return formatPageNumberFieldValue(sectionPageCount, pageNumberFieldFormat);
311098
310949
  return String(sectionPageCount);
311099
310950
  }
311100
310951
  return run2.text ?? "";
@@ -311111,6 +310962,7 @@ menclose::after {
311111
310962
  const linkData = extractLinkData(run2);
311112
310963
  const isActiveLink = !!(linkData && !linkData.blocked && linkData.href);
311113
310964
  const elem = isActiveLink ? renderContext.doc.createElement("a") : renderContext.doc.createElement("span");
310965
+ elem.classList.add(CLASS_NAMES$1.textRun);
311114
310966
  const text5 = resolveRunText(run2, context);
311115
310967
  const effectiveText = run2.bidi?.rtl === true && typeof text5 === "string" ? normalizeRtlDateTokenForWordParity(text5) : text5;
311116
310968
  setTextContentWithFormattingSpaceMarks(elem, effectiveText, renderContext.doc, renderContext.showFormattingMarks);
@@ -312881,6 +312733,7 @@ menclose::after {
312881
312733
  } else
312882
312734
  this.currentMapping = mapping ?? null;
312883
312735
  ensurePrintStyles(doc$12);
312736
+ ensureDocumentSurfaceStyles(doc$12);
312884
312737
  ensureLinkStyles(doc$12);
312885
312738
  ensureTrackChangeStyles(doc$12);
312886
312739
  ensureFormattingMarksStyles(doc$12);
@@ -313033,6 +312886,24 @@ menclose::after {
313033
312886
  win.addEventListener("resize", this.onResizeHandler);
313034
312887
  }
313035
312888
  }
312889
+ releaseVirtualizationHandlers() {
312890
+ if (this.mount && this.onScrollHandler)
312891
+ try {
312892
+ this.mount.removeEventListener("scroll", this.onScrollHandler);
312893
+ } catch {}
312894
+ const win = this.doc?.defaultView;
312895
+ if (win && this.onWindowScrollHandler)
312896
+ try {
312897
+ win.removeEventListener("scroll", this.onWindowScrollHandler);
312898
+ } catch {}
312899
+ if (win && this.onResizeHandler)
312900
+ try {
312901
+ win.removeEventListener("resize", this.onResizeHandler);
312902
+ } catch {}
312903
+ this.onScrollHandler = null;
312904
+ this.onWindowScrollHandler = null;
312905
+ this.onResizeHandler = null;
312906
+ }
313036
312907
  computeVirtualMetrics() {
313037
312908
  if (!this.currentLayout)
313038
312909
  return;
@@ -313444,6 +313315,15 @@ menclose::after {
313444
313315
  const container = existing ?? this.doc.createElement("div");
313445
313316
  container.className = className;
313446
313317
  container.innerHTML = "";
313318
+ if (typeof data.headerFooterRefId === "string" && data.headerFooterRefId.length > 0)
313319
+ container.setAttribute("data-sd-headerfooter-ref-id", data.headerFooterRefId);
313320
+ else
313321
+ container.removeAttribute("data-sd-headerfooter-ref-id");
313322
+ if (typeof data.sectionType === "string" && data.sectionType.length > 0)
313323
+ container.setAttribute("data-sd-headerfooter-variant", data.sectionType);
313324
+ else
313325
+ container.removeAttribute("data-sd-headerfooter-variant");
313326
+ container.setAttribute("data-sd-headerfooter-kind", kind);
313447
313327
  const baseOffset = data.offset;
313448
313328
  const marginLeft = data.marginLeft ?? 0;
313449
313329
  const marginRight = page.margins?.right ?? 0;
@@ -313550,18 +313430,7 @@ menclose::after {
313550
313430
  }
313551
313431
  resetState() {
313552
313432
  if (this.mount) {
313553
- if (this.onScrollHandler)
313554
- try {
313555
- this.mount.removeEventListener("scroll", this.onScrollHandler);
313556
- } catch {}
313557
- if (this.onWindowScrollHandler && this.doc?.defaultView)
313558
- try {
313559
- this.doc.defaultView.removeEventListener("scroll", this.onWindowScrollHandler);
313560
- } catch {}
313561
- if (this.onResizeHandler && this.doc?.defaultView)
313562
- try {
313563
- this.doc.defaultView.removeEventListener("resize", this.onResizeHandler);
313564
- } catch {}
313433
+ this.releaseVirtualizationHandlers();
313565
313434
  this.mount.innerHTML = "";
313566
313435
  }
313567
313436
  this.pageStates = [];
@@ -313570,9 +313439,6 @@ menclose::after {
313570
313439
  this.topSpacerEl = null;
313571
313440
  this.bottomSpacerEl = null;
313572
313441
  this.virtualPagesEl = null;
313573
- this.onScrollHandler = null;
313574
- this.onWindowScrollHandler = null;
313575
- this.onResizeHandler = null;
313576
313442
  this.scrollContainerMountOffset = null;
313577
313443
  this.layoutVersion = 0;
313578
313444
  this.processedLayoutVersion = -1;
@@ -313580,6 +313446,40 @@ menclose::after {
313580
313446
  this.lastPaintSnapshot = null;
313581
313447
  this.mountedPageIndices = [];
313582
313448
  }
313449
+ dispose() {
313450
+ this.releaseVirtualizationHandlers();
313451
+ if (this.mount)
313452
+ this.mount.innerHTML = "";
313453
+ this.pageStates = [];
313454
+ this.currentLayout = null;
313455
+ this.changedBlocks.clear();
313456
+ this.sectionPageCounts.clear();
313457
+ this.sdtLabelsRendered.clear();
313458
+ this.clearGapSpacers();
313459
+ this.topSpacerEl = null;
313460
+ this.bottomSpacerEl = null;
313461
+ this.virtualPagesEl = null;
313462
+ this.virtualPinnedPages = [];
313463
+ this.virtualMountedKey = "";
313464
+ this.pageIndexToState.clear();
313465
+ this.virtualHeights = [];
313466
+ this.virtualOffsets = [];
313467
+ this.virtualStart = 0;
313468
+ this.virtualEnd = -1;
313469
+ this.scrollContainer = null;
313470
+ this.scrollContainerMountOffset = null;
313471
+ this.layoutVersion = 0;
313472
+ this.layoutEpoch = 0;
313473
+ this.processedLayoutVersion = -1;
313474
+ this.currentMapping = null;
313475
+ this.paintSnapshotBuilder = null;
313476
+ this.lastPaintSnapshot = null;
313477
+ this.mountedPageIndices = [];
313478
+ this.resolvedLayout = null;
313479
+ this.totalPages = 0;
313480
+ this.mount = null;
313481
+ this.doc = null;
313482
+ }
313583
313483
  getSectionPageCount(page) {
313584
313484
  return this.sectionPageCounts.get(page.sectionIndex ?? 0) ?? this.totalPages ?? 1;
313585
313485
  }
@@ -314840,6 +314740,9 @@ menclose::after {
314840
314740
  },
314841
314741
  setShowFormattingMarks(showFormattingMarks) {
314842
314742
  painter.setShowFormattingMarks(showFormattingMarks);
314743
+ },
314744
+ dispose() {
314745
+ painter.dispose();
314843
314746
  }
314844
314747
  };
314845
314748
  }, PresentationPaintIndex = class {
@@ -317566,6 +317469,40 @@ menclose::after {
317566
317469
  if (!(v.blocksById instanceof Map))
317567
317470
  return false;
317568
317471
  return true;
317472
+ }, findPageIndexForBlockId = (layout, blockId) => {
317473
+ for (let pageIndex = 0;pageIndex < layout.pages.length; pageIndex += 1) {
317474
+ const page = layout.pages[pageIndex];
317475
+ if (!page)
317476
+ continue;
317477
+ for (const fragment2 of page.fragments)
317478
+ if (fragment2.blockId === blockId)
317479
+ return pageIndex;
317480
+ }
317481
+ return null;
317482
+ }, findFragmentForBlockId = (page, blockId) => {
317483
+ for (const fragment2 of page.fragments)
317484
+ if (fragment2.blockId === blockId)
317485
+ return fragment2;
317486
+ return null;
317487
+ }, findLineIndexForRunOrdinal = (measure, runOrdinal) => {
317488
+ if (!measure || !Array.isArray(measure.lines))
317489
+ return null;
317490
+ for (let lineIndex = 0;lineIndex < measure.lines.length; lineIndex += 1) {
317491
+ const line = measure.lines[lineIndex];
317492
+ if (runOrdinal >= line.fromRun && runOrdinal <= line.toRun)
317493
+ return lineIndex;
317494
+ }
317495
+ return null;
317496
+ }, findFragmentForBlockRunOrdinal = (page, blockId, lineIndex) => {
317497
+ for (const fragment2 of page.fragments) {
317498
+ if (fragment2.kind !== "para" && fragment2.kind !== "list-item")
317499
+ continue;
317500
+ if (fragment2.blockId !== blockId)
317501
+ continue;
317502
+ if (lineIndex >= fragment2.fromLine && lineIndex < fragment2.toLine)
317503
+ return fragment2;
317504
+ }
317505
+ return null;
317569
317506
  }, findPageIndexForPos = (layout, pos) => {
317570
317507
  if (!Number.isFinite(pos))
317571
317508
  return null;
@@ -317657,18 +317594,43 @@ menclose::after {
317657
317594
  return fragment2;
317658
317595
  }
317659
317596
  return null;
317660
- }, assignFootnotesToColumns = (layout, refs, pageColumns) => {
317597
+ }, assignFootnotesToColumns = (layout, refs, pageColumns, paragraphMeasuresByBlockId) => {
317661
317598
  const result = /* @__PURE__ */ new Map;
317662
317599
  const seenByColumn = /* @__PURE__ */ new Map;
317663
317600
  for (const ref$1 of refs) {
317664
- const pageIndex = findPageIndexForPos(layout, ref$1.pos);
317601
+ let pageIndex = null;
317602
+ let fragment2 = null;
317603
+ if (ref$1.blockId) {
317604
+ if (typeof ref$1.runOrdinal === "number" && Number.isFinite(ref$1.runOrdinal) && ref$1.runOrdinal >= 0) {
317605
+ const lineIndex = findLineIndexForRunOrdinal(paragraphMeasuresByBlockId.get(ref$1.blockId), ref$1.runOrdinal);
317606
+ if (lineIndex != null)
317607
+ for (let candidatePageIndex = 0;candidatePageIndex < layout.pages.length; candidatePageIndex += 1) {
317608
+ const candidatePage = layout.pages[candidatePageIndex];
317609
+ const candidateFragment = findFragmentForBlockRunOrdinal(candidatePage, ref$1.blockId, lineIndex);
317610
+ if (!candidateFragment)
317611
+ continue;
317612
+ pageIndex = candidatePageIndex;
317613
+ fragment2 = candidateFragment;
317614
+ break;
317615
+ }
317616
+ }
317617
+ if (pageIndex == null) {
317618
+ pageIndex = findPageIndexForBlockId(layout, ref$1.blockId);
317619
+ if (pageIndex != null)
317620
+ fragment2 = findFragmentForBlockId(layout.pages[pageIndex], ref$1.blockId);
317621
+ }
317622
+ }
317623
+ if (pageIndex == null) {
317624
+ pageIndex = findPageIndexForPos(layout, ref$1.pos);
317625
+ if (pageIndex != null)
317626
+ fragment2 = findFragmentForPos(layout.pages[pageIndex], ref$1.pos);
317627
+ }
317665
317628
  if (pageIndex == null)
317666
317629
  continue;
317667
317630
  const columns = pageColumns.get(pageIndex);
317668
317631
  const page = layout.pages[pageIndex];
317669
317632
  let columnIndex = 0;
317670
317633
  if (columns && columns.count > 1 && page) {
317671
- const fragment2 = findFragmentForPos(page, ref$1.pos);
317672
317634
  if (fragment2?.kind === "table" && typeof fragment2.columnIndex === "number")
317673
317635
  columnIndex = Math.max(0, Math.min(columns.count - 1, fragment2.columnIndex));
317674
317636
  else if (fragment2 && typeof fragment2.x === "number") {
@@ -324632,13 +324594,13 @@ menclose::after {
324632
324594
  return;
324633
324595
  console.log(...args$1);
324634
324596
  }, 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;
324635
- var init_src_CzUaHQHM_es = __esm(() => {
324597
+ var init_src_COxdGpKV_es = __esm(() => {
324636
324598
  init_rolldown_runtime_Bg48TavK_es();
324637
- init_SuperConverter_BvXoKdBC_es();
324599
+ init_SuperConverter_0i3YuAr2_es();
324638
324600
  init_jszip_C49i9kUs_es();
324639
324601
  init_xml_js_CqGKpaft_es();
324640
324602
  init_uuid_B2wVPhPi_es();
324641
- init_create_headless_toolbar_BVxCjzNG_es();
324603
+ init_create_headless_toolbar_DYCEnt7x_es();
324642
324604
  init_constants_D9qj59G2_es();
324643
324605
  init_unified_BDuVPlMu_es();
324644
324606
  init_remark_gfm_BUJjZJLy_es();
@@ -324648,9 +324610,9 @@ var init_src_CzUaHQHM_es = __esm(() => {
324648
324610
  init_eventemitter3_UwU_CLPU_es();
324649
324611
  init_errors_C_DoKMoN_es();
324650
324612
  init_blank_docx_CDDHd6CH_es();
324613
+ init_vue();
324651
324614
  init_yjs();
324652
324615
  init_yjs();
324653
- init_vue();
324654
324616
  NONE_FAILURES2 = [];
324655
324617
  NONE_THROWS2 = [];
324656
324618
  FOOTNOTE_MUTATION_FAILURES2 = ["INVALID_FRAGMENT", "CAPABILITY_UNAVAILABLE"];
@@ -358507,13 +358469,15 @@ function print() { __p += __j.call(arguments, '') }
358507
358469
  line: "superdoc-line",
358508
358470
  spread: "superdoc-spread",
358509
358471
  pageHeader: "superdoc-page-header",
358510
- pageFooter: "superdoc-page-footer"
358472
+ pageFooter: "superdoc-page-footer",
358473
+ textRun: "superdoc-text-run"
358511
358474
  };
358512
358475
  DEFAULT_PAGE_STYLES = {
358513
358476
  background: "var(--sd-layout-page-bg, #fff)",
358514
358477
  boxShadow: "var(--sd-layout-page-shadow, 0 4px 20px rgba(15, 23, 42, 0.08))",
358515
358478
  border: "1px solid rgba(15, 23, 42, 0.08)",
358516
- margin: "0 auto"
358479
+ margin: "0 auto",
358480
+ color: "var(--sd-layout-page-color, #000000)"
358517
358481
  };
358518
358482
  containerStyles = {
358519
358483
  display: "flex",
@@ -358545,7 +358509,8 @@ function print() { __p += __j.call(arguments, '') }
358545
358509
  position: "absolute",
358546
358510
  whiteSpace: "pre",
358547
358511
  overflow: "visible",
358548
- boxSizing: "border-box"
358512
+ boxSizing: "border-box",
358513
+ color: "inherit"
358549
358514
  };
358550
358515
  PRINT_STYLES = `
358551
358516
  @media print {
@@ -358561,6 +358526,189 @@ function print() { __p += __j.call(arguments, '') }
358561
358526
  page-break-after: always;
358562
358527
  }
358563
358528
  }
358529
+ `;
358530
+ DOCUMENT_SURFACE_STYLES = `
358531
+ /* Document paint isolation.
358532
+ *
358533
+ * The rendered page is document content, not host chrome. Establish a page
358534
+ * foreground and force painter-owned wrappers/text runs to inherit from that
358535
+ * page so common host CSS such as :root/body/span/body * color rules cannot
358536
+ * recolor unresolved/auto document text. This deliberately avoids priority flags:
358537
+ * real run colors applied as inline styles and painter feature states still win.
358538
+ */
358539
+ .${CLASS_NAMES$1.container} {
358540
+ color: var(--sd-layout-page-color, #000000);
358541
+ }
358542
+
358543
+ .${CLASS_NAMES$1.container} .${CLASS_NAMES$1.page},
358544
+ .${CLASS_NAMES$1.container} .${CLASS_NAMES$1.pageHeader},
358545
+ .${CLASS_NAMES$1.container} .${CLASS_NAMES$1.pageFooter},
358546
+ .${CLASS_NAMES$1.container} .${CLASS_NAMES$1.fragment},
358547
+ .${CLASS_NAMES$1.container} .${CLASS_NAMES$1.line},
358548
+ .${CLASS_NAMES$1.container} .superdoc-list-content,
358549
+ .${CLASS_NAMES$1.container} .${DOM_CLASS_NAMES.LIST_MARKER} {
358550
+ color: inherit;
358551
+ }
358552
+
358553
+ .${CLASS_NAMES$1.container} .${CLASS_NAMES$1.page} .${CLASS_NAMES$1.textRun}:not([data-bookmark-marker]) {
358554
+ color: inherit;
358555
+ }
358556
+ `;
358557
+ LINK_AND_TOC_STYLES = `
358558
+ /* Reset browser default link styling - allow run colors to show through from inline styles
358559
+ *
358560
+ * Note: !important was removed from these rules to allow inline styles to take precedence.
358561
+ * This is necessary because OOXML hyperlink character styles apply colors via inline style
358562
+ * attributes on the run elements. The CSS cascade ensures that inline styles (applied via
358563
+ * element.style.color in applyRunStyles) override these class-based rules naturally.
358564
+ *
358565
+ * Implications:
358566
+ * - OOXML hyperlink character styles will correctly display their assigned colors
358567
+ * - Browser default link colors are still reset by these inherit rules
358568
+ * - Inline color styles from run objects override the inherit value as expected
358569
+ */
358570
+ .superdoc-link {
358571
+ color: inherit;
358572
+ text-decoration: none;
358573
+ }
358574
+
358575
+ .superdoc-link:visited {
358576
+ color: inherit;
358577
+ }
358578
+
358579
+ .superdoc-link:hover {
358580
+ text-decoration: underline;
358581
+ }
358582
+
358583
+ /* Focus visible for keyboard navigation (WCAG 2.1 SC 2.4.7) */
358584
+ .superdoc-link:focus-visible {
358585
+ outline: 2px solid #0066cc;
358586
+ outline-offset: 2px;
358587
+ border-radius: 2px;
358588
+ }
358589
+
358590
+ /* Remove outline for mouse users */
358591
+ .superdoc-link:focus:not(:focus-visible) {
358592
+ outline: none;
358593
+ }
358594
+
358595
+ /* Active state */
358596
+ .superdoc-link:active {
358597
+ opacity: 0.8;
358598
+ }
358599
+
358600
+ /* Print mode: show URLs after links */
358601
+ @media print {
358602
+ .superdoc-link::after {
358603
+ content: " (" attr(href) ")";
358604
+ font-size: 0.9em;
358605
+ color: #666;
358606
+ }
358607
+
358608
+ /* Don't show URL for anchor-only links */
358609
+ .superdoc-link[href^="#"]::after {
358610
+ content: "";
358611
+ }
358612
+ }
358613
+
358614
+ /* High contrast mode support */
358615
+ @media (prefers-contrast: high) {
358616
+ .superdoc-link:focus-visible {
358617
+ outline-width: 3px;
358618
+ outline-offset: 3px;
358619
+ }
358620
+ }
358621
+
358622
+ /* SD-2454: bookmark bracket indicators.
358623
+ * When the showBookmarks layout option is enabled, the pm-adapter emits
358624
+ * [ and ] marker TextRuns at bookmark start/end positions. Mirror Word's
358625
+ * visual treatment: subtle gray, non-selectable so users can't accidentally
358626
+ * include the brackets in copied text. The bookmark name is surfaced via
358627
+ * the native title tooltip on the opening bracket. */
358628
+ .${CLASS_NAMES$1.container} [data-bookmark-marker="start"],
358629
+ .${CLASS_NAMES$1.container} [data-bookmark-marker="end"] {
358630
+ color: #8b8b8b;
358631
+ user-select: none;
358632
+ cursor: default;
358633
+ font-weight: normal;
358634
+ }
358635
+
358636
+
358637
+ /* Reduced motion support */
358638
+ @media (prefers-reduced-motion: reduce) {
358639
+ .superdoc-link {
358640
+ transition: none;
358641
+ }
358642
+ }
358643
+
358644
+ /* Screen reader only content (WCAG SC 1.3.1) */
358645
+ .superdoc-sr-only {
358646
+ position: absolute;
358647
+ width: 1px;
358648
+ height: 1px;
358649
+ padding: 0;
358650
+ margin: -1px;
358651
+ overflow: hidden;
358652
+ clip: rect(0, 0, 0, 0);
358653
+ white-space: nowrap;
358654
+ border: 0;
358655
+ }
358656
+
358657
+ /* TOC entry specific styles - prevent wrapping */
358658
+ .superdoc-toc-entry {
358659
+ white-space: nowrap !important;
358660
+ }
358661
+
358662
+ .superdoc-toc-entry .superdoc-link {
358663
+ color: inherit !important;
358664
+ text-decoration: none !important;
358665
+ cursor: default;
358666
+ /* Disable native link drag so our pointer loop can run text-selection. */
358667
+ -webkit-user-drag: none;
358668
+ user-drag: none;
358669
+ }
358670
+
358671
+ .superdoc-toc-entry .superdoc-link:hover {
358672
+ text-decoration: none;
358673
+ }
358674
+
358675
+ /* Override focus styles for TOC links (they're not interactive) */
358676
+ .superdoc-toc-entry .superdoc-link:focus-visible {
358677
+ outline: none;
358678
+ }
358679
+
358680
+ /* TOC hover. .toc-group-hover is set by PresentationEditor on every entry
358681
+ sharing a data-toc-id so the whole TOC greys out together. The ::after
358682
+ stripe (height set via --toc-gap-below) fills the paragraph-spacing gap
358683
+ between adjacent entries so the hover reads as one continuous block. */
358684
+ .superdoc-toc-entry:hover,
358685
+ .superdoc-toc-entry.toc-group-hover {
358686
+ background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
358687
+ }
358688
+
358689
+ /* Pointer-events stay on (default) so the stripe extends the parent entry's
358690
+ hit-test area through the paragraph-spacing gap. Without this, moving the
358691
+ cursor between two adjacent entries fires mouseout on the upper entry with
358692
+ relatedTarget = the page (not a TOC entry), the coordinator drops the
358693
+ group-hover class, and the grey disappears for a frame before the next
358694
+ entry's mouseover restores it — visible as a flicker. */
358695
+ .superdoc-toc-entry.toc-group-hover::after {
358696
+ content: '';
358697
+ position: absolute;
358698
+ left: 0;
358699
+ right: 0;
358700
+ top: 100%;
358701
+ height: var(--toc-gap-below, 0px);
358702
+ background-color: var(--sd-content-controls-block-hover-bg, #f2f2f2);
358703
+ }
358704
+
358705
+ /* Remove focus outlines from layout engine elements */
358706
+ .superdoc-layout,
358707
+ .superdoc-page,
358708
+ .superdoc-layout:focus,
358709
+ .superdoc-page:focus {
358710
+ outline: none !important;
358711
+ }
358564
358712
  `;
358565
358713
  IMAGE_SELECTION_STYLES = `
358566
358714
  /* Highlight for selected images (block or inline) */
@@ -366544,11 +366692,11 @@ function print() { __p += __j.call(arguments, '') }
366544
366692
  ]);
366545
366693
  });
366546
366694
 
366547
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DFb-Hgkj.es.js
366695
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-C1LNsWpB.es.js
366548
366696
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, 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, FONT_SIZE_OPTIONS;
366549
- var init_create_super_doc_ui_DFb_Hgkj_es = __esm(() => {
366550
- init_SuperConverter_BvXoKdBC_es();
366551
- init_create_headless_toolbar_BVxCjzNG_es();
366697
+ var init_create_super_doc_ui_C1LNsWpB_es = __esm(() => {
366698
+ init_SuperConverter_0i3YuAr2_es();
366699
+ init_create_headless_toolbar_DYCEnt7x_es();
366552
366700
  DEFAULT_TEXT_ALIGN_OPTIONS = [
366553
366701
  {
366554
366702
  label: "Left",
@@ -366839,15 +366987,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
366839
366987
 
366840
366988
  // ../../packages/superdoc/dist/super-editor.es.js
366841
366989
  var init_super_editor_es = __esm(() => {
366842
- init_src_CzUaHQHM_es();
366843
- init_SuperConverter_BvXoKdBC_es();
366990
+ init_src_COxdGpKV_es();
366991
+ init_SuperConverter_0i3YuAr2_es();
366844
366992
  init_jszip_C49i9kUs_es();
366845
366993
  init_xml_js_CqGKpaft_es();
366846
- init_create_headless_toolbar_BVxCjzNG_es();
366994
+ init_create_headless_toolbar_DYCEnt7x_es();
366847
366995
  init_constants_D9qj59G2_es();
366848
366996
  init_unified_BDuVPlMu_es();
366849
366997
  init_DocxZipper_BzS208BW_es();
366850
- init_create_super_doc_ui_DFb_Hgkj_es();
366998
+ init_create_super_doc_ui_C1LNsWpB_es();
366851
366999
  init_ui_CGB3qmy3_es();
366852
367000
  init_eventemitter3_UwU_CLPU_es();
366853
367001
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.33",
3
+ "version": "0.17.0-next.34",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -27,19 +27,19 @@
27
27
  "typescript": "^5.9.2",
28
28
  "y-protocols": "^1.0.6",
29
29
  "@superdoc/document-api": "0.1.0-alpha.0",
30
- "superdoc": "1.41.0",
31
- "@superdoc/super-editor": "0.0.1"
30
+ "@superdoc/super-editor": "0.0.1",
31
+ "superdoc": "1.41.0"
32
32
  },
33
33
  "module": "src/index.ts",
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.33",
39
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.33",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.33",
41
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.33",
42
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.33"
38
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.34",
39
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.34",
40
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.34",
41
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.34",
42
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.34"
43
43
  },
44
44
  "scripts": {
45
45
  "predev": "node scripts/ensure-superdoc-build.js",