@stll/folio-core 0.73.0 → 0.75.0
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/ai-edits/clean-text.d.ts +4 -1
- package/dist/ai-edits/clean-text.js +21 -7
- package/dist/ai-edits/headless.d.ts +5 -2
- package/dist/ai-edits/headless.js +20 -14
- package/dist/ai-edits/note-references.d.ts +1 -1
- package/dist/ai-edits/note-references.js +1 -1
- package/dist/ai-edits/pending-suggestions.d.ts +9 -7
- package/dist/ai-edits/pending-suggestions.js +134 -88
- package/dist/ai-edits/pendingJoin.d.ts +5 -1
- package/dist/ai-edits/pendingJoin.js +12 -3
- package/dist/ai-edits/result-validation.js +1 -1
- package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
- package/dist/ai-edits/retired-comment-receipts.js +3 -18
- package/dist/ai-edits/snapshot.js +1 -1
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
- package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
- package/dist/canonical/canonicalBatchReview.d.ts +4 -1
- package/dist/canonical/canonicalBatchReview.js +32 -14
- package/dist/canonical/canonicalComments.d.ts +6 -2
- package/dist/canonical/canonicalComments.js +8 -4
- package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
- package/dist/canonical/canonicalInlineGaps.js +118 -0
- package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
- package/dist/canonical/canonicalInlineProjection.js +6 -28
- package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
- package/dist/canonical/canonicalPublicOperations.js +99 -36
- package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
- package/dist/canonical/canonicalRefusalGrounds.js +56 -0
- package/dist/canonical/canonicalSelection.js +1 -1
- package/dist/canonical/canonicalSession.d.ts +12 -6
- package/dist/canonical/canonicalSession.js +129 -141
- package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
- package/dist/compare/inline-atoms.d.ts +35 -41
- package/dist/compare/inline-atoms.js +2 -465
- package/dist/compare/section-boundary-properties.d.ts +3 -30
- package/dist/compare/section-boundary-properties.js +4 -72
- package/dist/controller/autocompleteSuggestion.js +1 -1
- package/dist/controller/canonicalClipboard.js +45 -44
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +6 -6
- package/dist/controller/canonicalInput.d.ts +4 -2
- package/dist/controller/canonicalInput.js +34 -17
- package/dist/controller/canonicalPresence.js +1 -1
- package/dist/controller/canonicalRoomAuthority.js +1 -1
- package/dist/controller/canonicalRoomWire.js +1 -1
- package/dist/controller/canonicalStoryEditor.d.ts +2 -3
- package/dist/controller/canonicalStoryEditor.js +43 -25
- package/dist/controller/canonicalStructure.d.ts +19 -2
- package/dist/controller/canonicalStructure.js +140 -43
- package/dist/controller/canonicalTabRoom.js +1 -1
- package/dist/controller/canonicalYjsRoom.js +1 -1
- package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
- package/dist/controller/deferredDisplayListPainter.js +34 -0
- package/dist/controller/folioEditor.js +4 -2
- package/dist/controller/headerFooterEditorManager.js +3 -17
- package/dist/controller/hiddenEditorApi.d.ts +24 -3
- package/dist/controller/hiddenEditorApi.js +4 -17
- package/dist/controller/hiddenEditorManager.js +136 -197
- package/dist/controller/layoutPipeline.d.ts +4 -86
- package/dist/controller/layoutPipeline.js +8 -727
- package/dist/controller/layoutPipelineExecution.d.ts +94 -0
- package/dist/controller/layoutPipelineExecution.js +730 -0
- package/dist/controller/noteEditorManager.js +3 -16
- package/dist/document-operations.js +1 -1
- package/dist/docx/blockContentParser.d.ts +1 -3
- package/dist/docx/blockContentParser.js +3 -10
- package/dist/docx/canonicalSave.d.ts +4 -3
- package/dist/docx/canonicalSave.js +4 -3
- package/dist/docx/canonicalSessionInput.js +1 -1
- package/dist/docx/containerChildren.js +1 -1
- package/dist/docx/createDocx.d.ts +4 -0
- package/dist/docx/createDocx.js +6 -0
- package/dist/docx/listMarkerComputation.d.ts +24 -17
- package/dist/docx/listMarkerComputation.js +31 -60
- package/dist/docx/listModelNormalization.js +8 -15
- package/dist/docx/modelValidation.js +1 -1
- package/dist/docx/parser.js +1 -1
- package/dist/docx/reviewResolutionProvenance.js +1 -1
- package/dist/docx/rezip.d.ts +16 -3
- package/dist/docx/rezip.js +36 -10
- package/dist/docx/selectiveSave.js +13 -5
- package/dist/docx/serializer/borderSerializer.js +1 -1
- package/dist/docx/serializer/commentSerializer.js +1 -1
- package/dist/docx/serializer/documentSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +3 -3
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
- package/dist/docx/serializer/tableSerializer.js +1 -1
- package/dist/docx/serializer/textFormattingSerializer.js +1 -1
- package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
- package/dist/docx/server/templatePlan/apply.js +107 -14
- package/dist/docx/server/templatePlan/blocks.d.ts +16 -1
- package/dist/docx/server/templatePlan/blocks.js +93 -7
- package/dist/docx/server/templatePlan/builders.d.ts +37 -2
- package/dist/docx/server/templatePlan/builders.js +196 -5
- package/dist/docx/server/templatePlan/emit.d.ts +2 -0
- package/dist/docx/server/templatePlan/emit.js +2 -0
- package/dist/docx/server/templatePlan/inspect.js +81 -61
- package/dist/docx/server/templatePlan/labels.d.ts +16 -2
- package/dist/docx/server/templatePlan/labels.js +131 -20
- package/dist/docx/server/templatePlan/plan.d.ts +15 -1
- package/dist/docx/server/templatePlan/plan.js +62 -13
- package/dist/docx/server/templatePlan/planShape.js +52 -4
- package/dist/docx/server/templatePlan/story.d.ts +8 -0
- package/dist/docx/server/templatePlan/story.js +11 -1
- package/dist/docx/server/templatePlan/types.d.ts +176 -18
- package/dist/docx/server/templatePlan/types.js +1 -0
- package/dist/docx/server/templatePlan/verify.js +60 -11
- package/dist/docx/server/templatePlan/xml.d.ts +5 -0
- package/dist/docx/server/templatePlan/xml.js +7 -1
- package/dist/docx/storyBlockReplay.js +1 -1
- package/dist/docx/xmlParser.js +1 -1
- package/dist/i18n/loadMessages.d.ts +5 -0
- package/dist/i18n/loadMessages.js +46 -0
- package/dist/i18n/locales.d.ts +3 -0
- package/dist/i18n/locales.js +17 -0
- package/dist/i18n/messages/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -0
- package/dist/i18n/messages.d.ts +3 -2
- package/dist/i18n/messages.js +4 -16
- package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
- package/dist/internal/clipboardTransformPlugin.js +13 -0
- package/dist/internal/extensionRuntime.d.ts +7 -0
- package/dist/internal/extensionRuntime.js +28 -0
- package/dist/internal/paragraphFormattingSerialization.js +1 -1
- package/dist/internal/starterKitExtensions.d.ts +20 -0
- package/dist/internal/starterKitExtensions.js +123 -0
- package/dist/internal/wholeStoryRevisionResolution.js +2 -2
- package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
- package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
- package/dist/prosemirror/attrs/index.js +1 -1
- package/dist/prosemirror/canonicalSelectionRange.js +1 -1
- package/dist/prosemirror/canonicalTableCommands.js +1 -1
- package/dist/prosemirror/commands/comments.js +3 -3
- package/dist/prosemirror/commands/contentControls.js +1 -1
- package/dist/prosemirror/commands/pastePlainText.js +2 -3
- package/dist/prosemirror/commands/replaceRangeText.js +1 -1
- package/dist/prosemirror/commentRecords.js +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
- package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/index.js +2 -2
- package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
- package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
- package/dist/prosemirror/extensions/StarterKit.js +29 -115
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -2
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/index.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +7 -40
- package/dist/prosemirror/hyperlinkRemoval.js +7 -2
- package/dist/prosemirror/index.d.ts +2 -2
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/keptRangeBoundaries.js +1 -1
- package/dist/prosemirror/listMarker.d.ts +1 -6
- package/dist/prosemirror/listMarker.js +4 -56
- package/dist/prosemirror/listNumbering.js +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
- package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
- package/dist/prosemirror/noteReferenceReview.js +2 -243
- package/dist/prosemirror/pastedCommentCopies.js +1 -1
- package/dist/prosemirror/plugins/documentNumbering.js +1 -1
- package/dist/prosemirror/plugins/documentStyles.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -1
- package/dist/prosemirror/suggestionCommands.d.ts +47 -0
- package/dist/prosemirror/suggestionCommands.js +31 -0
- package/dist/prosemirror/tableCellPaste.js +1 -1
- package/dist/prosemirror/tableRunIn.js +1 -1
- package/dist/prosemirror/textInput.js +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +42 -93
- package/dist/types/canonicalCapabilities.js +53 -91
- package/dist/types/canonicalComments.d.ts +2 -2
- package/dist/types/canonicalSections.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +2 -28
- package/dist/utils/clipboard.js +1 -96
- package/dist/utils/clipboardFiles.d.ts +27 -0
- package/dist/utils/clipboardFiles.js +98 -0
- package/dist/utils/rulerControl.d.ts +1 -0
- package/dist/utils/rulerControl.js +2 -1
- package/package.json +2 -2
- package/dist/ai-edits/apply.d.ts +0 -94
- package/dist/ai-edits/apply.js +0 -6637
- package/dist/ai-edits/note-story-inventory.d.ts +0 -5
- package/dist/ai-edits/note-story-inventory.js +0 -10
- package/dist/ai-edits/revisionStretches.d.ts +0 -32
- package/dist/ai-edits/revisionStretches.js +0 -147
- package/dist/document-operations-apply.d.ts +0 -15
- package/dist/document-operations-apply.js +0 -280
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -12
- package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -114
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +0 -23
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -270
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -51
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -411
- package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
- package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
- package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
- package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
|
@@ -1,731 +1,12 @@
|
|
|
1
|
-
import { displayCommentsFrom } from "../display-list/build/commentAnnotations.js";
|
|
2
1
|
import { createDisplayListPagePainter } from "../display-list/editor/displayListPagePainter.js";
|
|
3
|
-
import { PAGE_RENDERER
|
|
4
|
-
import {
|
|
5
|
-
import { formatOoxmlCounter } from "../docx/ooxmlCounterFormatter.js";
|
|
6
|
-
import { buildBookmarkPageMap } from "../fields/bookmarkPages.js";
|
|
7
|
-
import { buildBookmarkText } from "../fields/bookmarkText.js";
|
|
8
|
-
import { buildHeaderFooterFieldValues, fieldValuesEqual, resolveFieldValues } from "../fields/resolveFieldValues.js";
|
|
9
|
-
import { buildSectionPageCounts } from "../fields/sectionPageCounts.js";
|
|
10
|
-
import { buildSeqValues } from "../fields/seqValues.js";
|
|
11
|
-
import { buildDocumentFontFacts, documentFontFactsCacheIdentity } from "../fonts/documentFontFacts.js";
|
|
12
|
-
import { buildFontAlternates } from "../fonts/fontAlternates.js";
|
|
13
|
-
import { prepareEndnoteAreas, resolveEndnotePosition, spliceEndnoteAreas, trailingEndnoteIds } from "../layout-bridge/convert/endnoteLayout.js";
|
|
14
|
-
import { buildFootnoteContentMap, collectEndnoteRefs, collectFootnoteRefs, computeNoteDisplayNumbers, remapNoteMarkerText } from "../layout-bridge/convert/footnoteLayout.js";
|
|
15
|
-
import { remapMarkupViewBlocks } from "../layout-bridge/convert/markupViewFlow.js";
|
|
16
|
-
import { applyTemplatePreviewToBlocks } from "../layout-bridge/convert/templatePreviewFlow.js";
|
|
17
|
-
import { toFlowBlocks } from "../layout-bridge/convert/toFlowBlocks.js";
|
|
18
|
-
import { getColumns } from "../layout-bridge/sectionColumns.js";
|
|
19
|
-
import { resolveAnchorLayoutInCellCompatibility } from "../layout-engine/anchorLayoutInCellCompatibility.js";
|
|
20
|
-
import { applyFootnoteContinuation, footnoteContinuationSettled, planFootnoteContinuation } from "../layout-engine/footnoteContinuation.js";
|
|
21
|
-
import { layoutDocument } from "../layout-engine/index.js";
|
|
22
|
-
import { resolveJustificationCompatibility } from "../layout-engine/justificationCompatibility.js";
|
|
23
|
-
import { recordLayoutComplete, recordLayoutError, recordLayoutPhase, recordLayoutStart, recordMarkupViewIncomplete } from "../layout-engine/layoutInstrumentation.js";
|
|
24
|
-
import { labelMeasureCachesFontSet, syncMeasureCachesToFontSet } from "../layout-engine/measure/cache.js";
|
|
25
|
-
import { collectRequestedHyphenationDictionaries } from "../layout-engine/measure/hyphenationDictionaries.js";
|
|
26
|
-
import { measureBlocks, measureSingleBlockWithoutFloatingZones } from "../layout-engine/measure/measureBlocks.js";
|
|
27
|
-
import { installCanvasMeasureProvider, resetCanvasContext } from "../layout-engine/measure/measureContainer.js";
|
|
28
|
-
import { settleRaisedTableWrap } from "../layout-engine/measure/raisedTableWrap.js";
|
|
29
|
-
import { forgetTableMeasures } from "../layout-engine/measure/tableMeasureMemo.js";
|
|
30
|
-
import { columnBalancingForCompatibility } from "../layout-engine/noColumnBalanceCompatibility.js";
|
|
31
|
-
import { resolveBodyTableLeadingSpacing, resolveEffectiveParagraphSpacingTree } from "../layout-engine/paragraphSpacing.js";
|
|
32
|
-
import { tableHeaderGroupStartForCompatibility } from "../layout-engine/tableHeaderCompatibility.js";
|
|
33
|
-
import { resolveTableIndentCompatibility } from "../layout-engine/tableIndentCompatibility.js";
|
|
34
|
-
import "../layout-engine/types.js";
|
|
35
|
-
import { renderPages } from "../layout-painter/renderPage.js";
|
|
36
|
-
import { tryBuildIncrementalMeasures } from "../paged-layout/incrementalMeasure.js";
|
|
37
|
-
import { computePerBlockMeasureInputs } from "../paged-layout/sectionBlockWidths.js";
|
|
38
|
-
import { getMargins, getPageNumbering, getPageSize, twipsToPixels } from "../paged-layout/sectionGeometry.js";
|
|
39
|
-
import { markupViewNotes } from "../prosemirror/markupViewNotes.js";
|
|
40
|
-
import { projectMarkupView } from "../prosemirror/markupViewProjection.js";
|
|
41
|
-
import { templatePreviewValuesKey } from "../prosemirror/plugins/templatePreviewValues.js";
|
|
42
|
-
import { readModel } from "../types/documentModel.js";
|
|
43
|
-
import { getDocumentWatermark } from "../watermark/index.js";
|
|
44
|
-
import { diffAgainstCommittedLayout } from "./committedLayoutDiff.js";
|
|
45
|
-
import { LAYOUT_MEASURE } from "./layoutRunOptions.js";
|
|
46
|
-
import { survivingComments } from "@stll/docx-core/ops";
|
|
2
|
+
import { PAGE_RENDERER } from "../display-list/editor/pageRenderer.js";
|
|
3
|
+
import { runLayoutPipelineWithPainter } from "./layoutPipelineExecution.js";
|
|
47
4
|
// src/controller/layoutPipeline.ts
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
const sameMeasureInputs = (left, right) => left.embeddedFontFamilyMap === right.embeddedFontFamilyMap && left.documentFontFactsCacheIdentity === right.documentFontFactsCacheIdentity && left.styles === right.styles && left.theme === right.theme && left.defaultTabStop === right.defaultTabStop && left.pageContentHeight === right.pageContentHeight && left.fontSet === right.fontSet && left.fontAlternates.size === right.fontAlternates.size && [...left.fontAlternates].every(([name, alternate]) => right.fontAlternates.get(name) === alternate) && left.markupView === right.markupView && left.showCommentHighlights === right.showCommentHighlights && left.altChunkMarkerText === right.altChunkMarkerText;
|
|
55
|
-
/**
|
|
56
|
-
* The range an incremental pass re-measures, or `null` for a full measure: the
|
|
57
|
-
* committed measures must come from the same measure inputs, and the range is
|
|
58
|
-
* where the current document and preview differ from the committed ones.
|
|
59
|
-
*/
|
|
60
|
-
const incrementalDirtyRange = ({ session, state, preview, measureInputs }) => {
|
|
61
|
-
const { lastPmDoc, lastMeasureInputs } = session;
|
|
62
|
-
if (!lastPmDoc || !lastMeasureInputs || !sameMeasureInputs(lastMeasureInputs, measureInputs)) return null;
|
|
63
|
-
const diff = diffAgainstCommittedLayout({
|
|
64
|
-
doc: lastPmDoc,
|
|
65
|
-
preview: session.lastTemplatePreview
|
|
66
|
-
}, {
|
|
67
|
-
doc: state.doc,
|
|
68
|
-
preview
|
|
69
|
-
});
|
|
70
|
-
switch (diff.type) {
|
|
71
|
-
case "full": return null;
|
|
72
|
-
case "range": return diff.range;
|
|
73
|
-
default: return diff;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
/** Resolve only package-owned picture-watermark bytes for the DOM painter. */
|
|
77
|
-
const resolveWatermarkImageSrc = (document, watermark) => {
|
|
78
|
-
if (watermark?.kind !== "picture" || watermark.imageTargetExternal === true) return;
|
|
79
|
-
const target = watermark.imageTarget;
|
|
80
|
-
return target === void 0 ? void 0 : document.package.media?.get(target)?.dataUrl;
|
|
81
|
-
};
|
|
82
|
-
function bodyMarginsClearHeaderFooter({ authoredMargins, preparedHeader, preparedFooter }) {
|
|
83
|
-
const top = authoredMargins.top < 0 ? -authoredMargins.top : Math.max(authoredMargins.top, preparedHeader ? (authoredMargins.header ?? 0) + (preparedHeader.marginPushBottom ?? preparedHeader.height) : 0, preparedHeader?.bodyTopClearance ?? 0);
|
|
84
|
-
const bottom = authoredMargins.bottom < 0 ? -authoredMargins.bottom : Math.max(authoredMargins.bottom, preparedFooter ? (authoredMargins.footer ?? 0) + (preparedFooter.marginPushBottom ?? preparedFooter.height) : 0);
|
|
85
|
-
if (top === authoredMargins.top && bottom === authoredMargins.bottom) return authoredMargins;
|
|
86
|
-
return {
|
|
87
|
-
...authoredMargins,
|
|
88
|
-
top,
|
|
89
|
-
bottom
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function bodyBlocksClearSectionHeaderFooter(blocks, { authoredMargins, sectionHeaderFooterRefs, headerContentByRId, footerContentByRId }) {
|
|
93
|
-
if (!sectionHeaderFooterRefs) return blocks;
|
|
94
|
-
let sectionIndex = 0;
|
|
95
|
-
let currentAuthoredMargins = authoredMargins;
|
|
96
|
-
let changed = false;
|
|
97
|
-
const nextBlocks = blocks.map((block) => {
|
|
98
|
-
if (block.kind !== "sectionBreak") return block;
|
|
99
|
-
currentAuthoredMargins = block.margins ?? currentAuthoredMargins;
|
|
100
|
-
const refs = sectionHeaderFooterRefs[sectionIndex];
|
|
101
|
-
sectionIndex += 1;
|
|
102
|
-
const effectiveMargins = bodyMarginsClearHeaderFooter({
|
|
103
|
-
authoredMargins: currentAuthoredMargins,
|
|
104
|
-
preparedHeader: refs?.headerDefault ? headerContentByRId?.get(refs.headerDefault) : void 0,
|
|
105
|
-
preparedFooter: refs?.footerDefault ? footerContentByRId?.get(refs.footerDefault) : void 0
|
|
106
|
-
});
|
|
107
|
-
if (effectiveMargins === currentAuthoredMargins && block.margins === currentAuthoredMargins) return block;
|
|
108
|
-
changed = true;
|
|
109
|
-
return {
|
|
110
|
-
...block,
|
|
111
|
-
margins: effectiveMargins
|
|
112
|
-
};
|
|
113
|
-
});
|
|
114
|
-
return changed ? nextBlocks : blocks;
|
|
115
|
-
}
|
|
116
|
-
const arePageMarginsEqual = (left, right) => left.top === right.top && left.right === right.right && left.bottom === right.bottom && left.left === right.left && left.header === right.header && left.footer === right.footer;
|
|
117
|
-
const mirrorPageMarginsIfNeeded = (authoredMargins, pageNumber, mirrorMargins) => mirrorMargins && pageNumber % 2 === 0 ? {
|
|
118
|
-
...authoredMargins,
|
|
119
|
-
left: authoredMargins.right,
|
|
120
|
-
right: authoredMargins.left
|
|
121
|
-
} : authoredMargins;
|
|
122
|
-
function attachAuthoredMarginsToLayoutPages(layout, options) {
|
|
123
|
-
let changed = false;
|
|
124
|
-
const pages = layout.pages.map((page) => {
|
|
125
|
-
const sectionProperties = options.sectionPropertiesForMargins[page.sectionIndex ?? 0];
|
|
126
|
-
const authoredMargins = mirrorPageMarginsIfNeeded(sectionProperties ? getMargins(sectionProperties) : options.authoredMargins, page.number, options.mirrorMargins);
|
|
127
|
-
if (page.authoredMargins && arePageMarginsEqual(page.authoredMargins, authoredMargins)) return page;
|
|
128
|
-
changed = true;
|
|
129
|
-
return {
|
|
130
|
-
...page,
|
|
131
|
-
authoredMargins
|
|
132
|
-
};
|
|
133
|
-
});
|
|
134
|
-
return changed ? {
|
|
135
|
-
...layout,
|
|
136
|
-
pages
|
|
137
|
-
} : layout;
|
|
138
|
-
}
|
|
139
|
-
function runLayoutPipeline(deps, state, options = {}) {
|
|
140
|
-
const { result, missing } = collectRequestedHyphenationDictionaries(() => runLayoutPipelineMeasured(deps, state, options));
|
|
141
|
-
deps.hyphenationReadiness.track(missing);
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
function runLayoutPipelineMeasured(deps, state, options) {
|
|
145
|
-
const { contentWidth, columns, pageSize, margins, pageGap, showMarginGuides, marginGuideColor, syncCoordinator, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, sectionHeaderFooterRefs, theme: _theme, sectionProperties, document: model, defaultTabStop, mirrorMargins, styles, layout, hfPMs, painter, pagesContainer, session, renderHfFromContentOrPm, renderHeaderFooterContentByRId, readFontSetSignature, buildFootnoteRenderItems, describeInvalidHighlightMarks, pageRenderer = PAGE_RENDERER.legacy, emptyTemplatePreviewEntries: EMPTY_TEMPLATE_PREVIEW_ENTRIES, emptyTemplatePreviewHidden: EMPTY_TEMPLATE_PREVIEW_HIDDEN, markupView, showCommentHighlights = true, altChunkMarkerText } = deps;
|
|
146
|
-
const document = model && readModel(model);
|
|
147
|
-
let outcome = {};
|
|
148
|
-
let pendingArtifacts;
|
|
149
|
-
let pendingTemplatePreview;
|
|
150
|
-
installCanvasMeasureProvider();
|
|
151
|
-
const fontSet = readFontSetSignature();
|
|
152
|
-
if (syncMeasureCachesToFontSet(fontSet)) resetCanvasContext();
|
|
153
|
-
const reason = options.reason ?? "manual";
|
|
154
|
-
const recordPhaseDuration = (phase, startedAt) => {
|
|
155
|
-
recordLayoutPhase(reason, phase, performance.now() - startedAt);
|
|
156
|
-
};
|
|
157
|
-
const currentEpoch = syncCoordinator.getStateSeq();
|
|
158
|
-
recordLayoutStart(reason);
|
|
159
|
-
syncCoordinator.onLayoutStart();
|
|
160
|
-
try {
|
|
161
|
-
let phaseStartedAt = performance.now();
|
|
162
|
-
const pageContentHeight = pageSize.h - margins.top - margins.bottom;
|
|
163
|
-
const fontAlternates = buildFontAlternates(document?.package.fontTable);
|
|
164
|
-
const documentFontFacts = buildDocumentFontFacts(document?.package.fontTable);
|
|
165
|
-
const displayCommentHighlights = showCommentHighlights && markupView !== "no-markup" && markupView !== "original";
|
|
166
|
-
const embeddedFontFamilies = session.embeddedFontFamilyMap ? { embeddedFontFamilyMap: session.embeddedFontFamilyMap } : {};
|
|
167
|
-
const measureInputs = {
|
|
168
|
-
...embeddedFontFamilies,
|
|
169
|
-
documentFontFactsCacheIdentity: documentFontFactsCacheIdentity(documentFontFacts),
|
|
170
|
-
styles,
|
|
171
|
-
theme: _theme,
|
|
172
|
-
defaultTabStop,
|
|
173
|
-
pageContentHeight,
|
|
174
|
-
fontSet,
|
|
175
|
-
fontAlternates,
|
|
176
|
-
markupView,
|
|
177
|
-
showCommentHighlights: displayCommentHighlights,
|
|
178
|
-
...altChunkMarkerText === void 0 ? {} : { altChunkMarkerText }
|
|
179
|
-
};
|
|
180
|
-
if (session.lastMeasureInputs && !sameMeasureInputs(session.lastMeasureInputs, measureInputs)) forgetTableMeasures();
|
|
181
|
-
const flowOpts = {
|
|
182
|
-
showCommentHighlights: displayCommentHighlights,
|
|
183
|
-
...altChunkMarkerText === void 0 ? {} : { altChunkMarkerText },
|
|
184
|
-
...embeddedFontFamilies,
|
|
185
|
-
...documentFontFacts === void 0 ? {} : { documentFontFacts },
|
|
186
|
-
pageContentHeight,
|
|
187
|
-
fontAlternates,
|
|
188
|
-
...styles ? { styles } : {},
|
|
189
|
-
...document === null ? {} : { defaultSize: 10 },
|
|
190
|
-
paragraphBlocks: session.paragraphBlocks
|
|
191
|
-
};
|
|
192
|
-
if (_theme !== void 0) flowOpts.theme = _theme;
|
|
193
|
-
if (defaultTabStop !== void 0) flowOpts.defaultTabStopTwips = defaultTabStop;
|
|
194
|
-
if (document?.package.settings?.splitPageBreakAndParagraphMark === true) flowOpts.splitPageBreakAndParagraphMark = true;
|
|
195
|
-
if (document?.package.settings?.lineBreakRules) flowOpts.lineBreakRules = document.package.settings.lineBreakRules;
|
|
196
|
-
const documentSettings = document?.package.settings;
|
|
197
|
-
const justificationCompatibility = resolveJustificationCompatibility(documentSettings?.compatibilityMode);
|
|
198
|
-
if (justificationCompatibility) flowOpts.justificationCompatibility = justificationCompatibility;
|
|
199
|
-
const tableIndentCompatibility = resolveTableIndentCompatibility(documentSettings?.compatibilityMode);
|
|
200
|
-
if (tableIndentCompatibility) flowOpts.tableIndentCompatibility = tableIndentCompatibility;
|
|
201
|
-
if (resolveAnchorLayoutInCellCompatibility(documentSettings?.compatibilityMode)) flowOpts.forceAnchorLayoutInCell = true;
|
|
202
|
-
if (documentSettings?.autoHyphenation === true) flowOpts.automaticHyphenation = {
|
|
203
|
-
enabled: true,
|
|
204
|
-
...documentSettings.doNotHyphenateCaps !== void 0 ? { doNotHyphenateCaps: documentSettings.doNotHyphenateCaps } : {},
|
|
205
|
-
...documentSettings.consecutiveHyphenLimit !== void 0 ? { consecutiveLineLimit: documentSettings.consecutiveHyphenLimit } : {},
|
|
206
|
-
...documentSettings.hyphenationZoneTwips !== void 0 ? { hyphenationZoneTwips: documentSettings.hyphenationZoneTwips } : {}
|
|
207
|
-
};
|
|
208
|
-
const finalSectionDocumentGridLinePitchTwips = resolveDocumentGridLinePitch(document?.package.document.sections?.at(-1)?.properties.docGrid);
|
|
209
|
-
if (finalSectionDocumentGridLinePitchTwips !== void 0) flowOpts.finalSectionDocumentGridLinePitchTwips = finalSectionDocumentGridLinePitchTwips;
|
|
210
|
-
const endnotePosition = resolveEndnotePosition(document?.package.settings?.endnotePr?.position, document?.package.document.sections?.at(-1)?.properties);
|
|
211
|
-
const bodyTrailingEndnoteIds = trailingEndnoteIds(document?.package.endnotes, endnotePosition);
|
|
212
|
-
if (bodyTrailingEndnoteIds.size > 0) flowOpts.trailingEndnoteIds = bodyTrailingEndnoteIds;
|
|
213
|
-
const projection = projectMarkupView(state, markupView);
|
|
214
|
-
if (projection.type === "resolved" && projection.completeness === "partial") recordMarkupViewIncomplete(markupView);
|
|
215
|
-
const viewDoc = projection.type === "resolved" ? projection.doc : state.doc;
|
|
216
|
-
const flowDoc = document === null ? viewDoc.type.create({
|
|
217
|
-
...viewDoc.attrs,
|
|
218
|
-
_finalSectionStart: sectionProperties?.sectionStart ?? null
|
|
219
|
-
}, viewDoc.content, viewDoc.marks) : viewDoc;
|
|
220
|
-
let newBlocks = toFlowBlocks(flowDoc, flowOpts);
|
|
221
|
-
if (projection.type === "resolved") newBlocks = remapMarkupViewBlocks(newBlocks, projection);
|
|
222
|
-
const previewState = templatePreviewValuesKey.getState(state);
|
|
223
|
-
const previewEntries = previewState?.entries ?? EMPTY_TEMPLATE_PREVIEW_ENTRIES;
|
|
224
|
-
const previewHidden = previewState?.hidden ?? EMPTY_TEMPLATE_PREVIEW_HIDDEN;
|
|
225
|
-
const previewMode = previewState?.preview?.mode ?? "plain";
|
|
226
|
-
if (previewEntries.length > 0 || previewHidden.length > 0) newBlocks = applyTemplatePreviewToBlocks(newBlocks, {
|
|
227
|
-
entries: previewEntries,
|
|
228
|
-
hidden: previewHidden,
|
|
229
|
-
mode: previewMode
|
|
230
|
-
});
|
|
231
|
-
pendingTemplatePreview = {
|
|
232
|
-
entries: previewEntries,
|
|
233
|
-
hidden: previewHidden,
|
|
234
|
-
mode: previewMode
|
|
235
|
-
};
|
|
236
|
-
outcome.blocks = newBlocks;
|
|
237
|
-
recordPhaseDuration("flow-blocks", phaseStartedAt);
|
|
238
|
-
phaseStartedAt = performance.now();
|
|
239
|
-
const footnoteRefs = collectFootnoteRefs(newBlocks);
|
|
240
|
-
const documentFootnotes = markupViewNotes(document?.package.footnotes, markupView, state, document);
|
|
241
|
-
const hasFootnotes = footnoteRefs.length > 0 && documentFootnotes !== void 0;
|
|
242
|
-
const footnoteDisplayNumbers = documentFootnotes ? computeNoteDisplayNumbers(documentFootnotes, footnoteRefs.map((ref) => ref.footnoteId)) : void 0;
|
|
243
|
-
const documentEndnotes = markupViewNotes(document?.package.endnotes, markupView, state, document);
|
|
244
|
-
const endnoteDisplayNumbers = documentEndnotes ? computeNoteDisplayNumbers(documentEndnotes, collectEndnoteRefs(newBlocks).map((ref) => ref.endnoteId)) : void 0;
|
|
245
|
-
const endnoteNumberFormat = document?.package.document.sections?.at(-1)?.properties.endnotePr?.numFmt ?? document?.package.settings?.endnotePr?.numFmt ?? "lowerRoman";
|
|
246
|
-
const endnoteTexts = endnoteDisplayNumbers ? formatEndnoteTexts(endnoteDisplayNumbers, (displayNumber) => formatOoxmlCounter(displayNumber, endnoteNumberFormat)) : void 0;
|
|
247
|
-
newBlocks = remapNoteMarkerText(newBlocks, {
|
|
248
|
-
...footnoteDisplayNumbers ? { footnoteNumbers: footnoteDisplayNumbers } : {},
|
|
249
|
-
...endnoteTexts ? { endnoteTexts } : {}
|
|
250
|
-
});
|
|
251
|
-
newBlocks = resolveBodyTableLeadingSpacing(newBlocks);
|
|
252
|
-
outcome.blocks = newBlocks;
|
|
253
|
-
const hfMetricsHeader = {
|
|
254
|
-
section: "header",
|
|
255
|
-
pageSize,
|
|
256
|
-
margins
|
|
257
|
-
};
|
|
258
|
-
const hfMetricsFooter = {
|
|
259
|
-
section: "footer",
|
|
260
|
-
pageSize,
|
|
261
|
-
margins
|
|
262
|
-
};
|
|
263
|
-
const hfPageCountEstimate = layout?.pages.length ?? 1;
|
|
264
|
-
const hfClock = /* @__PURE__ */ new Date();
|
|
265
|
-
const buildHfOptions = (pageCount, fieldInputs) => {
|
|
266
|
-
const hfMeasureBlocks = (hfBlocks, hfWidth) => measureBlocks(hfBlocks, hfWidth, void 0, void 0, buildHeaderFooterFieldValues(hfBlocks, pageCount, hfClock, fieldInputs), { allowEndTabOverflow: true });
|
|
267
|
-
return {
|
|
268
|
-
markupView,
|
|
269
|
-
showCommentHighlights: displayCommentHighlights,
|
|
270
|
-
...altChunkMarkerText === void 0 ? {} : { altChunkMarkerText },
|
|
271
|
-
...flowOpts.styles ? { styles: flowOpts.styles } : {},
|
|
272
|
-
...document?.package.numbering === void 0 ? {} : { numbering: document.package.numbering },
|
|
273
|
-
...flowOpts.defaultSize === void 0 ? {} : { defaultSize: flowOpts.defaultSize },
|
|
274
|
-
..._theme !== void 0 ? { theme: _theme } : {},
|
|
275
|
-
fontAlternates,
|
|
276
|
-
...embeddedFontFamilies,
|
|
277
|
-
...flowOpts.documentFontFacts === void 0 ? {} : { documentFontFacts: flowOpts.documentFontFacts },
|
|
278
|
-
measureBlocks: hfMeasureBlocks,
|
|
279
|
-
...defaultTabStop !== void 0 ? { defaultTabStopTwips: defaultTabStop } : {},
|
|
280
|
-
...flowOpts.lineBreakRules ? { lineBreakRules: flowOpts.lineBreakRules } : {},
|
|
281
|
-
...flowOpts.justificationCompatibility ? { justificationCompatibility: flowOpts.justificationCompatibility } : {},
|
|
282
|
-
...flowOpts.tableIndentCompatibility ? { tableIndentCompatibility: flowOpts.tableIndentCompatibility } : {},
|
|
283
|
-
...flowOpts.automaticHyphenation ? { automaticHyphenation: flowOpts.automaticHyphenation } : {}
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
const hfOptions = buildHfOptions(hfPageCountEstimate);
|
|
287
|
-
let headerContentForRender = renderHfFromContentOrPm(headerContent, headerContentRId, hfPMs, contentWidth, hfMetricsHeader, hfOptions);
|
|
288
|
-
let footerContentForRender = renderHfFromContentOrPm(footerContent, footerContentRId, hfPMs, contentWidth, hfMetricsFooter, hfOptions);
|
|
289
|
-
const hasTitlePg = sectionProperties?.titlePg === true;
|
|
290
|
-
let firstPageHeaderForRender = hasTitlePg ? renderHfFromContentOrPm(firstPageHeaderContent, firstPageHeaderContentRId, hfPMs, contentWidth, hfMetricsHeader, hfOptions) : void 0;
|
|
291
|
-
let firstPageFooterForRender = hasTitlePg ? renderHfFromContentOrPm(firstPageFooterContent, firstPageFooterContentRId, hfPMs, contentWidth, hfMetricsFooter, hfOptions) : void 0;
|
|
292
|
-
let headerContentByRId = renderHeaderFooterContentByRId(document?.package.headers, hfPMs, contentWidth, hfMetricsHeader, hfOptions);
|
|
293
|
-
let footerContentByRId = renderHeaderFooterContentByRId(document?.package.footers, hfPMs, contentWidth, hfMetricsFooter, hfOptions);
|
|
294
|
-
const sectionPropertiesForMargins = document?.package.document.sections?.map((section) => section.properties) ?? (sectionProperties ? [sectionProperties] : []);
|
|
295
|
-
const sectionEvenPageMargins = sectionHeaderFooterRefs?.map((refs, index) => {
|
|
296
|
-
if (refs.evenAndOddHeaders !== true) return;
|
|
297
|
-
const properties = sectionPropertiesForMargins[index];
|
|
298
|
-
return bodyMarginsClearHeaderFooter({
|
|
299
|
-
authoredMargins: properties ? getMargins(properties) : margins,
|
|
300
|
-
preparedHeader: refs.headerEven ? headerContentByRId?.get(refs.headerEven) : void 0,
|
|
301
|
-
preparedFooter: refs.footerEven ? footerContentByRId?.get(refs.footerEven) : void 0
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
|
-
const sectionFirstPageMargins = sectionHeaderFooterRefs?.map((refs, index) => {
|
|
305
|
-
if (refs.titlePg !== true) return;
|
|
306
|
-
const properties = sectionPropertiesForMargins[index];
|
|
307
|
-
return bodyMarginsClearHeaderFooter({
|
|
308
|
-
authoredMargins: properties ? getMargins(properties) : margins,
|
|
309
|
-
preparedHeader: refs.headerFirst ? headerContentByRId?.get(refs.headerFirst) : void 0,
|
|
310
|
-
preparedFooter: refs.footerFirst ? footerContentByRId?.get(refs.footerFirst) : void 0
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
newBlocks = bodyBlocksClearSectionHeaderFooter(newBlocks, {
|
|
314
|
-
authoredMargins: margins,
|
|
315
|
-
sectionHeaderFooterRefs,
|
|
316
|
-
headerContentByRId,
|
|
317
|
-
footerContentByRId
|
|
318
|
-
});
|
|
319
|
-
outcome.blocks = newBlocks;
|
|
320
|
-
const initialBodyMargins = bodyMarginsClearHeaderFooter({
|
|
321
|
-
authoredMargins: margins,
|
|
322
|
-
preparedHeader: headerContentForRender,
|
|
323
|
-
preparedFooter: footerContentForRender
|
|
324
|
-
});
|
|
325
|
-
recordPhaseDuration("header-footer", phaseStartedAt);
|
|
326
|
-
phaseStartedAt = performance.now();
|
|
327
|
-
const bodyLayoutConfig = {
|
|
328
|
-
pageSize,
|
|
329
|
-
margins: initialBodyMargins,
|
|
330
|
-
pageNumbering: getPageNumbering(sectionProperties)
|
|
331
|
-
};
|
|
332
|
-
if (columns !== void 0) bodyLayoutConfig.columns = columns;
|
|
333
|
-
const finalSectionProperties = document?.package.document.sections?.at(-1)?.properties;
|
|
334
|
-
const finalHeaderRId = sectionHeaderFooterRefs?.at(-1)?.headerDefault;
|
|
335
|
-
let finalHeaderForLayout = headerContentForRender;
|
|
336
|
-
if (finalHeaderRId) finalHeaderForLayout = headerContentByRId?.get(finalHeaderRId);
|
|
337
|
-
else if (sectionHeaderFooterRefs !== void 0) finalHeaderForLayout = void 0;
|
|
338
|
-
const finalFooterRId = sectionHeaderFooterRefs?.at(-1)?.footerDefault;
|
|
339
|
-
let finalFooterForLayout = footerContentForRender;
|
|
340
|
-
if (finalFooterRId) finalFooterForLayout = footerContentByRId?.get(finalFooterRId);
|
|
341
|
-
else if (sectionHeaderFooterRefs !== void 0) finalFooterForLayout = void 0;
|
|
342
|
-
const finalLayoutConfig = finalSectionProperties ? {
|
|
343
|
-
pageSize: getPageSize(finalSectionProperties),
|
|
344
|
-
margins: bodyMarginsClearHeaderFooter({
|
|
345
|
-
authoredMargins: getMargins(finalSectionProperties),
|
|
346
|
-
preparedHeader: finalHeaderForLayout,
|
|
347
|
-
preparedFooter: finalFooterForLayout
|
|
348
|
-
}),
|
|
349
|
-
pageNumbering: getPageNumbering(finalSectionProperties)
|
|
350
|
-
} : bodyLayoutConfig;
|
|
351
|
-
const finalColumns = getColumns(finalSectionProperties);
|
|
352
|
-
if (finalColumns !== void 0) finalLayoutConfig.columns = finalColumns;
|
|
353
|
-
const blockMeasureInputs = computePerBlockMeasureInputs({
|
|
354
|
-
blocks: newBlocks,
|
|
355
|
-
bodyConfig: bodyLayoutConfig,
|
|
356
|
-
finalConfig: finalLayoutConfig
|
|
357
|
-
});
|
|
358
|
-
const blockWidths = blockMeasureInputs.widths;
|
|
359
|
-
const bodyMeasureGeometry = {
|
|
360
|
-
pageWidth: blockMeasureInputs.pageWidths,
|
|
361
|
-
pageHeight: blockMeasureInputs.pageHeights,
|
|
362
|
-
marginLeft: blockMeasureInputs.marginLefts,
|
|
363
|
-
marginRight: blockMeasureInputs.marginRights,
|
|
364
|
-
marginBottom: blockMeasureInputs.marginBottoms,
|
|
365
|
-
contentLeft: blockMeasureInputs.contentLefts,
|
|
366
|
-
physicalPage: {
|
|
367
|
-
pageWidth: blockMeasureInputs.physicalPageGeometry.pageWidths,
|
|
368
|
-
pageHeight: blockMeasureInputs.physicalPageGeometry.pageHeights,
|
|
369
|
-
marginTop: blockMeasureInputs.physicalPageGeometry.marginTops,
|
|
370
|
-
marginLeft: blockMeasureInputs.physicalPageGeometry.marginLefts,
|
|
371
|
-
marginRight: blockMeasureInputs.physicalPageGeometry.marginRights,
|
|
372
|
-
marginBottom: blockMeasureInputs.physicalPageGeometry.marginBottoms
|
|
373
|
-
},
|
|
374
|
-
columnIndex: blockMeasureInputs.columnIndices,
|
|
375
|
-
columnCount: blockMeasureInputs.columnCounts,
|
|
376
|
-
sectionAdvances: blockMeasureInputs.sectionAdvances
|
|
377
|
-
};
|
|
378
|
-
const measureBody = (inputs = {}) => measureBlocks(newBlocks, blockWidths, blockMeasureInputs.marginTops, bodyMeasureGeometry, inputs.fieldValues, inputs);
|
|
379
|
-
const previousArtifacts = session.artifacts;
|
|
380
|
-
const dirtyRange = options.measure === LAYOUT_MEASURE.incremental ? incrementalDirtyRange({
|
|
381
|
-
session,
|
|
382
|
-
state,
|
|
383
|
-
preview: pendingTemplatePreview,
|
|
384
|
-
measureInputs
|
|
385
|
-
}) : null;
|
|
386
|
-
const incrementalResult = dirtyRange && previousArtifacts ? tryBuildIncrementalMeasures({
|
|
387
|
-
previousBlocks: previousArtifacts.blocks,
|
|
388
|
-
previousMeasures: previousArtifacts.measures,
|
|
389
|
-
previousBlockWidths: previousArtifacts.blockWidths,
|
|
390
|
-
nextBlocks: newBlocks,
|
|
391
|
-
nextBlockWidths: blockWidths,
|
|
392
|
-
dirtyRange,
|
|
393
|
-
measureBlock: measureSingleBlockWithoutFloatingZones
|
|
394
|
-
}) : null;
|
|
395
|
-
let forwardMeasures = incrementalResult?.measures ?? measureBody();
|
|
396
|
-
let newMeasures = forwardMeasures;
|
|
397
|
-
newBlocks = resolveEffectiveParagraphSpacingTree(newBlocks);
|
|
398
|
-
outcome.blocks = newBlocks;
|
|
399
|
-
pendingArtifacts = {
|
|
400
|
-
blocks: newBlocks,
|
|
401
|
-
blockWidths,
|
|
402
|
-
measures: newMeasures
|
|
403
|
-
};
|
|
404
|
-
outcome.measures = newMeasures;
|
|
405
|
-
recordPhaseDuration("measure-blocks", phaseStartedAt);
|
|
406
|
-
const buildNoteOptions = () => {
|
|
407
|
-
const noteOptions = {
|
|
408
|
-
measureBlocks,
|
|
409
|
-
showCommentHighlights: displayCommentHighlights,
|
|
410
|
-
...altChunkMarkerText === void 0 ? {} : { altChunkMarkerText },
|
|
411
|
-
markupView
|
|
412
|
-
};
|
|
413
|
-
if (flowOpts.styles) noteOptions.styles = flowOpts.styles;
|
|
414
|
-
if (flowOpts.defaultSize !== void 0) noteOptions.defaultSize = flowOpts.defaultSize;
|
|
415
|
-
if (_theme !== void 0) noteOptions.theme = _theme;
|
|
416
|
-
if (document?.package.numbering !== void 0) noteOptions.numbering = document.package.numbering;
|
|
417
|
-
noteOptions.fontAlternates = fontAlternates;
|
|
418
|
-
if (session.embeddedFontFamilyMap) noteOptions.embeddedFontFamilyMap = session.embeddedFontFamilyMap;
|
|
419
|
-
if (flowOpts.documentFontFacts !== void 0) noteOptions.documentFontFacts = flowOpts.documentFontFacts;
|
|
420
|
-
if (defaultTabStop !== void 0) noteOptions.defaultTabStopTwips = defaultTabStop;
|
|
421
|
-
if (flowOpts.lineBreakRules) noteOptions.lineBreakRules = flowOpts.lineBreakRules;
|
|
422
|
-
if (flowOpts.justificationCompatibility) noteOptions.justificationCompatibility = flowOpts.justificationCompatibility;
|
|
423
|
-
if (flowOpts.tableIndentCompatibility) noteOptions.tableIndentCompatibility = flowOpts.tableIndentCompatibility;
|
|
424
|
-
if (flowOpts.automaticHyphenation) noteOptions.automaticHyphenation = flowOpts.automaticHyphenation;
|
|
425
|
-
return noteOptions;
|
|
426
|
-
};
|
|
427
|
-
const endnoteAreas = documentEndnotes && endnoteDisplayNumbers && endnoteTexts ? prepareEndnoteAreas({
|
|
428
|
-
blocks: newBlocks,
|
|
429
|
-
endnotes: documentEndnotes,
|
|
430
|
-
displayNumbers: endnoteDisplayNumbers,
|
|
431
|
-
displayTexts: endnoteTexts,
|
|
432
|
-
position: endnotePosition,
|
|
433
|
-
sections: sectionPropertiesForMargins,
|
|
434
|
-
options: buildNoteOptions()
|
|
435
|
-
}) : void 0;
|
|
436
|
-
const paginateBody = (measures, nextLayoutOpts) => {
|
|
437
|
-
if (endnoteAreas === void 0) return layoutDocument(newBlocks, measures, nextLayoutOpts);
|
|
438
|
-
const flow = spliceEndnoteAreas(newBlocks, measures, endnoteAreas);
|
|
439
|
-
return layoutDocument(flow.blocks, flow.measures, {
|
|
440
|
-
...nextLayoutOpts,
|
|
441
|
-
noteAreas: endnoteAreas.noteAreas
|
|
442
|
-
});
|
|
443
|
-
};
|
|
444
|
-
let stabilizedFieldValues;
|
|
445
|
-
const layoutWithNoteAreas = (nextLayoutOpts) => {
|
|
446
|
-
const settled = settleRaisedTableWrap({
|
|
447
|
-
blocks: newBlocks,
|
|
448
|
-
measures: forwardMeasures,
|
|
449
|
-
layout: (measures) => paginateBody(measures, nextLayoutOpts),
|
|
450
|
-
measure: (raisedTableWrap) => measureBody({
|
|
451
|
-
fieldValues: stabilizedFieldValues,
|
|
452
|
-
raisedTableWrap
|
|
453
|
-
})
|
|
454
|
-
});
|
|
455
|
-
if (newMeasures !== settled.measures) {
|
|
456
|
-
newMeasures = settled.measures;
|
|
457
|
-
pendingArtifacts = {
|
|
458
|
-
blocks: newBlocks,
|
|
459
|
-
blockWidths,
|
|
460
|
-
measures: newMeasures
|
|
461
|
-
};
|
|
462
|
-
outcome.measures = newMeasures;
|
|
463
|
-
}
|
|
464
|
-
return settled.layout;
|
|
465
|
-
};
|
|
466
|
-
const withFootnoteHeights = (nextLayoutOpts) => {
|
|
467
|
-
if (!hasFootnotes) return nextLayoutOpts;
|
|
468
|
-
const footnoteHeightById = /* @__PURE__ */ new Map();
|
|
469
|
-
for (const [id, content] of footnoteContentMap) footnoteHeightById.set(id, content.height + 0);
|
|
470
|
-
return {
|
|
471
|
-
...nextLayoutOpts,
|
|
472
|
-
footnoteHeightById,
|
|
473
|
-
footnoteContinuation: nextLayoutOpts.footnoteContinuation ?? { trailingPages: 0 }
|
|
474
|
-
};
|
|
475
|
-
};
|
|
476
|
-
phaseStartedAt = performance.now();
|
|
477
|
-
let newLayout;
|
|
478
|
-
let pageFootnoteMap = /* @__PURE__ */ new Map();
|
|
479
|
-
let footnoteContentMap = /* @__PURE__ */ new Map();
|
|
480
|
-
const buildLayoutOpts = () => {
|
|
481
|
-
const nextLayoutOpts = {
|
|
482
|
-
pageSize,
|
|
483
|
-
margins: initialBodyMargins,
|
|
484
|
-
pageNumbering: bodyLayoutConfig.pageNumbering,
|
|
485
|
-
pageGap,
|
|
486
|
-
mirrorMargins,
|
|
487
|
-
columnBalancing: columnBalancingForCompatibility(document?.package.settings?.noColumnBalance, document?.package.settings?.compatibilityMode),
|
|
488
|
-
tableHeaderGroupStart: tableHeaderGroupStartForCompatibility(document?.package.settings?.compatibilityMode)
|
|
489
|
-
};
|
|
490
|
-
if (document?.package.document.sections !== void 0) nextLayoutOpts.sectionVerticalAlignments = document.package.document.sections.map(({ properties }) => properties.verticalAlign);
|
|
491
|
-
else if (sectionProperties !== null && sectionProperties !== void 0) nextLayoutOpts.sectionVerticalAlignments = [sectionProperties.verticalAlign];
|
|
492
|
-
if (sectionFirstPageMargins !== void 0) nextLayoutOpts.sectionFirstPageMargins = sectionFirstPageMargins;
|
|
493
|
-
else if (hasTitlePg) nextLayoutOpts.firstPageMargins = bodyMarginsClearHeaderFooter({
|
|
494
|
-
authoredMargins: margins,
|
|
495
|
-
preparedHeader: firstPageHeaderForRender,
|
|
496
|
-
preparedFooter: firstPageFooterForRender
|
|
497
|
-
});
|
|
498
|
-
if (finalSectionProperties) {
|
|
499
|
-
nextLayoutOpts.finalPageSize = finalLayoutConfig.pageSize;
|
|
500
|
-
nextLayoutOpts.finalMargins = finalLayoutConfig.margins;
|
|
501
|
-
nextLayoutOpts.finalColumns = finalLayoutConfig.columns ?? {
|
|
502
|
-
count: 1,
|
|
503
|
-
gap: 0
|
|
504
|
-
};
|
|
505
|
-
nextLayoutOpts.finalPageNumbering = finalLayoutConfig.pageNumbering;
|
|
506
|
-
}
|
|
507
|
-
if (columns !== void 0) nextLayoutOpts.columns = columns;
|
|
508
|
-
if (sectionHeaderFooterRefs !== void 0) nextLayoutOpts.sectionHeaderFooterRefs = sectionHeaderFooterRefs;
|
|
509
|
-
if (sectionEvenPageMargins !== void 0) nextLayoutOpts.sectionEvenPageMargins = sectionEvenPageMargins;
|
|
510
|
-
return nextLayoutOpts;
|
|
511
|
-
};
|
|
512
|
-
const layoutOpts = buildLayoutOpts();
|
|
513
|
-
let layoutOptsUsed = layoutOpts;
|
|
514
|
-
if (hasFootnotes) {
|
|
515
|
-
footnoteContentMap = buildFootnoteContentMap(documentFootnotes, footnoteRefs, contentWidth, buildNoteOptions());
|
|
516
|
-
layoutOptsUsed = withFootnoteHeights(layoutOpts);
|
|
517
|
-
newLayout = layoutWithNoteAreas(layoutOptsUsed);
|
|
518
|
-
pageFootnoteMap = /* @__PURE__ */ new Map();
|
|
519
|
-
for (const page of newLayout.pages) if (page.footnoteIds && page.footnoteIds.length > 0) pageFootnoteMap.set(page.number, page.footnoteIds);
|
|
520
|
-
} else newLayout = layoutWithNoteAreas(layoutOpts);
|
|
521
|
-
const rebuildFootnotePageMap = () => {
|
|
522
|
-
pageFootnoteMap = /* @__PURE__ */ new Map();
|
|
523
|
-
for (const page of newLayout.pages) if (page.footnoteIds && page.footnoteIds.length > 0) pageFootnoteMap.set(page.number, page.footnoteIds);
|
|
524
|
-
};
|
|
525
|
-
const relayoutWithCurrentMeasures = (nextLayoutOpts) => {
|
|
526
|
-
layoutOptsUsed = withFootnoteHeights(nextLayoutOpts);
|
|
527
|
-
newLayout = layoutWithNoteAreas(layoutOptsUsed);
|
|
528
|
-
if (hasFootnotes) rebuildFootnotePageMap();
|
|
529
|
-
};
|
|
530
|
-
const stabilizeFieldWidths = () => {
|
|
531
|
-
if (incrementalResult) return;
|
|
532
|
-
const MAX_FIELD_STABILIZATION_PASSES = 3;
|
|
533
|
-
const fieldClock = /* @__PURE__ */ new Date();
|
|
534
|
-
let previousFieldValues = null;
|
|
535
|
-
for (let pass = 0; pass < MAX_FIELD_STABILIZATION_PASSES; pass++) {
|
|
536
|
-
const seqValues = buildSeqValues(newBlocks);
|
|
537
|
-
const bookmarkTextInputs = previousFieldValues === null ? { seqValues } : {
|
|
538
|
-
fieldValues: previousFieldValues,
|
|
539
|
-
seqValues
|
|
540
|
-
};
|
|
541
|
-
const { values, changed } = resolveFieldValues(newBlocks, newLayout.pages, {
|
|
542
|
-
totalPages: newLayout.pages.length,
|
|
543
|
-
bookmarkPages: buildBookmarkPageMap(newLayout.pages, newBlocks),
|
|
544
|
-
bookmarkText: buildBookmarkText(newBlocks, bookmarkTextInputs),
|
|
545
|
-
seqValues,
|
|
546
|
-
sectionPageCounts: buildSectionPageCounts(newLayout.pages),
|
|
547
|
-
now: fieldClock
|
|
548
|
-
});
|
|
549
|
-
if (previousFieldValues === null ? !changed : fieldValuesEqual(previousFieldValues, values)) {
|
|
550
|
-
stabilizedFieldValues = values;
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
previousFieldValues = values;
|
|
554
|
-
stabilizedFieldValues = values;
|
|
555
|
-
forwardMeasures = measureBody({ fieldValues: values });
|
|
556
|
-
relayoutWithCurrentMeasures(layoutOptsUsed);
|
|
557
|
-
pendingArtifacts = {
|
|
558
|
-
blocks: newBlocks,
|
|
559
|
-
blockWidths,
|
|
560
|
-
measures: newMeasures
|
|
561
|
-
};
|
|
562
|
-
outcome.measures = newMeasures;
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
stabilizeFieldWidths();
|
|
566
|
-
if (hasFootnotes) {
|
|
567
|
-
const usedTrailingPages = () => layoutOptsUsed.footnoteContinuation?.trailingPages ?? 0;
|
|
568
|
-
const planContinuation = () => planFootnoteContinuation({
|
|
569
|
-
pages: newLayout.pages,
|
|
570
|
-
contentById: footnoteContentMap,
|
|
571
|
-
trailingPages: usedTrailingPages()
|
|
572
|
-
});
|
|
573
|
-
const relayoutFor = (reservedHeights, trailingPages) => {
|
|
574
|
-
relayoutWithCurrentMeasures({
|
|
575
|
-
...layoutOptsUsed,
|
|
576
|
-
...reservedHeights === void 0 ? {} : { footnoteReservedHeights: reservedHeights },
|
|
577
|
-
footnoteContinuation: { trailingPages }
|
|
578
|
-
});
|
|
579
|
-
stabilizeFieldWidths();
|
|
580
|
-
};
|
|
581
|
-
let continuation = planContinuation();
|
|
582
|
-
for (let round = 0; round < MAX_FOOTNOTE_CONTINUATION_ROUNDS && !footnoteContinuationSettled({
|
|
583
|
-
reservedHeights: layoutOptsUsed.footnoteReservedHeights,
|
|
584
|
-
trailingPages: usedTrailingPages()
|
|
585
|
-
}, continuation); round += 1) {
|
|
586
|
-
relayoutFor(continuation.reservedHeights, continuation.trailingPages);
|
|
587
|
-
continuation = planContinuation();
|
|
588
|
-
}
|
|
589
|
-
while (continuation.extraPages > 0) {
|
|
590
|
-
relayoutFor(layoutOptsUsed.footnoteReservedHeights, continuation.trailingPages);
|
|
591
|
-
continuation = planContinuation();
|
|
592
|
-
}
|
|
593
|
-
if (continuation.pages.size > 0) {
|
|
594
|
-
newLayout = {
|
|
595
|
-
...newLayout,
|
|
596
|
-
pages: applyFootnoteContinuation(newLayout.pages, continuation)
|
|
597
|
-
};
|
|
598
|
-
rebuildFootnotePageMap();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
newLayout = attachAuthoredMarginsToLayoutPages(newLayout, {
|
|
602
|
-
authoredMargins: margins,
|
|
603
|
-
mirrorMargins,
|
|
604
|
-
sectionPropertiesForMargins
|
|
605
|
-
});
|
|
606
|
-
const rebuildHeaderFooterForLayout = () => {
|
|
607
|
-
const seqValues = buildSeqValues(newBlocks);
|
|
608
|
-
const bookmarkTextInputs = stabilizedFieldValues === void 0 ? { seqValues } : {
|
|
609
|
-
fieldValues: stabilizedFieldValues,
|
|
610
|
-
seqValues
|
|
611
|
-
};
|
|
612
|
-
const finalHfFieldInputs = {
|
|
613
|
-
bookmarkPages: buildBookmarkPageMap(newLayout.pages, newBlocks),
|
|
614
|
-
bookmarkText: buildBookmarkText(newBlocks, bookmarkTextInputs),
|
|
615
|
-
seqValues,
|
|
616
|
-
sectionPageCounts: buildSectionPageCounts(newLayout.pages)
|
|
617
|
-
};
|
|
618
|
-
const finalHfOptions = buildHfOptions(newLayout.pages.length, finalHfFieldInputs);
|
|
619
|
-
headerContentForRender = renderHfFromContentOrPm(headerContent, headerContentRId, hfPMs, contentWidth, hfMetricsHeader, finalHfOptions);
|
|
620
|
-
footerContentForRender = renderHfFromContentOrPm(footerContent, footerContentRId, hfPMs, contentWidth, hfMetricsFooter, finalHfOptions);
|
|
621
|
-
firstPageHeaderForRender = hasTitlePg ? renderHfFromContentOrPm(firstPageHeaderContent, firstPageHeaderContentRId, hfPMs, contentWidth, hfMetricsHeader, finalHfOptions) : void 0;
|
|
622
|
-
firstPageFooterForRender = hasTitlePg ? renderHfFromContentOrPm(firstPageFooterContent, firstPageFooterContentRId, hfPMs, contentWidth, hfMetricsFooter, finalHfOptions) : void 0;
|
|
623
|
-
headerContentByRId = renderHeaderFooterContentByRId(document?.package.headers, hfPMs, contentWidth, hfMetricsHeader, finalHfOptions);
|
|
624
|
-
footerContentByRId = renderHeaderFooterContentByRId(document?.package.footers, hfPMs, contentWidth, hfMetricsFooter, finalHfOptions);
|
|
625
|
-
};
|
|
626
|
-
rebuildHeaderFooterForLayout();
|
|
627
|
-
outcome.layout = newLayout;
|
|
628
|
-
recordPhaseDuration("layout-document", phaseStartedAt);
|
|
629
|
-
if (pagesContainer && painter) {
|
|
630
|
-
phaseStartedAt = performance.now();
|
|
631
|
-
const blockLookup = /* @__PURE__ */ new Map();
|
|
632
|
-
for (let i = 0; i < newBlocks.length; i++) {
|
|
633
|
-
const block = newBlocks[i];
|
|
634
|
-
const measure = newMeasures[i];
|
|
635
|
-
if (block && measure) blockLookup.set(String(block.id), {
|
|
636
|
-
block,
|
|
637
|
-
measure
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
for (const area of endnoteAreas?.areas ?? []) for (const [index, block] of area.blocks.entries()) {
|
|
641
|
-
const measure = area.measures[index];
|
|
642
|
-
if (!measure) continue;
|
|
643
|
-
const noteStory = endnoteAreas?.noteStoryByBlockId.get(String(block.id));
|
|
644
|
-
blockLookup.set(String(block.id), {
|
|
645
|
-
block,
|
|
646
|
-
measure,
|
|
647
|
-
...noteStory === void 0 ? {} : { noteStory }
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
const continuationSeparator = endnoteAreas?.noteAreas.continuationSeparator;
|
|
651
|
-
if (continuationSeparator) blockLookup.set(String(continuationSeparator.block.id), continuationSeparator);
|
|
652
|
-
outcome.blockLookup = blockLookup;
|
|
653
|
-
const footnotesByPage = hasFootnotes ? buildFootnoteRenderItems(pageFootnoteMap, footnoteContentMap, document) : void 0;
|
|
654
|
-
const renderOpts = {
|
|
655
|
-
...embeddedFontFamilies,
|
|
656
|
-
...documentFontFacts === void 0 ? {} : { documentFontFacts },
|
|
657
|
-
pageGap,
|
|
658
|
-
showShadow: true,
|
|
659
|
-
blockLookup,
|
|
660
|
-
titlePg: hasTitlePg
|
|
661
|
-
};
|
|
662
|
-
if (showMarginGuides) {
|
|
663
|
-
renderOpts.showMarginGuides = true;
|
|
664
|
-
if (marginGuideColor !== void 0) renderOpts.marginGuideColor = marginGuideColor;
|
|
665
|
-
}
|
|
666
|
-
if (headerContentForRender) renderOpts.headerContent = headerContentForRender;
|
|
667
|
-
if (footerContentForRender) renderOpts.footerContent = footerContentForRender;
|
|
668
|
-
if (firstPageHeaderForRender) renderOpts.firstPageHeaderContent = firstPageHeaderForRender;
|
|
669
|
-
if (firstPageFooterForRender) renderOpts.firstPageFooterContent = firstPageFooterForRender;
|
|
670
|
-
if (headerContentByRId) renderOpts.headerContentByRId = headerContentByRId;
|
|
671
|
-
if (footerContentByRId) renderOpts.footerContentByRId = footerContentByRId;
|
|
672
|
-
if (sectionHeaderFooterRefs === void 0 && sectionProperties?.headerDistance !== void 0 && sectionProperties.headerDistance !== 0) renderOpts.headerDistance = twipsToPixels(sectionProperties.headerDistance);
|
|
673
|
-
if (sectionHeaderFooterRefs === void 0 && sectionProperties?.footerDistance !== void 0 && sectionProperties.footerDistance !== 0) renderOpts.footerDistance = twipsToPixels(sectionProperties.footerDistance);
|
|
674
|
-
if (sectionProperties?.pageBorders) renderOpts.pageBorders = sectionProperties.pageBorders;
|
|
675
|
-
if (_theme) renderOpts.theme = _theme;
|
|
676
|
-
if (footnotesByPage !== void 0 && footnotesByPage.size > 0) renderOpts.footnotesByPage = footnotesByPage;
|
|
677
|
-
const bookmarkPages = buildBookmarkPageMap(newLayout.pages, newBlocks);
|
|
678
|
-
if (bookmarkPages.size > 0) renderOpts.bookmarkPages = bookmarkPages;
|
|
679
|
-
const seqValues = buildSeqValues(newBlocks);
|
|
680
|
-
if (seqValues.size > 0) renderOpts.seqValues = seqValues;
|
|
681
|
-
const bookmarkText = buildBookmarkText(newBlocks, stabilizedFieldValues === void 0 ? { seqValues } : {
|
|
682
|
-
fieldValues: stabilizedFieldValues,
|
|
683
|
-
seqValues
|
|
684
|
-
});
|
|
685
|
-
if (bookmarkText.size > 0) renderOpts.bookmarkText = bookmarkText;
|
|
686
|
-
renderOpts.sectionPageCounts = buildSectionPageCounts(newLayout.pages);
|
|
687
|
-
if (document) {
|
|
688
|
-
const watermark = getDocumentWatermark(document);
|
|
689
|
-
if (watermark) renderOpts.watermark = watermark;
|
|
690
|
-
let watermarkByHeaderRId;
|
|
691
|
-
const headers = document.package.headers;
|
|
692
|
-
if (headers) {
|
|
693
|
-
watermarkByHeaderRId = /* @__PURE__ */ new Map();
|
|
694
|
-
for (const [rId, header] of headers) if (header.watermark) watermarkByHeaderRId.set(rId, header.watermark);
|
|
695
|
-
if (watermarkByHeaderRId.size > 0) renderOpts.watermarkByHeaderRId = watermarkByHeaderRId;
|
|
696
|
-
}
|
|
697
|
-
const pictureSources = new Set([watermark, ...watermarkByHeaderRId?.values() ?? []].filter((candidate) => candidate !== void 0).map((candidate) => resolveWatermarkImageSrc(document, candidate)));
|
|
698
|
-
const watermarkImageSrc = pictureSources.size === 1 ? [...pictureSources].at(0) : void 0;
|
|
699
|
-
if (watermarkImageSrc !== void 0) renderOpts.watermarkImageSrc = watermarkImageSrc;
|
|
700
|
-
}
|
|
701
|
-
if (pageRenderer === PAGE_RENDERER.displayList) renderOpts.paintPage = createDisplayListPagePainter({
|
|
702
|
-
layout: newLayout,
|
|
703
|
-
blockLookup,
|
|
704
|
-
doc: pagesContainer.ownerDocument,
|
|
705
|
-
...document?.package.document.comments === void 0 ? {} : { comments: displayCommentsFrom(survivingComments(document)) },
|
|
706
|
-
...displayListFurnitureFrom(renderOpts),
|
|
707
|
-
...footnoteContentMap.size === 0 ? {} : { footnoteContentById: footnoteContentMap }
|
|
708
|
-
}).paintPage;
|
|
709
|
-
renderPages(newLayout.pages, pagesContainer, renderOpts);
|
|
710
|
-
recordPhaseDuration("render-pages", phaseStartedAt);
|
|
711
|
-
}
|
|
712
|
-
const measuredFontSet = readFontSetSignature();
|
|
713
|
-
labelMeasureCachesFontSet(measuredFontSet);
|
|
714
|
-
session.artifacts = pendingArtifacts;
|
|
715
|
-
session.lastTemplatePreview = pendingTemplatePreview;
|
|
716
|
-
session.lastEditorState = state;
|
|
717
|
-
session.lastPmDoc = state.doc;
|
|
718
|
-
session.lastMeasureInputs = {
|
|
719
|
-
...measureInputs,
|
|
720
|
-
fontSet: measuredFontSet
|
|
721
|
-
};
|
|
722
|
-
recordLayoutComplete(reason);
|
|
723
|
-
} catch (error) {
|
|
724
|
-
const invalidHighlights = describeInvalidHighlightMarks(state.doc);
|
|
725
|
-
recordLayoutError(reason, invalidHighlights ? /* @__PURE__ */ new Error(`${String(error)} Invalid highlights: ${invalidHighlights}`) : error);
|
|
726
|
-
outcome = {};
|
|
727
|
-
}
|
|
728
|
-
syncCoordinator.onLayoutComplete(currentEpoch);
|
|
729
|
-
return outcome;
|
|
5
|
+
/** Run a synchronous layout pass for consumers of the core pipeline. */
|
|
6
|
+
function runLayoutPipeline(deps, state, options) {
|
|
7
|
+
return runLayoutPipelineWithPainter(deps.pageRenderer === PAGE_RENDERER.displayList ? {
|
|
8
|
+
...deps,
|
|
9
|
+
displayListPagePainter: createDisplayListPagePainter
|
|
10
|
+
} : deps, state, options);
|
|
730
11
|
}
|
|
731
12
|
export { runLayoutPipeline };
|