@cere/cere-design-system 0.0.21 → 0.0.22
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 +165 -1
- package/dist/index.d.ts +165 -1
- package/dist/index.js +353 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -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,301 @@ 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 buildDataset = (series, hiddenSeries) => {
|
|
7496
|
+
const timestampMap = /* @__PURE__ */ new Map();
|
|
7497
|
+
series.forEach((s) => {
|
|
7498
|
+
if (hiddenSeries.has(s.name)) return;
|
|
7499
|
+
s.data.forEach((dp) => {
|
|
7500
|
+
const ts = dp.timestamp.getTime();
|
|
7501
|
+
if (!timestampMap.has(ts)) {
|
|
7502
|
+
timestampMap.set(ts, { timestamp: dp.timestamp });
|
|
7503
|
+
}
|
|
7504
|
+
timestampMap.get(ts)[s.name] = dp.value;
|
|
7505
|
+
});
|
|
7506
|
+
});
|
|
7507
|
+
return Array.from(timestampMap.values()).sort(
|
|
7508
|
+
(a, b) => a.timestamp.getTime() - b.timestamp.getTime()
|
|
7509
|
+
);
|
|
7510
|
+
};
|
|
7511
|
+
var TimeSeriesGraph = ({
|
|
7512
|
+
title,
|
|
7513
|
+
series,
|
|
7514
|
+
timeRangeOptions,
|
|
7515
|
+
selectedTimeRange,
|
|
7516
|
+
onTimeRangeChange,
|
|
7517
|
+
summaryItems,
|
|
7518
|
+
showSummary = true,
|
|
7519
|
+
headerAction,
|
|
7520
|
+
loading = false
|
|
7521
|
+
}) => {
|
|
7522
|
+
const theme2 = (0, import_material67.useTheme)();
|
|
7523
|
+
const [hiddenSeries, setHiddenSeries] = (0, import_react33.useState)(/* @__PURE__ */ new Set());
|
|
7524
|
+
const dataset = (0, import_react33.useMemo)(() => buildDataset(series, hiddenSeries), [series, hiddenSeries]);
|
|
7525
|
+
const visibleSeries = (0, import_react33.useMemo)(
|
|
7526
|
+
() => series.filter((s) => !hiddenSeries.has(s.name)),
|
|
7527
|
+
[series, hiddenSeries]
|
|
7528
|
+
);
|
|
7529
|
+
const chartColors = (0, import_react33.useMemo)(() => visibleSeries.map((s) => s.color), [visibleSeries]);
|
|
7530
|
+
const handleLegendToggle = (0, import_react33.useCallback)((seriesName) => {
|
|
7531
|
+
setHiddenSeries((prev) => {
|
|
7532
|
+
const next = new Set(prev);
|
|
7533
|
+
if (next.has(seriesName)) {
|
|
7534
|
+
next.delete(seriesName);
|
|
7535
|
+
} else {
|
|
7536
|
+
next.add(seriesName);
|
|
7537
|
+
}
|
|
7538
|
+
return next;
|
|
7539
|
+
});
|
|
7540
|
+
}, []);
|
|
7541
|
+
const timeBounds = (0, import_react33.useMemo)(() => {
|
|
7542
|
+
if (dataset.length === 0) return { min: void 0, max: void 0 };
|
|
7543
|
+
const timestamps = dataset.map((row) => row.timestamp.getTime());
|
|
7544
|
+
return {
|
|
7545
|
+
min: new Date(Math.min(...timestamps)),
|
|
7546
|
+
max: new Date(Math.max(...timestamps))
|
|
7547
|
+
};
|
|
7548
|
+
}, [dataset]);
|
|
7549
|
+
const hasData = dataset.length > 0;
|
|
7550
|
+
const shouldShowSummary = showSummary && summaryItems && summaryItems.length > 0;
|
|
7551
|
+
const headerActionElement = /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_material67.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
7552
|
+
headerAction,
|
|
7553
|
+
timeRangeOptions && timeRangeOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7554
|
+
TimeRangeSelect,
|
|
7555
|
+
{
|
|
7556
|
+
options: timeRangeOptions,
|
|
7557
|
+
value: selectedTimeRange,
|
|
7558
|
+
onChange: onTimeRangeChange
|
|
7559
|
+
}
|
|
7560
|
+
)
|
|
7561
|
+
] });
|
|
7562
|
+
const showHeader = !!title || !!headerAction || timeRangeOptions && timeRangeOptions.length > 0;
|
|
7563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
7564
|
+
import_material67.Card,
|
|
7565
|
+
{
|
|
7566
|
+
"aria-label": title ? `Line chart showing ${title}` : "Line chart",
|
|
7567
|
+
role: "figure",
|
|
7568
|
+
children: [
|
|
7569
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7570
|
+
import_material67.CardHeader,
|
|
7571
|
+
{
|
|
7572
|
+
title,
|
|
7573
|
+
titleTypographyProps: {
|
|
7574
|
+
variant: "subtitle1",
|
|
7575
|
+
fontWeight: 500
|
|
7576
|
+
},
|
|
7577
|
+
action: headerActionElement
|
|
7578
|
+
}
|
|
7579
|
+
),
|
|
7580
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_material67.CardMedia, { children: [
|
|
7581
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(ChartContainer, { children: [
|
|
7582
|
+
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 }) }),
|
|
7583
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7584
|
+
import_x_charts3.LineChart,
|
|
7585
|
+
{
|
|
7586
|
+
dataset,
|
|
7587
|
+
axisHighlight: { x: "line", y: "none" },
|
|
7588
|
+
grid: { horizontal: true, vertical: false },
|
|
7589
|
+
margin: { top: 10, right: 20, bottom: 40, left: 50 },
|
|
7590
|
+
colors: chartColors.length > 0 ? chartColors : [theme2.palette.primary.main],
|
|
7591
|
+
slots: {
|
|
7592
|
+
noDataOverlay: () => null
|
|
7593
|
+
},
|
|
7594
|
+
tooltip: { trigger: hasData ? "axis" : "none" },
|
|
7595
|
+
yAxis: [
|
|
7596
|
+
{
|
|
7597
|
+
disableLine: true,
|
|
7598
|
+
disableTicks: true,
|
|
7599
|
+
min: hasData ? void 0 : 0,
|
|
7600
|
+
max: hasData ? void 0 : 100,
|
|
7601
|
+
tickNumber: hasData ? void 0 : 5,
|
|
7602
|
+
valueFormatter: (value) => formatYAxisValue(value || 0),
|
|
7603
|
+
tickLabelStyle: {
|
|
7604
|
+
fontSize: 10
|
|
7605
|
+
}
|
|
7606
|
+
}
|
|
7607
|
+
],
|
|
7608
|
+
xAxis: [
|
|
7609
|
+
{
|
|
7610
|
+
dataKey: "timestamp",
|
|
7611
|
+
scaleType: "time",
|
|
7612
|
+
min: timeBounds.min,
|
|
7613
|
+
max: timeBounds.max,
|
|
7614
|
+
disableLine: true,
|
|
7615
|
+
disableTicks: true,
|
|
7616
|
+
valueFormatter: (date) => (0, import_date_fns3.format)(date, "do MMM"),
|
|
7617
|
+
tickLabelStyle: {
|
|
7618
|
+
fontSize: 10
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
],
|
|
7622
|
+
series: visibleSeries.map((s) => ({
|
|
7623
|
+
curve: "linear",
|
|
7624
|
+
dataKey: s.name,
|
|
7625
|
+
label: s.name,
|
|
7626
|
+
showMark: false,
|
|
7627
|
+
connectNulls: false
|
|
7628
|
+
})),
|
|
7629
|
+
slotProps: {
|
|
7630
|
+
legend: { hidden: true }
|
|
7631
|
+
}
|
|
7632
|
+
}
|
|
7633
|
+
)
|
|
7634
|
+
] }),
|
|
7635
|
+
series.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7636
|
+
import_material67.Stack,
|
|
7637
|
+
{
|
|
7638
|
+
direction: "row",
|
|
7639
|
+
spacing: 2,
|
|
7640
|
+
justifyContent: "center",
|
|
7641
|
+
paddingY: 1,
|
|
7642
|
+
flexWrap: "wrap",
|
|
7643
|
+
useFlexGap: true,
|
|
7644
|
+
role: "list",
|
|
7645
|
+
"aria-label": "Chart legend",
|
|
7646
|
+
children: series.map((s) => {
|
|
7647
|
+
const isHidden = hiddenSeries.has(s.name);
|
|
7648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
7649
|
+
import_material67.Stack,
|
|
7650
|
+
{
|
|
7651
|
+
direction: "row",
|
|
7652
|
+
spacing: 1,
|
|
7653
|
+
alignItems: "center",
|
|
7654
|
+
role: "listitem",
|
|
7655
|
+
onClick: () => handleLegendToggle(s.name),
|
|
7656
|
+
sx: {
|
|
7657
|
+
cursor: "pointer",
|
|
7658
|
+
opacity: isHidden ? 0.4 : 1,
|
|
7659
|
+
transition: "opacity 0.2s ease",
|
|
7660
|
+
userSelect: "none"
|
|
7661
|
+
},
|
|
7662
|
+
"aria-pressed": !isHidden,
|
|
7663
|
+
"aria-label": `Toggle ${s.name} visibility`,
|
|
7664
|
+
children: [
|
|
7665
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LegendDot, { dotColor: s.color }),
|
|
7666
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_material67.Typography, { variant: "body2", children: s.name })
|
|
7667
|
+
]
|
|
7668
|
+
},
|
|
7669
|
+
s.name
|
|
7670
|
+
);
|
|
7671
|
+
})
|
|
7672
|
+
}
|
|
7673
|
+
)
|
|
7674
|
+
] }),
|
|
7675
|
+
shouldShowSummary && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_material67.Divider, {}),
|
|
7677
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SummaryStats, { items: summaryItems })
|
|
7678
|
+
] })
|
|
7679
|
+
]
|
|
7680
|
+
}
|
|
7681
|
+
);
|
|
7682
|
+
};
|
|
7683
|
+
|
|
7684
|
+
// src/components/third-party/FlowEditor.tsx
|
|
7685
|
+
var import_react34 = require("react");
|
|
7686
|
+
var import_reactflow = __toESM(require("reactflow"));
|
|
7687
|
+
var import_material68 = require("@mui/material");
|
|
7397
7688
|
var import_styles40 = require("@mui/material/styles");
|
|
7398
7689
|
var import_reactflow2 = require("reactflow");
|
|
7399
|
-
var
|
|
7690
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
7400
7691
|
var FlowEditor = ({
|
|
7401
7692
|
nodes,
|
|
7402
7693
|
edges,
|
|
@@ -7414,7 +7705,7 @@ var FlowEditor = ({
|
|
|
7414
7705
|
...reactFlowProps
|
|
7415
7706
|
}) => {
|
|
7416
7707
|
const theme2 = (0, import_styles40.useTheme)();
|
|
7417
|
-
const handleInit = (0,
|
|
7708
|
+
const handleInit = (0, import_react34.useCallback)(
|
|
7418
7709
|
(instance) => {
|
|
7419
7710
|
if (onInit) {
|
|
7420
7711
|
onInit(instance);
|
|
@@ -7422,8 +7713,8 @@ var FlowEditor = ({
|
|
|
7422
7713
|
},
|
|
7423
7714
|
[onInit]
|
|
7424
7715
|
);
|
|
7425
|
-
return /* @__PURE__ */ (0,
|
|
7426
|
-
|
|
7716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_reactflow.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7717
|
+
import_material68.Box,
|
|
7427
7718
|
{
|
|
7428
7719
|
sx: {
|
|
7429
7720
|
width: "100%",
|
|
@@ -7435,7 +7726,7 @@ var FlowEditor = ({
|
|
|
7435
7726
|
...containerProps?.sx
|
|
7436
7727
|
},
|
|
7437
7728
|
...containerProps,
|
|
7438
|
-
children: /* @__PURE__ */ (0,
|
|
7729
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
7439
7730
|
import_reactflow.default,
|
|
7440
7731
|
{
|
|
7441
7732
|
nodes,
|
|
@@ -7457,7 +7748,7 @@ var FlowEditor = ({
|
|
|
7457
7748
|
},
|
|
7458
7749
|
...reactFlowProps,
|
|
7459
7750
|
children: [
|
|
7460
|
-
showBackground && /* @__PURE__ */ (0,
|
|
7751
|
+
showBackground && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7461
7752
|
import_reactflow.Background,
|
|
7462
7753
|
{
|
|
7463
7754
|
variant: backgroundVariant,
|
|
@@ -7466,8 +7757,8 @@ var FlowEditor = ({
|
|
|
7466
7757
|
color: theme2.palette.divider
|
|
7467
7758
|
}
|
|
7468
7759
|
),
|
|
7469
|
-
showControls && /* @__PURE__ */ (0,
|
|
7470
|
-
showMinimap && /* @__PURE__ */ (0,
|
|
7760
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_reactflow.Controls, {}),
|
|
7761
|
+
showMinimap && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7471
7762
|
import_reactflow.MiniMap,
|
|
7472
7763
|
{
|
|
7473
7764
|
nodeColor: (node) => {
|
|
@@ -7490,15 +7781,15 @@ var FlowEditor = ({
|
|
|
7490
7781
|
};
|
|
7491
7782
|
|
|
7492
7783
|
// src/components/third-party/CodeEditor.tsx
|
|
7493
|
-
var
|
|
7494
|
-
var
|
|
7495
|
-
var
|
|
7784
|
+
var import_react35 = require("react");
|
|
7785
|
+
var import_react36 = __toESM(require("@monaco-editor/react"));
|
|
7786
|
+
var import_material69 = require("@mui/material");
|
|
7496
7787
|
var import_Fullscreen = __toESM(require("@mui/icons-material/Fullscreen"));
|
|
7497
7788
|
var import_FullscreenExit = __toESM(require("@mui/icons-material/FullscreenExit"));
|
|
7498
7789
|
var import_ErrorOutline = __toESM(require("@mui/icons-material/ErrorOutline"));
|
|
7499
7790
|
var import_ExpandMore3 = __toESM(require("@mui/icons-material/ExpandMore"));
|
|
7500
7791
|
var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"));
|
|
7501
|
-
var
|
|
7792
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
7502
7793
|
var configureTypeScript = (monaco) => {
|
|
7503
7794
|
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
7504
7795
|
target: monaco.languages.typescript.ScriptTarget.ES2020,
|
|
@@ -7542,16 +7833,16 @@ var CodeEditor = ({
|
|
|
7542
7833
|
containerProps,
|
|
7543
7834
|
typeDefinitions
|
|
7544
7835
|
}) => {
|
|
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,
|
|
7836
|
+
const [isEditorReady, setIsEditorReady] = (0, import_react35.useState)(false);
|
|
7837
|
+
const [validationErrors, setValidationErrors] = (0, import_react35.useState)([]);
|
|
7838
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react35.useState)(false);
|
|
7839
|
+
const [tsCode, setTsCode] = (0, import_react35.useState)(value);
|
|
7840
|
+
const [actualHeight, setActualHeight] = (0, import_react35.useState)(
|
|
7550
7841
|
typeof height === "number" ? `${height}px` : height
|
|
7551
7842
|
);
|
|
7552
|
-
const [showProblems, setShowProblems] = (0,
|
|
7553
|
-
const [hasUserToggledProblems, setHasUserToggledProblems] = (0,
|
|
7554
|
-
(0,
|
|
7843
|
+
const [showProblems, setShowProblems] = (0, import_react35.useState)(false);
|
|
7844
|
+
const [hasUserToggledProblems, setHasUserToggledProblems] = (0, import_react35.useState)(false);
|
|
7845
|
+
(0, import_react35.useEffect)(() => {
|
|
7555
7846
|
if (hasUserToggledProblems) return;
|
|
7556
7847
|
if (validationErrors.length > 0) {
|
|
7557
7848
|
setShowProblems(true);
|
|
@@ -7559,25 +7850,25 @@ var CodeEditor = ({
|
|
|
7559
7850
|
setShowProblems(false);
|
|
7560
7851
|
}
|
|
7561
7852
|
}, [validationErrors, hasUserToggledProblems]);
|
|
7562
|
-
const internalEditorRef = (0,
|
|
7563
|
-
const internalMonacoRef = (0,
|
|
7853
|
+
const internalEditorRef = (0, import_react35.useRef)(null);
|
|
7854
|
+
const internalMonacoRef = (0, import_react35.useRef)(null);
|
|
7564
7855
|
const finalEditorRef = editorRef || internalEditorRef;
|
|
7565
7856
|
const finalMonacoRef = monacoRef || internalMonacoRef;
|
|
7566
|
-
(0,
|
|
7857
|
+
(0, import_react35.useEffect)(() => {
|
|
7567
7858
|
if (isFullscreen) {
|
|
7568
7859
|
setActualHeight("calc(100vh - 80px)");
|
|
7569
7860
|
} else {
|
|
7570
7861
|
setActualHeight(typeof height === "number" ? `${height}px` : height);
|
|
7571
7862
|
}
|
|
7572
7863
|
}, [height, isFullscreen]);
|
|
7573
|
-
const toggleFullscreen = (0,
|
|
7864
|
+
const toggleFullscreen = (0, import_react35.useCallback)(() => {
|
|
7574
7865
|
const newFullscreenState = !isFullscreen;
|
|
7575
7866
|
setIsFullscreen(newFullscreenState);
|
|
7576
7867
|
if (onFullscreenChange) {
|
|
7577
7868
|
onFullscreenChange(newFullscreenState);
|
|
7578
7869
|
}
|
|
7579
7870
|
}, [isFullscreen, onFullscreenChange]);
|
|
7580
|
-
const gotoMarker = (0,
|
|
7871
|
+
const gotoMarker = (0, import_react35.useCallback)(
|
|
7581
7872
|
(marker) => {
|
|
7582
7873
|
const ed = finalEditorRef?.current;
|
|
7583
7874
|
if (!ed) return;
|
|
@@ -7592,7 +7883,7 @@ var CodeEditor = ({
|
|
|
7592
7883
|
},
|
|
7593
7884
|
[finalEditorRef]
|
|
7594
7885
|
);
|
|
7595
|
-
(0,
|
|
7886
|
+
(0, import_react35.useEffect)(() => {
|
|
7596
7887
|
if (!isFullscreen) return;
|
|
7597
7888
|
function escapeHandler(event) {
|
|
7598
7889
|
if (event.key === "Escape") {
|
|
@@ -7609,7 +7900,7 @@ var CodeEditor = ({
|
|
|
7609
7900
|
window.removeEventListener("keydown", escapeHandler, { capture: true });
|
|
7610
7901
|
};
|
|
7611
7902
|
}, [isFullscreen, onFullscreenChange]);
|
|
7612
|
-
const handleEditorDidMount = (0,
|
|
7903
|
+
const handleEditorDidMount = (0, import_react35.useCallback)(
|
|
7613
7904
|
(editor, monaco) => {
|
|
7614
7905
|
console.log("CodeEditor: onMount called", { editor: !!editor, monaco: !!monaco });
|
|
7615
7906
|
try {
|
|
@@ -7663,7 +7954,7 @@ var CodeEditor = ({
|
|
|
7663
7954
|
},
|
|
7664
7955
|
[isFullscreen, onFullscreenChange, onValidate, onMount, finalEditorRef, finalMonacoRef]
|
|
7665
7956
|
);
|
|
7666
|
-
(0,
|
|
7957
|
+
(0, import_react35.useEffect)(() => {
|
|
7667
7958
|
if (!isEditorReady || !finalMonacoRef?.current || !typeDefinitions) return;
|
|
7668
7959
|
const monaco = finalMonacoRef.current;
|
|
7669
7960
|
const definitions = Array.isArray(typeDefinitions) ? typeDefinitions : [typeDefinitions];
|
|
@@ -7685,7 +7976,7 @@ var CodeEditor = ({
|
|
|
7685
7976
|
setTsCode(valueStr);
|
|
7686
7977
|
onChange(valueStr);
|
|
7687
7978
|
};
|
|
7688
|
-
(0,
|
|
7979
|
+
(0, import_react35.useEffect)(() => {
|
|
7689
7980
|
if (value !== tsCode) {
|
|
7690
7981
|
setTsCode(value);
|
|
7691
7982
|
if (isEditorReady && finalEditorRef?.current) {
|
|
@@ -7710,8 +8001,8 @@ var CodeEditor = ({
|
|
|
7710
8001
|
theme: themeProp || "vs",
|
|
7711
8002
|
...options2
|
|
7712
8003
|
};
|
|
7713
|
-
return /* @__PURE__ */ (0,
|
|
7714
|
-
|
|
8004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8005
|
+
import_material69.Box,
|
|
7715
8006
|
{
|
|
7716
8007
|
sx: {
|
|
7717
8008
|
display: "flex",
|
|
@@ -7731,8 +8022,8 @@ var CodeEditor = ({
|
|
|
7731
8022
|
pb: isFullscreen ? 2 : 0,
|
|
7732
8023
|
overflow: isFullscreen ? "hidden" : "visible"
|
|
7733
8024
|
},
|
|
7734
|
-
children: /* @__PURE__ */ (0,
|
|
7735
|
-
|
|
8025
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8026
|
+
import_material69.Box,
|
|
7736
8027
|
{
|
|
7737
8028
|
sx: {
|
|
7738
8029
|
flex: 1,
|
|
@@ -7747,8 +8038,8 @@ var CodeEditor = ({
|
|
|
7747
8038
|
},
|
|
7748
8039
|
...containerProps,
|
|
7749
8040
|
children: [
|
|
7750
|
-
/* @__PURE__ */ (0,
|
|
7751
|
-
|
|
8041
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Tooltip, { title: isFullscreen ? "Exit Fullscreen" : "Fullscreen", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8042
|
+
import_material69.IconButton,
|
|
7752
8043
|
{
|
|
7753
8044
|
onClick: toggleFullscreen,
|
|
7754
8045
|
size: "small",
|
|
@@ -7765,11 +8056,11 @@ var CodeEditor = ({
|
|
|
7765
8056
|
},
|
|
7766
8057
|
boxShadow: 1
|
|
7767
8058
|
},
|
|
7768
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
8059
|
+
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
8060
|
}
|
|
7770
8061
|
) }),
|
|
7771
|
-
/* @__PURE__ */ (0,
|
|
7772
|
-
|
|
8062
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8063
|
+
import_material69.Box,
|
|
7773
8064
|
{
|
|
7774
8065
|
sx: {
|
|
7775
8066
|
flex: 1,
|
|
@@ -7780,8 +8071,8 @@ var CodeEditor = ({
|
|
|
7780
8071
|
position: "relative",
|
|
7781
8072
|
height: isFullscreen ? "100%" : actualHeight
|
|
7782
8073
|
},
|
|
7783
|
-
children: /* @__PURE__ */ (0,
|
|
7784
|
-
|
|
8074
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8075
|
+
import_react36.default,
|
|
7785
8076
|
{
|
|
7786
8077
|
height: "100%",
|
|
7787
8078
|
defaultLanguage: language,
|
|
@@ -7791,7 +8082,7 @@ var CodeEditor = ({
|
|
|
7791
8082
|
onMount: handleEditorDidMount,
|
|
7792
8083
|
theme: themeProp || "vs",
|
|
7793
8084
|
options: defaultOptions,
|
|
7794
|
-
loading: /* @__PURE__ */ (0,
|
|
8085
|
+
loading: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { p: 2, textAlign: "center" }, children: "Loading Monaco Editor..." }),
|
|
7795
8086
|
beforeMount: (monaco) => {
|
|
7796
8087
|
console.log("CodeEditor: beforeMount called", { monaco: !!monaco });
|
|
7797
8088
|
}
|
|
@@ -7799,8 +8090,8 @@ var CodeEditor = ({
|
|
|
7799
8090
|
)
|
|
7800
8091
|
}
|
|
7801
8092
|
),
|
|
7802
|
-
validationErrors.length > 0 && /* @__PURE__ */ (0,
|
|
7803
|
-
|
|
8093
|
+
validationErrors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8094
|
+
import_material69.Box,
|
|
7804
8095
|
{
|
|
7805
8096
|
sx: {
|
|
7806
8097
|
borderTop: 1,
|
|
@@ -7813,8 +8104,8 @@ var CodeEditor = ({
|
|
|
7813
8104
|
transition: "max-height 0.2s ease"
|
|
7814
8105
|
},
|
|
7815
8106
|
children: [
|
|
7816
|
-
/* @__PURE__ */ (0,
|
|
7817
|
-
|
|
8107
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8108
|
+
import_material69.Box,
|
|
7818
8109
|
{
|
|
7819
8110
|
sx: {
|
|
7820
8111
|
display: "flex",
|
|
@@ -7828,16 +8119,16 @@ var CodeEditor = ({
|
|
|
7828
8119
|
color: "text.secondary"
|
|
7829
8120
|
},
|
|
7830
8121
|
children: [
|
|
7831
|
-
/* @__PURE__ */ (0,
|
|
7832
|
-
/* @__PURE__ */ (0,
|
|
7833
|
-
/* @__PURE__ */ (0,
|
|
8122
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_ErrorOutline.default, { color: "error", fontSize: "small" }),
|
|
8123
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { fontWeight: 600, color: "text.primary" }, children: "Problems" }),
|
|
8124
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_material69.Box, { sx: { ml: 1 }, children: [
|
|
7834
8125
|
validationErrors.length,
|
|
7835
8126
|
" error",
|
|
7836
8127
|
validationErrors.length > 1 ? "s" : ""
|
|
7837
8128
|
] }),
|
|
7838
|
-
/* @__PURE__ */ (0,
|
|
7839
|
-
/* @__PURE__ */ (0,
|
|
7840
|
-
|
|
8129
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { flex: 1 } }),
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
8131
|
+
import_material69.IconButton,
|
|
7841
8132
|
{
|
|
7842
8133
|
size: "small",
|
|
7843
8134
|
"aria-label": "Toggle problems panel",
|
|
@@ -7845,14 +8136,14 @@ var CodeEditor = ({
|
|
|
7845
8136
|
setHasUserToggledProblems(true);
|
|
7846
8137
|
setShowProblems((s) => !s);
|
|
7847
8138
|
},
|
|
7848
|
-
children: showProblems ? /* @__PURE__ */ (0,
|
|
8139
|
+
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
8140
|
}
|
|
7850
8141
|
)
|
|
7851
8142
|
]
|
|
7852
8143
|
}
|
|
7853
8144
|
),
|
|
7854
|
-
showProblems && /* @__PURE__ */ (0,
|
|
7855
|
-
|
|
8145
|
+
showProblems && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { overflow: "auto" }, children: validationErrors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
8146
|
+
import_material69.Box,
|
|
7856
8147
|
{
|
|
7857
8148
|
onClick: () => gotoMarker(error),
|
|
7858
8149
|
sx: {
|
|
@@ -7868,12 +8159,12 @@ var CodeEditor = ({
|
|
|
7868
8159
|
fontSize: "0.85rem"
|
|
7869
8160
|
},
|
|
7870
8161
|
children: [
|
|
7871
|
-
/* @__PURE__ */ (0,
|
|
7872
|
-
/* @__PURE__ */ (0,
|
|
8162
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_ErrorOutline.default, { color: "error", sx: { fontSize: 18 } }),
|
|
8163
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_material69.Box, { sx: { color: "text.secondary", width: 64 }, children: [
|
|
7873
8164
|
"Line ",
|
|
7874
8165
|
error.startLineNumber
|
|
7875
8166
|
] }),
|
|
7876
|
-
/* @__PURE__ */ (0,
|
|
8167
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_material69.Box, { sx: { color: "text.primary", flex: 1, minWidth: 0 }, children: error.message })
|
|
7877
8168
|
]
|
|
7878
8169
|
},
|
|
7879
8170
|
`${error.startLineNumber}-${error.startColumn}-${index}`
|
|
@@ -7999,11 +8290,14 @@ var import_reactflow3 = require("reactflow");
|
|
|
7999
8290
|
StepLabel,
|
|
8000
8291
|
Stepper,
|
|
8001
8292
|
StorageAppIcon,
|
|
8293
|
+
SummaryStats,
|
|
8002
8294
|
Switch,
|
|
8003
8295
|
Tab,
|
|
8004
8296
|
Table,
|
|
8005
8297
|
TableHeader,
|
|
8006
8298
|
TextField,
|
|
8299
|
+
TimeRangeSelect,
|
|
8300
|
+
TimeSeriesGraph,
|
|
8007
8301
|
ToggleButton,
|
|
8008
8302
|
ToggleButtonGroup,
|
|
8009
8303
|
Toolbar,
|