ooxml.js 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -176,13 +176,13 @@ The package is layered from a lossless core outward to lossy convenience views:
176
176
  - **`src/package-io/`** — `read.ts` and `write.ts` sit between the zip and XML layers: unzip a package into path -> bytes, classify each entry as XML or binary (`looksLikeXml` sniffs the leading non-whitespace byte for `<`), and parse/serialize accordingly.
177
177
  - **`src/codec.ts`** — the public round-trip surface: `packageCodec`/`xmlCodec` are `z.codec()` pairs, and `decodePackage`/`encodePackage` are the ergonomic wrappers around them.
178
178
  - **`src/compact.ts`** — the ooxml.js format: `compactCodec` (`z.codec(PackageSchema, CompactPackageSchema, …)`) maps `Package ⇄ CompactPackage`, with `toCompact`/`fromCompact` as the ergonomic wrappers. `compactPackageCodec` composes `packageCodec` and `compactCodec` into a direct bytes ⇄ `CompactPackage` codec (`decodeCompactPackage`/`encodeCompactPackage`), so all three format pairs — bytes/`Package`, `Package`/`CompactPackage`, bytes/`CompactPackage` — have a named codec rather than requiring callers to chain two.
179
- - **`src/typed/`** — one-way, lossy projections that read the generic `Package` into ergonomic document/presentation/workbook models. `docx/` and `pptx/` share one block content model — `ContentParagraph`/`ContentTable`/`ContentImageBlock`/`ContentPageBreak`, discriminated as `ContentBlock`, imported from the sibling [`document-content-model`](https://github.com/ExaDev/document-schema.js) package rather than defined here (see below) — instead of each keeping its own, disjoint shape: `readDocx` resolves the full WordprocessingML style cascade (`docx/styles.ts`: `docDefaults` → named-style `basedOn` chains → paragraph-mark run properties → character styles → direct formatting) into ordered `sections` of paragraphs/tables/page-breaks (document order preserved, including inside tables), plus `comments`, `footnotes`, and `headers`/`footers`; `readPptx` resolves the placeholder → layout → master → theme inheritance cascade (`pptx/inherit.ts`) into `slides` of positioned, styled `shapes` (geometry, run/paragraph formatting, embedded images, tables, speaker notes) in presentation order (`p:sldIdLst`, never slide filename order); `readXlsx` covers cell values and formulas, merged ranges and defined names. `typed/shared/` holds the OOXML-specific primitives both `docx/` and `pptx/` build on: `drawingml.ts` (DrawingML `a:xfrm` geometry, theme/colour resolution, group-transform composition — including `ColorTransform`/`applyColorTransforms`, the shade/tint/lumMod/lumOff cascade maths, which stays here rather than in `document-content-model` since it's OOXML-cascade-resolution logic, not a content-model shape), `units.ts` (OOXML unit conversions — EMU/twip/half-point), `metadata.ts` (`docProps/core.xml` + `docProps/app.xml` → `DocumentMetadata`, shared verbatim across docx/pptx/xlsx), and `source-path.ts` (stamps a deterministic, document-order path like `sections[0].blocks[2].runs[1]` onto every `ContentRun`/`ContentBlock`/`ContentShape`, so a downstream consumer can trace a rendered item back to where it came from — see `document-content-model`'s own `sourcePath` field). Geometry (`Box`/`PageSize`/`Margins`), colour (`Color`/`ColorSchema`), and alignment (`Alignment`) types are imported from `document-content-model`, not defined locally. `src/image/sniff.ts` (magic-byte PNG/JPEG detection) supports `readPptx`'s picture-shape reading. None of `readDocx`/`readPptx`/`readXlsx` can be encoded back to a `Package` — round-tripping those always goes through `decodePackage`/`encodePackage`, never through a typed view; see `src/typed/xlsx/` below for this package's one write-back exception. `typed/util.ts` holds the shared XML-walking helpers (`walk`, `elementsWithTag`, `childrenWithTag`, `attr`, `rootElement`, `textContent`, entity decoding, `resolveRelationships`) every typed reader builds on.
179
+ - **`src/typed/`** — one-way, lossy projections that read the generic `Package` into ergonomic document/presentation/workbook models. `docx/` and `pptx/` share one block content model — `ContentParagraph`/`ContentTable`/`ContentImageBlock`/`ContentPageBreak`, discriminated as `ContentBlock`, imported from the sibling [`document-schema.js`](https://github.com/ExaDev/document-schema.js) package rather than defined here (see below) — instead of each keeping its own, disjoint shape: `readDocx` resolves the full WordprocessingML style cascade (`docx/styles.ts`: `docDefaults` → named-style `basedOn` chains → paragraph-mark run properties → character styles → direct formatting) into ordered `sections` of paragraphs/tables/page-breaks (document order preserved, including inside tables), plus `comments`, `footnotes`, and `headers`/`footers`; `readPptx` resolves the placeholder → layout → master → theme inheritance cascade (`pptx/inherit.ts`) into `slides` of positioned, styled `shapes` (geometry, run/paragraph formatting, embedded images, tables, speaker notes) in presentation order (`p:sldIdLst`, never slide filename order); `readXlsx` covers cell values and formulas, merged ranges and defined names. `typed/shared/` holds the OOXML-specific primitives both `docx/` and `pptx/` build on: `drawingml.ts` (DrawingML `a:xfrm` geometry, theme/colour resolution, group-transform composition — including `ColorTransform`/`applyColorTransforms`, the shade/tint/lumMod/lumOff cascade maths, which stays here rather than in `document-schema.js` since it's OOXML-cascade-resolution logic, not a content-model shape), `units.ts` (OOXML unit conversions — EMU/twip/half-point), `metadata.ts` (`docProps/core.xml` + `docProps/app.xml` → `DocumentMetadata`, shared verbatim across docx/pptx/xlsx), and `source-path.ts` (stamps a deterministic, document-order path like `sections[0].blocks[2].runs[1]` onto every `ContentRun`/`ContentBlock`/`ContentShape`, so a downstream consumer can trace a rendered item back to where it came from — see `document-schema.js`'s own `sourcePath` field). Geometry (`Box`/`PageSize`/`Margins`), colour (`Color`/`ColorSchema`), and alignment (`Alignment`) types are imported from `document-schema.js`, not defined locally. `src/image/sniff.ts` (magic-byte PNG/JPEG detection) supports `readPptx`'s picture-shape reading. None of `readDocx`/`readPptx`/`readXlsx` can be encoded back to a `Package` — round-tripping those always goes through `decodePackage`/`encodePackage`, never through a typed view; see `src/typed/xlsx/` below for this package's one write-back exception. `typed/util.ts` holds the shared XML-walking helpers (`walk`, `elementsWithTag`, `childrenWithTag`, `attr`, `rootElement`, `textContent`, entity decoding, `resolveRelationships`) every typed reader builds on.
180
180
  - **`src/typed/xlsx/`** — a second, `ContentDocument`-shaped xlsx pair alongside the lossy `readXlsx` above, not a replacement for it (both stay exported; they serve different callers). `content.ts`'s `readXlsxContent` reads a `Package` straight into `ContentDocument` (`kind: 'spreadsheet'`): real column widths, row heights, hidden rows/columns, merged ranges (resolved onto the anchor cell's `colSpan`/`rowSpan`), every cell value kind xlsx itself distinguishes, and a genuinely populated `ContentSheetPrintSettings` — matching the bar the sibling `odf.js` package's own `readOds` already sets, rather than `readXlsx`'s flattened `XlsxWorkbook`/`XlsxCell` shape. `build.ts`'s `buildXlsxPackage` is `readXlsxContent`'s write-side inverse and this package's first writer of genuinely new content: given a `ContentDocument`, it constructs a complete xlsx `Package` from scratch — workbook, worksheets, a minimal-but-real `xl/styles.xml`, shared strings, core/app properties — via `xml/fragment.ts`'s `el`/`txt`, rather than editing whatever package `readXlsxContent` itself decoded. Both stay scoped to what `ContentDocument`'s `spreadsheet` variant models: no number-format engine (a numeric cell's percentage/currency/date semantics live in `xl/styles.xml`'s own `numFmt` codes, which neither side interprets) and no per-cell rich-text runs.
181
181
 
182
182
  ## Conventions
183
183
 
184
184
  - **Zod-first schema/type/guard.** Every model type is inferred from its Zod schema (`z.infer<typeof XSchema>`), not hand-written — schema, type, and validator stay in lockstep.
185
- - **`XmlNode` uses a recursive structural guard, not `z.lazy`.** `z.lazy` collapses to `unknown` for the element-children case in the Zod version this project pins, so `XmlElementSchema` validates `children` via `z.custom<XmlNode>(isXmlNode)`, a hand-written recursive type guard in `model/node.ts`. Any change to `XmlNode`'s shape must update `isXmlNode` in step. `src/compact.ts`'s `CompactXmlNode` (`isCompactXmlNode` + `z.custom`) reuses the same pattern for the same reason; `document-content-model`'s own `ContentBlock` (`isContentBlock` + `z.custom`, since a table cell's blocks can themselves contain a table) does too, one level up the dependency graph.
185
+ - **`XmlNode` uses a recursive structural guard, not `z.lazy`.** `z.lazy` collapses to `unknown` for the element-children case in the Zod version this project pins, so `XmlElementSchema` validates `children` via `z.custom<XmlNode>(isXmlNode)`, a hand-written recursive type guard in `model/node.ts`. Any change to `XmlNode`'s shape must update `isXmlNode` in step. `src/compact.ts`'s `CompactXmlNode` (`isCompactXmlNode` + `z.custom`) reuses the same pattern for the same reason; `document-schema.js`'s own `ContentBlock` (`isContentBlock` + `z.custom`, since a table cell's blocks can themselves contain a table) does too, one level up the dependency graph.
186
186
  - **Lossless core vs. lossy views is a hard boundary.** `decodePackage`/`encodePackage` (and the underlying codecs) must stay byte/part faithful — every part round-trips unchanged. `src/typed/*`'s lossy readers (`readDocx`, `readPptx`, `readXlsx`) are explicitly one-way and are allowed to drop information (documented per-reader, e.g. `readDocx` resolves cached field-result text rather than re-evaluating live `PAGE`/`NUMPAGES` fields, docx's own `w:themeColor` references aren't resolved, and `readXlsx` drops cell styles, formats and charts). Don't blur this line by adding write-back support to one of those readers; a full round-trip of a package one of them decoded always goes through the generic `Package`. `readXlsxContent`/`buildXlsxPackage` (`src/typed/xlsx/`) are a deliberate, separate exception, not a violation of this rule: they were designed together as a genuine read/write pair around the shared `ContentDocument` model — matching the sibling `odf.js`/`documents.js` packages' own established convention of building fresh output from a `ContentDocument`, rather than editing a decoded package in place — and `buildXlsxPackage` never touches whatever package `readXlsxContent` itself decoded.
187
187
  - **XML entities stay raw in the lossless layer.** `parseXml` runs with `processEntities: false` so encoded entities (e.g. `&amp;`) are preserved verbatim for round-trip fidelity; typed readers decode the five standard entities (`decodeEntities` in `typed/util.ts`) only in their own lossy projection, never in the core model.
188
188
  - **No type assertions.** `eslint.config.ts` runs `@typescript-eslint/consistent-type-assertions` with `assertionStyle: "never"`, banning `as` and angle-bracket casts outright, with `linterOptions.noInlineConfig: true` so there is no `eslint-disable` escape hatch either — narrow with a guard or parse with Zod. An exception would have to be scoped structurally, as a `files`-matched override block in `eslint.config.ts`, not an inline comment.
@@ -215,8 +215,8 @@ Commits follow Conventional Commits (`feat:`, `fix:`, `test:`, `chore:`, …), e
215
215
 
216
216
  ## References
217
217
 
218
- - [document-content-model](https://github.com/ExaDev/document-schema.js) — the canonical `ContentBlock`/`ContentSection`/`ContentSlide`/geometry/colour/alignment schemas `readDocx`/`readPptx` return, plus the `ContentDocument`/`LayoutMetadata` types `readXlsxContent`/`buildXlsxPackage` read and write directly, all imported here rather than defined locally — the single source of truth this package shares with `odf.js` and `documents.js` so none of the three maintains an independent, drift-prone copy.
219
- - [odf.js](https://github.com/ExaDev/odf.js) — a sibling package doing the equivalent job for the OpenDocument Format (odt/ods/odp/odg/…), also built on `document-content-model`.
218
+ - [document-schema.js](https://github.com/ExaDev/document-schema.js) — the canonical `ContentBlock`/`ContentSection`/`ContentSlide`/geometry/colour/alignment schemas `readDocx`/`readPptx` return, plus the `ContentDocument`/`LayoutMetadata` types `readXlsxContent`/`buildXlsxPackage` read and write directly, all imported here rather than defined locally — the single source of truth this package shares with `odf.js` and `documents.js` so none of the three maintains an independent, drift-prone copy.
219
+ - [odf.js](https://github.com/ExaDev/odf.js) — a sibling package doing the equivalent job for the OpenDocument Format (odt/ods/odp/odg/…), also built on `document-schema.js`.
220
220
  - [documents.js](https://github.com/ExaDev/documents.js) — depends on this package for lossless OOXML handling and its cascade-resolved typed readers, adding PDF conversion and a read-and-write docx/pptx editor on top.
221
221
 
222
222
  ## License
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let zod = require("zod");
3
3
  let fast_xml_parser = require("fast-xml-parser");
4
4
  let fflate = require("fflate");
5
- let document_content_model = require("document-content-model");
5
+ let document_schema_js = require("document-schema.js");
6
6
  //#region src/model/node.ts
7
7
  const AttributeSchema = zod.z.object({
8
8
  name: zod.z.string(),
@@ -763,11 +763,11 @@ const CLR_SCHEME_SLOTS = [
763
763
  function readThemeSlotColor(colorEl) {
764
764
  if (colorEl.tag === "a:srgbClr") {
765
765
  const val = attr(colorEl, "val");
766
- return val === void 0 ? void 0 : (0, document_content_model.rgbHexToColor)(val);
766
+ return val === void 0 ? void 0 : (0, document_schema_js.rgbHexToColor)(val);
767
767
  }
768
768
  if (colorEl.tag === "a:sysClr") {
769
769
  const lastClr = attr(colorEl, "lastClr");
770
- if (lastClr !== void 0) return (0, document_content_model.rgbHexToColor)(lastClr);
770
+ if (lastClr !== void 0) return (0, document_schema_js.rgbHexToColor)(lastClr);
771
771
  return attr(colorEl, "val") === "window" ? {
772
772
  r: 1,
773
773
  g: 1,
@@ -856,7 +856,7 @@ function readSchemeColor(schemeClrEl, colorMap, theme) {
856
856
  }
857
857
  function readSrgbColor(srgbClrEl) {
858
858
  const val = attr(srgbClrEl, "val");
859
- return val === void 0 ? void 0 : applyColorTransforms((0, document_content_model.rgbHexToColor)(val), readColorTransforms(srgbClrEl));
859
+ return val === void 0 ? void 0 : applyColorTransforms((0, document_schema_js.rgbHexToColor)(val), readColorTransforms(srgbClrEl));
860
860
  }
861
861
  function readSolidFillColor(solidFillEl, colorMap, theme) {
862
862
  if (solidFillEl === void 0) return;
@@ -949,7 +949,7 @@ function readUnderline(u) {
949
949
  function readRunColor(colorEl) {
950
950
  if (colorEl === void 0) return;
951
951
  const val = attr(colorEl, "w:val");
952
- return val === void 0 || val === "auto" ? void 0 : (0, document_content_model.rgbHexToColor)(val);
952
+ return val === void 0 || val === "auto" ? void 0 : (0, document_schema_js.rgbHexToColor)(val);
953
953
  }
954
954
  function readRunFontFamily(rFonts, theme) {
955
955
  if (rFonts === void 0) return;
@@ -1067,7 +1067,7 @@ const FootnoteSchema = zod.z.object({
1067
1067
  });
1068
1068
  const DocxDocumentSchema = zod.z.object({
1069
1069
  metadata: DocumentMetadataSchema,
1070
- sections: zod.z.array(document_content_model.ContentSectionSchema),
1070
+ sections: zod.z.array(document_schema_js.ContentSectionSchema),
1071
1071
  comments: zod.z.array(CommentSchema),
1072
1072
  footnotes: zod.z.array(FootnoteSchema),
1073
1073
  headers: zod.z.array(zod.z.string()),
@@ -1087,7 +1087,7 @@ function readPageSize$1(sectPr) {
1087
1087
  const pgSz = childrenWithTag(sectPr, "w:pgSz")[0];
1088
1088
  const w = pgSz === void 0 ? void 0 : attr(pgSz, "w:w");
1089
1089
  const h = pgSz === void 0 ? void 0 : attr(pgSz, "w:h");
1090
- return w === void 0 || h === void 0 ? document_content_model.PAGE_SIZE_LETTER : {
1090
+ return w === void 0 || h === void 0 ? document_schema_js.PAGE_SIZE_LETTER : {
1091
1091
  widthPt: twipsToPt(Number(w)),
1092
1092
  heightPt: twipsToPt(Number(h))
1093
1093
  };
@@ -1203,7 +1203,7 @@ function readParagraph$1(paragraph, context, rels) {
1203
1203
  function readCellShading(tcPr) {
1204
1204
  const shd = tcPr === void 0 ? void 0 : childrenWithTag(tcPr, "w:shd")[0];
1205
1205
  const fill = shd === void 0 ? void 0 : attr(shd, "w:fill");
1206
- return fill === void 0 || fill === "auto" || fill === "none" ? void 0 : (0, document_content_model.rgbHexToColor)(fill);
1206
+ return fill === void 0 || fill === "auto" || fill === "none" ? void 0 : (0, document_schema_js.rgbHexToColor)(fill);
1207
1207
  }
1208
1208
  function readRawCell(tc, context, rels) {
1209
1209
  const tcPr = childrenWithTag(tc, "w:tcPr")[0];
@@ -1303,7 +1303,7 @@ function readSections(body, context, rels) {
1303
1303
  currentBlocks.push(...readBodyBlocks([node], context, rels));
1304
1304
  }
1305
1305
  if (currentBlocks.length > 0 || sections.length === 0) sections.push({
1306
- pageSize: document_content_model.PAGE_SIZE_LETTER,
1306
+ pageSize: document_schema_js.PAGE_SIZE_LETTER,
1307
1307
  margins: DEFAULT_MARGINS$1,
1308
1308
  blocks: currentBlocks
1309
1309
  });
@@ -1464,7 +1464,7 @@ function resolveDefaultRunProperties(placeholderType, level, context) {
1464
1464
  //#region src/typed/pptx/read.ts
1465
1465
  const PptxDocumentSchema = zod.z.object({
1466
1466
  metadata: DocumentMetadataSchema,
1467
- slides: zod.z.array(document_content_model.ContentSlideSchema)
1467
+ slides: zod.z.array(document_schema_js.ContentSlideSchema)
1468
1468
  });
1469
1469
  const PRESENTATION_PATH = "ppt/presentation.xml";
1470
1470
  const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
@@ -1472,7 +1472,7 @@ function readSlideSize(presentationRoot) {
1472
1472
  const sldSz = presentationRoot === void 0 ? void 0 : childrenWithTag(presentationRoot, "p:sldSz")[0];
1473
1473
  const cx = sldSz === void 0 ? void 0 : attr(sldSz, "cx");
1474
1474
  const cy = sldSz === void 0 ? void 0 : attr(sldSz, "cy");
1475
- return cx === void 0 || cy === void 0 ? document_content_model.SLIDE_SIZE_WIDESCREEN : {
1475
+ return cx === void 0 || cy === void 0 ? document_schema_js.SLIDE_SIZE_WIDESCREEN : {
1476
1476
  widthPt: emuToPt(Number(cx)),
1477
1477
  heightPt: emuToPt(Number(cy))
1478
1478
  };
@@ -2142,8 +2142,8 @@ function ptToUniversalMeasure(pt) {
2142
2142
  return `${(pt / 72 * 2.54).toFixed(2)}cm`;
2143
2143
  }
2144
2144
  const PAPER_SIZE_BY_CODE = {
2145
- "1": document_content_model.PAGE_SIZE_LETTER,
2146
- "9": document_content_model.PAGE_SIZE_A4
2145
+ "1": document_schema_js.PAGE_SIZE_LETTER,
2146
+ "9": document_schema_js.PAGE_SIZE_A4
2147
2147
  };
2148
2148
  function paperSizeCodeToPageSize(code) {
2149
2149
  return PAPER_SIZE_BY_CODE[code];
@@ -2153,8 +2153,8 @@ function approximatelyEquals(a, b) {
2153
2153
  return Math.abs(a - b) <= PAPER_SIZE_TOLERANCE_PT;
2154
2154
  }
2155
2155
  function pageSizeToPaperSizeCode(pageSize) {
2156
- if (approximatelyEquals(pageSize.widthPt, document_content_model.PAGE_SIZE_LETTER.widthPt) && approximatelyEquals(pageSize.heightPt, document_content_model.PAGE_SIZE_LETTER.heightPt)) return "1";
2157
- if (approximatelyEquals(pageSize.widthPt, document_content_model.PAGE_SIZE_A4.widthPt) && approximatelyEquals(pageSize.heightPt, document_content_model.PAGE_SIZE_A4.heightPt)) return "9";
2156
+ if (approximatelyEquals(pageSize.widthPt, document_schema_js.PAGE_SIZE_LETTER.widthPt) && approximatelyEquals(pageSize.heightPt, document_schema_js.PAGE_SIZE_LETTER.heightPt)) return "1";
2157
+ if (approximatelyEquals(pageSize.widthPt, document_schema_js.PAGE_SIZE_A4.widthPt) && approximatelyEquals(pageSize.heightPt, document_schema_js.PAGE_SIZE_A4.heightPt)) return "9";
2158
2158
  }
2159
2159
  //#endregion
2160
2160
  //#region src/typed/xlsx/print-settings.ts
@@ -2174,7 +2174,7 @@ function applyOrientation(pageSize, pageSetup) {
2174
2174
  };
2175
2175
  }
2176
2176
  function readPageSize(pageSetup) {
2177
- if (pageSetup === void 0) return document_content_model.PAGE_SIZE_LETTER;
2177
+ if (pageSetup === void 0) return document_schema_js.PAGE_SIZE_LETTER;
2178
2178
  const paperSize = attr(pageSetup, "paperSize");
2179
2179
  const byCode = paperSize === void 0 ? void 0 : paperSizeCodeToPageSize(paperSize);
2180
2180
  if (byCode !== void 0) return applyOrientation(byCode, pageSetup);
@@ -2182,7 +2182,7 @@ function readPageSize(pageSetup) {
2182
2182
  const paperHeight = attr(pageSetup, "paperHeight");
2183
2183
  const widthPt = paperWidth === void 0 ? void 0 : parseUniversalMeasureToPt(paperWidth);
2184
2184
  const heightPt = paperHeight === void 0 ? void 0 : parseUniversalMeasureToPt(paperHeight);
2185
- return widthPt === void 0 || heightPt === void 0 ? document_content_model.PAGE_SIZE_LETTER : applyOrientation({
2185
+ return widthPt === void 0 || heightPt === void 0 ? document_schema_js.PAGE_SIZE_LETTER : applyOrientation({
2186
2186
  widthPt,
2187
2187
  heightPt
2188
2188
  }, pageSetup);
@@ -2514,7 +2514,7 @@ function readXlsxContent(pkg) {
2514
2514
  const sheets = resolveSheetEntries(pkg).map((entry, sheetIndex) => readSheet(pkg, entry, sheetIndex, sharedStrings, definedNamesBySheet));
2515
2515
  return {
2516
2516
  kind: "spreadsheet",
2517
- formatVersion: document_content_model.CONTENT_FORMAT_VERSION,
2517
+ formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
2518
2518
  metadata: readCoreProperties(pkg),
2519
2519
  sheets
2520
2520
  };
@@ -2968,7 +2968,7 @@ function buildXlsxPackage(document) {
2968
2968
  Object.defineProperty(exports, "AlignmentSchema", {
2969
2969
  enumerable: true,
2970
2970
  get: function() {
2971
- return document_content_model.AlignmentSchema;
2971
+ return document_schema_js.AlignmentSchema;
2972
2972
  }
2973
2973
  });
2974
2974
  exports.AttributeSchema = AttributeSchema;
@@ -2976,25 +2976,25 @@ exports.BinaryPartSchema = BinaryPartSchema;
2976
2976
  Object.defineProperty(exports, "BoxSchema", {
2977
2977
  enumerable: true,
2978
2978
  get: function() {
2979
- return document_content_model.BoxSchema;
2979
+ return document_schema_js.BoxSchema;
2980
2980
  }
2981
2981
  });
2982
2982
  Object.defineProperty(exports, "COLOR_BLACK", {
2983
2983
  enumerable: true,
2984
2984
  get: function() {
2985
- return document_content_model.COLOR_BLACK;
2985
+ return document_schema_js.COLOR_BLACK;
2986
2986
  }
2987
2987
  });
2988
2988
  Object.defineProperty(exports, "CONTENT_FORMAT_VERSION", {
2989
2989
  enumerable: true,
2990
2990
  get: function() {
2991
- return document_content_model.CONTENT_FORMAT_VERSION;
2991
+ return document_schema_js.CONTENT_FORMAT_VERSION;
2992
2992
  }
2993
2993
  });
2994
2994
  Object.defineProperty(exports, "ColorSchema", {
2995
2995
  enumerable: true,
2996
2996
  get: function() {
2997
- return document_content_model.ColorSchema;
2997
+ return document_schema_js.ColorSchema;
2998
2998
  }
2999
2999
  });
3000
3000
  exports.CommentSchema = CommentSchema;
@@ -3004,133 +3004,133 @@ exports.CompactXmlNodeSchema = CompactXmlNodeSchema;
3004
3004
  Object.defineProperty(exports, "ContentBlockSchema", {
3005
3005
  enumerable: true,
3006
3006
  get: function() {
3007
- return document_content_model.ContentBlockSchema;
3007
+ return document_schema_js.ContentBlockSchema;
3008
3008
  }
3009
3009
  });
3010
3010
  Object.defineProperty(exports, "ContentCellValueSchema", {
3011
3011
  enumerable: true,
3012
3012
  get: function() {
3013
- return document_content_model.ContentCellValueSchema;
3013
+ return document_schema_js.ContentCellValueSchema;
3014
3014
  }
3015
3015
  });
3016
3016
  Object.defineProperty(exports, "ContentDocumentSchema", {
3017
3017
  enumerable: true,
3018
3018
  get: function() {
3019
- return document_content_model.ContentDocumentSchema;
3019
+ return document_schema_js.ContentDocumentSchema;
3020
3020
  }
3021
3021
  });
3022
3022
  Object.defineProperty(exports, "ContentImageBlockSchema", {
3023
3023
  enumerable: true,
3024
3024
  get: function() {
3025
- return document_content_model.ContentImageBlockSchema;
3025
+ return document_schema_js.ContentImageBlockSchema;
3026
3026
  }
3027
3027
  });
3028
3028
  Object.defineProperty(exports, "ContentListMembershipSchema", {
3029
3029
  enumerable: true,
3030
3030
  get: function() {
3031
- return document_content_model.ContentListMembershipSchema;
3031
+ return document_schema_js.ContentListMembershipSchema;
3032
3032
  }
3033
3033
  });
3034
3034
  Object.defineProperty(exports, "ContentPageBreakSchema", {
3035
3035
  enumerable: true,
3036
3036
  get: function() {
3037
- return document_content_model.ContentPageBreakSchema;
3037
+ return document_schema_js.ContentPageBreakSchema;
3038
3038
  }
3039
3039
  });
3040
3040
  Object.defineProperty(exports, "ContentParagraphSchema", {
3041
3041
  enumerable: true,
3042
3042
  get: function() {
3043
- return document_content_model.ContentParagraphSchema;
3043
+ return document_schema_js.ContentParagraphSchema;
3044
3044
  }
3045
3045
  });
3046
3046
  Object.defineProperty(exports, "ContentRunSchema", {
3047
3047
  enumerable: true,
3048
3048
  get: function() {
3049
- return document_content_model.ContentRunSchema;
3049
+ return document_schema_js.ContentRunSchema;
3050
3050
  }
3051
3051
  });
3052
3052
  Object.defineProperty(exports, "ContentSectionSchema", {
3053
3053
  enumerable: true,
3054
3054
  get: function() {
3055
- return document_content_model.ContentSectionSchema;
3055
+ return document_schema_js.ContentSectionSchema;
3056
3056
  }
3057
3057
  });
3058
3058
  Object.defineProperty(exports, "ContentShapeSchema", {
3059
3059
  enumerable: true,
3060
3060
  get: function() {
3061
- return document_content_model.ContentShapeSchema;
3061
+ return document_schema_js.ContentShapeSchema;
3062
3062
  }
3063
3063
  });
3064
3064
  Object.defineProperty(exports, "ContentSheetCellSchema", {
3065
3065
  enumerable: true,
3066
3066
  get: function() {
3067
- return document_content_model.ContentSheetCellSchema;
3067
+ return document_schema_js.ContentSheetCellSchema;
3068
3068
  }
3069
3069
  });
3070
3070
  Object.defineProperty(exports, "ContentSheetColumnSchema", {
3071
3071
  enumerable: true,
3072
3072
  get: function() {
3073
- return document_content_model.ContentSheetColumnSchema;
3073
+ return document_schema_js.ContentSheetColumnSchema;
3074
3074
  }
3075
3075
  });
3076
3076
  Object.defineProperty(exports, "ContentSheetImageSchema", {
3077
3077
  enumerable: true,
3078
3078
  get: function() {
3079
- return document_content_model.ContentSheetImageSchema;
3079
+ return document_schema_js.ContentSheetImageSchema;
3080
3080
  }
3081
3081
  });
3082
3082
  Object.defineProperty(exports, "ContentSheetPrintRangeSchema", {
3083
3083
  enumerable: true,
3084
3084
  get: function() {
3085
- return document_content_model.ContentSheetPrintRangeSchema;
3085
+ return document_schema_js.ContentSheetPrintRangeSchema;
3086
3086
  }
3087
3087
  });
3088
3088
  Object.defineProperty(exports, "ContentSheetPrintSettingsSchema", {
3089
3089
  enumerable: true,
3090
3090
  get: function() {
3091
- return document_content_model.ContentSheetPrintSettingsSchema;
3091
+ return document_schema_js.ContentSheetPrintSettingsSchema;
3092
3092
  }
3093
3093
  });
3094
3094
  Object.defineProperty(exports, "ContentSheetRepeatRangeSchema", {
3095
3095
  enumerable: true,
3096
3096
  get: function() {
3097
- return document_content_model.ContentSheetRepeatRangeSchema;
3097
+ return document_schema_js.ContentSheetRepeatRangeSchema;
3098
3098
  }
3099
3099
  });
3100
3100
  Object.defineProperty(exports, "ContentSheetRowSchema", {
3101
3101
  enumerable: true,
3102
3102
  get: function() {
3103
- return document_content_model.ContentSheetRowSchema;
3103
+ return document_schema_js.ContentSheetRowSchema;
3104
3104
  }
3105
3105
  });
3106
3106
  Object.defineProperty(exports, "ContentSheetSchema", {
3107
3107
  enumerable: true,
3108
3108
  get: function() {
3109
- return document_content_model.ContentSheetSchema;
3109
+ return document_schema_js.ContentSheetSchema;
3110
3110
  }
3111
3111
  });
3112
3112
  Object.defineProperty(exports, "ContentSlideSchema", {
3113
3113
  enumerable: true,
3114
3114
  get: function() {
3115
- return document_content_model.ContentSlideSchema;
3115
+ return document_schema_js.ContentSlideSchema;
3116
3116
  }
3117
3117
  });
3118
3118
  Object.defineProperty(exports, "ContentTableCellSchema", {
3119
3119
  enumerable: true,
3120
3120
  get: function() {
3121
- return document_content_model.ContentTableCellSchema;
3121
+ return document_schema_js.ContentTableCellSchema;
3122
3122
  }
3123
3123
  });
3124
3124
  Object.defineProperty(exports, "ContentTableRowSchema", {
3125
3125
  enumerable: true,
3126
3126
  get: function() {
3127
- return document_content_model.ContentTableRowSchema;
3127
+ return document_schema_js.ContentTableRowSchema;
3128
3128
  }
3129
3129
  });
3130
3130
  Object.defineProperty(exports, "ContentTableSchema", {
3131
3131
  enumerable: true,
3132
3132
  get: function() {
3133
- return document_content_model.ContentTableSchema;
3133
+ return document_schema_js.ContentTableSchema;
3134
3134
  }
3135
3135
  });
3136
3136
  exports.DefinedNameSchema = DefinedNameSchema;
@@ -3140,26 +3140,26 @@ exports.FootnoteSchema = FootnoteSchema;
3140
3140
  Object.defineProperty(exports, "MarginsSchema", {
3141
3141
  enumerable: true,
3142
3142
  get: function() {
3143
- return document_content_model.MarginsSchema;
3143
+ return document_schema_js.MarginsSchema;
3144
3144
  }
3145
3145
  });
3146
3146
  Object.defineProperty(exports, "PAGE_SIZE_A4", {
3147
3147
  enumerable: true,
3148
3148
  get: function() {
3149
- return document_content_model.PAGE_SIZE_A4;
3149
+ return document_schema_js.PAGE_SIZE_A4;
3150
3150
  }
3151
3151
  });
3152
3152
  Object.defineProperty(exports, "PAGE_SIZE_LETTER", {
3153
3153
  enumerable: true,
3154
3154
  get: function() {
3155
- return document_content_model.PAGE_SIZE_LETTER;
3155
+ return document_schema_js.PAGE_SIZE_LETTER;
3156
3156
  }
3157
3157
  });
3158
3158
  exports.PackageSchema = PackageSchema;
3159
3159
  Object.defineProperty(exports, "PageSizeSchema", {
3160
3160
  enumerable: true,
3161
3161
  get: function() {
3162
- return document_content_model.PageSizeSchema;
3162
+ return document_schema_js.PageSizeSchema;
3163
3163
  }
3164
3164
  });
3165
3165
  exports.PartSchema = PartSchema;
@@ -3167,13 +3167,13 @@ exports.PptxDocumentSchema = PptxDocumentSchema;
3167
3167
  Object.defineProperty(exports, "SLIDE_SIZE_STANDARD", {
3168
3168
  enumerable: true,
3169
3169
  get: function() {
3170
- return document_content_model.SLIDE_SIZE_STANDARD;
3170
+ return document_schema_js.SLIDE_SIZE_STANDARD;
3171
3171
  }
3172
3172
  });
3173
3173
  Object.defineProperty(exports, "SLIDE_SIZE_WIDESCREEN", {
3174
3174
  enumerable: true,
3175
3175
  get: function() {
3176
- return document_content_model.SLIDE_SIZE_WIDESCREEN;
3176
+ return document_schema_js.SLIDE_SIZE_WIDESCREEN;
3177
3177
  }
3178
3178
  });
3179
3179
  exports.XlsxCellSchema = XlsxCellSchema;
@@ -3197,7 +3197,7 @@ exports.childrenWithTag = childrenWithTag;
3197
3197
  Object.defineProperty(exports, "colorToRgbHex", {
3198
3198
  enumerable: true,
3199
3199
  get: function() {
3200
- return document_content_model.colorToRgbHex;
3200
+ return document_schema_js.colorToRgbHex;
3201
3201
  }
3202
3202
  });
3203
3203
  exports.compactCodec = compactCodec;
@@ -3215,7 +3215,7 @@ exports.isCompactXmlNode = isCompactXmlNode;
3215
3215
  Object.defineProperty(exports, "isContentBlock", {
3216
3216
  enumerable: true,
3217
3217
  get: function() {
3218
- return document_content_model.isContentBlock;
3218
+ return document_schema_js.isContentBlock;
3219
3219
  }
3220
3220
  });
3221
3221
  exports.isXmlNode = isXmlNode;
@@ -3230,7 +3230,7 @@ exports.resolveRelationships = resolveRelationships;
3230
3230
  Object.defineProperty(exports, "rgbHexToColor", {
3231
3231
  enumerable: true,
3232
3232
  get: function() {
3233
- return document_content_model.rgbHexToColor;
3233
+ return document_schema_js.rgbHexToColor;
3234
3234
  }
3235
3235
  });
3236
3236
  exports.rootElement = rootElement;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, Color, Color as Color$1, ColorSchema, ContentBlock, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-content-model";
2
+ import { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, Color, Color as Color$1, ColorSchema, ContentBlock, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-schema.js";
3
3
  //#region src/model/node.d.ts
4
4
  declare const AttributeSchema: z.ZodObject<{
5
5
  name: z.ZodString;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, Color, Color as Color$1, ColorSchema, ContentBlock, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-content-model";
2
+ import { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, Color, Color as Color$1, ColorSchema, ContentBlock, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-schema.js";
3
3
  //#region src/model/node.d.ts
4
4
  declare const AttributeSchema: z.ZodObject<{
5
5
  name: z.ZodString;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { XMLBuilder, XMLParser } from "fast-xml-parser";
3
3
  import { unzipSync, zipSync } from "fflate";
4
- import { AlignmentSchema, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, CONTENT_FORMAT_VERSION as CONTENT_FORMAT_VERSION$1, ColorSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentRunSchema, ContentSectionSchema, ContentSectionSchema as ContentSectionSchema$1, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentSlideSchema as ContentSlideSchema$1, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_A4 as PAGE_SIZE_A4$1, PAGE_SIZE_LETTER, PAGE_SIZE_LETTER as PAGE_SIZE_LETTER$1, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SLIDE_SIZE_WIDESCREEN as SLIDE_SIZE_WIDESCREEN$1, colorToRgbHex, isContentBlock, rgbHexToColor, rgbHexToColor as rgbHexToColor$1 } from "document-content-model";
4
+ import { AlignmentSchema, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, CONTENT_FORMAT_VERSION as CONTENT_FORMAT_VERSION$1, ColorSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentRunSchema, ContentSectionSchema, ContentSectionSchema as ContentSectionSchema$1, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentSlideSchema as ContentSlideSchema$1, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_A4 as PAGE_SIZE_A4$1, PAGE_SIZE_LETTER, PAGE_SIZE_LETTER as PAGE_SIZE_LETTER$1, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SLIDE_SIZE_WIDESCREEN as SLIDE_SIZE_WIDESCREEN$1, colorToRgbHex, isContentBlock, rgbHexToColor, rgbHexToColor as rgbHexToColor$1 } from "document-schema.js";
5
5
  //#region src/model/node.ts
6
6
  const AttributeSchema = z.object({
7
7
  name: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml.js",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Type-safe, lossless round-trip conversion between OOXML packages (docx, pptx, xlsx) and JSON, built on Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -61,7 +61,7 @@
61
61
  "license": "MIT",
62
62
  "packageManager": "pnpm@11.6.0",
63
63
  "dependencies": {
64
- "document-content-model": "^1.3.0",
64
+ "document-schema.js": "^1.5.3",
65
65
  "fast-xml-parser": "^5.10.1",
66
66
  "fflate": "^0.8.3",
67
67
  "zod": "^4.4.3"