@stll/docx-core 0.28.0 → 0.28.1

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.
@@ -68,7 +68,13 @@ const PARSE_WARNING_CODES = {
68
68
  /** A style set naming an initial paragraph style it does not contain. */
69
69
  styleSetInitialStyleMissing: "style-set-initial-style-missing",
70
70
  /** An explicit page-break run the editable model lays out approximately. */
71
- pageBreakProjectionApproximated: "page-break-projection-approximated"
71
+ pageBreakProjectionApproximated: "page-break-projection-approximated",
72
+ /** An altChunk payload Folio preserves but cannot safely interpret. */
73
+ altChunkUnsupported: "alt-chunk-unsupported",
74
+ /** A block-level tracked-change wrapper Folio preserves without interpreting. */
75
+ revisionCarrierOpaque: "revision-carrier-opaque",
76
+ /** A row nested where the table model can only preserve it as opaque markup. */
77
+ nestedRowOpaque: "nested-row-opaque"
72
78
  };
73
79
  /**
74
80
  * The cap on retained warnings per code.
@@ -1787,6 +1787,9 @@ type PositionedBookmarkMarker = {
1787
1787
  marker: BookmarkStart | BookmarkEnd;
1788
1788
  /** Row- or cell-level controls whose content held this marker. */
1789
1789
  contentControls?: SdtProperties[];
1790
+ /** Table/row custom-XML wrappers whose content held this marker. */
1791
+ /** Original mixed order of transparent wrappers around this marker. */
1792
+ carrierStack?: TableContentCarrier[];
1790
1793
  };
1791
1794
  /**
1792
1795
  * Known field types
@@ -1838,9 +1841,11 @@ type ComplexField = {
1838
1841
  fldLock?: boolean;
1839
1842
  /** `@w:dirty`: absent states nothing, `false` explicitly forbids a recompute. */
1840
1843
  dirty?: boolean;
1844
+ /** Captured `w:ffData` on the begin field character, including form state. */
1845
+ formFieldDataXml?: string;
1841
1846
  /**
1842
1847
  * `fieldResult` is a display fallback the reader synthesized (e.g. a legacy
1843
- * `FORMCHECKBOX` with no cached `w:ffData` result run), not content this
1848
+ * `FORMCHECKBOX` with no cached result run), not content this
1844
1849
  * field's source ever authored. A serializer honoring this leaves the
1845
1850
  * result out, so an unedited field keeps its original, resultless bytes
1846
1851
  * instead of gaining a run the source never had.
@@ -2408,6 +2413,8 @@ type TableCell = {
2408
2413
  * wrapper.
2409
2414
  */
2410
2415
  contentControls?: SdtProperties[];
2416
+ /** Original mixed order of customXml and SDT wrappers around this cell. */
2417
+ carrierStack?: TableContentCarrier[];
2411
2418
  };
2412
2419
  /**
2413
2420
  * A table or row child the verbatim sink kept, including the content-control
@@ -2421,8 +2428,24 @@ type TableCell = {
2421
2428
  type TablePreservedMarkup = {
2422
2429
  children?: (PreservedChild & {
2423
2430
  contentControls?: SdtProperties[];
2431
+ carrierStack?: TableContentCarrier[];
2424
2432
  })[];
2425
2433
  };
2434
+ /** Replayable shell for a transparent custom-XML wrapper around table structure. */
2435
+ type TableCustomXmlWrapper = {
2436
+ /** Parser-assigned identity; equal shell markup can still name distinct wrappers. */
2437
+ id: number;
2438
+ openingXml: string;
2439
+ closingXml: string;
2440
+ };
2441
+ /** Ordered transparent carrier stack on table, row and cell children. */
2442
+ type TableContentCarrier = {
2443
+ type: "customXml";
2444
+ wrapper: TableCustomXmlWrapper;
2445
+ } | {
2446
+ type: "sdt";
2447
+ properties: SdtProperties;
2448
+ };
2426
2449
  /**
2427
2450
  * Table row
2428
2451
  */
@@ -2504,6 +2527,8 @@ type TableRow = {
2504
2527
  * them.
2505
2528
  */
2506
2529
  contentControls?: SdtProperties[];
2530
+ /** Original mixed order of customXml and SDT wrappers around this row. */
2531
+ carrierStack?: TableContentCarrier[];
2507
2532
  };
2508
2533
  /**
2509
2534
  * Table (w:tbl)
@@ -2539,6 +2564,8 @@ type Table = {
2539
2564
  * joining {@link Table.preserved}.
2540
2565
  */
2541
2566
  bookmarks?: PositionedBookmarkMarker[];
2567
+ /** Original mixed order of customXml and SDT wrappers around this table's rows. */
2568
+ carrierStack?: TableContentCarrier[];
2542
2569
  };
2543
2570
  /**
2544
2571
  * A comment (w:comment) from comments.xml
@@ -3098,6 +3125,16 @@ type BlockSdt = {
3098
3125
  /** Block content inside the control. */
3099
3126
  content: BlockContent[];
3100
3127
  };
3128
+ /** Transparent block-level `w:customXml` wrapper. */
3129
+ type BlockCustomXml = {
3130
+ type: "blockCustomXml";
3131
+ /** Replayable start tag, including attributes and in-scope namespace bindings. */
3132
+ openingXml: string;
3133
+ /** Replayable end tag matching `openingXml`. */
3134
+ closingXml: string;
3135
+ /** Parsed block children; `w:customXmlPr` remains a positioned preserved child. */
3136
+ content: BlockContent[];
3137
+ };
3101
3138
  /**
3102
3139
  * Paragraph content types
3103
3140
  */
@@ -3553,6 +3590,8 @@ type PreservedBlock = {
3553
3590
  type: "preservedBlock";
3554
3591
  /** Replayable markup for one child, as `captureVerbatimXml` wrote it. */
3555
3592
  xml: string;
3593
+ /** Plain text safely extracted from a related w:altChunk part, when available. */
3594
+ readerText?: string;
3556
3595
  };
3557
3596
  /**
3558
3597
  * Block-level content types
@@ -3572,7 +3611,7 @@ type PreservedBlock = {
3572
3611
  * the paragraph-level half unpaired, and an unpaired boundary is deleted: the
3573
3612
  * bookmark would not merely move, it would go.
3574
3613
  */
3575
- type BlockContent = Paragraph | Table | BlockSdt | PreservedBlock | BookmarkStart | BookmarkEnd;
3614
+ type BlockContent = Paragraph | Table | BlockSdt | BlockCustomXml | PreservedBlock | BookmarkStart | BookmarkEnd;
3576
3615
  /** A block that can occur inside a table cell. */
3577
3616
  type TableCellBlock = BlockContent;
3578
3617
  /**
@@ -3698,6 +3737,12 @@ declare const PARSE_WARNING_CODES: {
3698
3737
  readonly styleSetInitialStyleMissing: "style-set-initial-style-missing";
3699
3738
  /** An explicit page-break run the editable model lays out approximately. */
3700
3739
  readonly pageBreakProjectionApproximated: "page-break-projection-approximated";
3740
+ /** An altChunk payload Folio preserves but cannot safely interpret. */
3741
+ readonly altChunkUnsupported: "alt-chunk-unsupported";
3742
+ /** A block-level tracked-change wrapper Folio preserves without interpreting. */
3743
+ readonly revisionCarrierOpaque: "revision-carrier-opaque";
3744
+ /** A row nested where the table model can only preserve it as opaque markup. */
3745
+ readonly nestedRowOpaque: "nested-row-opaque";
3701
3746
  };
3702
3747
  type ParseWarningCode = (typeof PARSE_WARNING_CODES)[keyof typeof PARSE_WARNING_CODES];
3703
3748
  /** Where a warning happened, as precisely as the part can say. */
@@ -4160,4 +4205,4 @@ type Document = {
4160
4205
  parseWarnings?: ParseWarning[];
4161
4206
  };
4162
4207
  //#endregion
4163
- export { Endnote as $, UnrecognisedPresetLineDash as $n, paragraphNumberingReference as $r, PreservedBlock as $t, BlockContent as A, ThemeColorValue as Ai, TableCell as An, TableBorders as Ar, MathEquation as At, CommentReference as B, THEME_COLORS as Bi, TextContent as Bn, TextEffect as Br, NoteNumberRestart as Bt, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as C, TextDirection as Ci, ShapeTextBody as Cn, EmphasisMark as Cr, InlineSdt as Ct, ParseWarningLocation as D, ShadingProperties as Di, SymbolContent as Dn, SpacingExplicit as Dr, LineNumberRestart as Dt, ParseWarningCode as E, ColorValue as Ei, SoftHyphenContent as En, ParagraphFormatting as Er, InstrTextContent as Et, BreakContent as F, readThemeColor as Fi, TablePropertyExceptionChange as Fn, TableLook as Fr, MoveTo as Ft, DocumentBackground as G, borderStyleToken as Gi, VerticalAlign as Gn, ParagraphNumberingOverride as Gr, Paragraph as Gt, DRAWING_RAW_XML_MODES as H, BorderStyleValue as Hi, TrackedChangeInfo as Hn, UnderlineStyle as Hr, PARAGRAPH_MARK_CHANGE_KINDS as Ht, Column as I, themeColorSlot as Ii, TableRow as In, TableMeasurement as Ir, MoveToRangeEnd as It, DrawingAnchor as J, isBorderStyle as Ji, WrapDistances as Jn, ResolvedParagraphNumbering as Jr, ParagraphMarkChangeKind as Jt, DocumentBackgroundDrawing as K, isBorderNil as Ki, Watermark as Kn, ParagraphNumberingReference as Kr, ParagraphContent as Kt, Comment as L, themeColorToken as Li, TableRowPropertyChange as Ln, TablePropertyExceptionFormatting as Lr, MoveToRangeStart as Lt, BookmarkEnd as M, isSchemeColorValue as Mi, TableCellPropertyChange as Mn, TableCellFormatting as Mr, MoveFrom as Mt, BookmarkRangeMarker as N, isThemeColor as Ni, TablePreservedMarkup as Nn, TableFormatting as Nr, MoveFromRangeEnd as Nt, BIDI_CONTROLS as O, SCHEME_COLOR_VALUE_BY_THEME_COLOR as Oi, TabContent as On, TabLeader as Or, MAX_REVISION_ID as Ot, BookmarkStart as P, knownThemeColor as Pi, TablePropertyChange as Pn, TableGridChange as Pr, MoveFromRangeStart as Pt, EffectExtentSlots as Q, PresetLineDashValue as Qn, paragraphNumberingLevel as Qr, PositionedBookmarkMarker as Qt, CommentRangeEnd as R, SchemeColorSlot as Ri, TableStructuralChangeInfo as Rn, TableRowFormatting as Rr, NoBreakHyphenContent as Rt, ThemeFontScheme as S, TableAlignment as Si, ShapeOutline as Sn, ConditionalFormatStyle as Sr, ImageWrapPolygon as St, ParseWarning as T, BorderSpec as Ti, SimpleField as Tn, LineSpacingRule as Tr, Insertion as Tt, Deletion as U, UnrecognisedBorderStyle as Ui, TrackedRunChange as Un, NO_NUMBERING_NUM_ID as Ur, PROPERTY_REVISION_KINDS as Ut, ComplexField as V, ThemeColor as Vi, TextWatermark as Vn, TextFormatting as Vr, NoteReferenceContent as Vt, DisplacedByCustomXml as W, borderStyleFrom as Wi, TrackedRunContent as Wn, NO_PARAGRAPH_NUMBERING as Wr, PageOrientation as Wt, DrawingGroupChild as X, BORDER_STYLES as Xi, isOoxmlSymbolCharacter as Xn, mergeParagraphNumbering as Xr, PictureWatermark as Xt, DrawingContent as Y, statesNoBorder as Yi, WrapPolygonPoint as Yn, isNumberingReference as Yr, ParagraphPropertyChange as Yt, DrawingRawXmlMode as Z, BorderStyle as Zi, normalizeRevisionId as Zn, paragraphNumberingFromSlots as Zr, PositionalTab as Zt, StyleDefinitions as _, TAB_STOP_ALIGNMENTS as _i, Shape as _n, ListMarkerFormatting as _r, ImagePadding as _t, DocxPackage as a, BODY_TEXT_OUTLINE_LEVEL as ai, REVIEW_CARRIERS as an, RelationshipId as ar, FooterReference as at, ThemeColorScheme as b, TEXT_DIRECTION_FLOW_BY_TOKEN as bi, ShapeFill as bn, NumberingInstance as br, ImageTransform as bt, EmbeddedFontRef as c, headingLevelOf as ci, RunContent as cn, PreviewDescriptor as cr, FootnoteProperties as ct, FontTable as d, outlineLevelStatedValue as di, SdtProperties as dn, COUNTER_FORMATS as dr, HeaderReference as dt, paragraphNumberingReferenceId as ei, PreservedInline as en, isPresetLineDashVal as er, EndnotePosition as et, MediaFile as f, NUMBER_FORMATS as fi, SdtType as fn, CounterFormat as fr, Hyperlink as ft, Style as g, TABLE_ALIGNMENTS as gi, SectionStart as gn, ListLevel as gr, ImageFrameLocks as gt, RelationshipType as h, ParagraphAlignment as hi, SectionPropertyChange as hn, LevelSuffix as hr, ImageDocPrLink as ht, DocxConformanceClass as i, sameStatedParagraphNumbering as ii, PropertyRevisionKind as in, PresetLineDashVal as ir, FieldType as it, BlockSdt as j, UnrecognisedThemeColor as ji, TableCellBlock as jn, TableCellBorders as jr, MoveBookmarkMarker as jt, BidiControl as k, THEME_COLOR_BY_SCHEME_COLOR_VALUE as ki, Table as kn, TabStop as kr, MarkupRangeMarker as kt, FontCharset as l, headingOutlineLevel as li, RunPropertyChange as ln, PreviewShape as lr, HeaderFooter as lt, RelationshipMap as m, PARAGRAPH_ALIGNMENTS as mi, SectionProperties as mn, LevelOverride as mr, ImageCrop as mt, Document as n, resolveParagraphNumbering as ni, PropertyChange as nn, presetLineDashToken as nr, Field as nt, ExhaustiveFields as o, HeadingOutlineLevel as oi, ReviewCarrier as on, mintRelationshipId as or, Footnote as ot, Relationship as p, NumberFormat as pi, Section as pn, LevelLegacy as pr, Image as pt, DocumentBody as q, isBorderNone as qi, WrapDistanceSlots as qn, ParagraphNumberingSlots as qr, ParagraphMarkChange as qt, DocumentSettings as r, sameEffectiveParagraphNumbering as ri, PropertyChangeInfo as rn, PRESET_LINE_DASH_VALS as rr, FieldCharContent as rt, DocDefaults as s, OutlineLevel as si, Run as sn, relationshipIdOf as sr, FootnotePosition as st, DOCX_CONFORMANCE_CLASSES as t, paragraphNumberingSlots as ti, PreservedXmlContent as tn, presetLineDashFrom as tr, EndnoteProperties as tt, FontInfo as u, outlineLevelFromStatedValue as ui, SdtEndProperties as un, AbstractNumbering as ur, HeaderFooterType as ut, StyleType as v, TEXT_DIRECTIONS as vi, ShapeAlternateContent as vn, ListRendering as vr, ImagePosition as vt, PARSE_WARNING_CODES as w, TextDirectionFlow as wi, ShapeType as wn, FloatingTableProperties as wr, InlineWrapper as wt, ThemeFont as x, TabStopAlignment as xi, ShapeGeometryAdjustment as xn, CellMargins as xr, ImageWrap as xt, Theme as y, TEXT_DIRECTION_FLOWS as yi, ShapeContent as yn, NumberingDefinitions as yr, ImageSize as yt, CommentRangeStart as z, SchemeColorValue as zi, TextBox as zn, TableWidthType as zr, NonVisualDrawingNames as zt };
4208
+ export { EffectExtentSlots as $, BORDER_STYLES as $i, isOoxmlSymbolCharacter as $n, mergeParagraphNumbering as $r, PositionedBookmarkMarker as $t, BlockContent as A, ShadingProperties as Ai, Table as An, SpacingExplicit as Ar, MarkupRangeMarker as At, CommentRangeStart as B, themeColorToken as Bi, TableRowPropertyChange as Bn, TablePropertyExceptionFormatting as Br, NonVisualDrawingNames as Bt, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as C, TEXT_DIRECTION_FLOW_BY_TOKEN as Ci, ShapeOutline as Cn, NumberingInstance as Cr, ImageWrapPolygon as Ct, ParseWarningLocation as D, TextDirectionFlow as Di, SoftHyphenContent as Dn, FloatingTableProperties as Dr, InstrTextContent as Dt, ParseWarningCode as E, TextDirection as Ei, SimpleField as En, EmphasisMark as Er, Insertion as Et, BookmarkStart as F, isSchemeColorValue as Fi, TableCustomXmlWrapper as Fn, TableCellFormatting as Fr, MoveFromRangeStart as Ft, DisplacedByCustomXml as G, BorderStyleValue as Gi, TrackedChangeInfo as Gn, UnderlineStyle as Gr, PageOrientation as Gt, ComplexField as H, SchemeColorValue as Hi, TextBox as Hn, TableWidthType as Hr, NoteReferenceContent as Ht, BreakContent as I, isThemeColor as Ii, TablePreservedMarkup as In, TableFormatting as Ir, MoveTo as It, DocumentBody as J, borderStyleToken as Ji, VerticalAlign as Jn, ParagraphNumberingOverride as Jr, ParagraphMarkChange as Jt, DocumentBackground as K, UnrecognisedBorderStyle as Ki, TrackedRunChange as Kn, NO_NUMBERING_NUM_ID as Kr, Paragraph as Kt, Column as L, knownThemeColor as Li, TablePropertyChange as Ln, TableGridChange as Lr, MoveToRangeEnd as Lt, BlockSdt as M, THEME_COLOR_BY_SCHEME_COLOR_VALUE as Mi, TableCellBlock as Mn, TabStop as Mr, MoveBookmarkMarker as Mt, BookmarkEnd as N, ThemeColorValue as Ni, TableCellPropertyChange as Nn, TableBorders as Nr, MoveFrom as Nt, BIDI_CONTROLS as O, BorderSpec as Oi, SymbolContent as On, LineSpacingRule as Or, LineNumberRestart as Ot, BookmarkRangeMarker as P, UnrecognisedThemeColor as Pi, TableContentCarrier as Pn, TableCellBorders as Pr, MoveFromRangeEnd as Pt, DrawingRawXmlMode as Q, statesNoBorder as Qi, WrapPolygonPoint as Qn, isNumberingReference as Qr, PositionalTab as Qt, Comment as R, readThemeColor as Ri, TablePropertyExceptionChange as Rn, TableLook as Rr, MoveToRangeStart as Rt, ThemeFontScheme as S, TEXT_DIRECTION_FLOWS as Si, ShapeGeometryAdjustment as Sn, NumberingDefinitions as Sr, ImageWrap as St, ParseWarning as T, TableAlignment as Ti, ShapeType as Tn, ConditionalFormatStyle as Tr, InlineWrapper as Tt, DRAWING_RAW_XML_MODES as U, THEME_COLORS as Ui, TextContent as Un, TextEffect as Ur, PARAGRAPH_MARK_CHANGE_KINDS as Ut, CommentReference as V, SchemeColorSlot as Vi, TableStructuralChangeInfo as Vn, TableRowFormatting as Vr, NoteNumberRestart as Vt, Deletion as W, ThemeColor as Wi, TextWatermark as Wn, TextFormatting as Wr, PROPERTY_REVISION_KINDS as Wt, DrawingContent as X, isBorderNone as Xi, WrapDistanceSlots as Xn, ParagraphNumberingSlots as Xr, ParagraphPropertyChange as Xt, DrawingAnchor as Y, isBorderNil as Yi, Watermark as Yn, ParagraphNumberingReference as Yr, ParagraphMarkChangeKind as Yt, DrawingGroupChild as Z, isBorderStyle as Zi, WrapDistances as Zn, ResolvedParagraphNumbering as Zr, PictureWatermark as Zt, StyleDefinitions as _, PARAGRAPH_ALIGNMENTS as _i, SectionStart as _n, LevelOverride as _r, ImageFrameLocks as _t, DocxPackage as a, resolveParagraphNumbering as ai, PropertyRevisionKind as an, presetLineDashToken as ar, FieldType as at, ThemeColorScheme as b, TAB_STOP_ALIGNMENTS as bi, ShapeContent as bn, ListMarkerFormatting as br, ImageSize as bt, EmbeddedFontRef as c, BODY_TEXT_OUTLINE_LEVEL as ci, Run as cn, RelationshipId as cr, FootnotePosition as ct, FontTable as d, headingLevelOf as di, SdtEndProperties as dn, PreviewDescriptor as dr, HeaderFooterType as dt, BorderStyle as ea, paragraphNumberingFromSlots as ei, PreservedBlock as en, normalizeRevisionId as er, Endnote as et, MediaFile as f, headingOutlineLevel as fi, SdtProperties as fn, PreviewShape as fr, HeaderReference as ft, Style as g, NumberFormat as gi, SectionPropertyChange as gn, LevelLegacy as gr, ImageDocPrLink as gt, RelationshipType as h, NUMBER_FORMATS as hi, SectionProperties as hn, CounterFormat as hr, ImageCrop as ht, DocxConformanceClass as i, paragraphNumberingSlots as ii, PropertyChangeInfo as in, presetLineDashFrom as ir, FieldCharContent as it, BlockCustomXml as j, SCHEME_COLOR_VALUE_BY_THEME_COLOR as ji, TableCell as jn, TabLeader as jr, MathEquation as jt, BidiControl as k, ColorValue as ki, TabContent as kn, ParagraphFormatting as kr, MAX_REVISION_ID as kt, FontCharset as l, HeadingOutlineLevel as li, RunContent as ln, mintRelationshipId as lr, FootnoteProperties as lt, RelationshipMap as m, outlineLevelStatedValue as mi, Section as mn, COUNTER_FORMATS as mr, Image as mt, Document as n, paragraphNumberingReference as ni, PreservedXmlContent as nn, UnrecognisedPresetLineDash as nr, EndnoteProperties as nt, ExhaustiveFields as o, sameEffectiveParagraphNumbering as oi, REVIEW_CARRIERS as on, PRESET_LINE_DASH_VALS as or, FooterReference as ot, Relationship as p, outlineLevelFromStatedValue as pi, SdtType as pn, AbstractNumbering as pr, Hyperlink as pt, DocumentBackgroundDrawing as q, borderStyleFrom as qi, TrackedRunContent as qn, NO_PARAGRAPH_NUMBERING as qr, ParagraphContent as qt, DocumentSettings as r, paragraphNumberingReferenceId as ri, PropertyChange as rn, isPresetLineDashVal as rr, Field as rt, DocDefaults as s, sameStatedParagraphNumbering as si, ReviewCarrier as sn, PresetLineDashVal as sr, Footnote as st, DOCX_CONFORMANCE_CLASSES as t, paragraphNumberingLevel as ti, PreservedInline as tn, PresetLineDashValue as tr, EndnotePosition as tt, FontInfo as u, OutlineLevel as ui, RunPropertyChange as un, relationshipIdOf as ur, HeaderFooter as ut, StyleType as v, ParagraphAlignment as vi, Shape as vn, LevelSuffix as vr, ImagePadding as vt, PARSE_WARNING_CODES as w, TabStopAlignment as wi, ShapeTextBody as wn, CellMargins as wr, InlineSdt as wt, ThemeFont as x, TEXT_DIRECTIONS as xi, ShapeFill as xn, ListRendering as xr, ImageTransform as xt, Theme as y, TABLE_ALIGNMENTS as yi, ShapeAlternateContent as yn, ListLevel as yr, ImagePosition as yt, CommentRangeEnd as z, themeColorSlot as zi, TableRow as zn, TableMeasurement as zr, NoBreakHyphenContent as zt };
Binary file
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as BlockContent, An as TableCell, Bn as TextContent, F as BreakContent, G as DocumentBackground, Gt as Paragraph, In as TableRow, K as DocumentBackgroundDrawing, Kt as ParagraphContent, Zt as PositionalTab, a as DocxPackage, cn as RunContent, g as Style, i as DocxConformanceClass, kn as Table, mn as SectionProperties, n as Document, q as DocumentBody, sn as Run, t as DOCX_CONFORMANCE_CLASSES, yr as NumberingDefinitions } from "./document-BtGS_I3E.js";
1
+ import { A as BlockContent, An as Table, I as BreakContent, J as DocumentBody, K as DocumentBackground, Kt as Paragraph, Qt as PositionalTab, Sr as NumberingDefinitions, Un as TextContent, a as DocxPackage, cn as Run, g as Style, hn as SectionProperties, i as DocxConformanceClass, jn as TableCell, ln as RunContent, n as Document, q as DocumentBackgroundDrawing, qt as ParagraphContent, t as DOCX_CONFORMANCE_CLASSES, zn as TableRow } from "./document-DrtmJ_hz.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";
@@ -126,6 +126,12 @@ type MarkdownContent = {
126
126
  content: BlockContent[];
127
127
  /** Present only when the markdown contained at least one list. */
128
128
  numbering?: NumberingDefinitions;
129
+ /**
130
+ * Non-fatal diagnostics from the compile, e.g. a table/code block/blockquote
131
+ * inside a list item that the block model can't nest and had to keep as a
132
+ * following sibling block instead. Present only when there is at least one.
133
+ */
134
+ warnings?: string[];
129
135
  };
130
136
  /**
131
137
  * Parse GFM markdown into document blocks plus the numbering its lists need.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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";
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-DdWrTPQY.js";
2
2
  import { i as serializeSequenceChildren } from "./sequenceChildren-BIixCB49.js";
3
3
  import { i as sanitizeXmlCharacters, n as escapeXmlText, r as hasIllegalXmlCharacters, t as escapeXmlAttribute } from "./xmlEscape-T-2DeGlS.js";
4
4
  import { panic } from "better-result";
@@ -189,6 +189,7 @@ const serializeBlock = (block) => {
189
189
  case "paragraph": return serializeParagraph(block);
190
190
  case "table": return serializeTable(block);
191
191
  case "blockSdt": return "";
192
+ case "blockCustomXml": return `${block.openingXml}${block.content.map(serializeBlock).join("")}${block.closingXml}`;
192
193
  case "preservedBlock": return block.xml;
193
194
  case "bookmarkStart":
194
195
  case "bookmarkEnd": return "";
@@ -2582,11 +2583,19 @@ const resolveListNumId = (numIds, parentNumId, level) => {
2582
2583
  numIds.levels.set(numId, /* @__PURE__ */ new Map([[level.ilvl, level]]));
2583
2584
  return numId;
2584
2585
  };
2585
- const listBlocks = (list, level, parentNumId, numIds) => {
2586
+ /**
2587
+ * Whether an item-content token is one the block model cannot nest inside a
2588
+ * list item's own paragraph: a nested list (handled separately, at a deeper
2589
+ * `ilvl`) or a block the DOCX list model has no notion of nesting at all
2590
+ * (OOXML lists are just numbered paragraphs, not containers — a table,
2591
+ * code block, or blockquote next to one is always a sibling, never a child).
2592
+ */
2593
+ const isNestedBlockToken = (token) => token !== void 0 && (isTokenType(token, "list") || isTokenType(token, "table") || isTokenType(token, "code") || isTokenType(token, "blockquote"));
2594
+ const listBlocks = (list, level, parentNumId, state) => {
2586
2595
  const out = [];
2587
2596
  const start = Number(list.start) || 1;
2588
2597
  const decimalLevels = Array.from({ length: level + 1 }, () => "decimal");
2589
- const numId = resolveListNumId(numIds, parentNumId, buildListLevel(level, !list.ordered, start));
2598
+ const numId = resolveListNumId(state, parentNumId, buildListLevel(level, !list.ordered, start));
2590
2599
  for (const item of list.items) {
2591
2600
  const rendering = list.ordered ? {
2592
2601
  marker: `%${level + 1}.`,
@@ -2603,11 +2612,27 @@ const listBlocks = (list, level, parentNumId, numIds) => {
2603
2612
  isBullet: true
2604
2613
  };
2605
2614
  const inlineTokens = [];
2606
- const nestedLists = [];
2607
- for (const child of item.tokens) if (isTokenType(child, "list")) nestedLists.push(child);
2608
- else inlineTokens.push(child);
2615
+ const trailing = [];
2616
+ let inTrailing = false;
2617
+ for (const [index, child] of item.tokens.entries()) {
2618
+ if (!inTrailing && isNestedBlockToken(child)) inTrailing = true;
2619
+ if (!inTrailing && child.type === "space" && isNestedBlockToken(item.tokens[index + 1])) continue;
2620
+ if (inTrailing) trailing.push(child);
2621
+ else inlineTokens.push(child);
2622
+ }
2609
2623
  out.push(listPara(inlineTokensToRuns(inlineTokens, item.text), rendering));
2610
- for (const nested of nestedLists) out.push(...listBlocks(nested, level + 1, numId, numIds));
2624
+ for (const block of trailing) {
2625
+ if (isTokenType(block, "list")) {
2626
+ out.push(...listBlocks(block, level + 1, numId, state));
2627
+ continue;
2628
+ }
2629
+ if (block.type === "space") continue;
2630
+ const rendered = blocksFromTokens([block], state);
2631
+ if (rendered.length > 0) {
2632
+ out.push(...rendered);
2633
+ state.warnings.push(`A list item's ${block.type} content could not stay nested inside the item (the DOCX list model has no way to nest it); it was kept as a block right after the item instead.`);
2634
+ }
2635
+ }
2611
2636
  }
2612
2637
  return out;
2613
2638
  };
@@ -2639,17 +2664,17 @@ const headingParagraph = (runs, depth) => {
2639
2664
  };
2640
2665
  /** The built-in a markdown blockquote compiles to. */
2641
2666
  const QUOTE_STYLE_ID = "Quote";
2642
- const blocksFromTokens = (tokens, numIds) => {
2667
+ const blocksFromTokens = (tokens, state) => {
2643
2668
  const blocks = [];
2644
2669
  for (const token of tokens ?? []) if (isTokenType(token, "heading")) blocks.push(headingParagraph(inlineTokensToRuns(token.tokens, token.text), token.depth));
2645
2670
  else if (isTokenType(token, "paragraph")) blocks.push(para(inlineTokensToRuns(token.tokens, token.text)));
2646
2671
  else if (isTokenType(token, "list")) {
2647
- const numId = numIds.next++;
2648
- numIds.levels.set(numId, /* @__PURE__ */ new Map());
2649
- blocks.push(...listBlocks(token, 0, numId, numIds));
2672
+ const numId = state.next++;
2673
+ state.levels.set(numId, /* @__PURE__ */ new Map());
2674
+ blocks.push(...listBlocks(token, 0, numId, state));
2650
2675
  } else if (isTokenType(token, "table")) blocks.push(tableFromToken(token));
2651
2676
  else if (isTokenType(token, "code")) for (const line of token.text.split("\n")) blocks.push(para([textRun(line.length > 0 ? line : " ", { mono: true })]));
2652
- else if (isTokenType(token, "blockquote")) for (const inner of blocksFromTokens(token.tokens, numIds)) {
2677
+ else if (isTokenType(token, "blockquote")) for (const inner of blocksFromTokens(token.tokens, state)) {
2653
2678
  const styled = inner.type === "paragraph" ? {
2654
2679
  ...inner,
2655
2680
  formatting: {
@@ -2689,13 +2714,15 @@ const buildNumbering = (numIdLevels) => {
2689
2714
  * (page geometry, styles, and presets are the host's decision).
2690
2715
  */
2691
2716
  const compileMarkdownToContent = (markdown) => {
2692
- const numIds = {
2717
+ const state = {
2693
2718
  next: 1,
2694
- levels: /* @__PURE__ */ new Map()
2719
+ levels: /* @__PURE__ */ new Map(),
2720
+ warnings: []
2695
2721
  };
2696
2722
  return {
2697
- content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)), numIds),
2698
- ...numIds.levels.size > 0 && { numbering: buildNumbering(numIds.levels) }
2723
+ content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)), state),
2724
+ ...state.levels.size > 0 && { numbering: buildNumbering(state.levels) },
2725
+ ...state.warnings.length > 0 && { warnings: state.warnings }
2699
2726
  };
2700
2727
  };
2701
2728
  //#endregion
@@ -1,3 +1,3 @@
1
- import { $ as Endnote, $n as UnrecognisedPresetLineDash, $r as paragraphNumberingReference, $t as PreservedBlock, A as BlockContent, Ai as ThemeColorValue, An as TableCell, Ar as TableBorders, At as MathEquation, B as CommentReference, Bi as THEME_COLORS, Bn as TextContent, Br as TextEffect, Bt as NoteNumberRestart, C as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, Ci as TextDirection, Cn as ShapeTextBody, Cr as EmphasisMark, Ct as InlineSdt, D as ParseWarningLocation, Di as ShadingProperties, Dn as SymbolContent, Dr as SpacingExplicit, Dt as LineNumberRestart, E as ParseWarningCode, Ei as ColorValue, En as SoftHyphenContent, Er as ParagraphFormatting, Et as InstrTextContent, F as BreakContent, Fi as readThemeColor, Fn as TablePropertyExceptionChange, Fr as TableLook, Ft as MoveTo, G as DocumentBackground, Gi as borderStyleToken, Gn as VerticalAlign, Gr as ParagraphNumberingOverride, Gt as Paragraph, H as DRAWING_RAW_XML_MODES, Hi as BorderStyleValue, Hn as TrackedChangeInfo, Hr as UnderlineStyle, Ht as PARAGRAPH_MARK_CHANGE_KINDS, I as Column, Ii as themeColorSlot, In as TableRow, Ir as TableMeasurement, It as MoveToRangeEnd, J as DrawingAnchor, Ji as isBorderStyle, Jn as WrapDistances, Jr as ResolvedParagraphNumbering, Jt as ParagraphMarkChangeKind, K as DocumentBackgroundDrawing, Ki as isBorderNil, Kn as Watermark, Kr as ParagraphNumberingReference, Kt as ParagraphContent, L as Comment, Li as themeColorToken, Ln as TableRowPropertyChange, Lr as TablePropertyExceptionFormatting, Lt as MoveToRangeStart, M as BookmarkEnd, Mi as isSchemeColorValue, Mn as TableCellPropertyChange, Mr as TableCellFormatting, Mt as MoveFrom, N as BookmarkRangeMarker, Ni as isThemeColor, Nn as TablePreservedMarkup, Nr as TableFormatting, Nt as MoveFromRangeEnd, O as BIDI_CONTROLS, Oi as SCHEME_COLOR_VALUE_BY_THEME_COLOR, On as TabContent, Or as TabLeader, Ot as MAX_REVISION_ID, P as BookmarkStart, Pi as knownThemeColor, Pn as TablePropertyChange, Pr as TableGridChange, Pt as MoveFromRangeStart, Q as EffectExtentSlots, Qn as PresetLineDashValue, Qr as paragraphNumberingLevel, Qt as PositionedBookmarkMarker, R as CommentRangeEnd, Ri as SchemeColorSlot, Rn as TableStructuralChangeInfo, Rr as TableRowFormatting, Rt as NoBreakHyphenContent, S as ThemeFontScheme, Si as TableAlignment, Sn as ShapeOutline, Sr as ConditionalFormatStyle, St as ImageWrapPolygon, T as ParseWarning, Ti as BorderSpec, Tn as SimpleField, Tr as LineSpacingRule, Tt as Insertion, U as Deletion, Ui as UnrecognisedBorderStyle, Un as TrackedRunChange, Ur as NO_NUMBERING_NUM_ID, Ut as PROPERTY_REVISION_KINDS, V as ComplexField, Vi as ThemeColor, Vn as TextWatermark, Vr as TextFormatting, Vt as NoteReferenceContent, W as DisplacedByCustomXml, Wi as borderStyleFrom, Wn as TrackedRunContent, Wr as NO_PARAGRAPH_NUMBERING, Wt as PageOrientation, X as DrawingGroupChild, Xi as BORDER_STYLES, Xn as isOoxmlSymbolCharacter, Xr as mergeParagraphNumbering, Xt as PictureWatermark, Y as DrawingContent, Yi as statesNoBorder, Yn as WrapPolygonPoint, Yr as isNumberingReference, Yt as ParagraphPropertyChange, Z as DrawingRawXmlMode, Zi as BorderStyle, Zn as normalizeRevisionId, Zr as paragraphNumberingFromSlots, Zt as PositionalTab, _ as StyleDefinitions, _i as TAB_STOP_ALIGNMENTS, _n as Shape, _r as ListMarkerFormatting, _t as ImagePadding, a as DocxPackage, ai as BODY_TEXT_OUTLINE_LEVEL, an as REVIEW_CARRIERS, ar as RelationshipId, at as FooterReference, b as ThemeColorScheme, bi as TEXT_DIRECTION_FLOW_BY_TOKEN, bn as ShapeFill, br as NumberingInstance, bt as ImageTransform, c as EmbeddedFontRef, ci as headingLevelOf, cn as RunContent, cr as PreviewDescriptor, ct as FootnoteProperties, d as FontTable, di as outlineLevelStatedValue, dn as SdtProperties, dr as COUNTER_FORMATS, dt as HeaderReference, ei as paragraphNumberingReferenceId, en as PreservedInline, er as isPresetLineDashVal, et as EndnotePosition, f as MediaFile, fi as NUMBER_FORMATS, fn as SdtType, fr as CounterFormat, ft as Hyperlink, g as Style, gi as TABLE_ALIGNMENTS, gn as SectionStart, gr as ListLevel, gt as ImageFrameLocks, h as RelationshipType, hi as ParagraphAlignment, hn as SectionPropertyChange, hr as LevelSuffix, ht as ImageDocPrLink, i as DocxConformanceClass, ii as sameStatedParagraphNumbering, in as PropertyRevisionKind, ir as PresetLineDashVal, it as FieldType, j as BlockSdt, ji as UnrecognisedThemeColor, jn as TableCellBlock, jr as TableCellBorders, jt as MoveBookmarkMarker, k as BidiControl, ki as THEME_COLOR_BY_SCHEME_COLOR_VALUE, kn as Table, kr as TabStop, kt as MarkupRangeMarker, l as FontCharset, li as headingOutlineLevel, ln as RunPropertyChange, lr as PreviewShape, lt as HeaderFooter, m as RelationshipMap, mi as PARAGRAPH_ALIGNMENTS, mn as SectionProperties, mr as LevelOverride, mt as ImageCrop, n as Document, ni as resolveParagraphNumbering, nn as PropertyChange, nr as presetLineDashToken, nt as Field, o as ExhaustiveFields, oi as HeadingOutlineLevel, on as ReviewCarrier, or as mintRelationshipId, ot as Footnote, p as Relationship, pi as NumberFormat, pn as Section, pr as LevelLegacy, pt as Image, q as DocumentBody, qi as isBorderNone, qn as WrapDistanceSlots, qr as ParagraphNumberingSlots, qt as ParagraphMarkChange, r as DocumentSettings, ri as sameEffectiveParagraphNumbering, rn as PropertyChangeInfo, rr as PRESET_LINE_DASH_VALS, rt as FieldCharContent, s as DocDefaults, si as OutlineLevel, sn as Run, sr as relationshipIdOf, st as FootnotePosition, t as DOCX_CONFORMANCE_CLASSES, ti as paragraphNumberingSlots, tn as PreservedXmlContent, tr as presetLineDashFrom, tt as EndnoteProperties, u as FontInfo, ui as outlineLevelFromStatedValue, un as SdtEndProperties, ur as AbstractNumbering, ut as HeaderFooterType, v as StyleType, vi as TEXT_DIRECTIONS, vn as ShapeAlternateContent, vr as ListRendering, vt as ImagePosition, w as PARSE_WARNING_CODES, wi as TextDirectionFlow, wn as ShapeType, wr as FloatingTableProperties, wt as InlineWrapper, x as ThemeFont, xi as TabStopAlignment, xn as ShapeGeometryAdjustment, xr as CellMargins, xt as ImageWrap, y as Theme, yi as TEXT_DIRECTION_FLOWS, yn as ShapeContent, yr as NumberingDefinitions, yt as ImageSize, z as CommentRangeStart, zi as SchemeColorValue, zn as TextBox, zr as TableWidthType, zt as NonVisualDrawingNames } from "../document-BtGS_I3E.js";
1
+ import { $ as EffectExtentSlots, $i as BORDER_STYLES, $n as isOoxmlSymbolCharacter, $r as mergeParagraphNumbering, $t as PositionedBookmarkMarker, A as BlockContent, Ai as ShadingProperties, An as Table, Ar as SpacingExplicit, At as MarkupRangeMarker, B as CommentRangeStart, Bi as themeColorToken, Bn as TableRowPropertyChange, Br as TablePropertyExceptionFormatting, Bt as NonVisualDrawingNames, C as MAX_RETAINED_PARSE_WARNINGS_PER_CODE, Ci as TEXT_DIRECTION_FLOW_BY_TOKEN, Cn as ShapeOutline, Cr as NumberingInstance, Ct as ImageWrapPolygon, D as ParseWarningLocation, Di as TextDirectionFlow, Dn as SoftHyphenContent, Dr as FloatingTableProperties, Dt as InstrTextContent, E as ParseWarningCode, Ei as TextDirection, En as SimpleField, Er as EmphasisMark, Et as Insertion, F as BookmarkStart, Fi as isSchemeColorValue, Fn as TableCustomXmlWrapper, Fr as TableCellFormatting, Ft as MoveFromRangeStart, G as DisplacedByCustomXml, Gi as BorderStyleValue, Gn as TrackedChangeInfo, Gr as UnderlineStyle, Gt as PageOrientation, H as ComplexField, Hi as SchemeColorValue, Hn as TextBox, Hr as TableWidthType, Ht as NoteReferenceContent, I as BreakContent, Ii as isThemeColor, In as TablePreservedMarkup, Ir as TableFormatting, It as MoveTo, J as DocumentBody, Ji as borderStyleToken, Jn as VerticalAlign, Jr as ParagraphNumberingOverride, Jt as ParagraphMarkChange, K as DocumentBackground, Ki as UnrecognisedBorderStyle, Kn as TrackedRunChange, Kr as NO_NUMBERING_NUM_ID, Kt as Paragraph, L as Column, Li as knownThemeColor, Ln as TablePropertyChange, Lr as TableGridChange, Lt as MoveToRangeEnd, M as BlockSdt, Mi as THEME_COLOR_BY_SCHEME_COLOR_VALUE, Mn as TableCellBlock, Mr as TabStop, Mt as MoveBookmarkMarker, N as BookmarkEnd, Ni as ThemeColorValue, Nn as TableCellPropertyChange, Nr as TableBorders, Nt as MoveFrom, O as BIDI_CONTROLS, Oi as BorderSpec, On as SymbolContent, Or as LineSpacingRule, Ot as LineNumberRestart, P as BookmarkRangeMarker, Pi as UnrecognisedThemeColor, Pn as TableContentCarrier, Pr as TableCellBorders, Pt as MoveFromRangeEnd, Q as DrawingRawXmlMode, Qi as statesNoBorder, Qn as WrapPolygonPoint, Qr as isNumberingReference, Qt as PositionalTab, R as Comment, Ri as readThemeColor, Rn as TablePropertyExceptionChange, Rr as TableLook, Rt as MoveToRangeStart, S as ThemeFontScheme, Si as TEXT_DIRECTION_FLOWS, Sn as ShapeGeometryAdjustment, Sr as NumberingDefinitions, St as ImageWrap, T as ParseWarning, Ti as TableAlignment, Tn as ShapeType, Tr as ConditionalFormatStyle, Tt as InlineWrapper, U as DRAWING_RAW_XML_MODES, Ui as THEME_COLORS, Un as TextContent, Ur as TextEffect, Ut as PARAGRAPH_MARK_CHANGE_KINDS, V as CommentReference, Vi as SchemeColorSlot, Vn as TableStructuralChangeInfo, Vr as TableRowFormatting, Vt as NoteNumberRestart, W as Deletion, Wi as ThemeColor, Wn as TextWatermark, Wr as TextFormatting, Wt as PROPERTY_REVISION_KINDS, X as DrawingContent, Xi as isBorderNone, Xn as WrapDistanceSlots, Xr as ParagraphNumberingSlots, Xt as ParagraphPropertyChange, Y as DrawingAnchor, Yi as isBorderNil, Yn as Watermark, Yr as ParagraphNumberingReference, Yt as ParagraphMarkChangeKind, Z as DrawingGroupChild, Zi as isBorderStyle, Zn as WrapDistances, Zr as ResolvedParagraphNumbering, Zt as PictureWatermark, _ as StyleDefinitions, _i as PARAGRAPH_ALIGNMENTS, _n as SectionStart, _r as LevelOverride, _t as ImageFrameLocks, a as DocxPackage, ai as resolveParagraphNumbering, an as PropertyRevisionKind, ar as presetLineDashToken, at as FieldType, b as ThemeColorScheme, bi as TAB_STOP_ALIGNMENTS, bn as ShapeContent, br as ListMarkerFormatting, bt as ImageSize, c as EmbeddedFontRef, ci as BODY_TEXT_OUTLINE_LEVEL, cn as Run, cr as RelationshipId, ct as FootnotePosition, d as FontTable, di as headingLevelOf, dn as SdtEndProperties, dr as PreviewDescriptor, dt as HeaderFooterType, ea as BorderStyle, ei as paragraphNumberingFromSlots, en as PreservedBlock, er as normalizeRevisionId, et as Endnote, f as MediaFile, fi as headingOutlineLevel, fn as SdtProperties, fr as PreviewShape, ft as HeaderReference, g as Style, gi as NumberFormat, gn as SectionPropertyChange, gr as LevelLegacy, gt as ImageDocPrLink, h as RelationshipType, hi as NUMBER_FORMATS, hn as SectionProperties, hr as CounterFormat, ht as ImageCrop, i as DocxConformanceClass, ii as paragraphNumberingSlots, in as PropertyChangeInfo, ir as presetLineDashFrom, it as FieldCharContent, j as BlockCustomXml, ji as SCHEME_COLOR_VALUE_BY_THEME_COLOR, jn as TableCell, jr as TabLeader, jt as MathEquation, k as BidiControl, ki as ColorValue, kn as TabContent, kr as ParagraphFormatting, kt as MAX_REVISION_ID, l as FontCharset, li as HeadingOutlineLevel, ln as RunContent, lr as mintRelationshipId, lt as FootnoteProperties, m as RelationshipMap, mi as outlineLevelStatedValue, mn as Section, mr as COUNTER_FORMATS, mt as Image, n as Document, ni as paragraphNumberingReference, nn as PreservedXmlContent, nr as UnrecognisedPresetLineDash, nt as EndnoteProperties, o as ExhaustiveFields, oi as sameEffectiveParagraphNumbering, on as REVIEW_CARRIERS, or as PRESET_LINE_DASH_VALS, ot as FooterReference, p as Relationship, pi as outlineLevelFromStatedValue, pn as SdtType, pr as AbstractNumbering, pt as Hyperlink, q as DocumentBackgroundDrawing, qi as borderStyleFrom, qn as TrackedRunContent, qr as NO_PARAGRAPH_NUMBERING, qt as ParagraphContent, r as DocumentSettings, ri as paragraphNumberingReferenceId, rn as PropertyChange, rr as isPresetLineDashVal, rt as Field, s as DocDefaults, si as sameStatedParagraphNumbering, sn as ReviewCarrier, sr as PresetLineDashVal, st as Footnote, t as DOCX_CONFORMANCE_CLASSES, ti as paragraphNumberingLevel, tn as PreservedInline, tr as PresetLineDashValue, tt as EndnotePosition, u as FontInfo, ui as OutlineLevel, un as RunPropertyChange, ur as relationshipIdOf, ut as HeaderFooter, v as StyleType, vi as ParagraphAlignment, vn as Shape, vr as LevelSuffix, vt as ImagePadding, w as PARSE_WARNING_CODES, wi as TabStopAlignment, wn as ShapeTextBody, wr as CellMargins, wt as InlineSdt, x as ThemeFont, xi as TEXT_DIRECTIONS, xn as ShapeFill, xr as ListRendering, xt as ImageTransform, y as Theme, yi as TABLE_ALIGNMENTS, yn as ShapeAlternateContent, yr as ListLevel, yt as ImagePosition, z as CommentRangeEnd, zi as themeColorSlot, zn as TableRow, zr as TableMeasurement, zt as NoBreakHyphenContent } from "../document-DrtmJ_hz.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 DocumentBackground, type DocumentBackgroundDrawing, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingAnchor, type DrawingContent, type DrawingGroupChild, 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 ShapeAlternateContent, 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 BlockCustomXml, 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 DrawingGroupChild, 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 ShapeAlternateContent, 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 TableContentCarrier, type TableCustomXmlWrapper, 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 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";
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-DdWrTPQY.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 };
@@ -1,4 +1,4 @@
1
- import { Er as ParagraphFormatting, Gt as Paragraph, Kt as ParagraphContent, Vr as TextFormatting, n as Document, qt as ParagraphMarkChange } from "../document-BtGS_I3E.js";
1
+ import { Jt as ParagraphMarkChange, Kt as Paragraph, Wr as TextFormatting, kr as ParagraphFormatting, n as Document, qt as ParagraphContent } from "../document-DrtmJ_hz.js";
2
2
  import { Result } from "better-result";
3
3
  //#region src/ops/types.d.ts
4
4
  /** The operation schema this module reads and writes. */
@@ -1,4 +1,4 @@
1
- import "../document-Bz9rYlJI.js";
1
+ import "../document-DdWrTPQY.js";
2
2
  import { r as hasIllegalXmlCharacters } from "../xmlEscape-T-2DeGlS.js";
3
3
  import { Result, TaggedError, panic } from "better-result";
4
4
  //#region src/ops/equality.ts
@@ -109,6 +109,12 @@ const collectParagraphs = (blocks, list, out) => {
109
109
  block: index
110
110
  }], out);
111
111
  break;
112
+ case "blockCustomXml":
113
+ collectParagraphs(block.content, [...list, {
114
+ kind: "blockCustomXml",
115
+ block: index
116
+ }], out);
117
+ break;
112
118
  case "preservedBlock":
113
119
  case "bookmarkStart":
114
120
  case "bookmarkEnd": break;
@@ -132,6 +138,7 @@ const sameStep = (left, right) => {
132
138
  switch (left.kind) {
133
139
  case "tableCell": return right.kind === "tableCell" && left.block === right.block && left.row === right.row && left.cell === right.cell;
134
140
  case "blockSdt": return right.kind === "blockSdt" && left.block === right.block;
141
+ case "blockCustomXml": return right.kind === "blockCustomXml" && left.block === right.block;
135
142
  default: return left;
136
143
  }
137
144
  };
@@ -173,6 +180,13 @@ const updateBlockList = (blocks, list, update) => {
173
180
  content: updateBlockList(block.content, rest, update)
174
181
  };
175
182
  return out;
183
+ case "blockCustomXml":
184
+ if (block?.type !== "blockCustomXml") return panic(`Block list step does not name a custom XML wrapper at ${step.block}.`);
185
+ out[step.block] = {
186
+ ...block,
187
+ content: updateBlockList(block.content, rest, update)
188
+ };
189
+ return out;
176
190
  default: return step;
177
191
  }
178
192
  };
@@ -1297,6 +1311,7 @@ const normalizeBlocks = (blocks) => {
1297
1311
  break;
1298
1312
  }
1299
1313
  case "blockSdt":
1314
+ case "blockCustomXml":
1300
1315
  out.push({
1301
1316
  ...block,
1302
1317
  content: normalizeBlocks(block.content)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/docx-core",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "description": "Typed OOXML/DOCX model, validation, serialization, legal-source compilation, and browser-native package projection.",
5
5
  "keywords": [
6
6
  "document-model",