@stll/docx-core 0.27.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.
- package/README.md +7 -0
- package/dist/{document-Bz9rYlJI.js → document-DdWrTPQY.js} +7 -1
- package/dist/{document-BtGS_I3E.d.ts → document-DrtmJ_hz.d.ts} +48 -3
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +44 -107
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +1 -1
- package/dist/ops/documentOps.d.ts +421 -0
- package/dist/ops/documentOps.js +2698 -0
- package/dist/xmlEscape-T-2DeGlS.js +92 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -36,6 +36,13 @@ bun add @stll/docx-core
|
|
|
36
36
|
(`serializeDocumentToDocx`), and validation (`validateDocxPackage`,
|
|
37
37
|
`validateDocumentModel`, `assertValidDocumentModel`).
|
|
38
38
|
- `./model` — the document model types only.
|
|
39
|
+
- `./ops` — document operations over the model: `applyDocumentOp` and
|
|
40
|
+
`applyDocumentOps` apply text and formatting edits addressed by paragraph
|
|
41
|
+
id and offset, and return the new document, the blocks it touched and its
|
|
42
|
+
exact inverse (operations addressed the same way), or a typed refusal.
|
|
43
|
+
`normalizeForOps` and `validateOpsDocument` establish and check the
|
|
44
|
+
contract a document meets before operations apply to it; `toOpEnvelope`
|
|
45
|
+
wraps an operation with its schema version for journaling.
|
|
39
46
|
|
|
40
47
|
## License
|
|
41
48
|
|
|
@@ -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
|
|
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 {
|
|
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 };
|
package/dist/docx_kernel_bg.wasm
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as BlockContent, An as
|
|
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,5 +1,6 @@
|
|
|
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-
|
|
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
|
+
import { i as sanitizeXmlCharacters, n as escapeXmlText, r as hasIllegalXmlCharacters, t as escapeXmlAttribute } from "./xmlEscape-T-2DeGlS.js";
|
|
3
4
|
import { panic } from "better-result";
|
|
4
5
|
import JSZip from "jszip";
|
|
5
6
|
import { XMLParser, XMLValidator } from "fast-xml-parser";
|
|
@@ -17,97 +18,6 @@ import { Marked } from "marked";
|
|
|
17
18
|
*/
|
|
18
19
|
const requiresXmlSpacePreserve = (text) => text.startsWith(" ") || text.endsWith(" ") || text.includes(" ");
|
|
19
20
|
//#endregion
|
|
20
|
-
//#region src/serialize/xmlEscape.ts
|
|
21
|
-
/**
|
|
22
|
-
* The one owner of XML character escaping for every part folio writes.
|
|
23
|
-
*
|
|
24
|
-
* Two contexts, two functions. A value going into element content takes
|
|
25
|
-
* {@link escapeXmlText}; a value going between the quotes of an attribute
|
|
26
|
-
* takes {@link escapeXmlAttribute}. Nothing else escapes XML by hand: a
|
|
27
|
-
* second escaper always ends up disagreeing with this one about some
|
|
28
|
-
* character, and the disagreement is a package Word refuses to open.
|
|
29
|
-
*
|
|
30
|
-
* Both functions guarantee the same contract: **the result is always legal
|
|
31
|
-
* XML 1.0 character data.** That is what makes the contract checkable — a
|
|
32
|
-
* caller cannot produce a corrupt part by forgetting something.
|
|
33
|
-
*
|
|
34
|
-
* XML 1.0 §2.2 `Char` admits tab, LF, CR, `#x20`-`#xD7FF`, `#xE000`-`#xFFFD`
|
|
35
|
-
* and the astral planes. Everything else — the rest of C0, `#xFFFE`,
|
|
36
|
-
* `#xFFFF`, an unpaired surrogate — cannot appear in a document at all, and
|
|
37
|
-
* cannot be escaped into one either: `�` is as illegal as a raw NUL
|
|
38
|
-
* (§4.1 requires a character reference to refer to a legal `Char`). The only
|
|
39
|
-
* output that is well-formed is one without them, so they are dropped here.
|
|
40
|
-
* Callers that own an input boundary sanitise before this point, with
|
|
41
|
-
* `sanitizeXmlCharacters`, so a user-visible value loses its illegal
|
|
42
|
-
* characters where something can still report it; the drop below is the last
|
|
43
|
-
* line of defence for a boundary nobody has covered yet.
|
|
44
|
-
*
|
|
45
|
-
* The whitespace rules are where the two contexts part:
|
|
46
|
-
*
|
|
47
|
-
* - §3.3.3 normalises tab, LF and CR in an **attribute value** to a space in
|
|
48
|
-
* every conformant parser, so a literal one does not survive a save. They
|
|
49
|
-
* are written as character references, which the same step leaves alone.
|
|
50
|
-
* - §2.11 normalises a literal CR (and CRLF) in **content** to LF on read, so
|
|
51
|
-
* CR is written as a reference there too. Tab and LF survive as themselves.
|
|
52
|
-
*
|
|
53
|
-
* Both contexts escape all five of `& < > " '`. Only `&` and `<` must be
|
|
54
|
-
* escaped in content, but folio has always written the full set, `>` closes
|
|
55
|
-
* the `]]>` hazard of §2.4 without a special case, and one lexical form
|
|
56
|
-
* across every writer is worth more than the bytes it costs. Every spelling
|
|
57
|
-
* here reads back as the character it stands for, so the rule preserves the
|
|
58
|
-
* value whichever context it lands in.
|
|
59
|
-
*/
|
|
60
|
-
/** XML 1.0 §2.2 `Char`, negated: the characters no XML document may contain. */
|
|
61
|
-
const ILLEGAL_XML_CHARACTER_CLASS = "[^\\u0009\\u000A\\u000D\\u0020-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]";
|
|
62
|
-
/**
|
|
63
|
-
* Unicode-mode classes match code points, so a well-formed surrogate pair is a
|
|
64
|
-
* single astral code point and cannot match a BMP class: this matches exactly
|
|
65
|
-
* the unpaired surrogates.
|
|
66
|
-
*/
|
|
67
|
-
const LONE_SURROGATE_PATTERN = /[\uD800-\uDFFF]/gu;
|
|
68
|
-
const ILLEGAL_XML_CHARACTER_PATTERN = new RegExp(ILLEGAL_XML_CHARACTER_CLASS, "gu");
|
|
69
|
-
const ILLEGAL_XML_CHARACTER_PROBE = new RegExp(ILLEGAL_XML_CHARACTER_CLASS, "u");
|
|
70
|
-
/** What an unpaired surrogate becomes at an input boundary: U+FFFD. */
|
|
71
|
-
const REPLACEMENT_CHARACTER = "�";
|
|
72
|
-
const TEXT_ESCAPES = {
|
|
73
|
-
"&": "&",
|
|
74
|
-
"<": "<",
|
|
75
|
-
">": ">",
|
|
76
|
-
"\"": """,
|
|
77
|
-
"'": "'",
|
|
78
|
-
"\r": " "
|
|
79
|
-
};
|
|
80
|
-
const ATTRIBUTE_ESCAPES = {
|
|
81
|
-
...TEXT_ESCAPES,
|
|
82
|
-
" ": "	",
|
|
83
|
-
"\n": " "
|
|
84
|
-
};
|
|
85
|
-
const TEXT_PROBE = new RegExp(`[&<>"'\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "u");
|
|
86
|
-
const TEXT_PATTERN = new RegExp(`[&<>"'\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "gu");
|
|
87
|
-
const ATTRIBUTE_PROBE = new RegExp(`[&<>"'\\t\\n\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "u");
|
|
88
|
-
const ATTRIBUTE_PATTERN = new RegExp(`[&<>"'\\t\\n\\r]|${ILLEGAL_XML_CHARACTER_CLASS}`, "gu");
|
|
89
|
-
/** Escape a value for XML element content. Tab and LF survive as themselves. */
|
|
90
|
-
const escapeXmlText = (value) => TEXT_PROBE.test(value) ? value.replace(TEXT_PATTERN, (character) => TEXT_ESCAPES[character] ?? "") : value;
|
|
91
|
-
/**
|
|
92
|
-
* Escape a value for an XML attribute value, of either quoting. Tab, LF and CR
|
|
93
|
-
* become character references so attribute-value normalisation cannot flatten
|
|
94
|
-
* them to spaces.
|
|
95
|
-
*/
|
|
96
|
-
const escapeXmlAttribute = (value) => ATTRIBUTE_PROBE.test(value) ? value.replace(ATTRIBUTE_PATTERN, (character) => ATTRIBUTE_ESCAPES[character] ?? "") : value;
|
|
97
|
-
/** Whether `value` holds a character XML 1.0 cannot represent at all. */
|
|
98
|
-
const hasIllegalXmlCharacters = (value) => ILLEGAL_XML_CHARACTER_PROBE.test(value);
|
|
99
|
-
/**
|
|
100
|
-
* Make a value from outside folio representable in XML: an unpaired surrogate
|
|
101
|
-
* becomes U+FFFD, every other character XML cannot hold is dropped.
|
|
102
|
-
*
|
|
103
|
-
* This is the rule for an input boundary — paste, a document operation, a
|
|
104
|
-
* markdown or legal-source compile, a template fill — where the value is still
|
|
105
|
-
* attached to the request that carried it and a warning still has somewhere to
|
|
106
|
-
* go. `escapeXmlText` and `escapeXmlAttribute` apply the same rule again
|
|
107
|
-
* further down, but by then nobody can say which input lost a character.
|
|
108
|
-
*/
|
|
109
|
-
const sanitizeXmlCharacters = (value) => hasIllegalXmlCharacters(value) ? value.replace(LONE_SURROGATE_PATTERN, REPLACEMENT_CHARACTER).replace(ILLEGAL_XML_CHARACTER_PATTERN, "") : value;
|
|
110
|
-
//#endregion
|
|
111
21
|
//#region src/serialize/xml.ts
|
|
112
22
|
const attr = (name, value) => value === void 0 ? "" : ` ${name}="${escapeXmlAttribute(String(value))}"`;
|
|
113
23
|
/**
|
|
@@ -279,6 +189,7 @@ const serializeBlock = (block) => {
|
|
|
279
189
|
case "paragraph": return serializeParagraph(block);
|
|
280
190
|
case "table": return serializeTable(block);
|
|
281
191
|
case "blockSdt": return "";
|
|
192
|
+
case "blockCustomXml": return `${block.openingXml}${block.content.map(serializeBlock).join("")}${block.closingXml}`;
|
|
282
193
|
case "preservedBlock": return block.xml;
|
|
283
194
|
case "bookmarkStart":
|
|
284
195
|
case "bookmarkEnd": return "";
|
|
@@ -2672,11 +2583,19 @@ const resolveListNumId = (numIds, parentNumId, level) => {
|
|
|
2672
2583
|
numIds.levels.set(numId, /* @__PURE__ */ new Map([[level.ilvl, level]]));
|
|
2673
2584
|
return numId;
|
|
2674
2585
|
};
|
|
2675
|
-
|
|
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) => {
|
|
2676
2595
|
const out = [];
|
|
2677
2596
|
const start = Number(list.start) || 1;
|
|
2678
2597
|
const decimalLevels = Array.from({ length: level + 1 }, () => "decimal");
|
|
2679
|
-
const numId = resolveListNumId(
|
|
2598
|
+
const numId = resolveListNumId(state, parentNumId, buildListLevel(level, !list.ordered, start));
|
|
2680
2599
|
for (const item of list.items) {
|
|
2681
2600
|
const rendering = list.ordered ? {
|
|
2682
2601
|
marker: `%${level + 1}.`,
|
|
@@ -2693,11 +2612,27 @@ const listBlocks = (list, level, parentNumId, numIds) => {
|
|
|
2693
2612
|
isBullet: true
|
|
2694
2613
|
};
|
|
2695
2614
|
const inlineTokens = [];
|
|
2696
|
-
const
|
|
2697
|
-
|
|
2698
|
-
|
|
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
|
+
}
|
|
2699
2623
|
out.push(listPara(inlineTokensToRuns(inlineTokens, item.text), rendering));
|
|
2700
|
-
for (const
|
|
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
|
+
}
|
|
2701
2636
|
}
|
|
2702
2637
|
return out;
|
|
2703
2638
|
};
|
|
@@ -2729,17 +2664,17 @@ const headingParagraph = (runs, depth) => {
|
|
|
2729
2664
|
};
|
|
2730
2665
|
/** The built-in a markdown blockquote compiles to. */
|
|
2731
2666
|
const QUOTE_STYLE_ID = "Quote";
|
|
2732
|
-
const blocksFromTokens = (tokens,
|
|
2667
|
+
const blocksFromTokens = (tokens, state) => {
|
|
2733
2668
|
const blocks = [];
|
|
2734
2669
|
for (const token of tokens ?? []) if (isTokenType(token, "heading")) blocks.push(headingParagraph(inlineTokensToRuns(token.tokens, token.text), token.depth));
|
|
2735
2670
|
else if (isTokenType(token, "paragraph")) blocks.push(para(inlineTokensToRuns(token.tokens, token.text)));
|
|
2736
2671
|
else if (isTokenType(token, "list")) {
|
|
2737
|
-
const numId =
|
|
2738
|
-
|
|
2739
|
-
blocks.push(...listBlocks(token, 0, numId,
|
|
2672
|
+
const numId = state.next++;
|
|
2673
|
+
state.levels.set(numId, /* @__PURE__ */ new Map());
|
|
2674
|
+
blocks.push(...listBlocks(token, 0, numId, state));
|
|
2740
2675
|
} else if (isTokenType(token, "table")) blocks.push(tableFromToken(token));
|
|
2741
2676
|
else if (isTokenType(token, "code")) for (const line of token.text.split("\n")) blocks.push(para([textRun(line.length > 0 ? line : " ", { mono: true })]));
|
|
2742
|
-
else if (isTokenType(token, "blockquote")) for (const inner of blocksFromTokens(token.tokens,
|
|
2677
|
+
else if (isTokenType(token, "blockquote")) for (const inner of blocksFromTokens(token.tokens, state)) {
|
|
2743
2678
|
const styled = inner.type === "paragraph" ? {
|
|
2744
2679
|
...inner,
|
|
2745
2680
|
formatting: {
|
|
@@ -2779,13 +2714,15 @@ const buildNumbering = (numIdLevels) => {
|
|
|
2779
2714
|
* (page geometry, styles, and presets are the host's decision).
|
|
2780
2715
|
*/
|
|
2781
2716
|
const compileMarkdownToContent = (markdown) => {
|
|
2782
|
-
const
|
|
2717
|
+
const state = {
|
|
2783
2718
|
next: 1,
|
|
2784
|
-
levels: /* @__PURE__ */ new Map()
|
|
2719
|
+
levels: /* @__PURE__ */ new Map(),
|
|
2720
|
+
warnings: []
|
|
2785
2721
|
};
|
|
2786
2722
|
return {
|
|
2787
|
-
content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)),
|
|
2788
|
-
...
|
|
2723
|
+
content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)), state),
|
|
2724
|
+
...state.levels.size > 0 && { numbering: buildNumbering(state.levels) },
|
|
2725
|
+
...state.warnings.length > 0 && { warnings: state.warnings }
|
|
2789
2726
|
};
|
|
2790
2727
|
};
|
|
2791
2728
|
//#endregion
|
package/dist/model/document.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
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 };
|
package/dist/model/document.js
CHANGED
|
@@ -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-
|
|
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 };
|