@web-ppt/viewer-core 0.4.3 → 0.4.5
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/CHANGELOG.md +32 -0
- package/README.md +12 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
本文件记录对使用者可见的变化。版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## 0.4.5
|
|
6
|
+
|
|
7
|
+
### 修复
|
|
8
|
+
|
|
9
|
+
- **`@web-ppt/viewer-core` 与 `@web-ppt/fonts` 的 npm 页面在 0.4.4 里仍是中文**。
|
|
10
|
+
包内容是对的(tarball 里躺着英文版),错的是 npm 用来渲染页面的那份元数据。
|
|
11
|
+
|
|
12
|
+
原因是 npm 认哪个文件当 README 并不看「是不是叫 README.md」:
|
|
13
|
+
`@npmcli/package-json` 用 `{README,README.*}` 去 glob 再取第一个像 markdown
|
|
14
|
+
的命中,而 0.4.4 引入的 `README.zh-CN.md` 同样匹配 `README.*`,实测还排在
|
|
15
|
+
`README.md` 前面。`files` 只挡住了 tarball,挡不住元数据。
|
|
16
|
+
|
|
17
|
+
本地化 README 改用连字符(`README-zh-CN.md`),并在 `sync-package-docs.mjs`
|
|
18
|
+
里加了守卫:包目录里出现 `README.*` 旁支就直接让发布失败。
|
|
19
|
+
|
|
20
|
+
## 0.4.4
|
|
21
|
+
|
|
22
|
+
本版没有代码改动,只动文档——但 npm 上看到的东西全变了,所以值得单独发一版。
|
|
23
|
+
|
|
24
|
+
### 变更
|
|
25
|
+
|
|
26
|
+
- **npm 页面改英文**。三个包的 README 与 `description` 之前全是中文,
|
|
27
|
+
而 npm 的读者以国际开发者为主,等于最有说服力的能力矩阵对他们不存在。
|
|
28
|
+
现在 `@web-ppt/core` 的 npm 页取仓库的 `README.en.md`,另两个包各自
|
|
29
|
+
维护英文版,中文移到同目录的 `README.zh-CN.md`,两边顶部互链。
|
|
30
|
+
|
|
31
|
+
GitHub 首页仍是中文,两个入口各自面向自己的人群。
|
|
32
|
+
|
|
33
|
+
- **README 首屏补了演示 GIF 与定位段**。GIF 由 `npm run demo-gif` 录制,
|
|
34
|
+
录的是仓库自己生成的 `fixtures/showcase.pptx`,引擎改了重跑即可,
|
|
35
|
+
不是一次性的手工录屏。
|
|
36
|
+
|
|
5
37
|
## 0.4.3
|
|
6
38
|
|
|
7
39
|
### 变更
|
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# @web-ppt/viewer-core
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
**English** · [简体中文](https://github.com/unStone/web-ppt/blob/master/packages/viewer-core/README-zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`Viewer`
|
|
5
|
+
The headless layer of [Web-PPT](https://github.com/unStone/web-ppt).
|
|
6
|
+
|
|
7
|
+
`PresentationState` is a pure state machine with zero DOM — navigation, zoom, search, animation batching, auto-advance. Drive it from plain DOM, React, Vue or Svelte, or run it straight in Node for tests. `Viewer` is the thinnest possible DOM binding on top (inject SVG, set visibility, kick off playback — about 24 lines).
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm i @web-ppt/core @web-ppt/viewer-core
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Batteries included
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { parse } from '@web-ppt/core';
|
|
@@ -19,14 +19,14 @@ import { Viewer } from '@web-ppt/viewer-core';
|
|
|
19
19
|
const pres = await parse(file);
|
|
20
20
|
const v = new Viewer(container, pres, { animate: true, autoAdvance: true });
|
|
21
21
|
|
|
22
|
-
v.next(); //
|
|
23
|
-
v.finishAnimations(); //
|
|
22
|
+
v.next(); // plays a pending animation batch, otherwise advances the slide
|
|
23
|
+
v.finishAnimations(); // jump to this slide's end state
|
|
24
24
|
v.setZoom(1.5);
|
|
25
|
-
v.search('
|
|
25
|
+
v.search('keyword'); // → array of matching slide indices
|
|
26
26
|
await v.exportPng(2); // → Blob
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Bring your own UI
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
import { PresentationState, playGroup, playTransition } from '@web-ppt/viewer-core';
|
|
@@ -43,11 +43,10 @@ st.subscribe((change) => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
st.next();
|
|
46
|
-
st.hiddenElementIds; //
|
|
47
|
-
st.resolveLink(href); // 'slide:3' → 2
|
|
46
|
+
st.hiddenElementIds; // element ids that should be hidden at the current batch
|
|
47
|
+
st.resolveLink(href); // 'slide:3' → 2, external links → null
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
所以换框架时不需要重写任何逻辑。
|
|
50
|
+
The state machine only decides *what should be visible*; the UI layer performs the actual playback through `playGroup` / `playTransition` — so switching frameworks rewrites no logic.
|
|
52
51
|
|
|
53
52
|
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-ppt/viewer-core",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Web-PPT
|
|
3
|
+
"version": "0.4.5",
|
|
4
|
+
"description": "Headless presentation state machine for Web-PPT: navigation, zoom, search and click-batched animation playback, drivable from any UI framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pptx",
|
|
7
7
|
"ppt",
|