@stll/docx-core 0.6.0 → 0.8.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.
@@ -1,4 +1,7 @@
1
1
  //#region src/model/content.ts
2
+ const OOXML_SYMBOL_CHARACTER_PATTERN = /^[\dA-Fa-f]{4}$/u;
3
+ /** Whether a symbol character is exactly four hexadecimal digits. */
4
+ const isOoxmlSymbolCharacter = (value) => OOXML_SYMBOL_CHARACTER_PATTERN.test(value);
2
5
  /**
3
6
  * Largest value a revision id (`w:id`) may carry: 2^31 - 1.
4
7
  *
@@ -32,4 +35,4 @@ const DOCX_CONFORMANCE_CLASSES = Object.freeze({
32
35
  UNKNOWN: "unknown"
33
36
  });
34
37
  //#endregion
35
- export { MAX_REVISION_ID as n, normalizeRevisionId as r, DOCX_CONFORMANCE_CLASSES as t };
38
+ export { normalizeRevisionId as i, MAX_REVISION_ID as n, isOoxmlSymbolCharacter as r, DOCX_CONFORMANCE_CLASSES as t };
@@ -682,6 +682,8 @@ type SymbolContent = {
682
682
  /** Character code */
683
683
  char: string;
684
684
  };
685
+ /** Whether a symbol character is exactly four hexadecimal digits. */
686
+ declare const isOoxmlSymbolCharacter: (value: string) => boolean;
685
687
  /**
686
688
  * Footnote or endnote reference
687
689
  */
@@ -2276,4 +2278,4 @@ type Document = {
2276
2278
  warnings?: string[];
2277
2279
  };
2278
2280
  //#endregion
2279
- export { ImageTransform as $, TrackedChangeInfo as $t, ComplexField as A, TextEffect as An, SectionProperties as At, FooterReference as B, SoftHyphenContent as Bt, BookmarkStart as C, TableCellBorders as Cn, PropertyChangeInfo as Ct, CommentRangeEnd as D, TableMeasurement as Dn, SdtProperties as Dt, Comment as E, TableLook as En, RunPropertyChange as Et, EndnotePosition as F, KnownBorderStyle as Fn, ShapeFill as Ft, HeaderFooterType as G, TableCellPropertyChange as Gt, FootnotePosition as H, TabContent as Ht, EndnoteProperties as I, ShadingProperties as In, ShapeOutline as It, Image as J, TableRowPropertyChange as Jt, HeaderReference as K, TablePropertyChange as Kt, Field as L, ThemeColorSlot as Ln, ShapeTextBody as Lt, DocumentBody as M, UnderlineStyle as Mn, SectionStart as Mt, DrawingContent as N, BorderSpec as Nn, Shape as Nt, CommentRangeStart as O, TableRowFormatting as On, SdtType as Ot, Endnote as P, ColorValue as Pn, ShapeContent as Pt, ImageSize as Q, TextWatermark as Qt, FieldCharContent as R, ShapeType as Rt, BookmarkEnd as S, TableBorders as Sn, PositionalTab as St, Column as T, TableFormatting 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 _, ParagraphFormatting as _n, Paragraph as _t, DocxPackage as a, LevelSuffix as an, MAX_REVISION_ID as at, BlockContent as b, TabStop as bn, ParagraphPropertyChange as bt, FontTable as c, NumberFormat as cn, MoveFromRangeEnd as ct, RelationshipMap as d, CellMargins as dn, MoveToRangeEnd as dt, TrackedRunChange as en, ImageWrap as et, RelationshipType as f, ConditionalFormatStyle as fn, MoveToRangeStart as ft, Theme as g, ParagraphAlignment as gn, PageOrientation as gt, StyleType as h, LineSpacingRule as hn, NoteReferenceContent as ht, DocxConformanceClass as i, AbstractNumbering as in, LineNumberRestart as it, Deletion as j, TextFormatting as jn, SectionPropertyChange as jt, CommentReference as k, TableWidthType as kn, Section as kt, MediaFile as l, NumberingDefinitions as ln, MoveFromRangeStart as lt, StyleDefinitions as m, FloatingTableProperties as mn, NoteNumberRestart as mt, Document as n, Watermark as nn, Insertion as nt, DocDefaults as o, ListLevel as on, MathEquation as ot, Style as p, EmphasisMark as pn, NoBreakHyphenContent as pt, Hyperlink as q, TableRow as qt, DocumentSettings as r, normalizeRevisionId as rn, InstrTextContent as rt, FontInfo as s, ListRendering as sn, MoveFrom as st, DOCX_CONFORMANCE_CLASSES as t, VerticalAlign as tn, InlineSdt as tt, Relationship as u, NumberingInstance as un, MoveTo as ut, ThemeFont as v, SpacingExplicit as vn, ParagraphContent as vt, BreakContent as w, TableCellFormatting as wn, Run as wt, BlockSdt as x, TabStopAlignment as xn, PictureWatermark as xt, ThemeFontScheme as y, TabLeader as yn, ParagraphMarkChange as yt, FieldType as z, SimpleField as zt };
2281
+ 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 };
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-DI8X7aZy.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-CMZ4oy9i.js";
2
2
  //#region src/legal-source/types.d.ts
3
3
  type LegalDocumentKind = "agreement" | "letter" | "memo" | "checklist" | "pleading" | "other";
4
4
  type LegalNumberingProfile = "legal" | "none" | "checklist";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as DOCX_CONFORMANCE_CLASSES } from "./document-D4XHQQIj.js";
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
4
  //#region src/serialize/xml.ts
@@ -605,7 +605,10 @@ const validateRunContent = (content, path, ctx) => {
605
605
  recordPath(ctx.noteRefs[noteType], content.id, path);
606
606
  return;
607
607
  }
608
- if (content.type === "symbol" && content.char.trim() === "") addError(ctx, `${path}.char`, "Symbol content must include a character.");
608
+ if (content.type === "symbol") {
609
+ if (content.font.trim() === "") addError(ctx, `${path}.font`, "Symbol content must include a font name.");
610
+ if (!isOoxmlSymbolCharacter(content.char)) addError(ctx, `${path}.char`, "Symbol character must be exactly four hexadecimal digits.");
611
+ }
609
612
  };
610
613
  const validateHyperlink = (hyperlink, path, ctx) => {
611
614
  if (!hyperlink.rId && !hyperlink.href && !hyperlink.anchor) addWarning(ctx, path, "Hyperlink has no relationship, href, or internal anchor.");
@@ -1,2 +1,2 @@
1
- import { $ as ImageTransform, $t as TrackedChangeInfo, A as ComplexField, An as TextEffect, At as SectionProperties, B as FooterReference, Bt as SoftHyphenContent, C as BookmarkStart, Cn as TableCellBorders, Ct as PropertyChangeInfo, D as CommentRangeEnd, Dn as TableMeasurement, Dt as SdtProperties, E as Comment, En as TableLook, Et as RunPropertyChange, F as EndnotePosition, Fn as KnownBorderStyle, Ft as ShapeFill, G as HeaderFooterType, Gt as TableCellPropertyChange, H as FootnotePosition, Ht as TabContent, I as EndnoteProperties, In as ShadingProperties, It as ShapeOutline, J as Image, Jt as TableRowPropertyChange, K as HeaderReference, Kt as TablePropertyChange, L as Field, Ln as ThemeColorSlot, Lt as ShapeTextBody, M as DocumentBody, Mn as UnderlineStyle, Mt as SectionStart, N as DrawingContent, Nn as BorderSpec, Nt as Shape, O as CommentRangeStart, On as TableRowFormatting, Ot as SdtType, P as Endnote, Pn as ColorValue, Pt as ShapeContent, Q as ImageSize, Qt as TextWatermark, R as FieldCharContent, Rt as ShapeType, S as BookmarkEnd, Sn as TableBorders, St as PositionalTab, T as Column, Tn as TableFormatting, 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 ParagraphFormatting, _t as Paragraph, a as DocxPackage, an as LevelSuffix, at as MAX_REVISION_ID, b as BlockContent, bn as TabStop, bt as ParagraphPropertyChange, c as FontTable, cn as NumberFormat, ct as MoveFromRangeEnd, d as RelationshipMap, dn as CellMargins, dt as MoveToRangeEnd, en as TrackedRunChange, et as ImageWrap, f as RelationshipType, fn as ConditionalFormatStyle, ft as MoveToRangeStart, g as Theme, gn as ParagraphAlignment, gt as PageOrientation, h as StyleType, hn as LineSpacingRule, ht as NoteReferenceContent, i as DocxConformanceClass, in as AbstractNumbering, it as LineNumberRestart, j as Deletion, jn as TextFormatting, jt as SectionPropertyChange, k as CommentReference, kn as TableWidthType, kt as Section, l as MediaFile, ln as NumberingDefinitions, lt as MoveFromRangeStart, m as StyleDefinitions, mn as FloatingTableProperties, mt as NoteNumberRestart, n as Document, nn as Watermark, nt as Insertion, o as DocDefaults, on as ListLevel, ot as MathEquation, p as Style, pn as EmphasisMark, pt as NoBreakHyphenContent, q as Hyperlink, qt as TableRow, r as DocumentSettings, rn as normalizeRevisionId, rt as InstrTextContent, s as FontInfo, sn as ListRendering, st as MoveFrom, t as DOCX_CONFORMANCE_CLASSES, tn as VerticalAlign, tt as InlineSdt, u as Relationship, un as NumberingInstance, ut as MoveTo, v as ThemeFont, vn as SpacingExplicit, vt as ParagraphContent, w as BreakContent, wn as TableCellFormatting, wt as Run, x as BlockSdt, xn as TabStopAlignment, xt as PictureWatermark, y as ThemeFontScheme, yn as TabLeader, yt as ParagraphMarkChange, z as FieldType, zt as SimpleField } from "../document-DI8X7aZy.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, normalizeRevisionId };
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-CMZ4oy9i.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,2 +1,2 @@
1
- import { n as MAX_REVISION_ID, r as normalizeRevisionId, t as DOCX_CONFORMANCE_CLASSES } from "../document-D4XHQQIj.js";
2
- export { DOCX_CONFORMANCE_CLASSES, MAX_REVISION_ID, normalizeRevisionId };
1
+ import { i as normalizeRevisionId, n as MAX_REVISION_ID, r as isOoxmlSymbolCharacter, t as DOCX_CONFORMANCE_CLASSES } from "../document-BO7h-LxY.js";
2
+ export { DOCX_CONFORMANCE_CLASSES, MAX_REVISION_ID, isOoxmlSymbolCharacter, normalizeRevisionId };
@@ -15,6 +15,22 @@ type DocxProjectionStructuralFacts = readonly [indentation: DocxProjectionFactSe
15
15
  type DocxProjectionRevisionUnsupportedReason = "incompatible-paragraph-merge" | "structural-table-revision" | "unsupported-revision-markup";
16
16
  type DocxProjectionRevisionStatus = readonly [status: "complete"] | readonly [status: "incomplete", reasons: readonly DocxProjectionRevisionUnsupportedReason[]];
17
17
  type DocxProjectionWire = readonly [schemaVersion: 2, paragraphs: readonly DocxProjectionParagraph[], structuralFacts: DocxProjectionStructuralFacts, revisionStatus: DocxProjectionRevisionStatus];
18
+ type DocxReviewUnknownReason = "invalid-document" | "invalid-comments" | "invalid-comments-extended" | "resource-limit" | "unsupported-location";
19
+ type DocxReviewFactSet<T> = readonly [status: "known", items: readonly T[]] | readonly [status: "unknown", reason: DocxReviewUnknownReason];
20
+ type DocxReviewDetail<T> = readonly [status: "known", value: T] | readonly [status: "unknown", reason: DocxReviewUnknownReason];
21
+ type DocxReviewPoint = readonly [paragraphOrdinal: number, utf8: number, utf16: number];
22
+ type DocxReviewSpan = readonly [start: DocxReviewPoint, end: DocxReviewPoint];
23
+ /** Compact versioned boundary tuple. Field order is stable within schema version 1. */
24
+ type DocxRevisionContent = readonly [span: DocxReviewSpan, text: string, contentKind: "text" | "formatting-only"];
25
+ type DocxCommentContent = readonly [anchor: DocxReviewSpan, commentText: string, referencedText: string];
26
+ /** Attributed revision wire tuple; positions are named and versioned by its container. */
27
+ type DocxAttributedRevision = readonly [type: "insertion" | "deletion" | "moveFrom" | "moveTo" | "cellIns" | "cellDel" | "cellMerge" | "pPrChange" | "rPrChange" | "sectPrChange" | "tblPrChange" | "trPrChange" | "tcPrChange" | "tblGridChange" | "customXmlDelRangeStart" | "customXmlDelRangeEnd" | "customXmlInsRangeStart" | "customXmlInsRangeEnd" | "customXmlMoveFromRangeStart" | "customXmlMoveFromRangeEnd" | "customXmlMoveToRangeStart" | "customXmlMoveToRangeEnd", author: string, date: string | null, revisionId: string | null, content: DocxReviewDetail<DocxRevisionContent>];
28
+ /** Attributed comment wire tuple; positions are named and versioned by its container. */
29
+ type DocxAttributedComment = readonly [commentId: string, author: string, initials: string | null, date: string | null, parentCommentId: string | null, threadState: "open" | "resolved", content: DocxReviewDetail<DocxCommentContent>];
30
+ /** Review-fact wire schema. A new tuple layout requires a schema-version bump. */
31
+ type DocxReviewFactsWire = readonly [schemaVersion: 1, revisions: DocxReviewFactSet<DocxAttributedRevision>, comments: DocxReviewFactSet<DocxAttributedComment>];
32
+ /** Fused package wire schema. A new tuple layout requires a schema-version bump. */
33
+ type DocxPackageProjectionWire = readonly [schemaVersion: 1, document: DocxProjectionWire, reviewFacts: DocxReviewFactsWire];
18
34
  //#endregion
19
35
  //#region src/projection.d.ts
20
36
  declare const DocxProjectionInitializationError_base: import("better-result").TaggedErrorClass<"DocxProjectionInitializationError", {
@@ -37,11 +53,12 @@ type InitializeDocxProjectionOptions = {
37
53
  };
38
54
  /** Loads and caches the single-threaded WebAssembly runtime. */
39
55
  declare const initializeDocxProjection: ({ wasm }?: InitializeDocxProjectionOptions) => Promise<void>;
56
+ declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
40
57
  /**
41
- * Projects compressed DOCX bytes through the canonical Rust implementation.
42
- * The TypeScript boundary initializes WebAssembly and preserves its versioned
43
- * result; it does not contain an alternate OOXML parser.
58
+ * Projects the document snapshot and attributed review facts through one
59
+ * bounded package scan. Optional review-part failures remain explicit unknown
60
+ * fact families rather than invalidating the document snapshot.
44
61
  */
45
- declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
62
+ declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array) => Promise<DocxPackageProjectionWire>;
46
63
  //#endregion
47
- export { type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, InitializeDocxProjectionOptions, initializeDocxProjection, projectCompressedDocx };
64
+ export { type DocxAttributedComment, type DocxAttributedRevision, type DocxCommentContent, type DocxPackageProjectionWire, type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, type DocxReviewDetail, type DocxReviewFactSet, type DocxReviewFactsWire, type DocxReviewPoint, type DocxReviewSpan, type DocxReviewUnknownReason, type DocxRevisionContent, InitializeDocxProjectionOptions, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
@@ -30,6 +30,31 @@ function projectCompressedDocx$1(bytes) {
30
30
  wasm.__wbindgen_add_to_stack_pointer(16);
31
31
  }
32
32
  }
33
+ /**
34
+ * Projects the document snapshot and attributed review facts from one bounded
35
+ * package-directory scan.
36
+ *
37
+ * # Errors
38
+ *
39
+ * Returns a JavaScript `Error` when the document package itself cannot be
40
+ * projected. Invalid optional review parts are represented as unknown facts.
41
+ * @param {Uint8Array} bytes
42
+ * @returns {DocxPackageProjectionWire}
43
+ */
44
+ function projectCompressedDocxWithReviewFacts$1(bytes) {
45
+ try {
46
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
47
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
48
+ const len0 = WASM_VECTOR_LEN;
49
+ wasm.projectCompressedDocxWithReviewFacts(retptr, ptr0, len0);
50
+ var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
51
+ var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
52
+ if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
53
+ return takeObject(r0);
54
+ } finally {
55
+ wasm.__wbindgen_add_to_stack_pointer(16);
56
+ }
57
+ }
33
58
  function __wbg_get_imports() {
34
59
  return {
35
60
  __proto__: null,
@@ -176,6 +201,8 @@ async function __wbg_init(module_or_path) {
176
201
  var DocxProjectionInitializationError = class extends TaggedError("DocxProjectionInitializationError")() {};
177
202
  var DocxProjectionError = class extends TaggedError("DocxProjectionError")() {};
178
203
  let initialization;
204
+ const DOCUMENT_PROJECTION_FAILURE_MESSAGE = "Could not project the DOCX document";
205
+ const PACKAGE_PROJECTION_FAILURE_MESSAGE = "Could not project the DOCX package with review facts";
179
206
  /** Loads and caches the single-threaded WebAssembly runtime. */
180
207
  const initializeDocxProjection = ({ wasm } = {}) => {
181
208
  initialization ??= __wbg_init(wasm === void 0 ? void 0 : { module_or_path: wasm }).then(() => void 0).catch((cause) => {
@@ -192,16 +219,31 @@ const initializeDocxProjection = ({ wasm } = {}) => {
192
219
  * The TypeScript boundary initializes WebAssembly and preserves its versioned
193
220
  * result; it does not contain an alternate OOXML parser.
194
221
  */
195
- const projectCompressedDocx = async (bytes) => {
222
+ const projectWith = async ({ bytes, project, message }) => {
196
223
  await initializeDocxProjection();
197
224
  try {
198
- return projectCompressedDocx$1(bytes);
225
+ return project(bytes);
199
226
  } catch (cause) {
200
227
  throw new DocxProjectionError({
201
- message: "Could not project the DOCX package",
228
+ message,
202
229
  cause
203
230
  });
204
231
  }
205
232
  };
233
+ const projectCompressedDocx = (bytes) => projectWith({
234
+ bytes,
235
+ project: projectCompressedDocx$1,
236
+ message: DOCUMENT_PROJECTION_FAILURE_MESSAGE
237
+ });
238
+ /**
239
+ * Projects the document snapshot and attributed review facts through one
240
+ * bounded package scan. Optional review-part failures remain explicit unknown
241
+ * fact families rather than invalidating the document snapshot.
242
+ */
243
+ const projectCompressedDocxWithReviewFacts = (bytes) => projectWith({
244
+ bytes,
245
+ project: projectCompressedDocxWithReviewFacts$1,
246
+ message: PACKAGE_PROJECTION_FAILURE_MESSAGE
247
+ });
206
248
  //#endregion
207
- export { DocxProjectionError, DocxProjectionInitializationError, initializeDocxProjection, projectCompressedDocx };
249
+ export { DocxProjectionError, DocxProjectionInitializationError, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/docx-core",
3
- "version": "0.6.0",
3
+ "version": "0.8.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",