@superdoc-dev/cli 0.17.0-next.42 → 0.17.0-next.43

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 +232 -114
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -68164,7 +68164,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
68164
68164
  emptyOptions2 = {};
68165
68165
  });
68166
68166
 
68167
- // ../../packages/superdoc/dist/chunks/SuperConverter-DRKaQwZS.es.js
68167
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DIgF4xk_.es.js
68168
68168
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68169
68169
  const fieldValue = extension$1.config[field];
68170
68170
  if (typeof fieldValue === "function")
@@ -104735,34 +104735,62 @@ function hydrateImageBlocks(blocks, mediaFiles) {
104735
104735
  if (blk.kind === "drawing") {
104736
104736
  const drawingBlock = blk;
104737
104737
  if (drawingBlock.drawingKind === "vectorShape" || drawingBlock.drawingKind === "textboxShape") {
104738
- const parts = drawingBlock.textContent?.parts;
104739
- if (!parts || parts.length === 0)
104740
- return blk;
104741
- let partsChanged = false;
104742
- const hydratedParts = parts.map((part) => {
104743
- if (part?.kind !== "image" || !part.src || part.src.startsWith("data:"))
104738
+ let blockChanged = false;
104739
+ let nextBlock = drawingBlock;
104740
+ if (drawingBlock.drawingKind === "textboxShape") {
104741
+ const contentBlocks = drawingBlock.contentBlocks;
104742
+ if (Array.isArray(contentBlocks) && contentBlocks.length > 0) {
104743
+ let contentBlocksChanged = false;
104744
+ const hydratedContentBlocks = contentBlocks.map((paragraphBlock) => {
104745
+ if (paragraphBlock.kind !== "paragraph" || !paragraphBlock.runs?.length)
104746
+ return paragraphBlock;
104747
+ const hydratedRuns = hydrateRuns(paragraphBlock.runs);
104748
+ if (hydratedRuns !== paragraphBlock.runs) {
104749
+ contentBlocksChanged = true;
104750
+ return {
104751
+ ...paragraphBlock,
104752
+ runs: hydratedRuns
104753
+ };
104754
+ }
104755
+ return paragraphBlock;
104756
+ });
104757
+ if (contentBlocksChanged) {
104758
+ blockChanged = true;
104759
+ nextBlock = {
104760
+ ...drawingBlock,
104761
+ contentBlocks: hydratedContentBlocks
104762
+ };
104763
+ }
104764
+ }
104765
+ }
104766
+ const parts = nextBlock.textContent?.parts;
104767
+ if (parts && parts.length > 0) {
104768
+ let partsChanged = false;
104769
+ const hydratedParts = parts.map((part) => {
104770
+ if (part?.kind !== "image" || !part.src || part.src.startsWith("data:"))
104771
+ return part;
104772
+ const resolvedSrc = resolveImageSrc(part.src, part.rId, undefined, part.extension);
104773
+ if (resolvedSrc) {
104774
+ partsChanged = true;
104775
+ return {
104776
+ ...part,
104777
+ src: resolvedSrc
104778
+ };
104779
+ }
104744
104780
  return part;
104745
- const resolvedSrc = resolveImageSrc(part.src, part.rId, undefined, part.extension);
104746
- if (resolvedSrc) {
104747
- partsChanged = true;
104748
- return {
104749
- ...part,
104750
- src: resolvedSrc
104781
+ });
104782
+ if (partsChanged) {
104783
+ blockChanged = true;
104784
+ nextBlock = {
104785
+ ...nextBlock,
104786
+ textContent: {
104787
+ ...nextBlock.textContent,
104788
+ parts: hydratedParts
104789
+ }
104751
104790
  };
104752
104791
  }
104753
- return part;
104754
- });
104755
- if (partsChanged) {
104756
- const vectorShapeBlock = drawingBlock;
104757
- return {
104758
- ...vectorShapeBlock,
104759
- textContent: {
104760
- ...vectorShapeBlock.textContent,
104761
- parts: hydratedParts
104762
- }
104763
- };
104764
104792
  }
104765
- return blk;
104793
+ return blockChanged ? nextBlock : blk;
104766
104794
  }
104767
104795
  if (drawingBlock.drawingKind !== "shapeGroup")
104768
104796
  return blk;
@@ -106927,6 +106955,7 @@ function shapeContainerNodeToDrawingBlock(node3, nextBlockId, positions) {
106927
106955
  const textContent = shapeTextboxNode ? extractTextboxTextContent(shapeTextboxNode) : undefined;
106928
106956
  return buildDrawingBlock({
106929
106957
  ...rawAttrs,
106958
+ ...resolveInlineAlignmentFromWrapper(rawAttrs),
106930
106959
  ...textContent ? { textContent } : {},
106931
106960
  ...rawAttrs.textAlign == null && textContent?.horizontalAlign ? { textAlign: textContent.horizontalAlign } : {},
106932
106961
  ...rawAttrs.textInsets == null ? { textInsets: resolveTextboxInsetsFromAttrs(textboxAttrs) } : {},
@@ -135146,6 +135175,37 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135146
135175
  required.bottom = Math.max(required.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
135147
135176
  }
135148
135177
  return hasEffectExtent(required) ? required : undefined;
135178
+ }, resolveWrapperAlignment = (justification) => {
135179
+ switch (justification) {
135180
+ case "center":
135181
+ case "distribute":
135182
+ return "center";
135183
+ case "right":
135184
+ case "end":
135185
+ return "right";
135186
+ default:
135187
+ return;
135188
+ }
135189
+ }, resolveInlineAlignmentFromWrapper = (rawAttrs) => {
135190
+ if (rawAttrs.wrap?.type !== "Inline" || !isPlainObject3(rawAttrs.wrapperParagraph))
135191
+ return {};
135192
+ const wrapper = rawAttrs.wrapperParagraph;
135193
+ const justification = (isPlainObject3(wrapper.paragraphProperties) ? wrapper.paragraphProperties : undefined)?.justification;
135194
+ const textAlign = typeof wrapper.textAlign === "string" ? wrapper.textAlign : undefined;
135195
+ const effectiveAlignment = resolveWrapperAlignment(justification) ?? textAlign;
135196
+ if (effectiveAlignment !== "center" && effectiveAlignment !== "right")
135197
+ return {};
135198
+ const metadata = { inlineParagraphAlignment: effectiveAlignment };
135199
+ const { paragraphAttrs } = computeParagraphAttrs({
135200
+ type: "paragraph",
135201
+ attrs: wrapper
135202
+ });
135203
+ const indent2 = paragraphAttrs.indent;
135204
+ if (typeof indent2?.left === "number")
135205
+ metadata.paragraphIndentLeft = indent2.left;
135206
+ if (typeof indent2?.right === "number")
135207
+ metadata.paragraphIndentRight = indent2.right;
135208
+ return metadata;
135149
135209
  }, getAttrs$1 = (node3) => {
135150
135210
  return isPlainObject3(node3.attrs) ? { ...node3.attrs } : {};
135151
135211
  }, parseFullWidth = (value) => {
@@ -136448,7 +136508,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136448
136508
  state.kern = kernNode.attributes["w:val"];
136449
136509
  }
136450
136510
  }, SuperConverter;
136451
- var init_SuperConverter_DRKaQwZS_es = __esm(() => {
136511
+ var init_SuperConverter_DIgF4xk__es = __esm(() => {
136452
136512
  init_rolldown_runtime_Bg48TavK_es();
136453
136513
  init_jszip_C49i9kUs_es();
136454
136514
  init_xml_js_CqGKpaft_es();
@@ -165374,7 +165434,7 @@ var init_SuperConverter_DRKaQwZS_es = __esm(() => {
165374
165434
  };
165375
165435
  });
165376
165436
 
165377
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-ChACxHAH.es.js
165437
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT4yIoZ-.es.js
165378
165438
  function parseSizeUnit(val = "0") {
165379
165439
  const length3 = val.toString() || "0";
165380
165440
  const value = Number.parseFloat(length3);
@@ -176177,9 +176237,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
176177
176237
  }
176178
176238
  };
176179
176239
  };
176180
- var init_create_headless_toolbar_ChACxHAH_es = __esm(() => {
176240
+ var init_create_headless_toolbar_BT4yIoZ_es = __esm(() => {
176181
176241
  init_rolldown_runtime_Bg48TavK_es();
176182
- init_SuperConverter_DRKaQwZS_es();
176242
+ init_SuperConverter_DIgF4xk__es();
176183
176243
  init_jszip_C49i9kUs_es();
176184
176244
  init_uuid_B2wVPhPi_es();
176185
176245
  init_constants_D9qj59G2_es();
@@ -226272,7 +226332,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226272
226332
  init_remark_gfm_BUJjZJLy_es();
226273
226333
  });
226274
226334
 
226275
- // ../../packages/superdoc/dist/chunks/src-ly1ZYfUZ.es.js
226335
+ // ../../packages/superdoc/dist/chunks/src-BrcexyXf.es.js
226276
226336
  function deleteProps(obj, propOrProps) {
226277
226337
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226278
226338
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -271576,7 +271636,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
271576
271636
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
271577
271637
  const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
271578
271638
  const rawWrap = attrs?.wrap;
271579
- const isInlineShapeGroup = block.drawingKind === "shapeGroup" && rawWrap?.type === "Inline";
271639
+ const isInlineAlignableDrawing = (block.drawingKind === "shapeGroup" || block.drawingKind === "textboxShape") && rawWrap?.type === "Inline";
271580
271640
  const inlineParagraphAlignment = attrs?.inlineParagraphAlignment === "center" || attrs?.inlineParagraphAlignment === "right" ? attrs.inlineParagraphAlignment : undefined;
271581
271641
  if (width > maxWidthForBlock && maxWidthForBlock > 0) {
271582
271642
  const scale = maxWidthForBlock / width;
@@ -271595,7 +271655,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
271595
271655
  state = advanceColumn(state);
271596
271656
  const pmRange = extractBlockPmRange(block);
271597
271657
  let x = columnX(state) + marginLeft + indentLeft;
271598
- if (isInlineShapeGroup && inlineParagraphAlignment) {
271658
+ if (isInlineAlignableDrawing && inlineParagraphAlignment) {
271599
271659
  const pIndentLeft = typeof attrs?.paragraphIndentLeft === "number" ? attrs.paragraphIndentLeft : 0;
271600
271660
  const pIndentRight = typeof attrs?.paragraphIndentRight === "number" ? attrs.paragraphIndentRight : 0;
271601
271661
  const alignBox = Math.max(0, maxWidthForBlock - pIndentLeft - pIndentRight);
@@ -275920,6 +275980,17 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
275920
275980
  endChar = text5.length > 0 ? text5.length : start$1 + 1;
275921
275981
  continue;
275922
275982
  }
275983
+ if (text5.length === 0 && isAtomicLayoutRun(run2)) {
275984
+ const atomicWidth = getAtomicRunLayoutWidth(run2);
275985
+ if (width > 0 && width + atomicWidth > effectiveMaxWidth - WIDTH_FUDGE_PX) {
275986
+ didBreakInThisLine = true;
275987
+ break;
275988
+ }
275989
+ width += atomicWidth;
275990
+ endRun = r$1;
275991
+ endChar = 1;
275992
+ continue;
275993
+ }
275923
275994
  for (let c = start$1;c < text5.length; c += 1) {
275924
275995
  const ch = text5[c];
275925
275996
  if (ch === "\t") {
@@ -276008,6 +276079,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
276008
276079
  endRun = startRun;
276009
276080
  endChar = startChar + 1;
276010
276081
  }
276082
+ const lineMaxAtomicHeight = getLineMaxAtomicHeight(runs2, startRun, startChar, endRun, endChar);
276011
276083
  const line = {
276012
276084
  fromRun: startRun,
276013
276085
  fromChar: startChar,
@@ -276016,8 +276088,9 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
276016
276088
  width,
276017
276089
  ascent: 0,
276018
276090
  descent: 0,
276019
- lineHeight: lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize),
276020
- maxWidth: effectiveMaxWidth
276091
+ lineHeight: Math.max(lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize), lineMaxAtomicHeight),
276092
+ maxWidth: effectiveMaxWidth,
276093
+ ...lineMaxAtomicHeight > 0 ? { maxImageHeight: lineMaxAtomicHeight } : {}
276021
276094
  };
276022
276095
  lines.push(line);
276023
276096
  if (lineMaxTextFontSize > 0)
@@ -284729,14 +284802,14 @@ function capitalizeText$1(text5, fullText, startOffset) {
284729
284802
  return result;
284730
284803
  }
284731
284804
  function measureFieldAnnotationWidth(run2, fontContext) {
284732
- const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1 : DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1;
284805
+ const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
284733
284806
  const font = buildFontString$1({
284734
284807
  fontFamily: normalizeFontFamily$1(run2.fontFamily ?? "Arial"),
284735
284808
  fontSize,
284736
284809
  bold: run2.bold,
284737
284810
  italic: run2.italic
284738
284811
  }, fontContext);
284739
- return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING$1);
284812
+ return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING);
284740
284813
  }
284741
284814
  function isExplicitLineBreakRun(run2) {
284742
284815
  return run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line";
@@ -284922,6 +284995,15 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
284922
284995
  endRunIndex: runs2.length
284923
284996
  };
284924
284997
  let foundDecimal = false;
284998
+ const measureAtomicText$1 = (text5, atomicRun, fontSize) => {
284999
+ const { font } = buildFontString({
285000
+ fontFamily: atomicRun.fontFamily ?? "Arial",
285001
+ fontSize,
285002
+ bold: atomicRun.bold,
285003
+ italic: atomicRun.italic
285004
+ }, fontContext);
285005
+ return measureRunWidth(text5, font, ctx$1, atomicRun, 0);
285006
+ };
284925
285007
  for (let i3 = startRunIndex;i3 < runs2.length; i3++) {
284926
285008
  const run2 = runs2[i3];
284927
285009
  if (isTabRun(run2)) {
@@ -284963,40 +285045,13 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
284963
285045
  });
284964
285046
  continue;
284965
285047
  }
284966
- if (isImageRun(run2)) {
284967
- const leftSpace = run2.distLeft ?? 0;
284968
- const rightSpace = run2.distRight ?? 0;
284969
- const imageWidth = run2.width + leftSpace + rightSpace;
284970
- result.runs.push({
284971
- runIndex: i3,
284972
- width: imageWidth
284973
- });
284974
- result.totalWidth += imageWidth;
284975
- continue;
284976
- }
284977
- if (run2.kind === "math") {
284978
- const mathWidth = run2.width ?? 20;
284979
- result.runs.push({
284980
- runIndex: i3,
284981
- width: mathWidth
284982
- });
284983
- result.totalWidth += mathWidth;
284984
- continue;
284985
- }
284986
- if (isFieldAnnotationRun(run2)) {
284987
- const fontSize = run2.fontSize ?? DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
284988
- const { font } = buildFontString({
284989
- fontFamily: run2.fontFamily ?? "Arial",
284990
- fontSize,
284991
- bold: run2.bold,
284992
- italic: run2.italic
284993
- }, fontContext);
284994
- const pillWidth = (run2.displayLabel ? measureRunWidth(run2.displayLabel, font, ctx$1, run2, 0) : 0) + FIELD_ANNOTATION_PILL_PADDING;
285048
+ if (isImageRun(run2) || run2.kind === "math" || isFieldAnnotationRun(run2)) {
285049
+ const { width } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
284995
285050
  result.runs.push({
284996
285051
  runIndex: i3,
284997
- width: pillWidth
285052
+ width
284998
285053
  });
284999
- result.totalWidth += pillWidth;
285054
+ result.totalWidth += width;
285000
285055
  continue;
285001
285056
  }
285002
285057
  result.runs.push({
@@ -285026,6 +285081,13 @@ async function measureBlock(block, constraints, fontContext = DEFAULT_FONT_MEASU
285026
285081
  }
285027
285082
  async function measureParagraphBlock(block, maxWidth, fontContext) {
285028
285083
  const ctx$1 = getCanvasContext();
285084
+ const measureAtomicText$1 = (text5, run2, fontSize) => {
285085
+ const family2 = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
285086
+ const weight = run2.bold ? "bold" : "normal";
285087
+ ctx$1.font = `${run2.italic ? "italic" : "normal"} ${weight} ${fontSize}px ${family2}`;
285088
+ const displayText = applyTextTransform(text5, run2);
285089
+ return displayText ? ctx$1.measureText(displayText).width : 0;
285090
+ };
285029
285091
  const wordLayout = block.attrs?.wordLayout;
285030
285092
  const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
285031
285093
  const fallbackFontSize = normalizeFontSize2((firstTextRunWithSize ?? block.runs.find((run2) => typeof run2.fontSize === "number" && run2.fontSize > 0))?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
@@ -285555,12 +285617,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
285555
285617
  continue;
285556
285618
  }
285557
285619
  if (isImageRun(run2)) {
285558
- const leftSpace = run2.distLeft ?? 0;
285559
- const rightSpace = run2.distRight ?? 0;
285560
- const imageWidth = run2.width + leftSpace + rightSpace;
285561
- const topSpace = run2.distTop ?? 0;
285562
- const bottomSpace = run2.distBottom ?? 0;
285563
- const imageHeight = run2.height + topSpace + bottomSpace;
285620
+ const { width: imageWidth, height: imageHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
285564
285621
  let imageStartX;
285565
285622
  if (activeTabGroup && currentLine) {
285566
285623
  imageStartX = activeTabGroup.currentX;
@@ -285651,9 +285708,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
285651
285708
  continue;
285652
285709
  }
285653
285710
  if (run2.kind === "math") {
285654
- const mathRun = run2;
285655
- const mathWidth = mathRun.width ?? 20;
285656
- const mathHeight = mathRun.height ?? 24;
285711
+ const { width: mathWidth, height: mathHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
285657
285712
  if (!currentLine)
285658
285713
  currentLine = {
285659
285714
  fromRun: runIndex,
@@ -285690,26 +285745,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
285690
285745
  continue;
285691
285746
  }
285692
285747
  if (isFieldAnnotationRun(run2)) {
285693
- const displayText = applyTextTransform(run2.displayLabel || "", run2);
285694
- const annotationFontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
285695
- const annotationFontFamily = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
285696
- const fontWeight = run2.bold ? "bold" : "normal";
285697
- ctx$1.font = `${run2.italic ? "italic" : "normal"} ${fontWeight} ${annotationFontSize}px ${annotationFontFamily}`;
285698
- const textWidth = displayText ? ctx$1.measureText(displayText).width : 0;
285699
- const annotationHorizontalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING;
285700
- const annotationVerticalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_VERTICAL_PADDING;
285701
- const annotationWidth = textWidth + annotationHorizontalPadding;
285702
- let annotationHeight = annotationFontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + annotationVerticalPadding;
285703
- if (run2.variant === "signature" && run2.imageSrc) {
285704
- const signatureHeight = 28 + annotationVerticalPadding;
285705
- annotationHeight = Math.max(annotationHeight, signatureHeight);
285706
- }
285707
- if (run2.variant === "image" && run2.imageSrc && run2.size?.height) {
285708
- const imageHeight = run2.size.height + annotationVerticalPadding;
285709
- annotationHeight = Math.max(annotationHeight, imageHeight);
285710
- }
285711
- if (run2.variant === "html" && run2.size?.height)
285712
- annotationHeight = Math.max(annotationHeight, run2.size.height);
285748
+ const { width: annotationWidth, height: annotationHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
285713
285749
  let annotationStartX;
285714
285750
  if (pendingTabAlignment && currentLine)
285715
285751
  annotationStartX = alignPendingTabForWidth(annotationWidth);
@@ -309623,7 +309659,7 @@ menclose::after {
309623
309659
  left: borders.right,
309624
309660
  right: borders.left
309625
309661
  };
309626
- }, getFiniteNumber = (value) => {
309662
+ }, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, getFiniteNumber = (value) => {
309627
309663
  if (typeof value !== "number" || !Number.isFinite(value))
309628
309664
  return;
309629
309665
  return value;
@@ -318131,7 +318167,51 @@ menclose::after {
318131
318167
  getStats() {
318132
318168
  return this.cache.getStats();
318133
318169
  }
318134
- }, sharedHeaderFooterCache, HEADER_FOOTER_VARIANTS$12, canvas = null, ctx = null, isWordChar$1 = (char) => {
318170
+ }, sharedHeaderFooterCache, HEADER_FOOTER_VARIANTS$12, isAtomicLayoutRun = (run2) => typeof run2.src === "string" || run2.kind === "math" || run2.kind === "fieldAnnotation", resolveFieldAnnotationFontSize = (value) => {
318171
+ if (typeof value === "number" && Number.isFinite(value))
318172
+ return value;
318173
+ if (typeof value === "string") {
318174
+ const parsed = parseFloat(value);
318175
+ if (Number.isFinite(parsed) && parsed > 0)
318176
+ return parsed;
318177
+ }
318178
+ return 16;
318179
+ }, getImageRunSize = (run2) => {
318180
+ const distLeft = run2.distLeft ?? 0;
318181
+ const distRight = run2.distRight ?? 0;
318182
+ const distTop = run2.distTop ?? 0;
318183
+ const distBottom = run2.distBottom ?? 0;
318184
+ return {
318185
+ width: (run2.width ?? 0) + distLeft + distRight,
318186
+ height: (run2.height ?? 0) + distTop + distBottom
318187
+ };
318188
+ }, getMathRunSize = (run2) => ({
318189
+ width: run2.width ?? 20,
318190
+ height: run2.height ?? 24
318191
+ }), getFieldAnnotationRunSize = (run2, measureText$1) => {
318192
+ const fontSize = resolveFieldAnnotationFontSize(run2.fontSize);
318193
+ const horizontalPadding = run2.highlighted === false ? 0 : 8;
318194
+ const verticalPadding = run2.highlighted === false ? 0 : 6;
318195
+ const label = run2.displayLabel ?? "";
318196
+ const width = (label ? measureText$1(label, run2, fontSize) : 0) + horizontalPadding;
318197
+ let height = fontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + verticalPadding;
318198
+ if (run2.variant === "signature" && run2.imageSrc)
318199
+ height = Math.max(height, 28 + verticalPadding);
318200
+ if (run2.variant === "image" && run2.imageSrc && run2.size?.height)
318201
+ height = Math.max(height, run2.size.height + verticalPadding);
318202
+ if (run2.variant === "html" && run2.size?.height)
318203
+ height = Math.max(height, run2.size.height);
318204
+ return {
318205
+ width,
318206
+ height
318207
+ };
318208
+ }, getAtomicRunLayoutSize = (run2, measureText$1) => {
318209
+ if (typeof run2.src === "string")
318210
+ return getImageRunSize(run2);
318211
+ if (run2.kind === "math")
318212
+ return getMathRunSize(run2);
318213
+ return getFieldAnnotationRunSize(run2, measureText$1);
318214
+ }, canvas = null, ctx = null, isWordChar$1 = (char) => {
318135
318215
  if (!char)
318136
318216
  return false;
318137
318217
  const code6 = char.charCodeAt(0);
@@ -318160,6 +318240,26 @@ menclose::after {
318160
318240
  }, DEFAULT_TAB_INTERVAL_TWIPS$12 = 720, TWIPS_PER_PX$2, TAB_EPSILON$1 = 0.1, WIDTH_FUDGE_PX = 0.5, twipsToPx$1 = (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) => {
318161
318241
  const width = run2.width;
318162
318242
  return typeof width === "number" ? width : 0;
318243
+ }, measureAtomicText = (text5, run2, fontSize) => {
318244
+ const family2 = run2.fontFamily || "Arial";
318245
+ const context = getCtx();
318246
+ if (!context)
318247
+ return Math.max(0, text5.length * (fontSize * 0.6));
318248
+ context.font = `${run2.italic ? "italic " : ""}${run2.bold ? "bold " : ""}${fontSize}px ${family2}`.trim();
318249
+ return context.measureText(text5).width;
318250
+ }, getAtomicRunLayoutWidth = (run2) => getAtomicRunLayoutSize(run2, measureAtomicText).width, getAtomicRunLayoutHeight = (run2) => getAtomicRunLayoutSize(run2, measureAtomicText).height, getLineMaxAtomicHeight = (runs2, fromRun, fromChar, toRun, toChar) => {
318251
+ let max$2 = 0;
318252
+ for (let r$1 = fromRun;r$1 <= toRun; r$1 += 1) {
318253
+ const run2 = runs2[r$1];
318254
+ if (!isAtomicLayoutRun(run2))
318255
+ continue;
318256
+ if (r$1 === toRun && toChar === 0)
318257
+ continue;
318258
+ if (r$1 === fromRun && r$1 === toRun && toChar <= fromChar)
318259
+ continue;
318260
+ max$2 = Math.max(max$2, getAtomicRunLayoutHeight(run2));
318261
+ }
318262
+ return max$2;
318163
318263
  }, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
318164
318264
  const size$1 = run2?.fontSize ?? 16;
318165
318265
  const family2 = run2?.fontFamily ?? "Arial";
@@ -318232,7 +318332,7 @@ menclose::after {
318232
318332
  };
318233
318333
  const text5 = runText(run2);
318234
318334
  if (!text5) {
318235
- const runWidth = getRunWidth(run2);
318335
+ const runWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
318236
318336
  if (runWidth > 0) {
318237
318337
  totalWidth += runWidth;
318238
318338
  endRun = r$1;
@@ -318291,7 +318391,7 @@ menclose::after {
318291
318391
  break;
318292
318392
  const text5 = runText(run2);
318293
318393
  if (!text5) {
318294
- totalWidth += getRunWidth(run2);
318394
+ totalWidth += isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
318295
318395
  continue;
318296
318396
  }
318297
318397
  const sliceStart = r$1 === startRunIndex ? startChar : 0;
@@ -318469,7 +318569,21 @@ menclose::after {
318469
318569
  }
318470
318570
  const text5 = runText(run2);
318471
318571
  if (!text5) {
318472
- cursorX += getRunWidth(run2);
318572
+ const atomicWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
318573
+ const pendingTabAlign = consumePendingTabAlignStart();
318574
+ if (pendingTabAlign != null) {
318575
+ const segment = {
318576
+ runIndex,
318577
+ fromChar: 0,
318578
+ toChar: 1,
318579
+ width: atomicWidth,
318580
+ x: pendingTabAlign.paintX,
318581
+ ...pendingTabAlign.precedingTabEndX !== undefined ? { precedingTabEndX: pendingTabAlign.precedingTabEndX } : {}
318582
+ };
318583
+ cursorX = pendingTabAlign.layoutX + atomicWidth;
318584
+ segments.push(segment);
318585
+ } else
318586
+ cursorX += atomicWidth;
318473
318587
  lineWidth = Math.max(lineWidth, cursorX);
318474
318588
  continue;
318475
318589
  }
@@ -323887,7 +324001,7 @@ menclose::after {
323887
324001
  }
323888
324002
  }, EMUS_PER_INCH = 914400, maxSize = 5000, cache, makeKey = (text5, font, letterSpacing) => {
323889
324003
  return `${text5}|${font}|${letterSpacing || 0}`;
323890
- }, fontMetricsCache, MAX_CACHE_SIZE = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", DEFAULT_MIN_COLUMN_WIDTH = 8, TWIPS_PER_PX$1 = 15, PLACEHOLDER_COLUMN_MAX_WIDTH = 1, DEFAULT_CELL_PADDING$1, DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1 = 16, FIELD_ANNOTATION_PILL_PADDING$1 = 8, TABLE_CELL_METRICS_CACHE_SIZE = 2000, TABLE_AUTOFIT_RESULT_CACHE_SIZE = 500, NO_WRAP_MAX_WIDTH, TOKEN_BOUNDARY_PATTERN, LruCache = class {
324004
+ }, fontMetricsCache, MAX_CACHE_SIZE = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", DEFAULT_MIN_COLUMN_WIDTH = 8, TWIPS_PER_PX$1 = 15, PLACEHOLDER_COLUMN_MAX_WIDTH = 1, DEFAULT_CELL_PADDING$1, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, FIELD_ANNOTATION_PILL_PADDING = 8, TABLE_CELL_METRICS_CACHE_SIZE = 2000, TABLE_AUTOFIT_RESULT_CACHE_SIZE = 500, NO_WRAP_MAX_WIDTH, TOKEN_BOUNDARY_PATTERN, LruCache = class {
323891
324005
  constructor(maxSize$1) {
323892
324006
  this.cache = /* @__PURE__ */ new Map;
323893
324007
  this.maxSize = maxSize$1;
@@ -323921,7 +324035,7 @@ menclose::after {
323921
324035
  this.cache.delete(oldestKey);
323922
324036
  }
323923
324037
  }
323924
- }, tableCellMetricsCache, autoFitTableResultCache, canvasContext$1 = null, computeTabStops2, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS2 = 720, TWIPS_PER_PX2, twipsToPx2 = (twips) => twips / TWIPS_PER_PX2, pxToTwips = (px) => Math.round(px * TWIPS_PER_PX2), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON = 0.1, DEFAULT_CELL_PADDING, DEFAULT_DECIMAL_SEPARATOR2 = ".", ALLOWED_TAB_VALS, FIELD_ANNOTATION_PILL_PADDING = 8, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, FIELD_ANNOTATION_VERTICAL_PADDING = 6, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize2 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
324038
+ }, tableCellMetricsCache, autoFitTableResultCache, canvasContext$1 = null, computeTabStops2, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS2 = 720, TWIPS_PER_PX2, twipsToPx2 = (twips) => twips / TWIPS_PER_PX2, pxToTwips = (px) => Math.round(px * TWIPS_PER_PX2), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON = 0.1, DEFAULT_CELL_PADDING, DEFAULT_DECIMAL_SEPARATOR2 = ".", ALLOWED_TAB_VALS, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize2 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
323925
324039
  if (isValidFontSize(value))
323926
324040
  return value;
323927
324041
  if (typeof value === "string") {
@@ -326493,13 +326607,13 @@ menclose::after {
326493
326607
  return;
326494
326608
  console.log(...args$1);
326495
326609
  }, 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;
326496
- var init_src_ly1ZYfUZ_es = __esm(() => {
326610
+ var init_src_BrcexyXf_es = __esm(() => {
326497
326611
  init_rolldown_runtime_Bg48TavK_es();
326498
- init_SuperConverter_DRKaQwZS_es();
326612
+ init_SuperConverter_DIgF4xk__es();
326499
326613
  init_jszip_C49i9kUs_es();
326500
326614
  init_xml_js_CqGKpaft_es();
326501
326615
  init_uuid_B2wVPhPi_es();
326502
- init_create_headless_toolbar_ChACxHAH_es();
326616
+ init_create_headless_toolbar_BT4yIoZ_es();
326503
326617
  init_constants_D9qj59G2_es();
326504
326618
  init_unified_BDuVPlMu_es();
326505
326619
  init_remark_gfm_BUJjZJLy_es();
@@ -339709,6 +339823,10 @@ ${err.toString()}`);
339709
339823
  return { style: attrs.style };
339710
339824
  } },
339711
339825
  wrapAttributes: { rendered: false },
339826
+ wrapperParagraph: {
339827
+ default: null,
339828
+ rendered: false
339829
+ },
339712
339830
  anchorData: { rendered: false },
339713
339831
  marginOffset: { rendered: false },
339714
339832
  attributes: { rendered: false },
@@ -369754,11 +369872,11 @@ function print() { __p += __j.call(arguments, '') }
369754
369872
  ]);
369755
369873
  });
369756
369874
 
369757
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CjKDFHjb.es.js
369875
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B-QEvuPe.es.js
369758
369876
  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;
369759
- var init_create_super_doc_ui_CjKDFHjb_es = __esm(() => {
369760
- init_SuperConverter_DRKaQwZS_es();
369761
- init_create_headless_toolbar_ChACxHAH_es();
369877
+ var init_create_super_doc_ui_B_QEvuPe_es = __esm(() => {
369878
+ init_SuperConverter_DIgF4xk__es();
369879
+ init_create_headless_toolbar_BT4yIoZ_es();
369762
369880
  DEFAULT_TEXT_ALIGN_OPTIONS = [
369763
369881
  {
369764
369882
  label: "Left",
@@ -370049,15 +370167,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
370049
370167
 
370050
370168
  // ../../packages/superdoc/dist/super-editor.es.js
370051
370169
  var init_super_editor_es = __esm(() => {
370052
- init_src_ly1ZYfUZ_es();
370053
- init_SuperConverter_DRKaQwZS_es();
370170
+ init_src_BrcexyXf_es();
370171
+ init_SuperConverter_DIgF4xk__es();
370054
370172
  init_jszip_C49i9kUs_es();
370055
370173
  init_xml_js_CqGKpaft_es();
370056
- init_create_headless_toolbar_ChACxHAH_es();
370174
+ init_create_headless_toolbar_BT4yIoZ_es();
370057
370175
  init_constants_D9qj59G2_es();
370058
370176
  init_unified_BDuVPlMu_es();
370059
370177
  init_DocxZipper_BzS208BW_es();
370060
- init_create_super_doc_ui_CjKDFHjb_es();
370178
+ init_create_super_doc_ui_B_QEvuPe_es();
370061
370179
  init_ui_CGB3qmy3_es();
370062
370180
  init_eventemitter3_UwU_CLPU_es();
370063
370181
  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.42",
3
+ "version": "0.17.0-next.43",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -35,11 +35,11 @@
35
35
  "access": "public"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.42",
39
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.42",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.42",
41
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.42",
42
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.42"
38
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.43",
39
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.43",
40
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.43",
41
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.43",
42
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.43"
43
43
  },
44
44
  "scripts": {
45
45
  "predev": "node scripts/ensure-superdoc-build.js",