@superdoc-dev/cli 0.16.0-next.11 → 0.16.0-next.13
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 +241 -58
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -68110,7 +68110,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
68110
68110
|
emptyOptions2 = {};
|
|
68111
68111
|
});
|
|
68112
68112
|
|
|
68113
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
68113
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-CcHCWpfX.es.js
|
|
68114
68114
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
68115
68115
|
const fieldValue = extension$1.config[field];
|
|
68116
68116
|
if (typeof fieldValue === "function")
|
|
@@ -104441,6 +104441,17 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104441
104441
|
const usePreviousFont = previousParagraphFont != null && resolvedParagraphProperties.numberingProperties != null && !hasExplicitParagraphRunProperties(paragraphProps);
|
|
104442
104442
|
const defaultFont = usePreviousFont && previousParagraphFont.fontFamily ? previousParagraphFont.fontFamily : extracted.defaultFont;
|
|
104443
104443
|
const defaultSize = usePreviousFont && previousParagraphFont.fontSize ? previousParagraphFont.fontSize : extracted.defaultSize;
|
|
104444
|
+
const finalizeParagraphBlocks = (outputBlocks) => {
|
|
104445
|
+
outputBlocks.forEach((block) => {
|
|
104446
|
+
if (block.kind === "paragraph")
|
|
104447
|
+
syncListMarkerFontFromParagraphRuns({
|
|
104448
|
+
block,
|
|
104449
|
+
converterContext,
|
|
104450
|
+
para
|
|
104451
|
+
});
|
|
104452
|
+
});
|
|
104453
|
+
return outputBlocks;
|
|
104454
|
+
};
|
|
104444
104455
|
if (paragraphAttrs.pageBreakBefore)
|
|
104445
104456
|
blocks.push({
|
|
104446
104457
|
kind: "pageBreak",
|
|
@@ -104449,7 +104460,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104449
104460
|
});
|
|
104450
104461
|
if (!para.content || para.content.length === 0) {
|
|
104451
104462
|
if (paragraphProps.runProperties?.vanish)
|
|
104452
|
-
return blocks;
|
|
104463
|
+
return finalizeParagraphBlocks(blocks);
|
|
104453
104464
|
const paragraphMarkTrackedChange = getParagraphMarkTrackedChange(paragraphProps, storyKey);
|
|
104454
104465
|
const paraPos = positions.get(para);
|
|
104455
104466
|
const emptyRun = {
|
|
@@ -104477,15 +104488,15 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104477
104488
|
sourceAnchor
|
|
104478
104489
|
});
|
|
104479
104490
|
if (!trackedChangesConfig)
|
|
104480
|
-
return blocks;
|
|
104491
|
+
return finalizeParagraphBlocks(blocks);
|
|
104481
104492
|
const paragraphBlock = blocks[blocks.length - 1];
|
|
104482
104493
|
if (paragraphBlock?.kind !== "paragraph")
|
|
104483
|
-
return blocks;
|
|
104494
|
+
return finalizeParagraphBlocks(blocks);
|
|
104484
104495
|
const filteredRuns = applyTrackedChangesModeToRuns(paragraphBlock.runs, trackedChangesConfig, hyperlinkConfig, applyMarksToRun, themeColors, enableComments, storyKey);
|
|
104485
104496
|
const isGhostTrackedListArtifact = trackedChangesConfig.enabled && isGhostSuppressionMode(trackedChangesConfig.mode) && Boolean(paragraphAttrs.numberingProperties) && Boolean(paragraphMarkTrackedChange) && filteredRuns.length > 0 && filteredRuns.every(isEmptyTextRun);
|
|
104486
104497
|
if (trackedChangesConfig.enabled && (filteredRuns.length === 0 || isGhostTrackedListArtifact)) {
|
|
104487
104498
|
blocks.pop();
|
|
104488
|
-
return blocks;
|
|
104499
|
+
return finalizeParagraphBlocks(blocks);
|
|
104489
104500
|
}
|
|
104490
104501
|
paragraphBlock.runs = filteredRuns;
|
|
104491
104502
|
paragraphBlock.attrs = {
|
|
@@ -104493,7 +104504,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104493
104504
|
trackedChangesMode: trackedChangesConfig.mode,
|
|
104494
104505
|
trackedChangesEnabled: trackedChangesConfig.enabled
|
|
104495
104506
|
};
|
|
104496
|
-
return blocks;
|
|
104507
|
+
return finalizeParagraphBlocks(blocks);
|
|
104497
104508
|
}
|
|
104498
104509
|
let currentRuns = [];
|
|
104499
104510
|
let partIndex = 0;
|
|
@@ -104600,9 +104611,15 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104600
104611
|
else {
|
|
104601
104612
|
const run$1 = inlineConverter(inlineConverterParams);
|
|
104602
104613
|
if (run$1) {
|
|
104603
|
-
|
|
104604
|
-
|
|
104614
|
+
if (node3.type === "tab") {
|
|
104615
|
+
const tabRun = run$1;
|
|
104616
|
+
if (tabRun.fontSize == null)
|
|
104617
|
+
tabRun.fontSize = defaultSize;
|
|
104618
|
+
if (tabRun.fontFamily == null)
|
|
104619
|
+
tabRun.fontFamily = defaultFont;
|
|
104605
104620
|
tabOrdinal += 1;
|
|
104621
|
+
}
|
|
104622
|
+
currentRuns.push(run$1);
|
|
104606
104623
|
}
|
|
104607
104624
|
}
|
|
104608
104625
|
} catch (error3) {
|
|
@@ -104669,7 +104686,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104669
104686
|
block.runs = expandRunsForInlineNewlines(block.runs);
|
|
104670
104687
|
});
|
|
104671
104688
|
if (!trackedChangesConfig)
|
|
104672
|
-
return blocks;
|
|
104689
|
+
return finalizeParagraphBlocks(blocks);
|
|
104673
104690
|
const processedBlocks = [];
|
|
104674
104691
|
blocks.forEach((block) => {
|
|
104675
104692
|
if (block.kind !== "paragraph") {
|
|
@@ -104687,7 +104704,7 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
|
|
|
104687
104704
|
};
|
|
104688
104705
|
processedBlocks.push(block);
|
|
104689
104706
|
});
|
|
104690
|
-
return processedBlocks;
|
|
104707
|
+
return finalizeParagraphBlocks(processedBlocks);
|
|
104691
104708
|
}
|
|
104692
104709
|
function getLastParagraphFont(blocks) {
|
|
104693
104710
|
for (let i$1 = blocks.length - 1;i$1 >= 0; i$1--) {
|
|
@@ -104697,6 +104714,8 @@ function getLastParagraphFont(blocks) {
|
|
|
104697
104714
|
if (!firstRun)
|
|
104698
104715
|
continue;
|
|
104699
104716
|
const run$1 = firstRun;
|
|
104717
|
+
if (typeof run$1.text === "string" && run$1.text.length === 0)
|
|
104718
|
+
continue;
|
|
104700
104719
|
const fontFamily = typeof run$1.fontFamily === "string" ? run$1.fontFamily.trim() : "";
|
|
104701
104720
|
const fontSize = typeof run$1.fontSize === "number" && Number.isFinite(run$1.fontSize) ? run$1.fontSize : NaN;
|
|
104702
104721
|
if (fontFamily.length > 0 && fontSize > 0)
|
|
@@ -104730,6 +104749,18 @@ function handleParagraphNode(node3, context) {
|
|
|
104730
104749
|
if (cached) {
|
|
104731
104750
|
const delta = pmStart - cached.pmStart;
|
|
104732
104751
|
const reusedBlocks = shiftCachedBlocks(cached.blocks, delta);
|
|
104752
|
+
const paragraphProps = node3.attrs?.paragraphProperties;
|
|
104753
|
+
const previousParagraphFont$2 = !hasExplicitParagraphRunProperties(paragraphProps) ? getLastParagraphFont(blocks) : undefined;
|
|
104754
|
+
reusedBlocks.forEach((block) => {
|
|
104755
|
+
if (block.kind === "paragraph")
|
|
104756
|
+
syncListMarkerFontFromParagraphRuns({
|
|
104757
|
+
block,
|
|
104758
|
+
converterContext,
|
|
104759
|
+
para: node3,
|
|
104760
|
+
contentFontSource: "paragraph",
|
|
104761
|
+
previousParagraphFont: previousParagraphFont$2
|
|
104762
|
+
});
|
|
104763
|
+
});
|
|
104733
104764
|
applyTrackedGhostListAdjustments(node3, reusedBlocks, context);
|
|
104734
104765
|
reusedBlocks.forEach((block) => {
|
|
104735
104766
|
blocks.push(block);
|
|
@@ -127787,7 +127818,7 @@ var isRegExp = (value) => {
|
|
|
127787
127818
|
};
|
|
127788
127819
|
}, browser2, process3, cachedSetTimeout2, cachedClearTimeout2, queue2, draining2 = false, currentQueue2, queueIndex2 = -1, browserExports2, process$12, TWIPS_PER_INCH$1 = 1440, PX_PER_PT, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, isValidTrackedMode = (value) => {
|
|
127789
127820
|
return typeof value === "string" && VALID_TRACKED_MODES.includes(value);
|
|
127790
|
-
}, isTextRun$
|
|
127821
|
+
}, isTextRun$2 = (run$1) => {
|
|
127791
127822
|
return "text" in run$1 && run$1.kind !== "tab";
|
|
127792
127823
|
}, stripTrackedChangeFromRun = (run$1) => {
|
|
127793
127824
|
if ("trackedChange" in run$1 && run$1.trackedChange)
|
|
@@ -127799,7 +127830,7 @@ var isRegExp = (value) => {
|
|
|
127799
127830
|
return run$1.trackedChanges;
|
|
127800
127831
|
return run$1.trackedChange ? [run$1.trackedChange] : [];
|
|
127801
127832
|
}, isTrackedChangeRun = (run$1) => {
|
|
127802
|
-
return isTextRun$
|
|
127833
|
+
return isTextRun$2(run$1) || run$1.kind === "break";
|
|
127803
127834
|
}, runHasTrackedChangeKind = (run$1, kind) => {
|
|
127804
127835
|
if (!isTrackedChangeRun(run$1))
|
|
127805
127836
|
return false;
|
|
@@ -127882,14 +127913,14 @@ var isRegExp = (value) => {
|
|
|
127882
127913
|
runs.forEach((run$1) => stripTrackedChangeFromRun(run$1));
|
|
127883
127914
|
else
|
|
127884
127915
|
runs.forEach((run$1) => {
|
|
127885
|
-
if (isTextRun$
|
|
127916
|
+
if (isTextRun$2(run$1))
|
|
127886
127917
|
applyFormatChangeMarks(run$1, config$42, hyperlinkConfig, applyMarksToRun$1, themeColors, enableComments, storyKey);
|
|
127887
127918
|
});
|
|
127888
127919
|
return runs;
|
|
127889
127920
|
}
|
|
127890
127921
|
const filtered = [];
|
|
127891
127922
|
runs.forEach((run$1) => {
|
|
127892
|
-
if (!isTextRun$
|
|
127923
|
+
if (!isTextRun$2(run$1) && run$1.kind !== "break") {
|
|
127893
127924
|
filtered.push(run$1);
|
|
127894
127925
|
return;
|
|
127895
127926
|
}
|
|
@@ -127907,7 +127938,7 @@ var isRegExp = (value) => {
|
|
|
127907
127938
|
filtered.forEach((run$1) => stripTrackedChangeFromRun(run$1));
|
|
127908
127939
|
else {
|
|
127909
127940
|
filtered.forEach((run$1) => {
|
|
127910
|
-
if (isTextRun$
|
|
127941
|
+
if (isTextRun$2(run$1))
|
|
127911
127942
|
applyFormatChangeMarks(run$1, config$42, hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG, applyMarksToRun$1, themeColors, enableComments, storyKey);
|
|
127912
127943
|
});
|
|
127913
127944
|
if ((config$42.mode === "original" || config$42.mode === "final") && config$42.enabled)
|
|
@@ -128499,6 +128530,11 @@ var isRegExp = (value) => {
|
|
|
128499
128530
|
inlineDirection,
|
|
128500
128531
|
writingMode
|
|
128501
128532
|
};
|
|
128533
|
+
}, numberingDefinesMarkerFontFamily = (numberingProperties, converterContext) => {
|
|
128534
|
+
const numId = numberingProperties?.numId;
|
|
128535
|
+
if (numId == null || numId === 0 || !converterContext)
|
|
128536
|
+
return false;
|
|
128537
|
+
return getNumberingProperties$1("runProperties", converterContext, numberingProperties?.ilvl ?? 0, numId).fontFamily != null;
|
|
128502
128538
|
}, DEFAULT_DECIMAL_SEPARATOR = ".", DEFAULT_TAB_INTERVAL_TWIPS = 720, normalizeColor$1 = (value) => {
|
|
128503
128539
|
if (typeof value !== "string")
|
|
128504
128540
|
return;
|
|
@@ -128681,15 +128717,11 @@ var isRegExp = (value) => {
|
|
|
128681
128717
|
if (normalizedNumberingProperties && normalizedListRendering) {
|
|
128682
128718
|
const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
|
|
128683
128719
|
let markerFontFallback;
|
|
128684
|
-
if (!hasExplicitParagraphRunProperties(paragraphProperties) && previousParagraphFont)
|
|
128685
|
-
const numProps = paragraphProperties.numberingProperties;
|
|
128686
|
-
const numId = numProps?.numId;
|
|
128687
|
-
const ilvl = numProps?.ilvl ?? 0;
|
|
128720
|
+
if (!hasExplicitParagraphRunProperties(paragraphProperties) && previousParagraphFont)
|
|
128688
128721
|
markerFontFallback = {
|
|
128689
|
-
fontFamily: (
|
|
128722
|
+
fontFamily: numberingDefinesMarkerFontFamily(paragraphProperties.numberingProperties, converterContext) ? undefined : previousParagraphFont.fontFamily,
|
|
128690
128723
|
fontSize: previousParagraphFont.fontSize
|
|
128691
128724
|
};
|
|
128692
|
-
}
|
|
128693
128725
|
paragraphAttrs.wordLayout = computeWordParagraphLayout({
|
|
128694
128726
|
paragraph: paragraphAttrs,
|
|
128695
128727
|
listRenderingAttrs: normalizedListRendering,
|
|
@@ -129431,6 +129463,84 @@ var isRegExp = (value) => {
|
|
|
129431
129463
|
merged.script = script;
|
|
129432
129464
|
}
|
|
129433
129465
|
return merged;
|
|
129466
|
+
}, isTextRun$1 = (run$1) => ("text" in run$1), pickFontPartial = (fontFamily, fontSize) => {
|
|
129467
|
+
const partial = {};
|
|
129468
|
+
if (typeof fontFamily === "string" && fontFamily.trim().length > 0)
|
|
129469
|
+
partial.fontFamily = fontFamily.trim();
|
|
129470
|
+
if (typeof fontSize === "number" && Number.isFinite(fontSize) && fontSize > 0)
|
|
129471
|
+
partial.fontSize = fontSize;
|
|
129472
|
+
return Object.keys(partial).length > 0 ? partial : undefined;
|
|
129473
|
+
}, getFontFromRuns = (runs) => {
|
|
129474
|
+
for (const run$1 of runs) {
|
|
129475
|
+
if (!isTextRun$1(run$1))
|
|
129476
|
+
continue;
|
|
129477
|
+
if (typeof run$1.text === "string" && run$1.text.length === 0)
|
|
129478
|
+
continue;
|
|
129479
|
+
const partial = pickFontPartial(run$1.fontFamily, run$1.fontSize);
|
|
129480
|
+
if (partial)
|
|
129481
|
+
return partial;
|
|
129482
|
+
}
|
|
129483
|
+
}, getFontFromTextStyleMark = (attrs) => {
|
|
129484
|
+
const probe = {
|
|
129485
|
+
text: "",
|
|
129486
|
+
fontFamily: "",
|
|
129487
|
+
fontSize: 0
|
|
129488
|
+
};
|
|
129489
|
+
applyTextStyleMark(probe, attrs);
|
|
129490
|
+
return pickFontPartial(probe.fontFamily, probe.fontSize);
|
|
129491
|
+
}, getFontFromParagraphContent = (node3) => {
|
|
129492
|
+
let found$1;
|
|
129493
|
+
const visit2 = (current) => {
|
|
129494
|
+
if (found$1 || current == null || typeof current !== "object")
|
|
129495
|
+
return;
|
|
129496
|
+
const candidate = current;
|
|
129497
|
+
if ((candidate.isText === true || typeof candidate.text === "string") && candidate.marks?.length)
|
|
129498
|
+
for (const mark of candidate.marks) {
|
|
129499
|
+
if ((typeof mark.type === "string" ? mark.type : mark.type?.name) !== "textStyle")
|
|
129500
|
+
continue;
|
|
129501
|
+
const partial = getFontFromTextStyleMark(mark.attrs ?? {});
|
|
129502
|
+
if (partial) {
|
|
129503
|
+
found$1 = partial;
|
|
129504
|
+
return;
|
|
129505
|
+
}
|
|
129506
|
+
}
|
|
129507
|
+
candidate.content?.forEach?.(visit2);
|
|
129508
|
+
};
|
|
129509
|
+
visit2(node3);
|
|
129510
|
+
return found$1;
|
|
129511
|
+
}, resolveContentFont = (block, para, source, previousParagraphFont) => {
|
|
129512
|
+
const fromRuns = getFontFromRuns(block.runs);
|
|
129513
|
+
const fromPara = para ? getFontFromParagraphContent(para) : undefined;
|
|
129514
|
+
if (source === "paragraph") {
|
|
129515
|
+
if (fromPara)
|
|
129516
|
+
return fromPara;
|
|
129517
|
+
return fromRuns ?? previousParagraphFont;
|
|
129518
|
+
}
|
|
129519
|
+
return fromRuns ?? fromPara;
|
|
129520
|
+
}, syncListMarkerFontFromParagraphRuns = ({ block, converterContext, para, contentFontSource = "runs", previousParagraphFont }) => {
|
|
129521
|
+
const markerRun = block.attrs?.wordLayout?.marker?.run;
|
|
129522
|
+
if (!markerRun)
|
|
129523
|
+
return;
|
|
129524
|
+
const contentFont = resolveContentFont(block, para, contentFontSource, previousParagraphFont);
|
|
129525
|
+
if (!contentFont)
|
|
129526
|
+
return;
|
|
129527
|
+
const paragraphProperties = para?.attrs?.paragraphProperties != null && typeof para.attrs.paragraphProperties === "object" ? para.attrs.paragraphProperties : undefined;
|
|
129528
|
+
const hasLiveTextStyleFont = para ? getFontFromParagraphContent(para) != null : false;
|
|
129529
|
+
const allowBodyFontSync = !hasExplicitParagraphRunProperties(paragraphProperties) || hasLiveTextStyleFont;
|
|
129530
|
+
if (contentFontSource === "paragraph") {
|
|
129531
|
+
const firstRun = block.runs[0];
|
|
129532
|
+
if (firstRun && isTextRun$1(firstRun) && firstRun.text.length === 0) {
|
|
129533
|
+
if (contentFont.fontFamily)
|
|
129534
|
+
firstRun.fontFamily = contentFont.fontFamily;
|
|
129535
|
+
if (contentFont.fontSize)
|
|
129536
|
+
firstRun.fontSize = contentFont.fontSize;
|
|
129537
|
+
}
|
|
129538
|
+
}
|
|
129539
|
+
const preserveNumberingFontFamily = numberingDefinesMarkerFontFamily(block.attrs?.numberingProperties, converterContext);
|
|
129540
|
+
if (allowBodyFontSync && !preserveNumberingFontFamily && contentFont.fontFamily)
|
|
129541
|
+
markerRun.fontFamily = contentFont.fontFamily;
|
|
129542
|
+
if (allowBodyFontSync && contentFont.fontSize)
|
|
129543
|
+
markerRun.fontSize = contentFont.fontSize;
|
|
129434
129544
|
}, buildSyntheticTextNode = (displayText, marks) => ({
|
|
129435
129545
|
type: "text",
|
|
129436
129546
|
text: displayText,
|
|
@@ -130696,7 +130806,7 @@ var isRegExp = (value) => {
|
|
|
130696
130806
|
state.kern = kernNode.attributes["w:val"];
|
|
130697
130807
|
}
|
|
130698
130808
|
}, SuperConverter;
|
|
130699
|
-
var
|
|
130809
|
+
var init_SuperConverter_CcHCWpfX_es = __esm(() => {
|
|
130700
130810
|
init_rolldown_runtime_Bg48TavK_es();
|
|
130701
130811
|
init_jszip_C49i9kUs_es();
|
|
130702
130812
|
init_xml_js_CqGKpaft_es();
|
|
@@ -169470,7 +169580,7 @@ var init_SuperConverter_D9c2ow57_es = __esm(() => {
|
|
|
169470
169580
|
};
|
|
169471
169581
|
});
|
|
169472
169582
|
|
|
169473
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
169583
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-DKwoydAR.es.js
|
|
169474
169584
|
function parseSizeUnit(val = "0") {
|
|
169475
169585
|
const length3 = val.toString() || "0";
|
|
169476
169586
|
const value = Number.parseFloat(length3);
|
|
@@ -179801,8 +179911,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
179801
179911
|
}
|
|
179802
179912
|
};
|
|
179803
179913
|
};
|
|
179804
|
-
var
|
|
179805
|
-
|
|
179914
|
+
var init_create_headless_toolbar_DKwoydAR_es = __esm(() => {
|
|
179915
|
+
init_SuperConverter_CcHCWpfX_es();
|
|
179806
179916
|
init_uuid_qzgm05fK_es();
|
|
179807
179917
|
init_constants_D_X7xF4s_es();
|
|
179808
179918
|
init_dist_B8HfvhaK_es();
|
|
@@ -228965,7 +229075,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
228965
229075
|
init_remark_gfm_BhnWr3yf_es();
|
|
228966
229076
|
});
|
|
228967
229077
|
|
|
228968
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
229078
|
+
// ../../packages/superdoc/dist/chunks/src-C8mTdIvv.es.js
|
|
228969
229079
|
function deleteProps(obj, propOrProps) {
|
|
228970
229080
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
228971
229081
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -283300,7 +283410,7 @@ function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun) {
|
|
|
283300
283410
|
return getFontInfoFromRun(newRun);
|
|
283301
283411
|
return currentMaxInfo;
|
|
283302
283412
|
}
|
|
283303
|
-
function isTextRun$
|
|
283413
|
+
function isTextRun$22(run2) {
|
|
283304
283414
|
return run2.kind === "text" || run2.kind === undefined;
|
|
283305
283415
|
}
|
|
283306
283416
|
function isTabRun(run2) {
|
|
@@ -283427,9 +283537,9 @@ async function measureBlock(block, constraints) {
|
|
|
283427
283537
|
async function measureParagraphBlock(block, maxWidth) {
|
|
283428
283538
|
const ctx$1 = getCanvasContext();
|
|
283429
283539
|
const wordLayout = block.attrs?.wordLayout;
|
|
283430
|
-
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$
|
|
283431
|
-
const fallbackFontSize = normalizeFontSize2(firstTextRunWithSize?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
|
|
283432
|
-
const fallbackFontFamily = block.runs.find((run2) => isTextRun$
|
|
283540
|
+
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
283541
|
+
const fallbackFontSize = normalizeFontSize2((firstTextRunWithSize ?? block.runs.find((run2) => typeof run2.fontSize === "number" && run2.fontSize > 0))?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
|
|
283542
|
+
const fallbackFontFamily = (block.runs.find((run2) => isTextRun$22(run2) && typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0) ?? block.runs.find((run2) => typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0))?.fontFamily ?? DEFAULT_PARAGRAPH_FONT_FAMILY;
|
|
283433
283543
|
const normalizedRuns = normalizeRunsForMeasurement(block.runs, fallbackFontSize, fallbackFontFamily);
|
|
283434
283544
|
const markerInfo = wordLayout?.marker ? (() => {
|
|
283435
283545
|
const { font: markerFont } = buildFontString({
|
|
@@ -283651,10 +283761,10 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
283651
283761
|
});
|
|
283652
283762
|
} else
|
|
283653
283763
|
runsToProcess.push(run2);
|
|
283654
|
-
if (runsToProcess.some((run2) => isTextRun$
|
|
283764
|
+
if (runsToProcess.some((run2) => isTextRun$22(run2) && typeof run2.text === "string" && run2.text.includes("\t"))) {
|
|
283655
283765
|
const expandedRuns = [];
|
|
283656
283766
|
for (const run2 of runsToProcess) {
|
|
283657
|
-
if (!isTextRun$
|
|
283767
|
+
if (!isTextRun$22(run2) || typeof run2.text !== "string" || !run2.text.includes("\t")) {
|
|
283658
283768
|
expandedRuns.push(run2);
|
|
283659
283769
|
continue;
|
|
283660
283770
|
}
|
|
@@ -295303,6 +295413,34 @@ var Node$13 = class Node$14 {
|
|
|
295303
295413
|
if (left$1)
|
|
295304
295414
|
return left$1;
|
|
295305
295415
|
return ctx$1.graph.segments.find((segment) => segment.side === SegmentSide.Inserted && segment.from === pos && isSameUserForRefinement(ctx$1, segment)) ?? null;
|
|
295416
|
+
}, findAdjacentDeletedSegment = (ctx$1, from$1, to) => {
|
|
295417
|
+
const sameUserDeleted = (segment) => segment.side === SegmentSide.Deleted && !segment.attrs?.replacementGroupId && !segment.attrs?.overlapParentId && isSameUserForRefinement(ctx$1, segment);
|
|
295418
|
+
const exactLeft = ctx$1.graph.segments.find((segment) => sameUserDeleted(segment) && segment.to === from$1);
|
|
295419
|
+
if (exactLeft)
|
|
295420
|
+
return exactLeft;
|
|
295421
|
+
const exactRight = ctx$1.graph.segments.find((segment) => sameUserDeleted(segment) && segment.from === to);
|
|
295422
|
+
if (exactRight)
|
|
295423
|
+
return exactRight;
|
|
295424
|
+
let nearest = null;
|
|
295425
|
+
let nearestDistance = Infinity;
|
|
295426
|
+
for (const segment of ctx$1.graph.segments) {
|
|
295427
|
+
if (!sameUserDeleted(segment))
|
|
295428
|
+
continue;
|
|
295429
|
+
if (segment.from > to) {
|
|
295430
|
+
const distance2 = segment.from - to;
|
|
295431
|
+
if (distance2 < nearestDistance && isCoalescibleDeletionGap(ctx$1, to, segment.from)) {
|
|
295432
|
+
nearest = segment;
|
|
295433
|
+
nearestDistance = distance2;
|
|
295434
|
+
}
|
|
295435
|
+
} else if (segment.to < from$1) {
|
|
295436
|
+
const distance2 = from$1 - segment.to;
|
|
295437
|
+
if (distance2 < nearestDistance && isCoalescibleDeletionGap(ctx$1, segment.to, from$1)) {
|
|
295438
|
+
nearest = segment;
|
|
295439
|
+
nearestDistance = distance2;
|
|
295440
|
+
}
|
|
295441
|
+
}
|
|
295442
|
+
}
|
|
295443
|
+
return nearest;
|
|
295306
295444
|
}, isEmptyStructuralGap = (ctx$1, from$1, to) => {
|
|
295307
295445
|
if (to <= from$1)
|
|
295308
295446
|
return false;
|
|
@@ -295322,6 +295460,25 @@ var Node$13 = class Node$14 {
|
|
|
295322
295460
|
}
|
|
295323
295461
|
});
|
|
295324
295462
|
return !hasInlineLeaf;
|
|
295463
|
+
}, ZERO_WIDTH_ANCHOR_NODE_NAMES, isCoalescibleDeletionGap = (ctx$1, from$1, to) => {
|
|
295464
|
+
if (to <= from$1)
|
|
295465
|
+
return false;
|
|
295466
|
+
if (!sharesTextblock(ctx$1.tr.doc, from$1, to))
|
|
295467
|
+
return false;
|
|
295468
|
+
if (ctx$1.graph.segmentsInRange(from$1, to).length)
|
|
295469
|
+
return false;
|
|
295470
|
+
if (ctx$1.tr.doc.textBetween(from$1, to, "", ""))
|
|
295471
|
+
return false;
|
|
295472
|
+
let blocked = false;
|
|
295473
|
+
ctx$1.tr.doc.nodesBetween(from$1, to, (node3, pos) => {
|
|
295474
|
+
if (pos < from$1 || pos >= to)
|
|
295475
|
+
return;
|
|
295476
|
+
if (node3.isInline && node3.isLeaf && !ZERO_WIDTH_ANCHOR_NODE_NAMES.has(node3.type.name)) {
|
|
295477
|
+
blocked = true;
|
|
295478
|
+
return false;
|
|
295479
|
+
}
|
|
295480
|
+
});
|
|
295481
|
+
return !blocked;
|
|
295325
295482
|
}, sharesTextblock = (doc$12, from$1, to) => {
|
|
295326
295483
|
const left$1 = textblockStart(doc$12, from$1);
|
|
295327
295484
|
const right$1 = textblockStart(doc$12, to);
|
|
@@ -295473,15 +295630,19 @@ var Node$13 = class Node$14 {
|
|
|
295473
295630
|
return failure$3("INVALID_TARGET", `text-delete range [${intent.from}, ${intent.to}] out of bounds.`);
|
|
295474
295631
|
if (intent.from === intent.to)
|
|
295475
295632
|
return failure$3("INVALID_TARGET", "text-delete requires a non-empty range.");
|
|
295633
|
+
const coalesceTarget = intent.replacementGroupHint || intent.preserveExistingReviewState ? null : findAdjacentDeletedSegment(ctx$1, intent.from, intent.to);
|
|
295634
|
+
const sharedDeletionId = intent.replacementGroupHint || coalesceTarget?.changeId || null;
|
|
295476
295635
|
const result = applyTrackedDelete(ctx$1, intent.from, intent.to, {
|
|
295477
295636
|
replacementGroupId: "",
|
|
295478
295637
|
replacementSideId: "",
|
|
295479
|
-
sharedDeletionId
|
|
295638
|
+
sharedDeletionId,
|
|
295480
295639
|
recordSharedDeletionId: Boolean(intent.replacementGroupHint),
|
|
295481
295640
|
reassignExistingDeletions: intent.source !== "native" && !intent.preserveExistingReviewState ? "different-user" : false
|
|
295482
295641
|
});
|
|
295483
295642
|
if (result.ok === false)
|
|
295484
295643
|
return result;
|
|
295644
|
+
if (coalesceTarget && !ctx$1.updatedChangeIds.includes(coalesceTarget.changeId))
|
|
295645
|
+
ctx$1.updatedChangeIds.push(coalesceTarget.changeId);
|
|
295485
295646
|
return {
|
|
295486
295647
|
ok: true,
|
|
295487
295648
|
tr: ctx$1.tr,
|
|
@@ -309100,7 +309261,7 @@ menclose::after {
|
|
|
309100
309261
|
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
309101
309262
|
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
309102
309263
|
}
|
|
309103
|
-
}, registriesByFontSet, domlessRegistry = null, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
|
|
309264
|
+
}, registriesByFontSet, domlessRegistry = null, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, underlineThicknessPx = (fontSize) => Math.max(1, Math.round(fontSize / 14)), hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
|
|
309104
309265
|
if (hasVerticalPositioning(run2))
|
|
309105
309266
|
element3.style.lineHeight = "1";
|
|
309106
309267
|
const explicitBaselineShift = normalizeBaselineShift(run2.baselineShift);
|
|
@@ -309142,6 +309303,7 @@ menclose::after {
|
|
|
309142
309303
|
decorations.push("underline");
|
|
309143
309304
|
const u = run2.underline;
|
|
309144
309305
|
element3.style.textDecorationStyle = u.style && u.style !== "single" ? u.style : "solid";
|
|
309306
|
+
element3.style.textDecorationThickness = `${underlineThicknessPx(run2.fontSize)}px`;
|
|
309145
309307
|
if (u.color)
|
|
309146
309308
|
element3.style.textDecorationColor = u.color;
|
|
309147
309309
|
}
|
|
@@ -309906,9 +310068,14 @@ menclose::after {
|
|
|
309906
310068
|
const tabWidth = run2.width ?? 48;
|
|
309907
310069
|
tabEl.style.display = "inline-block";
|
|
309908
310070
|
tabEl.style.width = `${tabWidth}px`;
|
|
309909
|
-
|
|
309910
|
-
|
|
309911
|
-
|
|
310071
|
+
if (run2.underline) {
|
|
310072
|
+
tabEl.style.height = `${underlineOffsetFromLineTop(line)}px`;
|
|
310073
|
+
tabEl.style.verticalAlign = "top";
|
|
310074
|
+
} else {
|
|
310075
|
+
tabEl.style.height = `${line.lineHeight}px`;
|
|
310076
|
+
tabEl.style.verticalAlign = "bottom";
|
|
310077
|
+
}
|
|
310078
|
+
applyTabUnderlineBorder(tabEl, run2);
|
|
309912
310079
|
if (styleId)
|
|
309913
310080
|
tabEl.setAttribute("styleid", styleId);
|
|
309914
310081
|
if (run2.pmStart != null)
|
|
@@ -309926,11 +310093,11 @@ menclose::after {
|
|
|
309926
310093
|
tabEl.style.left = `${tabStartX + indentOffset}px`;
|
|
309927
310094
|
tabEl.style.top = "0px";
|
|
309928
310095
|
tabEl.style.width = `${actualTabWidth}px`;
|
|
309929
|
-
tabEl.style.height = `${line.lineHeight}px`;
|
|
310096
|
+
tabEl.style.height = run2.underline ? `${underlineOffsetFromLineTop(line)}px` : `${line.lineHeight}px`;
|
|
309930
310097
|
tabEl.style.display = "inline-block";
|
|
309931
310098
|
tabEl.style.pointerEvents = "none";
|
|
309932
310099
|
tabEl.style.zIndex = "1";
|
|
309933
|
-
|
|
310100
|
+
applyTabUnderlineBorder(tabEl, run2);
|
|
309934
310101
|
if (!run2.underline)
|
|
309935
310102
|
tabEl.style.visibility = "hidden";
|
|
309936
310103
|
if (styleId)
|
|
@@ -309945,13 +310112,16 @@ menclose::after {
|
|
|
309945
310112
|
tabEndX,
|
|
309946
310113
|
actualTabWidth
|
|
309947
310114
|
};
|
|
309948
|
-
},
|
|
309949
|
-
|
|
309950
|
-
|
|
309951
|
-
|
|
309952
|
-
|
|
309953
|
-
|
|
309954
|
-
|
|
310115
|
+
}, underlineOffsetFromLineTop = (line) => {
|
|
310116
|
+
return Math.max(0, (line.lineHeight - line.ascent - line.descent) / 2) + line.ascent + Math.min(line.descent, line.lineHeight * 0.08);
|
|
310117
|
+
}, applyTabUnderlineBorder = (tabEl, run2) => {
|
|
310118
|
+
if (!run2.underline)
|
|
310119
|
+
return;
|
|
310120
|
+
const underlineStyle = run2.underline.style ?? "single";
|
|
310121
|
+
const underlineColor = run2.underline.color ?? "#000000";
|
|
310122
|
+
const borderStyle = underlineStyle === "double" ? "double" : "solid";
|
|
310123
|
+
const fontSize = run2.fontSize ?? 16;
|
|
310124
|
+
tabEl.style.borderBottom = `${underlineThicknessPx(fontSize)}px ${borderStyle} ${underlineColor}`;
|
|
309955
310125
|
}, applyStyles$1 = (el, styles) => {
|
|
309956
310126
|
Object.entries(styles).forEach(([key2, value]) => {
|
|
309957
310127
|
if (value != null && value !== "" && key2 in el.style)
|
|
@@ -313255,7 +313425,12 @@ menclose::after {
|
|
|
313255
313425
|
if (run2.kind === "lineBreak")
|
|
313256
313426
|
return "linebreak";
|
|
313257
313427
|
if (run2.kind === "tab")
|
|
313258
|
-
return [
|
|
313428
|
+
return [
|
|
313429
|
+
run2.text ?? "",
|
|
313430
|
+
"tab",
|
|
313431
|
+
run2.underline?.style ?? "",
|
|
313432
|
+
run2.underline?.color ?? ""
|
|
313433
|
+
].join(",");
|
|
313259
313434
|
if (run2.kind === "fieldAnnotation") {
|
|
313260
313435
|
const fieldRun = run2;
|
|
313261
313436
|
const size$1 = fieldRun.size ? `${fieldRun.size.width ?? ""}x${fieldRun.size.height ?? ""}` : "";
|
|
@@ -322089,13 +322264,13 @@ menclose::after {
|
|
|
322089
322264
|
return;
|
|
322090
322265
|
console.log(...args$1);
|
|
322091
322266
|
}, 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;
|
|
322092
|
-
var
|
|
322267
|
+
var init_src_C8mTdIvv_es = __esm(() => {
|
|
322093
322268
|
init_rolldown_runtime_Bg48TavK_es();
|
|
322094
|
-
|
|
322269
|
+
init_SuperConverter_CcHCWpfX_es();
|
|
322095
322270
|
init_jszip_C49i9kUs_es();
|
|
322096
322271
|
init_xml_js_CqGKpaft_es();
|
|
322097
322272
|
init_uuid_qzgm05fK_es();
|
|
322098
|
-
|
|
322273
|
+
init_create_headless_toolbar_DKwoydAR_es();
|
|
322099
322274
|
init_constants_D_X7xF4s_es();
|
|
322100
322275
|
init_dist_B8HfvhaK_es();
|
|
322101
322276
|
init_unified_Dsuw2be5_es();
|
|
@@ -339084,6 +339259,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
339084
339259
|
"format-apply",
|
|
339085
339260
|
"format-remove"
|
|
339086
339261
|
]);
|
|
339262
|
+
ZERO_WIDTH_ANCHOR_NODE_NAMES = new Set([
|
|
339263
|
+
"commentRangeStart",
|
|
339264
|
+
"commentRangeEnd",
|
|
339265
|
+
"commentReference",
|
|
339266
|
+
"bookmarkEnd",
|
|
339267
|
+
"permStart",
|
|
339268
|
+
"permEnd"
|
|
339269
|
+
]);
|
|
339087
339270
|
COMPOSITION_INPUT_TYPES = new Set(["insertCompositionText", "deleteCompositionText"]);
|
|
339088
339271
|
COMBINING_MARK_REGEX = /^\p{Mark}$/u;
|
|
339089
339272
|
graphemeSegmenter = typeof Intl !== "undefined" && typeof Intl.Segmenter === "function" ? new Intl.Segmenter(undefined, { granularity: "grapheme" }) : null;
|
|
@@ -356437,11 +356620,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
356437
356620
|
]);
|
|
356438
356621
|
});
|
|
356439
356622
|
|
|
356440
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
356623
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-CEjelItp.es.js
|
|
356441
356624
|
var 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;
|
|
356442
|
-
var
|
|
356443
|
-
|
|
356444
|
-
|
|
356625
|
+
var init_create_super_doc_ui_CEjelItp_es = __esm(() => {
|
|
356626
|
+
init_SuperConverter_CcHCWpfX_es();
|
|
356627
|
+
init_create_headless_toolbar_DKwoydAR_es();
|
|
356445
356628
|
MOD_ALIASES = new Set([
|
|
356446
356629
|
"Mod",
|
|
356447
356630
|
"Meta",
|
|
@@ -356483,16 +356666,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
356483
356666
|
|
|
356484
356667
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
356485
356668
|
var init_super_editor_es = __esm(() => {
|
|
356486
|
-
|
|
356487
|
-
|
|
356669
|
+
init_src_C8mTdIvv_es();
|
|
356670
|
+
init_SuperConverter_CcHCWpfX_es();
|
|
356488
356671
|
init_jszip_C49i9kUs_es();
|
|
356489
356672
|
init_xml_js_CqGKpaft_es();
|
|
356490
|
-
|
|
356673
|
+
init_create_headless_toolbar_DKwoydAR_es();
|
|
356491
356674
|
init_constants_D_X7xF4s_es();
|
|
356492
356675
|
init_dist_B8HfvhaK_es();
|
|
356493
356676
|
init_unified_Dsuw2be5_es();
|
|
356494
356677
|
init_DocxZipper_nv_KfOqb_es();
|
|
356495
|
-
|
|
356678
|
+
init_create_super_doc_ui_CEjelItp_es();
|
|
356496
356679
|
init_ui_C5PAS9hY_es();
|
|
356497
356680
|
init_eventemitter3_BnGqBE_Q_es();
|
|
356498
356681
|
init_errors_CNaD6vcg_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.16.0-next.
|
|
3
|
+
"version": "0.16.0-next.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
-
"superdoc": "
|
|
29
|
-
"
|
|
28
|
+
"@superdoc/super-editor": "0.0.1",
|
|
29
|
+
"superdoc": "1.38.0"
|
|
30
30
|
},
|
|
31
31
|
"module": "src/index.ts",
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@superdoc-dev/cli-darwin-
|
|
37
|
-
"@superdoc-dev/cli-darwin-
|
|
38
|
-
"@superdoc-dev/cli-linux-
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-
|
|
36
|
+
"@superdoc-dev/cli-darwin-arm64": "0.16.0-next.13",
|
|
37
|
+
"@superdoc-dev/cli-darwin-x64": "0.16.0-next.13",
|
|
38
|
+
"@superdoc-dev/cli-linux-x64": "0.16.0-next.13",
|
|
39
|
+
"@superdoc-dev/cli-windows-x64": "0.16.0-next.13",
|
|
40
|
+
"@superdoc-dev/cli-linux-arm64": "0.16.0-next.13"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"predev": "node scripts/ensure-superdoc-build.js",
|