@snack-uikit/utils 3.8.0 → 3.8.2-preview-8cf89a18.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/CHANGELOG.md +11 -0
- package/dist/cjs/fonts/SBSansInterface-Bold.woff +0 -0
- package/dist/cjs/fonts/SBSansInterface-Bold.woff2 +0 -0
- package/dist/cjs/fonts/SBSansInterface-Caps.woff +0 -0
- package/dist/cjs/fonts/SBSansInterface-Caps.woff2 +0 -0
- package/dist/cjs/fonts/SBSansInterface-Light.woff +0 -0
- package/dist/cjs/fonts/SBSansInterface-Light.woff2 +0 -0
- package/dist/cjs/fonts/SBSansInterface-Regular.woff +0 -0
- package/dist/cjs/fonts/SBSansInterface-Regular.woff2 +0 -0
- package/dist/cjs/fonts/SBSansInterface-Semibold.woff +0 -0
- package/dist/cjs/fonts/SBSansInterface-Semibold.woff2 +0 -0
- package/dist/cjs/fonts/SBSansTextMono-Bold.woff +0 -0
- package/dist/cjs/fonts/SBSansTextMono-Bold.woff2 +0 -0
- package/dist/cjs/fonts/SBSansTextMono-Regular.woff +0 -0
- package/dist/cjs/fonts/SBSansTextMono-Regular.woff2 +0 -0
- package/dist/cjs/globals.css +49 -0
- package/dist/cjs/hooks/useDebounce.js +3 -3
- package/dist/esm/fonts/SBSansInterface-Bold.woff +0 -0
- package/dist/esm/fonts/SBSansInterface-Bold.woff2 +0 -0
- package/dist/esm/fonts/SBSansInterface-Caps.woff +0 -0
- package/dist/esm/fonts/SBSansInterface-Caps.woff2 +0 -0
- package/dist/esm/fonts/SBSansInterface-Light.woff +0 -0
- package/dist/esm/fonts/SBSansInterface-Light.woff2 +0 -0
- package/dist/esm/fonts/SBSansInterface-Regular.woff +0 -0
- package/dist/esm/fonts/SBSansInterface-Regular.woff2 +0 -0
- package/dist/esm/fonts/SBSansInterface-Semibold.woff +0 -0
- package/dist/esm/fonts/SBSansInterface-Semibold.woff2 +0 -0
- package/dist/esm/fonts/SBSansTextMono-Bold.woff +0 -0
- package/dist/esm/fonts/SBSansTextMono-Bold.woff2 +0 -0
- package/dist/esm/fonts/SBSansTextMono-Regular.woff +0 -0
- package/dist/esm/fonts/SBSansTextMono-Regular.woff2 +0 -0
- package/dist/esm/globals.css +49 -0
- package/dist/esm/hooks/useDebounce.js +3 -3
- package/package.json +10 -4
- package/src/fonts/SBSansInterface-Bold.woff +0 -0
- package/src/fonts/SBSansInterface-Bold.woff2 +0 -0
- package/src/fonts/SBSansInterface-Caps.woff +0 -0
- package/src/fonts/SBSansInterface-Caps.woff2 +0 -0
- package/src/fonts/SBSansInterface-Light.woff +0 -0
- package/src/fonts/SBSansInterface-Light.woff2 +0 -0
- package/src/fonts/SBSansInterface-Regular.woff +0 -0
- package/src/fonts/SBSansInterface-Regular.woff2 +0 -0
- package/src/fonts/SBSansInterface-Semibold.woff +0 -0
- package/src/fonts/SBSansInterface-Semibold.woff2 +0 -0
- package/src/fonts/SBSansTextMono-Bold.woff +0 -0
- package/src/fonts/SBSansTextMono-Bold.woff2 +0 -0
- package/src/fonts/SBSansTextMono-Regular.woff +0 -0
- package/src/fonts/SBSansTextMono-Regular.woff2 +0 -0
- package/src/globals.scss +69 -0
- package/src/hooks/useDebounce.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 3.8.1 (2025-03-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **VMWDEV-2271:** fix timerId ([14fa135](https://github.com/cloud-ru-tech/snack-uikit/commit/14fa1351d12b76912b696aeaa6fcc7ce8d62d1b1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 3.8.0 (2025-03-04)
|
|
7
18
|
|
|
8
19
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@font-face{
|
|
2
|
+
font-family:"SB Sans Interface";
|
|
3
|
+
font-weight:600;
|
|
4
|
+
font-style:normal;
|
|
5
|
+
font-display:swap;
|
|
6
|
+
src:url("./fonts/SBSansInterface-Semibold.woff2") format("woff2"), url("./fonts/SBSansInterface-Semibold.woff") format("woff");
|
|
7
|
+
}
|
|
8
|
+
@font-face{
|
|
9
|
+
font-family:"SB Sans Interface";
|
|
10
|
+
font-weight:300;
|
|
11
|
+
font-style:normal;
|
|
12
|
+
font-display:swap;
|
|
13
|
+
src:url("./fonts/SBSansInterface-Light.woff2") format("woff2"), url("./fonts/SBSansInterface-Light.woff") format("woff");
|
|
14
|
+
}
|
|
15
|
+
@font-face{
|
|
16
|
+
font-family:"SB Sans Interface";
|
|
17
|
+
font-weight:bold;
|
|
18
|
+
font-style:normal;
|
|
19
|
+
font-display:swap;
|
|
20
|
+
src:url("./fonts/SBSansInterface-Bold.woff2") format("woff2"), url("./fonts/SBSansInterface-Bold.woff") format("woff");
|
|
21
|
+
}
|
|
22
|
+
@font-face{
|
|
23
|
+
font-family:"SB Sans Interface Caps";
|
|
24
|
+
font-weight:normal;
|
|
25
|
+
font-style:normal;
|
|
26
|
+
font-display:swap;
|
|
27
|
+
src:url("./fonts/SBSansInterface-Caps.woff2") format("woff2"), url("./fonts/SBSansInterface-Caps.woff") format("woff");
|
|
28
|
+
}
|
|
29
|
+
@font-face{
|
|
30
|
+
font-family:"SB Sans Interface";
|
|
31
|
+
font-weight:normal;
|
|
32
|
+
font-style:normal;
|
|
33
|
+
font-display:swap;
|
|
34
|
+
src:url("./fonts/SBSansInterface-Regular.woff2") format("woff2"), url("./fonts/SBSansInterface-Regular.woff") format("woff");
|
|
35
|
+
}
|
|
36
|
+
@font-face{
|
|
37
|
+
font-family:"SB Sans Text Mono";
|
|
38
|
+
font-weight:bold;
|
|
39
|
+
font-style:normal;
|
|
40
|
+
font-display:swap;
|
|
41
|
+
src:url("./fonts/SBSansTextMono-Bold.woff2") format("woff2"), url("./fonts/SBSansTextMono-Bold.woff") format("woff");
|
|
42
|
+
}
|
|
43
|
+
@font-face{
|
|
44
|
+
font-family:"SB Sans Text Mono";
|
|
45
|
+
font-weight:normal;
|
|
46
|
+
font-style:normal;
|
|
47
|
+
font-display:swap;
|
|
48
|
+
src:url("./fonts/SBSansTextMono-Regular.woff2") format("woff2"), url("./fonts/SBSansTextMono-Regular.woff") format("woff");
|
|
49
|
+
}
|
|
@@ -15,13 +15,13 @@ const useEventHandler_1 = require("./useEventHandler");
|
|
|
15
15
|
function useDebounce(callback) {
|
|
16
16
|
let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
17
17
|
const timeStampRef = (0, react_1.useRef)(0);
|
|
18
|
-
|
|
18
|
+
const timerIdRef = (0, react_1.useRef)(-1);
|
|
19
19
|
return (0, useEventHandler_1.useEventHandler)(() => {
|
|
20
20
|
(0, utils_1.isBrowser)() && requestAnimationFrame(timestamp => {
|
|
21
21
|
if (timestamp < timeStampRef.current) {
|
|
22
|
-
clearTimeout(
|
|
22
|
+
clearTimeout(timerIdRef.current);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
timerIdRef.current = setTimeout(callback, timeout);
|
|
25
25
|
timeStampRef.current = timestamp + timeout;
|
|
26
26
|
});
|
|
27
27
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@font-face{
|
|
2
|
+
font-family:"SB Sans Interface";
|
|
3
|
+
font-weight:600;
|
|
4
|
+
font-style:normal;
|
|
5
|
+
font-display:swap;
|
|
6
|
+
src:url("./fonts/SBSansInterface-Semibold.woff2") format("woff2"), url("./fonts/SBSansInterface-Semibold.woff") format("woff");
|
|
7
|
+
}
|
|
8
|
+
@font-face{
|
|
9
|
+
font-family:"SB Sans Interface";
|
|
10
|
+
font-weight:300;
|
|
11
|
+
font-style:normal;
|
|
12
|
+
font-display:swap;
|
|
13
|
+
src:url("./fonts/SBSansInterface-Light.woff2") format("woff2"), url("./fonts/SBSansInterface-Light.woff") format("woff");
|
|
14
|
+
}
|
|
15
|
+
@font-face{
|
|
16
|
+
font-family:"SB Sans Interface";
|
|
17
|
+
font-weight:bold;
|
|
18
|
+
font-style:normal;
|
|
19
|
+
font-display:swap;
|
|
20
|
+
src:url("./fonts/SBSansInterface-Bold.woff2") format("woff2"), url("./fonts/SBSansInterface-Bold.woff") format("woff");
|
|
21
|
+
}
|
|
22
|
+
@font-face{
|
|
23
|
+
font-family:"SB Sans Interface Caps";
|
|
24
|
+
font-weight:normal;
|
|
25
|
+
font-style:normal;
|
|
26
|
+
font-display:swap;
|
|
27
|
+
src:url("./fonts/SBSansInterface-Caps.woff2") format("woff2"), url("./fonts/SBSansInterface-Caps.woff") format("woff");
|
|
28
|
+
}
|
|
29
|
+
@font-face{
|
|
30
|
+
font-family:"SB Sans Interface";
|
|
31
|
+
font-weight:normal;
|
|
32
|
+
font-style:normal;
|
|
33
|
+
font-display:swap;
|
|
34
|
+
src:url("./fonts/SBSansInterface-Regular.woff2") format("woff2"), url("./fonts/SBSansInterface-Regular.woff") format("woff");
|
|
35
|
+
}
|
|
36
|
+
@font-face{
|
|
37
|
+
font-family:"SB Sans Text Mono";
|
|
38
|
+
font-weight:bold;
|
|
39
|
+
font-style:normal;
|
|
40
|
+
font-display:swap;
|
|
41
|
+
src:url("./fonts/SBSansTextMono-Bold.woff2") format("woff2"), url("./fonts/SBSansTextMono-Bold.woff") format("woff");
|
|
42
|
+
}
|
|
43
|
+
@font-face{
|
|
44
|
+
font-family:"SB Sans Text Mono";
|
|
45
|
+
font-weight:normal;
|
|
46
|
+
font-style:normal;
|
|
47
|
+
font-display:swap;
|
|
48
|
+
src:url("./fonts/SBSansTextMono-Regular.woff2") format("woff2"), url("./fonts/SBSansTextMono-Regular.woff") format("woff");
|
|
49
|
+
}
|
|
@@ -8,14 +8,14 @@ import { useEventHandler } from './useEventHandler';
|
|
|
8
8
|
*/
|
|
9
9
|
export function useDebounce(callback, timeout = 0) {
|
|
10
10
|
const timeStampRef = useRef(0);
|
|
11
|
-
|
|
11
|
+
const timerIdRef = useRef(-1);
|
|
12
12
|
return useEventHandler(() => {
|
|
13
13
|
isBrowser() &&
|
|
14
14
|
requestAnimationFrame(timestamp => {
|
|
15
15
|
if (timestamp < timeStampRef.current) {
|
|
16
|
-
clearTimeout(
|
|
16
|
+
clearTimeout(timerIdRef.current);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
timerIdRef.current = setTimeout(callback, timeout);
|
|
19
19
|
timeStampRef.current = timestamp + timeout;
|
|
20
20
|
});
|
|
21
21
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Utils",
|
|
7
|
-
"version": "3.8.0",
|
|
7
|
+
"version": "3.8.2-preview-8cf89a18.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -13,8 +13,14 @@
|
|
|
13
13
|
"description": "Пакет с вспомогательными функциями",
|
|
14
14
|
"types": "./dist/esm/index.d.ts",
|
|
15
15
|
"exports": {
|
|
16
|
-
"
|
|
17
|
-
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/esm/index.js",
|
|
18
|
+
"require": "./dist/cjs/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./globals.css": {
|
|
21
|
+
"import": "./dist/esm/globals.css",
|
|
22
|
+
"require": "./dist/cjs/globals.css"
|
|
23
|
+
}
|
|
18
24
|
},
|
|
19
25
|
"homepage": "https://github.com/cloud-ru-tech/snack-uikit/tree/master/packages/utils",
|
|
20
26
|
"repository": {
|
|
@@ -39,5 +45,5 @@
|
|
|
39
45
|
"react-swipeable": "7.0.2",
|
|
40
46
|
"uncontrollable": "8.0.4"
|
|
41
47
|
},
|
|
42
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "5e1747d716a0215e5b2c1165b130cbde1bf899f9"
|
|
43
49
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/globals.scss
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'SB Sans Interface';
|
|
3
|
+
font-weight: 600;
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-display: swap;
|
|
6
|
+
src:
|
|
7
|
+
url('./fonts/SBSansInterface-Semibold.woff2') format('woff2'),
|
|
8
|
+
url('./fonts/SBSansInterface-Semibold.woff') format('woff');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@font-face {
|
|
12
|
+
font-family: 'SB Sans Interface';
|
|
13
|
+
font-weight: 300;
|
|
14
|
+
font-style: normal;
|
|
15
|
+
font-display: swap;
|
|
16
|
+
src:
|
|
17
|
+
url('./fonts/SBSansInterface-Light.woff2') format('woff2'),
|
|
18
|
+
url('./fonts/SBSansInterface-Light.woff') format('woff');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@font-face {
|
|
22
|
+
font-family: 'SB Sans Interface';
|
|
23
|
+
font-weight: bold;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-display: swap;
|
|
26
|
+
src:
|
|
27
|
+
url('./fonts/SBSansInterface-Bold.woff2') format('woff2'),
|
|
28
|
+
url('./fonts/SBSansInterface-Bold.woff') format('woff');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@font-face {
|
|
32
|
+
font-family: 'SB Sans Interface Caps';
|
|
33
|
+
font-weight: normal;
|
|
34
|
+
font-style: normal;
|
|
35
|
+
font-display: swap;
|
|
36
|
+
src:
|
|
37
|
+
url('./fonts/SBSansInterface-Caps.woff2') format('woff2'),
|
|
38
|
+
url('./fonts/SBSansInterface-Caps.woff') format('woff');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@font-face {
|
|
42
|
+
font-family: 'SB Sans Interface';
|
|
43
|
+
font-weight: normal;
|
|
44
|
+
font-style: normal;
|
|
45
|
+
font-display: swap;
|
|
46
|
+
src:
|
|
47
|
+
url('./fonts/SBSansInterface-Regular.woff2') format('woff2'),
|
|
48
|
+
url('./fonts/SBSansInterface-Regular.woff') format('woff');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@font-face {
|
|
52
|
+
font-family: 'SB Sans Text Mono';
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-display: swap;
|
|
56
|
+
src:
|
|
57
|
+
url('./fonts/SBSansTextMono-Bold.woff2') format('woff2'),
|
|
58
|
+
url('./fonts/SBSansTextMono-Bold.woff') format('woff');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@font-face {
|
|
62
|
+
font-family: 'SB Sans Text Mono';
|
|
63
|
+
font-weight: normal;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
font-display: swap;
|
|
66
|
+
src:
|
|
67
|
+
url('./fonts/SBSansTextMono-Regular.woff2') format('woff2'),
|
|
68
|
+
url('./fonts/SBSansTextMono-Regular.woff') format('woff');
|
|
69
|
+
}
|
package/src/hooks/useDebounce.ts
CHANGED
|
@@ -10,15 +10,15 @@ import { useEventHandler } from './useEventHandler';
|
|
|
10
10
|
*/
|
|
11
11
|
export function useDebounce(callback: () => void, timeout = 0) {
|
|
12
12
|
const timeStampRef = useRef<number>(0);
|
|
13
|
-
|
|
13
|
+
const timerIdRef = useRef<NodeJS.Timeout | number>(-1);
|
|
14
14
|
|
|
15
15
|
return useEventHandler(() => {
|
|
16
16
|
isBrowser() &&
|
|
17
17
|
requestAnimationFrame(timestamp => {
|
|
18
18
|
if (timestamp < timeStampRef.current) {
|
|
19
|
-
clearTimeout(
|
|
19
|
+
clearTimeout(timerIdRef.current);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
timerIdRef.current = setTimeout(callback, timeout);
|
|
22
22
|
timeStampRef.current = timestamp + timeout;
|
|
23
23
|
});
|
|
24
24
|
});
|