lt-ppt 1.0.38 → 1.0.40

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-Bnxh2I4Q.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
+ };
@@ -5,9 +5,11 @@ type __VLS_Props = {
5
5
  onUploadFile?: (params: UploadFileParams) => Promise<string>;
6
6
  readonly?: boolean;
7
7
  onChange?: (slides: Slide[]) => void;
8
- onSave?: (params: SaveCallbackParams) => void;
8
+ onSave?: (params: SaveCallbackParams) => void | Promise<void>;
9
9
  onInitFinished?: () => void;
10
10
  onReturn?: () => void;
11
11
  };
12
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
12
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
13
+ offscreenCoverRef: HTMLDivElement;
14
+ }, HTMLDivElement>;
13
15
  export default _default;
@@ -6,7 +6,10 @@ declare const _default: import('vue').DefineComponent<LtPPTProps, {
6
6
  setSlides: (slides: Slide[]) => void;
7
7
  startScreening: () => void;
8
8
  getCurrentIndex: () => number;
9
+ hasUnsavedChanges: () => boolean;
10
+ save: () => Promise<void>;
9
11
  downloadPPT: () => void;
12
+ generateDeafultPPT: () => Promise<File>;
10
13
  setMode: (mode: LtPPTMode) => void;
11
14
  insertImage: (params: InsertImageParams) => Promise<PPTImageElement | null>;
12
15
  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;