@superdoc-dev/mcp 0.3.0-next.63 → 0.3.0-next.64

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 +148 -48
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -199223,7 +199223,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
199223
199223
  init_remark_gfm_BhnWr3yf_es();
199224
199224
  });
199225
199225
 
199226
- // ../../packages/superdoc/dist/chunks/src-ItIaPxzW.es.js
199226
+ // ../../packages/superdoc/dist/chunks/src-C-jV2TZI.es.js
199227
199227
  function deleteProps(obj, propOrProps) {
199228
199228
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
199229
199229
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -199280,9 +199280,11 @@ function cssColorToHex(cssColor) {
199280
199280
  return trimmed;
199281
199281
  }
199282
199282
  function computeTabStops$1(context) {
199283
- const { explicitStops, defaultTabInterval, paragraphIndent } = context;
199283
+ const { explicitStops, defaultTabInterval, paragraphIndent, rawParagraphIndent } = context;
199284
199284
  const leftIndent = paragraphIndent.left ?? 0;
199285
199285
  const hanging = paragraphIndent.hanging ?? 0;
199286
+ const rawLeftIndent = rawParagraphIndent?.left ?? leftIndent;
199287
+ const rawHanging = rawParagraphIndent?.hanging ?? hanging;
199286
199288
  const effectiveMinIndent = Math.max(0, leftIndent - hanging);
199287
199289
  const clearPositions = explicitStops.filter((stop) => stop.val === "clear").map((stop) => stop.pos);
199288
199290
  const filteredExplicitStops = explicitStops.filter((stop) => stop.val !== "clear").filter((stop) => stop.pos >= effectiveMinIndent).map((stop) => ({
@@ -199293,6 +199295,7 @@ function computeTabStops$1(context) {
199293
199295
  const stops = [...filteredExplicitStops];
199294
199296
  const hasStartAlignedExplicit = filteredExplicitStops.some((stop) => stop.val === "start");
199295
199297
  const hasExplicitStops = filteredExplicitStops.length > 0;
199298
+ const hasClearAtPosition = (position4) => clearPositions.some((clearPos) => Math.abs(clearPos - position4) < TAB_POSITION_TOLERANCE_TWIPS);
199296
199299
  const hasClearAtLeftIndent = clearPositions.some((clearPos) => Math.abs(clearPos - leftIndent) < TAB_POSITION_TOLERANCE_TWIPS);
199297
199300
  if (!hasExplicitStops && !hasClearAtLeftIndent && hanging > 0 && leftIndent > effectiveMinIndent)
199298
199301
  stops.push({
@@ -199301,6 +199304,22 @@ function computeTabStops$1(context) {
199301
199304
  leader: "none",
199302
199305
  source: "default"
199303
199306
  });
199307
+ const firstLineOrigin = rawLeftIndent - rawHanging;
199308
+ if (firstLineOrigin < 0 && !hasClearAtPosition(0) && !stops.some((stop) => Math.abs(stop.pos) < TAB_POSITION_TOLERANCE_TWIPS))
199309
+ stops.push({
199310
+ val: "start",
199311
+ pos: 0,
199312
+ leader: "none",
199313
+ source: "default"
199314
+ });
199315
+ const leftIndentStop = Math.abs(rawLeftIndent);
199316
+ if (rawHanging > 0 && leftIndentStop > 0 && firstLineOrigin < leftIndentStop && !hasClearAtPosition(leftIndentStop) && !stops.some((stop) => Math.abs(stop.pos - leftIndentStop) < TAB_POSITION_TOLERANCE_TWIPS))
199317
+ stops.push({
199318
+ val: "start",
199319
+ pos: leftIndentStop,
199320
+ leader: "none",
199321
+ source: "default"
199322
+ });
199304
199323
  const defaultStart = !hasStartAlignedExplicit ? 0 : Math.max(maxExplicit, leftIndent);
199305
199324
  let pos = defaultStart;
199306
199325
  const targetLimit = Math.max(defaultStart, leftIndent, maxExplicit) + 14400;
@@ -243264,7 +243283,8 @@ function resolveParagraphContent(fragment, block, measure) {
243264
243283
  if (!hasExplicitSegmentPositioning)
243265
243284
  textIndentPx = firstLineOffset;
243266
243285
  }
243267
- availableWidth = adjustAvailableWidthForTextIndent(availableWidth, textIndentPx, line.maxWidth);
243286
+ const availableWidthIndentOffset = isFirstLine && !isListFirstLine && line.hasExplicitTabStops !== true ? firstLineOffset : textIndentPx;
243287
+ availableWidth = adjustAvailableWidthForTextIndent(availableWidth, availableWidthIndentOffset, line.maxWidth);
243268
243288
  const indentLeft = paraIndent?.left ?? 0;
243269
243289
  const firstLine = paraIndent?.firstLine ?? 0;
243270
243290
  const hanging = paraIndent?.hanging ?? 0;
@@ -249133,8 +249153,8 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
249133
249153
  const wordLayout = attrs?.wordLayout;
249134
249154
  const rawIndentLeft = typeof indent2?.left === "number" && Number.isFinite(indent2.left) ? indent2.left : 0;
249135
249155
  const rawIndentRight = typeof indent2?.right === "number" && Number.isFinite(indent2.right) ? indent2.right : 0;
249136
- const indentLeft = Math.max(0, rawIndentLeft);
249137
- const indentRight = Math.max(0, rawIndentRight);
249156
+ const indentLeft = rawIndentLeft;
249157
+ const indentRight = rawIndentRight;
249138
249158
  const indentFirstLine = Math.max(0, indent2?.firstLine ?? 0);
249139
249159
  const indentHanging = Math.max(0, indent2?.hanging ?? 0);
249140
249160
  const baseFirstLineOffset = attrs?.suppressFirstLineIndent === true ? 0 : firstLineIndent || indentFirstLine - indentHanging;
@@ -259636,6 +259656,7 @@ async function measureParagraphBlock(block, maxWidth) {
259636
259656
  let hasSeenTextRun = false;
259637
259657
  let tabStopCursor = 0;
259638
259658
  let pendingTabAlignment = null;
259659
+ let pendingSegmentPrecedingTabEndX;
259639
259660
  let pendingLeader = null;
259640
259661
  let pendingRunSpacing = 0;
259641
259662
  let lastAppliedTabAlign = null;
@@ -259658,7 +259679,7 @@ async function measureParagraphBlock(block, maxWidth) {
259658
259679
  return;
259659
259680
  if (segmentWidth < 0)
259660
259681
  segmentWidth = 0;
259661
- const { target, val } = pendingTabAlignment;
259682
+ const { target, val, compensateNegativeLeft } = pendingTabAlignment;
259662
259683
  let startX = currentLine.width;
259663
259684
  if (val === "decimal") {
259664
259685
  const beforeWidth = beforeDecimalWidth ?? 0;
@@ -259669,10 +259690,9 @@ async function measureParagraphBlock(block, maxWidth) {
259669
259690
  startX = Math.max(0, target - segmentWidth / 2);
259670
259691
  else
259671
259692
  startX = Math.max(0, target);
259672
- if (pendingLeader) {
259673
- const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
259693
+ const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
259694
+ if (pendingLeader)
259674
259695
  pendingLeader.to = startX + effectiveIndent;
259675
- }
259676
259696
  currentLine.width = roundValue(startX);
259677
259697
  lastAppliedTabAlign = {
259678
259698
  target,
@@ -259680,7 +259700,17 @@ async function measureParagraphBlock(block, maxWidth) {
259680
259700
  };
259681
259701
  pendingTabAlignment = null;
259682
259702
  pendingLeader = null;
259683
- return startX;
259703
+ const shouldCompensateNegativeLeft = compensateNegativeLeft === true;
259704
+ pendingSegmentPrecedingTabEndX = shouldCompensateNegativeLeft ? startX : undefined;
259705
+ return shouldCompensateNegativeLeft ? startX - Math.min(effectiveIndent, 0) : startX;
259706
+ };
259707
+ const consumePendingPrecedingTabEndX = () => {
259708
+ const value = pendingSegmentPrecedingTabEndX;
259709
+ pendingSegmentPrecedingTabEndX = undefined;
259710
+ return value;
259711
+ };
259712
+ const clearPendingPrecedingTabEndX = () => {
259713
+ pendingSegmentPrecedingTabEndX = undefined;
259684
259714
  };
259685
259715
  const alignSegmentAtTab = (segmentText, font, runContext, segmentStartChar) => {
259686
259716
  if (!pendingTabAlignment || !currentLine)
@@ -260021,7 +260051,8 @@ async function measureParagraphBlock(block, maxWidth) {
260021
260051
  } else
260022
260052
  pendingTabAlignment = {
260023
260053
  target: clampedTarget - effectiveIndent,
260024
- val: stop.val
260054
+ val: stop.val,
260055
+ compensateNegativeLeft: stop.val === "start" && indentLeft < 0 && effectiveIndent === indentLeft && stop.source !== "explicit"
260025
260056
  };
260026
260057
  } else {
260027
260058
  pendingTabAlignment = null;
@@ -260043,6 +260074,7 @@ async function measureParagraphBlock(block, maxWidth) {
260043
260074
  activeTabGroup.currentX = roundValue(activeTabGroup.currentX + imageWidth);
260044
260075
  } else if (pendingTabAlignment && currentLine)
260045
260076
  imageStartX = alignPendingTabForWidth(imageWidth);
260077
+ const imagePrecedingTabEndX = imageStartX !== undefined ? consumePendingPrecedingTabEndX() : undefined;
260046
260078
  if (!currentLine) {
260047
260079
  currentLine = {
260048
260080
  fromRun: runIndex,
@@ -260059,7 +260091,8 @@ async function measureParagraphBlock(block, maxWidth) {
260059
260091
  fromChar: 0,
260060
260092
  toChar: 1,
260061
260093
  width: imageWidth,
260062
- ...imageStartX !== undefined ? { x: imageStartX } : {}
260094
+ ...imageStartX !== undefined ? { x: imageStartX } : {},
260095
+ ...imagePrecedingTabEndX !== undefined ? { precedingTabEndX: imagePrecedingTabEndX } : {}
260063
260096
  }]
260064
260097
  };
260065
260098
  pendingRunSpacing = 0;
@@ -260111,7 +260144,8 @@ async function measureParagraphBlock(block, maxWidth) {
260111
260144
  fromChar: 0,
260112
260145
  toChar: 1,
260113
260146
  width: imageWidth,
260114
- ...imageStartX !== undefined ? { x: imageStartX } : {}
260147
+ ...imageStartX !== undefined ? { x: imageStartX } : {},
260148
+ ...imagePrecedingTabEndX !== undefined ? { precedingTabEndX: imagePrecedingTabEndX } : {}
260115
260149
  });
260116
260150
  }
260117
260151
  if (activeTabGroup && runIndex + 1 >= activeTabGroup.measure.endRunIndex)
@@ -260186,6 +260220,7 @@ async function measureParagraphBlock(block, maxWidth) {
260186
260220
  let annotationStartX;
260187
260221
  if (pendingTabAlignment && currentLine)
260188
260222
  annotationStartX = alignPendingTabForWidth(annotationWidth);
260223
+ const annotationPrecedingTabEndX = annotationStartX !== undefined ? consumePendingPrecedingTabEndX() : undefined;
260189
260224
  if (!currentLine) {
260190
260225
  currentLine = {
260191
260226
  fromRun: runIndex,
@@ -260201,7 +260236,8 @@ async function measureParagraphBlock(block, maxWidth) {
260201
260236
  fromChar: 0,
260202
260237
  toChar: 1,
260203
260238
  width: annotationWidth,
260204
- ...annotationStartX !== undefined ? { x: annotationStartX } : {}
260239
+ ...annotationStartX !== undefined ? { x: annotationStartX } : {},
260240
+ ...annotationPrecedingTabEndX !== undefined ? { precedingTabEndX: annotationPrecedingTabEndX } : {}
260205
260241
  }]
260206
260242
  };
260207
260243
  pendingRunSpacing = 0;
@@ -260248,7 +260284,8 @@ async function measureParagraphBlock(block, maxWidth) {
260248
260284
  fromChar: 0,
260249
260285
  toChar: 1,
260250
260286
  width: annotationWidth,
260251
- ...annotationStartX !== undefined ? { x: annotationStartX } : {}
260287
+ ...annotationStartX !== undefined ? { x: annotationStartX } : {},
260288
+ ...annotationPrecedingTabEndX !== undefined ? { precedingTabEndX: annotationPrecedingTabEndX } : {}
260252
260289
  });
260253
260290
  }
260254
260291
  const tabAlign = lastAppliedTabAlign;
@@ -260356,6 +260393,18 @@ async function measureParagraphBlock(block, maxWidth) {
260356
260393
  if (segmentStartX == null)
260357
260394
  segmentStartX = currentLine.width;
260358
260395
  }
260396
+ let hasPendingSegmentTabGeometry = segmentStartX !== undefined;
260397
+ const consumeSegmentPrecedingTabEndX = () => {
260398
+ if (!hasPendingSegmentTabGeometry)
260399
+ return;
260400
+ hasPendingSegmentTabGeometry = false;
260401
+ return consumePendingPrecedingTabEndX();
260402
+ };
260403
+ const clearWrapState = () => {
260404
+ segmentStartX = undefined;
260405
+ hasPendingSegmentTabGeometry = false;
260406
+ clearPendingPrecedingTabEndX();
260407
+ };
260359
260408
  for (let wordIndex = 0;wordIndex < words.length; wordIndex++) {
260360
260409
  const word$1 = words[wordIndex];
260361
260410
  if (word$1 === "") {
@@ -260397,6 +260446,7 @@ async function measureParagraphBlock(block, maxWidth) {
260397
260446
  pendingLeader = null;
260398
260447
  lastAppliedTabAlign = null;
260399
260448
  activeTabGroup = null;
260449
+ clearWrapState();
260400
260450
  currentLine = {
260401
260451
  fromRun: runIndex,
260402
260452
  fromChar: spaceStartChar,
@@ -260421,11 +260471,15 @@ async function measureParagraphBlock(block, maxWidth) {
260421
260471
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
260422
260472
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
260423
260473
  let spaceExplicitX;
260474
+ let spacePrecedingTabEndX;
260424
260475
  if (inActiveTabGroup && activeTabGroup) {
260425
260476
  spaceExplicitX = activeTabGroup.currentX;
260426
260477
  activeTabGroup.currentX = roundValue(activeTabGroup.currentX + singleSpaceWidth);
260478
+ } else if (wordIndex === 0 && segmentStartX !== undefined) {
260479
+ spaceExplicitX = segmentStartX;
260480
+ spacePrecedingTabEndX = consumeSegmentPrecedingTabEndX();
260427
260481
  }
260428
- appendSegment(currentLine.segments, runIndex, spaceStartChar, spaceEndChar, singleSpaceWidth, spaceExplicitX);
260482
+ appendSegment(currentLine.segments, runIndex, spaceStartChar, spaceEndChar, singleSpaceWidth, spaceExplicitX, spacePrecedingTabEndX);
260429
260483
  currentLine.spaceCount += 1;
260430
260484
  }
260431
260485
  }
@@ -260453,6 +260507,7 @@ async function measureParagraphBlock(block, maxWidth) {
260453
260507
  pendingTabAlignment = null;
260454
260508
  pendingLeader = null;
260455
260509
  currentLine = null;
260510
+ clearWrapState();
260456
260511
  }
260457
260512
  const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
260458
260513
  const hasTabOnlyLine = currentLine && currentLine.segments && currentLine.segments.length === 0 && currentLine.width > 0;
@@ -260498,6 +260553,7 @@ async function measureParagraphBlock(block, maxWidth) {
260498
260553
  pendingTabAlignment = null;
260499
260554
  pendingLeader = null;
260500
260555
  currentLine = null;
260556
+ clearWrapState();
260501
260557
  }
260502
260558
  } else if (isLastChunk) {
260503
260559
  currentLine = {
@@ -260545,6 +260601,7 @@ async function measureParagraphBlock(block, maxWidth) {
260545
260601
  };
260546
260602
  addBarTabsToLine(chunkLine);
260547
260603
  lines.push(chunkLine);
260604
+ clearWrapState();
260548
260605
  }
260549
260606
  chunkCharOffset = chunkEndChar;
260550
260607
  }
@@ -260606,6 +260663,8 @@ async function measureParagraphBlock(block, maxWidth) {
260606
260663
  }
260607
260664
  }
260608
260665
  if (shouldBreak) {
260666
+ if (wordIndex === 0 && hasPendingSegmentTabGeometry)
260667
+ clearWrapState();
260609
260668
  trimTrailingWrapSpaces(currentLine);
260610
260669
  const metrics = finalizeLineMetrics(currentLine, spacing);
260611
260670
  const completedLine = {
@@ -260658,7 +260717,7 @@ async function measureParagraphBlock(block, maxWidth) {
260658
260717
  activeTabGroup.currentX = roundValue(activeTabGroup.currentX + wordOnlyWidth);
260659
260718
  } else if (wordIndex === 0 && segmentStartX !== undefined)
260660
260719
  explicitXHere = segmentStartX;
260661
- appendSegment(currentLine.segments, runIndex, wordStartChar, wordEndNoSpace, wordOnlyWidth, explicitXHere);
260720
+ appendSegment(currentLine.segments, runIndex, wordStartChar, wordEndNoSpace, wordOnlyWidth, explicitXHere, wordIndex === 0 ? consumeSegmentPrecedingTabEndX() : undefined);
260662
260721
  trimTrailingWrapSpaces(currentLine);
260663
260722
  const metrics = finalizeLineMetrics(currentLine, spacing);
260664
260723
  const completedLine = {
@@ -260688,7 +260747,7 @@ async function measureParagraphBlock(block, maxWidth) {
260688
260747
  currentLine.width = roundValue(targetWidth);
260689
260748
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
260690
260749
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
260691
- appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX);
260750
+ appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX, wordIndex === 0 ? consumeSegmentPrecedingTabEndX() : undefined);
260692
260751
  if (shouldIncludeDelimiterSpace)
260693
260752
  currentLine.spaceCount += 1;
260694
260753
  }
@@ -260741,7 +260800,8 @@ async function measureParagraphBlock(block, maxWidth) {
260741
260800
  validateTabStopVal(stop);
260742
260801
  pendingTabAlignment = {
260743
260802
  target: clampedTarget - effectiveIndent,
260744
- val: stop.val
260803
+ val: stop.val,
260804
+ compensateNegativeLeft: stop.val === "start" && indentLeft < 0 && effectiveIndent === indentLeft && stop.source !== "explicit"
260745
260805
  };
260746
260806
  } else {
260747
260807
  pendingTabAlignment = null;
@@ -281921,7 +281981,7 @@ menclose::after {
281921
281981
  if (transform2 === "capitalize")
281922
281982
  return capitalizeText$2(text5, fullText, startOffset);
281923
281983
  return text5;
281924
- }, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$2, TAB_EPSILON$1 = 0.1, WIDTH_FUDGE_PX = 0.5, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$2, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$2), sanitizeIndent$1 = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0, sanitizeDecimalSeparator$1 = (value) => value === "," ? "," : ".", getRunWidth = (run2) => {
281984
+ }, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$2, TAB_EPSILON$1 = 0.1, WIDTH_FUDGE_PX = 0.5, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$2, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$2), sanitizeIndent$1 = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0, sanitizeRawIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0, sanitizeDecimalSeparator$1 = (value) => value === "," ? "," : ".", getRunWidth = (run2) => {
281925
281985
  const width = run2.width;
281926
281986
  return typeof width === "number" ? width : 0;
281927
281987
  }, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
@@ -281935,10 +281995,17 @@ menclose::after {
281935
281995
  firstLine: pxToTwips$1(sanitizeIndent$1(indent2?.firstLine)),
281936
281996
  hanging: pxToTwips$1(sanitizeIndent$1(indent2?.hanging))
281937
281997
  };
281998
+ const rawParagraphIndentTwips = {
281999
+ left: pxToTwips$1(sanitizeRawIndent(indent2?.left)),
282000
+ right: pxToTwips$1(sanitizeRawIndent(indent2?.right)),
282001
+ firstLine: pxToTwips$1(sanitizeRawIndent(indent2?.firstLine)),
282002
+ hanging: pxToTwips$1(sanitizeIndent$1(indent2?.hanging))
282003
+ };
281938
282004
  return computeTabStops$1({
281939
282005
  explicitStops: tabs ?? [],
281940
282006
  defaultTabInterval: tabIntervalTwips ?? DEFAULT_TAB_INTERVAL_TWIPS$2,
281941
- paragraphIndent: paragraphIndentTwips
282007
+ paragraphIndent: paragraphIndentTwips,
282008
+ rawParagraphIndent: rawParagraphIndentTwips
281942
282009
  }).map((stop) => ({
281943
282010
  pos: twipsToPx$2(stop.pos),
281944
282011
  val: stop.val,
@@ -282163,6 +282230,10 @@ menclose::after {
282163
282230
  }
282164
282231
  const clampedTarget = Number.isFinite(maxAbsWidth) ? Math.min(target, maxAbsWidth) : target;
282165
282232
  const relativeTarget = clampedTarget - effectiveIndent;
282233
+ const stopVal = stop?.val ?? "start";
282234
+ const shouldCompensateNegativeLeft = stopVal === "start" && indentLeft < 0 && effectiveIndent === indentLeft && stop?.source !== "explicit";
282235
+ const paintTarget = shouldCompensateNegativeLeft ? relativeTarget - Math.min(effectiveIndent, 0) : relativeTarget;
282236
+ const precedingTabEndX = shouldCompensateNegativeLeft ? relativeTarget : undefined;
282166
282237
  lineWidth = Math.max(lineWidth, relativeTarget);
282167
282238
  if (stop?.source === "explicit")
282168
282239
  line.hasExplicitTabStops = true;
@@ -282175,7 +282246,6 @@ menclose::after {
282175
282246
  };
282176
282247
  leaders.push(currentLeader);
282177
282248
  }
282178
- const stopVal = stop?.val ?? "start";
282179
282249
  if (stopVal === "end" || stopVal === "center" || stopVal === "decimal") {
282180
282250
  const groupMeasure = measureTabAlignmentGroupInLine(runs2, line, startRunIndex, startChar, decimalSeparator);
282181
282251
  if (groupMeasure.totalWidth > 0) {
@@ -282190,14 +282260,28 @@ menclose::after {
282190
282260
  }
282191
282261
  if (currentLeader)
282192
282262
  currentLeader.to = groupStartX + effectiveIndent;
282193
- pendingTabAlignStartX = groupStartX;
282263
+ pendingTabAlignStartX = {
282264
+ layoutX: groupStartX,
282265
+ paintX: groupStartX
282266
+ };
282194
282267
  } else
282195
282268
  cursorX = Math.max(cursorX, relativeTarget);
282196
- } else
282269
+ } else {
282197
282270
  cursorX = Math.max(cursorX, relativeTarget);
282271
+ pendingTabAlignStartX = {
282272
+ layoutX: relativeTarget,
282273
+ paintX: paintTarget,
282274
+ ...precedingTabEndX !== undefined ? { precedingTabEndX } : {}
282275
+ };
282276
+ }
282198
282277
  if (run2 && run2.kind === "tab")
282199
282278
  run2.width = Math.max(0, relativeTarget - originX);
282200
282279
  };
282280
+ const consumePendingTabAlignStart = () => {
282281
+ const pending = pendingTabAlignStartX;
282282
+ pendingTabAlignStartX = null;
282283
+ return pending;
282284
+ };
282201
282285
  for (let runIndex = line.fromRun;runIndex <= line.toRun; runIndex += 1) {
282202
282286
  const run2 = runs2[runIndex];
282203
282287
  if (!run2)
@@ -282229,10 +282313,12 @@ menclose::after {
282229
282313
  toChar: i4,
282230
282314
  width: segmentWidth
282231
282315
  };
282232
- if (pendingTabAlignStartX != null) {
282233
- segment.x = pendingTabAlignStartX;
282234
- cursorX = pendingTabAlignStartX + segmentWidth;
282235
- pendingTabAlignStartX = null;
282316
+ const pendingTabAlign = consumePendingTabAlignStart();
282317
+ if (pendingTabAlign != null) {
282318
+ segment.x = pendingTabAlign.paintX;
282319
+ if (pendingTabAlign.precedingTabEndX !== undefined)
282320
+ segment.precedingTabEndX = pendingTabAlign.precedingTabEndX;
282321
+ cursorX = pendingTabAlign.layoutX + segmentWidth;
282236
282322
  } else
282237
282323
  cursorX += segmentWidth;
282238
282324
  lineWidth = Math.max(lineWidth, cursorX);
@@ -282250,10 +282336,12 @@ menclose::after {
282250
282336
  toChar: sliceEnd,
282251
282337
  width: segmentWidth
282252
282338
  };
282253
- if (pendingTabAlignStartX != null) {
282254
- segment.x = pendingTabAlignStartX;
282255
- cursorX = pendingTabAlignStartX + segmentWidth;
282256
- pendingTabAlignStartX = null;
282339
+ const pendingTabAlign = consumePendingTabAlignStart();
282340
+ if (pendingTabAlign != null) {
282341
+ segment.x = pendingTabAlign.paintX;
282342
+ if (pendingTabAlign.precedingTabEndX !== undefined)
282343
+ segment.precedingTabEndX = pendingTabAlign.precedingTabEndX;
282344
+ cursorX = pendingTabAlign.layoutX + segmentWidth;
282257
282345
  } else
282258
282346
  cursorX += segmentWidth;
282259
282347
  lineWidth = Math.max(lineWidth, cursorX);
@@ -289615,11 +289703,11 @@ menclose::after {
289615
289703
  width: currentWidth
289616
289704
  });
289617
289705
  return chunks;
289618
- }, appendSegment = (segments, runIndex, fromChar, toChar, width, x) => {
289706
+ }, appendSegment = (segments, runIndex, fromChar, toChar, width, x, precedingTabEndX) => {
289619
289707
  if (!segments)
289620
289708
  return;
289621
289709
  const last2 = segments[segments.length - 1];
289622
- if (last2 && last2.runIndex === runIndex && last2.toChar === fromChar && x === undefined) {
289710
+ if (last2 && last2.runIndex === runIndex && last2.toChar === fromChar && last2.x === undefined && last2.precedingTabEndX === undefined && x === undefined && precedingTabEndX === undefined) {
289623
289711
  last2.toChar = toChar;
289624
289712
  last2.width += width;
289625
289713
  return;
@@ -289629,7 +289717,8 @@ menclose::after {
289629
289717
  fromChar,
289630
289718
  toChar,
289631
289719
  width,
289632
- x
289720
+ ...x !== undefined ? { x } : {},
289721
+ ...precedingTabEndX !== undefined ? { precedingTabEndX } : {}
289633
289722
  });
289634
289723
  }, resolveLineHeight = (spacing, fontSize, maxHeight = -1) => {
289635
289724
  let computedHeight = spacing?.line ?? WORD_SINGLE_LINE_SPACING_MULTIPLIER;
@@ -289679,10 +289768,17 @@ menclose::after {
289679
289768
  firstLine: pxToTwips(sanitizePositive(indent2?.firstLine)),
289680
289769
  hanging: pxToTwips(sanitizePositive(indent2?.hanging))
289681
289770
  };
289771
+ const rawParagraphIndentTwips = {
289772
+ left: pxToTwips(sanitizeIndent(indent2?.left)),
289773
+ right: pxToTwips(sanitizeIndent(indent2?.right)),
289774
+ firstLine: pxToTwips(sanitizeIndent(indent2?.firstLine)),
289775
+ hanging: pxToTwips(sanitizePositive(indent2?.hanging))
289776
+ };
289682
289777
  return computeTabStops({
289683
289778
  explicitStops: tabs ?? [],
289684
289779
  defaultTabInterval: tabIntervalTwips ?? DEFAULT_TAB_INTERVAL_TWIPS,
289685
- paragraphIndent: paragraphIndentTwips
289780
+ paragraphIndent: paragraphIndentTwips,
289781
+ rawParagraphIndent: rawParagraphIndentTwips
289686
289782
  }).map((stop) => ({
289687
289783
  pos: twipsToPx(stop.pos),
289688
289784
  val: stop.val,
@@ -291349,7 +291445,7 @@ menclose::after {
291349
291445
  return;
291350
291446
  console.log(...args$1);
291351
291447
  }, 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;
291352
- var init_src_ItIaPxzW_es = __esm(() => {
291448
+ var init_src_C_jV2TZI_es = __esm(() => {
291353
291449
  init_rolldown_runtime_Bg48TavK_es();
291354
291450
  init_SuperConverter_D1o6_yKI_es();
291355
291451
  init_jszip_C49i9kUs_es();
@@ -319225,7 +319321,7 @@ function print() { __p += __j.call(arguments, '') }
319225
319321
  availableWidthOverride = fragment.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
319226
319322
  const isFirstLine = index2 === 0 && !paraContinuesFromPrev;
319227
319323
  const isListFirstLine = Boolean(hasListFirstLineMarker && fragment.markerTextWidth);
319228
- if (isFirstLine && !isListFirstLine && !hasExplicitSegmentPositioning)
319324
+ if (isFirstLine && !isListFirstLine && line.hasExplicitTabStops !== true)
319229
319325
  availableWidthOverride = adjustAvailableWidthForTextIndent(availableWidthOverride, firstLineOffset, line.maxWidth);
319230
319326
  const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !paraContinuesOnNext && !paragraphEndsWithLineBreak;
319231
319327
  const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment.fromLine + index2, shouldSkipJustifyForLastLine, expandedRunsForBlock, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
@@ -321019,6 +321115,7 @@ function print() { __p += __j.call(arguments, '') }
321019
321115
  el.appendChild(barEl);
321020
321116
  });
321021
321117
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== undefined);
321118
+ const hasMultipleExplicitPositionedSegments = (line.segments?.filter((seg) => seg.x !== undefined).length ?? 0) > 1;
321022
321119
  const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
321023
321120
  const justifyShouldApply = shouldApplyJustify({
321024
321121
  alignment: block.attrs?.alignment,
@@ -321026,7 +321123,7 @@ function print() { __p += __j.call(arguments, '') }
321026
321123
  hasExplicitTabStops: line.hasExplicitTabStops === true,
321027
321124
  isLastLineOfParagraph: false,
321028
321125
  paragraphEndsWithLineBreak: false,
321029
- skipJustifyOverride: skipJustify
321126
+ skipJustifyOverride: skipJustify || hasMultipleExplicitPositionedSegments
321030
321127
  });
321031
321128
  const countSpaces$1 = (text5) => {
321032
321129
  let count = 0;
@@ -321193,12 +321290,14 @@ function print() { __p += __j.call(arguments, '') }
321193
321290
  else
321194
321291
  segmentsByRun.set(segment.runIndex, [segment]);
321195
321292
  });
321196
- const findImmediateNextSegmentX = (fromRunIndex) => {
321293
+ const findImmediateNextSegment = (fromRunIndex) => {
321197
321294
  const nextRunIdx = fromRunIndex + 1;
321198
321295
  if (nextRunIdx <= line.toRun) {
321199
321296
  const nextSegments = segmentsByRun.get(nextRunIdx);
321200
- if (nextSegments && nextSegments.length > 0)
321201
- return nextSegments[0].x;
321297
+ if (nextSegments && nextSegments.length > 0) {
321298
+ const firstSegment = nextSegments[0];
321299
+ return firstSegment.x !== undefined || firstSegment.precedingTabEndX !== undefined ? firstSegment : undefined;
321300
+ }
321202
321301
  }
321203
321302
  };
321204
321303
  let geoSdtWrapper = null;
@@ -321242,9 +321341,10 @@ function print() { __p += __j.call(arguments, '') }
321242
321341
  if (!baseRun)
321243
321342
  continue;
321244
321343
  if (baseRun.kind === "tab") {
321245
- const immediateNextX = findImmediateNextSegmentX(runIndex);
321344
+ const immediateNextSegment = findImmediateNextSegment(runIndex);
321246
321345
  const tabStartX = cumulativeX;
321247
- const tabEndX = immediateNextX !== undefined ? immediateNextX : tabStartX + (baseRun.width ?? 0);
321346
+ const measuredTabEndX = tabStartX + (baseRun.width ?? 0);
321347
+ const tabEndX = immediateNextSegment?.precedingTabEndX ?? immediateNextSegment?.x ?? measuredTabEndX;
321248
321348
  const actualTabWidth = tabEndX - tabStartX;
321249
321349
  const tabEl = this.doc.createElement("span");
321250
321350
  tabEl.style.position = "absolute";
@@ -321354,10 +321454,10 @@ function print() { __p += __j.call(arguments, '') }
321354
321454
  elem.style.position = "absolute";
321355
321455
  elem.style.left = `${xPos}px`;
321356
321456
  appendToLineGeo(elem, segmentRun, xPos, segment.width);
321357
- const width = segment.width;
321358
- cumulativeX = baseX + width;
321457
+ const visualWidth = segment.width + (spacingPerSpace !== 0 ? spacingPerSpace * countSpaces$1(segmentText) : 0);
321458
+ cumulativeX = baseX + visualWidth;
321359
321459
  if (geoSdtWrapper)
321360
- geoSdtMaxRight = Math.max(geoSdtMaxRight, xPos + width);
321460
+ geoSdtMaxRight = Math.max(geoSdtMaxRight, xPos + visualWidth);
321361
321461
  }
321362
321462
  });
321363
321463
  }
@@ -328987,7 +329087,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
328987
329087
 
328988
329088
  // ../../packages/superdoc/dist/super-editor.es.js
328989
329089
  var init_super_editor_es = __esm(() => {
328990
- init_src_ItIaPxzW_es();
329090
+ init_src_C_jV2TZI_es();
328991
329091
  init_SuperConverter_D1o6_yKI_es();
328992
329092
  init_jszip_C49i9kUs_es();
328993
329093
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.63",
3
+ "version": "0.3.0-next.64",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"