gbpptx 0.5.2 → 0.6.1
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 +16 -0
- package/package.json +47 -47
- package/src/index.js +29 -29
- package/src/kernel/model.js +651 -651
- package/src/kernel/parts.js +173 -173
- package/src/kernel/pptx.js +72 -72
- package/src/kernel/print.js +76 -76
- package/src/kernel/read.js +1018 -1018
- package/src/kernel/roundtrip.js +174 -174
- package/src/kernel/text.js +278 -278
- package/src/kernel/write.js +385 -385
- package/web/app/slides/file.js +29 -2
- package/web/app/slides-app.js +25 -1
- package/web/app/ui/icons.js +2 -0
- package/web/app/ui/titlebar.js +253 -263
- package/web/index.html +3 -2
- package/web/serve.mjs +3 -2
- package/web/styles/slides.css +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,22 @@ app.setMenuBarVisible(true); // 再显示菜单栏
|
|
|
45
45
|
|
|
46
46
|
只读档下:Ribbon、格式窗格与备注 `inert`,编辑 / 插入 / 幻灯片 / 审阅菜单禁用(文件菜单只留导出与打印,放映 / 视图照常),画布的拖拽、缩放、旋转、就地文字与表格编辑入口关闭,缩略图的新建 / 版式 / 右键菜单 / 拖拽排序与查找替换一并锁定,粘贴、拖放和写快捷键由守卫拦下;选中对象、翻页、放映、缩放、复制、查找仍可用。`hideMenuBar` 隐藏 `.pp-topbar` 整行(含同行文档名与保存按钮),Ribbon 与画布不受影响。
|
|
47
47
|
|
|
48
|
+
## 文档头与宿主接管(0.6.0 起)
|
|
49
|
+
|
|
50
|
+
文档头骨架由 `gbofficeui` 的 `createOfficeHead` 统一生成(gbdocx / gbpptx / gbxlxs 三家同一套):标题 → 重命名 → 状态 → 自动保存 / 保存 → 下载 → 预览 → 全屏。「重命名」是标题右侧的一枚图标钮,「下载」紧挨「预览」。
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
const app = new SlidesApp(mountEl, {
|
|
54
|
+
host: {
|
|
55
|
+
getTitle: () => '季度汇报', // 覆盖文档头标题(服务端文档名)
|
|
56
|
+
rename: (event) => {}, // 宿主改服务端文档名
|
|
57
|
+
download: () => {}, // 宿主走后端二进制流
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
不传 `host` 时走包内实现:重命名弹窗改演示名,下载导出当前 `.pptx`;传了 `host` 但没给 `rename` / `download`,文档头就不渲染这两个按钮。
|
|
63
|
+
|
|
48
64
|
## 安装与运行
|
|
49
65
|
|
|
50
66
|
```bash
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gbpptx",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Office-style PowerPoint (pptx) editor: real PresentationML read/write, ribbon UI, slide sorter, presenter view.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"main": "./src/index.js",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": "./src/index.js",
|
|
11
|
-
"./model": "./src/kernel/model.js",
|
|
12
|
-
"./pptx": "./src/kernel/pptx.js",
|
|
13
|
-
"./package.json": "./package.json",
|
|
14
|
-
"./web/*": "./web/*",
|
|
15
|
-
"./*": "./src/*.js"
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"src",
|
|
19
|
-
"web",
|
|
20
|
-
"LICENSE"
|
|
21
|
-
],
|
|
22
|
-
"keywords": [
|
|
23
|
-
"pptx",
|
|
24
|
-
"presentation",
|
|
25
|
-
"powerpoint",
|
|
26
|
-
"ooxml",
|
|
27
|
-
"slides",
|
|
28
|
-
"editor",
|
|
29
|
-
"office",
|
|
30
|
-
"ribbon"
|
|
31
|
-
],
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=18"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"start": "node web/serve.mjs",
|
|
37
|
-
"test": "node --test test/roundtrip.test.js test/external-import.test.js test/ui-zoom.test.js test/mode.test.js"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"gbooxml": "^0.1.0",
|
|
41
|
-
"gbofficeui": "^0.
|
|
42
|
-
"guabiutils": "^0.3.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"jsdom": "^30.1.3"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gbpptx",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "Office-style PowerPoint (pptx) editor: real PresentationML read/write, ribbon UI, slide sorter, presenter view.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./src/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./src/index.js",
|
|
11
|
+
"./model": "./src/kernel/model.js",
|
|
12
|
+
"./pptx": "./src/kernel/pptx.js",
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
"./web/*": "./web/*",
|
|
15
|
+
"./*": "./src/*.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"src",
|
|
19
|
+
"web",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"pptx",
|
|
24
|
+
"presentation",
|
|
25
|
+
"powerpoint",
|
|
26
|
+
"ooxml",
|
|
27
|
+
"slides",
|
|
28
|
+
"editor",
|
|
29
|
+
"office",
|
|
30
|
+
"ribbon"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"start": "node web/serve.mjs",
|
|
37
|
+
"test": "node --test test/roundtrip.test.js test/external-import.test.js test/ui-zoom.test.js test/mode.test.js"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"gbooxml": "^0.1.0",
|
|
41
|
+
"gbofficeui": "^0.3.0",
|
|
42
|
+
"guabiutils": "^0.3.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"jsdom": "^30.1.3"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
// [文件] gbpptx·统一入口 —— 画布模型 + 真实 .pptx 读写 + 打印 能力聚合再导出
|
|
2
|
-
|
|
3
|
-
/* 画布对象模型 */
|
|
4
|
-
export {
|
|
5
|
-
SNAPSHOT_VERSION, SLIDE_W, SLIDE_H, SLIDE_SIZES, DEFAULT_SIZE,
|
|
6
|
-
normalizeSize, sizeOf, sizePresetKey,
|
|
7
|
-
THEMES, THEME_KEYS, themeOf,
|
|
8
|
-
TABLE_STYLES, tableStyleColors, contrastText,
|
|
9
|
-
TRANSITIONS, DEFAULT_TRANSITION, normalizeTransition, transitionOf,
|
|
10
|
-
SHAPE_KINDS, SHAPE_KIND_KEYS, shapeKindLabel, shapePreset, TYPE_NAMES,
|
|
11
|
-
cloneObject, copySlide, createSlide, topZ,
|
|
12
|
-
createTextObject, createImageObject, createShapeObject, createLineObject, createTableObject,
|
|
13
|
-
objectRect, objectBoxStyle, unionRect, shapePath, DASH_STYLES, DASH_KEYS,
|
|
14
|
-
isBlankHtml, htmlToPlain, plainToHtml,
|
|
15
|
-
clearInlineFontSizes, setObjectFontSize, normalizeSnapshot,
|
|
16
|
-
SLIDE_LAYOUTS, createSlideWithLayout, scaleSnapshotSize, createDraft,
|
|
17
|
-
} from './kernel/model.js';
|
|
18
|
-
|
|
19
|
-
/* pptx 读写(唯一出入口) */
|
|
20
|
-
export { parsePptx } from './kernel/read.js';
|
|
21
|
-
export { buildPptx } from './kernel/write.js';
|
|
22
|
-
export { buildPptxVerified } from './kernel/roundtrip.js';
|
|
23
|
-
export { isPptx, KIND_TO_PRST, PRST_TO_KIND, fontSizeToSz, szToFontSize, themeLabel } from './kernel/pptx.js';
|
|
24
|
-
|
|
25
|
-
/* 文本转换(富文本/项目符号往返) */
|
|
26
|
-
export { htmlToParas, parasToHTML, parasPlainText, parasPlainLines, parasOfPlain } from './kernel/text.js';
|
|
27
|
-
|
|
28
|
-
/* 打印 */
|
|
29
|
-
export { printSlides } from './kernel/print.js';
|
|
1
|
+
// [文件] gbpptx·统一入口 —— 画布模型 + 真实 .pptx 读写 + 打印 能力聚合再导出
|
|
2
|
+
|
|
3
|
+
/* 画布对象模型 */
|
|
4
|
+
export {
|
|
5
|
+
SNAPSHOT_VERSION, SLIDE_W, SLIDE_H, SLIDE_SIZES, DEFAULT_SIZE,
|
|
6
|
+
normalizeSize, sizeOf, sizePresetKey,
|
|
7
|
+
THEMES, THEME_KEYS, themeOf,
|
|
8
|
+
TABLE_STYLES, tableStyleColors, contrastText,
|
|
9
|
+
TRANSITIONS, DEFAULT_TRANSITION, normalizeTransition, transitionOf,
|
|
10
|
+
SHAPE_KINDS, SHAPE_KIND_KEYS, shapeKindLabel, shapePreset, TYPE_NAMES,
|
|
11
|
+
cloneObject, copySlide, createSlide, topZ,
|
|
12
|
+
createTextObject, createImageObject, createShapeObject, createLineObject, createTableObject,
|
|
13
|
+
objectRect, objectBoxStyle, unionRect, shapePath, DASH_STYLES, DASH_KEYS,
|
|
14
|
+
isBlankHtml, htmlToPlain, plainToHtml,
|
|
15
|
+
clearInlineFontSizes, setObjectFontSize, normalizeSnapshot,
|
|
16
|
+
SLIDE_LAYOUTS, createSlideWithLayout, scaleSnapshotSize, createDraft,
|
|
17
|
+
} from './kernel/model.js';
|
|
18
|
+
|
|
19
|
+
/* pptx 读写(唯一出入口) */
|
|
20
|
+
export { parsePptx } from './kernel/read.js';
|
|
21
|
+
export { buildPptx } from './kernel/write.js';
|
|
22
|
+
export { buildPptxVerified } from './kernel/roundtrip.js';
|
|
23
|
+
export { isPptx, KIND_TO_PRST, PRST_TO_KIND, fontSizeToSz, szToFontSize, themeLabel } from './kernel/pptx.js';
|
|
24
|
+
|
|
25
|
+
/* 文本转换(富文本/项目符号往返) */
|
|
26
|
+
export { htmlToParas, parasToHTML, parasPlainText, parasPlainLines, parasOfPlain } from './kernel/text.js';
|
|
27
|
+
|
|
28
|
+
/* 打印 */
|
|
29
|
+
export { printSlides } from './kernel/print.js';
|