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