ooxml.js 2.13.0 → 2.14.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 +1 -1
- package/dist/{codec-BrcAFCYO.d.ts → codec-3aIDwnZp.d.ts} +2 -2
- package/dist/{codec-BK9uVOS_.d.cts → codec-D-PdAEhr.d.cts} +2 -2
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/typed/pptx/chart.cjs +64 -0
- package/dist/typed/pptx/chart.d.cts +6 -0
- package/dist/typed/pptx/chart.d.ts +6 -0
- package/dist/typed/pptx/chart.js +63 -0
- package/dist/typed/pptx/read.cjs +19 -4
- package/dist/typed/pptx/read.js +19 -4
- package/package.json +2 -2
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;
|
|
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.
|
|
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, 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, 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 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 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, 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, 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 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 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-
|
|
1
|
+
import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-D-PdAEhr.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-
|
|
1
|
+
import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-3aIDwnZp.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-
|
|
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";
|
|
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-
|
|
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";
|
|
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,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_typed_util = require("../util.cjs");
|
|
3
|
+
//#region src/typed/pptx/chart.ts
|
|
4
|
+
function readCachedPoints(source) {
|
|
5
|
+
const numRef = require_typed_util.childrenWithTag(source, "c:numRef")[0];
|
|
6
|
+
const strRef = require_typed_util.childrenWithTag(source, "c:strRef")[0];
|
|
7
|
+
const multiLvlStrRef = require_typed_util.childrenWithTag(source, "c:multiLvlStrRef")[0];
|
|
8
|
+
let ptHolder;
|
|
9
|
+
if (numRef !== void 0) ptHolder = require_typed_util.childrenWithTag(numRef, "c:numCache")[0];
|
|
10
|
+
else if (strRef !== void 0) ptHolder = require_typed_util.childrenWithTag(strRef, "c:strCache")[0];
|
|
11
|
+
else if (multiLvlStrRef !== void 0) {
|
|
12
|
+
const multiLvlStrCache = require_typed_util.childrenWithTag(multiLvlStrRef, "c:multiLvlStrCache")[0];
|
|
13
|
+
ptHolder = multiLvlStrCache === void 0 ? void 0 : require_typed_util.childrenWithTag(multiLvlStrCache, "c:lvl").at(-1);
|
|
14
|
+
} else ptHolder = source;
|
|
15
|
+
const points = /* @__PURE__ */ new Map();
|
|
16
|
+
if (ptHolder === void 0) return points;
|
|
17
|
+
for (const pt of require_typed_util.childrenWithTag(ptHolder, "c:pt")) {
|
|
18
|
+
const idx = require_typed_util.attr(pt, "idx");
|
|
19
|
+
const v = require_typed_util.childrenWithTag(pt, "c:v")[0];
|
|
20
|
+
if (idx !== void 0 && v !== void 0) points.set(Number(idx), require_typed_util.textContent(v));
|
|
21
|
+
}
|
|
22
|
+
return points;
|
|
23
|
+
}
|
|
24
|
+
function readSeriesName(ser) {
|
|
25
|
+
const tx = require_typed_util.childrenWithTag(ser, "c:tx")[0];
|
|
26
|
+
if (tx === void 0) return;
|
|
27
|
+
const literal = require_typed_util.childrenWithTag(tx, "c:v")[0];
|
|
28
|
+
return literal === void 0 ? readCachedPoints(tx).get(0) : require_typed_util.textContent(literal);
|
|
29
|
+
}
|
|
30
|
+
function readSeries(ser) {
|
|
31
|
+
const catSource = require_typed_util.childrenWithTag(ser, "c:cat")[0] ?? require_typed_util.childrenWithTag(ser, "c:xVal")[0];
|
|
32
|
+
const valSource = require_typed_util.childrenWithTag(ser, "c:val")[0] ?? require_typed_util.childrenWithTag(ser, "c:yVal")[0];
|
|
33
|
+
return {
|
|
34
|
+
name: readSeriesName(ser),
|
|
35
|
+
categories: catSource === void 0 ? /* @__PURE__ */ new Map() : readCachedPoints(catSource),
|
|
36
|
+
values: valSource === void 0 ? /* @__PURE__ */ new Map() : readCachedPoints(valSource)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function labelCell(text) {
|
|
40
|
+
if (text === void 0 || text === "") return { blocks: [] };
|
|
41
|
+
return { blocks: [{
|
|
42
|
+
kind: "paragraph",
|
|
43
|
+
runs: [{ text }]
|
|
44
|
+
}] };
|
|
45
|
+
}
|
|
46
|
+
function readChartTable(chartRoot, frame) {
|
|
47
|
+
const chart = require_typed_util.childrenWithTag(chartRoot, "c:chart")[0];
|
|
48
|
+
const plotArea = chart === void 0 ? void 0 : require_typed_util.childrenWithTag(chart, "c:plotArea")[0];
|
|
49
|
+
if (plotArea === void 0) return;
|
|
50
|
+
const series = require_typed_util.elementsWithTag([plotArea], "c:ser").map(readSeries);
|
|
51
|
+
if (series.length === 0) return;
|
|
52
|
+
const categories = /* @__PURE__ */ new Map();
|
|
53
|
+
for (const s of series) for (const [idx, label] of s.categories) if (!categories.has(idx)) categories.set(idx, label);
|
|
54
|
+
const orderedIndexes = [...categories.keys()].sort((a, b) => a - b);
|
|
55
|
+
const rows = [{ cells: [labelCell(void 0), ...series.map((s) => labelCell(s.name))] }, ...orderedIndexes.map((idx) => ({ cells: [labelCell(categories.get(idx)), ...series.map((s) => labelCell(s.values.get(idx)))] }))];
|
|
56
|
+
const columnWidthPt = frame.widthPt / (series.length + 1);
|
|
57
|
+
return {
|
|
58
|
+
kind: "table",
|
|
59
|
+
rows,
|
|
60
|
+
columnWidthsPt: Array.from({ length: series.length + 1 }, () => columnWidthPt)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.readChartTable = readChartTable;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { l as XmlElement } from "../../node-CkBWRjNR.cjs";
|
|
2
|
+
import { Box, ContentTable } from "document-schema.js";
|
|
3
|
+
//#region src/typed/pptx/chart.d.ts
|
|
4
|
+
declare function readChartTable(chartRoot: XmlElement, frame: Box): ContentTable | undefined;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { readChartTable };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { l as XmlElement } from "../../node-CkBWRjNR.js";
|
|
2
|
+
import { Box, ContentTable } from "document-schema.js";
|
|
3
|
+
//#region src/typed/pptx/chart.d.ts
|
|
4
|
+
declare function readChartTable(chartRoot: XmlElement, frame: Box): ContentTable | undefined;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { readChartTable };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { attr, childrenWithTag, elementsWithTag, textContent } from "../util.js";
|
|
2
|
+
//#region src/typed/pptx/chart.ts
|
|
3
|
+
function readCachedPoints(source) {
|
|
4
|
+
const numRef = childrenWithTag(source, "c:numRef")[0];
|
|
5
|
+
const strRef = childrenWithTag(source, "c:strRef")[0];
|
|
6
|
+
const multiLvlStrRef = childrenWithTag(source, "c:multiLvlStrRef")[0];
|
|
7
|
+
let ptHolder;
|
|
8
|
+
if (numRef !== void 0) ptHolder = childrenWithTag(numRef, "c:numCache")[0];
|
|
9
|
+
else if (strRef !== void 0) ptHolder = childrenWithTag(strRef, "c:strCache")[0];
|
|
10
|
+
else if (multiLvlStrRef !== void 0) {
|
|
11
|
+
const multiLvlStrCache = childrenWithTag(multiLvlStrRef, "c:multiLvlStrCache")[0];
|
|
12
|
+
ptHolder = multiLvlStrCache === void 0 ? void 0 : childrenWithTag(multiLvlStrCache, "c:lvl").at(-1);
|
|
13
|
+
} else ptHolder = source;
|
|
14
|
+
const points = /* @__PURE__ */ new Map();
|
|
15
|
+
if (ptHolder === void 0) return points;
|
|
16
|
+
for (const pt of childrenWithTag(ptHolder, "c:pt")) {
|
|
17
|
+
const idx = attr(pt, "idx");
|
|
18
|
+
const v = childrenWithTag(pt, "c:v")[0];
|
|
19
|
+
if (idx !== void 0 && v !== void 0) points.set(Number(idx), textContent(v));
|
|
20
|
+
}
|
|
21
|
+
return points;
|
|
22
|
+
}
|
|
23
|
+
function readSeriesName(ser) {
|
|
24
|
+
const tx = childrenWithTag(ser, "c:tx")[0];
|
|
25
|
+
if (tx === void 0) return;
|
|
26
|
+
const literal = childrenWithTag(tx, "c:v")[0];
|
|
27
|
+
return literal === void 0 ? readCachedPoints(tx).get(0) : textContent(literal);
|
|
28
|
+
}
|
|
29
|
+
function readSeries(ser) {
|
|
30
|
+
const catSource = childrenWithTag(ser, "c:cat")[0] ?? childrenWithTag(ser, "c:xVal")[0];
|
|
31
|
+
const valSource = childrenWithTag(ser, "c:val")[0] ?? childrenWithTag(ser, "c:yVal")[0];
|
|
32
|
+
return {
|
|
33
|
+
name: readSeriesName(ser),
|
|
34
|
+
categories: catSource === void 0 ? /* @__PURE__ */ new Map() : readCachedPoints(catSource),
|
|
35
|
+
values: valSource === void 0 ? /* @__PURE__ */ new Map() : readCachedPoints(valSource)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function labelCell(text) {
|
|
39
|
+
if (text === void 0 || text === "") return { blocks: [] };
|
|
40
|
+
return { blocks: [{
|
|
41
|
+
kind: "paragraph",
|
|
42
|
+
runs: [{ text }]
|
|
43
|
+
}] };
|
|
44
|
+
}
|
|
45
|
+
function readChartTable(chartRoot, frame) {
|
|
46
|
+
const chart = childrenWithTag(chartRoot, "c:chart")[0];
|
|
47
|
+
const plotArea = chart === void 0 ? void 0 : childrenWithTag(chart, "c:plotArea")[0];
|
|
48
|
+
if (plotArea === void 0) return;
|
|
49
|
+
const series = elementsWithTag([plotArea], "c:ser").map(readSeries);
|
|
50
|
+
if (series.length === 0) return;
|
|
51
|
+
const categories = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const s of series) for (const [idx, label] of s.categories) if (!categories.has(idx)) categories.set(idx, label);
|
|
53
|
+
const orderedIndexes = [...categories.keys()].sort((a, b) => a - b);
|
|
54
|
+
const rows = [{ cells: [labelCell(void 0), ...series.map((s) => labelCell(s.name))] }, ...orderedIndexes.map((idx) => ({ cells: [labelCell(categories.get(idx)), ...series.map((s) => labelCell(s.values.get(idx)))] }))];
|
|
55
|
+
const columnWidthPt = frame.widthPt / (series.length + 1);
|
|
56
|
+
return {
|
|
57
|
+
kind: "table",
|
|
58
|
+
rows,
|
|
59
|
+
columnWidthsPt: Array.from({ length: series.length + 1 }, () => columnWidthPt)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { readChartTable };
|
package/dist/typed/pptx/read.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const require_typed_shared_units = require("../shared/units.cjs");
|
|
|
7
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
|
+
const require_typed_pptx_chart = require("./chart.cjs");
|
|
10
11
|
let zod = require("zod");
|
|
11
12
|
let document_schema_js = require("document-schema.js");
|
|
12
13
|
//#region src/typed/pptx/read.ts
|
|
@@ -16,6 +17,7 @@ const PptxDocumentSchema = zod.z.object({
|
|
|
16
17
|
});
|
|
17
18
|
const PRESENTATION_PATH = "ppt/presentation.xml";
|
|
18
19
|
const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
|
|
20
|
+
const CHART_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
19
21
|
function readSlideSize(presentationRoot) {
|
|
20
22
|
const sldSz = presentationRoot === void 0 ? void 0 : require_typed_util.childrenWithTag(presentationRoot, "p:sldSz")[0];
|
|
21
23
|
const cx = sldSz === void 0 ? void 0 : require_typed_util.attr(sldSz, "cx");
|
|
@@ -254,7 +256,12 @@ function readTable(tbl, context, slideRels) {
|
|
|
254
256
|
columnWidthsPt
|
|
255
257
|
};
|
|
256
258
|
}
|
|
257
|
-
function
|
|
259
|
+
function relatedPartRoot(rId, slideRels, pkg) {
|
|
260
|
+
if (rId === void 0) return;
|
|
261
|
+
const rel = slideRels.get(rId);
|
|
262
|
+
return rel === void 0 ? void 0 : require_typed_util.rootElement(pkg.parts[rel.target]);
|
|
263
|
+
}
|
|
264
|
+
function readGraphicFrameShape(gf, context, slideRels, pkg, parentTransform) {
|
|
258
265
|
const xfrm = require_typed_shared_drawingml.readXfrm(require_typed_util.childrenWithTag(gf, "p:xfrm")[0]);
|
|
259
266
|
if (xfrm === void 0) return;
|
|
260
267
|
const localFrame = {
|
|
@@ -268,8 +275,16 @@ function readGraphicFrameShape(gf, context, slideRels, parentTransform) {
|
|
|
268
275
|
const rotationDeg = composedRotationDeg === 0 ? void 0 : composedRotationDeg;
|
|
269
276
|
const graphic = require_typed_util.childrenWithTag(gf, "a:graphic")[0];
|
|
270
277
|
const graphicData = graphic === void 0 ? void 0 : require_typed_util.childrenWithTag(graphic, "a:graphicData")[0];
|
|
271
|
-
const
|
|
272
|
-
const
|
|
278
|
+
const uri = graphicData === void 0 ? void 0 : require_typed_util.attr(graphicData, "uri");
|
|
279
|
+
const tbl = uri === TABLE_GRAPHIC_URI && graphicData !== void 0 ? require_typed_util.childrenWithTag(graphicData, "a:tbl")[0] : void 0;
|
|
280
|
+
let blocks;
|
|
281
|
+
if (tbl !== void 0) blocks = [readTable(tbl, context, slideRels)];
|
|
282
|
+
else if (uri === CHART_GRAPHIC_URI && graphicData !== void 0) {
|
|
283
|
+
const chartRef = require_typed_util.childrenWithTag(graphicData, "c:chart")[0];
|
|
284
|
+
const chartRoot = relatedPartRoot(chartRef === void 0 ? void 0 : require_typed_util.attr(chartRef, "r:id"), slideRels, pkg);
|
|
285
|
+
const chartTable = chartRoot === void 0 ? void 0 : require_typed_pptx_chart.readChartTable(chartRoot, frame);
|
|
286
|
+
blocks = chartTable === void 0 ? [] : [chartTable];
|
|
287
|
+
} else blocks = [];
|
|
273
288
|
return {
|
|
274
289
|
name: shapeName(gf),
|
|
275
290
|
frame,
|
|
@@ -288,7 +303,7 @@ function walkShapeTreeChildren(children, parentTransform, context, slideRels, pk
|
|
|
288
303
|
const shape = readPicShape(node, context, slideRels, pkg, parentTransform);
|
|
289
304
|
if (shape !== void 0) out.push(shape);
|
|
290
305
|
} else if (node.tag === "p:graphicFrame") {
|
|
291
|
-
const shape = readGraphicFrameShape(node, context, slideRels, parentTransform);
|
|
306
|
+
const shape = readGraphicFrameShape(node, context, slideRels, pkg, parentTransform);
|
|
292
307
|
if (shape !== void 0) out.push(shape);
|
|
293
308
|
} else if (node.tag === "p:grpSp") {
|
|
294
309
|
const grpSpPr = require_typed_util.childrenWithTag(node, "p:grpSpPr")[0];
|
package/dist/typed/pptx/read.js
CHANGED
|
@@ -6,6 +6,7 @@ import { drawingMlFontSizeToPt, emuToPt } from "../shared/units.js";
|
|
|
6
6
|
import { applyGroupTransform, composeGroupTransform, composeShapeRotationDeg, readGroupXfrm, readSolidFillColor, readXfrm } from "../shared/drawingml.js";
|
|
7
7
|
import { assignSourcePaths } from "../shared/source-path.js";
|
|
8
8
|
import { readPlaceholderKey, readRunPropertiesFromElement, resolveDefaultRunProperties, resolvePlaceholderXfrm, resolveSlideInheritance } from "./inherit.js";
|
|
9
|
+
import { readChartTable } from "./chart.js";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
import { ContentSlideSchema, SLIDE_SIZE_WIDESCREEN } from "document-schema.js";
|
|
11
12
|
//#region src/typed/pptx/read.ts
|
|
@@ -15,6 +16,7 @@ const PptxDocumentSchema = z.object({
|
|
|
15
16
|
});
|
|
16
17
|
const PRESENTATION_PATH = "ppt/presentation.xml";
|
|
17
18
|
const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
|
|
19
|
+
const CHART_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
18
20
|
function readSlideSize(presentationRoot) {
|
|
19
21
|
const sldSz = presentationRoot === void 0 ? void 0 : childrenWithTag(presentationRoot, "p:sldSz")[0];
|
|
20
22
|
const cx = sldSz === void 0 ? void 0 : attr(sldSz, "cx");
|
|
@@ -253,7 +255,12 @@ function readTable(tbl, context, slideRels) {
|
|
|
253
255
|
columnWidthsPt
|
|
254
256
|
};
|
|
255
257
|
}
|
|
256
|
-
function
|
|
258
|
+
function relatedPartRoot(rId, slideRels, pkg) {
|
|
259
|
+
if (rId === void 0) return;
|
|
260
|
+
const rel = slideRels.get(rId);
|
|
261
|
+
return rel === void 0 ? void 0 : rootElement(pkg.parts[rel.target]);
|
|
262
|
+
}
|
|
263
|
+
function readGraphicFrameShape(gf, context, slideRels, pkg, parentTransform) {
|
|
257
264
|
const xfrm = readXfrm(childrenWithTag(gf, "p:xfrm")[0]);
|
|
258
265
|
if (xfrm === void 0) return;
|
|
259
266
|
const localFrame = {
|
|
@@ -267,8 +274,16 @@ function readGraphicFrameShape(gf, context, slideRels, parentTransform) {
|
|
|
267
274
|
const rotationDeg = composedRotationDeg === 0 ? void 0 : composedRotationDeg;
|
|
268
275
|
const graphic = childrenWithTag(gf, "a:graphic")[0];
|
|
269
276
|
const graphicData = graphic === void 0 ? void 0 : childrenWithTag(graphic, "a:graphicData")[0];
|
|
270
|
-
const
|
|
271
|
-
const
|
|
277
|
+
const uri = graphicData === void 0 ? void 0 : attr(graphicData, "uri");
|
|
278
|
+
const tbl = uri === TABLE_GRAPHIC_URI && graphicData !== void 0 ? childrenWithTag(graphicData, "a:tbl")[0] : void 0;
|
|
279
|
+
let blocks;
|
|
280
|
+
if (tbl !== void 0) blocks = [readTable(tbl, context, slideRels)];
|
|
281
|
+
else if (uri === CHART_GRAPHIC_URI && graphicData !== void 0) {
|
|
282
|
+
const chartRef = childrenWithTag(graphicData, "c:chart")[0];
|
|
283
|
+
const chartRoot = relatedPartRoot(chartRef === void 0 ? void 0 : attr(chartRef, "r:id"), slideRels, pkg);
|
|
284
|
+
const chartTable = chartRoot === void 0 ? void 0 : readChartTable(chartRoot, frame);
|
|
285
|
+
blocks = chartTable === void 0 ? [] : [chartTable];
|
|
286
|
+
} else blocks = [];
|
|
272
287
|
return {
|
|
273
288
|
name: shapeName(gf),
|
|
274
289
|
frame,
|
|
@@ -287,7 +302,7 @@ function walkShapeTreeChildren(children, parentTransform, context, slideRels, pk
|
|
|
287
302
|
const shape = readPicShape(node, context, slideRels, pkg, parentTransform);
|
|
288
303
|
if (shape !== void 0) out.push(shape);
|
|
289
304
|
} else if (node.tag === "p:graphicFrame") {
|
|
290
|
-
const shape = readGraphicFrameShape(node, context, slideRels, parentTransform);
|
|
305
|
+
const shape = readGraphicFrameShape(node, context, slideRels, pkg, parentTransform);
|
|
291
306
|
if (shape !== void 0) out.push(shape);
|
|
292
307
|
} else if (node.tag === "p:grpSp") {
|
|
293
308
|
const grpSpPr = childrenWithTag(node, "p:grpSpPr")[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ooxml.js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.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": "^3.
|
|
81
|
+
"document-schema.js": "^3.2.0",
|
|
82
82
|
"fast-xml-parser": "^5.10.1",
|
|
83
83
|
"fflate": "^0.8.3",
|
|
84
84
|
"zod": "^4.4.3"
|