@netless/fastboard-ui 0.3.0-canary.2 → 0.3.0-canary.5
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 +2 -2
- package/dist/index.js +61 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -21
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +61 -21
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/Fastboard/Fastboard.svelte +13 -3
- package/src/components/Fastboard/Fastboard.svelte.ts +1 -1
- package/src/components/Fastboard/ReplayFastboard.svelte +4 -3
- package/src/components/Fastboard/ReplayFastboard.svelte.ts +1 -1
- package/src/components/Toolbar/components/Contents.svelte +8 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-ui",
|
|
3
|
-
"version": "0.3.0-canary.
|
|
3
|
+
"version": "0.3.0-canary.5",
|
|
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.0-canary.
|
|
13
|
+
"@netless/fastboard-core": "0.3.0-canary.5"
|
|
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.0-canary.
|
|
20
|
+
"@netless/fastboard-core": "0.3.0-canary.5"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"cleanup": "rimraf dist",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { FastboardApp } from "@netless/fastboard-core";
|
|
3
3
|
import type { Language, Theme } from "../../typings";
|
|
4
|
+
import { onMount } from "svelte";
|
|
5
|
+
import { tippy_hide_all } from "../../actions/tippy";
|
|
4
6
|
import RedoUndo from "../RedoUndo";
|
|
5
7
|
import ZoomControl from "../ZoomControl";
|
|
6
8
|
import PageControl from "../PageControl";
|
|
@@ -9,18 +11,26 @@
|
|
|
9
11
|
export let app: FastboardApp | null | undefined = null;
|
|
10
12
|
export let theme: Theme = "light";
|
|
11
13
|
export let language: Language = "en";
|
|
12
|
-
export let
|
|
14
|
+
export let containerRef: ((element: HTMLDivElement | null) => void) | undefined = undefined;
|
|
13
15
|
|
|
14
16
|
const name = "fastboard";
|
|
15
17
|
|
|
16
18
|
let container: HTMLDivElement;
|
|
17
19
|
|
|
18
20
|
$: if (app && container) app.bindContainer(container);
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
onMount(() => {
|
|
23
|
+
if (containerRef) {
|
|
24
|
+
containerRef(container);
|
|
25
|
+
return () => {
|
|
26
|
+
if (containerRef) containerRef(null);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
20
30
|
</script>
|
|
21
31
|
|
|
22
32
|
<div class="{name}-root" class:loading={!app}>
|
|
23
|
-
<div class="{name}-view" bind:this={container} />
|
|
33
|
+
<div class="{name}-view" bind:this={container} on:touchstart|capture={tippy_hide_all} />
|
|
24
34
|
<div class="{name}-left">
|
|
25
35
|
<Toolbar {app} {theme} {language} />
|
|
26
36
|
</div>
|
|
@@ -6,7 +6,7 @@ export declare interface FastboardProps {
|
|
|
6
6
|
app?: FastboardApp | null;
|
|
7
7
|
theme?: Theme;
|
|
8
8
|
language?: Language;
|
|
9
|
-
|
|
9
|
+
containerRef?: (container: HTMLDivElement | null) => void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
declare class Fastboard extends SvelteComponentTyped<FastboardProps> {}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { FastboardPlayer } from "@netless/fastboard-core";
|
|
3
3
|
import type { Language, Theme } from "../../typings";
|
|
4
|
+
import { tippy_hide_all } from "../../actions/tippy";
|
|
4
5
|
import PlayerControl from "../PlayerControl";
|
|
5
6
|
|
|
6
7
|
export let player: FastboardPlayer | null | undefined = null;
|
|
7
8
|
export let theme: Theme = "light";
|
|
8
9
|
export let language: Language = "en";
|
|
9
|
-
export let
|
|
10
|
+
export let containerRef: ((element: HTMLDivElement | null) => void) | undefined = undefined;
|
|
10
11
|
|
|
11
12
|
const name = "fastboard";
|
|
12
13
|
|
|
13
14
|
let container: HTMLDivElement;
|
|
14
15
|
|
|
15
16
|
$: if (player && container) player.bindContainer(container);
|
|
16
|
-
$: if (
|
|
17
|
+
$: if (containerRef) containerRef(container || null);
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
20
|
<div class="{name}-root" class:loading={!player}>
|
|
20
|
-
<div class="{name}-view" bind:this={container} />
|
|
21
|
+
<div class="{name}-view" bind:this={container} on:touchstart|capture={tippy_hide_all} />
|
|
21
22
|
<div class="{name}-bottom">
|
|
22
23
|
<PlayerControl {player} {theme} {language} />
|
|
23
24
|
</div>
|
|
@@ -6,7 +6,7 @@ export declare interface ReplayFastboardProps {
|
|
|
6
6
|
player?: FastboardPlayer | null;
|
|
7
7
|
theme?: Theme;
|
|
8
8
|
language?: Language;
|
|
9
|
-
|
|
9
|
+
containerRef?: (container: HTMLDivElement | null) => void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
declare class ReplayFastboard extends SvelteComponentTyped<ReplayFastboardProps> {}
|
|
@@ -51,9 +51,16 @@
|
|
|
51
51
|
$: shape = $memberState?.shapeType;
|
|
52
52
|
$: status = app?.appsStatus;
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
$: if (applianceShapes.includes(appliance as Appliance)) {
|
|
55
|
+
last_shape = appliance as Shape;
|
|
56
|
+
} else if (shape) {
|
|
57
|
+
last_shape = shape;
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
$: max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
|
|
56
61
|
|
|
62
|
+
let top = writable(0);
|
|
63
|
+
|
|
57
64
|
function scroll_up() {
|
|
58
65
|
$top = clamp($top - 32 - 4, 0, max_scroll);
|
|
59
66
|
}
|
|
@@ -80,11 +87,6 @@
|
|
|
80
87
|
app?.setAppliance("shape", last_shape as Exclude<Shape, Appliance>);
|
|
81
88
|
}
|
|
82
89
|
}
|
|
83
|
-
$: if (applianceShapes.includes(appliance as Appliance)) {
|
|
84
|
-
last_shape = appliance as Shape;
|
|
85
|
-
} else if (shape) {
|
|
86
|
-
last_shape = shape;
|
|
87
|
-
}
|
|
88
90
|
function eraser() {
|
|
89
91
|
app?.setAppliance("eraser");
|
|
90
92
|
}
|