@netless/fastboard-ui 0.3.0-canary.4 → 0.3.0-canary.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 +1 -1
- package/dist/index.js +178 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -101
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +170 -109
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/actions/tippy.ts +1 -0
- package/src/behaviors/index.ts +2 -2
- package/src/components/Fastboard/Fastboard.svelte +20 -2
- package/src/components/Fastboard/ReplayFastboard.svelte +20 -2
- package/src/components/PageControl/PageControl.svelte +1 -0
- package/src/components/PlayerControl/PlayerControl.svelte +1 -1
- package/src/components/Toolbar/components/Contents.scss +4 -2
- package/src/components/Toolbar/components/Contents.svelte +10 -8
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.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.0-canary.
|
|
13
|
+
"@netless/fastboard-core": "0.3.0-canary.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.0-canary.
|
|
20
|
+
"@netless/fastboard-core": "0.3.0-canary.7"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"cleanup": "rimraf dist",
|
package/src/actions/tippy.ts
CHANGED
package/src/behaviors/index.ts
CHANGED
|
@@ -26,8 +26,8 @@ class AppsInToolbar {
|
|
|
26
26
|
this._listeners = this._listeners.filter(item => item !== fn);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
push(data: AppInToolbar) {
|
|
30
|
-
this._data.push(data);
|
|
29
|
+
push(...data: AppInToolbar[]) {
|
|
30
|
+
this._data.push(...data);
|
|
31
31
|
this._listeners.forEach(fn => fn(this._data));
|
|
32
32
|
}
|
|
33
33
|
insert(data: AppInToolbar, index: number) {
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
import { tippy_hide_all } from "../../actions/tippy";
|
|
5
6
|
import RedoUndo from "../RedoUndo";
|
|
6
7
|
import ZoomControl from "../ZoomControl";
|
|
@@ -16,8 +17,25 @@
|
|
|
16
17
|
|
|
17
18
|
let container: HTMLDivElement;
|
|
18
19
|
|
|
19
|
-
$:
|
|
20
|
-
|
|
20
|
+
$: try {
|
|
21
|
+
if (app && container) app.bindContainer(container);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
console.error("[fastboard] An error occurred while binding container");
|
|
24
|
+
console.error(err);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
$: if (app && theme) {
|
|
28
|
+
app.manager.setPrefersColorScheme(theme);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onMount(() => {
|
|
32
|
+
if (containerRef) {
|
|
33
|
+
containerRef(container);
|
|
34
|
+
return () => {
|
|
35
|
+
if (containerRef) containerRef(null);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
21
39
|
</script>
|
|
22
40
|
|
|
23
41
|
<div class="{name}-root" class:loading={!app}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { FastboardPlayer } from "@netless/fastboard-core";
|
|
3
3
|
import type { Language, Theme } from "../../typings";
|
|
4
|
+
import { onMount } from "svelte";
|
|
4
5
|
import { tippy_hide_all } from "../../actions/tippy";
|
|
5
6
|
import PlayerControl from "../PlayerControl";
|
|
6
7
|
|
|
@@ -13,8 +14,25 @@
|
|
|
13
14
|
|
|
14
15
|
let container: HTMLDivElement;
|
|
15
16
|
|
|
16
|
-
$:
|
|
17
|
-
|
|
17
|
+
$: try {
|
|
18
|
+
if (player && container) player.bindContainer(container);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error("[fastboard] An error occurred while binding container");
|
|
21
|
+
console.error(err);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
$: if (player && theme) {
|
|
25
|
+
player.manager.setPrefersColorScheme(theme);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
onMount(() => {
|
|
29
|
+
if (containerRef) {
|
|
30
|
+
containerRef(container);
|
|
31
|
+
return () => {
|
|
32
|
+
if (containerRef) containerRef(null);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
18
36
|
</script>
|
|
19
37
|
|
|
20
38
|
<div class="{name}-root" class:loading={!player}>
|
|
@@ -112,14 +112,15 @@ $name: "fastboard-toolbar";
|
|
|
112
112
|
|
|
113
113
|
.#{$name}-panel.apps {
|
|
114
114
|
display: grid;
|
|
115
|
-
grid-template-columns: repeat(3, 1fr);
|
|
115
|
+
grid-template-columns: repeat(min(var(--n, 3), 3), minmax(max-content, 1fr));
|
|
116
116
|
gap: 4px;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
.#{$name}-app-btn {
|
|
120
120
|
margin: 0;
|
|
121
121
|
border: 0;
|
|
122
|
-
|
|
122
|
+
border-radius: 2px;
|
|
123
|
+
padding: 4px 6px;
|
|
123
124
|
background-color: transparent;
|
|
124
125
|
display: inline-flex;
|
|
125
126
|
flex-direction: column;
|
|
@@ -139,6 +140,7 @@ $name: "fastboard-toolbar";
|
|
|
139
140
|
|
|
140
141
|
&-text {
|
|
141
142
|
font-size: 14px;
|
|
143
|
+
line-height: 1;
|
|
142
144
|
max-width: 100%;
|
|
143
145
|
overflow: hidden;
|
|
144
146
|
text-overflow: ellipsis;
|
|
@@ -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
|
}
|
|
@@ -170,8 +172,8 @@
|
|
|
170
172
|
<div class="{name}-panel-divider" />
|
|
171
173
|
<StrokeColor {app} {theme} {disabled} />
|
|
172
174
|
</div>
|
|
173
|
-
<div class="{name}-panel apps" bind:this={apps_panel}>
|
|
174
|
-
{#each apps
|
|
175
|
+
<div class="{name}-panel apps" style="--n:{$apps.length}" bind:this={apps_panel}>
|
|
176
|
+
{#each $apps as netless_app}
|
|
175
177
|
{@const { icon, label, kind, onClick } = netless_app}
|
|
176
178
|
{@const state = $status && $status[kind]}
|
|
177
179
|
<button
|