@cere/cere-design-system 0.0.21 → 0.0.23
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/index.d.mts +172 -1
- package/dist/index.d.ts +172 -1
- package/dist/index.js +364 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +363 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -137,11 +137,14 @@ __export(index_exports, {
|
|
|
137
137
|
StepLabel: () => StepLabel,
|
|
138
138
|
Stepper: () => Stepper,
|
|
139
139
|
StorageAppIcon: () => StorageAppIcon,
|
|
140
|
+
SummaryStats: () => SummaryStats,
|
|
140
141
|
Switch: () => Switch,
|
|
141
142
|
Tab: () => Tab,
|
|
142
143
|
Table: () => Table,
|
|
143
144
|
TableHeader: () => TableHeader,
|
|
144
145
|
TextField: () => TextField,
|
|
146
|
+
TimeRangeSelect: () => TimeRangeSelect,
|
|
147
|
+
TimeSeriesGraph: () => TimeSeriesGraph,
|
|
145
148
|
ToggleButton: () => ToggleButton,
|
|
146
149
|
ToggleButtonGroup: () => ToggleButtonGroup,
|
|
147
150
|
Toolbar: () => import_material37.Toolbar,
|
|
@@ -7390,13 +7393,312 @@ var MetricsChart = ({ history = [] }) => {
|
|
|
7390
7393
|
] });
|
|
7391
7394
|
};
|
|
7392
7395
|
|
|
7393
|
-
// src/components/
|
|
7396
|
+
// src/components/charts/TimeSeriesGraph/TimeSeriesGraph.tsx
|
|
7394
7397
|
var import_react33 = require("react");
|
|
7395
|
-
var
|
|
7398
|
+
var import_material67 = require("@mui/material");
|
|
7399
|
+
var import_x_charts3 = require("@mui/x-charts");
|
|
7400
|
+
var import_date_fns3 = require("date-fns");
|
|
7401
|
+
|
|
7402
|
+
// src/components/charts/TimeSeriesGraph/TimeRangeSelect.tsx
|
|
7396
7403
|
var import_material65 = require("@mui/material");
|
|
7404
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
7405
|
+
var TimeRangeSelect = ({ options: options2, value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
7406
|
+
import_material65.TextField,
|
|
7407
|
+
{
|
|
7408
|
+
select: true,
|
|
7409
|
+
size: "small",
|
|
7410
|
+
value: value ?? (options2.length > 0 ? options2[0].value : ""),
|
|
7411
|
+
onChange: (e) => onChange?.(e.target.value),
|
|
7412
|
+
"aria-label": "Time range selector",
|
|
7413
|
+
sx: { minWidth: 120 },
|
|
7414
|
+
children: options2.map((option) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_material65.MenuItem, { value: option.value, children: option.label }, option.value))
|
|
7415
|
+
}
|
|
7416
|
+
);
|
|
7417
|
+
|
|
7418
|
+
// src/components/charts/TimeSeriesGraph/SummaryStats.tsx
|
|
7419
|
+
var import_material66 = require("@mui/material");
|
|
7420
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
7421
|
+
var formatSummaryValue = (value, unit) => {
|
|
7422
|
+
const displayValue = typeof value === "number" ? value.toLocaleString() : value;
|
|
7423
|
+
return unit ? `${displayValue} ${unit}` : displayValue;
|
|
7424
|
+
};
|
|
7425
|
+
var SummaryStats = ({ items }) => {
|
|
7426
|
+
if (items.length === 0) {
|
|
7427
|
+
return null;
|
|
7428
|
+
}
|
|
7429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
7430
|
+
import_material66.Stack,
|
|
7431
|
+
{
|
|
7432
|
+
direction: "row",
|
|
7433
|
+
spacing: 3,
|
|
7434
|
+
padding: 2,
|
|
7435
|
+
flexWrap: "wrap",
|
|
7436
|
+
useFlexGap: true,
|
|
7437
|
+
role: "list",
|
|
7438
|
+
"aria-label": "Summary statistics",
|
|
7439
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
7440
|
+
import_material66.Stack,
|
|
7441
|
+
{
|
|
7442
|
+
direction: "row",
|
|
7443
|
+
alignItems: "center",
|
|
7444
|
+
spacing: 1,
|
|
7445
|
+
role: "listitem",
|
|
7446
|
+
children: [
|
|
7447
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_material66.Typography, { variant: "body2", color: "text.secondary", children: item.label }),
|
|
7448
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_material66.Typography, { variant: "h5", fontWeight: 600, children: formatSummaryValue(item.value, item.unit) })
|
|
7449
|
+
]
|
|
7450
|
+
},
|
|
7451
|
+
item.label
|
|
7452
|
+
))
|
|
7453
|
+
}
|
|
7454
|
+
);
|
|
7455
|
+
};
|
|
7456
|
+
|
|
7457
|
+
// src/components/charts/TimeSeriesGraph/TimeSeriesGraph.tsx
|
|
7458
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
7459
|
+
var ChartContainer = (0, import_material67.styled)(import_material67.Box)({
|
|
7460
|
+
position: "relative",
|
|
7461
|
+
height: 320
|
|
7462
|
+
});
|
|
7463
|
+
var LoadingOverlay = (0, import_material67.styled)(import_material67.Box)(({ theme: theme2 }) => ({
|
|
7464
|
+
position: "absolute",
|
|
7465
|
+
inset: 0,
|
|
7466
|
+
display: "flex",
|
|
7467
|
+
alignItems: "center",
|
|
7468
|
+
justifyContent: "center",
|
|
7469
|
+
backgroundColor: "rgba(255, 255, 255, 0.7)",
|
|
7470
|
+
zIndex: 1,
|
|
7471
|
+
borderRadius: theme2.shape.borderRadius
|
|
7472
|
+
}));
|
|
7473
|
+
var LegendDot = (0, import_material67.styled)(import_material67.Box, {
|
|
7474
|
+
shouldForwardProp: (prop) => prop !== "dotColor"
|
|
7475
|
+
})(({ dotColor }) => ({
|
|
7476
|
+
width: 14,
|
|
7477
|
+
height: 14,
|
|
7478
|
+
borderRadius: 4,
|
|
7479
|
+
backgroundColor: dotColor,
|
|
7480
|
+
flexShrink: 0
|
|
7481
|
+
}));
|
|
7482
|
+
var formatYAxisValue = (value) => {
|
|
7483
|
+
const absValue = Math.abs(value);
|
|
7484
|
+
if (absValue >= 1e9) {
|
|
7485
|
+
return `${(value / 1e9).toFixed(absValue % 1e9 === 0 ? 0 : 1)}B`;
|
|
7486
|
+
}
|
|
7487
|
+
if (absValue >= 1e6) {
|
|
7488
|
+
return `${(value / 1e6).toFixed(absValue % 1e6 === 0 ? 0 : 1)}M`;
|
|
7489
|
+
}
|
|
7490
|
+
if (absValue >= 1e3) {
|
|
7491
|
+
return `${(value / 1e3).toFixed(absValue % 1e3 === 0 ? 0 : 1)}K`;
|
|
7492
|
+
}
|
|
7493
|
+
return String(value);
|
|
7494
|
+
};
|
|
7495
|
+
var TWENTY_FOUR_HOURS_MS = 24 * 60 * 60 * 1e3;
|
|
7496
|
+
var inferXAxisFormat = (min, max) => {
|
|
7497
|
+
if (!min || !max) return "do MMM";
|
|
7498
|
+
const spanMs = max.getTime() - min.getTime();
|
|
7499
|
+
return spanMs <= TWENTY_FOUR_HOURS_MS ? "HH:mm" : "do MMM";
|
|
7500
|
+
};
|
|
7501
|
+
var buildDataset = (series, hiddenSeries) => {
|
|
7502
|
+
const timestampMap = /* @__PURE__ */ new Map();
|
|
7503
|
+
series.forEach((s) => {
|
|
7504
|
+
if (hiddenSeries.has(s.name)) return;
|
|
7505
|
+
s.data.forEach((dp) => {
|
|
7506
|
+
const ts = dp.timestamp.getTime();
|
|
7507
|
+
if (!timestampMap.has(ts)) {
|
|
7508
|
+
timestampMap.set(ts, { timestamp: dp.timestamp });
|
|
7509
|
+
}
|
|
7510
|
+
timestampMap.get(ts)[s.name] = dp.value;
|
|
7511
|
+
});
|
|
7512
|
+
});
|
|
7513
|
+
return Array.from(timestampMap.values()).sort(
|
|
7514
|
+
(a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
7515
|
+
);
|
|
7516
|
+
};
|
|
7517
|
+
var TimeSeriesGraph = ({
|
|
7518
|
+
title,
|
|
7519
|
+
series,
|
|
7520
|
+
timeRangeOptions,
|
|
7521
|
+
selectedTimeRange,
|
|
7522
|
+
onTimeRangeChange,
|
|
7523
|
+
summaryItems,
|
|
7524
|
+
showSummary = true,
|
|
7525
|
+
headerAction,
|
|
7526
|
+
loading = false,
|
|
7527
|
+
xAxisFormat
|
|
7528
|
+
}) => {
|
|
7529
|
+
const theme2 = (0, import_material67.useTheme)();
|
|
7530
|
+
const [hiddenSeries, setHiddenSeries] = (0, import_react33.useState)(/* @__PURE__ */ new Set());
|
|
7531
|
+
const dataset = (0, import_react33.useMemo)(() => buildDataset(series, hiddenSeries), [series, hiddenSeries]);
|
|
7532
|
+
const visibleSeries = (0, import_react33.useMemo)(
|
|
7533
|
+
() => series.filter((s) => !hiddenSeries.has(s.name)),
|
|
7534
|
+
[series, hiddenSeries]
|
|
7535
|
+
);
|
|
7536
|
+
const chartColors = (0, import_react33.useMemo)(() => visibleSeries.map((s) => s.color), [visibleSeries]);
|
|
7537
|
+
const handleLegendToggle = (0, import_react33.useCallback)((seriesName) => {
|
|
7538
|
+
setHiddenSeries((prev) => {
|
|
7539
|
+
const next = new Set(prev);
|
|
7540
|
+
if (next.has(seriesName)) {
|
|
7541
|
+
next.delete(seriesName);
|
|
7542
|
+
} else {
|
|
7543
|
+
next.add(seriesName);
|
|
7544
|
+
}
|
|
7545
|
+
return next;
|
|
7546
|
+
});
|
|
7547
|
+
}, []);
|
|
7548
|
+
const timeBounds = (0, import_react33.useMemo)(() => {
|
|
7549
|
+
if (dataset.length === 0) return { min: void 0, max: void 0 };
|
|
7550
|
+
const timestamps = dataset.map((row) => row.timestamp.getTime());
|
|
7551
|
+
return {
|
|
7552
|
+
min: new Date(Math.min(...timestamps)),
|
|
7553
|
+
max: new Date(Math.max(...timestamps))
|
|
7554
|
+
};
|
|
7555
|
+
}, [dataset]);
|
|
7556
|
+
const resolvedXAxisFormat = (0, import_react33.useMemo)(
|
|
7557
|
+
() => xAxisFormat ?? inferXAxisFormat(timeBounds.min, timeBounds.max),
|
|
7558
|
+
[xAxisFormat, timeBounds.min, timeBounds.max]
|
|
7559
|
+
);
|
|
7560
|
+
const hasData = dataset.length > 0;
|
|
7561
|
+
const shouldShowSummary = showSummary && summaryItems && summaryItems.length > 0;
|
|
7562
|
+
const headerActionElement = /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_material67.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
7563
|
+
headerAction,
|
|
7564
|
+
timeRangeOptions && timeRangeOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7565
|
+
TimeRangeSelect,
|
|
7566
|
+
{
|
|
7567
|
+
options: timeRangeOptions,
|
|
7568
|
+
value: selectedTimeRange,
|
|
7569
|
+
onChange: onTimeRangeChange
|
|
7570
|
+
}
|
|
7571
|
+
)
|
|
7572
|
+
] });
|
|
7573
|
+
const showHeader = !!title || !!headerAction || timeRangeOptions && timeRangeOptions.length > 0;
|
|
7574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
7575
|
+
import_material67.Card,
|
|
7576
|
+
{
|
|
7577
|
+
"aria-label": title ? `Line chart showing ${title}` : "Line chart",
|
|
7578
|
+
role: "figure",
|
|
7579
|
+
children: [
|
|
7580
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7581
|
+
import_material67.CardHeader,
|
|
7582
|
+
{
|
|
7583
|
+
title,
|
|
7584
|
+
titleTypographyProps: {
|
|
7585
|
+
variant: "subtitle1",
|
|
7586
|
+
fontWeight: 500
|
|
7587
|
+
},
|
|
7588
|
+
action: headerActionElement
|
|
7589
|
+
}
|
|
7590
|
+
),
|
|
7591
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_material67.CardMedia, { children: [
|
|
7592
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(ChartContainer, { children: [
|
|
7593
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LoadingOverlay, { role: "status", "aria-label": "Loading chart data", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_material67.CircularProgress, { size: 40 }) }),
|
|
7594
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7595
|
+
import_x_charts3.LineChart,
|
|
7596
|
+
{
|
|
7597
|
+
dataset,
|
|
7598
|
+
axisHighlight: { x: "line", y: "none" },
|
|
7599
|
+
grid: { horizontal: true, vertical: false },
|
|
7600
|
+
margin: { top: 10, right: 20, bottom: 40, left: 50 },
|
|
7601
|
+
colors: chartColors.length > 0 ? chartColors : [theme2.palette.primary.main],
|
|
7602
|
+
slots: {
|
|
7603
|
+
noDataOverlay: () => null
|
|
7604
|
+
},
|
|
7605
|
+
tooltip: { trigger: hasData ? "axis" : "none" },
|
|
7606
|
+
yAxis: [
|
|
7607
|
+
{
|
|
7608
|
+
disableLine: true,
|
|
7609
|
+
disableTicks: true,
|
|
7610
|
+
min: hasData ? void 0 : 0,
|
|
7611
|
+
max: hasData ? void 0 : 100,
|
|
7612
|
+
tickNumber: hasData ? void 0 : 5,
|
|
7613
|
+
valueFormatter: (value) => formatYAxisValue(value || 0),
|
|
7614
|
+
tickLabelStyle: {
|
|
7615
|
+
fontSize: 10
|
|
7616
|
+
}
|
|
7617
|
+
}
|
|
7618
|
+
],
|
|
7619
|
+
xAxis: [
|
|
7620
|
+
{
|
|
7621
|
+
dataKey: "timestamp",
|
|
7622
|
+
scaleType: "time",
|
|
7623
|
+
min: timeBounds.min,
|
|
7624
|
+
max: timeBounds.max,
|
|
7625
|
+
disableLine: true,
|
|
7626
|
+
disableTicks: true,
|
|
7627
|
+
valueFormatter: (date) => (0, import_date_fns3.format)(date, resolvedXAxisFormat),
|
|
7628
|
+
tickLabelStyle: {
|
|
7629
|
+
fontSize: 10
|
|
7630
|
+
}
|
|
7631
|
+
}
|
|
7632
|
+
],
|
|
7633
|
+
series: visibleSeries.map((s) => ({
|
|
7634
|
+
curve: "linear",
|
|
7635
|
+
dataKey: s.name,
|
|
7636
|
+
label: s.name,
|
|
7637
|
+
showMark: false,
|
|
7638
|
+
connectNulls: false
|
|
7639
|
+
})),
|
|
7640
|
+
slotProps: {
|
|
7641
|
+
legend: { hidden: true }
|
|
7642
|
+
}
|
|
7643
|
+
}
|
|
7644
|
+
)
|
|
7645
|
+
] }),
|
|
7646
|
+
series.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7647
|
+
import_material67.Stack,
|
|
7648
|
+
{
|
|
7649
|
+
direction: "row",
|
|
7650
|
+
spacing: 2,
|
|
7651
|
+
justifyContent: "center",
|
|
7652
|
+
paddingY: 1,
|
|
7653
|
+
flexWrap: "wrap",
|
|
7654
|
+
useFlexGap: true,
|
|
7655
|
+
role: "list",
|
|
7656
|
+
"aria-label": "Chart legend",
|
|
7657
|
+
children: series.map((s) => {
|
|
7658
|
+
const isHidden = hiddenSeries.has(s.name);
|
|
7659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
7660
|
+
import_material67.Stack,
|
|
7661
|
+
{
|
|
7662
|
+
direction: "row",
|
|
7663
|
+
spacing: 1,
|
|
7664
|
+
alignItems: "center",
|
|
7665
|
+
role: "listitem",
|
|
7666
|
+
onClick: () => handleLegendToggle(s.name),
|
|
7667
|
+
sx: {
|
|
7668
|
+
cursor: "pointer",
|
|
7669
|
+
opacity: isHidden ? 0.4 : 1,
|
|
7670
|
+
transition: "opacity 0.2s ease",
|
|
7671
|
+
userSelect: "none"
|
|
7672
|
+
},
|
|
7673
|
+
"aria-pressed": !isHidden,
|
|
7674
|
+
"aria-label": `Toggle ${s.name} visibility`,
|
|
7675
|
+
children: [
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LegendDot, { dotColor: s.color }),
|
|
7677
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_material67.Typography, { variant: "body2", children: s.name })
|
|
7678
|
+
]
|
|
7679
|
+
},
|
|
7680
|
+
s.name
|
|
7681
|
+
);
|
|
7682
|
+
})
|
|
7683
|
+
}
|
|
7684
|
+
)
|
|
7685
|
+
] }),
|
|
7686
|
+
shouldShowSummary && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
7687
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_material67.Divider, {}),
|
|
7688
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SummaryStats, { items: summaryItems })
|
|
7689
|
+
] })
|
|
7690
|
+
]
|
|
7691
|
+
}
|
|
7692
|
+
);
|
|
7693
|
+
};
|
|
7694
|
+
|
|
7695
|
+
// src/components/third-party/FlowEditor.tsx
|
|
7696
|
+
var import_react34 = require("react");
|
|
7697
|
+
var import_reactflow = __toESM(require("reactflow"));
|
|
7698
|
+
var import_material68 = require("@mui/material");
|
|
7397
7699
|
var import_styles40 = require("@mui/material/styles");
|
|
7398
7700
|
var import_reactflow2 = require("reactflow");
|
|
7399
|
-
var
|
|
7701
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
7400
7702
|
var FlowEditor = ({
|
|
7401
7703
|
nodes,
|
|
7402
7704
|
edges,
|
|
@@ -7414,7 +7716,7 @@ var FlowEditor = ({
|
|
|
7414
7716
|
...reactFlowProps
|
|
7415
7717
|
}) => {
|
|
7416
7718
|
const theme2 = (0, import_styles40.useTheme)();
|
|
7417
|
-
const handleInit = (0,
|
|
7719
|
+
const handleInit = (0, import_react34.useCallback)(
|
|
7418
7720
|
(instance) => {
|
|
7419
7721
|
if (onInit) {
|
|
7420
7722
|
onInit(instance);
|
|
@@ -7422,8 +7724,8 @@ var FlowEditor = ({
|
|
|
7422
7724
|
},
|
|
7423
7725
|
[onInit]
|
|
7424
7726
|
);
|
|
7425
|
-
return /* @__PURE__ */ (0,
|
|
7426
|
-
|
|
7727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_reactflow.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7728
|
+
import_material68.Box,
|
|
7427
7729
|
{
|
|
7428
7730
|
sx: {
|
|
7429
7731
|
width: "100%",
|
|
@@ -7435,7 +7737,7 @@ var FlowEditor = ({
|
|
|
7435
7737
|
...containerProps?.sx
|
|
7436
7738
|
},
|
|
7437
7739
|
...containerProps,
|
|
7438
|
-
children: /* @__PURE__ */ (0,
|
|
7740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
7439
7741
|
import_reactflow.default,
|
|
7440
7742
|
{
|
|
7441
7743
|
nodes,
|
|
@@ -7457,7 +7759,7 @@ var FlowEditor = ({
|
|
|
7457
7759
|
},
|
|
7458
7760
|
...reactFlowProps,
|
|
7459
7761
|
children: [
|
|
7460
|
-
showBackground && /* @__PURE__ */ (0,
|
|
7762
|
+
showBackground && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7461
7763
|
import_reactflow.Background,
|
|
7462
7764
|
{
|
|
7463
7765
|
variant: backgroundVariant,
|
|
@@ -7466,8 +7768,8 @@ var FlowEditor = ({
|
|
|
7466
7768
|
color: theme2.palette.divider
|
|
7467
7769
|
}
|
|
7468
7770
|
),
|
|
7469
|
-
showControls && /* @__PURE__ */ (0,
|
|
7470
|
-
showMinimap && /* @__PURE__ */ (0,
|
|
7771
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_reactflow.Controls, {}),
|
|
7772
|
+
showMinimap && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7471
7773
|
import_reactflow.MiniMap,
|
|
7472
7774
|
{
|
|
7473
7775
|
nodeColor: (node) => {
|
|
@@ -7490,15 +7792,15 @@ var FlowEditor = ({
|
|
|
7490
7792
|
};
|
|
7491
7793
|
|
|
7492
7794
|
// src/components/third-party/CodeEditor.tsx
|
|
7493
|
-
var
|
|
7494
|
-
var
|
|
7495
|
-
var
|
|
7795
|
+
var import_react35 = require("react");
|
|
7796
|
+
var import_react36 = __toESM(require("@monaco-editor/react"));
|
|
7797
|
+
var import_material69 = require("@mui/material");
|
|
7496
7798
|
var import_Fullscreen = __toESM(require("@mui/icons-material/Fullscreen"));
|
|
7497
7799
|
var import_FullscreenExit = __toESM(require("@mui/icons-material/FullscreenExit"));
|
|
7498
7800
|
var import_ErrorOutline = __toESM(require("@mui/icons-material/ErrorOutline"));
|
|
7499
7801
|
var import_ExpandMore3 = __toESM(require("@mui/icons-material/ExpandMore"));
|
|
7500
7802
|
var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"));
|
|
7501
|
-
var
|
|
7803
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
7502
7804
|
var configureTypeScript = (monaco) => {
|
|
7503
7805
|
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
7504
7806
|
target: monaco.languages.typescript.ScriptTarget.ES2020,
|
|
@@ -7542,16 +7844,16 @@ var CodeEditor = ({
|
|
|
7542
7844
|
containerProps,
|
|
7543
7845
|
typeDefinitions
|
|
7544
7846
|
}) => {
|
|
7545
|
-
const [isEditorReady, setIsEditorReady] = (0,
|
|
7546
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
7547
|
-
const [isFullscreen, setIsFullscreen] = (0,
|
|
7548
|
-
const [tsCode, setTsCode] = (0,
|
|
7549
|
-
const [actualHeight, setActualHeight] = (0,
|
|
7847
|
+
const [isEditorReady, setIsEditorReady] = (0, import_react35.useState)(false);
|
|
7848
|
+
const [validationErrors, setValidationErrors] = (0, import_react35.useState)([]);
|
|
7849
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react35.useState)(false);
|
|
7850
|
+
const [tsCode, setTsCode] = (0, import_react35.useState)(value);
|
|
7851
|
+
const [actualHeight, setActualHeight] = (0, import_react35.useState)(
|
|
7550
7852
|
typeof height === "number" ? `${height}px` : height
|
|
7551
7853
|
);
|
|
7552
|
-
const [showProblems, setShowProblems] = (0,
|
|
7553
|
-
const [hasUserToggledProblems, setHasUserToggledProblems] = (0,
|
|
7554
|
-
(0,
|
|
7854
|
+
const [showProblems, setShowProblems] = (0, import_react35.useState)(false);
|
|
7855
|
+
const [hasUserToggledProblems, setHasUserToggledProblems] = (0, import_react35.useState)(false);
|
|
7856
|
+
(0, import_react35.useEffect)(() => {
|
|
7555
7857
|
if (hasUserToggledProblems) return;
|
|
7556
7858
|
if (validationErrors.length > 0) {
|
|
7557
7859
|
setShowProblems(true);
|
|
@@ -7559,25 +7861,25 @@ var CodeEditor = ({
|
|
|
7559
7861
|
setShowProblems(false);
|
|
7560
7862
|
}
|
|
7561
7863
|
}, [validationErrors, hasUserToggledProblems]);
|
|
7562
|
-
const internalEditorRef = (0,
|
|
7563
|
-
const internalMonacoRef = (0,
|
|
7864
|
+
const internalEditorRef = (0, import_react35.useRef)(null);
|
|
7865
|
+
const internalMonacoRef = (0, import_react35.useRef)(null);
|
|
7564
7866
|
const finalEditorRef = editorRef || internalEditorRef;
|
|
7565
7867
|
const finalMonacoRef = monacoRef || internalMonacoRef;
|
|
7566
|
-
(0,
|
|
7868
|
+
(0, import_react35.useEffect)(() => {
|
|
7567
7869
|
if (isFullscreen) {
|
|
7568
7870
|
setActualHeight("calc(100vh - 80px)");
|
|
7569
7871
|
} else {
|
|
7570
7872
|
setActualHeight(typeof height === "number" ? `${height}px` : height);
|
|
7571
7873
|
}
|
|
7572
7874
|
}, [height, isFullscreen]);
|
|
7573
|
-
const toggleFullscreen = (0,
|
|
7875
|
+
const toggleFullscreen = (0, import_react35.useCallback)(() => {
|
|
7574
7876
|
const newFullscreenState = !isFullscreen;
|
|
7575
7877
|
setIsFullscreen(newFullscreenState);
|
|
7576
7878
|
if (onFullscreenChange) {
|
|
7577
7879
|
onFullscreenChange(newFullscreenState);
|
|
7578
7880
|
}
|
|
7579
7881
|
}, [isFullscreen, onFullscreenChange]);
|
|
7580
|
-
const gotoMarker = (0,
|
|
7882
|
+
const gotoMarker = (0, import_react35.useCallback)(
|
|
7581
7883
|
(marker) => {
|
|
7582
7884
|
const ed = finalEditorRef?.current;
|
|
7583
7885
|
if (!ed) return;
|
|
@@ -7592,7 +7894,7 @@ var CodeEditor = ({
|
|
|
7592
7894
|
},
|
|
7593
7895
|
[finalEditorRef]
|
|
7594
7896
|
);
|
|
7595
|
-
(0,
|
|
7897
|
+
(0, import_react35.useEffect)(() => {
|
|
7596
7898
|
if (!isFullscreen) return;
|
|
7597
7899
|
function escapeHandler(event) {
|
|
7598
7900
|
if (event.key === "Escape") {
|
|
@@ -7609,7 +7911,7 @@ var CodeEditor = ({
|
|
|
7609
7911
|
window.removeEventListener("keydown", escapeHandler, { capture: true });
|
|
7610
7912
|
};
|
|
7611
7913
|
}, [isFullscreen, onFullscreenChange]);
|
|
7612
|
-
const handleEditorDidMount = (0,
|
|
7914
|
+
const handleEditorDidMount = (0, import_react35.useCallback)(
|
|
7613
7915
|
(editor, monaco) => {
|
|
7614
7916
|
console.log("CodeEditor: onMount called", { editor: !!editor, monaco: !!monaco });
|
|
7615
7917
|
try {
|
|
@@ -7663,7 +7965,7 @@ var CodeEditor = ({
|
|
|
7663
7965
|
},
|
|
7664
7966
|
[isFullscreen, onFullscreenChange, onValidate, onMount, finalEditorRef, finalMonacoRef]
|
|
7665
7967
|
);
|
|
7666
|
-
(0,
|
|
7968
|
+
(0, import_react35.useEffect)(() => {
|
|
7667
7969
|
if (!isEditorReady || !finalMonacoRef?.current || !typeDefinitions) return;
|
|
7668
7970
|
const monaco = finalMonacoRef.current;
|
|
7669
7971
|
const definitions = Array.isArray(typeDefinitions) ? typeDefinitions : [typeDefinitions];
|
|
@@ -7685,7 +7987,7 @@ var CodeEditor = ({
|
|
|
7685
7987
|
setTsCode(valueStr);
|
|
7686
7988
|
onChange(valueStr);
|
|
7687
7989
|
};
|
|
7688
|
-
(0,
|
|
7990
|
+
(0, import_react35.useEffect)(() => {
|
|
7689
7991
|
if (value !== tsCode) {
|
|
7690
7992
|
setTsCode(value);
|
|
7691
7993
|
if (isEditorReady && finalEditorRef?.current) {
|
|
@@ -7710,8 +8012,8 @@ var CodeEditor = ({
|
|
|
7710
8012
|
theme: themeProp || "vs",
|
|
7711
8013
|
...options2
|
|
7712
8014
|
};
|
|
7713
|
-
return /* @__PURE__ */ (0,
|
|
7714
|
-
|
|
8015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8016
|
+
import_material69.Box,
|
|
7715
8017
|
{
|
|
7716
8018
|
sx: {
|
|
7717
8019
|
display: "flex",
|
|
@@ -7731,8 +8033,8 @@ var CodeEditor = ({
|
|
|
7731
8033
|
pb: isFullscreen ? 2 : 0,
|
|
7732
8034
|
overflow: isFullscreen ? "hidden" : "visible"
|
|
7733
8035
|
},
|
|
7734
|
-
children: /* @__PURE__ */ (0,
|
|
7735
|
-
|
|
8036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8037
|
+
import_material69.Box,
|
|
7736
8038
|
{
|
|
7737
8039
|
sx: {
|
|
7738
8040
|
flex: 1,
|
|
@@ -7747,8 +8049,8 @@ var CodeEditor = ({
|
|
|
7747
8049
|
},
|
|
7748
8050
|
...containerProps,
|
|
7749
8051
|
children: [
|
|
7750
|
-
/* @__PURE__ */ (0,
|
|
7751
|
-
|
|
8052
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Tooltip, { title: isFullscreen ? "Exit Fullscreen" : "Fullscreen", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8053
|
+
import_material69.IconButton,
|
|
7752
8054
|
{
|
|
7753
8055
|
onClick: toggleFullscreen,
|
|
7754
8056
|
size: "small",
|
|
@@ -7765,11 +8067,11 @@ var CodeEditor = ({
|
|
|
7765
8067
|
},
|
|
7766
8068
|
boxShadow: 1
|
|
7767
8069
|
},
|
|
7768
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
8070
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_FullscreenExit.default, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_Fullscreen.default, { fontSize: "small" })
|
|
7769
8071
|
}
|
|
7770
8072
|
) }),
|
|
7771
|
-
/* @__PURE__ */ (0,
|
|
7772
|
-
|
|
8073
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8074
|
+
import_material69.Box,
|
|
7773
8075
|
{
|
|
7774
8076
|
sx: {
|
|
7775
8077
|
flex: 1,
|
|
@@ -7780,8 +8082,8 @@ var CodeEditor = ({
|
|
|
7780
8082
|
position: "relative",
|
|
7781
8083
|
height: isFullscreen ? "100%" : actualHeight
|
|
7782
8084
|
},
|
|
7783
|
-
children: /* @__PURE__ */ (0,
|
|
7784
|
-
|
|
8085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8086
|
+
import_react36.default,
|
|
7785
8087
|
{
|
|
7786
8088
|
height: "100%",
|
|
7787
8089
|
defaultLanguage: language,
|
|
@@ -7791,7 +8093,7 @@ var CodeEditor = ({
|
|
|
7791
8093
|
onMount: handleEditorDidMount,
|
|
7792
8094
|
theme: themeProp || "vs",
|
|
7793
8095
|
options: defaultOptions,
|
|
7794
|
-
loading: /* @__PURE__ */ (0,
|
|
8096
|
+
loading: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { p: 2, textAlign: "center" }, children: "Loading Monaco Editor..." }),
|
|
7795
8097
|
beforeMount: (monaco) => {
|
|
7796
8098
|
console.log("CodeEditor: beforeMount called", { monaco: !!monaco });
|
|
7797
8099
|
}
|
|
@@ -7799,8 +8101,8 @@ var CodeEditor = ({
|
|
|
7799
8101
|
)
|
|
7800
8102
|
}
|
|
7801
8103
|
),
|
|
7802
|
-
validationErrors.length > 0 && /* @__PURE__ */ (0,
|
|
7803
|
-
|
|
8104
|
+
validationErrors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8105
|
+
import_material69.Box,
|
|
7804
8106
|
{
|
|
7805
8107
|
sx: {
|
|
7806
8108
|
borderTop: 1,
|
|
@@ -7813,8 +8115,8 @@ var CodeEditor = ({
|
|
|
7813
8115
|
transition: "max-height 0.2s ease"
|
|
7814
8116
|
},
|
|
7815
8117
|
children: [
|
|
7816
|
-
/* @__PURE__ */ (0,
|
|
7817
|
-
|
|
8118
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8119
|
+
import_material69.Box,
|
|
7818
8120
|
{
|
|
7819
8121
|
sx: {
|
|
7820
8122
|
display: "flex",
|
|
@@ -7828,16 +8130,16 @@ var CodeEditor = ({
|
|
|
7828
8130
|
color: "text.secondary"
|
|
7829
8131
|
},
|
|
7830
8132
|
children: [
|
|
7831
|
-
/* @__PURE__ */ (0,
|
|
7832
|
-
/* @__PURE__ */ (0,
|
|
7833
|
-
/* @__PURE__ */ (0,
|
|
8133
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_ErrorOutline.default, { color: "error", fontSize: "small" }),
|
|
8134
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { fontWeight: 600, color: "text.primary" }, children: "Problems" }),
|
|
8135
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_material69.Box, { sx: { ml: 1 }, children: [
|
|
7834
8136
|
validationErrors.length,
|
|
7835
8137
|
" error",
|
|
7836
8138
|
validationErrors.length > 1 ? "s" : ""
|
|
7837
8139
|
] }),
|
|
7838
|
-
/* @__PURE__ */ (0,
|
|
7839
|
-
/* @__PURE__ */ (0,
|
|
7840
|
-
|
|
8140
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { flex: 1 } }),
|
|
8141
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8142
|
+
import_material69.IconButton,
|
|
7841
8143
|
{
|
|
7842
8144
|
size: "small",
|
|
7843
8145
|
"aria-label": "Toggle problems panel",
|
|
@@ -7845,14 +8147,14 @@ var CodeEditor = ({
|
|
|
7845
8147
|
setHasUserToggledProblems(true);
|
|
7846
8148
|
setShowProblems((s) => !s);
|
|
7847
8149
|
},
|
|
7848
|
-
children: showProblems ? /* @__PURE__ */ (0,
|
|
8150
|
+
children: showProblems ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_ExpandMore3.default, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_ExpandLess.default, { fontSize: "small" })
|
|
7849
8151
|
}
|
|
7850
8152
|
)
|
|
7851
8153
|
]
|
|
7852
8154
|
}
|
|
7853
8155
|
),
|
|
7854
|
-
showProblems && /* @__PURE__ */ (0,
|
|
7855
|
-
|
|
8156
|
+
showProblems && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { overflow: "auto" }, children: validationErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8157
|
+
import_material69.Box,
|
|
7856
8158
|
{
|
|
7857
8159
|
onClick: () => gotoMarker(error),
|
|
7858
8160
|
sx: {
|
|
@@ -7868,12 +8170,12 @@ var CodeEditor = ({
|
|
|
7868
8170
|
fontSize: "0.85rem"
|
|
7869
8171
|
},
|
|
7870
8172
|
children: [
|
|
7871
|
-
/* @__PURE__ */ (0,
|
|
7872
|
-
/* @__PURE__ */ (0,
|
|
8173
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_ErrorOutline.default, { color: "error", sx: { fontSize: 18 } }),
|
|
8174
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_material69.Box, { sx: { color: "text.secondary", width: 64 }, children: [
|
|
7873
8175
|
"Line ",
|
|
7874
8176
|
error.startLineNumber
|
|
7875
8177
|
] }),
|
|
7876
|
-
/* @__PURE__ */ (0,
|
|
8178
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { color: "text.primary", flex: 1, minWidth: 0 }, children: error.message })
|
|
7877
8179
|
]
|
|
7878
8180
|
},
|
|
7879
8181
|
`${error.startLineNumber}-${error.startColumn}-${index}`
|
|
@@ -7999,11 +8301,14 @@ var import_reactflow3 = require("reactflow");
|
|
|
7999
8301
|
StepLabel,
|
|
8000
8302
|
Stepper,
|
|
8001
8303
|
StorageAppIcon,
|
|
8304
|
+
SummaryStats,
|
|
8002
8305
|
Switch,
|
|
8003
8306
|
Tab,
|
|
8004
8307
|
Table,
|
|
8005
8308
|
TableHeader,
|
|
8006
8309
|
TextField,
|
|
8310
|
+
TimeRangeSelect,
|
|
8311
|
+
TimeSeriesGraph,
|
|
8007
8312
|
ToggleButton,
|
|
8008
8313
|
ToggleButtonGroup,
|
|
8009
8314
|
Toolbar,
|