@netless/fastboard 0.0.11 → 0.2.1
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/LICENSE.txt +1 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +24 -85
- package/src/index.ts +2 -49
- package/README.md +0 -136
- package/dist/index.cjs.js +0 -14
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -2804
- package/dist/index.es.js.map +0 -1
- package/dist/svelte.cjs.js +0 -2
- package/dist/svelte.cjs.js.map +0 -1
- package/dist/svelte.es.js +0 -32
- package/dist/svelte.es.js.map +0 -1
- package/dist/vue.cjs.js +0 -2
- package/dist/vue.cjs.js.map +0 -1
- package/dist/vue.es.js +0 -43
- package/dist/vue.es.js.map +0 -1
- package/src/WhiteboardApp.ts +0 -146
- package/src/behaviors/register-apps.ts +0 -39
- package/src/behaviors/style.ts +0 -17
- package/src/components/PageControl/PageControl.scss +0 -80
- package/src/components/PageControl/PageControl.tsx +0 -110
- package/src/components/PageControl/hooks.ts +0 -70
- package/src/components/PageControl/index.ts +0 -2
- package/src/components/PlayerControl/PlayerControl.scss +0 -145
- package/src/components/PlayerControl/PlayerControl.tsx +0 -157
- package/src/components/PlayerControl/components/Button.tsx +0 -55
- package/src/components/PlayerControl/hooks.ts +0 -88
- package/src/components/PlayerControl/icons/Loading.tsx +0 -13
- package/src/components/PlayerControl/icons/Pause.tsx +0 -13
- package/src/components/PlayerControl/icons/Play.tsx +0 -13
- package/src/components/PlayerControl/icons/index.ts +0 -10
- package/src/components/PlayerControl/index.ts +0 -2
- package/src/components/RedoUndo/RedoUndo.scss +0 -56
- package/src/components/RedoUndo/RedoUndo.tsx +0 -79
- package/src/components/RedoUndo/hooks.ts +0 -50
- package/src/components/RedoUndo/index.ts +0 -2
- package/src/components/Root.scss +0 -55
- package/src/components/Root.tsx +0 -65
- package/src/components/Toolbar/Content.tsx +0 -94
- package/src/components/Toolbar/Toolbar.scss +0 -281
- package/src/components/Toolbar/Toolbar.tsx +0 -132
- package/src/components/Toolbar/components/ApplianceButtons.tsx +0 -132
- package/src/components/Toolbar/components/AppsButton.tsx +0 -106
- package/src/components/Toolbar/components/Button.tsx +0 -54
- package/src/components/Toolbar/components/ColorBox.tsx +0 -56
- package/src/components/Toolbar/components/CutLine.tsx +0 -8
- package/src/components/Toolbar/components/Mask.tsx +0 -44
- package/src/components/Toolbar/components/PencilButton.tsx +0 -70
- package/src/components/Toolbar/components/ShapesButton.tsx +0 -143
- package/src/components/Toolbar/components/Slider.tsx +0 -27
- package/src/components/Toolbar/components/TextButton.tsx +0 -66
- package/src/components/Toolbar/components/UpDownButtons.tsx +0 -49
- package/src/components/Toolbar/components/assets/cocos.png +0 -0
- package/src/components/Toolbar/components/assets/collapsed.png +0 -0
- package/src/components/Toolbar/components/assets/countdown.png +0 -0
- package/src/components/Toolbar/components/assets/expanded.png +0 -0
- package/src/components/Toolbar/components/assets/geogebra.png +0 -0
- package/src/components/Toolbar/components/assets/vscode.png +0 -0
- package/src/components/Toolbar/const.ts +0 -32
- package/src/components/Toolbar/hooks.ts +0 -112
- package/src/components/Toolbar/icons/Apps.tsx +0 -16
- package/src/components/Toolbar/icons/Arrow.tsx +0 -16
- package/src/components/Toolbar/icons/Circle.tsx +0 -21
- package/src/components/Toolbar/icons/Clean.tsx +0 -16
- package/src/components/Toolbar/icons/Clicker.tsx +0 -19
- package/src/components/Toolbar/icons/Collapse.tsx +0 -17
- package/src/components/Toolbar/icons/Diamond.tsx +0 -17
- package/src/components/Toolbar/icons/Down.tsx +0 -17
- package/src/components/Toolbar/icons/Eraser.tsx +0 -16
- package/src/components/Toolbar/icons/Expand.tsx +0 -17
- package/src/components/Toolbar/icons/Line.tsx +0 -13
- package/src/components/Toolbar/icons/Pencil.tsx +0 -16
- package/src/components/Toolbar/icons/Rectangle.tsx +0 -13
- package/src/components/Toolbar/icons/Selector.tsx +0 -16
- package/src/components/Toolbar/icons/SpeechBalloon.tsx +0 -17
- package/src/components/Toolbar/icons/Star.tsx +0 -17
- package/src/components/Toolbar/icons/Text.tsx +0 -16
- package/src/components/Toolbar/icons/Triangle.tsx +0 -17
- package/src/components/Toolbar/icons/Up.tsx +0 -17
- package/src/components/Toolbar/icons/index.ts +0 -42
- package/src/components/Toolbar/index.ts +0 -2
- package/src/components/ZoomControl/ZoomControl.scss +0 -80
- package/src/components/ZoomControl/ZoomControl.tsx +0 -109
- package/src/components/ZoomControl/hooks.ts +0 -111
- package/src/components/ZoomControl/index.ts +0 -2
- package/src/components/hooks.ts +0 -80
- package/src/i18n/en.json +0 -31
- package/src/i18n/index.ts +0 -22
- package/src/i18n/zh-CN.json +0 -32
- package/src/icons/ChevronLeft.tsx +0 -21
- package/src/icons/ChevronRight.tsx +0 -21
- package/src/icons/FilePlus.tsx +0 -18
- package/src/icons/Minus.tsx +0 -21
- package/src/icons/Plus.tsx +0 -21
- package/src/icons/Redo.tsx +0 -24
- package/src/icons/Reset.tsx +0 -23
- package/src/icons/Undo.tsx +0 -24
- package/src/icons/index.tsx +0 -11
- package/src/internal/Instance.tsx +0 -275
- package/src/internal/helpers.ts +0 -86
- package/src/internal/hooks.ts +0 -9
- package/src/internal/index.ts +0 -3
- package/src/internal/mount-whiteboard.ts +0 -90
- package/src/react.tsx +0 -52
- package/src/style.scss +0 -35
- package/src/svelte.ts +0 -45
- package/src/theme/index.ts +0 -36
- package/src/types/index.ts +0 -22
- package/src/vue.ts +0 -74
package/src/WhiteboardApp.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { ConversionResponse, SceneDefinition } from "white-web-sdk";
|
|
2
|
-
import type {
|
|
3
|
-
InsertDocsParams,
|
|
4
|
-
InsertMediaParams,
|
|
5
|
-
Language,
|
|
6
|
-
Layout,
|
|
7
|
-
WhiteboardAppConfig,
|
|
8
|
-
} from "./internal";
|
|
9
|
-
import { genUID, Instance, makeSlideParams } from "./internal";
|
|
10
|
-
|
|
11
|
-
export type {
|
|
12
|
-
Language,
|
|
13
|
-
Layout,
|
|
14
|
-
WhiteboardAppConfig,
|
|
15
|
-
InsertMediaParams,
|
|
16
|
-
InsertDocsParams,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export class WhiteboardApp {
|
|
20
|
-
private readonly _instance: Instance;
|
|
21
|
-
|
|
22
|
-
public constructor(readonly config: WhiteboardAppConfig) {
|
|
23
|
-
this._instance = new Instance(config);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public get room() {
|
|
27
|
-
return this._instance.room;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public get manager() {
|
|
31
|
-
return this._instance.manager;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public get sdk() {
|
|
35
|
-
return this._instance.sdk;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public get i18n() {
|
|
39
|
-
return this._instance.i18n;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public get target(): HTMLElement | null {
|
|
43
|
-
return this._instance.target;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public get collector(): HTMLElement | null {
|
|
47
|
-
return this._instance.collector;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public bindElement(target?: HTMLElement | null) {
|
|
51
|
-
this._instance.bindElement(target || null);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public bindCollector(collector?: HTMLElement | null) {
|
|
55
|
-
this._instance.bindCollector(collector || null);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public get layout() {
|
|
59
|
-
return this._instance.config.layout;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public updateLayout(layout?: Layout | undefined) {
|
|
63
|
-
this._instance.updateLayout(layout);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public insertMedia(params: InsertMediaParams) {
|
|
67
|
-
this._instance.insertMedia(params);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Insert PDF/PPTX from conversion result.
|
|
72
|
-
* @param status https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress
|
|
73
|
-
*/
|
|
74
|
-
public insertDocs(
|
|
75
|
-
filename: string,
|
|
76
|
-
status: ConversionResponse
|
|
77
|
-
): Promise<string | undefined>;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Manual way.
|
|
81
|
-
*/
|
|
82
|
-
public insertDocs(params: InsertDocsParams): Promise<string | undefined>;
|
|
83
|
-
|
|
84
|
-
public insertDocs(
|
|
85
|
-
arg1: string | InsertDocsParams,
|
|
86
|
-
arg2?: ConversionResponse
|
|
87
|
-
) {
|
|
88
|
-
if (typeof arg1 === "object" && "fileType" in arg1) {
|
|
89
|
-
return this._instance.insertDocs(arg1);
|
|
90
|
-
} else if (arg2 && arg2.status !== "Finished") {
|
|
91
|
-
throw new Error("[WhiteboardApp] cannot insert a converting doc");
|
|
92
|
-
} else if (arg2 && arg2.progress) {
|
|
93
|
-
const scenes: SceneDefinition[] = arg2.progress.convertedFileList.map(
|
|
94
|
-
(f, i) => ({
|
|
95
|
-
name: String(i + 1),
|
|
96
|
-
ppt: {
|
|
97
|
-
src: f.conversionFileUrl,
|
|
98
|
-
width: f.width,
|
|
99
|
-
height: f.height,
|
|
100
|
-
previewURL: f.preview,
|
|
101
|
-
},
|
|
102
|
-
})
|
|
103
|
-
);
|
|
104
|
-
const uid = genUID();
|
|
105
|
-
const scenePath = `/${arg2.uuid}/${uid}`;
|
|
106
|
-
const { scenesWithoutPPT, taskId, url } = makeSlideParams(scenes);
|
|
107
|
-
if (taskId && url) {
|
|
108
|
-
return this._instance.insertDocs({
|
|
109
|
-
fileType: "pptx",
|
|
110
|
-
scenePath,
|
|
111
|
-
taskId,
|
|
112
|
-
title: arg1,
|
|
113
|
-
url,
|
|
114
|
-
scenes: scenesWithoutPPT,
|
|
115
|
-
});
|
|
116
|
-
} else {
|
|
117
|
-
return this._instance.insertDocs({
|
|
118
|
-
fileType: "pdf",
|
|
119
|
-
scenePath,
|
|
120
|
-
scenes,
|
|
121
|
-
title: arg1,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
public insertCodeEditor() {
|
|
128
|
-
return this._instance.insertCodeEditor();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
public insertGeoGebra() {
|
|
132
|
-
return this._instance.insertGeoGebra();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
public insertCountdown() {
|
|
136
|
-
return this._instance.insertCountdown();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public changeLanguage(language: Language) {
|
|
140
|
-
return this._instance.changeLanguage(language);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public dispose() {
|
|
144
|
-
return this._instance.dispose();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { WindowManager } from "@netless/window-manager";
|
|
2
|
-
|
|
3
|
-
WindowManager.register({
|
|
4
|
-
kind: "Slide",
|
|
5
|
-
appOptions: {
|
|
6
|
-
// turn on to show debug controller
|
|
7
|
-
debug: false,
|
|
8
|
-
},
|
|
9
|
-
src: async () => {
|
|
10
|
-
const app = await import("@netless/app-slide");
|
|
11
|
-
return app.default ?? app;
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
WindowManager.register({
|
|
16
|
-
kind: "Monaco",
|
|
17
|
-
src: async () => {
|
|
18
|
-
const app = await import("@netless/app-monaco");
|
|
19
|
-
return app.default ?? app;
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
WindowManager.register({
|
|
23
|
-
kind: "Countdown",
|
|
24
|
-
src: async () => {
|
|
25
|
-
const app = await import("@netless/app-countdown");
|
|
26
|
-
return app.default ?? app;
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
WindowManager.register({
|
|
30
|
-
kind: "GeoGebra",
|
|
31
|
-
src: async () => {
|
|
32
|
-
const app = await import("@netless/app-geogebra");
|
|
33
|
-
return app.default ?? app;
|
|
34
|
-
},
|
|
35
|
-
appOptions: {
|
|
36
|
-
HTML5Codebase:
|
|
37
|
-
"https://flat-storage-cn-hz.whiteboard.agora.io/GeoGebra/HTML5/5.0/web3d",
|
|
38
|
-
},
|
|
39
|
-
});
|
package/src/behaviors/style.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { applyStyles } from "../internal";
|
|
2
|
-
import style from "../style.scss?inline";
|
|
3
|
-
|
|
4
|
-
const newEl = applyStyles(style);
|
|
5
|
-
|
|
6
|
-
if (import.meta.hot) {
|
|
7
|
-
import.meta.hot.dispose(data => {
|
|
8
|
-
data.el = newEl;
|
|
9
|
-
});
|
|
10
|
-
import.meta.hot.accept(() => {
|
|
11
|
-
const oldEl = import.meta.hot?.data.el;
|
|
12
|
-
if (oldEl) {
|
|
13
|
-
oldEl.innerText = newEl.innerText;
|
|
14
|
-
newEl.remove();
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
$name: "fastboard-page-control";
|
|
2
|
-
|
|
3
|
-
.#{$name} {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: 4px;
|
|
7
|
-
padding: 4px;
|
|
8
|
-
border-radius: 4px;
|
|
9
|
-
backdrop-filter: blur(2px);
|
|
10
|
-
-webkit-backdrop-filter: blur(2px);
|
|
11
|
-
|
|
12
|
-
&.light {
|
|
13
|
-
color: #333;
|
|
14
|
-
background-color: rgba($color: #fff, $alpha: 0.85);
|
|
15
|
-
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.dark {
|
|
19
|
-
color: #ddd;
|
|
20
|
-
background-color: rgba($color: #333, $alpha: 0.85);
|
|
21
|
-
border: 1px solid rgba(0, 0, 0, 0.45);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.#{$name}-btn {
|
|
26
|
-
appearance: none;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
margin: 0;
|
|
29
|
-
border: 0;
|
|
30
|
-
padding: 0;
|
|
31
|
-
width: 24px;
|
|
32
|
-
height: 24px;
|
|
33
|
-
background-color: transparent;
|
|
34
|
-
border-radius: 4px;
|
|
35
|
-
font-size: 24px;
|
|
36
|
-
line-height: 1;
|
|
37
|
-
|
|
38
|
-
svg,
|
|
39
|
-
img {
|
|
40
|
-
width: 1em;
|
|
41
|
-
height: 1em;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:disabled {
|
|
45
|
-
opacity: 0.5;
|
|
46
|
-
cursor: not-allowed;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&.light:not(:disabled):hover {
|
|
50
|
-
background-color: rgba(51, 129, 255, 0.1);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&.dark:not(:disabled):hover {
|
|
54
|
-
background-color: rgba(51, 129, 255, 0.25);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.#{$name}-cut-line {
|
|
59
|
-
height: 24px;
|
|
60
|
-
width: 0.5px;
|
|
61
|
-
|
|
62
|
-
&.light {
|
|
63
|
-
background-color: #e7e7e7;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&.dark {
|
|
67
|
-
background-color: rgba(255, 255, 255, 0.15);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.#{$name}-slash {
|
|
72
|
-
opacity: 0.6;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.#{$name}-page,
|
|
76
|
-
.#{$name}-slash,
|
|
77
|
-
.#{$name}-page-count {
|
|
78
|
-
font-size: 12px;
|
|
79
|
-
font-variant-numeric: tabular-nums;
|
|
80
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { CommonProps, GenericIcon } from "../../types";
|
|
2
|
-
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import Tippy from "@tippyjs/react";
|
|
6
|
-
|
|
7
|
-
import { TopOffset } from "../../theme";
|
|
8
|
-
import { Icon } from "../../icons";
|
|
9
|
-
import { FilePlus } from "../../icons/FilePlus";
|
|
10
|
-
import { ChevronLeft } from "../../icons/ChevronLeft";
|
|
11
|
-
import { ChevronRight } from "../../icons/ChevronRight";
|
|
12
|
-
import { useWritable } from "../hooks";
|
|
13
|
-
import { usePageControl } from "./hooks";
|
|
14
|
-
|
|
15
|
-
export const name = "fastboard-page-control";
|
|
16
|
-
|
|
17
|
-
export type PageControlProps = CommonProps &
|
|
18
|
-
GenericIcon<"add" | "prev" | "next">;
|
|
19
|
-
|
|
20
|
-
export function PageControl({
|
|
21
|
-
room,
|
|
22
|
-
manager,
|
|
23
|
-
theme = "light",
|
|
24
|
-
addIcon,
|
|
25
|
-
addIconDisable,
|
|
26
|
-
prevIcon,
|
|
27
|
-
prevIconDisable,
|
|
28
|
-
nextIcon,
|
|
29
|
-
nextIconDisable,
|
|
30
|
-
i18n,
|
|
31
|
-
}: PageControlProps) {
|
|
32
|
-
const writable = useWritable(room);
|
|
33
|
-
const { pageIndex, pageCount, ...actions } = usePageControl(room, manager);
|
|
34
|
-
|
|
35
|
-
const disabled = !writable;
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className={clsx(name, theme)}>
|
|
39
|
-
{/* <span className={clsx(`${name}-cut-line`, theme)} />{" "} */}
|
|
40
|
-
<Tippy
|
|
41
|
-
className="fastboard-tip"
|
|
42
|
-
content={i18n?.t("prevPage")}
|
|
43
|
-
theme={theme}
|
|
44
|
-
disabled={disabled}
|
|
45
|
-
placement="top"
|
|
46
|
-
duration={300}
|
|
47
|
-
offset={TopOffset}
|
|
48
|
-
>
|
|
49
|
-
<button
|
|
50
|
-
className={clsx(`${name}-btn`, "prev", theme)}
|
|
51
|
-
disabled={disabled || pageIndex === 0}
|
|
52
|
-
onClick={actions.prevPage}
|
|
53
|
-
>
|
|
54
|
-
<Icon
|
|
55
|
-
fallback={<ChevronLeft theme={theme} />}
|
|
56
|
-
src={disabled ? prevIconDisable : prevIcon}
|
|
57
|
-
alt="[prev]"
|
|
58
|
-
/>
|
|
59
|
-
</button>
|
|
60
|
-
</Tippy>
|
|
61
|
-
<span className={clsx(`${name}-page`, theme)}>
|
|
62
|
-
{pageCount === 0 ? "\u2026" : pageIndex + 1}
|
|
63
|
-
</span>
|
|
64
|
-
<span className={clsx(`${name}-slash`, theme)}>/</span>
|
|
65
|
-
<span className={clsx(`${name}-page-count`, theme)}>{pageCount}</span>
|
|
66
|
-
<Tippy
|
|
67
|
-
className="fastboard-tip"
|
|
68
|
-
content={i18n?.t("nextPage")}
|
|
69
|
-
theme={theme}
|
|
70
|
-
disabled={disabled}
|
|
71
|
-
placement="top"
|
|
72
|
-
duration={300}
|
|
73
|
-
offset={TopOffset}
|
|
74
|
-
>
|
|
75
|
-
<button
|
|
76
|
-
className={clsx(`${name}-btn`, "next", theme)}
|
|
77
|
-
disabled={disabled || pageIndex === pageCount - 1}
|
|
78
|
-
onClick={actions.nextPage}
|
|
79
|
-
>
|
|
80
|
-
<Icon
|
|
81
|
-
fallback={<ChevronRight theme={theme} />}
|
|
82
|
-
src={disabled ? nextIconDisable : nextIcon}
|
|
83
|
-
alt="[next]"
|
|
84
|
-
/>
|
|
85
|
-
</button>
|
|
86
|
-
</Tippy>
|
|
87
|
-
<Tippy
|
|
88
|
-
className="fastboard-tip"
|
|
89
|
-
content={i18n?.t("addPage")}
|
|
90
|
-
theme={theme}
|
|
91
|
-
disabled={disabled}
|
|
92
|
-
placement="top"
|
|
93
|
-
duration={300}
|
|
94
|
-
offset={TopOffset}
|
|
95
|
-
>
|
|
96
|
-
<button
|
|
97
|
-
className={clsx(`${name}-btn`, "add", theme)}
|
|
98
|
-
disabled={disabled}
|
|
99
|
-
onClick={actions.addPage}
|
|
100
|
-
>
|
|
101
|
-
<Icon
|
|
102
|
-
fallback={<FilePlus theme={theme} />}
|
|
103
|
-
src={disabled ? addIconDisable : addIcon}
|
|
104
|
-
alt="[add]"
|
|
105
|
-
/>
|
|
106
|
-
</button>
|
|
107
|
-
</Tippy>
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { Room, RoomState } from "white-web-sdk";
|
|
2
|
-
import type { WindowManager } from "@netless/window-manager";
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
|
-
|
|
5
|
-
export function usePageControl(
|
|
6
|
-
room?: Room | null,
|
|
7
|
-
manager?: WindowManager | null
|
|
8
|
-
) {
|
|
9
|
-
const [pageIndex, setPageIndex] = useState(0);
|
|
10
|
-
const [pageCount, setPageCount] = useState(0);
|
|
11
|
-
|
|
12
|
-
const addPage = useCallback(async () => {
|
|
13
|
-
if (manager && room) {
|
|
14
|
-
await manager.switchMainViewToWriter();
|
|
15
|
-
const path = room.state.sceneState.contextPath;
|
|
16
|
-
room.putScenes(path, [{}], pageIndex + 1);
|
|
17
|
-
await manager.setMainViewSceneIndex(pageIndex + 1);
|
|
18
|
-
} else if (!manager && room) {
|
|
19
|
-
const path = room.state.sceneState.contextPath;
|
|
20
|
-
room.putScenes(path, [{}], pageIndex + 1);
|
|
21
|
-
room.setSceneIndex(pageIndex + 1);
|
|
22
|
-
}
|
|
23
|
-
}, [room, manager, pageIndex]);
|
|
24
|
-
|
|
25
|
-
const prevPage = useCallback(() => {
|
|
26
|
-
if (manager) {
|
|
27
|
-
manager.setMainViewSceneIndex(pageIndex - 1);
|
|
28
|
-
} else if (room) {
|
|
29
|
-
room.pptPreviousStep();
|
|
30
|
-
}
|
|
31
|
-
}, [room, manager, pageIndex]);
|
|
32
|
-
|
|
33
|
-
const nextPage = useCallback(() => {
|
|
34
|
-
if (manager) {
|
|
35
|
-
manager.setMainViewSceneIndex(pageIndex + 1);
|
|
36
|
-
} else if (room) {
|
|
37
|
-
room.pptNextStep();
|
|
38
|
-
}
|
|
39
|
-
}, [room, manager, pageIndex]);
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (room) {
|
|
43
|
-
setPageIndex(room.state.sceneState.index);
|
|
44
|
-
setPageCount(room.state.sceneState.scenes.length);
|
|
45
|
-
|
|
46
|
-
if (manager) {
|
|
47
|
-
manager.emitter.on("mainViewSceneIndexChange", setPageIndex);
|
|
48
|
-
|
|
49
|
-
return () => {
|
|
50
|
-
manager.emitter.off("mainViewSceneIndexChange", setPageIndex);
|
|
51
|
-
};
|
|
52
|
-
} else {
|
|
53
|
-
const onRoomStateChanged = (modifyState: Partial<RoomState>) => {
|
|
54
|
-
if (modifyState.sceneState) {
|
|
55
|
-
setPageIndex(modifyState.sceneState.index);
|
|
56
|
-
setPageCount(modifyState.sceneState.scenes.length);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
room.callbacks.on("onRoomStateChanged", onRoomStateChanged);
|
|
61
|
-
|
|
62
|
-
return () => {
|
|
63
|
-
room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, [room, manager]);
|
|
68
|
-
|
|
69
|
-
return { pageIndex, pageCount, prevPage, nextPage, addPage };
|
|
70
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
$name: "fastboard-player-control";
|
|
2
|
-
|
|
3
|
-
.#{$name} {
|
|
4
|
-
width: 100%;
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: 4px;
|
|
8
|
-
padding: 4px;
|
|
9
|
-
border-radius: 4px;
|
|
10
|
-
backdrop-filter: blur(2px);
|
|
11
|
-
-webkit-backdrop-filter: blur(2px);
|
|
12
|
-
|
|
13
|
-
&.auto-hide {
|
|
14
|
-
opacity: 0;
|
|
15
|
-
transition: opacity 0.2s;
|
|
16
|
-
|
|
17
|
-
&:hover {
|
|
18
|
-
opacity: 1;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.rc-slider-disabled {
|
|
23
|
-
background: transparent;
|
|
24
|
-
opacity: 0.5;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.rc-slider-rail,
|
|
28
|
-
.rc-slider-track {
|
|
29
|
-
height: 2px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.tippy-content {
|
|
33
|
-
padding: 8px;
|
|
34
|
-
}
|
|
35
|
-
.tippy-box {
|
|
36
|
-
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
37
|
-
background-color: rgba($color: #333, $alpha: 0.95);
|
|
38
|
-
backdrop-filter: blur(2px);
|
|
39
|
-
-webkit-backdrop-filter: blur(2px);
|
|
40
|
-
}
|
|
41
|
-
.tippy-box[data-theme~="light"] {
|
|
42
|
-
background-color: rgba($color: #fff, $alpha: 0.95);
|
|
43
|
-
box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.25);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&.light {
|
|
47
|
-
color: #333;
|
|
48
|
-
background-color: rgba($color: #fff, $alpha: 0.85);
|
|
49
|
-
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&.dark {
|
|
53
|
-
color: #ddd;
|
|
54
|
-
background-color: rgba($color: #333, $alpha: 0.85);
|
|
55
|
-
border: 1px solid rgba(0, 0, 0, 0.45);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.#{$name}-btn {
|
|
60
|
-
appearance: none;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
margin: 0;
|
|
63
|
-
border: 0;
|
|
64
|
-
padding: 0;
|
|
65
|
-
min-width: 24px;
|
|
66
|
-
height: 24px;
|
|
67
|
-
background-color: transparent;
|
|
68
|
-
border-radius: 4px;
|
|
69
|
-
font-size: 24px;
|
|
70
|
-
line-height: 1;
|
|
71
|
-
display: inline-flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
|
|
75
|
-
svg,
|
|
76
|
-
img {
|
|
77
|
-
width: 1em;
|
|
78
|
-
height: 1em;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&:disabled {
|
|
82
|
-
opacity: 0.5;
|
|
83
|
-
cursor: not-allowed;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&.light:not(:disabled):hover {
|
|
87
|
-
background-color: rgba(51, 129, 255, 0.1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&.dark:not(:disabled):hover {
|
|
91
|
-
background-color: rgba(51, 129, 255, 0.25);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&.loading {
|
|
95
|
-
animation: fastboard-player-control-rotate 0.5s linear infinite;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@keyframes fastboard-player-control-rotate {
|
|
99
|
-
100% {
|
|
100
|
-
transform: rotate(360deg);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.#{$name}-panel {
|
|
106
|
-
padding: 0;
|
|
107
|
-
display: flex;
|
|
108
|
-
flex-flow: column nowrap;
|
|
109
|
-
align-items: stretch;
|
|
110
|
-
gap: 4px;
|
|
111
|
-
|
|
112
|
-
.#{$name}-btn {
|
|
113
|
-
width: initial;
|
|
114
|
-
height: initial;
|
|
115
|
-
user-select: none;
|
|
116
|
-
font-size: 12px;
|
|
117
|
-
padding: 4px;
|
|
118
|
-
justify-content: flex-end;
|
|
119
|
-
|
|
120
|
-
&.active {
|
|
121
|
-
color: #3381ff;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.#{$name}-slider {
|
|
127
|
-
width: 100%;
|
|
128
|
-
padding: 0 7px;
|
|
129
|
-
|
|
130
|
-
&.loading {
|
|
131
|
-
cursor: not-allowed;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.#{$name}-slash {
|
|
136
|
-
opacity: 0.6;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.#{$name}-current,
|
|
140
|
-
.#{$name}-slash,
|
|
141
|
-
.#{$name}-total,
|
|
142
|
-
.#{$name}-speed-text {
|
|
143
|
-
font-size: 12px;
|
|
144
|
-
font-variant-numeric: tabular-nums;
|
|
145
|
-
}
|