@netless/fastboard-ui 0.3.22-beta.1 → 0.3.22-beta.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.js +148 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -176
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +148 -176
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/Fastboard/Fastboard.svelte +1 -23
- package/src/components/Toolbar/Toolbar.svelte +15 -2
- package/src/helpers/index.ts +8 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-ui",
|
|
3
|
-
"version": "0.3.22-beta.
|
|
3
|
+
"version": "0.3.22-beta.2",
|
|
4
4
|
"description": "The front-end of @netless/fastboard-core.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"svelte": "dist/index.svelte.mjs",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
],
|
|
12
12
|
"repository": "netless-io/fastboard",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@netless/fastboard-core": "0.3.22-beta.
|
|
14
|
+
"@netless/fastboard-core": "0.3.22-beta.2"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"tippy.js": "^6.3.7"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@netless/buildtool": "0.1.0",
|
|
21
|
-
"@netless/fastboard-core": "0.3.22-beta.
|
|
21
|
+
"@netless/fastboard-core": "0.3.22-beta.2",
|
|
22
22
|
"@netless/esbuild-plugin-inline-sass": "0.1.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<svelte:options immutable />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type {
|
|
4
|
+
import type { FastboardApp } from "@netless/fastboard-core";
|
|
5
5
|
import type { Language, Theme, FastboardUIConfig } from "../../typings";
|
|
6
6
|
import { onMount } from "svelte";
|
|
7
7
|
import { tippy_hide_all } from "../../actions/tippy";
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
export let language: Language = "en";
|
|
16
16
|
export let containerRef: ((element: HTMLDivElement | null) => void) | undefined = undefined;
|
|
17
17
|
export let config: FastboardUIConfig = {};
|
|
18
|
-
export let colors: Color[] | undefined = undefined;
|
|
19
18
|
|
|
20
19
|
const name = "fastboard";
|
|
21
20
|
const AppsShowToolbar = ["DocsViewer", "Slide"];
|
|
@@ -24,27 +23,6 @@
|
|
|
24
23
|
let layout: "hidden" | "toolbar-only" | "visible" = "hidden";
|
|
25
24
|
let mounted = false;
|
|
26
25
|
|
|
27
|
-
$: manager = app?.manager;
|
|
28
|
-
$: room = app?.manager.room;
|
|
29
|
-
$: if (manager && room) {
|
|
30
|
-
const floatBarOptions = (room as any).floatBarOptions as { colors?: Color[] };
|
|
31
|
-
if (floatBarOptions.colors) {
|
|
32
|
-
colors = floatBarOptions.colors as Color[];
|
|
33
|
-
}
|
|
34
|
-
if (config?.toolbar) {
|
|
35
|
-
const _colors = config.toolbar.colors;
|
|
36
|
-
if (!_colors && colors) {
|
|
37
|
-
config = {
|
|
38
|
-
...config,
|
|
39
|
-
toolbar: {
|
|
40
|
-
...config.toolbar,
|
|
41
|
-
colors,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
26
|
$: writable = app?.writable;
|
|
49
27
|
$: boxState = app?.boxState;
|
|
50
28
|
$: focusedApp = app?.focusedApp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { FastboardApp } from "@netless/fastboard-core";
|
|
2
|
+
import type { Color, FastboardApp } from "@netless/fastboard-core";
|
|
3
3
|
import type { Language, Theme, ToolbarConfig } from "../../typings";
|
|
4
4
|
import { writable as svelte_writable } from "svelte/store";
|
|
5
5
|
import { height } from "../../actions/height";
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let theme: Theme = "light";
|
|
12
12
|
export let language: Language = "en";
|
|
13
13
|
export let config: ToolbarConfig = {};
|
|
14
|
+
export let colors: Color[] | undefined = undefined;
|
|
14
15
|
|
|
15
16
|
const name = "fastboard-toolbar";
|
|
16
17
|
const extra_height = (32 + 4 + 4) * 2;
|
|
@@ -29,7 +30,19 @@
|
|
|
29
30
|
$: placement = config.placement || "left";
|
|
30
31
|
$: items = config.items || default_items;
|
|
31
32
|
$: hide_apps = config.apps?.enable === false;
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
$: if (app?.manager && app?.manager.room) {
|
|
35
|
+
if (colors && !config.colors?.length) {
|
|
36
|
+
const floatBarOptions = (app?.manager.room as any).floatBarOptions as { colors?: Color[] };
|
|
37
|
+
if (floatBarOptions.colors) {
|
|
38
|
+
colors = floatBarOptions.colors as Color[];
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
colors = config.colors;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
colors = default_colors;
|
|
45
|
+
}
|
|
33
46
|
</script>
|
|
34
47
|
|
|
35
48
|
<div class="{name} {theme}" class:collapsed use:height={container_height}>
|
package/src/helpers/index.ts
CHANGED
|
@@ -33,34 +33,22 @@ export function createUI(app?: FastboardApp | null, div?: Element): UI {
|
|
|
33
33
|
if (fastboard) {
|
|
34
34
|
fastboard.$destroy();
|
|
35
35
|
}
|
|
36
|
-
if (props?.config?.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
props.config = {
|
|
40
|
-
...props.config,
|
|
41
|
-
toolbar: {
|
|
42
|
-
...props.config.toolbar,
|
|
43
|
-
colors,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
36
|
+
if (colors && props?.config && !props.config.toolbar?.colors) {
|
|
37
|
+
if (!props?.config.toolbar) {
|
|
38
|
+
props.config.toolbar = {};
|
|
46
39
|
}
|
|
40
|
+
props.config.toolbar.colors = colors;
|
|
47
41
|
}
|
|
48
42
|
fastboard = new Fastboard({ target: div, props: { app, ...props } });
|
|
49
43
|
return ui;
|
|
50
44
|
},
|
|
51
45
|
update(props?: FastboardProps) {
|
|
52
46
|
if (fastboard && props) {
|
|
53
|
-
if (props?.config?.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
props.config = {
|
|
57
|
-
...props.config,
|
|
58
|
-
toolbar: {
|
|
59
|
-
...props.config.toolbar,
|
|
60
|
-
colors,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
47
|
+
if (colors && props?.config && !props.config.toolbar?.colors) {
|
|
48
|
+
if (!props?.config.toolbar) {
|
|
49
|
+
props.config.toolbar = {};
|
|
63
50
|
}
|
|
51
|
+
props.config.toolbar.colors = colors;
|
|
64
52
|
}
|
|
65
53
|
fastboard.$set(props);
|
|
66
54
|
}
|