@superdoc-dev/cli 0.7.0-next.3 → 0.7.0-next.5

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 +166 -74
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -204289,7 +204289,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
204289
204289
  init_remark_gfm_BhnWr3yf_es();
204290
204290
  });
204291
204291
 
204292
- // ../../packages/superdoc/dist/chunks/src-D6bw0Eho.es.js
204292
+ // ../../packages/superdoc/dist/chunks/src-Bf2Vgwaf.es.js
204293
204293
  function deleteProps(obj, propOrProps) {
204294
204294
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
204295
204295
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -204577,6 +204577,16 @@ function shouldApplyJustify(params$1) {
204577
204577
  return false;
204578
204578
  return true;
204579
204579
  }
204580
+ function getFirstLineIndentOffset(indent2, suppressFirstLineIndent) {
204581
+ if (suppressFirstLineIndent)
204582
+ return 0;
204583
+ return (indent2?.firstLine ?? 0) - (indent2?.hanging ?? 0);
204584
+ }
204585
+ function adjustAvailableWidthForTextIndent(availableWidth, textIndentOffset, lineMaxWidth) {
204586
+ if (textIndentOffset !== 0 && (textIndentOffset < 0 || lineMaxWidth == null))
204587
+ return Math.max(0, availableWidth - textIndentOffset);
204588
+ return availableWidth;
204589
+ }
204580
204590
  function calculateJustifySpacing(params$1) {
204581
204591
  const { lineWidth, availableWidth, spaceCount, shouldJustify } = params$1;
204582
204592
  if (!shouldJustify)
@@ -245430,6 +245440,18 @@ function classifyMathText(text5) {
245430
245440
  return "mo";
245431
245441
  return "mi";
245432
245442
  }
245443
+ function resolveMathVariant(rPr) {
245444
+ const elements = rPr?.elements ?? [];
245445
+ const sty = elements.find((el) => el.name === "m:sty")?.attributes?.["m:val"];
245446
+ if (sty && STY_TO_VARIANT[sty])
245447
+ return STY_TO_VARIANT[sty];
245448
+ const scr = elements.find((el) => el.name === "m:scr")?.attributes?.["m:val"];
245449
+ if (scr && SCR_TO_VARIANT[scr])
245450
+ return SCR_TO_VARIANT[scr];
245451
+ if (elements.some((el) => el.name === "m:nor"))
245452
+ return "normal";
245453
+ return null;
245454
+ }
245433
245455
  function forceNormalMathVariant(root3) {
245434
245456
  root3.querySelectorAll("mi").forEach((identifier) => {
245435
245457
  identifier.setAttribute("mathvariant", "normal");
@@ -245939,6 +245961,7 @@ function resolveParagraphContent(fragment2, block, measure) {
245939
245961
  if (!hasExplicitSegmentPositioning)
245940
245962
  textIndentPx = firstLineOffset;
245941
245963
  }
245964
+ availableWidth = adjustAvailableWidthForTextIndent(availableWidth, textIndentPx, line.maxWidth);
245942
245965
  const indentLeft = paraIndent?.left ?? 0;
245943
245966
  const firstLine = paraIndent?.firstLine ?? 0;
245944
245967
  const hanging = paraIndent?.hanging ?? 0;
@@ -250919,11 +250942,11 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
250919
250942
  const indentRight = Math.max(0, rawIndentRight);
250920
250943
  const indentFirstLine = Math.max(0, indent2?.firstLine ?? 0);
250921
250944
  const indentHanging = Math.max(0, indent2?.hanging ?? 0);
250922
- const baseFirstLineOffset = firstLineIndent || indentFirstLine - indentHanging;
250923
- const rawFirstLineOffset = baseFirstLineOffset;
250945
+ const baseFirstLineOffset = attrs?.suppressFirstLineIndent === true ? 0 : firstLineIndent || indentFirstLine - indentHanging;
250924
250946
  const clampedFirstLineOffset = Math.max(0, baseFirstLineOffset);
250925
- const hasNegativeIndent = rawIndentLeft < 0 || rawIndentRight < 0;
250926
- const effectiveFirstLineOffset = !wordLayout?.marker && !hasNegativeIndent && baseFirstLineOffset < 0 ? baseFirstLineOffset : clampedFirstLineOffset;
250947
+ const hasNegativeLeftIndent = rawIndentLeft < 0;
250948
+ const allowNegativeFirstLineOffset = !wordLayout?.marker && !hasNegativeLeftIndent && baseFirstLineOffset < 0;
250949
+ const effectiveFirstLineOffset = wordLayout?.marker ? 0 : allowNegativeFirstLineOffset ? baseFirstLineOffset : clampedFirstLineOffset;
250927
250950
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
250928
250951
  const textStartPx = wordLayout?.textStartPx;
250929
250952
  let measuredMarkerTextWidth;
@@ -250945,7 +250968,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
250945
250968
  while (currentRun < runs2.length) {
250946
250969
  const isFirstLine = lines.length === 0;
250947
250970
  const effectiveMaxWidth = Math.max(1, isFirstLine ? firstLineWidth : contentWidth);
250948
- const effectiveIndent = isFirstLine ? indentLeft + rawFirstLineOffset : indentLeft;
250971
+ const effectiveIndent = isFirstLine ? indentLeft + baseFirstLineOffset : indentLeft;
250949
250972
  const startRun = currentRun;
250950
250973
  const startChar = currentChar;
250951
250974
  let width = 0;
@@ -251123,7 +251146,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
251123
251146
  const hasTabRun = runs2.some((run2) => run2?.kind === "tab");
251124
251147
  const hasTextTab = runs2.some((run2) => run2?.kind === "text" && typeof run2.text === "string" && run2.text.includes("\t"));
251125
251148
  if (hasTabRun || hasTextTab)
251126
- applyTabLayoutToLines(lines, runs2, tabStops, decimalSeparator, indentLeft, rawFirstLineOffset);
251149
+ applyTabLayoutToLines(lines, runs2, tabStops, decimalSeparator, indentLeft, baseFirstLineOffset);
251127
251150
  const totalHeight = lines.reduce((s2, l) => s2 + l.lineHeight, 0);
251128
251151
  const marker = wordLayout?.marker;
251129
251152
  return {
@@ -252477,10 +252500,16 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
252477
252500
  const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
252478
252501
  const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
252479
252502
  const totalIndent = (Number.isFinite(indentLeft) ? indentLeft : 0) + (Number.isFinite(indentRight) ? indentRight : 0);
252480
- const availableWidth = Math.max(0, fragment2.width - totalIndent);
252503
+ let availableWidth = Math.max(0, fragment2.width - totalIndent);
252481
252504
  if (totalIndent > fragment2.width)
252482
252505
  console.warn(`[clickToPosition] Paragraph indents (${totalIndent}px) exceed fragment width (${fragment2.width}px) for block ${fragment2.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`);
252483
252506
  const isListItem$1 = (fragment2.markerWidth ?? measure.marker?.markerWidth ?? 0) > 0;
252507
+ const hasRenderedMarkerText = isListItem$1 && Boolean(fragment2.markerTextWidth);
252508
+ if (lineIndex === 0 && !fragment2.continuesFromPrev && !hasRenderedMarkerText) {
252509
+ const suppressFLI = block.attrs?.suppressFirstLineIndent === true;
252510
+ const firstLineOffset = getFirstLineIndentOffset(block.attrs?.indent, suppressFLI);
252511
+ availableWidth = adjustAvailableWidthForTextIndent(availableWidth, firstLineOffset, line.maxWidth);
252512
+ }
252484
252513
  const isJustified = block.attrs?.alignment === "justify";
252485
252514
  const alignmentOverride = isListItem$1 && !isJustified ? "left" : undefined;
252486
252515
  const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment2.x, isRTL, availableWidth, alignmentOverride);
@@ -252521,10 +252550,17 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
252521
252550
  const indentLeft = typeof cellBlock.attrs?.indent?.left === "number" ? cellBlock.attrs.indent.left : 0;
252522
252551
  const indentRight = typeof cellBlock.attrs?.indent?.right === "number" ? cellBlock.attrs.indent.right : 0;
252523
252552
  const totalIndent = (Number.isFinite(indentLeft) ? indentLeft : 0) + (Number.isFinite(indentRight) ? indentRight : 0);
252524
- const availableWidth = Math.max(0, tableHit.fragment.width - totalIndent);
252553
+ let availableWidth = Math.max(0, tableHit.fragment.width - totalIndent);
252525
252554
  if (totalIndent > tableHit.fragment.width)
252526
252555
  console.warn(`[clickToPosition:table] Paragraph indents (${totalIndent}px) exceed fragment width (${tableHit.fragment.width}px) for block ${tableHit.fragment.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`);
252527
252556
  const isListItem$1 = (cellMeasure.marker?.markerWidth ?? 0) > 0;
252557
+ const cellLineStart = tableHit.fragment.partialRow?.fromLineByCell?.[tableHit.cellColIndex] ?? 0;
252558
+ const localStartLine = Math.max(0, cellLineStart - tableHit.blockStartGlobal);
252559
+ if (lineIndex === 0 && localStartLine === 0 && !isListItem$1) {
252560
+ const suppressFLI = cellBlock.attrs?.suppressFirstLineIndent === true;
252561
+ const firstLineOffset = getFirstLineIndentOffset(cellBlock.attrs?.indent, suppressFLI);
252562
+ availableWidth = adjustAvailableWidthForTextIndent(availableWidth, firstLineOffset, line.maxWidth);
252563
+ }
252528
252564
  const isJustified = cellBlock.attrs?.alignment === "justify";
252529
252565
  const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, isListItem$1 && !isJustified ? "left" : undefined);
252530
252566
  if (pos != null)
@@ -252600,15 +252636,17 @@ function selectionToRects(layout, blocks2, measures, from$1, to, geometryHelper)
252600
252636
  const isListItemFlag = isListItem2(markerWidth, block);
252601
252637
  const isJustified = block.attrs?.alignment === "justify";
252602
252638
  const alignmentOverride = isListItemFlag && !isJustified ? "left" : undefined;
252603
- const startX = mapPmToX(block, line, charOffsetFrom, fragment2.width, alignmentOverride);
252604
- const endX = mapPmToX(block, line, charOffsetTo, fragment2.width, alignmentOverride);
252639
+ const isFirstLine = index2 === fragment2.fromLine && !fragment2.continuesFromPrev;
252640
+ const fragmentMarkerTextWidth = fragment2.markerTextWidth ?? measure.marker?.markerTextWidth ?? undefined;
252641
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment2.width, alignmentOverride, isFirstLine, fragmentMarkerTextWidth);
252642
+ const endX = mapPmToX(block, line, charOffsetTo, fragment2.width, alignmentOverride, isFirstLine, fragmentMarkerTextWidth);
252605
252643
  const indent2 = extractParagraphIndent(block.attrs?.indent);
252606
252644
  const wordLayout = getWordLayoutConfig(block);
252607
252645
  const indentAdjust = calculateTextStartIndent({
252608
- isFirstLine: index2 === fragment2.fromLine,
252646
+ isFirstLine,
252609
252647
  isListItem: isListItemFlag,
252610
252648
  markerWidth,
252611
- markerTextWidth: fragment2.markerTextWidth ?? measure.marker?.markerTextWidth ?? undefined,
252649
+ markerTextWidth: fragmentMarkerTextWidth,
252612
252650
  paraIndentLeft: indent2.left,
252613
252651
  firstLineIndent: indent2.firstLine,
252614
252652
  hangingIndent: indent2.hanging,
@@ -252772,13 +252810,15 @@ function selectionToRects(layout, blocks2, measures, from$1, to, geometryHelper)
252772
252810
  const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
252773
252811
  const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
252774
252812
  const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
252775
- const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride);
252776
- const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride);
252813
+ const isFirstLine = index2 === 0;
252814
+ const cellMarkerTextWidth = info.measure?.marker?.markerTextWidth ?? undefined;
252815
+ const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth, alignmentOverride, isFirstLine, cellMarkerTextWidth);
252816
+ const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth, alignmentOverride, isFirstLine, cellMarkerTextWidth);
252777
252817
  const textIndentAdjust = calculateTextStartIndent({
252778
- isFirstLine: index2 === info.startLine,
252818
+ isFirstLine,
252779
252819
  isListItem: cellIsListItem,
252780
252820
  markerWidth: paragraphMarkerWidth,
252781
- markerTextWidth: info.measure?.marker?.markerTextWidth ?? undefined,
252821
+ markerTextWidth: cellMarkerTextWidth,
252782
252822
  paraIndentLeft: cellIndent.left,
252783
252823
  firstLineIndent: cellIndent.firstLine,
252784
252824
  hangingIndent: cellIndent.hanging,
@@ -258861,7 +258901,7 @@ async function measureParagraphBlock(block, maxWidth) {
258861
258901
  const hanging = indent2?.hanging ?? 0;
258862
258902
  const isWordLayoutList = Boolean(wordLayout?.marker);
258863
258903
  const rawFirstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : firstLine - hanging;
258864
- const firstLineOffset = isWordLayoutList ? 0 : !isWordLayoutList && !(indentLeft < 0 || indentRight < 0) && rawFirstLineOffset < 0 ? rawFirstLineOffset : Math.max(0, rawFirstLineOffset);
258904
+ const firstLineOffset = isWordLayoutList ? 0 : !isWordLayoutList && !(indentLeft < 0) && rawFirstLineOffset < 0 ? rawFirstLineOffset : Math.max(0, rawFirstLineOffset);
258865
258905
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
258866
258906
  const bodyContentWidth = contentWidth;
258867
258907
  let initialAvailableWidth;
@@ -277153,7 +277193,7 @@ var Node$13 = class Node$14 {
277153
277193
  }
277154
277194
  element3.style.textAlign = resolveTextAlign(attrs?.alignment, rtl);
277155
277195
  return rtl;
277156
- }, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, MATHML_NS$9 = "http://www.w3.org/1998/Math/MathML", OPERATOR_CHARS, convertMathRun = (node3, doc$12) => {
277196
+ }, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, MATHML_NS$11 = "http://www.w3.org/1998/Math/MathML", OPERATOR_CHARS, STY_TO_VARIANT, SCR_TO_VARIANT, convertMathRun = (node3, doc$12) => {
277157
277197
  const elements = node3.elements ?? [];
277158
277198
  let text5 = "";
277159
277199
  for (const child of elements)
@@ -277165,68 +277205,68 @@ var Node$13 = class Node$14 {
277165
277205
  }
277166
277206
  if (!text5)
277167
277207
  return null;
277168
- const isNormalText = elements.find((el$1) => el$1.name === "m:rPr")?.elements?.some((el$1) => el$1.name === "m:nor") ?? false;
277208
+ const variant = resolveMathVariant(elements.find((el$1) => el$1.name === "m:rPr"));
277169
277209
  const tag = classifyMathText(text5);
277170
- const el = doc$12.createElementNS(MATHML_NS$9, tag);
277210
+ const el = doc$12.createElementNS(MATHML_NS$11, tag);
277171
277211
  el.textContent = text5;
277172
- if (tag === "mi" && isNormalText)
277173
- el.setAttribute("mathvariant", "normal");
277212
+ if (variant)
277213
+ el.setAttribute("mathvariant", variant);
277174
277214
  return el;
277175
- }, MATHML_NS$8 = "http://www.w3.org/1998/Math/MathML", convertFraction = (node3, doc$12, convertChildren) => {
277215
+ }, MATHML_NS$10 = "http://www.w3.org/1998/Math/MathML", convertFraction = (node3, doc$12, convertChildren) => {
277176
277216
  const elements = node3.elements ?? [];
277177
277217
  const num = elements.find((e) => e.name === "m:num");
277178
277218
  const den = elements.find((e) => e.name === "m:den");
277179
- const frac = doc$12.createElementNS(MATHML_NS$8, "mfrac");
277180
- const numRow = doc$12.createElementNS(MATHML_NS$8, "mrow");
277219
+ const frac = doc$12.createElementNS(MATHML_NS$10, "mfrac");
277220
+ const numRow = doc$12.createElementNS(MATHML_NS$10, "mrow");
277181
277221
  numRow.appendChild(convertChildren(num?.elements ?? []));
277182
277222
  frac.appendChild(numRow);
277183
- const denRow = doc$12.createElementNS(MATHML_NS$8, "mrow");
277223
+ const denRow = doc$12.createElementNS(MATHML_NS$10, "mrow");
277184
277224
  denRow.appendChild(convertChildren(den?.elements ?? []));
277185
277225
  frac.appendChild(denRow);
277186
277226
  return frac;
277187
- }, MATHML_NS$7 = "http://www.w3.org/1998/Math/MathML", convertBar = (node3, doc$12, convertChildren) => {
277227
+ }, MATHML_NS$9 = "http://www.w3.org/1998/Math/MathML", convertBar = (node3, doc$12, convertChildren) => {
277188
277228
  const elements = node3.elements ?? [];
277189
277229
  const isUnder = elements.find((e) => e.name === "m:barPr")?.elements?.find((e) => e.name === "m:pos")?.attributes?.["m:val"] !== "top";
277190
277230
  const base5 = elements.find((e) => e.name === "m:e");
277191
- const wrapper = doc$12.createElementNS(MATHML_NS$7, isUnder ? "munder" : "mover");
277231
+ const wrapper = doc$12.createElementNS(MATHML_NS$9, isUnder ? "munder" : "mover");
277192
277232
  const baseContent = convertChildren(base5?.elements ?? []);
277193
- const mrow = doc$12.createElementNS(MATHML_NS$7, "mrow");
277233
+ const mrow = doc$12.createElementNS(MATHML_NS$9, "mrow");
277194
277234
  mrow.appendChild(baseContent);
277195
277235
  wrapper.appendChild(mrow);
277196
- const accent = doc$12.createElementNS(MATHML_NS$7, "mo");
277236
+ const accent = doc$12.createElementNS(MATHML_NS$9, "mo");
277197
277237
  accent.setAttribute("stretchy", "true");
277198
277238
  accent.textContent = "‾";
277199
277239
  wrapper.appendChild(accent);
277200
277240
  return wrapper;
277201
- }, MATHML_NS$6 = "http://www.w3.org/1998/Math/MathML", FUNCTION_APPLY_OPERATOR = "⁡", convertFunction = (node3, doc$12, convertChildren) => {
277241
+ }, MATHML_NS$8 = "http://www.w3.org/1998/Math/MathML", FUNCTION_APPLY_OPERATOR = "⁡", convertFunction = (node3, doc$12, convertChildren) => {
277202
277242
  const elements = node3.elements ?? [];
277203
277243
  const functionName = elements.find((element3) => element3.name === "m:fName");
277204
277244
  const argument = elements.find((element3) => element3.name === "m:e");
277205
- const wrapper = doc$12.createElementNS(MATHML_NS$6, "mrow");
277206
- const functionNameRow = doc$12.createElementNS(MATHML_NS$6, "mrow");
277245
+ const wrapper = doc$12.createElementNS(MATHML_NS$8, "mrow");
277246
+ const functionNameRow = doc$12.createElementNS(MATHML_NS$8, "mrow");
277207
277247
  functionNameRow.appendChild(convertChildren(functionName?.elements ?? []));
277208
277248
  forceNormalMathVariant(functionNameRow);
277209
277249
  if (functionNameRow.childNodes.length > 0)
277210
277250
  wrapper.appendChild(functionNameRow);
277211
- const argumentRow = doc$12.createElementNS(MATHML_NS$6, "mrow");
277251
+ const argumentRow = doc$12.createElementNS(MATHML_NS$8, "mrow");
277212
277252
  argumentRow.appendChild(convertChildren(argument?.elements ?? []));
277213
277253
  if (functionNameRow.childNodes.length > 0 && argumentRow.childNodes.length > 0) {
277214
- const applyOperator = doc$12.createElementNS(MATHML_NS$6, "mo");
277254
+ const applyOperator = doc$12.createElementNS(MATHML_NS$8, "mo");
277215
277255
  applyOperator.textContent = FUNCTION_APPLY_OPERATOR;
277216
277256
  wrapper.appendChild(applyOperator);
277217
277257
  }
277218
277258
  if (argumentRow.childNodes.length > 0)
277219
277259
  wrapper.appendChild(argumentRow);
277220
277260
  return wrapper.childNodes.length > 0 ? wrapper : null;
277221
- }, MATHML_NS$5 = "http://www.w3.org/1998/Math/MathML", DEFAULT_BEGIN_DELIMITER = "(", DEFAULT_END_DELIMITER = ")", DEFAULT_SEPARATOR_DELIMITER = "│", convertDelimiter = (node3, doc$12, convertChildren) => {
277261
+ }, MATHML_NS$7 = "http://www.w3.org/1998/Math/MathML", DEFAULT_BEGIN_DELIMITER = "(", DEFAULT_END_DELIMITER = ")", DEFAULT_SEPARATOR_DELIMITER = "│", convertDelimiter = (node3, doc$12, convertChildren) => {
277222
277262
  const elements = node3.elements ?? [];
277223
277263
  const delimiterProps = elements.find((element3) => element3.name === "m:dPr");
277224
277264
  const expressions = elements.filter((element3) => element3.name === "m:e");
277225
277265
  const beginDelimiter = getDelimiterValue(delimiterProps, "m:begChr", DEFAULT_BEGIN_DELIMITER);
277226
277266
  const endDelimiter = getDelimiterValue(delimiterProps, "m:endChr", DEFAULT_END_DELIMITER);
277227
277267
  const separatorDelimiter = getDelimiterValue(delimiterProps, "m:sepChr", DEFAULT_SEPARATOR_DELIMITER);
277228
- const wrapper = doc$12.createElementNS(MATHML_NS$5, "mrow");
277229
- const begin = doc$12.createElementNS(MATHML_NS$5, "mo");
277268
+ const wrapper = doc$12.createElementNS(MATHML_NS$7, "mrow");
277269
+ const begin = doc$12.createElementNS(MATHML_NS$7, "mo");
277230
277270
  begin.textContent = beginDelimiter;
277231
277271
  wrapper.appendChild(begin);
277232
277272
  let renderedCount = 0;
@@ -277235,81 +277275,105 @@ var Node$13 = class Node$14 {
277235
277275
  if (fragment2.childNodes.length === 0)
277236
277276
  continue;
277237
277277
  if (renderedCount > 0) {
277238
- const separator = doc$12.createElementNS(MATHML_NS$5, "mo");
277278
+ const separator = doc$12.createElementNS(MATHML_NS$7, "mo");
277239
277279
  separator.textContent = separatorDelimiter;
277240
277280
  wrapper.appendChild(separator);
277241
277281
  }
277242
- const group = doc$12.createElementNS(MATHML_NS$5, "mrow");
277282
+ const group = doc$12.createElementNS(MATHML_NS$7, "mrow");
277243
277283
  group.appendChild(fragment2);
277244
277284
  wrapper.appendChild(group);
277245
277285
  renderedCount++;
277246
277286
  }
277247
- const end$1 = doc$12.createElementNS(MATHML_NS$5, "mo");
277287
+ const end$1 = doc$12.createElementNS(MATHML_NS$7, "mo");
277248
277288
  end$1.textContent = endDelimiter;
277249
277289
  wrapper.appendChild(end$1);
277250
277290
  return wrapper;
277251
- }, MATHML_NS$4 = "http://www.w3.org/1998/Math/MathML", convertSubscript = (node3, doc$12, convertChildren) => {
277291
+ }, MATHML_NS$6 = "http://www.w3.org/1998/Math/MathML", convertSubscript = (node3, doc$12, convertChildren) => {
277252
277292
  const elements = node3.elements ?? [];
277253
277293
  const base5 = elements.find((e) => e.name === "m:e");
277254
277294
  const sub = elements.find((e) => e.name === "m:sub");
277255
- const msub = doc$12.createElementNS(MATHML_NS$4, "msub");
277256
- const baseRow = doc$12.createElementNS(MATHML_NS$4, "mrow");
277295
+ const msub = doc$12.createElementNS(MATHML_NS$6, "msub");
277296
+ const baseRow = doc$12.createElementNS(MATHML_NS$6, "mrow");
277257
277297
  baseRow.appendChild(convertChildren(base5?.elements ?? []));
277258
277298
  msub.appendChild(baseRow);
277259
- const subRow = doc$12.createElementNS(MATHML_NS$4, "mrow");
277299
+ const subRow = doc$12.createElementNS(MATHML_NS$6, "mrow");
277260
277300
  subRow.appendChild(convertChildren(sub?.elements ?? []));
277261
277301
  msub.appendChild(subRow);
277262
277302
  return msub;
277263
- }, MATHML_NS$3 = "http://www.w3.org/1998/Math/MathML", convertSuperscript = (node3, doc$12, convertChildren) => {
277303
+ }, MATHML_NS$5 = "http://www.w3.org/1998/Math/MathML", convertSuperscript = (node3, doc$12, convertChildren) => {
277264
277304
  const elements = node3.elements ?? [];
277265
277305
  const base5 = elements.find((e) => e.name === "m:e");
277266
277306
  const sup = elements.find((e) => e.name === "m:sup");
277267
- const msup = doc$12.createElementNS(MATHML_NS$3, "msup");
277268
- const baseRow = doc$12.createElementNS(MATHML_NS$3, "mrow");
277307
+ const msup = doc$12.createElementNS(MATHML_NS$5, "msup");
277308
+ const baseRow = doc$12.createElementNS(MATHML_NS$5, "mrow");
277269
277309
  baseRow.appendChild(convertChildren(base5?.elements ?? []));
277270
277310
  msup.appendChild(baseRow);
277271
- const supRow = doc$12.createElementNS(MATHML_NS$3, "mrow");
277311
+ const supRow = doc$12.createElementNS(MATHML_NS$5, "mrow");
277272
277312
  supRow.appendChild(convertChildren(sup?.elements ?? []));
277273
277313
  msup.appendChild(supRow);
277274
277314
  return msup;
277275
- }, MATHML_NS$2 = "http://www.w3.org/1998/Math/MathML", convertSubSuperscript = (node3, doc$12, convertChildren) => {
277315
+ }, MATHML_NS$4 = "http://www.w3.org/1998/Math/MathML", convertSubSuperscript = (node3, doc$12, convertChildren) => {
277276
277316
  const elements = node3.elements ?? [];
277277
277317
  const base5 = elements.find((e) => e.name === "m:e");
277278
277318
  const sub = elements.find((e) => e.name === "m:sub");
277279
277319
  const sup = elements.find((e) => e.name === "m:sup");
277280
- const msubsup = doc$12.createElementNS(MATHML_NS$2, "msubsup");
277281
- const baseRow = doc$12.createElementNS(MATHML_NS$2, "mrow");
277320
+ const msubsup = doc$12.createElementNS(MATHML_NS$4, "msubsup");
277321
+ const baseRow = doc$12.createElementNS(MATHML_NS$4, "mrow");
277282
277322
  baseRow.appendChild(convertChildren(base5?.elements ?? []));
277283
277323
  msubsup.appendChild(baseRow);
277284
- const subRow = doc$12.createElementNS(MATHML_NS$2, "mrow");
277324
+ const subRow = doc$12.createElementNS(MATHML_NS$4, "mrow");
277285
277325
  subRow.appendChild(convertChildren(sub?.elements ?? []));
277286
277326
  msubsup.appendChild(subRow);
277287
- const supRow = doc$12.createElementNS(MATHML_NS$2, "mrow");
277327
+ const supRow = doc$12.createElementNS(MATHML_NS$4, "mrow");
277288
277328
  supRow.appendChild(convertChildren(sup?.elements ?? []));
277289
277329
  msubsup.appendChild(supRow);
277290
277330
  return msubsup;
277291
- }, MATHML_NS$1 = "http://www.w3.org/1998/Math/MathML", convertRadical = (node3, doc$12, convertChildren) => {
277331
+ }, MATHML_NS$3 = "http://www.w3.org/1998/Math/MathML", convertRadical = (node3, doc$12, convertChildren) => {
277292
277332
  const elements = node3.elements ?? [];
277293
277333
  const radPr = elements.find((e) => e.name === "m:radPr");
277294
277334
  const deg = elements.find((e) => e.name === "m:deg");
277295
277335
  const radicand = elements.find((e) => e.name === "m:e");
277296
277336
  const degHideEl = radPr?.elements?.find((e) => e.name === "m:degHide");
277297
277337
  const degHideVal = degHideEl?.attributes?.["m:val"];
277298
- if (degHideEl !== undefined && degHideVal !== "0" && degHideVal !== "false" || !deg) {
277299
- const msqrt = doc$12.createElementNS(MATHML_NS$1, "msqrt");
277300
- const radicandRow$1 = doc$12.createElementNS(MATHML_NS$1, "mrow");
277338
+ if (degHideEl !== undefined && degHideVal !== "0" && degHideVal !== "false" && degHideVal !== "off" || !deg || (deg.elements ?? []).length === 0) {
277339
+ const msqrt = doc$12.createElementNS(MATHML_NS$3, "msqrt");
277340
+ const radicandRow$1 = doc$12.createElementNS(MATHML_NS$3, "mrow");
277301
277341
  radicandRow$1.appendChild(convertChildren(radicand?.elements ?? []));
277302
277342
  msqrt.appendChild(radicandRow$1);
277303
277343
  return msqrt;
277304
277344
  }
277305
- const mroot = doc$12.createElementNS(MATHML_NS$1, "mroot");
277306
- const radicandRow = doc$12.createElementNS(MATHML_NS$1, "mrow");
277345
+ const mroot = doc$12.createElementNS(MATHML_NS$3, "mroot");
277346
+ const radicandRow = doc$12.createElementNS(MATHML_NS$3, "mrow");
277307
277347
  radicandRow.appendChild(convertChildren(radicand?.elements ?? []));
277308
277348
  mroot.appendChild(radicandRow);
277309
- const degRow = doc$12.createElementNS(MATHML_NS$1, "mrow");
277349
+ const degRow = doc$12.createElementNS(MATHML_NS$3, "mrow");
277310
277350
  degRow.appendChild(convertChildren(deg?.elements ?? []));
277311
277351
  mroot.appendChild(degRow);
277312
277352
  return mroot;
277353
+ }, MATHML_NS$2 = "http://www.w3.org/1998/Math/MathML", convertLowerLimit = (node3, doc$12, convertChildren) => {
277354
+ const elements = node3.elements ?? [];
277355
+ const base5 = elements.find((e) => e.name === "m:e");
277356
+ const lim = elements.find((e) => e.name === "m:lim");
277357
+ const munder = doc$12.createElementNS(MATHML_NS$2, "munder");
277358
+ const baseRow = doc$12.createElementNS(MATHML_NS$2, "mrow");
277359
+ baseRow.appendChild(convertChildren(base5?.elements ?? []));
277360
+ munder.appendChild(baseRow);
277361
+ const limRow = doc$12.createElementNS(MATHML_NS$2, "mrow");
277362
+ limRow.appendChild(convertChildren(lim?.elements ?? []));
277363
+ munder.appendChild(limRow);
277364
+ return munder;
277365
+ }, MATHML_NS$1 = "http://www.w3.org/1998/Math/MathML", convertUpperLimit = (node3, doc$12, convertChildren) => {
277366
+ const elements = node3.elements ?? [];
277367
+ const base5 = elements.find((e) => e.name === "m:e");
277368
+ const lim = elements.find((e) => e.name === "m:lim");
277369
+ const mover = doc$12.createElementNS(MATHML_NS$1, "mover");
277370
+ const baseRow = doc$12.createElementNS(MATHML_NS$1, "mrow");
277371
+ baseRow.appendChild(convertChildren(base5?.elements ?? []));
277372
+ mover.appendChild(baseRow);
277373
+ const limRow = doc$12.createElementNS(MATHML_NS$1, "mrow");
277374
+ limRow.appendChild(convertChildren(lim?.elements ?? []));
277375
+ mover.appendChild(limRow);
277376
+ return mover;
277313
277377
  }, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, LIST_MARKER_GAP$1 = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
277314
277378
  if (typeof value !== "string")
277315
277379
  return null;
@@ -280615,6 +280679,7 @@ var Node$13 = class Node$14 {
280615
280679
  const rawMeasures = cellMeasure.blocks ?? (cellMeasure.paragraph ? [cellMeasure.paragraph] : []);
280616
280680
  const cellBlockMeasures = (Array.isArray(rawMeasures) ? rawMeasures : []).filter((m$1) => m$1 != null && typeof m$1 === "object" && ("kind" in m$1));
280617
280681
  let blockStartY = 0;
280682
+ let blockStartGlobalLines = 0;
280618
280683
  const getBlockHeight = (m$1) => {
280619
280684
  if (!m$1)
280620
280685
  return 0;
@@ -280658,10 +280723,12 @@ var Node$13 = class Node$14 {
280658
280723
  cellBlock: paragraphBlock,
280659
280724
  cellMeasure: paragraphMeasure,
280660
280725
  localX: Math.max(0, cellLocalX),
280661
- localY: Math.max(0, localYWithinBlock)
280726
+ localY: Math.max(0, localYWithinBlock),
280727
+ blockStartGlobal: blockStartGlobalLines
280662
280728
  };
280663
280729
  }
280664
280730
  blockStartY = blockEndY;
280731
+ blockStartGlobalLines += paragraphMeasure.lines.length;
280665
280732
  }
280666
280733
  }
280667
280734
  return null;
@@ -280707,29 +280774,38 @@ var Node$13 = class Node$14 {
280707
280774
  for (let i4 = 0;i4 < absoluteLineIndex; i4 += 1)
280708
280775
  height += measure.lines[i4]?.lineHeight ?? 0;
280709
280776
  return height;
280710
- }, mapPmToX = (block, line, offset$1, fragmentWidth, alignmentOverride) => {
280777
+ }, mapPmToX = (block, line, offset$1, fragmentWidth, alignmentOverride, isFirstLine, markerTextWidth) => {
280711
280778
  if (fragmentWidth <= 0 || line.width <= 0)
280712
280779
  return 0;
280713
280780
  let paraIndentLeft = 0;
280714
280781
  let paraIndentRight = 0;
280715
280782
  let effectiveLeft = 0;
280783
+ let isListParagraph = false;
280784
+ let wl;
280716
280785
  if (block.kind === "paragraph") {
280717
280786
  const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
280718
280787
  const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
280719
280788
  paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
280720
280789
  paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
280721
280790
  effectiveLeft = paraIndentLeft;
280722
- const wl = getWordLayoutConfig(block);
280723
- if (Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker)) {
280791
+ wl = getWordLayoutConfig(block);
280792
+ isListParagraph = Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker);
280793
+ if (isListParagraph) {
280724
280794
  const explicitTextStart = typeof wl?.marker?.textStartX === "number" && Number.isFinite(wl.marker.textStartX) ? wl.marker.textStartX : typeof wl?.textStartPx === "number" && Number.isFinite(wl.textStartPx) ? wl.textStartPx : undefined;
280725
280795
  if (typeof explicitTextStart === "number" && explicitTextStart > paraIndentLeft)
280726
280796
  effectiveLeft = explicitTextStart;
280727
280797
  }
280728
280798
  }
280729
280799
  const totalIndent = effectiveLeft + paraIndentRight;
280730
- const availableWidth = Math.max(0, fragmentWidth - totalIndent);
280800
+ let availableWidth = Math.max(0, fragmentWidth - totalIndent);
280731
280801
  if (totalIndent > fragmentWidth)
280732
280802
  console.warn(`[mapPmToX] Paragraph indents (${totalIndent}px) exceed fragment width (${fragmentWidth}px) for block ${block.id}. This may indicate a layout miscalculation. Available width clamped to 0.`);
280803
+ const hasRenderedMarkerText = isListParagraph && (markerTextWidth ?? 0) > 0;
280804
+ if (isFirstLine && block.kind === "paragraph" && !hasRenderedMarkerText) {
280805
+ const suppressFLI = block.attrs?.suppressFirstLineIndent === true;
280806
+ const firstLineOffset = getFirstLineIndentOffset(block.attrs?.indent, suppressFLI);
280807
+ availableWidth = adjustAvailableWidthForTextIndent(availableWidth, firstLineOffset, line.maxWidth);
280808
+ }
280733
280809
  return measureCharacterX(block, line, offset$1, availableWidth, alignmentOverride);
280734
280810
  }, WORD_CHARACTER_REGEX, EpochPositionMapper = class {
280735
280811
  #currentEpoch = 0;
@@ -287413,7 +287489,7 @@ var Node$13 = class Node$14 {
287413
287489
  return;
287414
287490
  console.log(...args$1);
287415
287491
  }, 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;
287416
- var init_src_D6bw0Eho_es = __esm(() => {
287492
+ var init_src_Bf2Vgwaf_es = __esm(() => {
287417
287493
  init_rolldown_runtime_Bg48TavK_es();
287418
287494
  init_SuperConverter_H0ERuAZY_es();
287419
287495
  init_jszip_C49i9kUs_es();
@@ -313151,12 +313227,29 @@ function print() { __p += __j.call(arguments, '') }
313151
313227
  "⊆",
313152
313228
  "⊇"
313153
313229
  ]);
313230
+ STY_TO_VARIANT = {
313231
+ p: "normal",
313232
+ b: "bold",
313233
+ i: "italic",
313234
+ bi: "bold-italic"
313235
+ };
313236
+ SCR_TO_VARIANT = {
313237
+ roman: "normal",
313238
+ script: "script",
313239
+ fraktur: "fraktur",
313240
+ "double-struck": "double-struck",
313241
+ "sans-serif": "sans-serif",
313242
+ monospace: "monospace"
313243
+ };
313154
313244
  MATH_OBJECT_REGISTRY = {
313155
313245
  "m:r": convertMathRun,
313156
313246
  "m:bar": convertBar,
313157
313247
  "m:d": convertDelimiter,
313158
313248
  "m:f": convertFraction,
313159
313249
  "m:func": convertFunction,
313250
+ "m:limLow": convertLowerLimit,
313251
+ "m:limUpp": convertUpperLimit,
313252
+ "m:rad": convertRadical,
313160
313253
  "m:sSub": convertSubscript,
313161
313254
  "m:sSup": convertSuperscript,
313162
313255
  "m:sSubSup": convertSubSuperscript,
@@ -313165,12 +313258,9 @@ function print() { __p += __j.call(arguments, '') }
313165
313258
  "m:box": null,
313166
313259
  "m:eqArr": null,
313167
313260
  "m:groupChr": null,
313168
- "m:limLow": null,
313169
- "m:limUpp": null,
313170
313261
  "m:m": null,
313171
313262
  "m:nary": null,
313172
313263
  "m:phant": null,
313173
- "m:rad": convertRadical,
313174
313264
  "m:sPre": null
313175
313265
  };
313176
313266
  ARGUMENT_ELEMENTS = new Set([
@@ -314589,10 +314679,12 @@ function print() { __p += __j.call(arguments, '') }
314589
314679
  let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
314590
314680
  if (shouldUseResolvedListTextStart)
314591
314681
  availableWidthOverride = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
314682
+ const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
314683
+ const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
314684
+ if (isFirstLine && !isListFirstLine && !hasExplicitSegmentPositioning)
314685
+ availableWidthOverride = adjustAvailableWidthForTextIndent(availableWidthOverride, firstLineOffset, line.maxWidth);
314592
314686
  const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
314593
314687
  const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
314594
- const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
314595
- const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
314596
314688
  if (!isListFirstLine) {
314597
314689
  if (hasExplicitSegmentPositioning) {
314598
314690
  if (isFirstLine && firstLineOffset !== 0) {
@@ -322140,7 +322232,7 @@ var init_zipper_DbkgrypV_es = __esm(() => {
322140
322232
 
322141
322233
  // ../../packages/superdoc/dist/super-editor.es.js
322142
322234
  var init_super_editor_es = __esm(() => {
322143
- init_src_D6bw0Eho_es();
322235
+ init_src_Bf2Vgwaf_es();
322144
322236
  init_SuperConverter_H0ERuAZY_es();
322145
322237
  init_jszip_C49i9kUs_es();
322146
322238
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.7.0-next.3",
3
+ "version": "0.7.0-next.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,21 +24,21 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
+ "@superdoc/document-api": "0.0.1",
27
28
  "@superdoc/pm-adapter": "0.0.0",
28
- "@superdoc/super-editor": "0.0.1",
29
29
  "superdoc": "1.25.0",
30
- "@superdoc/document-api": "0.0.1"
30
+ "@superdoc/super-editor": "0.0.1"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.3",
38
- "@superdoc-dev/cli-darwin-x64": "0.7.0-next.3",
39
- "@superdoc-dev/cli-linux-x64": "0.7.0-next.3",
40
- "@superdoc-dev/cli-linux-arm64": "0.7.0-next.3",
41
- "@superdoc-dev/cli-windows-x64": "0.7.0-next.3"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.5",
38
+ "@superdoc-dev/cli-linux-x64": "0.7.0-next.5",
39
+ "@superdoc-dev/cli-darwin-x64": "0.7.0-next.5",
40
+ "@superdoc-dev/cli-linux-arm64": "0.7.0-next.5",
41
+ "@superdoc-dev/cli-windows-x64": "0.7.0-next.5"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",