@stll/docx-core
Advanced tools
Sorry, the diff of this file is too big to display
+143
| import { A as DocumentBody, Bt as TableCell, Et as SectionProperties, S as BreakContent, Ut as TableRow, bt as Run, d as Style, ht as ParagraphContent, mt as Paragraph, qt as TextContent, r as DocxPackage, t as Document, v as BlockContent, xt as RunContent, zt as Table } from "./document-IR6XvC0O.js"; | ||
| //#region src/legal-source/types.d.ts | ||
| type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other"; | ||
| type LegalNumberingProfile = "legal" | "none" | "checklist"; | ||
| type LegalPageSize = "A4" | "Letter"; | ||
| type LegalPageOrientation = "portrait" | "landscape"; | ||
| type LegalDraftMeta = { | ||
| kind: LegalDocumentKind; | ||
| locale: string; | ||
| numbering: LegalNumberingProfile; | ||
| page: { | ||
| size: LegalPageSize; | ||
| orientation: LegalPageOrientation; | ||
| }; | ||
| title: string | null; | ||
| }; | ||
| type LegalTable = { | ||
| headers: string[]; | ||
| rows: string[][]; | ||
| }; | ||
| type LegalSignatureParty = { | ||
| name: string; | ||
| signatory?: string; | ||
| title?: string; | ||
| }; | ||
| type LegalDraftBlock = { | ||
| type: "title"; | ||
| text: string; | ||
| } | { | ||
| type: "recital"; | ||
| paragraphs: string[]; | ||
| } | { | ||
| type: "clause"; | ||
| level: number; | ||
| heading: string; | ||
| paragraphs: string[]; | ||
| } | { | ||
| type: "paragraph"; | ||
| paragraphs: string[]; | ||
| } | { | ||
| type: "list"; | ||
| ordered: boolean; | ||
| items: string[]; | ||
| } | { | ||
| type: "table"; | ||
| table: LegalTable; | ||
| } | { | ||
| type: "schedule"; | ||
| heading: string; | ||
| paragraphs: string[]; | ||
| } | { | ||
| type: "signatures"; | ||
| parties: LegalSignatureParty[]; | ||
| } | { | ||
| type: "pageBreak"; | ||
| }; | ||
| type LegalDraft = { | ||
| meta: LegalDraftMeta; | ||
| blocks: LegalDraftBlock[]; | ||
| }; | ||
| type LegalDraftDiagnosticSeverity = "warning" | "error"; | ||
| type LegalDraftDiagnostic = { | ||
| code: string; | ||
| message: string; | ||
| severity: LegalDraftDiagnosticSeverity; | ||
| line?: number; | ||
| }; | ||
| type Autofix = { | ||
| code: string; | ||
| message: string; | ||
| line?: number; | ||
| }; | ||
| type LegalSourceParseResult = { | ||
| draft: LegalDraft; | ||
| fixes: Autofix[]; | ||
| diagnostics: LegalDraftDiagnostic[]; | ||
| }; | ||
| type LegalSourceCompileOptions = { | ||
| titleFallback?: string; | ||
| }; | ||
| type CompiledLegalDocument = { | ||
| document: Document; | ||
| draft: LegalDraft; | ||
| fixes: Autofix[]; | ||
| warnings: LegalDraftDiagnostic[]; | ||
| }; | ||
| type LegalSourceCompileResult = ({ | ||
| status: "ok"; | ||
| } & CompiledLegalDocument) | { | ||
| status: "needs_llm_repair"; | ||
| draft: LegalDraft; | ||
| fixes: Autofix[]; | ||
| errors: LegalDraftDiagnostic[]; | ||
| }; | ||
| type LegalSourceDocxCompileResult = ({ | ||
| status: "ok"; | ||
| buffer: Buffer; | ||
| } & CompiledLegalDocument) | Extract<LegalSourceCompileResult, { | ||
| status: "needs_llm_repair"; | ||
| }>; | ||
| //#endregion | ||
| //#region src/legal-source/compile.d.ts | ||
| declare const compileLegalSourceToDocument: (source: string, options?: LegalSourceCompileOptions) => LegalSourceCompileResult; | ||
| //#endregion | ||
| //#region src/legal-source/parser.d.ts | ||
| declare const parseLegalSource: (source: string, options?: { | ||
| titleFallback?: string; | ||
| }) => LegalSourceParseResult; | ||
| //#endregion | ||
| //#region src/legal-source/validate.d.ts | ||
| declare const validateLegalDraft: (draft: LegalDraft) => LegalDraftDiagnostic[]; | ||
| //#endregion | ||
| //#region src/legal-source/index.d.ts | ||
| declare const compileLegalSourceToDocx: (source: string, options?: LegalSourceCompileOptions) => Promise<LegalSourceDocxCompileResult>; | ||
| //#endregion | ||
| //#region src/serialize/docx.d.ts | ||
| type SerializeDocumentOptions = { | ||
| /** BCP-47 language tag (e.g. "en", "cs", "cs-CZ"); used for footer labels. */language?: string; | ||
| }; | ||
| declare const serializeDocumentToDocx: (document: Document, options?: SerializeDocumentOptions) => Promise<ArrayBuffer>; | ||
| //#endregion | ||
| //#region src/validate/docx.d.ts | ||
| type ValidateDocxPackageResult = { | ||
| valid: true; | ||
| } | { | ||
| valid: false; | ||
| error: string; | ||
| }; | ||
| type ValidateDocumentModelIssue = { | ||
| path: string; | ||
| message: string; | ||
| severity: "error" | "warning"; | ||
| }; | ||
| type ValidateDocumentModelResult = { | ||
| valid: boolean; | ||
| issues: ValidateDocumentModelIssue[]; | ||
| }; | ||
| declare const validateDocxPackage: (buffer: ArrayBuffer | Uint8Array) => Promise<ValidateDocxPackageResult>; | ||
| declare const validateDocumentModel: (document: Document) => ValidateDocumentModelResult; | ||
| declare const assertValidDocumentModel: (document: Document) => void; | ||
| //#endregion | ||
| 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 }; |
Sorry, the diff of this file is too big to display
| import { $ as InlineSdt, $t as AbstractNumbering, A as DocumentBody, An as ShadingProperties, At as ShapeContent, B as FootnotePosition, Bt as TableCell, C as Column, Cn as TableWidthType, Ct as SdtProperties, D as CommentReference, Dn as BorderSpec, Dt as SectionPropertyChange, E as CommentRangeStart, En as UnderlineStyle, Et as SectionProperties, F as Field, Ft as SimpleField, G as Hyperlink, Gt as TableStructuralChangeInfo, H as HeaderFooter, Ht as TablePropertyChange, I as FieldCharContent, It as SoftHyphenContent, J as ImagePadding, Jt as TextWatermark, K as Image, Kt as TextBox, L as FieldType, Lt as SymbolContent, M as Endnote, Mt as ShapeOutline, N as EndnotePosition, Nt as ShapeTextBody, O as ComplexField, On as ColorValue, Ot as SectionStart, P as EndnoteProperties, Pt as ShapeType, Q as ImageWrap, Qt as Watermark, R as FooterReference, Rt as TabContent, S as BreakContent, Sn as TableRowFormatting, St as RunPropertyChange, T as CommentRangeEnd, Tn as TextFormatting, Tt as Section, U as HeaderFooterType, Ut as TableRow, V as FootnoteProperties, Vt as TableCellPropertyChange, W as HeaderReference, Wt as TableRowPropertyChange, X as ImageSize, Xt as TrackedRunChange, Y as ImagePosition, Yt as TrackedChangeInfo, Z as ImageTransform, Zt as VerticalAlign, _ as ThemeFontScheme, _n as TableBorders, _t as ParagraphPropertyChange, a as FontInfo, an as NumberingInstance, at as MoveFromRangeEnd, b as BookmarkEnd, bn as TableLook, bt as Run, c as Relationship, cn as EmphasisMark, ct as MoveToRangeEnd, d as Style, dn as ParagraphAlignment, dt as NoteNumberRestart, en as LevelSuffix, et as Insertion, f as StyleDefinitions, fn as ParagraphFormatting, ft as NoteReferenceContent, g as ThemeFont, gn as TabStopAlignment, gt as ParagraphMarkChange, h as ThemeColorScheme, hn as TabStop, ht as ParagraphContent, i as DocDefaults, in as NumberingDefinitions, it as MoveFrom, j as DrawingContent, jn as ThemeColorSlot, jt as ShapeFill, k as Deletion, kn as KnownBorderStyle, kt as Shape, l as RelationshipMap, ln as FloatingTableProperties, lt as MoveToRangeStart, m as Theme, mn as TabLeader, mt as Paragraph, n as DocumentSettings, nn as ListRendering, nt as LineNumberRestart, o as FontTable, on as CellMargins, ot as MoveFromRangeStart, p as StyleType, pn as SpacingExplicit, pt as PageOrientation, q as ImageCrop, qt as TextContent, r as DocxPackage, rn as NumberFormat, rt as MathEquation, s as MediaFile, sn as ConditionalFormatStyle, st as MoveTo, t as Document, tn as ListLevel, tt as InstrTextContent, u as RelationshipType, un as LineSpacingRule, ut as NoBreakHyphenContent, v as BlockContent, vn as TableCellFormatting, vt as PictureWatermark, w as Comment, wn as TextEffect, wt as SdtType, x as BookmarkStart, xn as TableMeasurement, xt as RunContent, y as BlockSdt, yn as TableFormatting, yt as PropertyChangeInfo, z as Footnote, zt as Table } from "../document-IR6XvC0O.js"; | ||
| 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 }; |
+40
| # @stll/docx-core | ||
| A typed OOXML/DOCX document model with parsing, validation, and serialization. | ||
| The package exposes a structured document model (paragraphs, runs, tables, | ||
| styles, section properties) together with the tools to produce and check DOCX | ||
| packages, plus a legal-source compiler that turns a plain legal draft into that | ||
| model or a finished DOCX file. | ||
| ```ts | ||
| import { compileLegalSourceToDocx, validateDocxPackage } from "@stll/docx-core"; | ||
| const { docx } = await compileLegalSourceToDocx(source); | ||
| const result = await validateDocxPackage(docx); | ||
| ``` | ||
| The document model types are also available from a dedicated subpath: | ||
| ```ts | ||
| import type { Document, Paragraph, Run } from "@stll/docx-core/model"; | ||
| ``` | ||
| ## Install | ||
| ```sh | ||
| bun add @stll/docx-core | ||
| ``` | ||
| ## Exports | ||
| - `.` — the document model types, the legal-source compiler | ||
| (`parseLegalSource`, `compileLegalSourceToDocument`, | ||
| `compileLegalSourceToDocx`, `validateLegalDraft`), DOCX serialization | ||
| (`serializeDocumentToDocx`), and validation (`validateDocxPackage`, | ||
| `validateDocumentModel`, `assertValidDocumentModel`). | ||
| - `./model` — the document model types only. | ||
| ## License | ||
| Apache-2.0 |
+64
-3
| { | ||
| "name": "@stll/docx-core", | ||
| "version": "0.0.1-placeholder.0", | ||
| "description": "Placeholder to bootstrap npm trusted publishing. The real package ships via the next @stll release." | ||
| } | ||
| "version": "0.1.0", | ||
| "description": "Typed OOXML/DOCX document model with parsing, validation, and serialization, plus a legal-source compiler that produces DOCX packages.", | ||
| "keywords": [ | ||
| "document-model", | ||
| "docx", | ||
| "legal", | ||
| "ooxml", | ||
| "openxml", | ||
| "serialize", | ||
| "validate", | ||
| "word" | ||
| ], | ||
| "homepage": "https://github.com/stella/stella/tree/main/packages/docx-core", | ||
| "bugs": { | ||
| "url": "https://github.com/stella/stella/issues" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/stella/stella.git", | ||
| "directory": "packages/docx-core" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "README.md" | ||
| ], | ||
| "type": "module", | ||
| "sideEffects": false, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js" | ||
| }, | ||
| "./model": { | ||
| "types": "./dist/model/document.d.ts", | ||
| "import": "./dist/model/document.js" | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "scripts": { | ||
| "clean": "git clean -xdf dist .cache .turbo node_modules", | ||
| "build": "tsdown", | ||
| "pack:dry-run": "bun pm pack --dry-run", | ||
| "test": "bun test src", | ||
| "typecheck": "tsgo --noEmit", | ||
| "lint": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --report-unused-disable-directives-severity=error --deny-warnings --type-aware packages/docx-core", | ||
| "lint:fix": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --type-aware --fix packages/docx-core", | ||
| "format": "oxfmt .", | ||
| "prepack": "bun run build" | ||
| }, | ||
| "dependencies": { | ||
| "better-result": "2.9.2", | ||
| "jszip": "3.10.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@stll/typescript-config": "0.0.0", | ||
| "@types/bun": "1.3.14", | ||
| "tsdown": "0.22.3" | ||
| }, | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts" | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
No License Found
LicenseLicense information could not be found.
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
No website
QualityPackage does not have a website.
146821
78413.9%7
600%0
-100%3768
Infinity%1
-50%1
-50%0
-100%41
Infinity%Yes
NaN2
Infinity%3
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added