kitzo 2.3.14 → 2.3.15

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.
@@ -1,20 +1,19 @@
1
- import { LEAVE_DELAY as l, clearAllTimers as d, clearTimer as f } from "./timers.js";
2
- function m({ toast: t, setToasts: n }) {
3
- if (!t.id) {
4
- let i = 0;
5
- if (n((e) => (i = e.length, e.length === 0 ? e : e.map((r) => ({ ...r, status: "leaving" })))), i === 0) return;
6
- setTimeout(() => {
7
- n([]);
8
- }, l), d();
1
+ import { LEAVE_DELAY as a, clearAllTimers as m, clearTimer as u } from "./timers.js";
2
+ function n({ toast: l, setToasts: r }) {
3
+ if (!l.id) {
4
+ r((e) => e.map((i) => ({ ...i, status: "leaving" }))), setTimeout(() => {
5
+ r((e) => e.filter((i) => i.status !== "leaving"));
6
+ }, a), m();
9
7
  return;
10
8
  }
11
- let u = !0;
12
- n((i) => i.find((r) => r.id === t.id) ? i.map(
13
- (r) => r.id === t.id ? { ...r, status: "leaving" } : r
14
- ) : (u = !1, i)), u && (f(t.id), setTimeout(() => {
15
- n((i) => i.filter((e) => e.id !== t.id));
16
- }, l));
9
+ u(l.id), r(
10
+ (e) => e.map((i) => i.id === l.id ? { ...i, status: "leaving" } : i)
11
+ ), setTimeout(() => {
12
+ r(
13
+ (e) => e.filter((i) => !(i.id === l.id && i.status === "leaving"))
14
+ );
15
+ }, a);
17
16
  }
18
17
  export {
19
- m as default
18
+ n as default
20
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.3.14",
3
+ "version": "2.3.15",
4
4
  "description": "A lightweight React micro-utility.",
5
5
  "type": "module",
6
6
  "files": [