@superdoc-dev/cli 0.16.0-next.20 → 0.16.0-next.21
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 +234 -149
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -230111,7 +230111,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
230111
230111
|
init_remark_gfm_BhnWr3yf_es();
|
|
230112
230112
|
});
|
|
230113
230113
|
|
|
230114
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
230114
|
+
// ../../packages/superdoc/dist/chunks/src-CF4og_LY.es.js
|
|
230115
230115
|
function deleteProps(obj, propOrProps) {
|
|
230116
230116
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
230117
230117
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -270607,44 +270607,17 @@ function normalizeFamilyKey$2(family$1) {
|
|
|
270607
270607
|
function splitStack(cssFontFamily) {
|
|
270608
270608
|
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
270609
270609
|
}
|
|
270610
|
-
function
|
|
270611
|
-
|
|
270612
|
-
return physical ? {
|
|
270613
|
-
physical,
|
|
270614
|
-
mapped: true
|
|
270615
|
-
} : {
|
|
270616
|
-
physical: bareFamily,
|
|
270617
|
-
mapped: false
|
|
270618
|
-
};
|
|
270610
|
+
function createFontResolver() {
|
|
270611
|
+
return new FontResolver;
|
|
270619
270612
|
}
|
|
270620
270613
|
function resolveFontFamily2(logicalFamily) {
|
|
270621
|
-
|
|
270622
|
-
return {
|
|
270623
|
-
logicalFamily,
|
|
270624
|
-
physicalFamily: physical,
|
|
270625
|
-
reason: mapped ? "bundled_substitute" : "as_requested"
|
|
270626
|
-
};
|
|
270614
|
+
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
270627
270615
|
}
|
|
270628
270616
|
function resolvePhysicalFamily(cssFontFamily) {
|
|
270629
|
-
|
|
270630
|
-
return cssFontFamily;
|
|
270631
|
-
const parts = splitStack(cssFontFamily);
|
|
270632
|
-
if (parts.length === 0)
|
|
270633
|
-
return cssFontFamily;
|
|
270634
|
-
const { physical, mapped } = physicalFor(parts[0]);
|
|
270635
|
-
if (!mapped)
|
|
270636
|
-
return cssFontFamily;
|
|
270637
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
270617
|
+
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
270638
270618
|
}
|
|
270639
270619
|
function resolvePrimaryPhysicalFamily(family$1) {
|
|
270640
|
-
return
|
|
270641
|
-
}
|
|
270642
|
-
function resolvePhysicalFamilies(families) {
|
|
270643
|
-
const out = /* @__PURE__ */ new Set;
|
|
270644
|
-
for (const family$1 of families)
|
|
270645
|
-
if (family$1)
|
|
270646
|
-
out.add(resolvePrimaryPhysicalFamily(family$1));
|
|
270647
|
-
return [...out];
|
|
270620
|
+
return defaultResolver.resolvePrimaryPhysicalFamily(family$1);
|
|
270648
270621
|
}
|
|
270649
270622
|
function getFontConfigVersion() {
|
|
270650
270623
|
return fontConfigVersion;
|
|
@@ -270734,14 +270707,14 @@ function installBundledSubstitutes(registry2, options = {}) {
|
|
|
270734
270707
|
});
|
|
270735
270708
|
}
|
|
270736
270709
|
}
|
|
270737
|
-
function buildFontReport(logicalFamilies, registry2) {
|
|
270710
|
+
function buildFontReport(logicalFamilies, registry2, resolver2) {
|
|
270738
270711
|
const seen = /* @__PURE__ */ new Set;
|
|
270739
270712
|
const report = [];
|
|
270740
270713
|
for (const logical of logicalFamilies) {
|
|
270741
270714
|
if (!logical || seen.has(logical))
|
|
270742
270715
|
continue;
|
|
270743
270716
|
seen.add(logical);
|
|
270744
|
-
const { physicalFamily, reason } = resolveFontFamily2(logical);
|
|
270717
|
+
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
|
|
270745
270718
|
const loadStatus = registry2.getStatus(physicalFamily);
|
|
270746
270719
|
report.push({
|
|
270747
270720
|
logicalFamily: logical,
|
|
@@ -271792,7 +271765,7 @@ function resolveFragmentSdtContainerKey(fragment2, blockMap) {
|
|
|
271792
271765
|
return getSdtContainerKey(block.attrs?.sdt, block.attrs?.containerSdt);
|
|
271793
271766
|
return null;
|
|
271794
271767
|
}
|
|
271795
|
-
function computeBlockVersion(blockId, blockMap, cache$2) {
|
|
271768
|
+
function computeBlockVersion(blockId, blockMap, cache$2, fontSignature = "") {
|
|
271796
271769
|
const cached = cache$2.get(blockId);
|
|
271797
271770
|
if (cached !== undefined)
|
|
271798
271771
|
return cached;
|
|
@@ -271802,8 +271775,9 @@ function computeBlockVersion(blockId, blockMap, cache$2) {
|
|
|
271802
271775
|
return "missing";
|
|
271803
271776
|
}
|
|
271804
271777
|
const version$1 = deriveBlockVersion(entry.block);
|
|
271805
|
-
|
|
271806
|
-
|
|
271778
|
+
const versioned = fontSignature ? `${fontSignature}|${version$1}` : version$1;
|
|
271779
|
+
cache$2.set(blockId, versioned);
|
|
271780
|
+
return versioned;
|
|
271807
271781
|
}
|
|
271808
271782
|
function applyPaintVersions(item, visualVersion) {
|
|
271809
271783
|
const evidenceVersion = sourceAnchorSignature(item.sourceAnchor);
|
|
@@ -271814,9 +271788,9 @@ function applyPaintVersions(item, visualVersion) {
|
|
|
271814
271788
|
} else
|
|
271815
271789
|
item.paintCacheVersion = visualVersion;
|
|
271816
271790
|
}
|
|
271817
|
-
function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache, story) {
|
|
271791
|
+
function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache, story, fontSignature = "") {
|
|
271818
271792
|
const sdtContainerKey = resolveFragmentSdtContainerKey(fragment2, blockMap);
|
|
271819
|
-
const version$1 = fragmentSignature(fragment2, computeBlockVersion(fragment2.blockId, blockMap, blockVersionCache));
|
|
271793
|
+
const version$1 = fragmentSignature(fragment2, computeBlockVersion(fragment2.blockId, blockMap, blockVersionCache, fontSignature));
|
|
271820
271794
|
const layoutSourceIdentity = resolveFragmentLayoutIdentity(fragment2, story);
|
|
271821
271795
|
switch (fragment2.kind) {
|
|
271822
271796
|
case "table": {
|
|
@@ -271919,6 +271893,7 @@ function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, bloc
|
|
|
271919
271893
|
}
|
|
271920
271894
|
function resolveLayout(input2) {
|
|
271921
271895
|
const { layout, flowMode, blocks: blocks2, measures } = input2;
|
|
271896
|
+
const fontSignature = input2.fontSignature ?? "";
|
|
271922
271897
|
const blockMap = buildBlockMap(blocks2, measures);
|
|
271923
271898
|
const blockVersionCache = /* @__PURE__ */ new Map;
|
|
271924
271899
|
const pages = layout.pages.map((page, pageIndex) => ({
|
|
@@ -271929,7 +271904,7 @@ function resolveLayout(input2) {
|
|
|
271929
271904
|
number: page.number,
|
|
271930
271905
|
width: page.size?.w ?? layout.pageSize.w,
|
|
271931
271906
|
height: page.size?.h ?? layout.pageSize.h,
|
|
271932
|
-
items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache)),
|
|
271907
|
+
items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache, undefined, fontSignature)),
|
|
271933
271908
|
margins: page.margins,
|
|
271934
271909
|
footnoteReserved: page.footnoteReserved,
|
|
271935
271910
|
displayNumber: page.displayNumber,
|
|
@@ -271952,12 +271927,12 @@ function resolveLayout(input2) {
|
|
|
271952
271927
|
...layout.documentBackground ? { documentBackground: layout.documentBackground } : {}
|
|
271953
271928
|
};
|
|
271954
271929
|
if (blocks2.length > 0)
|
|
271955
|
-
resolved.blockVersions = Object.fromEntries(blocks2.map((block) => [block.id, computeBlockVersion(block.id, blockMap, blockVersionCache)]));
|
|
271930
|
+
resolved.blockVersions = Object.fromEntries(blocks2.map((block) => [block.id, computeBlockVersion(block.id, blockMap, blockVersionCache, fontSignature)]));
|
|
271956
271931
|
if (layout.layoutEpoch != null)
|
|
271957
271932
|
resolved.layoutEpoch = layout.layoutEpoch;
|
|
271958
271933
|
return resolved;
|
|
271959
271934
|
}
|
|
271960
|
-
function resolveHeaderFooterLayout(layout, blocks2, measures, story) {
|
|
271935
|
+
function resolveHeaderFooterLayout(layout, blocks2, measures, story, fontSignature = "") {
|
|
271961
271936
|
const pages = layout.pages.map((page) => {
|
|
271962
271937
|
const blockMap = buildBlockMap(page.blocks ?? blocks2, page.measures ?? measures);
|
|
271963
271938
|
const blockVersionCache = /* @__PURE__ */ new Map;
|
|
@@ -271968,7 +271943,7 @@ function resolveHeaderFooterLayout(layout, blocks2, measures, story) {
|
|
|
271968
271943
|
pageNumberFormat: page.pageNumberFormat,
|
|
271969
271944
|
pageNumberChapterText: page.pageNumberChapterText,
|
|
271970
271945
|
pageNumberChapterSeparator: page.pageNumberChapterSeparator,
|
|
271971
|
-
items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, page.number - 1, blockMap, blockVersionCache, story))
|
|
271946
|
+
items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, page.number - 1, blockMap, blockVersionCache, story, fontSignature))
|
|
271972
271947
|
};
|
|
271973
271948
|
});
|
|
271974
271949
|
return {
|
|
@@ -277584,7 +277559,7 @@ function hasPageNumberTokensRequiringPerPageLayout(blocks2) {
|
|
|
277584
277559
|
}
|
|
277585
277560
|
return false;
|
|
277586
277561
|
}
|
|
277587
|
-
async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1, cache$2 = sharedHeaderFooterCache, totalPages, pageResolver, kind) {
|
|
277562
|
+
async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1, cache$2 = sharedHeaderFooterCache, totalPages, pageResolver, kind, fontSignature = "") {
|
|
277588
277563
|
const result = {};
|
|
277589
277564
|
if (!pageResolver) {
|
|
277590
277565
|
const numPages = totalPages ?? 1;
|
|
@@ -277593,7 +277568,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
277593
277568
|
continue;
|
|
277594
277569
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks2);
|
|
277595
277570
|
resolveHeaderFooterTokens(clonedBlocks, 1, numPages);
|
|
277596
|
-
const measures = await cache$2.measureBlocks(clonedBlocks, constraints, measureBlock$1);
|
|
277571
|
+
const measures = await cache$2.measureBlocks(clonedBlocks, constraints, measureBlock$1, fontSignature);
|
|
277597
277572
|
result[type] = {
|
|
277598
277573
|
blocks: clonedBlocks,
|
|
277599
277574
|
measures,
|
|
@@ -277610,7 +277585,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
277610
277585
|
if (!blocks2 || blocks2.length === 0)
|
|
277611
277586
|
continue;
|
|
277612
277587
|
if (!hasPageTokens(blocks2)) {
|
|
277613
|
-
const measures = await cache$2.measureBlocks(blocks2, constraints, measureBlock$1);
|
|
277588
|
+
const measures = await cache$2.measureBlocks(blocks2, constraints, measureBlock$1, fontSignature);
|
|
277614
277589
|
result[type] = {
|
|
277615
277590
|
blocks: blocks2,
|
|
277616
277591
|
measures,
|
|
@@ -277635,7 +277610,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
277635
277610
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks2);
|
|
277636
277611
|
const { displayText, displayNumber, totalPages: totalPagesForPage, sectionPageCount, pageFormat, chapterNumberText, chapterSeparator } = pageResolver(pageNum);
|
|
277637
277612
|
resolveHeaderFooterTokens(clonedBlocks, pageNum, totalPagesForPage, displayText, displayNumber, sectionPageCount, pageFormat, chapterNumberText, chapterSeparator);
|
|
277638
|
-
const measures = await cache$2.measureBlocks(clonedBlocks, constraints, measureBlock$1);
|
|
277613
|
+
const measures = await cache$2.measureBlocks(clonedBlocks, constraints, measureBlock$1, fontSignature);
|
|
277639
277614
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints, kind);
|
|
277640
277615
|
const measuresById = /* @__PURE__ */ new Map;
|
|
277641
277616
|
for (let i4 = 0;i4 < clonedBlocks.length; i4 += 1)
|
|
@@ -278420,7 +278395,9 @@ function invalidateHeaderFooterCache(cache$2, cacheState, headerBlocks, footerBl
|
|
|
278420
278395
|
HeaderFooterCacheLogger.logInvalidation(invalidationReasons.join(", "), uniqueBlockIds);
|
|
278421
278396
|
}
|
|
278422
278397
|
}
|
|
278423
|
-
async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, options, measureBlock$1, headerFooter, previousMeasures) {
|
|
278398
|
+
async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, options, measureBlock$1, headerFooter, previousMeasures, fontRuntime) {
|
|
278399
|
+
const fontSignature = fontRuntime?.fontSignature ?? "";
|
|
278400
|
+
const previousFontSignature = fontRuntime?.previousFontSignature ?? "";
|
|
278424
278401
|
const isSemanticFlow = options.flowMode === "semantic";
|
|
278425
278402
|
if (isSemanticFlow) {
|
|
278426
278403
|
headerFooter = undefined;
|
|
@@ -278435,7 +278412,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
278435
278412
|
throw new Error("incrementalLayout: invalid measurement constraints resolved from options");
|
|
278436
278413
|
const hasPreviousMeasures = Array.isArray(previousMeasures) && previousMeasures.length === previousBlocks.length;
|
|
278437
278414
|
const previousConstraints = hasPreviousMeasures && !isSemanticFlow ? resolveMeasurementConstraints(options, previousBlocks) : null;
|
|
278438
|
-
const canReusePreviousMeasures = hasPreviousMeasures && previousConstraints?.measurementWidth === measurementWidth && previousConstraints?.measurementHeight === measurementHeight;
|
|
278415
|
+
const canReusePreviousMeasures = hasPreviousMeasures && fontSignature === previousFontSignature && previousConstraints?.measurementWidth === measurementWidth && previousConstraints?.measurementHeight === measurementHeight;
|
|
278439
278416
|
const previousPerSectionConstraints = canReusePreviousMeasures ? computePerSectionConstraints(options, previousBlocks) : null;
|
|
278440
278417
|
const previousMeasuresById = canReusePreviousMeasures ? new Map(previousBlocks.map((block, index2) => [block.id, previousMeasures[index2]])) : null;
|
|
278441
278418
|
const previousConstraintsById = canReusePreviousMeasures ? new Map(previousBlocks.map((block, index2) => [block.id, previousPerSectionConstraints[index2]])) : null;
|
|
@@ -278465,7 +278442,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
278465
278442
|
}
|
|
278466
278443
|
}
|
|
278467
278444
|
const lookupStart = performance.now();
|
|
278468
|
-
const cached = measureCache.get(block, blockMeasureWidth, blockMeasureHeight);
|
|
278445
|
+
const cached = measureCache.get(block, blockMeasureWidth, blockMeasureHeight, fontSignature);
|
|
278469
278446
|
cacheLookupTime += performance.now() - lookupStart;
|
|
278470
278447
|
if (cached) {
|
|
278471
278448
|
measures.push(cached);
|
|
@@ -278475,7 +278452,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
278475
278452
|
const measureBlockStart = performance.now();
|
|
278476
278453
|
const measurement = await measureBlock$1(block, sectionConstraints);
|
|
278477
278454
|
actualMeasureTime += performance.now() - measureBlockStart;
|
|
278478
|
-
measureCache.set(block, blockMeasureWidth, blockMeasureHeight, measurement);
|
|
278455
|
+
measureCache.set(block, blockMeasureWidth, blockMeasureHeight, measurement, fontSignature);
|
|
278479
278456
|
measures.push(measurement);
|
|
278480
278457
|
cacheMisses++;
|
|
278481
278458
|
}
|
|
@@ -278536,7 +278513,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
278536
278513
|
};
|
|
278537
278514
|
headerContentHeights = {};
|
|
278538
278515
|
if (hasHeaderBlocks && headerFooter.headerBlocks) {
|
|
278539
|
-
const preHeaderLayouts = await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "header");
|
|
278516
|
+
const preHeaderLayouts = await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "header", fontSignature);
|
|
278540
278517
|
for (const [type, value] of Object.entries(preHeaderLayouts)) {
|
|
278541
278518
|
if (!isValidHeaderType(type))
|
|
278542
278519
|
continue;
|
|
@@ -278577,7 +278554,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
278577
278554
|
footerContentHeights = {};
|
|
278578
278555
|
try {
|
|
278579
278556
|
if (hasFooterBlocks && headerFooter.footerBlocks) {
|
|
278580
|
-
const preFooterLayouts = await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "footer");
|
|
278557
|
+
const preFooterLayouts = await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, prelayoutPageResolver, "footer", fontSignature);
|
|
278581
278558
|
for (const [type, value] of Object.entries(preFooterLayouts)) {
|
|
278582
278559
|
if (!isValidFooterType(type))
|
|
278583
278560
|
continue;
|
|
@@ -278717,13 +278694,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
278717
278694
|
const blocks2 = Array.from(needed.values());
|
|
278718
278695
|
const measuresById$1 = /* @__PURE__ */ new Map;
|
|
278719
278696
|
await Promise.all(blocks2.map(async (block) => {
|
|
278720
|
-
const cached = measureCache.get(block, footnoteConstraints.maxWidth, footnoteConstraints.maxHeight);
|
|
278697
|
+
const cached = measureCache.get(block, footnoteConstraints.maxWidth, footnoteConstraints.maxHeight, fontSignature);
|
|
278721
278698
|
if (cached) {
|
|
278722
278699
|
measuresById$1.set(block.id, cached);
|
|
278723
278700
|
return;
|
|
278724
278701
|
}
|
|
278725
278702
|
const measurement = await measureBlock$1(block, footnoteConstraints);
|
|
278726
|
-
measureCache.set(block, footnoteConstraints.maxWidth, footnoteConstraints.maxHeight, measurement);
|
|
278703
|
+
measureCache.set(block, footnoteConstraints.maxWidth, footnoteConstraints.maxHeight, measurement, fontSignature);
|
|
278727
278704
|
measuresById$1.set(block.id, measurement);
|
|
278728
278705
|
}));
|
|
278729
278706
|
return {
|
|
@@ -279679,9 +279656,9 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
279679
279656
|
};
|
|
279680
279657
|
} : undefined;
|
|
279681
279658
|
if (headerFooter.headerBlocks)
|
|
279682
|
-
headers = serializeHeaderFooterResults("header", await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "header"));
|
|
279659
|
+
headers = serializeHeaderFooterResults("header", await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "header", fontSignature));
|
|
279683
279660
|
if (headerFooter.footerBlocks)
|
|
279684
|
-
footers = serializeHeaderFooterResults("footer", await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "footer"));
|
|
279661
|
+
footers = serializeHeaderFooterResults("footer", await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "footer", fontSignature));
|
|
279685
279662
|
perfLog$1(`[Perf] 4.4 Header/footer layout: ${(performance.now() - hfStart).toFixed(2)}ms`);
|
|
279686
279663
|
const cacheStats = headerMeasureCache.getStats();
|
|
279687
279664
|
globalMetrics.recordHeaderFooterCacheMetrics(cacheStats);
|
|
@@ -286175,14 +286152,14 @@ function getCanvasContext() {
|
|
|
286175
286152
|
}
|
|
286176
286153
|
return canvasContext;
|
|
286177
286154
|
}
|
|
286178
|
-
function buildFontString(run2) {
|
|
286155
|
+
function buildFontString(run2, resolvePhysical = resolvePhysicalFamily) {
|
|
286179
286156
|
const parts = [];
|
|
286180
286157
|
if (run2.italic)
|
|
286181
286158
|
parts.push("italic");
|
|
286182
286159
|
if (run2.bold)
|
|
286183
286160
|
parts.push("bold");
|
|
286184
286161
|
parts.push(`${run2.fontSize}px`);
|
|
286185
|
-
const physicalFamily =
|
|
286162
|
+
const physicalFamily = resolvePhysical(run2.fontFamily);
|
|
286186
286163
|
if (measurementConfig.mode === "deterministic")
|
|
286187
286164
|
parts.push(measurementConfig.fonts.fallbackStack.length > 0 ? measurementConfig.fonts.fallbackStack.join(", ") : measurementConfig.fonts.deterministicFamily);
|
|
286188
286165
|
else
|
|
@@ -286275,7 +286252,7 @@ function isLineBreakRun(run2) {
|
|
|
286275
286252
|
function isFieldAnnotationRun(run2) {
|
|
286276
286253
|
return run2.kind === "fieldAnnotation";
|
|
286277
286254
|
}
|
|
286278
|
-
function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator = ".") {
|
|
286255
|
+
function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator = ".", resolvePhysical = resolvePhysicalFamily) {
|
|
286279
286256
|
const result = {
|
|
286280
286257
|
totalWidth: 0,
|
|
286281
286258
|
runs: [],
|
|
@@ -286296,7 +286273,7 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
286296
286273
|
const textRun = run2;
|
|
286297
286274
|
const text5 = textRun.text || "";
|
|
286298
286275
|
if (text5.length > 0) {
|
|
286299
|
-
const { font } = buildFontString(textRun);
|
|
286276
|
+
const { font } = buildFontString(textRun, resolvePhysical);
|
|
286300
286277
|
const width = measureRunWidth(text5, font, ctx$1, textRun, 0);
|
|
286301
286278
|
let beforeDecimalWidth;
|
|
286302
286279
|
if (!foundDecimal) {
|
|
@@ -286350,7 +286327,7 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
286350
286327
|
fontSize,
|
|
286351
286328
|
bold: run2.bold,
|
|
286352
286329
|
italic: run2.italic
|
|
286353
|
-
});
|
|
286330
|
+
}, resolvePhysical);
|
|
286354
286331
|
const pillWidth = (run2.displayLabel ? measureRunWidth(run2.displayLabel, font, ctx$1, run2, 0) : 0) + FIELD_ANNOTATION_PILL_PADDING;
|
|
286355
286332
|
result.runs.push({
|
|
286356
286333
|
runIndex: i4,
|
|
@@ -286366,25 +286343,25 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
286366
286343
|
}
|
|
286367
286344
|
return result;
|
|
286368
286345
|
}
|
|
286369
|
-
async function measureBlock(block, constraints) {
|
|
286346
|
+
async function measureBlock(block, constraints, resolvePhysical = resolvePhysicalFamily) {
|
|
286370
286347
|
const normalized = normalizeConstraints(constraints);
|
|
286371
286348
|
if (block.kind === "drawing")
|
|
286372
286349
|
return measureDrawingBlock(block, normalized);
|
|
286373
286350
|
if (block.kind === "image")
|
|
286374
286351
|
return measureImageBlock(block, normalized);
|
|
286375
286352
|
if (block.kind === "list")
|
|
286376
|
-
return measureListBlock(block, normalized);
|
|
286353
|
+
return measureListBlock(block, normalized, resolvePhysical);
|
|
286377
286354
|
if (block.kind === "table")
|
|
286378
|
-
return measureTableBlock(block, normalized);
|
|
286355
|
+
return measureTableBlock(block, normalized, resolvePhysical);
|
|
286379
286356
|
if (block.kind === "sectionBreak")
|
|
286380
286357
|
return { kind: "sectionBreak" };
|
|
286381
286358
|
if (block.kind === "pageBreak")
|
|
286382
286359
|
return { kind: "pageBreak" };
|
|
286383
286360
|
if (block.kind === "columnBreak")
|
|
286384
286361
|
return { kind: "columnBreak" };
|
|
286385
|
-
return measureParagraphBlock(block, normalized.maxWidth);
|
|
286362
|
+
return measureParagraphBlock(block, normalized.maxWidth, resolvePhysical);
|
|
286386
286363
|
}
|
|
286387
|
-
async function measureParagraphBlock(block, maxWidth) {
|
|
286364
|
+
async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolvePhysicalFamily) {
|
|
286388
286365
|
const ctx$1 = getCanvasContext();
|
|
286389
286366
|
const wordLayout = block.attrs?.wordLayout;
|
|
286390
286367
|
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
@@ -286397,7 +286374,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
286397
286374
|
fontSize: wordLayout.marker.run.fontSize ?? fallbackFontSize,
|
|
286398
286375
|
bold: wordLayout.marker.run.bold,
|
|
286399
286376
|
italic: wordLayout.marker.run.italic
|
|
286400
|
-
});
|
|
286377
|
+
}, resolvePhysical);
|
|
286401
286378
|
const markerText = wordLayout.marker.markerText ?? "";
|
|
286402
286379
|
const glyphWidth = markerText ? measureText(markerText, markerFont, ctx$1) : 0;
|
|
286403
286380
|
const gutter = typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx >= 0 ? wordLayout.marker.gutterWidthPx : 8;
|
|
@@ -286430,7 +286407,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
286430
286407
|
fontSize: marker.run?.fontSize ?? fallbackFontSize,
|
|
286431
286408
|
bold: marker.run?.bold ?? false,
|
|
286432
286409
|
italic: marker.run?.italic ?? false
|
|
286433
|
-
});
|
|
286410
|
+
}, resolvePhysical);
|
|
286434
286411
|
return measureText(markerText, markerFont, ctx$1);
|
|
286435
286412
|
}) ?? textStartPx;
|
|
286436
286413
|
if (typeof effectiveTextStartPx === "number" && effectiveTextStartPx > indentLeft)
|
|
@@ -286454,7 +286431,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
286454
286431
|
if (!dropCapDescriptor.run || !dropCapDescriptor.run.text || !dropCapDescriptor.lines)
|
|
286455
286432
|
console.warn("Invalid drop cap descriptor - missing required fields:", dropCapDescriptor);
|
|
286456
286433
|
else {
|
|
286457
|
-
const dropCapMeasured = measureDropCap(ctx$1, dropCapDescriptor, spacing);
|
|
286434
|
+
const dropCapMeasured = measureDropCap(ctx$1, dropCapDescriptor, spacing, resolvePhysical);
|
|
286458
286435
|
dropCapMeasure = dropCapMeasured;
|
|
286459
286436
|
dropCapDescriptor.measuredWidth = dropCapMeasured.width;
|
|
286460
286437
|
dropCapDescriptor.measuredHeight = dropCapMeasured.height;
|
|
@@ -286679,7 +286656,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
286679
286656
|
if (lineToTrim.fromRun === lineToTrim.toRun && sliceText.trim().length === 0)
|
|
286680
286657
|
return;
|
|
286681
286658
|
const keptText = sliceText.slice(0, Math.max(0, sliceText.length - trimCount));
|
|
286682
|
-
const { font } = buildFontString(lastRun);
|
|
286659
|
+
const { font } = buildFontString(lastRun, resolvePhysical);
|
|
286683
286660
|
const fullWidth = measureRunWidth(sliceText, font, ctx$1, lastRun, sliceStart);
|
|
286684
286661
|
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx$1, lastRun, sliceStart) : 0;
|
|
286685
286662
|
const delta = Math.max(0, fullWidth - keptWidth);
|
|
@@ -286876,7 +286853,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
286876
286853
|
if (stop) {
|
|
286877
286854
|
validateTabStopVal(stop);
|
|
286878
286855
|
if (stop.val === "end" || stop.val === "center" || stop.val === "decimal") {
|
|
286879
|
-
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx$1, decimalSeparator);
|
|
286856
|
+
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx$1, decimalSeparator, resolvePhysical);
|
|
286880
286857
|
if (groupMeasure.totalWidth > 0) {
|
|
286881
286858
|
const relativeTarget = clampedTarget - effectiveIndent;
|
|
286882
286859
|
let groupStartX;
|
|
@@ -287153,7 +287130,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
287153
287130
|
continue;
|
|
287154
287131
|
}
|
|
287155
287132
|
if (isEmptySdtPlaceholderRun(run2)) {
|
|
287156
|
-
const placeholderFont = buildFontString(run2).font;
|
|
287133
|
+
const placeholderFont = buildFontString(run2, resolvePhysical).font;
|
|
287157
287134
|
const placeholderText = applyTextTransform(EMPTY_SDT_PLACEHOLDER_TEXT, run2);
|
|
287158
287135
|
const measuredPlaceholderWidth = getMeasuredTextWidth(placeholderText, placeholderFont, run2.letterSpacing ?? 0, ctx$1);
|
|
287159
287136
|
const fallbackPlaceholderWidth = placeholderText.length * run2.fontSize * 0.45;
|
|
@@ -287225,7 +287202,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
287225
287202
|
}
|
|
287226
287203
|
lastFontSize = run2.fontSize;
|
|
287227
287204
|
hasSeenTextRun = true;
|
|
287228
|
-
const { font } = buildFontString(run2);
|
|
287205
|
+
const { font } = buildFontString(run2, resolvePhysical);
|
|
287229
287206
|
const tabSegments = run2.text.split("\t");
|
|
287230
287207
|
let charPosInRun = 0;
|
|
287231
287208
|
for (let segmentIndex = 0;segmentIndex < tabSegments.length; segmentIndex++) {
|
|
@@ -287779,7 +287756,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
287779
287756
|
...dropCapMeasure ? { dropCap: dropCapMeasure } : {}
|
|
287780
287757
|
};
|
|
287781
287758
|
}
|
|
287782
|
-
async function measureTableBlock(block, constraints) {
|
|
287759
|
+
async function measureTableBlock(block, constraints, resolvePhysical = resolvePhysicalFamily) {
|
|
287783
287760
|
const workingInput = buildAutoFitWorkingGridInput(block, { maxWidth: typeof constraints === "number" ? constraints : constraints.maxWidth });
|
|
287784
287761
|
const columnWidths = await resolveRuntimeTableColumnWidths(block, workingInput);
|
|
287785
287762
|
const gridColumnCount = columnWidths.length;
|
|
@@ -287832,7 +287809,7 @@ async function measureTableBlock(block, constraints) {
|
|
|
287832
287809
|
const measure = await measureBlock(block$1, {
|
|
287833
287810
|
maxWidth: contentWidth$1,
|
|
287834
287811
|
maxHeight: Infinity
|
|
287835
|
-
});
|
|
287812
|
+
}, resolvePhysical);
|
|
287836
287813
|
blockMeasures.push(measure);
|
|
287837
287814
|
const blockHeight = "totalHeight" in measure ? measure.totalHeight : ("height" in measure) ? measure.height : 0;
|
|
287838
287815
|
if ((block$1.kind === "image" || block$1.kind === "drawing") && block$1.anchor?.isAnchored === true && (block$1.wrap?.type ?? "Inline") !== "Inline")
|
|
@@ -288060,7 +288037,7 @@ function normalizeConstraints(constraints) {
|
|
|
288060
288037
|
return { maxWidth: constraints };
|
|
288061
288038
|
return constraints;
|
|
288062
288039
|
}
|
|
288063
|
-
async function measureListBlock(block, constraints) {
|
|
288040
|
+
async function measureListBlock(block, constraints, resolvePhysical = resolvePhysicalFamily) {
|
|
288064
288041
|
const ctx$1 = getCanvasContext();
|
|
288065
288042
|
const items = [];
|
|
288066
288043
|
let totalHeight = 0;
|
|
@@ -288079,12 +288056,12 @@ async function measureListBlock(block, constraints) {
|
|
|
288079
288056
|
bold: marker.run.bold,
|
|
288080
288057
|
italic: marker.run.italic,
|
|
288081
288058
|
letterSpacing: marker.run.letterSpacing
|
|
288082
|
-
});
|
|
288059
|
+
}, resolvePhysical);
|
|
288083
288060
|
markerTextWidth = marker.markerText ? measureText(marker.markerText, markerFont, ctx$1) : 0;
|
|
288084
288061
|
markerWidth = 0;
|
|
288085
288062
|
indentLeft = wordLayout.indentLeftPx ?? 0;
|
|
288086
288063
|
} else {
|
|
288087
|
-
const { font: markerFont } = buildFontString(getPrimaryRun(item.paragraph));
|
|
288064
|
+
const { font: markerFont } = buildFontString(getPrimaryRun(item.paragraph), resolvePhysical);
|
|
288088
288065
|
const markerText = item.marker.text ?? "";
|
|
288089
288066
|
markerTextWidth = markerText ? measureText(markerText, markerFont, ctx$1) : 0;
|
|
288090
288067
|
indentLeft = resolveIndentLeft(item);
|
|
@@ -288092,7 +288069,7 @@ async function measureListBlock(block, constraints) {
|
|
|
288092
288069
|
markerWidth = Math.max(24, markerTextWidth + 8, indentHanging);
|
|
288093
288070
|
}
|
|
288094
288071
|
const paragraphWidth = Math.max(1, constraints.maxWidth - indentLeft - markerWidth);
|
|
288095
|
-
const paragraphMeasure = await measureParagraphBlock(item.paragraph, paragraphWidth);
|
|
288072
|
+
const paragraphMeasure = await measureParagraphBlock(item.paragraph, paragraphWidth, resolvePhysical);
|
|
288096
288073
|
totalHeight += paragraphMeasure.totalHeight;
|
|
288097
288074
|
items.push({
|
|
288098
288075
|
itemId: item.id,
|
|
@@ -288108,7 +288085,7 @@ async function measureListBlock(block, constraints) {
|
|
|
288108
288085
|
totalHeight
|
|
288109
288086
|
};
|
|
288110
288087
|
}
|
|
288111
|
-
async function layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetadata, deps) {
|
|
288088
|
+
async function layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetadata, deps, fontResolver) {
|
|
288112
288089
|
deps.headerLayoutsByRId.clear();
|
|
288113
288090
|
deps.footerLayoutsByRId.clear();
|
|
288114
288091
|
if (!headerFooterInput)
|
|
@@ -288131,25 +288108,27 @@ async function layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetad
|
|
|
288131
288108
|
};
|
|
288132
288109
|
};
|
|
288133
288110
|
if (sectionMetadata.length > 1 && sectionMetadata.some((s2) => s2.margins || s2.pageSize)) {
|
|
288134
|
-
await layoutWithPerSectionConstraints("header", headerBlocksByRId, sectionMetadata, constraints, pageResolver, deps.headerLayoutsByRId);
|
|
288135
|
-
await layoutWithPerSectionConstraints("footer", footerBlocksByRId, sectionMetadata, constraints, pageResolver, deps.footerLayoutsByRId);
|
|
288111
|
+
await layoutWithPerSectionConstraints("header", headerBlocksByRId, sectionMetadata, constraints, pageResolver, deps.headerLayoutsByRId, fontResolver);
|
|
288112
|
+
await layoutWithPerSectionConstraints("footer", footerBlocksByRId, sectionMetadata, constraints, pageResolver, deps.footerLayoutsByRId, fontResolver);
|
|
288136
288113
|
} else {
|
|
288137
288114
|
const effectiveHeaderRefsBySection = buildEffectiveHeaderFooterRefsBySection(sectionMetadata, "header");
|
|
288138
288115
|
const effectiveFooterRefsBySection = buildEffectiveHeaderFooterRefsBySection(sectionMetadata, "footer");
|
|
288139
|
-
await layoutBlocksByRId("header", headerBlocksByRId, collectReferencedHeaderFooterRIds(effectiveHeaderRefsBySection), constraints, pageResolver, deps.headerLayoutsByRId);
|
|
288140
|
-
await layoutBlocksByRId("footer", footerBlocksByRId, collectReferencedHeaderFooterRIds(effectiveFooterRefsBySection), constraints, pageResolver, deps.footerLayoutsByRId);
|
|
288116
|
+
await layoutBlocksByRId("header", headerBlocksByRId, collectReferencedHeaderFooterRIds(effectiveHeaderRefsBySection), constraints, pageResolver, deps.headerLayoutsByRId, fontResolver);
|
|
288117
|
+
await layoutBlocksByRId("footer", footerBlocksByRId, collectReferencedHeaderFooterRIds(effectiveFooterRefsBySection), constraints, pageResolver, deps.footerLayoutsByRId, fontResolver);
|
|
288141
288118
|
}
|
|
288142
288119
|
}
|
|
288143
|
-
async function layoutBlocksByRId(kind, blocksByRId, referencedRIds, constraints, pageResolver, layoutsByRId) {
|
|
288120
|
+
async function layoutBlocksByRId(kind, blocksByRId, referencedRIds, constraints, pageResolver, layoutsByRId, fontResolver) {
|
|
288144
288121
|
if (!blocksByRId || referencedRIds.size === 0)
|
|
288145
288122
|
return;
|
|
288123
|
+
const resolvePhysical = fontResolver ? (css) => fontResolver.resolvePhysicalFamily(css) : undefined;
|
|
288124
|
+
const fontSignature = fontResolver?.signature ?? "";
|
|
288146
288125
|
for (const [rId, blocks2] of blocksByRId) {
|
|
288147
288126
|
if (!referencedRIds.has(rId))
|
|
288148
288127
|
continue;
|
|
288149
288128
|
if (!blocks2 || blocks2.length === 0)
|
|
288150
288129
|
continue;
|
|
288151
288130
|
try {
|
|
288152
|
-
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c), undefined, undefined, pageResolver, kind);
|
|
288131
|
+
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c, resolvePhysical), undefined, undefined, pageResolver, kind, fontSignature);
|
|
288153
288132
|
if (batchResult.default)
|
|
288154
288133
|
layoutsByRId.set(rId, {
|
|
288155
288134
|
kind,
|
|
@@ -288195,16 +288174,18 @@ function adjustFramePositionsForContentWidth(layout, blocks2, effectiveWidth, co
|
|
|
288195
288174
|
fragment2.x -= widthDiff / 2;
|
|
288196
288175
|
}
|
|
288197
288176
|
}
|
|
288198
|
-
async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadata, fallbackConstraints, pageResolver, layoutsByRId) {
|
|
288177
|
+
async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadata, fallbackConstraints, pageResolver, layoutsByRId, fontResolver) {
|
|
288199
288178
|
if (!blocksByRId)
|
|
288200
288179
|
return;
|
|
288180
|
+
const resolvePhysical = fontResolver ? (css) => fontResolver.resolvePhysicalFamily(css) : undefined;
|
|
288181
|
+
const fontSignature = fontResolver?.signature ?? "";
|
|
288201
288182
|
const groups = buildSectionAwareHeaderFooterMeasurementGroups(kind, blocksByRId, sectionMetadata, fallbackConstraints);
|
|
288202
288183
|
for (const group of groups) {
|
|
288203
288184
|
const blocks2 = blocksByRId.get(group.rId);
|
|
288204
288185
|
if (!blocks2 || blocks2.length === 0)
|
|
288205
288186
|
continue;
|
|
288206
288187
|
try {
|
|
288207
|
-
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c), undefined, undefined, pageResolver, kind);
|
|
288188
|
+
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c, resolvePhysical), undefined, undefined, pageResolver, kind, fontSignature);
|
|
288208
288189
|
if (batchResult.default)
|
|
288209
288190
|
for (const sectionIndex of group.sectionIndices) {
|
|
288210
288191
|
const contentWidth = buildSectionContentWidth(sectionMetadata.find((s2) => s2.sectionIndex === sectionIndex), fallbackConstraints);
|
|
@@ -288567,9 +288548,9 @@ function refForVariant(refs, variant) {
|
|
|
288567
288548
|
matchedVariant: "default"
|
|
288568
288549
|
} : undefined;
|
|
288569
288550
|
}
|
|
288570
|
-
function resolveResult(result, storyId) {
|
|
288551
|
+
function resolveResult(result, storyId, fontSignature = "") {
|
|
288571
288552
|
const story = buildHeaderFooterStory(result.kind, storyId ?? String(result.type));
|
|
288572
|
-
return resolveHeaderFooterLayout(result.layout, result.blocks, result.measures, story);
|
|
288553
|
+
return resolveHeaderFooterLayout(result.layout, result.blocks, result.measures, story, fontSignature);
|
|
288573
288554
|
}
|
|
288574
288555
|
function shiftResolvedPaintItemY(item, yOffset) {
|
|
288575
288556
|
if (item.kind === "group")
|
|
@@ -288857,10 +288838,10 @@ function defaultInvalidate() {
|
|
|
288857
288838
|
function faceKey(req) {
|
|
288858
288839
|
return `${req.family.toLowerCase()}|${req.weight}|${req.style}`;
|
|
288859
288840
|
}
|
|
288860
|
-
function collect(out, node3) {
|
|
288841
|
+
function collect(out, node3, resolve3) {
|
|
288861
288842
|
if (!node3 || typeof node3.fontFamily !== "string" || !node3.fontFamily)
|
|
288862
288843
|
return;
|
|
288863
|
-
const family$1 =
|
|
288844
|
+
const family$1 = resolve3(node3.fontFamily);
|
|
288864
288845
|
if (!family$1)
|
|
288865
288846
|
return;
|
|
288866
288847
|
const req = {
|
|
@@ -288872,7 +288853,7 @@ function collect(out, node3) {
|
|
|
288872
288853
|
if (!out.has(key2))
|
|
288873
288854
|
out.set(key2, req);
|
|
288874
288855
|
}
|
|
288875
|
-
function collectRuns(out, runs2) {
|
|
288856
|
+
function collectRuns(out, runs2, resolve3) {
|
|
288876
288857
|
if (!runs2)
|
|
288877
288858
|
return;
|
|
288878
288859
|
for (const run2 of runs2) {
|
|
@@ -288881,51 +288862,52 @@ function collectRuns(out, runs2) {
|
|
|
288881
288862
|
collect(out, {
|
|
288882
288863
|
...bearing,
|
|
288883
288864
|
fontFamily: "Arial"
|
|
288884
|
-
});
|
|
288865
|
+
}, resolve3);
|
|
288885
288866
|
else
|
|
288886
|
-
collect(out, bearing);
|
|
288867
|
+
collect(out, bearing, resolve3);
|
|
288887
288868
|
}
|
|
288888
288869
|
}
|
|
288889
|
-
function collectParagraph(out, paragraph2) {
|
|
288870
|
+
function collectParagraph(out, paragraph2, resolve3) {
|
|
288890
288871
|
if (!paragraph2)
|
|
288891
288872
|
return;
|
|
288892
|
-
collectRuns(out, paragraph2.runs);
|
|
288893
|
-
collect(out, paragraph2.attrs?.wordLayout?.marker?.run);
|
|
288894
|
-
collect(out, paragraph2.attrs?.dropCapDescriptor?.run);
|
|
288873
|
+
collectRuns(out, paragraph2.runs, resolve3);
|
|
288874
|
+
collect(out, paragraph2.attrs?.wordLayout?.marker?.run, resolve3);
|
|
288875
|
+
collect(out, paragraph2.attrs?.dropCapDescriptor?.run, resolve3);
|
|
288895
288876
|
}
|
|
288896
|
-
function collectTable(out, table2) {
|
|
288877
|
+
function collectTable(out, table2, resolve3) {
|
|
288897
288878
|
for (const row2 of table2.rows)
|
|
288898
288879
|
for (const cell2 of row2.cells) {
|
|
288899
|
-
collectParagraph(out, cell2.paragraph);
|
|
288880
|
+
collectParagraph(out, cell2.paragraph, resolve3);
|
|
288900
288881
|
if (cell2.blocks)
|
|
288901
288882
|
for (const b$1 of cell2.blocks)
|
|
288902
|
-
collectBlock(out, b$1);
|
|
288883
|
+
collectBlock(out, b$1, resolve3);
|
|
288903
288884
|
}
|
|
288904
288885
|
}
|
|
288905
|
-
function collectList(out, list5) {
|
|
288886
|
+
function collectList(out, list5, resolve3) {
|
|
288906
288887
|
for (const item of list5.items)
|
|
288907
|
-
collectParagraph(out, item.paragraph);
|
|
288888
|
+
collectParagraph(out, item.paragraph, resolve3);
|
|
288908
288889
|
}
|
|
288909
|
-
function collectBlock(out, block) {
|
|
288890
|
+
function collectBlock(out, block, resolve3) {
|
|
288910
288891
|
switch (block.kind) {
|
|
288911
288892
|
case "paragraph":
|
|
288912
|
-
collectParagraph(out, block);
|
|
288893
|
+
collectParagraph(out, block, resolve3);
|
|
288913
288894
|
break;
|
|
288914
288895
|
case "table":
|
|
288915
|
-
collectTable(out, block);
|
|
288896
|
+
collectTable(out, block, resolve3);
|
|
288916
288897
|
break;
|
|
288917
288898
|
case "list":
|
|
288918
|
-
collectList(out, block);
|
|
288899
|
+
collectList(out, block, resolve3);
|
|
288919
288900
|
break;
|
|
288920
288901
|
default:
|
|
288921
288902
|
break;
|
|
288922
288903
|
}
|
|
288923
288904
|
}
|
|
288924
|
-
function planRequiredFontFaces(blocks2) {
|
|
288905
|
+
function planRequiredFontFaces(blocks2, resolver2) {
|
|
288906
|
+
const resolve3 = resolver2 ? (family$1) => resolver2.resolvePrimaryPhysicalFamily(family$1) : resolvePrimaryPhysicalFamily;
|
|
288925
288907
|
const out = /* @__PURE__ */ new Map;
|
|
288926
288908
|
if (blocks2)
|
|
288927
288909
|
for (const block of blocks2)
|
|
288928
|
-
collectBlock(out, block);
|
|
288910
|
+
collectBlock(out, block, resolve3);
|
|
288929
288911
|
return [...out.values()];
|
|
288930
288912
|
}
|
|
288931
288913
|
function buildSemanticFootnoteBlocks(input2, footnotesMode) {
|
|
@@ -312178,7 +312160,88 @@ menclose::after {
|
|
|
312178
312160
|
const visualTextEndOffset = lineEl.dir === "rtl" || lineEl.style.direction === "rtl" ? alignmentOffset : alignmentOffset + lineWidth;
|
|
312179
312161
|
mark2.style.left = `${Math.max(0, leftOffsetPx + visualTextEndOffset)}px`;
|
|
312180
312162
|
lineEl.appendChild(mark2);
|
|
312181
|
-
}, SETTLED_STATUSES, BUNDLED_SUBSTITUTES,
|
|
312163
|
+
}, SETTLED_STATUSES, BUNDLED_SUBSTITUTES, FontResolver = class {
|
|
312164
|
+
#overrides = /* @__PURE__ */ new Map;
|
|
312165
|
+
#version = 0;
|
|
312166
|
+
map(logicalFamily, physicalFamily) {
|
|
312167
|
+
const key2 = normalizeFamilyKey$2(logicalFamily);
|
|
312168
|
+
const physical = physicalFamily?.trim();
|
|
312169
|
+
if (!key2 || !physical)
|
|
312170
|
+
return;
|
|
312171
|
+
if (this.#overrides.get(key2) === physical)
|
|
312172
|
+
return;
|
|
312173
|
+
this.#overrides.set(key2, physical);
|
|
312174
|
+
this.#version += 1;
|
|
312175
|
+
}
|
|
312176
|
+
unmap(logicalFamily) {
|
|
312177
|
+
if (this.#overrides.delete(normalizeFamilyKey$2(logicalFamily)))
|
|
312178
|
+
this.#version += 1;
|
|
312179
|
+
}
|
|
312180
|
+
reset() {
|
|
312181
|
+
if (this.#overrides.size === 0)
|
|
312182
|
+
return;
|
|
312183
|
+
this.#overrides.clear();
|
|
312184
|
+
this.#version += 1;
|
|
312185
|
+
}
|
|
312186
|
+
get version() {
|
|
312187
|
+
return this.#version;
|
|
312188
|
+
}
|
|
312189
|
+
get signature() {
|
|
312190
|
+
if (this.#overrides.size === 0)
|
|
312191
|
+
return "";
|
|
312192
|
+
return JSON.stringify([...this.#overrides.entries()].sort(([a2], [b$1]) => a2 < b$1 ? -1 : a2 > b$1 ? 1 : 0));
|
|
312193
|
+
}
|
|
312194
|
+
#physicalFor(bareFamily) {
|
|
312195
|
+
const key2 = normalizeFamilyKey$2(bareFamily);
|
|
312196
|
+
const override = this.#overrides.get(key2);
|
|
312197
|
+
if (override)
|
|
312198
|
+
return {
|
|
312199
|
+
physical: override,
|
|
312200
|
+
reason: "custom_mapping"
|
|
312201
|
+
};
|
|
312202
|
+
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
312203
|
+
if (bundled)
|
|
312204
|
+
return {
|
|
312205
|
+
physical: bundled,
|
|
312206
|
+
reason: "bundled_substitute"
|
|
312207
|
+
};
|
|
312208
|
+
return {
|
|
312209
|
+
physical: bareFamily,
|
|
312210
|
+
reason: "as_requested"
|
|
312211
|
+
};
|
|
312212
|
+
}
|
|
312213
|
+
resolveFontFamily(logicalFamily) {
|
|
312214
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
312215
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
312216
|
+
return {
|
|
312217
|
+
logicalFamily,
|
|
312218
|
+
physicalFamily: physical,
|
|
312219
|
+
reason
|
|
312220
|
+
};
|
|
312221
|
+
}
|
|
312222
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
312223
|
+
if (!cssFontFamily)
|
|
312224
|
+
return cssFontFamily;
|
|
312225
|
+
const parts = splitStack(cssFontFamily);
|
|
312226
|
+
if (parts.length === 0)
|
|
312227
|
+
return cssFontFamily;
|
|
312228
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
312229
|
+
if (reason === "as_requested")
|
|
312230
|
+
return cssFontFamily;
|
|
312231
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
312232
|
+
}
|
|
312233
|
+
resolvePrimaryPhysicalFamily(family$1) {
|
|
312234
|
+
const primary = splitStack(family$1)[0] ?? family$1;
|
|
312235
|
+
return this.#physicalFor(primary).physical;
|
|
312236
|
+
}
|
|
312237
|
+
resolvePhysicalFamilies(families) {
|
|
312238
|
+
const out = /* @__PURE__ */ new Set;
|
|
312239
|
+
for (const family$1 of families)
|
|
312240
|
+
if (family$1)
|
|
312241
|
+
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
312242
|
+
return [...out];
|
|
312243
|
+
}
|
|
312244
|
+
}, defaultResolver, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
312182
312245
|
#fontSet;
|
|
312183
312246
|
#FontFaceCtor;
|
|
312184
312247
|
#probeSize;
|
|
@@ -312454,10 +312517,10 @@ menclose::after {
|
|
|
312454
312517
|
}
|
|
312455
312518
|
if (run2.vertAlign === "baseline")
|
|
312456
312519
|
element3.style.verticalAlign = "baseline";
|
|
312457
|
-
}, applyRunStyles = (element3, run2, _isLink = false) => {
|
|
312520
|
+
}, applyRunStyles = (element3, run2, _isLink = false, resolvePhysical = resolvePhysicalFamily) => {
|
|
312458
312521
|
if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
|
|
312459
312522
|
return;
|
|
312460
|
-
element3.style.fontFamily =
|
|
312523
|
+
element3.style.fontFamily = resolvePhysical(run2.fontFamily);
|
|
312461
312524
|
element3.style.fontSize = `${run2.fontSize}px`;
|
|
312462
312525
|
if (run2.bold)
|
|
312463
312526
|
element3.style.fontWeight = "bold";
|
|
@@ -312558,7 +312621,7 @@ menclose::after {
|
|
|
312558
312621
|
if (linkData.tooltip)
|
|
312559
312622
|
renderContext.pendingTooltips.set(elem, linkData.tooltip);
|
|
312560
312623
|
}
|
|
312561
|
-
applyRunStyles(elem, run2, isActiveLink);
|
|
312624
|
+
applyRunStyles(elem, run2, isActiveLink, renderContext.resolvePhysical);
|
|
312562
312625
|
const dirAttr = resolveRunDirectionAttribute({
|
|
312563
312626
|
runText: run2.text,
|
|
312564
312627
|
effectiveText,
|
|
@@ -313242,7 +313305,7 @@ menclose::after {
|
|
|
313242
313305
|
if (run2.pmEnd != null)
|
|
313243
313306
|
elem.dataset.pmEnd = String(run2.pmEnd);
|
|
313244
313307
|
renderContext.applySdtDataset(elem, run2.sdt);
|
|
313245
|
-
applyRunStyles(elem, run2);
|
|
313308
|
+
applyRunStyles(elem, run2, false, renderContext.resolvePhysical);
|
|
313246
313309
|
return elem;
|
|
313247
313310
|
}, renderRun = (run2, context, renderContext, trackedConfig) => {
|
|
313248
313311
|
if (isImageRun$1(run2))
|
|
@@ -316163,6 +316226,7 @@ menclose::after {
|
|
|
316163
316226
|
layoutEpoch: this.layoutEpoch,
|
|
316164
316227
|
showFormattingMarks: this.showFormattingMarks,
|
|
316165
316228
|
contentControlsChrome: this.contentControlsChrome,
|
|
316229
|
+
resolvePhysical: this.options.resolvePhysical,
|
|
316166
316230
|
pendingTooltips: this.pendingTooltips,
|
|
316167
316231
|
getNextLinkId: () => `superdoc-link-${++this.linkIdCounter}`,
|
|
316168
316232
|
applySdtDataset,
|
|
@@ -317850,10 +317914,10 @@ menclose::after {
|
|
|
317850
317914
|
this.cache = /* @__PURE__ */ new Map;
|
|
317851
317915
|
this.stats = createStats();
|
|
317852
317916
|
}
|
|
317853
|
-
get(block, width, height) {
|
|
317917
|
+
get(block, width, height, fontSignature = "") {
|
|
317854
317918
|
if (!block || !block.id)
|
|
317855
317919
|
return;
|
|
317856
|
-
const key2 = this.composeKey(block, width, height);
|
|
317920
|
+
const key2 = this.composeKey(block, width, height, fontSignature);
|
|
317857
317921
|
const value = this.cache.get(key2);
|
|
317858
317922
|
if (value !== undefined) {
|
|
317859
317923
|
this.stats.hits += 1;
|
|
@@ -317865,10 +317929,10 @@ menclose::after {
|
|
|
317865
317929
|
return;
|
|
317866
317930
|
}
|
|
317867
317931
|
}
|
|
317868
|
-
set(block, width, height, value) {
|
|
317932
|
+
set(block, width, height, value, fontSignature = "") {
|
|
317869
317933
|
if (!block || !block.id)
|
|
317870
317934
|
return;
|
|
317871
|
-
const key2 = this.composeKey(block, width, height);
|
|
317935
|
+
const key2 = this.composeKey(block, width, height, fontSignature);
|
|
317872
317936
|
if (this.cache.has(key2))
|
|
317873
317937
|
this.cache.delete(key2);
|
|
317874
317938
|
if (this.cache.size >= MAX_CACHE_SIZE$1) {
|
|
@@ -317922,11 +317986,11 @@ menclose::after {
|
|
|
317922
317986
|
this.stats.size = this.cache.size;
|
|
317923
317987
|
this.stats.memorySizeEstimate = this.cache.size * BYTES_PER_ENTRY_ESTIMATE;
|
|
317924
317988
|
}
|
|
317925
|
-
composeKey(block, width, height) {
|
|
317989
|
+
composeKey(block, width, height, fontSignature) {
|
|
317926
317990
|
const safeWidth = Number.isFinite(width) ? Math.max(0, Math.min(Math.floor(width), MAX_DIMENSION)) : 0;
|
|
317927
317991
|
const safeHeight = Number.isFinite(height) ? Math.max(0, Math.min(Math.floor(height), MAX_DIMENSION)) : 0;
|
|
317928
317992
|
const hash$3 = hashRuns(block);
|
|
317929
|
-
return `${block.id}@${safeWidth}x${safeHeight}:${hash$3}`;
|
|
317993
|
+
return `${block.id}@${safeWidth}x${safeHeight}:${hash$3}#${fontSignature}`;
|
|
317930
317994
|
}
|
|
317931
317995
|
}, FeatureFlags, PageTokenLogger, HeaderFooterCacheLogger, MetricsCollector = class {
|
|
317932
317996
|
constructor() {
|
|
@@ -317983,10 +318047,10 @@ menclose::after {
|
|
|
317983
318047
|
constructor() {
|
|
317984
318048
|
this.cache = new MeasureCache;
|
|
317985
318049
|
}
|
|
317986
|
-
async measureBlocks(blocks2, constraints, measureBlock$1) {
|
|
318050
|
+
async measureBlocks(blocks2, constraints, measureBlock$1, fontSignature = "") {
|
|
317987
318051
|
const measures = [];
|
|
317988
318052
|
for (const block of blocks2) {
|
|
317989
|
-
const cached = this.cache.get(block, constraints.width, constraints.height);
|
|
318053
|
+
const cached = this.cache.get(block, constraints.width, constraints.height, fontSignature);
|
|
317990
318054
|
if (cached) {
|
|
317991
318055
|
measures.push(cached);
|
|
317992
318056
|
continue;
|
|
@@ -317995,7 +318059,7 @@ menclose::after {
|
|
|
317995
318059
|
maxWidth: constraints.width,
|
|
317996
318060
|
maxHeight: constraints.height
|
|
317997
318061
|
});
|
|
317998
|
-
this.cache.set(block, constraints.width, constraints.height, measurement);
|
|
318062
|
+
this.cache.set(block, constraints.width, constraints.height, measurement, fontSignature);
|
|
317999
318063
|
measures.push(measurement);
|
|
318000
318064
|
}
|
|
318001
318065
|
return measures;
|
|
@@ -323597,14 +323661,14 @@ menclose::after {
|
|
|
323597
323661
|
if (value === ",")
|
|
323598
323662
|
return ",";
|
|
323599
323663
|
return DEFAULT_DECIMAL_SEPARATOR2;
|
|
323600
|
-
}, DROP_CAP_PADDING_PX = 4, measureDropCap = (ctx$1, descriptor, spacing) => {
|
|
323664
|
+
}, DROP_CAP_PADDING_PX = 4, measureDropCap = (ctx$1, descriptor, spacing, resolvePhysical = resolvePhysicalFamily) => {
|
|
323601
323665
|
const { run: run2, lines, mode } = descriptor;
|
|
323602
323666
|
const { font } = buildFontString({
|
|
323603
323667
|
fontFamily: run2.fontFamily,
|
|
323604
323668
|
fontSize: run2.fontSize,
|
|
323605
323669
|
bold: run2.bold,
|
|
323606
323670
|
italic: run2.italic
|
|
323607
|
-
});
|
|
323671
|
+
}, resolvePhysical);
|
|
323608
323672
|
ctx$1.font = font;
|
|
323609
323673
|
const displayText = applyTextTransform(run2.text, run2);
|
|
323610
323674
|
const metrics = ctx$1.measureText(displayText);
|
|
@@ -323760,7 +323824,7 @@ menclose::after {
|
|
|
323760
323824
|
set headerLayoutResults(results) {
|
|
323761
323825
|
this.#headerFooterLayoutSnapshotPending = true;
|
|
323762
323826
|
this.#headerLayoutResults = results;
|
|
323763
|
-
this.#resolvedHeaderLayouts = results ? results.map((result) => resolveResult(result)) : null;
|
|
323827
|
+
this.#resolvedHeaderLayouts = results ? results.map((result) => this.#resolveResult(result)) : null;
|
|
323764
323828
|
}
|
|
323765
323829
|
get footerLayoutResults() {
|
|
323766
323830
|
return this.#footerLayoutResults;
|
|
@@ -323768,7 +323832,7 @@ menclose::after {
|
|
|
323768
323832
|
set footerLayoutResults(results) {
|
|
323769
323833
|
this.#headerFooterLayoutSnapshotPending = true;
|
|
323770
323834
|
this.#footerLayoutResults = results;
|
|
323771
|
-
this.#resolvedFooterLayouts = results ? results.map((result) => resolveResult(result)) : null;
|
|
323835
|
+
this.#resolvedFooterLayouts = results ? results.map((result) => this.#resolveResult(result)) : null;
|
|
323772
323836
|
}
|
|
323773
323837
|
get headerLayoutsByRId() {
|
|
323774
323838
|
return this.#headerLayoutsByRId;
|
|
@@ -323843,8 +323907,8 @@ menclose::after {
|
|
|
323843
323907
|
this.#headerFooterLayoutSnapshotPending = true;
|
|
323844
323908
|
this.#headerLayoutResults = headerResults;
|
|
323845
323909
|
this.#footerLayoutResults = footerResults;
|
|
323846
|
-
this.#resolvedHeaderLayouts = headerResults ? headerResults.map((result) => resolveResult(result)) : null;
|
|
323847
|
-
this.#resolvedFooterLayouts = footerResults ? footerResults.map((result) => resolveResult(result)) : null;
|
|
323910
|
+
this.#resolvedHeaderLayouts = headerResults ? headerResults.map((result) => this.#resolveResult(result)) : null;
|
|
323911
|
+
this.#resolvedFooterLayouts = footerResults ? footerResults.map((result) => this.#resolveResult(result)) : null;
|
|
323848
323912
|
}
|
|
323849
323913
|
initialize() {
|
|
323850
323914
|
if (!this.#options.editor)
|
|
@@ -324564,17 +324628,20 @@ menclose::after {
|
|
|
324564
324628
|
overflowBaseHeight
|
|
324565
324629
|
};
|
|
324566
324630
|
}
|
|
324567
|
-
|
|
324631
|
+
#resolveResult(result, storyId) {
|
|
324632
|
+
return resolveResult(result, storyId, this.#options.getFontSignature?.() ?? "");
|
|
324633
|
+
}
|
|
324634
|
+
async layoutPerRId(headerFooterInput, layout, sectionMetadata, fontResolver) {
|
|
324568
324635
|
await layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetadata, {
|
|
324569
324636
|
headerLayoutsByRId: this.#headerLayoutsByRId,
|
|
324570
324637
|
footerLayoutsByRId: this.#footerLayoutsByRId
|
|
324571
|
-
});
|
|
324638
|
+
}, fontResolver);
|
|
324572
324639
|
this.#resolvedHeaderByRId.clear();
|
|
324573
324640
|
for (const [key2, result] of this.#headerLayoutsByRId)
|
|
324574
|
-
this.#resolvedHeaderByRId.set(key2, resolveResult(result, storyIdFromHeaderFooterLayoutKey(key2)));
|
|
324641
|
+
this.#resolvedHeaderByRId.set(key2, this.#resolveResult(result, storyIdFromHeaderFooterLayoutKey(key2)));
|
|
324575
324642
|
this.#resolvedFooterByRId.clear();
|
|
324576
324643
|
for (const [key2, result] of this.#footerLayoutsByRId)
|
|
324577
|
-
this.#resolvedFooterByRId.set(key2, resolveResult(result, storyIdFromHeaderFooterLayoutKey(key2)));
|
|
324644
|
+
this.#resolvedFooterByRId.set(key2, this.#resolveResult(result, storyIdFromHeaderFooterLayoutKey(key2)));
|
|
324578
324645
|
}
|
|
324579
324646
|
#computeMetrics(kind, layoutHeight, box, pageHeight, footerMargin) {
|
|
324580
324647
|
const validatedLayoutHeight = Number.isFinite(layoutHeight) && layoutHeight >= 0 ? layoutHeight : 0;
|
|
@@ -324984,7 +325051,7 @@ menclose::after {
|
|
|
324984
325051
|
return cachedItems;
|
|
324985
325052
|
if (cachedItems)
|
|
324986
325053
|
console.warn(`[HeaderFooterSessionManager] Resolved items length (${cachedItems.length}) does not match fragments length (${fragments.length}) for ${contextLabel}. Recomputing items.`);
|
|
324987
|
-
const freshItems = resolveResult(result, storyId).pages.find((page) => page.number === slotPageNumber)?.items;
|
|
325054
|
+
const freshItems = this.#resolveResult(result, storyId).pages.find((page) => page.number === slotPageNumber)?.items;
|
|
324988
325055
|
if (freshItems && freshItems.length === fragments.length)
|
|
324989
325056
|
return freshItems;
|
|
324990
325057
|
if (freshItems)
|
|
@@ -325427,6 +325494,7 @@ menclose::after {
|
|
|
325427
325494
|
#getDocumentFonts;
|
|
325428
325495
|
#getRequiredFaces;
|
|
325429
325496
|
#resolveFamilies;
|
|
325497
|
+
#fontResolver;
|
|
325430
325498
|
#requestReflow;
|
|
325431
325499
|
#getFontEnvironment;
|
|
325432
325500
|
#registryOverride;
|
|
@@ -325446,7 +325514,9 @@ menclose::after {
|
|
|
325446
325514
|
constructor(options) {
|
|
325447
325515
|
this.#getDocumentFonts = options.getDocumentFonts;
|
|
325448
325516
|
this.#getRequiredFaces = options.getRequiredFaces ?? null;
|
|
325449
|
-
this.#
|
|
325517
|
+
this.#fontResolver = options.fontResolver ?? null;
|
|
325518
|
+
const resolver2 = this.#fontResolver;
|
|
325519
|
+
this.#resolveFamilies = options.resolveFamilies ?? (resolver2 ? (families) => resolver2.resolvePhysicalFamilies(families) : (families) => families);
|
|
325450
325520
|
this.#requestReflow = options.requestReflow;
|
|
325451
325521
|
this.#getFontEnvironment = options.getFontEnvironment ?? defaultFontEnvironment;
|
|
325452
325522
|
this.#registryOverride = options.registry ?? null;
|
|
@@ -325474,7 +325544,7 @@ menclose::after {
|
|
|
325474
325544
|
} catch {
|
|
325475
325545
|
return [];
|
|
325476
325546
|
}
|
|
325477
|
-
return buildFontReport(logical, this.#resolveContext().registry);
|
|
325547
|
+
return buildFontReport(logical, this.#resolveContext().registry, this.#fontResolver ?? undefined);
|
|
325478
325548
|
}
|
|
325479
325549
|
async ensureReadyForMeasure() {
|
|
325480
325550
|
if (this.#getRequiredFaces)
|
|
@@ -325705,7 +325775,7 @@ menclose::after {
|
|
|
325705
325775
|
return;
|
|
325706
325776
|
console.log(...args$1);
|
|
325707
325777
|
}, 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;
|
|
325708
|
-
var
|
|
325778
|
+
var init_src_CF4og_LY_es = __esm(() => {
|
|
325709
325779
|
init_rolldown_runtime_Bg48TavK_es();
|
|
325710
325780
|
init_SuperConverter_B9mZiCO9_es();
|
|
325711
325781
|
init_jszip_C49i9kUs_es();
|
|
@@ -352624,6 +352694,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
352624
352694
|
"times new roman": "Liberation Serif",
|
|
352625
352695
|
"courier new": "Liberation Mono"
|
|
352626
352696
|
});
|
|
352697
|
+
defaultResolver = new FontResolver;
|
|
352627
352698
|
BUNDLED_MANIFEST = Object.freeze([
|
|
352628
352699
|
family("Carlito", "Carlito", "OFL-1.1"),
|
|
352629
352700
|
family("Caladea", "Caladea", "Apache-2.0"),
|
|
@@ -353840,6 +353911,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
353840
353911
|
layout: null,
|
|
353841
353912
|
bookmarks: /* @__PURE__ */ new Map
|
|
353842
353913
|
};
|
|
353914
|
+
#layoutFontSignature = "";
|
|
353843
353915
|
#layoutLookupBlocks = [];
|
|
353844
353916
|
#layoutLookupMeasures = [];
|
|
353845
353917
|
#flowBlockCache = new FlowBlockCache;
|
|
@@ -353863,6 +353935,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
353863
353935
|
#isRerendering = false;
|
|
353864
353936
|
#selectionSync = new SelectionSyncCoordinator;
|
|
353865
353937
|
#fontGate = null;
|
|
353938
|
+
#fontResolver = createFontResolver();
|
|
353866
353939
|
#fontPlanBlocks = null;
|
|
353867
353940
|
#lastFontsChangedKey = null;
|
|
353868
353941
|
#lastFontsChangedPayload = null;
|
|
@@ -354094,7 +354167,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
354094
354167
|
isDebug: this.#options.isDebug,
|
|
354095
354168
|
initBudgetMs: HEADER_FOOTER_INIT_BUDGET_MS,
|
|
354096
354169
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
354097
|
-
defaultMargins: DEFAULT_MARGINS
|
|
354170
|
+
defaultMargins: DEFAULT_MARGINS,
|
|
354171
|
+
getFontSignature: () => this.#fontResolver.signature
|
|
354098
354172
|
});
|
|
354099
354173
|
this.#headerFooterSession.setHoverElements({
|
|
354100
354174
|
hoverOverlay: this.#hoverOverlay,
|
|
@@ -354158,8 +354232,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
354158
354232
|
this.#pendingDocChange = true;
|
|
354159
354233
|
this.#scheduleRerender();
|
|
354160
354234
|
},
|
|
354161
|
-
getRequiredFaces: () => planRequiredFontFaces(this.#fontPlanBlocks),
|
|
354162
|
-
|
|
354235
|
+
getRequiredFaces: () => planRequiredFontFaces(this.#fontPlanBlocks, this.#fontResolver),
|
|
354236
|
+
fontResolver: this.#fontResolver,
|
|
354163
354237
|
onRegistryResolved: (registry2) => installBundledSubstitutes(registry2, {
|
|
354164
354238
|
assetBaseUrl: this.#options.fontAssets?.assetBaseUrl,
|
|
354165
354239
|
resolveAssetUrl: this.#options.fontAssets?.resolveAssetUrl
|
|
@@ -355319,7 +355393,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
355319
355393
|
layout,
|
|
355320
355394
|
flowMode: this.#layoutOptions.flowMode ?? "paginated",
|
|
355321
355395
|
blocks: blocks2,
|
|
355322
|
-
measures
|
|
355396
|
+
measures,
|
|
355397
|
+
fontSignature: this.#fontResolver.signature
|
|
355323
355398
|
});
|
|
355324
355399
|
const isSemanticFlow = this.#layoutOptions.flowMode === "semantic";
|
|
355325
355400
|
this.#ensurePainter();
|
|
@@ -356399,6 +356474,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
356399
356474
|
});
|
|
356400
356475
|
const handleDocumentReplaced = () => {
|
|
356401
356476
|
this.#fontGate?.resetForDocumentChange();
|
|
356477
|
+
this.#fontResolver.reset();
|
|
356402
356478
|
this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
|
|
356403
356479
|
};
|
|
356404
356480
|
this.#editor.on("documentReplaced", handleDocumentReplaced);
|
|
@@ -357523,6 +357599,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357523
357599
|
const previousBlocks = this.#layoutState.blocks;
|
|
357524
357600
|
const previousLayout = this.#layoutState.layout;
|
|
357525
357601
|
const previousMeasures = this.#layoutState.measures;
|
|
357602
|
+
const resolvePhysical = (css) => this.#fontResolver.resolvePhysicalFamily(css);
|
|
357603
|
+
const fontSignature = this.#fontResolver.signature;
|
|
357604
|
+
const previousFontSignature = this.#layoutFontSignature;
|
|
357526
357605
|
let layout;
|
|
357527
357606
|
let measures;
|
|
357528
357607
|
let resolvedLayout;
|
|
@@ -357546,7 +357625,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357546
357625
|
} catch {}
|
|
357547
357626
|
try {
|
|
357548
357627
|
const incrementalLayoutStart = perfNow();
|
|
357549
|
-
const result = await incrementalLayout(previousBlocks, previousLayout, blocksForLayout, layoutOptions, (block, constraints) => measureBlock(block, constraints), headerFooterInput ?? undefined, previousMeasures
|
|
357628
|
+
const result = await incrementalLayout(previousBlocks, previousLayout, blocksForLayout, layoutOptions, (block, constraints) => measureBlock(block, constraints, resolvePhysical), headerFooterInput ?? undefined, previousMeasures, {
|
|
357629
|
+
fontSignature,
|
|
357630
|
+
previousFontSignature
|
|
357631
|
+
});
|
|
357550
357632
|
perfLog(`[Perf] incrementalLayout: ${(perfNow() - incrementalLayoutStart).toFixed(2)}ms`);
|
|
357551
357633
|
if (!result || typeof result !== "object") {
|
|
357552
357634
|
this.#handleLayoutError("render", /* @__PURE__ */ new Error("incrementalLayout returned invalid result"));
|
|
@@ -357573,7 +357655,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357573
357655
|
layout,
|
|
357574
357656
|
flowMode: this.#layoutOptions.flowMode ?? "paginated",
|
|
357575
357657
|
blocks: bodyBlocksForPaint,
|
|
357576
|
-
measures: bodyMeasuresForPaint
|
|
357658
|
+
measures: bodyMeasuresForPaint,
|
|
357659
|
+
fontSignature
|
|
357577
357660
|
});
|
|
357578
357661
|
headerLayouts = result.headers;
|
|
357579
357662
|
footerLayouts = result.footers;
|
|
@@ -357597,6 +357680,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357597
357680
|
bookmarks,
|
|
357598
357681
|
anchorMap
|
|
357599
357682
|
};
|
|
357683
|
+
this.#layoutFontSignature = fontSignature;
|
|
357600
357684
|
this.#layoutLookupBlocks = resolveBlocks;
|
|
357601
357685
|
this.#layoutLookupMeasures = resolveMeasures;
|
|
357602
357686
|
const tocStorage = this.#editor.storage?.tableOfContents;
|
|
@@ -357694,7 +357778,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
357694
357778
|
ruler: this.#layoutOptions.ruler,
|
|
357695
357779
|
pageGap: this.#layoutState.layout?.pageGap ?? effectiveGap,
|
|
357696
357780
|
showFormattingMarks: this.#layoutOptions.showFormattingMarks ?? false,
|
|
357697
|
-
contentControlsChrome: this.#layoutOptions.contentControlsChrome ?? "default"
|
|
357781
|
+
contentControlsChrome: this.#layoutOptions.contentControlsChrome ?? "default",
|
|
357782
|
+
resolvePhysical: (css) => this.#fontResolver.resolvePhysicalFamily(css)
|
|
357698
357783
|
});
|
|
357699
357784
|
const currentZoom = this.#layoutOptions.zoom ?? 1;
|
|
357700
357785
|
if (currentZoom !== 1)
|
|
@@ -358446,7 +358531,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
358446
358531
|
}
|
|
358447
358532
|
async#layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetadata) {
|
|
358448
358533
|
if (this.#headerFooterSession)
|
|
358449
|
-
await this.#headerFooterSession.layoutPerRId(headerFooterInput, layout, sectionMetadata);
|
|
358534
|
+
await this.#headerFooterSession.layoutPerRId(headerFooterInput, layout, sectionMetadata, this.#fontResolver);
|
|
358450
358535
|
}
|
|
358451
358536
|
#updateDecorationProviders(resolvedLayout) {
|
|
358452
358537
|
this.#headerFooterSession?.updateDecorationProviders(resolvedLayout);
|
|
@@ -360393,7 +360478,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
360393
360478
|
|
|
360394
360479
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
360395
360480
|
var init_super_editor_es = __esm(() => {
|
|
360396
|
-
|
|
360481
|
+
init_src_CF4og_LY_es();
|
|
360397
360482
|
init_SuperConverter_B9mZiCO9_es();
|
|
360398
360483
|
init_jszip_C49i9kUs_es();
|
|
360399
360484
|
init_xml_js_CqGKpaft_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.16.0-next.
|
|
3
|
+
"version": "0.16.0-next.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@types/node": "22.19.2",
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
|
-
"@superdoc/document-api": "0.0.1",
|
|
28
27
|
"@superdoc/super-editor": "0.0.1",
|
|
28
|
+
"@superdoc/document-api": "0.0.1",
|
|
29
29
|
"superdoc": "1.38.0"
|
|
30
30
|
},
|
|
31
31
|
"module": "src/index.ts",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@superdoc-dev/cli-darwin-
|
|
37
|
-
"@superdoc-dev/cli-darwin-
|
|
38
|
-
"@superdoc-dev/cli-linux-x64": "0.16.0-next.
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-
|
|
36
|
+
"@superdoc-dev/cli-darwin-x64": "0.16.0-next.21",
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.16.0-next.21",
|
|
38
|
+
"@superdoc-dev/cli-linux-x64": "0.16.0-next.21",
|
|
39
|
+
"@superdoc-dev/cli-linux-arm64": "0.16.0-next.21",
|
|
40
|
+
"@superdoc-dev/cli-windows-x64": "0.16.0-next.21"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"predev": "node scripts/ensure-superdoc-build.js",
|