@lilt-ui/charts 0.9.1 → 0.10.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 +32 -0
- package/README.md +40 -10
- package/dist/cards/activity-ring-card.d.ts +7 -2
- package/dist/cards/calendar-heatmap-card.d.ts +18 -0
- package/dist/cards/cartesian-card.d.ts +9 -3
- package/dist/cards/chart-card.d.ts +7 -3
- package/dist/cards/funnel-chart-card.d.ts +9 -3
- package/dist/cards/heatmap-chart-card.d.ts +7 -2
- package/dist/cards/horizontal-bar-chart-card.d.ts +7 -2
- package/dist/cards/keys.d.ts +2 -0
- package/dist/cards/observations-card.d.ts +82 -0
- package/dist/cards/progress-card.d.ts +7 -2
- package/dist/cards/radar-chart-card.d.ts +9 -3
- package/dist/cards/radial-chart-card.d.ts +9 -3
- package/dist/cards/range-select.d.ts +28 -0
- package/dist/cards/sankey-chart-card.d.ts +7 -2
- package/dist/cards/scatter-chart-card.d.ts +9 -3
- package/dist/cards/slope-chart-card.d.ts +7 -2
- package/dist/cards/stat-card.d.ts +7 -2
- package/dist/cards/strip-chart-card.d.ts +15 -0
- package/dist/cards/timeline-chart-card.d.ts +18 -0
- package/dist/cards/treemap-chart-card.d.ts +24 -0
- package/dist/engine/keyed.d.ts +19 -0
- package/dist/engine/lifecycle.d.ts +1 -1
- package/dist/engine/sankey.d.ts +16 -0
- package/dist/finance/cards/depth-chart-card.d.ts +7 -2
- package/dist/finance/order-book.d.ts +7 -2
- package/dist/finance.js +324 -326
- package/dist/index.d.ts +11 -1
- package/dist/index.js +3258 -2144
- package/dist/marks/contract.d.ts +0 -2
- package/dist/motion/use-chart-motion.d.ts +5 -0
- package/dist/motion/use-departing.d.ts +7 -0
- package/dist/motion/use-snap-bars.d.ts +27 -0
- package/dist/{report-context-CkzH-r8B.js → report-context-UrwaoLYZ.js} +416 -238
- package/dist/{skeleton-block-CHH5SIAo.js → skeleton-block-C8gOUsxn.js} +1672 -1422
- package/dist/styles.css +1 -1
- package/dist/watch/board/board-state.d.ts +0 -2
- package/dist/watch.js +129 -127
- package/package.json +1 -1
|
@@ -1,57 +1,64 @@
|
|
|
1
|
-
import { createContext as e, useContext as t, useEffect as n,
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import { AnimatePresence as
|
|
4
|
-
import { extent as
|
|
5
|
-
import { animate as
|
|
6
|
-
import
|
|
1
|
+
import { createContext as e, useContext as t, useEffect as n, useId as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { AnimatePresence as d, animate as f, motion as p, useMotionValue as m, useMotionValueEvent as h, useReducedMotion as g, useTransform as _ } from "motion/react";
|
|
4
|
+
import { extent as v, min as y } from "d3-array";
|
|
5
|
+
import { animate as b } from "motion";
|
|
6
|
+
import x from "@number-flow/react";
|
|
7
7
|
//#region src/motion/use-chart-motion.ts
|
|
8
|
-
var
|
|
8
|
+
var S = [
|
|
9
9
|
.22,
|
|
10
10
|
1,
|
|
11
11
|
.36,
|
|
12
12
|
1
|
|
13
13
|
];
|
|
14
|
-
function
|
|
15
|
-
let [t, r] =
|
|
14
|
+
function C(e) {
|
|
15
|
+
let [t, r] = s(!1);
|
|
16
16
|
return n(() => {
|
|
17
17
|
if (typeof window > "u" || !window.matchMedia) return;
|
|
18
18
|
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => r(e.matches);
|
|
19
19
|
return t(), e.addEventListener?.("change", t), () => e.removeEventListener?.("change", t);
|
|
20
20
|
}, []), e === "none" || t;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let [n,
|
|
24
|
-
return
|
|
25
|
-
if (
|
|
26
|
-
|
|
22
|
+
function w(e, t) {
|
|
23
|
+
let [n, r] = s(e.active ? +!!t : 1), a = o(e.key), c = e.active && e.key !== a.current;
|
|
24
|
+
return i(() => {
|
|
25
|
+
if (a.current = e.key, !e.active || t) {
|
|
26
|
+
r(1);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
let n =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
r(0);
|
|
30
|
+
let n = b(0, 1, {
|
|
31
|
+
...e.spring ? {
|
|
32
|
+
type: "spring",
|
|
33
|
+
duration: e.duration / 1e3,
|
|
34
|
+
bounce: .18
|
|
35
|
+
} : {
|
|
36
|
+
duration: e.duration / 1e3,
|
|
37
|
+
ease: S
|
|
38
|
+
},
|
|
39
|
+
onUpdate: (e) => r(e),
|
|
40
|
+
onComplete: () => r(1)
|
|
35
41
|
});
|
|
36
42
|
return () => n.stop();
|
|
37
43
|
}, [
|
|
38
44
|
t,
|
|
39
45
|
e.active,
|
|
40
46
|
e.duration,
|
|
41
|
-
e.key
|
|
42
|
-
|
|
47
|
+
e.key,
|
|
48
|
+
e.spring
|
|
49
|
+
]), t ? 1 : c ? 0 : Math.max(0, e.spring ? n : Math.min(1, n));
|
|
43
50
|
}
|
|
44
51
|
//#endregion
|
|
45
52
|
//#region src/interaction/pin-glyphs.tsx
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
return /* @__PURE__ */
|
|
53
|
+
var T = "M9 4.5h6l-1 5 3 3v2H7v-2l3-3-1-5ZM12 14.5v7";
|
|
54
|
+
function E({ release: e }) {
|
|
55
|
+
return /* @__PURE__ */ l("svg", {
|
|
49
56
|
className: e ? "lilt-chart__pin-glyph lilt-chart__pin-glyph--release" : "lilt-chart__pin-glyph",
|
|
50
57
|
viewBox: "0 0 24 24",
|
|
51
58
|
fill: "none",
|
|
52
59
|
"aria-hidden": "true",
|
|
53
|
-
children: /* @__PURE__ */
|
|
54
|
-
d: e ? `${
|
|
60
|
+
children: /* @__PURE__ */ l("path", {
|
|
61
|
+
d: e ? `${T}M4.5 5.5l15 15` : T,
|
|
55
62
|
stroke: "currentColor",
|
|
56
63
|
strokeLinecap: "round",
|
|
57
64
|
strokeLinejoin: "round",
|
|
@@ -59,22 +66,22 @@ function w({ release: e }) {
|
|
|
59
66
|
})
|
|
60
67
|
});
|
|
61
68
|
}
|
|
62
|
-
function
|
|
63
|
-
return /* @__PURE__ */
|
|
69
|
+
function D({ release: e = !1 }) {
|
|
70
|
+
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(E, {}), e ? /* @__PURE__ */ l(E, { release: !0 }) : null] });
|
|
64
71
|
}
|
|
65
72
|
//#endregion
|
|
66
73
|
//#region src/motion/number-format.ts
|
|
67
|
-
var
|
|
68
|
-
function
|
|
74
|
+
var O = /* @__PURE__ */ new WeakMap();
|
|
75
|
+
function k(e) {
|
|
69
76
|
let t = (t) => e.format(t);
|
|
70
|
-
return
|
|
77
|
+
return O.set(t, e), t;
|
|
71
78
|
}
|
|
72
|
-
function
|
|
73
|
-
return e instanceof Intl.NumberFormat ? e :
|
|
79
|
+
function ee(e) {
|
|
80
|
+
return e instanceof Intl.NumberFormat ? e : O.get(e);
|
|
74
81
|
}
|
|
75
82
|
//#endregion
|
|
76
83
|
//#region src/motion/animated-number.tsx
|
|
77
|
-
var
|
|
84
|
+
var A = /\p{Decimal_Number}/u, j = /* @__PURE__ */ new Set([
|
|
78
85
|
"integer",
|
|
79
86
|
"group",
|
|
80
87
|
"decimal",
|
|
@@ -82,10 +89,10 @@ var O = /\p{Decimal_Number}/u, k = /* @__PURE__ */ new Set([
|
|
|
82
89
|
"nan",
|
|
83
90
|
"infinity"
|
|
84
91
|
]);
|
|
85
|
-
function
|
|
92
|
+
function te(e, t) {
|
|
86
93
|
let n = [];
|
|
87
94
|
if (t?.length && t.map((e) => e.value).join("") === e) {
|
|
88
|
-
let e = t.findIndex((e) =>
|
|
95
|
+
let e = t.findIndex((e) => j.has(e.type)), r = t.length - 1 - [...t].reverse().findIndex((e) => j.has(e.type)), i = t.filter((e) => e.type === "integer").reduce((e, t) => e + Array.from(t.value).length, 0), a = 0, o = /* @__PURE__ */ new Map();
|
|
89
96
|
t.forEach((t, s) => {
|
|
90
97
|
let c = e < 0 || s < e ? "prefix" : s > r ? "suffix" : "number";
|
|
91
98
|
for (let e of Array.from(t.value)) {
|
|
@@ -101,15 +108,15 @@ function A(e, t) {
|
|
|
101
108
|
n.push({
|
|
102
109
|
key: r,
|
|
103
110
|
char: e,
|
|
104
|
-
digit:
|
|
111
|
+
digit: A.test(e),
|
|
105
112
|
role: c
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
115
|
});
|
|
109
116
|
} else {
|
|
110
|
-
let t = Array.from(e), r = t.findIndex((e) =>
|
|
117
|
+
let t = Array.from(e), r = t.findIndex((e) => A.test(e)), i = t.length - 1 - [...t].reverse().findIndex((e) => A.test(e));
|
|
111
118
|
t.forEach((e, a) => {
|
|
112
|
-
let o =
|
|
119
|
+
let o = A.test(e);
|
|
113
120
|
r < 0 || a < r ? n.push({
|
|
114
121
|
key: `prefix-${a}`,
|
|
115
122
|
char: e,
|
|
@@ -141,15 +148,15 @@ function re(e, t, n) {
|
|
|
141
148
|
let r = ((t - e) % 10 + 10) % 10;
|
|
142
149
|
return r === 0 ? e : n > 0 ? e + r : e - (10 - r);
|
|
143
150
|
}
|
|
144
|
-
var ie = 240,
|
|
151
|
+
var ie = 240, M = .16, N = {
|
|
145
152
|
duration: .1,
|
|
146
153
|
ease: "easeOut"
|
|
147
|
-
},
|
|
154
|
+
}, P = [
|
|
148
155
|
.16,
|
|
149
156
|
1,
|
|
150
157
|
.3,
|
|
151
158
|
1
|
|
152
|
-
],
|
|
159
|
+
], ae = {
|
|
153
160
|
type: "spring",
|
|
154
161
|
stiffness: 420,
|
|
155
162
|
damping: 34,
|
|
@@ -157,13 +164,13 @@ var ie = 240, j = .16, M = {
|
|
|
157
164
|
}, F = (e) => Math.min(e, 6) * .024;
|
|
158
165
|
function I({ cell: e, change: t, style: n }) {
|
|
159
166
|
let r = n === "slide" ? .72 : 0;
|
|
160
|
-
return /* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ l("span", {
|
|
161
168
|
className: "lilt-number__cell",
|
|
162
169
|
"data-digit": e.digit || void 0,
|
|
163
|
-
children: /* @__PURE__ */
|
|
170
|
+
children: /* @__PURE__ */ l(d, {
|
|
164
171
|
initial: !1,
|
|
165
172
|
custom: t,
|
|
166
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ l(p.span, {
|
|
167
174
|
className: "lilt-number__glyph",
|
|
168
175
|
custom: t,
|
|
169
176
|
variants: {
|
|
@@ -187,7 +194,7 @@ function I({ cell: e, change: t, style: n }) {
|
|
|
187
194
|
leave: ({ direction: e, live: t }) => t ? {
|
|
188
195
|
y: `${-e * r * 55}%`,
|
|
189
196
|
opacity: 0,
|
|
190
|
-
transition:
|
|
197
|
+
transition: N
|
|
191
198
|
} : {
|
|
192
199
|
y: `${-e * r * 100}%`,
|
|
193
200
|
opacity: 0,
|
|
@@ -199,14 +206,14 @@ function I({ cell: e, change: t, style: n }) {
|
|
|
199
206
|
animate: "rest",
|
|
200
207
|
exit: "leave",
|
|
201
208
|
transition: t.live ? {
|
|
202
|
-
duration:
|
|
203
|
-
ease:
|
|
209
|
+
duration: M,
|
|
210
|
+
ease: P
|
|
204
211
|
} : {
|
|
205
212
|
delay: F(e.place),
|
|
206
|
-
y:
|
|
213
|
+
y: ae,
|
|
207
214
|
default: {
|
|
208
215
|
duration: .26,
|
|
209
|
-
ease:
|
|
216
|
+
ease: P
|
|
210
217
|
}
|
|
211
218
|
},
|
|
212
219
|
children: e.char
|
|
@@ -215,19 +222,19 @@ function I({ cell: e, change: t, style: n }) {
|
|
|
215
222
|
});
|
|
216
223
|
}
|
|
217
224
|
var L = Array.from({ length: 30 }, (e, t) => String(t % 10));
|
|
218
|
-
function
|
|
219
|
-
let r = Number(e.char), i =
|
|
220
|
-
|
|
225
|
+
function oe({ cell: e, change: t }) {
|
|
226
|
+
let r = Number(e.char), i = m(10 + r), a = o(t);
|
|
227
|
+
a.current = t, n(() => {
|
|
221
228
|
let t = i.get();
|
|
222
229
|
(t < 5 || t >= 25) && (t = 10 + (t % 10 + 10) % 10, i.jump(t));
|
|
223
|
-
let { direction: n, live:
|
|
230
|
+
let { direction: n, live: o } = a.current, s = re(t, r, n);
|
|
224
231
|
if (s === t) return;
|
|
225
|
-
let c =
|
|
232
|
+
let c = f(i, s, {
|
|
226
233
|
type: "spring",
|
|
227
|
-
stiffness:
|
|
228
|
-
damping:
|
|
234
|
+
stiffness: o ? 320 : 190,
|
|
235
|
+
damping: o ? 32 : 26,
|
|
229
236
|
mass: .9,
|
|
230
|
-
delay:
|
|
237
|
+
delay: o ? 0 : F(e.place),
|
|
231
238
|
onComplete: () => i.jump(10 + r)
|
|
232
239
|
});
|
|
233
240
|
return () => c.stop();
|
|
@@ -236,48 +243,48 @@ function ae({ cell: e, change: t }) {
|
|
|
236
243
|
r,
|
|
237
244
|
i
|
|
238
245
|
]);
|
|
239
|
-
let s =
|
|
240
|
-
return /* @__PURE__ */
|
|
246
|
+
let s = _(i, (e) => `${-e / L.length * 100}%`);
|
|
247
|
+
return /* @__PURE__ */ u("span", {
|
|
241
248
|
className: "lilt-number__cell lilt-number__cell--reel",
|
|
242
249
|
"data-digit": !0,
|
|
243
|
-
children: [/* @__PURE__ */
|
|
250
|
+
children: [/* @__PURE__ */ l("span", {
|
|
244
251
|
className: "lilt-number__glyph lilt-number__sizer",
|
|
245
252
|
"aria-hidden": "true",
|
|
246
253
|
children: e.char
|
|
247
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ l(p.span, {
|
|
248
255
|
className: "lilt-number__reel",
|
|
249
256
|
style: { y: s },
|
|
250
|
-
children: L.map((e, t) => /* @__PURE__ */
|
|
257
|
+
children: L.map((e, t) => /* @__PURE__ */ l("span", { children: e }, t))
|
|
251
258
|
})]
|
|
252
259
|
});
|
|
253
260
|
}
|
|
254
|
-
var
|
|
255
|
-
function
|
|
256
|
-
let [r, i] =
|
|
257
|
-
return
|
|
258
|
-
if (
|
|
259
|
-
|
|
260
|
-
let t = 0, n =
|
|
261
|
-
t += 1, i(t >= n ? null :
|
|
261
|
+
var se = "0123456789";
|
|
262
|
+
function ce({ cell: e, live: t }) {
|
|
263
|
+
let [r, i] = s(null), a = o(e.char), c = o(t);
|
|
264
|
+
return c.current = t, n(() => {
|
|
265
|
+
if (a.current === e.char) return;
|
|
266
|
+
a.current = e.char;
|
|
267
|
+
let t = 0, n = c.current ? 2 : 5 + Math.min(e.place, 6), r = window.setInterval(() => {
|
|
268
|
+
t += 1, i(t >= n ? null : se[Math.floor(Math.random() * 10)]), t >= n && window.clearInterval(r);
|
|
262
269
|
}, 36);
|
|
263
270
|
return () => {
|
|
264
271
|
window.clearInterval(r), i(null);
|
|
265
272
|
};
|
|
266
|
-
}, [e.char, e.place]), /* @__PURE__ */
|
|
273
|
+
}, [e.char, e.place]), /* @__PURE__ */ l("span", {
|
|
267
274
|
className: "lilt-number__cell",
|
|
268
275
|
"data-digit": e.digit || void 0,
|
|
269
276
|
"data-scrambling": r !== null || void 0,
|
|
270
|
-
children: /* @__PURE__ */
|
|
277
|
+
children: /* @__PURE__ */ l("span", {
|
|
271
278
|
className: "lilt-number__glyph",
|
|
272
279
|
children: r ?? e.char
|
|
273
280
|
})
|
|
274
281
|
});
|
|
275
282
|
}
|
|
276
283
|
function R({ cell: e }) {
|
|
277
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ l("span", {
|
|
278
285
|
className: "lilt-number__cell",
|
|
279
286
|
"data-digit": e.digit || void 0,
|
|
280
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ l("span", {
|
|
281
288
|
className: "lilt-number__glyph",
|
|
282
289
|
children: e.char
|
|
283
290
|
})
|
|
@@ -288,7 +295,7 @@ var z = [
|
|
|
288
295
|
1.45,
|
|
289
296
|
.64,
|
|
290
297
|
1
|
|
291
|
-
],
|
|
298
|
+
], le = {
|
|
292
299
|
enter: (e) => e ? {
|
|
293
300
|
y: "16%",
|
|
294
301
|
opacity: .4,
|
|
@@ -303,37 +310,37 @@ var z = [
|
|
|
303
310
|
opacity: 1,
|
|
304
311
|
filter: "blur(0px)"
|
|
305
312
|
}
|
|
306
|
-
},
|
|
313
|
+
}, ue = { leave: (e) => e ? {
|
|
307
314
|
y: "-16%",
|
|
308
315
|
opacity: 0,
|
|
309
|
-
transition:
|
|
316
|
+
transition: N
|
|
310
317
|
} : {
|
|
311
318
|
y: "-32%",
|
|
312
319
|
opacity: 0,
|
|
313
320
|
filter: "blur(2px)",
|
|
314
321
|
transition: {
|
|
315
322
|
duration: .3,
|
|
316
|
-
ease:
|
|
323
|
+
ease: P
|
|
317
324
|
}
|
|
318
325
|
} };
|
|
319
|
-
function
|
|
326
|
+
function de({ cells: e, live: t }) {
|
|
320
327
|
let n = e.map((e) => e.char).join("");
|
|
321
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ l("span", {
|
|
322
329
|
className: "lilt-number__pop-host",
|
|
323
|
-
children: /* @__PURE__ */
|
|
330
|
+
children: /* @__PURE__ */ l(d, {
|
|
324
331
|
mode: "popLayout",
|
|
325
332
|
initial: !1,
|
|
326
333
|
custom: t,
|
|
327
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ l(p.span, {
|
|
328
335
|
className: "lilt-number__pop",
|
|
329
|
-
variants:
|
|
336
|
+
variants: ue,
|
|
330
337
|
initial: "enter",
|
|
331
338
|
animate: "visible",
|
|
332
339
|
exit: "leave",
|
|
333
|
-
children: e.map((e, n) => /* @__PURE__ */
|
|
340
|
+
children: e.map((e, n) => /* @__PURE__ */ l(p.span, {
|
|
334
341
|
className: "lilt-number__pop-char",
|
|
335
342
|
custom: t,
|
|
336
|
-
variants:
|
|
343
|
+
variants: le,
|
|
337
344
|
transition: t ? {
|
|
338
345
|
duration: .22,
|
|
339
346
|
ease: z
|
|
@@ -348,18 +355,18 @@ function ue({ cells: e, live: t }) {
|
|
|
348
355
|
})
|
|
349
356
|
});
|
|
350
357
|
}
|
|
351
|
-
function
|
|
352
|
-
let i =
|
|
353
|
-
|
|
354
|
-
let [c, l] =
|
|
355
|
-
return
|
|
358
|
+
function fe(e, t, r) {
|
|
359
|
+
let i = m(e), a = o(r);
|
|
360
|
+
a.current = r;
|
|
361
|
+
let [c, l] = s(e);
|
|
362
|
+
return h(i, "change", l), n(() => {
|
|
356
363
|
if (!t) {
|
|
357
364
|
i.jump(e);
|
|
358
365
|
return;
|
|
359
366
|
}
|
|
360
|
-
let n =
|
|
361
|
-
duration:
|
|
362
|
-
ease:
|
|
367
|
+
let n = f(i, e, {
|
|
368
|
+
duration: a.current ? .24 : .62,
|
|
369
|
+
ease: P
|
|
363
370
|
});
|
|
364
371
|
return () => n.stop();
|
|
365
372
|
}, [
|
|
@@ -368,8 +375,8 @@ function de(e, t, r) {
|
|
|
368
375
|
e
|
|
369
376
|
]), t ? ne(c, e) : e;
|
|
370
377
|
}
|
|
371
|
-
function
|
|
372
|
-
let [t, n] =
|
|
378
|
+
function pe(e) {
|
|
379
|
+
let [t, n] = s({
|
|
373
380
|
value: e,
|
|
374
381
|
at: 0,
|
|
375
382
|
direction: 1,
|
|
@@ -389,25 +396,25 @@ function B(e) {
|
|
|
389
396
|
live: t.live
|
|
390
397
|
};
|
|
391
398
|
}
|
|
392
|
-
function
|
|
393
|
-
let o = !
|
|
394
|
-
if (!
|
|
395
|
-
let { locale: e, ...t } =
|
|
399
|
+
function B({ value: e, format: t = String, className: n, motion: r = "auto", variant: i = "count" }) {
|
|
400
|
+
let o = !g() && r !== "none", s = ee(t), f = (e) => t instanceof Intl.NumberFormat ? t.format(e) : t(e), m = (e) => te(f(e), s?.formatToParts(e)), h = i === "flow" && !s ? "slide" : i, _ = a(() => {
|
|
401
|
+
if (!s) return;
|
|
402
|
+
let { locale: e, ...t } = s.resolvedOptions();
|
|
396
403
|
return {
|
|
397
404
|
locale: e,
|
|
398
405
|
options: t
|
|
399
406
|
};
|
|
400
|
-
}, [
|
|
401
|
-
if (
|
|
402
|
-
className:
|
|
407
|
+
}, [s]), v = f(e), y = pe(e), b = fe(e, o && h === "count", y.live), S = ["lilt-number", n].filter(Boolean).join(" ");
|
|
408
|
+
if (h === "flow" && _) return /* @__PURE__ */ u("span", {
|
|
409
|
+
className: S,
|
|
403
410
|
"data-variant": "flow",
|
|
404
|
-
children: [/* @__PURE__ */
|
|
411
|
+
children: [/* @__PURE__ */ l("span", {
|
|
405
412
|
className: "lilt-chart__sr-only",
|
|
406
413
|
children: v
|
|
407
|
-
}), /* @__PURE__ */
|
|
414
|
+
}), /* @__PURE__ */ l("span", {
|
|
408
415
|
"aria-hidden": "true",
|
|
409
416
|
className: "lilt-number__flow",
|
|
410
|
-
children: /* @__PURE__ */
|
|
417
|
+
children: /* @__PURE__ */ l(x, {
|
|
411
418
|
value: e,
|
|
412
419
|
locales: _.locale,
|
|
413
420
|
format: _.options,
|
|
@@ -416,29 +423,29 @@ function V({ value: e, format: t = String, className: n, motion: r = "auto", var
|
|
|
416
423
|
})
|
|
417
424
|
})]
|
|
418
425
|
});
|
|
419
|
-
let
|
|
426
|
+
let C = m(h === "count" ? b : e), w = (e) => o ? e.role === "number" ? h === "count" ? /* @__PURE__ */ l(R, { cell: e }) : h === "roll" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ l(oe, {
|
|
420
427
|
cell: e,
|
|
421
428
|
change: y
|
|
422
|
-
}) : /* @__PURE__ */
|
|
429
|
+
}) : /* @__PURE__ */ l(I, {
|
|
423
430
|
cell: e,
|
|
424
431
|
change: y,
|
|
425
432
|
style: "fade"
|
|
426
|
-
}) :
|
|
433
|
+
}) : h === "scramble" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ l(ce, {
|
|
427
434
|
cell: e,
|
|
428
435
|
live: y.live
|
|
429
|
-
}) : /* @__PURE__ */
|
|
436
|
+
}) : /* @__PURE__ */ l(I, {
|
|
430
437
|
cell: e,
|
|
431
438
|
change: y,
|
|
432
439
|
style: "fade"
|
|
433
|
-
}) : /* @__PURE__ */
|
|
440
|
+
}) : /* @__PURE__ */ l(I, {
|
|
434
441
|
cell: e,
|
|
435
442
|
change: y,
|
|
436
443
|
style: "slide"
|
|
437
|
-
}) : /* @__PURE__ */
|
|
444
|
+
}) : /* @__PURE__ */ l(I, {
|
|
438
445
|
cell: e,
|
|
439
446
|
change: y,
|
|
440
447
|
style: "fade"
|
|
441
|
-
}) : /* @__PURE__ */
|
|
448
|
+
}) : /* @__PURE__ */ l(R, { cell: e }), T = (e) => /* @__PURE__ */ l(p.span, {
|
|
442
449
|
className: "lilt-number__place",
|
|
443
450
|
custom: y.live,
|
|
444
451
|
initial: o ? {
|
|
@@ -454,114 +461,296 @@ function V({ value: e, format: t = String, className: n, motion: r = "auto", var
|
|
|
454
461
|
opacity: 0
|
|
455
462
|
} : void 0,
|
|
456
463
|
transition: {
|
|
457
|
-
duration: y.live ?
|
|
458
|
-
ease:
|
|
464
|
+
duration: y.live ? M : .32,
|
|
465
|
+
ease: P
|
|
459
466
|
},
|
|
460
|
-
children:
|
|
461
|
-
}, e.key),
|
|
462
|
-
return /* @__PURE__ */
|
|
463
|
-
className:
|
|
464
|
-
"data-variant":
|
|
465
|
-
children: [/* @__PURE__ */
|
|
467
|
+
children: w(e)
|
|
468
|
+
}, e.key), E = h === "pop" && o, D = C.filter((e) => e.role === "prefix"), O = C.filter((e) => e.role === "number"), k = C.filter((e) => e.role === "suffix");
|
|
469
|
+
return /* @__PURE__ */ u("span", {
|
|
470
|
+
className: S,
|
|
471
|
+
"data-variant": i,
|
|
472
|
+
children: [/* @__PURE__ */ l("span", {
|
|
466
473
|
className: "lilt-chart__sr-only",
|
|
467
474
|
children: v
|
|
468
|
-
}), /* @__PURE__ */
|
|
475
|
+
}), /* @__PURE__ */ l("span", {
|
|
469
476
|
"aria-hidden": "true",
|
|
470
477
|
className: "lilt-number__characters",
|
|
471
|
-
children:
|
|
472
|
-
/* @__PURE__ */
|
|
478
|
+
children: E ? /* @__PURE__ */ u(c, { children: [
|
|
479
|
+
/* @__PURE__ */ l(d, {
|
|
473
480
|
initial: !1,
|
|
474
|
-
children:
|
|
481
|
+
children: D.map(T)
|
|
475
482
|
}),
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
cells:
|
|
483
|
+
/* @__PURE__ */ l(de, {
|
|
484
|
+
cells: O,
|
|
478
485
|
live: y.live
|
|
479
486
|
}),
|
|
480
|
-
/* @__PURE__ */
|
|
487
|
+
/* @__PURE__ */ l(d, {
|
|
481
488
|
initial: !1,
|
|
482
|
-
children:
|
|
489
|
+
children: k.map(T)
|
|
483
490
|
})
|
|
484
|
-
] }) : /* @__PURE__ */
|
|
491
|
+
] }) : /* @__PURE__ */ l(d, {
|
|
485
492
|
initial: !1,
|
|
486
|
-
children:
|
|
493
|
+
children: C.map(T)
|
|
487
494
|
})
|
|
488
495
|
})]
|
|
489
496
|
});
|
|
490
497
|
}
|
|
491
498
|
//#endregion
|
|
499
|
+
//#region src/cards/range-select.tsx
|
|
500
|
+
var V = e(null);
|
|
501
|
+
function me({ rangeSelect: e, children: t }) {
|
|
502
|
+
return /* @__PURE__ */ l(V.Provider, {
|
|
503
|
+
value: e ?? null,
|
|
504
|
+
children: t
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
function he() {
|
|
508
|
+
return t(V);
|
|
509
|
+
}
|
|
510
|
+
var H = [
|
|
511
|
+
.23,
|
|
512
|
+
1,
|
|
513
|
+
.32,
|
|
514
|
+
1
|
|
515
|
+
];
|
|
516
|
+
function ge({ value: e, options: t, onValueChange: i, "aria-label": a }) {
|
|
517
|
+
let c = r(), f = g(), [m, h] = s(!1), _ = Math.max(0, t.findIndex((t) => t.id === e)), [v, y] = s(_), b = o(null), x = o(null), S = o(null), C = t[_], w = (e = _) => {
|
|
518
|
+
y(e), h(!0);
|
|
519
|
+
}, T = (e = !0) => {
|
|
520
|
+
h(!1), e && x.current?.focus();
|
|
521
|
+
}, E = (n) => {
|
|
522
|
+
let r = t[n];
|
|
523
|
+
r && r.id !== e && i(r.id), T();
|
|
524
|
+
};
|
|
525
|
+
return n(() => {
|
|
526
|
+
if (!m) return;
|
|
527
|
+
S.current?.focus();
|
|
528
|
+
let e = (e) => {
|
|
529
|
+
b.current?.contains(e.target) || T(!1);
|
|
530
|
+
};
|
|
531
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
532
|
+
}, [m]), /* @__PURE__ */ u("span", {
|
|
533
|
+
ref: b,
|
|
534
|
+
className: "lilt-card__range lilt-card__range--select",
|
|
535
|
+
"data-value": C?.id,
|
|
536
|
+
"data-open": m || void 0,
|
|
537
|
+
children: [/* @__PURE__ */ u("button", {
|
|
538
|
+
ref: x,
|
|
539
|
+
type: "button",
|
|
540
|
+
className: "lilt-range-select__trigger",
|
|
541
|
+
"aria-haspopup": "listbox",
|
|
542
|
+
"aria-expanded": m,
|
|
543
|
+
"aria-controls": m ? `${c}-list` : void 0,
|
|
544
|
+
"aria-label": `${a}: ${C?.label ?? ""}`,
|
|
545
|
+
onClick: () => m ? T() : w(),
|
|
546
|
+
onKeyDown: (e) => {
|
|
547
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), w(e.key === "ArrowDown" ? Math.min(t.length - 1, _ + 1) : Math.max(0, _ - 1)));
|
|
548
|
+
},
|
|
549
|
+
children: [/* @__PURE__ */ l("span", {
|
|
550
|
+
className: "lilt-range-select__value",
|
|
551
|
+
children: /* @__PURE__ */ l(d, {
|
|
552
|
+
mode: "popLayout",
|
|
553
|
+
initial: !1,
|
|
554
|
+
children: /* @__PURE__ */ l(p.span, {
|
|
555
|
+
initial: f ? { opacity: 0 } : {
|
|
556
|
+
opacity: 0,
|
|
557
|
+
y: 4,
|
|
558
|
+
filter: "blur(3px)"
|
|
559
|
+
},
|
|
560
|
+
animate: {
|
|
561
|
+
opacity: 1,
|
|
562
|
+
y: 0,
|
|
563
|
+
filter: "blur(0px)"
|
|
564
|
+
},
|
|
565
|
+
exit: f ? { opacity: 0 } : {
|
|
566
|
+
opacity: 0,
|
|
567
|
+
y: -4,
|
|
568
|
+
filter: "blur(3px)"
|
|
569
|
+
},
|
|
570
|
+
transition: {
|
|
571
|
+
duration: .2,
|
|
572
|
+
ease: H
|
|
573
|
+
},
|
|
574
|
+
children: C?.label
|
|
575
|
+
}, C?.id)
|
|
576
|
+
})
|
|
577
|
+
}), /* @__PURE__ */ l("svg", {
|
|
578
|
+
"aria-hidden": "true",
|
|
579
|
+
viewBox: "0 0 12 12",
|
|
580
|
+
width: "12",
|
|
581
|
+
height: "12",
|
|
582
|
+
children: /* @__PURE__ */ l("path", {
|
|
583
|
+
d: "M3 4.5 6 7.5 9 4.5",
|
|
584
|
+
fill: "none",
|
|
585
|
+
stroke: "currentColor",
|
|
586
|
+
strokeWidth: "1.5"
|
|
587
|
+
})
|
|
588
|
+
})]
|
|
589
|
+
}), /* @__PURE__ */ l(d, { children: m ? /* @__PURE__ */ l(p.ul, {
|
|
590
|
+
ref: S,
|
|
591
|
+
id: `${c}-list`,
|
|
592
|
+
role: "listbox",
|
|
593
|
+
tabIndex: -1,
|
|
594
|
+
"aria-label": a,
|
|
595
|
+
"aria-activedescendant": `${c}-option-${v}`,
|
|
596
|
+
className: "lilt-range-select__list",
|
|
597
|
+
onKeyDown: (e) => {
|
|
598
|
+
let n = (n) => {
|
|
599
|
+
e.preventDefault(), y(Math.max(0, Math.min(t.length - 1, n)));
|
|
600
|
+
};
|
|
601
|
+
if (e.key === "ArrowDown") n(v + 1);
|
|
602
|
+
else if (e.key === "ArrowUp") n(v - 1);
|
|
603
|
+
else if (e.key === "Home") n(0);
|
|
604
|
+
else if (e.key === "End") n(t.length - 1);
|
|
605
|
+
else if (e.key === "Enter" || e.key === " ") e.preventDefault(), E(v);
|
|
606
|
+
else if (e.key === "Escape") e.preventDefault(), T();
|
|
607
|
+
else if (e.key === "Tab") T(!1);
|
|
608
|
+
else if (e.key.length === 1) {
|
|
609
|
+
let r = e.key.toLowerCase(), i = t.findIndex((e, t) => t > v && e.label.toLowerCase().startsWith(r)), a = i >= 0 ? i : t.findIndex((e) => e.label.toLowerCase().startsWith(r));
|
|
610
|
+
a >= 0 && n(a);
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
initial: f ? { opacity: 0 } : {
|
|
614
|
+
opacity: 0,
|
|
615
|
+
scale: .96,
|
|
616
|
+
y: -4,
|
|
617
|
+
filter: "blur(4px)"
|
|
618
|
+
},
|
|
619
|
+
animate: {
|
|
620
|
+
opacity: 1,
|
|
621
|
+
scale: 1,
|
|
622
|
+
y: 0,
|
|
623
|
+
filter: "blur(0px)"
|
|
624
|
+
},
|
|
625
|
+
exit: f ? {
|
|
626
|
+
opacity: 0,
|
|
627
|
+
transition: { duration: .1 }
|
|
628
|
+
} : {
|
|
629
|
+
opacity: 0,
|
|
630
|
+
scale: .97,
|
|
631
|
+
filter: "blur(3px)",
|
|
632
|
+
transition: { duration: .12 }
|
|
633
|
+
},
|
|
634
|
+
transition: {
|
|
635
|
+
duration: .18,
|
|
636
|
+
ease: H
|
|
637
|
+
},
|
|
638
|
+
children: t.map((e, t) => /* @__PURE__ */ u("li", {
|
|
639
|
+
id: `${c}-option-${t}`,
|
|
640
|
+
role: "option",
|
|
641
|
+
"data-value": e.id,
|
|
642
|
+
"aria-selected": t === _,
|
|
643
|
+
className: "lilt-range-select__option",
|
|
644
|
+
"data-active": t === v || void 0,
|
|
645
|
+
onPointerMove: () => y(t),
|
|
646
|
+
onClick: () => E(t),
|
|
647
|
+
children: [
|
|
648
|
+
t === v ? /* @__PURE__ */ l(p.span, {
|
|
649
|
+
layoutId: f ? void 0 : `${c}-highlight`,
|
|
650
|
+
className: "lilt-range-select__highlight",
|
|
651
|
+
transition: {
|
|
652
|
+
type: "spring",
|
|
653
|
+
duration: .3,
|
|
654
|
+
bounce: 0
|
|
655
|
+
}
|
|
656
|
+
}) : null,
|
|
657
|
+
/* @__PURE__ */ l("span", {
|
|
658
|
+
className: "lilt-range-select__label",
|
|
659
|
+
children: e.label
|
|
660
|
+
}),
|
|
661
|
+
t === _ ? /* @__PURE__ */ l("svg", {
|
|
662
|
+
"aria-hidden": "true",
|
|
663
|
+
className: "lilt-range-select__check",
|
|
664
|
+
viewBox: "0 0 12 12",
|
|
665
|
+
width: "12",
|
|
666
|
+
height: "12",
|
|
667
|
+
children: /* @__PURE__ */ l("path", {
|
|
668
|
+
d: "M2.5 6.5 5 9l4.5-6",
|
|
669
|
+
fill: "none",
|
|
670
|
+
stroke: "currentColor",
|
|
671
|
+
strokeWidth: "1.6"
|
|
672
|
+
})
|
|
673
|
+
}) : null
|
|
674
|
+
]
|
|
675
|
+
}, e.id))
|
|
676
|
+
}) : null })]
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
//#endregion
|
|
492
680
|
//#region src/cards/chart-card.tsx
|
|
493
|
-
var
|
|
494
|
-
function
|
|
681
|
+
var U = e("count");
|
|
682
|
+
function W(...e) {
|
|
495
683
|
return e.filter(Boolean).join(" ");
|
|
496
684
|
}
|
|
497
|
-
var
|
|
498
|
-
function
|
|
499
|
-
let
|
|
685
|
+
var G = e(null);
|
|
686
|
+
function _e({ children: e, surface: n = "elevated", palette: r, motion: i, numberStyle: a = "count", badge: o, className: s, style: c, "aria-label": d, onKeyDown: f }) {
|
|
687
|
+
let p = t(G), m = p?.badge ?? o, h = m != null && m !== !1, g = h || p !== null, _ = {
|
|
500
688
|
"data-lilt-chart": "",
|
|
501
689
|
"data-lilt-palette": r,
|
|
502
690
|
"data-motion": i === "none" ? "none" : void 0,
|
|
503
|
-
style:
|
|
504
|
-
},
|
|
505
|
-
...
|
|
691
|
+
style: c
|
|
692
|
+
}, v = /* @__PURE__ */ l("section", {
|
|
693
|
+
...g ? { "data-lilt-chart": "" } : _,
|
|
506
694
|
"data-surface": n,
|
|
507
|
-
"data-tone":
|
|
508
|
-
className:
|
|
695
|
+
"data-tone": p?.tone ?? void 0,
|
|
696
|
+
className: W("lilt-card", !g && s),
|
|
509
697
|
"aria-label": d,
|
|
510
|
-
|
|
698
|
+
onKeyDown: f,
|
|
699
|
+
children: /* @__PURE__ */ l(G.Provider, {
|
|
511
700
|
value: null,
|
|
512
701
|
children: e
|
|
513
702
|
})
|
|
514
703
|
});
|
|
515
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ l(U.Provider, {
|
|
516
705
|
value: a,
|
|
517
|
-
children:
|
|
518
|
-
...
|
|
519
|
-
className:
|
|
520
|
-
"data-tabbed":
|
|
706
|
+
children: g ? /* @__PURE__ */ u("div", {
|
|
707
|
+
..._,
|
|
708
|
+
className: W("lilt-card-frame", s),
|
|
709
|
+
"data-tabbed": h || void 0,
|
|
521
710
|
children: [
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
711
|
+
h ? /* @__PURE__ */ l(K, { children: m }) : null,
|
|
712
|
+
p?.handle,
|
|
713
|
+
v
|
|
525
714
|
]
|
|
526
|
-
}) :
|
|
715
|
+
}) : v
|
|
527
716
|
});
|
|
528
717
|
}
|
|
529
|
-
function
|
|
530
|
-
return /* @__PURE__ */
|
|
718
|
+
function K({ children: e, className: t }) {
|
|
719
|
+
return /* @__PURE__ */ l("div", {
|
|
531
720
|
"data-lilt-chart": "",
|
|
532
|
-
className:
|
|
721
|
+
className: W("lilt-card-badge", t),
|
|
533
722
|
children: e
|
|
534
723
|
});
|
|
535
724
|
}
|
|
536
|
-
function
|
|
537
|
-
return /* @__PURE__ */
|
|
538
|
-
className:
|
|
539
|
-
children: [/* @__PURE__ */
|
|
725
|
+
function ve({ children: e, aside: t, className: n }) {
|
|
726
|
+
return /* @__PURE__ */ u("header", {
|
|
727
|
+
className: W("lilt-card__header", n),
|
|
728
|
+
children: [/* @__PURE__ */ l("div", {
|
|
540
729
|
className: "lilt-card__heading",
|
|
541
730
|
children: e
|
|
542
|
-
}), t ? /* @__PURE__ */
|
|
731
|
+
}), t ? /* @__PURE__ */ l("div", {
|
|
543
732
|
className: "lilt-card__aside",
|
|
544
733
|
children: t
|
|
545
734
|
}) : null]
|
|
546
735
|
});
|
|
547
736
|
}
|
|
548
|
-
function
|
|
549
|
-
return /* @__PURE__ */
|
|
737
|
+
function ye({ children: e }) {
|
|
738
|
+
return /* @__PURE__ */ l("p", {
|
|
550
739
|
className: "lilt-card__title",
|
|
551
740
|
children: e
|
|
552
741
|
});
|
|
553
742
|
}
|
|
554
|
-
function
|
|
555
|
-
let o = t(
|
|
556
|
-
return /* @__PURE__ */
|
|
743
|
+
function be({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
|
|
744
|
+
let o = t(U);
|
|
745
|
+
return /* @__PURE__ */ u("div", {
|
|
557
746
|
className: "lilt-card__value-row",
|
|
558
|
-
children: [/* @__PURE__ */
|
|
747
|
+
children: [/* @__PURE__ */ l("strong", {
|
|
559
748
|
className: "lilt-card__value",
|
|
560
749
|
"data-loading": i || void 0,
|
|
561
|
-
children: i ? /* @__PURE__ */
|
|
750
|
+
children: i ? /* @__PURE__ */ l("span", {
|
|
562
751
|
className: "lilt-card__skeleton",
|
|
563
752
|
"aria-label": "Loading"
|
|
564
|
-
}) : e === null ? "—" : /* @__PURE__ */
|
|
753
|
+
}) : e === null ? "—" : /* @__PURE__ */ l(B, {
|
|
565
754
|
value: e,
|
|
566
755
|
format: n,
|
|
567
756
|
variant: o,
|
|
@@ -570,71 +759,60 @@ function he({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
|
|
|
570
759
|
}), r]
|
|
571
760
|
});
|
|
572
761
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
762
|
+
var xe = (e) => `${e >= 0 ? "+" : ""}${(e * 100).toFixed(1)}%`;
|
|
763
|
+
function Se({ value: e, tone: t = "default", format: n = xe }) {
|
|
575
764
|
let r = e > 0 ? "up" : e < 0 ? "down" : "flat";
|
|
576
|
-
return /* @__PURE__ */
|
|
765
|
+
return /* @__PURE__ */ l("span", {
|
|
577
766
|
className: "lilt-card__delta",
|
|
578
767
|
"data-tone": t === "neutral" || r === "flat" ? "neutral" : r === "up" == (t === "default") ? "positive" : "negative",
|
|
579
768
|
children: n(e)
|
|
580
769
|
});
|
|
581
770
|
}
|
|
582
|
-
function
|
|
583
|
-
return /* @__PURE__ */
|
|
771
|
+
function Ce({ children: e }) {
|
|
772
|
+
return /* @__PURE__ */ l("span", {
|
|
584
773
|
className: "lilt-card__caption",
|
|
585
774
|
children: e
|
|
586
775
|
});
|
|
587
776
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
777
|
+
function we({ label: e, options: t, value: n, onValueChange: r }) {
|
|
778
|
+
let i = he();
|
|
779
|
+
if (!t || t.length < 2) return /* @__PURE__ */ l("span", {
|
|
590
780
|
className: "lilt-card__range",
|
|
591
781
|
children: e ?? t?.[0]?.label
|
|
592
|
-
}) : /* @__PURE__ */ l("span", {
|
|
593
|
-
className: "lilt-card__range lilt-card__range--select",
|
|
594
|
-
children: [/* @__PURE__ */ c("select", {
|
|
595
|
-
"aria-label": "Period",
|
|
596
|
-
value: n,
|
|
597
|
-
onChange: (e) => r?.(e.target.value),
|
|
598
|
-
children: t.map((e) => /* @__PURE__ */ c("option", {
|
|
599
|
-
value: e.id,
|
|
600
|
-
children: e.label
|
|
601
|
-
}, e.id))
|
|
602
|
-
}), /* @__PURE__ */ c("svg", {
|
|
603
|
-
"aria-hidden": "true",
|
|
604
|
-
viewBox: "0 0 12 12",
|
|
605
|
-
width: "12",
|
|
606
|
-
height: "12",
|
|
607
|
-
children: /* @__PURE__ */ c("path", {
|
|
608
|
-
d: "M3 4.5 6 7.5 9 4.5",
|
|
609
|
-
fill: "none",
|
|
610
|
-
stroke: "currentColor",
|
|
611
|
-
strokeWidth: "1.5"
|
|
612
|
-
})
|
|
613
|
-
})]
|
|
614
782
|
});
|
|
783
|
+
let a = {
|
|
784
|
+
value: n ?? t[0].id,
|
|
785
|
+
options: t,
|
|
786
|
+
onValueChange: (e) => r?.(e),
|
|
787
|
+
"aria-label": "Period"
|
|
788
|
+
};
|
|
789
|
+
return i ? /* @__PURE__ */ l("span", {
|
|
790
|
+
className: "lilt-card__range-slot",
|
|
791
|
+
children: /* @__PURE__ */ l(i, { ...a })
|
|
792
|
+
}) : /* @__PURE__ */ l(ge, { ...a });
|
|
615
793
|
}
|
|
616
794
|
//#endregion
|
|
617
795
|
//#region src/watch/engine/robust.ts
|
|
618
|
-
function
|
|
796
|
+
function q(e) {
|
|
619
797
|
if (e.length === 0) return null;
|
|
620
798
|
let t = [...e].sort((e, t) => e - t), n = t.length >> 1;
|
|
621
799
|
return t.length % 2 == 1 ? t[n] : (t[n - 1] + t[n]) / 2;
|
|
622
800
|
}
|
|
623
|
-
function
|
|
624
|
-
let n =
|
|
801
|
+
function Te(e, t) {
|
|
802
|
+
let n = q(e.map((e) => Math.abs(e - t)));
|
|
625
803
|
return n === null ? 0 : n * 1.4826;
|
|
626
804
|
}
|
|
627
805
|
//#endregion
|
|
628
806
|
//#region src/watch/engine/normal.ts
|
|
629
|
-
var
|
|
630
|
-
function
|
|
807
|
+
var J = 1440, Ee = 256, De = 12;
|
|
808
|
+
function Oe({ data: e, x: t, value: n, normal: r }) {
|
|
631
809
|
let i = (e, t) => {
|
|
632
810
|
let n = e[t];
|
|
633
811
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
634
812
|
}, a = e.map((e) => i(e, n));
|
|
635
813
|
if (r.around !== void 0 && r.tolerance === void 0) throw Error("Lilt Charts: `normal.around` needs a `tolerance`.");
|
|
636
814
|
if (r.given !== void 0 && r.learn === void 0) throw Error("Lilt Charts: `normal.given` needs `learn`.");
|
|
637
|
-
let o = r.learn === void 0 ? null :
|
|
815
|
+
let o = r.learn === void 0 ? null : Me(r.learn), s = o ? Ne(e, t, o) : null, c = r.given === void 0 ? null : Fe(r.given, e, i), l = /* @__PURE__ */ new Map(), u = [], d = Object.entries(r.rules ?? {}).map(([e, t]) => typeof t == "function" ? {
|
|
638
816
|
id: e,
|
|
639
817
|
test: t
|
|
640
818
|
} : {
|
|
@@ -651,36 +829,36 @@ function Ce({ data: e, x: t, value: n, normal: r }) {
|
|
|
651
829
|
h = {
|
|
652
830
|
lower: e ?? null,
|
|
653
831
|
upper: t ?? null
|
|
654
|
-
}, p && f !== null && (t !== void 0 && f > t && m.push(
|
|
832
|
+
}, p && f !== null && (t !== void 0 && f > t && m.push(Y("limit", "max", n, "above", t, f, X(t))), e !== void 0 && f < e && m.push(Y("limit", "min", n, "below", e, f, X(e))));
|
|
655
833
|
}
|
|
656
834
|
if (r.around !== void 0 && r.tolerance !== void 0) {
|
|
657
835
|
let e = i(t, r.around);
|
|
658
836
|
if (e !== null) {
|
|
659
|
-
let t =
|
|
837
|
+
let t = ke(r.tolerance, e), n = {
|
|
660
838
|
lower: e - t,
|
|
661
839
|
upper: e + t
|
|
662
840
|
};
|
|
663
|
-
if (h =
|
|
841
|
+
if (h = Z(h, n), g = e, p && f !== null) {
|
|
664
842
|
let e = r.aroundSeverity ?? "warning";
|
|
665
|
-
f > n.upper ? m.push(
|
|
843
|
+
f > n.upper ? m.push(Y("around", "around", e, "above", n.upper, f, t)) : f < n.lower && m.push(Y("around", "around", e, "below", n.lower, f, t));
|
|
666
844
|
}
|
|
667
845
|
}
|
|
668
846
|
}
|
|
669
847
|
if (o && s) {
|
|
670
|
-
let e =
|
|
848
|
+
let e = Ie(s(t), c ? c(t) : ""), r = e === null ? void 0 : l.get(e), i = r?.values;
|
|
671
849
|
if (r && i && i.length >= o.minSamples) {
|
|
672
|
-
let e =
|
|
850
|
+
let e = q(i);
|
|
673
851
|
_ = [...r.rows];
|
|
674
|
-
let t = u.length >=
|
|
852
|
+
let t = u.length >= De ? q(u) * 1.4826 : 0, n = Math.max(Te(i, e), Math.abs(e) * Math.max(t, .02), 1e-9) * o.width, a = {
|
|
675
853
|
lower: e - n,
|
|
676
854
|
upper: e + n
|
|
677
855
|
};
|
|
678
|
-
h =
|
|
856
|
+
h = Z(h, a), g = e, p && f !== null && (f > a.upper ? m.push(Y("learned", "learned", o.severity, "above", a.upper, f, n)) : f < a.lower && m.push(Y("learned", "learned", o.severity, "below", a.lower, f, n)));
|
|
679
857
|
}
|
|
680
858
|
if (e !== null && p && f !== null) {
|
|
681
859
|
if (g !== null && i && i.length >= o.minSamples) {
|
|
682
|
-
let e =
|
|
683
|
-
e !== 0 && (u.push(Math.abs(f - e) / Math.abs(e)), u.length >
|
|
860
|
+
let e = q(i);
|
|
861
|
+
e !== 0 && (u.push(Math.abs(f - e) / Math.abs(e)), u.length > Ee && u.shift());
|
|
684
862
|
}
|
|
685
863
|
let t = l.get(e) ?? {
|
|
686
864
|
values: [],
|
|
@@ -716,7 +894,7 @@ function Ce({ data: e, x: t, value: n, normal: r }) {
|
|
|
716
894
|
};
|
|
717
895
|
});
|
|
718
896
|
}
|
|
719
|
-
function
|
|
897
|
+
function Y(e, t, n, r, i, a, o) {
|
|
720
898
|
return {
|
|
721
899
|
source: e,
|
|
722
900
|
id: t,
|
|
@@ -726,19 +904,19 @@ function J(e, t, n, r, i, a, o) {
|
|
|
726
904
|
score: 1 + Math.abs(a - i) / Math.max(o, 1e-9)
|
|
727
905
|
};
|
|
728
906
|
}
|
|
729
|
-
var
|
|
730
|
-
function
|
|
907
|
+
var X = (e) => e === 0 ? 1 : Math.abs(e) * .1;
|
|
908
|
+
function ke(e, t) {
|
|
731
909
|
return typeof e == "number" ? Math.abs(e) : Math.abs(t) * Math.abs(Number.parseFloat(e)) / 100;
|
|
732
910
|
}
|
|
733
|
-
function
|
|
734
|
-
let n =
|
|
911
|
+
function Z(e, t) {
|
|
912
|
+
let n = Ae(e.lower, t.lower), r = je(e.upper, t.upper);
|
|
735
913
|
return n !== null && r !== null && n > r ? e : {
|
|
736
914
|
lower: n,
|
|
737
915
|
upper: r
|
|
738
916
|
};
|
|
739
917
|
}
|
|
740
|
-
var
|
|
741
|
-
function
|
|
918
|
+
var Ae = (e, t) => e === null ? t : t === null ? e : Math.max(e, t), je = (e, t) => e === null ? t : t === null ? e : Math.min(e, t);
|
|
919
|
+
function Me(e) {
|
|
742
920
|
return {
|
|
743
921
|
width: 3,
|
|
744
922
|
history: 8,
|
|
@@ -748,7 +926,7 @@ function De(e) {
|
|
|
748
926
|
...typeof e == "string" ? { period: e } : e
|
|
749
927
|
};
|
|
750
928
|
}
|
|
751
|
-
function
|
|
929
|
+
function Ne(e, t, n) {
|
|
752
930
|
if (n.period === "all") return () => "all";
|
|
753
931
|
let r = (e) => {
|
|
754
932
|
let r = e[t];
|
|
@@ -756,7 +934,7 @@ function Oe(e, t, n) {
|
|
|
756
934
|
if (typeof r == "number" && Number.isFinite(r)) return r;
|
|
757
935
|
if (r == null) return null;
|
|
758
936
|
throw Error(`Lilt Charts: learning by '${n.period}' needs dates or epoch milliseconds in '${t}'.`);
|
|
759
|
-
}, i = n.slotMinutes ??
|
|
937
|
+
}, i = n.slotMinutes ?? Pe(e.map(r));
|
|
760
938
|
return (e) => {
|
|
761
939
|
let t = r(e);
|
|
762
940
|
if (t === null) return null;
|
|
@@ -764,22 +942,22 @@ function Oe(e, t, n) {
|
|
|
764
942
|
return n.period === "week" ? `${a.getUTCDay()}:${s}` : String(s);
|
|
765
943
|
};
|
|
766
944
|
}
|
|
767
|
-
function
|
|
945
|
+
function Pe(e) {
|
|
768
946
|
let t = e.filter((e) => e !== null), n = [];
|
|
769
947
|
for (let e = 1; e < t.length; e += 1) {
|
|
770
948
|
let r = t[e] - t[e - 1];
|
|
771
949
|
r > 0 && n.push(r);
|
|
772
950
|
}
|
|
773
|
-
let r =
|
|
774
|
-
return r === null ?
|
|
951
|
+
let r = q(n);
|
|
952
|
+
return r === null ? J : Math.min(J, Math.max(1, Math.round(r / 6e4)));
|
|
775
953
|
}
|
|
776
|
-
function
|
|
954
|
+
function Fe(e, t, n) {
|
|
777
955
|
let { key: r, step: i } = typeof e == "string" ? {
|
|
778
956
|
key: e,
|
|
779
957
|
step: void 0
|
|
780
958
|
} : e, a = i;
|
|
781
959
|
if (a === void 0) {
|
|
782
|
-
let e = t.map((e) => n(e, r)).filter((e) => e !== null), [i, o] =
|
|
960
|
+
let e = t.map((e) => n(e, r)).filter((e) => e !== null), [i, o] = v(e), s = i === void 0 || o === void 0 ? 0 : o - i;
|
|
783
961
|
a = s > 0 ? s / 8 : 1;
|
|
784
962
|
}
|
|
785
963
|
return (e) => {
|
|
@@ -787,16 +965,16 @@ function Z(e, t, n) {
|
|
|
787
965
|
return t === null ? null : String(Math.floor(t / a));
|
|
788
966
|
};
|
|
789
967
|
}
|
|
790
|
-
function
|
|
968
|
+
function Ie(e, t) {
|
|
791
969
|
return e === null || t === null ? null : t === "" ? e : `${e}|${t}`;
|
|
792
970
|
}
|
|
793
971
|
//#endregion
|
|
794
972
|
//#region src/watch/engine/status.ts
|
|
795
|
-
function
|
|
973
|
+
function Le(e, { enter: t = 2, exit: n = 3 } = {}) {
|
|
796
974
|
let r = [], i = !1, a = null, o = null, s = [], c = 0, l = 0, u = 0, d = 0, f = [];
|
|
797
975
|
for (let p of e) {
|
|
798
976
|
let e = p.flags.length > 0;
|
|
799
|
-
p.judged && (e || p.value !== null) && (e ? (d = 0, l === 0 && (u = p.index, f = []), l += 1, f.push(p), !i && l >= t ? (i = !0, o = u, a =
|
|
977
|
+
p.judged && (e || p.value !== null) && (e ? (d = 0, l === 0 && (u = p.index, f = []), l += 1, f.push(p), !i && l >= t ? (i = !0, o = u, a = Re(f), c = Math.max(...f.map((e) => e.score)), s = p.flags, r.push({
|
|
800
978
|
type: "activated",
|
|
801
979
|
index: p.index,
|
|
802
980
|
severity: a,
|
|
@@ -820,10 +998,10 @@ function je(e, { enter: t = 2, exit: n = 3 } = {}) {
|
|
|
820
998
|
events: r
|
|
821
999
|
};
|
|
822
1000
|
}
|
|
823
|
-
var
|
|
1001
|
+
var Re = (e) => e.some((e) => e.severity === "critical") ? "critical" : "warning";
|
|
824
1002
|
//#endregion
|
|
825
1003
|
//#region src/watch/engine/describe.ts
|
|
826
|
-
function
|
|
1004
|
+
function ze(e, { formatValue: t = String, aroundLabel: n = "reference" } = {}) {
|
|
827
1005
|
let r = e.direction === "above";
|
|
828
1006
|
switch (e.source) {
|
|
829
1007
|
case "limit": return `${r ? "Above max" : "Below min"} ${t(e.bound)}`;
|
|
@@ -862,11 +1040,11 @@ function Q(e, t) {
|
|
|
862
1040
|
};
|
|
863
1041
|
}
|
|
864
1042
|
var $ = (e) => typeof e == "number" && Number.isFinite(e);
|
|
865
|
-
function
|
|
1043
|
+
function Be({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
|
|
866
1044
|
if (!n.length) return null;
|
|
867
1045
|
let a = {}, o = {}, s = (e, t, n) => {
|
|
868
1046
|
e[t] !== null && (e[t] = n === null ? null : (e[t] ?? 0) + n);
|
|
869
|
-
}, c =
|
|
1047
|
+
}, c = y(n) ?? Infinity, l = [];
|
|
870
1048
|
for (let e = c - 1; e >= 0 && l.length < i; --e) {
|
|
871
1049
|
let n = t[e];
|
|
872
1050
|
n?.judged && n.value !== null && n.flags.length === 0 && l.push(e);
|
|
@@ -877,12 +1055,12 @@ function Pe({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
|
|
|
877
1055
|
let c = r(n), u = (t[i]?.basis?.length ? t[i].basis : l).map((t) => r(e[t])), d = /* @__PURE__ */ new Set([...Object.keys(c), ...u.flatMap(Object.keys)]);
|
|
878
1056
|
for (let e of d) {
|
|
879
1057
|
let t = c[e];
|
|
880
|
-
s(a, e, $(t) ? t : null), s(o, e,
|
|
1058
|
+
s(a, e, $(t) ? t : null), s(o, e, q(u.map((t) => t[e]).filter($)));
|
|
881
1059
|
}
|
|
882
1060
|
}
|
|
883
1061
|
return Q(a, o);
|
|
884
1062
|
}
|
|
885
|
-
function
|
|
1063
|
+
function Ve(e, { lead: t = .5 } = {}) {
|
|
886
1064
|
if (!e || e.delta === 0) return null;
|
|
887
1065
|
let [n, r] = e.parts;
|
|
888
1066
|
if (!n || n.share <= 0) return null;
|
|
@@ -891,6 +1069,6 @@ function Fe(e, { lead: t = .5 } = {}) {
|
|
|
891
1069
|
}
|
|
892
1070
|
//#endregion
|
|
893
1071
|
//#region src/watch/board/report-context.ts
|
|
894
|
-
var
|
|
1072
|
+
var He = e(null);
|
|
895
1073
|
//#endregion
|
|
896
|
-
export {
|
|
1074
|
+
export { C, w as S, me as _, ze as a, D as b, K as c, Ce as d, Se as f, be as g, ye as h, Be as i, G as l, we as m, Ve as n, Le as o, ve as p, Q as r, Oe as s, He as t, _e as u, B as v, S as x, k as y };
|