lt-ppt 1.0.38 → 1.0.39

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.
@@ -0,0 +1,104 @@
1
+ import { defineStore as d } from "./pinia-CVat9nJz.js";
2
+ import { a as r, u as S, d as a } from "./database-BzBFTWuy.js";
3
+ const u = d("snapshot", {
4
+ state: () => ({
5
+ snapshotCursor: -1,
6
+ // 历史快照指针
7
+ snapshotLength: 0
8
+ // 历史快照长度
9
+ }),
10
+ getters: {
11
+ canUndo(s) {
12
+ return s.snapshotCursor > 0;
13
+ },
14
+ canRedo(s) {
15
+ return s.snapshotCursor < s.snapshotLength - 1;
16
+ }
17
+ },
18
+ actions: {
19
+ setSnapshotCursor(s) {
20
+ this.snapshotCursor = s;
21
+ },
22
+ setSnapshotLength(s) {
23
+ this.snapshotLength = s;
24
+ },
25
+ async initSnapshotDatabase() {
26
+ const s = r(), t = {
27
+ index: s.slideIndex,
28
+ slides: JSON.parse(JSON.stringify(s.slides))
29
+ };
30
+ await a.snapshots.add(t), this.setSnapshotCursor(0), this.setSnapshotLength(1);
31
+ },
32
+ async resetSnapshotDatabase() {
33
+ const s = r();
34
+ await a.snapshots.clear();
35
+ const t = {
36
+ index: s.slideIndex,
37
+ slides: JSON.parse(JSON.stringify(s.slides))
38
+ };
39
+ await a.snapshots.add(t), this.setSnapshotCursor(0), this.setSnapshotLength(1);
40
+ },
41
+ async addSnapshot() {
42
+ const s = r(), t = await a.snapshots.orderBy("id").keys();
43
+ let e = [];
44
+ this.snapshotCursor >= 0 && this.snapshotCursor < t.length - 1 && (e = t.slice(this.snapshotCursor + 1));
45
+ const h = {
46
+ index: s.slideIndex,
47
+ slides: JSON.parse(JSON.stringify(s.slides))
48
+ };
49
+ await a.snapshots.add(h);
50
+ let n = t.length - e.length + 1;
51
+ n > 20 && (e.push(t[0]), n--), n >= 2 && a.snapshots.update(t[n - 2], { index: s.slideIndex }), await a.snapshots.bulkDelete(e), this.setSnapshotCursor(n - 1), this.setSnapshotLength(n);
52
+ },
53
+ async unDo() {
54
+ if (this.snapshotCursor <= 0) return;
55
+ const s = r(), t = S(), e = this.snapshotCursor - 1, n = (await a.snapshots.orderBy("id").toArray())[e], { index: i, slides: o } = n, p = i > o.length - 1 ? o.length - 1 : i;
56
+ s.setSlides(o), s.updateSlideIndex(p), this.setSnapshotCursor(e), t.setActiveElementIdList([]);
57
+ },
58
+ async reDo() {
59
+ if (this.snapshotCursor >= this.snapshotLength - 1) return;
60
+ const s = r(), t = S(), e = this.snapshotCursor + 1, n = (await a.snapshots.orderBy("id").toArray())[e], { index: i, slides: o } = n, p = i > o.length - 1 ? o.length - 1 : i;
61
+ s.setSlides(o), s.updateSlideIndex(p), this.setSnapshotCursor(e), t.setActiveElementIdList([]);
62
+ }
63
+ }
64
+ }), y = d("keyboard", {
65
+ state: () => ({
66
+ ctrlKeyState: !1,
67
+ // ctrl键按下状态
68
+ shiftKeyState: !1,
69
+ // shift键按下状态
70
+ spaceKeyState: !1
71
+ // space键按下状态
72
+ }),
73
+ getters: {
74
+ ctrlOrShiftKeyActive(s) {
75
+ return s.ctrlKeyState || s.shiftKeyState;
76
+ }
77
+ },
78
+ actions: {
79
+ setCtrlKeyState(s) {
80
+ this.ctrlKeyState = s;
81
+ },
82
+ setShiftKeyState(s) {
83
+ this.shiftKeyState = s;
84
+ },
85
+ setSpaceKeyState(s) {
86
+ this.spaceKeyState = s;
87
+ }
88
+ }
89
+ }), g = d("screen", {
90
+ state: () => ({
91
+ screening: !1
92
+ // 是否进入放映状态
93
+ }),
94
+ actions: {
95
+ setScreening(s) {
96
+ this.screening = s;
97
+ }
98
+ }
99
+ });
100
+ export {
101
+ g as a,
102
+ u as b,
103
+ y as u
104
+ };
@@ -7,6 +7,7 @@ declare const _default: import('vue').DefineComponent<LtPPTProps, {
7
7
  startScreening: () => void;
8
8
  getCurrentIndex: () => number;
9
9
  downloadPPT: () => void;
10
+ generateDeafultPPT: () => Promise<File>;
10
11
  setMode: (mode: LtPPTMode) => void;
11
12
  insertImage: (params: InsertImageParams) => Promise<PPTImageElement | null>;
12
13
  replaceImage: (params: ReplaceImageParams) => Promise<PPTImageElement | null>;
@@ -1,5 +1,7 @@
1
+ import { useSlidesStore } from '../store';
1
2
  import { Slide } from '../types/slides';
2
- declare const _default: () => {
3
+ type SlidesStore = ReturnType<typeof useSlidesStore>;
4
+ declare const _default: (slidesStoreOverride?: SlidesStore) => {
3
5
  exporting: import('vue').Ref<boolean, boolean>;
4
6
  exportImage: (domRef: HTMLElement, format: string, quality: number, ignoreWebfont?: boolean) => void;
5
7
  exportImagePPTX: (domRefs: NodeListOf<Element>) => void;
@@ -165,6 +165,8 @@ export interface LtPPTInstance {
165
165
  getCurrentIndex: () => number;
166
166
  /** 打开下载 PPT 弹层 */
167
167
  downloadPPT: () => void;
168
+ /** 使用全部幻灯片、保留音视频并覆盖默认母版生成 PPTX 文件 */
169
+ generateDeafultPPT: () => Promise<File>;
168
170
  /** 切换编辑器显示模式 */
169
171
  setMode: (mode: LtPPTMode) => void;
170
172
  /** 向指定页面插入图片 */