@docx-editor.dev/core 2.12.0 → 2.13.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 +18 -14
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +5 -5
- package/dist/automation.d.ts +5 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +8 -8
- package/dist/binding.d.ts +8 -8
- package/dist/binding.js +1 -1
- package/dist/chunk-3AT4RUQ3.cjs +19 -0
- package/dist/chunk-4NAQLFXA.cjs +2 -0
- package/dist/{chunk-XCFM3G5L.cjs → chunk-67S7OHE6.cjs} +1 -1
- package/dist/chunk-BHAUFJO6.js +20 -0
- package/dist/{chunk-TKEGK4GQ.cjs → chunk-F7U4OLMS.cjs} +2 -2
- package/dist/chunk-FNMXRLGW.cjs +5 -0
- package/dist/{chunk-W77HJGYX.js → chunk-HWWHGREA.js} +1 -1
- package/dist/chunk-I36WS6XX.cjs +20 -0
- package/dist/chunk-IOTL2GGW.js +1 -0
- package/dist/chunk-OF2QZCTN.js +19 -0
- package/dist/chunk-PFSJVAWJ.cjs +1 -0
- package/dist/chunk-PRIBU3UH.js +2 -0
- package/dist/{chunk-WU7PUTVA.js → chunk-RIYSCEFQ.js} +1 -1
- package/dist/chunk-RO3HFCML.js +5 -0
- package/dist/chunk-SFOUCTKA.js +2 -0
- package/dist/{chunk-MHQNR2OU.js → chunk-VBEKERLJ.js} +2 -2
- package/dist/chunk-WANKXD34.cjs +2 -0
- package/dist/chunk-XETEMUIP.cjs +11 -0
- package/dist/chunk-YMW34EBA.js +11 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.cts +3 -3
- package/dist/collaboration/replication.d.ts +3 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.cts +3 -3
- package/dist/collaboration.d.ts +3 -3
- package/dist/contracts/editor.d.cts +7 -7
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.cts +7 -7
- package/dist/contracts/interaction.d.ts +7 -7
- package/dist/contracts/modules.d.cts +7 -7
- package/dist/contracts/modules.d.ts +7 -7
- package/dist/{custom-node-writes-D4rMJIES.d.cts → custom-node-writes-C46r3_5O.d.cts} +2 -2
- package/dist/{custom-node-writes-CcNeHH5C.d.ts → custom-node-writes-DntmaAVW.d.ts} +2 -2
- package/dist/{dist-YFULGVS3.js → dist-OSUJGKTK.js} +1 -1
- package/dist/{editor-B76SEMZw.d.cts → editor-DLrTueVe.d.cts} +21 -9
- package/dist/{editor-BcdsPdbY.d.ts → editor-KiB6JNvk.d.ts} +21 -9
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.cts +22 -22
- package/dist/editor.d.ts +22 -22
- package/dist/editor.js +1 -1
- package/dist/{index-BYTvklN5.d.ts → index-D4Pxdo_p.d.ts} +168 -13
- package/dist/{index-CDGhPib1.d.cts → index-D_PA2Xv6.d.cts} +168 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +179 -519
- package/dist/layout.d.ts +179 -519
- package/dist/layout.js +1 -1
- package/dist/{note-properties-Bx7rXruA.d.ts → note-properties-CDFiNXcD.d.ts} +1 -1
- package/dist/{note-properties-zQ8w04en.d.cts → note-properties-Y6qYh2Hv.d.cts} +1 -1
- package/dist/{omml-equation-69O1Pd8G.d.ts → omml-equation-BY49UOIF.d.ts} +1 -1
- package/dist/{omml-equation-BmV51rim.d.cts → omml-equation-DB8d-jCq.d.cts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -6
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-FTXtrAIT.d.cts → protocol-C8L58j66.d.cts} +2 -2
- package/dist/{protocol-DC7ueVuo.d.ts → protocol-DjgYKCAy.d.ts} +2 -2
- package/dist/{review-items-B78OsJU2.d.ts → review-items-CCS1h93f.d.ts} +1 -1
- package/dist/{review-items-C-2WQdEb.d.cts → review-items-CaAkgi5s.d.cts} +1 -1
- package/dist/{review-reads-CbBQlb-n.d.cts → review-reads-BrTDmoYH.d.cts} +2 -2
- package/dist/{review-reads-UexYBp-m.d.ts → review-reads-DcGYCH0w.d.ts} +2 -2
- package/dist/{revision-projection-B2v9U3qx.d.ts → revision-projection-BmLtLPxH.d.ts} +1 -1
- package/dist/{revision-projection-6u8lae9J.d.cts → revision-projection-Dknlar93.d.cts} +1 -1
- package/dist/{semantic-cell-selection-DsYz2Vg3.d.ts → semantic-cell-selection-BZ50i-Fu.d.ts} +4 -4
- package/dist/{semantic-cell-selection-nEE7E3Z8.d.cts → semantic-cell-selection-COnfaOZO.d.cts} +4 -4
- package/dist/{semantic-interaction-C00BpIyC.d.ts → semantic-interaction-BDJ4TBjm.d.ts} +4 -2
- package/dist/{semantic-interaction-DiOX0FIH.d.cts → semantic-interaction-Bq3ixB0I.d.cts} +4 -2
- package/dist/{semantic-paint-Cc11nrDL.d.cts → semantic-paint-C5SMTO8Y.d.cts} +2 -2
- package/dist/{semantic-paint-ofuoBsYo.d.ts → semantic-paint-DuhhY5-R.d.ts} +2 -2
- package/dist/{semantic-records-CzI0ZEuR.d.ts → semantic-records-BI1jpft7.d.ts} +603 -8
- package/dist/{semantic-records-CRG1r6-a.d.cts → semantic-records-Btw3Ao4v.d.cts} +603 -8
- package/dist/{shaped-measurer-CneACGcP.d.cts → shaped-measurer-CqdYa0fa.d.cts} +9 -1
- package/dist/{shaped-measurer-CkOGZQn9.d.ts → shaped-measurer-qnBJziPx.d.ts} +9 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +15 -12
- package/dist/store.d.ts +15 -12
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-CA7qgAUF.d.cts → tree-op-types-BUulYD5y.d.cts} +15 -2
- package/dist/{tree-op-types-HKfUzt_-.d.ts → tree-op-types-D6HzlPR4.d.ts} +15 -2
- package/dist/{tree-package-fragment-oJZX_5iN.d.ts → tree-package-fragment-B1supBtE.d.ts} +2 -2
- package/dist/{tree-package-fragment-Cz-v-0B3.d.cts → tree-package-fragment-ByN5yzll.d.cts} +2 -2
- package/dist/{tree-session-contract-BPDLrEPX.d.ts → tree-session-contract-BasiwZgZ.d.ts} +28 -5
- package/dist/{tree-session-contract-Cbl87xa8.d.cts → tree-session-contract-DbeBenMR.d.cts} +28 -5
- package/dist/{tree-store-B7hd6cEa.d.ts → tree-store-APgWx6qn.d.ts} +1 -1
- package/dist/{tree-store-BenW0Mg_.d.cts → tree-store-DEEQ9wz_.d.cts} +1 -1
- package/package.json +5 -2
- package/dist/chunk-3JON7JMD.cjs +0 -1
- package/dist/chunk-5V6FNKBE.cjs +0 -2
- package/dist/chunk-BXRVGHTY.cjs +0 -18
- package/dist/chunk-BXTTPJSH.js +0 -5
- package/dist/chunk-ILTZTY3K.cjs +0 -10
- package/dist/chunk-IUM7FZPA.js +0 -2
- package/dist/chunk-JWZG4QJ5.cjs +0 -2
- package/dist/chunk-JXZYDBKU.cjs +0 -19
- package/dist/chunk-KBOOIC2Q.js +0 -19
- package/dist/chunk-L6XZTLPS.js +0 -10
- package/dist/chunk-L7OR5TJK.cjs +0 -5
- package/dist/chunk-MLGPISGH.js +0 -1
- package/dist/chunk-NJXQABQU.js +0 -18
- package/dist/chunk-VGFMPWND.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as OoxmlNode, s as OoxmlProperty, x as ImageResourceState,
|
|
2
|
-
import { a as RevisionAttribution } from './revision-projection-
|
|
3
|
-
import { O as OmmlEquationProjection } from './omml-equation-
|
|
1
|
+
import { a as OoxmlNode, s as OoxmlProperty, g as OoxmlElement, O as OoxmlPart, x as ImageResourceState, U as DrawingAccessibility, S as SourceCrop, W as DrawingTransform, X as VectorShapeProjection, z as DrawingHorizontalReferenceFrame, A as DrawingVerticalReferenceFrame, u as ImageWrapTarget, Y as DrawingProjection, Z as OoxmlDrawingNode, _ as TableBorderStyle } from './tree-op-types-BUulYD5y.cjs';
|
|
2
|
+
import { a as RevisionAttribution } from './revision-projection-Dknlar93.cjs';
|
|
3
|
+
import { O as OmmlEquationProjection } from './omml-equation-DB8d-jCq.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Whether a paragraph must start a new page (`w:pageBreakBefore`).
|
|
@@ -454,6 +454,164 @@ interface StoryPageFieldNeeds {
|
|
|
454
454
|
readonly hasSectionPages: boolean;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
+
/** One recognized REF instruction: the target name and the supported switches, nothing else. */
|
|
458
|
+
interface RefFieldSpec {
|
|
459
|
+
readonly bookmark: string;
|
|
460
|
+
/** `r` / `w` paint the target's number; `n` the same without context; null the range text. */
|
|
461
|
+
readonly numberSwitch: 'r' | 'w' | 'n' | null;
|
|
462
|
+
/** `\h` parsed and inert — the reference paints; navigation is a follow-up. */
|
|
463
|
+
readonly hyperlink: boolean;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Recognize `REF <bookmark> [\r|\w|\n] [\t] [\h] [\* MERGEFORMAT]` or
|
|
467
|
+
* `NOTEREF <bookmark> [\h] [\* MERGEFORMAT]`, or null for anything else.
|
|
468
|
+
*
|
|
469
|
+
* The keyword matches case-insensitively; the bookmark name keeps its authored case (it is a
|
|
470
|
+
* lookup key into a Map, never an object property, so hostile names like `__proto__` are just
|
|
471
|
+
* names that resolve to nothing). Any unrecognized switch fails the parse so the field falls
|
|
472
|
+
* back to its cached result — never the raw instruction, never a guess. NOTEREF's `\p`
|
|
473
|
+
* (above/below position text) and `\f` (note-style formatting) are unrecognized on purpose.
|
|
474
|
+
*/
|
|
475
|
+
declare function parseRefInstruction(raw: string): RefFieldSpec | null;
|
|
476
|
+
|
|
477
|
+
/** Soft ceiling on abstractNum / num entries read from one part. */
|
|
478
|
+
declare const MAX_NUMBERING_DEFINITIONS = 512;
|
|
479
|
+
/** Soft ceiling on override entries per `w:num`. */
|
|
480
|
+
declare const MAX_LVL_OVERRIDES = 9;
|
|
481
|
+
/** `w:suff` — what separates a list marker from the text after it. */
|
|
482
|
+
type ListSuffix = 'tab' | 'space' | 'nothing';
|
|
483
|
+
/** `w:lvlJc` — how a list marker aligns within its own indent. */
|
|
484
|
+
type ListMarkerAlign = 'left' | 'center' | 'right';
|
|
485
|
+
/**
|
|
486
|
+
* One level's indent, plus which parts the level actually AUTHORED.
|
|
487
|
+
*
|
|
488
|
+
* The provenance matters: `w:ind` cascades per-attribute, so a level that authored only `left`
|
|
489
|
+
* must not overwrite an inherited `hanging` with a synthesized zero.
|
|
490
|
+
*/
|
|
491
|
+
interface NumberingLevelIndent {
|
|
492
|
+
readonly left: number;
|
|
493
|
+
readonly right: number;
|
|
494
|
+
readonly hanging: number;
|
|
495
|
+
readonly firstLine: number;
|
|
496
|
+
/**
|
|
497
|
+
* Which of these the LEVEL actually authored.
|
|
498
|
+
*
|
|
499
|
+
* A level's `w:pPr/w:ind` sits between the paragraph style and direct formatting, so the
|
|
500
|
+
* merge has to tell "the level says left = 0" from "the level says nothing about left and
|
|
501
|
+
* the style's value stands". Absent (the default) reads as "says nothing", which is what a
|
|
502
|
+
* hand-built level in a test means.
|
|
503
|
+
*/
|
|
504
|
+
readonly stated?: {
|
|
505
|
+
readonly left: boolean;
|
|
506
|
+
readonly right: boolean;
|
|
507
|
+
/** `w:hanging`/`w:firstLine` are one mutually exclusive slot (§17.3.1.10, §17.3.1.12). */
|
|
508
|
+
readonly firstLineOffset: boolean;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
/** One `w:lvl`: how this depth numbers, what its marker looks like, and how it indents. */
|
|
512
|
+
interface NumberingLevel {
|
|
513
|
+
readonly ilvl: number;
|
|
514
|
+
readonly start: number;
|
|
515
|
+
readonly numFmt: string;
|
|
516
|
+
readonly lvlText: string;
|
|
517
|
+
readonly lvlJc: ListMarkerAlign;
|
|
518
|
+
readonly suff: ListSuffix;
|
|
519
|
+
readonly indent: NumberingLevelIndent;
|
|
520
|
+
/**
|
|
521
|
+
* `w:lvlRestart` one-based trigger level, or `0` when the level never restarts.
|
|
522
|
+
* Omitted in XML → restart when the previous level (or any earlier level) is used.
|
|
523
|
+
*/
|
|
524
|
+
readonly lvlRestart?: number;
|
|
525
|
+
/**
|
|
526
|
+
* `w:isLgl` (§17.9.9): render EVERY level referenced by this level's `w:lvlText` in
|
|
527
|
+
* decimal, whatever number format those levels declare for themselves.
|
|
528
|
+
*/
|
|
529
|
+
readonly isLgl: boolean;
|
|
530
|
+
/** Level `w:rPr` as flat properties (for marker face / vanish). */
|
|
531
|
+
readonly runProperties: readonly OoxmlProperty[];
|
|
532
|
+
/** True when level run props request vanish — marker must not paint. */
|
|
533
|
+
readonly vanish: boolean;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* One `w:lvlOverride` on a `w:num`: a restart value, a replacement level, or both.
|
|
537
|
+
*
|
|
538
|
+
* How two lists share an abstract definition while numbering independently.
|
|
539
|
+
*/
|
|
540
|
+
interface LevelOverride {
|
|
541
|
+
readonly startOverride?: number;
|
|
542
|
+
/** Full level replacement when `w:lvl` is present under the override. */
|
|
543
|
+
readonly level?: NumberingLevel;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* One `w:abstractNum` — the shape of a list, without being a list.
|
|
547
|
+
*
|
|
548
|
+
* Never referenced by a paragraph directly. Paragraphs name a {@link NumDefinition}, which names
|
|
549
|
+
* one of these, so several lists can share a definition and still count separately.
|
|
550
|
+
*/
|
|
551
|
+
interface AbstractNumDefinition {
|
|
552
|
+
readonly abstractNumId: string;
|
|
553
|
+
readonly levels: ReadonlyMap<number, NumberingLevel>;
|
|
554
|
+
/**
|
|
555
|
+
* `w:numStyleLink` (§17.9.21): this definition carries no levels of its own — the numbering
|
|
556
|
+
* lives on the named style. Word follows the link; resolve it with
|
|
557
|
+
* {@link resolveNumberingStyleLinks} before reading levels, or every paragraph on this
|
|
558
|
+
* abstract renders with NO marker at all.
|
|
559
|
+
*/
|
|
560
|
+
readonly numStyleLink?: string;
|
|
561
|
+
/**
|
|
562
|
+
* `w:styleLink` (§17.9.23): the definition side of the same pair — this abstract IS the
|
|
563
|
+
* numbering of the named style. Kept so a link can be verified rather than assumed.
|
|
564
|
+
*/
|
|
565
|
+
readonly styleLink?: string;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* One `w:num` — the thing a paragraph's `w:numId` actually names.
|
|
569
|
+
*
|
|
570
|
+
* Points at an {@link AbstractNumDefinition} and may override any of its levels.
|
|
571
|
+
*/
|
|
572
|
+
interface NumDefinition {
|
|
573
|
+
readonly numId: string;
|
|
574
|
+
readonly abstractNumId: string;
|
|
575
|
+
readonly overrides: ReadonlyMap<number, LevelOverride>;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* The bounded projection of `numbering.xml` that list layout resolves against.
|
|
579
|
+
*
|
|
580
|
+
* Projection ONLY — never a mutation or serialization authority. Hostile values are dropped or
|
|
581
|
+
* clamped, and a missing definition resolves to "no list" rather than a guess.
|
|
582
|
+
*/
|
|
583
|
+
interface NumberingIndex {
|
|
584
|
+
readonly abstractNums: ReadonlyMap<string, AbstractNumDefinition>;
|
|
585
|
+
readonly nums: ReadonlyMap<string, NumDefinition>;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Build a numbering index from the root of a numbering part (`w:numbering`).
|
|
589
|
+
*
|
|
590
|
+
* Empty / missing roots yield an empty index. Duplicate ids keep the first definition.
|
|
591
|
+
*/
|
|
592
|
+
/**
|
|
593
|
+
* Project `numbering.xml` into the bounded index.
|
|
594
|
+
*
|
|
595
|
+
* Every ceiling here exists because the input is file-derived: definition counts, override
|
|
596
|
+
* counts, indent magnitudes and style-link hop depth are all capped, and nothing from the file
|
|
597
|
+
* becomes a loop bound or an allocation size.
|
|
598
|
+
*/
|
|
599
|
+
declare function buildNumberingIndex(root: OoxmlElement | null | undefined): NumberingIndex;
|
|
600
|
+
/** Resolve the effective level for a `numId` + `ilvl`, applying overrides. */
|
|
601
|
+
/**
|
|
602
|
+
* The effective level for one paragraph's numbering reference, after overrides and style links.
|
|
603
|
+
*
|
|
604
|
+
* Answers null for a reference the index cannot resolve — a paragraph naming a definition the
|
|
605
|
+
* file never declared is an unnumbered paragraph, not an error.
|
|
606
|
+
*/
|
|
607
|
+
declare function resolveNumberingLevel(index: NumberingIndex, numId: string, ilvl: number): {
|
|
608
|
+
readonly abstractNumId: string;
|
|
609
|
+
readonly level: NumberingLevel;
|
|
610
|
+
readonly startOverride?: number;
|
|
611
|
+
} | null;
|
|
612
|
+
/** Empty index for tests / documents without numbering. */
|
|
613
|
+
declare const EMPTY_NUMBERING_INDEX: NumberingIndex;
|
|
614
|
+
|
|
457
615
|
interface DrawingPoint {
|
|
458
616
|
readonly x: number;
|
|
459
617
|
readonly y: number;
|
|
@@ -475,6 +633,432 @@ interface DrawingGeometry {
|
|
|
475
633
|
readonly effectInsets: DrawingInsets;
|
|
476
634
|
}
|
|
477
635
|
|
|
636
|
+
/** Horizontal alignment of a paragraph (`w:jc`, ECMA-376 §17.3.1.13). */
|
|
637
|
+
type Alignment = 'left' | 'center' | 'right' | 'both';
|
|
638
|
+
|
|
639
|
+
/** Soft ceiling on `basedOn` chain length — enough for real templates, refuses hostile graphs. */
|
|
640
|
+
declare const MAX_STYLE_BASED_ON_DEPTH = 32;
|
|
641
|
+
/** Soft ceiling on style definitions read from one styles part. */
|
|
642
|
+
declare const MAX_STYLE_DEFINITIONS = 4096;
|
|
643
|
+
/** One `w:style` as the cascade reads it: its properties, and the style it is based on. */
|
|
644
|
+
interface StyleDefinition {
|
|
645
|
+
readonly styleId: string;
|
|
646
|
+
readonly type: string;
|
|
647
|
+
readonly basedOn: string | null;
|
|
648
|
+
/**
|
|
649
|
+
* `w:next` — the style Word gives the paragraph that FOLLOWS one in this style.
|
|
650
|
+
*
|
|
651
|
+
* Nothing in layout reads it: it is a rule about authoring, not about painting. It is
|
|
652
|
+
* read here because this is the one place `styles.xml` is parsed, and a second reader
|
|
653
|
+
* would be a second answer to what a style id means.
|
|
654
|
+
*/
|
|
655
|
+
readonly next: string | null;
|
|
656
|
+
readonly paragraphProperties: readonly OoxmlProperty[];
|
|
657
|
+
readonly runProperties: readonly OoxmlProperty[];
|
|
658
|
+
/** The style's `w:pPr` node, when present — needed for nested `w:pBdr`. */
|
|
659
|
+
readonly paragraphPropertiesNode: OoxmlElement | undefined;
|
|
660
|
+
/** The style's `w:tblPr`, for a `w:type="table"` style. */
|
|
661
|
+
readonly tablePropertiesNode: OoxmlElement | undefined;
|
|
662
|
+
/**
|
|
663
|
+
* `w:tblStylePr` conditional formats by `w:type` (`firstRow`, `band1Horz`, …).
|
|
664
|
+
*
|
|
665
|
+
* Word puts a table's real appearance here: `Table Grid` carries its grid in the style's
|
|
666
|
+
* `w:tblBorders`, and the banded/header looks live in these. A document states only
|
|
667
|
+
* `<w:tblStyle w:val="TableGrid"/>`.
|
|
668
|
+
*/
|
|
669
|
+
readonly conditionalTableFormats: ReadonlyMap<string, OoxmlElement>;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* The whole styles part, indexed and ready to resolve against.
|
|
673
|
+
*
|
|
674
|
+
* `cacheToken` is load-bearing: it folds into layout cache producers so breaks measured under one
|
|
675
|
+
* styles part are never reused under another.
|
|
676
|
+
*/
|
|
677
|
+
interface StyleCascadeTable {
|
|
678
|
+
/**
|
|
679
|
+
* Bounded fingerprint folded into layout cache producers so a different styles part cannot
|
|
680
|
+
* reuse breaks measured under another cascade. Computed once per table (FNV-1a hex).
|
|
681
|
+
*/
|
|
682
|
+
readonly cacheToken: string;
|
|
683
|
+
readonly docDefaultsRun: readonly OoxmlProperty[];
|
|
684
|
+
readonly docDefaultsParagraph: readonly OoxmlProperty[];
|
|
685
|
+
readonly docDefaultsParagraphNode: OoxmlElement | undefined;
|
|
686
|
+
/** `w:style[@w:default='1'][@w:type='paragraph']` — last wins among defaults of that type. */
|
|
687
|
+
readonly defaultParagraphStyleId: string | null;
|
|
688
|
+
/** `w:style[@w:default='1'][@w:type='character']` — last wins among defaults of that type. */
|
|
689
|
+
readonly defaultCharacterStyleId: string | null;
|
|
690
|
+
/**
|
|
691
|
+
* `w:style[@w:default='1'][@w:type='table']` — last wins among defaults of that type.
|
|
692
|
+
*
|
|
693
|
+
* A `w:tbl` with no `w:tblStyle` still resolves against this one. Word's own
|
|
694
|
+
* `TableNormal` is where the 0/108/0/108 twip cell margins live, so skipping it gives
|
|
695
|
+
* every unstyled table padding the document says it does not have.
|
|
696
|
+
*/
|
|
697
|
+
readonly defaultTableStyleId: string | null;
|
|
698
|
+
/**
|
|
699
|
+
* The theme part's Latin typefaces, for `w:rFonts` theme references.
|
|
700
|
+
*
|
|
701
|
+
* Lives on the cascade because it is document-level style material with the same
|
|
702
|
+
* lifetime, and because every site that resolves run properties already holds this table.
|
|
703
|
+
*/
|
|
704
|
+
readonly themeFonts: ThemeFonts;
|
|
705
|
+
readonly styles: ReadonlyMap<string, StyleDefinition>;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* A paragraph's properties after the cascade, plus the same list WITHOUT its own `w:pPr`.
|
|
709
|
+
*
|
|
710
|
+
* Both, because a writer needs to know what a paragraph INHERITS to decide whether setting a
|
|
711
|
+
* value is a change or a no-op — and writing back an inherited value freezes it into the
|
|
712
|
+
* paragraph as though the author had chosen it.
|
|
713
|
+
*/
|
|
714
|
+
interface CascadedParagraphFormatting {
|
|
715
|
+
/** Flat paragraph properties in cascade order (defaults → bases → style → direct). */
|
|
716
|
+
readonly paragraphProperties: readonly OoxmlProperty[];
|
|
717
|
+
/**
|
|
718
|
+
* The same list WITHOUT the paragraph's own `w:pPr` — everything it inherits.
|
|
719
|
+
*
|
|
720
|
+
* Numbering needs the two tiers apart: a level's `w:pPr/w:ind` outranks the style's and is
|
|
721
|
+
* outranked by the paragraph's own, and a flattened list cannot say which is which.
|
|
722
|
+
*/
|
|
723
|
+
readonly inheritedParagraphProperties: readonly OoxmlProperty[];
|
|
724
|
+
/** Matching `w:pPr` nodes for nested border resolution. */
|
|
725
|
+
readonly paragraphPropertyNodes: readonly OoxmlNode[];
|
|
726
|
+
/**
|
|
727
|
+
* Inherited run properties for CONTENT runs (before direct run `rPr`).
|
|
728
|
+
*
|
|
729
|
+
* Does NOT include direct `w:pPr/w:rPr` — that formats the paragraph MARK only
|
|
730
|
+
* (ECMA-376 §17.3.1.36). Folding mark `w:sz` into content made BodyText runs with no
|
|
731
|
+
* direct size paint at the mark's size (Selection Notice "or" alternative → 6.5pt).
|
|
732
|
+
*/
|
|
733
|
+
readonly runProperties: readonly OoxmlProperty[];
|
|
734
|
+
/**
|
|
735
|
+
* Content cascade plus direct `w:pPr/w:rPr` — empty-line metrics and last-line mark height.
|
|
736
|
+
*/
|
|
737
|
+
readonly markRunProperties: readonly OoxmlProperty[];
|
|
738
|
+
/**
|
|
739
|
+
* The style this paragraph resolved to, or null when it names none and there is no
|
|
740
|
+
* document default. `w:contextualSpacing` compares neighbours by exactly this.
|
|
741
|
+
*/
|
|
742
|
+
readonly styleId: string | null;
|
|
743
|
+
}
|
|
744
|
+
/** Accepted style ids only — over-long, control-bearing, or dangerous keys are dropped. */
|
|
745
|
+
declare function isValidStyleId(raw: string | undefined): raw is string;
|
|
746
|
+
/**
|
|
747
|
+
* What a table style contributes to the paragraphs of ONE cell: the style's whole-table
|
|
748
|
+
* `w:pPr`/`w:rPr` followed by every `w:tblStylePr` the cell is under (17.7.6.6), weakest
|
|
749
|
+
* first in the caller's condition order (banding, column, row, corner).
|
|
750
|
+
*
|
|
751
|
+
* This is how Word makes a header row bold and centred while the document states nothing
|
|
752
|
+
* but `<w:tblStyle w:val="…"/>` on the table and plain runs in the cells.
|
|
753
|
+
*/
|
|
754
|
+
interface TableCellStyleFormatting {
|
|
755
|
+
readonly paragraphProperties: readonly OoxmlProperty[];
|
|
756
|
+
/** Matching `w:pPr` nodes, for nested `w:pBdr` / `w:tabs` resolution. */
|
|
757
|
+
readonly paragraphPropertyNodes: readonly OoxmlElement[];
|
|
758
|
+
/** Inherited run properties for every run in the cell, before the paragraph style. */
|
|
759
|
+
readonly runProperties: readonly OoxmlProperty[];
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Build a cascade table from a styles part root.
|
|
763
|
+
*
|
|
764
|
+
* Only direct `w:style` children of the root participate (bounded count). Duplicate
|
|
765
|
+
* `styleId` values keep the last definition, matching Word's reader for this fixture class.
|
|
766
|
+
* Default paragraph/character style ids track `w:default="1"` with the same last-wins rule.
|
|
767
|
+
*/
|
|
768
|
+
declare function buildStyleCascadeTable(stylesRoot: OoxmlElement | null, themeFonts?: ThemeFonts): StyleCascadeTable;
|
|
769
|
+
/**
|
|
770
|
+
* Cascade paragraph + inherited run properties for one paragraph's direct `w:pPr`.
|
|
771
|
+
*
|
|
772
|
+
* Order: `docDefaults` → table style → `basedOn` ancestors → paragraph style → direct
|
|
773
|
+
* formatting, which is the style hierarchy of 17.7.2: a table style sits above the document
|
|
774
|
+
* defaults and below the paragraph style a cell paragraph names for itself.
|
|
775
|
+
* When `w:pStyle` is absent, the document's default paragraph style (`w:default="1"`) is used.
|
|
776
|
+
* Direct formatting is last so it overrides inherited values inside the existing resolvers.
|
|
777
|
+
*/
|
|
778
|
+
declare function cascadeParagraphFormatting(table: StyleCascadeTable, directPPr: OoxmlNode | undefined, tableCellStyle?: TableCellStyleFormatting): CascadedParagraphFormatting;
|
|
779
|
+
/**
|
|
780
|
+
* Bottom border after cascade: a later `w:pBdr` replaces an earlier one; absence inherits.
|
|
781
|
+
* `nil`/`none` clear the edge via `paragraphBorders`.
|
|
782
|
+
*/
|
|
783
|
+
declare function cascadedBottomBorder(paragraphPropertyNodes: readonly OoxmlNode[]): ParagraphBorderEdge | undefined;
|
|
784
|
+
/**
|
|
785
|
+
* Merge inherited paragraph-style run props with a run's direct `rPr` (direct last).
|
|
786
|
+
*
|
|
787
|
+
* When a cascade table is supplied, also resolves `w:rStyle` character styles (basedOn chain,
|
|
788
|
+
* cycle/depth capped). Runs without an explicit `rStyle` pick up the default character style
|
|
789
|
+
* (`w:default="1"`). Precedence: inherited → character style chain → direct formatting.
|
|
790
|
+
*
|
|
791
|
+
* PASS `inheritedRunProperties` BY IDENTITY. It must be an array
|
|
792
|
+
* {@link cascadeParagraphFormatting} returned — `runProperties` or `markRunProperties` — and
|
|
793
|
+
* not a copy of one. A toggle property (ECMA-376 §17.7.3) resolves per level of the style
|
|
794
|
+
* hierarchy, and the levels below the character style resolve to more than a true or a false:
|
|
795
|
+
* whether the document defaults' short circuit is still standing decides what the character
|
|
796
|
+
* style's own toggle does next, and no single `w:b` element can spell that. The paragraph
|
|
797
|
+
* cascade attaches that state to the array it returns, so spreading, filtering or sorting the
|
|
798
|
+
* list drops it. (`Object.freeze` returns the same object, so that one is safe.) A list
|
|
799
|
+
* without it is read as one ordinary level, which is the most a bare property list can say
|
|
800
|
+
* and is what a caller assembling its own list gets.
|
|
801
|
+
*/
|
|
802
|
+
declare function cascadeRunProperties(inheritedRunProperties: readonly OoxmlProperty[], directRunProperties: readonly OoxmlProperty[], table?: StyleCascadeTable): readonly OoxmlProperty[];
|
|
803
|
+
/** Everything the line breaker needs about one paragraph, already cascaded and converted. */
|
|
804
|
+
interface ParagraphLayoutInputs {
|
|
805
|
+
readonly props: OoxmlProperty[];
|
|
806
|
+
readonly indent: {
|
|
807
|
+
left: number;
|
|
808
|
+
right: number;
|
|
809
|
+
hanging: number;
|
|
810
|
+
firstLine: number;
|
|
811
|
+
};
|
|
812
|
+
readonly available: number;
|
|
813
|
+
readonly alignment: Alignment;
|
|
814
|
+
readonly spacing: ParagraphSpacing;
|
|
815
|
+
/** Resolved `w:line` / `w:lineRule`; single spacing where the cascade says nothing. */
|
|
816
|
+
readonly lineSpacing: ParagraphLineSpacing;
|
|
817
|
+
/** `w:contextualSpacing`: drop before/after between same-style neighbours. */
|
|
818
|
+
readonly contextualSpacing: boolean;
|
|
819
|
+
/** Resolved paragraph style id, for the `w:contextualSpacing` neighbour comparison. */
|
|
820
|
+
readonly styleId: string | null;
|
|
821
|
+
readonly bottomBorder: ParagraphBorderEdge | undefined;
|
|
822
|
+
/**
|
|
823
|
+
* Every `CT_PBdr` edge after cascade, not just the bottom one.
|
|
824
|
+
*
|
|
825
|
+
* `bottomBorder` stays alongside it because the fragment signature and the table flow
|
|
826
|
+
* read that field by name; this is the whole box, so a cell paragraph gets the same
|
|
827
|
+
* frame a body paragraph does.
|
|
828
|
+
*/
|
|
829
|
+
readonly borders: ParagraphBorders;
|
|
830
|
+
/** Validated 6-hex paragraph shading fill from cascaded `w:pPr/w:shd`, absent for none. */
|
|
831
|
+
readonly shading: string | undefined;
|
|
832
|
+
readonly inheritedRunProperties: readonly OoxmlProperty[];
|
|
833
|
+
/**
|
|
834
|
+
* Paragraph-mark cascade (`inheritedRunProperties` + direct `w:pPr/w:rPr`).
|
|
835
|
+
* Empty-line sizing and last-line mark height — never content-run face.
|
|
836
|
+
*/
|
|
837
|
+
readonly markRunProperties: readonly OoxmlProperty[];
|
|
838
|
+
/** Cascaded custom tab stops + default interval for paragraph-flow breaking. */
|
|
839
|
+
readonly tabStops: ResolvedTabStops;
|
|
840
|
+
/**
|
|
841
|
+
* Fingerprint folded into the paragraph layout cache key — nested `w:tabs` are absent
|
|
842
|
+
* from flat property bags, so style-inherited stops must be named explicitly.
|
|
843
|
+
*/
|
|
844
|
+
readonly tabStopsCacheToken: string;
|
|
845
|
+
/** Resolved list marker inputs when the paragraph participates in numbering. */
|
|
846
|
+
readonly listItem?: ResolvedListItem;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Resolve every paragraph input semantic layout / table cells share: cascaded props when a
|
|
850
|
+
* style table is present, otherwise direct formatting only.
|
|
851
|
+
*
|
|
852
|
+
* When `listItem` is provided, its merged level indent becomes the paragraph indent (list
|
|
853
|
+
* hanging / left from `numbering.xml`), which is what Word uses for fixture list paragraphs
|
|
854
|
+
* that author no direct `w:ind`.
|
|
855
|
+
*
|
|
856
|
+
* `tableCellStyle` carries what the enclosing table's style says about this cell's
|
|
857
|
+
* paragraphs; body paragraphs pass nothing.
|
|
858
|
+
*
|
|
859
|
+
* `inTableCell` is asked for separately because a cell paragraph may have no table style to
|
|
860
|
+
* inherit at all, and `w:beforeAutospacing` still needs to know it is in a cell.
|
|
861
|
+
*/
|
|
862
|
+
declare function resolveParagraphLayoutInputs(paragraph: OoxmlElement, contentWidth: number, styleCascade: StyleCascadeTable | undefined, listItem?: ResolvedListItem, tableCellStyle?: TableCellStyleFormatting, inTableCell?: boolean): ParagraphLayoutInputs;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* A paragraph's list membership fully resolved: definition, level, marker text and geometry.
|
|
866
|
+
*
|
|
867
|
+
* `markerText` is already expanded through the counter state, so it is the string a reader sees
|
|
868
|
+
* rather than the `w:lvlText` template.
|
|
869
|
+
*/
|
|
870
|
+
interface ResolvedListItem {
|
|
871
|
+
readonly numId: string;
|
|
872
|
+
readonly ilvl: number;
|
|
873
|
+
readonly abstractNumId: string;
|
|
874
|
+
/** `w:numFmt` of the resolved level — `bullet` or a numbering format. */
|
|
875
|
+
readonly numFmt: string;
|
|
876
|
+
readonly markerText: string;
|
|
877
|
+
readonly markerAlign: ListMarkerAlign;
|
|
878
|
+
readonly suffix: ListSuffix;
|
|
879
|
+
/** Effective indent after merging level + paragraph indents, in points. */
|
|
880
|
+
readonly indent: NumberingLevelIndent;
|
|
881
|
+
readonly markerStyle: ResolvedRunStyle;
|
|
882
|
+
/** Fingerprint for layout cache keys (indent, marker text, marker face). */
|
|
883
|
+
readonly cacheToken: string;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Read `w:numPr` from cascaded paragraph-property nodes (lowest precedence first).
|
|
887
|
+
*
|
|
888
|
+
* Flat `OoxmlProperty[]` bags drop nested `ilvl`/`numId`, so this walks the tree nodes
|
|
889
|
+
* the same way borders and tabs do.
|
|
890
|
+
*
|
|
891
|
+
* `w:ilvl` and `w:numId` inherit INDEPENDENTLY through the style chain and the direct
|
|
892
|
+
* `w:pPr` (§17.3.1.19): a tier stating only the level keeps the id it inherits — Word's
|
|
893
|
+
* standard Heading2–Heading9 shape, where only Heading1 names the `w:num` — and a tier
|
|
894
|
+
* stating only the id keeps the inherited level. Treating each `w:numPr` node as a full
|
|
895
|
+
* replacement dropped the id at every level-only tier and unnumbered the paragraph. A
|
|
896
|
+
* stated `w:numId w:val="0"` (or an invalid value) still switches numbering off at that
|
|
897
|
+
* tier even when a lower tier set one; a higher tier stating a valid id re-enables. A
|
|
898
|
+
* level-only tier with no id inherited from below resolves to no numbering.
|
|
899
|
+
*/
|
|
900
|
+
declare function readNumPr(paragraphPropertyNodes: readonly OoxmlNode[]): {
|
|
901
|
+
numId: string;
|
|
902
|
+
ilvl: number;
|
|
903
|
+
} | null;
|
|
904
|
+
/**
|
|
905
|
+
* Resolve `w:numStyleLink` delegation using the document's styles (§17.9.21).
|
|
906
|
+
*
|
|
907
|
+
* Without a style table there is nothing to follow, so the index is returned unchanged —
|
|
908
|
+
* and so it is when nothing delegates, which keeps layout cache identity.
|
|
909
|
+
*/
|
|
910
|
+
declare function withNumberingStyleLinks(index: NumberingIndex, styleCascade: StyleCascadeTable | undefined): NumberingIndex;
|
|
911
|
+
/**
|
|
912
|
+
* The effective indent of a list paragraph: STYLE, then the numbering LEVEL, then DIRECT.
|
|
913
|
+
*
|
|
914
|
+
* Word applies a level's `w:pPr/w:ind` between the paragraph style and the paragraph's own
|
|
915
|
+
* formatting, per attribute — and the ordering matters on real documents. A converted
|
|
916
|
+
* agreement numbers its `(a)` items with a level stating `left=1512 hanging=738` under a
|
|
917
|
+
* `ListParagraph` style stating `left=775 hanging=624`, and states only `hanging="737"` on
|
|
918
|
+
* the paragraph itself. Reading the flattened cascade as "the paragraph's indent" gave the
|
|
919
|
+
* STYLE's 775 to a level that had overridden it, so every lettered sub-item hung a full
|
|
920
|
+
* indent step to the left of where Word puts it.
|
|
921
|
+
*
|
|
922
|
+
* `inherited` is the cascade WITHOUT the paragraph's own `w:pPr` (defaults, table cell style,
|
|
923
|
+
* style chain); `direct` is that `w:pPr` alone.
|
|
924
|
+
*/
|
|
925
|
+
declare function mergeListIndent(levelIndent: NumberingLevelIndent, inherited: readonly OoxmlProperty[], direct?: readonly OoxmlProperty[]): NumberingLevelIndent;
|
|
926
|
+
/**
|
|
927
|
+
* Collect paragraphs of a block list in document order, descending into tables.
|
|
928
|
+
*
|
|
929
|
+
* Caps nesting so a hostile nested-table document cannot recurse without bound.
|
|
930
|
+
*/
|
|
931
|
+
declare function walkStoryParagraphs(blocks: readonly OoxmlElement[], maxTableDepth?: number): OoxmlElement[];
|
|
932
|
+
/**
|
|
933
|
+
* Resolve every list paragraph in a story to a {@link ResolvedListItem}, keyed by node id.
|
|
934
|
+
*
|
|
935
|
+
* Non-list paragraphs are absent from the map. Hostile / missing numbering resolves inertly
|
|
936
|
+
* (paragraph omitted — laid out as ordinary text).
|
|
937
|
+
*/
|
|
938
|
+
declare function resolveStoryListItems(blocks: readonly OoxmlElement[], index: NumberingIndex, styleCascade: StyleCascadeTable | undefined, isFontAvailable?: (family: string) => boolean): ReadonlyMap<string, ResolvedListItem>;
|
|
939
|
+
/**
|
|
940
|
+
* Attach a full-story list-item map to layout options.
|
|
941
|
+
*
|
|
942
|
+
* Resolves once over `blocks` (body story including table cells) so counters continue across
|
|
943
|
+
* section boundaries. No-ops when numbering is absent.
|
|
944
|
+
*/
|
|
945
|
+
declare function withResolvedListItems<T extends {
|
|
946
|
+
readonly numberingIndex?: NumberingIndex;
|
|
947
|
+
readonly listItems?: ReadonlyMap<string, ResolvedListItem>;
|
|
948
|
+
readonly styleCascade?: StyleCascadeTable;
|
|
949
|
+
readonly isFontAvailable?: (family: string) => boolean;
|
|
950
|
+
}>(options: T, blocks: readonly OoxmlElement[]): T & {
|
|
951
|
+
readonly numberingIndex: NumberingIndex;
|
|
952
|
+
readonly listItems?: ReadonlyMap<string, ResolvedListItem>;
|
|
953
|
+
};
|
|
954
|
+
/**
|
|
955
|
+
* Horizontal marker box inside the first-line indent slot.
|
|
956
|
+
*
|
|
957
|
+
* Coordinates are relative to the same origin as paragraph content (`indent.left` is the
|
|
958
|
+
* text start). Returns null when there is nothing to paint.
|
|
959
|
+
*
|
|
960
|
+
* `w:hanging` and a positive `w:firstLine` are one mutually exclusive slot
|
|
961
|
+
* (§17.3.1.10, §17.3.1.12), so the marker has two placements, not an interaction:
|
|
962
|
+
* a hanging level puts the marker BEFORE the text start (`left - hanging`); a
|
|
963
|
+
* positive-firstLine level puts it AFTER (`left + firstLine`) — the standard legal
|
|
964
|
+
* shape `w:ind w:left="0" w:firstLine="720"` numbers at 0.5" while continuation
|
|
965
|
+
* lines return to the margin. Reading only the hanging model painted every such
|
|
966
|
+
* marker at the left margin.
|
|
967
|
+
*/
|
|
968
|
+
declare function listMarkerBox(item: ResolvedListItem, markerWidth: number, lineY: number, lineHeight: number): {
|
|
969
|
+
x: number;
|
|
970
|
+
y: number;
|
|
971
|
+
width: number;
|
|
972
|
+
height: number;
|
|
973
|
+
} | null;
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* The story's resolved REF inputs for one layout pass.
|
|
977
|
+
*
|
|
978
|
+
* Threaded as a runtime rider on the layout options (see `layoutSemanticDocument`) rather
|
|
979
|
+
* than a `SemanticLayoutOptions` member, so the public options surface stays put. Absent
|
|
980
|
+
* means every REF field paints its cached result — the pre-existing degradation, and the one
|
|
981
|
+
* header/footer and text-box stories still take. Note stories receive the body's context
|
|
982
|
+
* through `NotesLayoutInput.refFields`.
|
|
983
|
+
*/
|
|
984
|
+
interface RefFieldContext {
|
|
985
|
+
/**
|
|
986
|
+
* Content token over every PAINTED REF output in the story, for the section prepass memo.
|
|
987
|
+
* A renumbering edit can move a REF value in a section whose own blocks and list map are
|
|
988
|
+
* identity-unchanged, and this token is the only validator that sees it. A field that
|
|
989
|
+
* failed calibration contributes its (session-constant) cached text, so the token still
|
|
990
|
+
* moves exactly when painted output moves.
|
|
991
|
+
*/
|
|
992
|
+
readonly valuesToken: string;
|
|
993
|
+
/** The paragraph's REF outputs folded for its block cache key; `''` when it holds none. */
|
|
994
|
+
tokenForParagraph(paragraphId: string): string;
|
|
995
|
+
/**
|
|
996
|
+
* The live value ONE field paints, keyed by its begin / `w:fldSimple` node id, or null to
|
|
997
|
+
* keep the cached result (failed calibration, unresolvable, or an anchor this scan never
|
|
998
|
+
* saw). Anchor-keyed so the projection's paint and this context's token fold read the SAME
|
|
999
|
+
* calibration verdict, however each walk collected the field's cached text.
|
|
1000
|
+
*/
|
|
1001
|
+
liveValueOf(anchorId: string, spec: RefFieldSpec): string | null;
|
|
1002
|
+
/**
|
|
1003
|
+
* The synthesized display of ONE AUTONUM-family field, keyed by its begin / `w:fldSimple`
|
|
1004
|
+
* node id, or null to paint nothing (unsupported switches, or an anchor this scan never
|
|
1005
|
+
* saw — both the field's historical rendering). These fields carry no cached result at
|
|
1006
|
+
* all, so there is no calibration: the sequential value is the only display they have.
|
|
1007
|
+
* Optional so hand-built contexts predating it stay valid.
|
|
1008
|
+
*/
|
|
1009
|
+
autonumValueOf?(anchorId: string): string | null;
|
|
1010
|
+
/**
|
|
1011
|
+
* The deferred projection of ONE `PAGEREF` field, or null to keep the cached result
|
|
1012
|
+
* (missing bookmark, unsupported switches, or an anchor this scan never saw).
|
|
1013
|
+
*
|
|
1014
|
+
* A `PAGEREF` value is a property of pagination, so the scan cannot compute it — it hands
|
|
1015
|
+
* the projection the resolved TARGET and the calibration inputs instead, and document
|
|
1016
|
+
* finalize (`finalizePageFieldProjection`) substitutes the page number the target's first
|
|
1017
|
+
* fragment lands on. Optional so hand-built contexts predating it stay valid.
|
|
1018
|
+
*/
|
|
1019
|
+
pageRefProjectionOf?(anchorId: string, spec: RefFieldSpec): PageRefFieldProjection | null;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Sticky calibration identity for one `PAGEREF` field.
|
|
1023
|
+
*
|
|
1024
|
+
* An opaque frozen object rather than a mutable verdict holder because span markers are
|
|
1025
|
+
* serialized into fragment signatures — a verdict written into the marker would move a
|
|
1026
|
+
* signature that no painted output moved. The verdict itself lives beside the finalize pass
|
|
1027
|
+
* (`field-page-furniture.ts`), keyed weakly on this object; the registry below carries the
|
|
1028
|
+
* object across passes the same way REF verdicts are carried.
|
|
1029
|
+
*/
|
|
1030
|
+
type PageRefCalibrationCell = Readonly<Record<never, never>>;
|
|
1031
|
+
/**
|
|
1032
|
+
* What a `PAGEREF` span carries to document finalize: the resolved target, the normalized
|
|
1033
|
+
* authored cache (the calibration oracle), and the sticky calibration identity.
|
|
1034
|
+
*/
|
|
1035
|
+
interface PageRefFieldProjection {
|
|
1036
|
+
/** Canonical id of the paragraph the bookmark names — first declaration wins. */
|
|
1037
|
+
readonly targetParagraphId: string;
|
|
1038
|
+
/** The authored cached result, whitespace-collapsed — what the computed number must reproduce. */
|
|
1039
|
+
readonly cached: string;
|
|
1040
|
+
readonly calibration: PageRefCalibrationCell;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Note parts whose stories join the context: their REF fields resolve against the body's
|
|
1044
|
+
* bookmarks and numbering (a footnote citing "Section 1.2(c)" targets a body paragraph),
|
|
1045
|
+
* and their bookmark declarations become plain-REF targets. Number switches aimed AT a
|
|
1046
|
+
* note paragraph still fall back to the cached result — the list map is the body's.
|
|
1047
|
+
*/
|
|
1048
|
+
interface RefNoteParts {
|
|
1049
|
+
readonly footnotesPart: OoxmlPart | null;
|
|
1050
|
+
readonly endnotesPart: OoxmlPart | null;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Resolve the document's REF fields for one layout pass, or null when it has none.
|
|
1054
|
+
*
|
|
1055
|
+
* Bookmarks and REF fields resolve across the body story and (when `notes` is given) the
|
|
1056
|
+
* footnote/endnote stories, against ONE shared target index — a footnote REF finds the
|
|
1057
|
+
* body bookmark it cites. Header/footer and text-box stories are not given a context and
|
|
1058
|
+
* keep painting cached results.
|
|
1059
|
+
*/
|
|
1060
|
+
declare function resolveStoryRefFields(blocks: readonly OoxmlElement[], listItems: ReadonlyMap<string, ResolvedListItem> | undefined, notes?: RefNoteParts): RefFieldContext | null;
|
|
1061
|
+
|
|
478
1062
|
/**
|
|
479
1063
|
* Why textbox story layout stopped short.
|
|
480
1064
|
*
|
|
@@ -647,6 +1231,15 @@ interface FieldAtomMarker {
|
|
|
647
1231
|
/** The field's `\#` numeric picture, applied when finalize substitutes the value. */
|
|
648
1232
|
readonly picture?: string;
|
|
649
1233
|
};
|
|
1234
|
+
/**
|
|
1235
|
+
* A BODY `PAGEREF` atom whose value is the page number its bookmark target lands on.
|
|
1236
|
+
*
|
|
1237
|
+
* Deferred exactly like {@link pageField}: the paragraph walk paints the field's cached
|
|
1238
|
+
* result (or the placeholder digit when the file cached none) and records the resolved
|
|
1239
|
+
* target here; document finalize substitutes the number of the page hosting the target's
|
|
1240
|
+
* first fragment, gated per field on the calibration verdict.
|
|
1241
|
+
*/
|
|
1242
|
+
readonly pageRef?: PageRefFieldProjection;
|
|
650
1243
|
}
|
|
651
1244
|
/** A half-open model-offset range, in the paragraph's own UTF-16 offset space. */
|
|
652
1245
|
interface ModelRange {
|
|
@@ -982,10 +1575,12 @@ interface StyleSpanRecord {
|
|
|
982
1575
|
/**
|
|
983
1576
|
* Cumulative advances from {@link box}.x to each UTF-16 caret boundary in {@link text}.
|
|
984
1577
|
*
|
|
985
|
-
* Length is `text.length + 1` (both endpoints).
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
*
|
|
1578
|
+
* Length is `text.length + 1` (both endpoints). When PRESENT, these are the interaction
|
|
1579
|
+
* authority: hit-testing and the caret read them instead of re-measuring. Layout does not
|
|
1580
|
+
* publish them eagerly — measuring every character of every laid span dominated page
|
|
1581
|
+
* repagination — so interactions measure prefixes on demand through the same measurer the
|
|
1582
|
+
* span was laid with (memoized per span; see `prefixWidth` in semantic-hit-test.ts), and
|
|
1583
|
+
* only interpolate across {@link box}.width when no measurer is supplied.
|
|
989
1584
|
*/
|
|
990
1585
|
readonly caretEdges?: readonly number[];
|
|
991
1586
|
/**
|
|
@@ -1682,4 +2277,4 @@ interface TextMeasurer {
|
|
|
1682
2277
|
};
|
|
1683
2278
|
}
|
|
1684
2279
|
|
|
1685
|
-
export { type
|
|
2280
|
+
export { type FieldAtomMarker as $, type AnchoredDrawingRecord as A, type BlockFragmentRecord as B, type ContentControlBoundaryRecord as C, type DrawingPoint as D, DEFAULT_RUN_STYLE as E, type FieldLinkProjector as F, DEFAULT_TAB_INTERVAL_PT as G, type HyperlinkProjector as H, type InlineDrawingRecord as I, DEFAULT_TAB_INTERVAL_TWIPS as J, EMPTY_NUMBERING_INDEX as K, type LineRecord as L, type ModelRange as M, type NumberingLevel as N, EMPTY_TAB_STOPS as O, type PageGeometry as P, type EquationFractionGeometry as Q, type ResolvedRunStyle as R, type SemanticLayout as S, type TextMeasurer as T, type EquationGeometry as U, type EquationNaryGeometry as V, type EquationRadicalGeometry as W, type EquationRowGeometry as X, type EquationScriptGeometry as Y, type EquationSpanRecord as Z, type EquationTextGeometry as _, type StyleSpanRecord as a, cascadedParagraphBorders as a$, type HeaderFooterStoryRecord as a0, type HyperlinkFieldSpec as a1, type LevelOverride as a2, type LineSpacingRule as a3, type ListMarkerAlign as a4, type ListMarkerRecord as a5, type ListSuffix as a6, MAX_BORDER_SPACE_PT as a7, MAX_BORDER_WIDTH_PT as a8, MAX_LVL_OVERRIDES as a9, type ResolvedTableBorderEdge as aA, type ResolvedTableBorderEdgeSegment as aB, type ResolvedUnderline as aC, SINGLE_LINE_SPACING as aD, type SourceRange as aE, type SpanLinkRecord as aF, type StyleDefinition as aG, TAB_LEADER_GLYPH as aH, type TabAlignment as aI, type TabDestination as aJ, type TabLeader as aK, type TabStop as aL, type TableBorderSideName as aM, type TableBorderStrokeRecord as aN, type TableFragmentRecord as aO, type VerticalAlign as aP, appliedSpaceBefore as aQ, applyLineSpacing as aR, baselineShiftPtOf as aS, borderExtentPt as aT, borderWeight as aU, bottomBorderExtentPt as aV, buildNumberingIndex as aW, buildStyleCascadeTable as aX, cascadeParagraphFormatting as aY, cascadeRunProperties as aZ, cascadedBottomBorder as a_, MAX_NUMBERING_DEFINITIONS as aa, MAX_PARAGRAPH_SPACING_PT as ab, MAX_STYLE_BASED_ON_DEPTH as ac, MAX_STYLE_DEFINITIONS as ad, MAX_TABLE_BORDER_STROKES as ae, MAX_TAB_POSITION_TWIPS as af, MAX_TAB_STOPS as ag, type NumDefinition as ah, type NumberingLevelIndent as ai, PARAGRAPH_BORDER_SIDES as aj, type PageRefCalibrationCell as ak, type PageRefFieldProjection as al, type ParagraphAutoSpacingContext as am, type ParagraphBorderEdge as an, type ParagraphBorderSide as ao, type ParagraphBorderStrokeRecord as ap, type ParagraphBorders as aq, type ParagraphBottomBorderRecord as ar, type ParagraphIndent as as, type ParagraphLayoutInputs as at, type ParagraphLineSpacing as au, type ParagraphSpacing as av, type RefFieldSpec as aw, type RefNoteParts as ax, type ResolvedCellBorders as ay, type ResolvedTabStops as az, type TableRowFragmentRecord as b, cascadedTabStops as b0, collapsedSpaceBefore as b1, defaultTabIntervalFromSettings as b2, displayText as b3, isValidStyleId as b4, layoutEquation as b5, listMarkerBox as b6, measureDisplayText as b7, mergeListIndent as b8, nextTabDestination as b9, withNumberingStyleLinks as bA, withResolvedListItems as bB, paragraphBorderExtentPt as ba, paragraphBorderStrokeWidthPt as bb, paragraphBorders as bc, paragraphBordersFingerprint as bd, paragraphBreaksBefore as be, paragraphContextualSpacing as bf, paragraphLineSpacing as bg, paragraphSpacing as bh, paragraphTabStops as bi, parseRefInstruction as bj, readBorderSide as bk, readCellBorders as bl, readNumPr as bm, readTableBorders as bn, resolveBorderConflict as bo, resolveNumberingLevel as bp, resolveParagraphLayoutInputs as bq, resolveRunStyle as br, resolveStoryListItems as bs, resolveStoryRefFields as bt, resolveTableCellBorderGrid as bu, runStylesEqual as bv, tabAdvanceWidth as bw, tabStopsFingerprint as bx, walkStoryParagraphs as by, withDefaultTabInterval as bz, type TableCellFragmentRecord as c, type NumberingIndex as d, type LayoutBox as e, type DrawingInsets as f, type PageRecord as g, type TableBorderSide as h, type ContentControlLock as i, type ParagraphFragmentRecord as j, type InlineDrawingLayoutContext as k, type StyleCascadeTable as l, type RefFieldContext as m, type StoryPageFieldNeeds as n, type ResolvedListItem as o, type CellBorderBox as p, type TableCellStyleFormatting as q, type TableBorderBox as r, AUTO_PARAGRAPH_SPACING_PT as s, type AbstractNumDefinition as t, type BorderGridGeometry as u, type CascadedParagraphFormatting as v, type ContentControlGeometryFragment as w, type ContentControlLevel as x, type ContentControlMappedType as y, DEFAULT_PAGE_GEOMETRY as z };
|