@superdoc-dev/cli 0.2.0-next.120 → 0.2.0-next.122

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 +223 -122
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -134644,7 +134644,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
134644
134644
  init_remark_gfm_z_sDF4ss_es();
134645
134645
  });
134646
134646
 
134647
- // ../../packages/superdoc/dist/chunks/src-CA9yZS_s.es.js
134647
+ // ../../packages/superdoc/dist/chunks/src-BDv_tIia.es.js
134648
134648
  function deleteProps(obj, propOrProps) {
134649
134649
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
134650
134650
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -158845,12 +158845,8 @@ function applySectPrToProjection$1(editor, projection, sectPr) {
158845
158845
  editor.dispatch(tr$1);
158846
158846
  return;
158847
158847
  }
158848
- const docAttrs = editor.state.doc.attrs ?? {};
158849
158848
  const tr = applyDirectMutationMeta(editor.state.tr);
158850
- tr.setNodeMarkup(0, undefined, {
158851
- ...docAttrs,
158852
- bodySectPr: sectPr
158853
- });
158849
+ tr.setDocAttribute("bodySectPr", sectPr);
158854
158850
  tr.setMeta("forceUpdatePagination", true);
158855
158851
  editor.dispatch(tr);
158856
158852
  syncConverterBodySection$1(editor, sectPr);
@@ -163124,12 +163120,8 @@ function applySectPrToProjection(editor, projection, sectPr) {
163124
163120
  editor.dispatch(tr$1);
163125
163121
  return;
163126
163122
  }
163127
- const docAttrs = editor.state.doc.attrs ?? {};
163128
163123
  const tr = applyDirectMutationMeta(editor.state.tr);
163129
- tr.setNodeMarkup(0, undefined, {
163130
- ...docAttrs,
163131
- bodySectPr: sectPr
163132
- });
163124
+ tr.setDocAttribute("bodySectPr", sectPr);
163133
163125
  tr.setMeta("forceUpdatePagination", true);
163134
163126
  editor.dispatch(tr);
163135
163127
  syncConverterBodySection(editor, sectPr);
@@ -169624,76 +169616,86 @@ function applyAlphaToSVG$1(svg2, alphaData) {
169624
169616
  function generateGradientId(prefix2 = "gradient") {
169625
169617
  return `${prefix2}-${Date.now()}-${gradientIdCounter++}-${Math.random().toString(36).substring(2, 11)}`;
169626
169618
  }
169627
- function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, measureMarkerText) {
169619
+ function resolveListMarkerGeometry(wordLayout, indentLeft, firstLine, hanging, measureMarkerText) {
169628
169620
  const marker = wordLayout?.marker;
169629
169621
  if (!marker)
169630
- return wordLayout?.firstLineIndentMode === true && typeof wordLayout.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
169631
- const markerBoxWidth = typeof marker.markerBoxWidthPx === "number" && Number.isFinite(marker.markerBoxWidthPx) ? marker.markerBoxWidthPx : 0;
169632
- let markerTextWidth = typeof marker.glyphWidthPx === "number" && Number.isFinite(marker.glyphWidthPx) ? marker.glyphWidthPx : undefined;
169633
- if (markerTextWidth == null && marker.markerText)
169634
- markerTextWidth = measureMarkerText(marker.markerText, marker);
169635
- if (!Number.isFinite(markerTextWidth) || markerTextWidth !== undefined && markerTextWidth < 0)
169636
- markerTextWidth = markerBoxWidth;
169637
- const finalMarkerTextWidth = Math.max(0, markerTextWidth ?? 0);
169638
- let markerStartPos;
169639
- if (wordLayout?.firstLineIndentMode === true && typeof marker.markerX === "number" && Number.isFinite(marker.markerX))
169640
- markerStartPos = marker.markerX;
169641
- else
169642
- markerStartPos = indentLeft - hanging + firstLine;
169643
- if (!Number.isFinite(markerStartPos))
169644
- markerStartPos = 0;
169645
- const currentPos = markerStartPos + finalMarkerTextWidth;
169622
+ return;
169623
+ const markerTextWidthPx = getMarkerTextWidthPx(marker, measureMarkerText);
169624
+ const markerBoxWidthPx = getMarkerBoxWidthPx(marker, markerTextWidthPx);
169625
+ const justification = marker.justification ?? "left";
169626
+ const explicitFirstLineMarkerStartPx = getExplicitFirstLineMarkerStartPx(wordLayout, marker);
169627
+ const anchorPx = getMarkerAnchorPx(indentLeft, firstLine, hanging);
169628
+ const markerStartPx = explicitFirstLineMarkerStartPx ?? getMarkerStartPx(anchorPx, justification, markerTextWidthPx);
169629
+ const markerContentEndPx = markerStartPx + markerTextWidthPx;
169646
169630
  const suffix = marker.suffix ?? "tab";
169647
- if (suffix === "space")
169648
- return markerStartPos + finalMarkerTextWidth + 4;
169649
169631
  if (suffix === "nothing")
169650
- return markerStartPos + finalMarkerTextWidth;
169651
- const markerJustification = marker.justification ?? "left";
169652
- const markerWidthEffective = Math.max(typeof marker.markerBoxWidthPx === "number" && Number.isFinite(marker.markerBoxWidthPx) ? marker.markerBoxWidthPx : 0, finalMarkerTextWidth);
169653
- if (markerJustification !== "left") {
169654
- const gutterWidth$1 = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : 8;
169655
- return markerStartPos + finalMarkerTextWidth + Math.max(gutterWidth$1, 8);
169632
+ return {
169633
+ markerStartPx,
169634
+ markerTextWidthPx,
169635
+ textStartPx: markerContentEndPx,
169636
+ suffixWidthPx: 0
169637
+ };
169638
+ if (suffix === "space")
169639
+ return {
169640
+ markerStartPx,
169641
+ markerTextWidthPx,
169642
+ textStartPx: markerContentEndPx + 4,
169643
+ suffixWidthPx: 4
169644
+ };
169645
+ if (justification !== "left") {
169646
+ const gutterWidthPx$1 = Math.max(getNonNegativeFiniteNumber(marker.gutterWidthPx) ?? 0, 8);
169647
+ return {
169648
+ markerStartPx,
169649
+ markerTextWidthPx,
169650
+ textStartPx: markerContentEndPx + gutterWidthPx$1,
169651
+ suffixWidthPx: gutterWidthPx$1
169652
+ };
169656
169653
  }
169657
169654
  if (wordLayout?.firstLineIndentMode === true) {
169658
- let targetTabStop;
169659
- if (Array.isArray(wordLayout.tabsPx)) {
169660
- for (const tab of wordLayout.tabsPx)
169661
- if (typeof tab === "number" && tab > currentPos) {
169662
- targetTabStop = tab;
169663
- break;
169664
- }
169665
- }
169666
- const textStartTarget$1 = typeof marker.textStartX === "number" && Number.isFinite(marker.textStartX) ? marker.textStartX : wordLayout.textStartPx;
169667
- let tabWidth$1;
169668
- if (targetTabStop !== undefined)
169669
- tabWidth$1 = targetTabStop - currentPos;
169670
- else if (textStartTarget$1 !== undefined && Number.isFinite(textStartTarget$1) && textStartTarget$1 > currentPos)
169671
- tabWidth$1 = textStartTarget$1 - currentPos;
169655
+ const explicitTabStopPx = getNextExplicitTabStopPx(wordLayout.tabsPx, markerContentEndPx);
169656
+ const textStartTargetPx = getFirstLineTextStartTargetPx(wordLayout, marker);
169657
+ let textStartPx$1;
169658
+ if (explicitTabStopPx != null)
169659
+ textStartPx$1 = explicitTabStopPx;
169660
+ else if (textStartTargetPx != null && textStartTargetPx > markerContentEndPx)
169661
+ textStartPx$1 = textStartTargetPx;
169672
169662
  else
169673
- tabWidth$1 = 8;
169674
- if (tabWidth$1 < 8)
169675
- tabWidth$1 = 8;
169676
- return markerStartPos + finalMarkerTextWidth + tabWidth$1;
169677
- }
169678
- const textStartTarget = typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
169679
- const gutterWidth = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : 8;
169680
- const currentPosStandard = markerStartPos + markerWidthEffective;
169681
- let explicitTabStop;
169682
- if (Array.isArray(wordLayout?.tabsPx)) {
169683
- for (const tab of wordLayout.tabsPx)
169684
- if (typeof tab === "number" && tab > currentPosStandard) {
169685
- explicitTabStop = tab;
169686
- break;
169687
- }
169663
+ textStartPx$1 = markerContentEndPx + 8;
169664
+ if (textStartPx$1 - markerContentEndPx < 8)
169665
+ textStartPx$1 = markerContentEndPx + 8;
169666
+ return {
169667
+ markerStartPx,
169668
+ markerTextWidthPx,
169669
+ textStartPx: textStartPx$1,
169670
+ suffixWidthPx: textStartPx$1 - markerContentEndPx
169671
+ };
169688
169672
  }
169689
- if (explicitTabStop !== undefined)
169690
- return explicitTabStop;
169691
- if (textStartTarget !== undefined)
169692
- return currentPosStandard + Math.max(textStartTarget - currentPosStandard, gutterWidth);
169693
- let tabWidth = indentLeft + firstLine - currentPosStandard;
169694
- if (tabWidth <= 0)
169695
- tabWidth = currentPosStandard + 48 - currentPosStandard % 48 - currentPosStandard;
169696
- return currentPosStandard + tabWidth;
169673
+ const gutterWidthPx = Math.max(getNonNegativeFiniteNumber(marker.gutterWidthPx) ?? 0, 8);
169674
+ const explicitTextStartPx = resolveExplicitStandardTextStartPx(getFiniteNumber(wordLayout?.textStartPx), markerContentEndPx, gutterWidthPx);
169675
+ if (explicitTextStartPx != null)
169676
+ return {
169677
+ markerStartPx,
169678
+ markerTextWidthPx,
169679
+ textStartPx: explicitTextStartPx,
169680
+ suffixWidthPx: explicitTextStartPx - markerContentEndPx
169681
+ };
169682
+ const markerBoxEndPx = markerStartPx + markerBoxWidthPx;
169683
+ let textStartPx = indentLeft + firstLine;
169684
+ if (textStartPx <= markerBoxEndPx)
169685
+ textStartPx = getNextDefaultTabStopPx(markerBoxEndPx);
169686
+ return {
169687
+ markerStartPx,
169688
+ markerTextWidthPx,
169689
+ textStartPx,
169690
+ suffixWidthPx: textStartPx - markerContentEndPx
169691
+ };
169692
+ }
169693
+ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, measureMarkerText) {
169694
+ const geometry = resolveListMarkerGeometry(wordLayout, indentLeft, firstLine, hanging, measureMarkerText);
169695
+ if (geometry)
169696
+ return geometry.textStartPx;
169697
+ if (wordLayout?.firstLineIndentMode === true)
169698
+ return getFiniteNumber(wordLayout.textStartPx);
169697
169699
  }
169698
169700
  function calculateRotatedBounds(input2) {
169699
169701
  const width = Math.max(0, input2.width);
@@ -175768,7 +175770,14 @@ function computeCellVisibleHeight(cell2, cellFrom, cellTo) {
175768
175770
  return cellVisHeight;
175769
175771
  }
175770
175772
  function renderListMarker(params$1) {
175771
- const { doc: doc$2, lineEl, markerLayout, markerMeasure, indentLeftPx, hangingIndentPx, firstLineIndentPx, tabsPx } = params$1;
175773
+ const { doc: doc$2, lineEl, wordLayout, markerLayout, markerMeasure, indentLeftPx, hangingIndentPx, firstLineIndentPx, tabsPx } = params$1;
175774
+ const markerGeometry = markerLayout?.justification === "left" && wordLayout?.firstLineIndentMode !== true && typeof markerMeasure?.markerTextWidth === "number" && Number.isFinite(markerMeasure.markerTextWidth) && markerMeasure.markerTextWidth >= 0 ? resolvePainterListMarkerGeometry({
175775
+ wordLayout,
175776
+ indentLeftPx,
175777
+ hangingIndentPx,
175778
+ firstLineIndentPx,
175779
+ markerTextWidthPx: markerMeasure?.markerTextWidth
175780
+ }) : undefined;
175772
175781
  const anchorPoint = indentLeftPx - hangingIndentPx + firstLineIndentPx;
175773
175782
  const markerJustification = markerLayout?.justification ?? "left";
175774
175783
  const markerTextWidth = markerMeasure?.markerTextWidth ?? 0;
@@ -175785,7 +175794,9 @@ function renderListMarker(params$1) {
175785
175794
  }
175786
175795
  const suffix = markerLayout?.suffix ?? "tab";
175787
175796
  let listTabWidth = 0;
175788
- if (suffix === "tab")
175797
+ if (markerGeometry && (suffix === "tab" || suffix === "space"))
175798
+ listTabWidth = markerGeometry.suffixWidthPx;
175799
+ else if (suffix === "tab")
175789
175800
  listTabWidth = computeTabWidth(currentPos, markerJustification, tabsPx, hangingIndentPx, firstLineIndentPx, indentLeftPx);
175790
175801
  else if (suffix === "space")
175791
175802
  listTabWidth = 4;
@@ -176993,6 +177004,10 @@ function computeWordParagraphLayout(input2) {
176993
177004
  }
176994
177005
  layout.marker = {
176995
177006
  markerText: listRenderingAttrs.markerText,
177007
+ markerBoxWidthPx,
177008
+ markerX,
177009
+ textStartX: layout.textStartPx,
177010
+ gutterWidthPx: 8,
176996
177011
  justification: listRenderingAttrs.justification ?? "left",
176997
177012
  suffix: normalizeSuffix(listRenderingAttrs.suffix),
176998
177013
  run: markerRun
@@ -178784,7 +178799,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
178784
178799
  kind: "paragraph",
178785
178800
  id: baseBlockId,
178786
178801
  runs: [emptyRun],
178787
- attrs: deepClone2(paragraphAttrs)
178802
+ attrs: emptyParagraphAttrs
178788
178803
  });
178789
178804
  return blocks2;
178790
178805
  }
@@ -194368,11 +194383,7 @@ var Node$13 = class Node$14 {
194368
194383
  if (resolved.footer != null)
194369
194384
  pageMargins.footer = resolved.footer;
194370
194385
  }
194371
- const nextDocAttrs = {
194372
- ...docAttrs,
194373
- bodySectPr: sectPr
194374
- };
194375
- tr.setNodeMarkup(0, undefined, nextDocAttrs);
194386
+ tr.setDocAttribute("bodySectPr", sectPr);
194376
194387
  tr.setMeta("forceUpdatePagination", true);
194377
194388
  return true;
194378
194389
  }, insertSectionBreakAtSelection = ({ headerInches, footerInches } = {}) => ({ tr, state, editor }) => {
@@ -197321,11 +197332,7 @@ var Node$13 = class Node$14 {
197321
197332
  return false;
197322
197333
  if (!editor?.state?.tr)
197323
197334
  return false;
197324
- const nextDocAttrs = {
197325
- ...editor.state.doc?.attrs ?? {},
197326
- bodySectPr: nextBodySectPr
197327
- };
197328
- const tr = editor.state.tr.setNodeMarkup(0, undefined, nextDocAttrs).setMeta("addToHistory", false).setMeta(BODY_SECT_PR_SYNC_META_KEY, true);
197335
+ const tr = editor.state.tr.setDocAttribute("bodySectPr", nextBodySectPr).setMeta("addToHistory", false).setMeta(BODY_SECT_PR_SYNC_META_KEY, true);
197329
197336
  if (typeof editor.dispatch === "function") {
197330
197337
  editor.dispatch(tr);
197331
197338
  return true;
@@ -201030,7 +201037,56 @@ var Node$13 = class Node$14 {
201030
201037
  styleEl.textContent = NATIVE_SELECTION_STYLES;
201031
201038
  doc$2.head?.appendChild(styleEl);
201032
201039
  nativeSelectionStylesInjected = true;
201033
- }, gradientIdCounter = 0, EMUS_PER_INCH = 914400, maxSize = 5000, cache$1, makeKey = (text5, font, letterSpacing) => {
201040
+ }, gradientIdCounter = 0, getFiniteNumber = (value) => {
201041
+ if (typeof value !== "number" || !Number.isFinite(value))
201042
+ return;
201043
+ return value;
201044
+ }, getNonNegativeFiniteNumber = (value) => {
201045
+ const numericValue = getFiniteNumber(value);
201046
+ if (numericValue == null || numericValue < 0)
201047
+ return;
201048
+ return numericValue;
201049
+ }, getMarkerTextWidthPx = (marker, measureMarkerText) => {
201050
+ const glyphWidthPx = getNonNegativeFiniteNumber(marker.glyphWidthPx);
201051
+ if (glyphWidthPx != null)
201052
+ return glyphWidthPx;
201053
+ if (marker.markerText) {
201054
+ const safeMeasuredWidthPx = getNonNegativeFiniteNumber(measureMarkerText(marker.markerText, marker));
201055
+ if (safeMeasuredWidthPx != null)
201056
+ return safeMeasuredWidthPx;
201057
+ }
201058
+ return getNonNegativeFiniteNumber(marker.markerBoxWidthPx) ?? 0;
201059
+ }, getMarkerBoxWidthPx = (marker, markerTextWidthPx) => Math.max(getNonNegativeFiniteNumber(marker.markerBoxWidthPx) ?? 0, markerTextWidthPx), getExplicitFirstLineMarkerStartPx = (wordLayout, marker) => {
201060
+ if (wordLayout?.firstLineIndentMode !== true)
201061
+ return;
201062
+ return getFiniteNumber(marker.markerX);
201063
+ }, getMarkerAnchorPx = (indentLeft, firstLine, hanging) => indentLeft - hanging + firstLine, getMarkerStartPx = (anchorPx, justification, markerTextWidthPx) => {
201064
+ if (justification === "right")
201065
+ return anchorPx - markerTextWidthPx;
201066
+ if (justification === "center")
201067
+ return anchorPx - markerTextWidthPx / 2;
201068
+ return anchorPx;
201069
+ }, getNextExplicitTabStopPx = (tabsPx, currentPosPx) => {
201070
+ if (!Array.isArray(tabsPx))
201071
+ return;
201072
+ for (const tabPx of tabsPx)
201073
+ if (typeof tabPx === "number" && Number.isFinite(tabPx) && tabPx > currentPosPx)
201074
+ return tabPx;
201075
+ }, getFirstLineTextStartTargetPx = (wordLayout, marker) => {
201076
+ return getFiniteNumber(marker.textStartX) ?? getFiniteNumber(wordLayout?.textStartPx);
201077
+ }, getNextDefaultTabStopPx = (currentPosPx) => {
201078
+ const remainderPx = currentPosPx % 48;
201079
+ if (remainderPx === 0)
201080
+ return currentPosPx + 48;
201081
+ return currentPosPx + 48 - remainderPx;
201082
+ }, getMinimumReadableTextStartPx = (markerContentEndPx, gutterWidthPx) => markerContentEndPx + gutterWidthPx, resolveExplicitStandardTextStartPx = (explicitTextStartPx, markerContentEndPx, gutterWidthPx) => {
201083
+ if (explicitTextStartPx == null)
201084
+ return;
201085
+ if (explicitTextStartPx > markerContentEndPx)
201086
+ return explicitTextStartPx;
201087
+ if (explicitTextStartPx > 0)
201088
+ return getMinimumReadableTextStartPx(markerContentEndPx, gutterWidthPx);
201089
+ }, EMUS_PER_INCH = 914400, maxSize = 5000, cache$1, makeKey = (text5, font, letterSpacing) => {
201034
201090
  return `${text5}|${font}|${letterSpacing || 0}`;
201035
201091
  }, fontMetricsCache, MAX_CACHE_SIZE$1 = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", computeTabStops, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$1, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1), DEFAULT_TAB_INTERVAL_PX$1, TAB_EPSILON$1 = 0.1, DEFAULT_CELL_PADDING$1, DEFAULT_DECIMAL_SEPARATOR$1 = ".", 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, normalizeFontSize$1 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
201036
201092
  if (isValidFontSize(value))
@@ -201694,7 +201750,11 @@ var Node$13 = class Node$14 {
201694
201750
  line.el.style.marginLeft = `${marginLeft}px`;
201695
201751
  line.el.style.marginRight = `${marginRight}px`;
201696
201752
  });
201697
- }, DEFAULT_TAB_INTERVAL_PX = 48, computeTabWidth = (currentPos, justification, tabs, hangingIndent, firstLineIndent, leftIndent) => {
201753
+ }, DEFAULT_TAB_INTERVAL_PX = 48, getFiniteNonNegativeNumber = (value) => {
201754
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
201755
+ return;
201756
+ return value;
201757
+ }, resolvePainterMarkerTextWidth = (markerTextWidthPx, marker) => getFiniteNonNegativeNumber(markerTextWidthPx) ?? getFiniteNonNegativeNumber(marker.glyphWidthPx) ?? getFiniteNonNegativeNumber(marker.markerBoxWidthPx) ?? 0, resolvePainterListMarkerGeometry = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), resolvePainterListTextStartPx = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), computeTabWidth = (currentPos, justification, tabs, hangingIndent, firstLineIndent, leftIndent) => {
201698
201758
  const nextDefaultTabStop = currentPos + DEFAULT_TAB_INTERVAL_PX - currentPos % DEFAULT_TAB_INTERVAL_PX;
201699
201759
  let tabWidth;
201700
201760
  if (justification === "left") {
@@ -202112,6 +202172,13 @@ var Node$13 = class Node$14 {
202112
202172
  const hangingIndentPx = block.attrs?.indent && typeof block.attrs.indent.hanging === "number" ? block.attrs.indent.hanging : 0;
202113
202173
  const firstLineIndentPx = block.attrs?.indent && typeof block.attrs.indent.firstLine === "number" ? block.attrs.indent.firstLine : 0;
202114
202174
  const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
202175
+ const listFirstLineTextStartPx = markerLayout && markerMeasure ? resolvePainterListTextStartPx({
202176
+ wordLayout: wordLayout ?? undefined,
202177
+ indentLeftPx,
202178
+ hangingIndentPx,
202179
+ firstLineIndentPx,
202180
+ markerTextWidthPx: markerMeasure.markerTextWidth
202181
+ }) : undefined;
202115
202182
  const blockStartGlobal = cumulativeLineCount;
202116
202183
  if (cumulativeLineCount + blockLineCount <= globalFromLine) {
202117
202184
  cumulativeLineCount += blockLineCount;
@@ -202151,7 +202218,7 @@ var Node$13 = class Node$14 {
202151
202218
  const lineEl = renderLine(block, line, {
202152
202219
  ...context,
202153
202220
  section: "body"
202154
- }, lineIdx, isLastLine);
202221
+ }, lineIdx, isLastLine, lineIdx === 0 && localStartLine === 0 ? listFirstLineTextStartPx : undefined);
202155
202222
  lineEl.style.paddingLeft = "";
202156
202223
  lineEl.style.paddingRight = "";
202157
202224
  lineEl.style.textIndent = "";
@@ -202159,6 +202226,7 @@ var Node$13 = class Node$14 {
202159
202226
  renderListMarker({
202160
202227
  doc: doc$2,
202161
202228
  lineEl,
202229
+ wordLayout: wordLayout ?? undefined,
202162
202230
  markerLayout,
202163
202231
  markerMeasure,
202164
202232
  indentLeftPx,
@@ -202768,7 +202836,7 @@ var Node$13 = class Node$14 {
202768
202836
  this.onMouseLeave = null;
202769
202837
  this.hoveredSdtId = null;
202770
202838
  }
202771
- }, LIST_MARKER_GAP = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, COMMENT_EXTERNAL_COLOR = "#B1124B", COMMENT_INTERNAL_COLOR = "#078383", COMMENT_INACTIVE_ALPHA = "40", COMMENT_ACTIVE_ALPHA = "66", COMMENT_FADED_ALPHA = "20", 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_FOCUSED_CLASS = "track-change-focused", TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
202839
+ }, LIST_MARKER_GAP$1 = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, COMMENT_EXTERNAL_COLOR = "#B1124B", COMMENT_INTERNAL_COLOR = "#078383", COMMENT_INACTIVE_ALPHA = "40", COMMENT_ACTIVE_ALPHA = "66", COMMENT_FADED_ALPHA = "20", 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_FOCUSED_CLASS = "track-change-focused", TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
202772
202840
  if (typeof value !== "string")
202773
202841
  return null;
202774
202842
  const trimmed = value.trim();
@@ -216758,7 +216826,7 @@ var Node$13 = class Node$14 {
216758
216826
  return false;
216759
216827
  return Boolean(checker(attrs));
216760
216828
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
216761
- var init_src_CA9yZS_s_es = __esm(() => {
216829
+ var init_src_BDv_tIia_es = __esm(() => {
216762
216830
  init_rolldown_runtime_B2q5OVn9_es();
216763
216831
  init_SuperConverter_BBGfKYpx_es();
216764
216832
  init_jszip_ChlR43oI_es();
@@ -226455,6 +226523,29 @@ function print() { __p += __j.call(arguments, '') }
226455
226523
  tr.setMeta("replaceContent", true);
226456
226524
  this.#dispatchTransaction(tr);
226457
226525
  }
226526
+ #syncDocumentAttrs(nextAttrs = {}) {
226527
+ const currentAttrs = this.state.doc?.attrs ?? {};
226528
+ const docAttrSpecs = this.schema?.topNodeType?.spec?.attrs ?? {};
226529
+ const attrKeys = new Set([
226530
+ ...Object.keys(docAttrSpecs),
226531
+ ...Object.keys(currentAttrs),
226532
+ ...Object.keys(nextAttrs)
226533
+ ]);
226534
+ if (attrKeys.size === 0)
226535
+ return;
226536
+ const valuesMatch = (a2, b$1) => a2 === b$1 || JSON.stringify(a2) === JSON.stringify(b$1);
226537
+ const tr = this.state.tr.setMeta("addToHistory", false);
226538
+ let changed = false;
226539
+ for (const key$1 of attrKeys) {
226540
+ const nextValue = Object.prototype.hasOwnProperty.call(nextAttrs, key$1) ? nextAttrs[key$1] : docAttrSpecs[key$1]?.default;
226541
+ if (valuesMatch(currentAttrs[key$1], nextValue))
226542
+ continue;
226543
+ tr.setDocAttribute(key$1, nextValue);
226544
+ changed = true;
226545
+ }
226546
+ if (changed)
226547
+ this.#dispatchTransaction(tr);
226548
+ }
226458
226549
  #insertNewFileData() {
226459
226550
  if (!this.options.isNewFile)
226460
226551
  return;
@@ -226466,13 +226557,7 @@ function print() { __p += __j.call(arguments, '') }
226466
226557
  const ydoc = this.options.ydoc;
226467
226558
  if (ydoc)
226468
226559
  ydoc.getMap("meta").set("bodySectPr", nextBodySectPr);
226469
- if (Object.keys(doc$2.attrs).length > 0) {
226470
- const attrsTr = this.state.tr.setNodeMarkup(0, undefined, {
226471
- ...this.state.doc.attrs ?? {},
226472
- ...doc$2.attrs ?? {}
226473
- }).setMeta("addToHistory", false);
226474
- this.#dispatchTransaction(attrsTr);
226475
- }
226560
+ this.#syncDocumentAttrs(doc$2.attrs ?? {});
226476
226561
  setTimeout(() => {
226477
226562
  this.#initComments();
226478
226563
  }, 50);
@@ -232313,9 +232398,22 @@ function print() { __p += __j.call(arguments, '') }
232313
232398
  const paraIndentRight = paraIndent?.right ?? 0;
232314
232399
  const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
232315
232400
  const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
232316
- let listFirstLineMarkerTabEndPx = null;
232401
+ const listFirstLineTextStartPx = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker ? resolvePainterListTextStartPx({
232402
+ wordLayout,
232403
+ indentLeftPx: paraIndentLeft,
232404
+ hangingIndentPx: paraIndent?.hanging ?? 0,
232405
+ firstLineIndentPx: paraIndent?.firstLine ?? 0,
232406
+ markerTextWidthPx: fragment2.markerTextWidth
232407
+ }) : undefined;
232408
+ const listFirstLineMarkerGeometry = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment2.markerTextWidth === "number" && Number.isFinite(fragment2.markerTextWidth) && fragment2.markerTextWidth >= 0 ? resolvePainterListMarkerGeometry({
232409
+ wordLayout,
232410
+ indentLeftPx: paraIndentLeft,
232411
+ hangingIndentPx: paraIndent?.hanging ?? 0,
232412
+ firstLineIndentPx: paraIndent?.firstLine ?? 0,
232413
+ markerTextWidthPx: fragment2.markerTextWidth
232414
+ }) : undefined;
232317
232415
  let listTabWidth = 0;
232318
- let markerStartPos;
232416
+ let markerStartPos = 0;
232319
232417
  if (!fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker) {
232320
232418
  const markerTextWidth = fragment2.markerTextWidth;
232321
232419
  const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
@@ -232332,22 +232430,25 @@ function print() { __p += __j.call(arguments, '') }
232332
232430
  currentPos = markerStartPos + markerTextWidth;
232333
232431
  }
232334
232432
  const suffix = wordLayout.marker.suffix ?? "tab";
232335
- if (suffix === "tab")
232433
+ if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
232434
+ listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
232435
+ else if (suffix === "tab")
232336
232436
  listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
232337
232437
  else if (suffix === "space")
232338
232438
  listTabWidth = 4;
232339
- listFirstLineMarkerTabEndPx = currentPos + listTabWidth;
232340
232439
  }
232341
232440
  lines.forEach((line, index2) => {
232441
+ const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
232442
+ const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
232443
+ const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
232342
232444
  const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
232343
232445
  const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
232344
232446
  let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
232345
- if (index2 === 0 && listFirstLineMarkerTabEndPx != null)
232346
- availableWidthOverride = fragment2.width - listFirstLineMarkerTabEndPx - Math.max(0, paraIndentRight);
232447
+ if (shouldUseResolvedListTextStart)
232448
+ availableWidthOverride = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
232347
232449
  const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
232348
- const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine);
232349
- const isListFirstLine = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && fragment2.markerTextWidth && wordLayout?.marker;
232350
- const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== undefined);
232450
+ const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
232451
+ const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
232351
232452
  const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
232352
232453
  if (!isListFirstLine) {
232353
232454
  if (hasExplicitSegmentPositioning) {
@@ -232369,7 +232470,9 @@ function print() { __p += __j.call(arguments, '') }
232369
232470
  } else if (firstLineOffset && !isListFirstLine)
232370
232471
  lineEl.style.textIndent = "0px";
232371
232472
  if (isListFirstLine) {
232372
- const marker = wordLayout.marker;
232473
+ const marker = wordLayout?.marker;
232474
+ if (!marker)
232475
+ return;
232373
232476
  lineEl.style.paddingLeft = `${paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)}px`;
232374
232477
  if (!marker.run.vanish) {
232375
232478
  const markerContainer = this.doc.createElement("span");
@@ -232516,8 +232619,8 @@ function print() { __p += __j.call(arguments, '') }
232516
232619
  if (marker) {
232517
232620
  markerEl.textContent = marker.markerText ?? null;
232518
232621
  markerEl.style.display = "inline-block";
232519
- markerEl.style.width = `${Math.max(0, fragment2.markerWidth - LIST_MARKER_GAP)}px`;
232520
- markerEl.style.paddingRight = `${LIST_MARKER_GAP}px`;
232622
+ markerEl.style.width = `${Math.max(0, fragment2.markerWidth - LIST_MARKER_GAP$1)}px`;
232623
+ markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
232521
232624
  markerEl.style.textAlign = marker.justification ?? "left";
232522
232625
  markerEl.style.fontFamily = toCssFontFamily(marker.run.fontFamily) ?? marker.run.fontFamily;
232523
232626
  markerEl.style.fontSize = `${marker.run.fontSize}px`;
@@ -232532,8 +232635,8 @@ function print() { __p += __j.call(arguments, '') }
232532
232635
  } else {
232533
232636
  markerEl.textContent = item.marker.text;
232534
232637
  markerEl.style.display = "inline-block";
232535
- markerEl.style.width = `${Math.max(0, fragment2.markerWidth - LIST_MARKER_GAP)}px`;
232536
- markerEl.style.paddingRight = `${LIST_MARKER_GAP}px`;
232638
+ markerEl.style.width = `${Math.max(0, fragment2.markerWidth - LIST_MARKER_GAP$1)}px`;
232639
+ markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
232537
232640
  if (item.marker.align)
232538
232641
  markerEl.style.textAlign = item.marker.align;
232539
232642
  }
@@ -233211,10 +233314,10 @@ function print() { __p += __j.call(arguments, '') }
233211
233314
  const applyFragmentFrameWithSection = (el, frag) => {
233212
233315
  this.applyFragmentFrame(el, frag, context.section);
233213
233316
  };
233214
- const renderLineForTableCell = (block, line, ctx$1, lineIndex, isLastLine) => {
233317
+ const renderLineForTableCell = (block, line, ctx$1, lineIndex, isLastLine, resolvedListTextStartPx) => {
233215
233318
  const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
233216
233319
  const shouldSkipJustify = isLastLine && !paragraphEndsWithLineBreak;
233217
- return this.renderLine(block, line, ctx$1, undefined, lineIndex, shouldSkipJustify);
233320
+ return this.renderLine(block, line, ctx$1, undefined, lineIndex, shouldSkipJustify, resolvedListTextStartPx);
233218
233321
  };
233219
233322
  const renderDrawingContentForTableCell = (block) => {
233220
233323
  if (block.drawingKind === "image")
@@ -233796,7 +233899,7 @@ function print() { __p += __j.call(arguments, '') }
233796
233899
  annotation.style.position = "relative";
233797
233900
  annotation.appendChild(caretAnchor);
233798
233901
  }
233799
- renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify) {
233902
+ renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, resolvedListTextStartPx) {
233800
233903
  if (!this.doc)
233801
233904
  throw new Error("DomPainter: document is not available");
233802
233905
  const lineRange = computeLinePmRange$1(block, line);
@@ -234020,8 +234123,8 @@ function print() { __p += __j.call(arguments, '') }
234020
234123
  const wordLayoutValue = block.attrs?.wordLayout;
234021
234124
  const wordLayout = isMinimalWordLayout(wordLayoutValue) ? wordLayoutValue : undefined;
234022
234125
  const isListParagraph = Boolean(wordLayout?.marker);
234023
- const rawTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
234024
- const indentOffset = isListParagraph ? isFirstLineOfPara ? rawTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
234126
+ const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
234127
+ const indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
234025
234128
  let cumulativeX = 0;
234026
234129
  const segmentsByRun = /* @__PURE__ */ new Map;
234027
234130
  line.segments.forEach((segment) => {
@@ -250351,7 +250454,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
250351
250454
 
250352
250455
  // ../../packages/superdoc/dist/super-editor.es.js
250353
250456
  var init_super_editor_es = __esm(() => {
250354
- init_src_CA9yZS_s_es();
250457
+ init_src_BDv_tIia_es();
250355
250458
  init_SuperConverter_BBGfKYpx_es();
250356
250459
  init_jszip_ChlR43oI_es();
250357
250460
  init_xml_js_DLE8mr0n_es();
@@ -331666,9 +331769,8 @@ function applySectPrToProjection2(editor, projection, sectPr) {
331666
331769
  editor.dispatch(tr2);
331667
331770
  return;
331668
331771
  }
331669
- const docAttrs = editor.state.doc.attrs ?? {};
331670
331772
  const tr = applyDirectMutationMeta2(editor.state.tr);
331671
- tr.setNodeMarkup(0, undefined, { ...docAttrs, bodySectPr: sectPr });
331773
+ tr.setDocAttribute("bodySectPr", sectPr);
331672
331774
  tr.setMeta("forceUpdatePagination", true);
331673
331775
  editor.dispatch(tr);
331674
331776
  syncConverterBodySection2(editor, sectPr);
@@ -335928,9 +336030,8 @@ function applySectPrToProjection3(editor, projection, sectPr) {
335928
336030
  editor.dispatch(tr2);
335929
336031
  return;
335930
336032
  }
335931
- const docAttrs = editor.state.doc.attrs ?? {};
335932
336033
  const tr = applyDirectMutationMeta2(editor.state.tr);
335933
- tr.setNodeMarkup(0, undefined, { ...docAttrs, bodySectPr: sectPr });
336034
+ tr.setDocAttribute("bodySectPr", sectPr);
335934
336035
  tr.setMeta("forceUpdatePagination", true);
335935
336036
  editor.dispatch(tr);
335936
336037
  syncConverterBodySection3(editor, sectPr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.120",
3
+ "version": "0.2.0-next.122",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.120",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.120",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.120",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.120",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.120"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.122",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.122",
35
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.122",
36
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.122",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.122"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",