@netless/fastboard-ui 0.3.5 → 0.3.7
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 +11 -11
- package/dist/index.js +179 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +168 -118
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +153 -111
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/actions/scroll.ts +1 -1
- package/src/components/Button/Button.svelte.d.ts +1 -2
- package/src/components/Toolbar/README.md +1 -1
- package/src/components/Toolbar/Toolbar.scss +1 -1
- package/src/components/Toolbar/components/Shapes.svelte +1 -0
- package/src/components/Toolbar/components/StrokeColor.svelte +1 -0
- package/src/components/Toolbar/components/TextColor.svelte +1 -0
- package/src/helpers/index.ts +12 -12
- package/src/index.ts +8 -4
- package/src/style.scss +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
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.
|
|
13
|
+
"@netless/fastboard-core": "0.3.7"
|
|
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.
|
|
20
|
+
"@netless/fastboard-core": "0.3.7"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"cleanup": "rimraf dist",
|
package/src/actions/scroll.ts
CHANGED
|
@@ -10,7 +10,7 @@ export const scrollTop: SvelteAction<Writable<number>> = function (node, value)
|
|
|
10
10
|
|
|
11
11
|
function on_scroll() {
|
|
12
12
|
clearTimeout(timer);
|
|
13
|
-
timer = setTimeout(() => value.set(node.scrollTop), 200);
|
|
13
|
+
timer = window.setTimeout(() => value.set(node.scrollTop), 200);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
node.addEventListener("scroll", on_scroll);
|
|
@@ -18,8 +18,7 @@ export declare interface ButtonEvents {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export declare interface ButtonSlots {
|
|
21
|
-
|
|
22
|
-
default: {};
|
|
21
|
+
default: any;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
declare class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {}
|
|
@@ -52,6 +52,6 @@ The `computed_height` is calculated by:
|
|
|
52
52
|
|
|
53
53
|
```js
|
|
54
54
|
const max_height = button_height * 2 + scrollable_area_full_height;
|
|
55
|
-
|
|
55
|
+
const full_height = container.height;
|
|
56
56
|
computed_height = full_height < max_height ? full_height : max_height;
|
|
57
57
|
```
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
68
69
|
<div class="fastboard-toolbar-shapes {theme}" on:click={set_appliance_or_shape}>
|
|
69
70
|
{#each shapes as key (key)}
|
|
70
71
|
{@const is_selected = appliance === "shape" ? shape === key : appliance === key}
|
package/src/helpers/index.ts
CHANGED
|
@@ -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?:
|
|
8
|
+
mount(div: Element, props?: FastboardProps): UI;
|
|
9
9
|
/** update UI (theme, language, etc.) */
|
|
10
|
-
update(props?:
|
|
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
|
|
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?:
|
|
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?:
|
|
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?:
|
|
53
|
+
mount(div: Element, props?: ReplayFastboardProps): ReplayUI;
|
|
54
54
|
/** update UI (theme, language, etc.) */
|
|
55
|
-
update(props?:
|
|
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
|
|
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?:
|
|
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?:
|
|
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;
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./style.scss";
|
|
2
|
+
|
|
1
3
|
export * from "./typings";
|
|
2
4
|
|
|
3
5
|
export { default as RedoUndo, type RedoUndoProps } from "./components/RedoUndo";
|
|
@@ -5,10 +7,12 @@ export { default as PageControl, type PageControlProps } from "./components/Page
|
|
|
5
7
|
export { default as ZoomControl, type ZoomControlProps } from "./components/ZoomControl";
|
|
6
8
|
export { default as Toolbar, type ToolbarProps } from "./components/Toolbar";
|
|
7
9
|
export { default as PlayerControl, type PlayerControlProps } from "./components/PlayerControl";
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
+
export {
|
|
11
|
+
Fastboard,
|
|
12
|
+
ReplayFastboard,
|
|
13
|
+
type FastboardProps,
|
|
14
|
+
type ReplayFastboardProps,
|
|
15
|
+
} from "./components/Fastboard";
|
|
10
16
|
|
|
11
17
|
export * from "./helpers";
|
|
12
18
|
export * from "./behaviors";
|
|
13
|
-
|
|
14
|
-
import "./style.scss";
|