@elevasis/ui 1.4.0 → 1.6.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/dist/{CoreAuthKitInner-3J4RVQO6.js → CoreAuthKitInner-Y6LQYIPX.js} +1 -0
- package/dist/api/index.js +1 -0
- package/dist/auth/context.js +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/charts/index.d.ts +96 -0
- package/dist/charts/index.js +384 -0
- package/dist/chunk-54S7KNJV.js +112 -0
- package/dist/{chunk-6IX5JZEH.js → chunk-G4TAF3T6.js} +166 -1
- package/dist/{chunk-Y2I5JJ3N.js → chunk-K3YVC5RW.js} +2 -2
- package/dist/chunk-KB5NKPTN.js +1455 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-GIFAF5ZS.js → chunk-MS45MNFM.js} +6 -1
- package/dist/chunk-R56VC63S.js +129 -0
- package/dist/chunk-TYV5NJV2.js +1 -0
- package/dist/{chunk-JQLT6HBI.js → chunk-YJFTZUJJ.js} +22 -2
- package/dist/components/index.css +486 -0
- package/dist/components/index.d.ts +2047 -1
- package/dist/components/index.js +3350 -0
- package/dist/components/navigation/index.js +1 -0
- package/dist/execution/index.d.ts +15 -3
- package/dist/execution/index.js +2 -1
- package/dist/graph/index.js +2 -1
- package/dist/hooks/index.d.ts +270 -0
- package/dist/hooks/index.js +3 -2
- package/dist/hooks/published.d.ts +546 -2
- package/dist/hooks/published.js +3 -2
- package/dist/index.css +62 -0
- package/dist/index.d.ts +351 -4
- package/dist/index.js +12 -1038
- package/dist/initialization/index.d.ts +270 -0
- package/dist/initialization/index.js +1 -0
- package/dist/layout/index.css +44 -0
- package/dist/layout/index.d.ts +330 -0
- package/dist/layout/index.js +1440 -0
- package/dist/organization/index.js +1 -0
- package/dist/profile/index.d.ts +270 -0
- package/dist/profile/index.js +1 -0
- package/dist/provider/index.css +61 -0
- package/dist/provider/index.d.ts +54 -2
- package/dist/provider/index.js +5 -3
- package/dist/provider/published.d.ts +6 -0
- package/dist/provider/published.js +3 -2
- package/dist/router/context.js +1 -0
- package/dist/router/index.js +1 -0
- package/dist/sse/index.js +1 -1
- package/dist/supabase/index.d.ts +525 -0
- package/dist/supabase/index.js +1 -0
- package/dist/theme/index.d.ts +107 -0
- package/dist/theme/index.js +3 -0
- package/dist/typeform/index.js +1 -0
- package/dist/typeform/schemas.js +1 -0
- package/dist/types/index.d.ts +3636 -368
- package/dist/utils/index.js +1 -0
- package/package.json +96 -3
- package/dist/chunk-XXDDMASA.js +0 -170
- /package/dist/{chunk-BUZONXAW.js → chunk-ARQRKA6J.js} +0 -0
package/dist/api/index.js
CHANGED
package/dist/auth/context.js
CHANGED
package/dist/auth/index.js
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CyberAreaChart — Reusable area chart with cyber/high-tech aesthetic.
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - SVG gradient fills with neon color palette (light/dark aware)
|
|
8
|
+
* - Gaussian blur glow filters on lines
|
|
9
|
+
* - Glassmorphism tooltip with backdrop blur
|
|
10
|
+
* - Animated pulsing active dots
|
|
11
|
+
* - Dotted grid lines at low opacity
|
|
12
|
+
* - Baseline glow line when all values are zero
|
|
13
|
+
* - Consistent slide-in animation on every mount
|
|
14
|
+
*/
|
|
15
|
+
interface CyberSeries {
|
|
16
|
+
/** The key in each data record that holds this series' value. */
|
|
17
|
+
dataKey: string;
|
|
18
|
+
/** Display name shown in tooltip. Defaults to dataKey. */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Which cyber color to use. Defaults to 'cyan'. */
|
|
21
|
+
color?: 'cyan' | 'blue' | 'green' | 'red' | 'yellow';
|
|
22
|
+
/** Animation duration in ms. Defaults to 1200. */
|
|
23
|
+
animationDuration?: number;
|
|
24
|
+
}
|
|
25
|
+
interface CyberAreaChartProps {
|
|
26
|
+
data: Record<string, unknown>[];
|
|
27
|
+
series: CyberSeries[];
|
|
28
|
+
/** Key in each data record used for the X axis. Defaults to 'time'. */
|
|
29
|
+
xDataKey?: string;
|
|
30
|
+
/** Chart height in px. Defaults to 300. */
|
|
31
|
+
height?: number;
|
|
32
|
+
/** Y-axis label text. */
|
|
33
|
+
yAxisLabel?: string;
|
|
34
|
+
/** Y-axis domain. Defaults to [0, 'auto']. */
|
|
35
|
+
yDomain?: [number | string | ((v: number) => number), number | string | ((v: number) => number)];
|
|
36
|
+
/** Custom Y-axis tick formatter. */
|
|
37
|
+
yTickFormatter?: (value: number) => string;
|
|
38
|
+
/** Custom X-axis tick formatter. When provided, raw data values are used as keys and this formats the display. */
|
|
39
|
+
xTickFormatter?: (value: string) => string;
|
|
40
|
+
/** Whether to show the dotted grid. Defaults to true. */
|
|
41
|
+
showGrid?: boolean;
|
|
42
|
+
/** Whether to show a glowing baseline when all values are 0. Defaults to true. */
|
|
43
|
+
showZeroBaseline?: boolean;
|
|
44
|
+
/** Which cyber color to use for the zero baseline. Defaults to the first series' color. */
|
|
45
|
+
baselineColor?: 'cyan' | 'blue' | 'green' | 'red' | 'yellow';
|
|
46
|
+
/** Render as line only (no gradient fill). Defaults to false. */
|
|
47
|
+
lineOnly?: boolean;
|
|
48
|
+
/** Custom tooltip value formatter. Defaults to String(value). */
|
|
49
|
+
tooltipFormatter?: (value: number) => string;
|
|
50
|
+
/** Chart margin overrides. */
|
|
51
|
+
margin?: {
|
|
52
|
+
top?: number;
|
|
53
|
+
right?: number;
|
|
54
|
+
bottom?: number;
|
|
55
|
+
left?: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
declare function CyberLegendItem({ color, label }: {
|
|
59
|
+
color: string;
|
|
60
|
+
label: string;
|
|
61
|
+
}): react_jsx_runtime.JSX.Element;
|
|
62
|
+
declare function CyberAreaChart({ data, series, xDataKey, height, yAxisLabel, yDomain, yTickFormatter, showGrid, showZeroBaseline, baselineColor, lineOnly, margin, xTickFormatter, tooltipFormatter }: CyberAreaChartProps): react_jsx_runtime.JSX.Element;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Cyber chart theme — color palette and shared config for light/dark modes.
|
|
66
|
+
*
|
|
67
|
+
* Theme-derived values (grid, tick text, tooltip) use CSS custom properties
|
|
68
|
+
* so they automatically match whatever color theme the app uses.
|
|
69
|
+
* Only the neon accent colors (cyan, blue, green, red) differ between light/dark.
|
|
70
|
+
*/
|
|
71
|
+
interface CyberColors {
|
|
72
|
+
cyan: string;
|
|
73
|
+
cyanDim: string;
|
|
74
|
+
blue: string;
|
|
75
|
+
green: string;
|
|
76
|
+
greenDim: string;
|
|
77
|
+
red: string;
|
|
78
|
+
redDim: string;
|
|
79
|
+
yellow: string;
|
|
80
|
+
magenta: string;
|
|
81
|
+
grid: string;
|
|
82
|
+
gridLine: string;
|
|
83
|
+
tickText: string;
|
|
84
|
+
tooltipBg: string;
|
|
85
|
+
tooltipBorder: string;
|
|
86
|
+
tooltipText: string;
|
|
87
|
+
cardGlow: string;
|
|
88
|
+
dotStroke: string;
|
|
89
|
+
}
|
|
90
|
+
/** Returns the resolved cyber color palette for the current color scheme. */
|
|
91
|
+
declare function useCyberColors(): CyberColors;
|
|
92
|
+
/** Map a series dataKey to its color from the palette. */
|
|
93
|
+
declare function getSeriesColor(key: string, colors: CyberColors): string;
|
|
94
|
+
|
|
95
|
+
export { CyberAreaChart, CyberLegendItem, getSeriesColor, useCyberColors };
|
|
96
|
+
export type { CyberAreaChartProps, CyberColors, CyberSeries };
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import '../chunk-MLKGABMK.js';
|
|
2
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
3
|
+
import { useComputedColorScheme, Group, Text, Box } from '@mantine/core';
|
|
4
|
+
import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine, Area } from 'recharts';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var THEME_DERIVED = {
|
|
8
|
+
grid: "var(--color-border)",
|
|
9
|
+
gridLine: "var(--color-border)",
|
|
10
|
+
tickText: "var(--mantine-color-dimmed)",
|
|
11
|
+
tooltipBg: "var(--glass-background)",
|
|
12
|
+
tooltipBorder: "var(--color-border)",
|
|
13
|
+
tooltipText: "var(--mantine-color-dimmed)",
|
|
14
|
+
dotStroke: "var(--mantine-color-body)"
|
|
15
|
+
};
|
|
16
|
+
var DARK = {
|
|
17
|
+
cyan: "#00e5ff",
|
|
18
|
+
cyanDim: "#00b8d4",
|
|
19
|
+
blue: "#448aff",
|
|
20
|
+
green: "#00ff88",
|
|
21
|
+
greenDim: "#00c853",
|
|
22
|
+
red: "#ff1744",
|
|
23
|
+
redDim: "#d50000",
|
|
24
|
+
yellow: "#ffab00",
|
|
25
|
+
magenta: "#ff4081",
|
|
26
|
+
...THEME_DERIVED,
|
|
27
|
+
cardGlow: "0 0 30px rgba(0, 229, 255, 0.06)"
|
|
28
|
+
};
|
|
29
|
+
var LIGHT = {
|
|
30
|
+
cyan: "#0091ea",
|
|
31
|
+
cyanDim: "#0277bd",
|
|
32
|
+
blue: "#4d8af0",
|
|
33
|
+
green: "#00a854",
|
|
34
|
+
greenDim: "#00873e",
|
|
35
|
+
red: "#d32f2f",
|
|
36
|
+
redDim: "#b71c1c",
|
|
37
|
+
yellow: "#f9a825",
|
|
38
|
+
magenta: "#c51162",
|
|
39
|
+
...THEME_DERIVED,
|
|
40
|
+
cardGlow: "0 0 20px rgba(0, 145, 234, 0.06)"
|
|
41
|
+
};
|
|
42
|
+
function useCyberColors() {
|
|
43
|
+
const scheme = useComputedColorScheme("dark");
|
|
44
|
+
return useMemo(() => scheme === "dark" ? DARK : LIGHT, [scheme]);
|
|
45
|
+
}
|
|
46
|
+
function getSeriesColor(key, colors) {
|
|
47
|
+
switch (key) {
|
|
48
|
+
case "Success Rate":
|
|
49
|
+
return colors.cyan;
|
|
50
|
+
case "Executions":
|
|
51
|
+
return colors.blue;
|
|
52
|
+
case "Success Count":
|
|
53
|
+
return colors.green;
|
|
54
|
+
case "Error Count":
|
|
55
|
+
return colors.red;
|
|
56
|
+
default:
|
|
57
|
+
return colors.cyan;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function CyberDefs({ colors }) {
|
|
61
|
+
const gradients = [
|
|
62
|
+
{ id: "gradCyan", color: colors.cyan, opacity: 0.35 },
|
|
63
|
+
{ id: "gradBlue", color: colors.blue, opacity: 0.3 },
|
|
64
|
+
{ id: "gradGreen", color: colors.green, opacity: 0.3 },
|
|
65
|
+
{ id: "gradRed", color: colors.red, opacity: 0.3 },
|
|
66
|
+
{ id: "gradYellow", color: colors.yellow, opacity: 0.3 }
|
|
67
|
+
];
|
|
68
|
+
const filters = [
|
|
69
|
+
{ id: "glowCyan", std: 3 },
|
|
70
|
+
{ id: "glowBlue", std: 3 },
|
|
71
|
+
{ id: "glowGreen", std: 2.5 },
|
|
72
|
+
{ id: "glowRed", std: 2.5 },
|
|
73
|
+
{ id: "glowYellow", std: 2.5 }
|
|
74
|
+
];
|
|
75
|
+
return /* @__PURE__ */ jsxs("defs", { children: [
|
|
76
|
+
gradients.map((g) => /* @__PURE__ */ jsxs("linearGradient", { id: g.id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
77
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: g.color, stopOpacity: g.opacity }),
|
|
78
|
+
/* @__PURE__ */ jsx("stop", { offset: "60%", stopColor: g.color, stopOpacity: g.opacity * 0.2 }),
|
|
79
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: g.color, stopOpacity: 0 })
|
|
80
|
+
] }, g.id)),
|
|
81
|
+
filters.map((f) => /* @__PURE__ */ jsxs("filter", { id: f.id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
|
|
82
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: f.std, result: "blur" }),
|
|
83
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
84
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
85
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
86
|
+
] })
|
|
87
|
+
] }, f.id)),
|
|
88
|
+
/* @__PURE__ */ jsxs("filter", { id: "dotGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
89
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
|
|
90
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
91
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
92
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
93
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
94
|
+
] })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsxs("filter", { id: "pulseGlow", x: "-30%", y: "-30%", width: "160%", height: "160%", children: [
|
|
97
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "5", result: "blur" }),
|
|
98
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
99
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
100
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
101
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
102
|
+
] })
|
|
103
|
+
] })
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
function PulseDefs({ series, colors, isLight }) {
|
|
107
|
+
return /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
|
|
108
|
+
const color = colors[s.color ?? "cyan"];
|
|
109
|
+
const dur = "6s";
|
|
110
|
+
const delay = "0s";
|
|
111
|
+
const keyTimes = "0;0.3;1";
|
|
112
|
+
const keySplines = "0.33 0 0.67 1;0 0 1 1";
|
|
113
|
+
const animateProps = {
|
|
114
|
+
dur,
|
|
115
|
+
keyTimes,
|
|
116
|
+
keySplines,
|
|
117
|
+
repeatCount: "indefinite",
|
|
118
|
+
calcMode: "spline",
|
|
119
|
+
begin: delay
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsxs("linearGradient", { id: `pulse-${i}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
122
|
+
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.15;1.0;1.0", ...animateProps }) }),
|
|
123
|
+
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: isLight ? "white" : color, stopOpacity: isLight ? 0.6 : 0.9, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.075;1.075;1.075", ...animateProps }) }),
|
|
124
|
+
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "0;1.15;1.15", ...animateProps }) })
|
|
125
|
+
] }, i);
|
|
126
|
+
}) });
|
|
127
|
+
}
|
|
128
|
+
function CyberActiveDot({
|
|
129
|
+
cx,
|
|
130
|
+
cy,
|
|
131
|
+
color,
|
|
132
|
+
dotStroke
|
|
133
|
+
}) {
|
|
134
|
+
if (cx == null || cy == null) return null;
|
|
135
|
+
return /* @__PURE__ */ jsxs("g", { filter: "url(#dotGlow)", children: [
|
|
136
|
+
/* @__PURE__ */ jsxs("circle", { cx, cy, r: 6, fill: "none", stroke: color, strokeWidth: 2, opacity: 0.5, children: [
|
|
137
|
+
/* @__PURE__ */ jsx("animate", { attributeName: "r", from: "4", to: "10", dur: "1.2s", repeatCount: "indefinite" }),
|
|
138
|
+
/* @__PURE__ */ jsx("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: "1.2s", repeatCount: "indefinite" })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ jsx("circle", { cx, cy, r: 4, fill: color, stroke: dotStroke, strokeWidth: 2 })
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
function CyberTooltipContent({
|
|
144
|
+
active,
|
|
145
|
+
payload,
|
|
146
|
+
label,
|
|
147
|
+
colors,
|
|
148
|
+
labelFormatter,
|
|
149
|
+
valueFormatter
|
|
150
|
+
}) {
|
|
151
|
+
if (!active || !payload?.length) return null;
|
|
152
|
+
const filtered = payload.filter((entry) => !entry.name?.startsWith("_pulse_"));
|
|
153
|
+
if (!filtered.length) return null;
|
|
154
|
+
const displayLabel = label && labelFormatter ? labelFormatter(label) : label;
|
|
155
|
+
return /* @__PURE__ */ jsxs(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
style: {
|
|
159
|
+
background: colors.tooltipBg,
|
|
160
|
+
border: `1px solid ${colors.tooltipBorder}`,
|
|
161
|
+
borderRadius: 8,
|
|
162
|
+
padding: "10px 14px",
|
|
163
|
+
backdropFilter: "var(--glass-blur)",
|
|
164
|
+
WebkitBackdropFilter: "var(--glass-blur)",
|
|
165
|
+
boxShadow: "var(--standard-box-shadow)",
|
|
166
|
+
fontFamily: "var(--mantine-font-family-monospace, monospace)",
|
|
167
|
+
minWidth: 160
|
|
168
|
+
},
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ jsx(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
style: {
|
|
174
|
+
fontSize: 11,
|
|
175
|
+
color: colors.tickText,
|
|
176
|
+
marginBottom: 8,
|
|
177
|
+
letterSpacing: "0.05em",
|
|
178
|
+
textTransform: "uppercase",
|
|
179
|
+
borderBottom: `1px solid ${colors.tooltipBorder}`,
|
|
180
|
+
paddingBottom: 6
|
|
181
|
+
},
|
|
182
|
+
children: displayLabel
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
filtered.map((entry) => {
|
|
186
|
+
const color = entry.color || getSeriesColor(entry.dataKey, colors);
|
|
187
|
+
return /* @__PURE__ */ jsxs(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
style: {
|
|
191
|
+
display: "flex",
|
|
192
|
+
justifyContent: "space-between",
|
|
193
|
+
alignItems: "center",
|
|
194
|
+
gap: 16,
|
|
195
|
+
padding: "3px 0",
|
|
196
|
+
fontSize: 12
|
|
197
|
+
},
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
200
|
+
/* @__PURE__ */ jsx(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
style: {
|
|
204
|
+
width: 8,
|
|
205
|
+
height: 8,
|
|
206
|
+
borderRadius: "50%",
|
|
207
|
+
backgroundColor: color,
|
|
208
|
+
boxShadow: `0 0 6px ${color}`
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText }, children: entry.name ?? entry.dataKey })
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: entry.value != null && valueFormatter ? valueFormatter(entry.value) : String(entry.value) })
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
entry.dataKey
|
|
218
|
+
);
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
function CyberLegendItem({ color, label }) {
|
|
225
|
+
return /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
"div",
|
|
228
|
+
{
|
|
229
|
+
style: {
|
|
230
|
+
width: 10,
|
|
231
|
+
height: 10,
|
|
232
|
+
borderRadius: "50%",
|
|
233
|
+
backgroundColor: color,
|
|
234
|
+
boxShadow: `0 0 8px ${color}, 0 0 16px ${color}40`
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: { letterSpacing: "0.03em" }, children: label })
|
|
239
|
+
] });
|
|
240
|
+
}
|
|
241
|
+
var COLOR_MAP = {
|
|
242
|
+
cyan: { gradient: "url(#gradCyan)", filter: "url(#glowCyan)", key: "cyan" },
|
|
243
|
+
blue: { gradient: "url(#gradBlue)", filter: "url(#glowBlue)", key: "blue" },
|
|
244
|
+
green: { gradient: "url(#gradGreen)", filter: "url(#glowGreen)", key: "green" },
|
|
245
|
+
red: { gradient: "url(#gradRed)", filter: "url(#glowRed)", key: "red" },
|
|
246
|
+
yellow: { gradient: "url(#gradYellow)", filter: "url(#glowYellow)", key: "yellow" }
|
|
247
|
+
};
|
|
248
|
+
function CyberAreaChart({
|
|
249
|
+
data,
|
|
250
|
+
series,
|
|
251
|
+
xDataKey = "time",
|
|
252
|
+
height = 300,
|
|
253
|
+
yAxisLabel,
|
|
254
|
+
yDomain,
|
|
255
|
+
yTickFormatter,
|
|
256
|
+
showGrid = true,
|
|
257
|
+
showZeroBaseline = true,
|
|
258
|
+
baselineColor,
|
|
259
|
+
lineOnly = false,
|
|
260
|
+
margin = { top: 8, right: 20, left: 0, bottom: 0 },
|
|
261
|
+
xTickFormatter,
|
|
262
|
+
tooltipFormatter
|
|
263
|
+
}) {
|
|
264
|
+
const isLight = useComputedColorScheme("dark") === "light";
|
|
265
|
+
const colors = useCyberColors();
|
|
266
|
+
const [ready, setReady] = useState(false);
|
|
267
|
+
useEffect(() => {
|
|
268
|
+
const frame = requestAnimationFrame(() => setReady(true));
|
|
269
|
+
return () => cancelAnimationFrame(frame);
|
|
270
|
+
}, []);
|
|
271
|
+
const allZero = useMemo(() => {
|
|
272
|
+
if (!showZeroBaseline || !data.length) return false;
|
|
273
|
+
return data.every((row) => series.every((s) => row[s.dataKey] === 0));
|
|
274
|
+
}, [data, series, showZeroBaseline]);
|
|
275
|
+
if (!ready || !data.length) return /* @__PURE__ */ jsx(Box, { style: { height } });
|
|
276
|
+
const gridProps = {
|
|
277
|
+
stroke: colors.gridLine,
|
|
278
|
+
strokeDasharray: "3 6",
|
|
279
|
+
strokeOpacity: 1
|
|
280
|
+
};
|
|
281
|
+
const xAxisConfig = {
|
|
282
|
+
stroke: "none",
|
|
283
|
+
tick: {
|
|
284
|
+
fill: colors.tickText,
|
|
285
|
+
fontSize: 11,
|
|
286
|
+
fontFamily: "var(--mantine-font-family-monospace, monospace)"
|
|
287
|
+
},
|
|
288
|
+
tickLine: false,
|
|
289
|
+
axisLine: { stroke: colors.grid, strokeWidth: 1 }
|
|
290
|
+
};
|
|
291
|
+
const yTickStyle = {
|
|
292
|
+
fill: colors.tickText,
|
|
293
|
+
fontSize: 11,
|
|
294
|
+
fontFamily: "var(--mantine-font-family-monospace, monospace)"
|
|
295
|
+
};
|
|
296
|
+
return /* @__PURE__ */ jsx(Box, { style: { width: "100%", height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(AreaChart, { data, margin, children: [
|
|
297
|
+
/* @__PURE__ */ jsx(CyberDefs, { colors }),
|
|
298
|
+
/* @__PURE__ */ jsx(PulseDefs, { series, colors, isLight }),
|
|
299
|
+
showGrid && /* @__PURE__ */ jsx(CartesianGrid, { ...gridProps }),
|
|
300
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: xDataKey, ...xAxisConfig, tickFormatter: xTickFormatter }),
|
|
301
|
+
/* @__PURE__ */ jsx(
|
|
302
|
+
YAxis,
|
|
303
|
+
{
|
|
304
|
+
domain: yDomain ?? [0, (max) => Math.max(max, 1)],
|
|
305
|
+
allowDecimals: false,
|
|
306
|
+
stroke: "none",
|
|
307
|
+
tick: yTickStyle,
|
|
308
|
+
tickFormatter: yTickFormatter,
|
|
309
|
+
tickLine: false,
|
|
310
|
+
axisLine: { stroke: colors.grid, strokeWidth: 1 },
|
|
311
|
+
label: yAxisLabel ? {
|
|
312
|
+
value: yAxisLabel,
|
|
313
|
+
angle: -90,
|
|
314
|
+
position: "insideLeft",
|
|
315
|
+
offset: 0,
|
|
316
|
+
style: { fill: colors.tickText, fontSize: 11 }
|
|
317
|
+
} : void 0
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
/* @__PURE__ */ jsx(
|
|
321
|
+
Tooltip,
|
|
322
|
+
{
|
|
323
|
+
content: /* @__PURE__ */ jsx(CyberTooltipContent, { colors, labelFormatter: xTickFormatter, valueFormatter: tooltipFormatter }),
|
|
324
|
+
cursor: { stroke: colors.cyan, strokeOpacity: 0.2 }
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
allZero && (() => {
|
|
328
|
+
const bColor = colors[baselineColor ?? series[0]?.color ?? "cyan"];
|
|
329
|
+
return /* @__PURE__ */ jsx(
|
|
330
|
+
ReferenceLine,
|
|
331
|
+
{
|
|
332
|
+
y: 0,
|
|
333
|
+
stroke: bColor,
|
|
334
|
+
strokeWidth: 2,
|
|
335
|
+
style: {
|
|
336
|
+
filter: `drop-shadow(0 0 4px ${bColor}) drop-shadow(0 0 8px ${bColor})`
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
})(),
|
|
341
|
+
series.map((s) => {
|
|
342
|
+
const cm = COLOR_MAP[s.color ?? "cyan"];
|
|
343
|
+
const strokeColor = colors[cm.key];
|
|
344
|
+
return /* @__PURE__ */ jsx(
|
|
345
|
+
Area,
|
|
346
|
+
{
|
|
347
|
+
type: "monotone",
|
|
348
|
+
dataKey: s.dataKey,
|
|
349
|
+
name: s.name ?? s.dataKey,
|
|
350
|
+
stroke: strokeColor,
|
|
351
|
+
strokeWidth: lineOnly ? 3 : 2,
|
|
352
|
+
fill: lineOnly ? "transparent" : cm.gradient,
|
|
353
|
+
filter: cm.filter,
|
|
354
|
+
dot: false,
|
|
355
|
+
activeDot: /* @__PURE__ */ jsx(CyberActiveDot, { color: strokeColor, dotStroke: colors.dotStroke }),
|
|
356
|
+
animationBegin: 100,
|
|
357
|
+
animationDuration: s.animationDuration ?? 1200,
|
|
358
|
+
animationEasing: "ease-out"
|
|
359
|
+
},
|
|
360
|
+
s.dataKey
|
|
361
|
+
);
|
|
362
|
+
}),
|
|
363
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
364
|
+
Area,
|
|
365
|
+
{
|
|
366
|
+
type: "monotone",
|
|
367
|
+
dataKey: s.dataKey,
|
|
368
|
+
name: `_pulse_${s.dataKey}`,
|
|
369
|
+
stroke: `url(#pulse-${i})`,
|
|
370
|
+
strokeWidth: 3,
|
|
371
|
+
fill: "none",
|
|
372
|
+
filter: "url(#pulseGlow)",
|
|
373
|
+
dot: false,
|
|
374
|
+
activeDot: false,
|
|
375
|
+
tooltipType: "none",
|
|
376
|
+
isAnimationActive: false,
|
|
377
|
+
style: { pointerEvents: "none" }
|
|
378
|
+
},
|
|
379
|
+
`pulse-${s.dataKey}`
|
|
380
|
+
))
|
|
381
|
+
] }) }) });
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export { CyberAreaChart, CyberLegendItem, getSeriesColor, useCyberColors };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver } from './chunk-KB5NKPTN.js';
|
|
2
|
+
import { ElevasisCoreProvider } from './chunk-K3YVC5RW.js';
|
|
3
|
+
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-4VGWQ5AN.js';
|
|
4
|
+
import { useMemo, useEffect } from 'react';
|
|
5
|
+
import { mergeThemeOverrides, MantineProvider } from '@mantine/core';
|
|
6
|
+
import '@mantine/core/styles.css';
|
|
7
|
+
import '@mantine/notifications/styles.css';
|
|
8
|
+
import { notifications } from '@mantine/notifications';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var mantineNotificationAdapter = {
|
|
12
|
+
success(title, message) {
|
|
13
|
+
notifications.show({
|
|
14
|
+
title,
|
|
15
|
+
message,
|
|
16
|
+
autoClose: 5e3,
|
|
17
|
+
color: "green",
|
|
18
|
+
position: "top-right"
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
error(title, message) {
|
|
22
|
+
notifications.show({
|
|
23
|
+
title,
|
|
24
|
+
message,
|
|
25
|
+
autoClose: 5e3,
|
|
26
|
+
color: "red",
|
|
27
|
+
position: "top-right"
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
info(title, message) {
|
|
31
|
+
notifications.show({
|
|
32
|
+
title,
|
|
33
|
+
message,
|
|
34
|
+
autoClose: 5e3,
|
|
35
|
+
color: "blue",
|
|
36
|
+
position: "top-right"
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
warning(title, message) {
|
|
40
|
+
notifications.show({
|
|
41
|
+
title,
|
|
42
|
+
message,
|
|
43
|
+
autoClose: 5e3,
|
|
44
|
+
color: "orange",
|
|
45
|
+
position: "top-right"
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
apiError(error) {
|
|
49
|
+
const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
|
|
50
|
+
const hasFields = fields && Object.keys(fields).length > 0;
|
|
51
|
+
notifications.show({
|
|
52
|
+
title: getErrorTitle(code),
|
|
53
|
+
message: formatErrorMessage(message, requestId, fields, retryAfter),
|
|
54
|
+
autoClose: retryAfter ? retryAfter * 1e3 : hasFields ? 8e3 : 5e3,
|
|
55
|
+
color: "red",
|
|
56
|
+
position: "top-right"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function ElevasisUIProvider({ theme, children, ...coreProps }) {
|
|
61
|
+
const resolvedColorScheme = theme?.colorScheme ?? "dark";
|
|
62
|
+
const preset = useMemo(() => getPreset(theme?.preset ?? "default"), [theme?.preset]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!preset.fontImports?.length) return;
|
|
65
|
+
const links = [];
|
|
66
|
+
for (const href of preset.fontImports) {
|
|
67
|
+
if (document.querySelector(`link[href="${href}"]`)) continue;
|
|
68
|
+
const link = document.createElement("link");
|
|
69
|
+
link.rel = "stylesheet";
|
|
70
|
+
link.href = href;
|
|
71
|
+
document.head.appendChild(link);
|
|
72
|
+
links.push(link);
|
|
73
|
+
}
|
|
74
|
+
const subtitleFont = preset.subtitleFontFamily ?? preset.framework?.headings?.fontFamily ?? preset.framework?.fontFamily ?? "";
|
|
75
|
+
document.documentElement.style.setProperty("--elevasis-font-family-subtitle", subtitleFont);
|
|
76
|
+
return () => {
|
|
77
|
+
links.forEach((l) => l.remove());
|
|
78
|
+
document.documentElement.style.removeProperty("--elevasis-font-family-subtitle");
|
|
79
|
+
};
|
|
80
|
+
}, [
|
|
81
|
+
preset.fontImports,
|
|
82
|
+
preset.subtitleFontFamily,
|
|
83
|
+
preset.framework?.headings?.fontFamily,
|
|
84
|
+
preset.framework?.fontFamily
|
|
85
|
+
]);
|
|
86
|
+
const resolvedTheme = useMemo(() => {
|
|
87
|
+
const primaryHex = theme?.tokens?.primary ?? preset.dark.primary;
|
|
88
|
+
const primaryOverride = {
|
|
89
|
+
primaryColor: "primary",
|
|
90
|
+
colors: { primary: generateShades(primaryHex) }
|
|
91
|
+
};
|
|
92
|
+
let base = mergeThemeOverrides(mantineThemeOverride, primaryOverride);
|
|
93
|
+
if (preset.framework) base = mergeThemeOverrides(base, preset.framework);
|
|
94
|
+
return theme?.mantine ? mergeThemeOverrides(base, theme.mantine) : base;
|
|
95
|
+
}, [theme?.mantine, preset, theme?.tokens?.primary]);
|
|
96
|
+
const cssVariablesResolver = useMemo(
|
|
97
|
+
() => createCssVariablesResolver(theme?.tokens, theme?.preset),
|
|
98
|
+
[theme?.tokens, theme?.preset]
|
|
99
|
+
);
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
MantineProvider,
|
|
102
|
+
{
|
|
103
|
+
theme: resolvedTheme,
|
|
104
|
+
defaultColorScheme: resolvedColorScheme,
|
|
105
|
+
cssVariablesResolver,
|
|
106
|
+
children: /* @__PURE__ */ jsx(ElevasisCoreProvider, { notifications: mantineNotificationAdapter, ...coreProps, children })
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
var ElevasisProvider = ElevasisUIProvider;
|
|
111
|
+
|
|
112
|
+
export { ElevasisProvider, ElevasisUIProvider, mantineNotificationAdapter };
|