@netless/fastboard-react 0.2.9 → 0.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/fastboard-react",
3
- "version": "0.2.9",
3
+ "version": "0.2.12",
4
4
  "description": "A UI kit built on top of @netless/fastboard.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -22,13 +22,13 @@
22
22
  "white-web-sdk": ">=2.16.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@netless/fastboard-core": "0.2.9",
26
- "@netless/window-manager": "^0.4.10",
25
+ "@netless/fastboard-core": "0.2.12",
26
+ "@netless/window-manager": "^0.4.11-canary.1",
27
27
  "@types/react": "^17.0.39",
28
28
  "@types/react-dom": "^17.0.13",
29
29
  "sass": "^1.49.9",
30
30
  "tippy.js": "^6.3.7",
31
- "tsup": "^5.11.13",
31
+ "tsup": "^5.12.0",
32
32
  "white-web-sdk": "^2.16.10"
33
33
  },
34
34
  "scripts": {
@@ -37,5 +37,5 @@
37
37
  "check": "tsc --noEmit"
38
38
  },
39
39
  "module": "dist/index.mjs",
40
- "types": "src/index.ts"
40
+ "types": "dist/index.d.ts"
41
41
  }
@@ -1,4 +1,3 @@
1
- import type { Placement } from "tippy.js";
2
1
  import type { Theme } from "../../../typings";
3
2
 
4
3
  import clsx from "clsx";
@@ -14,7 +13,7 @@ type ButtonProps = PropsWithChildren<{
14
13
  active?: boolean;
15
14
  onClick?: () => void;
16
15
  interactive?: boolean;
17
- placement?: Placement;
16
+ placement?: "top" | "right"; // not using tippy.js's placement to satisfy dts
18
17
  }>;
19
18
 
20
19
  export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
@@ -1,4 +1,3 @@
1
- import type { Placement } from "tippy.js";
2
1
  import type { PropsWithChildren } from "react";
3
2
 
4
3
  import clsx from "clsx";
@@ -14,7 +13,7 @@ type ButtonProps = PropsWithChildren<{
14
13
  active?: boolean;
15
14
  onClick?: () => void;
16
15
  interactive?: boolean;
17
- placement?: Placement;
16
+ placement?: "top" | "right"; // not using tippy.js's placement to satisfy dts
18
17
  }>;
19
18
 
20
19
  export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
@@ -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
- instances.forEach(instance => instance.hide());
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
  }