@superdoc-dev/mcp 0.12.0-next.46 → 0.12.0-next.47
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 +233 -114
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
|
|
|
50479
50479
|
emptyOptions2 = {};
|
|
50480
50480
|
});
|
|
50481
50481
|
|
|
50482
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
50482
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DIgF4xk_.es.js
|
|
50483
50483
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
50484
50484
|
const fieldValue = extension$1.config[field];
|
|
50485
50485
|
if (typeof fieldValue === "function")
|
|
@@ -87050,34 +87050,62 @@ function hydrateImageBlocks(blocks, mediaFiles) {
|
|
|
87050
87050
|
if (blk.kind === "drawing") {
|
|
87051
87051
|
const drawingBlock = blk;
|
|
87052
87052
|
if (drawingBlock.drawingKind === "vectorShape" || drawingBlock.drawingKind === "textboxShape") {
|
|
87053
|
-
|
|
87054
|
-
|
|
87055
|
-
|
|
87056
|
-
|
|
87057
|
-
|
|
87058
|
-
|
|
87053
|
+
let blockChanged = false;
|
|
87054
|
+
let nextBlock = drawingBlock;
|
|
87055
|
+
if (drawingBlock.drawingKind === "textboxShape") {
|
|
87056
|
+
const contentBlocks = drawingBlock.contentBlocks;
|
|
87057
|
+
if (Array.isArray(contentBlocks) && contentBlocks.length > 0) {
|
|
87058
|
+
let contentBlocksChanged = false;
|
|
87059
|
+
const hydratedContentBlocks = contentBlocks.map((paragraphBlock) => {
|
|
87060
|
+
if (paragraphBlock.kind !== "paragraph" || !paragraphBlock.runs?.length)
|
|
87061
|
+
return paragraphBlock;
|
|
87062
|
+
const hydratedRuns = hydrateRuns(paragraphBlock.runs);
|
|
87063
|
+
if (hydratedRuns !== paragraphBlock.runs) {
|
|
87064
|
+
contentBlocksChanged = true;
|
|
87065
|
+
return {
|
|
87066
|
+
...paragraphBlock,
|
|
87067
|
+
runs: hydratedRuns
|
|
87068
|
+
};
|
|
87069
|
+
}
|
|
87070
|
+
return paragraphBlock;
|
|
87071
|
+
});
|
|
87072
|
+
if (contentBlocksChanged) {
|
|
87073
|
+
blockChanged = true;
|
|
87074
|
+
nextBlock = {
|
|
87075
|
+
...drawingBlock,
|
|
87076
|
+
contentBlocks: hydratedContentBlocks
|
|
87077
|
+
};
|
|
87078
|
+
}
|
|
87079
|
+
}
|
|
87080
|
+
}
|
|
87081
|
+
const parts = nextBlock.textContent?.parts;
|
|
87082
|
+
if (parts && parts.length > 0) {
|
|
87083
|
+
let partsChanged = false;
|
|
87084
|
+
const hydratedParts = parts.map((part) => {
|
|
87085
|
+
if (part?.kind !== "image" || !part.src || part.src.startsWith("data:"))
|
|
87086
|
+
return part;
|
|
87087
|
+
const resolvedSrc = resolveImageSrc(part.src, part.rId, undefined, part.extension);
|
|
87088
|
+
if (resolvedSrc) {
|
|
87089
|
+
partsChanged = true;
|
|
87090
|
+
return {
|
|
87091
|
+
...part,
|
|
87092
|
+
src: resolvedSrc
|
|
87093
|
+
};
|
|
87094
|
+
}
|
|
87059
87095
|
return part;
|
|
87060
|
-
|
|
87061
|
-
if (
|
|
87062
|
-
|
|
87063
|
-
|
|
87064
|
-
...
|
|
87065
|
-
|
|
87096
|
+
});
|
|
87097
|
+
if (partsChanged) {
|
|
87098
|
+
blockChanged = true;
|
|
87099
|
+
nextBlock = {
|
|
87100
|
+
...nextBlock,
|
|
87101
|
+
textContent: {
|
|
87102
|
+
...nextBlock.textContent,
|
|
87103
|
+
parts: hydratedParts
|
|
87104
|
+
}
|
|
87066
87105
|
};
|
|
87067
87106
|
}
|
|
87068
|
-
return part;
|
|
87069
|
-
});
|
|
87070
|
-
if (partsChanged) {
|
|
87071
|
-
const vectorShapeBlock = drawingBlock;
|
|
87072
|
-
return {
|
|
87073
|
-
...vectorShapeBlock,
|
|
87074
|
-
textContent: {
|
|
87075
|
-
...vectorShapeBlock.textContent,
|
|
87076
|
-
parts: hydratedParts
|
|
87077
|
-
}
|
|
87078
|
-
};
|
|
87079
87107
|
}
|
|
87080
|
-
return blk;
|
|
87108
|
+
return blockChanged ? nextBlock : blk;
|
|
87081
87109
|
}
|
|
87082
87110
|
if (drawingBlock.drawingKind !== "shapeGroup")
|
|
87083
87111
|
return blk;
|
|
@@ -89242,6 +89270,7 @@ function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
|
89242
89270
|
const textContent = shapeTextboxNode ? extractTextboxTextContent(shapeTextboxNode) : undefined;
|
|
89243
89271
|
return buildDrawingBlock({
|
|
89244
89272
|
...rawAttrs,
|
|
89273
|
+
...resolveInlineAlignmentFromWrapper(rawAttrs),
|
|
89245
89274
|
...textContent ? { textContent } : {},
|
|
89246
89275
|
...rawAttrs.textAlign == null && textContent?.horizontalAlign ? { textAlign: textContent.horizontalAlign } : {},
|
|
89247
89276
|
...rawAttrs.textInsets == null ? { textInsets: resolveTextboxInsetsFromAttrs(textboxAttrs) } : {},
|
|
@@ -117461,6 +117490,37 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
|
|
|
117461
117490
|
required2.bottom = Math.max(required2.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
|
|
117462
117491
|
}
|
|
117463
117492
|
return hasEffectExtent(required2) ? required2 : undefined;
|
|
117493
|
+
}, resolveWrapperAlignment = (justification) => {
|
|
117494
|
+
switch (justification) {
|
|
117495
|
+
case "center":
|
|
117496
|
+
case "distribute":
|
|
117497
|
+
return "center";
|
|
117498
|
+
case "right":
|
|
117499
|
+
case "end":
|
|
117500
|
+
return "right";
|
|
117501
|
+
default:
|
|
117502
|
+
return;
|
|
117503
|
+
}
|
|
117504
|
+
}, resolveInlineAlignmentFromWrapper = (rawAttrs) => {
|
|
117505
|
+
if (rawAttrs.wrap?.type !== "Inline" || !isPlainObject4(rawAttrs.wrapperParagraph))
|
|
117506
|
+
return {};
|
|
117507
|
+
const wrapper = rawAttrs.wrapperParagraph;
|
|
117508
|
+
const justification = (isPlainObject4(wrapper.paragraphProperties) ? wrapper.paragraphProperties : undefined)?.justification;
|
|
117509
|
+
const textAlign = typeof wrapper.textAlign === "string" ? wrapper.textAlign : undefined;
|
|
117510
|
+
const effectiveAlignment = resolveWrapperAlignment(justification) ?? textAlign;
|
|
117511
|
+
if (effectiveAlignment !== "center" && effectiveAlignment !== "right")
|
|
117512
|
+
return {};
|
|
117513
|
+
const metadata = { inlineParagraphAlignment: effectiveAlignment };
|
|
117514
|
+
const { paragraphAttrs } = computeParagraphAttrs({
|
|
117515
|
+
type: "paragraph",
|
|
117516
|
+
attrs: wrapper
|
|
117517
|
+
});
|
|
117518
|
+
const indent2 = paragraphAttrs.indent;
|
|
117519
|
+
if (typeof indent2?.left === "number")
|
|
117520
|
+
metadata.paragraphIndentLeft = indent2.left;
|
|
117521
|
+
if (typeof indent2?.right === "number")
|
|
117522
|
+
metadata.paragraphIndentRight = indent2.right;
|
|
117523
|
+
return metadata;
|
|
117464
117524
|
}, getAttrs$1 = (node2) => {
|
|
117465
117525
|
return isPlainObject4(node2.attrs) ? { ...node2.attrs } : {};
|
|
117466
117526
|
}, parseFullWidth = (value) => {
|
|
@@ -118763,7 +118823,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
|
|
|
118763
118823
|
state.kern = kernNode.attributes["w:val"];
|
|
118764
118824
|
}
|
|
118765
118825
|
}, SuperConverter;
|
|
118766
|
-
var
|
|
118826
|
+
var init_SuperConverter_DIgF4xk__es = __esm(() => {
|
|
118767
118827
|
init_rolldown_runtime_Bg48TavK_es();
|
|
118768
118828
|
init_jszip_C49i9kUs_es();
|
|
118769
118829
|
init_xml_js_CqGKpaft_es();
|
|
@@ -147689,7 +147749,7 @@ var init_SuperConverter_DRKaQwZS_es = __esm(() => {
|
|
|
147689
147749
|
};
|
|
147690
147750
|
});
|
|
147691
147751
|
|
|
147692
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
147752
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT4yIoZ-.es.js
|
|
147693
147753
|
function parseSizeUnit(val = "0") {
|
|
147694
147754
|
const length = val.toString() || "0";
|
|
147695
147755
|
const value = Number.parseFloat(length);
|
|
@@ -158492,9 +158552,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
158492
158552
|
}
|
|
158493
158553
|
};
|
|
158494
158554
|
};
|
|
158495
|
-
var
|
|
158555
|
+
var init_create_headless_toolbar_BT4yIoZ_es = __esm(() => {
|
|
158496
158556
|
init_rolldown_runtime_Bg48TavK_es();
|
|
158497
|
-
|
|
158557
|
+
init_SuperConverter_DIgF4xk__es();
|
|
158498
158558
|
init_jszip_C49i9kUs_es();
|
|
158499
158559
|
init_uuid_B2wVPhPi_es();
|
|
158500
158560
|
init_constants_D9qj59G2_es();
|
|
@@ -214108,7 +214168,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
|
|
|
214108
214168
|
init_remark_gfm_BUJjZJLy_es();
|
|
214109
214169
|
});
|
|
214110
214170
|
|
|
214111
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
214171
|
+
// ../../packages/superdoc/dist/chunks/src-BrcexyXf.es.js
|
|
214112
214172
|
function deleteProps(obj, propOrProps) {
|
|
214113
214173
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
214114
214174
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -259279,7 +259339,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
|
|
|
259279
259339
|
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
259280
259340
|
const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
|
|
259281
259341
|
const rawWrap = attrs?.wrap;
|
|
259282
|
-
const
|
|
259342
|
+
const isInlineAlignableDrawing = (block.drawingKind === "shapeGroup" || block.drawingKind === "textboxShape") && rawWrap?.type === "Inline";
|
|
259283
259343
|
const inlineParagraphAlignment = attrs?.inlineParagraphAlignment === "center" || attrs?.inlineParagraphAlignment === "right" ? attrs.inlineParagraphAlignment : undefined;
|
|
259284
259344
|
if (width > maxWidthForBlock && maxWidthForBlock > 0) {
|
|
259285
259345
|
const scale = maxWidthForBlock / width;
|
|
@@ -259298,7 +259358,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
|
|
|
259298
259358
|
state = advanceColumn(state);
|
|
259299
259359
|
const pmRange = extractBlockPmRange(block);
|
|
259300
259360
|
let x = columnX(state) + marginLeft + indentLeft;
|
|
259301
|
-
if (
|
|
259361
|
+
if (isInlineAlignableDrawing && inlineParagraphAlignment) {
|
|
259302
259362
|
const pIndentLeft = typeof attrs?.paragraphIndentLeft === "number" ? attrs.paragraphIndentLeft : 0;
|
|
259303
259363
|
const pIndentRight = typeof attrs?.paragraphIndentRight === "number" ? attrs.paragraphIndentRight : 0;
|
|
259304
259364
|
const alignBox = Math.max(0, maxWidthForBlock - pIndentLeft - pIndentRight);
|
|
@@ -263623,6 +263683,17 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
263623
263683
|
endChar = text5.length > 0 ? text5.length : start$1 + 1;
|
|
263624
263684
|
continue;
|
|
263625
263685
|
}
|
|
263686
|
+
if (text5.length === 0 && isAtomicLayoutRun(run2)) {
|
|
263687
|
+
const atomicWidth = getAtomicRunLayoutWidth(run2);
|
|
263688
|
+
if (width > 0 && width + atomicWidth > effectiveMaxWidth - WIDTH_FUDGE_PX) {
|
|
263689
|
+
didBreakInThisLine = true;
|
|
263690
|
+
break;
|
|
263691
|
+
}
|
|
263692
|
+
width += atomicWidth;
|
|
263693
|
+
endRun = r$1;
|
|
263694
|
+
endChar = 1;
|
|
263695
|
+
continue;
|
|
263696
|
+
}
|
|
263626
263697
|
for (let c = start$1;c < text5.length; c += 1) {
|
|
263627
263698
|
const ch = text5[c];
|
|
263628
263699
|
if (ch === "\t") {
|
|
@@ -263711,6 +263782,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
263711
263782
|
endRun = startRun;
|
|
263712
263783
|
endChar = startChar + 1;
|
|
263713
263784
|
}
|
|
263785
|
+
const lineMaxAtomicHeight = getLineMaxAtomicHeight(runs2, startRun, startChar, endRun, endChar);
|
|
263714
263786
|
const line = {
|
|
263715
263787
|
fromRun: startRun,
|
|
263716
263788
|
fromChar: startChar,
|
|
@@ -263719,8 +263791,9 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
263719
263791
|
width,
|
|
263720
263792
|
ascent: 0,
|
|
263721
263793
|
descent: 0,
|
|
263722
|
-
lineHeight: lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize),
|
|
263723
|
-
maxWidth: effectiveMaxWidth
|
|
263794
|
+
lineHeight: Math.max(lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize), lineMaxAtomicHeight),
|
|
263795
|
+
maxWidth: effectiveMaxWidth,
|
|
263796
|
+
...lineMaxAtomicHeight > 0 ? { maxImageHeight: lineMaxAtomicHeight } : {}
|
|
263724
263797
|
};
|
|
263725
263798
|
lines.push(line);
|
|
263726
263799
|
if (lineMaxTextFontSize > 0)
|
|
@@ -272432,14 +272505,14 @@ function capitalizeText$1(text5, fullText, startOffset) {
|
|
|
272432
272505
|
return result;
|
|
272433
272506
|
}
|
|
272434
272507
|
function measureFieldAnnotationWidth(run2, fontContext) {
|
|
272435
|
-
const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE
|
|
272508
|
+
const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
272436
272509
|
const font = buildFontString$1({
|
|
272437
272510
|
fontFamily: normalizeFontFamily$1(run2.fontFamily ?? "Arial"),
|
|
272438
272511
|
fontSize,
|
|
272439
272512
|
bold: run2.bold,
|
|
272440
272513
|
italic: run2.italic
|
|
272441
272514
|
}, fontContext);
|
|
272442
|
-
return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING
|
|
272515
|
+
return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING);
|
|
272443
272516
|
}
|
|
272444
272517
|
function isExplicitLineBreakRun(run2) {
|
|
272445
272518
|
return run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line";
|
|
@@ -272625,6 +272698,15 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
272625
272698
|
endRunIndex: runs2.length
|
|
272626
272699
|
};
|
|
272627
272700
|
let foundDecimal = false;
|
|
272701
|
+
const measureAtomicText$1 = (text5, atomicRun, fontSize) => {
|
|
272702
|
+
const { font } = buildFontString({
|
|
272703
|
+
fontFamily: atomicRun.fontFamily ?? "Arial",
|
|
272704
|
+
fontSize,
|
|
272705
|
+
bold: atomicRun.bold,
|
|
272706
|
+
italic: atomicRun.italic
|
|
272707
|
+
}, fontContext);
|
|
272708
|
+
return measureRunWidth(text5, font, ctx$1, atomicRun, 0);
|
|
272709
|
+
};
|
|
272628
272710
|
for (let i3 = startRunIndex;i3 < runs2.length; i3++) {
|
|
272629
272711
|
const run2 = runs2[i3];
|
|
272630
272712
|
if (isTabRun(run2)) {
|
|
@@ -272666,40 +272748,13 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
272666
272748
|
});
|
|
272667
272749
|
continue;
|
|
272668
272750
|
}
|
|
272669
|
-
if (isImageRun(run2)) {
|
|
272670
|
-
const
|
|
272671
|
-
const rightSpace = run2.distRight ?? 0;
|
|
272672
|
-
const imageWidth = run2.width + leftSpace + rightSpace;
|
|
272751
|
+
if (isImageRun(run2) || run2.kind === "math" || isFieldAnnotationRun(run2)) {
|
|
272752
|
+
const { width } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
272673
272753
|
result.runs.push({
|
|
272674
272754
|
runIndex: i3,
|
|
272675
|
-
width
|
|
272676
|
-
});
|
|
272677
|
-
result.totalWidth += imageWidth;
|
|
272678
|
-
continue;
|
|
272679
|
-
}
|
|
272680
|
-
if (run2.kind === "math") {
|
|
272681
|
-
const mathWidth = run2.width ?? 20;
|
|
272682
|
-
result.runs.push({
|
|
272683
|
-
runIndex: i3,
|
|
272684
|
-
width: mathWidth
|
|
272685
|
-
});
|
|
272686
|
-
result.totalWidth += mathWidth;
|
|
272687
|
-
continue;
|
|
272688
|
-
}
|
|
272689
|
-
if (isFieldAnnotationRun(run2)) {
|
|
272690
|
-
const fontSize = run2.fontSize ?? DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
272691
|
-
const { font } = buildFontString({
|
|
272692
|
-
fontFamily: run2.fontFamily ?? "Arial",
|
|
272693
|
-
fontSize,
|
|
272694
|
-
bold: run2.bold,
|
|
272695
|
-
italic: run2.italic
|
|
272696
|
-
}, fontContext);
|
|
272697
|
-
const pillWidth = (run2.displayLabel ? measureRunWidth(run2.displayLabel, font, ctx$1, run2, 0) : 0) + FIELD_ANNOTATION_PILL_PADDING;
|
|
272698
|
-
result.runs.push({
|
|
272699
|
-
runIndex: i3,
|
|
272700
|
-
width: pillWidth
|
|
272755
|
+
width
|
|
272701
272756
|
});
|
|
272702
|
-
result.totalWidth +=
|
|
272757
|
+
result.totalWidth += width;
|
|
272703
272758
|
continue;
|
|
272704
272759
|
}
|
|
272705
272760
|
result.runs.push({
|
|
@@ -272729,6 +272784,13 @@ async function measureBlock(block, constraints, fontContext = DEFAULT_FONT_MEASU
|
|
|
272729
272784
|
}
|
|
272730
272785
|
async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
272731
272786
|
const ctx$1 = getCanvasContext();
|
|
272787
|
+
const measureAtomicText$1 = (text5, run2, fontSize) => {
|
|
272788
|
+
const family2 = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
|
|
272789
|
+
const weight = run2.bold ? "bold" : "normal";
|
|
272790
|
+
ctx$1.font = `${run2.italic ? "italic" : "normal"} ${weight} ${fontSize}px ${family2}`;
|
|
272791
|
+
const displayText = applyTextTransform(text5, run2);
|
|
272792
|
+
return displayText ? ctx$1.measureText(displayText).width : 0;
|
|
272793
|
+
};
|
|
272732
272794
|
const wordLayout = block.attrs?.wordLayout;
|
|
272733
272795
|
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
272734
272796
|
const fallbackFontSize = normalizeFontSize2((firstTextRunWithSize ?? block.runs.find((run2) => typeof run2.fontSize === "number" && run2.fontSize > 0))?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
|
|
@@ -273258,12 +273320,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
|
273258
273320
|
continue;
|
|
273259
273321
|
}
|
|
273260
273322
|
if (isImageRun(run2)) {
|
|
273261
|
-
const
|
|
273262
|
-
const rightSpace = run2.distRight ?? 0;
|
|
273263
|
-
const imageWidth = run2.width + leftSpace + rightSpace;
|
|
273264
|
-
const topSpace = run2.distTop ?? 0;
|
|
273265
|
-
const bottomSpace = run2.distBottom ?? 0;
|
|
273266
|
-
const imageHeight = run2.height + topSpace + bottomSpace;
|
|
273323
|
+
const { width: imageWidth, height: imageHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
273267
273324
|
let imageStartX;
|
|
273268
273325
|
if (activeTabGroup && currentLine) {
|
|
273269
273326
|
imageStartX = activeTabGroup.currentX;
|
|
@@ -273354,9 +273411,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
|
273354
273411
|
continue;
|
|
273355
273412
|
}
|
|
273356
273413
|
if (run2.kind === "math") {
|
|
273357
|
-
const
|
|
273358
|
-
const mathWidth = mathRun.width ?? 20;
|
|
273359
|
-
const mathHeight = mathRun.height ?? 24;
|
|
273414
|
+
const { width: mathWidth, height: mathHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
273360
273415
|
if (!currentLine)
|
|
273361
273416
|
currentLine = {
|
|
273362
273417
|
fromRun: runIndex,
|
|
@@ -273393,26 +273448,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
|
273393
273448
|
continue;
|
|
273394
273449
|
}
|
|
273395
273450
|
if (isFieldAnnotationRun(run2)) {
|
|
273396
|
-
const
|
|
273397
|
-
const annotationFontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
273398
|
-
const annotationFontFamily = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
|
|
273399
|
-
const fontWeight = run2.bold ? "bold" : "normal";
|
|
273400
|
-
ctx$1.font = `${run2.italic ? "italic" : "normal"} ${fontWeight} ${annotationFontSize}px ${annotationFontFamily}`;
|
|
273401
|
-
const textWidth = displayText ? ctx$1.measureText(displayText).width : 0;
|
|
273402
|
-
const annotationHorizontalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING;
|
|
273403
|
-
const annotationVerticalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_VERTICAL_PADDING;
|
|
273404
|
-
const annotationWidth = textWidth + annotationHorizontalPadding;
|
|
273405
|
-
let annotationHeight = annotationFontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + annotationVerticalPadding;
|
|
273406
|
-
if (run2.variant === "signature" && run2.imageSrc) {
|
|
273407
|
-
const signatureHeight = 28 + annotationVerticalPadding;
|
|
273408
|
-
annotationHeight = Math.max(annotationHeight, signatureHeight);
|
|
273409
|
-
}
|
|
273410
|
-
if (run2.variant === "image" && run2.imageSrc && run2.size?.height) {
|
|
273411
|
-
const imageHeight = run2.size.height + annotationVerticalPadding;
|
|
273412
|
-
annotationHeight = Math.max(annotationHeight, imageHeight);
|
|
273413
|
-
}
|
|
273414
|
-
if (run2.variant === "html" && run2.size?.height)
|
|
273415
|
-
annotationHeight = Math.max(annotationHeight, run2.size.height);
|
|
273451
|
+
const { width: annotationWidth, height: annotationHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
273416
273452
|
let annotationStartX;
|
|
273417
273453
|
if (pendingTabAlignment && currentLine)
|
|
273418
273454
|
annotationStartX = alignPendingTabForWidth(annotationWidth);
|
|
@@ -297326,7 +297362,7 @@ menclose::after {
|
|
|
297326
297362
|
left: borders.right,
|
|
297327
297363
|
right: borders.left
|
|
297328
297364
|
};
|
|
297329
|
-
}, getFiniteNumber = (value) => {
|
|
297365
|
+
}, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, getFiniteNumber = (value) => {
|
|
297330
297366
|
if (typeof value !== "number" || !Number.isFinite(value))
|
|
297331
297367
|
return;
|
|
297332
297368
|
return value;
|
|
@@ -305834,7 +305870,51 @@ menclose::after {
|
|
|
305834
305870
|
getStats() {
|
|
305835
305871
|
return this.cache.getStats();
|
|
305836
305872
|
}
|
|
305837
|
-
}, sharedHeaderFooterCache, HEADER_FOOTER_VARIANTS$12,
|
|
305873
|
+
}, sharedHeaderFooterCache, HEADER_FOOTER_VARIANTS$12, isAtomicLayoutRun = (run2) => typeof run2.src === "string" || run2.kind === "math" || run2.kind === "fieldAnnotation", resolveFieldAnnotationFontSize = (value) => {
|
|
305874
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
305875
|
+
return value;
|
|
305876
|
+
if (typeof value === "string") {
|
|
305877
|
+
const parsed = parseFloat(value);
|
|
305878
|
+
if (Number.isFinite(parsed) && parsed > 0)
|
|
305879
|
+
return parsed;
|
|
305880
|
+
}
|
|
305881
|
+
return 16;
|
|
305882
|
+
}, getImageRunSize = (run2) => {
|
|
305883
|
+
const distLeft = run2.distLeft ?? 0;
|
|
305884
|
+
const distRight = run2.distRight ?? 0;
|
|
305885
|
+
const distTop = run2.distTop ?? 0;
|
|
305886
|
+
const distBottom = run2.distBottom ?? 0;
|
|
305887
|
+
return {
|
|
305888
|
+
width: (run2.width ?? 0) + distLeft + distRight,
|
|
305889
|
+
height: (run2.height ?? 0) + distTop + distBottom
|
|
305890
|
+
};
|
|
305891
|
+
}, getMathRunSize = (run2) => ({
|
|
305892
|
+
width: run2.width ?? 20,
|
|
305893
|
+
height: run2.height ?? 24
|
|
305894
|
+
}), getFieldAnnotationRunSize = (run2, measureText$1) => {
|
|
305895
|
+
const fontSize = resolveFieldAnnotationFontSize(run2.fontSize);
|
|
305896
|
+
const horizontalPadding = run2.highlighted === false ? 0 : 8;
|
|
305897
|
+
const verticalPadding = run2.highlighted === false ? 0 : 6;
|
|
305898
|
+
const label = run2.displayLabel ?? "";
|
|
305899
|
+
const width = (label ? measureText$1(label, run2, fontSize) : 0) + horizontalPadding;
|
|
305900
|
+
let height = fontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + verticalPadding;
|
|
305901
|
+
if (run2.variant === "signature" && run2.imageSrc)
|
|
305902
|
+
height = Math.max(height, 28 + verticalPadding);
|
|
305903
|
+
if (run2.variant === "image" && run2.imageSrc && run2.size?.height)
|
|
305904
|
+
height = Math.max(height, run2.size.height + verticalPadding);
|
|
305905
|
+
if (run2.variant === "html" && run2.size?.height)
|
|
305906
|
+
height = Math.max(height, run2.size.height);
|
|
305907
|
+
return {
|
|
305908
|
+
width,
|
|
305909
|
+
height
|
|
305910
|
+
};
|
|
305911
|
+
}, getAtomicRunLayoutSize = (run2, measureText$1) => {
|
|
305912
|
+
if (typeof run2.src === "string")
|
|
305913
|
+
return getImageRunSize(run2);
|
|
305914
|
+
if (run2.kind === "math")
|
|
305915
|
+
return getMathRunSize(run2);
|
|
305916
|
+
return getFieldAnnotationRunSize(run2, measureText$1);
|
|
305917
|
+
}, canvas = null, ctx = null, isWordChar$1 = (char) => {
|
|
305838
305918
|
if (!char)
|
|
305839
305919
|
return false;
|
|
305840
305920
|
const code6 = char.charCodeAt(0);
|
|
@@ -305863,6 +305943,26 @@ menclose::after {
|
|
|
305863
305943
|
}, DEFAULT_TAB_INTERVAL_TWIPS$12 = 720, TWIPS_PER_PX$2, TAB_EPSILON$1 = 0.1, WIDTH_FUDGE_PX = 0.5, twipsToPx$1 = (twips) => twips / TWIPS_PER_PX$2, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$2), sanitizeIndent$1 = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0, sanitizeRawIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0, sanitizeDecimalSeparator$1 = (value) => value === "," ? "," : ".", getRunWidth = (run2) => {
|
|
305864
305944
|
const width = run2.width;
|
|
305865
305945
|
return typeof width === "number" ? width : 0;
|
|
305946
|
+
}, measureAtomicText = (text5, run2, fontSize) => {
|
|
305947
|
+
const family2 = run2.fontFamily || "Arial";
|
|
305948
|
+
const context = getCtx();
|
|
305949
|
+
if (!context)
|
|
305950
|
+
return Math.max(0, text5.length * (fontSize * 0.6));
|
|
305951
|
+
context.font = `${run2.italic ? "italic " : ""}${run2.bold ? "bold " : ""}${fontSize}px ${family2}`.trim();
|
|
305952
|
+
return context.measureText(text5).width;
|
|
305953
|
+
}, getAtomicRunLayoutWidth = (run2) => getAtomicRunLayoutSize(run2, measureAtomicText).width, getAtomicRunLayoutHeight = (run2) => getAtomicRunLayoutSize(run2, measureAtomicText).height, getLineMaxAtomicHeight = (runs2, fromRun, fromChar, toRun, toChar) => {
|
|
305954
|
+
let max$2 = 0;
|
|
305955
|
+
for (let r$1 = fromRun;r$1 <= toRun; r$1 += 1) {
|
|
305956
|
+
const run2 = runs2[r$1];
|
|
305957
|
+
if (!isAtomicLayoutRun(run2))
|
|
305958
|
+
continue;
|
|
305959
|
+
if (r$1 === toRun && toChar === 0)
|
|
305960
|
+
continue;
|
|
305961
|
+
if (r$1 === fromRun && r$1 === toRun && toChar <= fromChar)
|
|
305962
|
+
continue;
|
|
305963
|
+
max$2 = Math.max(max$2, getAtomicRunLayoutHeight(run2));
|
|
305964
|
+
}
|
|
305965
|
+
return max$2;
|
|
305866
305966
|
}, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
|
|
305867
305967
|
const size$1 = run2?.fontSize ?? 16;
|
|
305868
305968
|
const family2 = run2?.fontFamily ?? "Arial";
|
|
@@ -305935,7 +306035,7 @@ menclose::after {
|
|
|
305935
306035
|
};
|
|
305936
306036
|
const text5 = runText(run2);
|
|
305937
306037
|
if (!text5) {
|
|
305938
|
-
const runWidth = getRunWidth(run2);
|
|
306038
|
+
const runWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
|
|
305939
306039
|
if (runWidth > 0) {
|
|
305940
306040
|
totalWidth += runWidth;
|
|
305941
306041
|
endRun = r$1;
|
|
@@ -305994,7 +306094,7 @@ menclose::after {
|
|
|
305994
306094
|
break;
|
|
305995
306095
|
const text5 = runText(run2);
|
|
305996
306096
|
if (!text5) {
|
|
305997
|
-
totalWidth += getRunWidth(run2);
|
|
306097
|
+
totalWidth += isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
|
|
305998
306098
|
continue;
|
|
305999
306099
|
}
|
|
306000
306100
|
const sliceStart = r$1 === startRunIndex ? startChar : 0;
|
|
@@ -306172,7 +306272,21 @@ menclose::after {
|
|
|
306172
306272
|
}
|
|
306173
306273
|
const text5 = runText(run2);
|
|
306174
306274
|
if (!text5) {
|
|
306175
|
-
|
|
306275
|
+
const atomicWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
|
|
306276
|
+
const pendingTabAlign = consumePendingTabAlignStart();
|
|
306277
|
+
if (pendingTabAlign != null) {
|
|
306278
|
+
const segment = {
|
|
306279
|
+
runIndex,
|
|
306280
|
+
fromChar: 0,
|
|
306281
|
+
toChar: 1,
|
|
306282
|
+
width: atomicWidth,
|
|
306283
|
+
x: pendingTabAlign.paintX,
|
|
306284
|
+
...pendingTabAlign.precedingTabEndX !== undefined ? { precedingTabEndX: pendingTabAlign.precedingTabEndX } : {}
|
|
306285
|
+
};
|
|
306286
|
+
cursorX = pendingTabAlign.layoutX + atomicWidth;
|
|
306287
|
+
segments.push(segment);
|
|
306288
|
+
} else
|
|
306289
|
+
cursorX += atomicWidth;
|
|
306176
306290
|
lineWidth = Math.max(lineWidth, cursorX);
|
|
306177
306291
|
continue;
|
|
306178
306292
|
}
|
|
@@ -311590,7 +311704,7 @@ menclose::after {
|
|
|
311590
311704
|
}
|
|
311591
311705
|
}, EMUS_PER_INCH = 914400, maxSize = 5000, cache, makeKey = (text5, font, letterSpacing) => {
|
|
311592
311706
|
return `${text5}|${font}|${letterSpacing || 0}`;
|
|
311593
|
-
}, fontMetricsCache, MAX_CACHE_SIZE = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", DEFAULT_MIN_COLUMN_WIDTH = 8, TWIPS_PER_PX$1 = 15, PLACEHOLDER_COLUMN_MAX_WIDTH = 1, DEFAULT_CELL_PADDING$1, DEFAULT_FIELD_ANNOTATION_FONT_SIZE
|
|
311707
|
+
}, fontMetricsCache, MAX_CACHE_SIZE = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", DEFAULT_MIN_COLUMN_WIDTH = 8, TWIPS_PER_PX$1 = 15, PLACEHOLDER_COLUMN_MAX_WIDTH = 1, DEFAULT_CELL_PADDING$1, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, FIELD_ANNOTATION_PILL_PADDING = 8, TABLE_CELL_METRICS_CACHE_SIZE = 2000, TABLE_AUTOFIT_RESULT_CACHE_SIZE = 500, NO_WRAP_MAX_WIDTH, TOKEN_BOUNDARY_PATTERN, LruCache = class {
|
|
311594
311708
|
constructor(maxSize$1) {
|
|
311595
311709
|
this.cache = /* @__PURE__ */ new Map;
|
|
311596
311710
|
this.maxSize = maxSize$1;
|
|
@@ -311624,7 +311738,7 @@ menclose::after {
|
|
|
311624
311738
|
this.cache.delete(oldestKey);
|
|
311625
311739
|
}
|
|
311626
311740
|
}
|
|
311627
|
-
}, tableCellMetricsCache, autoFitTableResultCache, canvasContext$1 = null, computeTabStops2, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS2 = 720, TWIPS_PER_PX2, twipsToPx2 = (twips) => twips / TWIPS_PER_PX2, pxToTwips = (px) => Math.round(px * TWIPS_PER_PX2), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON = 0.1, DEFAULT_CELL_PADDING, DEFAULT_DECIMAL_SEPARATOR2 = ".", ALLOWED_TAB_VALS,
|
|
311741
|
+
}, tableCellMetricsCache, autoFitTableResultCache, canvasContext$1 = null, computeTabStops2, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS2 = 720, TWIPS_PER_PX2, twipsToPx2 = (twips) => twips / TWIPS_PER_PX2, pxToTwips = (px) => Math.round(px * TWIPS_PER_PX2), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON = 0.1, DEFAULT_CELL_PADDING, DEFAULT_DECIMAL_SEPARATOR2 = ".", ALLOWED_TAB_VALS, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize2 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
|
|
311628
311742
|
if (isValidFontSize(value))
|
|
311629
311743
|
return value;
|
|
311630
311744
|
if (typeof value === "string") {
|
|
@@ -314196,13 +314310,13 @@ menclose::after {
|
|
|
314196
314310
|
return;
|
|
314197
314311
|
console.log(...args$1);
|
|
314198
314312
|
}, 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;
|
|
314199
|
-
var
|
|
314313
|
+
var init_src_BrcexyXf_es = __esm(() => {
|
|
314200
314314
|
init_rolldown_runtime_Bg48TavK_es();
|
|
314201
|
-
|
|
314315
|
+
init_SuperConverter_DIgF4xk__es();
|
|
314202
314316
|
init_jszip_C49i9kUs_es();
|
|
314203
314317
|
init_xml_js_CqGKpaft_es();
|
|
314204
314318
|
init_uuid_B2wVPhPi_es();
|
|
314205
|
-
|
|
314319
|
+
init_create_headless_toolbar_BT4yIoZ_es();
|
|
314206
314320
|
init_constants_D9qj59G2_es();
|
|
314207
314321
|
init_unified_BDuVPlMu_es();
|
|
314208
314322
|
init_remark_gfm_BUJjZJLy_es();
|
|
@@ -327412,6 +327526,10 @@ ${err.toString()}`);
|
|
|
327412
327526
|
return { style: attrs.style };
|
|
327413
327527
|
} },
|
|
327414
327528
|
wrapAttributes: { rendered: false },
|
|
327529
|
+
wrapperParagraph: {
|
|
327530
|
+
default: null,
|
|
327531
|
+
rendered: false
|
|
327532
|
+
},
|
|
327415
327533
|
anchorData: { rendered: false },
|
|
327416
327534
|
marginOffset: { rendered: false },
|
|
327417
327535
|
attributes: { rendered: false },
|
|
@@ -357457,11 +357575,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357457
357575
|
]);
|
|
357458
357576
|
});
|
|
357459
357577
|
|
|
357460
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
357578
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-B-QEvuPe.es.js
|
|
357461
357579
|
var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
|
|
357462
|
-
var
|
|
357463
|
-
|
|
357464
|
-
|
|
357580
|
+
var init_create_super_doc_ui_B_QEvuPe_es = __esm(() => {
|
|
357581
|
+
init_SuperConverter_DIgF4xk__es();
|
|
357582
|
+
init_create_headless_toolbar_BT4yIoZ_es();
|
|
357465
357583
|
DEFAULT_TEXT_ALIGN_OPTIONS = [
|
|
357466
357584
|
{
|
|
357467
357585
|
label: "Left",
|
|
@@ -357752,15 +357870,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
357752
357870
|
|
|
357753
357871
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
357754
357872
|
var init_super_editor_es = __esm(() => {
|
|
357755
|
-
|
|
357756
|
-
|
|
357873
|
+
init_src_BrcexyXf_es();
|
|
357874
|
+
init_SuperConverter_DIgF4xk__es();
|
|
357757
357875
|
init_jszip_C49i9kUs_es();
|
|
357758
357876
|
init_xml_js_CqGKpaft_es();
|
|
357759
|
-
|
|
357877
|
+
init_create_headless_toolbar_BT4yIoZ_es();
|
|
357760
357878
|
init_constants_D9qj59G2_es();
|
|
357761
357879
|
init_unified_BDuVPlMu_es();
|
|
357762
357880
|
init_DocxZipper_BzS208BW_es();
|
|
357763
|
-
|
|
357881
|
+
init_create_super_doc_ui_B_QEvuPe_es();
|
|
357764
357882
|
init_ui_CGB3qmy3_es();
|
|
357765
357883
|
init_eventemitter3_UwU_CLPU_es();
|
|
357766
357884
|
init_errors_C_DoKMoN_es();
|
|
@@ -391366,6 +391484,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
|
|
|
391366
391484
|
var init_shapes = __esm(() => {
|
|
391367
391485
|
init_src();
|
|
391368
391486
|
init_utilities();
|
|
391487
|
+
init_attributes();
|
|
391369
391488
|
init_paragraph2();
|
|
391370
391489
|
WRAP_TYPES2 = new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
391371
391490
|
WRAP_TEXT_VALUES2 = new Set(["bothSides", "left", "right", "largest"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/mcp",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.47",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@types/bun": "^1.3.8",
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
|
-
"@superdoc/super-editor": "0.0.1",
|
|
23
22
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
23
|
+
"@superdoc/super-editor": "0.0.1",
|
|
24
24
|
"superdoc": "1.43.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|