@netless/fastboard-ui 1.0.0-canary.1 → 1.0.0-canary.2
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/dist/index.d.ts +71 -56
- package/dist/index.js +358 -296
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +340 -260
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +340 -260
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/actions/tippy.ts +9 -5
- package/src/components/Button/Button.svelte.d.ts +1 -2
- package/src/components/Fastboard/Fastboard.svelte +3 -3
- package/src/components/Fastboard/Fastboard.svelte.ts +1 -1
- package/src/components/Fastboard/ReplayFastboard.svelte +5 -2
- package/src/components/Fastboard/ReplayFastboard.svelte.ts +2 -1
- package/src/components/PageControl/PageControl.svelte +2 -2
- package/src/components/Toolbar/README.md +1 -1
- package/src/components/Toolbar/Toolbar.scss +1 -1
- package/src/components/Toolbar/Toolbar.svelte +2 -1
- package/src/components/Toolbar/Toolbar.svelte.d.ts +7 -1
- package/src/components/Toolbar/components/constants.ts +0 -2
- package/src/components/Toolbar/components/helper.ts +1 -1
- package/src/components/ZoomControl/ZoomControl.svelte +1 -1
- package/src/helpers/index.ts +72 -48
- package/src/index.ts +8 -4
- package/src/style.scss +4 -0
- package/src/typings.ts +16 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,67 +1,38 @@
|
|
|
1
1
|
import { FastboardApp, FastboardPlayer } from '@netless/fastboard-core';
|
|
2
2
|
import { SvelteComponentTyped } from 'svelte';
|
|
3
3
|
|
|
4
|
-
interface
|
|
5
|
-
(node: HTMLElement, parameters: T): void | {
|
|
6
|
-
update?: (parameters: T) => void;
|
|
7
|
-
destroy?: () => void;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
declare type Theme = "light" | "dark";
|
|
11
|
-
declare type Language = "en" | "zh-CN";
|
|
12
|
-
declare type IconType = "normal" | "disable";
|
|
13
|
-
declare type GenericIcon<K extends string, E extends string = IconType> = {
|
|
14
|
-
[key in K]: {
|
|
15
|
-
[kind in E]: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
declare type I18nData<T extends string> = Record<Language, Record<T, string>>;
|
|
19
|
-
interface ToolbarConfig {
|
|
20
|
-
apps?: {
|
|
21
|
-
enable?: boolean;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
interface FastboardUIConfig {
|
|
25
|
-
toolbar?: {
|
|
26
|
-
enable?: boolean;
|
|
27
|
-
} & ToolbarConfig;
|
|
28
|
-
redo_undo?: {
|
|
29
|
-
enable?: boolean;
|
|
30
|
-
};
|
|
31
|
-
zoom_control?: {
|
|
32
|
-
enable?: boolean;
|
|
33
|
-
};
|
|
34
|
-
page_control?: {
|
|
35
|
-
enable?: boolean;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare interface RedoUndoProps {
|
|
4
|
+
declare interface PageControlProps {
|
|
40
5
|
app?: FastboardApp | null;
|
|
41
6
|
theme?: Theme;
|
|
42
7
|
language?: Language;
|
|
43
|
-
icons?: GenericIcon<"
|
|
8
|
+
icons?: GenericIcon<"prev" | "next" | "add">;
|
|
44
9
|
}
|
|
45
10
|
|
|
46
|
-
declare class
|
|
11
|
+
declare class PageControl extends SvelteComponentTyped<PageControlProps> {}
|
|
47
12
|
|
|
48
|
-
declare interface
|
|
49
|
-
|
|
13
|
+
declare interface PlayerControlProps {
|
|
14
|
+
player?: FastboardPlayer | null;
|
|
50
15
|
theme?: Theme;
|
|
51
16
|
language?: Language;
|
|
52
|
-
icons?: GenericIcon<"
|
|
17
|
+
icons?: GenericIcon<"play" | "pause" | "loading">;
|
|
53
18
|
}
|
|
54
19
|
|
|
55
|
-
declare class
|
|
20
|
+
declare class PlayerControl extends SvelteComponentTyped<PlayerControlProps> {}
|
|
56
21
|
|
|
57
|
-
declare interface
|
|
22
|
+
declare interface RedoUndoProps {
|
|
58
23
|
app?: FastboardApp | null;
|
|
59
24
|
theme?: Theme;
|
|
60
25
|
language?: Language;
|
|
61
|
-
icons?: GenericIcon<"
|
|
26
|
+
icons?: GenericIcon<"undo" | "redo">;
|
|
62
27
|
}
|
|
63
28
|
|
|
64
|
-
declare class
|
|
29
|
+
declare class RedoUndo extends SvelteComponentTyped<RedoUndoProps> {}
|
|
30
|
+
|
|
31
|
+
declare interface ToolbarConfig {
|
|
32
|
+
apps?: {
|
|
33
|
+
enable?: boolean;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
65
36
|
|
|
66
37
|
declare interface ToolbarProps {
|
|
67
38
|
app?: FastboardApp | null;
|
|
@@ -72,19 +43,59 @@ declare interface ToolbarProps {
|
|
|
72
43
|
|
|
73
44
|
declare class Toolbar extends SvelteComponentTyped<ToolbarProps> {}
|
|
74
45
|
|
|
75
|
-
declare interface
|
|
76
|
-
|
|
46
|
+
declare interface ZoomControlProps {
|
|
47
|
+
app?: FastboardApp | null;
|
|
77
48
|
theme?: Theme;
|
|
78
49
|
language?: Language;
|
|
79
|
-
icons?: GenericIcon<"
|
|
50
|
+
icons?: GenericIcon<"plus" | "minus" | "reset">;
|
|
80
51
|
}
|
|
81
52
|
|
|
82
|
-
declare class
|
|
53
|
+
declare class ZoomControl extends SvelteComponentTyped<ZoomControlProps> {}
|
|
54
|
+
|
|
55
|
+
interface SvelteAction<T = void> {
|
|
56
|
+
(node: HTMLElement, parameters: T): void | {
|
|
57
|
+
update?: (parameters: T) => void;
|
|
58
|
+
destroy?: () => void;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
declare type Theme = "light" | "dark";
|
|
62
|
+
declare type Language = "en" | "zh-CN";
|
|
63
|
+
declare type IconType = "normal" | "disable";
|
|
64
|
+
declare type GenericIcon<K extends string, E extends string = IconType> = {
|
|
65
|
+
[key in K]: {
|
|
66
|
+
[kind in E]: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
declare type I18nData<T extends string> = Record<Language, Record<T, string>>;
|
|
70
|
+
interface FastboardUIConfig {
|
|
71
|
+
toolbar?: {
|
|
72
|
+
enable?: boolean;
|
|
73
|
+
} & ToolbarConfig;
|
|
74
|
+
redo_undo?: {
|
|
75
|
+
enable?: boolean;
|
|
76
|
+
icons?: RedoUndoProps["icons"];
|
|
77
|
+
};
|
|
78
|
+
zoom_control?: {
|
|
79
|
+
enable?: boolean;
|
|
80
|
+
icons?: ZoomControlProps["icons"];
|
|
81
|
+
};
|
|
82
|
+
page_control?: {
|
|
83
|
+
enable?: boolean;
|
|
84
|
+
icons?: PageControlProps["icons"];
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
interface ReplayFastboardUIConfig {
|
|
88
|
+
player_control?: {
|
|
89
|
+
enable?: boolean;
|
|
90
|
+
icons?: PlayerControlProps["icons"];
|
|
91
|
+
};
|
|
92
|
+
}
|
|
83
93
|
|
|
84
94
|
declare interface ReplayFastboardProps {
|
|
85
95
|
player?: FastboardPlayer | null;
|
|
86
96
|
theme?: Theme;
|
|
87
97
|
language?: Language;
|
|
98
|
+
config?: ReplayFastboardUIConfig;
|
|
88
99
|
containerRef?: (container: HTMLDivElement | null) => void;
|
|
89
100
|
}
|
|
90
101
|
declare class ReplayFastboard extends SvelteComponentTyped<ReplayFastboardProps> {
|
|
@@ -102,32 +113,36 @@ declare class Fastboard extends SvelteComponentTyped<FastboardProps> {
|
|
|
102
113
|
|
|
103
114
|
interface UI {
|
|
104
115
|
/** render UI to div */
|
|
105
|
-
mount(div: Element, props?:
|
|
116
|
+
mount(div: Element, props?: FastboardProps): UI;
|
|
106
117
|
/** update UI (theme, language, etc.) */
|
|
107
|
-
update(props?:
|
|
118
|
+
update(props?: FastboardProps): void;
|
|
108
119
|
/** remove UI */
|
|
109
120
|
destroy(): void;
|
|
121
|
+
/** div == null ? destroy() : mount() */
|
|
122
|
+
setElement(div: Element | null): void;
|
|
110
123
|
}
|
|
111
124
|
/**
|
|
112
125
|
* @example
|
|
113
126
|
* let ui = createUI(fastboardApp, document.getElementById("whiteboard"));
|
|
114
127
|
* ui.update({ theme: "dark" })
|
|
115
128
|
*/
|
|
116
|
-
declare function createUI(app
|
|
129
|
+
declare function createUI(app?: FastboardApp | null, div?: Element): UI;
|
|
117
130
|
interface ReplayUI {
|
|
118
131
|
/** render UI to div */
|
|
119
|
-
mount(div: Element, props?:
|
|
132
|
+
mount(div: Element, props?: ReplayFastboardProps): ReplayUI;
|
|
120
133
|
/** update UI (theme, language, etc.) */
|
|
121
|
-
update(props?:
|
|
134
|
+
update(props?: ReplayFastboardProps): void;
|
|
122
135
|
/** remove UI */
|
|
123
136
|
destroy(): void;
|
|
137
|
+
/** div == null ? destroy() : mount() */
|
|
138
|
+
setElement(div: Element | null): void;
|
|
124
139
|
}
|
|
125
140
|
/**
|
|
126
141
|
* @example
|
|
127
142
|
* let ui = createReplayUI(fastboardPlayer, document.getElementById("whiteboard"));
|
|
128
143
|
* ui.update({ theme: "dark" })
|
|
129
144
|
*/
|
|
130
|
-
declare function createReplayUI(player
|
|
145
|
+
declare function createReplayUI(player?: FastboardPlayer | null, div?: Element): ReplayUI;
|
|
131
146
|
|
|
132
147
|
interface AppInToolbar {
|
|
133
148
|
kind: string;
|
|
@@ -150,4 +165,4 @@ declare class AppsInToolbar {
|
|
|
150
165
|
|
|
151
166
|
declare const apps: AppsInToolbar;
|
|
152
167
|
|
|
153
|
-
export { AppInToolbar, AppsInToolbar, Fastboard, FastboardProps, FastboardUIConfig, GenericIcon, I18nData, IconType, Language, PageControl, PageControlProps, PlayerControl, PlayerControlProps, RedoUndo, RedoUndoProps, ReplayFastboard, ReplayFastboardProps, ReplayUI, SvelteAction, Theme, Toolbar,
|
|
168
|
+
export { AppInToolbar, AppsInToolbar, Fastboard, FastboardProps, FastboardUIConfig, GenericIcon, I18nData, IconType, Language, PageControl, PageControlProps, PlayerControl, PlayerControlProps, RedoUndo, RedoUndoProps, ReplayFastboard, ReplayFastboardProps, ReplayFastboardUIConfig, ReplayUI, SvelteAction, Theme, Toolbar, ToolbarProps, UI, ZoomControl, ZoomControlProps, apps, createReplayUI, createUI };
|