@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.
Files changed (206) hide show
  1. package/dist/ai-edits/headless.js +6 -5
  2. package/dist/ai-edits/index.d.ts +2 -2
  3. package/dist/ai-edits/index.js +2 -2
  4. package/dist/ai-edits/snapshot.js +13 -9
  5. package/dist/compare/content-alignment.js +16 -1
  6. package/dist/compare/inline-atoms.js +1 -1
  7. package/dist/compare/style-resources.js +6 -0
  8. package/dist/compat/eigenpal.d.ts +2 -2
  9. package/dist/controller/layoutPipeline.d.ts +2 -1
  10. package/dist/controller/layoutPipeline.js +5 -2
  11. package/dist/controller/layoutSession.d.ts +2 -1
  12. package/dist/controller/layoutSession.js +1 -0
  13. package/dist/docx/appVersionNormalization.d.ts +0 -18
  14. package/dist/docx/blockContentParser.js +10 -1
  15. package/dist/docx/blockRangeMarkers.d.ts +36 -0
  16. package/dist/docx/blockRangeMarkers.js +59 -0
  17. package/dist/docx/bookmarkParser.d.ts +2 -20
  18. package/dist/docx/bookmarkParser.js +6 -30
  19. package/dist/docx/borderParser.d.ts +13 -0
  20. package/dist/docx/borderParser.js +71 -0
  21. package/dist/docx/builtInStyles.d.ts +165 -0
  22. package/dist/docx/builtInStyles.js +239 -0
  23. package/dist/docx/commentIdNormalization.d.ts +10 -0
  24. package/dist/docx/commentIdNormalization.js +33 -0
  25. package/dist/docx/commentParser.d.ts +2 -1
  26. package/dist/docx/commentParser.js +34 -7
  27. package/dist/docx/commentReferenceNormalization.d.ts +4 -1
  28. package/dist/docx/commentReferenceNormalization.js +23 -14
  29. package/dist/docx/danglingRelationshipReferences.d.ts +15 -0
  30. package/dist/docx/danglingRelationshipReferences.js +30 -0
  31. package/dist/docx/defaultParagraphStyle.d.ts +39 -0
  32. package/dist/docx/defaultParagraphStyle.js +54 -0
  33. package/dist/docx/documentParser.d.ts +2 -1
  34. package/dist/docx/documentParser.js +2 -2
  35. package/dist/docx/drawingUtils.d.ts +8 -1
  36. package/dist/docx/drawingUtils.js +12 -3
  37. package/dist/docx/fieldParser.js +3 -5
  38. package/dist/docx/footnoteParser.d.ts +3 -2
  39. package/dist/docx/footnoteParser.js +19 -2
  40. package/dist/docx/groupDrawingParser.js +1 -1
  41. package/dist/docx/headerFooterRefParser.d.ts +15 -3
  42. package/dist/docx/headerFooterRefParser.js +51 -14
  43. package/dist/docx/headerFooterReferenceNormalization.d.ts +4 -1
  44. package/dist/docx/headerFooterReferenceNormalization.js +5 -1
  45. package/dist/docx/hyperlinkParser.js +11 -15
  46. package/dist/docx/imageParser.d.ts +1 -1
  47. package/dist/docx/imageParser.js +22 -18
  48. package/dist/docx/imageRawXml.js +5 -5
  49. package/dist/docx/markupRangeMarker.d.ts +15 -0
  50. package/dist/docx/markupRangeMarker.js +44 -0
  51. package/dist/docx/noteReferenceStyles.d.ts +29 -0
  52. package/dist/docx/noteReferenceStyles.js +70 -0
  53. package/dist/docx/numberingParser.js +2 -1
  54. package/dist/docx/numberingReference.d.ts +21 -0
  55. package/dist/docx/numberingReference.js +21 -0
  56. package/dist/docx/numberingReferenceNormalization.d.ts +14 -2
  57. package/dist/docx/numberingReferenceNormalization.js +51 -9
  58. package/dist/docx/paraIdRangeNormalization.d.ts +0 -19
  59. package/dist/docx/paragraphParser.js +69 -101
  60. package/dist/docx/paragraphPropertySource.js +1 -0
  61. package/dist/docx/paragraphTraversal.d.ts +37 -1
  62. package/dist/docx/paragraphTraversal.js +84 -1
  63. package/dist/docx/parseContext.d.ts +37 -0
  64. package/dist/docx/parseContext.js +67 -0
  65. package/dist/docx/parseWarningMessage.d.ts +6 -0
  66. package/dist/docx/parseWarningMessage.js +44 -0
  67. package/dist/docx/parser.js +86 -24
  68. package/dist/docx/relsParser.d.ts +28 -11
  69. package/dist/docx/relsParser.js +26 -13
  70. package/dist/docx/revisionIdNormalization.js +81 -7
  71. package/dist/docx/rezip.js +85 -27
  72. package/dist/docx/runConsolidator.js +1 -2
  73. package/dist/docx/runParser.d.ts +8 -1
  74. package/dist/docx/runParser.js +30 -48
  75. package/dist/docx/sectionParser.d.ts +2 -1
  76. package/dist/docx/sectionParser.js +21 -65
  77. package/dist/docx/serializer/borderSerializer.d.ts +1 -2
  78. package/dist/docx/serializer/commentSerializer.js +22 -9
  79. package/dist/docx/serializer/documentSerializer.d.ts +1 -5
  80. package/dist/docx/serializer/documentSerializer.js +6 -16
  81. package/dist/docx/serializer/headerFooterSerializer.js +5 -0
  82. package/dist/docx/serializer/markupRangeAttributes.d.ts +8 -0
  83. package/dist/docx/serializer/markupRangeAttributes.js +24 -0
  84. package/dist/docx/serializer/noteSerializer.js +5 -0
  85. package/dist/docx/serializer/paragraphSerializer.d.ts +1 -5
  86. package/dist/docx/serializer/paragraphSerializer.js +29 -35
  87. package/dist/docx/serializer/runSerializer.js +13 -7
  88. package/dist/docx/serializer/tableSerializer.js +28 -13
  89. package/dist/docx/serializer/textFormattingSerializer.d.ts +2 -3
  90. package/dist/docx/server/build.js +8 -1
  91. package/dist/docx/server/createBilingualDocument.js +15 -22
  92. package/dist/docx/server/extractDocxText.js +3 -4
  93. package/dist/docx/shadingParser.d.ts +6 -0
  94. package/dist/docx/shadingParser.js +32 -0
  95. package/dist/docx/shapeParser.js +3 -3
  96. package/dist/docx/styleParser.js +15 -89
  97. package/dist/docx/styleReferenceResolution.d.ts +36 -0
  98. package/dist/docx/styleReferenceResolution.js +51 -0
  99. package/dist/docx/tableLook.d.ts +57 -0
  100. package/dist/docx/tableLook.js +63 -0
  101. package/dist/docx/tableParser.d.ts +7 -9
  102. package/dist/docx/tableParser.js +64 -110
  103. package/dist/docx/textBoxParser.js +4 -4
  104. package/dist/docx/trackedMoveRangeNormalization.d.ts +3 -1
  105. package/dist/docx/trackedMoveRangeNormalization.js +11 -21
  106. package/dist/docx/transitionalSpelling.d.ts +13 -2
  107. package/dist/docx/transitionalSpelling.js +23 -1
  108. package/dist/docx/verbatimCapture.js +4 -11
  109. package/dist/docx/vmlImageParser.js +2 -2
  110. package/dist/docx/watermarkParser.js +2 -2
  111. package/dist/docx/xmlParser.d.ts +22 -32
  112. package/dist/docx/xmlParser.js +36 -21
  113. package/dist/index.d.ts +2 -2
  114. package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +2 -0
  115. package/dist/internal/pageBreakRunSourceDescendantIndex.js +9 -6
  116. package/dist/internal/paragraphFormattingSerialization.d.ts +2 -3
  117. package/dist/internal/paragraphFormattingSerialization.js +26 -6
  118. package/dist/layout-bridge/convert/footnoteLayout.js +2 -7
  119. package/dist/layout-bridge/convert/templatePreviewFlow.d.ts +19 -11
  120. package/dist/layout-bridge/convert/templatePreviewFlow.js +103 -38
  121. package/dist/layout-bridge/convert/toFlowBlocks.js +12 -3
  122. package/dist/layout-engine/index.d.ts +2 -2
  123. package/dist/layout-engine/index.js +2 -2
  124. package/dist/layout-engine/measure/measureBlocks.js +1 -6
  125. package/dist/layout-engine/types.d.ts +8 -2
  126. package/dist/layout-engine/types.js +35 -2
  127. package/dist/markdown/index.js +1 -1
  128. package/dist/markdown/internals.d.ts +6 -1
  129. package/dist/markdown/internals.js +14 -1
  130. package/dist/markdown/renderBlock.js +35 -21
  131. package/dist/markdown/renderParagraph.js +14 -5
  132. package/dist/markdown/renderRuns.js +4 -3
  133. package/dist/markdown/renderTable.js +4 -3
  134. package/dist/markdown/trailers.js +41 -7
  135. package/dist/markdown/types.d.ts +3 -7
  136. package/dist/prosemirror/attrs/index.js +2 -5
  137. package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +11 -1
  138. package/dist/prosemirror/bookmarkBoundaryAttrs.js +18 -3
  139. package/dist/prosemirror/commands/index.d.ts +3 -3
  140. package/dist/prosemirror/commands/index.js +2 -2
  141. package/dist/prosemirror/commands/pageBreak.js +12 -1
  142. package/dist/prosemirror/commands/paragraph.d.ts +3 -3
  143. package/dist/prosemirror/commands/paragraph.js +2 -2
  144. package/dist/prosemirror/commentIdAllocator.js +2 -7
  145. package/dist/prosemirror/conversion/fromProseDoc.js +131 -41
  146. package/dist/prosemirror/conversion/toProseDoc.d.ts +1 -14
  147. package/dist/prosemirror/conversion/toProseDoc.js +402 -328
  148. package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +14 -1
  149. package/dist/prosemirror/extensions/core/ParagraphExtension.js +11 -6
  150. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -3
  151. package/dist/prosemirror/extensions/features/ListExtension.js +42 -4
  152. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +4 -1
  153. package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +6 -2
  154. package/dist/prosemirror/extensions/features/pastedHeadingStyles.d.ts +7 -0
  155. package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +74 -0
  156. package/dist/prosemirror/extensions/marks/markUtils.d.ts +11 -3
  157. package/dist/prosemirror/extensions/marks/markUtils.js +98 -19
  158. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +7 -3
  159. package/dist/prosemirror/extensions/nodes/ImageExtension.js +2 -1
  160. package/dist/prosemirror/extensions/nodes/ShapeExtension.js +1 -0
  161. package/dist/prosemirror/extensions/nodes/TableExtension.js +15 -1
  162. package/dist/prosemirror/extensions/types.d.ts +2 -2
  163. package/dist/prosemirror/index.d.ts +3 -3
  164. package/dist/prosemirror/index.js +3 -3
  165. package/dist/prosemirror/insertOperations.d.ts +9 -2
  166. package/dist/prosemirror/insertOperations.js +9 -4
  167. package/dist/prosemirror/listMarker.js +2 -1
  168. package/dist/prosemirror/numberedRefFields.js +2 -1
  169. package/dist/prosemirror/pageBreakRunProjection.d.ts +11 -3
  170. package/dist/prosemirror/pageBreakRunProjection.js +16 -8
  171. package/dist/prosemirror/paragraphFormattingProvenance.d.ts +159 -0
  172. package/dist/prosemirror/paragraphFormattingProvenance.js +106 -0
  173. package/dist/prosemirror/plugins/documentStyles.d.ts +9 -1
  174. package/dist/prosemirror/plugins/documentStyles.js +11 -1
  175. package/dist/prosemirror/plugins/index.d.ts +2 -2
  176. package/dist/prosemirror/plugins/index.js +2 -2
  177. package/dist/prosemirror/plugins/revisionIds.d.ts +11 -2
  178. package/dist/prosemirror/plugins/revisionIds.js +21 -6
  179. package/dist/prosemirror/plugins/templatePreviewValues.d.ts +42 -1
  180. package/dist/prosemirror/plugins/templatePreviewValues.js +217 -14
  181. package/dist/prosemirror/runFormattingReconciliation.js +3 -2
  182. package/dist/prosemirror/runStyleFormatting.d.ts +1 -1
  183. package/dist/prosemirror/schema/nodes.d.ts +31 -0
  184. package/dist/prosemirror/styles/resolvedStyleAttrs.js +4 -1
  185. package/dist/prosemirror/styles/styleResolver.d.ts +9 -0
  186. package/dist/prosemirror/styles/styleResolver.js +15 -6
  187. package/dist/prosemirror/utils/visualLineNavigation.d.ts +22 -2
  188. package/dist/prosemirror/utils/visualLineNavigation.js +80 -63
  189. package/dist/style-engine/styleEngine.d.ts +4 -1
  190. package/dist/style-engine/styleEngine.js +3 -0
  191. package/dist/style-sets/extract.js +35 -11
  192. package/dist/style-sets/stellaStyle.js +46 -39
  193. package/dist/style-sets/styleSetNormalization.d.ts +19 -0
  194. package/dist/style-sets/styleSetNormalization.js +99 -0
  195. package/dist/types/content.d.ts +2 -2
  196. package/dist/utils/createDocument.js +145 -20
  197. package/dist/utils/headingCollector.d.ts +8 -5
  198. package/dist/utils/headingCollector.js +23 -25
  199. package/dist/utils/tableOfContentsStyle.js +9 -2
  200. package/package.json +3 -2
  201. package/dist/docx/textWhitespace.d.ts +0 -4
  202. package/dist/docx/textWhitespace.js +0 -4
  203. package/dist/layout-bridge/engine/tableWidthUtils.d.ts +0 -6
  204. package/dist/layout-bridge/engine/tableWidthUtils.js +0 -25
  205. package/dist/markdown/headings.d.ts +0 -13
  206. package/dist/markdown/headings.js +0 -20
@@ -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
- * Check if an element has a specific attribute with value "true" or "1"
485
+ * Read an `ST_OnOff` attribute.
485
486
  *
486
- * @param element - Element to check
487
- * @param namespace - Attribute namespace
488
- * @param name - Attribute name
489
- * @returns true if attribute exists and is truthy
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 hasFlag(element, namespace, name) {
492
- const value = getAttribute(element, namespace, name);
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. For `w:type="pct"`, producers
558
- * sometimes emit human-readable percentages (`100%`) instead of 50ths-of-percent
559
- * (`5000`); normalize those to the ECMA-376 unit the layout engine expects.
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" && trimmed.endsWith("%")) {
566
- const pct = Number.parseFloat(trimmed.slice(0, -1));
567
- if (!Number.isNaN(pct)) return Math.round(pct * 50);
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: return;
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) ?? true;
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, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffValue, parseTableMeasurementValue, parseXml, parseXmlDocument, selectAlternateContentBranch };
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": return inspectMany(content.content, inspectParagraphContent);
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
- const flags = flagsByObject.get(content);
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
- const serializeNumbering = (numPr) => {
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.ilvl !== void 0) parts.push(`<w:ilvl w:val="${intAttr(modeled.ilvl)}"/>`);
82
- if (modeled.numId !== void 0) parts.push(`<w:numId w:val="${intAttr(modeled.numId)}"/>`);
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) ? "" : serializeNumbering(numPr),
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 = resolveFootnoteTableWidth(tableBlock.width, tableBlock.widthType, contentWidth);
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
- type TemplatePreviewFlowOptions = {
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). Returns the input
21
- * array unchanged when there is nothing to substitute.
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 that differs between two preview
26
- * states (changed, added, or removed entries), or `null` when the
27
- * substituted flow content is identical. Feeds the layout pipeline's
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: readonly TemplatePreviewFlowEntry[], next: readonly TemplatePreviewFlowEntry[]): {
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). Returns the input
6
- * array unchanged when there is nothing to substitute.
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). Every run keeps the marker's full PM range so
125
- * click-to-position keeps resolving into the marker.
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
- if (typeof entry.value === "string") return [{
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
- return entry.value.runs.map((span) => {
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
- ...host,
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
- return valueRun;
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 that differs between two preview
151
- * states (changed, added, or removed entries), or `null` when the
152
- * substituted flow content is identical. Feeds the layout pipeline's
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 previousKeys = new Set(previous.map(entryKey));
158
- const nextKeys = new Set(next.map(entryKey));
159
- let from = Number.POSITIVE_INFINITY;
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 singleParagraph = node.childCount === 1 && node.firstChild?.type.name === "paragraph" ? node.firstChild : void 0;
1352
- if (authoredPageBreakPosition !== void 0 && singleParagraph === void 0) panic(`An explicit page-break run at ${String(authoredPageBreakPosition)} cannot be projected inside a table cell`);
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 === singleParagraph ? pageBreaks : void 0);
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 };