@docx-editor.dev/core 2.14.1 → 2.15.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/README.md +42 -0
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +6 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +16 -10
- package/dist/binding.js +1 -1
- package/dist/chunk-24APKZAN.cjs +11 -0
- package/dist/chunk-2YH4MSHX.cjs +2 -0
- package/dist/chunk-5Y7AADI6.js +1 -0
- package/dist/chunk-AREFLNUP.js +11 -0
- package/dist/chunk-AS7YZNQE.cjs +2 -0
- package/dist/chunk-AVGCKH6A.cjs +20 -0
- package/dist/chunk-CDYVDQRI.cjs +5 -0
- package/dist/chunk-FGBADUSK.cjs +1 -0
- package/dist/chunk-HOEWFH5U.cjs +1 -0
- package/dist/chunk-KFELX7CN.js +2 -0
- package/dist/{chunk-OKEDGR65.js → chunk-KXPVOPR5.js} +1 -1
- package/dist/chunk-LGFKIF4M.cjs +1 -0
- package/dist/chunk-M52QXFKI.js +1 -0
- package/dist/chunk-MNUKSXRO.js +1 -0
- package/dist/chunk-PBOIGBDO.js +2 -0
- package/dist/chunk-PMHGONET.cjs +1 -0
- package/dist/chunk-PXKZUTHX.cjs +2 -0
- package/dist/chunk-Q4AB7E4O.cjs +1 -0
- package/dist/chunk-QJYH6AYD.js +1 -0
- package/dist/chunk-QRC37MWG.cjs +20 -0
- package/dist/chunk-RJSB6RJ7.js +20 -0
- package/dist/chunk-SB54HLFJ.js +20 -0
- package/dist/chunk-VP7SDFCM.js +1 -0
- package/dist/chunk-XCESLTJL.js +2 -0
- package/dist/{chunk-KIAP7PFQ.cjs → chunk-YL4Q5LZP.cjs} +1 -1
- package/dist/chunk-Z4527AXR.js +5 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +4 -3
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.ts +7 -7
- package/dist/contracts/modules.d.ts +8 -7
- package/dist/{custom-node-writes-DntmaAVW.d.ts → custom-node-writes-C9ArIlJh.d.ts} +2 -2
- package/dist/{editor-a6VvsfYU.d.ts → editor-sRxrFJd8.d.ts} +29 -21
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.ts +27 -58
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -0
- package/dist/export.d.ts +337 -0
- package/dist/export.js +2 -0
- package/dist/font-resolver-BYEHQGTw.d.ts +251 -0
- package/dist/headless-document-view-DELC4E5v.d.ts +134 -0
- package/dist/hf-references-DTrHkktY.d.ts +70 -0
- package/dist/{index-C5ZnSRkF.d.ts → index-C3Gvq4jN.d.ts} +55 -246
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -16
- package/dist/index.js +1 -1
- package/dist/{shaped-measurer-CFPnXFs9.d.cts → layout-shaping-DoGR5cf8.d.ts} +86 -12
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1106 -729
- package/dist/layout.js +1 -1
- package/dist/{note-properties-CDFiNXcD.d.ts → note-properties-DSe8igrz.d.ts} +2 -2
- package/dist/{omml-equation-BY49UOIF.d.ts → omml-equation-BpRmfDAf.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-gOY5GA8K.d.cts → protocol-DZzKxH5r.d.ts} +18 -12
- package/dist/{review-items-CCS1h93f.d.ts → review-items-DYRx187i.d.ts} +2 -2
- package/dist/{review-reads-BjZYeMd4.d.ts → review-reads-LbGUdNzn.d.ts} +22 -25
- package/dist/{revision-projection-BeXVrSSV.d.ts → revision-projection-DHRJH48u.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BK91NCCG.d.ts → semantic-cell-selection-BXVWCBYm.d.ts} +4 -4
- package/dist/{semantic-interaction-BmQ7h2cq.d.ts → semantic-interaction-DZsDmPg5.d.ts} +1 -1
- package/dist/{semantic-paint-WJD2KeG1.d.ts → semantic-paint-f7SqN4oW.d.ts} +2 -2
- package/dist/{semantic-records-BpozY7-j.d.cts → semantic-records-EIdwId-a.d.ts} +301 -205
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +15 -65
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-D6HzlPR4.d.ts → tree-op-types-egdarvH_.d.ts} +7 -3
- package/dist/{tree-package-fragment-CWFjgH6a.d.ts → tree-package-fragment-DjkH4ESI.d.ts} +4 -70
- package/dist/{tree-session-contract-B2HfGt79.d.ts → tree-session-contract-CGOOgPjW.d.ts} +29 -23
- package/dist/{tree-store-APgWx6qn.d.ts → tree-store-DKJB0IcA.d.ts} +2 -2
- package/package.json +7 -2
- package/dist/automation.d.cts +0 -82
- package/dist/binding.d.cts +0 -153
- package/dist/chunk-2PIHW2QM.cjs +0 -1
- package/dist/chunk-2QTY5S6T.js +0 -1
- package/dist/chunk-4Z5MODAE.cjs +0 -2
- package/dist/chunk-5TKAPFZT.cjs +0 -2
- package/dist/chunk-DRQHIQ4R.cjs +0 -1
- package/dist/chunk-F2K6SDHA.cjs +0 -20
- package/dist/chunk-FBA57EUJ.js +0 -2
- package/dist/chunk-KTAQ7BRQ.js +0 -20
- package/dist/chunk-LBAHXZCU.cjs +0 -5
- package/dist/chunk-MCDUQYWP.js +0 -5
- package/dist/chunk-MQP26KCF.js +0 -1
- package/dist/chunk-NDJGSR6M.cjs +0 -19
- package/dist/chunk-NJNFJPGB.cjs +0 -11
- package/dist/chunk-O5M4CR4P.cjs +0 -2
- package/dist/chunk-UKUOZXUD.js +0 -19
- package/dist/chunk-VQ4R5LTU.js +0 -2
- package/dist/chunk-ZBEJHJN2.js +0 -11
- package/dist/chunk-ZVTW7RGD.js +0 -2
- package/dist/collaboration/replication.d.cts +0 -216
- package/dist/collaboration.d.cts +0 -176
- package/dist/contracts/document.d.cts +0 -273
- package/dist/contracts/editor.d.cts +0 -10
- package/dist/contracts/interaction.d.cts +0 -10
- package/dist/contracts/modules.d.cts +0 -130
- package/dist/contracts/types.d.cts +0 -562
- package/dist/custom-node-writes-C46r3_5O.d.cts +0 -310
- package/dist/document-properties-D6Ahr8D6.d.cts +0 -28
- package/dist/document-properties-D6Ahr8D6.d.ts +0 -28
- package/dist/editor-AJ06hyyg.d.cts +0 -1994
- package/dist/editor.d.cts +0 -393
- package/dist/failure-BnGjoXf0.d.cts +0 -64
- package/dist/index-Cbw4lkOt.d.cts +0 -3391
- package/dist/index.d.cts +0 -23
- package/dist/layout.d.cts +0 -2486
- package/dist/note-properties-Y6qYh2Hv.d.cts +0 -67
- package/dist/omml-equation-DB8d-jCq.d.cts +0 -84
- package/dist/output.d.cts +0 -74
- package/dist/protocol-BsmQgblT.d.ts +0 -1358
- package/dist/review-items-CaAkgi5s.d.cts +0 -360
- package/dist/review-reads-DEsV0OOW.d.cts +0 -163
- package/dist/revision-projection-DXbrfNGD.d.cts +0 -156
- package/dist/semantic-cell-selection-BMhku3B1.d.cts +0 -451
- package/dist/semantic-interaction-DUAnxbgf.d.cts +0 -160
- package/dist/semantic-paint-DufNL1Zr.d.cts +0 -247
- package/dist/semantic-records-92UnKeU_.d.ts +0 -2821
- package/dist/shaped-measurer-BWbindlI.d.ts +0 -168
- package/dist/store.d.cts +0 -2500
- package/dist/tree-op-types-BUulYD5y.d.cts +0 -3099
- package/dist/tree-package-fragment-Dhyw7oPm.d.cts +0 -732
- package/dist/tree-session-contract-BY9xd7s_.d.cts +0 -613
- package/dist/tree-store-DEEQ9wz_.d.cts +0 -416
package/dist/layout.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { C as CacheLookup,
|
|
4
|
-
import { a as OoxmlNode,
|
|
5
|
-
export {
|
|
6
|
-
import {
|
|
7
|
-
import { R as
|
|
8
|
-
|
|
9
|
-
import { b as
|
|
10
|
-
|
|
11
|
-
import { a as SectionColumns } from './semantic-cell-selection-
|
|
12
|
-
export { C as CellSelection, D as DEFAULT_SECTION_PROPERTIES, b as DEFAULT_VERTICAL_WEIGHT, c as DocumentSection, d as DocumentSectionsEnumeration, e as DrawingOverlayFrame, H as HitPoint, f as HitTestOptions, M as MAX_DOCUMENT_SECTIONS, P as PlacedCell, g as SectionBreakType, h as SectionColumnDefinition, i as SectionMargins, j as SectionPageNumbering, S as SectionProperties, k as SemanticHit, l as SemanticHitDrawing, T as TableCellAddress, m as TableCellContext, n as caretBoxOnLine, o as cellSelectionBetween, p as cellSelectionRects, q as cellSelectionText, r as contentControlAtPoint, s as enumerateDocumentSections, t as enumerateDocumentSectionsBounded, u as findDrawingOverlayFrameInLayout, v as geometryOfSection, w as hitTestPage, x as hitTestSheet, y as isFurniturePoint, z as lineEndOffset, A as pageAtY, B as paragraphSectionNode, E as paragraphsInCells, F as parsePageNumbering, G as parseSectionProperties, I as projectedSectionSourceIndexes, J as readSectionProperties, K as spanOffsetX, L as spansInCells, N as tableContextAt } from './semantic-cell-selection-
|
|
13
|
-
export { M as MAX_SDT_NESTING, c as collectFlowBlocks,
|
|
14
|
-
import { a as ReviewItem } from './review-items-
|
|
15
|
-
export { i as CommentAnchor, j as CommentPosition, C as CommentRecord, h as CommentThreadState, c as ReviewCommentItem, d as ReviewCustomItem, R as ReviewModelInput, e as ReviewPosition, f as ReviewRange, b as ReviewRevisionItem, g as ReviewRevisionKind, W as W15_NAMESPACE_URI,
|
|
16
|
-
import { S as SemanticPosition, b as SelectionRect, a as SemanticSelection } from './semantic-interaction-
|
|
17
|
-
export { c as CaretAtOptions, C as CaretGeometry, M as MoveCaretOptions, N as NavigationCommand, d as caretAt, e as caretStops, f as caretStopsForBlocks, g as compositionAnchor, h as contentControlAtSemantic, i as contentControlsInLayout, j as deletedTextBoundaries, k as hitTestSemantic, m as moveCaret, p as paragraphTextFromLayout, s as spansInSelection } from './semantic-interaction-
|
|
18
|
-
import './omml-equation-
|
|
1
|
+
import { l as NumberingLevel, m as NumberingIndex, n as LayoutBox, D as DrawingPoint, o as DrawingInsets, a as StyleSpanRecord, I as InlineDrawingRecord, M as ModelRange, S as SemanticLayout, p as TableBorderSide, q as CellBorderBox, r as TableCellStyleFormatting, s as TableBorderBox, t as StyleCascadeTable, B as BlockFragmentRecord, A as AnchoredDrawingRecord, u as PageRecord, v as ParagraphFragmentRecord, L as LineRecord, w as NoteAreaRecord, H as HeaderFooterStoryRecord, x as NoteStoryRecord, C as ContentControlBoundaryRecord$1, y as ContentControlLock, T as TextMeasurer, V as VersionedShapingLibrary, e as TextShaper, z as FontByteValidator, g as FixedPointRoundingMode, E as FixedPoint, k as ShapedRun, G as SourceRange, J as HyperlinkProjector, K as InlineDrawingLayoutContext, O as FieldLinkProjector, Q as StoryPageFieldNeeds, U as RefFieldContext, W as HyperlinkFieldSpec, X as SpanLinkRecord, P as PageGeometry, Y as ResolvedListItem } from './semantic-records-EIdwId-a.js';
|
|
2
|
+
export { Z as AUTO_PARAGRAPH_SPACING_PT, _ as AbstractNumDefinition, $ as AnchoredDrawingLayoutFallback, a0 as BidiEmbeddingLevels, a1 as BorderGridGeometry, a2 as CascadedParagraphFormatting, a3 as ContentControlGeometryFragment, a4 as ContentControlLevel, a5 as ContentControlMappedType, a6 as DEFAULT_PAGE_GEOMETRY, a7 as DEFAULT_RUN_STYLE, a8 as DEFAULT_TAB_INTERVAL_PT, a9 as DEFAULT_TAB_INTERVAL_TWIPS, aa as DeclaredFontSubstitution, ab as DrawingClipFallback, ac as DrawingGeometry, ad as EMPTY_NUMBERING_INDEX, ae as EMPTY_TAB_STOPS, af as EquationFractionGeometry, ag as EquationGeometry, ah as EquationNaryGeometry, ai as EquationRadicalGeometry, aj as EquationRowGeometry, ak as EquationScriptGeometry, al as EquationSpanRecord, am as EquationTextGeometry, an as FieldAtomMarker, ao as FontFingerprintInputs, h as FontRequest, ap as FontResolutionError, aq as FontResolutionErrorCode, ar as FontResourceDefinition, as as FontResourceInstrumentation, F as FontResourceSnapshot, at as FontResourceSnapshotOptions, au as FontSlot, j as FontSubstitution, av as FontValidationResult, aw as GlyphOutline, ax as HARD_MAX_AGGREGATE_FONT_BYTES, ay as HARD_MAX_FONT_BYTES, az as HARD_MAX_FONT_SOURCES, aA as LevelOverride, aB as LineSpacingRule, aC as ListMarkerAlign, aD as ListMarkerRecord, aE as ListSuffix, aF as MAX_BORDER_SPACE_PT, aG as MAX_BORDER_WIDTH_PT, aH as MAX_LVL_OVERRIDES, aI as MAX_NUMBERING_DEFINITIONS, aJ as MAX_PARAGRAPH_SPACING_PT, aK as MAX_STYLE_BASED_ON_DEPTH, aL as MAX_STYLE_DEFINITIONS, aM as MAX_TABLE_BORDER_STROKES, aN as MAX_TAB_POSITION_TWIPS, aO as MAX_TAB_STOPS, N as NormalizationPolicy, aP as NumDefinition, aQ as NumberingLevelIndent, aR as PARAGRAPH_BORDER_SIDES, aS as PageRefCalibrationCell, aT as PageRefFieldProjection, aU as ParagraphAutoSpacingContext, aV as ParagraphBorderEdge, aW as ParagraphBorderSide, aX as ParagraphBorderStrokeRecord, aY as ParagraphBorders, aZ as ParagraphBottomBorderRecord, a_ as ParagraphIndent, a$ as ParagraphLayoutInputs, b0 as ParagraphLineSpacing, b1 as ParagraphSpacing, b2 as RefFieldSpec, b3 as RefNoteParts, b4 as ResolvedCellBorders, f as ResolvedFont, R as ResolvedRunStyle, b5 as ResolvedTabStops, b6 as ResolvedTableBorderEdge, b7 as ResolvedTableBorderEdgeSegment, b8 as ResolvedUnderline, b9 as SINGLE_LINE_SPACING, ba as ScriptItem, bb as SemanticArtifactRootStoryKind, bc as SemanticArtifactStoryKind, bd as SemanticCommentArtifactRecord, be as SemanticReviewArtifactOccurrence, bf as SemanticReviewArtifactOccurrenceGeometry, bg as SemanticReviewArtifactPosition, i as SemanticReviewArtifactRecord, bh as SemanticReviewArtifactSource, bi as SemanticTrackedChangeArtifactRecord, bj as ShapeInput, bk as ShapedCluster, bl as ShapedFontSpan, bm as ShapedGlyph, bn as ShapedRunComparatorInputs, bo as ShapedVerticalMetrics, bp as ShapingEnvironment, bq as ShapingEnvironmentFingerprintInputs, d as ShapingEnvironmentInput, br as StyleDefinition, bs as TAB_LEADER_GLYPH, bt as TabAlignment, bu as TabDestination, bv as TabLeader, bw as TabStop, bx as TableBorderSideName, by as TableBorderStrokeRecord, c as TableCellFragmentRecord, bz as TableFragmentRecord, b as TableRowFragmentRecord, bA as TextDirection, bB as TextboxStoryFallbackReason, bC as TextboxStoryLayout, bD as UnsupportedScriptError, bE as VerticalAlign, bF as appliedSpaceBefore, bG as applyLineSpacing, bH as baselineShiftPtOf, bI as borderExtentPt, bJ as borderWeight, bK as bottomBorderExtentPt, bL as boundedStructuralFontValidator, bM as buildNumberingIndex, bN as buildStyleCascadeTable, bO as cascadeParagraphFormatting, bP as cascadeRunProperties, bQ as cascadedBottomBorder, bR as cascadedParagraphBorders, bS as cascadedTabStops, bT as collapsedSpaceBefore, bU as createFontResourceSnapshot, bV as createShapedRun, bW as createShapingEnvironment, bX as defaultTabIntervalFromSettings, bY as displayText, bZ as fixedPoint, b_ as fontRequestKey, b$ as isValidStyleId, c0 as itemizeScriptFontSlots, c1 as layoutEquation, c2 as listMarkerBox, c3 as measureDisplayText, c4 as mergeListIndent, c5 as nextTabDestination, c6 as paragraphBorderExtentPt, c7 as paragraphBorderStrokeWidthPt, c8 as paragraphBorders, c9 as paragraphBordersFingerprint, ca as paragraphBreaksBefore, cb as paragraphContextualSpacing, cc as paragraphLineSpacing, cd as paragraphSpacing, ce as paragraphTabStops, cf as parseRefInstruction, cg as readBorderSide, ch as readCellBorders, ci as readNumPr, cj as readTableBorders, ck as resolveBorderConflict, cl as resolveNumberingLevel, cm as resolveParagraphLayoutInputs, cn as resolveRunStyle, co as resolveStoryListItems, cp as resolveStoryRefFields, cq as resolveTableCellBorderGrid, cr as runStylesEqual, cs as shapedRunComparatorInputs, ct as shapingEnvironmentFingerprint, cu as shapingEnvironmentFingerprintInputs, cv as styleForFontSlot, cw as tabAdvanceWidth, cx as tabStopsFingerprint, cy as walkStoryParagraphs, cz as withDefaultTabInterval, cA as withNumberingStyleLinks, cB as withResolvedListItems } from './semantic-records-EIdwId-a.js';
|
|
3
|
+
export { C as CacheLookup, b as CacheMiss, c as CacheProvenance, e as LayoutEnvironmentShapedMeasurerOptions, f as LayoutFontConfiguration, g as LayoutFontSource, h as LayoutFontSubstitution, i as LayoutShapingConfigurationError, j as LayoutShapingEnvironment, L as LayoutShapingInstrumentation, a as LayoutShapingOptions, O as OperationSnapshot, k as OperationSnapshotField, l as OperationSnapshotGuard, P as PreparedLayoutFontConfiguration, R as ResolvedCache, m as ResourceDependencyProvenance, S as ShapedMeasurerOptions, n as captureOperationSnapshot, o as createLayoutShapedMeasurer, p as createLayoutShaping, q as createShapedMeasurer, d as disposeLayoutShaping, r as guardOperationSnapshot, s as layoutFontConfigurationFingerprint, t as prepareLayoutFontConfiguration } from './layout-shaping-DoGR5cf8.js';
|
|
4
|
+
import { a as OoxmlNode, q as OoxmlProperty, I as ImpactClass, c as OoxmlElement, O as OoxmlPart, T as TreeDocOp, b as OoxmlPackage, ai as ContentControlKind, aj as ContentControlLevel, al as ContentControlLock$1, af as ContentControlDataBinding } from './tree-op-types-egdarvH_.js';
|
|
5
|
+
export { W as DrawingAccessibility, z as DrawingHorizontalReferenceFrame, X as DrawingTransform, A as DrawingVerticalReferenceFrame, u as ImageWrapTarget, S as SourceCrop, U as TableBorderStyle, cD as VectorShapeComponent, Y as VectorShapeProjection } from './tree-op-types-egdarvH_.js';
|
|
6
|
+
import { H as HeadlessDocumentView, D as DocumentProperties, r as relationshipTargetIn } from './headless-document-view-DELC4E5v.js';
|
|
7
|
+
import { b as RevisionAttribution, R as RevisionDisplayMode, a as RevisionAuthorFilter } from './revision-projection-DHRJH48u.js';
|
|
8
|
+
export { D as DEFAULT_REVISION_DISPLAY_MODE, c as RevisionFilter, d as RevisionKind, f as formatRevisionOf, m as markRevisionRemovesMark, p as paragraphMarkFormatRevisionOf, e as paragraphMarkRevisionOf, g as paragraphMarkRevisionsOf, r as revisionAuthorFilter, h as revisionsAreDeletion, i as revisionsVisible, s as shownMarkRevision } from './revision-projection-DHRJH48u.js';
|
|
9
|
+
import { b as ResolvedFootnoteProperties, R as ResolvedEndnoteProperties } from './note-properties-DSe8igrz.js';
|
|
10
|
+
import { N as NoteKind, T as TreeModelChange, H as noteTypeOf } from './tree-store-DKJB0IcA.js';
|
|
11
|
+
import { a as SectionColumns } from './semantic-cell-selection-BXVWCBYm.js';
|
|
12
|
+
export { C as CellSelection, D as DEFAULT_SECTION_PROPERTIES, b as DEFAULT_VERTICAL_WEIGHT, c as DocumentSection, d as DocumentSectionsEnumeration, e as DrawingOverlayFrame, H as HitPoint, f as HitTestOptions, M as MAX_DOCUMENT_SECTIONS, P as PlacedCell, g as SectionBreakType, h as SectionColumnDefinition, i as SectionMargins, j as SectionPageNumbering, S as SectionProperties, k as SemanticHit, l as SemanticHitDrawing, T as TableCellAddress, m as TableCellContext, n as caretBoxOnLine, o as cellSelectionBetween, p as cellSelectionRects, q as cellSelectionText, r as contentControlAtPoint, s as enumerateDocumentSections, t as enumerateDocumentSectionsBounded, u as findDrawingOverlayFrameInLayout, v as geometryOfSection, w as hitTestPage, x as hitTestSheet, y as isFurniturePoint, z as lineEndOffset, A as pageAtY, B as paragraphSectionNode, E as paragraphsInCells, F as parsePageNumbering, G as parseSectionProperties, I as projectedSectionSourceIndexes, J as readSectionProperties, K as spanOffsetX, L as spansInCells, N as tableContextAt } from './semantic-cell-selection-BXVWCBYm.js';
|
|
13
|
+
export { M as MAX_SDT_NESTING, c as collectFlowBlocks, b as commentBodyText, d as commentInitials, m as contentControlContentChildren, i as isContentControl, h as isContentControlContent, p as paragraphOrderOfPart } from './review-reads-LbGUdNzn.js';
|
|
14
|
+
import { a as ReviewItem } from './review-items-DYRx187i.js';
|
|
15
|
+
export { i as CommentAnchor, j as CommentPosition, C as CommentRecord, h as CommentThreadState, c as ReviewCommentItem, d as ReviewCustomItem, R as ReviewModelInput, e as ReviewPosition, f as ReviewRange, b as ReviewRevisionItem, g as ReviewRevisionKind, W as W15_NAMESPACE_URI, p as activeReviewItem, m as firstReviewRange, r as reviewItemKey, q as reviewItemPositionRank, o as reviewItemRanges, s as reviewItemsAt, u as reviewThreadRootOf } from './review-items-DYRx187i.js';
|
|
16
|
+
import { S as SemanticPosition, b as SelectionRect, a as SemanticSelection } from './semantic-interaction-DZsDmPg5.js';
|
|
17
|
+
export { c as CaretAtOptions, C as CaretGeometry, M as MoveCaretOptions, N as NavigationCommand, d as caretAt, e as caretStops, f as caretStopsForBlocks, g as compositionAnchor, h as contentControlAtSemantic, i as contentControlsInLayout, j as deletedTextBoundaries, k as hitTestSemantic, m as moveCaret, p as paragraphTextFromLayout, s as spansInSelection } from './semantic-interaction-DZsDmPg5.js';
|
|
18
|
+
import './omml-equation-BpRmfDAf.js';
|
|
19
19
|
import './contracts/types.js';
|
|
20
|
+
import './hf-references-DTrHkktY.js';
|
|
20
21
|
|
|
21
22
|
/** Synchronous platform-neutral SHA-256 used before font bytes cross into a shaping implementation. */
|
|
22
23
|
declare const sha256FontBytes: (bytes: Uint8Array) => string;
|
|
@@ -160,8 +161,24 @@ interface LayoutCacheStats {
|
|
|
160
161
|
* touched are never measured again.
|
|
161
162
|
*/
|
|
162
163
|
interface ParagraphLayoutCache<T> {
|
|
164
|
+
/**
|
|
165
|
+
* Whether values released after placement remain available to later layout passes.
|
|
166
|
+
*
|
|
167
|
+
* One-shot exporters set this false so producers may avoid defensive snapshots whose
|
|
168
|
+
* only purpose is protecting a value reused by a future pass.
|
|
169
|
+
*/
|
|
170
|
+
readonly retainAcrossPasses?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Derive a break key inside this cache's ownership scope.
|
|
173
|
+
*
|
|
174
|
+
* Export caches use this hook to release construction-only subtree fingerprints together
|
|
175
|
+
* with measured breaks. Optional so structural/custom cache implementations remain valid.
|
|
176
|
+
*/
|
|
177
|
+
keyFor?(inputs: ParagraphKeyInputs): ParagraphLayoutKey;
|
|
163
178
|
get(key: ParagraphLayoutKey): T | undefined;
|
|
164
179
|
set(key: ParagraphLayoutKey, value: T): void;
|
|
180
|
+
/** Release a break after final placement when this cache was created for a one-shot pass. */
|
|
181
|
+
release?(key: ParagraphLayoutKey): void;
|
|
165
182
|
/** Drop entries for paragraphs a commit removed, so the cache cannot grow without bound. */
|
|
166
183
|
retain(keys: ReadonlySet<ParagraphLayoutKey>): void;
|
|
167
184
|
/**
|
|
@@ -202,6 +219,8 @@ interface ParagraphKeyInputs {
|
|
|
202
219
|
* when paragraph text is unchanged.
|
|
203
220
|
*/
|
|
204
221
|
readonly drawingToken?: string;
|
|
222
|
+
/** Paragraph-local semantic projection identity (links and live metadata fields). */
|
|
223
|
+
readonly projectionToken?: string;
|
|
205
224
|
/** Active page exclusion zones affecting this paragraph's break. */
|
|
206
225
|
readonly exclusionToken?: string;
|
|
207
226
|
}
|
|
@@ -221,6 +240,8 @@ interface ParagraphLayoutCacheOptions {
|
|
|
221
240
|
* next one needs and the cache costs more than it saves.
|
|
222
241
|
*/
|
|
223
242
|
readonly maxEntries?: number;
|
|
243
|
+
/** Keep placed breaks for later revisions. Default true; false bounds one-shot exporters. */
|
|
244
|
+
readonly retainAcrossPasses?: boolean;
|
|
224
245
|
}
|
|
225
246
|
/**
|
|
226
247
|
* A bounded least-recently-used cache with generation-scoped retention.
|
|
@@ -397,197 +418,6 @@ interface LayoutScheduler {
|
|
|
397
418
|
*/
|
|
398
419
|
declare function createLayoutScheduler(options: LayoutSchedulerOptions): LayoutScheduler;
|
|
399
420
|
|
|
400
|
-
/** The flow state as it stood immediately before one block was placed. */
|
|
401
|
-
interface FlowCheckpoint {
|
|
402
|
-
/** Completed pages at this point. The prefix of the previous layout that still stands. */
|
|
403
|
-
readonly pageCount: number;
|
|
404
|
-
/** Fragments already on the page being built. */
|
|
405
|
-
readonly pageFragments: readonly BlockFragmentRecord[];
|
|
406
|
-
/** Anchored drawings already collected for the open page. */
|
|
407
|
-
readonly pendingAnchoredDrawings: readonly AnchoredDrawingRecord[];
|
|
408
|
-
/**
|
|
409
|
-
* Anchored drawings overlap resolution pushed onto the NEXT page, and how many times each
|
|
410
|
-
* drawing has been pushed.
|
|
411
|
-
*
|
|
412
|
-
* Flow state like the rest of this record, and carried for the same reason: a resume that
|
|
413
|
-
* started with an empty list dropped a drawing that the previous pass had deferred but not
|
|
414
|
-
* yet placed, and a convergence that did not compare them accepted a flow that still owed
|
|
415
|
-
* the next page a drawing as equal to one that owed it nothing.
|
|
416
|
-
*/
|
|
417
|
-
readonly deferredAnchoredDrawings: readonly AnchoredDrawingRecord[];
|
|
418
|
-
readonly anchorPageDeferCounts: ReadonlyMap<string, number>;
|
|
419
|
-
readonly cursorY: number;
|
|
420
|
-
readonly lineCounter: number;
|
|
421
|
-
/** Trailing paragraph spacing participating in adjacent-spacing collapse. */
|
|
422
|
-
readonly previousSpaceAfter: number;
|
|
423
|
-
/** Active column index when the section uses multiple columns. */
|
|
424
|
-
readonly flowColumnIndex: number;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* What the last layout pass actually did — the observable evidence that incremental layout is
|
|
428
|
-
* working.
|
|
429
|
-
*
|
|
430
|
-
* `reusedPages` and `fullPasses` are the ones that matter: a typing keystroke that rebuilds every
|
|
431
|
-
* page produces identical output and unusable performance, so the tests assert on these rather
|
|
432
|
-
* than on the rendered result.
|
|
433
|
-
*/
|
|
434
|
-
interface LayoutSessionStats {
|
|
435
|
-
/** Paragraphs placed by the last pass, against the number in the document. */
|
|
436
|
-
readonly placed: number;
|
|
437
|
-
readonly total: number;
|
|
438
|
-
/** Pages carried over from the previous layout without being rebuilt. */
|
|
439
|
-
readonly reusedPages: number;
|
|
440
|
-
/** Passes that could not resume and laid the document out from the top. */
|
|
441
|
-
readonly fullPasses: number;
|
|
442
|
-
}
|
|
443
|
-
/** One section's place on the previous document sheet stack. */
|
|
444
|
-
interface SectionStackSpan {
|
|
445
|
-
readonly startIndex: number;
|
|
446
|
-
readonly pageCount: number;
|
|
447
|
-
readonly sheetY: number;
|
|
448
|
-
/** Remapped pages (projectors intact) from the last pass for this section. */
|
|
449
|
-
readonly remappedPages: readonly PageRecord[];
|
|
450
|
-
/**
|
|
451
|
-
* The section-local pages this span's pass returned — identity evidence for reuse. (On a
|
|
452
|
-
* continuous section the host tail merges instead of remapping, so `remappedPages` covers
|
|
453
|
-
* only the overflow sheets while this list still holds every returned page.)
|
|
454
|
-
*
|
|
455
|
-
* A section can lay out more than once inside one document pass (a reserve re-run, a
|
|
456
|
-
* balancing probe), and the last run then reports "nothing placed" against its OWN session
|
|
457
|
-
* even though an earlier run this pass rebuilt the pages. Counts and stats cannot tell
|
|
458
|
-
* those apart; only these object identities can say the span still describes the pages the
|
|
459
|
-
* section just returned.
|
|
460
|
-
*/
|
|
461
|
-
readonly sourcePages: readonly PageRecord[];
|
|
462
|
-
}
|
|
463
|
-
/** Orchestrator state for multi-section incremental layout. */
|
|
464
|
-
interface MultiSectionLayoutState {
|
|
465
|
-
structureKey: string;
|
|
466
|
-
sections: LayoutSession[];
|
|
467
|
-
spans: SectionStackSpan[];
|
|
468
|
-
previousRemapped: readonly PageRecord[];
|
|
469
|
-
previousFinalized: SemanticLayout | null;
|
|
470
|
-
previousPageCount: number;
|
|
471
|
-
/**
|
|
472
|
-
* The PAGEREF assignment token of the pages behind `previousFinalized`. A target can move
|
|
473
|
-
* sheets while the TOC page's own remapped record stays identity-unchanged, so the finalized
|
|
474
|
-
* restore must compare this before handing back a previously substituted sheet.
|
|
475
|
-
*/
|
|
476
|
-
previousPageRefToken: string;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Carried-over state that makes layout incremental.
|
|
480
|
-
*
|
|
481
|
-
* A caller creates one and hands the SAME object back each pass. It holds the previous pages, the
|
|
482
|
-
* per-block cache keys and the flow checkpoints a pass resumes from, so an edit low in a document
|
|
483
|
-
* re-lays only what follows it. A no-change pass returns the previous pages by identity.
|
|
484
|
-
*/
|
|
485
|
-
interface LayoutSession {
|
|
486
|
-
/** @internal Mutable across passes; a caller only creates one and passes it back. */
|
|
487
|
-
previous: SemanticLayout | null;
|
|
488
|
-
checkpoints: FlowCheckpoint[];
|
|
489
|
-
keys: string[];
|
|
490
|
-
/** Geometry and flow context of the previous pass; a change forces a full pass. */
|
|
491
|
-
context: string;
|
|
492
|
-
/**
|
|
493
|
-
* Producer of the previous pass, compared beside {@link context} rather than embedded in
|
|
494
|
-
* it: the producer carries the content-control token, which runs to kilobytes on a
|
|
495
|
-
* control-heavy document, and embedding it copied that token into every section's context
|
|
496
|
-
* string on every pass. Identity-stable when unchanged, so the comparison is a pointer
|
|
497
|
-
* check.
|
|
498
|
-
*
|
|
499
|
-
* Optional so a session literal built before this field existed still type-checks; an
|
|
500
|
-
* absent producer never matches and forces a conservative full pass.
|
|
501
|
-
*/
|
|
502
|
-
producer?: string;
|
|
503
|
-
/**
|
|
504
|
-
* Whether the previous pass read page PARITY: even/odd header variants, or an anchored
|
|
505
|
-
* drawing positioned against an inside/outside frame or alignment.
|
|
506
|
-
*
|
|
507
|
-
* The document page index is not part of {@link context} — page numbers re-project at
|
|
508
|
-
* finalize and page shells renumber at remap — so parity is the only page-position input
|
|
509
|
-
* that can invalidate a section's layout. Tracked separately so the common document pays
|
|
510
|
-
* nothing for a start-index shift.
|
|
511
|
-
*/
|
|
512
|
-
parityDependent: boolean;
|
|
513
|
-
/** Parity (0/1) of the document page index this session's layout started on. */
|
|
514
|
-
startPageParity: number;
|
|
515
|
-
/**
|
|
516
|
-
* The section's memoized prepass (prepared blocks, cache keys, flow keys, document
|
|
517
|
-
* order), reused verbatim while its inputs are unchanged. Opaque here: the shape is
|
|
518
|
-
* owned by `semantic-layout.ts`, which is the only reader and writer.
|
|
519
|
-
*/
|
|
520
|
-
prepass: unknown;
|
|
521
|
-
/**
|
|
522
|
-
* The notes pass's memoized state (reference hits, mark contexts, per-page attach
|
|
523
|
-
* results), reused while its inputs are unchanged. Opaque here: the shape is owned by
|
|
524
|
-
* `note-pagination.ts`, which is the only reader and writer.
|
|
525
|
-
*/
|
|
526
|
-
notes: unknown;
|
|
527
|
-
/** Line counter at the start of the previous pass, for translating reused section counts. */
|
|
528
|
-
startLineCounter: number;
|
|
529
|
-
/**
|
|
530
|
-
* Line counter after the last block of the previous pass.
|
|
531
|
-
*
|
|
532
|
-
* Multi-section orchestration threads a global line counter across sections; early-exit
|
|
533
|
-
* paths (unchanged / converged) must report this rather than the resume cursor.
|
|
534
|
-
*/
|
|
535
|
-
endLineCounter: number;
|
|
536
|
-
/**
|
|
537
|
-
* Flow state after the last block of the previous pass, for a section that CONTINUES
|
|
538
|
-
* onto this one's last sheet (`w:type="continuous"`).
|
|
539
|
-
*
|
|
540
|
-
* `endCursorY` is the used height of that sheet's content column; `endSpaceAfter` is the
|
|
541
|
-
* trailing paragraph spacing still eligible for adjacent-spacing collapse. Reported by
|
|
542
|
-
* the early-exit paths (unchanged / converged) for the same reason as
|
|
543
|
-
* {@link endLineCounter}: the resume cursor is not the end of the flow.
|
|
544
|
-
*/
|
|
545
|
-
endCursorY: number;
|
|
546
|
-
endSpaceAfter: number;
|
|
547
|
-
/** Whether the last page of that pass was still open (no trailing page break). */
|
|
548
|
-
endsOpenPage: boolean;
|
|
549
|
-
stats: LayoutSessionStats;
|
|
550
|
-
/**
|
|
551
|
-
* Column-height limit chosen by the last balanced multi-column pass, or null when the
|
|
552
|
-
* last pass did not balance.
|
|
553
|
-
*
|
|
554
|
-
* Lets the next pass try the remembered limit FIRST: an unchanged balanced section
|
|
555
|
-
* early-exits on that single attempt instead of re-running the natural pass and the
|
|
556
|
-
* whole balance search every time.
|
|
557
|
-
*/
|
|
558
|
-
balanceLimit: number | null;
|
|
559
|
-
/** Present when the last pass was multi-section; child sessions live here. */
|
|
560
|
-
multi: MultiSectionLayoutState | null;
|
|
561
|
-
/**
|
|
562
|
-
* Page-bottom footnote reserves from the last published notes layout.
|
|
563
|
-
*
|
|
564
|
-
* Seeded into the next {@link layoutSemanticDocumentWithNotes} call so the first body
|
|
565
|
-
* pass already matches the reserved context key — without this, every notes document
|
|
566
|
-
* starts empty, mismatches, and throws away the session on reflow.
|
|
567
|
-
*/
|
|
568
|
-
notePageBottomReserves: ReadonlyMap<number, number> | null;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* A layout session, retained across revisions by the caller.
|
|
572
|
-
*/
|
|
573
|
-
declare function createLayoutSession(): LayoutSession;
|
|
574
|
-
|
|
575
|
-
type AutonumFieldKind = 'AUTONUM' | 'AUTONUMLGL' | 'AUTONUMOUT';
|
|
576
|
-
/** One recognized AUTONUM-family instruction: the kind and its supported switches. */
|
|
577
|
-
interface AutonumFieldSpec {
|
|
578
|
-
readonly kind: AutonumFieldKind;
|
|
579
|
-
/** ST_NumberFormat resolved from the `\*` switch; null paints decimal. */
|
|
580
|
-
readonly numFmt: string | null;
|
|
581
|
-
/** `\e`: display the number without its trailing period. */
|
|
582
|
-
readonly suppressPeriod: boolean;
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* Recognize `AUTONUM | AUTONUMLGL | AUTONUMOUT [\* <format>] [\e] [\* MERGEFORMAT]`, or null
|
|
586
|
-
* for anything else. Any unrecognized switch fails the parse so the field stays inert (paints
|
|
587
|
-
* nothing — its historical rendering), never the raw instruction, never a guessed number.
|
|
588
|
-
*/
|
|
589
|
-
declare function parseAutonumInstruction(raw: string): AutonumFieldSpec | null;
|
|
590
|
-
|
|
591
421
|
/**
|
|
592
422
|
* What one cell side is before any ADJACENT cell has its say.
|
|
593
423
|
*
|
|
@@ -626,53 +456,664 @@ interface CompoundBorderMetrics {
|
|
|
626
456
|
*/
|
|
627
457
|
declare function computeDoubleBorderMetricsPt(widthPt: number): CompoundBorderMetrics;
|
|
628
458
|
|
|
459
|
+
/** Far above anything Word authors (its UI caps at 63) while keeping allocation bounded. */
|
|
460
|
+
declare const MAX_TABLE_COLUMNS = 1024;
|
|
461
|
+
|
|
629
462
|
/**
|
|
630
|
-
*
|
|
463
|
+
* `w:tblW` / `w:tcW` / `w:wBefore` (CT_TblWidth, 17.4.63 / 17.4.71 / 17.4.86): a PREFERRED
|
|
464
|
+
* width plus the unit it is stated in. Preferred is the operative word — it is what the
|
|
465
|
+
* producer asked for, not what the table resolved to.
|
|
631
466
|
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
467
|
+
* `pct` is stated in fiftieths of a percent (5000 = 100%) by Word, and in the `"50%"`
|
|
468
|
+
* string form of `ST_Percentage` by others; both are read. `auto` and `nil` carry no width.
|
|
634
469
|
*/
|
|
635
|
-
|
|
636
|
-
declare function paragraphFragmentsOfBlocks(blocks: readonly BlockFragmentRecord[], includeHeaderRepeats?: boolean): ParagraphFragmentRecord[];
|
|
637
|
-
/** Every line in a layout, in reading order — the order caret navigation walks. */
|
|
638
|
-
declare function linesOf(layout: SemanticLayout): LineRecord[];
|
|
639
|
-
/** Every fragment belonging to one paragraph, in order, across page boundaries. */
|
|
640
|
-
declare function fragmentsOfParagraph(layout: SemanticLayout, paragraphId: string): ParagraphFragmentRecord[];
|
|
641
|
-
/** The line containing a model position, or null when the position is not laid out. */
|
|
642
|
-
declare function lineAtPosition(layout: SemanticLayout, paragraphId: string, offset: number,
|
|
643
|
-
/** Lines to test, when the caller already knows which ones can carry the paragraph. */
|
|
644
|
-
candidates?: Iterable<LineRecord>): LineRecord | null;
|
|
645
|
-
/** Every content-control boundary on a layout, preferring the layout-level list. */
|
|
646
|
-
declare function contentControlsOfLayout(layout: SemanticLayout): readonly ContentControlBoundaryRecord$1[];
|
|
470
|
+
type PreferredWidthType = 'dxa' | 'pct' | 'auto' | 'nil';
|
|
647
471
|
/**
|
|
648
|
-
*
|
|
472
|
+
* `w:tblW` / `w:tcW` — a requested width, whose UNIT depends on its type.
|
|
649
473
|
*
|
|
650
|
-
*
|
|
474
|
+
* Points for `dxa`, percent for `pct`, and zero for `auto`/`nil`. Reading `value` without `type`
|
|
475
|
+
* is always wrong.
|
|
651
476
|
*/
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
477
|
+
interface PreferredWidth {
|
|
478
|
+
readonly type: PreferredWidthType;
|
|
479
|
+
/** POINTS for `dxa`, PERCENT (0–100) for `pct`, 0 for `auto`/`nil`. */
|
|
480
|
+
readonly value: number;
|
|
481
|
+
}
|
|
482
|
+
/** The frozen "no preferred width" value — what a table or cell that declares none resolves to. */
|
|
483
|
+
declare const AUTO_PREFERRED_WIDTH: PreferredWidth;
|
|
655
484
|
|
|
656
|
-
/** Paragraph ids in document order, deduplicated across fragments. */
|
|
657
|
-
declare function documentOrder(layout: SemanticLayout): string[];
|
|
658
485
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
* Body, then each page's header and footer, then its note areas — per page, so a story's own
|
|
662
|
-
* paragraphs stay adjacent and in reading order. That is all any caller needs: a selection
|
|
663
|
-
* cannot span two stories (the engine refuses one), so only the order WITHIN a story is ever
|
|
664
|
-
* compared, and this gets that right for all of them at once.
|
|
486
|
+
* The uniform 3 pt (60 twip) inset this lane used to apply on every side.
|
|
665
487
|
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
* {@link documentOrder} is the body alone, and
|
|
669
|
-
* using it as a default is what let selection reads silently answer about the wrong story —
|
|
670
|
-
* two paragraphs selected in a header both ranked -1, the walk gave up, and the run properties
|
|
671
|
-
* came back short. A caller that DOES know its story should still pass that story's order:
|
|
672
|
-
* it is smaller, and it cannot match a paragraph the caret is not among.
|
|
488
|
+
* Word's defaults are not uniform — see {@link DEFAULT_CELL_MARGINS} — so nothing resolves
|
|
489
|
+
* against this any more. Kept because it is published.
|
|
673
490
|
*/
|
|
674
|
-
declare
|
|
675
|
-
|
|
491
|
+
declare const CELL_PAD = 3;
|
|
492
|
+
/** Resolved cell padding in points, after the table default and any per-cell override. */
|
|
493
|
+
interface CellMarginsPt {
|
|
494
|
+
readonly top: number;
|
|
495
|
+
readonly right: number;
|
|
496
|
+
readonly bottom: number;
|
|
497
|
+
readonly left: number;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Word's own default cell padding, for a document whose styles part states none.
|
|
501
|
+
*
|
|
502
|
+
* 0 top, 0 bottom, 108 twips left and right — the values `TableNormal` carries. A uniform
|
|
503
|
+
* 3 pt on all four sides made every row of every table that authored no `w:tblCellMar` 6 pt
|
|
504
|
+
* taller than Word's, and that error compounds down a table until it paginates a page early.
|
|
505
|
+
* A document that DOES ship a default table style resolves against that instead; this is the
|
|
506
|
+
* floor beneath it.
|
|
507
|
+
*/
|
|
508
|
+
declare const DEFAULT_CELL_MARGINS: CellMarginsPt;
|
|
509
|
+
|
|
510
|
+
/** `w:vAlign` — where a cell's content sits when the row is taller than the content. */
|
|
511
|
+
type CellVerticalAlign = 'top' | 'center' | 'bottom';
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Layout-time nesting ceiling. Parse-time depth (MAX_DEPTH = 256 XML levels) alone still
|
|
515
|
+
* admits ~80 levels of `w:tbl` recursion into the layout walk; deeper tables render as an
|
|
516
|
+
* empty cell box rather than recursing.
|
|
517
|
+
*/
|
|
518
|
+
declare const MAX_TABLE_NESTING = 16;
|
|
519
|
+
/**
|
|
520
|
+
* Soft ceiling on an authored `w:trHeight` (~22"). Hostile `w:val` otherwise becomes a
|
|
521
|
+
* multi-page row that every pagination preflight and cell box inherits.
|
|
522
|
+
*/
|
|
523
|
+
declare const MAX_TABLE_ROW_HEIGHT_PT: number;
|
|
524
|
+
/**
|
|
525
|
+
* `w:trPr/w:trHeight` (17.4.81) resolved for layout. Points leave the reader already —
|
|
526
|
+
* twips convert once here, matching every other table geometry boundary.
|
|
527
|
+
*
|
|
528
|
+
* Word quirk (matches Form025U and Word's UI export): a present `@w:val` with an omitted
|
|
529
|
+
* `@w:hRule` is treated as `atLeast`, not ECMA's `auto`. Explicit `auto` still ignores val.
|
|
530
|
+
*/
|
|
531
|
+
type TableRowHeightRule = 'auto' | 'atLeast' | 'exact';
|
|
532
|
+
/**
|
|
533
|
+
* `w:trHeight` — a row's height rule and its value.
|
|
534
|
+
*
|
|
535
|
+
* `auto` carries no value at all, which is why this is a union rather than a rule plus an
|
|
536
|
+
* optional number.
|
|
537
|
+
*/
|
|
538
|
+
type TableRowHeight = {
|
|
539
|
+
readonly rule: 'auto';
|
|
540
|
+
} | {
|
|
541
|
+
readonly rule: 'atLeast' | 'exact';
|
|
542
|
+
readonly valuePt: number;
|
|
543
|
+
};
|
|
544
|
+
/** `w:tblPr/w:jc` (17.4.29, ST_JcTable): where the table sits within the text column. */
|
|
545
|
+
type TableAlignment = 'left' | 'center' | 'right';
|
|
546
|
+
/**
|
|
547
|
+
* `w:tblpPr/@w:horzAnchor` (17.4.58) and `@w:vertAnchor` (17.4.66): the box a floated
|
|
548
|
+
* table's offsets are measured from. Absent means `text` for both.
|
|
549
|
+
*/
|
|
550
|
+
type TableFloatAnchor = 'text' | 'margin' | 'page';
|
|
551
|
+
/** `w:tblpPr/@w:tblpXSpec` (17.4.63, ST_XAlign). */
|
|
552
|
+
type TableFloatXSpec = 'left' | 'center' | 'right' | 'inside' | 'outside';
|
|
553
|
+
/** `w:tblpPr/@w:tblpYSpec` (17.4.65, ST_YAlign). */
|
|
554
|
+
type TableFloatYSpec = 'inline' | 'top' | 'center' | 'bottom' | 'inside' | 'outside';
|
|
555
|
+
/**
|
|
556
|
+
* `w:tblPr/w:tblpPr` (17.4.57) — a table positioned against an anchor box rather than at
|
|
557
|
+
* the point in the text where it was authored.
|
|
558
|
+
*
|
|
559
|
+
* A spec (`tblpXSpec`/`tblpYSpec`) supersedes the matching offset when both are present:
|
|
560
|
+
* 17.4.57 states the alignment outright, and the offset only answers "how far from the
|
|
561
|
+
* anchor" for the case where no alignment was stated.
|
|
562
|
+
*/
|
|
563
|
+
interface TableFloatPosition {
|
|
564
|
+
readonly horzAnchor: TableFloatAnchor;
|
|
565
|
+
readonly vertAnchor: TableFloatAnchor;
|
|
566
|
+
readonly xSpec?: TableFloatXSpec;
|
|
567
|
+
/** `w:tblpX` in points; signed, so a table can be pulled into the margin. */
|
|
568
|
+
readonly xPt: number;
|
|
569
|
+
readonly ySpec?: TableFloatYSpec;
|
|
570
|
+
/** `w:tblpY` in points; signed. */
|
|
571
|
+
readonly yPt: number;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* One cell in the resolved table structure.
|
|
575
|
+
*
|
|
576
|
+
* `gridSpan` is clamped at READ time and layout never re-derives it — the value comes from a file
|
|
577
|
+
* and would otherwise be a loop bound an attacker controls.
|
|
578
|
+
*/
|
|
579
|
+
interface SemanticTableCell {
|
|
580
|
+
readonly id: string;
|
|
581
|
+
/** Clamped to [1, MAX_TABLE_COLUMNS] at read time; layout never re-derives it. */
|
|
582
|
+
readonly gridSpan: number;
|
|
583
|
+
/**
|
|
584
|
+
* Absolute grid column this cell starts on, after `w:gridBefore` and every preceding
|
|
585
|
+
* span. Structural conditional formats and cell geometry both key on this, never on the
|
|
586
|
+
* cell's position in the row: one `gridSpan` cell otherwise shifts firstCol/lastCol and
|
|
587
|
+
* the vertical bands for every cell after it.
|
|
588
|
+
*/
|
|
589
|
+
readonly gridColumn: number;
|
|
590
|
+
/** Canonical `w:gridCol` node id for this cell's start column, when the grid is authored. */
|
|
591
|
+
readonly gridColumnId?: string;
|
|
592
|
+
/** A vMerge cell that is not the restart continues the cell above: box, no content. */
|
|
593
|
+
readonly vMergeContinue: boolean;
|
|
594
|
+
/** `w:vAlign` — defaults to top when omitted/unrecognised. */
|
|
595
|
+
readonly vAlign: CellVerticalAlign;
|
|
596
|
+
/** `w:textDirection`; unsupported values keep horizontal layout. */
|
|
597
|
+
readonly textDirection: 'horizontal' | 'btLr';
|
|
598
|
+
/** Resolved per-side margins (tcMar over tblCellMar over the table style over Word's default). */
|
|
599
|
+
readonly margins: CellMarginsPt;
|
|
600
|
+
/** Three-state authored `tcBorders` (omitted / none / edge). */
|
|
601
|
+
readonly borders: CellBorderBox;
|
|
602
|
+
/** Validated 6-hex shading fill, absent for none/auto. */
|
|
603
|
+
readonly shading?: string;
|
|
604
|
+
/**
|
|
605
|
+
* `w:tcW` — the width this cell asked for, as authored.
|
|
606
|
+
*
|
|
607
|
+
* Published for consumers that need the cell's own statement (a column-resize handle has
|
|
608
|
+
* to write back to it). Column geometry is NOT derived from this field: the resolver works
|
|
609
|
+
* from a flat claim list built in the same pass, because resolving a column means looking
|
|
610
|
+
* at every cell that covers it across every row, not at one cell at a time. Read
|
|
611
|
+
* `columnWidthsPt` for what the table actually laid out.
|
|
612
|
+
*/
|
|
613
|
+
readonly preferredWidth: PreferredWidth;
|
|
614
|
+
/**
|
|
615
|
+
* What the table style says about this cell's paragraphs and runs (17.7.6.6) — a header
|
|
616
|
+
* row's bold and centring live here, not in the cell's own properties.
|
|
617
|
+
*/
|
|
618
|
+
readonly styleFormatting: TableCellStyleFormatting;
|
|
619
|
+
/** Block children in reading order, with content-control wrappers flattened. */
|
|
620
|
+
readonly blocks: readonly OoxmlElement[];
|
|
621
|
+
}
|
|
622
|
+
/** One row in the resolved structure: its cells, its height rule, and any row-level revision. */
|
|
623
|
+
interface SemanticTableRow {
|
|
624
|
+
readonly id: string;
|
|
625
|
+
/** Pending Word row insertion/deletion authored in `w:trPr`. */
|
|
626
|
+
readonly revisionKind?: 'insert' | 'delete';
|
|
627
|
+
/**
|
|
628
|
+
* The `w:trPr/w:ins|w:del` attribution, carried with the kind so a painted row can say
|
|
629
|
+
* WHOSE pending decision it is — the review model addresses the decision by exactly this
|
|
630
|
+
* `(id, author, date)` triple, and a surface with only the kind could highlight the row
|
|
631
|
+
* but never open its card.
|
|
632
|
+
*/
|
|
633
|
+
readonly revisionId?: string;
|
|
634
|
+
readonly revisionAuthor?: string;
|
|
635
|
+
readonly revisionDate?: string;
|
|
636
|
+
/** `w:trPr/w:tblHeader` — the row repeats atop each page the table continues onto. */
|
|
637
|
+
readonly isHeader: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* `w:trPr/w:cantSplit` — the row must stay on one page. When it cannot fit a fresh page,
|
|
640
|
+
* layout fails closed rather than fragmenting or overflowing the content box.
|
|
641
|
+
*/
|
|
642
|
+
readonly cantSplit: boolean;
|
|
643
|
+
/** `w:trPr/w:trHeight` — auto / atLeast floor / exact (clipped) row height. */
|
|
644
|
+
readonly height: TableRowHeight;
|
|
645
|
+
readonly cells: readonly SemanticTableCell[];
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* A table resolved into a rectangular grid: column widths, rows, and the widths it asked for.
|
|
649
|
+
*
|
|
650
|
+
* The grid is normalized here so layout never has to reconcile `w:gridCol` against actual cell
|
|
651
|
+
* spans — vertical merges and column spans are already accounted for.
|
|
652
|
+
*/
|
|
653
|
+
interface SemanticTableStructure {
|
|
654
|
+
readonly columnWidthsPt: readonly number[];
|
|
655
|
+
readonly rows: readonly SemanticTableRow[];
|
|
656
|
+
/** `w:tblPr/w:tblW` — the width the table asked for. */
|
|
657
|
+
readonly tableWidth: PreferredWidth;
|
|
658
|
+
/**
|
|
659
|
+
* `w:tblInd` (17.4.50) in points — "this indentation should shift the table into the text
|
|
660
|
+
* margin by the specified amount". Applies to a left-aligned table; `w:jc` decides the
|
|
661
|
+
* placement outright for the other two.
|
|
662
|
+
*/
|
|
663
|
+
readonly indentPt: number;
|
|
664
|
+
/** `w:tblPr/w:jc` (17.4.29) — where the table sits in the text column. */
|
|
665
|
+
readonly alignment: TableAlignment;
|
|
666
|
+
/**
|
|
667
|
+
* `w:tblPr/w:tblpPr` (17.4.57) — present when the table is positioned against an anchor
|
|
668
|
+
* box. Placement then comes from {@link tableFloatOriginX} rather than `w:jc`/`w:tblInd`.
|
|
669
|
+
*/
|
|
670
|
+
readonly float?: TableFloatPosition;
|
|
671
|
+
/**
|
|
672
|
+
* `w:tblCellSpacing` (17.4.45) in points: the gap between adjacent cell edges. Applied as
|
|
673
|
+
* a half-gap inset on each side of every cell, so cells separate visually without the grid
|
|
674
|
+
* itself moving. Word ALSO grows the table's overall width by the spacing it adds around
|
|
675
|
+
* the outside; that part is not modelled, so a spaced table is laid out on the same grid
|
|
676
|
+
* its file states rather than a wider one.
|
|
677
|
+
*/
|
|
678
|
+
readonly cellSpacingPt: number;
|
|
679
|
+
/**
|
|
680
|
+
* `w:tblPr/w:tblLayout/@w:type="fixed"` (17.4.52 — 17.4.53 is the `w:tblPrEx` exception
|
|
681
|
+
* variant, not this element). Fixed layout takes the grid as final;
|
|
682
|
+
* anything else is autofit, which in Word never renders wider than the text column.
|
|
683
|
+
*/
|
|
684
|
+
readonly layoutFixed: boolean;
|
|
685
|
+
/** Table-level `tblBorders` (three-state, including insideH/insideV). */
|
|
686
|
+
readonly tableBorders: TableBorderBox;
|
|
687
|
+
/** Table-level `tblCellMar` defaults (per-side, Word's own default when a side is omitted). */
|
|
688
|
+
readonly defaultMargins: CellMarginsPt;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Where a table's left edge sits inside the box that contains it.
|
|
692
|
+
*
|
|
693
|
+
* 17.4.50 puts a left-aligned table at `w:tblInd` from the leading margin. 17.4.29's other
|
|
694
|
+
* two placements are stated relative to the containing box instead, so the indent does not
|
|
695
|
+
* also apply to them — Word centres a centred table in the text column whatever indent the
|
|
696
|
+
* file carries. A table wider than its container starts flush so its leading edge stays on
|
|
697
|
+
* the page rather than being centred off it.
|
|
698
|
+
*/
|
|
699
|
+
declare function tableOriginX(structure: SemanticTableStructure, containerWidthPt: number): number;
|
|
700
|
+
/**
|
|
701
|
+
* Read one typed table node into a bounded structure, or null when the node is not a
|
|
702
|
+
* typed table or sits beyond the nesting ceiling.
|
|
703
|
+
*/
|
|
704
|
+
declare function readTableStructure(table: OoxmlNode, contentWidthPt: number, depth: number, styleCascade?: StyleCascadeTable,
|
|
705
|
+
/** Which revisions the view resolves away; only the proposed result performs the join. */
|
|
706
|
+
displayMode?: RevisionDisplayMode, authorFilter?: RevisionAuthorFilter): SemanticTableStructure | null;
|
|
707
|
+
|
|
708
|
+
interface PositionedTableAnchorSignal {
|
|
709
|
+
readonly anchorId: string;
|
|
710
|
+
readonly column: number;
|
|
711
|
+
readonly fragmentIndex: number;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/** The flow state as it stood immediately before one block was placed. */
|
|
715
|
+
interface FlowCheckpoint {
|
|
716
|
+
/** Completed pages at this point. The prefix of the previous layout that still stands. */
|
|
717
|
+
readonly pageCount: number;
|
|
718
|
+
/** Fragments already on the page being built. */
|
|
719
|
+
readonly pageFragments: readonly BlockFragmentRecord[];
|
|
720
|
+
/** Anchored drawings already collected for the open page. */
|
|
721
|
+
readonly pendingAnchoredDrawings: readonly AnchoredDrawingRecord[];
|
|
722
|
+
/**
|
|
723
|
+
* Anchored drawings overlap resolution pushed onto the NEXT page, and how many times each
|
|
724
|
+
* drawing has been pushed.
|
|
725
|
+
*
|
|
726
|
+
* Flow state like the rest of this record, and carried for the same reason: a resume that
|
|
727
|
+
* started with an empty list dropped a drawing that the previous pass had deferred but not
|
|
728
|
+
* yet placed, and a convergence that did not compare them accepted a flow that still owed
|
|
729
|
+
* the next page a drawing as equal to one that owed it nothing.
|
|
730
|
+
*/
|
|
731
|
+
readonly deferredAnchoredDrawings: readonly AnchoredDrawingRecord[];
|
|
732
|
+
readonly anchorPageDeferCounts: ReadonlyMap<string, number>;
|
|
733
|
+
/** Sheet-positioned tables and zero-line anchors still owed by the open page. */
|
|
734
|
+
readonly pendingPositionedTableTokens?: readonly string[];
|
|
735
|
+
readonly positionedTableAnchorSignals?: readonly PositionedTableAnchorSignal[];
|
|
736
|
+
readonly cursorY: number;
|
|
737
|
+
readonly lineCounter: number;
|
|
738
|
+
/** Trailing paragraph spacing participating in adjacent-spacing collapse. */
|
|
739
|
+
readonly previousSpaceAfter: number;
|
|
740
|
+
/** Active column index when the section uses multiple columns. */
|
|
741
|
+
readonly flowColumnIndex: number;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* What the last layout pass actually did — the observable evidence that incremental layout is
|
|
745
|
+
* working.
|
|
746
|
+
*
|
|
747
|
+
* `reusedPages` and `fullPasses` are the ones that matter: a typing keystroke that rebuilds every
|
|
748
|
+
* page produces identical output and unusable performance, so the tests assert on these rather
|
|
749
|
+
* than on the rendered result.
|
|
750
|
+
*/
|
|
751
|
+
interface LayoutSessionStats {
|
|
752
|
+
/** Paragraphs placed by the last pass, against the number in the document. */
|
|
753
|
+
readonly placed: number;
|
|
754
|
+
readonly total: number;
|
|
755
|
+
/** Pages carried over from the previous layout without being rebuilt. */
|
|
756
|
+
readonly reusedPages: number;
|
|
757
|
+
/** Passes that could not resume and laid the document out from the top. */
|
|
758
|
+
readonly fullPasses: number;
|
|
759
|
+
}
|
|
760
|
+
/** One section's place on the previous document sheet stack. */
|
|
761
|
+
interface SectionStackSpan {
|
|
762
|
+
readonly startIndex: number;
|
|
763
|
+
readonly pageCount: number;
|
|
764
|
+
readonly sheetY: number;
|
|
765
|
+
/** Remapped pages (projectors intact) from the last pass for this section. */
|
|
766
|
+
readonly remappedPages: readonly PageRecord[];
|
|
767
|
+
/**
|
|
768
|
+
* The section-local pages this span's pass returned — identity evidence for reuse. (On a
|
|
769
|
+
* continuous section the host tail merges instead of remapping, so `remappedPages` covers
|
|
770
|
+
* only the overflow sheets while this list still holds every returned page.)
|
|
771
|
+
*
|
|
772
|
+
* A section can lay out more than once inside one document pass (a reserve re-run, a
|
|
773
|
+
* balancing probe), and the last run then reports "nothing placed" against its OWN session
|
|
774
|
+
* even though an earlier run this pass rebuilt the pages. Counts and stats cannot tell
|
|
775
|
+
* those apart; only these object identities can say the span still describes the pages the
|
|
776
|
+
* section just returned.
|
|
777
|
+
*/
|
|
778
|
+
readonly sourcePages: readonly PageRecord[];
|
|
779
|
+
}
|
|
780
|
+
/** Orchestrator state for multi-section incremental layout. */
|
|
781
|
+
interface MultiSectionLayoutState {
|
|
782
|
+
structureKey: string;
|
|
783
|
+
sections: LayoutSession[];
|
|
784
|
+
spans: SectionStackSpan[];
|
|
785
|
+
previousRemapped: readonly PageRecord[];
|
|
786
|
+
previousFinalized: SemanticLayout | null;
|
|
787
|
+
previousPageCount: number;
|
|
788
|
+
/**
|
|
789
|
+
* The PAGEREF assignment token of the pages behind `previousFinalized`. A target can move
|
|
790
|
+
* sheets while the TOC page's own remapped record stays identity-unchanged, so the finalized
|
|
791
|
+
* restore must compare this before handing back a previously substituted sheet.
|
|
792
|
+
*/
|
|
793
|
+
previousPageRefToken: string;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Carried-over state that makes layout incremental.
|
|
797
|
+
*
|
|
798
|
+
* A caller creates one and hands the SAME object back each pass. It holds the previous pages, the
|
|
799
|
+
* per-block cache keys and the flow checkpoints a pass resumes from, so an edit low in a document
|
|
800
|
+
* re-lays only what follows it. A no-change pass returns the previous pages by identity.
|
|
801
|
+
*/
|
|
802
|
+
interface LayoutSession {
|
|
803
|
+
/** @internal Mutable across passes; a caller only creates one and passes it back. */
|
|
804
|
+
previous: SemanticLayout | null;
|
|
805
|
+
checkpoints: FlowCheckpoint[];
|
|
806
|
+
keys: string[];
|
|
807
|
+
/** Geometry and flow context of the previous pass; a change forces a full pass. */
|
|
808
|
+
context: string;
|
|
809
|
+
/**
|
|
810
|
+
* Producer of the previous pass, compared beside {@link context} rather than embedded in
|
|
811
|
+
* it: the producer carries the content-control token, which runs to kilobytes on a
|
|
812
|
+
* control-heavy document, and embedding it copied that token into every section's context
|
|
813
|
+
* string on every pass. Identity-stable when unchanged, so the comparison is a pointer
|
|
814
|
+
* check.
|
|
815
|
+
*
|
|
816
|
+
* Optional so a session literal built before this field existed still type-checks; an
|
|
817
|
+
* absent producer never matches and forces a conservative full pass.
|
|
818
|
+
*/
|
|
819
|
+
producer?: string;
|
|
820
|
+
/**
|
|
821
|
+
* Whether the previous pass read page PARITY: even/odd header variants, or an anchored
|
|
822
|
+
* drawing positioned against an inside/outside frame or alignment.
|
|
823
|
+
*
|
|
824
|
+
* The document page index is not part of {@link context} — page numbers re-project at
|
|
825
|
+
* finalize and page shells renumber at remap — so parity is the only page-position input
|
|
826
|
+
* that can invalidate a section's layout. Tracked separately so the common document pays
|
|
827
|
+
* nothing for a start-index shift.
|
|
828
|
+
*/
|
|
829
|
+
parityDependent: boolean;
|
|
830
|
+
/** Parity (0/1) of the document page index this session's layout started on. */
|
|
831
|
+
startPageParity: number;
|
|
832
|
+
/**
|
|
833
|
+
* The section's memoized prepass (prepared blocks, cache keys, flow keys, document
|
|
834
|
+
* order), reused verbatim while its inputs are unchanged. Opaque here: the shape is
|
|
835
|
+
* owned by `semantic-layout.ts`, which is the only reader and writer.
|
|
836
|
+
*/
|
|
837
|
+
prepass: unknown;
|
|
838
|
+
/**
|
|
839
|
+
* The notes pass's memoized state (reference hits, mark contexts, per-page attach
|
|
840
|
+
* results), reused while its inputs are unchanged. Opaque here: the shape is owned by
|
|
841
|
+
* `note-pagination.ts`, which is the only reader and writer.
|
|
842
|
+
*/
|
|
843
|
+
notes: unknown;
|
|
844
|
+
/** Line counter at the start of the previous pass, for translating reused section counts. */
|
|
845
|
+
startLineCounter: number;
|
|
846
|
+
/**
|
|
847
|
+
* Line counter after the last block of the previous pass.
|
|
848
|
+
*
|
|
849
|
+
* Multi-section orchestration threads a global line counter across sections; early-exit
|
|
850
|
+
* paths (unchanged / converged) must report this rather than the resume cursor.
|
|
851
|
+
*/
|
|
852
|
+
endLineCounter: number;
|
|
853
|
+
/**
|
|
854
|
+
* Flow state after the last block of the previous pass, for a section that CONTINUES
|
|
855
|
+
* onto this one's last sheet (`w:type="continuous"`).
|
|
856
|
+
*
|
|
857
|
+
* `endCursorY` is the used height of that sheet's content column; `endSpaceAfter` is the
|
|
858
|
+
* trailing paragraph spacing still eligible for adjacent-spacing collapse. Reported by
|
|
859
|
+
* the early-exit paths (unchanged / converged) for the same reason as
|
|
860
|
+
* {@link endLineCounter}: the resume cursor is not the end of the flow.
|
|
861
|
+
*/
|
|
862
|
+
endCursorY: number;
|
|
863
|
+
endSpaceAfter: number;
|
|
864
|
+
/** Whether the last page of that pass was still open (no trailing page break). */
|
|
865
|
+
endsOpenPage: boolean;
|
|
866
|
+
stats: LayoutSessionStats;
|
|
867
|
+
/**
|
|
868
|
+
* Column-height limit chosen by the last balanced multi-column pass, or null when the
|
|
869
|
+
* last pass did not balance.
|
|
870
|
+
*
|
|
871
|
+
* Lets the next pass try the remembered limit FIRST: an unchanged balanced section
|
|
872
|
+
* early-exits on that single attempt instead of re-running the natural pass and the
|
|
873
|
+
* whole balance search every time.
|
|
874
|
+
*/
|
|
875
|
+
balanceLimit: number | null;
|
|
876
|
+
/** Present when the last pass was multi-section; child sessions live here. */
|
|
877
|
+
multi: MultiSectionLayoutState | null;
|
|
878
|
+
/**
|
|
879
|
+
* Page-bottom footnote reserves from the last published notes layout.
|
|
880
|
+
*
|
|
881
|
+
* Seeded into the next {@link layoutSemanticDocumentWithNotes} call so the first body
|
|
882
|
+
* pass already matches the reserved context key — without this, every notes document
|
|
883
|
+
* starts empty, mismatches, and throws away the session on reflow.
|
|
884
|
+
*/
|
|
885
|
+
notePageBottomReserves: ReadonlyMap<number, number> | null;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* A layout session, retained across revisions by the caller.
|
|
889
|
+
*/
|
|
890
|
+
declare function createLayoutSession(): LayoutSession;
|
|
891
|
+
|
|
892
|
+
/** Soft ceiling on fragments emitted for one authored row (hostile / runaway splits). */
|
|
893
|
+
declare const MAX_TABLE_ROW_FRAGMENTS = 4096;
|
|
894
|
+
/**
|
|
895
|
+
* Why a table could not be paginated as authored.
|
|
896
|
+
*
|
|
897
|
+
* Each is a bound: a row taller than a page, a row that cannot be split, or a row producing more
|
|
898
|
+
* fragments than the limit allows.
|
|
899
|
+
*/
|
|
900
|
+
type TablePaginationErrorCode = 'table-row-overheight' | 'table-row-split-unsupported' | 'table-row-fragment-limit';
|
|
901
|
+
/**
|
|
902
|
+
* Bounded table pagination failure. Prefer this over emitting a fragment that overflows
|
|
903
|
+
* the page content box.
|
|
904
|
+
*/
|
|
905
|
+
declare class TablePaginationError extends Error {
|
|
906
|
+
readonly code: TablePaginationErrorCode;
|
|
907
|
+
constructor(code: TablePaginationErrorCode, message: string);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
type AutonumFieldKind = 'AUTONUM' | 'AUTONUMLGL' | 'AUTONUMOUT';
|
|
911
|
+
/** One recognized AUTONUM-family instruction: the kind and its supported switches. */
|
|
912
|
+
interface AutonumFieldSpec {
|
|
913
|
+
readonly kind: AutonumFieldKind;
|
|
914
|
+
/** ST_NumberFormat resolved from the `\*` switch; null paints decimal. */
|
|
915
|
+
readonly numFmt: string | null;
|
|
916
|
+
/** `\e`: display the number without its trailing period. */
|
|
917
|
+
readonly suppressPeriod: boolean;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Recognize `AUTONUM | AUTONUMLGL | AUTONUMOUT [\* <format>] [\e] [\* MERGEFORMAT]`, or null
|
|
921
|
+
* for anything else. Any unrecognized switch fails the parse so the field stays inert (paints
|
|
922
|
+
* nothing — its historical rendering), never the raw instruction, never a guessed number.
|
|
923
|
+
*/
|
|
924
|
+
declare function parseAutonumInstruction(raw: string): AutonumFieldSpec | null;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Depth-first paragraph fragments of one page, in reading order.
|
|
928
|
+
*
|
|
929
|
+
* Table interiors flatten through rows and cells; header-repeat rows are skipped unless
|
|
930
|
+
* asked for, so interaction sees each caret stop exactly once while paint sees everything.
|
|
931
|
+
*/
|
|
932
|
+
declare function paragraphFragmentsOf(page: PageRecord, includeHeaderRepeats?: boolean): ParagraphFragmentRecord[];
|
|
933
|
+
declare function paragraphFragmentsOfBlocks(blocks: readonly BlockFragmentRecord[], includeHeaderRepeats?: boolean): ParagraphFragmentRecord[];
|
|
934
|
+
/** Every line in a layout, in reading order — the order caret navigation walks. */
|
|
935
|
+
declare function linesOf(layout: SemanticLayout): LineRecord[];
|
|
936
|
+
/** The fragment-plus-anchored-drawings shape every laid-out story shares. */
|
|
937
|
+
interface StoryDrawingHost {
|
|
938
|
+
/** Root story fragments in their published reading order. */
|
|
939
|
+
readonly fragments: readonly BlockFragmentRecord[];
|
|
940
|
+
/** Story-level positioned drawings, when that story supports anchors. */
|
|
941
|
+
readonly anchoredDrawings?: readonly AnchoredDrawingRecord[];
|
|
942
|
+
}
|
|
943
|
+
/** Root story kinds published directly from one page record. @public */
|
|
944
|
+
type SemanticRootStoryKind = 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'note-separator';
|
|
945
|
+
/** Story containing a visited semantic record. @public */
|
|
946
|
+
type SemanticStoryKind = SemanticRootStoryKind | 'textbox';
|
|
947
|
+
/**
|
|
948
|
+
* One root story in the engine's complete published page/story order.
|
|
949
|
+
*
|
|
950
|
+
* The story discriminant preserves the precise published host type so exporters can consume
|
|
951
|
+
* furniture and note metadata without casting or searching the page graph a second time.
|
|
952
|
+
* @public
|
|
953
|
+
*/
|
|
954
|
+
type SemanticStoryVisit = {
|
|
955
|
+
readonly page: PageRecord;
|
|
956
|
+
readonly story: 'body';
|
|
957
|
+
readonly host: PageRecord;
|
|
958
|
+
/** Absolute story bounds; body records are relative to the page content box. */
|
|
959
|
+
readonly box: LayoutBox;
|
|
960
|
+
/** Absolute origin to add to story-relative fragment and drawing coordinates. */
|
|
961
|
+
readonly origin: Readonly<{
|
|
962
|
+
x: number;
|
|
963
|
+
y: number;
|
|
964
|
+
}>;
|
|
965
|
+
readonly noteScopeId: null;
|
|
966
|
+
readonly noteAreaKind: null;
|
|
967
|
+
} | {
|
|
968
|
+
readonly page: PageRecord;
|
|
969
|
+
readonly story: 'header' | 'footer';
|
|
970
|
+
readonly host: HeaderFooterStoryRecord;
|
|
971
|
+
readonly box: LayoutBox;
|
|
972
|
+
readonly origin: Readonly<{
|
|
973
|
+
x: number;
|
|
974
|
+
y: number;
|
|
975
|
+
}>;
|
|
976
|
+
readonly noteScopeId: null;
|
|
977
|
+
readonly noteAreaKind: null;
|
|
978
|
+
} | {
|
|
979
|
+
readonly page: PageRecord;
|
|
980
|
+
readonly story: 'footnote' | 'endnote';
|
|
981
|
+
readonly host: NoteStoryRecord;
|
|
982
|
+
readonly box: LayoutBox;
|
|
983
|
+
readonly origin: Readonly<{
|
|
984
|
+
x: number;
|
|
985
|
+
y: number;
|
|
986
|
+
}>;
|
|
987
|
+
readonly noteScopeId: string;
|
|
988
|
+
readonly noteAreaKind: NoteAreaRecord['kind'];
|
|
989
|
+
} | {
|
|
990
|
+
readonly page: PageRecord;
|
|
991
|
+
readonly story: 'note-separator';
|
|
992
|
+
readonly host: NonNullable<NoteAreaRecord['separator']>;
|
|
993
|
+
readonly box: LayoutBox;
|
|
994
|
+
readonly origin: Readonly<{
|
|
995
|
+
x: number;
|
|
996
|
+
y: number;
|
|
997
|
+
}>;
|
|
998
|
+
readonly noteScopeId: null;
|
|
999
|
+
readonly noteAreaKind: NoteAreaRecord['kind'];
|
|
1000
|
+
};
|
|
1001
|
+
/** Visit every root story in a semantic layout, preserving page/story order. @public */
|
|
1002
|
+
declare function forEachSemanticStory(layout: SemanticLayout, visit: (story: SemanticStoryVisit) => void): void;
|
|
1003
|
+
/** Location of one paragraph fragment within a recursively painted story graph. @public */
|
|
1004
|
+
interface StoryParagraphFragmentContext {
|
|
1005
|
+
/** Absolute origin of the immediate story containing this record. */
|
|
1006
|
+
readonly storyOrigin: Readonly<{
|
|
1007
|
+
x: number;
|
|
1008
|
+
y: number;
|
|
1009
|
+
}>;
|
|
1010
|
+
/** Zero for the supplied story; increments for every anchored textbox boundary. */
|
|
1011
|
+
readonly textboxDepth: number;
|
|
1012
|
+
/** Drawing whose textbox directly owns this fragment, or null for the root story. */
|
|
1013
|
+
readonly textboxOwner: AnchoredDrawingRecord | null;
|
|
1014
|
+
/** Root-to-leaf owning drawings, empty for the supplied story. */
|
|
1015
|
+
readonly textboxPath: readonly AnchoredDrawingRecord[];
|
|
1016
|
+
}
|
|
1017
|
+
/** Location of one drawing within a recursively painted story graph. @public */
|
|
1018
|
+
interface StoryDrawingContext extends StoryParagraphFragmentContext {
|
|
1019
|
+
/** Enclosing paragraph for an inline drawing; null for a story-level anchor. */
|
|
1020
|
+
readonly paragraph: ParagraphFragmentRecord | null;
|
|
1021
|
+
/** Enclosing line for an inline drawing; null for a story-level anchor. */
|
|
1022
|
+
readonly line: LineRecord | null;
|
|
1023
|
+
}
|
|
1024
|
+
type RootDrawingOrigin = (drawing: AnchoredDrawingRecord) => Readonly<{
|
|
1025
|
+
x: number;
|
|
1026
|
+
y: number;
|
|
1027
|
+
}>;
|
|
1028
|
+
/** Drawing layer relative to its owning story's text. @public */
|
|
1029
|
+
type SemanticDrawingLayer = 'behind-text' | 'inline' | 'in-front-of-text';
|
|
1030
|
+
/**
|
|
1031
|
+
* One drawing in bounded graph-enumeration order with exporter-grade provenance.
|
|
1032
|
+
*
|
|
1033
|
+
* Enumeration is deliberately not paint order: story anchors (and nested textboxes) are visited
|
|
1034
|
+
* before inline line drawings. Renderers use `paintLayer` plus record geometry to compose layers.
|
|
1035
|
+
* @public
|
|
1036
|
+
*/
|
|
1037
|
+
interface SemanticDrawingVisit extends StoryDrawingContext {
|
|
1038
|
+
/** Physical page carrying this drawing occurrence. */
|
|
1039
|
+
readonly page: PageRecord;
|
|
1040
|
+
/** Immediate story classification; `textbox` after textbox descent. */
|
|
1041
|
+
readonly story: SemanticStoryKind;
|
|
1042
|
+
/** Root story from which textbox descent began. */
|
|
1043
|
+
readonly rootStory: SemanticRootStoryKind;
|
|
1044
|
+
/** Note scope for drawings in note stories; null elsewhere. */
|
|
1045
|
+
readonly noteScopeId: string | null;
|
|
1046
|
+
/** Owning note-area kind for note/separator drawings; null elsewhere. */
|
|
1047
|
+
readonly noteAreaKind: NoteAreaRecord['kind'] | null;
|
|
1048
|
+
/** Precise root host and absolute origin for story-relative geometry. */
|
|
1049
|
+
readonly root: SemanticStoryVisit;
|
|
1050
|
+
/** Absolute origin of this drawing's extent in page-stack coordinates. */
|
|
1051
|
+
readonly drawingOrigin: Readonly<{
|
|
1052
|
+
x: number;
|
|
1053
|
+
y: number;
|
|
1054
|
+
}>;
|
|
1055
|
+
/** Absolute painted bounds, including effects and clipping. */
|
|
1056
|
+
readonly absolutePaintBounds: LayoutBox;
|
|
1057
|
+
/** Absolute pointer/hit bounds. */
|
|
1058
|
+
readonly absoluteHitBounds: LayoutBox;
|
|
1059
|
+
/** Layer relative to text in the immediate owning story. */
|
|
1060
|
+
readonly paintLayer: SemanticDrawingLayer;
|
|
1061
|
+
/** Published drawing record; inline visits also carry paragraph and line. */
|
|
1062
|
+
readonly drawing: InlineDrawingRecord | AnchoredDrawingRecord;
|
|
1063
|
+
}
|
|
1064
|
+
/** Visit every drawing through the canonical root-story and recursive textbox walks. @public */
|
|
1065
|
+
declare function forEachSemanticDrawing(layout: SemanticLayout, visit: (drawing: SemanticDrawingVisit) => void): void;
|
|
1066
|
+
/**
|
|
1067
|
+
* Visit every paragraph fragment one story paints — its own (table interiors flattened,
|
|
1068
|
+
* header repeats included) and the fragments inside each anchored drawing's text-box story,
|
|
1069
|
+
* recursively.
|
|
1070
|
+
*
|
|
1071
|
+
* The fragment sibling of {@link forEachStoryDrawing}, sharing its depth bound, for
|
|
1072
|
+
* consumers that read per-paragraph published fields (list markers) rather than drawings.
|
|
1073
|
+
* The furniture list-marker token walks with this; a fragment it misses leaves a reused
|
|
1074
|
+
* page showing a stale marker.
|
|
1075
|
+
*/
|
|
1076
|
+
declare function forEachStoryParagraphFragment(story: StoryDrawingHost, visit: (fragment: ParagraphFragmentRecord, context: StoryParagraphFragmentContext) => void, rootOrigin?: Readonly<{
|
|
1077
|
+
x: number;
|
|
1078
|
+
y: number;
|
|
1079
|
+
}>, rootDrawingOrigin?: RootDrawingOrigin): void;
|
|
1080
|
+
/** Every fragment belonging to one paragraph, in order, across page boundaries. */
|
|
1081
|
+
declare function fragmentsOfParagraph(layout: SemanticLayout, paragraphId: string): ParagraphFragmentRecord[];
|
|
1082
|
+
/** The line containing a model position, or null when the position is not laid out. */
|
|
1083
|
+
declare function lineAtPosition(layout: SemanticLayout, paragraphId: string, offset: number,
|
|
1084
|
+
/** Lines to test, when the caller already knows which ones can carry the paragraph. */
|
|
1085
|
+
candidates?: Iterable<LineRecord>): LineRecord | null;
|
|
1086
|
+
/** Every content-control boundary on a layout, preferring the layout-level list. */
|
|
1087
|
+
declare function contentControlsOfLayout(layout: SemanticLayout): readonly ContentControlBoundaryRecord$1[];
|
|
1088
|
+
/**
|
|
1089
|
+
* Axis-aligned union of boxes, or null when the list is empty.
|
|
1090
|
+
*
|
|
1091
|
+
* Used when a control's content spans several fragments or spans on one page.
|
|
1092
|
+
*/
|
|
1093
|
+
declare function unionLayoutBoxes(boxes: readonly LayoutBox[]): LayoutBox | null;
|
|
1094
|
+
/** Collapse raw + ancestor locks into one `ST_Lock` vocabulary value. */
|
|
1095
|
+
declare function effectiveContentControlLock(locks: readonly ContentControlLock[]): ContentControlLock;
|
|
1096
|
+
|
|
1097
|
+
/** Paragraph ids in document order, deduplicated across fragments. */
|
|
1098
|
+
declare function documentOrder(layout: SemanticLayout): string[];
|
|
1099
|
+
/**
|
|
1100
|
+
* Paragraph ids of EVERY story the layout paints, in the order they sit on the page.
|
|
1101
|
+
*
|
|
1102
|
+
* Body, then each page's header and footer, then its note areas — per page, so a story's own
|
|
1103
|
+
* paragraphs stay adjacent and in reading order. That is all any caller needs: a selection
|
|
1104
|
+
* cannot span two stories (the engine refuses one), so only the order WITHIN a story is ever
|
|
1105
|
+
* compared, and this gets that right for all of them at once.
|
|
1106
|
+
*
|
|
1107
|
+
* What a caller passes when it has no story in hand — `selectionRects` and
|
|
1108
|
+
* `spansInSelection` both REQUIRE an order rather than defaulting to one, deliberately.
|
|
1109
|
+
* {@link documentOrder} is the body alone, and
|
|
1110
|
+
* using it as a default is what let selection reads silently answer about the wrong story —
|
|
1111
|
+
* two paragraphs selected in a header both ranked -1, the walk gave up, and the run properties
|
|
1112
|
+
* came back short. A caller that DOES know its story should still pass that story's order:
|
|
1113
|
+
* it is smaller, and it cannot match a paragraph the caret is not among.
|
|
1114
|
+
*/
|
|
1115
|
+
declare function everyStoryOrder(layout: SemanticLayout): string[];
|
|
1116
|
+
|
|
676
1117
|
/**
|
|
677
1118
|
* The rectangles covering a selection, one per line it spans.
|
|
678
1119
|
*
|
|
@@ -1044,42 +1485,255 @@ interface GraphemeWordSegmentRecord {
|
|
|
1044
1485
|
/** Map UTF-16 word segments to grapheme-safe half-open ranges within one paragraph. */
|
|
1045
1486
|
declare function wordSegmentsToGraphemeRecords(text: string, segments: readonly WordSegment[]): readonly GraphemeWordSegmentRecord[];
|
|
1046
1487
|
|
|
1488
|
+
/** One span in the engine's published story order. @public */
|
|
1489
|
+
interface SemanticSpanVisit {
|
|
1490
|
+
readonly page: PageRecord;
|
|
1491
|
+
readonly story: SemanticStoryKind;
|
|
1492
|
+
/** Root story from which textbox descent began; equal to `story` outside textboxes. */
|
|
1493
|
+
readonly rootStory: SemanticRootStoryKind;
|
|
1494
|
+
/** Precise root host and absolute origin for story-relative geometry. */
|
|
1495
|
+
readonly root: SemanticStoryVisit;
|
|
1496
|
+
/** Absolute origin of the immediate root or textbox story containing this span. */
|
|
1497
|
+
readonly storyOrigin: Readonly<{
|
|
1498
|
+
x: number;
|
|
1499
|
+
y: number;
|
|
1500
|
+
}>;
|
|
1501
|
+
/** Absolute laid-out span bounds in page-stack coordinates. */
|
|
1502
|
+
readonly absoluteBox: LayoutBox;
|
|
1503
|
+
/** Owning note scope/area where applicable; null for body and page furniture. */
|
|
1504
|
+
readonly noteScopeId: string | null;
|
|
1505
|
+
readonly noteAreaKind: SemanticStoryVisit['noteAreaKind'];
|
|
1506
|
+
/** Zero outside a textbox, otherwise its bounded nesting depth. */
|
|
1507
|
+
readonly textboxDepth: number;
|
|
1508
|
+
/** Immediate textbox-owning anchor, or null in the root story. */
|
|
1509
|
+
readonly textboxOwner: AnchoredDrawingRecord | null;
|
|
1510
|
+
/** Root-to-leaf textbox owners, preserving anchor identity for future exporters. */
|
|
1511
|
+
readonly textboxPath: readonly AnchoredDrawingRecord[];
|
|
1512
|
+
/** Enclosing published fragment; use paragraphId for the authored span owner. */
|
|
1513
|
+
readonly paragraph: ParagraphFragmentRecord;
|
|
1514
|
+
/** Authored paragraph owning this span, including spans merged into another fragment. */
|
|
1515
|
+
readonly paragraphId: string;
|
|
1516
|
+
readonly line: LineRecord;
|
|
1517
|
+
readonly span: StyleSpanRecord;
|
|
1518
|
+
/**
|
|
1519
|
+
* Model address for authored text. Projected atoms intentionally return null even though
|
|
1520
|
+
* their geometry record carries a range used internally by layout.
|
|
1521
|
+
*/
|
|
1522
|
+
readonly sourceRange: SourceRange | null;
|
|
1523
|
+
}
|
|
1524
|
+
/** Return the model address exporters may use, excluding layout-projected atoms. @public */
|
|
1525
|
+
declare function exportSourceRangeOf(span: StyleSpanRecord): SourceRange | null;
|
|
1047
1526
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1527
|
+
* Visit every published span in page/story order without consulting the source package.
|
|
1528
|
+
* @public
|
|
1050
1529
|
*/
|
|
1051
|
-
declare function
|
|
1530
|
+
declare function forEachSemanticSpan(layout: SemanticLayout, visitor: (visit: SemanticSpanVisit) => void): void;
|
|
1531
|
+
|
|
1052
1532
|
/**
|
|
1053
|
-
*
|
|
1533
|
+
* The part of a line that belongs to ONE paragraph.
|
|
1054
1534
|
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
* the
|
|
1059
|
-
*
|
|
1535
|
+
* A line normally belongs to one paragraph outright, and then this is the whole of it — the
|
|
1536
|
+
* same object every caller read before, so nothing about an ordinary document takes a new
|
|
1537
|
+
* path. A resolved display mode merges paragraphs that a tracked decision merges, and the line
|
|
1538
|
+
* carrying the join holds spans from two of them. Offsets there are ambiguous by themselves:
|
|
1539
|
+
* both paragraphs start at zero, so an offset means nothing without the paragraph it counts in.
|
|
1540
|
+
*/
|
|
1541
|
+
interface LineSegment {
|
|
1542
|
+
readonly paragraphId: string;
|
|
1543
|
+
readonly start: number;
|
|
1544
|
+
readonly end: number;
|
|
1545
|
+
readonly spans: readonly StyleSpanRecord[];
|
|
1546
|
+
readonly drawings: readonly InlineDrawingRecord[];
|
|
1547
|
+
}
|
|
1548
|
+
/** Every paragraph a line carries, in visual order. One entry for an ordinary line. */
|
|
1549
|
+
declare function lineSegments(line: LineRecord): readonly LineSegment[];
|
|
1550
|
+
|
|
1551
|
+
/** Memoized style inputs shared by every story in one document view. @public */
|
|
1552
|
+
interface DocumentStyleDependencies {
|
|
1553
|
+
readonly styleCascade: () => StyleCascadeTable | undefined;
|
|
1554
|
+
readonly defaultTabStopPt: () => number;
|
|
1555
|
+
readonly numberingIndex: () => NumberingIndex;
|
|
1556
|
+
}
|
|
1557
|
+
/** Build the cascade and numbering projections layout consumes. @public */
|
|
1558
|
+
declare function createDocumentStyleDependencies(view: HeadlessDocumentView): DocumentStyleDependencies;
|
|
1559
|
+
|
|
1560
|
+
/** Paired projector/cache identities shared by browser, exporters, and future story hosts. */
|
|
1561
|
+
interface StoryProjectionDependencies {
|
|
1562
|
+
readonly tokenForParagraphForPart: (partName: string, paragraph: OoxmlNode) => string;
|
|
1563
|
+
/** Memoized aggregate for every paragraph in an immutable table subtree. */
|
|
1564
|
+
readonly tokenForTableForPart: (partName: string, table: OoxmlNode) => string;
|
|
1565
|
+
readonly epochForPart: (partName: string) => string;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* Sanitized projectors paired with the cache identities required to use them safely.
|
|
1060
1570
|
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1571
|
+
* Keep this object intact when passing it to a document composition helper. Projected text and
|
|
1572
|
+
* its dependency tokens are one contract: accepting either half independently permits stale
|
|
1573
|
+
* paragraph caches after relationship- or property-only revisions.
|
|
1574
|
+
* @public
|
|
1064
1575
|
*/
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1576
|
+
interface DocumentLinkProjectors extends StoryProjectionDependencies {
|
|
1577
|
+
readonly projectLink: HyperlinkProjector;
|
|
1578
|
+
readonly projectLinkForPart: (partName: string) => HyperlinkProjector;
|
|
1579
|
+
}
|
|
1580
|
+
/** Sanitized body and per-part link projectors over one neutral document view. @public */
|
|
1581
|
+
declare function createDocumentLinkProjectors(view: HeadlessDocumentView): DocumentLinkProjectors;
|
|
1582
|
+
|
|
1583
|
+
/** Page geometry for header/footer anchored frame resolution (story-relative layout space). */
|
|
1584
|
+
interface HeaderFooterPageContext {
|
|
1585
|
+
readonly pageNumber: number;
|
|
1586
|
+
readonly pageWidth: number;
|
|
1587
|
+
readonly pageHeight: number;
|
|
1588
|
+
readonly marginLeft: number;
|
|
1589
|
+
readonly marginRight: number;
|
|
1590
|
+
readonly marginTop: number;
|
|
1591
|
+
readonly marginBottom: number;
|
|
1592
|
+
}
|
|
1593
|
+
/** Per-sheet geometry needed to resolve header/footer anchors before wrap and clipping. */
|
|
1594
|
+
interface HeaderFooterLayoutPageContext extends FieldPageContext {
|
|
1595
|
+
/** Effective content-box inset after this page's header/footer reserves are applied. */
|
|
1596
|
+
readonly contentInsetTop?: number;
|
|
1597
|
+
/** Effective bottom content-box inset after footer reserve. */
|
|
1598
|
+
readonly contentInsetBottom?: number;
|
|
1599
|
+
/** Story-box top measured from the physical sheet top. */
|
|
1600
|
+
readonly storyTop?: number;
|
|
1601
|
+
}
|
|
1602
|
+
interface HeaderFooterStoryLayout {
|
|
1603
|
+
readonly partName: string;
|
|
1604
|
+
/**
|
|
1605
|
+
* The part this story was laid out from.
|
|
1606
|
+
*
|
|
1607
|
+
* Carried because a derivation that runs over the finished layout cannot reach it otherwise:
|
|
1608
|
+
* the layout receives furniture as fragments plus a NAME, and a name is not a tree. The
|
|
1609
|
+
* content-control boundary pass needs the tree to know which controls exist at all.
|
|
1610
|
+
*/
|
|
1611
|
+
readonly part?: OoxmlPart;
|
|
1612
|
+
/** Main-document relationship id when the furniture source knows it. */
|
|
1613
|
+
readonly rId?: string;
|
|
1614
|
+
/**
|
|
1615
|
+
* Bounded identity of the story's canonical OOXML content.
|
|
1616
|
+
*
|
|
1617
|
+
* Furniture cache keys must not rely on {@link flowHeight} alone: equal-height A→B edits
|
|
1618
|
+
* would otherwise reuse stale page furniture. Derived as a 16-hex FNV-1a over the part's
|
|
1619
|
+
* canonical fingerprint — never DOM identity or unbounded raw serialization in the key.
|
|
1620
|
+
* PAGE/NUMPAGES/SECTIONPAGES projection shares this key; page context is cached separately.
|
|
1621
|
+
*/
|
|
1622
|
+
readonly contentKey: string;
|
|
1623
|
+
/** Snapshot identity for projected links and live document-property fields in this story. */
|
|
1624
|
+
readonly projectionEpoch?: string;
|
|
1625
|
+
/** Story-relative fragments; origin at the story box's top-left. */
|
|
1626
|
+
readonly fragments: readonly BlockFragmentRecord[];
|
|
1627
|
+
/** The height the blocks actually flow to — what sizes the box on every page. */
|
|
1628
|
+
readonly flowHeight: number;
|
|
1629
|
+
/**
|
|
1630
|
+
* Allowlisted complex PAGE / NUMPAGES / SECTIONPAGES presence detected for this story.
|
|
1631
|
+
*
|
|
1632
|
+
* Callers use this to skip attaching a page-field projector when the baseline is enough.
|
|
1633
|
+
*/
|
|
1634
|
+
readonly pageFieldNeeds: StoryPageFieldNeeds;
|
|
1635
|
+
/** Anchored drawings owned by this story, in story-relative coordinates. */
|
|
1636
|
+
readonly anchoredDrawings?: readonly AnchoredDrawingRecord[];
|
|
1637
|
+
/**
|
|
1638
|
+
* Re-layout this story under page-field and optional attached-page geometry context.
|
|
1639
|
+
*
|
|
1640
|
+
* Field-free stories return `this`. Count-only stories cache by the counts they read.
|
|
1641
|
+
* PAGE stories cache by the distinct evaluated values (including format) with a bounded LRU.
|
|
1642
|
+
*/
|
|
1643
|
+
readonly withPageContext: (ctx: HeaderFooterLayoutPageContext) => HeaderFooterStoryLayout;
|
|
1644
|
+
}
|
|
1068
1645
|
/**
|
|
1069
|
-
*
|
|
1646
|
+
* Story-level inputs the body path has always had and furniture never did.
|
|
1070
1647
|
*
|
|
1071
|
-
*
|
|
1648
|
+
* A BAG, not more positional parameters. The signature below already carries fifteen, and its
|
|
1649
|
+
* own doc comment used to tell new callers to "keep passing `undefined` for what they do not
|
|
1650
|
+
* set" — which is why `numberingIndex` was never added and a numbered paragraph in a header
|
|
1651
|
+
* painted no marker for as long as headers have been editable. Everything new goes here.
|
|
1072
1652
|
*/
|
|
1073
|
-
|
|
1653
|
+
interface HeaderFooterStoryInputs {
|
|
1654
|
+
/**
|
|
1655
|
+
* `numbering.xml`, so a `w:numPr` paragraph in this story resolves a marker — directly or
|
|
1656
|
+
* inside an anchored text box, which lays out with its own per-box counters.
|
|
1657
|
+
*
|
|
1658
|
+
* Absent, the story lays out exactly as before: no marker record, and no numbering indent
|
|
1659
|
+
* merged into the paragraph's own.
|
|
1660
|
+
*/
|
|
1661
|
+
readonly numberingIndex?: NumberingIndex;
|
|
1662
|
+
/** Sanitized hyperlink seams scoped to this header/footer part. */
|
|
1663
|
+
readonly projectLink?: HyperlinkProjector;
|
|
1664
|
+
readonly projectFieldLink?: FieldLinkProjector;
|
|
1665
|
+
/** Per-paragraph identity for links and live document-property projection. */
|
|
1666
|
+
readonly projectionTokenForParagraph?: (paragraph: OoxmlNode) => string;
|
|
1667
|
+
/** Memoized aggregate projection identity for table subtrees. */
|
|
1668
|
+
readonly projectionTokenForTable?: (table: OoxmlNode) => string;
|
|
1669
|
+
/** Aggregate identity of link and live-field projections for furniture reuse keys. */
|
|
1670
|
+
readonly projectionEpoch?: string;
|
|
1671
|
+
/** Reviewers whose changes project as accepted in this story. */
|
|
1672
|
+
readonly revisionAuthorFilter?: RevisionAuthorFilter;
|
|
1673
|
+
}
|
|
1074
1674
|
/**
|
|
1075
|
-
*
|
|
1675
|
+
* Lay one header/footer part out at `contentWidth`.
|
|
1076
1676
|
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1677
|
+
* Line ids are namespaced by part so the body's `line-N` counter — which incremental
|
|
1678
|
+
* convergence compares — never moves because a header changed.
|
|
1679
|
+
*
|
|
1680
|
+
* When `pageContext` is set, allowlisted PAGE/NUMPAGES/SECTIONPAGES instructions project
|
|
1681
|
+
* live values; otherwise those fields contribute only cached result text (often empty).
|
|
1682
|
+
* Field-free stories ignore `pageContext` and share one baseline layout.
|
|
1683
|
+
*
|
|
1684
|
+
* `defaultTabStopPt` is the document's `w:settings/w:defaultTabStop` (ECMA-376 §17.15.1.25)
|
|
1685
|
+
* in points; absent keeps the 0.5" schema default. Furniture tabs on the SAME grid as the
|
|
1686
|
+
* body — a page-number tab in a metric-locale footer belongs on the document's interval, not
|
|
1687
|
+
* on a constant. It sits at the tail because the parameters ahead of it are already
|
|
1688
|
+
* positional; new callers should keep passing `undefined` for what they do not set.
|
|
1689
|
+
*
|
|
1690
|
+
* NEW inputs belong in {@link HeaderFooterStoryInputs}, the trailing bag, rather than as a
|
|
1691
|
+
* sixteenth position. Fifteen is what stopped `numberingIndex` being threaded here at all.
|
|
1079
1692
|
*/
|
|
1080
|
-
declare function
|
|
1081
|
-
|
|
1082
|
-
|
|
1693
|
+
declare function layoutHeaderFooterStory(part: OoxmlPart, contentWidth: number, measurer: TextMeasurer, producer: string, cache?: ParagraphLayoutCache<readonly PendingLine[]>, styleCascade?: StyleCascadeTable, pageContext?: FieldPageContext, maxPageContextEntries?: number, defaultTabStopPt?: number, displayMode?: RevisionDisplayMode, inlineDrawingLayout?: InlineDrawingLayoutContext, drawingTokenForParagraph?: (paragraph: OoxmlNode) => string, drawingLayoutToken?: string, hfPageContext?: HeaderFooterPageContext, documentProperties?: DocumentProperties, inputs?: HeaderFooterStoryInputs): HeaderFooterStoryLayout;
|
|
1694
|
+
|
|
1695
|
+
/** Which header/footer variant a page shows (ECMA-376 §17.10.5). */
|
|
1696
|
+
type HeaderFooterVariantName = 'default' | 'first' | 'even';
|
|
1697
|
+
/**
|
|
1698
|
+
* Pre-laid page furniture, supplied by the host (phase 2).
|
|
1699
|
+
*
|
|
1700
|
+
* Baseline stories are laid out once per variant (`layoutHeaderFooterStory`) for furniture
|
|
1701
|
+
* height. Stories that actually contain allowlisted PAGE/NUMPAGES fields attach a projector
|
|
1702
|
+
* so document-level finalize can re-layout under the known page count; field-free furniture
|
|
1703
|
+
* reuses the baseline on every sheet.
|
|
1704
|
+
*/
|
|
1705
|
+
interface PageFurniture {
|
|
1706
|
+
readonly titlePage: boolean;
|
|
1707
|
+
readonly evenAndOddHeaders: boolean;
|
|
1708
|
+
readonly headers: ReadonlyMap<HeaderFooterVariantName, HeaderFooterStoryLayout>;
|
|
1709
|
+
readonly footers: ReadonlyMap<HeaderFooterVariantName, HeaderFooterStoryLayout>;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/** Page furniture supplied to semantic layout. @public */
|
|
1713
|
+
interface DocumentFurnitureSource {
|
|
1714
|
+
furniture(): PageFurniture | undefined;
|
|
1715
|
+
sectionFurniture(): readonly (PageFurniture | undefined)[];
|
|
1716
|
+
}
|
|
1717
|
+
/** Inputs that remain valid for the lifetime of one furniture source. @public */
|
|
1718
|
+
interface CreateDocumentFurnitureSourceOptions {
|
|
1719
|
+
readonly view: HeadlessDocumentView;
|
|
1720
|
+
readonly measurer: TextMeasurer;
|
|
1721
|
+
readonly producer: string;
|
|
1722
|
+
readonly cache: ParagraphLayoutCache<readonly PendingLine[]>;
|
|
1723
|
+
readonly styleCascade?: () => StyleCascadeTable | undefined;
|
|
1724
|
+
readonly numberingIndex?: () => NumberingIndex;
|
|
1725
|
+
readonly defaultTabStopPt?: () => number;
|
|
1726
|
+
readonly displayMode?: RevisionDisplayMode;
|
|
1727
|
+
readonly revisionAuthorFilter?: RevisionAuthorFilter;
|
|
1728
|
+
readonly inlineDrawingLayoutForPart?: (partName: string) => InlineDrawingLayoutContext | undefined;
|
|
1729
|
+
readonly drawingLayoutTokenForPart?: (partName: string) => string;
|
|
1730
|
+
readonly drawingTokenForParagraphForPart?: (partName: string, paragraph: OoxmlNode) => string;
|
|
1731
|
+
/** Link/property projection and its inseparable cache identities. */
|
|
1732
|
+
readonly linkProjectors: DocumentLinkProjectors;
|
|
1733
|
+
readonly projectFieldLink?: FieldLinkProjector;
|
|
1734
|
+
}
|
|
1735
|
+
/** Build section-aware header/footer layout from a neutral document view. @public */
|
|
1736
|
+
declare function createDocumentFurnitureSource(options: CreateDocumentFurnitureSourceOptions): DocumentFurnitureSource;
|
|
1083
1737
|
|
|
1084
1738
|
/**
|
|
1085
1739
|
* Where one note is referenced from — what per-page and per-section restart rules are computed
|
|
@@ -1238,6 +1892,8 @@ interface LayoutNoteStoryOptions {
|
|
|
1238
1892
|
*/
|
|
1239
1893
|
readonly projectLinkForPart?: (ownerPartName: string) => HyperlinkProjector | undefined;
|
|
1240
1894
|
readonly projectFieldLink?: FieldLinkProjector;
|
|
1895
|
+
readonly projectionTokenForParagraphForPart?: (ownerPartName: string, paragraph: OoxmlNode) => string;
|
|
1896
|
+
readonly projectionTokenForTableForPart?: (ownerPartName: string, table: OoxmlNode) => string;
|
|
1241
1897
|
/** Document properties for a document-property field inside a note story. */
|
|
1242
1898
|
readonly documentProperties?: DocumentProperties;
|
|
1243
1899
|
/**
|
|
@@ -1293,7 +1949,7 @@ declare function defaultNoteSeparatorRuleStyle(_noteKind: NoteKind, _kind: 'sepa
|
|
|
1293
1949
|
* True when a separator note contains only OOXML separator markers (and empty noteRef
|
|
1294
1950
|
* atoms Word often authors beside them) — no measurable text or paragraph borders.
|
|
1295
1951
|
*/
|
|
1296
|
-
declare function isMarkerOnlySeparatorNote(note: OoxmlNode): boolean;
|
|
1952
|
+
declare function isMarkerOnlySeparatorNote(note: OoxmlNode, displayMode?: RevisionDisplayMode, revisionAuthorFilter?: RevisionAuthorFilter): boolean;
|
|
1297
1953
|
/**
|
|
1298
1954
|
* Layout the document's separator note, or synthesize a short horizontal rule.
|
|
1299
1955
|
*
|
|
@@ -1403,6 +2059,12 @@ interface NotesLayoutInput {
|
|
|
1403
2059
|
* the same fail-closed rule `drawingsForPart` follows through `drawingLayoutEpoch`.
|
|
1404
2060
|
*/
|
|
1405
2061
|
readonly linkRelsEpoch?: string;
|
|
2062
|
+
/** Per-notes-part paragraph identity for projected links and metadata fields. */
|
|
2063
|
+
readonly projectionTokenForParagraphForPart?: (ownerPartName: string, paragraph: OoxmlNode) => string;
|
|
2064
|
+
/** Memoized table aggregate counterpart to `projectionTokenForParagraphForPart`. */
|
|
2065
|
+
readonly projectionTokenForTableForPart?: (ownerPartName: string, table: OoxmlNode) => string;
|
|
2066
|
+
/** Combined notes-part freshness signal; outer memo only, never a paragraph producer. */
|
|
2067
|
+
readonly projectionEpoch?: string;
|
|
1406
2068
|
readonly projectFieldLink?: FieldLinkProjector;
|
|
1407
2069
|
/** Document properties for a document-property field inside a note story. */
|
|
1408
2070
|
readonly documentProperties?: DocumentProperties;
|
|
@@ -1475,140 +2137,113 @@ passMemo?: unknown,
|
|
|
1475
2137
|
* (a block the body pass declined to split under a known budget only moves whole);
|
|
1476
2138
|
* absent, the hold-out releases the ambiguous cases — a caller outside the reflow loop
|
|
1477
2139
|
* must not manufacture holds the loop never observed.
|
|
1478
|
-
*/
|
|
1479
|
-
previousReserves?: ReadonlyMap<number, number>): {
|
|
1480
|
-
readonly reserves: ReadonlyMap<number, number>;
|
|
1481
|
-
readonly stable: boolean;
|
|
1482
|
-
readonly reasons: readonly NotePaginationFallbackReason[];
|
|
1483
|
-
};
|
|
1484
|
-
/**
|
|
1485
|
-
* Attach footnote/endnote areas onto a body layout. Does not re-paginate — callers that
|
|
1486
|
-
* need reservation must re-run body layout with {@link pageBottomReserves} first.
|
|
1487
|
-
*/
|
|
1488
|
-
declare function attachNotesToLayout(layout: SemanticLayout, allRefs: readonly PageRefHit[], input: NotesLayoutInput, options?: {
|
|
1489
|
-
readonly fallbackReasons?: readonly NotePaginationFallbackReason[];
|
|
1490
|
-
readonly paragraphSectionIndex?: ReadonlyMap<string, number>;
|
|
1491
|
-
/**
|
|
1492
|
-
* Session-carried notes memo, already validated against `allRefs` and `input`.
|
|
1493
|
-
* Opaque at this boundary; the shape is owned by this module.
|
|
1494
|
-
*/
|
|
1495
|
-
readonly memo?: unknown;
|
|
1496
|
-
}): NotesAttachResult;
|
|
1497
|
-
/**
|
|
1498
|
-
* Build a continuous (pre-page) mark context for the first body layout pass.
|
|
1499
|
-
* eachPage reserves digit width; {@link reprojectBodyNoteMarks} publishes final marks
|
|
1500
|
-
* onto body citations after page assignment in {@link attachNotesToLayout}.
|
|
1501
|
-
*/
|
|
1502
|
-
declare function provisionalNoteMarks(refs: readonly PageRefHit[], input: NotesLayoutInput): NoteMarkContext;
|
|
1503
|
-
|
|
1504
|
-
/** Page geometry for header/footer anchored frame resolution (story-relative layout space). */
|
|
1505
|
-
interface HeaderFooterPageContext {
|
|
1506
|
-
readonly pageNumber: number;
|
|
1507
|
-
readonly pageWidth: number;
|
|
1508
|
-
readonly pageHeight: number;
|
|
1509
|
-
readonly marginLeft: number;
|
|
1510
|
-
readonly marginRight: number;
|
|
1511
|
-
readonly marginTop: number;
|
|
1512
|
-
readonly marginBottom: number;
|
|
1513
|
-
}
|
|
1514
|
-
interface HeaderFooterStoryLayout {
|
|
1515
|
-
readonly partName: string;
|
|
1516
|
-
/**
|
|
1517
|
-
* The part this story was laid out from.
|
|
1518
|
-
*
|
|
1519
|
-
* Carried because a derivation that runs over the finished layout cannot reach it otherwise:
|
|
1520
|
-
* the layout receives furniture as fragments plus a NAME, and a name is not a tree. The
|
|
1521
|
-
* content-control boundary pass needs the tree to know which controls exist at all.
|
|
1522
|
-
*/
|
|
1523
|
-
readonly part?: OoxmlPart;
|
|
1524
|
-
/** Main-document relationship id when the furniture source knows it. */
|
|
1525
|
-
readonly rId?: string;
|
|
1526
|
-
/**
|
|
1527
|
-
* Bounded identity of the story's canonical OOXML content.
|
|
1528
|
-
*
|
|
1529
|
-
* Furniture cache keys must not rely on {@link flowHeight} alone: equal-height A→B edits
|
|
1530
|
-
* would otherwise reuse stale page furniture. Derived as a 16-hex FNV-1a over the part's
|
|
1531
|
-
* canonical fingerprint — never DOM identity or unbounded raw serialization in the key.
|
|
1532
|
-
* PAGE/NUMPAGES/SECTIONPAGES projection shares this key; page context is cached separately.
|
|
1533
|
-
*/
|
|
1534
|
-
readonly contentKey: string;
|
|
1535
|
-
/** Story-relative fragments; origin at the story box's top-left. */
|
|
1536
|
-
readonly fragments: readonly BlockFragmentRecord[];
|
|
1537
|
-
/** The height the blocks actually flow to — what sizes the box on every page. */
|
|
1538
|
-
readonly flowHeight: number;
|
|
1539
|
-
/**
|
|
1540
|
-
* Allowlisted complex PAGE / NUMPAGES / SECTIONPAGES presence detected for this story.
|
|
1541
|
-
*
|
|
1542
|
-
* Callers use this to skip attaching a page-field projector when the baseline is enough.
|
|
1543
|
-
*/
|
|
1544
|
-
readonly pageFieldNeeds: StoryPageFieldNeeds;
|
|
1545
|
-
/** Anchored drawings owned by this story, in story-relative coordinates. */
|
|
1546
|
-
readonly anchoredDrawings?: readonly AnchoredDrawingRecord[];
|
|
1547
|
-
/**
|
|
1548
|
-
* Re-layout this story under a page-field context.
|
|
1549
|
-
*
|
|
1550
|
-
* Field-free stories return `this`. Count-only stories cache by the counts they read.
|
|
1551
|
-
* PAGE stories cache by the distinct evaluated values (including format) with a bounded LRU.
|
|
1552
|
-
*/
|
|
1553
|
-
readonly withPageContext: (ctx: FieldPageContext) => HeaderFooterStoryLayout;
|
|
1554
|
-
}
|
|
2140
|
+
*/
|
|
2141
|
+
previousReserves?: ReadonlyMap<number, number>): {
|
|
2142
|
+
readonly reserves: ReadonlyMap<number, number>;
|
|
2143
|
+
readonly stable: boolean;
|
|
2144
|
+
readonly reasons: readonly NotePaginationFallbackReason[];
|
|
2145
|
+
};
|
|
1555
2146
|
/**
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1558
|
-
* A BAG, not more positional parameters. The signature below already carries fifteen, and its
|
|
1559
|
-
* own doc comment used to tell new callers to "keep passing `undefined` for what they do not
|
|
1560
|
-
* set" — which is why `numberingIndex` was never added and a numbered paragraph in a header
|
|
1561
|
-
* painted no marker for as long as headers have been editable. Everything new goes here.
|
|
2147
|
+
* Attach footnote/endnote areas onto a body layout. Does not re-paginate — callers that
|
|
2148
|
+
* need reservation must re-run body layout with {@link pageBottomReserves} first.
|
|
1562
2149
|
*/
|
|
1563
|
-
|
|
2150
|
+
declare function attachNotesToLayout(layout: SemanticLayout, allRefs: readonly PageRefHit[], input: NotesLayoutInput, options?: {
|
|
2151
|
+
readonly fallbackReasons?: readonly NotePaginationFallbackReason[];
|
|
2152
|
+
readonly paragraphSectionIndex?: ReadonlyMap<string, number>;
|
|
1564
2153
|
/**
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1568
|
-
* Absent, the story lays out exactly as before: no marker record, and no numbering indent
|
|
1569
|
-
* merged into the paragraph's own.
|
|
2154
|
+
* Session-carried notes memo, already validated against `allRefs` and `input`.
|
|
2155
|
+
* Opaque at this boundary; the shape is owned by this module.
|
|
1570
2156
|
*/
|
|
1571
|
-
readonly
|
|
1572
|
-
|
|
2157
|
+
readonly memo?: unknown;
|
|
2158
|
+
}): NotesAttachResult;
|
|
2159
|
+
/**
|
|
2160
|
+
* Build a continuous (pre-page) mark context for the first body layout pass.
|
|
2161
|
+
* eachPage reserves digit width; {@link reprojectBodyNoteMarks} publishes final marks
|
|
2162
|
+
* onto body citations after page assignment in {@link attachNotesToLayout}.
|
|
2163
|
+
*/
|
|
2164
|
+
declare function provisionalNoteMarks(refs: readonly PageRefHit[], input: NotesLayoutInput): NoteMarkContext;
|
|
2165
|
+
|
|
2166
|
+
/** Inputs for projecting notes through the same semantic layout pass. @public */
|
|
2167
|
+
interface CreateDocumentNotesInputOptions {
|
|
2168
|
+
readonly view: HeadlessDocumentView;
|
|
2169
|
+
readonly measurer: TextMeasurer;
|
|
2170
|
+
readonly producer: string;
|
|
2171
|
+
readonly cache: Parameters<typeof layoutHeaderFooterStory>[4];
|
|
2172
|
+
readonly styleCascade?: () => StyleCascadeTable | undefined;
|
|
2173
|
+
readonly numberingIndex?: () => NumberingIndex;
|
|
2174
|
+
readonly defaultTabStopPt?: number;
|
|
2175
|
+
readonly inlineDrawingLayoutForPart?: (partName: string) => InlineDrawingLayoutContext | undefined;
|
|
2176
|
+
readonly drawingTokenForParagraphForPart?: (partName: string, paragraph: OoxmlNode) => string;
|
|
2177
|
+
readonly drawingLayoutEpochForPart?: (partName: string) => string;
|
|
2178
|
+
/** Link/property projection and its inseparable cache identities. */
|
|
2179
|
+
readonly linkProjectors: DocumentLinkProjectors;
|
|
2180
|
+
readonly projectFieldLink?: NotesLayoutInput['projectFieldLink'];
|
|
2181
|
+
readonly displayMode?: RevisionDisplayMode;
|
|
1573
2182
|
readonly revisionAuthorFilter?: RevisionAuthorFilter;
|
|
1574
2183
|
}
|
|
2184
|
+
/** Build note layout input from the neutral package view, or undefined when unused. @public */
|
|
2185
|
+
declare function createDocumentNotesInput(options: CreateDocumentNotesInputOptions): NotesLayoutInput | undefined;
|
|
2186
|
+
/** Resolve a relationship in a non-body story for shared link projection. @public */
|
|
2187
|
+
declare function documentRelationshipTargetIn(view: HeadlessDocumentView, partName: string, relationshipId: string): ReturnType<typeof relationshipTargetIn>;
|
|
2188
|
+
|
|
2189
|
+
/** Sanitized field link retained for interactive consumers. @public */
|
|
2190
|
+
interface RegisteredFieldLink {
|
|
2191
|
+
readonly id: string;
|
|
2192
|
+
readonly paragraphId: '';
|
|
2193
|
+
readonly start: 0;
|
|
2194
|
+
readonly end: 0;
|
|
2195
|
+
readonly text: '';
|
|
2196
|
+
readonly kind: 'external' | 'internal' | 'unresolved';
|
|
2197
|
+
readonly href: string | null;
|
|
2198
|
+
readonly authored: string;
|
|
2199
|
+
readonly anchor?: string;
|
|
2200
|
+
readonly tooltip?: string;
|
|
2201
|
+
}
|
|
2202
|
+
/** Per-layout registry for projected HYPERLINK fields. @public */
|
|
2203
|
+
interface FieldLinkRegistry {
|
|
2204
|
+
project(spec: HyperlinkFieldSpec): SpanLinkRecord | null;
|
|
2205
|
+
linkById(linkId: string): RegisteredFieldLink | null;
|
|
2206
|
+
clear(): void;
|
|
2207
|
+
}
|
|
2208
|
+
/** Create a bounded, content-keyed field-link registry. @public */
|
|
2209
|
+
declare function createFieldLinkRegistry(): FieldLinkRegistry;
|
|
2210
|
+
|
|
1575
2211
|
/**
|
|
1576
|
-
*
|
|
1577
|
-
*
|
|
1578
|
-
|
|
1579
|
-
|
|
2212
|
+
* Strict hex fill: exactly six hex digits. Rejects `auto`, `nil`, and any non-hex payload
|
|
2213
|
+
* (CSS functions, URLs, short hex, theme tokens).
|
|
2214
|
+
*/
|
|
2215
|
+
declare function resolveStrictHexFill(raw: string | undefined): string | undefined;
|
|
2216
|
+
/**
|
|
2217
|
+
* Resolve a `w:shd` attribute bag to a validated RRGGBB fill, or undefined.
|
|
1580
2218
|
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
2219
|
+
* `w:themeFill` is a REFERENCE, and Word always writes the value it resolved to alongside
|
|
2220
|
+
* it: `<w:shd w:val="clear" w:fill="D9E2F3" w:themeFill="accent1" w:themeFillTint="33"/>`.
|
|
2221
|
+
* Reading `w:fill` in that case is not inventing a colour from the theme — it is reading
|
|
2222
|
+
* the colour the producer computed. Dropping the fill because a theme reference sat next
|
|
2223
|
+
* to it left every accent-shaded cell and paragraph unpainted.
|
|
1584
2224
|
*
|
|
1585
|
-
* `
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
|
|
1589
|
-
|
|
2225
|
+
* `val="nil"` clears shading. Pattern vals are not rendered; a valid solid `fill` still
|
|
2226
|
+
* paints as a clear fill until pattern support lands. A theme reference with no usable
|
|
2227
|
+
* `w:fill` still resolves to nothing rather than a guess.
|
|
2228
|
+
*/
|
|
2229
|
+
declare function resolveOoxmlShadingFill(attributes: Readonly<Record<string, string>> | undefined): string | undefined;
|
|
2230
|
+
/** Read `w:shd` from a typed/generic element (table `tcPr`, nested `pPr`, …). */
|
|
2231
|
+
declare function shadingFillFromElement(shd: OoxmlElement | undefined): string | undefined;
|
|
2232
|
+
/**
|
|
2233
|
+
* Resolve paragraph shading from cascaded flat `w:pPr` properties.
|
|
1590
2234
|
*
|
|
1591
|
-
*
|
|
1592
|
-
* sixteenth position. Fifteen is what stopped `numberingIndex` being threaded here at all.
|
|
2235
|
+
* Later `w:shd` entries win (defaults → style → direct), matching spacing/border cascade.
|
|
1593
2236
|
*/
|
|
1594
|
-
declare function
|
|
1595
|
-
|
|
1596
|
-
/** Which header/footer variant a page shows (ECMA-376 §17.10.5). */
|
|
1597
|
-
type HeaderFooterVariantName = 'default' | 'first' | 'even';
|
|
2237
|
+
declare function paragraphShading(props: readonly OoxmlProperty[]): string | undefined;
|
|
1598
2238
|
/**
|
|
1599
|
-
*
|
|
2239
|
+
* Page-content box for paragraph shading: union of this fragment's line boxes.
|
|
1600
2240
|
*
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
* so document-level finalize can re-layout under the known page count; field-free furniture
|
|
1604
|
-
* reuses the baseline on every sheet.
|
|
2241
|
+
* Excludes collapsed before/after spacing and bottom-border extent so the painted band
|
|
2242
|
+
* matches Word's content-area fill (character shading height on a single line).
|
|
1605
2243
|
*/
|
|
1606
|
-
|
|
1607
|
-
readonly
|
|
1608
|
-
|
|
1609
|
-
readonly headers: ReadonlyMap<HeaderFooterVariantName, HeaderFooterStoryLayout>;
|
|
1610
|
-
readonly footers: ReadonlyMap<HeaderFooterVariantName, HeaderFooterStoryLayout>;
|
|
1611
|
-
}
|
|
2244
|
+
declare function paragraphShadingBox(lines: readonly {
|
|
2245
|
+
readonly box: LayoutBox;
|
|
2246
|
+
}[], x: number, width: number): LayoutBox | undefined;
|
|
1612
2247
|
|
|
1613
2248
|
/**
|
|
1614
2249
|
* A deterministic measurer for tests and headless use.
|
|
@@ -1678,6 +2313,8 @@ interface SemanticLayoutOptions {
|
|
|
1678
2313
|
* the recompute path — the memo must never miss a token move it cannot see.
|
|
1679
2314
|
*/
|
|
1680
2315
|
readonly drawingLayoutEpoch?: string;
|
|
2316
|
+
/** Part-level freshness signal for paragraph-local semantic projection tokens. */
|
|
2317
|
+
readonly projectionEpoch?: string;
|
|
1681
2318
|
/**
|
|
1682
2319
|
* Who produced the measurements, folded into every cache key.
|
|
1683
2320
|
*
|
|
@@ -1785,6 +2422,10 @@ interface SemanticLayoutOptions {
|
|
|
1785
2422
|
readonly inlineDrawingLayout?: InlineDrawingLayoutContext;
|
|
1786
2423
|
/** Per-paragraph drawing projection/resource token for break cache keys. */
|
|
1787
2424
|
readonly drawingTokenForParagraph?: (paragraph: OoxmlNode) => string;
|
|
2425
|
+
/** Per-paragraph identity for projected links and live document-property text. */
|
|
2426
|
+
readonly projectionTokenForParagraph?: (paragraph: OoxmlNode) => string;
|
|
2427
|
+
/** Memoized aggregate projection identity for an immutable table subtree. */
|
|
2428
|
+
readonly projectionTokenForTable?: (table: OoxmlNode) => string;
|
|
1788
2429
|
/** @deprecated Prefer {@link drawingTokenForParagraph}. */
|
|
1789
2430
|
readonly drawingLayoutToken?: string;
|
|
1790
2431
|
/** Internal: reflow pass index while wrap exclusions converge. */
|
|
@@ -2112,343 +2753,97 @@ interface ReviewParagraphAnchor {
|
|
|
2112
2753
|
readonly paragraphId: string;
|
|
2113
2754
|
readonly end: number;
|
|
2114
2755
|
};
|
|
2115
|
-
}[];
|
|
2116
|
-
}[];
|
|
2117
|
-
}
|
|
2118
|
-
/**
|
|
2119
|
-
* The y of the line a position sits on, measured from the anchor's own origin.
|
|
2120
|
-
*
|
|
2121
|
-
* An ordinary line answers from its own range, exactly as it always did. On a merged
|
|
2122
|
-
* fragment's join line the range names one of the two paragraphs, so an offset compared
|
|
2123
|
-
* against it either overshot — putting a card in the absorbed half beside the wrong line —
|
|
2124
|
-
* or matched the first line every time.
|
|
2125
|
-
*/
|
|
2126
|
-
declare function anchorLineY(anchor: ReviewParagraphAnchor, paragraphId: string, offset: number): number;
|
|
2127
|
-
/**
|
|
2128
|
-
* Paragraph id to its place on the page, in ONE pass over the layout.
|
|
2129
|
-
*
|
|
2130
|
-
* Built once per layout and reused by every card. The straightforward version — scan the
|
|
2131
|
-
* pages until the paragraph turns up, per card — is a full-document walk per card, and a
|
|
2132
|
-
* contract with two hundred comments walked the document two hundred times every time the
|
|
2133
|
-
* caret moved. Toggling the pane was visibly slow for exactly that reason.
|
|
2134
|
-
*/
|
|
2135
|
-
declare function reviewAnchorIndex<TPage extends {
|
|
2136
|
-
readonly index: number;
|
|
2137
|
-
readonly contentBox: {
|
|
2138
|
-
readonly y: number;
|
|
2139
|
-
};
|
|
2140
|
-
}>(layout: {
|
|
2141
|
-
readonly pages: readonly TPage[];
|
|
2142
|
-
}, paragraphFragments: (page: TPage) => readonly {
|
|
2143
|
-
readonly paragraphId: string;
|
|
2144
|
-
readonly box: {
|
|
2145
|
-
readonly y: number;
|
|
2146
|
-
};
|
|
2147
|
-
readonly lines?: readonly {
|
|
2148
|
-
readonly range: {
|
|
2149
|
-
readonly end: number;
|
|
2150
|
-
};
|
|
2151
|
-
readonly box: {
|
|
2152
|
-
readonly y: number;
|
|
2153
|
-
};
|
|
2154
|
-
/** Present on a real line; a merged one carries spans from more than one paragraph. */
|
|
2155
|
-
readonly spans?: readonly {
|
|
2156
|
-
readonly range: {
|
|
2157
|
-
readonly paragraphId: string;
|
|
2158
|
-
readonly end: number;
|
|
2159
|
-
};
|
|
2160
|
-
}[];
|
|
2161
|
-
}[];
|
|
2162
|
-
}[]): Map<string, ReviewParagraphAnchor>;
|
|
2163
|
-
/**
|
|
2164
|
-
* Where a card belongs beside the page, from LAYOUT RECORDS.
|
|
2165
|
-
*
|
|
2166
|
-
* The one question the tree cannot answer, and the one a surface must not answer for itself:
|
|
2167
|
-
* measuring painted DOM puts the sidebar a repaint behind the document and breaks outright
|
|
2168
|
-
* while pagination is in flight.
|
|
2169
|
-
*
|
|
2170
|
-
* Returns null when the item has no resolvable range, or when its paragraph is not in this
|
|
2171
|
-
* layout — a comment anchored in a header belongs to a story the body layout never saw.
|
|
2172
|
-
*/
|
|
2173
|
-
declare function reviewItemGeometry(item: ReviewItem, index: ReadonlyMap<string, ReviewParagraphAnchor>): {
|
|
2174
|
-
readonly pageIndex: number;
|
|
2175
|
-
readonly y: number;
|
|
2176
|
-
} | null;
|
|
2177
|
-
|
|
2178
|
-
/** The visible band of the document, in layout units. */
|
|
2179
|
-
interface ViewportWindow {
|
|
2180
|
-
/** Distance from the top of the document to the top of the visible area, in layout units. */
|
|
2181
|
-
readonly top: number;
|
|
2182
|
-
readonly height: number;
|
|
2183
|
-
}
|
|
2184
|
-
/**
|
|
2185
|
-
* Which pages to build in detail.
|
|
2186
|
-
*
|
|
2187
|
-
* A page left out keeps its size and position but no content, so the document's height and page
|
|
2188
|
-
* count are unchanged and scrolling to it reveals it rather than reflowing everything below.
|
|
2189
|
-
*/
|
|
2190
|
-
interface MaterializationInput {
|
|
2191
|
-
readonly layout: SemanticLayout;
|
|
2192
|
-
/** Omitted means "no viewport": everything is materialized, which is the honest default. */
|
|
2193
|
-
readonly viewport?: ViewportWindow;
|
|
2194
|
-
/** Extra pages kept ready either side of the visible band. */
|
|
2195
|
-
readonly overscanPages?: number;
|
|
2196
|
-
/** Pages that must be built wherever they are — caret, selection, a search hit. */
|
|
2197
|
-
readonly pinnedPages?: Iterable<number>;
|
|
2198
|
-
}
|
|
2199
|
-
/**
|
|
2200
|
-
* The page indices to build in detail.
|
|
2201
|
-
*
|
|
2202
|
-
* Returns indices rather than records so a caller can compare cheaply against what it
|
|
2203
|
-
* already has mounted, and so the decision can be made without touching the layout.
|
|
2204
|
-
*/
|
|
2205
|
-
declare function pagesToMaterialize(input: MaterializationInput): Set<number>;
|
|
2206
|
-
|
|
2207
|
-
/** Far above anything Word authors (its UI caps at 63) while keeping allocation bounded. */
|
|
2208
|
-
declare const MAX_TABLE_COLUMNS = 1024;
|
|
2209
|
-
|
|
2210
|
-
/**
|
|
2211
|
-
* `w:tblW` / `w:tcW` / `w:wBefore` (CT_TblWidth, 17.4.63 / 17.4.71 / 17.4.86): a PREFERRED
|
|
2212
|
-
* width plus the unit it is stated in. Preferred is the operative word — it is what the
|
|
2213
|
-
* producer asked for, not what the table resolved to.
|
|
2214
|
-
*
|
|
2215
|
-
* `pct` is stated in fiftieths of a percent (5000 = 100%) by Word, and in the `"50%"`
|
|
2216
|
-
* string form of `ST_Percentage` by others; both are read. `auto` and `nil` carry no width.
|
|
2217
|
-
*/
|
|
2218
|
-
type PreferredWidthType = 'dxa' | 'pct' | 'auto' | 'nil';
|
|
2219
|
-
/**
|
|
2220
|
-
* `w:tblW` / `w:tcW` — a requested width, whose UNIT depends on its type.
|
|
2221
|
-
*
|
|
2222
|
-
* Points for `dxa`, percent for `pct`, and zero for `auto`/`nil`. Reading `value` without `type`
|
|
2223
|
-
* is always wrong.
|
|
2224
|
-
*/
|
|
2225
|
-
interface PreferredWidth {
|
|
2226
|
-
readonly type: PreferredWidthType;
|
|
2227
|
-
/** POINTS for `dxa`, PERCENT (0–100) for `pct`, 0 for `auto`/`nil`. */
|
|
2228
|
-
readonly value: number;
|
|
2229
|
-
}
|
|
2230
|
-
/** The frozen "no preferred width" value — what a table or cell that declares none resolves to. */
|
|
2231
|
-
declare const AUTO_PREFERRED_WIDTH: PreferredWidth;
|
|
2232
|
-
|
|
2233
|
-
/**
|
|
2234
|
-
* The uniform 3 pt (60 twip) inset this lane used to apply on every side.
|
|
2235
|
-
*
|
|
2236
|
-
* Word's defaults are not uniform — see {@link DEFAULT_CELL_MARGINS} — so nothing resolves
|
|
2237
|
-
* against this any more. Kept because it is published.
|
|
2238
|
-
*/
|
|
2239
|
-
declare const CELL_PAD = 3;
|
|
2240
|
-
/** Resolved cell padding in points, after the table default and any per-cell override. */
|
|
2241
|
-
interface CellMarginsPt {
|
|
2242
|
-
readonly top: number;
|
|
2243
|
-
readonly right: number;
|
|
2244
|
-
readonly bottom: number;
|
|
2245
|
-
readonly left: number;
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* Word's own default cell padding, for a document whose styles part states none.
|
|
2249
|
-
*
|
|
2250
|
-
* 0 top, 0 bottom, 108 twips left and right — the values `TableNormal` carries. A uniform
|
|
2251
|
-
* 3 pt on all four sides made every row of every table that authored no `w:tblCellMar` 6 pt
|
|
2252
|
-
* taller than Word's, and that error compounds down a table until it paginates a page early.
|
|
2253
|
-
* A document that DOES ship a default table style resolves against that instead; this is the
|
|
2254
|
-
* floor beneath it.
|
|
2255
|
-
*/
|
|
2256
|
-
declare const DEFAULT_CELL_MARGINS: CellMarginsPt;
|
|
2257
|
-
|
|
2258
|
-
/**
|
|
2259
|
-
* Layout-time nesting ceiling. Parse-time depth (MAX_DEPTH = 256 XML levels) alone still
|
|
2260
|
-
* admits ~80 levels of `w:tbl` recursion into the layout walk; deeper tables render as an
|
|
2261
|
-
* empty cell box rather than recursing.
|
|
2262
|
-
*/
|
|
2263
|
-
declare const MAX_TABLE_NESTING = 16;
|
|
2264
|
-
/**
|
|
2265
|
-
* Soft ceiling on an authored `w:trHeight` (~22"). Hostile `w:val` otherwise becomes a
|
|
2266
|
-
* multi-page row that every pagination preflight and cell box inherits.
|
|
2267
|
-
*/
|
|
2268
|
-
declare const MAX_TABLE_ROW_HEIGHT_PT: number;
|
|
2756
|
+
}[];
|
|
2757
|
+
}[];
|
|
2758
|
+
}
|
|
2269
2759
|
/**
|
|
2270
|
-
*
|
|
2271
|
-
* twips convert once here, matching every other table geometry boundary.
|
|
2760
|
+
* The y of the line a position sits on, measured from the anchor's own origin.
|
|
2272
2761
|
*
|
|
2273
|
-
*
|
|
2274
|
-
*
|
|
2762
|
+
* An ordinary line answers from its own range, exactly as it always did. On a merged
|
|
2763
|
+
* fragment's join line the range names one of the two paragraphs, so an offset compared
|
|
2764
|
+
* against it either overshot — putting a card in the absorbed half beside the wrong line —
|
|
2765
|
+
* or matched the first line every time.
|
|
2275
2766
|
*/
|
|
2276
|
-
|
|
2767
|
+
declare function anchorLineY(anchor: ReviewParagraphAnchor, paragraphId: string, offset: number): number;
|
|
2277
2768
|
/**
|
|
2278
|
-
*
|
|
2769
|
+
* Paragraph id to its place on the page, in ONE pass over the layout.
|
|
2279
2770
|
*
|
|
2280
|
-
*
|
|
2281
|
-
*
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
readonly rule: 'auto';
|
|
2285
|
-
} | {
|
|
2286
|
-
readonly rule: 'atLeast' | 'exact';
|
|
2287
|
-
readonly valuePt: number;
|
|
2288
|
-
};
|
|
2289
|
-
/** `w:vAlign` — where a cell's content sits when the row is taller than the content. */
|
|
2290
|
-
type CellVerticalAlign = 'top' | 'center' | 'bottom';
|
|
2291
|
-
/** `w:tblPr/w:jc` (17.4.29, ST_JcTable): where the table sits within the text column. */
|
|
2292
|
-
type TableAlignment = 'left' | 'center' | 'right';
|
|
2293
|
-
/**
|
|
2294
|
-
* `w:tblpPr/@w:horzAnchor` (17.4.58) and `@w:vertAnchor` (17.4.66): the box a floated
|
|
2295
|
-
* table's offsets are measured from. Absent means `text` for both.
|
|
2771
|
+
* Built once per layout and reused by every card. The straightforward version — scan the
|
|
2772
|
+
* pages until the paragraph turns up, per card — is a full-document walk per card, and a
|
|
2773
|
+
* contract with two hundred comments walked the document two hundred times every time the
|
|
2774
|
+
* caret moved. Toggling the pane was visibly slow for exactly that reason.
|
|
2296
2775
|
*/
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2776
|
+
declare function reviewAnchorIndex<TPage extends {
|
|
2777
|
+
readonly index: number;
|
|
2778
|
+
readonly contentBox: {
|
|
2779
|
+
readonly y: number;
|
|
2780
|
+
};
|
|
2781
|
+
}>(layout: {
|
|
2782
|
+
readonly pages: readonly TPage[];
|
|
2783
|
+
}, paragraphFragments: (page: TPage) => readonly {
|
|
2784
|
+
readonly paragraphId: string;
|
|
2785
|
+
readonly box: {
|
|
2786
|
+
readonly y: number;
|
|
2787
|
+
};
|
|
2788
|
+
readonly lines?: readonly {
|
|
2789
|
+
readonly range: {
|
|
2790
|
+
readonly end: number;
|
|
2791
|
+
};
|
|
2792
|
+
readonly box: {
|
|
2793
|
+
readonly y: number;
|
|
2794
|
+
};
|
|
2795
|
+
/** Present on a real line; a merged one carries spans from more than one paragraph. */
|
|
2796
|
+
readonly spans?: readonly {
|
|
2797
|
+
readonly range: {
|
|
2798
|
+
readonly paragraphId: string;
|
|
2799
|
+
readonly end: number;
|
|
2800
|
+
};
|
|
2801
|
+
}[];
|
|
2802
|
+
}[];
|
|
2803
|
+
}[]): Map<string, ReviewParagraphAnchor>;
|
|
2302
2804
|
/**
|
|
2303
|
-
*
|
|
2304
|
-
* the point in the text where it was authored.
|
|
2805
|
+
* Where a card belongs beside the page, from LAYOUT RECORDS.
|
|
2305
2806
|
*
|
|
2306
|
-
*
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2309
|
-
*/
|
|
2310
|
-
interface TableFloatPosition {
|
|
2311
|
-
readonly horzAnchor: TableFloatAnchor;
|
|
2312
|
-
readonly vertAnchor: TableFloatAnchor;
|
|
2313
|
-
readonly xSpec?: TableFloatXSpec;
|
|
2314
|
-
/** `w:tblpX` in points; signed, so a table can be pulled into the margin. */
|
|
2315
|
-
readonly xPt: number;
|
|
2316
|
-
readonly ySpec?: TableFloatYSpec;
|
|
2317
|
-
/** `w:tblpY` in points; signed. */
|
|
2318
|
-
readonly yPt: number;
|
|
2319
|
-
}
|
|
2320
|
-
/**
|
|
2321
|
-
* One cell in the resolved table structure.
|
|
2807
|
+
* The one question the tree cannot answer, and the one a surface must not answer for itself:
|
|
2808
|
+
* measuring painted DOM puts the sidebar a repaint behind the document and breaks outright
|
|
2809
|
+
* while pagination is in flight.
|
|
2322
2810
|
*
|
|
2323
|
-
*
|
|
2324
|
-
*
|
|
2811
|
+
* Returns null when the item has no resolvable range, or when its paragraph is not in this
|
|
2812
|
+
* layout — a comment anchored in a header belongs to a story the body layout never saw.
|
|
2325
2813
|
*/
|
|
2326
|
-
|
|
2327
|
-
readonly
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
readonly gridColumn: number;
|
|
2337
|
-
/** Canonical `w:gridCol` node id for this cell's start column, when the grid is authored. */
|
|
2338
|
-
readonly gridColumnId?: string;
|
|
2339
|
-
/** A vMerge cell that is not the restart continues the cell above: box, no content. */
|
|
2340
|
-
readonly vMergeContinue: boolean;
|
|
2341
|
-
/** `w:vAlign` — defaults to top when omitted/unrecognised. */
|
|
2342
|
-
readonly vAlign: CellVerticalAlign;
|
|
2343
|
-
/** Resolved per-side margins (tcMar over tblCellMar over the table style over Word's default). */
|
|
2344
|
-
readonly margins: CellMarginsPt;
|
|
2345
|
-
/** Three-state authored `tcBorders` (omitted / none / edge). */
|
|
2346
|
-
readonly borders: CellBorderBox;
|
|
2347
|
-
/** Validated 6-hex shading fill, absent for none/auto. */
|
|
2348
|
-
readonly shading?: string;
|
|
2349
|
-
/**
|
|
2350
|
-
* `w:tcW` — the width this cell asked for, as authored.
|
|
2351
|
-
*
|
|
2352
|
-
* Published for consumers that need the cell's own statement (a column-resize handle has
|
|
2353
|
-
* to write back to it). Column geometry is NOT derived from this field: the resolver works
|
|
2354
|
-
* from a flat claim list built in the same pass, because resolving a column means looking
|
|
2355
|
-
* at every cell that covers it across every row, not at one cell at a time. Read
|
|
2356
|
-
* `columnWidthsPt` for what the table actually laid out.
|
|
2357
|
-
*/
|
|
2358
|
-
readonly preferredWidth: PreferredWidth;
|
|
2359
|
-
/**
|
|
2360
|
-
* What the table style says about this cell's paragraphs and runs (17.7.6.6) — a header
|
|
2361
|
-
* row's bold and centring live here, not in the cell's own properties.
|
|
2362
|
-
*/
|
|
2363
|
-
readonly styleFormatting: TableCellStyleFormatting;
|
|
2364
|
-
/** Block children in reading order, with content-control wrappers flattened. */
|
|
2365
|
-
readonly blocks: readonly OoxmlElement[];
|
|
2366
|
-
}
|
|
2367
|
-
/** One row in the resolved structure: its cells, its height rule, and any row-level revision. */
|
|
2368
|
-
interface SemanticTableRow {
|
|
2369
|
-
readonly id: string;
|
|
2370
|
-
/** Pending Word row insertion/deletion authored in `w:trPr`. */
|
|
2371
|
-
readonly revisionKind?: 'insert' | 'delete';
|
|
2372
|
-
/**
|
|
2373
|
-
* The `w:trPr/w:ins|w:del` attribution, carried with the kind so a painted row can say
|
|
2374
|
-
* WHOSE pending decision it is — the review model addresses the decision by exactly this
|
|
2375
|
-
* `(id, author, date)` triple, and a surface with only the kind could highlight the row
|
|
2376
|
-
* but never open its card.
|
|
2377
|
-
*/
|
|
2378
|
-
readonly revisionId?: string;
|
|
2379
|
-
readonly revisionAuthor?: string;
|
|
2380
|
-
readonly revisionDate?: string;
|
|
2381
|
-
/** `w:trPr/w:tblHeader` — the row repeats atop each page the table continues onto. */
|
|
2382
|
-
readonly isHeader: boolean;
|
|
2383
|
-
/**
|
|
2384
|
-
* `w:trPr/w:cantSplit` — the row must stay on one page. When it cannot fit a fresh page,
|
|
2385
|
-
* layout fails closed rather than fragmenting or overflowing the content box.
|
|
2386
|
-
*/
|
|
2387
|
-
readonly cantSplit: boolean;
|
|
2388
|
-
/** `w:trPr/w:trHeight` — auto / atLeast floor / exact (clipped) row height. */
|
|
2389
|
-
readonly height: TableRowHeight;
|
|
2390
|
-
readonly cells: readonly SemanticTableCell[];
|
|
2814
|
+
declare function reviewItemGeometry(item: ReviewItem, index: ReadonlyMap<string, ReviewParagraphAnchor>): {
|
|
2815
|
+
readonly pageIndex: number;
|
|
2816
|
+
readonly y: number;
|
|
2817
|
+
} | null;
|
|
2818
|
+
|
|
2819
|
+
/** The visible band of the document, in layout units. */
|
|
2820
|
+
interface ViewportWindow {
|
|
2821
|
+
/** Distance from the top of the document to the top of the visible area, in layout units. */
|
|
2822
|
+
readonly top: number;
|
|
2823
|
+
readonly height: number;
|
|
2391
2824
|
}
|
|
2392
2825
|
/**
|
|
2393
|
-
*
|
|
2826
|
+
* Which pages to build in detail.
|
|
2394
2827
|
*
|
|
2395
|
-
*
|
|
2396
|
-
*
|
|
2828
|
+
* A page left out keeps its size and position but no content, so the document's height and page
|
|
2829
|
+
* count are unchanged and scrolling to it reveals it rather than reflowing everything below.
|
|
2397
2830
|
*/
|
|
2398
|
-
interface
|
|
2399
|
-
readonly
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
* placement outright for the other two.
|
|
2407
|
-
*/
|
|
2408
|
-
readonly indentPt: number;
|
|
2409
|
-
/** `w:tblPr/w:jc` (17.4.29) — where the table sits in the text column. */
|
|
2410
|
-
readonly alignment: TableAlignment;
|
|
2411
|
-
/**
|
|
2412
|
-
* `w:tblPr/w:tblpPr` (17.4.57) — present when the table is positioned against an anchor
|
|
2413
|
-
* box. Placement then comes from {@link tableFloatOriginX} rather than `w:jc`/`w:tblInd`.
|
|
2414
|
-
*/
|
|
2415
|
-
readonly float?: TableFloatPosition;
|
|
2416
|
-
/**
|
|
2417
|
-
* `w:tblCellSpacing` (17.4.45) in points: the gap between adjacent cell edges. Applied as
|
|
2418
|
-
* a half-gap inset on each side of every cell, so cells separate visually without the grid
|
|
2419
|
-
* itself moving. Word ALSO grows the table's overall width by the spacing it adds around
|
|
2420
|
-
* the outside; that part is not modelled, so a spaced table is laid out on the same grid
|
|
2421
|
-
* its file states rather than a wider one.
|
|
2422
|
-
*/
|
|
2423
|
-
readonly cellSpacingPt: number;
|
|
2424
|
-
/**
|
|
2425
|
-
* `w:tblPr/w:tblLayout/@w:type="fixed"` (17.4.52 — 17.4.53 is the `w:tblPrEx` exception
|
|
2426
|
-
* variant, not this element). Fixed layout takes the grid as final;
|
|
2427
|
-
* anything else is autofit, which in Word never renders wider than the text column.
|
|
2428
|
-
*/
|
|
2429
|
-
readonly layoutFixed: boolean;
|
|
2430
|
-
/** Table-level `tblBorders` (three-state, including insideH/insideV). */
|
|
2431
|
-
readonly tableBorders: TableBorderBox;
|
|
2432
|
-
/** Table-level `tblCellMar` defaults (per-side, Word's own default when a side is omitted). */
|
|
2433
|
-
readonly defaultMargins: CellMarginsPt;
|
|
2831
|
+
interface MaterializationInput {
|
|
2832
|
+
readonly layout: SemanticLayout;
|
|
2833
|
+
/** Omitted means "no viewport": everything is materialized, which is the honest default. */
|
|
2834
|
+
readonly viewport?: ViewportWindow;
|
|
2835
|
+
/** Extra pages kept ready either side of the visible band. */
|
|
2836
|
+
readonly overscanPages?: number;
|
|
2837
|
+
/** Pages that must be built wherever they are — caret, selection, a search hit. */
|
|
2838
|
+
readonly pinnedPages?: Iterable<number>;
|
|
2434
2839
|
}
|
|
2435
2840
|
/**
|
|
2436
|
-
*
|
|
2841
|
+
* The page indices to build in detail.
|
|
2437
2842
|
*
|
|
2438
|
-
*
|
|
2439
|
-
*
|
|
2440
|
-
* also apply to them — Word centres a centred table in the text column whatever indent the
|
|
2441
|
-
* file carries. A table wider than its container starts flush so its leading edge stays on
|
|
2442
|
-
* the page rather than being centred off it.
|
|
2443
|
-
*/
|
|
2444
|
-
declare function tableOriginX(structure: SemanticTableStructure, containerWidthPt: number): number;
|
|
2445
|
-
/**
|
|
2446
|
-
* Read one typed table node into a bounded structure, or null when the node is not a
|
|
2447
|
-
* typed table or sits beyond the nesting ceiling.
|
|
2843
|
+
* Returns indices rather than records so a caller can compare cheaply against what it
|
|
2844
|
+
* already has mounted, and so the decision can be made without touching the layout.
|
|
2448
2845
|
*/
|
|
2449
|
-
declare function
|
|
2450
|
-
/** Which revisions the view resolves away; only the proposed result performs the join. */
|
|
2451
|
-
displayMode?: RevisionDisplayMode, authorFilter?: RevisionAuthorFilter): SemanticTableStructure | null;
|
|
2846
|
+
declare function pagesToMaterialize(input: MaterializationInput): Set<number>;
|
|
2452
2847
|
|
|
2453
2848
|
/**
|
|
2454
2849
|
* `w:pPr/w:rPr/w:del` or `w:moveFrom` — a tracked revision REMOVES the paragraph mark.
|
|
@@ -2465,22 +2860,4 @@ declare function paragraphMarkDeleted(paragraph: OoxmlNode): boolean;
|
|
|
2465
2860
|
*/
|
|
2466
2861
|
declare function revisionRemovesParagraph(paragraph: OoxmlNode, displayMode?: RevisionDisplayMode, authorFilter?: RevisionAuthorFilter): boolean;
|
|
2467
2862
|
|
|
2468
|
-
|
|
2469
|
-
declare const MAX_TABLE_ROW_FRAGMENTS = 4096;
|
|
2470
|
-
/**
|
|
2471
|
-
* Why a table could not be paginated as authored.
|
|
2472
|
-
*
|
|
2473
|
-
* Each is a bound: a row taller than a page, a row that cannot be split, or a row producing more
|
|
2474
|
-
* fragments than the limit allows.
|
|
2475
|
-
*/
|
|
2476
|
-
type TablePaginationErrorCode = 'table-row-overheight' | 'table-row-split-unsupported' | 'table-row-fragment-limit';
|
|
2477
|
-
/**
|
|
2478
|
-
* Bounded table pagination failure. Prefer this over emitting a fragment that overflows
|
|
2479
|
-
* the page content box.
|
|
2480
|
-
*/
|
|
2481
|
-
declare class TablePaginationError extends Error {
|
|
2482
|
-
readonly code: TablePaginationErrorCode;
|
|
2483
|
-
constructor(code: TablePaginationErrorCode, message: string);
|
|
2484
|
-
}
|
|
2485
|
-
|
|
2486
|
-
export { AUTO_PREFERRED_WIDTH, type AutonumFieldKind, type AutonumFieldSpec, BlockFragmentRecord, CELL_PAD, COMPOUND_BORDER_MIN_GAP_PT, COMPOUND_BORDER_MIN_STROKE_PT, type CanvasMeasurerOptions, type CanvasTextContext, type CanvasTextMetrics, CellBorderBox, type CellMarginsPt, type CellVerticalAlign, type CompoundBorderMetrics, ContentControlBoundaryRecord$1 as ContentControlBoundaryRecord, type ContentControlFragmentRecord, ContentControlLock, DEFAULT_CANVAS_FONT_STACK, DEFAULT_CELL_MARGINS, FieldLinkProjector, FixedPoint, FixedPointRoundingMode, FontByteValidator, GRAPHEME_SEGMENTER_LOCALE, type GraphemeBoundary, type GraphemeSegment, type GraphemeWordSegmentRecord, HARFBUZZ_SHAPING_LIBRARY, type HarfBuzzFaceCacheEvent, type HarfBuzzOutlineCacheEvent, type HarfBuzzShapeCacheEvent, HarfBuzzShapingError, type HarfBuzzShapingErrorCode, type HarfBuzzTextShaper, type HarfBuzzTextShaperInstrumentation, type HarfBuzzTextShaperOptions, type HeaderFooterVariantName, HyperlinkProjector, type KeyedRange, LayoutBox, type LayoutCacheStats, type LayoutScheduler, type LayoutSchedulerOptions, type LayoutScope, type LayoutSession, type LayoutSessionStats, LineRecord, type ListCounterAdvance, type ListCounterState, MAX_EACH_PAGE_MARK_CANDIDATES, MAX_LVL_TEXT_LENGTH, MAX_MARKER_TEXT_LENGTH, MAX_NOTES_LAID_OUT, MAX_NOTE_FRAGMENTS, MAX_NOTE_OVERFLOW_PAGES, MAX_NOTE_REFLOW_ATTEMPTS, MAX_TABLE_COLUMNS, MAX_TABLE_NESTING, MAX_TABLE_ROW_FRAGMENTS, MAX_TABLE_ROW_HEIGHT_PT, type MaterializationInput, type NoteDisplayMark, type NoteLayoutFallbackReason, type NoteMarkContext, type NotePaginationFallbackReason, type NoteReferenceSite, type NoteSeparatorLayout, type NoteSeparatorRuleStyle, type NoteStoryDrawings, type NoteStoryLayout, type NotesAttachResult, type NotesLayoutInput, NumberingIndex, NumberingLevel, type PageFurniture, PageGeometry, PageRecord, type PageRefIndex, ParagraphFragmentRecord, type ParagraphKeyInputs, type ParagraphLayoutCache, type ParagraphLayoutCacheOptions, type PreferredWidth, type PreferredWidthType, RefFieldContext, type RefFieldRefreshOptions, ResolvedListItem, type ResolvedSurfaceMeasurer, ReviewItem, type ReviewParagraphAnchor, RevisionAttribution, RevisionAuthorFilter, RevisionDisplayMode, SectionColumns, SelectionRect, SemanticLayout, type SemanticLayoutOptions, SemanticPosition, SemanticSelection, type SemanticTableCell, type SemanticTableRow, type SemanticTableStructure, ShapedRun, StyleCascadeTable, StyleSpanRecord, type TableAlignment, TableBorderBox, TableBorderSide, TableCellStyleFormatting, TablePaginationError, type TablePaginationErrorCode, type TableRowHeight, type TableRowHeightRule, TextMeasurer, TextShaper, VersionedShapingLibrary, type ViewportWindow, WORD_SEGMENTER_LOCALE, type WordBoundary, type WordBoundaryResolverDeps, type WordSegment, anchorLineY, attachNotesToLayout, boundedFallbackWordSegments, buildPageRefIndex, clampListValue, computeDoubleBorderMetricsPt, computeFootnoteReserves, contentControlBoundaries, contentControlHoldingParagraph, contentControlRecordsInPart, contentControlsOfLayout, createBoundedFallbackWordBoundary, createDefaultWordBoundary, createFixedMeasurer, createHarfBuzzTextShaper, createIntlWordBoundary, createLayoutScheduler, createLayoutSession, createListCounterState, createParagraphLayoutCache, defaultNoteSeparatorRuleStyle, deriveNoteDisplayMarks, deriveNoteDisplayMarksResolved, documentOrder, effectiveBorderSide, effectiveContentControlLock, emptyTocPlaceholderParagraphIds, emptyTocSuppressedResultParagraphIds, everyStoryOrder, expandLvlText, filterRefsOnPage, findSeparatorNote, formatDecimal, formatDecimalZero, formatLowerLetter, formatLowerRoman, formatNumFmt, formatPageNumber, formatUpperLetter, formatUpperRoman, fragmentOwnsAtomOffset, fragmentsOfParagraph, graphemeBoundaryEpoch, graphemeCount, graphemeOffsetToUtf16, harfBuzzFontValidator, initializeHarfBuzz, intlGraphemeBoundary, isCanvasMeasurementAvailable, isCumulativeGeometryTrustedFromLineOrigin, isGeometryTrustedCaretOffset, isHarfBuzzInitialized, isIntlSegmenterAvailable, isIntlWordSegmenterAvailable, isMarkerOnlySeparatorNote, isWholeGraphemeHorizontalBoundary, keyedRangeRects, layoutHeaderFooterStory, layoutNoteById, layoutNoteSeparator, layoutNoteStory, layoutSemanticDocument, lineAtPosition, linesOf, normalNotesOf, noteDisplayMarkMap, noteLineIdPrefix, noteMarkKey, noteSeparatorAreaBox, noteStoryBlocks, pageRefPageNumbersFromLayout, pagesToMaterialize, paragraphFragmentsOf, paragraphFragmentsOfBlocks, paragraphLayoutKey, paragraphMarkDeleted, paragraphShading, paragraphShadingBox, parseAutonumInstruction, planRefFieldResultRefresh, positionPastDeletion, projectedNoteMarkText, provisionalNoteMarks, readTableStructure, resetGraphemeBoundary, resolveDefaultSurfaceMeasurer, resolveDefaultWordBoundary, resolveOoxmlShadingFill, resolveStrictHexFill, reviewAnchorIndex, reviewItemGeometry, revisionRemovesParagraph, roundFontUnitToFixedPoint, segmentGraphemes, segmentWords, selectionRects, semanticHorizontalBoundaries, setGraphemeBoundary, setHarfBuzzWasmUrl, sha256FontBytes, shadingFillFromElement, shapedHorizontalBoundaries, storyBlocks, syntheticSeparatorBox, tableOriginX, tocFieldChromeParagraphIds, tryCreateCanvasMeasurer, unionLayoutBoxes, utf16OffsetToGrapheme, wordBoundary, wordSegmentsToGraphemeRecords };
|
|
2863
|
+
export { AUTO_PREFERRED_WIDTH, AnchoredDrawingRecord, type AutonumFieldKind, type AutonumFieldSpec, BlockFragmentRecord, CELL_PAD, COMPOUND_BORDER_MIN_GAP_PT, COMPOUND_BORDER_MIN_STROKE_PT, type CanvasMeasurerOptions, type CanvasTextContext, type CanvasTextMetrics, CellBorderBox, type CellMarginsPt, type CellVerticalAlign, type CompoundBorderMetrics, ContentControlBoundaryRecord$1 as ContentControlBoundaryRecord, type ContentControlFragmentRecord, ContentControlLock, type CreateDocumentFurnitureSourceOptions, type CreateDocumentNotesInputOptions, DEFAULT_CANVAS_FONT_STACK, DEFAULT_CELL_MARGINS, type DocumentFurnitureSource, type DocumentLinkProjectors, type DocumentStyleDependencies, DrawingInsets, DrawingPoint, FieldLinkProjector, type FieldLinkRegistry, FixedPoint, FixedPointRoundingMode, FontByteValidator, GRAPHEME_SEGMENTER_LOCALE, type GraphemeBoundary, type GraphemeSegment, type GraphemeWordSegmentRecord, HARFBUZZ_SHAPING_LIBRARY, type HarfBuzzFaceCacheEvent, type HarfBuzzOutlineCacheEvent, type HarfBuzzShapeCacheEvent, HarfBuzzShapingError, type HarfBuzzShapingErrorCode, type HarfBuzzTextShaper, type HarfBuzzTextShaperInstrumentation, type HarfBuzzTextShaperOptions, HeaderFooterStoryRecord, type HeaderFooterVariantName, HyperlinkFieldSpec, HyperlinkProjector, InlineDrawingRecord, type KeyedRange, LayoutBox, type LayoutCacheStats, type LayoutScheduler, type LayoutSchedulerOptions, type LayoutScope, type LayoutSession, type LayoutSessionStats, LineRecord, type LineSegment, type ListCounterAdvance, type ListCounterState, MAX_EACH_PAGE_MARK_CANDIDATES, MAX_LVL_TEXT_LENGTH, MAX_MARKER_TEXT_LENGTH, MAX_NOTES_LAID_OUT, MAX_NOTE_FRAGMENTS, MAX_NOTE_OVERFLOW_PAGES, MAX_NOTE_REFLOW_ATTEMPTS, MAX_TABLE_COLUMNS, MAX_TABLE_NESTING, MAX_TABLE_ROW_FRAGMENTS, MAX_TABLE_ROW_HEIGHT_PT, type MaterializationInput, NoteAreaRecord, type NoteDisplayMark, type NoteLayoutFallbackReason, type NoteMarkContext, type NotePaginationFallbackReason, type NoteReferenceSite, type NoteSeparatorLayout, type NoteSeparatorRuleStyle, type NoteStoryDrawings, type NoteStoryLayout, NoteStoryRecord, type NotesAttachResult, type NotesLayoutInput, NumberingIndex, NumberingLevel, type PageFurniture, PageGeometry, PageRecord, type PageRefIndex, ParagraphFragmentRecord, type ParagraphKeyInputs, type ParagraphLayoutCache, type ParagraphLayoutCacheOptions, type PreferredWidth, type PreferredWidthType, RefFieldContext, type RefFieldRefreshOptions, type RegisteredFieldLink, ResolvedListItem, type ResolvedSurfaceMeasurer, ReviewItem, type ReviewParagraphAnchor, RevisionAttribution, RevisionAuthorFilter, RevisionDisplayMode, SectionColumns, SelectionRect, type SemanticDrawingLayer, type SemanticDrawingVisit, SemanticLayout, type SemanticLayoutOptions, SemanticPosition, type SemanticRootStoryKind, SemanticSelection, type SemanticSpanVisit, type SemanticStoryKind, type SemanticStoryVisit, type SemanticTableCell, type SemanticTableRow, type SemanticTableStructure, ShapedRun, SourceRange, SpanLinkRecord, type StoryDrawingContext, type StoryDrawingHost, type StoryParagraphFragmentContext, type StoryProjectionDependencies, StyleCascadeTable, StyleSpanRecord, type TableAlignment, TableBorderBox, TableBorderSide, TableCellStyleFormatting, TablePaginationError, type TablePaginationErrorCode, type TableRowHeight, type TableRowHeightRule, TextMeasurer, TextShaper, VersionedShapingLibrary, type ViewportWindow, WORD_SEGMENTER_LOCALE, type WordBoundary, type WordBoundaryResolverDeps, type WordSegment, anchorLineY, attachNotesToLayout, boundedFallbackWordSegments, buildPageRefIndex, clampListValue, computeDoubleBorderMetricsPt, computeFootnoteReserves, contentControlBoundaries, contentControlHoldingParagraph, contentControlRecordsInPart, contentControlsOfLayout, createBoundedFallbackWordBoundary, createDefaultWordBoundary, createDocumentFurnitureSource, createDocumentLinkProjectors, createDocumentNotesInput, createDocumentStyleDependencies, createFieldLinkRegistry, createFixedMeasurer, createHarfBuzzTextShaper, createIntlWordBoundary, createLayoutScheduler, createLayoutSession, createListCounterState, createParagraphLayoutCache, defaultNoteSeparatorRuleStyle, deriveNoteDisplayMarks, deriveNoteDisplayMarksResolved, documentOrder, documentRelationshipTargetIn, effectiveBorderSide, effectiveContentControlLock, emptyTocPlaceholderParagraphIds, emptyTocSuppressedResultParagraphIds, everyStoryOrder, expandLvlText, exportSourceRangeOf, filterRefsOnPage, findSeparatorNote, forEachSemanticDrawing, forEachSemanticSpan, forEachSemanticStory, forEachStoryParagraphFragment, formatDecimal, formatDecimalZero, formatLowerLetter, formatLowerRoman, formatNumFmt, formatPageNumber, formatUpperLetter, formatUpperRoman, fragmentOwnsAtomOffset, fragmentsOfParagraph, graphemeBoundaryEpoch, graphemeCount, graphemeOffsetToUtf16, harfBuzzFontValidator, initializeHarfBuzz, intlGraphemeBoundary, isCanvasMeasurementAvailable, isCumulativeGeometryTrustedFromLineOrigin, isGeometryTrustedCaretOffset, isHarfBuzzInitialized, isIntlSegmenterAvailable, isIntlWordSegmenterAvailable, isMarkerOnlySeparatorNote, isWholeGraphemeHorizontalBoundary, keyedRangeRects, layoutHeaderFooterStory, layoutNoteById, layoutNoteSeparator, layoutNoteStory, layoutSemanticDocument, lineAtPosition, lineSegments, linesOf, normalNotesOf, noteDisplayMarkMap, noteLineIdPrefix, noteMarkKey, noteSeparatorAreaBox, noteStoryBlocks, pageRefPageNumbersFromLayout, pagesToMaterialize, paragraphFragmentsOf, paragraphFragmentsOfBlocks, paragraphLayoutKey, paragraphMarkDeleted, paragraphShading, paragraphShadingBox, parseAutonumInstruction, planRefFieldResultRefresh, positionPastDeletion, projectedNoteMarkText, provisionalNoteMarks, readTableStructure, resetGraphemeBoundary, resolveDefaultSurfaceMeasurer, resolveDefaultWordBoundary, resolveOoxmlShadingFill, resolveStrictHexFill, reviewAnchorIndex, reviewItemGeometry, revisionRemovesParagraph, roundFontUnitToFixedPoint, segmentGraphemes, segmentWords, selectionRects, semanticHorizontalBoundaries, setGraphemeBoundary, setHarfBuzzWasmUrl, sha256FontBytes, shadingFillFromElement, shapedHorizontalBoundaries, storyBlocks, syntheticSeparatorBox, tableOriginX, tocFieldChromeParagraphIds, tryCreateCanvasMeasurer, unionLayoutBoxes, utf16OffsetToGrapheme, wordBoundary, wordSegmentsToGraphemeRecords };
|