ooxml.js 2.14.0 → 2.16.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.
package/README.md CHANGED
@@ -241,7 +241,7 @@ The package layers a lossless core outward to lossy convenience views:
241
241
 
242
242
  ## Gotchas and quirks
243
243
 
244
- - **`readDocx`/`readPptx` are not a round-trip path.** Numbering definitions, cell border styling/shading, and `w:themeColor` (without `themeShade`/`themeTint`) are read; images read into `ContentImageBlock` (floating `wp:anchor` position not recorded); `PAGE`/`NUMPAGES` fields resolve to Word's cached text. On pptx: connector shapes (`p:cxnSp`) are skipped; shape rotation composes through groups; a chart graphic frame reads its chart part's cached series/category model into a table block (header row = series names, one row per category index); SmartArt and OLE graphic frames come through with geometry but empty content.
244
+ - **`readDocx`/`readPptx` are not a round-trip path.** Numbering definitions, cell border styling/shading, and `w:themeColor` (without `themeShade`/`themeTint`) are read; images read into `ContentImageBlock` (floating `wp:anchor` position not recorded); `PAGE`/`NUMPAGES` fields resolve to Word's cached text. On pptx: connector shapes (`p:cxnSp`) are skipped; shape rotation composes through groups; a chart graphic frame reads its chart part's cached series/category model into a table block (header row = series names, one row per category index); a SmartArt graphic frame reads its diagram data model's node text as paragraphs in diagram order (depth-first over `parOf` connections, siblings by `srcOrd`); an OLE graphic frame reads the fallback picture its `mc:Fallback` carries (or, with none reachable, a paragraph naming the `p:oleObj`'s `progId`) — the embedded payload itself is an external application's data and is not decoded.
245
245
  - **xlsx has no native percentage/currency/date/time cell type.** Both directions are closed via the number-format engine: reading classifies style → format code → kind; writing emits interned `numFmt` codes, fed back through the classifier in tests. `displayText` is the typed-value spelling, not the producer's rendered string.
246
246
  - **`test:smoke` depends on a fresh build.** It runs `tsdown && vitest run --project smoke`, always rebuilding `dist/` first. A bare `vitest` runs both projects; `smoke` fails loudly (`Cannot find module '../dist/index.js'`) if `dist/` is unbuilt.
247
247
  - **Binary-vs-XML part classification is a byte sniff, not an extension check.** `looksLikeXml` looks for a leading `<` after skipping a UTF-8 BOM and whitespace; any future binary format starting with `<` would misclassify.
@@ -16,7 +16,7 @@ import "./xlsx-BxKODiLX.js";
16
16
  import "./content-t6ZfmfQM.js";
17
17
  import "./build-C0gS5QeG.js";
18
18
  import { z } from "zod";
19
- import { Alignment as Alignment$1, AlignmentSchema, Box as Box$1, BoxSchema, COLOR_BLACK as COLOR_BLACK$1, CONTENT_FORMAT_VERSION as CONTENT_FORMAT_VERSION$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, 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";
19
+ import { Alignment as Alignment$1, AlignmentSchema, Box as Box$1, BoxSchema, COLOR_BLACK as COLOR_BLACK$1, CONTENT_FORMAT_VERSION as CONTENT_FORMAT_VERSION$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
20
  //#region src/codec.d.ts
21
21
  declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
22
22
  type: z.ZodLiteral<"text">;
@@ -85,4 +85,4 @@ declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint
85
85
  declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
86
86
  declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
87
87
  //#endregion
88
- export { ContentSlide as $, ContentParagraphSchema as A, ContentSheetColumn as B, ContentImageBlock as C, ContentPageBreak as D, ContentListMembershipSchema as E, ContentShape as F, ContentSheetPrintRangeSchema as G, ContentSheetImage as H, ContentShapeSchema as I, ContentSheetRepeatRange$1 as J, ContentSheetPrintSettings$1 as K, ContentSheet as L, ContentRunSchema as M, ContentSection as N, ContentPageBreakSchema as O, ContentSectionSchema$1 as P, ContentSheetSchema as Q, ContentSheetCell as R, ContentDocumentSchema as S, ContentListMembership as T, ContentSheetImageSchema as U, ContentSheetColumnSchema as V, ContentSheetPrintRange$1 as W, ContentSheetRow as X, ContentSheetRepeatRangeSchema as Y, ContentSheetRowSchema as Z, ContentCellBorders$1 as _, colorToRgbHex$1 as _t, Alignment$1 as a, ContentTableCellSchema as at, ContentCellValueSchema as b, BoxSchema as c, ContentTableSchema as ct, Color$1 as d, PAGE_SIZE_A4$1 as dt, ContentSlideSchema$1 as et, ColorSchema as f, PAGE_SIZE_LETTER$1 as ft, ContentBorderSchema as g, SLIDE_SIZE_WIDESCREEN$1 as gt, ContentBorder as h, SLIDE_SIZE_STANDARD as ht, xmlCodec as i, ContentTableCell as it, ContentRun as j, ContentParagraph as k, COLOR_BLACK$1 as l, Margins as lt, ContentBlockSchema as m, PageSizeSchema as mt, encodePackage as n, ContentStrokeStyleSchema as nt, AlignmentSchema as o, ContentTableRow as ot, ContentBlock$1 as p, PageSize$1 as pt, ContentSheetPrintSettingsSchema as q, packageCodec as r, ContentTable$1 as rt, Box$1 as s, ContentTableRowSchema as st, decodePackage as t, ContentStrokeStyle as tt, CONTENT_FORMAT_VERSION$1 as u, MarginsSchema as ut, ContentCellBordersSchema as v, isContentBlock as vt, ContentImageBlockSchema as w, ContentDocument$1 as x, ContentCellValue as y, rgbHexToColor$1 as yt, ContentSheetCellSchema as z };
88
+ export { ContentSlide as $, ContentParagraphSchema as A, ContentSheetColumn as B, ContentImageBlock as C, ContentPageBreak as D, ContentListMembershipSchema as E, ContentShape as F, ContentSheetPrintRangeSchema as G, ContentSheetImage as H, ContentShapeSchema as I, ContentSheetRepeatRange$1 as J, ContentSheetPrintSettings$1 as K, ContentSheet as L, ContentRunSchema as M, ContentSection as N, ContentPageBreakSchema as O, ContentSectionSchema$1 as P, ContentSheetSchema as Q, ContentSheetCell as R, ContentDocumentSchema as S, ContentListMembership as T, ContentSheetImageSchema as U, ContentSheetColumnSchema as V, ContentSheetPrintRange$1 as W, ContentSheetRow as X, ContentSheetRepeatRangeSchema as Y, ContentSheetRowSchema as Z, ContentCellBorders$1 as _, colorToRgbHex$1 as _t, Alignment$1 as a, ContentTableCellSchema as at, ContentCellValueSchema as b, BoxSchema as c, ContentTableSchema as ct, Color$1 as d, PAGE_SIZE_A4$1 as dt, ContentSlideSchema$1 as et, ColorSchema as f, PAGE_SIZE_LETTER$1 as ft, ContentBorderSchema as g, SLIDE_SIZE_WIDESCREEN$1 as gt, ContentBorder as h, SLIDE_SIZE_STANDARD as ht, xmlCodec as i, ContentTableCell as it, ContentRun as j, ContentParagraph$1 as k, COLOR_BLACK$1 as l, Margins as lt, ContentBlockSchema as m, PageSizeSchema as mt, encodePackage as n, ContentStrokeStyleSchema as nt, AlignmentSchema as o, ContentTableRow as ot, ContentBlock$1 as p, PageSize$1 as pt, ContentSheetPrintSettingsSchema as q, packageCodec as r, ContentTable$1 as rt, Box$1 as s, ContentTableRowSchema as st, decodePackage as t, ContentStrokeStyle as tt, CONTENT_FORMAT_VERSION$1 as u, MarginsSchema as ut, ContentCellBordersSchema as v, isContentBlock as vt, ContentImageBlockSchema as w, ContentDocument$1 as x, ContentCellValue as y, rgbHexToColor$1 as yt, ContentSheetCellSchema as z };
@@ -16,7 +16,7 @@ import "./xlsx-B97t4YE-.cjs";
16
16
  import "./content-UlQ-Nhgi.cjs";
17
17
  import "./build-CBL9scQK.cjs";
18
18
  import { z } from "zod";
19
- import { Alignment as Alignment$1, AlignmentSchema, Box as Box$1, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, 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, 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";
19
+ import { Alignment as Alignment$1, AlignmentSchema, Box as Box$1, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, 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
20
  //#region src/codec.d.ts
21
21
  declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
22
22
  type: z.ZodLiteral<"text">;
@@ -85,4 +85,4 @@ declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint
85
85
  declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
86
86
  declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
87
87
  //#endregion
88
- export { ContentSlide as $, ContentParagraphSchema as A, ContentSheetColumn as B, ContentImageBlock as C, ContentPageBreak as D, ContentListMembershipSchema as E, ContentShape as F, ContentSheetPrintRangeSchema as G, ContentSheetImage as H, ContentShapeSchema as I, ContentSheetRepeatRange$1 as J, ContentSheetPrintSettings$1 as K, ContentSheet as L, ContentRunSchema as M, ContentSection as N, ContentPageBreakSchema as O, ContentSectionSchema as P, ContentSheetSchema as Q, ContentSheetCell as R, ContentDocumentSchema as S, ContentListMembership as T, ContentSheetImageSchema as U, ContentSheetColumnSchema as V, ContentSheetPrintRange$1 as W, ContentSheetRow as X, ContentSheetRepeatRangeSchema as Y, ContentSheetRowSchema as Z, ContentCellBorders$1 as _, colorToRgbHex as _t, Alignment$1 as a, ContentTableCellSchema as at, ContentCellValueSchema as b, BoxSchema as c, ContentTableSchema as ct, Color$1 as d, PAGE_SIZE_A4 as dt, ContentSlideSchema as et, ColorSchema as f, PAGE_SIZE_LETTER as ft, ContentBorderSchema as g, SLIDE_SIZE_WIDESCREEN as gt, ContentBorder as h, SLIDE_SIZE_STANDARD as ht, xmlCodec as i, ContentTableCell as it, ContentRun as j, ContentParagraph as k, COLOR_BLACK as l, Margins as lt, ContentBlockSchema as m, PageSizeSchema as mt, encodePackage as n, ContentStrokeStyleSchema as nt, AlignmentSchema as o, ContentTableRow as ot, ContentBlock$1 as p, PageSize$1 as pt, ContentSheetPrintSettingsSchema as q, packageCodec as r, ContentTable$1 as rt, Box$1 as s, ContentTableRowSchema as st, decodePackage as t, ContentStrokeStyle as tt, CONTENT_FORMAT_VERSION as u, MarginsSchema as ut, ContentCellBordersSchema as v, isContentBlock as vt, ContentImageBlockSchema as w, ContentDocument$1 as x, ContentCellValue as y, rgbHexToColor as yt, ContentSheetCellSchema as z };
88
+ export { ContentSlide as $, ContentParagraphSchema as A, ContentSheetColumn as B, ContentImageBlock as C, ContentPageBreak as D, ContentListMembershipSchema as E, ContentShape as F, ContentSheetPrintRangeSchema as G, ContentSheetImage as H, ContentShapeSchema as I, ContentSheetRepeatRange$1 as J, ContentSheetPrintSettings$1 as K, ContentSheet as L, ContentRunSchema as M, ContentSection as N, ContentPageBreakSchema as O, ContentSectionSchema as P, ContentSheetSchema as Q, ContentSheetCell as R, ContentDocumentSchema as S, ContentListMembership as T, ContentSheetImageSchema as U, ContentSheetColumnSchema as V, ContentSheetPrintRange$1 as W, ContentSheetRow as X, ContentSheetRepeatRangeSchema as Y, ContentSheetRowSchema as Z, ContentCellBorders$1 as _, colorToRgbHex as _t, Alignment$1 as a, ContentTableCellSchema as at, ContentCellValueSchema as b, BoxSchema as c, ContentTableSchema as ct, Color$1 as d, PAGE_SIZE_A4 as dt, ContentSlideSchema as et, ColorSchema as f, PAGE_SIZE_LETTER as ft, ContentBorderSchema as g, SLIDE_SIZE_WIDESCREEN as gt, ContentBorder as h, SLIDE_SIZE_STANDARD as ht, xmlCodec as i, ContentTableCell as it, ContentRun as j, ContentParagraph$1 as k, COLOR_BLACK as l, Margins as lt, ContentBlockSchema as m, PageSizeSchema as mt, encodePackage as n, ContentStrokeStyleSchema as nt, AlignmentSchema as o, ContentTableRow as ot, ContentBlock$1 as p, PageSize$1 as pt, ContentSheetPrintSettingsSchema as q, packageCodec as r, ContentTable$1 as rt, Box$1 as s, ContentTableRowSchema as st, decodePackage as t, ContentStrokeStyle as tt, CONTENT_FORMAT_VERSION as u, MarginsSchema as ut, ContentCellBordersSchema as v, isContentBlock as vt, ContentImageBlockSchema as w, ContentDocument$1 as x, ContentCellValue as y, rgbHexToColor as yt, ContentSheetCellSchema as z };
package/dist/codec.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-D-PdAEhr.cjs";
1
+ import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-D2Q5WkEd.cjs";
2
2
  export { decodePackage, encodePackage, packageCodec, xmlCodec };
package/dist/codec.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-3aIDwnZp.js";
1
+ import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-Ad7Qf290.js";
2
2
  export { decodePackage, encodePackage, packageCodec, xmlCodec };
package/dist/index.d.cts CHANGED
@@ -19,5 +19,5 @@ import { n as PptxDocumentSchema, r as readPptx, t as PptxDocument } from "./rea
19
19
  import { a as XlsxSheet, c as XlsxWorkbookSchema, i as XlsxCellSchema, l as readXlsx, n as DefinedNameSchema, o as XlsxSheetSchema, r as XlsxCell, s as XlsxWorkbook, t as DefinedName } from "./xlsx-B97t4YE-.cjs";
20
20
  import { t as readXlsxContent } from "./content-UlQ-Nhgi.cjs";
21
21
  import { t as buildXlsxPackage } from "./build-CBL9scQK.cjs";
22
- import { $ as ContentSlide, A as ContentParagraphSchema, B as ContentSheetColumn, C as ContentImageBlock, D as ContentPageBreak, E as ContentListMembershipSchema, F as ContentShape, G as ContentSheetPrintRangeSchema, H as ContentSheetImage, I as ContentShapeSchema, J as ContentSheetRepeatRange, K as ContentSheetPrintSettings, L as ContentSheet, M as ContentRunSchema, N as ContentSection, O as ContentPageBreakSchema, P as ContentSectionSchema, Q as ContentSheetSchema, R as ContentSheetCell, S as ContentDocumentSchema, T as ContentListMembership, U as ContentSheetImageSchema, V as ContentSheetColumnSchema, W as ContentSheetPrintRange, X as ContentSheetRow, Y as ContentSheetRepeatRangeSchema, Z as ContentSheetRowSchema, _ as ContentCellBorders, _t as colorToRgbHex, a as Alignment, at as ContentTableCellSchema, b as ContentCellValueSchema, c as BoxSchema, ct as ContentTableSchema, d as Color, dt as PAGE_SIZE_A4, et as ContentSlideSchema, f as ColorSchema, ft as PAGE_SIZE_LETTER, g as ContentBorderSchema, gt as SLIDE_SIZE_WIDESCREEN, h as ContentBorder, ht as SLIDE_SIZE_STANDARD, i as xmlCodec, it as ContentTableCell, j as ContentRun, k as ContentParagraph, l as COLOR_BLACK, lt as Margins, m as ContentBlockSchema, mt as PageSizeSchema, n as encodePackage, nt as ContentStrokeStyleSchema, o as AlignmentSchema, ot as ContentTableRow, p as ContentBlock, pt as PageSize, q as ContentSheetPrintSettingsSchema, r as packageCodec, rt as ContentTable, s as Box, st as ContentTableRowSchema, t as decodePackage, tt as ContentStrokeStyle, u as CONTENT_FORMAT_VERSION, ut as MarginsSchema, v as ContentCellBordersSchema, vt as isContentBlock, w as ContentImageBlockSchema, x as ContentDocument, y as ContentCellValue, yt as rgbHexToColor, z as ContentSheetCellSchema } from "./codec-D-PdAEhr.cjs";
22
+ import { $ as ContentSlide, A as ContentParagraphSchema, B as ContentSheetColumn, C as ContentImageBlock, D as ContentPageBreak, E as ContentListMembershipSchema, F as ContentShape, G as ContentSheetPrintRangeSchema, H as ContentSheetImage, I as ContentShapeSchema, J as ContentSheetRepeatRange, K as ContentSheetPrintSettings, L as ContentSheet, M as ContentRunSchema, N as ContentSection, O as ContentPageBreakSchema, P as ContentSectionSchema, Q as ContentSheetSchema, R as ContentSheetCell, S as ContentDocumentSchema, T as ContentListMembership, U as ContentSheetImageSchema, V as ContentSheetColumnSchema, W as ContentSheetPrintRange, X as ContentSheetRow, Y as ContentSheetRepeatRangeSchema, Z as ContentSheetRowSchema, _ as ContentCellBorders, _t as colorToRgbHex, a as Alignment, at as ContentTableCellSchema, b as ContentCellValueSchema, c as BoxSchema, ct as ContentTableSchema, d as Color, dt as PAGE_SIZE_A4, et as ContentSlideSchema, f as ColorSchema, ft as PAGE_SIZE_LETTER, g as ContentBorderSchema, gt as SLIDE_SIZE_WIDESCREEN, h as ContentBorder, ht as SLIDE_SIZE_STANDARD, i as xmlCodec, it as ContentTableCell, j as ContentRun, k as ContentParagraph, l as COLOR_BLACK, lt as Margins, m as ContentBlockSchema, mt as PageSizeSchema, n as encodePackage, nt as ContentStrokeStyleSchema, o as AlignmentSchema, ot as ContentTableRow, p as ContentBlock, pt as PageSize, q as ContentSheetPrintSettingsSchema, r as packageCodec, rt as ContentTable, s as Box, st as ContentTableRowSchema, t as decodePackage, tt as ContentStrokeStyle, u as CONTENT_FORMAT_VERSION, ut as MarginsSchema, v as ContentCellBordersSchema, vt as isContentBlock, w as ContentImageBlockSchema, x as ContentDocument, y as ContentCellValue, yt as rgbHexToColor, z as ContentSheetCellSchema } from "./codec-D2Q5WkEd.cjs";
23
23
  export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, type Color, ColorSchema, type ColorTransform, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type ContentBlock, ContentBlockSchema, type ContentBorder, ContentBorderSchema, type ContentCellBorders, ContentCellBordersSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, ContentDocumentSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, ContentListMembershipSchema, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, ContentSheetImageSchema, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStrokeStyle, ContentStrokeStyleSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type DefinedName, DefinedNameSchema, type DocumentMetadata, DocumentMetadataSchema, type DocxDocument, DocxDocumentSchema, type Footnote, FootnoteSchema, type ImageFormat, type Margins, MarginsSchema, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageSize, PageSizeSchema, type Part, PartSchema, type PptxDocument, PptxDocumentSchema, type Relationship, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, type XlsxCell, XlsxCellSchema, type XlsxSheet, XlsxSheetSchema, type XlsxWorkbook, XlsxWorkbookSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyColorTransforms, attr, base64ToBytes, buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, colorToRgbHex, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, el, elementsWithTag, encodeCompactPackage, encodePackage, encodeXmlText, fromCompact, isCompactXmlNode, isContentBlock, isXmlNode, packageCodec, parsePackage, parseXml, readDocx, readNumberingDefinitions, readPptx, readXlsx, readXlsxContent, resolveRelationships, rgbHexToColor, rootElement, serializePackage, sniffImageFormat, textContent, toCompact, txt, unzipPackage, walk, xmlCodec, zipPackage };
package/dist/index.d.ts CHANGED
@@ -19,5 +19,5 @@ import { n as PptxDocumentSchema, r as readPptx, t as PptxDocument } from "./rea
19
19
  import { a as XlsxSheet, c as XlsxWorkbookSchema, i as XlsxCellSchema, l as readXlsx, n as DefinedNameSchema, o as XlsxSheetSchema, r as XlsxCell, s as XlsxWorkbook, t as DefinedName } from "./xlsx-BxKODiLX.js";
20
20
  import { t as readXlsxContent } from "./content-t6ZfmfQM.js";
21
21
  import { t as buildXlsxPackage } from "./build-C0gS5QeG.js";
22
- import { $ as ContentSlide, A as ContentParagraphSchema, B as ContentSheetColumn, C as ContentImageBlock, D as ContentPageBreak, E as ContentListMembershipSchema, F as ContentShape, G as ContentSheetPrintRangeSchema, H as ContentSheetImage, I as ContentShapeSchema, J as ContentSheetRepeatRange, K as ContentSheetPrintSettings, L as ContentSheet, M as ContentRunSchema, N as ContentSection, O as ContentPageBreakSchema, P as ContentSectionSchema, Q as ContentSheetSchema, R as ContentSheetCell, S as ContentDocumentSchema, T as ContentListMembership, U as ContentSheetImageSchema, V as ContentSheetColumnSchema, W as ContentSheetPrintRange, X as ContentSheetRow, Y as ContentSheetRepeatRangeSchema, Z as ContentSheetRowSchema, _ as ContentCellBorders, _t as colorToRgbHex, a as Alignment, at as ContentTableCellSchema, b as ContentCellValueSchema, c as BoxSchema, ct as ContentTableSchema, d as Color, dt as PAGE_SIZE_A4, et as ContentSlideSchema, f as ColorSchema, ft as PAGE_SIZE_LETTER, g as ContentBorderSchema, gt as SLIDE_SIZE_WIDESCREEN, h as ContentBorder, ht as SLIDE_SIZE_STANDARD, i as xmlCodec, it as ContentTableCell, j as ContentRun, k as ContentParagraph, l as COLOR_BLACK, lt as Margins, m as ContentBlockSchema, mt as PageSizeSchema, n as encodePackage, nt as ContentStrokeStyleSchema, o as AlignmentSchema, ot as ContentTableRow, p as ContentBlock, pt as PageSize, q as ContentSheetPrintSettingsSchema, r as packageCodec, rt as ContentTable, s as Box, st as ContentTableRowSchema, t as decodePackage, tt as ContentStrokeStyle, u as CONTENT_FORMAT_VERSION, ut as MarginsSchema, v as ContentCellBordersSchema, vt as isContentBlock, w as ContentImageBlockSchema, x as ContentDocument, y as ContentCellValue, yt as rgbHexToColor, z as ContentSheetCellSchema } from "./codec-3aIDwnZp.js";
22
+ import { $ as ContentSlide, A as ContentParagraphSchema, B as ContentSheetColumn, C as ContentImageBlock, D as ContentPageBreak, E as ContentListMembershipSchema, F as ContentShape, G as ContentSheetPrintRangeSchema, H as ContentSheetImage, I as ContentShapeSchema, J as ContentSheetRepeatRange, K as ContentSheetPrintSettings, L as ContentSheet, M as ContentRunSchema, N as ContentSection, O as ContentPageBreakSchema, P as ContentSectionSchema, Q as ContentSheetSchema, R as ContentSheetCell, S as ContentDocumentSchema, T as ContentListMembership, U as ContentSheetImageSchema, V as ContentSheetColumnSchema, W as ContentSheetPrintRange, X as ContentSheetRow, Y as ContentSheetRepeatRangeSchema, Z as ContentSheetRowSchema, _ as ContentCellBorders, _t as colorToRgbHex, a as Alignment, at as ContentTableCellSchema, b as ContentCellValueSchema, c as BoxSchema, ct as ContentTableSchema, d as Color, dt as PAGE_SIZE_A4, et as ContentSlideSchema, f as ColorSchema, ft as PAGE_SIZE_LETTER, g as ContentBorderSchema, gt as SLIDE_SIZE_WIDESCREEN, h as ContentBorder, ht as SLIDE_SIZE_STANDARD, i as xmlCodec, it as ContentTableCell, j as ContentRun, k as ContentParagraph, l as COLOR_BLACK, lt as Margins, m as ContentBlockSchema, mt as PageSizeSchema, n as encodePackage, nt as ContentStrokeStyleSchema, o as AlignmentSchema, ot as ContentTableRow, p as ContentBlock, pt as PageSize, q as ContentSheetPrintSettingsSchema, r as packageCodec, rt as ContentTable, s as Box, st as ContentTableRowSchema, t as decodePackage, tt as ContentStrokeStyle, u as CONTENT_FORMAT_VERSION, ut as MarginsSchema, v as ContentCellBordersSchema, vt as isContentBlock, w as ContentImageBlockSchema, x as ContentDocument, y as ContentCellValue, yt as rgbHexToColor, z as ContentSheetCellSchema } from "./codec-Ad7Qf290.js";
23
23
  export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, type Color, ColorSchema, type ColorTransform, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type ContentBlock, ContentBlockSchema, type ContentBorder, ContentBorderSchema, type ContentCellBorders, ContentCellBordersSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, ContentDocumentSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, ContentListMembershipSchema, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, ContentSheetImageSchema, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStrokeStyle, ContentStrokeStyleSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type DefinedName, DefinedNameSchema, type DocumentMetadata, DocumentMetadataSchema, type DocxDocument, DocxDocumentSchema, type Footnote, FootnoteSchema, type ImageFormat, type Margins, MarginsSchema, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageSize, PageSizeSchema, type Part, PartSchema, type PptxDocument, PptxDocumentSchema, type Relationship, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, type XlsxCell, XlsxCellSchema, type XlsxSheet, XlsxSheetSchema, type XlsxWorkbook, XlsxWorkbookSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyColorTransforms, attr, base64ToBytes, buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, colorToRgbHex, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, el, elementsWithTag, encodeCompactPackage, encodePackage, encodeXmlText, fromCompact, isCompactXmlNode, isContentBlock, isXmlNode, packageCodec, parsePackage, parseXml, readDocx, readNumberingDefinitions, readPptx, readXlsx, readXlsxContent, resolveRelationships, rgbHexToColor, rootElement, serializePackage, sniffImageFormat, textContent, toCompact, txt, unzipPackage, walk, xmlCodec, zipPackage };
@@ -0,0 +1,72 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_typed_util = require("../util.cjs");
3
+ //#region src/typed/pptx/diagram.ts
4
+ function diagramTextParagraphs(txBody) {
5
+ if (txBody === void 0) return [];
6
+ return require_typed_util.childrenWithTag(txBody, "a:p").map((p) => {
7
+ const runs = [];
8
+ for (const child of p.children) {
9
+ if (child.type !== "element") continue;
10
+ if (child.tag === "a:r" || child.tag === "a:fld") {
11
+ const t = require_typed_util.childrenWithTag(child, "a:t")[0];
12
+ runs.push({ text: t === void 0 ? "" : require_typed_util.textContent(t) });
13
+ } else if (child.tag === "a:br") runs.push({ text: "\n" });
14
+ }
15
+ return {
16
+ kind: "paragraph",
17
+ runs
18
+ };
19
+ });
20
+ }
21
+ function readDiagramText(dataModelRoot) {
22
+ const ptLst = require_typed_util.childrenWithTag(dataModelRoot, "dgm:ptLst")[0];
23
+ const cxnLst = require_typed_util.childrenWithTag(dataModelRoot, "dgm:cxnLst")[0];
24
+ if (ptLst === void 0) return [];
25
+ const pointsByModelId = /* @__PURE__ */ new Map();
26
+ let docModelId;
27
+ for (const pt of require_typed_util.childrenWithTag(ptLst, "dgm:pt")) {
28
+ const modelId = require_typed_util.attr(pt, "modelId");
29
+ if (modelId === void 0) continue;
30
+ const type = require_typed_util.attr(pt, "type") ?? "node";
31
+ pointsByModelId.set(modelId, {
32
+ type,
33
+ txBody: require_typed_util.childrenWithTag(pt, "dgm:t")[0]
34
+ });
35
+ if (type === "doc") docModelId = modelId;
36
+ }
37
+ if (docModelId === void 0) return [];
38
+ const childrenBySrcId = /* @__PURE__ */ new Map();
39
+ if (cxnLst !== void 0) for (const cxn of require_typed_util.childrenWithTag(cxnLst, "dgm:cxn")) {
40
+ if ((require_typed_util.attr(cxn, "type") ?? "parOf") !== "parOf") continue;
41
+ const srcId = require_typed_util.attr(cxn, "srcId");
42
+ const destId = require_typed_util.attr(cxn, "destId");
43
+ if (srcId === void 0 || destId === void 0) continue;
44
+ const srcOrd = require_typed_util.attr(cxn, "srcOrd");
45
+ const siblings = childrenBySrcId.get(srcId);
46
+ const edge = {
47
+ destId,
48
+ srcOrd: srcOrd === void 0 ? 0 : Number(srcOrd)
49
+ };
50
+ if (siblings === void 0) childrenBySrcId.set(srcId, [edge]);
51
+ else siblings.push(edge);
52
+ }
53
+ const blocks = [];
54
+ const visited = /* @__PURE__ */ new Set();
55
+ const visit = (modelId) => {
56
+ if (visited.has(modelId)) return;
57
+ visited.add(modelId);
58
+ const point = pointsByModelId.get(modelId);
59
+ if (point !== void 0 && (point.type === "node" || point.type === "asst")) {
60
+ const paragraphs = diagramTextParagraphs(point.txBody);
61
+ if (paragraphs.some((p) => p.runs.some((run) => run.text !== ""))) blocks.push(...paragraphs);
62
+ }
63
+ const children = childrenBySrcId.get(modelId);
64
+ if (children === void 0) return;
65
+ children.sort((a, b) => a.srcOrd - b.srcOrd);
66
+ for (const child of children) visit(child.destId);
67
+ };
68
+ visit(docModelId);
69
+ return blocks;
70
+ }
71
+ //#endregion
72
+ exports.readDiagramText = readDiagramText;
@@ -0,0 +1,6 @@
1
+ import { l as XmlElement } from "../../node-CkBWRjNR.cjs";
2
+ import { ContentParagraph } from "document-schema.js";
3
+ //#region src/typed/pptx/diagram.d.ts
4
+ declare function readDiagramText(dataModelRoot: XmlElement): ContentParagraph[];
5
+ //#endregion
6
+ export { readDiagramText };
@@ -0,0 +1,6 @@
1
+ import { l as XmlElement } from "../../node-CkBWRjNR.js";
2
+ import { ContentParagraph } from "document-schema.js";
3
+ //#region src/typed/pptx/diagram.d.ts
4
+ declare function readDiagramText(dataModelRoot: XmlElement): ContentParagraph[];
5
+ //#endregion
6
+ export { readDiagramText };
@@ -0,0 +1,71 @@
1
+ import { attr, childrenWithTag, textContent } from "../util.js";
2
+ //#region src/typed/pptx/diagram.ts
3
+ function diagramTextParagraphs(txBody) {
4
+ if (txBody === void 0) return [];
5
+ return childrenWithTag(txBody, "a:p").map((p) => {
6
+ const runs = [];
7
+ for (const child of p.children) {
8
+ if (child.type !== "element") continue;
9
+ if (child.tag === "a:r" || child.tag === "a:fld") {
10
+ const t = childrenWithTag(child, "a:t")[0];
11
+ runs.push({ text: t === void 0 ? "" : textContent(t) });
12
+ } else if (child.tag === "a:br") runs.push({ text: "\n" });
13
+ }
14
+ return {
15
+ kind: "paragraph",
16
+ runs
17
+ };
18
+ });
19
+ }
20
+ function readDiagramText(dataModelRoot) {
21
+ const ptLst = childrenWithTag(dataModelRoot, "dgm:ptLst")[0];
22
+ const cxnLst = childrenWithTag(dataModelRoot, "dgm:cxnLst")[0];
23
+ if (ptLst === void 0) return [];
24
+ const pointsByModelId = /* @__PURE__ */ new Map();
25
+ let docModelId;
26
+ for (const pt of childrenWithTag(ptLst, "dgm:pt")) {
27
+ const modelId = attr(pt, "modelId");
28
+ if (modelId === void 0) continue;
29
+ const type = attr(pt, "type") ?? "node";
30
+ pointsByModelId.set(modelId, {
31
+ type,
32
+ txBody: childrenWithTag(pt, "dgm:t")[0]
33
+ });
34
+ if (type === "doc") docModelId = modelId;
35
+ }
36
+ if (docModelId === void 0) return [];
37
+ const childrenBySrcId = /* @__PURE__ */ new Map();
38
+ if (cxnLst !== void 0) for (const cxn of childrenWithTag(cxnLst, "dgm:cxn")) {
39
+ if ((attr(cxn, "type") ?? "parOf") !== "parOf") continue;
40
+ const srcId = attr(cxn, "srcId");
41
+ const destId = attr(cxn, "destId");
42
+ if (srcId === void 0 || destId === void 0) continue;
43
+ const srcOrd = attr(cxn, "srcOrd");
44
+ const siblings = childrenBySrcId.get(srcId);
45
+ const edge = {
46
+ destId,
47
+ srcOrd: srcOrd === void 0 ? 0 : Number(srcOrd)
48
+ };
49
+ if (siblings === void 0) childrenBySrcId.set(srcId, [edge]);
50
+ else siblings.push(edge);
51
+ }
52
+ const blocks = [];
53
+ const visited = /* @__PURE__ */ new Set();
54
+ const visit = (modelId) => {
55
+ if (visited.has(modelId)) return;
56
+ visited.add(modelId);
57
+ const point = pointsByModelId.get(modelId);
58
+ if (point !== void 0 && (point.type === "node" || point.type === "asst")) {
59
+ const paragraphs = diagramTextParagraphs(point.txBody);
60
+ if (paragraphs.some((p) => p.runs.some((run) => run.text !== ""))) blocks.push(...paragraphs);
61
+ }
62
+ const children = childrenBySrcId.get(modelId);
63
+ if (children === void 0) return;
64
+ children.sort((a, b) => a.srcOrd - b.srcOrd);
65
+ for (const child of children) visit(child.destId);
66
+ };
67
+ visit(docModelId);
68
+ return blocks;
69
+ }
70
+ //#endregion
71
+ export { readDiagramText };
@@ -8,6 +8,7 @@ const require_typed_shared_drawingml = require("../shared/drawingml.cjs");
8
8
  const require_typed_shared_source_path = require("../shared/source-path.cjs");
9
9
  const require_typed_pptx_inherit = require("./inherit.cjs");
10
10
  const require_typed_pptx_chart = require("./chart.cjs");
11
+ const require_typed_pptx_diagram = require("./diagram.cjs");
11
12
  let zod = require("zod");
12
13
  let document_schema_js = require("document-schema.js");
13
14
  //#region src/typed/pptx/read.ts
@@ -18,6 +19,8 @@ const PptxDocumentSchema = zod.z.object({
18
19
  const PRESENTATION_PATH = "ppt/presentation.xml";
19
20
  const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
20
21
  const CHART_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
22
+ const DIAGRAM_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/diagram";
23
+ const OLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/presentationml/2006/ole";
21
24
  function readSlideSize(presentationRoot) {
22
25
  const sldSz = presentationRoot === void 0 ? void 0 : require_typed_util.childrenWithTag(presentationRoot, "p:sldSz")[0];
23
26
  const cx = sldSz === void 0 ? void 0 : require_typed_util.attr(sldSz, "cx");
@@ -193,29 +196,26 @@ function readSpShape(sp, context, slideRels, parentTransform) {
193
196
  blocks
194
197
  };
195
198
  }
196
- function readPicShape(pic, context, slideRels, pkg, parentTransform) {
197
- const resolved = resolveShapeFrame(pic, context, parentTransform);
198
- if (resolved === void 0) return;
199
- const blipFill = require_typed_util.childrenWithTag(pic, "p:blipFill")[0];
200
- const blip = blipFill === void 0 ? void 0 : require_typed_util.childrenWithTag(blipFill, "a:blip")[0];
199
+ function readBlipImage(parent, slideRels, pkg, frame) {
200
+ const blip = require_typed_util.elementsWithTag([parent], "a:blip")[0];
201
201
  const rId = blip === void 0 ? void 0 : require_typed_util.attr(blip, "r:embed");
202
202
  const rel = rId === void 0 ? void 0 : slideRels.get(rId);
203
203
  const mediaPart = rel === void 0 ? void 0 : pkg.parts[rel.target];
204
- const blocks = [];
205
- if (mediaPart?.kind === "binary") {
206
- const bytes = require_util_base64.base64ToBytes(mediaPart.base64);
207
- const format = require_image_sniff.sniffImageFormat(bytes);
208
- if (format !== void 0) {
209
- const image = {
210
- kind: "image",
211
- format,
212
- base64: mediaPart.base64,
213
- widthPt: resolved.frame.widthPt,
214
- heightPt: resolved.frame.heightPt
215
- };
216
- blocks.push(image);
217
- }
218
- }
204
+ if (mediaPart?.kind !== "binary") return;
205
+ const format = require_image_sniff.sniffImageFormat(require_util_base64.base64ToBytes(mediaPart.base64));
206
+ return format === void 0 ? void 0 : {
207
+ kind: "image",
208
+ format,
209
+ base64: mediaPart.base64,
210
+ widthPt: frame.widthPt,
211
+ heightPt: frame.heightPt
212
+ };
213
+ }
214
+ function readPicShape(pic, context, slideRels, pkg, parentTransform) {
215
+ const resolved = resolveShapeFrame(pic, context, parentTransform);
216
+ if (resolved === void 0) return;
217
+ const image = readBlipImage(pic, slideRels, pkg, resolved.frame);
218
+ const blocks = image === void 0 ? [] : [image];
219
219
  return {
220
220
  name: shapeName(pic),
221
221
  frame: resolved.frame,
@@ -284,6 +284,21 @@ function readGraphicFrameShape(gf, context, slideRels, pkg, parentTransform) {
284
284
  const chartRoot = relatedPartRoot(chartRef === void 0 ? void 0 : require_typed_util.attr(chartRef, "r:id"), slideRels, pkg);
285
285
  const chartTable = chartRoot === void 0 ? void 0 : require_typed_pptx_chart.readChartTable(chartRoot, frame);
286
286
  blocks = chartTable === void 0 ? [] : [chartTable];
287
+ } else if (uri === DIAGRAM_GRAPHIC_URI && graphicData !== void 0) {
288
+ const relIds = require_typed_util.childrenWithTag(graphicData, "dgm:relIds")[0];
289
+ const dataModelRoot = relatedPartRoot(relIds === void 0 ? void 0 : require_typed_util.attr(relIds, "r:dm"), slideRels, pkg);
290
+ blocks = dataModelRoot === void 0 ? [] : require_typed_pptx_diagram.readDiagramText(dataModelRoot);
291
+ } else if (uri === OLE_GRAPHIC_URI && graphicData !== void 0) {
292
+ const image = readBlipImage(graphicData, slideRels, pkg, frame);
293
+ if (image !== void 0) blocks = [image];
294
+ else {
295
+ const oleObj = require_typed_util.elementsWithTag([graphicData], "p:oleObj")[0];
296
+ const progId = oleObj === void 0 ? void 0 : require_typed_util.attr(oleObj, "progId");
297
+ blocks = progId === void 0 ? [] : [{
298
+ kind: "paragraph",
299
+ runs: [{ text: progId }]
300
+ }];
301
+ }
287
302
  } else blocks = [];
288
303
  return {
289
304
  name: shapeName(gf),
@@ -7,6 +7,7 @@ import { applyGroupTransform, composeGroupTransform, composeShapeRotationDeg, re
7
7
  import { assignSourcePaths } from "../shared/source-path.js";
8
8
  import { readPlaceholderKey, readRunPropertiesFromElement, resolveDefaultRunProperties, resolvePlaceholderXfrm, resolveSlideInheritance } from "./inherit.js";
9
9
  import { readChartTable } from "./chart.js";
10
+ import { readDiagramText } from "./diagram.js";
10
11
  import { z } from "zod";
11
12
  import { ContentSlideSchema, SLIDE_SIZE_WIDESCREEN } from "document-schema.js";
12
13
  //#region src/typed/pptx/read.ts
@@ -17,6 +18,8 @@ const PptxDocumentSchema = z.object({
17
18
  const PRESENTATION_PATH = "ppt/presentation.xml";
18
19
  const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
19
20
  const CHART_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
21
+ const DIAGRAM_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/diagram";
22
+ const OLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/presentationml/2006/ole";
20
23
  function readSlideSize(presentationRoot) {
21
24
  const sldSz = presentationRoot === void 0 ? void 0 : childrenWithTag(presentationRoot, "p:sldSz")[0];
22
25
  const cx = sldSz === void 0 ? void 0 : attr(sldSz, "cx");
@@ -192,29 +195,26 @@ function readSpShape(sp, context, slideRels, parentTransform) {
192
195
  blocks
193
196
  };
194
197
  }
195
- function readPicShape(pic, context, slideRels, pkg, parentTransform) {
196
- const resolved = resolveShapeFrame(pic, context, parentTransform);
197
- if (resolved === void 0) return;
198
- const blipFill = childrenWithTag(pic, "p:blipFill")[0];
199
- const blip = blipFill === void 0 ? void 0 : childrenWithTag(blipFill, "a:blip")[0];
198
+ function readBlipImage(parent, slideRels, pkg, frame) {
199
+ const blip = elementsWithTag([parent], "a:blip")[0];
200
200
  const rId = blip === void 0 ? void 0 : attr(blip, "r:embed");
201
201
  const rel = rId === void 0 ? void 0 : slideRels.get(rId);
202
202
  const mediaPart = rel === void 0 ? void 0 : pkg.parts[rel.target];
203
- const blocks = [];
204
- if (mediaPart?.kind === "binary") {
205
- const bytes = base64ToBytes(mediaPart.base64);
206
- const format = sniffImageFormat(bytes);
207
- if (format !== void 0) {
208
- const image = {
209
- kind: "image",
210
- format,
211
- base64: mediaPart.base64,
212
- widthPt: resolved.frame.widthPt,
213
- heightPt: resolved.frame.heightPt
214
- };
215
- blocks.push(image);
216
- }
217
- }
203
+ if (mediaPart?.kind !== "binary") return;
204
+ const format = sniffImageFormat(base64ToBytes(mediaPart.base64));
205
+ return format === void 0 ? void 0 : {
206
+ kind: "image",
207
+ format,
208
+ base64: mediaPart.base64,
209
+ widthPt: frame.widthPt,
210
+ heightPt: frame.heightPt
211
+ };
212
+ }
213
+ function readPicShape(pic, context, slideRels, pkg, parentTransform) {
214
+ const resolved = resolveShapeFrame(pic, context, parentTransform);
215
+ if (resolved === void 0) return;
216
+ const image = readBlipImage(pic, slideRels, pkg, resolved.frame);
217
+ const blocks = image === void 0 ? [] : [image];
218
218
  return {
219
219
  name: shapeName(pic),
220
220
  frame: resolved.frame,
@@ -283,6 +283,21 @@ function readGraphicFrameShape(gf, context, slideRels, pkg, parentTransform) {
283
283
  const chartRoot = relatedPartRoot(chartRef === void 0 ? void 0 : attr(chartRef, "r:id"), slideRels, pkg);
284
284
  const chartTable = chartRoot === void 0 ? void 0 : readChartTable(chartRoot, frame);
285
285
  blocks = chartTable === void 0 ? [] : [chartTable];
286
+ } else if (uri === DIAGRAM_GRAPHIC_URI && graphicData !== void 0) {
287
+ const relIds = childrenWithTag(graphicData, "dgm:relIds")[0];
288
+ const dataModelRoot = relatedPartRoot(relIds === void 0 ? void 0 : attr(relIds, "r:dm"), slideRels, pkg);
289
+ blocks = dataModelRoot === void 0 ? [] : readDiagramText(dataModelRoot);
290
+ } else if (uri === OLE_GRAPHIC_URI && graphicData !== void 0) {
291
+ const image = readBlipImage(graphicData, slideRels, pkg, frame);
292
+ if (image !== void 0) blocks = [image];
293
+ else {
294
+ const oleObj = elementsWithTag([graphicData], "p:oleObj")[0];
295
+ const progId = oleObj === void 0 ? void 0 : attr(oleObj, "progId");
296
+ blocks = progId === void 0 ? [] : [{
297
+ kind: "paragraph",
298
+ runs: [{ text: progId }]
299
+ }];
300
+ }
286
301
  } else blocks = [];
287
302
  return {
288
303
  name: shapeName(gf),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml.js",
3
- "version": "2.14.0",
3
+ "version": "2.16.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": {