@netless/app-slide 0.2.82 → 0.2.84

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 CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@netless/app-slide",
3
- "version": "0.2.82",
3
+ "version": "0.2.84",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.es.js",
6
6
  "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "types": "node scripts/build-types.mjs",
9
+ "build": "vite build && npm run types",
10
+ "build:dev": "vite build --mode development && npm run types",
11
+ "cleanup": "rimraf ./dist"
12
+ },
7
13
  "files": [
8
14
  "src",
9
15
  "dist",
10
16
  "README-zh.md"
11
17
  ],
12
18
  "devDependencies": {
13
- "@netless/slide": "1.4.40",
19
+ "@netless/slide": "1.4.41",
14
20
  "@types/color-string": "^1.5.2",
15
21
  "color-string": "^1.9.1",
16
22
  "jspdf": "2.5.1",
@@ -24,11 +30,5 @@
24
30
  "jspdf": {
25
31
  "optional": true
26
32
  }
27
- },
28
- "scripts": {
29
- "types": "node scripts/build-types.mjs",
30
- "build": "vite build && npm run types",
31
- "build:dev": "vite build --mode development && npm run types",
32
- "cleanup": "rimraf ./dist"
33
33
  }
34
- }
34
+ }
@@ -55,12 +55,13 @@ type MagixEventListener = Parameters<
55
55
  AppContext<Attributes, MagixEvents>["addMagixEventListener"]
56
56
  >[1];
57
57
 
58
- export class SlideController {
58
+
59
+ export class SlideControllerBase {
59
60
  public readonly context: SlideControllerOptions["context"];
60
- public readonly slide: Slide;
61
+ public slide!: Slide;
61
62
  public readonly showRenderError: boolean;
62
63
  public readonly onRenderError?: (error: Error, pageIndex: number) => void;
63
- public readonly onNavigate: (index: number, origin?: string) => void;
64
+ public readonly onNavigate!: (index: number, origin?: string) => void;
64
65
 
65
66
  protected readonly room?: Room;
66
67
  protected readonly player?: Player;
@@ -82,19 +83,8 @@ export class SlideController {
82
83
  // 签名后的预览图
83
84
  public previewList: string[] = [];
84
85
 
85
- public constructor({
86
- context,
87
- anchor,
88
- onRenderStart,
89
- onPageChanged,
90
- onTransitionStart,
91
- onTransitionEnd,
92
- onNavigate,
93
- onError,
94
- onRenderError,
95
- showRenderError,
96
- invisibleBehavior,
97
- }: SlideControllerOptions) {
86
+ public constructor(props: SlideControllerOptions) {
87
+ const { context, onRenderStart, onPageChanged, onTransitionStart, onTransitionEnd, onNavigate, onError, onRenderError, showRenderError, invisibleBehavior } = props;
98
88
  this.invisibleBehavior = invisibleBehavior ?? "frozen";
99
89
  this.onRenderStart = onRenderStart;
100
90
  this.onPageChanged = onPageChanged;
@@ -109,15 +99,15 @@ export class SlideController {
109
99
  this.room = context.getRoom();
110
100
  this.player = this.room ? undefined : (context.getDisplayer() as Player);
111
101
  setRoomLogger((this.room || this.player) as Displayer);
112
- this.slide = this.createSlide(anchor, {
113
- whiteTracker: getRoomTracker(context.getDisplayer()),
114
- });
102
+ // this.slide = this.createSlide(anchor, {
103
+ // whiteTracker: getRoomTracker(context.getDisplayer()),
104
+ // });
115
105
 
116
106
  // the adder does not need to sync state
117
107
  this.syncStateOnceFlag = !this.context.isAddApp;
118
108
  this.visible = document.visibilityState === "visible";
119
109
  this.savedIsFrozen = false;
120
- this.initialize();
110
+ // this.initialize();
121
111
  }
122
112
 
123
113
  public ready = false;
@@ -407,3 +397,13 @@ export class SlideController {
407
397
  }
408
398
  };
409
399
  }
400
+
401
+ export class SlideController extends SlideControllerBase {
402
+ public constructor(props: SlideControllerOptions) {
403
+ super(props)
404
+ this.slide = this.createSlide(props.anchor, {
405
+ whiteTracker: getRoomTracker(props.context.getDisplayer()),
406
+ });
407
+ this.initialize();
408
+ }
409
+ }
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  EmptyAttributes,
13
13
  syncSceneWithSlide,
14
14
  SlideController,
15
+ SlideControllerBase
15
16
  } from "./SlideController";
16
17
  import { SlideDocsViewer } from "./SlideDocsViewer";
17
18
  import { apps, FreezerLength, addHooks, useFreezer } from "./utils/freezer";
@@ -20,15 +21,16 @@ import styles from "./style.scss?inline";
20
21
 
21
22
  export type { PreviewParams } from "./SlidePreviewer";
22
23
  export { SlidePreviewer, default as previewSlide } from "./SlidePreviewer";
24
+ export { DocsViewer } from "./DocsViewer";
23
25
 
24
26
  export type { Attributes, AddHooks, FreezableSlide };
25
- export { Slide };
27
+ export { Slide, SlideController, SlideDocsViewer, syncSceneWithSlide, SideEffectManager, SlideControllerBase };
26
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
29
  export const usePlugin: (plugin: any) => any = /* @__PURE__ */ Slide.usePlugin.bind(Slide);
28
30
 
29
31
  export const version = __APP_VERSION__;
30
32
 
31
- export { DefaultUrl, apps, FreezerLength, addHooks };
33
+ export { DefaultUrl, apps, FreezerLength, addHooks, useFreezer, log, logger };
32
34
 
33
35
  export { setFreezerLength, getFreezerLength, onCreated, onDestroyed } from "./utils/freezer";
34
36
 
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 netless
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.