@stll/docx-core 0.1.1 → 0.2.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.
|
@@ -188,8 +188,12 @@ type ParagraphFormatting = {
|
|
|
188
188
|
outlineLevel?: number; /** Paragraph style ID (w:pStyle) */
|
|
189
189
|
styleId?: string; /** Text frame properties (w:framePr) */
|
|
190
190
|
frame?: {
|
|
191
|
+
dropCap?: "none" | "drop" | "margin";
|
|
192
|
+
lines?: number;
|
|
191
193
|
width?: number;
|
|
192
194
|
height?: number;
|
|
195
|
+
hSpace?: number;
|
|
196
|
+
vSpace?: number;
|
|
193
197
|
hAnchor?: "text" | "margin" | "page";
|
|
194
198
|
vAnchor?: "text" | "margin" | "page";
|
|
195
199
|
x?: number;
|
|
@@ -286,7 +290,11 @@ type TableFormatting = {
|
|
|
286
290
|
* Table row formatting properties (w:trPr)
|
|
287
291
|
*/
|
|
288
292
|
type TableRowFormatting = {
|
|
289
|
-
/**
|
|
293
|
+
/** Number of table grid columns omitted before the first cell */gridBefore?: number; /** Preferred width of the omitted leading grid columns */
|
|
294
|
+
widthBefore?: TableMeasurement; /** Number of table grid columns omitted after the last cell */
|
|
295
|
+
gridAfter?: number; /** Preferred width of the omitted trailing grid columns */
|
|
296
|
+
widthAfter?: TableMeasurement; /** Row height */
|
|
297
|
+
height?: TableMeasurement; /** Height rule */
|
|
290
298
|
heightRule?: "auto" | "atLeast" | "exact"; /** Header row (repeats on each page) */
|
|
291
299
|
header?: boolean; /** Allow row to break across pages */
|
|
292
300
|
cantSplit?: boolean; /** Row justification */
|
|
@@ -393,7 +401,8 @@ type ListRendering = {
|
|
|
393
401
|
numFmt?: NumberFormat; /** Whether the list marker is hidden (w:vanish on level rPr) */
|
|
394
402
|
markerHidden?: boolean; /** Marker font family from numbering level rPr (ascii name) */
|
|
395
403
|
markerFontFamily?: string; /** Marker font size from numbering level rPr, in points */
|
|
396
|
-
markerFontSize?: number;
|
|
404
|
+
markerFontSize?: number; /** Horizontal alignment of the marker around the paragraph's list anchor. */
|
|
405
|
+
markerAlignment?: "left" | "center" | "right";
|
|
397
406
|
/**
|
|
398
407
|
* `w:caps` on the numbering level rPr — the marker text renders in upper
|
|
399
408
|
* case (e.g. "SCHEDULE 1" instead of "Schedule 1"). Apply at substitution
|
|
@@ -795,7 +804,8 @@ type TextBox = {
|
|
|
795
804
|
wrap?: ImageWrap; /** Fill */
|
|
796
805
|
fill?: ShapeFill; /** Outline */
|
|
797
806
|
outline?: ShapeOutline; /** Text content */
|
|
798
|
-
content: Paragraph[]; /**
|
|
807
|
+
content: Paragraph[]; /** Text fitting behavior */
|
|
808
|
+
autoFit?: ShapeTextBody["autoFit"]; /** Internal margins */
|
|
799
809
|
margins?: {
|
|
800
810
|
top?: number;
|
|
801
811
|
bottom?: number;
|
|
@@ -1617,11 +1627,18 @@ type DocumentSettings = {
|
|
|
1617
1627
|
bidi?: string;
|
|
1618
1628
|
};
|
|
1619
1629
|
};
|
|
1620
|
-
/**
|
|
1621
|
-
|
|
1622
|
-
|
|
1630
|
+
/** DOCX package conformance classes. */
|
|
1631
|
+
declare const DOCX_CONFORMANCE_CLASSES: Readonly<{
|
|
1632
|
+
readonly STRICT: "strict";
|
|
1633
|
+
readonly TRANSITIONAL: "transitional";
|
|
1634
|
+
readonly UNKNOWN: "unknown";
|
|
1635
|
+
}>;
|
|
1636
|
+
/** Conformance class detected from a DOCX package. */
|
|
1637
|
+
type DocxConformanceClass = (typeof DOCX_CONFORMANCE_CLASSES)[keyof typeof DOCX_CONFORMANCE_CLASSES];
|
|
1638
|
+
/** Complete DOCX package structure. */
|
|
1623
1639
|
type DocxPackage = {
|
|
1624
|
-
/**
|
|
1640
|
+
/** Conformance class detected from the main document namespace. */conformanceClass?: DocxConformanceClass; /** Document body */
|
|
1641
|
+
document: DocumentBody; /** Document-wide settings (`word/settings.xml`). */
|
|
1625
1642
|
settings?: DocumentSettings; /** Style definitions */
|
|
1626
1643
|
styles?: StyleDefinitions; /** Theme */
|
|
1627
1644
|
theme?: Theme; /** Numbering definitions */
|
|
@@ -1656,4 +1673,4 @@ type Document = {
|
|
|
1656
1673
|
warnings?: string[];
|
|
1657
1674
|
};
|
|
1658
1675
|
//#endregion
|
|
1659
|
-
export {
|
|
1676
|
+
export { ImageTransform as $, VerticalAlign as $t, ComplexField as A, ColorValue as An, SectionStart as At, FooterReference as B, TabContent as Bt, BookmarkStart as C, TableMeasurement as Cn, RunContent as Ct, CommentRangeEnd as D, TextFormatting as Dn, Section as Dt, Comment as E, TextEffect as En, SdtType as Et, EndnotePosition as F, ShapeTextBody as Ft, HeaderFooterType as G, TableRow as Gt, FootnotePosition as H, TableCell as Ht, EndnoteProperties as I, ShapeType as It, Image as J, TextBox as Jt, HeaderReference as K, TableRowPropertyChange as Kt, Field as L, SimpleField as Lt, DocumentBody as M, ShadingProperties as Mn, ShapeContent as Mt, DrawingContent as N, ThemeColorSlot as Nn, ShapeFill as Nt, CommentRangeStart as O, UnderlineStyle as On, SectionProperties as Ot, Endnote as P, ShapeOutline as Pt, ImageSize as Q, TrackedRunChange as Qt, FieldCharContent as R, SoftHyphenContent as Rt, BookmarkEnd as S, TableLook as Sn, Run as St, Column as T, TableWidthType as Tn, SdtProperties as Tt, FootnoteProperties as U, TableCellPropertyChange as Ut, Footnote as V, Table as Vt, HeaderFooter as W, TablePropertyChange as Wt, ImagePadding as X, TextWatermark as Xt, ImageCrop as Y, TextContent as Yt, ImagePosition as Z, TrackedChangeInfo as Zt, ThemeColorScheme as _, TabStop as _n, ParagraphContent as _t, DocxPackage as a, NumberFormat as an, MathEquation as at, BlockContent as b, TableCellFormatting as bn, PictureWatermark as bt, FontTable as c, CellMargins as cn, MoveFromRangeStart as ct, RelationshipMap as d, FloatingTableProperties as dn, MoveToRangeStart as dt, Watermark as en, ImageWrap as et, RelationshipType as f, LineSpacingRule as fn, NoBreakHyphenContent as ft, Theme as g, TabLeader as gn, Paragraph as gt, StyleType as h, SpacingExplicit as hn, PageOrientation as ht, DocxConformanceClass as i, ListRendering as in, LineNumberRestart as it, Deletion as j, KnownBorderStyle as jn, Shape as jt, CommentReference as k, BorderSpec as kn, SectionPropertyChange as kt, MediaFile as l, ConditionalFormatStyle as ln, MoveTo as lt, StyleDefinitions as m, ParagraphFormatting as mn, NoteReferenceContent as mt, Document as n, LevelSuffix as nn, Insertion as nt, DocDefaults as o, NumberingDefinitions as on, MoveFrom as ot, Style as p, ParagraphAlignment as pn, NoteNumberRestart as pt, Hyperlink as q, TableStructuralChangeInfo as qt, DocumentSettings as r, ListLevel as rn, InstrTextContent as rt, FontInfo as s, NumberingInstance as sn, MoveFromRangeEnd as st, DOCX_CONFORMANCE_CLASSES as t, AbstractNumbering as tn, InlineSdt as tt, Relationship as u, EmphasisMark as un, MoveToRangeEnd as ut, ThemeFont as v, TabStopAlignment as vn, ParagraphMarkChange as vt, BreakContent as w, TableRowFormatting as wn, RunPropertyChange as wt, BlockSdt as x, TableFormatting as xn, PropertyChangeInfo as xt, ThemeFontScheme as y, TableBorders as yn, ParagraphPropertyChange as yt, FieldType as z, SymbolContent as zt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as RunContent, Gt as TableRow, Ht as TableCell, M as DocumentBody, Ot as SectionProperties, St as Run, Vt as Table, Yt as TextContent, _t as ParagraphContent, a as DocxPackage, b as BlockContent, gt as Paragraph, i as DocxConformanceClass, n as Document, p as Style, t as DOCX_CONFORMANCE_CLASSES, w as BreakContent } from "./document-B3E-xw_J.js";
|
|
2
2
|
|
|
3
3
|
//#region src/legal-source/types.d.ts
|
|
4
4
|
type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";
|
|
@@ -140,4 +140,4 @@ declare const validateDocxPackage: (buffer: ArrayBuffer | Uint8Array) => Promise
|
|
|
140
140
|
declare const validateDocumentModel: (document: Document) => ValidateDocumentModelResult;
|
|
141
141
|
declare const assertValidDocumentModel: (document: Document) => void;
|
|
142
142
|
//#endregion
|
|
143
|
-
export { type Autofix, type BlockContent, type BreakContent, type CompiledLegalDocument, type Document, type DocumentBody, type DocxPackage, type LegalDraft, type LegalDraftBlock, type LegalDraftDiagnostic, type LegalSourceCompileOptions, type LegalSourceCompileResult, type LegalSourceDocxCompileResult, type LegalSourceParseResult, type Paragraph, type ParagraphContent, 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 };
|
|
143
|
+
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 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,3 +1,4 @@
|
|
|
1
|
+
import { DOCX_CONFORMANCE_CLASSES } from "./model/document.js";
|
|
1
2
|
import JSZip from "jszip";
|
|
2
3
|
import { panic } from "better-result";
|
|
3
4
|
//#region src/serialize/xml.ts
|
|
@@ -1935,4 +1936,4 @@ const compileLegalSourceToDocx = async (source, options = {}) => {
|
|
|
1935
1936
|
};
|
|
1936
1937
|
};
|
|
1937
1938
|
//#endregion
|
|
1938
|
-
export { assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
|
|
1939
|
+
export { DOCX_CONFORMANCE_CLASSES, assertValidDocumentModel, compileLegalSourceToDocument, compileLegalSourceToDocx, parseLegalSource, serializeDocumentToDocx, validateDocumentModel, validateDocxPackage, validateLegalDraft };
|
package/dist/model/document.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
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, type Deletion, type DocDefaults, Document, type DocumentBody, DocumentSettings, 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, 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 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 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 };
|
|
1
|
+
import { $ as ImageTransform, $t as VerticalAlign, A as ComplexField, An as ColorValue, At as SectionStart, B as FooterReference, Bt as TabContent, C as BookmarkStart, Cn as TableMeasurement, Ct as RunContent, D as CommentRangeEnd, Dn as TextFormatting, Dt as Section, E as Comment, En as TextEffect, Et as SdtType, F as EndnotePosition, Ft as ShapeTextBody, G as HeaderFooterType, Gt as TableRow, H as FootnotePosition, Ht as TableCell, I as EndnoteProperties, It as ShapeType, J as Image, Jt as TextBox, K as HeaderReference, Kt as TableRowPropertyChange, L as Field, Lt as SimpleField, M as DocumentBody, Mn as ShadingProperties, Mt as ShapeContent, N as DrawingContent, Nn as ThemeColorSlot, Nt as ShapeFill, O as CommentRangeStart, On as UnderlineStyle, Ot as SectionProperties, P as Endnote, Pt as ShapeOutline, Q as ImageSize, Qt as TrackedRunChange, R as FieldCharContent, Rt as SoftHyphenContent, S as BookmarkEnd, Sn as TableLook, St as Run, T as Column, Tn as TableWidthType, Tt as SdtProperties, U as FootnoteProperties, Ut as TableCellPropertyChange, V as Footnote, Vt as Table, W as HeaderFooter, Wt as TablePropertyChange, X as ImagePadding, Xt as TextWatermark, Y as ImageCrop, Yt as TextContent, Z as ImagePosition, Zt as TrackedChangeInfo, _ as ThemeColorScheme, _n as TabStop, _t as ParagraphContent, a as DocxPackage, an as NumberFormat, at as MathEquation, b as BlockContent, bn as TableCellFormatting, bt as PictureWatermark, c as FontTable, cn as CellMargins, ct as MoveFromRangeStart, d as RelationshipMap, dn as FloatingTableProperties, dt as MoveToRangeStart, en as Watermark, et as ImageWrap, f as RelationshipType, fn as LineSpacingRule, ft as NoBreakHyphenContent, g as Theme, gn as TabLeader, gt as Paragraph, h as StyleType, hn as SpacingExplicit, ht as PageOrientation, i as DocxConformanceClass, in as ListRendering, it as LineNumberRestart, j as Deletion, jn as KnownBorderStyle, jt as Shape, k as CommentReference, kn as BorderSpec, kt as SectionPropertyChange, l as MediaFile, ln as ConditionalFormatStyle, lt as MoveTo, m as StyleDefinitions, mn as ParagraphFormatting, mt as NoteReferenceContent, n as Document, nn as LevelSuffix, nt as Insertion, o as DocDefaults, on as NumberingDefinitions, ot as MoveFrom, p as Style, pn as ParagraphAlignment, pt as NoteNumberRestart, q as Hyperlink, qt as TableStructuralChangeInfo, r as DocumentSettings, rn as ListLevel, rt as InstrTextContent, s as FontInfo, sn as NumberingInstance, st as MoveFromRangeEnd, t as DOCX_CONFORMANCE_CLASSES, tn as AbstractNumbering, tt as InlineSdt, u as Relationship, un as EmphasisMark, ut as MoveToRangeEnd, v as ThemeFont, vn as TabStopAlignment, vt as ParagraphMarkChange, w as BreakContent, wn as TableRowFormatting, wt as RunPropertyChange, x as BlockSdt, xn as TableFormatting, xt as PropertyChangeInfo, y as ThemeFontScheme, yn as TableBorders, yt as ParagraphPropertyChange, z as FieldType, zt as SymbolContent } from "../document-B3E-xw_J.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, 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 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 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 };
|
package/dist/model/document.js
CHANGED
package/package.json
CHANGED