@stll/docx-core 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- 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 +14 -1
- package/dist/index.js +170 -22
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +1 -1
- package/dist/ops/documentOps.d.ts +339 -28
- package/dist/ops/documentOps.js +2388 -342
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,7 +40,12 @@ bun add @stll/docx-core
|
|
|
40
40
|
`applyDocumentOps` apply text and formatting edits addressed by paragraph
|
|
41
41
|
id and offset, and return the new document, the blocks it touched and its
|
|
42
42
|
exact inverse (operations addressed the same way), or a typed refusal.
|
|
43
|
-
|
|
43
|
+
With a `revision` stamp, the text, formatting and paragraph operations
|
|
44
|
+
record their edit as tracked changes instead, and `resolveRevision`
|
|
45
|
+
accepts or rejects tracked changes by revision id. `planTrackedDeletion`
|
|
46
|
+
plans a tracked deletion around the author's own insertions and comment
|
|
47
|
+
anchors, and `revisionIdDemand` counts the new revision ids an operation
|
|
48
|
+
takes. `normalizeForOps` and `validateOpsDocument` establish and check the
|
|
44
49
|
contract a document meets before operations apply to it; `toOpEnvelope`
|
|
45
50
|
wraps an operation with its schema version for journaling.
|
|
46
51
|
|
|
@@ -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,5 @@
|
|
|
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
|
+
import JSZip from "jszip";
|
|
2
3
|
import { Buffer } from "node:buffer";
|
|
3
4
|
//#region src/legal-source/types.d.ts
|
|
4
5
|
type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";
|
|
@@ -126,6 +127,12 @@ type MarkdownContent = {
|
|
|
126
127
|
content: BlockContent[];
|
|
127
128
|
/** Present only when the markdown contained at least one list. */
|
|
128
129
|
numbering?: NumberingDefinitions;
|
|
130
|
+
/**
|
|
131
|
+
* Non-fatal diagnostics from the compile, e.g. a table/code block/blockquote
|
|
132
|
+
* inside a list item that the block model can't nest and had to keep as a
|
|
133
|
+
* following sibling block instead. Present only when there is at least one.
|
|
134
|
+
*/
|
|
135
|
+
warnings?: string[];
|
|
129
136
|
};
|
|
130
137
|
/**
|
|
131
138
|
* Parse GFM markdown into document blocks plus the numbering its lists need.
|
|
@@ -279,6 +286,12 @@ declare const sanitizeXmlCharacters: (value: string) => string;
|
|
|
279
286
|
declare const requiresXmlSpacePreserve: (text: string) => boolean;
|
|
280
287
|
//#endregion
|
|
281
288
|
//#region src/validate/docx.d.ts
|
|
289
|
+
declare module "jszip" {
|
|
290
|
+
interface JSZipObject {
|
|
291
|
+
/** Chunked read of the entry content, missing from the published typings. */
|
|
292
|
+
internalStream(type: "uint8array"): JSZip.JSZipStreamHelper<Uint8Array>;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
282
295
|
declare const DOCX_PACKAGE_ISSUE_CODES: {
|
|
283
296
|
readonly ArchiveBoundsExceeded: "archive_bounds_exceeded";
|
|
284
297
|
readonly InvalidArchive: "invalid_archive";
|
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-
|
|
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 "";
|
|
@@ -467,6 +468,16 @@ const VALIDATE_DOCX_MAX_ENTRIES = 4096;
|
|
|
467
468
|
const VALIDATE_DOCX_MAX_ENTRY_BYTES = 128 * 1024 * 1024;
|
|
468
469
|
const VALIDATE_DOCX_MAX_TOTAL_BYTES = 256 * 1024 * 1024;
|
|
469
470
|
const VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES = 32 * 1024 * 1024;
|
|
471
|
+
/**
|
|
472
|
+
* Inflated bytes allowed per compressed byte, for a markup or text entry and
|
|
473
|
+
* for the whole archive, once either passes the grace size. Real document
|
|
474
|
+
* parts stay far below this; an entry of one repeated byte sits near
|
|
475
|
+
* DEFLATE's 1032:1 ceiling. Binary entries can legitimately compress that far
|
|
476
|
+
* (an uncompressed bitmap of one colour), so only the archive-wide ratio and
|
|
477
|
+
* the byte limits bound them.
|
|
478
|
+
*/
|
|
479
|
+
const VALIDATE_DOCX_MAX_COMPRESSION_RATIO = 200;
|
|
480
|
+
const VALIDATE_DOCX_COMPRESSION_RATIO_GRACE_BYTES = 4 * 1024 * 1024;
|
|
470
481
|
const WORDPROCESSINGML_NAMESPACES = /* @__PURE__ */ new Set(["http://schemas.openxmlformats.org/wordprocessingml/2006/main", "http://purl.oclc.org/ooxml/wordprocessingml/main"]);
|
|
471
482
|
const packageXmlParser = new XMLParser({
|
|
472
483
|
preserveOrder: true,
|
|
@@ -481,6 +492,101 @@ const getDeclaredUncompressedSize = (file) => {
|
|
|
481
492
|
const metadata = file._data;
|
|
482
493
|
return typeof metadata?.uncompressedSize === "number" ? metadata.uncompressedSize : null;
|
|
483
494
|
};
|
|
495
|
+
const getCompressedSize = (file) => {
|
|
496
|
+
const metadata = file._data;
|
|
497
|
+
return typeof metadata?.compressedSize === "number" ? metadata.compressedSize : null;
|
|
498
|
+
};
|
|
499
|
+
const RATIO_BOUNDED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
500
|
+
"xml",
|
|
501
|
+
"rels",
|
|
502
|
+
"vml",
|
|
503
|
+
"txt",
|
|
504
|
+
"htm",
|
|
505
|
+
"html",
|
|
506
|
+
"mht",
|
|
507
|
+
"mhtml",
|
|
508
|
+
"rtf"
|
|
509
|
+
]);
|
|
510
|
+
const isRatioBoundedPart = (path) => RATIO_BOUNDED_EXTENSIONS.has(path.slice(path.lastIndexOf(".") + 1).toLowerCase());
|
|
511
|
+
const exceedsCompressionRatio = (inflatedBytes, compressedBytes) => compressedBytes !== null && inflatedBytes > VALIDATE_DOCX_COMPRESSION_RATIO_GRACE_BYTES && inflatedBytes > compressedBytes * VALIDATE_DOCX_MAX_COMPRESSION_RATIO;
|
|
512
|
+
/**
|
|
513
|
+
* Upper bound on the archive's central-directory records, counted before JSZip
|
|
514
|
+
* builds an object per record: each record starts with the `PK\x01\x02`
|
|
515
|
+
* signature, so JSZip cannot find more records than there are signatures.
|
|
516
|
+
*/
|
|
517
|
+
const countCentralDirectoryRecords = (bytes, stopAfter) => {
|
|
518
|
+
let count = 0;
|
|
519
|
+
let offset = bytes.indexOf(80);
|
|
520
|
+
while (offset !== -1 && offset + 3 < bytes.length) {
|
|
521
|
+
if (bytes[offset + 1] === 75 && bytes[offset + 2] === 1 && bytes[offset + 3] === 2) {
|
|
522
|
+
count += 1;
|
|
523
|
+
if (count > stopAfter) return count;
|
|
524
|
+
}
|
|
525
|
+
offset = bytes.indexOf(80, offset + 1);
|
|
526
|
+
}
|
|
527
|
+
return count;
|
|
528
|
+
};
|
|
529
|
+
const concatChunks = (chunks, totalBytes) => {
|
|
530
|
+
const merged = new Uint8Array(totalBytes);
|
|
531
|
+
let offset = 0;
|
|
532
|
+
for (const chunk of chunks) {
|
|
533
|
+
merged.set(chunk, offset);
|
|
534
|
+
offset += chunk.length;
|
|
535
|
+
}
|
|
536
|
+
return merged;
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Inflate one entry chunk by chunk and stop as soon as it passes `maxBytes`,
|
|
540
|
+
* its declared size or the compression-ratio cap. JSZip compares an entry
|
|
541
|
+
* with its declared size only after inflating all of it, so the declared
|
|
542
|
+
* size alone does not bound the allocation.
|
|
543
|
+
*/
|
|
544
|
+
const readEntryWithinBounds = async (entry, maxBytes) => {
|
|
545
|
+
const declaredBytes = getDeclaredUncompressedSize(entry);
|
|
546
|
+
const compressedBytes = getCompressedSize(entry);
|
|
547
|
+
return await new Promise((resolve, reject) => {
|
|
548
|
+
const stream = entry.internalStream("uint8array");
|
|
549
|
+
const chunks = [];
|
|
550
|
+
let entryBytes = 0;
|
|
551
|
+
let settled = false;
|
|
552
|
+
const stop = (error) => {
|
|
553
|
+
settled = true;
|
|
554
|
+
stream.pause();
|
|
555
|
+
resolve({
|
|
556
|
+
ok: false,
|
|
557
|
+
error
|
|
558
|
+
});
|
|
559
|
+
};
|
|
560
|
+
stream.on("data", (chunk) => {
|
|
561
|
+
if (settled) return;
|
|
562
|
+
entryBytes += chunk.length;
|
|
563
|
+
if (declaredBytes !== null && entryBytes > declaredBytes) {
|
|
564
|
+
stop(`Generated DOCX entry "${entry.name}" inflates past its declared size.`);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (exceedsCompressionRatio(entryBytes, compressedBytes)) {
|
|
568
|
+
stop(`Generated DOCX entry "${entry.name}" exceeds the ${VALIDATE_DOCX_MAX_COMPRESSION_RATIO}:1 compression ratio limit.`);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (entryBytes > maxBytes) {
|
|
572
|
+
stop(`Generated DOCX ${entry.name} exceeds the ${maxBytes}-byte limit.`);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
chunks.push(chunk);
|
|
576
|
+
}).on("end", () => {
|
|
577
|
+
if (settled) return;
|
|
578
|
+
settled = true;
|
|
579
|
+
resolve({
|
|
580
|
+
ok: true,
|
|
581
|
+
bytes: concatChunks(chunks, entryBytes)
|
|
582
|
+
});
|
|
583
|
+
}).on("error", (error) => {
|
|
584
|
+
if (settled) return;
|
|
585
|
+
settled = true;
|
|
586
|
+
reject(error);
|
|
587
|
+
}).resume();
|
|
588
|
+
});
|
|
589
|
+
};
|
|
484
590
|
/**
|
|
485
591
|
* Reject an archive whose entry count or declared uncompressed size (total
|
|
486
592
|
* or per-entry) exceeds the local bounds above, before any part is inflated.
|
|
@@ -488,7 +594,7 @@ const getDeclaredUncompressedSize = (file) => {
|
|
|
488
594
|
* as unbounded — the per-entry cap below still bounds what an inflate call
|
|
489
595
|
* can actually produce once it runs.
|
|
490
596
|
*/
|
|
491
|
-
const checkDocxArchiveBounds = (zip) => {
|
|
597
|
+
const checkDocxArchiveBounds = (zip, archiveBytes) => {
|
|
492
598
|
const entries = Object.values(zip.files);
|
|
493
599
|
if (entries.length > VALIDATE_DOCX_MAX_ENTRIES) return `Generated DOCX declares ${entries.length} archive entries, over the ${VALIDATE_DOCX_MAX_ENTRIES}-entry limit.`;
|
|
494
600
|
let totalUncompressedBytes = 0;
|
|
@@ -496,9 +602,11 @@ const checkDocxArchiveBounds = (zip) => {
|
|
|
496
602
|
const declaredBytes = getDeclaredUncompressedSize(entry);
|
|
497
603
|
if (declaredBytes === null) continue;
|
|
498
604
|
if (declaredBytes > VALIDATE_DOCX_MAX_ENTRY_BYTES) return `Generated DOCX entry "${entry.name}" declares ${declaredBytes} uncompressed bytes, over the ${VALIDATE_DOCX_MAX_ENTRY_BYTES}-byte limit.`;
|
|
605
|
+
if (isRatioBoundedPart(entry.name) && exceedsCompressionRatio(declaredBytes, getCompressedSize(entry))) return `Generated DOCX entry "${entry.name}" declares more than ${VALIDATE_DOCX_MAX_COMPRESSION_RATIO} uncompressed bytes per compressed byte.`;
|
|
499
606
|
totalUncompressedBytes += declaredBytes;
|
|
500
607
|
if (totalUncompressedBytes > VALIDATE_DOCX_MAX_TOTAL_BYTES) return `Generated DOCX declares more than ${VALIDATE_DOCX_MAX_TOTAL_BYTES} cumulative uncompressed bytes.`;
|
|
501
608
|
}
|
|
609
|
+
if (exceedsCompressionRatio(totalUncompressedBytes, archiveBytes)) return `Generated DOCX declares more than ${VALIDATE_DOCX_MAX_COMPRESSION_RATIO} uncompressed bytes per archive byte.`;
|
|
502
610
|
return null;
|
|
503
611
|
};
|
|
504
612
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -533,8 +641,14 @@ const validateDocumentXml = (xml) => {
|
|
|
533
641
|
};
|
|
534
642
|
const validateDocxPackage = async (buffer) => {
|
|
535
643
|
try {
|
|
644
|
+
const archiveBytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
645
|
+
if (countCentralDirectoryRecords(archiveBytes, VALIDATE_DOCX_MAX_ENTRIES) > VALIDATE_DOCX_MAX_ENTRIES) return {
|
|
646
|
+
valid: false,
|
|
647
|
+
code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
|
|
648
|
+
error: `Generated DOCX holds more than ${VALIDATE_DOCX_MAX_ENTRIES} archive entries.`
|
|
649
|
+
};
|
|
536
650
|
const zip = await JSZip.loadAsync(buffer);
|
|
537
|
-
const boundsError = checkDocxArchiveBounds(zip);
|
|
651
|
+
const boundsError = checkDocxArchiveBounds(zip, archiveBytes.byteLength);
|
|
538
652
|
if (boundsError) return {
|
|
539
653
|
valid: false,
|
|
540
654
|
code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
|
|
@@ -556,12 +670,13 @@ const validateDocxPackage = async (buffer) => {
|
|
|
556
670
|
code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
|
|
557
671
|
error: `Generated DOCX word/document.xml declares ${declaredDocumentBytes} uncompressed bytes, over the ${VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES}-byte limit.`
|
|
558
672
|
};
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
673
|
+
const documentRead = documentPart ? await readEntryWithinBounds(documentPart, VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES) : void 0;
|
|
674
|
+
if (documentRead !== void 0 && !documentRead.ok) return {
|
|
561
675
|
valid: false,
|
|
562
676
|
code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
|
|
563
|
-
error:
|
|
677
|
+
error: documentRead.error
|
|
564
678
|
};
|
|
679
|
+
const documentBytes = documentRead?.bytes;
|
|
565
680
|
const documentXml = documentBytes ? new TextDecoder().decode(documentBytes) : void 0;
|
|
566
681
|
const documentError = documentXml ? validateDocumentXml(documentXml) : "Generated DOCX has no word/document.xml root document.";
|
|
567
682
|
if (documentError) return {
|
|
@@ -569,7 +684,14 @@ const validateDocxPackage = async (buffer) => {
|
|
|
569
684
|
code: DOCX_PACKAGE_ISSUE_CODES.InvalidDocumentRoot,
|
|
570
685
|
error: documentError
|
|
571
686
|
};
|
|
572
|
-
|
|
687
|
+
const documentRelsPart = zip.file("word/_rels/document.xml.rels");
|
|
688
|
+
const documentRelsRead = documentRelsPart ? await readEntryWithinBounds(documentRelsPart, VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES) : void 0;
|
|
689
|
+
if (documentRelsRead !== void 0 && !documentRelsRead.ok) return {
|
|
690
|
+
valid: false,
|
|
691
|
+
code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
|
|
692
|
+
error: documentRelsRead.error
|
|
693
|
+
};
|
|
694
|
+
if ((documentRelsRead ? new TextDecoder().decode(documentRelsRead.bytes) : void 0)?.includes("/relationships/numbering") && !zip.file("word/numbering.xml")) return {
|
|
573
695
|
valid: false,
|
|
574
696
|
code: DOCX_PACKAGE_ISSUE_CODES.MissingNumberingPart,
|
|
575
697
|
error: "Generated DOCX references numbering.xml but does not include it."
|
|
@@ -2582,11 +2704,19 @@ const resolveListNumId = (numIds, parentNumId, level) => {
|
|
|
2582
2704
|
numIds.levels.set(numId, /* @__PURE__ */ new Map([[level.ilvl, level]]));
|
|
2583
2705
|
return numId;
|
|
2584
2706
|
};
|
|
2585
|
-
|
|
2707
|
+
/**
|
|
2708
|
+
* Whether an item-content token is one the block model cannot nest inside a
|
|
2709
|
+
* list item's own paragraph: a nested list (handled separately, at a deeper
|
|
2710
|
+
* `ilvl`) or a block the DOCX list model has no notion of nesting at all
|
|
2711
|
+
* (OOXML lists are just numbered paragraphs, not containers — a table,
|
|
2712
|
+
* code block, or blockquote next to one is always a sibling, never a child).
|
|
2713
|
+
*/
|
|
2714
|
+
const isNestedBlockToken = (token) => token !== void 0 && (isTokenType(token, "list") || isTokenType(token, "table") || isTokenType(token, "code") || isTokenType(token, "blockquote"));
|
|
2715
|
+
const listBlocks = (list, level, parentNumId, state) => {
|
|
2586
2716
|
const out = [];
|
|
2587
2717
|
const start = Number(list.start) || 1;
|
|
2588
2718
|
const decimalLevels = Array.from({ length: level + 1 }, () => "decimal");
|
|
2589
|
-
const numId = resolveListNumId(
|
|
2719
|
+
const numId = resolveListNumId(state, parentNumId, buildListLevel(level, !list.ordered, start));
|
|
2590
2720
|
for (const item of list.items) {
|
|
2591
2721
|
const rendering = list.ordered ? {
|
|
2592
2722
|
marker: `%${level + 1}.`,
|
|
@@ -2603,11 +2733,27 @@ const listBlocks = (list, level, parentNumId, numIds) => {
|
|
|
2603
2733
|
isBullet: true
|
|
2604
2734
|
};
|
|
2605
2735
|
const inlineTokens = [];
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2608
|
-
|
|
2736
|
+
const trailing = [];
|
|
2737
|
+
let inTrailing = false;
|
|
2738
|
+
for (const [index, child] of item.tokens.entries()) {
|
|
2739
|
+
if (!inTrailing && isNestedBlockToken(child)) inTrailing = true;
|
|
2740
|
+
if (!inTrailing && child.type === "space" && isNestedBlockToken(item.tokens[index + 1])) continue;
|
|
2741
|
+
if (inTrailing) trailing.push(child);
|
|
2742
|
+
else inlineTokens.push(child);
|
|
2743
|
+
}
|
|
2609
2744
|
out.push(listPara(inlineTokensToRuns(inlineTokens, item.text), rendering));
|
|
2610
|
-
for (const
|
|
2745
|
+
for (const block of trailing) {
|
|
2746
|
+
if (isTokenType(block, "list")) {
|
|
2747
|
+
out.push(...listBlocks(block, level + 1, numId, state));
|
|
2748
|
+
continue;
|
|
2749
|
+
}
|
|
2750
|
+
if (block.type === "space") continue;
|
|
2751
|
+
const rendered = blocksFromTokens([block], state);
|
|
2752
|
+
if (rendered.length > 0) {
|
|
2753
|
+
out.push(...rendered);
|
|
2754
|
+
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.`);
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2611
2757
|
}
|
|
2612
2758
|
return out;
|
|
2613
2759
|
};
|
|
@@ -2639,17 +2785,17 @@ const headingParagraph = (runs, depth) => {
|
|
|
2639
2785
|
};
|
|
2640
2786
|
/** The built-in a markdown blockquote compiles to. */
|
|
2641
2787
|
const QUOTE_STYLE_ID = "Quote";
|
|
2642
|
-
const blocksFromTokens = (tokens,
|
|
2788
|
+
const blocksFromTokens = (tokens, state) => {
|
|
2643
2789
|
const blocks = [];
|
|
2644
2790
|
for (const token of tokens ?? []) if (isTokenType(token, "heading")) blocks.push(headingParagraph(inlineTokensToRuns(token.tokens, token.text), token.depth));
|
|
2645
2791
|
else if (isTokenType(token, "paragraph")) blocks.push(para(inlineTokensToRuns(token.tokens, token.text)));
|
|
2646
2792
|
else if (isTokenType(token, "list")) {
|
|
2647
|
-
const numId =
|
|
2648
|
-
|
|
2649
|
-
blocks.push(...listBlocks(token, 0, numId,
|
|
2793
|
+
const numId = state.next++;
|
|
2794
|
+
state.levels.set(numId, /* @__PURE__ */ new Map());
|
|
2795
|
+
blocks.push(...listBlocks(token, 0, numId, state));
|
|
2650
2796
|
} else if (isTokenType(token, "table")) blocks.push(tableFromToken(token));
|
|
2651
2797
|
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,
|
|
2798
|
+
else if (isTokenType(token, "blockquote")) for (const inner of blocksFromTokens(token.tokens, state)) {
|
|
2653
2799
|
const styled = inner.type === "paragraph" ? {
|
|
2654
2800
|
...inner,
|
|
2655
2801
|
formatting: {
|
|
@@ -2689,13 +2835,15 @@ const buildNumbering = (numIdLevels) => {
|
|
|
2689
2835
|
* (page geometry, styles, and presets are the host's decision).
|
|
2690
2836
|
*/
|
|
2691
2837
|
const compileMarkdownToContent = (markdown) => {
|
|
2692
|
-
const
|
|
2838
|
+
const state = {
|
|
2693
2839
|
next: 1,
|
|
2694
|
-
levels: /* @__PURE__ */ new Map()
|
|
2840
|
+
levels: /* @__PURE__ */ new Map(),
|
|
2841
|
+
warnings: []
|
|
2695
2842
|
};
|
|
2696
2843
|
return {
|
|
2697
|
-
content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)),
|
|
2698
|
-
...
|
|
2844
|
+
content: blocksFromTokens(lexMarkdown(sanitizeXmlCharacters(markdown)), state),
|
|
2845
|
+
...state.levels.size > 0 && { numbering: buildNumbering(state.levels) },
|
|
2846
|
+
...state.warnings.length > 0 && { warnings: state.warnings }
|
|
2699
2847
|
};
|
|
2700
2848
|
};
|
|
2701
2849
|
//#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 };
|