tekivex-ui 2.5.7 → 2.5.8
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-2tGLCPH6.js +326 -0
- package/dist/TkxForm-C2VqR2wC.cjs +12 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +264 -251
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +21 -20
- package/dist/index-BgHMZe4Z.js +66 -0
- package/dist/index-Bt5y50Qa.cjs +1 -0
- package/dist/index-DnqXtpwV.cjs +2 -0
- package/dist/{index-CAXjeKoK.js → index-iUUHRxqJ.js} +77 -75
- package/dist/index.cjs +21 -21
- package/dist/index.js +24 -25
- package/dist/quantum.cjs +2 -2
- package/dist/quantum.js +4 -4
- package/dist/realtime.cjs +8 -4
- package/dist/realtime.js +391 -377
- package/dist/{security-loRa1HyV.js → security-C-ZPGoyG.js} +1 -1
- package/dist/{security-DMqZVW5d.cjs → security-Uf0mjv8o.cjs} +1 -1
- package/dist/src/charts/TkxDonutChart.d.ts.map +1 -1
- package/dist/src/charts/TkxPieChart.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts +17 -16
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxLiveMetrics.d.ts.map +1 -1
- package/dist/src/components/TkxPlayground.d.ts.map +1 -1
- package/dist/src/components/TkxProgress.d.ts.map +1 -1
- package/dist/src/themes/index.d.ts.map +1 -1
- package/dist/{tkx-C_AlpMt4.js → tkx-BtHzWKTl.js} +1 -1
- package/dist/{tkx-69KQ0myA.cjs → tkx-C7GvVUE9.cjs} +1 -1
- package/package.json +5 -5
- package/src/charts/TkxDonutChart.tsx +6 -2
- package/src/charts/TkxPieChart.tsx +7 -3
- package/src/charts/shared.ts +4 -4
- package/src/components/TkxForm.tsx +35 -32
- package/src/components/TkxLiveMetrics.tsx +24 -2
- package/src/components/TkxPlayground.tsx +40 -5
- package/src/components/TkxProgress.tsx +0 -2
- package/src/themes/index.ts +8 -1
- package/dist/TkxForm-BK5Sq7oj.cjs +0 -12
- package/dist/TkxForm-br3i_vo8.js +0 -388
- package/dist/index-DB_m7X7e.cjs +0 -2
package/dist/realtime.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useRef as D, useState as
|
|
2
|
-
import { u as
|
|
3
|
-
import { s as
|
|
4
|
-
const _ = 64,
|
|
5
|
-
let
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
import { useRef as D, useState as W, useMemo as Q, useEffect as B, useCallback as K, createElement as n } from "react";
|
|
2
|
+
import { u as ee } from "./index-iUUHRxqJ.js";
|
|
3
|
+
import { s as L } from "./security-C-ZPGoyG.js";
|
|
4
|
+
const _ = 64, ue = 5;
|
|
5
|
+
let fe = !1;
|
|
6
|
+
function Ie() {
|
|
7
|
+
if (fe || typeof document > "u") return;
|
|
8
|
+
fe = !0;
|
|
9
|
+
const e = document.createElement("style");
|
|
10
|
+
e.id = "tkx-live-feed-styles", e.textContent = `
|
|
11
11
|
@keyframes tkx-feed-slide-in {
|
|
12
12
|
from { transform: translateY(-20px); opacity: 0; }
|
|
13
13
|
to { transform: translateY(0); opacity: 1; }
|
|
@@ -15,34 +15,34 @@ function It() {
|
|
|
15
15
|
.tkx-feed-item-new {
|
|
16
16
|
animation: tkx-feed-slide-in 0.25s ease-out both;
|
|
17
17
|
}
|
|
18
|
-
`.trim(), document.head.appendChild(
|
|
18
|
+
`.trim(), document.head.appendChild(e);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
return
|
|
20
|
+
function Le(e) {
|
|
21
|
+
const t = Date.now() - e;
|
|
22
|
+
return t < 1e4 ? "just now" : t < 6e4 ? `${Math.floor(t / 1e3)}s ago` : t < 36e5 ? `${Math.floor(t / 6e4)}m ago` : t < 864e5 ? `${Math.floor(t / 36e5)}h ago` : `${Math.floor(t / 864e5)}d ago`;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
switch (
|
|
24
|
+
function Re(e, t) {
|
|
25
|
+
switch (e) {
|
|
26
26
|
case "info":
|
|
27
|
-
return
|
|
27
|
+
return t.info;
|
|
28
28
|
case "success":
|
|
29
|
-
return
|
|
29
|
+
return t.success;
|
|
30
30
|
case "warning":
|
|
31
|
-
return
|
|
31
|
+
return t.warning;
|
|
32
32
|
case "error":
|
|
33
|
-
return
|
|
33
|
+
return t.danger;
|
|
34
34
|
default:
|
|
35
|
-
return
|
|
35
|
+
return t.border;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
38
|
+
function ze(e) {
|
|
39
|
+
return e ? e.split(" ").map((t) => t[0] ?? "").slice(0, 2).join("").toUpperCase() : "?";
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const u =
|
|
43
|
-
if (
|
|
44
|
-
return n("div", { style: f, className:
|
|
45
|
-
const
|
|
41
|
+
function Ee({ item: e, isNew: t, showTimestamps: o, onItemClick: r, renderItem: a, theme: s, style: f }) {
|
|
42
|
+
const u = Re(e.type, s);
|
|
43
|
+
if (a)
|
|
44
|
+
return n("div", { style: f, className: t ? "tkx-feed-item-new" : void 0 }, a(e));
|
|
45
|
+
const h = {
|
|
46
46
|
...f,
|
|
47
47
|
display: "flex",
|
|
48
48
|
alignItems: "center",
|
|
@@ -58,13 +58,13 @@ function Nt({ item: t, isNew: e, showTimestamps: o, onItemClick: r, renderItem:
|
|
|
58
58
|
return n(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
|
-
style:
|
|
62
|
-
className:
|
|
63
|
-
onClick: r ? () => r(
|
|
61
|
+
style: h,
|
|
62
|
+
className: t ? "tkx-feed-item-new" : void 0,
|
|
63
|
+
onClick: r ? () => r(e) : void 0,
|
|
64
64
|
role: r ? "button" : void 0,
|
|
65
65
|
tabIndex: r ? 0 : void 0,
|
|
66
|
-
onKeyDown: r ? (
|
|
67
|
-
(
|
|
66
|
+
onKeyDown: r ? (l) => {
|
|
67
|
+
(l.key === "Enter" || l.key === " ") && r(e);
|
|
68
68
|
} : void 0
|
|
69
69
|
},
|
|
70
70
|
// Avatar
|
|
@@ -86,7 +86,7 @@ function Nt({ item: t, isNew: e, showTimestamps: o, onItemClick: r, renderItem:
|
|
|
86
86
|
overflow: "hidden"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
e.avatar ? n("img", { src: e.avatar, alt: e.author ?? "", style: { width: "100%", height: "100%", objectFit: "cover" } }) : ze(e.author)
|
|
90
90
|
),
|
|
91
91
|
// Body
|
|
92
92
|
n(
|
|
@@ -95,75 +95,75 @@ function Nt({ item: t, isNew: e, showTimestamps: o, onItemClick: r, renderItem:
|
|
|
95
95
|
n(
|
|
96
96
|
"div",
|
|
97
97
|
{ style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 2 } },
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
e.author && n("span", { style: { fontWeight: 600, fontSize: 13, color: s.text } }, L(e.author)),
|
|
99
|
+
e.meta && n("span", { style: { fontSize: 11, color: s.textMuted, background: s.surfaceAlt, borderRadius: 4, padding: "1px 5px" } }, L(e.meta))
|
|
100
100
|
),
|
|
101
101
|
n(
|
|
102
102
|
"div",
|
|
103
103
|
{ style: { fontSize: 13, color: s.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } },
|
|
104
|
-
|
|
104
|
+
L(e.content)
|
|
105
105
|
)
|
|
106
106
|
),
|
|
107
107
|
// Timestamp
|
|
108
108
|
o && n(
|
|
109
109
|
"div",
|
|
110
110
|
{ style: { fontSize: 11, color: s.textMuted, flexShrink: 0 } },
|
|
111
|
-
|
|
111
|
+
Le(e.timestamp)
|
|
112
112
|
)
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
items:
|
|
117
|
-
maxItems:
|
|
115
|
+
function Je({
|
|
116
|
+
items: e,
|
|
117
|
+
maxItems: t = 100,
|
|
118
118
|
height: o = 400,
|
|
119
119
|
autoScroll: r = !0,
|
|
120
|
-
showTimestamps:
|
|
120
|
+
showTimestamps: a = !0,
|
|
121
121
|
onItemClick: s,
|
|
122
122
|
emptyMessage: f = "No activity yet.",
|
|
123
123
|
pauseOnHover: u = !0,
|
|
124
|
-
renderItem:
|
|
124
|
+
renderItem: h
|
|
125
125
|
}) {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
() =>
|
|
130
|
-
[
|
|
131
|
-
), $ = typeof o == "number" ? o : 400, w =
|
|
132
|
-
|
|
133
|
-
const I = new Set(
|
|
126
|
+
const l = ee();
|
|
127
|
+
Ie();
|
|
128
|
+
const y = D(null), [v, k] = W(0), [b, x] = W(!1), [C, N] = W(/* @__PURE__ */ new Set()), V = D([]), R = Q(
|
|
129
|
+
() => e.slice(-t),
|
|
130
|
+
[e, t]
|
|
131
|
+
), $ = typeof o == "number" ? o : 400, w = R.length * _;
|
|
132
|
+
B(() => {
|
|
133
|
+
const I = new Set(V.current.map((E) => E.id)), S = R.filter((E) => !I.has(E.id)).map((E) => E.id);
|
|
134
134
|
if (S.length > 0) {
|
|
135
|
-
|
|
135
|
+
N((j) => {
|
|
136
136
|
const F = new Set(j);
|
|
137
137
|
return S.forEach((A) => F.add(A)), F;
|
|
138
138
|
});
|
|
139
|
-
const
|
|
140
|
-
|
|
139
|
+
const E = window.setTimeout(() => {
|
|
140
|
+
N((j) => {
|
|
141
141
|
const F = new Set(j);
|
|
142
142
|
return S.forEach((A) => F.delete(A)), F;
|
|
143
143
|
});
|
|
144
144
|
}, 400);
|
|
145
|
-
return () => clearTimeout(
|
|
145
|
+
return () => clearTimeout(E);
|
|
146
146
|
}
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
}, [
|
|
147
|
+
}, [R]), B(() => {
|
|
148
|
+
V.current = R;
|
|
149
|
+
}, [R]);
|
|
150
150
|
const P = r && !(u && b);
|
|
151
|
-
|
|
152
|
-
if (!P || !
|
|
153
|
-
const I =
|
|
154
|
-
(I.scrollHeight - I.scrollTop - I.clientHeight < _ * 3 ||
|
|
155
|
-
}, [
|
|
151
|
+
B(() => {
|
|
152
|
+
if (!P || !y.current) return;
|
|
153
|
+
const I = y.current;
|
|
154
|
+
(I.scrollHeight - I.scrollTop - I.clientHeight < _ * 3 || R.length <= 5) && (I.scrollTop = I.scrollHeight);
|
|
155
|
+
}, [R.length, P]);
|
|
156
156
|
const Y = K(() => {
|
|
157
|
-
|
|
158
|
-
}, []), H = Math.max(0, Math.floor(v / _) -
|
|
159
|
-
|
|
160
|
-
Math.ceil((v + $) / _) +
|
|
157
|
+
y.current && k(y.current.scrollTop);
|
|
158
|
+
}, []), H = Math.max(0, Math.floor(v / _) - ue), g = Math.min(
|
|
159
|
+
R.length - 1,
|
|
160
|
+
Math.ceil((v + $) / _) + ue
|
|
161
161
|
), T = {
|
|
162
162
|
position: "relative",
|
|
163
163
|
overflow: "auto",
|
|
164
164
|
height: typeof o == "number" ? `${o}px` : o,
|
|
165
|
-
background:
|
|
166
|
-
border: `1px solid ${
|
|
165
|
+
background: l.bg,
|
|
166
|
+
border: `1px solid ${l.border}`,
|
|
167
167
|
borderRadius: 8,
|
|
168
168
|
boxSizing: "border-box"
|
|
169
169
|
}, G = {
|
|
@@ -171,24 +171,24 @@ function qt({
|
|
|
171
171
|
height: w,
|
|
172
172
|
minHeight: "100%"
|
|
173
173
|
};
|
|
174
|
-
if (
|
|
174
|
+
if (R.length === 0)
|
|
175
175
|
return n(
|
|
176
176
|
"div",
|
|
177
177
|
{ style: { ...T, display: "flex", alignItems: "center", justifyContent: "center" } },
|
|
178
|
-
n("span", { style: { color:
|
|
178
|
+
n("span", { style: { color: l.textMuted, fontSize: 14 } }, L(f))
|
|
179
179
|
);
|
|
180
|
-
const
|
|
180
|
+
const z = [];
|
|
181
181
|
for (let I = H; I <= g; I++) {
|
|
182
|
-
const S =
|
|
183
|
-
S &&
|
|
184
|
-
n(
|
|
182
|
+
const S = R[I];
|
|
183
|
+
S && z.push(
|
|
184
|
+
n(Ee, {
|
|
185
185
|
key: S.id,
|
|
186
186
|
item: S,
|
|
187
|
-
isNew:
|
|
188
|
-
showTimestamps:
|
|
187
|
+
isNew: C.has(S.id),
|
|
188
|
+
showTimestamps: a,
|
|
189
189
|
onItemClick: s,
|
|
190
|
-
renderItem:
|
|
191
|
-
theme:
|
|
190
|
+
renderItem: h,
|
|
191
|
+
theme: l,
|
|
192
192
|
style: {
|
|
193
193
|
position: "absolute",
|
|
194
194
|
top: I * _,
|
|
@@ -201,23 +201,23 @@ function qt({
|
|
|
201
201
|
return n(
|
|
202
202
|
"div",
|
|
203
203
|
{
|
|
204
|
-
ref:
|
|
204
|
+
ref: y,
|
|
205
205
|
style: T,
|
|
206
206
|
onScroll: Y,
|
|
207
|
-
onMouseEnter: u ? () =>
|
|
208
|
-
onMouseLeave: u ? () =>
|
|
207
|
+
onMouseEnter: u ? () => x(!0) : void 0,
|
|
208
|
+
onMouseLeave: u ? () => x(!1) : void 0,
|
|
209
209
|
"aria-label": "Live feed",
|
|
210
210
|
role: "feed"
|
|
211
211
|
},
|
|
212
|
-
n("div", { style: G }, ...
|
|
212
|
+
n("div", { style: G }, ...z)
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
-
let
|
|
216
|
-
function
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
215
|
+
let pe = !1;
|
|
216
|
+
function Ne() {
|
|
217
|
+
if (pe || typeof document > "u") return;
|
|
218
|
+
pe = !0;
|
|
219
|
+
const e = document.createElement("style");
|
|
220
|
+
e.id = "tkx-live-metrics-styles", e.textContent = `
|
|
221
221
|
@keyframes tkx-metric-pulse {
|
|
222
222
|
0% { opacity: 1; }
|
|
223
223
|
40% { opacity: 0.4; }
|
|
@@ -230,48 +230,62 @@ function Et() {
|
|
|
230
230
|
.tkx-metric-shimmer {
|
|
231
231
|
animation: tkx-metric-shimmer 0.6s ease-in-out;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
@media (prefers-reduced-motion: reduce) {
|
|
234
|
+
.tkx-metric-shimmer { animation: none; }
|
|
235
|
+
.tkx-metric-pulse { animation: none; }
|
|
236
|
+
}
|
|
237
|
+
`.trim(), document.head.appendChild(e);
|
|
234
238
|
}
|
|
235
|
-
function
|
|
236
|
-
if (typeof
|
|
237
|
-
const o =
|
|
238
|
-
return
|
|
239
|
+
function ge(e, t) {
|
|
240
|
+
if (typeof e == "string") return e;
|
|
241
|
+
const o = e >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(Number.isInteger(e) ? e : e.toFixed(2));
|
|
242
|
+
return t ? `${o}${t}` : o;
|
|
239
243
|
}
|
|
240
|
-
function
|
|
241
|
-
switch (
|
|
244
|
+
function We(e, t) {
|
|
245
|
+
switch (e) {
|
|
242
246
|
case "warning":
|
|
243
|
-
return
|
|
247
|
+
return t.warning;
|
|
244
248
|
case "critical":
|
|
245
|
-
return
|
|
249
|
+
return t.danger;
|
|
246
250
|
default:
|
|
247
|
-
return
|
|
251
|
+
return t.primary;
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
|
-
function
|
|
251
|
-
const [
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
function Ce() {
|
|
255
|
+
const [e, t] = W(
|
|
256
|
+
() => typeof window < "u" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : !1
|
|
257
|
+
);
|
|
258
|
+
return B(() => {
|
|
259
|
+
if (typeof window > "u") return;
|
|
260
|
+
const o = window.matchMedia("(prefers-reduced-motion: reduce)"), r = (a) => t(a.matches);
|
|
261
|
+
return o.addEventListener("change", r), () => o.removeEventListener("change", r);
|
|
262
|
+
}, []), e;
|
|
263
|
+
}
|
|
264
|
+
function He(e, t, o) {
|
|
265
|
+
const [r, a] = W(e), s = D(e), f = D(null), u = D(null), h = Ce();
|
|
266
|
+
return B(() => {
|
|
267
|
+
if (!o || h) {
|
|
268
|
+
a(e), s.current = e;
|
|
255
269
|
return;
|
|
256
270
|
}
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
271
|
+
const l = s.current;
|
|
272
|
+
if (l === e) return;
|
|
259
273
|
f.current = null;
|
|
260
|
-
const
|
|
261
|
-
f.current === null && (f.current =
|
|
262
|
-
const
|
|
263
|
-
|
|
274
|
+
const y = (v) => {
|
|
275
|
+
f.current === null && (f.current = v);
|
|
276
|
+
const k = v - f.current, b = Math.min(k / t, 1), x = 1 - Math.pow(1 - b, 3);
|
|
277
|
+
a(l + (e - l) * x), b < 1 ? u.current = requestAnimationFrame(y) : s.current = e;
|
|
264
278
|
};
|
|
265
|
-
return u.current = requestAnimationFrame(
|
|
279
|
+
return u.current = requestAnimationFrame(y), () => {
|
|
266
280
|
u.current !== null && cancelAnimationFrame(u.current);
|
|
267
281
|
};
|
|
268
|
-
}, [t,
|
|
282
|
+
}, [e, t, o, h]), r;
|
|
269
283
|
}
|
|
270
|
-
function
|
|
271
|
-
if (
|
|
272
|
-
const o = 80, r = 24,
|
|
273
|
-
const
|
|
274
|
-
return `${
|
|
284
|
+
function Fe({ data: e, color: t }) {
|
|
285
|
+
if (e.length < 2) return null;
|
|
286
|
+
const o = 80, r = 24, a = Math.min(...e), f = Math.max(...e) - a || 1, u = e.map((h, l) => {
|
|
287
|
+
const y = l / (e.length - 1) * o, v = r - (h - a) / f * (r - 2) - 1;
|
|
288
|
+
return `${y.toFixed(1)},${v.toFixed(1)}`;
|
|
275
289
|
});
|
|
276
290
|
return n(
|
|
277
291
|
"svg",
|
|
@@ -279,29 +293,29 @@ function Ht({ data: t, color: e }) {
|
|
|
279
293
|
n("polyline", {
|
|
280
294
|
points: u.join(" "),
|
|
281
295
|
fill: "none",
|
|
282
|
-
stroke:
|
|
296
|
+
stroke: t,
|
|
283
297
|
strokeWidth: 1.5,
|
|
284
298
|
strokeLinejoin: "round",
|
|
285
299
|
strokeLinecap: "round"
|
|
286
300
|
})
|
|
287
301
|
);
|
|
288
302
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
303
|
+
function Ae({ trend: e, theme: t }) {
|
|
304
|
+
return e === "up" ? n("span", { style: { color: t.success, fontSize: 14, fontWeight: 700 } }, "▲") : e === "down" ? n("span", { style: { color: t.danger, fontSize: 14, fontWeight: 700 } }, "▼") : n("span", { style: { color: t.textMuted, fontSize: 14 } }, "→");
|
|
291
305
|
}
|
|
292
|
-
function
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
return () => clearTimeout(
|
|
306
|
+
function De({ metric: e, animate: t, onMetricClick: o, theme: r }) {
|
|
307
|
+
const a = e.color ?? We(e.status, r), s = typeof e.value == "number" ? e.value : NaN, f = He(isNaN(s) ? 0 : s, 600, t && !isNaN(s)), [u, h] = W(!1), l = D(e.value);
|
|
308
|
+
B(() => {
|
|
309
|
+
if (l.current !== e.value) {
|
|
310
|
+
l.current = e.value, h(!0);
|
|
311
|
+
const x = window.setTimeout(() => h(!1), 700);
|
|
312
|
+
return () => clearTimeout(x);
|
|
299
313
|
}
|
|
300
|
-
}, [
|
|
301
|
-
const
|
|
314
|
+
}, [e.value]);
|
|
315
|
+
const y = e.previousValue !== void 0 && e.previousValue !== s, v = {
|
|
302
316
|
background: r.surface,
|
|
303
317
|
border: `1px solid ${r.border}`,
|
|
304
|
-
borderLeft: `4px solid ${
|
|
318
|
+
borderLeft: `4px solid ${a}`,
|
|
305
319
|
borderRadius: 8,
|
|
306
320
|
padding: "14px 16px",
|
|
307
321
|
cursor: o ? "pointer" : "default",
|
|
@@ -311,171 +325,171 @@ function At({ metric: t, animate: e, onMetricClick: o, theme: r }) {
|
|
|
311
325
|
}, k = u ? {
|
|
312
326
|
position: "absolute",
|
|
313
327
|
inset: 0,
|
|
314
|
-
background: `linear-gradient(90deg, transparent 0%, ${
|
|
328
|
+
background: `linear-gradient(90deg, transparent 0%, ${a}22 50%, transparent 100%)`,
|
|
315
329
|
backgroundSize: "200% 100%",
|
|
316
330
|
animation: "tkx-metric-shimmer 0.6s ease-in-out",
|
|
317
331
|
pointerEvents: "none"
|
|
318
|
-
} : {}, b = isNaN(s) ?
|
|
332
|
+
} : {}, b = isNaN(s) ? L(String(e.value)) : ge(f, e.unit);
|
|
319
333
|
return n(
|
|
320
334
|
"div",
|
|
321
335
|
{
|
|
322
336
|
style: v,
|
|
323
337
|
className: u ? "tkx-metric-shimmer" : void 0,
|
|
324
|
-
onClick: o ? () => o(
|
|
338
|
+
onClick: o ? () => o(e) : void 0,
|
|
325
339
|
role: o ? "button" : void 0,
|
|
326
340
|
tabIndex: o ? 0 : void 0
|
|
327
341
|
},
|
|
328
342
|
// Shimmer overlay
|
|
329
343
|
u && n("div", { style: k }),
|
|
330
344
|
// Label
|
|
331
|
-
n("div", { style: { fontSize: 12, color: r.textMuted, marginBottom: 6, fontWeight: 500, letterSpacing: "0.03em" } },
|
|
345
|
+
n("div", { style: { fontSize: 12, color: r.textMuted, marginBottom: 6, fontWeight: 500, letterSpacing: "0.03em" } }, L(e.label)),
|
|
332
346
|
// Value row
|
|
333
347
|
n(
|
|
334
348
|
"div",
|
|
335
349
|
{ style: { display: "flex", alignItems: "flex-end", gap: 6, marginBottom: 6 } },
|
|
336
350
|
n("span", { style: { fontSize: 28, fontWeight: 700, color: r.text, lineHeight: 1 } }, b),
|
|
337
|
-
|
|
351
|
+
e.unit && isNaN(s) && n("span", { style: { fontSize: 14, color: r.textMuted, marginBottom: 2 } }, L(e.unit))
|
|
338
352
|
),
|
|
339
353
|
// Trend row
|
|
340
|
-
(
|
|
354
|
+
(e.trend || e.trendValue) && n(
|
|
341
355
|
"div",
|
|
342
|
-
{ style: { display: "flex", alignItems: "center", gap: 4, marginBottom:
|
|
343
|
-
|
|
344
|
-
|
|
356
|
+
{ style: { display: "flex", alignItems: "center", gap: 4, marginBottom: e.sparkline ? 8 : 0 } },
|
|
357
|
+
e.trend && n(Ae, { trend: e.trend, theme: r }),
|
|
358
|
+
e.trendValue && n("span", { style: { fontSize: 12, color: r.textMuted } }, L(e.trendValue))
|
|
345
359
|
),
|
|
346
360
|
// Previous value
|
|
347
|
-
|
|
361
|
+
y && n(
|
|
348
362
|
"div",
|
|
349
363
|
{ style: { fontSize: 11, color: r.textMuted, marginTop: 2 } },
|
|
350
|
-
`was ${
|
|
364
|
+
`was ${ge(e.previousValue)}`
|
|
351
365
|
),
|
|
352
366
|
// Sparkline
|
|
353
|
-
|
|
367
|
+
e.sparkline && e.sparkline.length >= 2 && n(
|
|
354
368
|
"div",
|
|
355
369
|
{ style: { marginTop: 8 } },
|
|
356
|
-
n(
|
|
370
|
+
n(Fe, { data: e.sparkline, color: a })
|
|
357
371
|
)
|
|
358
372
|
);
|
|
359
373
|
}
|
|
360
|
-
function
|
|
361
|
-
metrics:
|
|
362
|
-
columns:
|
|
374
|
+
function Ze({
|
|
375
|
+
metrics: e,
|
|
376
|
+
columns: t = 3,
|
|
363
377
|
animate: o = !0,
|
|
364
378
|
onMetricClick: r
|
|
365
379
|
}) {
|
|
366
|
-
const
|
|
367
|
-
|
|
380
|
+
const a = ee();
|
|
381
|
+
Ne();
|
|
368
382
|
const s = {
|
|
369
383
|
display: "grid",
|
|
370
|
-
gridTemplateColumns: `repeat(${
|
|
384
|
+
gridTemplateColumns: `repeat(${t}, minmax(0, 1fr))`,
|
|
371
385
|
gap: 16
|
|
372
386
|
};
|
|
373
387
|
return n(
|
|
374
388
|
"div",
|
|
375
389
|
{ style: s },
|
|
376
|
-
...
|
|
377
|
-
(f) => n(
|
|
390
|
+
...e.map(
|
|
391
|
+
(f) => n(De, {
|
|
378
392
|
key: f.id,
|
|
379
393
|
metric: f,
|
|
380
394
|
animate: o,
|
|
381
395
|
onMetricClick: r,
|
|
382
|
-
theme:
|
|
396
|
+
theme: a
|
|
383
397
|
})
|
|
384
398
|
)
|
|
385
399
|
);
|
|
386
400
|
}
|
|
387
|
-
function
|
|
388
|
-
const
|
|
389
|
-
return `${o}:${r}:${
|
|
401
|
+
function xe(e) {
|
|
402
|
+
const t = new Date(e), o = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), a = String(t.getSeconds()).padStart(2, "0");
|
|
403
|
+
return `${o}:${r}:${a}`;
|
|
390
404
|
}
|
|
391
|
-
function
|
|
392
|
-
return Math.abs(
|
|
405
|
+
function he(e) {
|
|
406
|
+
return Math.abs(e) >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
393
407
|
}
|
|
394
|
-
function
|
|
395
|
-
data:
|
|
396
|
-
maxPoints:
|
|
408
|
+
function Qe({
|
|
409
|
+
data: e,
|
|
410
|
+
maxPoints: t = 60,
|
|
397
411
|
height: o = 200,
|
|
398
412
|
width: r = "100%",
|
|
399
|
-
color:
|
|
413
|
+
color: a,
|
|
400
414
|
fill: s = !0,
|
|
401
415
|
showGrid: f = !0,
|
|
402
416
|
showLabels: u = !0,
|
|
403
|
-
showTooltip:
|
|
404
|
-
label:
|
|
405
|
-
unit:
|
|
417
|
+
showTooltip: h = !0,
|
|
418
|
+
label: l,
|
|
419
|
+
unit: y,
|
|
406
420
|
animate: v = !0,
|
|
407
421
|
yMin: k,
|
|
408
422
|
yMax: b
|
|
409
423
|
}) {
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
if (!
|
|
413
|
-
const i = new ResizeObserver((
|
|
414
|
-
const O =
|
|
415
|
-
O &&
|
|
424
|
+
const x = ee(), C = a ?? x.primary, N = D(null), [V, R] = W(600), [$, w] = W(null), [P, Y] = W(0), H = D(e.length);
|
|
425
|
+
B(() => {
|
|
426
|
+
if (!N.current) return;
|
|
427
|
+
const i = new ResizeObserver((m) => {
|
|
428
|
+
const O = m[0];
|
|
429
|
+
O && R(O.contentRect.width);
|
|
416
430
|
});
|
|
417
|
-
return i.observe(
|
|
431
|
+
return i.observe(N.current), R(N.current.offsetWidth), () => i.disconnect();
|
|
418
432
|
}, []);
|
|
419
433
|
const g = Q(
|
|
420
|
-
() =>
|
|
421
|
-
[
|
|
434
|
+
() => e.slice(-t),
|
|
435
|
+
[e, t]
|
|
422
436
|
);
|
|
423
|
-
|
|
437
|
+
B(() => {
|
|
424
438
|
g.length > H.current && Y((i) => i + 1), H.current = g.length;
|
|
425
439
|
}, [g.length]);
|
|
426
|
-
const T = u ? 48 : 12, G = 12,
|
|
440
|
+
const T = u ? 48 : 12, G = 12, z = l ? 28 : 12, I = 28, S = Math.max(V - T - G, 1), E = Math.max(o - z - I, 1), j = g.length ? Math.min(...g.map((i) => i.value)) : 0, F = g.length ? Math.max(...g.map((i) => i.value)) : 1, A = F - j || 1, d = k !== void 0 ? k : j - A * 0.1, p = (b !== void 0 ? b : F + A * 0.1) - d || 1;
|
|
427
441
|
function M(i) {
|
|
428
442
|
return g.length < 2 ? S / 2 : i / (g.length - 1) * S;
|
|
429
443
|
}
|
|
430
|
-
function
|
|
431
|
-
return
|
|
444
|
+
function q(i) {
|
|
445
|
+
return E - (i - d) / p * E;
|
|
432
446
|
}
|
|
433
|
-
const
|
|
434
|
-
for (let i = 0; i <=
|
|
435
|
-
|
|
436
|
-
const
|
|
437
|
-
const
|
|
438
|
-
return { y:
|
|
439
|
-
}),
|
|
440
|
-
{ length:
|
|
441
|
-
(i,
|
|
442
|
-
) : [],
|
|
447
|
+
const X = g.length >= 2 ? g.map((i, m) => `${m === 0 ? "M" : "L"}${M(m).toFixed(2)},${q(i.value).toFixed(2)}`).join(" ") : "", ae = X ? `${X} L${M(g.length - 1).toFixed(2)},${E} L${M(0).toFixed(2)},${E} Z` : "", te = 4, ne = [];
|
|
448
|
+
for (let i = 0; i <= te; i++)
|
|
449
|
+
ne.push(i);
|
|
450
|
+
const be = ne.map((i) => {
|
|
451
|
+
const m = d + i / te * p;
|
|
452
|
+
return { y: q(m), text: he(m) };
|
|
453
|
+
}), oe = Math.min(4, g.length), Se = oe > 0 ? Array.from(
|
|
454
|
+
{ length: oe },
|
|
455
|
+
(i, m) => Math.round(m / Math.max(oe - 1, 1) * (g.length - 1))
|
|
456
|
+
) : [], ke = K(
|
|
443
457
|
(i) => {
|
|
444
|
-
if (!
|
|
445
|
-
const
|
|
446
|
-
let U = 0,
|
|
447
|
-
g.forEach((
|
|
448
|
-
const
|
|
449
|
-
|
|
458
|
+
if (!h || g.length === 0) return;
|
|
459
|
+
const m = i.currentTarget.getBoundingClientRect(), O = i.clientX - m.left - T;
|
|
460
|
+
let U = 0, le = 1 / 0;
|
|
461
|
+
g.forEach((Ue, ce) => {
|
|
462
|
+
const de = Math.abs(M(ce) - O);
|
|
463
|
+
de < le && (le = de, U = ce);
|
|
450
464
|
});
|
|
451
|
-
const
|
|
452
|
-
if (!
|
|
453
|
-
const $
|
|
454
|
-
w({ x: $
|
|
465
|
+
const se = g[U];
|
|
466
|
+
if (!se) return;
|
|
467
|
+
const $e = M(U) + T, Te = q(se.value) + z;
|
|
468
|
+
w({ x: $e, y: Te, point: se });
|
|
455
469
|
},
|
|
456
|
-
[g,
|
|
457
|
-
),
|
|
470
|
+
[g, h, T, z]
|
|
471
|
+
), we = K(() => w(null), []), re = V, J = o, ie = `tkx-chart-clip-${P}`, Me = {
|
|
458
472
|
position: "relative",
|
|
459
473
|
width: typeof r == "number" ? `${r}px` : r,
|
|
460
|
-
background:
|
|
461
|
-
border: `1px solid ${
|
|
474
|
+
background: x.surface,
|
|
475
|
+
border: `1px solid ${x.border}`,
|
|
462
476
|
borderRadius: 8,
|
|
463
477
|
overflow: "hidden",
|
|
464
478
|
boxSizing: "border-box"
|
|
465
479
|
};
|
|
466
480
|
return n(
|
|
467
481
|
"div",
|
|
468
|
-
{ ref:
|
|
482
|
+
{ ref: N, style: Me },
|
|
469
483
|
n(
|
|
470
484
|
"svg",
|
|
471
485
|
{
|
|
472
|
-
width:
|
|
486
|
+
width: re,
|
|
473
487
|
height: J,
|
|
474
|
-
viewBox: `0 0 ${
|
|
475
|
-
onMouseMove:
|
|
476
|
-
onMouseLeave:
|
|
488
|
+
viewBox: `0 0 ${re} ${J}`,
|
|
489
|
+
onMouseMove: ke,
|
|
490
|
+
onMouseLeave: we,
|
|
477
491
|
style: { display: "block", userSelect: "none" },
|
|
478
|
-
"aria-label":
|
|
492
|
+
"aria-label": l ? L(l) : "Real-time chart"
|
|
479
493
|
},
|
|
480
494
|
// Defs: clip for animation
|
|
481
495
|
v && g.length >= 2 && n(
|
|
@@ -483,7 +497,7 @@ function Zt({
|
|
|
483
497
|
null,
|
|
484
498
|
n(
|
|
485
499
|
"clipPath",
|
|
486
|
-
{ id:
|
|
500
|
+
{ id: ie },
|
|
487
501
|
n(
|
|
488
502
|
"rect",
|
|
489
503
|
{
|
|
@@ -503,91 +517,91 @@ function Zt({
|
|
|
503
517
|
)
|
|
504
518
|
),
|
|
505
519
|
// Chart title
|
|
506
|
-
|
|
520
|
+
l && n(
|
|
507
521
|
"text",
|
|
508
522
|
{
|
|
509
523
|
x: T,
|
|
510
524
|
y: 18,
|
|
511
|
-
fill:
|
|
525
|
+
fill: x.textMuted,
|
|
512
526
|
fontSize: 12,
|
|
513
527
|
fontWeight: 500
|
|
514
528
|
},
|
|
515
|
-
|
|
529
|
+
L(l)
|
|
516
530
|
),
|
|
517
531
|
// Grid lines
|
|
518
|
-
f &&
|
|
519
|
-
const
|
|
532
|
+
f && ne.map((i) => {
|
|
533
|
+
const m = q(d + i / te * p) + z;
|
|
520
534
|
return n("line", {
|
|
521
535
|
key: `grid-${i}`,
|
|
522
536
|
x1: T,
|
|
523
|
-
y1:
|
|
537
|
+
y1: m,
|
|
524
538
|
x2: T + S,
|
|
525
|
-
y2:
|
|
526
|
-
stroke:
|
|
539
|
+
y2: m,
|
|
540
|
+
stroke: x.border,
|
|
527
541
|
strokeWidth: 1,
|
|
528
542
|
strokeDasharray: "4 4"
|
|
529
543
|
});
|
|
530
544
|
}),
|
|
531
545
|
// Y axis labels
|
|
532
|
-
u &&
|
|
546
|
+
u && be.map((i, m) => n(
|
|
533
547
|
"text",
|
|
534
548
|
{
|
|
535
|
-
key: `yl-${
|
|
549
|
+
key: `yl-${m}`,
|
|
536
550
|
x: T - 4,
|
|
537
|
-
y: i.y +
|
|
538
|
-
fill:
|
|
551
|
+
y: i.y + z + 4,
|
|
552
|
+
fill: x.textMuted,
|
|
539
553
|
fontSize: 10,
|
|
540
554
|
textAnchor: "end"
|
|
541
555
|
},
|
|
542
556
|
i.text
|
|
543
557
|
)),
|
|
544
558
|
// Y axis unit
|
|
545
|
-
|
|
559
|
+
y && n(
|
|
546
560
|
"text",
|
|
547
|
-
{ x: 4, y:
|
|
548
|
-
|
|
561
|
+
{ x: 4, y: z + 10, fill: x.textMuted, fontSize: 9 },
|
|
562
|
+
L(y)
|
|
549
563
|
),
|
|
550
564
|
// Area fill
|
|
551
|
-
s &&
|
|
552
|
-
d:
|
|
553
|
-
fill: `${
|
|
554
|
-
clipPath: v ? `url(#${
|
|
555
|
-
transform: `translate(${T}, ${
|
|
565
|
+
s && ae && n("path", {
|
|
566
|
+
d: ae,
|
|
567
|
+
fill: `${C}22`,
|
|
568
|
+
clipPath: v ? `url(#${ie})` : void 0,
|
|
569
|
+
transform: `translate(${T}, ${z})`
|
|
556
570
|
}),
|
|
557
571
|
// Data line
|
|
558
|
-
|
|
559
|
-
d:
|
|
572
|
+
X && n("path", {
|
|
573
|
+
d: X,
|
|
560
574
|
fill: "none",
|
|
561
|
-
stroke:
|
|
575
|
+
stroke: C,
|
|
562
576
|
strokeWidth: 2,
|
|
563
577
|
strokeLinejoin: "round",
|
|
564
578
|
strokeLinecap: "round",
|
|
565
|
-
clipPath: v ? `url(#${
|
|
566
|
-
transform: `translate(${T}, ${
|
|
579
|
+
clipPath: v ? `url(#${ie})` : void 0,
|
|
580
|
+
transform: `translate(${T}, ${z})`
|
|
567
581
|
}),
|
|
568
582
|
// X axis labels
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
return
|
|
583
|
+
Se.map((i) => {
|
|
584
|
+
const m = g[i];
|
|
585
|
+
return m ? n(
|
|
572
586
|
"text",
|
|
573
587
|
{
|
|
574
588
|
key: `xl-${i}`,
|
|
575
589
|
x: T + M(i),
|
|
576
590
|
y: J - 8,
|
|
577
|
-
fill:
|
|
591
|
+
fill: x.textMuted,
|
|
578
592
|
fontSize: 9,
|
|
579
593
|
textAnchor: "middle"
|
|
580
594
|
},
|
|
581
|
-
|
|
595
|
+
xe(m.timestamp)
|
|
582
596
|
) : null;
|
|
583
597
|
}),
|
|
584
598
|
// Tooltip vertical line
|
|
585
599
|
$ && n("line", {
|
|
586
600
|
x1: $.x,
|
|
587
|
-
y1:
|
|
601
|
+
y1: z,
|
|
588
602
|
x2: $.x,
|
|
589
|
-
y2:
|
|
590
|
-
stroke:
|
|
603
|
+
y2: z + E,
|
|
604
|
+
stroke: C,
|
|
591
605
|
strokeWidth: 1,
|
|
592
606
|
strokeDasharray: "3 3",
|
|
593
607
|
opacity: 0.6
|
|
@@ -597,190 +611,190 @@ function Zt({
|
|
|
597
611
|
cx: $.x,
|
|
598
612
|
cy: $.y,
|
|
599
613
|
r: 4,
|
|
600
|
-
fill:
|
|
601
|
-
stroke:
|
|
614
|
+
fill: C,
|
|
615
|
+
stroke: x.surface,
|
|
602
616
|
strokeWidth: 2
|
|
603
617
|
}),
|
|
604
618
|
// Tooltip box
|
|
605
619
|
$ && (() => {
|
|
606
|
-
const i = Math.min($.x + 8,
|
|
620
|
+
const i = Math.min($.x + 8, re - 100), m = Math.max($.y - 36, 4), O = `${he($.point.value)}${y || ""}`, U = xe($.point.timestamp);
|
|
607
621
|
return n(
|
|
608
622
|
"g",
|
|
609
623
|
null,
|
|
610
624
|
n("rect", {
|
|
611
625
|
x: i - 4,
|
|
612
|
-
y:
|
|
626
|
+
y: m - 2,
|
|
613
627
|
width: 90,
|
|
614
628
|
height: 34,
|
|
615
629
|
rx: 4,
|
|
616
|
-
fill:
|
|
617
|
-
stroke:
|
|
630
|
+
fill: x.surfaceAlt,
|
|
631
|
+
stroke: x.border,
|
|
618
632
|
strokeWidth: 1
|
|
619
633
|
}),
|
|
620
|
-
n("text", { x: i, y:
|
|
621
|
-
n("text", { x: i, y:
|
|
634
|
+
n("text", { x: i, y: m + 11, fill: x.text, fontSize: 12, fontWeight: 700 }, O),
|
|
635
|
+
n("text", { x: i, y: m + 26, fill: x.textMuted, fontSize: 10 }, U)
|
|
622
636
|
);
|
|
623
637
|
})()
|
|
624
638
|
)
|
|
625
639
|
);
|
|
626
640
|
}
|
|
627
|
-
const Z = 28,
|
|
641
|
+
const Z = 28, me = 8, ye = {
|
|
628
642
|
debug: 0,
|
|
629
643
|
info: 1,
|
|
630
644
|
warn: 2,
|
|
631
645
|
error: 3,
|
|
632
646
|
fatal: 4
|
|
633
647
|
};
|
|
634
|
-
let
|
|
635
|
-
function
|
|
636
|
-
if (
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
|
|
648
|
+
let ve = !1;
|
|
649
|
+
function je() {
|
|
650
|
+
if (ve || typeof document > "u") return;
|
|
651
|
+
ve = !0;
|
|
652
|
+
const e = document.createElement("style");
|
|
653
|
+
e.id = "tkx-live-log-styles", e.textContent = `
|
|
640
654
|
.tkx-log-row:hover { filter: brightness(1.12); }
|
|
641
655
|
.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }
|
|
642
|
-
`.trim(), document.head.appendChild(
|
|
656
|
+
`.trim(), document.head.appendChild(e);
|
|
643
657
|
}
|
|
644
|
-
function
|
|
645
|
-
const
|
|
646
|
-
return `${o}:${r}:${
|
|
658
|
+
function Be(e) {
|
|
659
|
+
const t = new Date(e), o = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), a = String(t.getSeconds()).padStart(2, "0"), s = String(t.getMilliseconds()).padStart(3, "0");
|
|
660
|
+
return `${o}:${r}:${a}.${s}`;
|
|
647
661
|
}
|
|
648
|
-
function
|
|
649
|
-
switch (
|
|
662
|
+
function Ve(e, t) {
|
|
663
|
+
switch (e) {
|
|
650
664
|
case "debug":
|
|
651
|
-
return
|
|
665
|
+
return t.textMuted;
|
|
652
666
|
case "info":
|
|
653
|
-
return
|
|
667
|
+
return t.info;
|
|
654
668
|
case "warn":
|
|
655
|
-
return
|
|
669
|
+
return t.warning;
|
|
656
670
|
case "error":
|
|
657
|
-
return
|
|
671
|
+
return t.danger;
|
|
658
672
|
case "fatal":
|
|
659
|
-
return
|
|
673
|
+
return t.danger;
|
|
660
674
|
default:
|
|
661
|
-
return
|
|
675
|
+
return t.textMuted;
|
|
662
676
|
}
|
|
663
677
|
}
|
|
664
|
-
function
|
|
665
|
-
return
|
|
678
|
+
function Oe(e, t) {
|
|
679
|
+
return e === "fatal" ? `${t.danger}22` : "transparent";
|
|
666
680
|
}
|
|
667
|
-
function
|
|
668
|
-
return `[${
|
|
681
|
+
function Pe(e) {
|
|
682
|
+
return `[${e.toUpperCase().padEnd(5)}]`;
|
|
669
683
|
}
|
|
670
|
-
function
|
|
671
|
-
if (!
|
|
672
|
-
const o =
|
|
684
|
+
function Ye(e, t) {
|
|
685
|
+
if (!t) return [e];
|
|
686
|
+
const o = L(e), r = L(t);
|
|
673
687
|
if (!r) return [o];
|
|
674
688
|
try {
|
|
675
|
-
const
|
|
676
|
-
return o.split(
|
|
677
|
-
(f, u) =>
|
|
689
|
+
const a = new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi");
|
|
690
|
+
return o.split(a).map(
|
|
691
|
+
(f, u) => a.test(f) ? n("mark", { key: u, className: "tkx-log-highlight" }, f) : f
|
|
678
692
|
);
|
|
679
693
|
} catch {
|
|
680
694
|
return [o];
|
|
681
695
|
}
|
|
682
696
|
}
|
|
683
|
-
function
|
|
684
|
-
entry:
|
|
685
|
-
showLevel:
|
|
697
|
+
function _e({
|
|
698
|
+
entry: e,
|
|
699
|
+
showLevel: t,
|
|
686
700
|
showTimestamp: o,
|
|
687
701
|
showSource: r,
|
|
688
|
-
searchQuery:
|
|
702
|
+
searchQuery: a,
|
|
689
703
|
monospace: s,
|
|
690
704
|
isExpanded: f,
|
|
691
705
|
onToggle: u,
|
|
692
|
-
onEntryClick:
|
|
693
|
-
theme:
|
|
694
|
-
style:
|
|
706
|
+
onEntryClick: h,
|
|
707
|
+
theme: l,
|
|
708
|
+
style: y
|
|
695
709
|
}) {
|
|
696
|
-
const v =
|
|
697
|
-
...
|
|
710
|
+
const v = Ve(e.level, l), k = Oe(e.level, l), b = e.metadata && Object.keys(e.metadata).length > 0, x = {
|
|
711
|
+
...y,
|
|
698
712
|
display: "flex",
|
|
699
713
|
alignItems: "center",
|
|
700
714
|
gap: 6,
|
|
701
715
|
padding: "0 10px",
|
|
702
716
|
fontSize: 12,
|
|
703
717
|
fontFamily: s ? '"JetBrains Mono", "Fira Mono", Consolas, monospace' : "inherit",
|
|
704
|
-
cursor: b ||
|
|
718
|
+
cursor: b || h ? "pointer" : "default",
|
|
705
719
|
background: k,
|
|
706
720
|
boxSizing: "border-box",
|
|
707
721
|
height: Z,
|
|
708
722
|
overflow: "hidden",
|
|
709
723
|
whiteSpace: "nowrap",
|
|
710
|
-
borderBottom: `1px solid ${
|
|
724
|
+
borderBottom: `1px solid ${l.border}22`
|
|
711
725
|
};
|
|
712
726
|
return n(
|
|
713
727
|
"div",
|
|
714
728
|
{
|
|
715
|
-
style:
|
|
729
|
+
style: x,
|
|
716
730
|
className: "tkx-log-row",
|
|
717
731
|
onClick: () => {
|
|
718
|
-
b && u(),
|
|
732
|
+
b && u(), h && h(e);
|
|
719
733
|
},
|
|
720
734
|
role: b ? "button" : void 0,
|
|
721
735
|
tabIndex: b ? 0 : void 0,
|
|
722
|
-
onKeyDown: b ? (
|
|
723
|
-
(
|
|
736
|
+
onKeyDown: b ? (N) => {
|
|
737
|
+
(N.key === "Enter" || N.key === " ") && u();
|
|
724
738
|
} : void 0,
|
|
725
739
|
"aria-expanded": b ? f : void 0
|
|
726
740
|
},
|
|
727
741
|
// Timestamp
|
|
728
742
|
o && n(
|
|
729
743
|
"span",
|
|
730
|
-
{ style: { color:
|
|
731
|
-
|
|
744
|
+
{ style: { color: l.textMuted, flexShrink: 0, minWidth: 84 } },
|
|
745
|
+
Be(e.timestamp)
|
|
732
746
|
),
|
|
733
747
|
// Level badge
|
|
734
|
-
|
|
748
|
+
t && n(
|
|
735
749
|
"span",
|
|
736
750
|
{
|
|
737
751
|
style: {
|
|
738
752
|
color: v,
|
|
739
753
|
flexShrink: 0,
|
|
740
|
-
fontWeight:
|
|
754
|
+
fontWeight: e.level === "fatal" ? 700 : 500,
|
|
741
755
|
minWidth: 56
|
|
742
756
|
}
|
|
743
757
|
},
|
|
744
|
-
|
|
758
|
+
Pe(e.level)
|
|
745
759
|
),
|
|
746
760
|
// Source badge
|
|
747
|
-
r &&
|
|
761
|
+
r && e.source && n(
|
|
748
762
|
"span",
|
|
749
763
|
{
|
|
750
764
|
style: {
|
|
751
|
-
background:
|
|
752
|
-
border: `1px solid ${
|
|
765
|
+
background: l.surfaceAlt,
|
|
766
|
+
border: `1px solid ${l.border}`,
|
|
753
767
|
borderRadius: 10,
|
|
754
768
|
padding: "0 5px",
|
|
755
769
|
fontSize: 10,
|
|
756
|
-
color:
|
|
770
|
+
color: l.textMuted,
|
|
757
771
|
flexShrink: 0,
|
|
758
772
|
maxWidth: 80,
|
|
759
773
|
overflow: "hidden",
|
|
760
774
|
textOverflow: "ellipsis"
|
|
761
775
|
}
|
|
762
776
|
},
|
|
763
|
-
|
|
777
|
+
L(e.source)
|
|
764
778
|
),
|
|
765
779
|
// Message
|
|
766
780
|
n(
|
|
767
781
|
"span",
|
|
768
|
-
{ style: { flex: 1, color:
|
|
769
|
-
...
|
|
782
|
+
{ style: { flex: 1, color: l.text, overflow: "hidden", textOverflow: "ellipsis" } },
|
|
783
|
+
...Ye(e.message, a)
|
|
770
784
|
),
|
|
771
785
|
// Expand indicator
|
|
772
786
|
b && n(
|
|
773
787
|
"span",
|
|
774
|
-
{ style: { color:
|
|
788
|
+
{ style: { color: l.textMuted, fontSize: 10, flexShrink: 0 } },
|
|
775
789
|
f ? "▲" : "▼"
|
|
776
790
|
)
|
|
777
791
|
);
|
|
778
792
|
}
|
|
779
|
-
function
|
|
793
|
+
function Ge({ metadata: e, theme: t, style: o }) {
|
|
780
794
|
const r = {
|
|
781
795
|
...o,
|
|
782
|
-
background:
|
|
783
|
-
borderBottom: `1px solid ${
|
|
796
|
+
background: t.surfaceAlt,
|
|
797
|
+
borderBottom: `1px solid ${t.border}`,
|
|
784
798
|
padding: "6px 10px 6px 56px",
|
|
785
799
|
display: "flex",
|
|
786
800
|
flexWrap: "wrap",
|
|
@@ -790,92 +804,92 @@ function _t({ metadata: t, theme: e, style: o }) {
|
|
|
790
804
|
return n(
|
|
791
805
|
"div",
|
|
792
806
|
{ style: r },
|
|
793
|
-
...Object.entries(
|
|
794
|
-
([
|
|
807
|
+
...Object.entries(e).map(
|
|
808
|
+
([a, s]) => n(
|
|
795
809
|
"span",
|
|
796
810
|
{
|
|
797
|
-
key:
|
|
811
|
+
key: a,
|
|
798
812
|
style: {
|
|
799
813
|
fontSize: 11,
|
|
800
814
|
fontFamily: "monospace",
|
|
801
|
-
color:
|
|
802
|
-
background:
|
|
803
|
-
border: `1px solid ${
|
|
815
|
+
color: t.textMuted,
|
|
816
|
+
background: t.surface,
|
|
817
|
+
border: `1px solid ${t.border}`,
|
|
804
818
|
borderRadius: 4,
|
|
805
819
|
padding: "1px 6px"
|
|
806
820
|
}
|
|
807
821
|
},
|
|
808
|
-
n("span", { style: { color:
|
|
809
|
-
|
|
822
|
+
n("span", { style: { color: t.info } }, `${L(a)}: `),
|
|
823
|
+
L(String(s))
|
|
810
824
|
)
|
|
811
825
|
)
|
|
812
826
|
);
|
|
813
827
|
}
|
|
814
|
-
function
|
|
815
|
-
entries:
|
|
816
|
-
maxEntries:
|
|
828
|
+
function et({
|
|
829
|
+
entries: e,
|
|
830
|
+
maxEntries: t = 500,
|
|
817
831
|
height: o = 400,
|
|
818
832
|
autoScroll: r = !0,
|
|
819
|
-
showLevel:
|
|
833
|
+
showLevel: a = !0,
|
|
820
834
|
showTimestamp: s = !0,
|
|
821
835
|
showSource: f = !0,
|
|
822
836
|
filterLevel: u,
|
|
823
|
-
searchQuery:
|
|
824
|
-
monospace:
|
|
825
|
-
onEntryClick:
|
|
837
|
+
searchQuery: h = "",
|
|
838
|
+
monospace: l = !0,
|
|
839
|
+
onEntryClick: y
|
|
826
840
|
}) {
|
|
827
|
-
const v =
|
|
828
|
-
|
|
829
|
-
const k = D(null), [b,
|
|
830
|
-
let d =
|
|
841
|
+
const v = ee();
|
|
842
|
+
je();
|
|
843
|
+
const k = D(null), [b, x] = W(0), [C, N] = W(/* @__PURE__ */ new Set()), [V, R] = W(!1), $ = D(e.length), w = Q(() => {
|
|
844
|
+
let d = e.slice(-t);
|
|
831
845
|
if (u !== void 0) {
|
|
832
|
-
const
|
|
833
|
-
d = d.filter((p) =>
|
|
846
|
+
const c = ye[u];
|
|
847
|
+
d = d.filter((p) => ye[p.level] >= c);
|
|
834
848
|
}
|
|
835
|
-
if (
|
|
836
|
-
const
|
|
849
|
+
if (h) {
|
|
850
|
+
const c = h.toLowerCase();
|
|
837
851
|
d = d.filter(
|
|
838
|
-
(p) => p.message.toLowerCase().includes(
|
|
852
|
+
(p) => p.message.toLowerCase().includes(c) || (p.source ?? "").toLowerCase().includes(c)
|
|
839
853
|
);
|
|
840
854
|
}
|
|
841
855
|
return d;
|
|
842
|
-
}, [
|
|
856
|
+
}, [e, t, u, h]), P = typeof o == "number" ? o : 400, Y = 40, H = Q(() => {
|
|
843
857
|
const d = [];
|
|
844
|
-
let
|
|
858
|
+
let c = 0;
|
|
845
859
|
for (const p of w)
|
|
846
|
-
d.push(
|
|
847
|
-
return d.push(
|
|
848
|
-
}, [w,
|
|
849
|
-
|
|
850
|
-
!r ||
|
|
851
|
-
}, [w.length, r,
|
|
860
|
+
d.push(c), c += Z + (C.has(p.id) ? Y : 0);
|
|
861
|
+
return d.push(c), d;
|
|
862
|
+
}, [w, C]), g = H[H.length - 1] ?? 0;
|
|
863
|
+
B(() => {
|
|
864
|
+
!r || V || w.length !== $.current && ($.current = w.length, k.current && (k.current.scrollTop = k.current.scrollHeight));
|
|
865
|
+
}, [w.length, r, V]);
|
|
852
866
|
const T = K(() => {
|
|
853
867
|
if (!k.current) return;
|
|
854
|
-
const d = k.current,
|
|
855
|
-
|
|
868
|
+
const d = k.current, c = d.scrollHeight - d.scrollTop - d.clientHeight < Z * 2;
|
|
869
|
+
R(!c), x(d.scrollTop);
|
|
856
870
|
}, []), G = K((d) => {
|
|
857
|
-
|
|
858
|
-
const p = new Set(
|
|
871
|
+
N((c) => {
|
|
872
|
+
const p = new Set(c);
|
|
859
873
|
return p.has(d) ? p.delete(d) : p.add(d), p;
|
|
860
874
|
});
|
|
861
875
|
}, []);
|
|
862
|
-
function
|
|
863
|
-
let
|
|
864
|
-
for (;
|
|
865
|
-
const M =
|
|
866
|
-
(H[M + 1] ?? 0) <= d ?
|
|
876
|
+
function z(d) {
|
|
877
|
+
let c = 0, p = w.length - 1;
|
|
878
|
+
for (; c < p; ) {
|
|
879
|
+
const M = c + p >> 1;
|
|
880
|
+
(H[M + 1] ?? 0) <= d ? c = M + 1 : p = M;
|
|
867
881
|
}
|
|
868
|
-
return Math.max(0,
|
|
882
|
+
return Math.max(0, c - me);
|
|
869
883
|
}
|
|
870
884
|
function I(d) {
|
|
871
|
-
let
|
|
872
|
-
for (;
|
|
873
|
-
const M =
|
|
874
|
-
(H[M] ?? 0) >= d + P ? p = M - 1 :
|
|
885
|
+
let c = 0, p = w.length - 1;
|
|
886
|
+
for (; c < p; ) {
|
|
887
|
+
const M = c + p + 1 >> 1;
|
|
888
|
+
(H[M] ?? 0) >= d + P ? p = M - 1 : c = M;
|
|
875
889
|
}
|
|
876
|
-
return Math.min(w.length - 1,
|
|
890
|
+
return Math.min(w.length - 1, c + me);
|
|
877
891
|
}
|
|
878
|
-
const S = w.length > 0 ?
|
|
892
|
+
const S = w.length > 0 ? z(b) : 0, E = w.length > 0 ? I(b) : -1, j = {
|
|
879
893
|
position: "relative",
|
|
880
894
|
overflow: "auto",
|
|
881
895
|
height: typeof o == "number" ? `${o}px` : o,
|
|
@@ -895,29 +909,29 @@ function Qt({
|
|
|
895
909
|
n("span", { style: { color: v.textMuted, fontSize: 13, fontFamily: "monospace" } }, "No log entries.")
|
|
896
910
|
);
|
|
897
911
|
const A = [];
|
|
898
|
-
for (let d = S; d <=
|
|
899
|
-
const
|
|
900
|
-
if (!
|
|
901
|
-
const p = H[d] ?? 0, M =
|
|
912
|
+
for (let d = S; d <= E; d++) {
|
|
913
|
+
const c = w[d];
|
|
914
|
+
if (!c) continue;
|
|
915
|
+
const p = H[d] ?? 0, M = C.has(c.id);
|
|
902
916
|
A.push(
|
|
903
|
-
n(
|
|
904
|
-
key:
|
|
905
|
-
entry:
|
|
906
|
-
showLevel:
|
|
917
|
+
n(_e, {
|
|
918
|
+
key: c.id,
|
|
919
|
+
entry: c,
|
|
920
|
+
showLevel: a,
|
|
907
921
|
showTimestamp: s,
|
|
908
922
|
showSource: f,
|
|
909
|
-
searchQuery:
|
|
910
|
-
monospace:
|
|
923
|
+
searchQuery: h,
|
|
924
|
+
monospace: l,
|
|
911
925
|
isExpanded: M,
|
|
912
|
-
onToggle: () => G(
|
|
913
|
-
onEntryClick:
|
|
926
|
+
onToggle: () => G(c.id),
|
|
927
|
+
onEntryClick: y,
|
|
914
928
|
theme: v,
|
|
915
929
|
style: { position: "absolute", top: p, left: 0, right: 0 }
|
|
916
930
|
})
|
|
917
|
-
), M &&
|
|
918
|
-
n(
|
|
919
|
-
key: `${
|
|
920
|
-
metadata:
|
|
931
|
+
), M && c.metadata && Object.keys(c.metadata).length > 0 && A.push(
|
|
932
|
+
n(Ge, {
|
|
933
|
+
key: `${c.id}-meta`,
|
|
934
|
+
metadata: c.metadata,
|
|
921
935
|
theme: v,
|
|
922
936
|
style: { position: "absolute", top: p + Z, left: 0, right: 0, height: Y }
|
|
923
937
|
})
|
|
@@ -937,8 +951,8 @@ function Qt({
|
|
|
937
951
|
);
|
|
938
952
|
}
|
|
939
953
|
export {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
954
|
+
Je as TkxLiveFeed,
|
|
955
|
+
et as TkxLiveLog,
|
|
956
|
+
Ze as TkxLiveMetrics,
|
|
957
|
+
Qe as TkxRealTimeChart
|
|
944
958
|
};
|