@stll/docx-core 0.25.2 → 0.25.3

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.
@@ -1104,6 +1104,10 @@ const COUNTER_FORMATS = [
1104
1104
  const OOXML_SYMBOL_CHARACTER_PATTERN = /^[\dA-Fa-f]{4}$/u;
1105
1105
  /** Whether a symbol character is exactly four hexadecimal digits. */
1106
1106
  const isOoxmlSymbolCharacter = (value) => OOXML_SYMBOL_CHARACTER_PATTERN.test(value);
1107
+ /** IDs reserved for the separator records in footnotes.xml and endnotes.xml. */
1108
+ const RESERVED_NOTE_REFERENCE_IDS = [-1, 0];
1109
+ /** Whether an id can name a note from a body reference. */
1110
+ const isNoteReferenceId = (id) => RESERVED_NOTE_REFERENCE_IDS.every((reserved) => id !== reserved);
1107
1111
  /** Raw XML handling modes for drawings that Folio cannot model completely. */
1108
1112
  const DRAWING_RAW_XML_MODES = {
1109
1113
  PRESERVE_ONLY: "preserveOnly",
@@ -1197,4 +1201,4 @@ const DOCX_CONFORMANCE_CLASSES = Object.freeze({
1197
1201
  UNKNOWN: "unknown"
1198
1202
  });
1199
1203
  //#endregion
1200
- export { paragraphNumberingSlots as $, THEME_COLOR_BY_SCHEME_COLOR_VALUE as A, BODY_TEXT_OUTLINE_LEVEL as B, PARAGRAPH_ALIGNMENTS as C, TEXT_DIRECTION_FLOWS as D, TEXT_DIRECTIONS as E, themeColorSlot as F, NO_NUMBERING_NUM_ID as G, headingOutlineLevel as H, themeColorToken as I, mergeParagraphNumbering as J, NO_PARAGRAPH_NUMBERING as K, THEME_COLORS as L, isThemeColor as M, knownThemeColor as N, TEXT_DIRECTION_FLOW_BY_TOKEN as O, readThemeColor as P, paragraphNumberingReferenceId as Q, mintRelationshipId as R, NUMBER_FORMATS as S, TAB_STOP_ALIGNMENTS as T, outlineLevelFromStatedValue as U, headingLevelOf as V, outlineLevelStatedValue as W, paragraphNumberingLevel as X, paragraphNumberingFromSlots as Y, paragraphNumberingReference as Z, isBorderNil as _, PARAGRAPH_MARK_CHANGE_KINDS as a, statesNoBorder as b, isOoxmlSymbolCharacter as c, isPresetLineDashVal as d, resolveParagraphNumbering as et, presetLineDashFrom as f, borderStyleToken as g, borderStyleFrom as h, MAX_REVISION_ID as i, PARSE_WARNING_CODES as it, isSchemeColorValue as j, SCHEME_COLOR_VALUE_BY_THEME_COLOR as k, normalizeRevisionId as l, PRESET_LINE_DASH_VALS as m, BIDI_CONTROLS as n, sameStatedParagraphNumbering as nt, PROPERTY_REVISION_KINDS as o, presetLineDashToken as p, isNumberingReference as q, DRAWING_RAW_XML_MODES as r, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as rt, REVIEW_CARRIERS as s, DOCX_CONFORMANCE_CLASSES as t, sameEffectiveParagraphNumbering as tt, COUNTER_FORMATS as u, isBorderNone as v, TABLE_ALIGNMENTS as w, BORDER_STYLES as x, isBorderStyle as y, relationshipIdOf as z };
1204
+ export { paragraphNumberingReferenceId as $, SCHEME_COLOR_VALUE_BY_THEME_COLOR as A, relationshipIdOf as B, NUMBER_FORMATS as C, TEXT_DIRECTIONS as D, TAB_STOP_ALIGNMENTS as E, readThemeColor as F, outlineLevelStatedValue as G, headingLevelOf as H, themeColorSlot as I, isNumberingReference as J, NO_NUMBERING_NUM_ID as K, themeColorToken as L, isSchemeColorValue as M, isThemeColor as N, TEXT_DIRECTION_FLOWS as O, knownThemeColor as P, paragraphNumberingReference as Q, THEME_COLORS as R, BORDER_STYLES as S, TABLE_ALIGNMENTS as T, headingOutlineLevel as U, BODY_TEXT_OUTLINE_LEVEL as V, outlineLevelFromStatedValue as W, paragraphNumberingFromSlots as X, mergeParagraphNumbering as Y, paragraphNumberingLevel as Z, borderStyleToken as _, PARAGRAPH_MARK_CHANGE_KINDS as a, PARSE_WARNING_CODES as at, isBorderStyle as b, isNoteReferenceId as c, COUNTER_FORMATS as d, paragraphNumberingSlots as et, isPresetLineDashVal as f, borderStyleFrom as g, PRESET_LINE_DASH_VALS as h, MAX_REVISION_ID as i, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as it, THEME_COLOR_BY_SCHEME_COLOR_VALUE as j, TEXT_DIRECTION_FLOW_BY_TOKEN as k, isOoxmlSymbolCharacter as l, presetLineDashToken as m, BIDI_CONTROLS as n, sameEffectiveParagraphNumbering as nt, PROPERTY_REVISION_KINDS as o, presetLineDashFrom as p, NO_PARAGRAPH_NUMBERING as q, DRAWING_RAW_XML_MODES as r, sameStatedParagraphNumbering as rt, REVIEW_CARRIERS as s, DOCX_CONFORMANCE_CLASSES as t, resolveParagraphNumbering as tt, normalizeRevisionId as u, isBorderNil as v, PARAGRAPH_ALIGNMENTS as w, statesNoBorder as x, isBorderNone as y, mintRelationshipId as z };
@@ -2337,15 +2337,7 @@ type TableCell = {
2337
2337
  propertyChanges?: TableCellPropertyChange[];
2338
2338
  /** Tracked structural changes (cell insert/delete/merge) */
2339
2339
  structuralChange?: TableStructuralChangeInfo;
2340
- /**
2341
- * Cell content.
2342
- *
2343
- * Derived from {@link BlockContent} rather than listed, so a new block kind
2344
- * cannot land without a decision here; `BlockSdt` is excluded because folio
2345
- * unwraps a `w:sdt` inside a cell into its `sdtContent` children rather
2346
- * than modelling the wrapper, and keeping the branch out of the cell keeps
2347
- * the model's recursion out of every table.
2348
- */
2340
+ /** Cell content, including block controls nested directly in the cell. */
2349
2341
  content: TableCellBlock[];
2350
2342
  /**
2351
2343
  * The cell-level content controls (`CT_SdtCell`) this cell sits inside,
@@ -2613,7 +2605,7 @@ type PropertyChangeInfo = {
2613
2605
  * with it: the text is then neither inserted nor deleted, and accepting and
2614
2606
  * rejecting the revision both keep it.
2615
2607
  */
2616
- type TrackedRunContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | InlineWrapper | MathEquation | PreservedInline | TrackedRunChange;
2608
+ type TrackedRunContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | SimpleField | ComplexField | InlineSdt | InlineWrapper | MathEquation | PreservedInline | TrackedRunChange;
2617
2609
  /**
2618
2610
  * Insertion wrapper (w:ins) — runs inserted by tracked changes
2619
2611
  */
@@ -3017,20 +3009,20 @@ type SdtEndProperties = {
3017
3009
  * this level. All of them must survive parse → edit → save so docProps-bound
3018
3010
  * fields and reviewed template content do not lose their wrapper on round-trip.
3019
3011
  *
3020
- * The bookmark boundaries belong here for the reason the revision wrapper's
3021
- * do: `CT_SdtContentRun` reaches them through
3012
+ * Bookmark and tracked-move boundaries belong here for the reason the revision
3013
+ * wrapper's do: `CT_SdtContentRun` reaches them through
3022
3014
  * `EG_RunLevelElts > EG_RangeMarkupElements`, and a marker lifted out to a
3023
- * sibling of the control is a bookmark whose extent has changed. A range that
3015
+ * sibling of the control has changed extent or ownership. A bookmark that
3024
3016
  * covered the control's content ends up covering the control and whatever
3025
- * follows it, so a `REF` field or a link to the bookmark resolves to the
3026
- * wrong text.
3017
+ * follows it; a tracked move can stop covering the marker that identifies its
3018
+ * source or destination.
3027
3019
  */
3028
3020
  type InlineSdt = {
3029
3021
  type: "inlineSdt";
3030
3022
  /** SDT properties */
3031
3023
  properties: SdtProperties;
3032
3024
  /** Inline content held inside the control */
3033
- content: (Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | InlineWrapper | Insertion | Deletion | MoveFrom | MoveTo | MathEquation | PreservedInline)[];
3025
+ content: (Run | Hyperlink | BookmarkStart | BookmarkEnd | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | SimpleField | ComplexField | InlineSdt | InlineWrapper | Insertion | Deletion | MoveFrom | MoveTo | MathEquation | PreservedInline)[];
3034
3026
  };
3035
3027
  /**
3036
3028
  * Block-level SDT (content control wrapping paragraphs/tables).
@@ -3521,8 +3513,8 @@ type PreservedBlock = {
3521
3513
  * bookmark would not merely move, it would go.
3522
3514
  */
3523
3515
  type BlockContent = Paragraph | Table | BlockSdt | PreservedBlock | BookmarkStart | BookmarkEnd;
3524
- /** {@link BlockContent} minus the branch folio does not model inside a cell. */
3525
- type TableCellBlock = Exclude<BlockContent, BlockSdt>;
3516
+ /** A block that can occur inside a table cell. */
3517
+ type TableCellBlock = BlockContent;
3526
3518
  /**
3527
3519
  * Section (implicit or explicit based on sectPr)
3528
3520
  */
@@ -3536,10 +3528,36 @@ type Section = {
3536
3528
  /** Footers for this section */
3537
3529
  footers?: Map<HeaderFooterType, HeaderFooter>;
3538
3530
  };
3531
+ /**
3532
+ * Drawing payload under the document-level `w:background`.
3533
+ *
3534
+ * Folio does not interpret this drawing. Keeping it as authored markup avoids
3535
+ * inventing an editable projection for legacy VML/DrawingML page art while the
3536
+ * surrounding background attributes remain typed.
3537
+ */
3538
+ type DocumentBackgroundDrawing = {
3539
+ /** Replayable `w:drawing` markup, as the source wrote it. */
3540
+ rawXml: string;
3541
+ };
3542
+ /** Page background declared directly under `w:document`. */
3543
+ type DocumentBackground = {
3544
+ /** Direct colour or the `auto` sentinel. */
3545
+ color?: ColorValue;
3546
+ /** Theme colour token, including the explicit `none` cancellation. */
3547
+ themeColor?: ThemeColorValue;
3548
+ /** Theme tint modifier, kept in its authored hexadecimal spelling. */
3549
+ themeTint?: string;
3550
+ /** Theme shade modifier, kept in its authored hexadecimal spelling. */
3551
+ themeShade?: string;
3552
+ /** Optional drawing payload carried opaquely through an editor save. */
3553
+ drawing?: DocumentBackgroundDrawing;
3554
+ };
3539
3555
  /**
3540
3556
  * Document body (w:body)
3541
3557
  */
3542
3558
  type DocumentBody = {
3559
+ /** Optional `w:document/w:background`, serialized before the body. */
3560
+ background?: DocumentBackground;
3543
3561
  /** All content (paragraphs, tables) */
3544
3562
  content: BlockContent[];
3545
3563
  /** Sections (derived from sectPr in paragraphs and final sectPr) */
@@ -4072,4 +4090,4 @@ type Document = {
4072
4090
  parseWarnings?: ParseWarning[];
4073
4091
  };
4074
4092
  //#endregion
4075
- export { Field as $, PRESET_LINE_DASH_VALS as $n, sameEffectiveParagraphNumbering as $r, PropertyChange as $t, BlockContent as A, knownThemeColor as Ai, TablePropertyChange as An, TableGridChange as Ar, MoveFromRangeEnd as At, CommentReference as B, borderStyleFrom as Bi, TrackedRunContent as Bn, NO_PARAGRAPH_NUMBERING as Br, PROPERTY_REVISION_KINDS as Bt, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as C, ShadingProperties as Ci, SymbolContent as Cn, SpacingExplicit as Cr, InstrTextContent as Ct, ParseWarningLocation as D, UnrecognisedThemeColor as Di, TableCellBlock as Dn, TableCellBorders as Dr, MathEquation as Dt, ParseWarningCode as E, ThemeColorValue as Ei, TableCell as En, TableBorders as Er, MarkupRangeMarker as Et, BreakContent as F, SchemeColorValue as Fi, TextBox as Fn, TableWidthType as Fr, NoBreakHyphenContent as Ft, DocumentBody as G, statesNoBorder as Gi, WrapPolygonPoint as Gn, isNumberingReference as Gr, ParagraphMarkChangeKind as Gt, DRAWING_RAW_XML_MODES as H, isBorderNil as Hi, Watermark as Hn, ParagraphNumberingReference as Hr, Paragraph as Ht, Column as I, THEME_COLORS as Ii, TextContent as In, TextEffect as Ir, NonVisualDrawingNames as It, DrawingRawXmlMode as J, PresetLineDashValue as Jn, paragraphNumberingLevel as Jr, PositionalTab as Jt, DrawingAnchor as K, BORDER_STYLES as Ki, isOoxmlSymbolCharacter as Kn, mergeParagraphNumbering as Kr, ParagraphPropertyChange as Kt, Comment as L, ThemeColor as Li, TextWatermark as Ln, TextFormatting as Lr, NoteNumberRestart as Lt, BookmarkEnd as M, themeColorSlot as Mi, TableRow as Mn, TableMeasurement as Mr, MoveTo as Mt, BookmarkRangeMarker as N, themeColorToken as Ni, TableRowPropertyChange as Nn, TablePropertyExceptionFormatting as Nr, MoveToRangeEnd as Nt, BIDI_CONTROLS as O, isSchemeColorValue as Oi, TableCellPropertyChange as On, TableCellFormatting as Or, MoveBookmarkMarker as Ot, BookmarkStart as P, SchemeColorSlot as Pi, TableStructuralChangeInfo as Pn, TableRowFormatting as Pr, MoveToRangeStart as Pt, EndnoteProperties as Q, presetLineDashToken as Qn, resolveParagraphNumbering as Qr, PreservedXmlContent as Qt, CommentRangeEnd as R, BorderStyleValue as Ri, TrackedChangeInfo as Rn, UnderlineStyle as Rr, NoteReferenceContent as Rt, ThemeFontScheme as S, ColorValue as Si, SoftHyphenContent as Sn, ParagraphFormatting as Sr, Insertion as St, ParseWarning as T, THEME_COLOR_BY_SCHEME_COLOR_VALUE as Ti, Table as Tn, TabStop as Tr, MAX_REVISION_ID as Tt, Deletion as U, isBorderNone as Ui, WrapDistanceSlots as Un, ParagraphNumberingSlots as Ur, ParagraphContent as Ut, ComplexField as V, borderStyleToken as Vi, VerticalAlign as Vn, ParagraphNumberingOverride as Vr, PageOrientation as Vt, DisplacedByCustomXml as W, isBorderStyle as Wi, WrapDistances as Wn, ResolvedParagraphNumbering as Wr, ParagraphMarkChange as Wt, Endnote as X, isPresetLineDashVal as Xn, paragraphNumberingReferenceId as Xr, PreservedBlock as Xt, EffectExtentSlots as Y, UnrecognisedPresetLineDash as Yn, paragraphNumberingReference as Yr, PositionedBookmarkMarker as Yt, EndnotePosition as Z, presetLineDashFrom as Zn, paragraphNumberingSlots as Zr, PreservedInline as Zt, StyleDefinitions as _, TabStopAlignment as _i, ShapeGeometryAdjustment as _n, CellMargins as _r, ImageTransform as _t, DocxPackage as a, headingOutlineLevel as ai, RunContent as an, PreviewShape as ar, FootnoteProperties as at, ThemeColorScheme as b, TextDirectionFlow as bi, ShapeType as bn, FloatingTableProperties as br, InlineSdt as bt, EmbeddedFontRef as c, NUMBER_FORMATS as ci, SdtProperties as cn, CounterFormat as cr, HeaderReference as ct, FontTable as d, ParagraphAlignment as di, SectionProperties as dn, LevelSuffix as dr, ImageCrop as dt, sameStatedParagraphNumbering as ei, PropertyChangeInfo as en, PresetLineDashVal as er, FieldCharContent as et, MediaFile as f, TABLE_ALIGNMENTS as fi, SectionPropertyChange as fn, ListLevel as fr, ImageDocPrLink as ft, Style as g, TEXT_DIRECTION_FLOW_BY_TOKEN as gi, ShapeFill as gn, NumberingInstance as gr, ImageSize as gt, RelationshipType as h, TEXT_DIRECTION_FLOWS as hi, ShapeContent as hn, NumberingDefinitions as hr, ImagePosition as ht, DocxConformanceClass as i, headingLevelOf as ii, Run as in, PreviewDescriptor as ir, FootnotePosition as it, BlockSdt as j, readThemeColor as ji, TablePropertyExceptionChange as jn, TableLook as jr, MoveFromRangeStart as jt, BidiControl as k, isThemeColor as ki, TablePreservedMarkup as kn, TableFormatting as kr, MoveFrom as kt, FontCharset as l, NumberFormat as li, SdtType as ln, LevelLegacy as lr, Hyperlink as lt, RelationshipMap as m, TEXT_DIRECTIONS as mi, Shape as mn, ListRendering as mr, ImagePadding as mt, Document as n, HeadingOutlineLevel as ni, REVIEW_CARRIERS as nn, mintRelationshipId as nr, FooterReference as nt, ExhaustiveFields as o, outlineLevelFromStatedValue as oi, RunPropertyChange as on, AbstractNumbering as or, HeaderFooter as ot, Relationship as p, TAB_STOP_ALIGNMENTS as pi, SectionStart as pn, ListMarkerFormatting as pr, ImageFrameLocks as pt, DrawingContent as q, BorderStyle as qi, normalizeRevisionId as qn, paragraphNumberingFromSlots as qr, PictureWatermark as qt, DocumentSettings as r, OutlineLevel as ri, ReviewCarrier as rn, relationshipIdOf as rr, Footnote as rt, DocDefaults as s, outlineLevelStatedValue as si, SdtEndProperties as sn, COUNTER_FORMATS as sr, HeaderFooterType as st, DOCX_CONFORMANCE_CLASSES as t, BODY_TEXT_OUTLINE_LEVEL as ti, PropertyRevisionKind as tn, RelationshipId as tr, FieldType as tt, FontInfo as u, PARAGRAPH_ALIGNMENTS as ui, Section as un, LevelOverride as ur, Image as ut, StyleType as v, TableAlignment as vi, ShapeOutline as vn, ConditionalFormatStyle as vr, ImageWrap as vt, PARSE_WARNING_CODES as w, SCHEME_COLOR_VALUE_BY_THEME_COLOR as wi, TabContent as wn, TabLeader as wr, LineNumberRestart as wt, ThemeFont as x, BorderSpec as xi, SimpleField as xn, LineSpacingRule as xr, InlineWrapper as xt, Theme as y, TextDirection as yi, ShapeTextBody as yn, EmphasisMark as yr, ImageWrapPolygon as yt, CommentRangeStart as z, UnrecognisedBorderStyle as zi, TrackedRunChange as zn, NO_NUMBERING_NUM_ID as zr, PARAGRAPH_MARK_CHANGE_KINDS as zt };
4093
+ export { EndnotePosition as $, presetLineDashFrom as $n, paragraphNumberingSlots as $r, PreservedInline as $t, BlockContent as A, isSchemeColorValue as Ai, TableCellPropertyChange as An, TableCellFormatting as Ar, MoveBookmarkMarker as At, CommentReference as B, BorderStyleValue as Bi, TrackedChangeInfo as Bn, UnderlineStyle as Br, NoteReferenceContent as Bt, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as C, BorderSpec as Ci, SimpleField as Cn, LineSpacingRule as Cr, InlineWrapper as Ct, ParseWarningLocation as D, THEME_COLOR_BY_SCHEME_COLOR_VALUE as Di, Table as Dn, TabStop as Dr, MAX_REVISION_ID as Dt, ParseWarningCode as E, SCHEME_COLOR_VALUE_BY_THEME_COLOR as Ei, TabContent as En, TabLeader as Er, LineNumberRestart as Et, BreakContent as F, themeColorToken as Fi, TableRowPropertyChange as Fn, TablePropertyExceptionFormatting as Fr, MoveToRangeEnd as Ft, DocumentBackground as G, isBorderNone as Gi, WrapDistanceSlots as Gn, ParagraphNumberingSlots as Gr, ParagraphContent as Gt, DRAWING_RAW_XML_MODES as H, borderStyleFrom as Hi, TrackedRunContent as Hn, NO_PARAGRAPH_NUMBERING as Hr, PROPERTY_REVISION_KINDS as Ht, Column as I, SchemeColorSlot as Ii, TableStructuralChangeInfo as In, TableRowFormatting as Ir, MoveToRangeStart as It, DrawingAnchor as J, BORDER_STYLES as Ji, isOoxmlSymbolCharacter as Jn, mergeParagraphNumbering as Jr, ParagraphPropertyChange as Jt, DocumentBackgroundDrawing as K, isBorderStyle as Ki, WrapDistances as Kn, ResolvedParagraphNumbering as Kr, ParagraphMarkChange as Kt, Comment as L, SchemeColorValue as Li, TextBox as Ln, TableWidthType as Lr, NoBreakHyphenContent as Lt, BookmarkEnd as M, knownThemeColor as Mi, TablePropertyChange as Mn, TableGridChange as Mr, MoveFromRangeEnd as Mt, BookmarkRangeMarker as N, readThemeColor as Ni, TablePropertyExceptionChange as Nn, TableLook as Nr, MoveFromRangeStart as Nt, BIDI_CONTROLS as O, ThemeColorValue as Oi, TableCell as On, TableBorders as Or, MarkupRangeMarker as Ot, BookmarkStart as P, themeColorSlot as Pi, TableRow as Pn, TableMeasurement as Pr, MoveTo as Pt, Endnote as Q, isPresetLineDashVal as Qn, paragraphNumberingReferenceId as Qr, PreservedBlock as Qt, CommentRangeEnd as R, THEME_COLORS as Ri, TextContent as Rn, TextEffect as Rr, NonVisualDrawingNames as Rt, ThemeFontScheme as S, TextDirectionFlow as Si, ShapeType as Sn, FloatingTableProperties as Sr, InlineSdt as St, ParseWarning as T, ShadingProperties as Ti, SymbolContent as Tn, SpacingExplicit as Tr, InstrTextContent as Tt, Deletion as U, borderStyleToken as Ui, VerticalAlign as Un, ParagraphNumberingOverride as Ur, PageOrientation as Ut, ComplexField as V, UnrecognisedBorderStyle as Vi, TrackedRunChange as Vn, NO_NUMBERING_NUM_ID as Vr, PARAGRAPH_MARK_CHANGE_KINDS as Vt, DisplacedByCustomXml as W, isBorderNil as Wi, Watermark as Wn, ParagraphNumberingReference as Wr, Paragraph as Wt, DrawingRawXmlMode as X, PresetLineDashValue as Xn, paragraphNumberingLevel as Xr, PositionalTab as Xt, DrawingContent as Y, BorderStyle as Yi, normalizeRevisionId as Yn, paragraphNumberingFromSlots as Yr, PictureWatermark as Yt, EffectExtentSlots as Z, UnrecognisedPresetLineDash as Zn, paragraphNumberingReference as Zr, PositionedBookmarkMarker as Zt, StyleDefinitions as _, TEXT_DIRECTION_FLOWS as _i, ShapeContent as _n, NumberingDefinitions as _r, ImagePosition as _t, DocxPackage as a, OutlineLevel as ai, ReviewCarrier as an, relationshipIdOf as ar, Footnote as at, ThemeColorScheme as b, TableAlignment as bi, ShapeOutline as bn, ConditionalFormatStyle as br, ImageWrap as bt, EmbeddedFontRef as c, outlineLevelFromStatedValue as ci, RunPropertyChange as cn, AbstractNumbering as cr, HeaderFooter as ct, FontTable as d, NumberFormat as di, SdtType as dn, LevelLegacy as dr, Hyperlink as dt, resolveParagraphNumbering as ei, PreservedXmlContent as en, presetLineDashToken as er, EndnoteProperties as et, MediaFile as f, PARAGRAPH_ALIGNMENTS as fi, Section as fn, LevelOverride as fr, Image as ft, Style as g, TEXT_DIRECTIONS as gi, Shape as gn, ListRendering as gr, ImagePadding as gt, RelationshipType as h, TAB_STOP_ALIGNMENTS as hi, SectionStart as hn, ListMarkerFormatting as hr, ImageFrameLocks as ht, DocxConformanceClass as i, HeadingOutlineLevel as ii, REVIEW_CARRIERS as in, mintRelationshipId as ir, FooterReference as it, BlockSdt as j, isThemeColor as ji, TablePreservedMarkup as jn, TableFormatting as jr, MoveFrom as jt, BidiControl as k, UnrecognisedThemeColor as ki, TableCellBlock as kn, TableCellBorders as kr, MathEquation as kt, FontCharset as l, outlineLevelStatedValue as li, SdtEndProperties as ln, COUNTER_FORMATS as lr, HeaderFooterType as lt, RelationshipMap as m, TABLE_ALIGNMENTS as mi, SectionPropertyChange as mn, ListLevel as mr, ImageDocPrLink as mt, Document as n, sameStatedParagraphNumbering as ni, PropertyChangeInfo as nn, PresetLineDashVal as nr, FieldCharContent as nt, ExhaustiveFields as o, headingLevelOf as oi, Run as on, PreviewDescriptor as or, FootnotePosition as ot, Relationship as p, ParagraphAlignment as pi, SectionProperties as pn, LevelSuffix as pr, ImageCrop as pt, DocumentBody as q, statesNoBorder as qi, WrapPolygonPoint as qn, isNumberingReference as qr, ParagraphMarkChangeKind as qt, DocumentSettings as r, BODY_TEXT_OUTLINE_LEVEL as ri, PropertyRevisionKind as rn, RelationshipId as rr, FieldType as rt, DocDefaults as s, headingOutlineLevel as si, RunContent as sn, PreviewShape as sr, FootnoteProperties as st, DOCX_CONFORMANCE_CLASSES as t, sameEffectiveParagraphNumbering as ti, PropertyChange as tn, PRESET_LINE_DASH_VALS as tr, Field as tt, FontInfo as u, NUMBER_FORMATS as ui, SdtProperties as un, CounterFormat as ur, HeaderReference as ut, StyleType as v, TEXT_DIRECTION_FLOW_BY_TOKEN as vi, ShapeFill as vn, NumberingInstance as vr, ImageSize as vt, PARSE_WARNING_CODES as w, ColorValue as wi, SoftHyphenContent as wn, ParagraphFormatting as wr, Insertion as wt, ThemeFont as x, TextDirection as xi, ShapeTextBody as xn, EmphasisMark as xr, ImageWrapPolygon as xt, Theme as y, TabStopAlignment as yi, ShapeGeometryAdjustment as yn, CellMargins as yr, ImageTransform as yt, CommentRangeStart as z, ThemeColor as zi, TextWatermark as zn, TextFormatting as zr, NoteNumberRestart as zt };
Binary file
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as BlockContent, En as TableCell, F as BreakContent, G as DocumentBody, Ht as Paragraph, In as TextContent, Jt as PositionalTab, Mn as TableRow, Tn as Table, Ut as ParagraphContent, a as DocxPackage, an as RunContent, dn as SectionProperties, g as Style, hr as NumberingDefinitions, i as DocxConformanceClass, in as Run, n as Document, t as DOCX_CONFORMANCE_CLASSES } from "./document-P82X2cGL.js";
1
+ import { A as BlockContent, Dn as Table, F as BreakContent, G as DocumentBackground, Gt as ParagraphContent, K as DocumentBackgroundDrawing, On as TableCell, Pn as TableRow, Rn as TextContent, Wt as Paragraph, Xt as PositionalTab, _r as NumberingDefinitions, a as DocxPackage, g as Style, i as DocxConformanceClass, n as Document, on as Run, pn as SectionProperties, q as DocumentBody, sn as RunContent, t as DOCX_CONFORMANCE_CLASSES } from "./document-Cy1Dd6UE.js";
2
2
  import { Buffer } from "node:buffer";
3
3
  //#region src/legal-source/types.d.ts
4
4
  type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";
@@ -307,4 +307,4 @@ declare const validateDocxPackage: (buffer: ArrayBuffer | Uint8Array) => Promise
307
307
  declare const validateDocumentModel: (document: Document) => ValidateDocumentModelResult;
308
308
  declare const assertValidDocumentModel: (document: Document) => void;
309
309
  //#endregion
310
- export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, type Document, type DocumentBody, type DocxConformanceClass, type DocxPackage, type DocxPackageIssueCode, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type MarkdownContent, type Paragraph, type ParagraphContent, type PositionalTab, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, compileMarkdownToContent, escapeXmlAttribute, escapeXmlText, hasIllegalXmlCharacters, parseLegalSource, pushOnOffElement, requiresXmlSpacePreserve, sanitizeExternalUrl, sanitizeXmlCharacters, serializeDocumentToDocx, serializeOnOffElement, validateDocumentModel, validateDocxPackage, validateLegalDraft };
310
+ export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, type Document, type DocumentBackground, type DocumentBackgroundDrawing, type DocumentBody, type DocxConformanceClass, type DocxPackage, type DocxPackageIssueCode, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type MarkdownContent, type Paragraph, type ParagraphContent, type PositionalTab, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, compileMarkdownToContent, escapeXmlAttribute, escapeXmlText, hasIllegalXmlCharacters, parseLegalSource, pushOnOffElement, requiresXmlSpacePreserve, sanitizeExternalUrl, sanitizeXmlCharacters, serializeDocumentToDocx, serializeOnOffElement, validateDocumentModel, validateDocxPackage, validateLegalDraft };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as paragraphNumberingSlots, H as headingOutlineLevel, Q as paragraphNumberingReferenceId, X as paragraphNumberingLevel, Z as paragraphNumberingReference, b as statesNoBorder, c as isOoxmlSymbolCharacter, g as borderStyleToken, t as DOCX_CONFORMANCE_CLASSES } from "./document-DJuN_2kr.js";
2
- import { i as serializeSequenceChildren } from "./sequenceChildren-DlUb7FZG.js";
1
+ import { $ as paragraphNumberingReferenceId, Q as paragraphNumberingReference, U as headingOutlineLevel, Z as paragraphNumberingLevel, _ as borderStyleToken, c as isNoteReferenceId, et as paragraphNumberingSlots, l as isOoxmlSymbolCharacter, t as DOCX_CONFORMANCE_CLASSES, x as statesNoBorder } from "./document-Bz9rYlJI.js";
2
+ import { i as serializeSequenceChildren } from "./sequenceChildren-BIixCB49.js";
3
3
  import { panic } from "better-result";
4
4
  import JSZip from "jszip";
5
5
  import { XMLParser, XMLValidator } from "fast-xml-parser";
@@ -1035,7 +1035,13 @@ const validateNoteCollection = ({ refs, notes, path, label, ctx }) => {
1035
1035
  ids.add(note.id);
1036
1036
  validateBlocks(note.content, `${path}[${index}].content`, ctx);
1037
1037
  }
1038
- for (const [id, paths] of refs.entries()) if (!ids.has(id)) addError(ctx, paths.at(0) ?? path, `${label} ${id} is referenced but not present in the package.`);
1038
+ for (const [id, paths] of refs.entries()) {
1039
+ if (!isNoteReferenceId(id)) {
1040
+ addError(ctx, paths.at(0) ?? path, `${label} id ${id} is reserved for a note-part separator and cannot be referenced.`);
1041
+ continue;
1042
+ }
1043
+ if (!ids.has(id)) addError(ctx, paths.at(0) ?? path, `${label} ${id} is referenced but not present in the package.`);
1044
+ }
1039
1045
  };
1040
1046
  const validateMedia = (document, ctx) => {
1041
1047
  const media = document.package.media;
@@ -1,3 +1,3 @@
1
- import { $ as Field, $n as PRESET_LINE_DASH_VALS, $r as sameEffectiveParagraphNumbering, $t as PropertyChange, A as BlockContent, Ai as knownThemeColor, An as TablePropertyChange, Ar as TableGridChange, At as MoveFromRangeEnd, B as CommentReference, Bi as borderStyleFrom, Bn as TrackedRunContent, Br as NO_PARAGRAPH_NUMBERING, Bt as PROPERTY_REVISION_KINDS, C as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, Ci as ShadingProperties, Cn as SymbolContent, Cr as SpacingExplicit, Ct as InstrTextContent, D as ParseWarningLocation, Di as UnrecognisedThemeColor, Dn as TableCellBlock, Dr as TableCellBorders, Dt as MathEquation, E as ParseWarningCode, Ei as ThemeColorValue, En as TableCell, Er as TableBorders, Et as MarkupRangeMarker, F as BreakContent, Fi as SchemeColorValue, Fn as TextBox, Fr as TableWidthType, Ft as NoBreakHyphenContent, G as DocumentBody, Gi as statesNoBorder, Gn as WrapPolygonPoint, Gr as isNumberingReference, Gt as ParagraphMarkChangeKind, H as DRAWING_RAW_XML_MODES, Hi as isBorderNil, Hn as Watermark, Hr as ParagraphNumberingReference, Ht as Paragraph, I as Column, Ii as THEME_COLORS, In as TextContent, Ir as TextEffect, It as NonVisualDrawingNames, J as DrawingRawXmlMode, Jn as PresetLineDashValue, Jr as paragraphNumberingLevel, Jt as PositionalTab, K as DrawingAnchor, Ki as BORDER_STYLES, Kn as isOoxmlSymbolCharacter, Kr as mergeParagraphNumbering, Kt as ParagraphPropertyChange, L as Comment, Li as ThemeColor, Ln as TextWatermark, Lr as TextFormatting, Lt as NoteNumberRestart, M as BookmarkEnd, Mi as themeColorSlot, Mn as TableRow, Mr as TableMeasurement, Mt as MoveTo, N as BookmarkRangeMarker, Ni as themeColorToken, Nn as TableRowPropertyChange, Nr as TablePropertyExceptionFormatting, Nt as MoveToRangeEnd, O as BIDI_CONTROLS, Oi as isSchemeColorValue, On as TableCellPropertyChange, Or as TableCellFormatting, Ot as MoveBookmarkMarker, P as BookmarkStart, Pi as SchemeColorSlot, Pn as TableStructuralChangeInfo, Pr as TableRowFormatting, Pt as MoveToRangeStart, Q as EndnoteProperties, Qn as presetLineDashToken, Qr as resolveParagraphNumbering, Qt as PreservedXmlContent, R as CommentRangeEnd, Ri as BorderStyleValue, Rn as TrackedChangeInfo, Rr as UnderlineStyle, Rt as NoteReferenceContent, S as ThemeFontScheme, Si as ColorValue, Sn as SoftHyphenContent, Sr as ParagraphFormatting, St as Insertion, T as ParseWarning, Ti as THEME_COLOR_BY_SCHEME_COLOR_VALUE, Tn as Table, Tr as TabStop, Tt as MAX_REVISION_ID, U as Deletion, Ui as isBorderNone, Un as WrapDistanceSlots, Ur as ParagraphNumberingSlots, Ut as ParagraphContent, V as ComplexField, Vi as borderStyleToken, Vn as VerticalAlign, Vr as ParagraphNumberingOverride, Vt as PageOrientation, W as DisplacedByCustomXml, Wi as isBorderStyle, Wn as WrapDistances, Wr as ResolvedParagraphNumbering, Wt as ParagraphMarkChange, X as Endnote, Xn as isPresetLineDashVal, Xr as paragraphNumberingReferenceId, Xt as PreservedBlock, Y as EffectExtentSlots, Yn as UnrecognisedPresetLineDash, Yr as paragraphNumberingReference, Yt as PositionedBookmarkMarker, Z as EndnotePosition, Zn as presetLineDashFrom, Zr as paragraphNumberingSlots, Zt as PreservedInline, _ as StyleDefinitions, _i as TabStopAlignment, _n as ShapeGeometryAdjustment, _r as CellMargins, _t as ImageTransform, a as DocxPackage, ai as headingOutlineLevel, an as RunContent, ar as PreviewShape, at as FootnoteProperties, b as ThemeColorScheme, bi as TextDirectionFlow, bn as ShapeType, br as FloatingTableProperties, bt as InlineSdt, c as EmbeddedFontRef, ci as NUMBER_FORMATS, cn as SdtProperties, cr as CounterFormat, ct as HeaderReference, d as FontTable, di as ParagraphAlignment, dn as SectionProperties, dr as LevelSuffix, dt as ImageCrop, ei as sameStatedParagraphNumbering, en as PropertyChangeInfo, er as PresetLineDashVal, et as FieldCharContent, f as MediaFile, fi as TABLE_ALIGNMENTS, fn as SectionPropertyChange, fr as ListLevel, ft as ImageDocPrLink, g as Style, gi as TEXT_DIRECTION_FLOW_BY_TOKEN, gn as ShapeFill, gr as NumberingInstance, gt as ImageSize, h as RelationshipType, hi as TEXT_DIRECTION_FLOWS, hn as ShapeContent, hr as NumberingDefinitions, ht as ImagePosition, i as DocxConformanceClass, ii as headingLevelOf, in as Run, ir as PreviewDescriptor, it as FootnotePosition, j as BlockSdt, ji as readThemeColor, jn as TablePropertyExceptionChange, jr as TableLook, jt as MoveFromRangeStart, k as BidiControl, ki as isThemeColor, kn as TablePreservedMarkup, kr as TableFormatting, kt as MoveFrom, l as FontCharset, li as NumberFormat, ln as SdtType, lr as LevelLegacy, lt as Hyperlink, m as RelationshipMap, mi as TEXT_DIRECTIONS, mn as Shape, mr as ListRendering, mt as ImagePadding, n as Document, ni as HeadingOutlineLevel, nn as REVIEW_CARRIERS, nr as mintRelationshipId, nt as FooterReference, o as ExhaustiveFields, oi as outlineLevelFromStatedValue, on as RunPropertyChange, or as AbstractNumbering, ot as HeaderFooter, p as Relationship, pi as TAB_STOP_ALIGNMENTS, pn as SectionStart, pr as ListMarkerFormatting, pt as ImageFrameLocks, q as DrawingContent, qi as BorderStyle, qn as normalizeRevisionId, qr as paragraphNumberingFromSlots, qt as PictureWatermark, r as DocumentSettings, ri as OutlineLevel, rn as ReviewCarrier, rr as relationshipIdOf, rt as Footnote, s as DocDefaults, si as outlineLevelStatedValue, sn as SdtEndProperties, sr as COUNTER_FORMATS, st as HeaderFooterType, t as DOCX_CONFORMANCE_CLASSES, ti as BODY_TEXT_OUTLINE_LEVEL, tn as PropertyRevisionKind, tr as RelationshipId, tt as FieldType, u as FontInfo, ui as PARAGRAPH_ALIGNMENTS, un as Section, ur as LevelOverride, ut as Image, v as StyleType, vi as TableAlignment, vn as ShapeOutline, vr as ConditionalFormatStyle, vt as ImageWrap, w as PARSE_WARNING_CODES, wi as SCHEME_COLOR_VALUE_BY_THEME_COLOR, wn as TabContent, wr as TabLeader, wt as LineNumberRestart, x as ThemeFont, xi as BorderSpec, xn as SimpleField, xr as LineSpacingRule, xt as InlineWrapper, y as Theme, yi as TextDirection, yn as ShapeTextBody, yr as EmphasisMark, yt as ImageWrapPolygon, z as CommentRangeStart, zi as UnrecognisedBorderStyle, zn as TrackedRunChange, zr as NO_NUMBERING_NUM_ID, zt as PARAGRAPH_MARK_CHANGE_KINDS } from "../document-P82X2cGL.js";
1
+ import { $ as EndnotePosition, $n as presetLineDashFrom, $r as paragraphNumberingSlots, $t as PreservedInline, A as BlockContent, Ai as isSchemeColorValue, An as TableCellPropertyChange, Ar as TableCellFormatting, At as MoveBookmarkMarker, B as CommentReference, Bi as BorderStyleValue, Bn as TrackedChangeInfo, Br as UnderlineStyle, Bt as NoteReferenceContent, C as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, Ci as BorderSpec, Cn as SimpleField, Cr as LineSpacingRule, Ct as InlineWrapper, D as ParseWarningLocation, Di as THEME_COLOR_BY_SCHEME_COLOR_VALUE, Dn as Table, Dr as TabStop, Dt as MAX_REVISION_ID, E as ParseWarningCode, Ei as SCHEME_COLOR_VALUE_BY_THEME_COLOR, En as TabContent, Er as TabLeader, Et as LineNumberRestart, F as BreakContent, Fi as themeColorToken, Fn as TableRowPropertyChange, Fr as TablePropertyExceptionFormatting, Ft as MoveToRangeEnd, G as DocumentBackground, Gi as isBorderNone, Gn as WrapDistanceSlots, Gr as ParagraphNumberingSlots, Gt as ParagraphContent, H as DRAWING_RAW_XML_MODES, Hi as borderStyleFrom, Hn as TrackedRunContent, Hr as NO_PARAGRAPH_NUMBERING, Ht as PROPERTY_REVISION_KINDS, I as Column, Ii as SchemeColorSlot, In as TableStructuralChangeInfo, Ir as TableRowFormatting, It as MoveToRangeStart, J as DrawingAnchor, Ji as BORDER_STYLES, Jn as isOoxmlSymbolCharacter, Jr as mergeParagraphNumbering, Jt as ParagraphPropertyChange, K as DocumentBackgroundDrawing, Ki as isBorderStyle, Kn as WrapDistances, Kr as ResolvedParagraphNumbering, Kt as ParagraphMarkChange, L as Comment, Li as SchemeColorValue, Ln as TextBox, Lr as TableWidthType, Lt as NoBreakHyphenContent, M as BookmarkEnd, Mi as knownThemeColor, Mn as TablePropertyChange, Mr as TableGridChange, Mt as MoveFromRangeEnd, N as BookmarkRangeMarker, Ni as readThemeColor, Nn as TablePropertyExceptionChange, Nr as TableLook, Nt as MoveFromRangeStart, O as BIDI_CONTROLS, Oi as ThemeColorValue, On as TableCell, Or as TableBorders, Ot as MarkupRangeMarker, P as BookmarkStart, Pi as themeColorSlot, Pn as TableRow, Pr as TableMeasurement, Pt as MoveTo, Q as Endnote, Qn as isPresetLineDashVal, Qr as paragraphNumberingReferenceId, Qt as PreservedBlock, R as CommentRangeEnd, Ri as THEME_COLORS, Rn as TextContent, Rr as TextEffect, Rt as NonVisualDrawingNames, S as ThemeFontScheme, Si as TextDirectionFlow, Sn as ShapeType, Sr as FloatingTableProperties, St as InlineSdt, T as ParseWarning, Ti as ShadingProperties, Tn as SymbolContent, Tr as SpacingExplicit, Tt as InstrTextContent, U as Deletion, Ui as borderStyleToken, Un as VerticalAlign, Ur as ParagraphNumberingOverride, Ut as PageOrientation, V as ComplexField, Vi as UnrecognisedBorderStyle, Vn as TrackedRunChange, Vr as NO_NUMBERING_NUM_ID, Vt as PARAGRAPH_MARK_CHANGE_KINDS, W as DisplacedByCustomXml, Wi as isBorderNil, Wn as Watermark, Wr as ParagraphNumberingReference, Wt as Paragraph, X as DrawingRawXmlMode, Xn as PresetLineDashValue, Xr as paragraphNumberingLevel, Xt as PositionalTab, Y as DrawingContent, Yi as BorderStyle, Yn as normalizeRevisionId, Yr as paragraphNumberingFromSlots, Yt as PictureWatermark, Z as EffectExtentSlots, Zn as UnrecognisedPresetLineDash, Zr as paragraphNumberingReference, Zt as PositionedBookmarkMarker, _ as StyleDefinitions, _i as TEXT_DIRECTION_FLOWS, _n as ShapeContent, _r as NumberingDefinitions, _t as ImagePosition, a as DocxPackage, ai as OutlineLevel, an as ReviewCarrier, ar as relationshipIdOf, at as Footnote, b as ThemeColorScheme, bi as TableAlignment, bn as ShapeOutline, br as ConditionalFormatStyle, bt as ImageWrap, c as EmbeddedFontRef, ci as outlineLevelFromStatedValue, cn as RunPropertyChange, cr as AbstractNumbering, ct as HeaderFooter, d as FontTable, di as NumberFormat, dn as SdtType, dr as LevelLegacy, dt as Hyperlink, ei as resolveParagraphNumbering, en as PreservedXmlContent, er as presetLineDashToken, et as EndnoteProperties, f as MediaFile, fi as PARAGRAPH_ALIGNMENTS, fn as Section, fr as LevelOverride, ft as Image, g as Style, gi as TEXT_DIRECTIONS, gn as Shape, gr as ListRendering, gt as ImagePadding, h as RelationshipType, hi as TAB_STOP_ALIGNMENTS, hn as SectionStart, hr as ListMarkerFormatting, ht as ImageFrameLocks, i as DocxConformanceClass, ii as HeadingOutlineLevel, in as REVIEW_CARRIERS, ir as mintRelationshipId, it as FooterReference, j as BlockSdt, ji as isThemeColor, jn as TablePreservedMarkup, jr as TableFormatting, jt as MoveFrom, k as BidiControl, ki as UnrecognisedThemeColor, kn as TableCellBlock, kr as TableCellBorders, kt as MathEquation, l as FontCharset, li as outlineLevelStatedValue, ln as SdtEndProperties, lr as COUNTER_FORMATS, lt as HeaderFooterType, m as RelationshipMap, mi as TABLE_ALIGNMENTS, mn as SectionPropertyChange, mr as ListLevel, mt as ImageDocPrLink, n as Document, ni as sameStatedParagraphNumbering, nn as PropertyChangeInfo, nr as PresetLineDashVal, nt as FieldCharContent, o as ExhaustiveFields, oi as headingLevelOf, on as Run, or as PreviewDescriptor, ot as FootnotePosition, p as Relationship, pi as ParagraphAlignment, pn as SectionProperties, pr as LevelSuffix, pt as ImageCrop, q as DocumentBody, qi as statesNoBorder, qn as WrapPolygonPoint, qr as isNumberingReference, qt as ParagraphMarkChangeKind, r as DocumentSettings, ri as BODY_TEXT_OUTLINE_LEVEL, rn as PropertyRevisionKind, rr as RelationshipId, rt as FieldType, s as DocDefaults, si as headingOutlineLevel, sn as RunContent, sr as PreviewShape, st as FootnoteProperties, t as DOCX_CONFORMANCE_CLASSES, ti as sameEffectiveParagraphNumbering, tn as PropertyChange, tr as PRESET_LINE_DASH_VALS, tt as Field, u as FontInfo, ui as NUMBER_FORMATS, un as SdtProperties, ur as CounterFormat, ut as HeaderReference, v as StyleType, vi as TEXT_DIRECTION_FLOW_BY_TOKEN, vn as ShapeFill, vr as NumberingInstance, vt as ImageSize, w as PARSE_WARNING_CODES, wi as ColorValue, wn as SoftHyphenContent, wr as ParagraphFormatting, wt as Insertion, x as ThemeFont, xi as TextDirection, xn as ShapeTextBody, xr as EmphasisMark, xt as ImageWrapPolygon, y as Theme, yi as TabStopAlignment, yn as ShapeGeometryAdjustment, yr as CellMargins, yt as ImageTransform, z as CommentRangeStart, zi as ThemeColor, zn as TextWatermark, zr as TextFormatting, zt as NoteNumberRestart } from "../document-Cy1Dd6UE.js";
2
2
  import { n as PreservedChild, r as PreservedMarkup, t as PreservedAttribute } from "../preservedMarkup-G8XjWhs2.js";
3
- export { type AbstractNumbering, BIDI_CONTROLS, BODY_TEXT_OUTLINE_LEVEL, BORDER_STYLES, type BidiControl, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkRangeMarker, type BookmarkStart, type BorderSpec, type BorderStyle, type BorderStyleValue, type BreakContent, COUNTER_FORMATS, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, type CounterFormat, DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, type Deletion, type DisplacedByCustomXml, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingAnchor, type DrawingContent, type DrawingRawXmlMode, type EffectExtentSlots, type EmbeddedFontRef, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type ExhaustiveFields, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontCharset, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type HeadingOutlineLevel, type Hyperlink, type Image, type ImageCrop, type ImageDocPrLink, type ImageFrameLocks, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type ImageWrapPolygon, type InlineSdt, type InlineWrapper, type Insertion, type InstrTextContent, type LevelLegacy, type LevelOverride, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListMarkerFormatting, type ListRendering, MAX_RETAINED_PARSE_WARNINGS_PER_CODE, MAX_REVISION_ID, type MarkupRangeMarker, type MathEquation, type MediaFile, type MoveBookmarkMarker, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, NO_NUMBERING_NUM_ID, NO_PARAGRAPH_NUMBERING, NUMBER_FORMATS, type NoBreakHyphenContent, type NonVisualDrawingNames, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, type OutlineLevel, PARAGRAPH_ALIGNMENTS, PARAGRAPH_MARK_CHANGE_KINDS, PARSE_WARNING_CODES, PRESET_LINE_DASH_VALS, PROPERTY_REVISION_KINDS, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphMarkChangeKind, type ParagraphNumberingOverride, type ParagraphNumberingReference, type ParagraphNumberingSlots, type ParagraphPropertyChange, type ParseWarning, type ParseWarningCode, type ParseWarningLocation, type PictureWatermark, type PositionalTab, type PositionedBookmarkMarker, type PreservedAttribute, type PreservedBlock, type PreservedChild, type PreservedInline, type PreservedMarkup, type PreservedXmlContent, type PresetLineDashVal, type PresetLineDashValue, type PreviewDescriptor, type PreviewShape, type PropertyChange, type PropertyChangeInfo, type PropertyRevisionKind, REVIEW_CARRIERS, type Relationship, type RelationshipId, type RelationshipMap, type RelationshipType, type ResolvedParagraphNumbering, type ReviewCarrier, type Run, type RunContent, type RunPropertyChange, SCHEME_COLOR_VALUE_BY_THEME_COLOR, type SchemeColorSlot, type SchemeColorValue, type SdtEndProperties, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeGeometryAdjustment, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, TABLE_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TEXT_DIRECTIONS, TEXT_DIRECTION_FLOWS, TEXT_DIRECTION_FLOW_BY_TOKEN, THEME_COLORS, THEME_COLOR_BY_SCHEME_COLOR_VALUE, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableAlignment, type TableBorders, type TableCell, type TableCellBlock, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableGridChange, type TableLook, type TableMeasurement, type TablePreservedMarkup, type TablePropertyChange, type TablePropertyExceptionChange, type TablePropertyExceptionFormatting, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextDirection, type TextDirectionFlow, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColor, type ThemeColorScheme, type ThemeColorValue, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type TrackedRunContent, type UnderlineStyle, type UnrecognisedBorderStyle, type UnrecognisedPresetLineDash, type UnrecognisedThemeColor, type VerticalAlign, type Watermark, type WrapDistanceSlots, type WrapDistances, type WrapPolygonPoint, borderStyleFrom, borderStyleToken, headingLevelOf, headingOutlineLevel, isBorderNil, isBorderNone, isBorderStyle, isNumberingReference, isOoxmlSymbolCharacter, isPresetLineDashVal, isSchemeColorValue, isThemeColor, knownThemeColor, mergeParagraphNumbering, mintRelationshipId, normalizeRevisionId, outlineLevelFromStatedValue, outlineLevelStatedValue, paragraphNumberingFromSlots, paragraphNumberingLevel, paragraphNumberingReference, paragraphNumberingReferenceId, paragraphNumberingSlots, presetLineDashFrom, presetLineDashToken, readThemeColor, relationshipIdOf, resolveParagraphNumbering, sameEffectiveParagraphNumbering, sameStatedParagraphNumbering, statesNoBorder, themeColorSlot, themeColorToken };
3
+ export { type AbstractNumbering, BIDI_CONTROLS, BODY_TEXT_OUTLINE_LEVEL, BORDER_STYLES, type BidiControl, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkRangeMarker, type BookmarkStart, type BorderSpec, type BorderStyle, type BorderStyleValue, type BreakContent, COUNTER_FORMATS, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, type CounterFormat, DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, type Deletion, type DisplacedByCustomXml, type DocDefaults, Document, type DocumentBackground, type DocumentBackgroundDrawing, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingAnchor, type DrawingContent, type DrawingRawXmlMode, type EffectExtentSlots, type EmbeddedFontRef, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type ExhaustiveFields, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontCharset, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type HeadingOutlineLevel, type Hyperlink, type Image, type ImageCrop, type ImageDocPrLink, type ImageFrameLocks, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type ImageWrapPolygon, type InlineSdt, type InlineWrapper, type Insertion, type InstrTextContent, type LevelLegacy, type LevelOverride, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListMarkerFormatting, type ListRendering, MAX_RETAINED_PARSE_WARNINGS_PER_CODE, MAX_REVISION_ID, type MarkupRangeMarker, type MathEquation, type MediaFile, type MoveBookmarkMarker, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, NO_NUMBERING_NUM_ID, NO_PARAGRAPH_NUMBERING, NUMBER_FORMATS, type NoBreakHyphenContent, type NonVisualDrawingNames, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, type OutlineLevel, PARAGRAPH_ALIGNMENTS, PARAGRAPH_MARK_CHANGE_KINDS, PARSE_WARNING_CODES, PRESET_LINE_DASH_VALS, PROPERTY_REVISION_KINDS, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphMarkChangeKind, type ParagraphNumberingOverride, type ParagraphNumberingReference, type ParagraphNumberingSlots, type ParagraphPropertyChange, type ParseWarning, type ParseWarningCode, type ParseWarningLocation, type PictureWatermark, type PositionalTab, type PositionedBookmarkMarker, type PreservedAttribute, type PreservedBlock, type PreservedChild, type PreservedInline, type PreservedMarkup, type PreservedXmlContent, type PresetLineDashVal, type PresetLineDashValue, type PreviewDescriptor, type PreviewShape, type PropertyChange, type PropertyChangeInfo, type PropertyRevisionKind, REVIEW_CARRIERS, type Relationship, type RelationshipId, type RelationshipMap, type RelationshipType, type ResolvedParagraphNumbering, type ReviewCarrier, type Run, type RunContent, type RunPropertyChange, SCHEME_COLOR_VALUE_BY_THEME_COLOR, type SchemeColorSlot, type SchemeColorValue, type SdtEndProperties, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeGeometryAdjustment, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, TABLE_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TEXT_DIRECTIONS, TEXT_DIRECTION_FLOWS, TEXT_DIRECTION_FLOW_BY_TOKEN, THEME_COLORS, THEME_COLOR_BY_SCHEME_COLOR_VALUE, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableAlignment, type TableBorders, type TableCell, type TableCellBlock, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableGridChange, type TableLook, type TableMeasurement, type TablePreservedMarkup, type TablePropertyChange, type TablePropertyExceptionChange, type TablePropertyExceptionFormatting, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextDirection, type TextDirectionFlow, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColor, type ThemeColorScheme, type ThemeColorValue, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type TrackedRunContent, type UnderlineStyle, type UnrecognisedBorderStyle, type UnrecognisedPresetLineDash, type UnrecognisedThemeColor, type VerticalAlign, type Watermark, type WrapDistanceSlots, type WrapDistances, type WrapPolygonPoint, borderStyleFrom, borderStyleToken, headingLevelOf, headingOutlineLevel, isBorderNil, isBorderNone, isBorderStyle, isNumberingReference, isOoxmlSymbolCharacter, isPresetLineDashVal, isSchemeColorValue, isThemeColor, knownThemeColor, mergeParagraphNumbering, mintRelationshipId, normalizeRevisionId, outlineLevelFromStatedValue, outlineLevelStatedValue, paragraphNumberingFromSlots, paragraphNumberingLevel, paragraphNumberingReference, paragraphNumberingReferenceId, paragraphNumberingSlots, presetLineDashFrom, presetLineDashToken, readThemeColor, relationshipIdOf, resolveParagraphNumbering, sameEffectiveParagraphNumbering, sameStatedParagraphNumbering, statesNoBorder, themeColorSlot, themeColorToken };
@@ -1,2 +1,2 @@
1
- import { $ as paragraphNumberingSlots, A as THEME_COLOR_BY_SCHEME_COLOR_VALUE, B as BODY_TEXT_OUTLINE_LEVEL, C as PARAGRAPH_ALIGNMENTS, D as TEXT_DIRECTION_FLOWS, E as TEXT_DIRECTIONS, F as themeColorSlot, G as NO_NUMBERING_NUM_ID, H as headingOutlineLevel, I as themeColorToken, J as mergeParagraphNumbering, K as NO_PARAGRAPH_NUMBERING, L as THEME_COLORS, M as isThemeColor, N as knownThemeColor, O as TEXT_DIRECTION_FLOW_BY_TOKEN, P as readThemeColor, Q as paragraphNumberingReferenceId, R as mintRelationshipId, S as NUMBER_FORMATS, T as TAB_STOP_ALIGNMENTS, U as outlineLevelFromStatedValue, V as headingLevelOf, W as outlineLevelStatedValue, X as paragraphNumberingLevel, Y as paragraphNumberingFromSlots, Z as paragraphNumberingReference, _ as isBorderNil, a as PARAGRAPH_MARK_CHANGE_KINDS, b as statesNoBorder, c as isOoxmlSymbolCharacter, d as isPresetLineDashVal, et as resolveParagraphNumbering, f as presetLineDashFrom, g as borderStyleToken, h as borderStyleFrom, i as MAX_REVISION_ID, it as PARSE_WARNING_CODES, j as isSchemeColorValue, k as SCHEME_COLOR_VALUE_BY_THEME_COLOR, l as normalizeRevisionId, m as PRESET_LINE_DASH_VALS, n as BIDI_CONTROLS, nt as sameStatedParagraphNumbering, o as PROPERTY_REVISION_KINDS, p as presetLineDashToken, q as isNumberingReference, r as DRAWING_RAW_XML_MODES, rt as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, s as REVIEW_CARRIERS, t as DOCX_CONFORMANCE_CLASSES, tt as sameEffectiveParagraphNumbering, u as COUNTER_FORMATS, v as isBorderNone, w as TABLE_ALIGNMENTS, x as BORDER_STYLES, y as isBorderStyle, z as relationshipIdOf } from "../document-DJuN_2kr.js";
1
+ import { $ as paragraphNumberingReferenceId, A as SCHEME_COLOR_VALUE_BY_THEME_COLOR, B as relationshipIdOf, C as NUMBER_FORMATS, D as TEXT_DIRECTIONS, E as TAB_STOP_ALIGNMENTS, F as readThemeColor, G as outlineLevelStatedValue, H as headingLevelOf, I as themeColorSlot, J as isNumberingReference, K as NO_NUMBERING_NUM_ID, L as themeColorToken, M as isSchemeColorValue, N as isThemeColor, O as TEXT_DIRECTION_FLOWS, P as knownThemeColor, Q as paragraphNumberingReference, R as THEME_COLORS, S as BORDER_STYLES, T as TABLE_ALIGNMENTS, U as headingOutlineLevel, V as BODY_TEXT_OUTLINE_LEVEL, W as outlineLevelFromStatedValue, X as paragraphNumberingFromSlots, Y as mergeParagraphNumbering, Z as paragraphNumberingLevel, _ as borderStyleToken, a as PARAGRAPH_MARK_CHANGE_KINDS, at as PARSE_WARNING_CODES, b as isBorderStyle, d as COUNTER_FORMATS, et as paragraphNumberingSlots, f as isPresetLineDashVal, g as borderStyleFrom, h as PRESET_LINE_DASH_VALS, i as MAX_REVISION_ID, it as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, j as THEME_COLOR_BY_SCHEME_COLOR_VALUE, k as TEXT_DIRECTION_FLOW_BY_TOKEN, l as isOoxmlSymbolCharacter, m as presetLineDashToken, n as BIDI_CONTROLS, nt as sameEffectiveParagraphNumbering, o as PROPERTY_REVISION_KINDS, p as presetLineDashFrom, q as NO_PARAGRAPH_NUMBERING, r as DRAWING_RAW_XML_MODES, rt as sameStatedParagraphNumbering, s as REVIEW_CARRIERS, t as DOCX_CONFORMANCE_CLASSES, tt as resolveParagraphNumbering, u as normalizeRevisionId, v as isBorderNil, w as PARAGRAPH_ALIGNMENTS, x as statesNoBorder, y as isBorderNone, z as mintRelationshipId } from "../document-Bz9rYlJI.js";
2
2
  export { BIDI_CONTROLS, BODY_TEXT_OUTLINE_LEVEL, BORDER_STYLES, COUNTER_FORMATS, DOCX_CONFORMANCE_CLASSES, DRAWING_RAW_XML_MODES, MAX_RETAINED_PARSE_WARNINGS_PER_CODE, MAX_REVISION_ID, NO_NUMBERING_NUM_ID, NO_PARAGRAPH_NUMBERING, NUMBER_FORMATS, PARAGRAPH_ALIGNMENTS, PARAGRAPH_MARK_CHANGE_KINDS, PARSE_WARNING_CODES, PRESET_LINE_DASH_VALS, PROPERTY_REVISION_KINDS, REVIEW_CARRIERS, SCHEME_COLOR_VALUE_BY_THEME_COLOR, TABLE_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TEXT_DIRECTIONS, TEXT_DIRECTION_FLOWS, TEXT_DIRECTION_FLOW_BY_TOKEN, THEME_COLORS, THEME_COLOR_BY_SCHEME_COLOR_VALUE, borderStyleFrom, borderStyleToken, headingLevelOf, headingOutlineLevel, isBorderNil, isBorderNone, isBorderStyle, isNumberingReference, isOoxmlSymbolCharacter, isPresetLineDashVal, isSchemeColorValue, isThemeColor, knownThemeColor, mergeParagraphNumbering, mintRelationshipId, normalizeRevisionId, outlineLevelFromStatedValue, outlineLevelStatedValue, paragraphNumberingFromSlots, paragraphNumberingLevel, paragraphNumberingReference, paragraphNumberingReferenceId, paragraphNumberingSlots, presetLineDashFrom, presetLineDashToken, readThemeColor, relationshipIdOf, resolveParagraphNumbering, sameEffectiveParagraphNumbering, sameStatedParagraphNumbering, statesNoBorder, themeColorSlot, themeColorToken };
@@ -58,7 +58,7 @@ type SerializeSequenceChildrenOptions<Container extends SequenceContainer> = {
58
58
  /** Whether a captured child is exactly one bounded, well-formed XML element. */
59
59
  declare const isSafePreservedChildXml: (xml: string) => boolean;
60
60
  /** Whether a capture collection stays within its aggregate resource budget. */
61
- declare const isWithinPreservedMarkupBudget: (children: readonly unknown[]) => boolean;
61
+ declare const isWithinPreservedMarkupBudget: (children: Iterable<unknown>) => boolean;
62
62
  /** Reject unsafe captured children before a caller performs any transformation. */
63
63
  declare const assertSafePreservedMarkup: (preserved: PreservedMarkup | undefined) => void;
64
64
  /**
@@ -1,2 +1,2 @@
1
- import { a as SEQUENCE_CHILDREN, i as serializeSequenceChildren, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, t as assertSafePreservedMarkup } from "../sequenceChildren-DlUb7FZG.js";
1
+ import { a as SEQUENCE_CHILDREN, i as serializeSequenceChildren, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, t as assertSafePreservedMarkup } from "../sequenceChildren-BIixCB49.js";
2
2
  export { SEQUENCE_CHILDREN, assertSafePreservedMarkup, isSafePreservedChildXml, isWithinPreservedMarkupBudget, serializeSequenceChildren };
@@ -410,9 +410,11 @@ const isSafePreservedChildXml = (xml) => {
410
410
  };
411
411
  /** Whether a capture collection stays within its aggregate resource budget. */
412
412
  const isWithinPreservedMarkupBudget = (children) => {
413
- if (children.length > MAX_PRESERVED_CHILD_COUNT) return false;
413
+ let count = 0;
414
414
  let characters = 0;
415
415
  for (const child of children) {
416
+ count += 1;
417
+ if (count > MAX_PRESERVED_CHILD_COUNT) return false;
416
418
  if (!isRecord(child)) continue;
417
419
  const xml = child["xml"];
418
420
  if (typeof xml !== "string") continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/docx-core",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "description": "Typed OOXML/DOCX model, validation, serialization, legal-source compilation, and browser-native package projection.",
5
5
  "keywords": [
6
6
  "document-model",