@superdoc-dev/cli 0.5.0-next.28 → 0.5.0-next.29
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.
- package/dist/index.js +485 -215
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -172583,7 +172583,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
172583
172583
|
init_remark_gfm_z_sDF4ss_es();
|
|
172584
172584
|
});
|
|
172585
172585
|
|
|
172586
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
172586
|
+
// ../../packages/superdoc/dist/chunks/src-C5K9vSFa.es.js
|
|
172587
172587
|
function deleteProps(obj, propOrProps) {
|
|
172588
172588
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
172589
172589
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -182573,6 +182573,69 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
|
|
|
182573
182573
|
if (wordLayout?.firstLineIndentMode === true)
|
|
182574
182574
|
return getFiniteNumber(wordLayout.textStartPx);
|
|
182575
182575
|
}
|
|
182576
|
+
function isMinimalWordLayout(value) {
|
|
182577
|
+
if (typeof value !== "object" || value === null)
|
|
182578
|
+
return false;
|
|
182579
|
+
const obj = value;
|
|
182580
|
+
if (obj.marker !== undefined) {
|
|
182581
|
+
if (typeof obj.marker !== "object" || obj.marker === null)
|
|
182582
|
+
return false;
|
|
182583
|
+
const marker = obj.marker;
|
|
182584
|
+
if (marker.markerText !== undefined && typeof marker.markerText !== "string")
|
|
182585
|
+
return false;
|
|
182586
|
+
if (marker.markerX !== undefined && typeof marker.markerX !== "number")
|
|
182587
|
+
return false;
|
|
182588
|
+
if (marker.textStartX !== undefined && typeof marker.textStartX !== "number")
|
|
182589
|
+
return false;
|
|
182590
|
+
}
|
|
182591
|
+
if (obj.indentLeftPx !== undefined) {
|
|
182592
|
+
if (typeof obj.indentLeftPx !== "number")
|
|
182593
|
+
return false;
|
|
182594
|
+
}
|
|
182595
|
+
if (obj.firstLineIndentMode !== undefined) {
|
|
182596
|
+
if (typeof obj.firstLineIndentMode !== "boolean")
|
|
182597
|
+
return false;
|
|
182598
|
+
}
|
|
182599
|
+
if (obj.textStartPx !== undefined) {
|
|
182600
|
+
if (typeof obj.textStartPx !== "number")
|
|
182601
|
+
return false;
|
|
182602
|
+
}
|
|
182603
|
+
if (obj.tabsPx !== undefined) {
|
|
182604
|
+
if (!Array.isArray(obj.tabsPx))
|
|
182605
|
+
return false;
|
|
182606
|
+
for (const tab of obj.tabsPx)
|
|
182607
|
+
if (typeof tab !== "number")
|
|
182608
|
+
return false;
|
|
182609
|
+
}
|
|
182610
|
+
return true;
|
|
182611
|
+
}
|
|
182612
|
+
function computeTabWidth(currentPos, justification, tabs, hangingIndent, firstLineIndent, leftIndent) {
|
|
182613
|
+
const nextDefaultTabStop = currentPos + 48 - currentPos % 48;
|
|
182614
|
+
let tabWidth;
|
|
182615
|
+
if (justification === "left") {
|
|
182616
|
+
const explicitTabs = [...tabs ?? []];
|
|
182617
|
+
if (hangingIndent && hangingIndent > 0) {
|
|
182618
|
+
explicitTabs.push(leftIndent);
|
|
182619
|
+
explicitTabs.sort((a2, b$1) => a2 - b$1);
|
|
182620
|
+
}
|
|
182621
|
+
let targetTabStop;
|
|
182622
|
+
for (const tab of explicitTabs)
|
|
182623
|
+
if (tab > currentPos) {
|
|
182624
|
+
targetTabStop = tab;
|
|
182625
|
+
break;
|
|
182626
|
+
}
|
|
182627
|
+
if (targetTabStop === undefined)
|
|
182628
|
+
targetTabStop = nextDefaultTabStop;
|
|
182629
|
+
tabWidth = targetTabStop - currentPos;
|
|
182630
|
+
} else if (justification === "right")
|
|
182631
|
+
if (firstLineIndent != null && firstLineIndent > 0)
|
|
182632
|
+
tabWidth = nextDefaultTabStop - currentPos;
|
|
182633
|
+
else
|
|
182634
|
+
tabWidth = hangingIndent ?? 0;
|
|
182635
|
+
else
|
|
182636
|
+
tabWidth = nextDefaultTabStop - currentPos;
|
|
182637
|
+
return tabWidth;
|
|
182638
|
+
}
|
|
182576
182639
|
function calculateRotatedBounds(input2) {
|
|
182577
182640
|
const width = Math.max(0, input2.width);
|
|
182578
182641
|
const height = Math.max(0, input2.height);
|
|
@@ -189403,41 +189466,8 @@ function convertOmmlToMathml(ommlJson, doc$12) {
|
|
|
189403
189466
|
}
|
|
189404
189467
|
return mathEl.childNodes.length > 0 ? mathEl : null;
|
|
189405
189468
|
}
|
|
189406
|
-
function isMinimalWordLayout(value) {
|
|
189407
|
-
|
|
189408
|
-
return false;
|
|
189409
|
-
const obj = value;
|
|
189410
|
-
if (obj.marker !== undefined) {
|
|
189411
|
-
if (typeof obj.marker !== "object" || obj.marker === null)
|
|
189412
|
-
return false;
|
|
189413
|
-
const marker = obj.marker;
|
|
189414
|
-
if (marker.markerText !== undefined && typeof marker.markerText !== "string")
|
|
189415
|
-
return false;
|
|
189416
|
-
if (marker.markerX !== undefined && typeof marker.markerX !== "number")
|
|
189417
|
-
return false;
|
|
189418
|
-
if (marker.textStartX !== undefined && typeof marker.textStartX !== "number")
|
|
189419
|
-
return false;
|
|
189420
|
-
}
|
|
189421
|
-
if (obj.indentLeftPx !== undefined) {
|
|
189422
|
-
if (typeof obj.indentLeftPx !== "number")
|
|
189423
|
-
return false;
|
|
189424
|
-
}
|
|
189425
|
-
if (obj.firstLineIndentMode !== undefined) {
|
|
189426
|
-
if (typeof obj.firstLineIndentMode !== "boolean")
|
|
189427
|
-
return false;
|
|
189428
|
-
}
|
|
189429
|
-
if (obj.textStartPx !== undefined) {
|
|
189430
|
-
if (typeof obj.textStartPx !== "number")
|
|
189431
|
-
return false;
|
|
189432
|
-
}
|
|
189433
|
-
if (obj.tabsPx !== undefined) {
|
|
189434
|
-
if (!Array.isArray(obj.tabsPx))
|
|
189435
|
-
return false;
|
|
189436
|
-
for (const tab of obj.tabsPx)
|
|
189437
|
-
if (typeof tab !== "number")
|
|
189438
|
-
return false;
|
|
189439
|
-
}
|
|
189440
|
-
return true;
|
|
189469
|
+
function isMinimalWordLayout$1(value) {
|
|
189470
|
+
return isMinimalWordLayout(value);
|
|
189441
189471
|
}
|
|
189442
189472
|
function roundSnapshotMetric(value) {
|
|
189443
189473
|
if (!Number.isFinite(value))
|
|
@@ -219614,6 +219644,159 @@ function findSliceAtPosition(slices, pmPos) {
|
|
|
219614
219644
|
}
|
|
219615
219645
|
return null;
|
|
219616
219646
|
}
|
|
219647
|
+
function resolveMarkerTextWidth(markerTextWidthPx, marker) {
|
|
219648
|
+
const val = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : undefined;
|
|
219649
|
+
return val(markerTextWidthPx) ?? val(marker.glyphWidthPx) ?? val(marker.markerBoxWidthPx) ?? 0;
|
|
219650
|
+
}
|
|
219651
|
+
function resolverListMarkerGeometry(wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx) {
|
|
219652
|
+
return resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolveMarkerTextWidth(markerTextWidthPx, marker));
|
|
219653
|
+
}
|
|
219654
|
+
function resolverListTextStartPx(wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx) {
|
|
219655
|
+
return resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolveMarkerTextWidth(markerTextWidthPx, marker));
|
|
219656
|
+
}
|
|
219657
|
+
function resolveParagraphContent(fragment2, block, measure) {
|
|
219658
|
+
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
219659
|
+
const paraIndent = block.attrs?.indent;
|
|
219660
|
+
const paraIndentLeft = paraIndent?.left ?? 0;
|
|
219661
|
+
const paraIndentRight = paraIndent?.right ?? 0;
|
|
219662
|
+
const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
219663
|
+
const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
|
|
219664
|
+
const lines = fragment2.lines ?? measure.lines.slice(fragment2.fromLine, fragment2.toLine);
|
|
219665
|
+
const hasMarker = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
219666
|
+
const listFirstLineTextStartPx = hasMarker ? resolverListTextStartPx(wordLayout, paraIndentLeft, paraIndent?.hanging ?? 0, paraIndent?.firstLine ?? 0, fragment2.markerTextWidth) : undefined;
|
|
219667
|
+
const listFirstLineMarkerGeometry = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment2.markerTextWidth === "number" && Number.isFinite(fragment2.markerTextWidth) && fragment2.markerTextWidth >= 0 ? resolverListMarkerGeometry(wordLayout, paraIndentLeft, paraIndent?.hanging ?? 0, paraIndent?.firstLine ?? 0, fragment2.markerTextWidth) : undefined;
|
|
219668
|
+
let listTabWidth = 0;
|
|
219669
|
+
let markerStartPos = 0;
|
|
219670
|
+
if (hasMarker) {
|
|
219671
|
+
const markerTextWidth = fragment2.markerTextWidth;
|
|
219672
|
+
const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
|
|
219673
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
219674
|
+
let currentPos;
|
|
219675
|
+
if (markerJustification === "left") {
|
|
219676
|
+
markerStartPos = anchorPoint;
|
|
219677
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
219678
|
+
} else if (markerJustification === "right") {
|
|
219679
|
+
markerStartPos = anchorPoint - markerTextWidth;
|
|
219680
|
+
currentPos = anchorPoint;
|
|
219681
|
+
} else {
|
|
219682
|
+
markerStartPos = anchorPoint - markerTextWidth / 2;
|
|
219683
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
219684
|
+
}
|
|
219685
|
+
const suffix = wordLayout.marker.suffix ?? "tab";
|
|
219686
|
+
if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
|
|
219687
|
+
listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
|
|
219688
|
+
else if (suffix === "tab")
|
|
219689
|
+
listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
|
|
219690
|
+
else if (suffix === "space")
|
|
219691
|
+
listTabWidth = 4;
|
|
219692
|
+
}
|
|
219693
|
+
let marker;
|
|
219694
|
+
if (hasMarker) {
|
|
219695
|
+
const m$1 = wordLayout.marker;
|
|
219696
|
+
const justification = m$1.justification ?? "left";
|
|
219697
|
+
const firstLinePaddingLeftPx = paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
219698
|
+
let centerPaddingAdjustPx;
|
|
219699
|
+
if (justification === "center")
|
|
219700
|
+
centerPaddingAdjustPx = fragment2.markerTextWidth / 2;
|
|
219701
|
+
marker = {
|
|
219702
|
+
text: m$1.markerText ?? "",
|
|
219703
|
+
justification,
|
|
219704
|
+
suffix: m$1.suffix ?? "tab",
|
|
219705
|
+
vanish: m$1.run?.vanish,
|
|
219706
|
+
markerStartPx: markerStartPos,
|
|
219707
|
+
suffixWidthPx: listTabWidth,
|
|
219708
|
+
firstLinePaddingLeftPx,
|
|
219709
|
+
centerPaddingAdjustPx,
|
|
219710
|
+
run: {
|
|
219711
|
+
fontFamily: m$1.run?.fontFamily ?? "",
|
|
219712
|
+
fontSize: m$1.run?.fontSize ?? 0,
|
|
219713
|
+
bold: m$1.run?.bold,
|
|
219714
|
+
italic: m$1.run?.italic,
|
|
219715
|
+
color: m$1.run?.color,
|
|
219716
|
+
letterSpacing: m$1.run?.letterSpacing
|
|
219717
|
+
}
|
|
219718
|
+
};
|
|
219719
|
+
}
|
|
219720
|
+
let dropCap;
|
|
219721
|
+
const dropCapDescriptor = block.attrs?.dropCapDescriptor;
|
|
219722
|
+
const dropCapMeasure = measure.dropCap;
|
|
219723
|
+
if (dropCapDescriptor && dropCapMeasure && !fragment2.continuesFromPrev)
|
|
219724
|
+
dropCap = {
|
|
219725
|
+
text: dropCapDescriptor.run.text,
|
|
219726
|
+
mode: dropCapDescriptor.mode,
|
|
219727
|
+
fontFamily: dropCapDescriptor.run.fontFamily,
|
|
219728
|
+
fontSize: dropCapDescriptor.run.fontSize,
|
|
219729
|
+
bold: dropCapDescriptor.run.bold,
|
|
219730
|
+
italic: dropCapDescriptor.run.italic,
|
|
219731
|
+
color: dropCapDescriptor.run.color,
|
|
219732
|
+
position: dropCapDescriptor.run.position,
|
|
219733
|
+
width: dropCapMeasure.width,
|
|
219734
|
+
height: dropCapMeasure.height
|
|
219735
|
+
};
|
|
219736
|
+
return {
|
|
219737
|
+
lines: lines.map((line, index2) => {
|
|
219738
|
+
const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
|
|
219739
|
+
const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
219740
|
+
const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
|
|
219741
|
+
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
219742
|
+
const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
|
|
219743
|
+
let availableWidth = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
219744
|
+
if (shouldUseResolvedListTextStart)
|
|
219745
|
+
availableWidth = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
|
|
219746
|
+
const skipJustify = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
|
|
219747
|
+
const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
|
|
219748
|
+
const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
|
|
219749
|
+
let paddingLeftPx = 0;
|
|
219750
|
+
let paddingRightPx = 0;
|
|
219751
|
+
let textIndentPx = 0;
|
|
219752
|
+
if (!isListFirstLine) {
|
|
219753
|
+
if (hasExplicitSegmentPositioning) {
|
|
219754
|
+
if (isFirstLine && firstLineOffset !== 0) {
|
|
219755
|
+
const adjustedPadding = (paraIndentLeft < 0 ? 0 : paraIndentLeft) + firstLineOffset;
|
|
219756
|
+
if (adjustedPadding > 0)
|
|
219757
|
+
paddingLeftPx = adjustedPadding;
|
|
219758
|
+
}
|
|
219759
|
+
} else if (paraIndentLeft && paraIndentLeft > 0)
|
|
219760
|
+
paddingLeftPx = paraIndentLeft;
|
|
219761
|
+
else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0 && !(paraIndentLeft != null && paraIndentLeft < 0))
|
|
219762
|
+
paddingLeftPx = paraIndent.hanging;
|
|
219763
|
+
}
|
|
219764
|
+
if (paraIndentRight && paraIndentRight > 0)
|
|
219765
|
+
paddingRightPx = paraIndentRight;
|
|
219766
|
+
if (!fragment2.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
|
|
219767
|
+
if (!hasExplicitSegmentPositioning)
|
|
219768
|
+
textIndentPx = firstLineOffset;
|
|
219769
|
+
}
|
|
219770
|
+
const indentLeft = paraIndent?.left ?? 0;
|
|
219771
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
219772
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
219773
|
+
const paragraphLineIndex = fragment2.fromLine + index2;
|
|
219774
|
+
const isFirstLineOfPara = paragraphLineIndex === 0;
|
|
219775
|
+
const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
|
|
219776
|
+
const isListParagraph = Boolean(wordLayout?.marker);
|
|
219777
|
+
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;
|
|
219778
|
+
const indentOffset = isListParagraph ? isFirstLineOfPara ? (shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined) ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
|
|
219779
|
+
return {
|
|
219780
|
+
line,
|
|
219781
|
+
lineIndex: paragraphLineIndex,
|
|
219782
|
+
availableWidth,
|
|
219783
|
+
skipJustify,
|
|
219784
|
+
paddingLeftPx,
|
|
219785
|
+
paddingRightPx,
|
|
219786
|
+
textIndentPx,
|
|
219787
|
+
isListFirstLine,
|
|
219788
|
+
resolvedListTextStartPx: shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined,
|
|
219789
|
+
hasExplicitSegmentPositioning,
|
|
219790
|
+
indentOffset
|
|
219791
|
+
};
|
|
219792
|
+
}),
|
|
219793
|
+
dropCap,
|
|
219794
|
+
marker,
|
|
219795
|
+
continuesFromPrev: fragment2.continuesFromPrev,
|
|
219796
|
+
continuesOnNext: fragment2.continuesOnNext,
|
|
219797
|
+
paragraphEndsWithLineBreak
|
|
219798
|
+
};
|
|
219799
|
+
}
|
|
219617
219800
|
function buildBlockMap(blocks2, measures) {
|
|
219618
219801
|
const map$12 = /* @__PURE__ */ new Map;
|
|
219619
219802
|
for (let i4 = 0;i4 < blocks2.length; i4++)
|
|
@@ -219677,6 +219860,14 @@ function resolveFragmentId(fragment2) {
|
|
|
219677
219860
|
}
|
|
219678
219861
|
}
|
|
219679
219862
|
}
|
|
219863
|
+
function resolveParagraphContentIfApplicable(fragment2, blockMap) {
|
|
219864
|
+
if (fragment2.kind !== "para")
|
|
219865
|
+
return;
|
|
219866
|
+
const entry = blockMap.get(fragment2.blockId);
|
|
219867
|
+
if (!entry || entry.block.kind !== "paragraph" || entry.measure.kind !== "paragraph")
|
|
219868
|
+
return;
|
|
219869
|
+
return resolveParagraphContent(fragment2, entry.block, entry.measure);
|
|
219870
|
+
}
|
|
219680
219871
|
function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap) {
|
|
219681
219872
|
return {
|
|
219682
219873
|
kind: "fragment",
|
|
@@ -219689,7 +219880,8 @@ function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap) {
|
|
|
219689
219880
|
zIndex: resolveFragmentZIndex(fragment2),
|
|
219690
219881
|
fragmentKind: fragment2.kind,
|
|
219691
219882
|
blockId: fragment2.blockId,
|
|
219692
|
-
fragmentIndex
|
|
219883
|
+
fragmentIndex,
|
|
219884
|
+
content: resolveParagraphContentIfApplicable(fragment2, blockMap)
|
|
219693
219885
|
};
|
|
219694
219886
|
}
|
|
219695
219887
|
function resolveLayout(input2) {
|
|
@@ -240138,7 +240330,7 @@ var Node$13 = class Node$14 {
|
|
|
240138
240330
|
return getMinimumReadableTextStartPx(markerContentEndPx, gutterWidthPx);
|
|
240139
240331
|
}, EMUS_PER_INCH = 914400, maxSize = 5000, cache, makeKey = (text5, font, letterSpacing) => {
|
|
240140
240332
|
return `${text5}|${font}|${letterSpacing || 0}`;
|
|
240141
|
-
}, 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
|
|
240333
|
+
}, 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, 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) => {
|
|
240142
240334
|
if (isValidFontSize(value))
|
|
240143
240335
|
return value;
|
|
240144
240336
|
if (typeof value === "string") {
|
|
@@ -240324,7 +240516,7 @@ var Node$13 = class Node$14 {
|
|
|
240324
240516
|
stop: tabStops[index2]
|
|
240325
240517
|
};
|
|
240326
240518
|
return {
|
|
240327
|
-
target: currentX + DEFAULT_TAB_INTERVAL_PX
|
|
240519
|
+
target: currentX + DEFAULT_TAB_INTERVAL_PX,
|
|
240328
240520
|
nextIndex: index2
|
|
240329
240521
|
};
|
|
240330
240522
|
}, SINGLE_COLUMN_DEFAULT, isTextRun$4 = (run2) => {
|
|
@@ -240804,37 +240996,11 @@ var Node$13 = class Node$14 {
|
|
|
240804
240996
|
line.el.style.marginLeft = `${marginLeft}px`;
|
|
240805
240997
|
line.el.style.marginRight = `${marginRight}px`;
|
|
240806
240998
|
});
|
|
240807
|
-
},
|
|
240999
|
+
}, getFiniteNonNegativeNumber = (value) => {
|
|
240808
241000
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
|
|
240809
241001
|
return;
|
|
240810
241002
|
return value;
|
|
240811
|
-
}, 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)),
|
|
240812
|
-
const nextDefaultTabStop = currentPos + DEFAULT_TAB_INTERVAL_PX - currentPos % DEFAULT_TAB_INTERVAL_PX;
|
|
240813
|
-
let tabWidth;
|
|
240814
|
-
if (justification === "left") {
|
|
240815
|
-
const explicitTabs = [...tabs ?? []];
|
|
240816
|
-
if (hangingIndent && hangingIndent > 0) {
|
|
240817
|
-
explicitTabs.push(leftIndent);
|
|
240818
|
-
explicitTabs.sort((a2, b$1) => a2 - b$1);
|
|
240819
|
-
}
|
|
240820
|
-
let targetTabStop;
|
|
240821
|
-
for (const tab of explicitTabs)
|
|
240822
|
-
if (tab > currentPos) {
|
|
240823
|
-
targetTabStop = tab;
|
|
240824
|
-
break;
|
|
240825
|
-
}
|
|
240826
|
-
if (targetTabStop === undefined)
|
|
240827
|
-
targetTabStop = nextDefaultTabStop;
|
|
240828
|
-
tabWidth = targetTabStop - currentPos;
|
|
240829
|
-
} else if (justification === "right")
|
|
240830
|
-
if (firstLineIndent != null && firstLineIndent > 0)
|
|
240831
|
-
tabWidth = nextDefaultTabStop - currentPos;
|
|
240832
|
-
else
|
|
240833
|
-
tabWidth = hangingIndent ?? 0;
|
|
240834
|
-
else
|
|
240835
|
-
tabWidth = nextDefaultTabStop - currentPos;
|
|
240836
|
-
return tabWidth;
|
|
240837
|
-
}, normalizeSpan = (span) => {
|
|
241003
|
+
}, 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)), normalizeSpan = (span) => {
|
|
240838
241004
|
if (typeof span !== "number" || !Number.isFinite(span) || span < 1)
|
|
240839
241005
|
return 1;
|
|
240840
241006
|
return Math.floor(span);
|
|
@@ -242696,6 +242862,10 @@ var Node$13 = class Node$14 {
|
|
|
242696
242862
|
result.push(run2);
|
|
242697
242863
|
continue;
|
|
242698
242864
|
}
|
|
242865
|
+
if (run2.kind === "math") {
|
|
242866
|
+
result.push(run2);
|
|
242867
|
+
continue;
|
|
242868
|
+
}
|
|
242699
242869
|
if (!("text" in run2))
|
|
242700
242870
|
continue;
|
|
242701
242871
|
const text5 = run2.text ?? "";
|
|
@@ -254971,7 +255141,7 @@ var Node$13 = class Node$14 {
|
|
|
254971
255141
|
return;
|
|
254972
255142
|
console.log(...args$1);
|
|
254973
255143
|
}, 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;
|
|
254974
|
-
var
|
|
255144
|
+
var init_src_C5K9vSFa_es = __esm(() => {
|
|
254975
255145
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
254976
255146
|
init_SuperConverter_B9oNf3OB_es();
|
|
254977
255147
|
init_jszip_ChlR43oI_es();
|
|
@@ -273272,7 +273442,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273272
273442
|
cacheSize: 5000
|
|
273273
273443
|
};
|
|
273274
273444
|
TWIPS_PER_PX$1 = 1440 / 96;
|
|
273275
|
-
DEFAULT_TAB_INTERVAL_PX
|
|
273445
|
+
DEFAULT_TAB_INTERVAL_PX = twipsToPx$2(DEFAULT_TAB_INTERVAL_TWIPS$2);
|
|
273276
273446
|
DEFAULT_CELL_PADDING$1 = {
|
|
273277
273447
|
top: 0,
|
|
273278
273448
|
left: 4,
|
|
@@ -274658,7 +274828,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274658
274828
|
throw new Error("DomPainter: document is not available");
|
|
274659
274829
|
const block = lookup3.block;
|
|
274660
274830
|
const measure = lookup3.measure;
|
|
274661
|
-
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
274831
|
+
const wordLayout = isMinimalWordLayout$1(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
274832
|
+
const content3 = resolvedItem?.content;
|
|
274662
274833
|
const fragmentEl = this.doc.createElement("div");
|
|
274663
274834
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment);
|
|
274664
274835
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
@@ -274698,11 +274869,34 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274698
274869
|
this.applySdtDataset(fragmentEl, block.attrs?.sdt);
|
|
274699
274870
|
this.applyContainerSdtDataset(fragmentEl, block.attrs?.containerSdt);
|
|
274700
274871
|
applySdtContainerStyling(this.doc, fragmentEl, block.attrs?.sdt, block.attrs?.containerSdt, sdtBoundary);
|
|
274701
|
-
|
|
274702
|
-
|
|
274703
|
-
|
|
274704
|
-
|
|
274872
|
+
if (content3?.dropCap) {
|
|
274873
|
+
const dc = content3.dropCap;
|
|
274874
|
+
const dropCapEl = this.renderDropCap({
|
|
274875
|
+
mode: dc.mode,
|
|
274876
|
+
run: {
|
|
274877
|
+
text: dc.text,
|
|
274878
|
+
fontFamily: dc.fontFamily,
|
|
274879
|
+
fontSize: dc.fontSize,
|
|
274880
|
+
bold: dc.bold,
|
|
274881
|
+
italic: dc.italic,
|
|
274882
|
+
color: dc.color,
|
|
274883
|
+
position: dc.position
|
|
274884
|
+
},
|
|
274885
|
+
lines: 0
|
|
274886
|
+
}, dc.width != null && dc.height != null ? {
|
|
274887
|
+
width: dc.width,
|
|
274888
|
+
height: dc.height,
|
|
274889
|
+
lines: 0,
|
|
274890
|
+
mode: dc.mode
|
|
274891
|
+
} : undefined);
|
|
274705
274892
|
fragmentEl.appendChild(dropCapEl);
|
|
274893
|
+
} else {
|
|
274894
|
+
const dropCapDescriptor = block.attrs?.dropCapDescriptor;
|
|
274895
|
+
const dropCapMeasure = measure.dropCap;
|
|
274896
|
+
if (dropCapDescriptor && dropCapMeasure && !fragment2.continuesFromPrev) {
|
|
274897
|
+
const dropCapEl = this.renderDropCap(dropCapDescriptor, dropCapMeasure);
|
|
274898
|
+
fragmentEl.appendChild(dropCapEl);
|
|
274899
|
+
}
|
|
274706
274900
|
}
|
|
274707
274901
|
if (fragmentEl.style.paddingLeft)
|
|
274708
274902
|
fragmentEl.style.removeProperty("padding-left");
|
|
@@ -274714,139 +274908,210 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274714
274908
|
fragmentEl.style.removeProperty("margin-right");
|
|
274715
274909
|
if (fragmentEl.style.textIndent)
|
|
274716
274910
|
fragmentEl.style.removeProperty("text-indent");
|
|
274717
|
-
|
|
274718
|
-
|
|
274719
|
-
|
|
274720
|
-
|
|
274721
|
-
|
|
274722
|
-
|
|
274723
|
-
|
|
274724
|
-
|
|
274725
|
-
|
|
274726
|
-
|
|
274727
|
-
|
|
274728
|
-
|
|
274729
|
-
|
|
274730
|
-
wordLayout,
|
|
274731
|
-
indentLeftPx: paraIndentLeft,
|
|
274732
|
-
hangingIndentPx: paraIndent?.hanging ?? 0,
|
|
274733
|
-
firstLineIndentPx: paraIndent?.firstLine ?? 0,
|
|
274734
|
-
markerTextWidthPx: fragment2.markerTextWidth
|
|
274735
|
-
}) : undefined;
|
|
274736
|
-
let listTabWidth = 0;
|
|
274737
|
-
let markerStartPos = 0;
|
|
274738
|
-
if (!fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker) {
|
|
274739
|
-
const markerTextWidth = fragment2.markerTextWidth;
|
|
274740
|
-
const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
|
|
274741
|
-
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
274742
|
-
let currentPos;
|
|
274743
|
-
if (markerJustification === "left") {
|
|
274744
|
-
markerStartPos = anchorPoint;
|
|
274745
|
-
currentPos = markerStartPos + markerTextWidth;
|
|
274746
|
-
} else if (markerJustification === "right") {
|
|
274747
|
-
markerStartPos = anchorPoint - markerTextWidth;
|
|
274748
|
-
currentPos = anchorPoint;
|
|
274749
|
-
} else {
|
|
274750
|
-
markerStartPos = anchorPoint - markerTextWidth / 2;
|
|
274751
|
-
currentPos = markerStartPos + markerTextWidth;
|
|
274752
|
-
}
|
|
274753
|
-
const suffix = wordLayout.marker.suffix ?? "tab";
|
|
274754
|
-
if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
|
|
274755
|
-
listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
|
|
274756
|
-
else if (suffix === "tab")
|
|
274757
|
-
listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
|
|
274758
|
-
else if (suffix === "space")
|
|
274759
|
-
listTabWidth = 4;
|
|
274760
|
-
}
|
|
274761
|
-
lines.forEach((line, index2) => {
|
|
274762
|
-
const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
|
|
274763
|
-
const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
274764
|
-
const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
|
|
274765
|
-
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
274766
|
-
const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
|
|
274767
|
-
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
274768
|
-
if (shouldUseResolvedListTextStart)
|
|
274769
|
-
availableWidthOverride = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
|
|
274770
|
-
const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
|
|
274771
|
-
const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
|
|
274772
|
-
const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
|
|
274773
|
-
const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
|
|
274774
|
-
if (!isListFirstLine) {
|
|
274775
|
-
if (hasExplicitSegmentPositioning) {
|
|
274776
|
-
if (isFirstLine && firstLineOffset !== 0) {
|
|
274777
|
-
const adjustedPadding = (paraIndentLeft < 0 ? 0 : paraIndentLeft) + firstLineOffset;
|
|
274778
|
-
if (adjustedPadding > 0)
|
|
274779
|
-
lineEl.style.paddingLeft = `${adjustedPadding}px`;
|
|
274911
|
+
if (content3) {
|
|
274912
|
+
const resolvedMarker = content3.marker;
|
|
274913
|
+
content3.lines.forEach((resolvedLine) => {
|
|
274914
|
+
const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset);
|
|
274915
|
+
if (!resolvedLine.isListFirstLine) {
|
|
274916
|
+
if (resolvedLine.paddingLeftPx > 0)
|
|
274917
|
+
lineEl.style.paddingLeft = `${resolvedLine.paddingLeftPx}px`;
|
|
274918
|
+
if (resolvedLine.textIndentPx !== 0)
|
|
274919
|
+
lineEl.style.textIndent = `${resolvedLine.textIndentPx}px`;
|
|
274920
|
+
else if (resolvedLine.lineIndex > 0 || content3.continuesFromPrev) {
|
|
274921
|
+
const paraIndent = block.attrs?.indent;
|
|
274922
|
+
if ((block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)) && !resolvedLine.isListFirstLine)
|
|
274923
|
+
lineEl.style.textIndent = "0px";
|
|
274780
274924
|
}
|
|
274781
|
-
}
|
|
274782
|
-
|
|
274783
|
-
|
|
274784
|
-
|
|
274785
|
-
|
|
274786
|
-
|
|
274787
|
-
|
|
274788
|
-
|
|
274789
|
-
|
|
274790
|
-
|
|
274791
|
-
|
|
274792
|
-
|
|
274793
|
-
|
|
274794
|
-
|
|
274795
|
-
|
|
274796
|
-
|
|
274797
|
-
|
|
274798
|
-
|
|
274799
|
-
|
|
274800
|
-
|
|
274801
|
-
|
|
274802
|
-
|
|
274803
|
-
|
|
274804
|
-
|
|
274805
|
-
|
|
274806
|
-
|
|
274807
|
-
|
|
274808
|
-
|
|
274809
|
-
|
|
274810
|
-
|
|
274811
|
-
|
|
274812
|
-
|
|
274813
|
-
|
|
274814
|
-
|
|
274925
|
+
}
|
|
274926
|
+
if (resolvedLine.paddingRightPx > 0)
|
|
274927
|
+
lineEl.style.paddingRight = `${resolvedLine.paddingRightPx}px`;
|
|
274928
|
+
if (resolvedLine.isListFirstLine && resolvedMarker) {
|
|
274929
|
+
lineEl.style.paddingLeft = `${resolvedMarker.firstLinePaddingLeftPx}px`;
|
|
274930
|
+
if (!resolvedMarker.vanish) {
|
|
274931
|
+
const markerContainer = this.doc.createElement("span");
|
|
274932
|
+
markerContainer.style.display = "inline-block";
|
|
274933
|
+
markerContainer.style.wordSpacing = "0px";
|
|
274934
|
+
const markerEl = this.doc.createElement("span");
|
|
274935
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
274936
|
+
markerEl.textContent = resolvedMarker.text;
|
|
274937
|
+
markerEl.style.pointerEvents = "none";
|
|
274938
|
+
markerContainer.style.position = "relative";
|
|
274939
|
+
if (resolvedMarker.justification === "right") {
|
|
274940
|
+
markerContainer.style.position = "absolute";
|
|
274941
|
+
markerContainer.style.left = `${resolvedMarker.markerStartPx}px`;
|
|
274942
|
+
} else if (resolvedMarker.justification === "center") {
|
|
274943
|
+
markerContainer.style.position = "absolute";
|
|
274944
|
+
markerContainer.style.left = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
|
|
274945
|
+
lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + (resolvedMarker.centerPaddingAdjustPx ?? 0) + "px";
|
|
274946
|
+
}
|
|
274947
|
+
markerEl.style.fontFamily = toCssFontFamily(resolvedMarker.run.fontFamily) ?? resolvedMarker.run.fontFamily;
|
|
274948
|
+
markerEl.style.fontSize = `${resolvedMarker.run.fontSize}px`;
|
|
274949
|
+
markerEl.style.fontWeight = resolvedMarker.run.bold ? "bold" : "";
|
|
274950
|
+
markerEl.style.fontStyle = resolvedMarker.run.italic ? "italic" : "";
|
|
274951
|
+
if (resolvedMarker.run.color)
|
|
274952
|
+
markerEl.style.color = resolvedMarker.run.color;
|
|
274953
|
+
if (resolvedMarker.run.letterSpacing != null)
|
|
274954
|
+
markerEl.style.letterSpacing = `${resolvedMarker.run.letterSpacing}px`;
|
|
274955
|
+
markerContainer.appendChild(markerEl);
|
|
274956
|
+
if (resolvedMarker.suffix === "tab") {
|
|
274957
|
+
const tabEl = this.doc.createElement("span");
|
|
274958
|
+
tabEl.className = "superdoc-tab";
|
|
274959
|
+
tabEl.innerHTML = " ";
|
|
274960
|
+
tabEl.style.display = "inline-block";
|
|
274961
|
+
tabEl.style.wordSpacing = "0px";
|
|
274962
|
+
tabEl.style.width = `${resolvedMarker.suffixWidthPx}px`;
|
|
274963
|
+
lineEl.prepend(tabEl);
|
|
274964
|
+
} else if (resolvedMarker.suffix === "space") {
|
|
274965
|
+
const spaceEl = this.doc.createElement("span");
|
|
274966
|
+
spaceEl.classList.add("superdoc-marker-suffix-space");
|
|
274967
|
+
spaceEl.style.wordSpacing = "0px";
|
|
274968
|
+
spaceEl.textContent = " ";
|
|
274969
|
+
lineEl.prepend(spaceEl);
|
|
274970
|
+
}
|
|
274971
|
+
lineEl.prepend(markerContainer);
|
|
274815
274972
|
}
|
|
274816
|
-
|
|
274817
|
-
|
|
274818
|
-
|
|
274819
|
-
|
|
274820
|
-
|
|
274821
|
-
|
|
274822
|
-
|
|
274823
|
-
|
|
274824
|
-
|
|
274825
|
-
|
|
274826
|
-
|
|
274827
|
-
|
|
274828
|
-
|
|
274829
|
-
|
|
274830
|
-
|
|
274831
|
-
|
|
274832
|
-
|
|
274833
|
-
|
|
274834
|
-
|
|
274835
|
-
|
|
274836
|
-
|
|
274837
|
-
|
|
274838
|
-
|
|
274839
|
-
|
|
274973
|
+
}
|
|
274974
|
+
this.capturePaintSnapshotLine(lineEl, context, {
|
|
274975
|
+
inTableFragment: false,
|
|
274976
|
+
inTableParagraph: false
|
|
274977
|
+
});
|
|
274978
|
+
fragmentEl.appendChild(lineEl);
|
|
274979
|
+
});
|
|
274980
|
+
} else {
|
|
274981
|
+
const paraIndent = block.attrs?.indent;
|
|
274982
|
+
const paraIndentLeft = paraIndent?.left ?? 0;
|
|
274983
|
+
const paraIndentRight = paraIndent?.right ?? 0;
|
|
274984
|
+
const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
274985
|
+
const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
|
|
274986
|
+
const listFirstLineTextStartPx = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker ? resolvePainterListTextStartPx({
|
|
274987
|
+
wordLayout,
|
|
274988
|
+
indentLeftPx: paraIndentLeft,
|
|
274989
|
+
hangingIndentPx: paraIndent?.hanging ?? 0,
|
|
274990
|
+
firstLineIndentPx: paraIndent?.firstLine ?? 0,
|
|
274991
|
+
markerTextWidthPx: fragment2.markerTextWidth
|
|
274992
|
+
}) : undefined;
|
|
274993
|
+
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({
|
|
274994
|
+
wordLayout,
|
|
274995
|
+
indentLeftPx: paraIndentLeft,
|
|
274996
|
+
hangingIndentPx: paraIndent?.hanging ?? 0,
|
|
274997
|
+
firstLineIndentPx: paraIndent?.firstLine ?? 0,
|
|
274998
|
+
markerTextWidthPx: fragment2.markerTextWidth
|
|
274999
|
+
}) : undefined;
|
|
275000
|
+
let listTabWidth = 0;
|
|
275001
|
+
let markerStartPos = 0;
|
|
275002
|
+
if (!fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker) {
|
|
275003
|
+
const markerTextWidth = fragment2.markerTextWidth;
|
|
275004
|
+
const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
|
|
275005
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
275006
|
+
let currentPos;
|
|
275007
|
+
if (markerJustification === "left") {
|
|
275008
|
+
markerStartPos = anchorPoint;
|
|
275009
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
275010
|
+
} else if (markerJustification === "right") {
|
|
275011
|
+
markerStartPos = anchorPoint - markerTextWidth;
|
|
275012
|
+
currentPos = anchorPoint;
|
|
275013
|
+
} else {
|
|
275014
|
+
markerStartPos = anchorPoint - markerTextWidth / 2;
|
|
275015
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
275016
|
+
}
|
|
275017
|
+
const suffix = wordLayout.marker.suffix ?? "tab";
|
|
275018
|
+
if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
|
|
275019
|
+
listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
|
|
275020
|
+
else if (suffix === "tab")
|
|
275021
|
+
listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
|
|
275022
|
+
else if (suffix === "space")
|
|
275023
|
+
listTabWidth = 4;
|
|
275024
|
+
}
|
|
275025
|
+
lines.forEach((line, index2) => {
|
|
275026
|
+
const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
|
|
275027
|
+
const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
275028
|
+
const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
|
|
275029
|
+
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
275030
|
+
const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
|
|
275031
|
+
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
275032
|
+
if (shouldUseResolvedListTextStart)
|
|
275033
|
+
availableWidthOverride = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
|
|
275034
|
+
const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
|
|
275035
|
+
const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
|
|
275036
|
+
const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
|
|
275037
|
+
const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
|
|
275038
|
+
if (!isListFirstLine) {
|
|
275039
|
+
if (hasExplicitSegmentPositioning) {
|
|
275040
|
+
if (isFirstLine && firstLineOffset !== 0) {
|
|
275041
|
+
const adjustedPadding = (paraIndentLeft < 0 ? 0 : paraIndentLeft) + firstLineOffset;
|
|
275042
|
+
if (adjustedPadding > 0)
|
|
275043
|
+
lineEl.style.paddingLeft = `${adjustedPadding}px`;
|
|
275044
|
+
}
|
|
275045
|
+
} else if (paraIndentLeft && paraIndentLeft > 0)
|
|
275046
|
+
lineEl.style.paddingLeft = `${paraIndentLeft}px`;
|
|
275047
|
+
else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0 && !(paraIndentLeft != null && paraIndentLeft < 0))
|
|
275048
|
+
lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
|
|
275049
|
+
}
|
|
275050
|
+
if (paraIndentRight && paraIndentRight > 0)
|
|
275051
|
+
lineEl.style.paddingRight = `${paraIndentRight}px`;
|
|
275052
|
+
if (!fragment2.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
|
|
275053
|
+
if (!hasExplicitSegmentPositioning)
|
|
275054
|
+
lineEl.style.textIndent = `${firstLineOffset}px`;
|
|
275055
|
+
} else if (firstLineOffset && !isListFirstLine)
|
|
275056
|
+
lineEl.style.textIndent = "0px";
|
|
275057
|
+
if (isListFirstLine) {
|
|
275058
|
+
const marker = wordLayout?.marker;
|
|
275059
|
+
if (!marker)
|
|
275060
|
+
return;
|
|
275061
|
+
lineEl.style.paddingLeft = `${paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)}px`;
|
|
275062
|
+
if (!marker.run.vanish) {
|
|
275063
|
+
const markerContainer = this.doc.createElement("span");
|
|
275064
|
+
markerContainer.style.display = "inline-block";
|
|
275065
|
+
markerContainer.style.wordSpacing = "0px";
|
|
275066
|
+
const markerEl = this.doc.createElement("span");
|
|
275067
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
275068
|
+
markerEl.textContent = marker.markerText ?? "";
|
|
275069
|
+
markerEl.style.pointerEvents = "none";
|
|
275070
|
+
const markerJustification = marker.justification ?? "left";
|
|
275071
|
+
markerContainer.style.position = "relative";
|
|
275072
|
+
if (markerJustification === "right") {
|
|
275073
|
+
markerContainer.style.position = "absolute";
|
|
275074
|
+
markerContainer.style.left = `${markerStartPos}px`;
|
|
275075
|
+
} else if (markerJustification === "center") {
|
|
275076
|
+
markerContainer.style.position = "absolute";
|
|
275077
|
+
markerContainer.style.left = `${markerStartPos - fragment2.markerTextWidth / 2}px`;
|
|
275078
|
+
lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + fragment2.markerTextWidth / 2 + "px";
|
|
275079
|
+
}
|
|
275080
|
+
markerEl.style.fontFamily = toCssFontFamily(marker.run.fontFamily) ?? marker.run.fontFamily;
|
|
275081
|
+
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
275082
|
+
markerEl.style.fontWeight = marker.run.bold ? "bold" : "";
|
|
275083
|
+
markerEl.style.fontStyle = marker.run.italic ? "italic" : "";
|
|
275084
|
+
if (marker.run.color)
|
|
275085
|
+
markerEl.style.color = marker.run.color;
|
|
275086
|
+
if (marker.run.letterSpacing != null)
|
|
275087
|
+
markerEl.style.letterSpacing = `${marker.run.letterSpacing}px`;
|
|
275088
|
+
markerContainer.appendChild(markerEl);
|
|
275089
|
+
const suffix = marker.suffix ?? "tab";
|
|
275090
|
+
if (suffix === "tab") {
|
|
275091
|
+
const tabEl = this.doc.createElement("span");
|
|
275092
|
+
tabEl.className = "superdoc-tab";
|
|
275093
|
+
tabEl.innerHTML = " ";
|
|
275094
|
+
tabEl.style.display = "inline-block";
|
|
275095
|
+
tabEl.style.wordSpacing = "0px";
|
|
275096
|
+
tabEl.style.width = `${listTabWidth}px`;
|
|
275097
|
+
lineEl.prepend(tabEl);
|
|
275098
|
+
} else if (suffix === "space") {
|
|
275099
|
+
const spaceEl = this.doc.createElement("span");
|
|
275100
|
+
spaceEl.classList.add("superdoc-marker-suffix-space");
|
|
275101
|
+
spaceEl.style.wordSpacing = "0px";
|
|
275102
|
+
spaceEl.textContent = " ";
|
|
275103
|
+
lineEl.prepend(spaceEl);
|
|
275104
|
+
}
|
|
275105
|
+
lineEl.prepend(markerContainer);
|
|
274840
275106
|
}
|
|
274841
|
-
lineEl.prepend(markerContainer);
|
|
274842
275107
|
}
|
|
274843
|
-
|
|
274844
|
-
|
|
274845
|
-
|
|
274846
|
-
|
|
275108
|
+
this.capturePaintSnapshotLine(lineEl, context, {
|
|
275109
|
+
inTableFragment: false,
|
|
275110
|
+
inTableParagraph: false
|
|
275111
|
+
});
|
|
275112
|
+
fragmentEl.appendChild(lineEl);
|
|
274847
275113
|
});
|
|
274848
|
-
|
|
274849
|
-
});
|
|
275114
|
+
}
|
|
274850
275115
|
return fragmentEl;
|
|
274851
275116
|
} catch (error3) {
|
|
274852
275117
|
console.error("[DomPainter] Fragment rendering failed:", {
|
|
@@ -276264,7 +276529,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276264
276529
|
annotation.style.position = "relative";
|
|
276265
276530
|
annotation.appendChild(caretAnchor);
|
|
276266
276531
|
}
|
|
276267
|
-
renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, resolvedListTextStartPx) {
|
|
276532
|
+
renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, resolvedListTextStartPx, indentOffsetOverride) {
|
|
276268
276533
|
if (!this.doc)
|
|
276269
276534
|
throw new Error("DomPainter: document is not available");
|
|
276270
276535
|
const lineRange = computeLinePmRange$1(block, line);
|
|
@@ -276476,17 +276741,22 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276476
276741
|
if (spacingPerSpace !== 0)
|
|
276477
276742
|
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
276478
276743
|
if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl)) {
|
|
276479
|
-
|
|
276480
|
-
|
|
276481
|
-
|
|
276482
|
-
|
|
276483
|
-
|
|
276484
|
-
|
|
276485
|
-
|
|
276486
|
-
|
|
276487
|
-
|
|
276488
|
-
|
|
276489
|
-
|
|
276744
|
+
let indentOffset;
|
|
276745
|
+
if (indentOffsetOverride != null)
|
|
276746
|
+
indentOffset = indentOffsetOverride;
|
|
276747
|
+
else {
|
|
276748
|
+
const paraIndent = block.attrs?.indent;
|
|
276749
|
+
const indentLeft = paraIndent?.left ?? 0;
|
|
276750
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
276751
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
276752
|
+
const isFirstLineOfPara = lineIndex === 0 || lineIndex === undefined;
|
|
276753
|
+
const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
|
|
276754
|
+
const wordLayoutValue = block.attrs?.wordLayout;
|
|
276755
|
+
const wordLayout = isMinimalWordLayout$1(wordLayoutValue) ? wordLayoutValue : undefined;
|
|
276756
|
+
const isListParagraph = Boolean(wordLayout?.marker);
|
|
276757
|
+
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;
|
|
276758
|
+
indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
|
|
276759
|
+
}
|
|
276490
276760
|
let cumulativeX = 0;
|
|
276491
276761
|
const segments = line.segments;
|
|
276492
276762
|
const segmentsByRun = /* @__PURE__ */ new Map;
|
|
@@ -289316,7 +289586,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
289316
289586
|
|
|
289317
289587
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
289318
289588
|
var init_super_editor_es = __esm(() => {
|
|
289319
|
-
|
|
289589
|
+
init_src_C5K9vSFa_es();
|
|
289320
289590
|
init_SuperConverter_B9oNf3OB_es();
|
|
289321
289591
|
init_jszip_ChlR43oI_es();
|
|
289322
289592
|
init_xml_js_40FWvL78_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
-
"@superdoc/
|
|
28
|
+
"@superdoc/super-editor": "0.0.1",
|
|
29
29
|
"superdoc": "1.23.0",
|
|
30
|
-
"@superdoc/
|
|
30
|
+
"@superdoc/pm-adapter": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.
|
|
38
|
-
"@superdoc-dev/cli-
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.5.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.29",
|
|
38
|
+
"@superdoc-dev/cli-linux-x64": "0.5.0-next.29",
|
|
39
|
+
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.29",
|
|
40
|
+
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.29",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.5.0-next.29"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|