ooxml.js 3.0.1 → 3.1.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.
@@ -63,11 +63,12 @@ function resolveRelationships(pkg, partPath) {
63
63
  for (const rel of childrenWithTag(rels, "Relationship")) {
64
64
  const id = attr(rel, "Id");
65
65
  const type = attr(rel, "Type");
66
- const target = attr(rel, "Target");
67
- if (id === void 0 || type === void 0 || target === void 0) continue;
66
+ const rawTarget = attr(rel, "Target");
67
+ if (id === void 0 || type === void 0 || rawTarget === void 0) continue;
68
+ const target = decodeEntities(rawTarget);
68
69
  const targetMode = attr(rel, "TargetMode");
69
70
  map.set(id, {
70
- type,
71
+ type: decodeEntities(type),
71
72
  target: targetMode === "External" ? target : resolveRelTarget(partPath, target),
72
73
  targetMode
73
74
  });
@@ -62,11 +62,12 @@ function resolveRelationships(pkg, partPath) {
62
62
  for (const rel of childrenWithTag(rels, "Relationship")) {
63
63
  const id = attr(rel, "Id");
64
64
  const type = attr(rel, "Type");
65
- const target = attr(rel, "Target");
66
- if (id === void 0 || type === void 0 || target === void 0) continue;
65
+ const rawTarget = attr(rel, "Target");
66
+ if (id === void 0 || type === void 0 || rawTarget === void 0) continue;
67
+ const target = decodeEntities(rawTarget);
67
68
  const targetMode = attr(rel, "TargetMode");
68
69
  map.set(id, {
69
- type,
70
+ type: decodeEntities(type),
70
71
  target: targetMode === "External" ? target : resolveRelTarget(partPath, target),
71
72
  targetMode
72
73
  });
@@ -0,0 +1,11 @@
1
+ import { r as Package } from "./package-L24lkba-.cjs";
2
+ import { t as DocumentMetadata } from "./metadata-D6o-kLpg.cjs";
3
+ import { ContentSection } from "document-schema.js";
4
+ //#region src/typed/docx/write.d.ts
5
+ interface DocxContent {
6
+ readonly metadata?: DocumentMetadata;
7
+ readonly sections: readonly ContentSection[];
8
+ }
9
+ declare function buildDocxPackage(content: DocxContent): Package;
10
+ //#endregion
11
+ export { buildDocxPackage as n, DocxContent as t };
@@ -0,0 +1,11 @@
1
+ import { r as Package } from "./package-BUojjTXf.js";
2
+ import { t as DocumentMetadata } from "./metadata-o_WH9V_I.js";
3
+ import { ContentSection } from "document-schema.js";
4
+ //#region src/typed/docx/write.d.ts
5
+ interface DocxContent {
6
+ readonly metadata?: DocumentMetadata;
7
+ readonly sections: readonly ContentSection[];
8
+ }
9
+ declare function buildDocxPackage(content: DocxContent): Package;
10
+ //#endregion
11
+ export { buildDocxPackage as n, DocxContent as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml.js",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
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": {
@@ -78,7 +78,7 @@
78
78
  "license": "MIT",
79
79
  "packageManager": "pnpm@11.6.0",
80
80
  "dependencies": {
81
- "document-schema.js": "^4.1.0",
81
+ "document-schema.js": "^4.2.0",
82
82
  "fast-xml-parser": "^5.10.1",
83
83
  "fflate": "^0.8.3",
84
84
  "zod": "^4.4.3"
@@ -1,88 +0,0 @@
1
- import { d as XmlNode } from "./node-CkBWRjNR.cjs";
2
- import { r as Package } from "./package-L24lkba-.cjs";
3
- import "./read-DzmMJPHd.cjs";
4
- import "./write-6JmxvaK5.cjs";
5
- import "./parse-CP5FLZqv.cjs";
6
- import "./build-XSm3I8LT.cjs";
7
- import "./fragment-B1og_8uA.cjs";
8
- import "./util-M3JJlDhF.cjs";
9
- import "./compact-B1qg9oex.cjs";
10
- import "./color-fFIKAs-Y.cjs";
11
- import "./metadata-D6o-kLpg.cjs";
12
- import "./read-D_CpruL_.cjs";
13
- import "./numbering-C53LT-Jx.cjs";
14
- import "./read-OBV7MMlF.cjs";
15
- import "./xlsx-B97t4YE-.cjs";
16
- import "./content-UlQ-Nhgi.cjs";
17
- import "./build-CBL9scQK.cjs";
18
- import { z } from "zod";
19
- import { Alignment as Alignment$1, AlignmentSchema, Box as Box$1, BoxSchema, COLOR_BLACK, Color as Color$1, ColorSchema, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders as ContentCellBorders$1, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph as ContentParagraph$1, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange as ContentSheetPrintRange$1, ContentSheetPrintRangeSchema, ContentSheetPrintSettings as ContentSheetPrintSettings$1, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange as ContentSheetRepeatRange$1, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentTable as ContentTable$1, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize as PageSize$1, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-schema.js";
20
- //#region src/codec.d.ts
21
- declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
22
- type: z.ZodLiteral<"text">;
23
- value: z.ZodString;
24
- }, z.core.$strip>, z.ZodObject<{
25
- type: z.ZodLiteral<"cdata">;
26
- value: z.ZodString;
27
- }, z.core.$strip>, z.ZodObject<{
28
- type: z.ZodLiteral<"comment">;
29
- value: z.ZodString;
30
- }, z.core.$strip>, z.ZodObject<{
31
- type: z.ZodLiteral<"declaration">;
32
- attributes: z.ZodArray<z.ZodObject<{
33
- name: z.ZodString;
34
- value: z.ZodString;
35
- }, z.core.$strip>>;
36
- }, z.core.$strip>, z.ZodObject<{
37
- type: z.ZodLiteral<"pi">;
38
- target: z.ZodString;
39
- content: z.ZodString;
40
- }, z.core.$strip>, z.ZodObject<{
41
- type: z.ZodLiteral<"element">;
42
- tag: z.ZodString;
43
- attributes: z.ZodArray<z.ZodObject<{
44
- name: z.ZodString;
45
- value: z.ZodString;
46
- }, z.core.$strip>>;
47
- children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
48
- }, z.core.$strip>], "type">>>;
49
- declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodObject<{
50
- parts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
51
- kind: z.ZodLiteral<"xml">;
52
- nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
53
- type: z.ZodLiteral<"text">;
54
- value: z.ZodString;
55
- }, z.core.$strip>, z.ZodObject<{
56
- type: z.ZodLiteral<"cdata">;
57
- value: z.ZodString;
58
- }, z.core.$strip>, z.ZodObject<{
59
- type: z.ZodLiteral<"comment">;
60
- value: z.ZodString;
61
- }, z.core.$strip>, z.ZodObject<{
62
- type: z.ZodLiteral<"declaration">;
63
- attributes: z.ZodArray<z.ZodObject<{
64
- name: z.ZodString;
65
- value: z.ZodString;
66
- }, z.core.$strip>>;
67
- }, z.core.$strip>, z.ZodObject<{
68
- type: z.ZodLiteral<"pi">;
69
- target: z.ZodString;
70
- content: z.ZodString;
71
- }, z.core.$strip>, z.ZodObject<{
72
- type: z.ZodLiteral<"element">;
73
- tag: z.ZodString;
74
- attributes: z.ZodArray<z.ZodObject<{
75
- name: z.ZodString;
76
- value: z.ZodString;
77
- }, z.core.$strip>>;
78
- children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
79
- }, z.core.$strip>], "type">>;
80
- }, z.core.$strip>, z.ZodObject<{
81
- kind: z.ZodLiteral<"binary">;
82
- base64: z.ZodString;
83
- }, z.core.$strip>], "kind">>;
84
- }, z.core.$strip>>;
85
- declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
86
- declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
87
- //#endregion
88
- export { ContentSlideSchema as $, ContentRun as A, ContentSheetColumnSchema as B, ContentImageBlockSchema as C, ContentPageBreakSchema as D, ContentPageBreak as E, ContentShapeSchema as F, ContentSheetPrintSettings$1 as G, ContentSheetImageSchema as H, ContentSheet as I, ContentSheetRepeatRangeSchema as J, ContentSheetPrintSettingsSchema as K, ContentSheetCell as L, ContentSection as M, ContentSectionSchema as N, ContentParagraph$1 as O, ContentShape as P, ContentSlide as Q, ContentSheetCellSchema as R, ContentImageBlock as S, ContentListMembershipSchema as T, ContentSheetPrintRange$1 as U, ContentSheetImage as V, ContentSheetPrintRangeSchema as W, ContentSheetRowSchema as X, ContentSheetRow as Y, ContentSheetSchema as Z, ContentCellBordersSchema as _, isContentBlock as _t, Alignment$1 as a, ContentTableRow as at, ContentDocument$1 as b, BoxSchema as c, Margins as ct, ColorSchema as d, PAGE_SIZE_LETTER as dt, ContentStrokeStyle as et, ContentBlock$1 as f, PageSize$1 as ft, ContentCellBorders$1 as g, colorToRgbHex as gt, ContentBorderSchema as h, SLIDE_SIZE_WIDESCREEN as ht, xmlCodec as i, ContentTableCellSchema as it, ContentRunSchema as j, ContentParagraphSchema as k, COLOR_BLACK as l, MarginsSchema as lt, ContentBorder as m, SLIDE_SIZE_STANDARD as mt, encodePackage as n, ContentTable$1 as nt, AlignmentSchema as o, ContentTableRowSchema as ot, ContentBlockSchema as p, PageSizeSchema as pt, ContentSheetRepeatRange$1 as q, packageCodec as r, ContentTableCell as rt, Box$1 as s, ContentTableSchema as st, decodePackage as t, ContentStrokeStyleSchema as tt, Color$1 as u, PAGE_SIZE_A4 as ut, ContentCellValue as v, rgbHexToColor as vt, ContentListMembership as w, ContentDocumentSchema as x, ContentCellValueSchema as y, ContentSheetColumn as z };
@@ -1,88 +0,0 @@
1
- import { d as XmlNode } from "./node-CkBWRjNR.js";
2
- import { r as Package } from "./package-BUojjTXf.js";
3
- import "./read-CMDEXqGw.js";
4
- import "./write-CT-EgVT7.js";
5
- import "./parse-A8_8sdpX.js";
6
- import "./build-Z1KRkSEB.js";
7
- import "./fragment-B1ZV7T5Z.js";
8
- import "./util-DFe4UbvU.js";
9
- import "./compact-f0TfhicN.js";
10
- import "./color-fFIKAs-Y.js";
11
- import "./metadata-o_WH9V_I.js";
12
- import "./read-B2-FFhqI.js";
13
- import "./numbering-D0YfuiOO.js";
14
- import "./read-CeCtSzjQ.js";
15
- import "./xlsx-BxKODiLX.js";
16
- import "./content-t6ZfmfQM.js";
17
- import "./build-C0gS5QeG.js";
18
- import { z } from "zod";
19
- import { Alignment as Alignment$1, AlignmentSchema, Box as Box$1, BoxSchema, COLOR_BLACK as COLOR_BLACK$1, Color as Color$1, ColorSchema, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders as ContentCellBorders$1, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph as ContentParagraph$1, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema as ContentSectionSchema$1, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange as ContentSheetPrintRange$1, ContentSheetPrintRangeSchema, ContentSheetPrintSettings as ContentSheetPrintSettings$1, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange as ContentSheetRepeatRange$1, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema as ContentSlideSchema$1, ContentStrokeStyle, ContentStrokeStyleSchema, ContentTable as ContentTable$1, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, Margins, MarginsSchema, PAGE_SIZE_A4 as PAGE_SIZE_A4$1, PAGE_SIZE_LETTER as PAGE_SIZE_LETTER$1, PageSize as PageSize$1, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN as SLIDE_SIZE_WIDESCREEN$1, colorToRgbHex as colorToRgbHex$1, isContentBlock, rgbHexToColor as rgbHexToColor$1 } from "document-schema.js";
20
- //#region src/codec.d.ts
21
- declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
22
- type: z.ZodLiteral<"text">;
23
- value: z.ZodString;
24
- }, z.core.$strip>, z.ZodObject<{
25
- type: z.ZodLiteral<"cdata">;
26
- value: z.ZodString;
27
- }, z.core.$strip>, z.ZodObject<{
28
- type: z.ZodLiteral<"comment">;
29
- value: z.ZodString;
30
- }, z.core.$strip>, z.ZodObject<{
31
- type: z.ZodLiteral<"declaration">;
32
- attributes: z.ZodArray<z.ZodObject<{
33
- name: z.ZodString;
34
- value: z.ZodString;
35
- }, z.core.$strip>>;
36
- }, z.core.$strip>, z.ZodObject<{
37
- type: z.ZodLiteral<"pi">;
38
- target: z.ZodString;
39
- content: z.ZodString;
40
- }, z.core.$strip>, z.ZodObject<{
41
- type: z.ZodLiteral<"element">;
42
- tag: z.ZodString;
43
- attributes: z.ZodArray<z.ZodObject<{
44
- name: z.ZodString;
45
- value: z.ZodString;
46
- }, z.core.$strip>>;
47
- children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
48
- }, z.core.$strip>], "type">>>;
49
- declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodObject<{
50
- parts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
51
- kind: z.ZodLiteral<"xml">;
52
- nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
53
- type: z.ZodLiteral<"text">;
54
- value: z.ZodString;
55
- }, z.core.$strip>, z.ZodObject<{
56
- type: z.ZodLiteral<"cdata">;
57
- value: z.ZodString;
58
- }, z.core.$strip>, z.ZodObject<{
59
- type: z.ZodLiteral<"comment">;
60
- value: z.ZodString;
61
- }, z.core.$strip>, z.ZodObject<{
62
- type: z.ZodLiteral<"declaration">;
63
- attributes: z.ZodArray<z.ZodObject<{
64
- name: z.ZodString;
65
- value: z.ZodString;
66
- }, z.core.$strip>>;
67
- }, z.core.$strip>, z.ZodObject<{
68
- type: z.ZodLiteral<"pi">;
69
- target: z.ZodString;
70
- content: z.ZodString;
71
- }, z.core.$strip>, z.ZodObject<{
72
- type: z.ZodLiteral<"element">;
73
- tag: z.ZodString;
74
- attributes: z.ZodArray<z.ZodObject<{
75
- name: z.ZodString;
76
- value: z.ZodString;
77
- }, z.core.$strip>>;
78
- children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
79
- }, z.core.$strip>], "type">>;
80
- }, z.core.$strip>, z.ZodObject<{
81
- kind: z.ZodLiteral<"binary">;
82
- base64: z.ZodString;
83
- }, z.core.$strip>], "kind">>;
84
- }, z.core.$strip>>;
85
- declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
86
- declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
87
- //#endregion
88
- export { ContentSlideSchema$1 as $, ContentRun as A, ContentSheetColumnSchema as B, ContentImageBlockSchema as C, ContentPageBreakSchema as D, ContentPageBreak as E, ContentShapeSchema as F, ContentSheetPrintSettings$1 as G, ContentSheetImageSchema as H, ContentSheet as I, ContentSheetRepeatRangeSchema as J, ContentSheetPrintSettingsSchema as K, ContentSheetCell as L, ContentSection as M, ContentSectionSchema$1 as N, ContentParagraph$1 as O, ContentShape as P, ContentSlide as Q, ContentSheetCellSchema as R, ContentImageBlock as S, ContentListMembershipSchema as T, ContentSheetPrintRange$1 as U, ContentSheetImage as V, ContentSheetPrintRangeSchema as W, ContentSheetRowSchema as X, ContentSheetRow as Y, ContentSheetSchema as Z, ContentCellBordersSchema as _, isContentBlock as _t, Alignment$1 as a, ContentTableRow as at, ContentDocument$1 as b, BoxSchema as c, Margins as ct, ColorSchema as d, PAGE_SIZE_LETTER$1 as dt, ContentStrokeStyle as et, ContentBlock$1 as f, PageSize$1 as ft, ContentCellBorders$1 as g, colorToRgbHex$1 as gt, ContentBorderSchema as h, SLIDE_SIZE_WIDESCREEN$1 as ht, xmlCodec as i, ContentTableCellSchema as it, ContentRunSchema as j, ContentParagraphSchema as k, COLOR_BLACK$1 as l, MarginsSchema as lt, ContentBorder as m, SLIDE_SIZE_STANDARD as mt, encodePackage as n, ContentTable$1 as nt, AlignmentSchema as o, ContentTableRowSchema as ot, ContentBlockSchema as p, PageSizeSchema as pt, ContentSheetRepeatRange$1 as q, packageCodec as r, ContentTableCell as rt, Box$1 as s, ContentTableSchema as st, decodePackage as t, ContentStrokeStyleSchema as tt, Color$1 as u, PAGE_SIZE_A4$1 as ut, ContentCellValue as v, rgbHexToColor$1 as vt, ContentListMembership as w, ContentDocumentSchema as x, ContentCellValueSchema as y, ContentSheetColumn as z };