huijia-pptxtojson 1.0.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/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "huijia-pptxtojson",
3
+ "version": "1.0.0",
4
+ "description": "A javascript tool for parsing .pptx file",
5
+ "type": "module",
6
+ "main": "./dist/index.umd.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "src/index.d.ts",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "scripts": {
23
+ "clean:dist": "rimraf dist",
24
+ "dev": "rollup -c -w",
25
+ "lint": "eslint src --ext .js,.jsx,.ts,.tsx",
26
+ "build": "rollup -c && cp src/index.d.ts dist/index.d.ts"
27
+ },
28
+ "author": "pipipi_pikachu@163.com",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/pipipi-pikachu/pptxtojson.git"
32
+ },
33
+ "keywords": [
34
+ "ppt",
35
+ "pptx",
36
+ "json"
37
+ ],
38
+ "homepage": "https://github.com/pipipi-pikachu/pptxtojson",
39
+ "license": "MIT",
40
+ "publishConfig": {
41
+ "registry": "https://registry.npmjs.org"
42
+ },
43
+ "dependencies": {
44
+ "jszip": "^3.10.1",
45
+ "tinycolor2": "1.6.0",
46
+ "txml": "^5.1.1"
47
+ },
48
+ "devDependencies": {
49
+ "@babel/core": "^7.20.2",
50
+ "@babel/plugin-transform-runtime": "^7.19.6",
51
+ "@babel/preset-env": "^7.20.2",
52
+ "@babel/runtime": "^7.20.1",
53
+ "@rollup/plugin-babel": "^6.0.2",
54
+ "@rollup/plugin-commonjs": "^23.0.2",
55
+ "@rollup/plugin-eslint": "^9.0.1",
56
+ "@rollup/plugin-node-resolve": "^15.0.1",
57
+ "@rollup/plugin-terser": "^0.1.0",
58
+ "eslint": "^8.27.0",
59
+ "rollup": "^3.3.0",
60
+ "rollup-plugin-node-builtins": "^2.1.2",
61
+ "rollup-plugin-node-globals": "^1.4.0"
62
+ }
63
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ /*
2
+ * @Author: LiZhiWei
3
+ * @Date: 2025-12-30 11:22:21
4
+ * @LastEditors: LiZhiWei
5
+ * @LastEditTime: 2025-12-30 11:22:22
6
+ * @Description:
7
+ */
8
+ export interface ParseOptions {
9
+ /**
10
+ * 是否跳过某些特定的解析步骤或自定义解析行为(根据具体实现而定)
11
+ */
12
+ [key: string]: any;
13
+ }
14
+
15
+ export interface Size {
16
+ width: number;
17
+ height: number;
18
+ }
19
+
20
+ export interface SlideElement {
21
+ type: 'text' | 'image' | 'shape' | 'chart' | 'table' | 'video' | 'audio' | string;
22
+ left: number;
23
+ top: number;
24
+ width: number;
25
+ height: number;
26
+ rotate?: number;
27
+ name?: string;
28
+ [key: string]: any;
29
+ }
30
+
31
+ export interface Slide {
32
+ fill?: {
33
+ type: 'color' | 'grad' | 'pic' | 'none';
34
+ value: string | any;
35
+ };
36
+ elements: SlideElement[];
37
+ layoutElements?: SlideElement[];
38
+ note?: string;
39
+ [key: string]: any;
40
+ }
41
+
42
+ export interface ParseResult {
43
+ slides: Slide[];
44
+ themeColors: Record<string, string>;
45
+ size: Size;
46
+ }
47
+
48
+ /**
49
+ * 解析 .pptx 文件为 JSON 数据
50
+ * @param file .pptx 文件的 ArrayBuffer 或 Blob
51
+ * @param options 解析选项
52
+ */
53
+ export function parse(file: ArrayBuffer | Blob, options?: ParseOptions): Promise<ParseResult>;