@stll/docx-core 0.15.1 → 0.16.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.
@@ -568,6 +568,8 @@ type NumberingInstance = {
568
568
  lvl?: ListLevel;
569
569
  }[];
570
570
  };
571
+ /** Typography from numbering-level `w:rPr` that applies to the marker glyphs. */
572
+ type ListMarkerFormatting = Pick<TextFormatting, "fontFamily" | "fontSize" | "fontSizeCs" | "bold" | "boldCs" | "italic" | "italicCs" | "rtl" | "cs">;
571
573
  /**
572
574
  * Computed list rendering info
573
575
  */
@@ -586,12 +588,8 @@ type ListRendering = {
586
588
  numFmt?: NumberFormat;
587
589
  /** Whether the list marker is hidden (w:vanish on level rPr) */
588
590
  markerHidden?: boolean;
589
- /** Marker font family from numbering level rPr (ascii name) */
590
- markerFontFamily?: string;
591
- /** Marker font size from numbering level rPr, in points */
592
- markerFontSize?: number;
593
- /** Marker bold state from numbering level rPr */
594
- markerBold?: boolean;
591
+ /** Canonical numbering-level marker typography, in OOXML units. */
592
+ markerFormatting?: ListMarkerFormatting;
595
593
  /** Horizontal alignment of the marker around the paragraph's list anchor. */
596
594
  markerAlignment?: "left" | "center" | "right";
597
595
  /**
@@ -2284,4 +2282,4 @@ type Document = {
2284
2282
  warnings?: string[];
2285
2283
  };
2286
2284
  //#endregion
2287
- export { ImageTransform as $, TrackedChangeInfo as $t, ComplexField as A, TableWidthType as An, SectionProperties as At, FooterReference as B, SoftHyphenContent as Bt, BookmarkStart as C, TableBorders as Cn, PropertyChangeInfo as Ct, CommentRangeEnd as D, TableLook as Dn, SdtProperties as Dt, Comment as E, TableFormatting as En, RunPropertyChange as Et, EndnotePosition as F, ColorValue as Fn, ShapeFill as Ft, HeaderFooterType as G, TableCellPropertyChange as Gt, FootnotePosition as H, TabContent as Ht, EndnoteProperties as I, KnownBorderStyle as In, ShapeOutline as It, Image as J, TableRowPropertyChange as Jt, HeaderReference as K, TablePropertyChange as Kt, Field as L, ShadingProperties as Ln, ShapeTextBody as Lt, DocumentBody as M, TextFormatting as Mn, SectionStart as Mt, DrawingContent as N, UnderlineStyle as Nn, Shape as Nt, CommentRangeStart as O, TableMeasurement as On, SdtType as Ot, Endnote as P, BorderSpec as Pn, ShapeContent as Pt, ImageSize as Q, TextWatermark as Qt, FieldCharContent as R, ThemeColorSlot as Rn, ShapeType as Rt, BookmarkEnd as S, TabStopAlignment as Sn, PositionalTab as St, Column as T, TableCellFormatting as Tn, RunContent as Tt, FootnoteProperties as U, Table as Ut, Footnote as V, SymbolContent as Vt, HeaderFooter as W, TableCell as Wt, ImagePadding as X, TextBox as Xt, ImageCrop as Y, TableStructuralChangeInfo as Yt, ImagePosition as Z, TextContent as Zt, ThemeColorScheme as _, ParagraphAlignment as _n, Paragraph as _t, DocxPackage as a, AbstractNumbering as an, MAX_REVISION_ID as at, BlockContent as b, TabLeader as bn, ParagraphPropertyChange as bt, FontTable as c, ListRendering as cn, MoveFromRangeEnd as ct, RelationshipMap as d, NumberingInstance as dn, MoveToRangeEnd as dt, TrackedRunChange as en, ImageWrap as et, RelationshipType as f, CellMargins as fn, MoveToRangeStart as ft, Theme as g, LineSpacingRule as gn, PageOrientation as gt, StyleType as h, FloatingTableProperties as hn, NoteReferenceContent as ht, DocxConformanceClass as i, normalizeRevisionId as in, LineNumberRestart as it, Deletion as j, TextEffect as jn, SectionPropertyChange as jt, CommentReference as k, TableRowFormatting as kn, Section as kt, MediaFile as l, NumberFormat as ln, MoveFromRangeStart as lt, StyleDefinitions as m, EmphasisMark as mn, NoteNumberRestart as mt, Document as n, Watermark as nn, Insertion as nt, DocDefaults as o, LevelSuffix as on, MathEquation as ot, Style as p, ConditionalFormatStyle as pn, NoBreakHyphenContent as pt, Hyperlink as q, TableRow as qt, DocumentSettings as r, isOoxmlSymbolCharacter as rn, InstrTextContent as rt, FontInfo as s, ListLevel as sn, MoveFrom as st, DOCX_CONFORMANCE_CLASSES as t, VerticalAlign as tn, InlineSdt as tt, Relationship as u, NumberingDefinitions as un, MoveTo as ut, ThemeFont as v, ParagraphFormatting as vn, ParagraphContent as vt, BreakContent as w, TableCellBorders as wn, Run as wt, BlockSdt as x, TabStop as xn, PictureWatermark as xt, ThemeFontScheme as y, SpacingExplicit as yn, ParagraphMarkChange as yt, FieldType as z, SimpleField as zt };
2285
+ export { ImageTransform as $, TrackedChangeInfo as $t, ComplexField as A, TableRowFormatting as An, SectionProperties as At, FooterReference as B, SoftHyphenContent as Bt, BookmarkStart as C, TabStopAlignment as Cn, PropertyChangeInfo as Ct, CommentRangeEnd as D, TableFormatting as Dn, SdtProperties as Dt, Comment as E, TableCellFormatting as En, RunPropertyChange as Et, EndnotePosition as F, BorderSpec as Fn, ShapeFill as Ft, HeaderFooterType as G, TableCellPropertyChange as Gt, FootnotePosition as H, TabContent as Ht, EndnoteProperties as I, ColorValue as In, ShapeOutline as It, Image as J, TableRowPropertyChange as Jt, HeaderReference as K, TablePropertyChange as Kt, Field as L, KnownBorderStyle as Ln, ShapeTextBody as Lt, DocumentBody as M, TextEffect as Mn, SectionStart as Mt, DrawingContent as N, TextFormatting as Nn, Shape as Nt, CommentRangeStart as O, TableLook as On, SdtType as Ot, Endnote as P, UnderlineStyle as Pn, ShapeContent as Pt, ImageSize as Q, TextWatermark as Qt, FieldCharContent as R, ShadingProperties as Rn, ShapeType as Rt, BookmarkEnd as S, TabStop as Sn, PositionalTab as St, Column as T, TableCellBorders as Tn, RunContent as Tt, FootnoteProperties as U, Table as Ut, Footnote as V, SymbolContent as Vt, HeaderFooter as W, TableCell as Wt, ImagePadding as X, TextBox as Xt, ImageCrop as Y, TableStructuralChangeInfo as Yt, ImagePosition as Z, TextContent as Zt, ThemeColorScheme as _, LineSpacingRule as _n, Paragraph as _t, DocxPackage as a, AbstractNumbering as an, MAX_REVISION_ID as at, BlockContent as b, SpacingExplicit as bn, ParagraphPropertyChange as bt, FontTable as c, ListMarkerFormatting as cn, MoveFromRangeEnd as ct, RelationshipMap as d, NumberingDefinitions as dn, MoveToRangeEnd as dt, TrackedRunChange as en, ImageWrap as et, RelationshipType as f, NumberingInstance as fn, MoveToRangeStart as ft, Theme as g, FloatingTableProperties as gn, PageOrientation as gt, StyleType as h, EmphasisMark as hn, NoteReferenceContent as ht, DocxConformanceClass as i, normalizeRevisionId as in, LineNumberRestart as it, Deletion as j, TableWidthType as jn, SectionPropertyChange as jt, CommentReference as k, TableMeasurement as kn, Section as kt, MediaFile as l, ListRendering as ln, MoveFromRangeStart as lt, StyleDefinitions as m, ConditionalFormatStyle as mn, NoteNumberRestart as mt, Document as n, Watermark as nn, Insertion as nt, DocDefaults as o, LevelSuffix as on, MathEquation as ot, Style as p, CellMargins as pn, NoBreakHyphenContent as pt, Hyperlink as q, TableRow as qt, DocumentSettings as r, isOoxmlSymbolCharacter as rn, InstrTextContent as rt, FontInfo as s, ListLevel as sn, MoveFrom as st, DOCX_CONFORMANCE_CLASSES as t, VerticalAlign as tn, InlineSdt as tt, Relationship as u, NumberFormat as un, MoveTo as ut, ThemeFont as v, ParagraphAlignment as vn, ParagraphContent as vt, BreakContent as w, TableBorders as wn, Run as wt, BlockSdt as x, TabLeader as xn, PictureWatermark as xt, ThemeFontScheme as y, ParagraphFormatting as yn, ParagraphMarkChange as yt, FieldType as z, ThemeColorSlot as zn, SimpleField as zt };
Binary file
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { At as SectionProperties, M as DocumentBody, St as PositionalTab, Tt as RunContent, Ut as Table, Wt as TableCell, Zt as TextContent, _t as Paragraph, a as DocxPackage, b as BlockContent, i as DocxConformanceClass, n as Document, p as Style, qt as TableRow, t as DOCX_CONFORMANCE_CLASSES, vt as ParagraphContent, w as BreakContent, wt as Run } from "./document-ckW6arDW.js";
1
+ import { At as SectionProperties, M as DocumentBody, St as PositionalTab, Tt as RunContent, Ut as Table, Wt as TableCell, Zt as TextContent, _t as Paragraph, a as DocxPackage, b as BlockContent, i as DocxConformanceClass, n as Document, p as Style, qt as TableRow, t as DOCX_CONFORMANCE_CLASSES, vt as ParagraphContent, w as BreakContent, wt as Run } from "./document-BBf3sBoZ.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";
@@ -122,10 +122,19 @@ type SerializeDocumentOptions = {
122
122
  declare const serializeDocumentToDocx: (document: Document, options?: SerializeDocumentOptions) => Promise<ArrayBuffer>;
123
123
  //#endregion
124
124
  //#region src/validate/docx.d.ts
125
+ declare const DOCX_PACKAGE_ISSUE_CODES: {
126
+ readonly ArchiveBoundsExceeded: "archive_bounds_exceeded";
127
+ readonly InvalidArchive: "invalid_archive";
128
+ readonly InvalidDocumentRoot: "invalid_document_root";
129
+ readonly MissingNumberingPart: "missing_numbering_part";
130
+ readonly MissingPackagePart: "missing_package_part";
131
+ };
132
+ type DocxPackageIssueCode = (typeof DOCX_PACKAGE_ISSUE_CODES)[keyof typeof DOCX_PACKAGE_ISSUE_CODES];
125
133
  type ValidateDocxPackageResult = {
126
134
  valid: true;
127
135
  } | {
128
136
  valid: false;
137
+ code: DocxPackageIssueCode;
129
138
  error: string;
130
139
  };
131
140
  type ValidateDocumentModelIssue = {
@@ -141,4 +150,4 @@ declare const validateDocxPackage: (buffer: ArrayBuffer | Uint8Array) => Promise
141
150
  declare const validateDocumentModel: (document: Document) => ValidateDocumentModelResult;
142
151
  declare const assertValidDocumentModel: (document: Document) => void;
143
152
  //#endregion
144
- export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, DOCX_CONFORMANCE_CLASSES, type Document, type DocumentBody, type DocxConformanceClass, type DocxPackage, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type Paragraph, type ParagraphContent, type PositionalTab, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
153
+ export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, type Document, type DocumentBody, type DocxConformanceClass, type DocxPackage, type DocxPackageIssueCode, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type Paragraph, type ParagraphContent, type PositionalTab, type Run, type RunContent, type SectionProperties, type Style, type Table, type TableCell, type TableRow, type TextContent, type ValidateDocumentModelIssue, type ValidateDocumentModelResult, type ValidateDocxPackageResult, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { r as isOoxmlSymbolCharacter, t as DOCX_CONFORMANCE_CLASSES } from "./document-BO7h-LxY.js";
2
2
  import JSZip from "jszip";
3
3
  import { panic } from "better-result";
4
+ import { XMLParser, XMLValidator } from "fast-xml-parser";
4
5
  //#region src/serialize/xml.ts
5
6
  const ILLEGAL_XML_CHARS_RE = /[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]/gu;
6
7
  const stripIllegalXmlChars = (value) => value.replace(ILLEGAL_XML_CHARS_RE, "");
@@ -170,13 +171,22 @@ const serializeRunProperties = (formatting) => {
170
171
  if (!formatting) return "";
171
172
  const parts = [];
172
173
  if (formatting.styleId) parts.push(`<w:rStyle w:val="${escapeXml(formatting.styleId)}"/>`);
173
- if (formatting.bold) parts.push("<w:b/>");
174
- if (formatting.italic) parts.push("<w:i/>");
174
+ if (formatting.bold === true) parts.push("<w:b/>");
175
+ else if (formatting.bold === false) parts.push("<w:b w:val=\"0\"/>");
176
+ if (formatting.boldCs === true) parts.push("<w:bCs/>");
177
+ else if (formatting.boldCs === false) parts.push("<w:bCs w:val=\"0\"/>");
178
+ if (formatting.italic === true) parts.push("<w:i/>");
179
+ else if (formatting.italic === false) parts.push("<w:i w:val=\"0\"/>");
180
+ if (formatting.italicCs === true) parts.push("<w:iCs/>");
181
+ else if (formatting.italicCs === false) parts.push("<w:iCs w:val=\"0\"/>");
175
182
  if (formatting.allCaps) parts.push("<w:caps/>");
176
183
  if (formatting.smallCaps) parts.push("<w:smallCaps/>");
177
184
  if (formatting.highlight) parts.push(`<w:highlight w:val="${formatting.highlight}"/>`);
178
185
  if (formatting.fontSize !== void 0) parts.push(`<w:sz w:val="${formatting.fontSize}"/>`);
186
+ if (formatting.fontSizeCs !== void 0) parts.push(`<w:szCs w:val="${formatting.fontSizeCs}"/>`);
179
187
  if (formatting.fontFamily) parts.push(`<w:rFonts${attr("w:ascii", formatting.fontFamily.ascii)}${attr("w:hAnsi", formatting.fontFamily.hAnsi)}${attr("w:cs", formatting.fontFamily.cs)}/>`);
188
+ if (formatting.cs === true) parts.push("<w:cs/>");
189
+ else if (formatting.cs === false) parts.push("<w:cs w:val=\"0\"/>");
180
190
  return parts.length > 0 ? `<w:rPr>${parts.join("")}</w:rPr>` : "";
181
191
  };
182
192
  const serializeRunContent = (content) => {
@@ -322,6 +332,13 @@ const serializeCoreProperties = (document) => {
322
332
  };
323
333
  //#endregion
324
334
  //#region src/validate/docx.ts
335
+ const DOCX_PACKAGE_ISSUE_CODES = {
336
+ ArchiveBoundsExceeded: "archive_bounds_exceeded",
337
+ InvalidArchive: "invalid_archive",
338
+ InvalidDocumentRoot: "invalid_document_root",
339
+ MissingNumberingPart: "missing_numbering_part",
340
+ MissingPackagePart: "missing_package_part"
341
+ };
325
342
  /**
326
343
  * Local bounds on the ZIP archive `validateDocxPackage` inflates parts from.
327
344
  * `docx-core` has no dependency on `@stll/folio-core`, so these mirror the
@@ -334,6 +351,17 @@ const serializeCoreProperties = (document) => {
334
351
  const VALIDATE_DOCX_MAX_ENTRIES = 4096;
335
352
  const VALIDATE_DOCX_MAX_ENTRY_BYTES = 128 * 1024 * 1024;
336
353
  const VALIDATE_DOCX_MAX_TOTAL_BYTES = 256 * 1024 * 1024;
354
+ const VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES = 32 * 1024 * 1024;
355
+ const WORDPROCESSINGML_NAMESPACES = /* @__PURE__ */ new Set(["http://schemas.openxmlformats.org/wordprocessingml/2006/main", "http://purl.oclc.org/ooxml/wordprocessingml/main"]);
356
+ const packageXmlParser = new XMLParser({
357
+ preserveOrder: true,
358
+ ignoreAttributes: false,
359
+ attributeNamePrefix: "",
360
+ parseTagValue: false,
361
+ parseAttributeValue: false,
362
+ processEntities: false,
363
+ ignoreDeclaration: true
364
+ });
337
365
  const getDeclaredUncompressedSize = (file) => {
338
366
  const metadata = file._data;
339
367
  return typeof metadata?.uncompressedSize === "number" ? metadata.uncompressedSize : null;
@@ -358,36 +386,84 @@ const checkDocxArchiveBounds = (zip) => {
358
386
  }
359
387
  return null;
360
388
  };
389
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
390
+ const elementName = (node) => Object.keys(node).find((key) => key !== ":@" && !key.startsWith("?")) ?? null;
391
+ const localName = (name) => name.slice(name.indexOf(":") + 1);
392
+ const prefix = (name) => {
393
+ const separator = name.indexOf(":");
394
+ return separator === -1 ? "" : name.slice(0, separator);
395
+ };
396
+ const namespaceFor = (name, attributes, inherited = {}) => {
397
+ const key = prefix(name) === "" ? "xmlns" : `xmlns:${prefix(name)}`;
398
+ const value = attributes[key] ?? inherited[key];
399
+ return typeof value === "string" ? value : null;
400
+ };
401
+ const validateDocumentXml = (xml) => {
402
+ if (XMLValidator.validate(xml) !== true) return "Generated DOCX has malformed word/document.xml.";
403
+ const parsed = packageXmlParser.parse(xml);
404
+ if (!Array.isArray(parsed)) return "Generated DOCX has no word/document.xml root document.";
405
+ const root = parsed.find(isRecord);
406
+ if (!root) return "Generated DOCX has no word/document.xml root document.";
407
+ const rootName = elementName(root);
408
+ const rootAttributes = isRecord(root[":@"]) ? root[":@"] : {};
409
+ if (rootName === null || localName(rootName) !== "document" || !WORDPROCESSINGML_NAMESPACES.has(namespaceFor(rootName, rootAttributes) ?? "")) return "Generated DOCX has no WordprocessingML document root.";
410
+ const children = root[rootName];
411
+ if (!Array.isArray(children)) return "Generated DOCX document root has no WordprocessingML body.";
412
+ return children.some((child) => {
413
+ if (!isRecord(child)) return false;
414
+ const childName = elementName(child);
415
+ const childAttributes = isRecord(child[":@"]) ? child[":@"] : {};
416
+ return childName !== null && localName(childName) === "body" && WORDPROCESSINGML_NAMESPACES.has(namespaceFor(childName, childAttributes, rootAttributes) ?? "");
417
+ }) ? null : "Generated DOCX document root has no WordprocessingML body.";
418
+ };
361
419
  const validateDocxPackage = async (buffer) => {
362
420
  try {
363
421
  const zip = await JSZip.loadAsync(buffer);
364
422
  const boundsError = checkDocxArchiveBounds(zip);
365
423
  if (boundsError) return {
366
424
  valid: false,
425
+ code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
367
426
  error: boundsError
368
427
  };
369
428
  for (const requiredPath of [
370
429
  "[Content_Types].xml",
371
430
  "_rels/.rels",
372
- "word/document.xml",
373
- "word/styles.xml",
374
- "word/_rels/document.xml.rels"
431
+ "word/document.xml"
375
432
  ]) if (!zip.file(requiredPath)) return {
376
433
  valid: false,
434
+ code: DOCX_PACKAGE_ISSUE_CODES.MissingPackagePart,
377
435
  error: `Generated DOCX is missing required package part: ${requiredPath}`
378
436
  };
379
- if (!(await zip.file("word/document.xml")?.async("string"))?.includes("<w:document")) return {
437
+ const documentPart = zip.file("word/document.xml");
438
+ const declaredDocumentBytes = documentPart ? getDeclaredUncompressedSize(documentPart) : null;
439
+ if (declaredDocumentBytes !== null && declaredDocumentBytes > VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES) return {
440
+ valid: false,
441
+ code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
442
+ error: `Generated DOCX word/document.xml declares ${declaredDocumentBytes} uncompressed bytes, over the ${VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES}-byte limit.`
443
+ };
444
+ const documentBytes = await documentPart?.async("uint8array");
445
+ if (documentBytes !== void 0 && documentBytes.byteLength > VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES) return {
446
+ valid: false,
447
+ code: DOCX_PACKAGE_ISSUE_CODES.ArchiveBoundsExceeded,
448
+ error: `Generated DOCX word/document.xml exceeds the ${VALIDATE_DOCX_MAX_DOCUMENT_XML_BYTES}-byte limit.`
449
+ };
450
+ const documentXml = documentBytes ? new TextDecoder().decode(documentBytes) : void 0;
451
+ const documentError = documentXml ? validateDocumentXml(documentXml) : "Generated DOCX has no word/document.xml root document.";
452
+ if (documentError) return {
380
453
  valid: false,
381
- error: "Generated DOCX has no word/document.xml root document."
454
+ code: DOCX_PACKAGE_ISSUE_CODES.InvalidDocumentRoot,
455
+ error: documentError
382
456
  };
383
457
  if ((await zip.file("word/_rels/document.xml.rels")?.async("string"))?.includes("/relationships/numbering") && !zip.file("word/numbering.xml")) return {
384
458
  valid: false,
459
+ code: DOCX_PACKAGE_ISSUE_CODES.MissingNumberingPart,
385
460
  error: "Generated DOCX references numbering.xml but does not include it."
386
461
  };
387
462
  return { valid: true };
388
463
  } catch (error) {
389
464
  return {
390
465
  valid: false,
466
+ code: DOCX_PACKAGE_ISSUE_CODES.InvalidArchive,
391
467
  error: error instanceof Error ? error.message : "Invalid DOCX package."
392
468
  };
393
469
  }
@@ -1983,4 +2059,4 @@ const compileLegalSourceToDocx = async (source, options = {}) => {
1983
2059
  };
1984
2060
  };
1985
2061
  //#endregion
1986
- export { DOCX_CONFORMANCE_CLASSES, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
2062
+ export { DOCX_CONFORMANCE_CLASSES, DOCX_PACKAGE_ISSUE_CODES, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
@@ -1,2 +1,2 @@
1
- import { $ as ImageTransform, $t as TrackedChangeInfo, A as ComplexField, An as TableWidthType, At as SectionProperties, B as FooterReference, Bt as SoftHyphenContent, C as BookmarkStart, Cn as TableBorders, Ct as PropertyChangeInfo, D as CommentRangeEnd, Dn as TableLook, Dt as SdtProperties, E as Comment, En as TableFormatting, Et as RunPropertyChange, F as EndnotePosition, Fn as ColorValue, Ft as ShapeFill, G as HeaderFooterType, Gt as TableCellPropertyChange, H as FootnotePosition, Ht as TabContent, I as EndnoteProperties, In as KnownBorderStyle, It as ShapeOutline, J as Image, Jt as TableRowPropertyChange, K as HeaderReference, Kt as TablePropertyChange, L as Field, Ln as ShadingProperties, Lt as ShapeTextBody, M as DocumentBody, Mn as TextFormatting, Mt as SectionStart, N as DrawingContent, Nn as UnderlineStyle, Nt as Shape, O as CommentRangeStart, On as TableMeasurement, Ot as SdtType, P as Endnote, Pn as BorderSpec, Pt as ShapeContent, Q as ImageSize, Qt as TextWatermark, R as FieldCharContent, Rn as ThemeColorSlot, Rt as ShapeType, S as BookmarkEnd, Sn as TabStopAlignment, St as PositionalTab, T as Column, Tn as TableCellFormatting, Tt as RunContent, U as FootnoteProperties, Ut as Table, V as Footnote, Vt as SymbolContent, W as HeaderFooter, Wt as TableCell, X as ImagePadding, Xt as TextBox, Y as ImageCrop, Yt as TableStructuralChangeInfo, Z as ImagePosition, Zt as TextContent, _ as ThemeColorScheme, _n as ParagraphAlignment, _t as Paragraph, a as DocxPackage, an as AbstractNumbering, at as MAX_REVISION_ID, b as BlockContent, bn as TabLeader, bt as ParagraphPropertyChange, c as FontTable, cn as ListRendering, ct as MoveFromRangeEnd, d as RelationshipMap, dn as NumberingInstance, dt as MoveToRangeEnd, en as TrackedRunChange, et as ImageWrap, f as RelationshipType, fn as CellMargins, ft as MoveToRangeStart, g as Theme, gn as LineSpacingRule, gt as PageOrientation, h as StyleType, hn as FloatingTableProperties, ht as NoteReferenceContent, i as DocxConformanceClass, in as normalizeRevisionId, it as LineNumberRestart, j as Deletion, jn as TextEffect, jt as SectionPropertyChange, k as CommentReference, kn as TableRowFormatting, kt as Section, l as MediaFile, ln as NumberFormat, lt as MoveFromRangeStart, m as StyleDefinitions, mn as EmphasisMark, mt as NoteNumberRestart, n as Document, nn as Watermark, nt as Insertion, o as DocDefaults, on as LevelSuffix, ot as MathEquation, p as Style, pn as ConditionalFormatStyle, pt as NoBreakHyphenContent, q as Hyperlink, qt as TableRow, r as DocumentSettings, rn as isOoxmlSymbolCharacter, rt as InstrTextContent, s as FontInfo, sn as ListLevel, st as MoveFrom, t as DOCX_CONFORMANCE_CLASSES, tn as VerticalAlign, tt as InlineSdt, u as Relationship, un as NumberingDefinitions, ut as MoveTo, v as ThemeFont, vn as ParagraphFormatting, vt as ParagraphContent, w as BreakContent, wn as TableCellBorders, wt as Run, x as BlockSdt, xn as TabStop, xt as PictureWatermark, y as ThemeFontScheme, yn as SpacingExplicit, yt as ParagraphMarkChange, z as FieldType, zt as SimpleField } from "../document-ckW6arDW.js";
2
- export { type AbstractNumbering, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkStart, type BorderSpec, type BreakContent, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, DOCX_CONFORMANCE_CLASSES, type Deletion, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingContent, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type Hyperlink, type Image, type ImageCrop, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type InlineSdt, type Insertion, type InstrTextContent, type KnownBorderStyle, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListRendering, MAX_REVISION_ID, type MathEquation, type MediaFile, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, type NoBreakHyphenContent, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphPropertyChange, type PictureWatermark, type PositionalTab, type PropertyChangeInfo, type Relationship, type RelationshipMap, type RelationshipType, type Run, type RunContent, type RunPropertyChange, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableBorders, type TableCell, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableLook, type TableMeasurement, type TablePropertyChange, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColorScheme, type ThemeColorSlot, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type UnderlineStyle, type VerticalAlign, type Watermark, isOoxmlSymbolCharacter, normalizeRevisionId };
1
+ import { $ as ImageTransform, $t as TrackedChangeInfo, A as ComplexField, An as TableRowFormatting, At as SectionProperties, B as FooterReference, Bt as SoftHyphenContent, C as BookmarkStart, Cn as TabStopAlignment, Ct as PropertyChangeInfo, D as CommentRangeEnd, Dn as TableFormatting, Dt as SdtProperties, E as Comment, En as TableCellFormatting, Et as RunPropertyChange, F as EndnotePosition, Fn as BorderSpec, Ft as ShapeFill, G as HeaderFooterType, Gt as TableCellPropertyChange, H as FootnotePosition, Ht as TabContent, I as EndnoteProperties, In as ColorValue, It as ShapeOutline, J as Image, Jt as TableRowPropertyChange, K as HeaderReference, Kt as TablePropertyChange, L as Field, Ln as KnownBorderStyle, Lt as ShapeTextBody, M as DocumentBody, Mn as TextEffect, Mt as SectionStart, N as DrawingContent, Nn as TextFormatting, Nt as Shape, O as CommentRangeStart, On as TableLook, Ot as SdtType, P as Endnote, Pn as UnderlineStyle, Pt as ShapeContent, Q as ImageSize, Qt as TextWatermark, R as FieldCharContent, Rn as ShadingProperties, Rt as ShapeType, S as BookmarkEnd, Sn as TabStop, St as PositionalTab, T as Column, Tn as TableCellBorders, Tt as RunContent, U as FootnoteProperties, Ut as Table, V as Footnote, Vt as SymbolContent, W as HeaderFooter, Wt as TableCell, X as ImagePadding, Xt as TextBox, Y as ImageCrop, Yt as TableStructuralChangeInfo, Z as ImagePosition, Zt as TextContent, _ as ThemeColorScheme, _n as LineSpacingRule, _t as Paragraph, a as DocxPackage, an as AbstractNumbering, at as MAX_REVISION_ID, b as BlockContent, bn as SpacingExplicit, bt as ParagraphPropertyChange, c as FontTable, cn as ListMarkerFormatting, ct as MoveFromRangeEnd, d as RelationshipMap, dn as NumberingDefinitions, dt as MoveToRangeEnd, en as TrackedRunChange, et as ImageWrap, f as RelationshipType, fn as NumberingInstance, ft as MoveToRangeStart, g as Theme, gn as FloatingTableProperties, gt as PageOrientation, h as StyleType, hn as EmphasisMark, ht as NoteReferenceContent, i as DocxConformanceClass, in as normalizeRevisionId, it as LineNumberRestart, j as Deletion, jn as TableWidthType, jt as SectionPropertyChange, k as CommentReference, kn as TableMeasurement, kt as Section, l as MediaFile, ln as ListRendering, lt as MoveFromRangeStart, m as StyleDefinitions, mn as ConditionalFormatStyle, mt as NoteNumberRestart, n as Document, nn as Watermark, nt as Insertion, o as DocDefaults, on as LevelSuffix, ot as MathEquation, p as Style, pn as CellMargins, pt as NoBreakHyphenContent, q as Hyperlink, qt as TableRow, r as DocumentSettings, rn as isOoxmlSymbolCharacter, rt as InstrTextContent, s as FontInfo, sn as ListLevel, st as MoveFrom, t as DOCX_CONFORMANCE_CLASSES, tn as VerticalAlign, tt as InlineSdt, u as Relationship, un as NumberFormat, ut as MoveTo, v as ThemeFont, vn as ParagraphAlignment, vt as ParagraphContent, w as BreakContent, wn as TableBorders, wt as Run, x as BlockSdt, xn as TabLeader, xt as PictureWatermark, y as ThemeFontScheme, yn as ParagraphFormatting, yt as ParagraphMarkChange, z as FieldType, zn as ThemeColorSlot, zt as SimpleField } from "../document-BBf3sBoZ.js";
2
+ export { type AbstractNumbering, type BlockContent, type BlockSdt, type BookmarkEnd, type BookmarkStart, type BorderSpec, type BreakContent, type CellMargins, type ColorValue, type Column, type Comment, type CommentRangeEnd, type CommentRangeStart, type CommentReference, type ComplexField, type ConditionalFormatStyle, DOCX_CONFORMANCE_CLASSES, type Deletion, type DocDefaults, Document, type DocumentBody, DocumentSettings, DocxConformanceClass, DocxPackage, type DrawingContent, type EmphasisMark, type Endnote, type EndnotePosition, type EndnoteProperties, type Field, type FieldCharContent, type FieldType, type FloatingTableProperties, type FontInfo, type FontTable, type FooterReference, type Footnote, type FootnotePosition, type FootnoteProperties, type HeaderFooter, type HeaderFooterType, type HeaderReference, type Hyperlink, type Image, type ImageCrop, type ImagePadding, type ImagePosition, type ImageSize, type ImageTransform, type ImageWrap, type InlineSdt, type Insertion, type InstrTextContent, type KnownBorderStyle, type LevelSuffix, type LineNumberRestart, type LineSpacingRule, type ListLevel, type ListMarkerFormatting, type ListRendering, MAX_REVISION_ID, type MathEquation, type MediaFile, type MoveFrom, type MoveFromRangeEnd, type MoveFromRangeStart, type MoveTo, type MoveToRangeEnd, type MoveToRangeStart, type NoBreakHyphenContent, type NoteNumberRestart, type NoteReferenceContent, type NumberFormat, type NumberingDefinitions, type NumberingInstance, type PageOrientation, type Paragraph, type ParagraphAlignment, type ParagraphContent, type ParagraphFormatting, type ParagraphMarkChange, type ParagraphPropertyChange, type PictureWatermark, type PositionalTab, type PropertyChangeInfo, type Relationship, type RelationshipMap, type RelationshipType, type Run, type RunContent, type RunPropertyChange, type SdtProperties, type SdtType, type Section, type SectionProperties, type SectionPropertyChange, type SectionStart, type ShadingProperties, type Shape, type ShapeContent, type ShapeFill, type ShapeOutline, type ShapeTextBody, type ShapeType, type SimpleField, type SoftHyphenContent, type SpacingExplicit, type Style, type StyleDefinitions, type StyleType, type SymbolContent, type TabContent, type TabLeader, type TabStop, type TabStopAlignment, type Table, type TableBorders, type TableCell, type TableCellBorders, type TableCellFormatting, type TableCellPropertyChange, type TableFormatting, type TableLook, type TableMeasurement, type TablePropertyChange, type TableRow, type TableRowFormatting, type TableRowPropertyChange, type TableStructuralChangeInfo, type TableWidthType, type TextBox, type TextContent, type TextEffect, type TextFormatting, type TextWatermark, type Theme, type ThemeColorScheme, type ThemeColorSlot, type ThemeFont, type ThemeFontScheme, type TrackedChangeInfo, type TrackedRunChange, type UnderlineStyle, type VerticalAlign, type Watermark, isOoxmlSymbolCharacter, normalizeRevisionId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/docx-core",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "description": "Typed OOXML/DOCX model, validation, serialization, legal-source compilation, and browser-native package projection.",
5
5
  "keywords": [
6
6
  "document-model",
@@ -61,6 +61,7 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "better-result": "3.0.1",
64
+ "fast-xml-parser": "^5.10.1",
64
65
  "jszip": "3.10.1"
65
66
  },
66
67
  "devDependencies": {