@netless/fastboard-ui 0.3.5 → 0.3.6

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/fastboard-ui",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -10,14 +10,14 @@
10
10
  ],
11
11
  "repository": "netless-io/fastboard",
12
12
  "peerDependencies": {
13
- "@netless/fastboard-core": "0.3.5"
13
+ "@netless/fastboard-core": "0.3.6"
14
14
  },
15
15
  "dependencies": {
16
16
  "tippy.js": "^6.3.7"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@netless/esbuild-plugin-inline-sass": "0.1.0",
20
- "@netless/fastboard-core": "0.3.5"
20
+ "@netless/fastboard-core": "0.3.6"
21
21
  },
22
22
  "scripts": {
23
23
  "cleanup": "rimraf dist",
@@ -5,9 +5,9 @@ import { Fastboard, ReplayFastboard } from "../components/Fastboard";
5
5
 
6
6
  export interface UI {
7
7
  /** render UI to div */
8
- mount(div: Element, props?: Omit<FastboardProps, "app">): UI;
8
+ mount(div: Element, props?: FastboardProps): UI;
9
9
  /** update UI (theme, language, etc.) */
10
- update(props?: Omit<FastboardProps, "app">): void;
10
+ update(props?: FastboardProps): void;
11
11
  /** remove UI */
12
12
  destroy(): void;
13
13
  }
@@ -17,18 +17,18 @@ export interface UI {
17
17
  * let ui = createUI(fastboardApp, document.getElementById("whiteboard"));
18
18
  * ui.update({ theme: "dark" })
19
19
  */
20
- export function createUI(app: FastboardApp, div?: Element): UI {
20
+ export function createUI(app?: FastboardApp | null, div?: Element): UI {
21
21
  let fastboard: Fastboard | undefined;
22
22
 
23
23
  const ui: UI = {
24
- mount(div: Element, props?: Omit<FastboardProps, "app">) {
24
+ mount(div: Element, props?: FastboardProps) {
25
25
  if (fastboard) {
26
26
  fastboard.$destroy();
27
27
  }
28
28
  fastboard = new Fastboard({ target: div, props: { app, ...props } });
29
29
  return ui;
30
30
  },
31
- update(props?: Omit<FastboardProps, "app">) {
31
+ update(props?: FastboardProps) {
32
32
  if (fastboard) {
33
33
  fastboard.$set(props);
34
34
  }
@@ -42,7 +42,7 @@ export function createUI(app: FastboardApp, div?: Element): UI {
42
42
  };
43
43
 
44
44
  if (div) {
45
- ui.mount(div);
45
+ ui.mount(div, { app });
46
46
  }
47
47
 
48
48
  return ui;
@@ -50,9 +50,9 @@ export function createUI(app: FastboardApp, div?: Element): UI {
50
50
 
51
51
  export interface ReplayUI {
52
52
  /** render UI to div */
53
- mount(div: Element, props?: Omit<ReplayFastboardProps, "player">): ReplayUI;
53
+ mount(div: Element, props?: ReplayFastboardProps): ReplayUI;
54
54
  /** update UI (theme, language, etc.) */
55
- update(props?: Omit<ReplayFastboardProps, "player">): void;
55
+ update(props?: ReplayFastboardProps): void;
56
56
  /** remove UI */
57
57
  destroy(): void;
58
58
  }
@@ -62,18 +62,18 @@ export interface ReplayUI {
62
62
  * let ui = createReplayUI(fastboardPlayer, document.getElementById("whiteboard"));
63
63
  * ui.update({ theme: "dark" })
64
64
  */
65
- export function createReplayUI(player: FastboardPlayer, div?: Element): ReplayUI {
65
+ export function createReplayUI(player?: FastboardPlayer | null, div?: Element): ReplayUI {
66
66
  let fastboard: ReplayFastboard | undefined;
67
67
 
68
68
  const ui: ReplayUI = {
69
- mount(div: Element, props?: Omit<ReplayFastboardProps, "player">) {
69
+ mount(div: Element, props?: ReplayFastboardProps) {
70
70
  if (fastboard) {
71
71
  fastboard.$destroy();
72
72
  }
73
73
  fastboard = new ReplayFastboard({ target: div, props: { player, ...props } });
74
74
  return ui;
75
75
  },
76
- update(props?: Omit<ReplayFastboardProps, "player">) {
76
+ update(props?: ReplayFastboardProps) {
77
77
  if (fastboard) {
78
78
  fastboard.$set(props);
79
79
  }
@@ -87,7 +87,7 @@ export function createReplayUI(player: FastboardPlayer, div?: Element): ReplayUI
87
87
  };
88
88
 
89
89
  if (div) {
90
- ui.mount(div);
90
+ ui.mount(div, { player });
91
91
  }
92
92
 
93
93
  return ui;