@netless/fastboard-react 0.2.10 → 0.2.13-canary.0
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 +4 -4
- package/dist/index.js +12 -2833
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2833
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/components/tippy-util.ts +4 -14
- package/src/vanilla/index.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13-canary.0",
|
|
4
4
|
"description": "A UI kit built on top of @netless/fastboard.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -11,24 +11,24 @@
|
|
|
11
11
|
"@tippyjs/react": "^4.2.6",
|
|
12
12
|
"clsx": "^1.1.1",
|
|
13
13
|
"framer-motion": "^6.2.8",
|
|
14
|
-
"i18next": "^21.6.
|
|
14
|
+
"i18next": "^21.6.14",
|
|
15
15
|
"rc-slider": "^9.7.5"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@netless/fastboard-core": "
|
|
18
|
+
"@netless/fastboard-core": "0.2.13-canary.0",
|
|
19
19
|
"@netless/window-manager": ">=0.4.0",
|
|
20
20
|
"react": "*",
|
|
21
21
|
"react-dom": "*",
|
|
22
22
|
"white-web-sdk": ">=2.16.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@netless/fastboard-core": "0.2.
|
|
26
|
-
"@netless/window-manager": "^0.4.
|
|
27
|
-
"@types/react": "^17.0.
|
|
25
|
+
"@netless/fastboard-core": "0.2.13-canary.0",
|
|
26
|
+
"@netless/window-manager": "^0.4.11",
|
|
27
|
+
"@types/react": "^17.0.40",
|
|
28
28
|
"@types/react-dom": "^17.0.13",
|
|
29
29
|
"sass": "^1.49.9",
|
|
30
30
|
"tippy.js": "^6.3.7",
|
|
31
|
-
"tsup": "^5.
|
|
31
|
+
"tsup": "^5.12.0",
|
|
32
32
|
"white-web-sdk": "^2.16.10"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import type { Instance } from "tippy.js";
|
|
2
|
-
import tippy from "tippy.js";
|
|
3
|
-
|
|
4
|
-
export const instances = new Set<Instance>();
|
|
5
|
-
|
|
6
|
-
export function onCreate(instance: Instance) {
|
|
7
|
-
instances.add(instance);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function onDestroy(instance: Instance) {
|
|
11
|
-
instances.delete(instance);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
tippy.setDefaultProps({ onCreate, onDestroy });
|
|
15
2
|
|
|
16
3
|
export function hideAll() {
|
|
17
|
-
|
|
4
|
+
Array.from(document.querySelectorAll("[data-tippy-root]")).forEach(e => {
|
|
5
|
+
const instance = (e as unknown as { _tippy?: Instance })._tippy;
|
|
6
|
+
if (instance) instance.hide();
|
|
7
|
+
});
|
|
18
8
|
}
|
package/src/vanilla/index.tsx
CHANGED
|
@@ -8,17 +8,17 @@ import { Fastboard } from "../components/Fastboard";
|
|
|
8
8
|
export type MountProps = Omit<FastboardProps & DivProps, "ref">;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Mount fastboard app to some dom, returns the
|
|
11
|
+
* Mount fastboard app to some dom, returns the updater and disposer.
|
|
12
12
|
* @example
|
|
13
13
|
* let app = await createFastboard({ ...config })
|
|
14
14
|
* const { update, destroy } = mount(app, document.getElementById("whiteboard"))
|
|
15
15
|
* update({ theme: 'dark' })
|
|
16
16
|
* destroy()
|
|
17
17
|
*/
|
|
18
|
-
export function mount(app: FastboardApp, dom: HTMLElement, props: MountProps) {
|
|
18
|
+
export function mount(app: FastboardApp, dom: HTMLElement, props: MountProps = {}) {
|
|
19
19
|
ReactDOM.render(<Fastboard app={app} {...props} />, dom);
|
|
20
20
|
return {
|
|
21
|
-
update(props: MountProps) {
|
|
21
|
+
update(props: MountProps = {}) {
|
|
22
22
|
ReactDOM.render(<Fastboard app={app} {...props} />, dom);
|
|
23
23
|
},
|
|
24
24
|
destroy() {
|