kitzo 2.3.44 → 2.4.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/README.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
# Kitzo
|
|
2
|
-
|
|
3
|
-
**Lightweight React UI components and essential hooks.**
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
### Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install kitzo
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
### Core Features
|
|
16
|
-
|
|
17
|
-
#### Components
|
|
18
|
-
|
|
19
|
-
- **Toast** — Accessible, animated notifications.
|
|
20
|
-
- **Tooltip** — Smart-positioned contextual labels.
|
|
21
|
-
|
|
22
|
-
#### Hooks
|
|
23
|
-
|
|
24
|
-
- **useDebounce** — Optimize performance by delaying execution.
|
|
25
|
-
- **useWindowSize** — Real-time viewport dimensions.
|
|
26
|
-
- **useCopy** — Simple "copy to clipboard" functionality.
|
|
27
|
-
- **useThrottle** — Limits how often a value can change within a specified time interval.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
### Documentation
|
|
32
|
-
|
|
33
|
-
For usage guides and live demos, visit documentation:
|
|
34
|
-
[https://kitzo.vercel.app](https://kitzo.vercel.app)
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
### License
|
|
39
|
-
|
|
40
|
-
MIT
|
|
1
|
+
# Kitzo
|
|
2
|
+
|
|
3
|
+
**Lightweight React UI components and essential hooks.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install kitzo
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### Core Features
|
|
16
|
+
|
|
17
|
+
#### Components
|
|
18
|
+
|
|
19
|
+
- **Toast** — Accessible, animated notifications.
|
|
20
|
+
- **Tooltip** — Smart-positioned contextual labels.
|
|
21
|
+
|
|
22
|
+
#### Hooks
|
|
23
|
+
|
|
24
|
+
- **useDebounce** — Optimize performance by delaying execution.
|
|
25
|
+
- **useWindowSize** — Real-time viewport dimensions.
|
|
26
|
+
- **useCopy** — Simple "copy to clipboard" functionality.
|
|
27
|
+
- **useThrottle** — Limits how often a value can change within a specified time interval.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
|
|
33
|
+
For usage guides and live demos, visit documentation:
|
|
34
|
+
[https://kitzo.vercel.app](https://kitzo.vercel.app)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
### License
|
|
39
|
+
|
|
40
|
+
MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import b from "../triggerToasts.js";
|
|
2
2
|
let s = !1, e = null, c = null, m = 0, r = 0, a = !1, l = null;
|
|
3
|
-
const L = 2, y =
|
|
3
|
+
const L = 2, y = 65, S = 20, g = 100;
|
|
4
4
|
function x(t) {
|
|
5
5
|
const o = Math.sign(t) || 1, n = Math.abs(t), h = S * (1 - Math.exp(-n / g));
|
|
6
6
|
return o * h;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createToast as
|
|
1
|
+
import { createToast as n, updateToast as s, genId as c } from "./createToast.js";
|
|
2
2
|
import { notify as i } from "./listenars.js";
|
|
3
3
|
const e = (r, t) => {
|
|
4
4
|
r != null && i(
|
|
5
|
-
|
|
5
|
+
n({
|
|
6
6
|
type: "default",
|
|
7
7
|
action: "add",
|
|
8
8
|
content: r,
|
|
@@ -11,11 +11,15 @@ const e = (r, t) => {
|
|
|
11
11
|
);
|
|
12
12
|
};
|
|
13
13
|
e.dismiss = (r, t) => {
|
|
14
|
-
i({
|
|
14
|
+
i({
|
|
15
|
+
action: "dismiss",
|
|
16
|
+
id: r,
|
|
17
|
+
toasterId: t
|
|
18
|
+
});
|
|
15
19
|
};
|
|
16
20
|
e.info = (r, t) => {
|
|
17
21
|
r != null && i(
|
|
18
|
-
|
|
22
|
+
n({
|
|
19
23
|
action: "add",
|
|
20
24
|
type: "info",
|
|
21
25
|
content: r,
|
|
@@ -25,7 +29,7 @@ e.info = (r, t) => {
|
|
|
25
29
|
};
|
|
26
30
|
e.success = (r, t) => {
|
|
27
31
|
r != null && i(
|
|
28
|
-
|
|
32
|
+
n({
|
|
29
33
|
action: "add",
|
|
30
34
|
type: "success",
|
|
31
35
|
content: r,
|
|
@@ -35,7 +39,7 @@ e.success = (r, t) => {
|
|
|
35
39
|
};
|
|
36
40
|
e.warning = (r, t) => {
|
|
37
41
|
r != null && i(
|
|
38
|
-
|
|
42
|
+
n({
|
|
39
43
|
action: "add",
|
|
40
44
|
type: "warning",
|
|
41
45
|
content: r,
|
|
@@ -45,7 +49,7 @@ e.warning = (r, t) => {
|
|
|
45
49
|
};
|
|
46
50
|
e.error = (r, t) => {
|
|
47
51
|
r != null && i(
|
|
48
|
-
|
|
52
|
+
n({
|
|
49
53
|
action: "add",
|
|
50
54
|
type: "error",
|
|
51
55
|
content: r,
|
|
@@ -55,7 +59,7 @@ e.error = (r, t) => {
|
|
|
55
59
|
};
|
|
56
60
|
e.loading = (r, t) => {
|
|
57
61
|
r != null && i(
|
|
58
|
-
|
|
62
|
+
n({
|
|
59
63
|
action: "add",
|
|
60
64
|
type: "loading",
|
|
61
65
|
content: r,
|
|
@@ -65,7 +69,7 @@ e.loading = (r, t) => {
|
|
|
65
69
|
};
|
|
66
70
|
e.custom = (r, t) => {
|
|
67
71
|
r != null && i(
|
|
68
|
-
|
|
72
|
+
n({
|
|
69
73
|
action: "add",
|
|
70
74
|
type: "custom",
|
|
71
75
|
content: r,
|
|
@@ -73,25 +77,25 @@ e.custom = (r, t) => {
|
|
|
73
77
|
})
|
|
74
78
|
);
|
|
75
79
|
};
|
|
76
|
-
e.update = (r, t,
|
|
77
|
-
r != null && t != null && i(s({ id: `${r}`, content: t, options:
|
|
80
|
+
e.update = (r, t, a) => {
|
|
81
|
+
r != null && t != null && i(s({ id: `${r}`, content: t, options: a }));
|
|
78
82
|
};
|
|
79
|
-
e.promise = (async (r, t,
|
|
83
|
+
e.promise = (async (r, t, a) => {
|
|
80
84
|
const u = c();
|
|
81
85
|
i(
|
|
82
|
-
|
|
86
|
+
n({
|
|
83
87
|
action: "add",
|
|
84
88
|
type: "loading",
|
|
85
89
|
content: t.loading,
|
|
86
|
-
options: { ...
|
|
90
|
+
options: { ...a, id: u, duration: 1 / 0, swipeToClose: !1 }
|
|
87
91
|
})
|
|
88
92
|
);
|
|
89
93
|
try {
|
|
90
94
|
const o = await r, d = typeof t.success == "function" ? await t.success(o) : t.success;
|
|
91
|
-
return e.update(u, d, { ...
|
|
95
|
+
return e.update(u, d, { ...a, type: "success" }), o;
|
|
92
96
|
} catch (o) {
|
|
93
97
|
const d = typeof t.error == "function" ? await t.error(o) : t.error;
|
|
94
|
-
throw e.update(u, d, { ...
|
|
98
|
+
throw e.update(u, d, { ...a, type: "error" }), o;
|
|
95
99
|
}
|
|
96
100
|
});
|
|
97
101
|
export {
|
package/package.json
CHANGED
|
@@ -1,74 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "kitzo",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "A lightweight React micro-utility.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
|
-
"sideEffects": false,
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"default": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./fns": {
|
|
17
|
-
"types": "./dist/fns.d.ts",
|
|
18
|
-
"import": "./dist/fns.js",
|
|
19
|
-
"default": "./dist/fns.js"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "kitzo",
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"description": "A lightweight React micro-utility.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./fns": {
|
|
17
|
+
"types": "./dist/fns.d.ts",
|
|
18
|
+
"import": "./dist/fns.js",
|
|
19
|
+
"default": "./dist/fns.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"kitzo",
|
|
24
|
+
"components",
|
|
25
|
+
"toast",
|
|
26
|
+
"toaster",
|
|
27
|
+
"tooltip",
|
|
28
|
+
"hooks",
|
|
29
|
+
"function",
|
|
30
|
+
"micro-utility",
|
|
31
|
+
"ui",
|
|
32
|
+
"react",
|
|
33
|
+
"reactjs"
|
|
34
|
+
],
|
|
35
|
+
"author": "Riyad",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/riyad-96/kitzo.git"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/riyad-96/kitzo#readme",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": ">=19",
|
|
44
|
+
"react-dom": ">=19"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@changesets/cli": "^2.29.8",
|
|
48
|
+
"@eslint/js": "^9.39.2",
|
|
49
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
50
|
+
"@types/node": "^25.0.6",
|
|
51
|
+
"@types/react": "^19.2.8",
|
|
52
|
+
"@types/react-dom": "^19.2.3",
|
|
53
|
+
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
54
|
+
"daisyui": "^5.5.14",
|
|
55
|
+
"eslint": "^9.39.2",
|
|
56
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
57
|
+
"eslint-plugin-react-refresh": "^0.4.26",
|
|
58
|
+
"globals": "^17.0.0",
|
|
59
|
+
"prettier": "^3.7.4",
|
|
60
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
61
|
+
"react": "^19.2.3",
|
|
62
|
+
"react-dom": "^19.2.3",
|
|
63
|
+
"tailwindcss": "^4.1.18",
|
|
64
|
+
"typescript": "~5.8.2",
|
|
65
|
+
"typescript-eslint": "^8.52.0",
|
|
66
|
+
"vite": "^7.3.1",
|
|
67
|
+
"vite-plugin-dts": "^4.5.4"
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"dev": "vite",
|
|
71
|
+
"dev:host": "vite --host",
|
|
72
|
+
"build": "tsc -b && vite build",
|
|
73
|
+
"lint": "eslint .",
|
|
74
|
+
"preview": "vite preview",
|
|
75
|
+
"cs": "changeset"
|
|
76
|
+
}
|
|
77
|
+
}
|