tekivex-ui 2.5.11 → 2.5.13
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/TkxForm-1KDzoniV.cjs +12 -0
- package/dist/TkxForm-9-W3Nl6m.js +314 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +543 -507
- package/dist/chunk-Bmb41Sf3.cjs +1 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +428 -447
- package/dist/hooks-6pRsPOyG.js +58 -0
- package/dist/hooks-mivgRljH.cjs +1 -0
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +728 -752
- package/dist/index.cjs +26 -26
- package/dist/index.js +16102 -16619
- package/dist/quantum.cjs +14 -16
- package/dist/quantum.js +2473 -2279
- package/dist/realtime.cjs +4 -10
- package/dist/realtime.js +804 -958
- package/dist/src/components/TkxClock.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxLiveFeed.d.ts +1 -1
- package/dist/src/components/TkxLiveLog.d.ts +1 -1
- package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
- package/dist/src/components/TkxTooltip.d.ts.map +1 -1
- package/dist/src/components/TkxTypography.d.ts +5 -5
- package/dist/src/components/TkxTypography.d.ts.map +1 -1
- package/dist/tekivex-ui.css +2 -0
- package/dist/themes-BbJanqiC.js +498 -0
- package/dist/themes-CMq2vWXj.cjs +2 -0
- package/dist/tkx-0oAwZqgL.cjs +4 -0
- package/dist/tkx-DQkvHdE5.js +1172 -0
- package/package.json +18 -19
- package/src/charts/TkxPieChart.tsx +1 -1
- package/src/components/TkxClock.tsx +2 -2
- package/src/components/TkxForm.tsx +4 -2
- package/src/components/TkxTooltip.tsx +7 -5
- package/src/components/TkxTypography.tsx +2 -2
- package/dist/TkxForm-2tGLCPH6.js +0 -326
- package/dist/TkxForm-C2VqR2wC.cjs +0 -12
- package/dist/index-BgHMZe4Z.js +0 -66
- package/dist/index-Bt5y50Qa.cjs +0 -1
- package/dist/index-DnqXtpwV.cjs +0 -2
- package/dist/index-iUUHRxqJ.js +0 -515
- package/dist/security-C-ZPGoyG.js +0 -97
- package/dist/security-Uf0mjv8o.cjs +0 -1
- package/dist/style.css +0 -1
- package/dist/tkx-BtHzWKTl.js +0 -1112
- package/dist/tkx-C7GvVUE9.cjs +0 -4
package/dist/headless.js
CHANGED
|
@@ -1,460 +1,441 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { u as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { D as e, E as t, b as n, h as r, j as i, k as a, x as o } from "./themes-BbJanqiC.js";
|
|
2
|
+
import { c as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m } from "./tkx-DQkvHdE5.js";
|
|
3
|
+
import { a as h, i as g, n as _, o as v, r as y, t as b } from "./hooks-6pRsPOyG.js";
|
|
4
|
+
import { r as x } from "./TkxForm-9-W3Nl6m.js";
|
|
5
|
+
import { useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
6
|
+
//#region src/headless/useDisclosure.ts
|
|
7
|
+
function D(e = !1) {
|
|
8
|
+
let [t, n] = E(e);
|
|
9
|
+
return {
|
|
10
|
+
isOpen: t,
|
|
11
|
+
open: S(() => n(!0), []),
|
|
12
|
+
close: S(() => n(!1), []),
|
|
13
|
+
toggle: S(() => n((e) => !e), [])
|
|
14
|
+
};
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return (w = s.current[e - 1]) == null ? void 0 : w.focus();
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
|
-
[n, l, t, e]
|
|
45
|
-
);
|
|
46
|
-
return { focusedIndex: n, setFocusedIndex: o, getItemProps: m };
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/headless/useRovingTabIndex.ts
|
|
18
|
+
function O({ count: e, initialIndex: t = 0, orientation: n = "horizontal", loop: r = !0 }) {
|
|
19
|
+
let [i, a] = E(t), o = T([]), s = S((t) => {
|
|
20
|
+
a((n) => {
|
|
21
|
+
let i = n + t;
|
|
22
|
+
return i = r ? (i % e + e) % e : Math.max(0, Math.min(e - 1, i)), requestAnimationFrame(() => {
|
|
23
|
+
o.current[i]?.focus();
|
|
24
|
+
}), i;
|
|
25
|
+
});
|
|
26
|
+
}, [e, r]);
|
|
27
|
+
return {
|
|
28
|
+
focusedIndex: i,
|
|
29
|
+
setFocusedIndex: a,
|
|
30
|
+
getItemProps: S((t) => ({
|
|
31
|
+
tabIndex: t === i ? 0 : -1,
|
|
32
|
+
"data-focused": t === i,
|
|
33
|
+
onFocus: () => a(t),
|
|
34
|
+
onKeyDown: (t) => {
|
|
35
|
+
let r = n === "horizontal" || n === "both", i = n === "vertical" || n === "both";
|
|
36
|
+
r && t.key === "ArrowRight" && (t.preventDefault(), s(1)), r && t.key === "ArrowLeft" && (t.preventDefault(), s(-1)), i && t.key === "ArrowDown" && (t.preventDefault(), s(1)), i && t.key === "ArrowUp" && (t.preventDefault(), s(-1)), t.key === "Home" && (t.preventDefault(), a(0), requestAnimationFrame(() => o.current[0]?.focus())), t.key === "End" && (t.preventDefault(), a(e - 1), requestAnimationFrame(() => o.current[e - 1]?.focus()));
|
|
37
|
+
}
|
|
38
|
+
}), [
|
|
39
|
+
i,
|
|
40
|
+
s,
|
|
41
|
+
n,
|
|
42
|
+
e
|
|
43
|
+
])
|
|
44
|
+
};
|
|
47
45
|
}
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/headless/useFormState.ts
|
|
48
|
+
function k({ initialValues: e, validate: t }) {
|
|
49
|
+
let [n, r] = E({ ...e }), [i, a] = E({}), [o, s] = E({}), c = T(e), l = S((e, t) => {
|
|
50
|
+
r((n) => ({
|
|
51
|
+
...n,
|
|
52
|
+
[e]: t
|
|
53
|
+
}));
|
|
54
|
+
}, []), u = S((e) => {
|
|
55
|
+
r((t) => ({
|
|
56
|
+
...t,
|
|
57
|
+
...e
|
|
58
|
+
}));
|
|
59
|
+
}, []), d = S((e) => {
|
|
60
|
+
s((t) => ({
|
|
61
|
+
...t,
|
|
62
|
+
[e]: !0
|
|
63
|
+
}));
|
|
64
|
+
}, []), f = S(() => {
|
|
65
|
+
if (!t) return !0;
|
|
66
|
+
let e = t(n), r = Object.fromEntries(Object.entries(e).filter(([, e]) => e != null));
|
|
67
|
+
return a(r), s(Object.fromEntries(Object.keys(n).map((e) => [e, !0]))), Object.keys(r).length === 0;
|
|
68
|
+
}, [n, t]), p = S(() => {
|
|
69
|
+
r({ ...c.current }), a({}), s({});
|
|
70
|
+
}, []);
|
|
71
|
+
return {
|
|
72
|
+
values: n,
|
|
73
|
+
errors: i,
|
|
74
|
+
touched: o,
|
|
75
|
+
dirty: Object.keys(n).some((e) => n[e] !== c.current[e]),
|
|
76
|
+
isValid: Object.keys(i).length === 0,
|
|
77
|
+
setValue: l,
|
|
78
|
+
setValues: u,
|
|
79
|
+
touchField: d,
|
|
80
|
+
validate: f,
|
|
81
|
+
reset: p,
|
|
82
|
+
getFieldProps: S((e) => ({
|
|
83
|
+
value: n[e],
|
|
84
|
+
onChange: (t) => {
|
|
85
|
+
l(e, t.target.value);
|
|
86
|
+
},
|
|
87
|
+
onBlur: () => d(e),
|
|
88
|
+
"aria-invalid": o[e] && i[e] ? !0 : void 0,
|
|
89
|
+
"aria-describedby": i[e] ? `${String(e)}-error` : void 0
|
|
90
|
+
}), [
|
|
91
|
+
n,
|
|
92
|
+
i,
|
|
93
|
+
o,
|
|
94
|
+
l,
|
|
95
|
+
d
|
|
96
|
+
])
|
|
97
|
+
};
|
|
85
98
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
selectedArray: w
|
|
126
|
-
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/headless/useListSelection.ts
|
|
101
|
+
function A({ items: e, initialSelected: t = [], multiple: n = !0 }) {
|
|
102
|
+
let [r, i] = E(() => new Set(t)), a = S((e) => {
|
|
103
|
+
i((t) => {
|
|
104
|
+
let r = new Set(t);
|
|
105
|
+
return r.has(e) ? r.delete(e) : (n || r.clear(), r.add(e)), r;
|
|
106
|
+
});
|
|
107
|
+
}, [n]), o = S((e) => {
|
|
108
|
+
i((t) => {
|
|
109
|
+
if (t.has(e)) return t;
|
|
110
|
+
let r = n ? new Set(t) : /* @__PURE__ */ new Set();
|
|
111
|
+
return r.add(e), r;
|
|
112
|
+
});
|
|
113
|
+
}, [n]), s = S((e) => {
|
|
114
|
+
i((t) => {
|
|
115
|
+
if (!t.has(e)) return t;
|
|
116
|
+
let n = new Set(t);
|
|
117
|
+
return n.delete(e), n;
|
|
118
|
+
});
|
|
119
|
+
}, []), c = S(() => {
|
|
120
|
+
n && i(new Set(e));
|
|
121
|
+
}, [e, n]), l = S(() => i(/* @__PURE__ */ new Set()), []), u = S(() => {
|
|
122
|
+
i((t) => e.every((e) => t.has(e)) ? /* @__PURE__ */ new Set() : new Set(e));
|
|
123
|
+
}, [e]), d = e.length > 0 && e.every((e) => r.has(e)), f = e.some((e) => r.has(e)), p = w(() => Array.from(r), [r]);
|
|
124
|
+
return {
|
|
125
|
+
selected: r,
|
|
126
|
+
isSelected: S((e) => r.has(e), [r]),
|
|
127
|
+
toggle: a,
|
|
128
|
+
select: o,
|
|
129
|
+
deselect: s,
|
|
130
|
+
selectAll: c,
|
|
131
|
+
deselectAll: l,
|
|
132
|
+
toggleAll: u,
|
|
133
|
+
allSelected: d,
|
|
134
|
+
someSelected: f,
|
|
135
|
+
selectedCount: r.size,
|
|
136
|
+
selectedArray: p
|
|
137
|
+
};
|
|
127
138
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/headless/useDebounce.ts
|
|
141
|
+
function j(e, t) {
|
|
142
|
+
let [n, r] = E(e);
|
|
143
|
+
return C(() => {
|
|
144
|
+
let n = setTimeout(() => r(e), t);
|
|
145
|
+
return () => clearTimeout(n);
|
|
146
|
+
}, [e, t]), n;
|
|
134
147
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/headless/useThrottle.ts
|
|
150
|
+
function M(e, t) {
|
|
151
|
+
let [n, r] = E(e), i = T(Date.now());
|
|
152
|
+
return C(() => {
|
|
153
|
+
let n = Date.now(), a = t - (n - i.current);
|
|
154
|
+
if (a <= 0) i.current = n, r(e);
|
|
155
|
+
else {
|
|
156
|
+
let t = setTimeout(() => {
|
|
157
|
+
i.current = Date.now(), r(e);
|
|
158
|
+
}, a);
|
|
159
|
+
return () => clearTimeout(t);
|
|
160
|
+
}
|
|
161
|
+
}, [e, t]), n;
|
|
148
162
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var i;
|
|
159
|
-
r || o(m), (i = s.current) == null || i.call(s, m);
|
|
160
|
-
},
|
|
161
|
-
[r]
|
|
162
|
-
);
|
|
163
|
-
return [r ? e : n, l];
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/headless/useControllable.ts
|
|
165
|
+
function N({ value: e, onChange: t, defaultValue: n }) {
|
|
166
|
+
let r = e !== void 0, [i, a] = E(n), o = T(t);
|
|
167
|
+
o.current = t;
|
|
168
|
+
let s = S((e) => {
|
|
169
|
+
r || a(e), o.current?.(e);
|
|
170
|
+
}, [r]);
|
|
171
|
+
return [r ? e : i, s];
|
|
164
172
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/headless/useMediaQuery.ts
|
|
175
|
+
function P(e) {
|
|
176
|
+
let [t, n] = E(() => typeof window > "u" ? !1 : window.matchMedia(e).matches);
|
|
177
|
+
return C(() => {
|
|
178
|
+
if (typeof window > "u") return;
|
|
179
|
+
let t = window.matchMedia(e);
|
|
180
|
+
n(t.matches);
|
|
181
|
+
let r = (e) => n(e.matches);
|
|
182
|
+
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
183
|
+
}, [e]), t;
|
|
174
184
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return [t, n, o];
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/headless/useLocalStorage.ts
|
|
187
|
+
function F(e, t) {
|
|
188
|
+
let [n, r] = E(() => {
|
|
189
|
+
if (typeof window > "u") return t;
|
|
190
|
+
try {
|
|
191
|
+
let n = window.localStorage.getItem(e);
|
|
192
|
+
return n === null ? t : JSON.parse(n);
|
|
193
|
+
} catch {
|
|
194
|
+
return t;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return [
|
|
198
|
+
n,
|
|
199
|
+
S((t) => {
|
|
200
|
+
r((n) => {
|
|
201
|
+
let r = typeof t == "function" ? t(n) : t;
|
|
202
|
+
if (typeof window < "u") try {
|
|
203
|
+
window.localStorage.setItem(e, JSON.stringify(r));
|
|
204
|
+
} catch {}
|
|
205
|
+
return r;
|
|
206
|
+
});
|
|
207
|
+
}, [e]),
|
|
208
|
+
S(() => {
|
|
209
|
+
if (r(t), typeof window < "u") try {
|
|
210
|
+
window.localStorage.removeItem(e);
|
|
211
|
+
} catch {}
|
|
212
|
+
}, [e, t])
|
|
213
|
+
];
|
|
205
214
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/headless/useIntersectionObserver.ts
|
|
217
|
+
function I({ threshold: e = 0, rootMargin: t = "0px", root: n = null, once: r = !1 } = {}) {
|
|
218
|
+
let i = T(null), [a, o] = E(null), s = T(null);
|
|
219
|
+
return C(() => {
|
|
220
|
+
let a = i.current;
|
|
221
|
+
if (!(!a || typeof IntersectionObserver > "u")) return s.current = new IntersectionObserver(([e]) => {
|
|
222
|
+
o(e), r && e.isIntersecting && s.current?.unobserve(a);
|
|
223
|
+
}, {
|
|
224
|
+
threshold: e,
|
|
225
|
+
rootMargin: t,
|
|
226
|
+
root: n
|
|
227
|
+
}), s.current.observe(a), () => s.current?.disconnect();
|
|
228
|
+
}, [
|
|
229
|
+
e,
|
|
230
|
+
t,
|
|
231
|
+
n,
|
|
232
|
+
r
|
|
233
|
+
]), {
|
|
234
|
+
ref: i,
|
|
235
|
+
isIntersecting: a?.isIntersecting ?? !1,
|
|
236
|
+
entry: a
|
|
237
|
+
};
|
|
227
238
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/headless/useWebSocket.ts
|
|
241
|
+
function L(e) {
|
|
242
|
+
let { url: t, protocols: n, reconnect: r = !0, reconnectDelay: i = 1e3, reconnectAttempts: a = 10, heartbeatInterval: o = 3e4, heartbeatMessage: s = "ping", onOpen: c, onClose: l, onError: u, onMessage: d } = e, [f, p] = E("disconnected"), [m, h] = E(null), [g, _] = E([]), [v, y] = E(0), [b, x] = E(null), w = T(null), D = T(0), O = T(null), k = T(null), A = T(null), j = T([]), M = T(!0), N = T(!1), P = T(c), F = T(l), I = T(u), L = T(d);
|
|
243
|
+
P.current = c, F.current = l, I.current = u, L.current = d;
|
|
244
|
+
let R = S(() => {
|
|
245
|
+
O.current &&= (clearTimeout(O.current), null), k.current &&= (clearInterval(k.current), null);
|
|
246
|
+
}, []), z = S((e) => {
|
|
247
|
+
for (; j.current.length > 0;) {
|
|
248
|
+
let t = j.current.shift();
|
|
249
|
+
t !== void 0 && e.send(typeof t == "string" ? t : JSON.stringify(t));
|
|
250
|
+
}
|
|
251
|
+
}, []), B = S(() => {
|
|
252
|
+
if (w.current && w.current.readyState === WebSocket.OPEN) return;
|
|
253
|
+
N.current = !1, R(), M.current && p("connecting");
|
|
254
|
+
let e = new WebSocket(t, n);
|
|
255
|
+
w.current = e, e.onopen = (t) => {
|
|
256
|
+
M.current && (p("connected"), D.current = 0, y(0), P.current?.(t), z(e), k.current = setInterval(() => {
|
|
257
|
+
if (e.readyState === WebSocket.OPEN) {
|
|
258
|
+
A.current = Date.now();
|
|
259
|
+
try {
|
|
260
|
+
e.send(JSON.stringify({
|
|
261
|
+
type: "ping",
|
|
262
|
+
t: A.current
|
|
263
|
+
}));
|
|
264
|
+
} catch {}
|
|
265
|
+
}
|
|
266
|
+
}, o));
|
|
267
|
+
}, e.onmessage = (e) => {
|
|
268
|
+
if (!M.current) return;
|
|
269
|
+
let t;
|
|
270
|
+
try {
|
|
271
|
+
t = JSON.parse(e.data);
|
|
272
|
+
} catch {
|
|
273
|
+
t = e.data;
|
|
274
|
+
}
|
|
275
|
+
let n = t;
|
|
276
|
+
if (n && typeof n == "object" && n.type === "pong" && typeof n.t == "number") {
|
|
277
|
+
x(Date.now() - n.t);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (t === s && A.current !== null) {
|
|
281
|
+
x(Date.now() - A.current), A.current = null;
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
h(t), _((e) => {
|
|
285
|
+
let n = [...e, t];
|
|
286
|
+
return n.length > 100 ? n.slice(n.length - 100) : n;
|
|
287
|
+
}), L.current?.(t);
|
|
288
|
+
}, e.onerror = (e) => {
|
|
289
|
+
M.current && (p("error"), I.current?.(e));
|
|
290
|
+
}, e.onclose = (e) => {
|
|
291
|
+
if (M.current && (R(), p("disconnected"), F.current?.(e), !N.current && r && D.current < a)) {
|
|
292
|
+
let e = i * 1.5 ** D.current;
|
|
293
|
+
D.current += 1, y(D.current), O.current = setTimeout(() => {
|
|
294
|
+
M.current && B();
|
|
295
|
+
}, e);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
}, [
|
|
299
|
+
t,
|
|
300
|
+
n,
|
|
301
|
+
r,
|
|
302
|
+
i,
|
|
303
|
+
a,
|
|
304
|
+
o,
|
|
305
|
+
s,
|
|
306
|
+
R,
|
|
307
|
+
z
|
|
308
|
+
]), V = S(() => {
|
|
309
|
+
N.current = !0, R(), w.current &&= (w.current.close(), null), M.current && p("disconnected");
|
|
310
|
+
}, [R]), H = S((e) => {
|
|
311
|
+
w.current && w.current.readyState === WebSocket.OPEN ? w.current.send(typeof e == "string" ? e : JSON.stringify(e)) : j.current.push(e);
|
|
312
|
+
}, []);
|
|
313
|
+
return C(() => (M.current = !0, B(), () => {
|
|
314
|
+
M.current = !1, N.current = !0, R(), w.current &&= (w.current.close(), null);
|
|
315
|
+
}), []), {
|
|
316
|
+
status: f,
|
|
317
|
+
lastMessage: m,
|
|
318
|
+
messages: g,
|
|
319
|
+
send: H,
|
|
320
|
+
connect: B,
|
|
321
|
+
disconnect: V,
|
|
322
|
+
reconnectCount: v,
|
|
323
|
+
latency: b
|
|
324
|
+
};
|
|
307
325
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/headless/useSSE.ts
|
|
328
|
+
function R(e) {
|
|
329
|
+
let { url: t, events: n = ["message"], withCredentials: r = !1, reconnect: i = !0, reconnectDelay: a = 3e3, onOpen: o, onError: s } = e, [c, l] = E("connecting"), [u, d] = E(null), [f, p] = E([]), [m, h] = E(0), g = T(null), _ = T(null), v = T(!0), y = T(!1), b = T(o), x = T(s);
|
|
330
|
+
b.current = o, x.current = s;
|
|
331
|
+
let w = S(() => {
|
|
332
|
+
_.current &&= (clearTimeout(_.current), null);
|
|
333
|
+
}, []), D = S(() => {
|
|
334
|
+
if (typeof EventSource > "u") {
|
|
335
|
+
v.current && l("error");
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
y.current = !1, w(), g.current &&= (g.current.close(), null), v.current && l("connecting");
|
|
339
|
+
let e = new EventSource(t, { withCredentials: r });
|
|
340
|
+
g.current = e, e.onopen = () => {
|
|
341
|
+
v.current && (l("connected"), b.current?.());
|
|
342
|
+
}, e.onerror = (e) => {
|
|
343
|
+
v.current && (l("error"), x.current?.(e), !y.current && i && (w(), _.current = setTimeout(() => {
|
|
344
|
+
v.current && D();
|
|
345
|
+
}, a)));
|
|
346
|
+
};
|
|
347
|
+
let o = (e) => (t) => {
|
|
348
|
+
if (!v.current) return;
|
|
349
|
+
let n;
|
|
350
|
+
try {
|
|
351
|
+
n = JSON.parse(t.data);
|
|
352
|
+
} catch {
|
|
353
|
+
n = t.data;
|
|
354
|
+
}
|
|
355
|
+
let r = {
|
|
356
|
+
type: e,
|
|
357
|
+
data: n,
|
|
358
|
+
timestamp: Date.now(),
|
|
359
|
+
...t.lastEventId ? { id: t.lastEventId } : {}
|
|
360
|
+
};
|
|
361
|
+
d({
|
|
362
|
+
type: r.type,
|
|
363
|
+
data: r.data,
|
|
364
|
+
id: r.id
|
|
365
|
+
}), p((e) => {
|
|
366
|
+
let t = [...e, r];
|
|
367
|
+
return t.length > 200 ? t.slice(t.length - 200) : t;
|
|
368
|
+
}), h((e) => e + 1);
|
|
369
|
+
};
|
|
370
|
+
for (let t of n) e.addEventListener(t, o(t));
|
|
371
|
+
}, [
|
|
372
|
+
t,
|
|
373
|
+
r,
|
|
374
|
+
i,
|
|
375
|
+
a,
|
|
376
|
+
w
|
|
377
|
+
]), O = S(() => {
|
|
378
|
+
y.current = !0, w(), g.current &&= (g.current.close(), null), v.current && l("closed");
|
|
379
|
+
}, [w]);
|
|
380
|
+
return C(() => (v.current = !0, D(), () => {
|
|
381
|
+
v.current = !1, y.current = !0, w(), g.current &&= (g.current.close(), null);
|
|
382
|
+
}), []), {
|
|
383
|
+
status: c,
|
|
384
|
+
lastEvent: u,
|
|
385
|
+
events: f,
|
|
386
|
+
connect: D,
|
|
387
|
+
disconnect: O,
|
|
388
|
+
eventCount: m
|
|
389
|
+
};
|
|
371
390
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
pageIndex: w,
|
|
421
|
-
totalLoaded: F
|
|
422
|
-
};
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/headless/useInfiniteQuery.ts
|
|
393
|
+
function z(e) {
|
|
394
|
+
let { queryFn: t, initialCursor: n = null, enabled: r = !0, dedupKey: i } = e, [a, o] = E([]), [s, c] = E("idle"), [l, u] = E(null), [d, f] = E(!1), [p, m] = E(0), h = T(n ?? null), g = T(!1), _ = T(!0), v = T(void 0), y = T(t);
|
|
395
|
+
y.current = t;
|
|
396
|
+
let b = S(async (e, t, n) => {
|
|
397
|
+
if (g.current || i !== void 0 && i === v.current) return;
|
|
398
|
+
g.current = !0;
|
|
399
|
+
let r = !1;
|
|
400
|
+
_.current && (c(n ? "loading" : "fetching-more"), u(null));
|
|
401
|
+
try {
|
|
402
|
+
let a = await y.current(e, t);
|
|
403
|
+
if (r || !_.current) return;
|
|
404
|
+
i !== void 0 && (v.current = i), h.current = a.nextCursor, o((e) => n ? [a.data] : [...e, a.data]), f(a.hasMore), m(t), c("success");
|
|
405
|
+
} catch (e) {
|
|
406
|
+
if (r || !_.current) return;
|
|
407
|
+
u(e instanceof Error ? e : Error(String(e))), c("error");
|
|
408
|
+
} finally {
|
|
409
|
+
r || (g.current = !1);
|
|
410
|
+
}
|
|
411
|
+
return () => {
|
|
412
|
+
r = !0;
|
|
413
|
+
};
|
|
414
|
+
}, [i]), x = S(() => {
|
|
415
|
+
!d || g.current || b(h.current, p + 1, !1);
|
|
416
|
+
}, [
|
|
417
|
+
d,
|
|
418
|
+
p,
|
|
419
|
+
b
|
|
420
|
+
]), w = S(() => {
|
|
421
|
+
g.current = !1, v.current = void 0, h.current = n ?? null, o([]), c("idle"), u(null), f(!1), m(0);
|
|
422
|
+
}, [n]);
|
|
423
|
+
C(() => (_.current = !0, r && b(n ?? null, 0, !0), () => {
|
|
424
|
+
_.current = !1;
|
|
425
|
+
}), [r]);
|
|
426
|
+
let D = a.flat();
|
|
427
|
+
return {
|
|
428
|
+
data: D,
|
|
429
|
+
pages: a,
|
|
430
|
+
status: s,
|
|
431
|
+
error: l,
|
|
432
|
+
hasMore: d,
|
|
433
|
+
isFetchingMore: s === "fetching-more",
|
|
434
|
+
fetchMore: x,
|
|
435
|
+
reset: w,
|
|
436
|
+
pageIndex: p,
|
|
437
|
+
totalLoaded: D.length
|
|
438
|
+
};
|
|
423
439
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
Ce as cssVar,
|
|
427
|
-
Ee as cx,
|
|
428
|
-
xe as extractAtomicCSS,
|
|
429
|
-
Me as extractCSS,
|
|
430
|
-
ke as injectStyles,
|
|
431
|
-
Fe as meetsAA,
|
|
432
|
-
Le as meetsAAA,
|
|
433
|
-
Ie as resetAtomicCSS,
|
|
434
|
-
Ve as resetStyles,
|
|
435
|
-
Ne as sanitizeProps,
|
|
436
|
-
je as sanitizeString,
|
|
437
|
-
Oe as tkxListPlugins,
|
|
438
|
-
De as tkxPlugin,
|
|
439
|
-
Re as tkxRemovePlugin,
|
|
440
|
-
ge as useAnnounce,
|
|
441
|
-
me as useClickOutside,
|
|
442
|
-
ce as useControllable,
|
|
443
|
-
ne as useDebounce,
|
|
444
|
-
Z as useDisclosure,
|
|
445
|
-
he as useEscapeKey,
|
|
446
|
-
ye as useFocusTrap,
|
|
447
|
-
ee as useFormState,
|
|
448
|
-
Se as useHighContrast,
|
|
449
|
-
ie as useInfiniteQuery,
|
|
450
|
-
ue as useIntersectionObserver,
|
|
451
|
-
te as useListSelection,
|
|
452
|
-
oe as useLocalStorage,
|
|
453
|
-
se as useMediaQuery,
|
|
454
|
-
pe as useReducedMotion,
|
|
455
|
-
_ as useRovingTabIndex,
|
|
456
|
-
le as useSSE,
|
|
457
|
-
re as useThrottle,
|
|
458
|
-
ve as useTkxForm,
|
|
459
|
-
ae as useWebSocket
|
|
460
|
-
};
|
|
440
|
+
//#endregion
|
|
441
|
+
export { r as contrastRatio, t as cssVar, m as cx, l as extractAtomicCSS, e as extractCSS, a as injectStyles, n as meetsAA, o as meetsAAA, f as resetAtomicCSS, i as resetStyles, d as sanitizeProps, c as sanitizeString, u as tkxListPlugins, p as tkxPlugin, s as tkxRemovePlugin, b as useAnnounce, _ as useClickOutside, N as useControllable, j as useDebounce, D as useDisclosure, y as useEscapeKey, g as useFocusTrap, k as useFormState, h as useHighContrast, z as useInfiniteQuery, I as useIntersectionObserver, A as useListSelection, F as useLocalStorage, P as useMediaQuery, v as useReducedMotion, O as useRovingTabIndex, R as useSSE, M as useThrottle, x as useTkxForm, L as useWebSocket };
|