@superdoc-dev/mcp 0.11.0-next.5 → 0.11.0-next.6
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/README.md +1 -1
- package/dist/index.js +378 -228
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Works with Claude Code, Claude Desktop, Cursor, Windsurf, and any MCP-compatible
|
|
|
10
10
|
npx @superdoc-dev/mcp
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The server
|
|
13
|
+
The server runs locally over stdio as a subprocess. You don't run it directly; your MCP client spawns it.
|
|
14
14
|
|
|
15
15
|
## Setup
|
|
16
16
|
|
package/dist/index.js
CHANGED
|
@@ -52208,7 +52208,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
52208
52208
|
emptyOptions2 = {};
|
|
52209
52209
|
});
|
|
52210
52210
|
|
|
52211
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
52211
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-BSMYiYJm.es.js
|
|
52212
52212
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
52213
52213
|
const fieldValue = extension$1.config[field];
|
|
52214
52214
|
if (typeof fieldValue === "function")
|
|
@@ -62157,6 +62157,70 @@ function computeFragmentPmRange(block, lines, fromLine, toLine) {
|
|
|
62157
62157
|
pmEnd
|
|
62158
62158
|
};
|
|
62159
62159
|
}
|
|
62160
|
+
function resolveAnchoredGraphicY(input) {
|
|
62161
|
+
const { anchor, objectHeight, contentTop, contentBottom, pageBottomMargin = 0, anchorParagraphY = contentTop, firstLineHeight = 0, preRegisteredFallbackToContentTop = false } = input;
|
|
62162
|
+
const offsetV = anchor?.offsetV ?? 0;
|
|
62163
|
+
const vRelativeFrom = anchor?.vRelativeFrom;
|
|
62164
|
+
const alignV = anchor?.alignV;
|
|
62165
|
+
const contentHeight = Math.max(0, contentBottom - contentTop);
|
|
62166
|
+
if (vRelativeFrom === "margin") {
|
|
62167
|
+
if (alignV === "bottom")
|
|
62168
|
+
return contentBottom - objectHeight + offsetV;
|
|
62169
|
+
if (alignV === "center")
|
|
62170
|
+
return contentTop + (contentHeight - objectHeight) / 2 + offsetV;
|
|
62171
|
+
return contentTop + offsetV;
|
|
62172
|
+
}
|
|
62173
|
+
if (vRelativeFrom === "page") {
|
|
62174
|
+
const pageHeight = contentBottom + pageBottomMargin;
|
|
62175
|
+
if (alignV === "bottom")
|
|
62176
|
+
return pageHeight - objectHeight + offsetV;
|
|
62177
|
+
if (alignV === "center")
|
|
62178
|
+
return (pageHeight - objectHeight) / 2 + offsetV;
|
|
62179
|
+
return offsetV;
|
|
62180
|
+
}
|
|
62181
|
+
if (vRelativeFrom === "paragraph") {
|
|
62182
|
+
if (preRegisteredFallbackToContentTop)
|
|
62183
|
+
return contentTop + offsetV;
|
|
62184
|
+
const baseAnchorY = anchorParagraphY;
|
|
62185
|
+
if (alignV === "bottom")
|
|
62186
|
+
return baseAnchorY + firstLineHeight - objectHeight + offsetV;
|
|
62187
|
+
if (alignV === "center")
|
|
62188
|
+
return baseAnchorY + (firstLineHeight - objectHeight) / 2 + offsetV;
|
|
62189
|
+
return baseAnchorY + offsetV;
|
|
62190
|
+
}
|
|
62191
|
+
if (preRegisteredFallbackToContentTop)
|
|
62192
|
+
return contentTop + offsetV;
|
|
62193
|
+
return anchorParagraphY + offsetV;
|
|
62194
|
+
}
|
|
62195
|
+
function resolveAnchoredGraphicX(anchor, columnIndex, columns, objectWidth, margins, pageWidth) {
|
|
62196
|
+
const alignH = anchor.alignH ?? "left";
|
|
62197
|
+
const offsetH = anchor.offsetH ?? 0;
|
|
62198
|
+
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
62199
|
+
const marginRight = Math.max(0, margins?.right ?? 0);
|
|
62200
|
+
const contentWidth = pageWidth != null ? Math.max(1, pageWidth - (marginLeft + marginRight)) : columns.width;
|
|
62201
|
+
const contentLeft = marginLeft;
|
|
62202
|
+
const columnLeft = contentLeft + columnIndex * (columns.width + columns.gap);
|
|
62203
|
+
const relativeFrom = anchor.hRelativeFrom ?? "column";
|
|
62204
|
+
let baseX;
|
|
62205
|
+
let availableWidth;
|
|
62206
|
+
if (relativeFrom === "page") {
|
|
62207
|
+
baseX = 0;
|
|
62208
|
+
availableWidth = pageWidth != null ? pageWidth : contentWidth + marginLeft + marginRight;
|
|
62209
|
+
} else if (relativeFrom === "margin") {
|
|
62210
|
+
baseX = contentLeft;
|
|
62211
|
+
availableWidth = contentWidth;
|
|
62212
|
+
} else {
|
|
62213
|
+
baseX = columnLeft;
|
|
62214
|
+
availableWidth = columns.width;
|
|
62215
|
+
}
|
|
62216
|
+
if (alignH === "left")
|
|
62217
|
+
return baseX + offsetH;
|
|
62218
|
+
if (alignH === "right")
|
|
62219
|
+
return baseX + availableWidth - objectWidth - offsetH;
|
|
62220
|
+
if (alignH === "center")
|
|
62221
|
+
return baseX + (availableWidth - objectWidth) / 2 + offsetH;
|
|
62222
|
+
return baseX;
|
|
62223
|
+
}
|
|
62160
62224
|
function widthsEqual(a, b) {
|
|
62161
62225
|
if (!a && !b)
|
|
62162
62226
|
return true;
|
|
@@ -62183,10 +62247,12 @@ function cloneColumnLayout(columns) {
|
|
|
62183
62247
|
}
|
|
62184
62248
|
function normalizeColumnLayout(input, contentWidth, epsilon = 0.0001) {
|
|
62185
62249
|
const rawCount = input && Number.isFinite(input.count) ? Math.floor(input.count) : 1;
|
|
62186
|
-
|
|
62250
|
+
let count = Math.max(1, rawCount || 1);
|
|
62187
62251
|
const gap = Math.max(0, input?.gap ?? 0);
|
|
62252
|
+
const explicitWidths = input?.equalWidth === false && Array.isArray(input?.widths) && input.widths.length > 0 ? input.widths.filter((width$1) => typeof width$1 === "number" && Number.isFinite(width$1) && width$1 > 0) : [];
|
|
62253
|
+
if (explicitWidths.length > 0 && explicitWidths.length < count)
|
|
62254
|
+
count = explicitWidths.length;
|
|
62188
62255
|
const availableWidth = contentWidth - gap * (count - 1);
|
|
62189
|
-
const explicitWidths = Array.isArray(input?.widths) && input.widths.length > 0 ? input.widths.filter((width$1) => typeof width$1 === "number" && Number.isFinite(width$1) && width$1 > 0) : [];
|
|
62190
62256
|
let widths = explicitWidths.length > 0 ? explicitWidths.slice(0, count) : Array.from({ length: count }, () => availableWidth > 0 ? availableWidth / count : contentWidth);
|
|
62191
62257
|
if (widths.length < count) {
|
|
62192
62258
|
const remaining = Math.max(0, availableWidth - widths.reduce((sum, width$1) => sum + width$1, 0));
|
|
@@ -67621,6 +67687,8 @@ function handleImageNode$1(node2, params, isAnchor) {
|
|
|
67621
67687
|
default:
|
|
67622
67688
|
break;
|
|
67623
67689
|
}
|
|
67690
|
+
if (wrap$1.type === "Square" || wrap$1.type === "Tight" || wrap$1.type === "Through" || wrap$1.type === "TopAndBottom")
|
|
67691
|
+
mergeAnchorPaddingIntoWrapDistances(wrap$1, padding);
|
|
67624
67692
|
const docPr = node2.elements.find((el) => el.name === "wp:docPr");
|
|
67625
67693
|
const isHidden = isDocPrHidden(docPr);
|
|
67626
67694
|
let anchorData = null;
|
|
@@ -85691,18 +85759,22 @@ function extractColumns(elements) {
|
|
|
85691
85759
|
const cols = elements.find((el) => el?.name === "w:cols");
|
|
85692
85760
|
if (!cols?.attributes)
|
|
85693
85761
|
return;
|
|
85694
|
-
|
|
85762
|
+
let count = parseColumnCount(cols.attributes["w:num"]);
|
|
85695
85763
|
const withSeparator = parseColumnSeparator(cols.attributes["w:sep"]);
|
|
85696
85764
|
const equalWidthRaw = cols.attributes["w:equalWidth"];
|
|
85697
85765
|
const equalWidth = equalWidthRaw === "0" || equalWidthRaw === 0 || equalWidthRaw === false ? false : equalWidthRaw === "1" || equalWidthRaw === 1 || equalWidthRaw === true ? true : undefined;
|
|
85698
85766
|
const columnChildren = Array.isArray(cols.elements) ? cols.elements.filter((child) => child?.name === "w:col") : [];
|
|
85699
|
-
const
|
|
85767
|
+
const isExplicit = equalWidth === false;
|
|
85768
|
+
const firstChildSpace = columnChildren.find((child) => child?.attributes?.["w:space"] != null)?.attributes?.["w:space"];
|
|
85769
|
+
const gapInches = parseColumnGap(isExplicit ? firstChildSpace ?? 0 : cols.attributes["w:space"]);
|
|
85700
85770
|
const widths = columnChildren.map((child) => Number(child.attributes?.["w:w"])).filter((widthTwips) => Number.isFinite(widthTwips) && widthTwips > 0).map((widthTwips) => widthTwips / 1440 * PX_PER_INCH$1);
|
|
85771
|
+
if (isExplicit && widths.length > 0)
|
|
85772
|
+
count = Math.min(count, widths.length);
|
|
85701
85773
|
return {
|
|
85702
85774
|
count,
|
|
85703
85775
|
gap: gapInches * PX_PER_INCH$1,
|
|
85704
85776
|
withSeparator,
|
|
85705
|
-
...widths.length > 0 ? { widths } : {},
|
|
85777
|
+
...isExplicit && widths.length > 0 ? { widths } : {},
|
|
85706
85778
|
...equalWidth !== undefined ? { equalWidth } : {}
|
|
85707
85779
|
};
|
|
85708
85780
|
}
|
|
@@ -88546,6 +88618,8 @@ function imageNodeToBlock(node2, nextBlockId, positions, _trackedMeta, _trackedC
|
|
|
88546
88618
|
const height = typeof size.height === "number" && Number.isFinite(size.height) ? size.height : undefined;
|
|
88547
88619
|
const explicitDisplay = typeof attrs.display === "string" ? attrs.display : undefined;
|
|
88548
88620
|
const normalizedWrap = normalizeWrap$1(attrs.wrap);
|
|
88621
|
+
if (normalizedWrap)
|
|
88622
|
+
mergeWrapDistancesFromPadding(normalizedWrap, toBoxSpacing$1(attrs.padding));
|
|
88549
88623
|
let anchor = normalizeAnchorData(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
|
|
88550
88624
|
if (!anchor && normalizedWrap) {
|
|
88551
88625
|
anchor = { isAnchored: true };
|
|
@@ -104019,6 +104093,17 @@ var isRegExp = (value) => {
|
|
|
104019
104093
|
if (!hasValue || !hasPositive)
|
|
104020
104094
|
return null;
|
|
104021
104095
|
return `inset(${percentEdges.top ?? 0}% ${percentEdges.right ?? 0}% ${percentEdges.bottom ?? 0}% ${percentEdges.left ?? 0}%)`;
|
|
104096
|
+
}, mergeAnchorPaddingIntoWrapDistances = (wrap$1, padding) => {
|
|
104097
|
+
if (!wrap$1?.attrs || !padding)
|
|
104098
|
+
return;
|
|
104099
|
+
if (wrap$1.attrs.distTop == null && Number.isFinite(padding.top) && padding.top !== 0)
|
|
104100
|
+
wrap$1.attrs.distTop = padding.top;
|
|
104101
|
+
if (wrap$1.attrs.distBottom == null && Number.isFinite(padding.bottom) && padding.bottom !== 0)
|
|
104102
|
+
wrap$1.attrs.distBottom = padding.bottom;
|
|
104103
|
+
if (wrap$1.attrs.distLeft == null && Number.isFinite(padding.left) && padding.left !== 0)
|
|
104104
|
+
wrap$1.attrs.distLeft = padding.left;
|
|
104105
|
+
if (wrap$1.attrs.distRight == null && Number.isFinite(padding.right) && padding.right !== 0)
|
|
104106
|
+
wrap$1.attrs.distRight = padding.right;
|
|
104022
104107
|
}, handleShapeDrawing = (params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, isAnchor, isHidden) => {
|
|
104023
104108
|
const wsp = graphicData.elements.find((el) => el.name === "wps:wsp");
|
|
104024
104109
|
const textBoxContent = wsp.elements.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
|
|
@@ -112583,6 +112668,17 @@ var isRegExp = (value) => {
|
|
|
112583
112668
|
const parsed = parseFloat(value);
|
|
112584
112669
|
return Number.isFinite(parsed) ? parsed : undefined;
|
|
112585
112670
|
}
|
|
112671
|
+
}, mergeWrapDistancesFromPadding = (wrap$1, padding) => {
|
|
112672
|
+
if (!padding || wrap$1.type === "None" || wrap$1.type === "Inline")
|
|
112673
|
+
return;
|
|
112674
|
+
if (wrap$1.distTop == null && padding.top != null)
|
|
112675
|
+
wrap$1.distTop = padding.top;
|
|
112676
|
+
if (wrap$1.distBottom == null && padding.bottom != null)
|
|
112677
|
+
wrap$1.distBottom = padding.bottom;
|
|
112678
|
+
if (wrap$1.distLeft == null && padding.left != null)
|
|
112679
|
+
wrap$1.distLeft = padding.left;
|
|
112680
|
+
if (wrap$1.distRight == null && padding.right != null)
|
|
112681
|
+
wrap$1.distRight = padding.right;
|
|
112586
112682
|
}, normalizeColor = (value) => {
|
|
112587
112683
|
if (typeof value !== "string")
|
|
112588
112684
|
return;
|
|
@@ -114391,6 +114487,8 @@ var isRegExp = (value) => {
|
|
|
114391
114487
|
return anchor.isAnchored || anchor.hRelativeFrom != null || anchor.vRelativeFrom != null || anchor.alignH != null || anchor.alignV != null || anchor.offsetH != null || anchor.offsetV != null || anchor.behindDoc != null ? anchor : undefined;
|
|
114392
114488
|
}, buildDrawingBlock = (rawAttrs, nextBlockId, positions, node2, geometry, drawingKind, extraProps) => {
|
|
114393
114489
|
const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
|
|
114490
|
+
if (normalizedWrap)
|
|
114491
|
+
mergeWrapDistancesFromPadding(normalizedWrap, toBoxSpacing(rawAttrs.padding));
|
|
114394
114492
|
const sourceAnchor = isPlainObject4(rawAttrs.sourceAnchor) ? rawAttrs.sourceAnchor : undefined;
|
|
114395
114493
|
const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
114396
114494
|
const pos = positions.get(node2);
|
|
@@ -115445,7 +115543,7 @@ var isRegExp = (value) => {
|
|
|
115445
115543
|
state.kern = kernNode.attributes["w:val"];
|
|
115446
115544
|
}
|
|
115447
115545
|
}, SuperConverter;
|
|
115448
|
-
var
|
|
115546
|
+
var init_SuperConverter_BSMYiYJm_es = __esm(() => {
|
|
115449
115547
|
init_rolldown_runtime_Bg48TavK_es();
|
|
115450
115548
|
init_jszip_C49i9kUs_es();
|
|
115451
115549
|
init_xml_js_CqGKpaft_es();
|
|
@@ -154480,7 +154578,7 @@ var init_SuperConverter_B9mZiCO9_es = __esm(() => {
|
|
|
154480
154578
|
};
|
|
154481
154579
|
});
|
|
154482
154580
|
|
|
154483
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
154581
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-DeKyOdIi.es.js
|
|
154484
154582
|
function parseSizeUnit(val = "0") {
|
|
154485
154583
|
const length = val.toString() || "0";
|
|
154486
154584
|
const value = Number.parseFloat(length);
|
|
@@ -164813,8 +164911,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
164813
164911
|
}
|
|
164814
164912
|
};
|
|
164815
164913
|
};
|
|
164816
|
-
var
|
|
164817
|
-
|
|
164914
|
+
var init_create_headless_toolbar_DeKyOdIi_es = __esm(() => {
|
|
164915
|
+
init_SuperConverter_BSMYiYJm_es();
|
|
164818
164916
|
init_uuid_qzgm05fK_es();
|
|
164819
164917
|
init_constants_D_X7xF4s_es();
|
|
164820
164918
|
init_dist_B8HfvhaK_es();
|
|
@@ -219498,7 +219596,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
219498
219596
|
init_remark_gfm_BhnWr3yf_es();
|
|
219499
219597
|
});
|
|
219500
219598
|
|
|
219501
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
219599
|
+
// ../../packages/superdoc/dist/chunks/src-plIVvSkL.es.js
|
|
219502
219600
|
function deleteProps(obj, propOrProps) {
|
|
219503
219601
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
219504
219602
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -259649,6 +259747,9 @@ function isSettled(status) {
|
|
|
259649
259747
|
function normalizeFamilyKey$2(family$1) {
|
|
259650
259748
|
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
259651
259749
|
}
|
|
259750
|
+
function stripFamilyQuotes(family$1) {
|
|
259751
|
+
return family$1.trim().replace(/^["']|["']$/g, "");
|
|
259752
|
+
}
|
|
259652
259753
|
function splitStack(cssFontFamily) {
|
|
259653
259754
|
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
259654
259755
|
}
|
|
@@ -261258,7 +261359,7 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
261258
261359
|
let currentPageWidth = pageWidth;
|
|
261259
261360
|
let marginLeft = Math.max(0, currentMargins?.left ?? 0);
|
|
261260
261361
|
return {
|
|
261261
|
-
registerDrawing(drawingBlock, measure,
|
|
261362
|
+
registerDrawing(drawingBlock, measure, resolvedAnchorY, columnIndex, pageNumber) {
|
|
261262
261363
|
if (!drawingBlock.anchor?.isAnchored)
|
|
261263
261364
|
return;
|
|
261264
261365
|
const { wrap: wrap4, anchor } = drawingBlock;
|
|
@@ -261268,14 +261369,13 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
261268
261369
|
const objectWidth = measure.width ?? 0;
|
|
261269
261370
|
const objectHeight = measure.height ?? 0;
|
|
261270
261371
|
const x = computeAnchorX(anchor, columnIndex, currentColumns, objectWidth, currentMargins, currentPageWidth);
|
|
261271
|
-
const y$1 = anchorY + (anchor.offsetV ?? 0);
|
|
261272
261372
|
const zone = {
|
|
261273
261373
|
imageBlockId: drawingBlock.id,
|
|
261274
261374
|
pageNumber,
|
|
261275
261375
|
columnIndex,
|
|
261276
261376
|
bounds: {
|
|
261277
261377
|
x,
|
|
261278
|
-
y:
|
|
261378
|
+
y: resolvedAnchorY,
|
|
261279
261379
|
width: objectWidth,
|
|
261280
261380
|
height: objectHeight
|
|
261281
261381
|
},
|
|
@@ -261290,7 +261390,7 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
261290
261390
|
};
|
|
261291
261391
|
zones.push(zone);
|
|
261292
261392
|
},
|
|
261293
|
-
registerTable(tableBlock, measure,
|
|
261393
|
+
registerTable(tableBlock, measure, resolvedAnchorY, columnIndex, pageNumber) {
|
|
261294
261394
|
if (!tableBlock.anchor?.isAnchored)
|
|
261295
261395
|
return;
|
|
261296
261396
|
const { wrap: wrap4, anchor } = tableBlock;
|
|
@@ -261299,14 +261399,13 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
261299
261399
|
const tableWidth = measure.totalWidth ?? 0;
|
|
261300
261400
|
const tableHeight = measure.totalHeight ?? 0;
|
|
261301
261401
|
const x = computeTableAnchorX(anchor, columnIndex, currentColumns, tableWidth, currentMargins, currentPageWidth);
|
|
261302
|
-
const y$1 = anchorY + (anchor.offsetV ?? 0);
|
|
261303
261402
|
const zone = {
|
|
261304
261403
|
imageBlockId: tableBlock.id,
|
|
261305
261404
|
pageNumber,
|
|
261306
261405
|
columnIndex,
|
|
261307
261406
|
bounds: {
|
|
261308
261407
|
x,
|
|
261309
|
-
y:
|
|
261408
|
+
y: resolvedAnchorY,
|
|
261310
261409
|
width: tableWidth,
|
|
261311
261410
|
height: tableHeight
|
|
261312
261411
|
},
|
|
@@ -261360,12 +261459,12 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
261360
261459
|
rightFloats.push(zone);
|
|
261361
261460
|
let leftBoundary = 0;
|
|
261362
261461
|
for (const zone of leftFloats) {
|
|
261363
|
-
const boundary = zone.bounds.x + zone.bounds.width + zone.distances.
|
|
261462
|
+
const boundary = zone.bounds.x + zone.bounds.width + zone.distances.right;
|
|
261364
261463
|
leftBoundary = Math.max(leftBoundary, boundary);
|
|
261365
261464
|
}
|
|
261366
261465
|
let rightBoundary = columnOrigin + baseWidth;
|
|
261367
261466
|
for (const zone of rightFloats) {
|
|
261368
|
-
const boundary = zone.bounds.x - zone.distances.left
|
|
261467
|
+
const boundary = zone.bounds.x - zone.distances.left;
|
|
261369
261468
|
rightBoundary = Math.min(rightBoundary, boundary);
|
|
261370
261469
|
}
|
|
261371
261470
|
const availableWidth = rightBoundary - leftBoundary;
|
|
@@ -261395,27 +261494,7 @@ function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
|
261395
261494
|
};
|
|
261396
261495
|
}
|
|
261397
261496
|
function computeAnchorX(anchor, columnIndex, columns, imageWidth, margins, pageWidth) {
|
|
261398
|
-
|
|
261399
|
-
const offsetH = anchor.offsetH ?? 0;
|
|
261400
|
-
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
261401
|
-
const marginRight = Math.max(0, margins?.right ?? 0);
|
|
261402
|
-
const contentWidth = pageWidth != null ? Math.max(1, pageWidth - (marginLeft + marginRight)) : columns.width;
|
|
261403
|
-
const contentLeft = marginLeft;
|
|
261404
|
-
const columnLeft = contentLeft + columnIndex * (columns.width + columns.gap);
|
|
261405
|
-
const relativeFrom = anchor.hRelativeFrom ?? "column";
|
|
261406
|
-
let baseX;
|
|
261407
|
-
let availableWidth;
|
|
261408
|
-
if (relativeFrom === "page") {
|
|
261409
|
-
baseX = 0;
|
|
261410
|
-
availableWidth = pageWidth != null ? pageWidth : contentWidth + marginLeft + marginRight;
|
|
261411
|
-
} else if (relativeFrom === "margin") {
|
|
261412
|
-
baseX = contentLeft;
|
|
261413
|
-
availableWidth = contentWidth;
|
|
261414
|
-
} else {
|
|
261415
|
-
baseX = columnLeft;
|
|
261416
|
-
availableWidth = columns.width;
|
|
261417
|
-
}
|
|
261418
|
-
return alignH === "left" ? baseX + offsetH : alignH === "right" ? baseX + availableWidth - imageWidth - offsetH : alignH === "center" ? baseX + (availableWidth - imageWidth) / 2 + offsetH : baseX;
|
|
261497
|
+
return resolveAnchoredGraphicX(anchor, columnIndex, columns, imageWidth, margins, pageWidth);
|
|
261419
261498
|
}
|
|
261420
261499
|
function computeWrapMode(wrap4, _anchor) {
|
|
261421
261500
|
if (!wrap4)
|
|
@@ -261750,6 +261829,30 @@ function normalizeLines(measure) {
|
|
|
261750
261829
|
function shouldSuppressOwnSpacing(ownStyleId, ownContextualSpacing, adjacentStyleId) {
|
|
261751
261830
|
return ownContextualSpacing && !!ownStyleId && !!adjacentStyleId && ownStyleId === adjacentStyleId;
|
|
261752
261831
|
}
|
|
261832
|
+
function collapseSpacingBefore(spacingBefore, trailingSpacing) {
|
|
261833
|
+
const prevTrailing = trailingSpacing ?? 0;
|
|
261834
|
+
return Math.max(spacingBefore - prevTrailing, 0);
|
|
261835
|
+
}
|
|
261836
|
+
function rewindPreviousParagraphTrailing(cursorY, trailingSpacing) {
|
|
261837
|
+
const prevTrailing = trailingSpacing ?? 0;
|
|
261838
|
+
return prevTrailing > 0 ? cursorY - prevTrailing : cursorY;
|
|
261839
|
+
}
|
|
261840
|
+
function computeParagraphContentStartY(cursorY, spacingBefore, appliedSpacingBefore, trailingSpacing) {
|
|
261841
|
+
if (appliedSpacingBefore || spacingBefore <= 0)
|
|
261842
|
+
return cursorY;
|
|
261843
|
+
return cursorY + collapseSpacingBefore(spacingBefore, trailingSpacing);
|
|
261844
|
+
}
|
|
261845
|
+
function computeParagraphLayoutStartY(input2) {
|
|
261846
|
+
let y$1 = input2.cursorY;
|
|
261847
|
+
let trailingForCollapse = input2.trailingSpacing;
|
|
261848
|
+
if (input2.rewindTrailingFromPrevious) {
|
|
261849
|
+
y$1 = rewindPreviousParagraphTrailing(y$1, input2.trailingSpacing);
|
|
261850
|
+
if ((input2.trailingSpacing ?? 0) > 0)
|
|
261851
|
+
trailingForCollapse = 0;
|
|
261852
|
+
}
|
|
261853
|
+
const effectiveSpacingBefore = input2.suppressSpacingBefore ? 0 : input2.spacingBefore;
|
|
261854
|
+
return computeParagraphContentStartY(y$1, effectiveSpacingBefore, effectiveSpacingBefore === 0, trailingForCollapse);
|
|
261855
|
+
}
|
|
261753
261856
|
function calculateFirstLineIndent(block, measure) {
|
|
261754
261857
|
const wordLayout = block.attrs?.wordLayout;
|
|
261755
261858
|
if (!wordLayout?.firstLineIndentMode)
|
|
@@ -261765,52 +261868,75 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
261765
261868
|
const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx$1;
|
|
261766
261869
|
const remeasureParagraph$1 = ctx$1.remeasureParagraph;
|
|
261767
261870
|
const frame = getParagraphAttrs(block)?.frame;
|
|
261768
|
-
|
|
261871
|
+
let lines = normalizeLines(measure);
|
|
261872
|
+
const measurementWidth = lines[0]?.maxWidth;
|
|
261873
|
+
const paraIndent = block.attrs?.indent;
|
|
261874
|
+
const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
|
|
261875
|
+
const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
|
|
261876
|
+
const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
|
|
261877
|
+
const negativeRightIndent = indentRight < 0 ? indentRight : 0;
|
|
261878
|
+
const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
|
|
261879
|
+
let didRemeasureForColumnWidth = false;
|
|
261880
|
+
let remeasuredMarkerInfo;
|
|
261881
|
+
if (typeof remeasureParagraph$1 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
261882
|
+
const newMeasure = remeasureParagraph$1(block, columnWidth, calculateFirstLineIndent(block, measure));
|
|
261883
|
+
lines = normalizeLines(newMeasure);
|
|
261884
|
+
didRemeasureForColumnWidth = true;
|
|
261885
|
+
if (newMeasure.marker)
|
|
261886
|
+
remeasuredMarkerInfo = newMeasure.marker;
|
|
261887
|
+
}
|
|
261888
|
+
let fromLine = 0;
|
|
261889
|
+
const attrs = getParagraphAttrs(block);
|
|
261890
|
+
const spacing = attrs?.spacing ?? {};
|
|
261891
|
+
const spacingExplicit = attrs?.spacingExplicit;
|
|
261892
|
+
const styleId$1 = asString2(attrs?.styleId);
|
|
261893
|
+
const contextualSpacing = asBoolean$1(attrs?.contextualSpacing);
|
|
261894
|
+
let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
|
|
261895
|
+
let spacingAfter = ctx$1.overrideSpacingAfter ?? Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
|
|
261896
|
+
if (isEmptyTextParagraph(block) && spacingExplicit) {
|
|
261897
|
+
if (!spacingExplicit.before)
|
|
261898
|
+
spacingBefore = 0;
|
|
261899
|
+
if (!spacingExplicit.after)
|
|
261900
|
+
spacingAfter = 0;
|
|
261901
|
+
}
|
|
261902
|
+
const baseSpacingBefore = spacingBefore;
|
|
261903
|
+
let appliedSpacingBefore = spacingBefore === 0;
|
|
261904
|
+
let lastState = null;
|
|
261905
|
+
const previewState = ensurePage();
|
|
261906
|
+
const rawBorderExpansion = computeBorderVerticalExpansion(attrs?.borders);
|
|
261907
|
+
const currentBorderHash = hashBorders(attrs?.borders);
|
|
261908
|
+
const inBorderGroup = currentBorderHash != null && currentBorderHash === previewState.lastParagraphBorderHash;
|
|
261909
|
+
const borderExpansion = {
|
|
261910
|
+
top: inBorderGroup ? 0 : rawBorderExpansion.top,
|
|
261911
|
+
bottom: rawBorderExpansion.bottom
|
|
261912
|
+
};
|
|
261913
|
+
const paragraphAnchorBaseY = computeParagraphLayoutStartY({
|
|
261914
|
+
cursorY: previewState.cursorY,
|
|
261915
|
+
spacingBefore,
|
|
261916
|
+
trailingSpacing: previewState.trailingSpacing,
|
|
261917
|
+
suppressSpacingBefore: shouldSuppressOwnSpacing(styleId$1, contextualSpacing, previewState.lastParagraphStyleId),
|
|
261918
|
+
rewindTrailingFromPrevious: shouldSuppressOwnSpacing(previewState.lastParagraphStyleId, previewState.lastParagraphContextualSpacing, styleId$1)
|
|
261919
|
+
}) + borderExpansion.top - (inBorderGroup ? rawBorderExpansion.bottom : 0);
|
|
261920
|
+
const registerAnchoredDrawingsAt = (paragraphContentStartY) => {
|
|
261921
|
+
if (!anchors?.anchoredDrawings?.length)
|
|
261922
|
+
return;
|
|
261769
261923
|
for (const entry of anchors.anchoredDrawings) {
|
|
261770
261924
|
if (anchors.placedAnchoredIds.has(entry.block.id))
|
|
261771
261925
|
continue;
|
|
261772
261926
|
const state = ensurePage();
|
|
261773
|
-
const vRelativeFrom = entry.block.anchor?.vRelativeFrom;
|
|
261774
|
-
const alignV = entry.block.anchor?.alignV;
|
|
261775
|
-
const offsetV = entry.block.anchor?.offsetV ?? 0;
|
|
261776
|
-
const imageHeight = entry.measure.height;
|
|
261777
261927
|
const contentTop = state.topMargin;
|
|
261778
261928
|
const contentBottom = state.contentBottom;
|
|
261779
|
-
const
|
|
261780
|
-
|
|
261781
|
-
|
|
261782
|
-
|
|
261783
|
-
|
|
261784
|
-
|
|
261785
|
-
|
|
261786
|
-
|
|
261787
|
-
|
|
261788
|
-
else
|
|
261789
|
-
anchorY = contentTop + offsetV;
|
|
261790
|
-
else if (vRelativeFrom === "page")
|
|
261791
|
-
if (alignV === "top")
|
|
261792
|
-
anchorY = offsetV;
|
|
261793
|
-
else if (alignV === "bottom")
|
|
261794
|
-
anchorY = contentBottom + (anchors.pageMargins.bottom ?? 0) - imageHeight + offsetV;
|
|
261795
|
-
else if (alignV === "center")
|
|
261796
|
-
anchorY = (contentBottom + (anchors.pageMargins.bottom ?? 0) - imageHeight) / 2 + offsetV;
|
|
261797
|
-
else
|
|
261798
|
-
anchorY = offsetV;
|
|
261799
|
-
else if (vRelativeFrom === "paragraph") {
|
|
261800
|
-
const baseAnchorY = state.cursorY;
|
|
261801
|
-
const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
|
|
261802
|
-
if (alignV === "top")
|
|
261803
|
-
anchorY = baseAnchorY + offsetV;
|
|
261804
|
-
else if (alignV === "bottom")
|
|
261805
|
-
anchorY = baseAnchorY + firstLineHeight - imageHeight + offsetV;
|
|
261806
|
-
else if (alignV === "center")
|
|
261807
|
-
anchorY = baseAnchorY + (firstLineHeight - imageHeight) / 2 + offsetV;
|
|
261808
|
-
else
|
|
261809
|
-
anchorY = baseAnchorY + offsetV;
|
|
261810
|
-
} else
|
|
261811
|
-
anchorY = state.cursorY + offsetV;
|
|
261929
|
+
const anchorY = resolveAnchoredGraphicY({
|
|
261930
|
+
anchor: entry.block.anchor,
|
|
261931
|
+
objectHeight: entry.measure.height,
|
|
261932
|
+
contentTop,
|
|
261933
|
+
contentBottom,
|
|
261934
|
+
pageBottomMargin: anchors.pageMargins.bottom ?? 0,
|
|
261935
|
+
anchorParagraphY: paragraphContentStartY,
|
|
261936
|
+
firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
|
|
261937
|
+
});
|
|
261812
261938
|
floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
|
|
261813
|
-
const anchorX = entry.block.anchor ?
|
|
261939
|
+
const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(entry.block.anchor, state.columnIndex, anchors.columns, entry.measure.width, {
|
|
261814
261940
|
left: anchors.pageMargins.left,
|
|
261815
261941
|
right: anchors.pageMargins.right
|
|
261816
261942
|
}, anchors.pageWidth) : columnX(state.columnIndex);
|
|
@@ -261882,40 +262008,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
261882
262008
|
}
|
|
261883
262009
|
anchors.placedAnchoredIds.add(entry.block.id);
|
|
261884
262010
|
}
|
|
261885
|
-
|
|
261886
|
-
|
|
261887
|
-
const paraIndent = block.attrs?.indent;
|
|
261888
|
-
const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
|
|
261889
|
-
const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
|
|
261890
|
-
const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
|
|
261891
|
-
const negativeRightIndent = indentRight < 0 ? indentRight : 0;
|
|
261892
|
-
const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
|
|
261893
|
-
let didRemeasureForColumnWidth = false;
|
|
261894
|
-
let remeasuredMarkerInfo;
|
|
261895
|
-
if (typeof remeasureParagraph$1 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
261896
|
-
const newMeasure = remeasureParagraph$1(block, columnWidth, calculateFirstLineIndent(block, measure));
|
|
261897
|
-
lines = normalizeLines(newMeasure);
|
|
261898
|
-
didRemeasureForColumnWidth = true;
|
|
261899
|
-
if (newMeasure.marker)
|
|
261900
|
-
remeasuredMarkerInfo = newMeasure.marker;
|
|
261901
|
-
}
|
|
261902
|
-
let fromLine = 0;
|
|
261903
|
-
const attrs = getParagraphAttrs(block);
|
|
261904
|
-
const spacing = attrs?.spacing ?? {};
|
|
261905
|
-
const spacingExplicit = attrs?.spacingExplicit;
|
|
261906
|
-
const styleId$1 = asString2(attrs?.styleId);
|
|
261907
|
-
const contextualSpacing = asBoolean$1(attrs?.contextualSpacing);
|
|
261908
|
-
let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
|
|
261909
|
-
let spacingAfter = ctx$1.overrideSpacingAfter ?? Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
|
|
261910
|
-
if (isEmptyTextParagraph(block) && spacingExplicit) {
|
|
261911
|
-
if (!spacingExplicit.before)
|
|
261912
|
-
spacingBefore = 0;
|
|
261913
|
-
if (!spacingExplicit.after)
|
|
261914
|
-
spacingAfter = 0;
|
|
261915
|
-
}
|
|
261916
|
-
const baseSpacingBefore = spacingBefore;
|
|
261917
|
-
let appliedSpacingBefore = spacingBefore === 0;
|
|
261918
|
-
let lastState = null;
|
|
262011
|
+
};
|
|
262012
|
+
registerAnchoredDrawingsAt(paragraphAnchorBaseY);
|
|
261919
262013
|
if (frame?.wrap === "none") {
|
|
261920
262014
|
let state = ensurePage();
|
|
261921
262015
|
if (state.cursorY >= state.contentBottom)
|
|
@@ -261957,12 +262051,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
261957
262051
|
let didRemeasureForFloats = false;
|
|
261958
262052
|
if (typeof remeasureParagraph$1 === "function") {
|
|
261959
262053
|
const tempState = ensurePage();
|
|
261960
|
-
let tempY =
|
|
261961
|
-
if (!appliedSpacingBefore && spacingBefore > 0) {
|
|
261962
|
-
const prevTrailing = tempState.trailingSpacing ?? 0;
|
|
261963
|
-
const neededSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
|
|
261964
|
-
tempY += neededSpacingBefore;
|
|
261965
|
-
}
|
|
262054
|
+
let tempY = paragraphAnchorBaseY;
|
|
261966
262055
|
for (let i4 = 0;i4 < lines.length; i4++) {
|
|
261967
262056
|
const lineY = tempY;
|
|
261968
262057
|
const lineHeight = lines[i4]?.lineHeight || 0;
|
|
@@ -261973,8 +262062,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
261973
262062
|
}
|
|
261974
262063
|
tempY += lineHeight;
|
|
261975
262064
|
}
|
|
261976
|
-
const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
|
|
261977
|
-
if (narrowestRemeasureWidth < remeasureWidth) {
|
|
262065
|
+
const narrowestRemeasureWidth = narrowestWidth < columnWidth || narrowestOffsetX > 0 ? Math.max(1, narrowestWidth - Math.max(indentLeft, 0) - Math.max(indentRight, 0)) : Math.max(1, narrowestWidth - indentLeft - indentRight);
|
|
262066
|
+
if (narrowestRemeasureWidth < remeasureWidth || narrowestOffsetX > 0) {
|
|
261978
262067
|
const newMeasure = remeasureParagraph$1(block, narrowestRemeasureWidth, calculateFirstLineIndent(block, measure));
|
|
261979
262068
|
lines = normalizeLines(newMeasure);
|
|
261980
262069
|
didRemeasureForFloats = true;
|
|
@@ -261982,13 +262071,6 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
261982
262071
|
remeasuredMarkerInfo = newMeasure.marker;
|
|
261983
262072
|
}
|
|
261984
262073
|
}
|
|
261985
|
-
const rawBorderExpansion = computeBorderVerticalExpansion(attrs?.borders);
|
|
261986
|
-
const currentBorderHash = hashBorders(attrs?.borders);
|
|
261987
|
-
const inBorderGroup = currentBorderHash != null && currentBorderHash === ensurePage().lastParagraphBorderHash;
|
|
261988
|
-
const borderExpansion = {
|
|
261989
|
-
top: inBorderGroup ? 0 : rawBorderExpansion.top,
|
|
261990
|
-
bottom: rawBorderExpansion.bottom
|
|
261991
|
-
};
|
|
261992
262074
|
while (fromLine < lines.length) {
|
|
261993
262075
|
let state = ensurePage();
|
|
261994
262076
|
if (state.trailingSpacing == null)
|
|
@@ -262000,13 +262082,12 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
262000
262082
|
if (shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId$1)) {
|
|
262001
262083
|
const prevTrailing = asSafeNumber(state.trailingSpacing);
|
|
262002
262084
|
if (prevTrailing > 0) {
|
|
262003
|
-
state.cursorY
|
|
262085
|
+
state.cursorY = rewindPreviousParagraphTrailing(state.cursorY, prevTrailing);
|
|
262004
262086
|
state.trailingSpacing = 0;
|
|
262005
262087
|
}
|
|
262006
262088
|
}
|
|
262007
262089
|
if (attrs?.keepLines === true && fromLine === 0) {
|
|
262008
|
-
const
|
|
262009
|
-
const neededSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
|
|
262090
|
+
const neededSpacingBefore = collapseSpacingBefore(spacingBefore, state.trailingSpacing);
|
|
262010
262091
|
const pageContentHeight = state.contentBottom - state.topMargin;
|
|
262011
262092
|
const fullHeight = lines.reduce((sum, line) => sum + (line.lineHeight || 0), 0) + borderExpansion.top + borderExpansion.bottom;
|
|
262012
262093
|
const fitsOnBlankPage = fullHeight + baseSpacingBefore <= pageContentHeight;
|
|
@@ -262020,8 +262101,8 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
262020
262101
|
}
|
|
262021
262102
|
if (!appliedSpacingBefore && spacingBefore > 0)
|
|
262022
262103
|
while (!appliedSpacingBefore) {
|
|
262023
|
-
|
|
262024
|
-
const neededSpacingBefore =
|
|
262104
|
+
state.trailingSpacing;
|
|
262105
|
+
const neededSpacingBefore = collapseSpacingBefore(spacingBefore, state.trailingSpacing);
|
|
262025
262106
|
if (state.cursorY + neededSpacingBefore > state.contentBottom) {
|
|
262026
262107
|
if (state.cursorY <= state.topMargin) {
|
|
262027
262108
|
state.trailingSpacing = 0;
|
|
@@ -262143,8 +262224,12 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
262143
262224
|
state.footnoteAnchorsThisPage.push(a2);
|
|
262144
262225
|
}
|
|
262145
262226
|
}
|
|
262146
|
-
const
|
|
262147
|
-
const
|
|
262227
|
+
const floatAdjustedX = columnX(state.columnIndex) + offsetX;
|
|
262228
|
+
const adjustedX = didRemeasureForFloats ? floatAdjustedX + Math.max(negativeLeftIndent, 0) : floatAdjustedX + negativeLeftIndent;
|
|
262229
|
+
const columnRight = columnX(state.columnIndex) + columnWidth;
|
|
262230
|
+
let adjustedWidth = didRemeasureForFloats ? effectiveColumnWidth : effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
|
|
262231
|
+
if (didRemeasureForFloats)
|
|
262232
|
+
adjustedWidth = Math.min(adjustedWidth, Math.max(1, columnRight - adjustedX));
|
|
262148
262233
|
const fragment = {
|
|
262149
262234
|
kind: "para",
|
|
262150
262235
|
blockId: block.id,
|
|
@@ -262156,7 +262241,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
262156
262241
|
sourceAnchor: block.sourceAnchor,
|
|
262157
262242
|
...computeFragmentPmRange2(block, lines, fromLine, slice2.toLine)
|
|
262158
262243
|
};
|
|
262159
|
-
if (didRemeasureForColumnWidth)
|
|
262244
|
+
if (didRemeasureForColumnWidth || didRemeasureForFloats)
|
|
262160
262245
|
fragment.lines = lines.slice(fromLine, slice2.toLine);
|
|
262161
262246
|
if ((measure.marker || remeasuredMarkerInfo) && fromLine === 0) {
|
|
262162
262247
|
fragment.markerWidth = (remeasuredMarkerInfo ?? measure.marker)?.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
@@ -264007,13 +264092,19 @@ function getBalancingHeight(fragment, measureMap, sectPrMarkerBlockIds) {
|
|
|
264007
264092
|
return 0;
|
|
264008
264093
|
return getFragmentHeight(fragment, measureMap);
|
|
264009
264094
|
}
|
|
264095
|
+
function allColumnWidthsEqual(widths) {
|
|
264096
|
+
if (widths.length <= 1)
|
|
264097
|
+
return true;
|
|
264098
|
+
const first$1 = widths[0];
|
|
264099
|
+
return widths.every((w) => Math.abs(w - first$1) <= 0.5);
|
|
264100
|
+
}
|
|
264010
264101
|
function balanceSectionOnPage(args$1) {
|
|
264011
264102
|
const { sectionColumns, sectionHasExplicitColumnBreak, sectionIndex, blockSectionMap, fragments } = args$1;
|
|
264012
264103
|
if (sectionColumns.count <= 1)
|
|
264013
264104
|
return null;
|
|
264014
264105
|
if (sectionHasExplicitColumnBreak)
|
|
264015
264106
|
return null;
|
|
264016
|
-
if (sectionColumns.equalWidth === false && Array.isArray(sectionColumns.widths) && sectionColumns.widths.length > 0)
|
|
264107
|
+
if (sectionColumns.equalWidth === false && Array.isArray(sectionColumns.widths) && sectionColumns.widths.length > 0 && !allColumnWidthsEqual(sectionColumns.widths))
|
|
264017
264108
|
return null;
|
|
264018
264109
|
const sectionFragments = fragments.filter((f2) => blockSectionMap.get(f2.blockId) === sectionIndex);
|
|
264019
264110
|
if (sectionFragments.length === 0)
|
|
@@ -265266,58 +265357,28 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
265266
265357
|
const resolveParagraphlessAnchoredTableY = (block, measure, state) => {
|
|
265267
265358
|
const contentTop = state.topMargin;
|
|
265268
265359
|
const contentBottom = state.contentBottom;
|
|
265269
|
-
const contentHeight = Math.max(0, contentBottom - contentTop);
|
|
265270
265360
|
const tableHeight = measure.totalHeight ?? 0;
|
|
265271
|
-
|
|
265272
|
-
|
|
265273
|
-
|
|
265274
|
-
|
|
265275
|
-
|
|
265276
|
-
|
|
265277
|
-
|
|
265278
|
-
|
|
265279
|
-
return contentTop + (contentHeight - tableHeight) / 2 + offsetV;
|
|
265280
|
-
return contentTop + offsetV;
|
|
265281
|
-
}
|
|
265282
|
-
if (vRelativeFrom === "page") {
|
|
265283
|
-
if (alignV === "bottom")
|
|
265284
|
-
return contentBottom + (state.page.margins?.bottom ?? activeBottomMargin) - tableHeight + offsetV;
|
|
265285
|
-
if (alignV === "center")
|
|
265286
|
-
return (contentBottom + (state.page.margins?.bottom ?? activeBottomMargin) - tableHeight) / 2 + offsetV;
|
|
265287
|
-
return offsetV;
|
|
265288
|
-
}
|
|
265289
|
-
return contentTop + offsetV;
|
|
265361
|
+
return resolveAnchoredGraphicY({
|
|
265362
|
+
anchor: block.anchor,
|
|
265363
|
+
objectHeight: tableHeight,
|
|
265364
|
+
contentTop,
|
|
265365
|
+
contentBottom,
|
|
265366
|
+
pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
|
|
265367
|
+
preRegisteredFallbackToContentTop: true
|
|
265368
|
+
});
|
|
265290
265369
|
};
|
|
265291
265370
|
for (const entry of preRegisteredAnchors) {
|
|
265292
265371
|
const state = paginator.ensurePage();
|
|
265293
|
-
const vRelativeFrom = entry.block.anchor?.vRelativeFrom ?? "paragraph";
|
|
265294
|
-
const alignV = entry.block.anchor?.alignV ?? "top";
|
|
265295
|
-
const offsetV = entry.block.anchor?.offsetV ?? 0;
|
|
265296
|
-
const imageHeight = entry.measure.height ?? 0;
|
|
265297
265372
|
const contentTop = state.topMargin;
|
|
265298
265373
|
const contentBottom = state.contentBottom;
|
|
265299
|
-
const
|
|
265300
|
-
|
|
265301
|
-
|
|
265302
|
-
|
|
265303
|
-
|
|
265304
|
-
|
|
265305
|
-
|
|
265306
|
-
|
|
265307
|
-
anchorY = contentTop + (contentHeight - imageHeight) / 2 + offsetV;
|
|
265308
|
-
else
|
|
265309
|
-
anchorY = contentTop + offsetV;
|
|
265310
|
-
else if (vRelativeFrom === "page")
|
|
265311
|
-
if (alignV === "top")
|
|
265312
|
-
anchorY = offsetV;
|
|
265313
|
-
else if (alignV === "bottom")
|
|
265314
|
-
anchorY = contentBottom + (state.page.margins?.bottom ?? activeBottomMargin) - imageHeight + offsetV;
|
|
265315
|
-
else if (alignV === "center")
|
|
265316
|
-
anchorY = (contentBottom + (state.page.margins?.bottom ?? activeBottomMargin) - imageHeight) / 2 + offsetV;
|
|
265317
|
-
else
|
|
265318
|
-
anchorY = offsetV;
|
|
265319
|
-
else
|
|
265320
|
-
anchorY = contentTop + offsetV;
|
|
265374
|
+
const anchorY = resolveAnchoredGraphicY({
|
|
265375
|
+
anchor: entry.block.anchor,
|
|
265376
|
+
objectHeight: entry.measure.height ?? 0,
|
|
265377
|
+
contentTop,
|
|
265378
|
+
contentBottom,
|
|
265379
|
+
pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
|
|
265380
|
+
preRegisteredFallbackToContentTop: true
|
|
265381
|
+
});
|
|
265321
265382
|
const anchorX = entry.block.anchor ? computeAnchorX(entry.block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), entry.measure.width, {
|
|
265322
265383
|
left: activeLeftMargin,
|
|
265323
265384
|
right: activeRightMargin
|
|
@@ -265628,7 +265689,6 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
265628
265689
|
overrideSpacingAfter = 0;
|
|
265629
265690
|
}
|
|
265630
265691
|
}
|
|
265631
|
-
const paragraphStartY = paginator.ensurePage().cursorY;
|
|
265632
265692
|
layoutParagraphBlock({
|
|
265633
265693
|
block,
|
|
265634
265694
|
measure,
|
|
@@ -265658,7 +265718,12 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
265658
265718
|
if (tablesForPara) {
|
|
265659
265719
|
const state = paginator.ensurePage();
|
|
265660
265720
|
const columnWidthForTable = getCurrentColumnWidth();
|
|
265721
|
+
let anchorParagraphTopY = state.cursorY;
|
|
265722
|
+
for (const fragment of state.page.fragments)
|
|
265723
|
+
if (fragment.kind === "para" && fragment.blockId === block.id)
|
|
265724
|
+
anchorParagraphTopY = Math.min(anchorParagraphTopY, fragment.y);
|
|
265661
265725
|
let tableBottomY = state.cursorY;
|
|
265726
|
+
let nextStackY = state.cursorY;
|
|
265662
265727
|
for (const { block: tableBlock, measure: tableMeasure } of tablesForPara) {
|
|
265663
265728
|
if (placedAnchoredTableIds.has(tableBlock.id))
|
|
265664
265729
|
continue;
|
|
@@ -265666,15 +265731,17 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
265666
265731
|
if (columnWidthForTable > 0 && totalWidth >= columnWidthForTable * 0.99)
|
|
265667
265732
|
continue;
|
|
265668
265733
|
const offsetV = tableBlock.anchor?.offsetV ?? 0;
|
|
265669
|
-
const anchorY = Math.max(
|
|
265734
|
+
const anchorY = Math.max(anchorParagraphTopY, nextStackY) + offsetV;
|
|
265670
265735
|
floatManager.registerTable(tableBlock, tableMeasure, anchorY, state.columnIndex, state.page.number);
|
|
265671
265736
|
const tableFragment = createAnchoredTableFragment(tableBlock, tableMeasure, tableBlock.anchor?.offsetH ?? columnX(state.columnIndex), anchorY);
|
|
265672
265737
|
state.page.fragments.push(tableFragment);
|
|
265673
265738
|
placedAnchoredTableIds.add(tableBlock.id);
|
|
265674
265739
|
if ((tableBlock.wrap?.type ?? "None") !== "None") {
|
|
265675
265740
|
const bottom$1 = anchorY + (tableMeasure.totalHeight ?? 0);
|
|
265741
|
+
const distBottom = tableBlock.wrap?.distBottom ?? 0;
|
|
265676
265742
|
if (bottom$1 > tableBottomY)
|
|
265677
265743
|
tableBottomY = bottom$1;
|
|
265744
|
+
nextStackY = bottom$1 + distBottom;
|
|
265678
265745
|
}
|
|
265679
265746
|
}
|
|
265680
265747
|
state.cursorY = tableBottomY;
|
|
@@ -299393,7 +299460,7 @@ menclose::after {
|
|
|
299393
299460
|
return;
|
|
299394
299461
|
if (this.#overrides.get(key2) === physical)
|
|
299395
299462
|
return;
|
|
299396
|
-
if (
|
|
299463
|
+
if (key2 === normalizeFamilyKey$2(physical)) {
|
|
299397
299464
|
if (this.#overrides.delete(key2)) {
|
|
299398
299465
|
this.#version += 1;
|
|
299399
299466
|
this.#cachedSignature = null;
|
|
@@ -299445,12 +299512,41 @@ menclose::after {
|
|
|
299445
299512
|
reason: "as_requested"
|
|
299446
299513
|
};
|
|
299447
299514
|
}
|
|
299515
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
299516
|
+
const key2 = normalizeFamilyKey$2(primary);
|
|
299517
|
+
const override = this.#overrides.get(key2);
|
|
299518
|
+
if (override && hasFace(override, face.weight, face.style))
|
|
299519
|
+
return {
|
|
299520
|
+
physical: override,
|
|
299521
|
+
reason: "custom_mapping"
|
|
299522
|
+
};
|
|
299523
|
+
if (hasFace(primary, face.weight, face.style))
|
|
299524
|
+
return {
|
|
299525
|
+
physical: primary,
|
|
299526
|
+
reason: "registered_face"
|
|
299527
|
+
};
|
|
299528
|
+
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
299529
|
+
if (bundled && hasFace(bundled, face.weight, face.style))
|
|
299530
|
+
return {
|
|
299531
|
+
physical: bundled,
|
|
299532
|
+
reason: "bundled_substitute"
|
|
299533
|
+
};
|
|
299534
|
+
if (override || bundled)
|
|
299535
|
+
return {
|
|
299536
|
+
physical: primary,
|
|
299537
|
+
reason: "fallback_face_absent"
|
|
299538
|
+
};
|
|
299539
|
+
return {
|
|
299540
|
+
physical: primary,
|
|
299541
|
+
reason: "as_requested"
|
|
299542
|
+
};
|
|
299543
|
+
}
|
|
299448
299544
|
resolveFontFamily(logicalFamily) {
|
|
299449
299545
|
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
299450
299546
|
const { physical, reason } = this.#physicalFor(primary);
|
|
299451
299547
|
return {
|
|
299452
299548
|
logicalFamily,
|
|
299453
|
-
physicalFamily: physical,
|
|
299549
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
299454
299550
|
reason
|
|
299455
299551
|
};
|
|
299456
299552
|
}
|
|
@@ -299467,23 +299563,11 @@ menclose::after {
|
|
|
299467
299563
|
}
|
|
299468
299564
|
resolveFace(logicalFamily, face, hasFace) {
|
|
299469
299565
|
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
299470
|
-
const { physical, reason } = this.#
|
|
299471
|
-
if (reason === "as_requested")
|
|
299472
|
-
return {
|
|
299473
|
-
logicalFamily,
|
|
299474
|
-
physicalFamily: physical,
|
|
299475
|
-
reason
|
|
299476
|
-
};
|
|
299477
|
-
if (hasFace(physical, face.weight, face.style))
|
|
299478
|
-
return {
|
|
299479
|
-
logicalFamily,
|
|
299480
|
-
physicalFamily: physical,
|
|
299481
|
-
reason
|
|
299482
|
-
};
|
|
299566
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
299483
299567
|
return {
|
|
299484
299568
|
logicalFamily,
|
|
299485
|
-
physicalFamily:
|
|
299486
|
-
reason
|
|
299569
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
299570
|
+
reason
|
|
299487
299571
|
};
|
|
299488
299572
|
}
|
|
299489
299573
|
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
@@ -299492,12 +299576,10 @@ menclose::after {
|
|
|
299492
299576
|
const parts = splitStack(cssFontFamily);
|
|
299493
299577
|
if (parts.length === 0)
|
|
299494
299578
|
return cssFontFamily;
|
|
299495
|
-
const { physical, reason } = this.#
|
|
299496
|
-
if (reason === "
|
|
299497
|
-
return
|
|
299498
|
-
|
|
299499
|
-
return cssFontFamily;
|
|
299500
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
299579
|
+
const { physical, reason } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
299580
|
+
if (reason === "custom_mapping" || reason === "bundled_substitute")
|
|
299581
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
299582
|
+
return cssFontFamily;
|
|
299501
299583
|
}
|
|
299502
299584
|
resolvePrimaryPhysicalFamily(family$1) {
|
|
299503
299585
|
const primary = splitStack(family$1)[0] ?? family$1;
|
|
@@ -299525,6 +299607,7 @@ menclose::after {
|
|
|
299525
299607
|
#faceInflight = /* @__PURE__ */ new Map;
|
|
299526
299608
|
#faceSources = /* @__PURE__ */ new Map;
|
|
299527
299609
|
#facesByFamily = /* @__PURE__ */ new Map;
|
|
299610
|
+
#providerFaceKeys = /* @__PURE__ */ new Set;
|
|
299528
299611
|
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
299529
299612
|
constructor(options = {}) {
|
|
299530
299613
|
this.#fontSet = options.fontSet ?? null;
|
|
@@ -299536,7 +299619,9 @@ menclose::after {
|
|
|
299536
299619
|
register(descriptor) {
|
|
299537
299620
|
const { family: family$1, source, descriptors: descriptors2 } = descriptor;
|
|
299538
299621
|
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
299539
|
-
const
|
|
299622
|
+
const weight = normalizeWeight(descriptors2?.weight);
|
|
299623
|
+
const style2 = normalizeStyle$1(descriptors2?.style);
|
|
299624
|
+
const key2 = faceKeyOf$1(family$1, weight, style2);
|
|
299540
299625
|
if (typeof identitySource === "string") {
|
|
299541
299626
|
const existingSource = this.#faceSources.get(key2);
|
|
299542
299627
|
if (existingSource === identitySource)
|
|
@@ -299549,7 +299634,11 @@ menclose::after {
|
|
|
299549
299634
|
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
299550
299635
|
}
|
|
299551
299636
|
if (this.#FontFaceCtor && this.#fontSet) {
|
|
299552
|
-
const face = new this.#FontFaceCtor(family$1, source,
|
|
299637
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
299638
|
+
...descriptors2,
|
|
299639
|
+
weight,
|
|
299640
|
+
style: style2
|
|
299641
|
+
});
|
|
299553
299642
|
this.#fontSet.add(face);
|
|
299554
299643
|
this.#managed.set(family$1, face);
|
|
299555
299644
|
}
|
|
@@ -299561,6 +299650,7 @@ menclose::after {
|
|
|
299561
299650
|
}
|
|
299562
299651
|
if (!this.#status.has(family$1))
|
|
299563
299652
|
this.#status.set(family$1, "unloaded");
|
|
299653
|
+
this.#providerFaceKeys.add(key2);
|
|
299564
299654
|
this.#trackFace(family$1, key2);
|
|
299565
299655
|
if (!this.#faceStatus.has(key2))
|
|
299566
299656
|
this.#faceStatus.set(key2, "unloaded");
|
|
@@ -299605,7 +299695,8 @@ menclose::after {
|
|
|
299605
299695
|
return "unloaded";
|
|
299606
299696
|
}
|
|
299607
299697
|
hasFace(family$1, weight, style2) {
|
|
299608
|
-
|
|
299698
|
+
const key2 = faceKeyOf$1(family$1, weight, style2);
|
|
299699
|
+
return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
|
|
299609
299700
|
}
|
|
299610
299701
|
isAvailable(family$1) {
|
|
299611
299702
|
if (!this.#fontSet)
|
|
@@ -314991,6 +315082,7 @@ menclose::after {
|
|
|
314991
315082
|
#requiredFaceKeys = /* @__PURE__ */ new Set;
|
|
314992
315083
|
#seenAvailable = /* @__PURE__ */ new Set;
|
|
314993
315084
|
#seenAvailableFaces = /* @__PURE__ */ new Set;
|
|
315085
|
+
#seenFailedFaces = /* @__PURE__ */ new Set;
|
|
314994
315086
|
#lastSummary = null;
|
|
314995
315087
|
#loadingDoneHandler = null;
|
|
314996
315088
|
#lateLoadScheduler;
|
|
@@ -315066,9 +315158,18 @@ menclose::after {
|
|
|
315066
315158
|
} catch {
|
|
315067
315159
|
results = [];
|
|
315068
315160
|
}
|
|
315069
|
-
|
|
315161
|
+
const failedKeys = [];
|
|
315162
|
+
for (const result of results) {
|
|
315163
|
+
const key2 = faceKeyOf(result.request.family, result.request.weight, result.request.style);
|
|
315070
315164
|
if (result.status === "loaded")
|
|
315071
|
-
this.#seenAvailableFaces.add(
|
|
315165
|
+
this.#seenAvailableFaces.add(key2);
|
|
315166
|
+
else if (result.status === "failed" && !this.#seenFailedFaces.has(key2)) {
|
|
315167
|
+
this.#seenFailedFaces.add(key2);
|
|
315168
|
+
failedKeys.push(key2);
|
|
315169
|
+
}
|
|
315170
|
+
}
|
|
315171
|
+
if (failedKeys.length > 0)
|
|
315172
|
+
this.#scheduleAvailabilityReflow(failedKeys);
|
|
315072
315173
|
this.#lastSummary = summarizeFaces(results);
|
|
315073
315174
|
return this.#lastSummary;
|
|
315074
315175
|
}
|
|
@@ -315125,6 +315226,7 @@ menclose::after {
|
|
|
315125
315226
|
this.#requiredFamilies = /* @__PURE__ */ new Set;
|
|
315126
315227
|
this.#seenAvailable.clear();
|
|
315127
315228
|
this.#seenAvailableFaces.clear();
|
|
315229
|
+
this.#seenFailedFaces.clear();
|
|
315128
315230
|
this.#lastSummary = null;
|
|
315129
315231
|
}
|
|
315130
315232
|
dispose() {
|
|
@@ -315190,6 +315292,9 @@ menclose::after {
|
|
|
315190
315292
|
}
|
|
315191
315293
|
if (changedKeys.length === 0)
|
|
315192
315294
|
return;
|
|
315295
|
+
this.#scheduleAvailabilityReflow(changedKeys);
|
|
315296
|
+
}
|
|
315297
|
+
#scheduleAvailabilityReflow(changedKeys) {
|
|
315193
315298
|
this.#fontConfigVersion += 1;
|
|
315194
315299
|
bumpFontConfigVersion();
|
|
315195
315300
|
this.#invalidateCaches();
|
|
@@ -315289,8 +315394,13 @@ menclose::after {
|
|
|
315289
315394
|
const registry3 = this.#getGate()?.resolveRegistry();
|
|
315290
315395
|
if (!registry3)
|
|
315291
315396
|
throw new Error("[superdoc] fonts.preload: the font registry is not ready yet");
|
|
315397
|
+
const hasFace = (family$1, weight, style2) => registry3.hasFace(family$1, weight, style2);
|
|
315398
|
+
const face = {
|
|
315399
|
+
weight: "400",
|
|
315400
|
+
style: "normal"
|
|
315401
|
+
};
|
|
315292
315402
|
const requests = families.map((logical) => ({
|
|
315293
|
-
family: this.#resolver.
|
|
315403
|
+
family: this.#resolver.resolveFace(logical, face, hasFace).physicalFamily,
|
|
315294
315404
|
weight: "400",
|
|
315295
315405
|
style: "normal"
|
|
315296
315406
|
}));
|
|
@@ -315407,13 +315517,13 @@ menclose::after {
|
|
|
315407
315517
|
return;
|
|
315408
315518
|
console.log(...args$1);
|
|
315409
315519
|
}, 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;
|
|
315410
|
-
var
|
|
315520
|
+
var init_src_plIVvSkL_es = __esm(() => {
|
|
315411
315521
|
init_rolldown_runtime_Bg48TavK_es();
|
|
315412
|
-
|
|
315522
|
+
init_SuperConverter_BSMYiYJm_es();
|
|
315413
315523
|
init_jszip_C49i9kUs_es();
|
|
315414
315524
|
init_xml_js_CqGKpaft_es();
|
|
315415
315525
|
init_uuid_qzgm05fK_es();
|
|
315416
|
-
|
|
315526
|
+
init_create_headless_toolbar_DeKyOdIi_es();
|
|
315417
315527
|
init_constants_D_X7xF4s_es();
|
|
315418
315528
|
init_dist_B8HfvhaK_es();
|
|
315419
315529
|
init_unified_Dsuw2be5_es();
|
|
@@ -350122,11 +350232,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
350122
350232
|
]);
|
|
350123
350233
|
});
|
|
350124
350234
|
|
|
350125
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
350235
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-CJMIa98h.es.js
|
|
350126
350236
|
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;
|
|
350127
|
-
var
|
|
350128
|
-
|
|
350129
|
-
|
|
350237
|
+
var init_create_super_doc_ui_CJMIa98h_es = __esm(() => {
|
|
350238
|
+
init_SuperConverter_BSMYiYJm_es();
|
|
350239
|
+
init_create_headless_toolbar_DeKyOdIi_es();
|
|
350130
350240
|
MOD_ALIASES = new Set([
|
|
350131
350241
|
"Mod",
|
|
350132
350242
|
"Meta",
|
|
@@ -350168,16 +350278,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
350168
350278
|
|
|
350169
350279
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
350170
350280
|
var init_super_editor_es = __esm(() => {
|
|
350171
|
-
|
|
350172
|
-
|
|
350281
|
+
init_src_plIVvSkL_es();
|
|
350282
|
+
init_SuperConverter_BSMYiYJm_es();
|
|
350173
350283
|
init_jszip_C49i9kUs_es();
|
|
350174
350284
|
init_xml_js_CqGKpaft_es();
|
|
350175
|
-
|
|
350285
|
+
init_create_headless_toolbar_DeKyOdIi_es();
|
|
350176
350286
|
init_constants_D_X7xF4s_es();
|
|
350177
350287
|
init_dist_B8HfvhaK_es();
|
|
350178
350288
|
init_unified_Dsuw2be5_es();
|
|
350179
350289
|
init_DocxZipper_VodIk8WL_es();
|
|
350180
|
-
|
|
350290
|
+
init_create_super_doc_ui_CJMIa98h_es();
|
|
350181
350291
|
init_ui_C5PAS9hY_es();
|
|
350182
350292
|
init_eventemitter3_BnGqBE_Q_es();
|
|
350183
350293
|
init_errors_CNaD6vcg_es();
|
|
@@ -371557,19 +371667,24 @@ function extractColumns2(elements) {
|
|
|
371557
371667
|
const cols = elements.find((el) => el?.name === "w:cols");
|
|
371558
371668
|
if (!cols?.attributes)
|
|
371559
371669
|
return;
|
|
371560
|
-
|
|
371670
|
+
let count = parseColumnCount2(cols.attributes["w:num"]);
|
|
371561
371671
|
const withSeparator = parseColumnSeparator2(cols.attributes["w:sep"]);
|
|
371562
371672
|
const equalWidthRaw = cols.attributes["w:equalWidth"];
|
|
371563
371673
|
const equalWidth = equalWidthRaw === "0" || equalWidthRaw === 0 || equalWidthRaw === false ? false : equalWidthRaw === "1" || equalWidthRaw === 1 || equalWidthRaw === true ? true : undefined;
|
|
371564
371674
|
const columnChildren = Array.isArray(cols.elements) ? cols.elements.filter((child) => child?.name === "w:col") : [];
|
|
371565
|
-
const
|
|
371675
|
+
const isExplicit = equalWidth === false;
|
|
371676
|
+
const firstChildSpace = columnChildren.find((child) => child?.attributes?.["w:space"] != null)?.attributes?.["w:space"];
|
|
371677
|
+
const gapTwips = isExplicit ? firstChildSpace ?? 0 : cols.attributes["w:space"];
|
|
371566
371678
|
const gapInches = parseColumnGap2(gapTwips);
|
|
371567
371679
|
const widths = columnChildren.map((child) => Number(child.attributes?.["w:w"])).filter((widthTwips) => Number.isFinite(widthTwips) && widthTwips > 0).map((widthTwips) => widthTwips / 1440 * PX_PER_INCH);
|
|
371680
|
+
if (isExplicit && widths.length > 0) {
|
|
371681
|
+
count = Math.min(count, widths.length);
|
|
371682
|
+
}
|
|
371568
371683
|
const result = {
|
|
371569
371684
|
count,
|
|
371570
371685
|
gap: gapInches * PX_PER_INCH,
|
|
371571
371686
|
withSeparator,
|
|
371572
|
-
...widths.length > 0 ? { widths } : {},
|
|
371687
|
+
...isExplicit && widths.length > 0 ? { widths } : {},
|
|
371573
371688
|
...equalWidth !== undefined ? { equalWidth } : {}
|
|
371574
371689
|
};
|
|
371575
371690
|
return result;
|
|
@@ -372296,6 +372411,17 @@ var twipsToPx3 = (value) => value / TWIPS_PER_INCH2 * PX_PER_INCH2, ptToPx2 = (p
|
|
|
372296
372411
|
return Number.isFinite(parsed) ? parsed : undefined;
|
|
372297
372412
|
}
|
|
372298
372413
|
return;
|
|
372414
|
+
}, mergeWrapDistancesFromPadding2 = (wrap4, padding) => {
|
|
372415
|
+
if (!padding || wrap4.type === "None" || wrap4.type === "Inline")
|
|
372416
|
+
return;
|
|
372417
|
+
if (wrap4.distTop == null && padding.top != null)
|
|
372418
|
+
wrap4.distTop = padding.top;
|
|
372419
|
+
if (wrap4.distBottom == null && padding.bottom != null)
|
|
372420
|
+
wrap4.distBottom = padding.bottom;
|
|
372421
|
+
if (wrap4.distLeft == null && padding.left != null)
|
|
372422
|
+
wrap4.distLeft = padding.left;
|
|
372423
|
+
if (wrap4.distRight == null && padding.right != null)
|
|
372424
|
+
wrap4.distRight = padding.right;
|
|
372299
372425
|
}, normalizeColor2 = (value) => {
|
|
372300
372426
|
if (typeof value !== "string")
|
|
372301
372427
|
return;
|
|
@@ -381023,6 +381149,9 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
|
|
|
381023
381149
|
return hasData ? anchor : undefined;
|
|
381024
381150
|
}, buildDrawingBlock2 = (rawAttrs, nextBlockId, positions, node3, geometry, drawingKind, extraProps) => {
|
|
381025
381151
|
const normalizedWrap = normalizeWrap3(rawAttrs.wrap);
|
|
381152
|
+
if (normalizedWrap) {
|
|
381153
|
+
mergeWrapDistancesFromPadding2(normalizedWrap, toBoxSpacing2(rawAttrs.padding));
|
|
381154
|
+
}
|
|
381026
381155
|
const sourceAnchor = isPlainObject8(rawAttrs.sourceAnchor) ? rawAttrs.sourceAnchor : undefined;
|
|
381027
381156
|
const baseAnchor = normalizeAnchorData2(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
381028
381157
|
const pos = positions.get(node3);
|
|
@@ -381176,6 +381305,9 @@ function imageNodeToBlock2(node3, nextBlockId, positions, _trackedMeta, _tracked
|
|
|
381176
381305
|
const height = typeof size3.height === "number" && Number.isFinite(size3.height) ? size3.height : undefined;
|
|
381177
381306
|
const explicitDisplay = typeof attrs.display === "string" ? attrs.display : undefined;
|
|
381178
381307
|
const normalizedWrap = normalizeWrap4(attrs.wrap);
|
|
381308
|
+
if (normalizedWrap) {
|
|
381309
|
+
mergeWrapDistancesFromPadding2(normalizedWrap, toBoxSpacing3(attrs.padding));
|
|
381310
|
+
}
|
|
381179
381311
|
let anchor = normalizeAnchorData3(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
|
|
381180
381312
|
if (!anchor && normalizedWrap) {
|
|
381181
381313
|
anchor = { isAnchored: true };
|
|
@@ -437834,6 +437966,9 @@ function handleImageNode3(node4, params3, isAnchor) {
|
|
|
437834
437966
|
default:
|
|
437835
437967
|
break;
|
|
437836
437968
|
}
|
|
437969
|
+
if (wrap6.type === "Square" || wrap6.type === "Tight" || wrap6.type === "Through" || wrap6.type === "TopAndBottom") {
|
|
437970
|
+
mergeAnchorPaddingIntoWrapDistances2(wrap6, padding);
|
|
437971
|
+
}
|
|
437837
437972
|
const docPr = node4.elements.find((el) => el.name === "wp:docPr");
|
|
437838
437973
|
const isHidden = isDocPrHidden2(docPr);
|
|
437839
437974
|
let anchorData = null;
|
|
@@ -438358,6 +438493,21 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
|
|
|
438358
438493
|
const bottom2 = percentEdges.bottom ?? 0;
|
|
438359
438494
|
const left2 = percentEdges.left ?? 0;
|
|
438360
438495
|
return `inset(${top}% ${right2}% ${bottom2}% ${left2}%)`;
|
|
438496
|
+
}, mergeAnchorPaddingIntoWrapDistances2 = (wrap6, padding) => {
|
|
438497
|
+
if (!wrap6?.attrs || !padding)
|
|
438498
|
+
return;
|
|
438499
|
+
if (wrap6.attrs.distTop == null && Number.isFinite(padding.top) && padding.top !== 0) {
|
|
438500
|
+
wrap6.attrs.distTop = padding.top;
|
|
438501
|
+
}
|
|
438502
|
+
if (wrap6.attrs.distBottom == null && Number.isFinite(padding.bottom) && padding.bottom !== 0) {
|
|
438503
|
+
wrap6.attrs.distBottom = padding.bottom;
|
|
438504
|
+
}
|
|
438505
|
+
if (wrap6.attrs.distLeft == null && Number.isFinite(padding.left) && padding.left !== 0) {
|
|
438506
|
+
wrap6.attrs.distLeft = padding.left;
|
|
438507
|
+
}
|
|
438508
|
+
if (wrap6.attrs.distRight == null && Number.isFinite(padding.right) && padding.right !== 0) {
|
|
438509
|
+
wrap6.attrs.distRight = padding.right;
|
|
438510
|
+
}
|
|
438361
438511
|
}, handleShapeDrawing2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isAnchor, isHidden) => {
|
|
438362
438512
|
const wsp = graphicData.elements.find((el) => el.name === "wps:wsp");
|
|
438363
438513
|
const textBox = wsp.elements.find((el) => el.name === "wps:txbx");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/mcp",
|
|
3
|
-
"version": "0.11.0-next.
|
|
3
|
+
"version": "0.11.0-next.6",
|
|
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.0.1",
|
|
23
|
-
"
|
|
24
|
-
"superdoc": "
|
|
23
|
+
"superdoc": "1.38.0",
|
|
24
|
+
"@superdoc/super-editor": "0.0.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|