@superdoc-dev/mcp 0.12.0-next.45 → 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 +382 -135
- package/package.json +3 -3
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")
|
|
@@ -72321,6 +72321,7 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
|
|
|
72321
72321
|
const context = getParagraphRunContext($pos, editor);
|
|
72322
72322
|
const currentRunProperties = context?.runProperties || null;
|
|
72323
72323
|
const cursorMarks = $pos.marks();
|
|
72324
|
+
const directMarkRunProperties = decodeRPrFromMarks(cursorMarks);
|
|
72324
72325
|
const hasStoredMarks = storedMarks !== null;
|
|
72325
72326
|
const hasExplicitEmptyStoredMarks = hasStoredMarks && storedMarks.length === 0;
|
|
72326
72327
|
const resolvedMarks = [];
|
|
@@ -72348,7 +72349,9 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
|
|
|
72348
72349
|
inlineMarks: [],
|
|
72349
72350
|
resolvedRunProperties: {},
|
|
72350
72351
|
inlineRunProperties: {},
|
|
72351
|
-
styleRunProperties: {}
|
|
72352
|
+
styleRunProperties: {},
|
|
72353
|
+
directMarkRunProperties: {},
|
|
72354
|
+
mixedRunProperties: null
|
|
72352
72355
|
};
|
|
72353
72356
|
const resolvedFromSelection = getInheritedRunProperties($pos, editor, preferParagraphRunProperties || !hasStoredMarks && context?.isEmpty ? context?.paragraphAttrs?.paragraphProperties?.runProperties || null : inlineRunProperties);
|
|
72354
72357
|
const resolvedRunProperties = resolvedFromSelection?.resolvedRunProperties ?? inlineRunProperties;
|
|
@@ -72362,7 +72365,9 @@ function getFormattingStateAtPos(state, pos, editor, options = {}) {
|
|
|
72362
72365
|
inlineMarks,
|
|
72363
72366
|
resolvedRunProperties,
|
|
72364
72367
|
inlineRunProperties,
|
|
72365
|
-
styleRunProperties
|
|
72368
|
+
styleRunProperties,
|
|
72369
|
+
directMarkRunProperties,
|
|
72370
|
+
mixedRunProperties: null
|
|
72366
72371
|
};
|
|
72367
72372
|
}
|
|
72368
72373
|
function getFormattingStateForRange(state, from, to, editor) {
|
|
@@ -72382,9 +72387,14 @@ function getFormattingStateForRange(state, from, to, editor) {
|
|
|
72382
72387
|
return aggregateFormattingSegments(state, editor, segments);
|
|
72383
72388
|
}
|
|
72384
72389
|
function aggregateFormattingSegments(state, editor, segments) {
|
|
72385
|
-
const
|
|
72386
|
-
const
|
|
72387
|
-
const
|
|
72390
|
+
const resolvedRunPropertiesList = segments.map((segment) => segment.resolvedRunProperties);
|
|
72391
|
+
const inlineRunPropertiesList = segments.map((segment) => segment.inlineRunProperties);
|
|
72392
|
+
const styleRunPropertiesList = segments.map((segment) => segment.styleRunProperties);
|
|
72393
|
+
const directMarkRunPropertiesList = segments.map((segment) => segment.directMarkRunProperties);
|
|
72394
|
+
const resolvedRunProperties = intersectRunProperties(resolvedRunPropertiesList);
|
|
72395
|
+
const inlineRunProperties = intersectRunProperties(inlineRunPropertiesList);
|
|
72396
|
+
const styleRunProperties = intersectRunProperties(styleRunPropertiesList);
|
|
72397
|
+
const directMarkRunProperties = intersectRunProperties(directMarkRunPropertiesList);
|
|
72388
72398
|
const resolvedMarks = createMarksFromRunProperties(state, resolvedRunProperties, editor);
|
|
72389
72399
|
const inlineMarks = createMarksFromRunProperties(state, inlineRunProperties, editor);
|
|
72390
72400
|
return {
|
|
@@ -72392,7 +72402,9 @@ function aggregateFormattingSegments(state, editor, segments) {
|
|
|
72392
72402
|
inlineMarks,
|
|
72393
72403
|
resolvedRunProperties,
|
|
72394
72404
|
inlineRunProperties,
|
|
72395
|
-
styleRunProperties
|
|
72405
|
+
styleRunProperties,
|
|
72406
|
+
directMarkRunProperties,
|
|
72407
|
+
mixedRunProperties: getMixedRunProperties(resolvedRunPropertiesList, directMarkRunPropertiesList)
|
|
72396
72408
|
};
|
|
72397
72409
|
}
|
|
72398
72410
|
function mergeResolvedMarksWithInlineFallback(resolvedMarks, inlineMarks) {
|
|
@@ -72417,6 +72429,41 @@ function intersectRunProperties(runPropertiesList) {
|
|
|
72417
72429
|
});
|
|
72418
72430
|
return Object.keys(intersection3).length ? intersection3 : null;
|
|
72419
72431
|
}
|
|
72432
|
+
function getMixedRunProperties(runPropertiesList, directRunPropertiesList = []) {
|
|
72433
|
+
const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
|
|
72434
|
+
if (filtered.length <= 1)
|
|
72435
|
+
return null;
|
|
72436
|
+
const keys$1 = new Set(filtered.flatMap((props) => Object.keys(props)));
|
|
72437
|
+
const mixed = {};
|
|
72438
|
+
keys$1.forEach((key) => {
|
|
72439
|
+
if (key === "fontFamily" && hasUniformDirectFontFamily(directRunPropertiesList))
|
|
72440
|
+
return;
|
|
72441
|
+
const values = filtered.map((props) => Object.prototype.hasOwnProperty.call(props, key) ? props[key] : undefined);
|
|
72442
|
+
const first = JSON.stringify(values[0]);
|
|
72443
|
+
if (values.some((value) => JSON.stringify(value) !== first))
|
|
72444
|
+
mixed[key] = true;
|
|
72445
|
+
});
|
|
72446
|
+
return Object.keys(mixed).length ? mixed : null;
|
|
72447
|
+
}
|
|
72448
|
+
function hasUniformDirectFontFamily(runPropertiesList) {
|
|
72449
|
+
if (runPropertiesList.length <= 1)
|
|
72450
|
+
return false;
|
|
72451
|
+
let firstValue;
|
|
72452
|
+
let hasFirstValue = false;
|
|
72453
|
+
for (const props of runPropertiesList) {
|
|
72454
|
+
if (!props || typeof props !== "object" || !Object.prototype.hasOwnProperty.call(props, "fontFamily"))
|
|
72455
|
+
return false;
|
|
72456
|
+
const value = props.fontFamily;
|
|
72457
|
+
if (!hasFirstValue) {
|
|
72458
|
+
firstValue = value;
|
|
72459
|
+
hasFirstValue = true;
|
|
72460
|
+
continue;
|
|
72461
|
+
}
|
|
72462
|
+
if (JSON.stringify(value) !== JSON.stringify(firstValue))
|
|
72463
|
+
return false;
|
|
72464
|
+
}
|
|
72465
|
+
return hasFirstValue;
|
|
72466
|
+
}
|
|
72420
72467
|
function getInheritedRunProperties($pos, editor, inlineRunProperties) {
|
|
72421
72468
|
if (!editor)
|
|
72422
72469
|
return {
|
|
@@ -87003,34 +87050,62 @@ function hydrateImageBlocks(blocks, mediaFiles) {
|
|
|
87003
87050
|
if (blk.kind === "drawing") {
|
|
87004
87051
|
const drawingBlock = blk;
|
|
87005
87052
|
if (drawingBlock.drawingKind === "vectorShape" || drawingBlock.drawingKind === "textboxShape") {
|
|
87006
|
-
|
|
87007
|
-
|
|
87008
|
-
|
|
87009
|
-
|
|
87010
|
-
|
|
87011
|
-
|
|
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
|
+
}
|
|
87012
87095
|
return part;
|
|
87013
|
-
|
|
87014
|
-
if (
|
|
87015
|
-
|
|
87016
|
-
|
|
87017
|
-
...
|
|
87018
|
-
|
|
87096
|
+
});
|
|
87097
|
+
if (partsChanged) {
|
|
87098
|
+
blockChanged = true;
|
|
87099
|
+
nextBlock = {
|
|
87100
|
+
...nextBlock,
|
|
87101
|
+
textContent: {
|
|
87102
|
+
...nextBlock.textContent,
|
|
87103
|
+
parts: hydratedParts
|
|
87104
|
+
}
|
|
87019
87105
|
};
|
|
87020
87106
|
}
|
|
87021
|
-
return part;
|
|
87022
|
-
});
|
|
87023
|
-
if (partsChanged) {
|
|
87024
|
-
const vectorShapeBlock = drawingBlock;
|
|
87025
|
-
return {
|
|
87026
|
-
...vectorShapeBlock,
|
|
87027
|
-
textContent: {
|
|
87028
|
-
...vectorShapeBlock.textContent,
|
|
87029
|
-
parts: hydratedParts
|
|
87030
|
-
}
|
|
87031
|
-
};
|
|
87032
87107
|
}
|
|
87033
|
-
return blk;
|
|
87108
|
+
return blockChanged ? nextBlock : blk;
|
|
87034
87109
|
}
|
|
87035
87110
|
if (drawingBlock.drawingKind !== "shapeGroup")
|
|
87036
87111
|
return blk;
|
|
@@ -89195,6 +89270,7 @@ function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
|
89195
89270
|
const textContent = shapeTextboxNode ? extractTextboxTextContent(shapeTextboxNode) : undefined;
|
|
89196
89271
|
return buildDrawingBlock({
|
|
89197
89272
|
...rawAttrs,
|
|
89273
|
+
...resolveInlineAlignmentFromWrapper(rawAttrs),
|
|
89198
89274
|
...textContent ? { textContent } : {},
|
|
89199
89275
|
...rawAttrs.textAlign == null && textContent?.horizontalAlign ? { textAlign: textContent.horizontalAlign } : {},
|
|
89200
89276
|
...rawAttrs.textInsets == null ? { textInsets: resolveTextboxInsetsFromAttrs(textboxAttrs) } : {},
|
|
@@ -117414,6 +117490,37 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
|
|
|
117414
117490
|
required2.bottom = Math.max(required2.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
|
|
117415
117491
|
}
|
|
117416
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;
|
|
117417
117524
|
}, getAttrs$1 = (node2) => {
|
|
117418
117525
|
return isPlainObject4(node2.attrs) ? { ...node2.attrs } : {};
|
|
117419
117526
|
}, parseFullWidth = (value) => {
|
|
@@ -118716,7 +118823,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
|
|
|
118716
118823
|
state.kern = kernNode.attributes["w:val"];
|
|
118717
118824
|
}
|
|
118718
118825
|
}, SuperConverter;
|
|
118719
|
-
var
|
|
118826
|
+
var init_SuperConverter_DIgF4xk__es = __esm(() => {
|
|
118720
118827
|
init_rolldown_runtime_Bg48TavK_es();
|
|
118721
118828
|
init_jszip_C49i9kUs_es();
|
|
118722
118829
|
init_xml_js_CqGKpaft_es();
|
|
@@ -147642,7 +147749,7 @@ var init_SuperConverter_x_mSI6o_es = __esm(() => {
|
|
|
147642
147749
|
};
|
|
147643
147750
|
});
|
|
147644
147751
|
|
|
147645
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
147752
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT4yIoZ-.es.js
|
|
147646
147753
|
function parseSizeUnit(val = "0") {
|
|
147647
147754
|
const length = val.toString() || "0";
|
|
147648
147755
|
const value = Number.parseFloat(length);
|
|
@@ -157607,6 +157714,14 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
157607
157714
|
if (!rawActiveMark || !hasFormattingAttrs(rawActiveMark))
|
|
157608
157715
|
return false;
|
|
157609
157716
|
return isNegatedMark(rawActiveMark.name, rawActiveMark.attrs);
|
|
157717
|
+
}, getPrimaryFontFamily = (value) => {
|
|
157718
|
+
if (typeof value === "string")
|
|
157719
|
+
return value.split(",")[0].trim();
|
|
157720
|
+
if (!value || typeof value !== "object")
|
|
157721
|
+
return null;
|
|
157722
|
+
const fontFamily = value;
|
|
157723
|
+
const primary = fontFamily.ascii ?? fontFamily.hAnsi ?? fontFamily.eastAsia ?? fontFamily.cs;
|
|
157724
|
+
return typeof primary === "string" ? primary.split(",")[0].trim() : null;
|
|
157610
157725
|
}, isFormatCommandsStorage = (value) => {
|
|
157611
157726
|
return typeof value === "object" && value !== null && "storedStyle" in value;
|
|
157612
157727
|
}, hasStoredCopyFormat = (context) => {
|
|
@@ -157699,15 +157814,20 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
157699
157814
|
disabled: true,
|
|
157700
157815
|
value: null
|
|
157701
157816
|
};
|
|
157702
|
-
const
|
|
157817
|
+
const values = getFormattingAttr(formatting, "fontFamily", "fontFamily");
|
|
157818
|
+
const selectionFormattingState = stateEditor?.state?.selection?.empty === false ? getSelectionFormattingState(stateEditor.state, stateEditor) : null;
|
|
157819
|
+
const normalizedValues = values.map((value$1) => normalizeFontFamilyValue(value$1));
|
|
157703
157820
|
const uniqueValues = [...new Set(normalizedValues)];
|
|
157704
|
-
const
|
|
157821
|
+
const hasDirectValue = uniqueValues.length > 0;
|
|
157822
|
+
const hasMixedFontFamily = Boolean(selectionFormattingState?.mixedRunProperties?.fontFamily);
|
|
157823
|
+
const directSelectionValue = normalizeFontFamilyValue(getPrimaryFontFamily(selectionFormattingState?.directMarkRunProperties?.fontFamily));
|
|
157824
|
+
const canUseLinkedStyle = !hasDirectValue && !hasMixedFontFamily && isFormattingActivatedFromLinkedStyle(context, "font-family");
|
|
157705
157825
|
const paragraphProps = canUseLinkedStyle ? getCurrentResolvedParagraphProperties(context) : null;
|
|
157706
157826
|
const documentEditor = context?.presentationEditor?.editor ?? context?.editor ?? null;
|
|
157707
157827
|
const linkedStyleValue = normalizeFontFamilyValue((canUseLinkedStyle ? documentEditor?.converter?.linkedStyles?.find((style) => style.id === paragraphProps?.styleId) : null)?.definition?.styles?.["font-family"]) ?? null;
|
|
157708
|
-
const value = uniqueValues.length === 1 ? uniqueValues[0] : linkedStyleValue;
|
|
157828
|
+
const value = hasMixedFontFamily ? null : directSelectionValue || (uniqueValues.length === 1 ? uniqueValues[0] : linkedStyleValue);
|
|
157709
157829
|
return {
|
|
157710
|
-
active: uniqueValues.length > 0 || linkedStyleValue != null,
|
|
157830
|
+
active: hasMixedFontFamily || uniqueValues.length > 0 || directSelectionValue != null || linkedStyleValue != null,
|
|
157711
157831
|
disabled: false,
|
|
157712
157832
|
value
|
|
157713
157833
|
};
|
|
@@ -158432,9 +158552,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
|
|
|
158432
158552
|
}
|
|
158433
158553
|
};
|
|
158434
158554
|
};
|
|
158435
|
-
var
|
|
158555
|
+
var init_create_headless_toolbar_BT4yIoZ_es = __esm(() => {
|
|
158436
158556
|
init_rolldown_runtime_Bg48TavK_es();
|
|
158437
|
-
|
|
158557
|
+
init_SuperConverter_DIgF4xk__es();
|
|
158438
158558
|
init_jszip_C49i9kUs_es();
|
|
158439
158559
|
init_uuid_B2wVPhPi_es();
|
|
158440
158560
|
init_constants_D9qj59G2_es();
|
|
@@ -214048,7 +214168,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
|
|
|
214048
214168
|
init_remark_gfm_BUJjZJLy_es();
|
|
214049
214169
|
});
|
|
214050
214170
|
|
|
214051
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
214171
|
+
// ../../packages/superdoc/dist/chunks/src-BrcexyXf.es.js
|
|
214052
214172
|
function deleteProps(obj, propOrProps) {
|
|
214053
214173
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
214054
214174
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -259219,7 +259339,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
|
|
|
259219
259339
|
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
259220
259340
|
const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
|
|
259221
259341
|
const rawWrap = attrs?.wrap;
|
|
259222
|
-
const
|
|
259342
|
+
const isInlineAlignableDrawing = (block.drawingKind === "shapeGroup" || block.drawingKind === "textboxShape") && rawWrap?.type === "Inline";
|
|
259223
259343
|
const inlineParagraphAlignment = attrs?.inlineParagraphAlignment === "center" || attrs?.inlineParagraphAlignment === "right" ? attrs.inlineParagraphAlignment : undefined;
|
|
259224
259344
|
if (width > maxWidthForBlock && maxWidthForBlock > 0) {
|
|
259225
259345
|
const scale = maxWidthForBlock / width;
|
|
@@ -259238,7 +259358,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
|
|
|
259238
259358
|
state = advanceColumn(state);
|
|
259239
259359
|
const pmRange = extractBlockPmRange(block);
|
|
259240
259360
|
let x = columnX(state) + marginLeft + indentLeft;
|
|
259241
|
-
if (
|
|
259361
|
+
if (isInlineAlignableDrawing && inlineParagraphAlignment) {
|
|
259242
259362
|
const pIndentLeft = typeof attrs?.paragraphIndentLeft === "number" ? attrs.paragraphIndentLeft : 0;
|
|
259243
259363
|
const pIndentRight = typeof attrs?.paragraphIndentRight === "number" ? attrs.paragraphIndentRight : 0;
|
|
259244
259364
|
const alignBox = Math.max(0, maxWidthForBlock - pIndentLeft - pIndentRight);
|
|
@@ -263563,6 +263683,17 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
263563
263683
|
endChar = text5.length > 0 ? text5.length : start$1 + 1;
|
|
263564
263684
|
continue;
|
|
263565
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
|
+
}
|
|
263566
263697
|
for (let c = start$1;c < text5.length; c += 1) {
|
|
263567
263698
|
const ch = text5[c];
|
|
263568
263699
|
if (ch === "\t") {
|
|
@@ -263651,6 +263782,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
263651
263782
|
endRun = startRun;
|
|
263652
263783
|
endChar = startChar + 1;
|
|
263653
263784
|
}
|
|
263785
|
+
const lineMaxAtomicHeight = getLineMaxAtomicHeight(runs2, startRun, startChar, endRun, endChar);
|
|
263654
263786
|
const line = {
|
|
263655
263787
|
fromRun: startRun,
|
|
263656
263788
|
fromChar: startChar,
|
|
@@ -263659,8 +263791,9 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
263659
263791
|
width,
|
|
263660
263792
|
ascent: 0,
|
|
263661
263793
|
descent: 0,
|
|
263662
|
-
lineHeight: lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize),
|
|
263663
|
-
maxWidth: effectiveMaxWidth
|
|
263794
|
+
lineHeight: Math.max(lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize), lineMaxAtomicHeight),
|
|
263795
|
+
maxWidth: effectiveMaxWidth,
|
|
263796
|
+
...lineMaxAtomicHeight > 0 ? { maxImageHeight: lineMaxAtomicHeight } : {}
|
|
263664
263797
|
};
|
|
263665
263798
|
lines.push(line);
|
|
263666
263799
|
if (lineMaxTextFontSize > 0)
|
|
@@ -272372,14 +272505,14 @@ function capitalizeText$1(text5, fullText, startOffset) {
|
|
|
272372
272505
|
return result;
|
|
272373
272506
|
}
|
|
272374
272507
|
function measureFieldAnnotationWidth(run2, fontContext) {
|
|
272375
|
-
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;
|
|
272376
272509
|
const font = buildFontString$1({
|
|
272377
272510
|
fontFamily: normalizeFontFamily$1(run2.fontFamily ?? "Arial"),
|
|
272378
272511
|
fontSize,
|
|
272379
272512
|
bold: run2.bold,
|
|
272380
272513
|
italic: run2.italic
|
|
272381
272514
|
}, fontContext);
|
|
272382
|
-
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);
|
|
272383
272516
|
}
|
|
272384
272517
|
function isExplicitLineBreakRun(run2) {
|
|
272385
272518
|
return run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line";
|
|
@@ -272565,6 +272698,15 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
272565
272698
|
endRunIndex: runs2.length
|
|
272566
272699
|
};
|
|
272567
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
|
+
};
|
|
272568
272710
|
for (let i3 = startRunIndex;i3 < runs2.length; i3++) {
|
|
272569
272711
|
const run2 = runs2[i3];
|
|
272570
272712
|
if (isTabRun(run2)) {
|
|
@@ -272606,40 +272748,13 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
272606
272748
|
});
|
|
272607
272749
|
continue;
|
|
272608
272750
|
}
|
|
272609
|
-
if (isImageRun(run2)) {
|
|
272610
|
-
const
|
|
272611
|
-
const rightSpace = run2.distRight ?? 0;
|
|
272612
|
-
const imageWidth = run2.width + leftSpace + rightSpace;
|
|
272613
|
-
result.runs.push({
|
|
272614
|
-
runIndex: i3,
|
|
272615
|
-
width: imageWidth
|
|
272616
|
-
});
|
|
272617
|
-
result.totalWidth += imageWidth;
|
|
272618
|
-
continue;
|
|
272619
|
-
}
|
|
272620
|
-
if (run2.kind === "math") {
|
|
272621
|
-
const mathWidth = run2.width ?? 20;
|
|
272751
|
+
if (isImageRun(run2) || run2.kind === "math" || isFieldAnnotationRun(run2)) {
|
|
272752
|
+
const { width } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
272622
272753
|
result.runs.push({
|
|
272623
272754
|
runIndex: i3,
|
|
272624
|
-
width
|
|
272625
|
-
});
|
|
272626
|
-
result.totalWidth += mathWidth;
|
|
272627
|
-
continue;
|
|
272628
|
-
}
|
|
272629
|
-
if (isFieldAnnotationRun(run2)) {
|
|
272630
|
-
const fontSize = run2.fontSize ?? DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
272631
|
-
const { font } = buildFontString({
|
|
272632
|
-
fontFamily: run2.fontFamily ?? "Arial",
|
|
272633
|
-
fontSize,
|
|
272634
|
-
bold: run2.bold,
|
|
272635
|
-
italic: run2.italic
|
|
272636
|
-
}, fontContext);
|
|
272637
|
-
const pillWidth = (run2.displayLabel ? measureRunWidth(run2.displayLabel, font, ctx$1, run2, 0) : 0) + FIELD_ANNOTATION_PILL_PADDING;
|
|
272638
|
-
result.runs.push({
|
|
272639
|
-
runIndex: i3,
|
|
272640
|
-
width: pillWidth
|
|
272755
|
+
width
|
|
272641
272756
|
});
|
|
272642
|
-
result.totalWidth +=
|
|
272757
|
+
result.totalWidth += width;
|
|
272643
272758
|
continue;
|
|
272644
272759
|
}
|
|
272645
272760
|
result.runs.push({
|
|
@@ -272669,6 +272784,13 @@ async function measureBlock(block, constraints, fontContext = DEFAULT_FONT_MEASU
|
|
|
272669
272784
|
}
|
|
272670
272785
|
async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
272671
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
|
+
};
|
|
272672
272794
|
const wordLayout = block.attrs?.wordLayout;
|
|
272673
272795
|
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
272674
272796
|
const fallbackFontSize = normalizeFontSize2((firstTextRunWithSize ?? block.runs.find((run2) => typeof run2.fontSize === "number" && run2.fontSize > 0))?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
|
|
@@ -273198,12 +273320,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
|
273198
273320
|
continue;
|
|
273199
273321
|
}
|
|
273200
273322
|
if (isImageRun(run2)) {
|
|
273201
|
-
const
|
|
273202
|
-
const rightSpace = run2.distRight ?? 0;
|
|
273203
|
-
const imageWidth = run2.width + leftSpace + rightSpace;
|
|
273204
|
-
const topSpace = run2.distTop ?? 0;
|
|
273205
|
-
const bottomSpace = run2.distBottom ?? 0;
|
|
273206
|
-
const imageHeight = run2.height + topSpace + bottomSpace;
|
|
273323
|
+
const { width: imageWidth, height: imageHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
273207
273324
|
let imageStartX;
|
|
273208
273325
|
if (activeTabGroup && currentLine) {
|
|
273209
273326
|
imageStartX = activeTabGroup.currentX;
|
|
@@ -273294,9 +273411,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
|
273294
273411
|
continue;
|
|
273295
273412
|
}
|
|
273296
273413
|
if (run2.kind === "math") {
|
|
273297
|
-
const
|
|
273298
|
-
const mathWidth = mathRun.width ?? 20;
|
|
273299
|
-
const mathHeight = mathRun.height ?? 24;
|
|
273414
|
+
const { width: mathWidth, height: mathHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
273300
273415
|
if (!currentLine)
|
|
273301
273416
|
currentLine = {
|
|
273302
273417
|
fromRun: runIndex,
|
|
@@ -273333,26 +273448,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
|
273333
273448
|
continue;
|
|
273334
273449
|
}
|
|
273335
273450
|
if (isFieldAnnotationRun(run2)) {
|
|
273336
|
-
const
|
|
273337
|
-
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;
|
|
273338
|
-
const annotationFontFamily = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
|
|
273339
|
-
const fontWeight = run2.bold ? "bold" : "normal";
|
|
273340
|
-
ctx$1.font = `${run2.italic ? "italic" : "normal"} ${fontWeight} ${annotationFontSize}px ${annotationFontFamily}`;
|
|
273341
|
-
const textWidth = displayText ? ctx$1.measureText(displayText).width : 0;
|
|
273342
|
-
const annotationHorizontalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING;
|
|
273343
|
-
const annotationVerticalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_VERTICAL_PADDING;
|
|
273344
|
-
const annotationWidth = textWidth + annotationHorizontalPadding;
|
|
273345
|
-
let annotationHeight = annotationFontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + annotationVerticalPadding;
|
|
273346
|
-
if (run2.variant === "signature" && run2.imageSrc) {
|
|
273347
|
-
const signatureHeight = 28 + annotationVerticalPadding;
|
|
273348
|
-
annotationHeight = Math.max(annotationHeight, signatureHeight);
|
|
273349
|
-
}
|
|
273350
|
-
if (run2.variant === "image" && run2.imageSrc && run2.size?.height) {
|
|
273351
|
-
const imageHeight = run2.size.height + annotationVerticalPadding;
|
|
273352
|
-
annotationHeight = Math.max(annotationHeight, imageHeight);
|
|
273353
|
-
}
|
|
273354
|
-
if (run2.variant === "html" && run2.size?.height)
|
|
273355
|
-
annotationHeight = Math.max(annotationHeight, run2.size.height);
|
|
273451
|
+
const { width: annotationWidth, height: annotationHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
|
|
273356
273452
|
let annotationStartX;
|
|
273357
273453
|
if (pendingTabAlignment && currentLine)
|
|
273358
273454
|
annotationStartX = alignPendingTabForWidth(annotationWidth);
|
|
@@ -290713,7 +290809,12 @@ var Node$13 = class Node$14 {
|
|
|
290713
290809
|
suppressActiveHighlight: true,
|
|
290714
290810
|
attributes: { ariaLabel: "Font family" },
|
|
290715
290811
|
options: fontOptions,
|
|
290716
|
-
onActivate: ({ fontFamily }) => {
|
|
290812
|
+
onActivate: ({ fontFamily } = {}, isMultiple = false) => {
|
|
290813
|
+
if (isMultiple) {
|
|
290814
|
+
fontButton.label.value = "";
|
|
290815
|
+
fontButton.selectedValue.value = "";
|
|
290816
|
+
return;
|
|
290817
|
+
}
|
|
290717
290818
|
if (!fontFamily)
|
|
290718
290819
|
return;
|
|
290719
290820
|
fontFamily = fontFamily.split(",")[0];
|
|
@@ -297261,7 +297362,7 @@ menclose::after {
|
|
|
297261
297362
|
left: borders.right,
|
|
297262
297363
|
right: borders.left
|
|
297263
297364
|
};
|
|
297264
|
-
}, getFiniteNumber = (value) => {
|
|
297365
|
+
}, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, getFiniteNumber = (value) => {
|
|
297265
297366
|
if (typeof value !== "number" || !Number.isFinite(value))
|
|
297266
297367
|
return;
|
|
297267
297368
|
return value;
|
|
@@ -305769,7 +305870,51 @@ menclose::after {
|
|
|
305769
305870
|
getStats() {
|
|
305770
305871
|
return this.cache.getStats();
|
|
305771
305872
|
}
|
|
305772
|
-
}, 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) => {
|
|
305773
305918
|
if (!char)
|
|
305774
305919
|
return false;
|
|
305775
305920
|
const code6 = char.charCodeAt(0);
|
|
@@ -305798,6 +305943,26 @@ menclose::after {
|
|
|
305798
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) => {
|
|
305799
305944
|
const width = run2.width;
|
|
305800
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;
|
|
305801
305966
|
}, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
|
|
305802
305967
|
const size$1 = run2?.fontSize ?? 16;
|
|
305803
305968
|
const family2 = run2?.fontFamily ?? "Arial";
|
|
@@ -305870,7 +306035,7 @@ menclose::after {
|
|
|
305870
306035
|
};
|
|
305871
306036
|
const text5 = runText(run2);
|
|
305872
306037
|
if (!text5) {
|
|
305873
|
-
const runWidth = getRunWidth(run2);
|
|
306038
|
+
const runWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
|
|
305874
306039
|
if (runWidth > 0) {
|
|
305875
306040
|
totalWidth += runWidth;
|
|
305876
306041
|
endRun = r$1;
|
|
@@ -305929,7 +306094,7 @@ menclose::after {
|
|
|
305929
306094
|
break;
|
|
305930
306095
|
const text5 = runText(run2);
|
|
305931
306096
|
if (!text5) {
|
|
305932
|
-
totalWidth += getRunWidth(run2);
|
|
306097
|
+
totalWidth += isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
|
|
305933
306098
|
continue;
|
|
305934
306099
|
}
|
|
305935
306100
|
const sliceStart = r$1 === startRunIndex ? startChar : 0;
|
|
@@ -306107,7 +306272,21 @@ menclose::after {
|
|
|
306107
306272
|
}
|
|
306108
306273
|
const text5 = runText(run2);
|
|
306109
306274
|
if (!text5) {
|
|
306110
|
-
|
|
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;
|
|
306111
306290
|
lineWidth = Math.max(lineWidth, cursorX);
|
|
306112
306291
|
continue;
|
|
306113
306292
|
}
|
|
@@ -311525,7 +311704,7 @@ menclose::after {
|
|
|
311525
311704
|
}
|
|
311526
311705
|
}, EMUS_PER_INCH = 914400, maxSize = 5000, cache, makeKey = (text5, font, letterSpacing) => {
|
|
311527
311706
|
return `${text5}|${font}|${letterSpacing || 0}`;
|
|
311528
|
-
}, 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 {
|
|
311529
311708
|
constructor(maxSize$1) {
|
|
311530
311709
|
this.cache = /* @__PURE__ */ new Map;
|
|
311531
311710
|
this.maxSize = maxSize$1;
|
|
@@ -311559,7 +311738,7 @@ menclose::after {
|
|
|
311559
311738
|
this.cache.delete(oldestKey);
|
|
311560
311739
|
}
|
|
311561
311740
|
}
|
|
311562
|
-
}, 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) => {
|
|
311563
311742
|
if (isValidFontSize(value))
|
|
311564
311743
|
return value;
|
|
311565
311744
|
if (typeof value === "string") {
|
|
@@ -314131,13 +314310,13 @@ menclose::after {
|
|
|
314131
314310
|
return;
|
|
314132
314311
|
console.log(...args$1);
|
|
314133
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;
|
|
314134
|
-
var
|
|
314313
|
+
var init_src_BrcexyXf_es = __esm(() => {
|
|
314135
314314
|
init_rolldown_runtime_Bg48TavK_es();
|
|
314136
|
-
|
|
314315
|
+
init_SuperConverter_DIgF4xk__es();
|
|
314137
314316
|
init_jszip_C49i9kUs_es();
|
|
314138
314317
|
init_xml_js_CqGKpaft_es();
|
|
314139
314318
|
init_uuid_B2wVPhPi_es();
|
|
314140
|
-
|
|
314319
|
+
init_create_headless_toolbar_BT4yIoZ_es();
|
|
314141
314320
|
init_constants_D9qj59G2_es();
|
|
314142
314321
|
init_unified_BDuVPlMu_es();
|
|
314143
314322
|
init_remark_gfm_BUJjZJLy_es();
|
|
@@ -320899,10 +321078,18 @@ ${err.toString()}`);
|
|
|
320899
321078
|
addCommands() {
|
|
320900
321079
|
return {
|
|
320901
321080
|
setFontFamily: (fontFamily) => ({ chain }) => {
|
|
320902
|
-
return chain().setMark("textStyle", {
|
|
321081
|
+
return chain().setMark("textStyle", {
|
|
321082
|
+
fontFamily,
|
|
321083
|
+
eastAsiaFontFamily: null,
|
|
321084
|
+
csFontFamily: null
|
|
321085
|
+
}).run();
|
|
320903
321086
|
},
|
|
320904
321087
|
unsetFontFamily: () => ({ chain }) => {
|
|
320905
|
-
return chain().setMark("textStyle", {
|
|
321088
|
+
return chain().setMark("textStyle", {
|
|
321089
|
+
fontFamily: null,
|
|
321090
|
+
eastAsiaFontFamily: null,
|
|
321091
|
+
csFontFamily: null
|
|
321092
|
+
}).removeEmptyTextStyle().run();
|
|
320906
321093
|
}
|
|
320907
321094
|
};
|
|
320908
321095
|
}
|
|
@@ -327339,6 +327526,10 @@ ${err.toString()}`);
|
|
|
327339
327526
|
return { style: attrs.style };
|
|
327340
327527
|
} },
|
|
327341
327528
|
wrapAttributes: { rendered: false },
|
|
327529
|
+
wrapperParagraph: {
|
|
327530
|
+
default: null,
|
|
327531
|
+
rendered: false
|
|
327532
|
+
},
|
|
327342
327533
|
anchorData: { rendered: false },
|
|
327343
327534
|
marginOffset: { rendered: false },
|
|
327344
327535
|
attributes: { rendered: false },
|
|
@@ -344067,7 +344258,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344067
344258
|
return null;
|
|
344068
344259
|
return getParagraphFontFamilyFromProperties(calculateResolvedParagraphProperties(this.activeEditor, paragraphParent.node, state.doc.resolve(paragraphParent.pos)), this.activeEditor?.converter?.convertedXml ?? {}) || null;
|
|
344069
344260
|
}
|
|
344070
|
-
#
|
|
344261
|
+
#isMixedState(commandState) {
|
|
344071
344262
|
return Boolean(commandState?.active) && commandState?.value == null;
|
|
344072
344263
|
}
|
|
344073
344264
|
#applyHeadlessState(item) {
|
|
@@ -344111,6 +344302,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344111
344302
|
item.activate({ fontFamily: commandState.value });
|
|
344112
344303
|
return;
|
|
344113
344304
|
}
|
|
344305
|
+
if (this.#isMixedState(commandState)) {
|
|
344306
|
+
item.activate({}, true);
|
|
344307
|
+
return;
|
|
344308
|
+
}
|
|
344114
344309
|
const fallbackFontFamily = this.#getFontFamilyFallbackValue();
|
|
344115
344310
|
if (fallbackFontFamily) {
|
|
344116
344311
|
item.activate({ fontFamily: fallbackFontFamily });
|
|
@@ -344123,7 +344318,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344123
344318
|
item.activate({ fontSize: commandState.value });
|
|
344124
344319
|
return;
|
|
344125
344320
|
}
|
|
344126
|
-
if (this.#
|
|
344321
|
+
if (this.#isMixedState(commandState)) {
|
|
344127
344322
|
item.activate({}, true);
|
|
344128
344323
|
return;
|
|
344129
344324
|
}
|
|
@@ -357380,11 +357575,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357380
357575
|
]);
|
|
357381
357576
|
});
|
|
357382
357577
|
|
|
357383
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
357578
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-B-QEvuPe.es.js
|
|
357384
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;
|
|
357385
|
-
var
|
|
357386
|
-
|
|
357387
|
-
|
|
357580
|
+
var init_create_super_doc_ui_B_QEvuPe_es = __esm(() => {
|
|
357581
|
+
init_SuperConverter_DIgF4xk__es();
|
|
357582
|
+
init_create_headless_toolbar_BT4yIoZ_es();
|
|
357388
357583
|
DEFAULT_TEXT_ALIGN_OPTIONS = [
|
|
357389
357584
|
{
|
|
357390
357585
|
label: "Left",
|
|
@@ -357675,15 +357870,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
357675
357870
|
|
|
357676
357871
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
357677
357872
|
var init_super_editor_es = __esm(() => {
|
|
357678
|
-
|
|
357679
|
-
|
|
357873
|
+
init_src_BrcexyXf_es();
|
|
357874
|
+
init_SuperConverter_DIgF4xk__es();
|
|
357680
357875
|
init_jszip_C49i9kUs_es();
|
|
357681
357876
|
init_xml_js_CqGKpaft_es();
|
|
357682
|
-
|
|
357877
|
+
init_create_headless_toolbar_BT4yIoZ_es();
|
|
357683
357878
|
init_constants_D9qj59G2_es();
|
|
357684
357879
|
init_unified_BDuVPlMu_es();
|
|
357685
357880
|
init_DocxZipper_BzS208BW_es();
|
|
357686
|
-
|
|
357881
|
+
init_create_super_doc_ui_B_QEvuPe_es();
|
|
357687
357882
|
init_ui_CGB3qmy3_es();
|
|
357688
357883
|
init_eventemitter3_UwU_CLPU_es();
|
|
357689
357884
|
init_errors_C_DoKMoN_es();
|
|
@@ -391289,6 +391484,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
|
|
|
391289
391484
|
var init_shapes = __esm(() => {
|
|
391290
391485
|
init_src();
|
|
391291
391486
|
init_utilities();
|
|
391487
|
+
init_attributes();
|
|
391292
391488
|
init_paragraph2();
|
|
391293
391489
|
WRAP_TYPES2 = new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
391294
391490
|
WRAP_TEXT_VALUES2 = new Set(["bothSides", "left", "right", "largest"]);
|
|
@@ -469684,6 +469880,7 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
469684
469880
|
const context = getParagraphRunContext2($pos, editor);
|
|
469685
469881
|
const currentRunProperties = context?.runProperties || null;
|
|
469686
469882
|
const cursorMarks = $pos.marks();
|
|
469883
|
+
const directMarkRunProperties = decodeRPrFromMarks2(cursorMarks);
|
|
469687
469884
|
const hasStoredMarks = storedMarks !== null;
|
|
469688
469885
|
const hasExplicitEmptyStoredMarks = hasStoredMarks && storedMarks.length === 0;
|
|
469689
469886
|
const resolvedMarks = [];
|
|
@@ -469711,7 +469908,9 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
469711
469908
|
inlineMarks: [],
|
|
469712
469909
|
resolvedRunProperties: {},
|
|
469713
469910
|
inlineRunProperties: {},
|
|
469714
|
-
styleRunProperties: {}
|
|
469911
|
+
styleRunProperties: {},
|
|
469912
|
+
directMarkRunProperties: {},
|
|
469913
|
+
mixedRunProperties: null
|
|
469715
469914
|
};
|
|
469716
469915
|
}
|
|
469717
469916
|
const resolvedFromSelection = getInheritedRunProperties2($pos, editor, preferParagraphRunProperties || !hasStoredMarks && context?.isEmpty ? context?.paragraphAttrs?.paragraphProperties?.runProperties || null : inlineRunProperties);
|
|
@@ -469727,7 +469926,9 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
469727
469926
|
inlineMarks,
|
|
469728
469927
|
resolvedRunProperties,
|
|
469729
469928
|
inlineRunProperties,
|
|
469730
|
-
styleRunProperties
|
|
469929
|
+
styleRunProperties,
|
|
469930
|
+
directMarkRunProperties,
|
|
469931
|
+
mixedRunProperties: null
|
|
469731
469932
|
};
|
|
469732
469933
|
}
|
|
469733
469934
|
function getFormattingStateForRange2(state, from4, to, editor) {
|
|
@@ -469748,9 +469949,14 @@ function getFormattingStateForRange2(state, from4, to, editor) {
|
|
|
469748
469949
|
return aggregateFormattingSegments2(state, editor, segments);
|
|
469749
469950
|
}
|
|
469750
469951
|
function aggregateFormattingSegments2(state, editor, segments) {
|
|
469751
|
-
const
|
|
469752
|
-
const
|
|
469753
|
-
const
|
|
469952
|
+
const resolvedRunPropertiesList = segments.map((segment) => segment.resolvedRunProperties);
|
|
469953
|
+
const inlineRunPropertiesList = segments.map((segment) => segment.inlineRunProperties);
|
|
469954
|
+
const styleRunPropertiesList = segments.map((segment) => segment.styleRunProperties);
|
|
469955
|
+
const directMarkRunPropertiesList = segments.map((segment) => segment.directMarkRunProperties);
|
|
469956
|
+
const resolvedRunProperties = intersectRunProperties2(resolvedRunPropertiesList);
|
|
469957
|
+
const inlineRunProperties = intersectRunProperties2(inlineRunPropertiesList);
|
|
469958
|
+
const styleRunProperties = intersectRunProperties2(styleRunPropertiesList);
|
|
469959
|
+
const directMarkRunProperties = intersectRunProperties2(directMarkRunPropertiesList);
|
|
469754
469960
|
const resolvedMarks = createMarksFromRunProperties2(state, resolvedRunProperties, editor);
|
|
469755
469961
|
const inlineMarks = createMarksFromRunProperties2(state, inlineRunProperties, editor);
|
|
469756
469962
|
return {
|
|
@@ -469758,7 +469964,9 @@ function aggregateFormattingSegments2(state, editor, segments) {
|
|
|
469758
469964
|
inlineMarks,
|
|
469759
469965
|
resolvedRunProperties,
|
|
469760
469966
|
inlineRunProperties,
|
|
469761
|
-
styleRunProperties
|
|
469967
|
+
styleRunProperties,
|
|
469968
|
+
directMarkRunProperties,
|
|
469969
|
+
mixedRunProperties: getMixedRunProperties2(resolvedRunPropertiesList, directMarkRunPropertiesList)
|
|
469762
469970
|
};
|
|
469763
469971
|
}
|
|
469764
469972
|
function mergeResolvedMarksWithInlineFallback2(resolvedMarks, inlineMarks) {
|
|
@@ -469784,6 +469992,45 @@ function intersectRunProperties2(runPropertiesList) {
|
|
|
469784
469992
|
});
|
|
469785
469993
|
return Object.keys(intersection3).length ? intersection3 : null;
|
|
469786
469994
|
}
|
|
469995
|
+
function getMixedRunProperties2(runPropertiesList, directRunPropertiesList = []) {
|
|
469996
|
+
const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
|
|
469997
|
+
if (filtered.length <= 1)
|
|
469998
|
+
return null;
|
|
469999
|
+
const keys7 = new Set(filtered.flatMap((props) => Object.keys(props)));
|
|
470000
|
+
const mixed = {};
|
|
470001
|
+
keys7.forEach((key2) => {
|
|
470002
|
+
if (key2 === "fontFamily" && hasUniformDirectFontFamily2(directRunPropertiesList)) {
|
|
470003
|
+
return;
|
|
470004
|
+
}
|
|
470005
|
+
const values2 = filtered.map((props) => Object.prototype.hasOwnProperty.call(props, key2) ? props[key2] : undefined);
|
|
470006
|
+
const first2 = JSON.stringify(values2[0]);
|
|
470007
|
+
if (values2.some((value) => JSON.stringify(value) !== first2)) {
|
|
470008
|
+
mixed[key2] = true;
|
|
470009
|
+
}
|
|
470010
|
+
});
|
|
470011
|
+
return Object.keys(mixed).length ? mixed : null;
|
|
470012
|
+
}
|
|
470013
|
+
function hasUniformDirectFontFamily2(runPropertiesList) {
|
|
470014
|
+
if (runPropertiesList.length <= 1)
|
|
470015
|
+
return false;
|
|
470016
|
+
let firstValue;
|
|
470017
|
+
let hasFirstValue = false;
|
|
470018
|
+
for (const props of runPropertiesList) {
|
|
470019
|
+
if (!props || typeof props !== "object" || !Object.prototype.hasOwnProperty.call(props, "fontFamily")) {
|
|
470020
|
+
return false;
|
|
470021
|
+
}
|
|
470022
|
+
const value = props.fontFamily;
|
|
470023
|
+
if (!hasFirstValue) {
|
|
470024
|
+
firstValue = value;
|
|
470025
|
+
hasFirstValue = true;
|
|
470026
|
+
continue;
|
|
470027
|
+
}
|
|
470028
|
+
if (JSON.stringify(value) !== JSON.stringify(firstValue)) {
|
|
470029
|
+
return false;
|
|
470030
|
+
}
|
|
470031
|
+
}
|
|
470032
|
+
return hasFirstValue;
|
|
470033
|
+
}
|
|
469787
470034
|
function getInheritedRunProperties2($pos, editor, inlineRunProperties) {
|
|
469788
470035
|
if (!editor) {
|
|
469789
470036
|
return {
|
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"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
22
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
23
|
-
"superdoc": "
|
|
24
|
-
"
|
|
23
|
+
"@superdoc/super-editor": "0.0.1",
|
|
24
|
+
"superdoc": "1.43.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|