ppt2json 0.3.0 → 0.3.2
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 +5 -6
- package/dist/index.d.mts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ppt2json
|
|
2
2
|
|
|
3
|
-
Convert `.pptx` files into JSON
|
|
3
|
+
Convert `.pptx` files into presentation JSON structures normalized by the `json2pptx-schema` pipeline.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -13,19 +13,18 @@ npm i ppt2json
|
|
|
13
13
|
```ts
|
|
14
14
|
import { parsePptxToJson } from 'ppt2json'
|
|
15
15
|
|
|
16
|
-
const file = new File([arrayBuffer], '
|
|
16
|
+
const file = new File([arrayBuffer], 'presentation.pptx', {
|
|
17
17
|
type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
-
const {
|
|
20
|
+
const { presentationJSON, warnings } = await parsePptxToJson(file)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
`
|
|
23
|
+
`presentationJSON` is normalized `PresentationData`, and `warnings` contains non-fatal conversion warnings.
|
|
24
24
|
|
|
25
25
|
## Notes
|
|
26
26
|
|
|
27
|
-
- Parsing is based on Office XML
|
|
27
|
+
- Parsing is based on Office XML.
|
|
28
28
|
- Returned output is normalized through `json2pptx-schema`, whose parse layer returns `PresentationDocument`.
|
|
29
29
|
- Visual round-trip is optimized for the built-in templates in this repo and shared primitives such as fills, text, paths, lines, images, and image clipping.
|
|
30
30
|
- Arbitrary third-party PPTX files are best-effort conversions.
|
|
31
|
-
- `Deck` remains exported as a compatibility alias, but the recommended application-layer type name is `PresentationData`.
|
package/dist/index.d.mts
CHANGED
|
@@ -128,13 +128,11 @@ type PresentationData = {
|
|
|
128
128
|
slides?: Slide[];
|
|
129
129
|
theme?: PresentationTheme;
|
|
130
130
|
};
|
|
131
|
-
type Presentation = PresentationData;
|
|
132
|
-
type Deck = PresentationData;
|
|
133
131
|
|
|
134
132
|
type ParsedResult = {
|
|
135
|
-
|
|
133
|
+
presentation: PresentationData;
|
|
136
134
|
warnings: string[];
|
|
137
135
|
};
|
|
138
136
|
declare function parsePptxToJson(file: File): Promise<ParsedResult>;
|
|
139
137
|
|
|
140
|
-
export { type Deck, type ParsedResult, type Presentation, type PresentationData, type PresentationTheme, type Slide, type SlideElement, parsePptxToJson };
|
|
138
|
+
export { type PresentationData as Deck, type ParsedResult, type PresentationData as Presentation, type PresentationData, type PresentationTheme, type Slide, type SlideElement, parsePptxToJson };
|
package/dist/index.d.ts
CHANGED
|
@@ -128,13 +128,11 @@ type PresentationData = {
|
|
|
128
128
|
slides?: Slide[];
|
|
129
129
|
theme?: PresentationTheme;
|
|
130
130
|
};
|
|
131
|
-
type Presentation = PresentationData;
|
|
132
|
-
type Deck = PresentationData;
|
|
133
131
|
|
|
134
132
|
type ParsedResult = {
|
|
135
|
-
|
|
133
|
+
presentation: PresentationData;
|
|
136
134
|
warnings: string[];
|
|
137
135
|
};
|
|
138
136
|
declare function parsePptxToJson(file: File): Promise<ParsedResult>;
|
|
139
137
|
|
|
140
|
-
export { type Deck, type ParsedResult, type Presentation, type PresentationData, type PresentationTheme, type Slide, type SlideElement, parsePptxToJson };
|
|
138
|
+
export { type PresentationData as Deck, type ParsedResult, type PresentationData as Presentation, type PresentationData, type PresentationTheme, type Slide, type SlideElement, parsePptxToJson };
|
package/dist/index.js
CHANGED
|
@@ -9776,7 +9776,7 @@ var DEFAULT_THEME = {
|
|
|
9776
9776
|
async function parsePptxToJson(file) {
|
|
9777
9777
|
const fileBuffer = await file.arrayBuffer();
|
|
9778
9778
|
return {
|
|
9779
|
-
|
|
9779
|
+
presentation: await buildDeckFromPptx(fileBuffer),
|
|
9780
9780
|
warnings: []
|
|
9781
9781
|
};
|
|
9782
9782
|
}
|