@stll/folio-core 0.42.0 → 0.44.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/headless.js +6 -5
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/index.js +2 -2
- package/dist/ai-edits/snapshot.js +13 -9
- package/dist/compare/content-alignment.js +16 -1
- package/dist/compare/inline-atoms.js +1 -1
- package/dist/compare/style-resources.js +6 -0
- package/dist/compat/eigenpal.d.ts +2 -2
- package/dist/controller/layoutPipeline.d.ts +2 -1
- package/dist/controller/layoutPipeline.js +5 -2
- package/dist/controller/layoutSession.d.ts +2 -1
- package/dist/controller/layoutSession.js +1 -0
- package/dist/docx/appVersionNormalization.d.ts +0 -18
- package/dist/docx/blockContentParser.js +10 -1
- package/dist/docx/blockRangeMarkers.d.ts +36 -0
- package/dist/docx/blockRangeMarkers.js +59 -0
- package/dist/docx/bookmarkParser.d.ts +2 -20
- package/dist/docx/bookmarkParser.js +6 -30
- package/dist/docx/borderParser.d.ts +13 -0
- package/dist/docx/borderParser.js +71 -0
- package/dist/docx/builtInStyles.d.ts +165 -0
- package/dist/docx/builtInStyles.js +239 -0
- package/dist/docx/commentIdNormalization.d.ts +10 -0
- package/dist/docx/commentIdNormalization.js +33 -0
- package/dist/docx/commentParser.d.ts +2 -1
- package/dist/docx/commentParser.js +34 -7
- package/dist/docx/commentReferenceNormalization.d.ts +4 -1
- package/dist/docx/commentReferenceNormalization.js +23 -14
- package/dist/docx/danglingRelationshipReferences.d.ts +15 -0
- package/dist/docx/danglingRelationshipReferences.js +30 -0
- package/dist/docx/defaultParagraphStyle.d.ts +39 -0
- package/dist/docx/defaultParagraphStyle.js +54 -0
- package/dist/docx/documentParser.d.ts +2 -1
- package/dist/docx/documentParser.js +2 -2
- package/dist/docx/drawingUtils.d.ts +8 -1
- package/dist/docx/drawingUtils.js +12 -3
- package/dist/docx/fieldParser.js +3 -5
- package/dist/docx/footnoteParser.d.ts +3 -2
- package/dist/docx/footnoteParser.js +19 -2
- package/dist/docx/groupDrawingParser.js +1 -1
- package/dist/docx/headerFooterRefParser.d.ts +15 -3
- package/dist/docx/headerFooterRefParser.js +51 -14
- package/dist/docx/headerFooterReferenceNormalization.d.ts +4 -1
- package/dist/docx/headerFooterReferenceNormalization.js +5 -1
- package/dist/docx/hyperlinkParser.js +11 -15
- package/dist/docx/imageParser.d.ts +1 -1
- package/dist/docx/imageParser.js +22 -18
- package/dist/docx/imageRawXml.js +5 -5
- package/dist/docx/markupRangeMarker.d.ts +15 -0
- package/dist/docx/markupRangeMarker.js +44 -0
- package/dist/docx/noteReferenceStyles.d.ts +29 -0
- package/dist/docx/noteReferenceStyles.js +70 -0
- package/dist/docx/numberingParser.js +2 -1
- package/dist/docx/numberingReference.d.ts +21 -0
- package/dist/docx/numberingReference.js +21 -0
- package/dist/docx/numberingReferenceNormalization.d.ts +14 -2
- package/dist/docx/numberingReferenceNormalization.js +51 -9
- package/dist/docx/paraIdRangeNormalization.d.ts +0 -19
- package/dist/docx/paragraphParser.js +69 -101
- package/dist/docx/paragraphPropertySource.js +1 -0
- package/dist/docx/paragraphTraversal.d.ts +37 -1
- package/dist/docx/paragraphTraversal.js +84 -1
- package/dist/docx/parseContext.d.ts +37 -0
- package/dist/docx/parseContext.js +67 -0
- package/dist/docx/parseWarningMessage.d.ts +6 -0
- package/dist/docx/parseWarningMessage.js +44 -0
- package/dist/docx/parser.js +86 -24
- package/dist/docx/relsParser.d.ts +28 -11
- package/dist/docx/relsParser.js +26 -13
- package/dist/docx/revisionIdNormalization.js +81 -7
- package/dist/docx/rezip.js +85 -27
- package/dist/docx/runConsolidator.js +1 -2
- package/dist/docx/runParser.d.ts +8 -1
- package/dist/docx/runParser.js +30 -48
- package/dist/docx/sectionParser.d.ts +2 -1
- package/dist/docx/sectionParser.js +21 -65
- package/dist/docx/serializer/borderSerializer.d.ts +1 -2
- package/dist/docx/serializer/commentSerializer.js +22 -9
- package/dist/docx/serializer/documentSerializer.d.ts +1 -5
- package/dist/docx/serializer/documentSerializer.js +6 -16
- package/dist/docx/serializer/headerFooterSerializer.js +5 -0
- package/dist/docx/serializer/markupRangeAttributes.d.ts +8 -0
- package/dist/docx/serializer/markupRangeAttributes.js +24 -0
- package/dist/docx/serializer/noteSerializer.js +5 -0
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -5
- package/dist/docx/serializer/paragraphSerializer.js +29 -35
- package/dist/docx/serializer/runSerializer.js +13 -7
- package/dist/docx/serializer/tableSerializer.js +28 -13
- package/dist/docx/serializer/textFormattingSerializer.d.ts +2 -3
- package/dist/docx/server/build.js +8 -1
- package/dist/docx/server/createBilingualDocument.js +15 -22
- package/dist/docx/server/extractDocxText.js +3 -4
- package/dist/docx/shadingParser.d.ts +6 -0
- package/dist/docx/shadingParser.js +32 -0
- package/dist/docx/shapeParser.js +3 -3
- package/dist/docx/styleParser.js +15 -89
- package/dist/docx/styleReferenceResolution.d.ts +36 -0
- package/dist/docx/styleReferenceResolution.js +51 -0
- package/dist/docx/tableLook.d.ts +57 -0
- package/dist/docx/tableLook.js +63 -0
- package/dist/docx/tableParser.d.ts +7 -9
- package/dist/docx/tableParser.js +64 -110
- package/dist/docx/textBoxParser.js +4 -4
- package/dist/docx/trackedMoveRangeNormalization.d.ts +3 -1
- package/dist/docx/trackedMoveRangeNormalization.js +11 -21
- package/dist/docx/transitionalSpelling.d.ts +13 -2
- package/dist/docx/transitionalSpelling.js +23 -1
- package/dist/docx/verbatimCapture.js +4 -11
- package/dist/docx/vmlImageParser.js +2 -2
- package/dist/docx/watermarkParser.js +2 -2
- package/dist/docx/xmlParser.d.ts +22 -32
- package/dist/docx/xmlParser.js +36 -21
- package/dist/index.d.ts +2 -2
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +2 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +9 -6
- package/dist/internal/paragraphFormattingSerialization.d.ts +2 -3
- package/dist/internal/paragraphFormattingSerialization.js +26 -6
- package/dist/layout-bridge/convert/footnoteLayout.js +2 -7
- package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +19 -11
- package/dist/layout-bridge/convert/templatePreviewFlow.js +103 -38
- package/dist/layout-bridge/convert/toFlowBlocks.js +12 -3
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +2 -2
- package/dist/layout-engine/measure/measureBlocks.js +1 -6
- package/dist/layout-engine/types.d.ts +8 -2
- package/dist/layout-engine/types.js +35 -2
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/internals.d.ts +6 -1
- package/dist/markdown/internals.js +14 -1
- package/dist/markdown/renderBlock.js +35 -21
- package/dist/markdown/renderParagraph.js +14 -5
- package/dist/markdown/renderRuns.js +4 -3
- package/dist/markdown/renderTable.js +4 -3
- package/dist/markdown/trailers.js +41 -7
- package/dist/markdown/types.d.ts +3 -7
- package/dist/prosemirror/attrs/index.js +2 -5
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +11 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +18 -3
- package/dist/prosemirror/commands/index.d.ts +3 -3
- package/dist/prosemirror/commands/index.js +2 -2
- package/dist/prosemirror/commands/pageBreak.js +12 -1
- package/dist/prosemirror/commands/paragraph.d.ts +3 -3
- package/dist/prosemirror/commands/paragraph.js +2 -2
- package/dist/prosemirror/commentIdAllocator.js +2 -7
- package/dist/prosemirror/conversion/fromProseDoc.js +131 -41
- package/dist/prosemirror/conversion/toProseDoc.d.ts +1 -14
- package/dist/prosemirror/conversion/toProseDoc.js +402 -328
- package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +14 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +11 -6
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -3
- package/dist/prosemirror/extensions/features/ListExtension.js +42 -4
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +4 -1
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +6 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.d.ts +7 -0
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +74 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +11 -3
- package/dist/prosemirror/extensions/marks/markUtils.js +98 -19
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +7 -3
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +2 -1
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +1 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +15 -1
- package/dist/prosemirror/extensions/types.d.ts +2 -2
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/index.js +3 -3
- package/dist/prosemirror/insertOperations.d.ts +9 -2
- package/dist/prosemirror/insertOperations.js +9 -4
- package/dist/prosemirror/listMarker.js +2 -1
- package/dist/prosemirror/numberedRefFields.js +2 -1
- package/dist/prosemirror/pageBreakRunProjection.d.ts +11 -3
- package/dist/prosemirror/pageBreakRunProjection.js +16 -8
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +159 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +106 -0
- package/dist/prosemirror/plugins/documentStyles.d.ts +9 -1
- package/dist/prosemirror/plugins/documentStyles.js +11 -1
- package/dist/prosemirror/plugins/index.d.ts +2 -2
- package/dist/prosemirror/plugins/index.js +2 -2
- package/dist/prosemirror/plugins/revisionIds.d.ts +11 -2
- package/dist/prosemirror/plugins/revisionIds.js +21 -6
- package/dist/prosemirror/plugins/templatePreviewValues.d.ts +42 -1
- package/dist/prosemirror/plugins/templatePreviewValues.js +217 -14
- package/dist/prosemirror/runFormattingReconciliation.js +3 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +1 -1
- package/dist/prosemirror/schema/nodes.d.ts +31 -0
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +4 -1
- package/dist/prosemirror/styles/styleResolver.d.ts +9 -0
- package/dist/prosemirror/styles/styleResolver.js +15 -6
- package/dist/prosemirror/utils/visualLineNavigation.d.ts +22 -2
- package/dist/prosemirror/utils/visualLineNavigation.js +80 -63
- package/dist/style-engine/styleEngine.d.ts +4 -1
- package/dist/style-engine/styleEngine.js +3 -0
- package/dist/style-sets/extract.js +35 -11
- package/dist/style-sets/stellaStyle.js +46 -39
- package/dist/style-sets/styleSetNormalization.d.ts +19 -0
- package/dist/style-sets/styleSetNormalization.js +99 -0
- package/dist/types/content.d.ts +2 -2
- package/dist/utils/createDocument.js +145 -20
- package/dist/utils/headingCollector.d.ts +8 -5
- package/dist/utils/headingCollector.js +23 -25
- package/dist/utils/tableOfContentsStyle.js +9 -2
- package/package.json +3 -2
- package/dist/docx/textWhitespace.d.ts +0 -4
- package/dist/docx/textWhitespace.js +0 -4
- package/dist/layout-bridge/engine/tableWidthUtils.d.ts +0 -6
- package/dist/layout-bridge/engine/tableWidthUtils.js +0 -25
- package/dist/markdown/headings.d.ts +0 -13
- package/dist/markdown/headings.js +0 -20
package/dist/docx/xmlParser.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { transitionalSlotEncoding } from "./transitionalSpelling.js";
|
|
1
|
+
import { NUMBERS_PER_PERCENT, percentageSpelling, transitionalSlotEncoding } from "./transitionalSpelling.js";
|
|
2
2
|
import { universalMeasureAs } from "./universalMeasure.js";
|
|
3
3
|
import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
4
4
|
import { OOXML_NS } from "@stll/docx-utils";
|
|
5
|
+
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
5
6
|
//#region src/docx/xmlParser.ts
|
|
6
7
|
/**
|
|
7
8
|
* XML Parser Utilities for OOXML
|
|
@@ -481,17 +482,19 @@ function getTextContent(element) {
|
|
|
481
482
|
return text;
|
|
482
483
|
}
|
|
483
484
|
/**
|
|
484
|
-
*
|
|
485
|
+
* Read an `ST_OnOff` attribute.
|
|
485
486
|
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
487
|
+
* The type has three spellings per polarity — `1`/`true`/`on` and
|
|
488
|
+
* `0`/`false`/`off` — and producers use all of them. `undefined` means the
|
|
489
|
+
* author said nothing (absent, or a value outside the type), so the caller
|
|
490
|
+
* still owns what absence means for its own slot.
|
|
491
|
+
*
|
|
492
|
+
* Every on/off attribute goes through here: a hand-rolled `=== "1"` reads
|
|
493
|
+
* `w:beforeAutospacing="on"` as false, and the save path then writes `"0"`,
|
|
494
|
+
* inverting what the document said.
|
|
490
495
|
*/
|
|
491
|
-
function
|
|
492
|
-
|
|
493
|
-
if (value === null) return false;
|
|
494
|
-
return parseOnOffValue(value) ?? true;
|
|
496
|
+
function parseOnOffAttribute(element, namespace, name, context) {
|
|
497
|
+
return parseOnOffValue(getAttribute(element, namespace, name), context, element?.name ?? name);
|
|
495
498
|
}
|
|
496
499
|
/**
|
|
497
500
|
* Check if a child element exists (used for boolean flags in OOXML)
|
|
@@ -554,17 +557,19 @@ function parseNumberingLevelAttribute(element) {
|
|
|
554
557
|
return level !== void 0 && level >= 0 ? level : void 0;
|
|
555
558
|
}
|
|
556
559
|
/**
|
|
557
|
-
* Parse `w:w` on a table width/height element.
|
|
558
|
-
*
|
|
559
|
-
* (`5000`);
|
|
560
|
+
* Parse `w:w` on a table width/height element. A percentage may be spelled the
|
|
561
|
+
* way it reads (`100%`) or as the number its slot counts in
|
|
562
|
+
* (50ths-of-percent, `5000`); the generated slot table says which unit that
|
|
563
|
+
* is, so the two spellings are not decided here.
|
|
560
564
|
*/
|
|
561
565
|
function parseTableMeasurementValue(element, widthType) {
|
|
562
566
|
const raw = getAttribute(element, "w", "w");
|
|
563
567
|
if (raw === null) return;
|
|
564
568
|
const trimmed = raw.trim();
|
|
565
|
-
if (widthType === "pct"
|
|
566
|
-
const
|
|
567
|
-
|
|
569
|
+
if (widthType === "pct") {
|
|
570
|
+
const percent = percentageSpelling(trimmed);
|
|
571
|
+
const unit = element === null || element === void 0 ? void 0 : transitionalSlotEncoding(element.namespaceUri, getLocalName(element.name), "w")?.percent;
|
|
572
|
+
if (percent !== void 0 && unit !== void 0) return Math.round(percent * NUMBERS_PER_PERCENT[unit]);
|
|
568
573
|
}
|
|
569
574
|
const measure = universalMeasureAs(trimmed, "twips");
|
|
570
575
|
if (measure !== void 0) return measure;
|
|
@@ -573,8 +578,12 @@ function parseTableMeasurementValue(element, widthType) {
|
|
|
573
578
|
}
|
|
574
579
|
/**
|
|
575
580
|
* Parse an OOXML `ST_OnOff` lexical value.
|
|
581
|
+
*
|
|
582
|
+
* `context` is optional and trailing on purpose: every call site that has one
|
|
583
|
+
* reports the value folio declined to read, and the hundred that do not yet
|
|
584
|
+
* thread one keep compiling and keep their behaviour.
|
|
576
585
|
*/
|
|
577
|
-
function parseOnOffValue(value) {
|
|
586
|
+
function parseOnOffValue(value, context, element) {
|
|
578
587
|
if (value === null || value === void 0) return;
|
|
579
588
|
switch (value) {
|
|
580
589
|
case "1":
|
|
@@ -583,7 +592,13 @@ function parseOnOffValue(value) {
|
|
|
583
592
|
case "0":
|
|
584
593
|
case "false":
|
|
585
594
|
case "off": return false;
|
|
586
|
-
default:
|
|
595
|
+
default:
|
|
596
|
+
context?.warn({
|
|
597
|
+
code: PARSE_WARNING_CODES.unrecognisedOnOffValue,
|
|
598
|
+
value,
|
|
599
|
+
...element === void 0 ? {} : { element }
|
|
600
|
+
});
|
|
601
|
+
return;
|
|
587
602
|
}
|
|
588
603
|
}
|
|
589
604
|
/**
|
|
@@ -598,7 +613,7 @@ function parseOnOffValue(value) {
|
|
|
598
613
|
* @param namespace - Namespace for val attribute
|
|
599
614
|
* @returns boolean value
|
|
600
615
|
*/
|
|
601
|
-
function parseBooleanElement(element, namespace = "w") {
|
|
616
|
+
function parseBooleanElement(element, namespace = "w", context) {
|
|
602
617
|
if (!element) return false;
|
|
603
618
|
let val = null;
|
|
604
619
|
const elementName = element.name ?? "";
|
|
@@ -613,7 +628,7 @@ function parseBooleanElement(element, namespace = "w") {
|
|
|
613
628
|
}
|
|
614
629
|
}
|
|
615
630
|
if (val === null) return true;
|
|
616
|
-
return parseOnOffValue(val) ??
|
|
631
|
+
return parseOnOffValue(val, context, elementName) ?? false;
|
|
617
632
|
}
|
|
618
633
|
/**
|
|
619
634
|
* Deep find - search recursively for an element
|
|
@@ -810,4 +825,4 @@ function cloneElement(element, overrides) {
|
|
|
810
825
|
return clone;
|
|
811
826
|
}
|
|
812
827
|
//#endregion
|
|
813
|
-
export { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, OOXML_NAMESPACE_SCOPE, WORDPROCESSINGML_NAMESPACE_URIS, attachXmlNamespaceContext, cloneElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findAttributeByNamespaceUri, findByFullName, findChild, findChildByLocalName, findChildByNamespaceUri, findChildren, findChildrenByLocalName, findChildrenByNamespaceUri, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributeByNamespaceUri, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, getTextContent, hasChild,
|
|
828
|
+
export { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, OOXML_NAMESPACE_SCOPE, WORDPROCESSINGML_NAMESPACE_URIS, attachXmlNamespaceContext, cloneElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findAttributeByNamespaceUri, findByFullName, findChild, findChildByLocalName, findChildByNamespaceUri, findChildren, findChildrenByLocalName, findChildrenByNamespaceUri, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributeByNamespaceUri, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, getTextContent, hasChild, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffAttribute, parseOnOffValue, parseTableMeasurementValue, parseXml, parseXmlDocument, selectAlternateContentBranch };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { getFolioCaretViewportRect, getFolioSelectionViewportRect } from "./page
|
|
|
30
30
|
import { AICitationRange, createAICitationDecorationsPlugin, setAICitationsMeta, setActiveCitationMeta } from "./prosemirror/plugins/aiCitationDecorations.js";
|
|
31
31
|
import { AnonymizationMatch, AnonymizationTerm, anonymizationDecorationsKey, getAnonymizationMatches, setAnonymizationTermsMeta } from "./prosemirror/plugins/anonymizationDecorations.js";
|
|
32
32
|
import { DirectiveKind, DirectiveRange, getTemplateDirectives, scanDirectives } from "./prosemirror/plugins/templateDirectives.js";
|
|
33
|
-
import { TemplatePreviewSpan, TemplatePreviewValue, TemplatePreviewValues, setTemplatePreviewValues } from "./prosemirror/plugins/templatePreviewValues.js";
|
|
33
|
+
import { TemplatePreviewHiddenRange, TemplatePreviewSpan, TemplatePreviewValue, TemplatePreviewValues, setTemplatePreviewValues } from "./prosemirror/plugins/templatePreviewValues.js";
|
|
34
34
|
import { TemplateSlashMenuKeyAction, TemplateSlashMenuState, clearTemplateSlashMenu, consumeTemplateSlashQuery, getTemplateSlashMenu, resetTemplateSlashQuery, templateSlashMenuKey } from "./prosemirror/plugins/templateSlashMenu.js";
|
|
35
35
|
import { AcceptAutocompleteResult, AutocompleteSuggestionPluginOptions, AutocompleteSuggestionState, AutocompleteSuggestionStatus, AutocompleteTriggerCheck, AutocompleteTriggerOptions, AutocompleteTriggerSkipReason, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, acceptAutocompleteSuggestion, acceptAutocompleteWord, appendAutocompleteToken, autocompleteSuggestionKey, autocompleteSuggestionPlugin, clearAutocompleteSuggestion, finishAutocompleteSuggestion, getAutocompleteSuggestion, shouldTriggerAutocomplete, startAutocompleteSuggestion } from "./prosemirror/plugins/autocompleteSuggestion.js";
|
|
36
36
|
import { ImageMeta, ImageRef, MarkdownOptions, MarkdownResult } from "./markdown/types.js";
|
|
@@ -41,4 +41,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
|
|
|
41
41
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
42
42
|
type Document = document_d_exports.Document;
|
|
43
43
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
44
|
-
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioRevisionStamp, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
44
|
+
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioRevisionStamp, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
@@ -2,6 +2,8 @@ import { document_d_exports } from "../types/document.js";
|
|
|
2
2
|
//#region src/internal/pageBreakRunSourceDescendantIndex.d.ts
|
|
3
3
|
type PageBreakRunSourceDescendantIndex = {
|
|
4
4
|
containsPageBreakRun: (content: readonly document_d_exports.BlockContent[]) => boolean;
|
|
5
|
+
/** The same question about one block, so a caller can ask it per sibling. */
|
|
6
|
+
blockContainsPageBreakRun: (block: document_d_exports.BlockContent) => boolean;
|
|
5
7
|
paragraphFeatures: (paragraph: document_d_exports.Paragraph) => PageBreakRunSourceParagraphFeatures;
|
|
6
8
|
};
|
|
7
9
|
type PageBreakRunSourceParagraphFeatures = {
|
|
@@ -59,7 +59,8 @@ const buildPageBreakRunSourceDescendantIndex = (rootContent) => {
|
|
|
59
59
|
case "deletion":
|
|
60
60
|
case "moveFrom":
|
|
61
61
|
case "moveTo":
|
|
62
|
-
case "inlineSdt":
|
|
62
|
+
case "inlineSdt":
|
|
63
|
+
case "bidiWrapper": return inspectMany(content.content, inspectParagraphContent);
|
|
63
64
|
case "simpleField": {
|
|
64
65
|
const fieldResultFlags = inspectMany(content.content, inspectParagraphContent);
|
|
65
66
|
if (hasFlag(fieldResultFlags, SOURCE_FLAGS.paragraphPageBreak) && hasFlag(fieldResultFlags, SOURCE_FLAGS.paragraphTextBoxShape)) return fieldResultFlags | SOURCE_FLAGS.pageBreakSharesTextBoxShape;
|
|
@@ -105,12 +106,14 @@ const buildPageBreakRunSourceDescendantIndex = (rootContent) => {
|
|
|
105
106
|
return flags;
|
|
106
107
|
}
|
|
107
108
|
inspectBlocks(rootContent);
|
|
109
|
+
const indexedFlags = (node) => {
|
|
110
|
+
const flags = flagsByObject.get(node);
|
|
111
|
+
if (flags === void 0) panic("Page-break source ownership was queried outside its conversion index");
|
|
112
|
+
return flags;
|
|
113
|
+
};
|
|
108
114
|
return {
|
|
109
|
-
containsPageBreakRun: (content) =>
|
|
110
|
-
|
|
111
|
-
if (flags === void 0) panic("Page-break source ownership was queried outside its conversion index");
|
|
112
|
-
return hasFlag(flags, SOURCE_FLAGS.containsPageBreak);
|
|
113
|
-
},
|
|
115
|
+
containsPageBreakRun: (content) => hasFlag(indexedFlags(content), SOURCE_FLAGS.containsPageBreak),
|
|
116
|
+
blockContainsPageBreakRun: (block) => hasFlag(indexedFlags(block), SOURCE_FLAGS.containsPageBreak),
|
|
114
117
|
paragraphFeatures: (paragraph) => {
|
|
115
118
|
const flags = flagsByObject.get(paragraph);
|
|
116
119
|
if (flags === void 0) panic("Page-break paragraph ownership was queried outside its conversion index");
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
//#region src/internal/paragraphFormattingSerialization.d.ts
|
|
3
|
-
type ExhaustiveFields<Source, Classified extends keyof Source> = Exclude<keyof Source, Classified> extends never ? Source : never;
|
|
4
3
|
type ParagraphNumberingReference = document_d_exports.ParagraphFormatting["numPr"] | null;
|
|
5
|
-
type ClassifiedParagraphFormattingField = "alignment" | "bidi" | "kinsoku" | "overflowPunctuation" | "spaceBefore" | "spaceAfter" | "lineSpacing" | "lineSpacingRule" | "snapToGrid" | "beforeAutospacing" | "afterAutospacing" | "spacingExplicit" | "indentLeft" | "indentRight" | "indentFirstLine" | "hangingIndent" | "borders" | "shading" | "tabs" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "contextualSpacing" | "numPr" | "numPrFromStyle" | "outlineLevel" | "styleId" | "frame" | "suppressLineNumbers" | "suppressAutoHyphens" | "runProperties" | "runInWithNext";
|
|
6
|
-
type ExhaustiveParagraphFormatting = ExhaustiveFields<document_d_exports.ParagraphFormatting, ClassifiedParagraphFormattingField>;
|
|
4
|
+
type ClassifiedParagraphFormattingField = "alignment" | "bidi" | "kinsoku" | "overflowPunctuation" | "spaceBefore" | "spaceAfter" | "lineSpacing" | "lineSpacingRule" | "snapToGrid" | "beforeAutospacing" | "afterAutospacing" | "spacingExplicit" | "indentLeft" | "indentRight" | "indentFirstLine" | "hangingIndent" | "borders" | "shading" | "tabs" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "contextualSpacing" | "numPr" | "numPrFromStyle" | "numberingChangeXml" | "outlineLevel" | "styleId" | "frame" | "suppressLineNumbers" | "suppressAutoHyphens" | "runProperties" | "runInWithNext";
|
|
5
|
+
type ExhaustiveParagraphFormatting = document_d_exports.ExhaustiveFields<document_d_exports.ParagraphFormatting, ClassifiedParagraphFormattingField>;
|
|
7
6
|
/** Compare numbering references by their emitted id and effective level. */
|
|
8
7
|
declare const paragraphNumberingReferencesEqual: (left: ParagraphNumberingReference, right: ParagraphNumberingReference) => boolean;
|
|
9
8
|
/** Compare the authored `w:numPr` attributes, including an absent `w:ilvl`. */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { serializeBorder } from "../docx/serializer/borderSerializer.js";
|
|
2
2
|
import { serializeShading, serializeTextFormatting } from "../docx/serializer/textFormattingSerializer.js";
|
|
3
3
|
import { escapeXml, intAttr } from "../docx/serializer/xmlUtils.js";
|
|
4
|
+
import { sanitizeCapturedXmlElement } from "../docx/verbatimCapture.js";
|
|
5
|
+
import { NAMESPACES, OOXML_NAMESPACE_SCOPE } from "../docx/xmlParser.js";
|
|
4
6
|
//#region src/internal/paragraphFormattingSerialization.ts
|
|
5
7
|
const modelParagraphNumberingReference = (reference) => {
|
|
6
8
|
if (!reference) return null;
|
|
@@ -74,14 +76,32 @@ const serializeIndentation = (formatting) => {
|
|
|
74
76
|
}
|
|
75
77
|
return attrs.length === 0 ? "" : `<w:ind ${attrs.join(" ")}/>`;
|
|
76
78
|
};
|
|
77
|
-
|
|
79
|
+
/**
|
|
80
|
+
* `w:numPr`, with the tracked record of the numbering it replaced.
|
|
81
|
+
*
|
|
82
|
+
* `w:numberingChange` is the revision a reviewer's numbering change left
|
|
83
|
+
* behind. It is history: nothing in the model derives it, and a rebuilt
|
|
84
|
+
* `w:numPr` that drops it discards the revision silently. It is written even
|
|
85
|
+
* when the paragraph's own numbering reference is gone, because a change
|
|
86
|
+
* record with nothing left to describe is still a record — the schema declares
|
|
87
|
+
* it last in `CT_NumPr`, after `w:ilvl` and `w:numId`.
|
|
88
|
+
*/
|
|
89
|
+
const serializeNumbering = (numPr, numberingChangeXml) => {
|
|
78
90
|
const modeled = modelParagraphNumberingReference(numPr ?? null);
|
|
79
|
-
if (!modeled) return "";
|
|
80
91
|
const parts = [];
|
|
81
|
-
if (modeled
|
|
82
|
-
if (modeled
|
|
92
|
+
if (modeled?.ilvl !== void 0) parts.push(`<w:ilvl w:val="${intAttr(modeled.ilvl)}"/>`);
|
|
93
|
+
if (modeled?.numId !== void 0) parts.push(`<w:numId w:val="${intAttr(modeled.numId)}"/>`);
|
|
94
|
+
const change = replayableNumberingChangeXml(numberingChangeXml);
|
|
95
|
+
if (change !== null) parts.push(change);
|
|
83
96
|
return parts.length === 0 ? "" : `<w:numPr>${parts.join("")}</w:numPr>`;
|
|
84
97
|
};
|
|
98
|
+
const NUMBERING_CHANGE_ROOT_NAME = /* @__PURE__ */ new Set(["numberingChange"]);
|
|
99
|
+
const WORDPROCESSINGML_NAMESPACE = /* @__PURE__ */ new Set([NAMESPACES.w]);
|
|
100
|
+
const replayableNumberingChangeXml = (numberingChangeXml) => sanitizeCapturedXmlElement(numberingChangeXml, {
|
|
101
|
+
allowedLocalNames: NUMBERING_CHANGE_ROOT_NAME,
|
|
102
|
+
allowedNamespaceUris: WORDPROCESSINGML_NAMESPACE,
|
|
103
|
+
inheritedNamespaceScope: OOXML_NAMESPACE_SCOPE
|
|
104
|
+
});
|
|
85
105
|
const serializeFrameProperties = (frame) => {
|
|
86
106
|
if (!frame) return "";
|
|
87
107
|
const { dropCap, lines, width, height, hSpace, vSpace, hAnchor, vAnchor, x, y, xAlign, yAlign, wrap } = frame;
|
|
@@ -117,7 +137,7 @@ const extractRunPropertiesInnerXml = (runPropertiesXml) => {
|
|
|
117
137
|
*/
|
|
118
138
|
const modelParagraphFormattingEmission = (input) => {
|
|
119
139
|
if (!input) return {};
|
|
120
|
-
const { alignment, bidi, kinsoku, overflowPunctuation, spaceBefore, spaceAfter, lineSpacing, lineSpacingRule, snapToGrid, beforeAutospacing, afterAutospacing, spacingExplicit, indentLeft, indentRight, indentFirstLine, hangingIndent, borders, shading, tabs, keepNext, keepLines, widowControl, pageBreakBefore, contextualSpacing, numPr, numPrFromStyle, outlineLevel, styleId, frame, suppressLineNumbers, suppressAutoHyphens, runProperties, runInWithNext } = input;
|
|
140
|
+
const { alignment, bidi, kinsoku, overflowPunctuation, spaceBefore, spaceAfter, lineSpacing, lineSpacingRule, snapToGrid, beforeAutospacing, afterAutospacing, spacingExplicit, indentLeft, indentRight, indentFirstLine, hangingIndent, borders, shading, tabs, keepNext, keepLines, widowControl, pageBreakBefore, contextualSpacing, numPr, numPrFromStyle, numberingChangeXml, outlineLevel, styleId, frame, suppressLineNumbers, suppressAutoHyphens, runProperties, runInWithNext } = input;
|
|
121
141
|
modelSpacingProvenance(spacingExplicit);
|
|
122
142
|
const propertiesXml = [
|
|
123
143
|
styleId ? `<w:pStyle w:val="${escapeXml(styleId)}"/>` : "",
|
|
@@ -126,7 +146,7 @@ const modelParagraphFormattingEmission = (input) => {
|
|
|
126
146
|
serializeToggle("pageBreakBefore", pageBreakBefore),
|
|
127
147
|
serializeFrameProperties(frame),
|
|
128
148
|
serializeToggle("widowControl", widowControl),
|
|
129
|
-
isStyleSourcedParagraphNumbering(numPr, numPrFromStyle) ?
|
|
149
|
+
isStyleSourcedParagraphNumbering(numPr, numPrFromStyle) ? serializeNumbering(void 0, numberingChangeXml) : serializeNumbering(numPr, numberingChangeXml),
|
|
130
150
|
serializeToggle("suppressLineNumbers", suppressLineNumbers),
|
|
131
151
|
serializeParagraphBorders(borders),
|
|
132
152
|
serializeShading(shading),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { measureParagraph } from "../../layout-engine/measure/measureParagraph.js";
|
|
2
2
|
import { layoutTextBoxContent } from "../../layout-engine/measure/textBoxParagraphLayout.js";
|
|
3
|
-
import { DEFAULT_TEXTBOX_MARGINS, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, isFloatingImageRun } from "../../layout-engine/types.js";
|
|
3
|
+
import { DEFAULT_TEXTBOX_MARGINS, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, isFloatingImageRun, resolveTableWidthPx } from "../../layout-engine/types.js";
|
|
4
4
|
import { footnoteToProseDoc } from "../../prosemirror/conversion/toProseDoc.js";
|
|
5
5
|
import { toFlowBlocks } from "./toFlowBlocks.js";
|
|
6
6
|
//#region src/layout-bridge/convert/footnoteLayout.ts
|
|
@@ -264,14 +264,9 @@ function measureFootnoteBlock(block, contentWidth) {
|
|
|
264
264
|
default: return block;
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
function resolveFootnoteTableWidth(width, widthType, contentWidth) {
|
|
268
|
-
if (!width) return;
|
|
269
|
-
if (widthType === "pct") return contentWidth * width / 5e3;
|
|
270
|
-
if (widthType === "dxa" || !widthType || widthType === "auto") return width / 1440 * 96;
|
|
271
|
-
}
|
|
272
267
|
function measureFootnoteTable(tableBlock, contentWidth) {
|
|
273
268
|
let columnWidths = tableBlock.columnWidths ?? [];
|
|
274
|
-
const explicitWidth =
|
|
269
|
+
const explicitWidth = resolveTableWidthPx(tableBlock.width, tableBlock.widthType, contentWidth);
|
|
275
270
|
if (columnWidths.length === 0) {
|
|
276
271
|
const firstRow = tableBlock.rows.at(0);
|
|
277
272
|
let colCount = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplatePreviewValue } from "../../prosemirror/plugins/templatePreviewValues.js";
|
|
1
|
+
import { TemplatePreviewHiddenRange, TemplatePreviewValue } from "../../prosemirror/plugins/templatePreviewValues.js";
|
|
2
2
|
import { FlowBlock } from "../../layout-engine/types.js";
|
|
3
3
|
//#region src/layout-bridge/convert/templatePreviewFlow.d.ts
|
|
4
4
|
/** One marker→value substitution, in PM doc positions. */
|
|
@@ -10,27 +10,35 @@ type TemplatePreviewFlowEntry = {
|
|
|
10
10
|
/** The typed value displayed in place of the marker. */
|
|
11
11
|
value: TemplatePreviewValue;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
/** What the preview substitutes and what it hides, as the flow stage sees it. */
|
|
14
|
+
type TemplatePreviewFlowState = {
|
|
14
15
|
entries: readonly TemplatePreviewFlowEntry[];
|
|
16
|
+
/** Conditional spans a `false` condition hides, in PM doc positions. */
|
|
17
|
+
hidden: readonly TemplatePreviewHiddenRange[];
|
|
18
|
+
};
|
|
19
|
+
type TemplatePreviewFlowOptions = TemplatePreviewFlowState & {
|
|
15
20
|
/** `highlighted` marks substituted runs for the accent-chip CSS. */
|
|
16
21
|
mode: "highlighted" | "plain";
|
|
17
22
|
};
|
|
18
23
|
/**
|
|
19
24
|
* Replace each entry's marker range with its preview value across the given
|
|
20
|
-
* flow blocks (recursing into table cells and text boxes)
|
|
21
|
-
*
|
|
25
|
+
* flow blocks (recursing into table cells and text boxes), and drop the blocks
|
|
26
|
+
* a hidden conditional span swallows whole. Returns the input array unchanged
|
|
27
|
+
* when there is nothing to substitute and nothing to hide.
|
|
22
28
|
*/
|
|
23
|
-
declare function applyTemplatePreviewToBlocks(blocks: FlowBlock[], { entries, mode }: TemplatePreviewFlowOptions): FlowBlock[];
|
|
29
|
+
declare function applyTemplatePreviewToBlocks(blocks: FlowBlock[], { entries, hidden, mode }: TemplatePreviewFlowOptions): FlowBlock[];
|
|
24
30
|
/**
|
|
25
|
-
* PM range covering every substitution
|
|
26
|
-
* states (changed, added, or removed
|
|
27
|
-
*
|
|
31
|
+
* PM range covering every substitution and every hidden span that differs
|
|
32
|
+
* between two preview states (changed, added, or removed), or `null` when the
|
|
33
|
+
* flow content both produce is identical. Feeds the layout pipeline's
|
|
28
34
|
* dirty-range invalidation so typing a value re-measures only the blocks
|
|
29
|
-
* hosting the affected markers.
|
|
35
|
+
* hosting the affected markers. A hidden span that appears or disappears also
|
|
36
|
+
* changes the block count, which sends the measure path down its full-remeasure
|
|
37
|
+
* branch regardless of how wide this range is.
|
|
30
38
|
*/
|
|
31
|
-
declare function templatePreviewDirtyRange(previous:
|
|
39
|
+
declare function templatePreviewDirtyRange(previous: TemplatePreviewFlowState, next: TemplatePreviewFlowState): {
|
|
32
40
|
from: number;
|
|
33
41
|
to: number;
|
|
34
42
|
} | null;
|
|
35
43
|
//#endregion
|
|
36
|
-
export { TemplatePreviewFlowEntry, TemplatePreviewFlowOptions, applyTemplatePreviewToBlocks, templatePreviewDirtyRange };
|
|
44
|
+
export { TemplatePreviewFlowEntry, TemplatePreviewFlowOptions, TemplatePreviewFlowState, applyTemplatePreviewToBlocks, templatePreviewDirtyRange };
|
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
import { templatePreviewValueFingerprint } from "../../prosemirror/plugins/templatePreviewValues.js";
|
|
1
|
+
import { templatePreviewHidesWholeBlock, templatePreviewValueFingerprint } from "../../prosemirror/plugins/templatePreviewValues.js";
|
|
2
2
|
//#region src/layout-bridge/convert/templatePreviewFlow.ts
|
|
3
3
|
/**
|
|
4
|
+
* A top-level block a hidden span swallows whole, which therefore leaves the
|
|
5
|
+
* flow. A block the span only partly covers stays: its text is authored content
|
|
6
|
+
* outside the conditional, and dropping the block would take that text with it.
|
|
7
|
+
*
|
|
8
|
+
* A block carrying no PM positions stays too. That is every section break,
|
|
9
|
+
* which is the safe answer rather than an accident: a section break sets the
|
|
10
|
+
* page geometry that follows it, so hiding text must not take it out of the
|
|
11
|
+
* flow. `SectionBreakBlock` is the one `FlowBlock` variant without the fields,
|
|
12
|
+
* hence the `in` test, matching `findDirtyBlockIndexes`.
|
|
13
|
+
*/
|
|
14
|
+
const isHiddenWholeBlock = (block, hidden) => {
|
|
15
|
+
const pmStart = "pmStart" in block ? block.pmStart : void 0;
|
|
16
|
+
const pmEnd = "pmEnd" in block ? block.pmEnd : void 0;
|
|
17
|
+
if (pmStart === void 0 || pmEnd === void 0) return false;
|
|
18
|
+
return hidden.some((range) => templatePreviewHidesWholeBlock(range, {
|
|
19
|
+
pmStart,
|
|
20
|
+
pmEnd
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
4
24
|
* Replace each entry's marker range with its preview value across the given
|
|
5
|
-
* flow blocks (recursing into table cells and text boxes)
|
|
6
|
-
*
|
|
25
|
+
* flow blocks (recursing into table cells and text boxes), and drop the blocks
|
|
26
|
+
* a hidden conditional span swallows whole. Returns the input array unchanged
|
|
27
|
+
* when there is nothing to substitute and nothing to hide.
|
|
7
28
|
*/
|
|
8
|
-
function applyTemplatePreviewToBlocks(blocks, { entries, mode }) {
|
|
9
|
-
if (entries.length === 0) return blocks;
|
|
29
|
+
function applyTemplatePreviewToBlocks(blocks, { entries, hidden, mode }) {
|
|
30
|
+
if (entries.length === 0 && hidden.length === 0) return blocks;
|
|
10
31
|
const sorted = [...entries].sort((a, b) => a.from - b.from);
|
|
11
32
|
let changed = false;
|
|
12
33
|
const next = [];
|
|
13
34
|
for (const block of blocks) {
|
|
35
|
+
if (isHiddenWholeBlock(block, hidden)) {
|
|
36
|
+
changed = true;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
14
39
|
const transformed = transformBlock(block, sorted, mode);
|
|
15
40
|
changed ||= transformed !== block;
|
|
16
41
|
next.push(transformed);
|
|
@@ -117,60 +142,100 @@ function sliceTextRun(run, base, from, to) {
|
|
|
117
142
|
pmEnd: to
|
|
118
143
|
};
|
|
119
144
|
}
|
|
145
|
+
/** Every newline form a host value may carry; `\r\n` counts once. */
|
|
146
|
+
const VALUE_LINE_BREAK_RE = /\r\n|[\n\r]/u;
|
|
147
|
+
/**
|
|
148
|
+
* Push one span of value text, breaking its lines the way the editor does: each
|
|
149
|
+
* newline becomes a `lineBreak` run, which is the `w:br` the measurer starts a
|
|
150
|
+
* new line on. Consecutive newlines emit consecutive breaks, so a blank line
|
|
151
|
+
* stays a blank line; an empty segment contributes no text run of its own.
|
|
152
|
+
*
|
|
153
|
+
* A rich value's spans are one text stream, so a `\r\n` the host split across a
|
|
154
|
+
* formatting boundary is still one break: `pendingCr` carries a `\r` that ended
|
|
155
|
+
* the previous span, and the returned flag carries this span's. Without it the
|
|
156
|
+
* halves would count as two breaks and the value would gain a blank line.
|
|
157
|
+
*/
|
|
158
|
+
function pushValueSpan(out, valueRun, pendingCr) {
|
|
159
|
+
const text = pendingCr && valueRun.text.startsWith("\n") ? valueRun.text.slice(1) : valueRun.text;
|
|
160
|
+
const segments = text.split(VALUE_LINE_BREAK_RE);
|
|
161
|
+
for (const [index, segment] of segments.entries()) {
|
|
162
|
+
if (index > 0) out.push({
|
|
163
|
+
kind: "lineBreak",
|
|
164
|
+
pmStart: valueRun.pmStart,
|
|
165
|
+
pmEnd: valueRun.pmEnd
|
|
166
|
+
});
|
|
167
|
+
if (segment !== "") out.push({
|
|
168
|
+
...valueRun,
|
|
169
|
+
text: segment
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return text.endsWith("\r");
|
|
173
|
+
}
|
|
120
174
|
/**
|
|
121
175
|
* The value run(s) replacing a marker. A plain value is one run carrying the
|
|
122
176
|
* host run's formatting; a rich value emits one run per span, each layering
|
|
123
177
|
* its own bold/italic over the host formatting (host bold stays bold, a
|
|
124
|
-
* span's flags OR in).
|
|
125
|
-
*
|
|
178
|
+
* span's flags OR in). A newline in either splits its span around a line
|
|
179
|
+
* break run. Every run keeps the marker's full PM range so click-to-position
|
|
180
|
+
* keeps resolving into the marker.
|
|
126
181
|
*/
|
|
127
182
|
function buildValueRuns(host, entry, mode) {
|
|
128
|
-
|
|
183
|
+
const runs = [];
|
|
184
|
+
const base = {
|
|
129
185
|
...host,
|
|
130
|
-
text: entry.value,
|
|
131
186
|
pmStart: entry.from,
|
|
132
187
|
pmEnd: entry.to,
|
|
133
188
|
templatePreview: mode
|
|
134
|
-
}
|
|
135
|
-
|
|
189
|
+
};
|
|
190
|
+
if (typeof entry.value === "string") {
|
|
191
|
+
pushValueSpan(runs, {
|
|
192
|
+
...base,
|
|
193
|
+
text: entry.value
|
|
194
|
+
}, false);
|
|
195
|
+
return runs;
|
|
196
|
+
}
|
|
197
|
+
let pendingCr = false;
|
|
198
|
+
for (const span of entry.value.runs) {
|
|
136
199
|
const valueRun = {
|
|
137
|
-
...
|
|
138
|
-
text: span.text
|
|
139
|
-
pmStart: entry.from,
|
|
140
|
-
pmEnd: entry.to,
|
|
141
|
-
templatePreview: mode
|
|
200
|
+
...base,
|
|
201
|
+
text: span.text
|
|
142
202
|
};
|
|
143
203
|
if (span.bold === true) valueRun.bold = true;
|
|
144
204
|
if (span.italic === true) valueRun.italic = true;
|
|
145
|
-
|
|
146
|
-
}
|
|
205
|
+
pendingCr = pushValueSpan(runs, valueRun, pendingCr);
|
|
206
|
+
}
|
|
207
|
+
return runs;
|
|
147
208
|
}
|
|
148
209
|
const entryKey = (entry) => `${entry.from}:${entry.to}:${templatePreviewValueFingerprint(entry.value)}`;
|
|
210
|
+
const hiddenKey = (range) => `${range.from}:${range.to}:${range.expr}`;
|
|
211
|
+
/** Widen `bounds` over every range whose key is absent from `known`. */
|
|
212
|
+
const growOverUnknown = (ranges, key, known, bounds) => {
|
|
213
|
+
for (const range of ranges) {
|
|
214
|
+
if (known.has(key(range))) continue;
|
|
215
|
+
bounds.from = Math.min(bounds.from, range.from);
|
|
216
|
+
bounds.to = Math.max(bounds.to, range.to);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
149
219
|
/**
|
|
150
|
-
* PM range covering every substitution
|
|
151
|
-
* states (changed, added, or removed
|
|
152
|
-
*
|
|
220
|
+
* PM range covering every substitution and every hidden span that differs
|
|
221
|
+
* between two preview states (changed, added, or removed), or `null` when the
|
|
222
|
+
* flow content both produce is identical. Feeds the layout pipeline's
|
|
153
223
|
* dirty-range invalidation so typing a value re-measures only the blocks
|
|
154
|
-
* hosting the affected markers.
|
|
224
|
+
* hosting the affected markers. A hidden span that appears or disappears also
|
|
225
|
+
* changes the block count, which sends the measure path down its full-remeasure
|
|
226
|
+
* branch regardless of how wide this range is.
|
|
155
227
|
*/
|
|
156
228
|
function templatePreviewDirtyRange(previous, next) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
let to = Number.NEGATIVE_INFINITY;
|
|
161
|
-
for (const entry of previous) if (!nextKeys.has(entryKey(entry))) {
|
|
162
|
-
from = Math.min(from, entry.from);
|
|
163
|
-
to = Math.max(to, entry.to);
|
|
164
|
-
}
|
|
165
|
-
for (const entry of next) if (!previousKeys.has(entryKey(entry))) {
|
|
166
|
-
from = Math.min(from, entry.from);
|
|
167
|
-
to = Math.max(to, entry.to);
|
|
168
|
-
}
|
|
169
|
-
if (from === Number.POSITIVE_INFINITY) return null;
|
|
170
|
-
return {
|
|
171
|
-
from,
|
|
172
|
-
to
|
|
229
|
+
const bounds = {
|
|
230
|
+
from: Number.POSITIVE_INFINITY,
|
|
231
|
+
to: Number.NEGATIVE_INFINITY
|
|
173
232
|
};
|
|
233
|
+
growOverUnknown(previous.entries, entryKey, new Set(next.entries.map(entryKey)), bounds);
|
|
234
|
+
growOverUnknown(next.entries, entryKey, new Set(previous.entries.map(entryKey)), bounds);
|
|
235
|
+
growOverUnknown(previous.hidden, hiddenKey, new Set(next.hidden.map(hiddenKey)), bounds);
|
|
236
|
+
growOverUnknown(next.hidden, hiddenKey, new Set(previous.hidden.map(hiddenKey)), bounds);
|
|
237
|
+
if (bounds.from === Number.POSITIVE_INFINITY) return null;
|
|
238
|
+
return bounds;
|
|
174
239
|
}
|
|
175
240
|
//#endregion
|
|
176
241
|
export { applyTemplatePreviewToBlocks, templatePreviewDirtyRange };
|
|
@@ -1175,6 +1175,15 @@ const runIsZeroWidthBoundaryMarker = (run) => {
|
|
|
1175
1175
|
default: return run;
|
|
1176
1176
|
}
|
|
1177
1177
|
};
|
|
1178
|
+
/** Every page-break run under a node, nested tables and text boxes included. */
|
|
1179
|
+
const countPageBreakRuns = (node) => {
|
|
1180
|
+
let count = node.type.name === "pageBreakRun" ? 1 : 0;
|
|
1181
|
+
node.descendants((descendant) => {
|
|
1182
|
+
if (descendant.type.name === "pageBreakRun") count += 1;
|
|
1183
|
+
return true;
|
|
1184
|
+
});
|
|
1185
|
+
return count;
|
|
1186
|
+
};
|
|
1178
1187
|
/** Decide leading-break eligibility from the exact projected runs consumed by layout. */
|
|
1179
1188
|
const hasSingleLeadingProjectedPageBreak = (runs, pageBreaks) => {
|
|
1180
1189
|
if (pageBreaks.length !== 1) return false;
|
|
@@ -1348,12 +1357,12 @@ function convertTableCell(node, startPos, options, tableCellMargins) {
|
|
|
1348
1357
|
const blocks = [];
|
|
1349
1358
|
let offset = startPos + 1;
|
|
1350
1359
|
const authoredPageBreakPosition = options.firstPageBreakRunPosition(node);
|
|
1351
|
-
const
|
|
1352
|
-
if (authoredPageBreakPosition !== void 0 &&
|
|
1360
|
+
const leadingParagraph = node.firstChild?.type.name === "paragraph" ? node.firstChild : void 0;
|
|
1361
|
+
if (authoredPageBreakPosition !== void 0 && (leadingParagraph === void 0 || countPageBreakRuns(node) !== 1 || options.firstPageBreakRunPosition(leadingParagraph) !== authoredPageBreakPosition)) panic(`An explicit page-break run at ${String(authoredPageBreakPosition)} cannot be projected inside a table cell`);
|
|
1353
1362
|
const pageBreaks = [];
|
|
1354
1363
|
node.forEach((child) => {
|
|
1355
1364
|
if (child.type.name === "paragraph") {
|
|
1356
|
-
const block = convertParagraph(child, offset, options, child ===
|
|
1365
|
+
const block = convertParagraph(child, offset, options, child === leadingParagraph ? pageBreaks : void 0);
|
|
1357
1366
|
blocks.push(block);
|
|
1358
1367
|
} else if (child.type.name === "table") blocks.push(convertTable(child, offset, options));
|
|
1359
1368
|
else if (child.type.name === "textBox") blocks.push(convertTextBoxNode(child, offset, options));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockId, BorderStyle, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting, ListNumPr, MathRun, Measure, MeasuredLine, Page, PageBreakBlock, PageBreakMeasure, PageHeaderFooterRefs, PageMargins, ParagraphAttrs, ParagraphBlock, ParagraphBorders, ParagraphFragment, ParagraphIndent, ParagraphMeasure, ParagraphSpacing, RenderedPageBreakRun, Run, RunFormatting, SdtGroup, SectionBreakBlock, SectionBreakMeasure, SectionPageNumbering, TabAlignment, TabRun, TabStop, TableBlock, TableCell, TableCellMeasure, TableFragment, TableMeasure, TableRow, TableRowMeasure, TextBoxBlock, TextBoxFlowAttrs, TextBoxFragment, TextBoxMeasure, TextRun, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, resolveTableCellPadding, tableColumnsArePinned } from "./types.js";
|
|
1
|
+
import { BlockId, BorderStyle, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting, ListNumPr, MathRun, Measure, MeasuredLine, Page, PageBreakBlock, PageBreakMeasure, PageHeaderFooterRefs, PageMargins, ParagraphAttrs, ParagraphBlock, ParagraphBorders, ParagraphFragment, ParagraphIndent, ParagraphMeasure, ParagraphSpacing, RenderedPageBreakRun, Run, RunFormatting, SdtGroup, SectionBreakBlock, SectionBreakMeasure, SectionPageNumbering, TabAlignment, TabRun, TabStop, TableBlock, TableCell, TableCellMeasure, TableFragment, TableMeasure, TableRow, TableRowMeasure, TextBoxBlock, TextBoxFlowAttrs, TextBoxFragment, TextBoxMeasure, TextRun, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned } from "./types.js";
|
|
2
2
|
import { PageState, Paginator, PaginatorOptions, createPaginator } from "./paginator.js";
|
|
3
3
|
import { KeepNextChain, calculateChainHeight, computeKeepNextChains, getMidChainIndices, hasKeepLines, hasPageBreakBefore } from "./keep-together.js";
|
|
4
4
|
import { resolveSectionHeaderFooterRefs } from "./headerFooterRefs.js";
|
|
@@ -42,4 +42,4 @@ declare function layoutDocument(blocks: FlowBlock[], measures: Measure[], option
|
|
|
42
42
|
*/
|
|
43
43
|
declare function getHeaderRowsHeight(measure: TableMeasure, headerRowCount: number): number;
|
|
44
44
|
//#endregion
|
|
45
|
-
export { BlockId, BorderStyle, type BreakDecision, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, type KeepNextChain, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting, ListNumPr, MathRun, Measure, MeasuredLine, Page, PageBreakBlock, PageBreakMeasure, PageHeaderFooterRefs, PageMargins, type PageState, type Paginator, type PaginatorOptions, ParagraphAttrs, ParagraphBlock, ParagraphBorders, ParagraphFragment, ParagraphIndent, ParagraphMeasure, ParagraphSpacing, RenderedPageBreakRun, Run, RunFormatting, SdtGroup, SectionBreakBlock, SectionBreakMeasure, SectionLayoutConfig, SectionPageNumbering, type SectionState, TabAlignment, TabRun, TabStop, TableBlock, TableCell, TableCellMeasure, TableFragment, TableMeasure, TableRow, TableRowMeasure, TextBoxBlock, TextBoxFlowAttrs, TextBoxFragment, TextBoxMeasure, TextRun, applyContextualSpacing, applyPendingToActive, assertExhaustiveFlowBlock, calculateChainHeight, collectSectionConfigs, computeKeepNextChains, createInitialSectionState, createPaginator, findPageIndexContainingPmPos, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, getHeaderRowsHeight, getMidChainIndices, getTableRowLeadingWidth, hasKeepLines, hasPageBreakBefore, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, layoutDocument, resolveSectionHeaderFooterRefs, resolveTableCellPadding, scheduleSectionBreak, tableColumnsArePinned };
|
|
45
|
+
export { BlockId, BorderStyle, type BreakDecision, CellBorderSpec, CellBorders, ColumnBreakBlock, ColumnBreakMeasure, ColumnLayout, DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, DocumentPosition, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, FieldRun, FloatingTablePosition, FlowBlock, FootnoteContent, Fragment, FragmentBase, HeaderFooterContent, HeaderFooterContentHeights, HeaderFooterLayout, HitTestResult, HyperlinkInfo, ImageBlock, ImageFragment, ImageMeasure, ImageRun, ImageRunPosition, type KeepNextChain, Layout, LayoutOptions, LineBreakRun, ListMarkerFormatting, ListNumPr, MathRun, Measure, MeasuredLine, Page, PageBreakBlock, PageBreakMeasure, PageHeaderFooterRefs, PageMargins, type PageState, type Paginator, type PaginatorOptions, ParagraphAttrs, ParagraphBlock, ParagraphBorders, ParagraphFragment, ParagraphIndent, ParagraphMeasure, ParagraphSpacing, RenderedPageBreakRun, Run, RunFormatting, SdtGroup, SectionBreakBlock, SectionBreakMeasure, SectionLayoutConfig, SectionPageNumbering, type SectionState, TabAlignment, TabRun, TabStop, TableBlock, TableCell, TableCellMeasure, TableFragment, TableMeasure, TableRow, TableRowMeasure, TextBoxBlock, TextBoxFlowAttrs, TextBoxFragment, TextBoxMeasure, TextRun, applyContextualSpacing, applyPendingToActive, assertExhaustiveFlowBlock, calculateChainHeight, collectSectionConfigs, computeKeepNextChains, createInitialSectionState, createPaginator, findPageIndexContainingPmPos, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, getHeaderRowsHeight, getMidChainIndices, getTableRowLeadingWidth, hasKeepLines, hasPageBreakBefore, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, layoutDocument, resolveSectionHeaderFooterRefs, resolveTableCellPadding, resolveTableWidthPx, scheduleSectionBreak, tableColumnsArePinned };
|
|
@@ -14,7 +14,7 @@ import { applyPendingToActive, createInitialSectionState, getEffectiveColumns, g
|
|
|
14
14
|
import { applySectionVerticalAlignment } from "./sectionVerticalAlignment.js";
|
|
15
15
|
import { buildTableRowBreakInfo, getRowContinuationSkip, snapRowBreak } from "./tableRowBreak.js";
|
|
16
16
|
import { bandFragmentX, bandTopContentY, isPageFrameRelativeAnchor } from "./textBoxFlow.js";
|
|
17
|
-
import { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, resolveTableCellPadding, tableColumnsArePinned } from "./types.js";
|
|
17
|
+
import { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, resolveTableCellPadding, resolveTableWidthPx, tableColumnsArePinned } from "./types.js";
|
|
18
18
|
import { panic } from "better-result";
|
|
19
19
|
//#region src/layout-engine/index.ts
|
|
20
20
|
/**
|
|
@@ -1036,4 +1036,4 @@ function handleSectionBreak(_block, paginator, nextSectionConfig, nextSectionTyp
|
|
|
1036
1036
|
paginator.updateColumns(nextSectionConfig.columns ?? DEFAULT_COLUMNS);
|
|
1037
1037
|
}
|
|
1038
1038
|
//#endregion
|
|
1039
|
-
export { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, applyContextualSpacing, applyPendingToActive, assertExhaustiveFlowBlock, calculateChainHeight, collectSectionConfigs, computeKeepNextChains, createInitialSectionState, createPaginator, findPageIndexContainingPmPos, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, getHeaderRowsHeight, getMidChainIndices, getTableRowLeadingWidth, hasKeepLines, hasPageBreakBefore, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, layoutDocument, resolveSectionHeaderFooterRefs, resolveTableCellPadding, scheduleSectionBreak, tableColumnsArePinned };
|
|
1039
|
+
export { DEFAULT_TEXTBOX_MARGINS, DEFAULT_TEXTBOX_WIDTH, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, applyContextualSpacing, applyPendingToActive, assertExhaustiveFlowBlock, calculateChainHeight, collectSectionConfigs, computeKeepNextChains, createInitialSectionState, createPaginator, findPageIndexContainingPmPos, floatingTextBoxReservesBand, floatingTextBoxWrapsText, getEffectiveColumns, getEffectiveMargins, getEffectivePageSize, getHeaderRowsHeight, getMidChainIndices, getTableRowLeadingWidth, hasKeepLines, hasPageBreakBefore, isFloatingImageRun, isFloatingTextBoxBlock, isTextWrappingFloatingImageRun, layoutDocument, resolveSectionHeaderFooterRefs, resolveTableCellPadding, resolveTableWidthPx, scheduleSectionBreak, tableColumnsArePinned };
|