kitzo 2.3.20 → 2.3.22
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 +2 -10
- package/dist/react/hooks/useCopy.js +13 -13
- package/dist/react/hooks/useWindowSize.js +11 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -93,11 +93,7 @@ declare type TooltipProps = PropsWithChildren<TooltipCoreProps>;
|
|
|
93
93
|
|
|
94
94
|
declare type UpdateToastOptions = Omit<ToastOptions, 'id'>;
|
|
95
95
|
|
|
96
|
-
export declare function useCopy(
|
|
97
|
-
|
|
98
|
-
declare type UseCopyOptions = {
|
|
99
|
-
resetDelay?: number;
|
|
100
|
-
};
|
|
96
|
+
export declare function useCopy(resetDelay?: number): UseCopyReturn;
|
|
101
97
|
|
|
102
98
|
declare type UseCopyReturn = {
|
|
103
99
|
copy: (doc: string) => Promise<void>;
|
|
@@ -113,13 +109,9 @@ export declare function useDebounce<T>(value: T, delay?: number): T;
|
|
|
113
109
|
|
|
114
110
|
export declare function useThrottle<T>(value: T, delay?: number): T;
|
|
115
111
|
|
|
116
|
-
export declare function useWindowSize(
|
|
112
|
+
export declare function useWindowSize(updateDelay?: number): {
|
|
117
113
|
screenWidth: number;
|
|
118
114
|
screenHeight: number;
|
|
119
115
|
};
|
|
120
116
|
|
|
121
|
-
declare type UseWindowSizeOptions = {
|
|
122
|
-
updateDelay?: number;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
117
|
export { }
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { useState as u, useRef as i, useCallback as
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
async (
|
|
1
|
+
import { useState as u, useRef as i, useCallback as y, useEffect as p } from "react";
|
|
2
|
+
import m from "../../functions/copy/copy.js";
|
|
3
|
+
function E(c = 1500) {
|
|
4
|
+
const [r, e] = u("standby"), [a, s] = u(null), t = i(null), n = i(!1), f = y(
|
|
5
|
+
async (l) => {
|
|
6
6
|
if (!n.current) {
|
|
7
7
|
t.current && clearTimeout(t.current);
|
|
8
8
|
try {
|
|
9
|
-
n.current = !0,
|
|
9
|
+
n.current = !0, s(null), e("copying"), await m(l), e("copied");
|
|
10
10
|
} catch (o) {
|
|
11
|
-
|
|
11
|
+
s(o instanceof Error ? o : new Error(String(o))), e("error");
|
|
12
12
|
} finally {
|
|
13
13
|
t.current = setTimeout(
|
|
14
14
|
() => {
|
|
15
15
|
n.current = !1, e("standby");
|
|
16
16
|
},
|
|
17
|
-
Math.max(
|
|
17
|
+
Math.max(c, 500)
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
[
|
|
22
|
+
[c]
|
|
23
23
|
);
|
|
24
|
-
return
|
|
24
|
+
return p(() => () => {
|
|
25
25
|
t.current && clearTimeout(t.current);
|
|
26
26
|
}, []), {
|
|
27
|
-
copy:
|
|
27
|
+
copy: f,
|
|
28
28
|
status: r,
|
|
29
|
-
error:
|
|
29
|
+
error: a,
|
|
30
30
|
isCopying: r === "copying",
|
|
31
31
|
isCopied: r === "copied",
|
|
32
32
|
isError: r === "error",
|
|
@@ -34,5 +34,5 @@ function g(a = {}) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
E as default
|
|
38
38
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
1
|
+
import { useState as o, useRef as u, useEffect as c } from "react";
|
|
2
|
+
function d(n = 30) {
|
|
3
|
+
const [t, r] = o({
|
|
4
4
|
screenWidth: window.innerWidth,
|
|
5
5
|
screenHeight: window.innerHeight
|
|
6
|
-
}), e =
|
|
7
|
-
return
|
|
8
|
-
function
|
|
6
|
+
}), e = u(null);
|
|
7
|
+
return c(() => {
|
|
8
|
+
function i() {
|
|
9
9
|
e.current && clearTimeout(e.current), e.current = setTimeout(
|
|
10
10
|
() => {
|
|
11
|
-
|
|
11
|
+
r({
|
|
12
12
|
screenWidth: window.innerWidth,
|
|
13
13
|
screenHeight: window.innerHeight
|
|
14
14
|
});
|
|
@@ -16,11 +16,11 @@ function w(i = {}) {
|
|
|
16
16
|
Math.max(0, +n)
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
return typeof window < "u" && window.addEventListener("resize",
|
|
20
|
-
e.current && clearTimeout(e.current), window.removeEventListener("resize",
|
|
19
|
+
return typeof window < "u" && window.addEventListener("resize", i), () => {
|
|
20
|
+
e.current && clearTimeout(e.current), window.removeEventListener("resize", i);
|
|
21
21
|
};
|
|
22
|
-
}, [n]),
|
|
22
|
+
}, [n]), t;
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
d as default
|
|
26
26
|
};
|