@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/vue.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ComponentPublicInstance, Ref } from "vue-demi";
|
|
2
|
-
import {
|
|
3
|
-
computed,
|
|
4
|
-
getCurrentScope,
|
|
5
|
-
onScopeDispose,
|
|
6
|
-
shallowRef,
|
|
7
|
-
unref,
|
|
8
|
-
watchEffect,
|
|
9
|
-
} from "vue-demi";
|
|
10
|
-
import { createWhiteboardApp } from "./index";
|
|
11
|
-
|
|
12
|
-
import type { WhiteboardApp, WhiteboardAppConfig } from "./WhiteboardApp";
|
|
13
|
-
|
|
14
|
-
export type FastBoardConfig = WhiteboardAppConfig;
|
|
15
|
-
|
|
16
|
-
export type MaybeRef<T> = T | Ref<T>;
|
|
17
|
-
export type VueInstance = ComponentPublicInstance;
|
|
18
|
-
export type MaybeElementRef = MaybeRef<
|
|
19
|
-
HTMLElement | SVGElement | VueInstance | undefined | null
|
|
20
|
-
>;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get the dom element of a ref of element or Vue component instance
|
|
24
|
-
*/
|
|
25
|
-
export function unrefElement(elRef: MaybeElementRef) {
|
|
26
|
-
const plain = unref(elRef);
|
|
27
|
-
return (plain as VueInstance)?.$el ?? plain;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function tryOnScopeDispose(fn: () => void) {
|
|
31
|
-
if (getCurrentScope()) {
|
|
32
|
-
onScopeDispose(fn);
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @example
|
|
40
|
-
* ```vue
|
|
41
|
-
* <script setup>
|
|
42
|
-
* const el = ref(null)
|
|
43
|
-
* const app = useFastboard(el, { sdkConfig, joinRoom })
|
|
44
|
-
* if (app.value) {
|
|
45
|
-
* app.value.insertDocs({...})
|
|
46
|
-
* }
|
|
47
|
-
* </script>
|
|
48
|
-
* <template>
|
|
49
|
-
* <div style="width: 100%; height: 100%" ref="el"></div>
|
|
50
|
-
* </template>
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export function useFastboard(el: MaybeElementRef, config: FastBoardConfig) {
|
|
54
|
-
const app = shallowRef<WhiteboardApp | null>(null);
|
|
55
|
-
const target = computed(() => unrefElement(el));
|
|
56
|
-
|
|
57
|
-
createWhiteboardApp(config).then(app_ => {
|
|
58
|
-
app.value = app_;
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
watchEffect(() => {
|
|
62
|
-
if (target.value && app.value) {
|
|
63
|
-
app.value.bindElement(target.value);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
tryOnScopeDispose(() => {
|
|
68
|
-
if (app.value) {
|
|
69
|
-
app.value.dispose();
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return app;
|
|
74
|
-
}
|