web-mojo 2.2.8 → 2.2.10

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.
Files changed (54) hide show
  1. package/dist/admin.cjs.js +1 -1
  2. package/dist/admin.cjs.js.map +1 -1
  3. package/dist/admin.es.js +8296 -7415
  4. package/dist/admin.es.js.map +1 -1
  5. package/dist/auth.cjs.js +1 -1
  6. package/dist/auth.es.js +1 -1
  7. package/dist/charts.cjs.js +1 -1
  8. package/dist/charts.es.js +3 -3
  9. package/dist/chunks/{ChatView-DfKH7ep8.js → ChatView-BxIeRwBQ.js} +2 -2
  10. package/dist/chunks/{ChatView-DfKH7ep8.js.map → ChatView-BxIeRwBQ.js.map} +1 -1
  11. package/dist/chunks/{ChatView-2mFEGsXL.js → ChatView-DfhhZKoN.js} +3 -3
  12. package/dist/chunks/{ChatView-2mFEGsXL.js.map → ChatView-DfhhZKoN.js.map} +1 -1
  13. package/dist/chunks/{Dialog-DrCs-ex1.js → Dialog-Cu_Dx46k.js} +3 -3
  14. package/dist/chunks/{Dialog-DrCs-ex1.js.map → Dialog-Cu_Dx46k.js.map} +1 -1
  15. package/dist/chunks/{Dialog-BBZUgBbz.js → Dialog-DX5h2QA9.js} +2 -2
  16. package/dist/chunks/{Dialog-BBZUgBbz.js.map → Dialog-DX5h2QA9.js.map} +1 -1
  17. package/dist/chunks/{FormView-CwYt4vH3.js → FormView-B_90L1RY.js} +284 -26
  18. package/dist/chunks/FormView-B_90L1RY.js.map +1 -0
  19. package/dist/chunks/FormView-Bwofbd8S.js +3 -0
  20. package/dist/chunks/FormView-Bwofbd8S.js.map +1 -0
  21. package/dist/chunks/{MetricsMiniChartWidget-DdZ3zNve.js → MetricsMiniChartWidget-DL5stA6A.js} +139 -58
  22. package/dist/chunks/MetricsMiniChartWidget-DL5stA6A.js.map +1 -0
  23. package/dist/chunks/MetricsMiniChartWidget-vXr5pxpm.js +2 -0
  24. package/dist/chunks/MetricsMiniChartWidget-vXr5pxpm.js.map +1 -0
  25. package/dist/chunks/{PDFViewer-CkKC_E0G.js → PDFViewer--jlqnuVw.js} +2 -2
  26. package/dist/chunks/{PDFViewer-CkKC_E0G.js.map → PDFViewer--jlqnuVw.js.map} +1 -1
  27. package/dist/chunks/{PDFViewer-DaiTPsQH.js → PDFViewer-DSmi78S6.js} +2 -2
  28. package/dist/chunks/{PDFViewer-DaiTPsQH.js.map → PDFViewer-DSmi78S6.js.map} +1 -1
  29. package/dist/chunks/{TokenManager-D9z35vwT.js → TokenManager-CEOPgnsw.js} +2 -2
  30. package/dist/chunks/{TokenManager-D9z35vwT.js.map → TokenManager-CEOPgnsw.js.map} +1 -1
  31. package/dist/chunks/{TokenManager-XwKaWaKd.js → TokenManager-DiQfilqw.js} +2 -2
  32. package/dist/chunks/{TokenManager-XwKaWaKd.js.map → TokenManager-DiQfilqw.js.map} +1 -1
  33. package/dist/chunks/{version-BQcvJscT.js → version-DOHckOGK.js} +4 -4
  34. package/dist/chunks/version-DOHckOGK.js.map +1 -0
  35. package/dist/chunks/version-DUvrBxZl.js +2 -0
  36. package/dist/chunks/version-DUvrBxZl.js.map +1 -0
  37. package/dist/core.css +65 -0
  38. package/dist/css/web-mojo.css +1 -1
  39. package/dist/docit.cjs.js +1 -1
  40. package/dist/docit.es.js +3 -3
  41. package/dist/index.cjs.js +1 -1
  42. package/dist/index.es.js +7 -7
  43. package/dist/lightbox.cjs.js +1 -1
  44. package/dist/lightbox.es.js +4 -4
  45. package/package.json +1 -1
  46. package/dist/chunks/FormView-CNkSOc2U.js +0 -3
  47. package/dist/chunks/FormView-CNkSOc2U.js.map +0 -1
  48. package/dist/chunks/FormView-CwYt4vH3.js.map +0 -1
  49. package/dist/chunks/MetricsMiniChartWidget-B3PHrgkn.js +0 -2
  50. package/dist/chunks/MetricsMiniChartWidget-B3PHrgkn.js.map +0 -1
  51. package/dist/chunks/MetricsMiniChartWidget-DdZ3zNve.js.map +0 -1
  52. package/dist/chunks/version-BQcvJscT.js.map +0 -1
  53. package/dist/chunks/version-DhSPKHUm.js +0 -2
  54. package/dist/chunks/version-DhSPKHUm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { D as Dialog } from "./Dialog-DrCs-ex1.js";
1
+ import { D as Dialog } from "./Dialog-Cu_Dx46k.js";
2
2
  import { V as View, d as dataFormatter } from "./Rest-ChN4Ntac.js";
3
3
  import { W as WebSocketClient } from "./WebSocketClient-bLYhu2Wv.js";
4
4
  class BaseChart extends View {
@@ -1018,6 +1018,48 @@ class ChartHeaderView extends View {
1018
1018
  return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1019
1019
  }
1020
1020
  }
1021
+ const DEFAULT_CHART_COLORS = [
1022
+ "rgba(52, 152, 219, 0.85)",
1023
+ // Belize Hole
1024
+ "rgba(231, 76, 60, 0.85)",
1025
+ // Alizarin
1026
+ "rgba(46, 204, 113, 0.85)",
1027
+ // Emerald
1028
+ "rgba(241, 196, 15, 0.85)",
1029
+ // Sunflower
1030
+ "rgba(155, 89, 182, 0.85)",
1031
+ // Amethyst
1032
+ "rgba(230, 126, 34, 0.85)",
1033
+ // Carrot
1034
+ "rgba(26, 188, 156, 0.85)",
1035
+ // Turquoise
1036
+ "rgba(52, 73, 94, 0.85)",
1037
+ // Wet asphalt
1038
+ "rgba(243, 156, 18, 0.85)",
1039
+ // Orange
1040
+ "rgba(142, 68, 173, 0.85)",
1041
+ // Wisteria
1042
+ "rgba(39, 174, 96, 0.85)",
1043
+ // Nephritis
1044
+ "rgba(41, 128, 185, 0.85)",
1045
+ // Peter River
1046
+ "rgba(192, 57, 43, 0.85)",
1047
+ // Pomegranate
1048
+ "rgba(127, 140, 141, 0.85)",
1049
+ // Asbestos
1050
+ "rgba(22, 160, 133, 0.85)",
1051
+ // Green Sea
1052
+ "rgba(211, 84, 0, 0.85)",
1053
+ // Pumpkin
1054
+ "rgba(44, 62, 80, 0.85)",
1055
+ // Midnight Blue
1056
+ "rgba(214, 69, 65, 0.85)",
1057
+ // Valencia
1058
+ "rgba(149, 165, 166, 0.85)",
1059
+ // Concrete
1060
+ "rgba(52, 232, 158, 0.85)"
1061
+ // Mint
1062
+ ];
1021
1063
  class SeriesChart extends BaseChart {
1022
1064
  constructor(options = {}) {
1023
1065
  super({
@@ -1045,26 +1087,39 @@ class SeriesChart extends BaseChart {
1045
1087
  this.series = options.series || [];
1046
1088
  this.xField = options.xField || "x";
1047
1089
  this.yField = options.yField || "y";
1048
- this.colors = options.colors || [
1049
- "rgba(54, 162, 235, 0.8)",
1050
- // Blue
1051
- "rgba(255, 99, 132, 0.8)",
1052
- // Red
1053
- "rgba(75, 192, 192, 0.8)",
1054
- // Green
1055
- "rgba(255, 206, 86, 0.8)",
1056
- // Yellow
1057
- "rgba(153, 102, 255, 0.8)",
1058
- // Purple
1059
- "rgba(255, 159, 64, 0.8)",
1060
- // Orange
1061
- "rgba(199, 199, 199, 0.8)",
1062
- // Grey
1063
- "rgba(83, 102, 255, 0.8)"
1064
- // Indigo
1065
- ];
1090
+ const providedColors = Array.isArray(options.colors) && options.colors.length ? options.colors : DEFAULT_CHART_COLORS;
1091
+ this.colors = [...providedColors];
1066
1092
  this.tooltipFormatters = options.tooltip || {};
1067
1093
  }
1094
+ getColor(index) {
1095
+ this.ensureColorPool(index + 1);
1096
+ return this.colors[index];
1097
+ }
1098
+ ensureColorPool(count) {
1099
+ if (this.colors.length >= count) return;
1100
+ while (this.colors.length < count) {
1101
+ const nextIndex = this.colors.length;
1102
+ const hue = nextIndex * 37 % 360;
1103
+ const color = `hsla(${hue}, 70%, 55%, 0.85)`;
1104
+ this.colors.push(color);
1105
+ }
1106
+ }
1107
+ withAlpha(color, alpha = 0.4) {
1108
+ if (!color) return color;
1109
+ const rgbaMatch = color.match(/rgba?\(([^)]+)\)/i);
1110
+ if (rgbaMatch) {
1111
+ const parts = rgbaMatch[1].split(",").map((part) => part.trim());
1112
+ const [r, g, b] = parts;
1113
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
1114
+ }
1115
+ const hslaMatch = color.match(/hsla?\(([^)]+)\)/i);
1116
+ if (hslaMatch) {
1117
+ const parts = hslaMatch[1].split(",").map((part) => part.trim());
1118
+ const [h, s, l] = parts;
1119
+ return `hsla(${h}, ${s}, ${l}, ${alpha})`;
1120
+ }
1121
+ return color;
1122
+ }
1068
1123
  async getTemplate() {
1069
1124
  return await super.getTemplate();
1070
1125
  }
@@ -1142,13 +1197,16 @@ class SeriesChart extends BaseChart {
1142
1197
  labels.push(xValue);
1143
1198
  values.push(yValue);
1144
1199
  });
1200
+ this.ensureColorPool(1);
1201
+ const baseColor = this.getColor(0);
1202
+ const backgroundAlpha = this.chartType === "line" ? 0.25 : 0.65;
1145
1203
  return {
1146
1204
  labels,
1147
1205
  datasets: [{
1148
1206
  label: this.title || "Data",
1149
1207
  data: values,
1150
- backgroundColor: this.colors[0].replace("0.8", "0.6"),
1151
- borderColor: this.colors[0],
1208
+ backgroundColor: this.withAlpha(baseColor, backgroundAlpha),
1209
+ borderColor: baseColor,
1152
1210
  borderWidth: 2,
1153
1211
  tension: this.chartType === "line" ? this.tension : 0,
1154
1212
  fill: this.chartType === "line" ? this.fill : false,
@@ -1158,26 +1216,40 @@ class SeriesChart extends BaseChart {
1158
1216
  }
1159
1217
  processChartJSData(data) {
1160
1218
  const processedData = { ...data };
1161
- processedData.datasets = processedData.datasets.map((dataset, index) => ({
1162
- ...dataset,
1163
- backgroundColor: dataset.backgroundColor || this.colors[index % this.colors.length].replace("0.8", "0.6"),
1164
- borderColor: dataset.borderColor || this.colors[index % this.colors.length],
1165
- borderWidth: dataset.borderWidth || 2,
1166
- tension: this.chartType === "line" ? dataset.tension ?? this.tension : 0,
1167
- fill: this.chartType === "line" ? dataset.fill ?? this.fill : false,
1168
- stepped: this.chartType === "line" ? dataset.stepped ?? this.stepped : false
1169
- }));
1219
+ if (!processedData.datasets) {
1220
+ processedData.datasets = [];
1221
+ return processedData;
1222
+ }
1223
+ const datasetCount = processedData.datasets.length;
1224
+ this.ensureColorPool(datasetCount);
1225
+ const backgroundAlpha = this.chartType === "line" ? 0.25 : 0.65;
1226
+ processedData.datasets = processedData.datasets.map((dataset, index) => {
1227
+ const baseColor = dataset.borderColor || this.getColor(index);
1228
+ return {
1229
+ ...dataset,
1230
+ backgroundColor: dataset.backgroundColor || this.withAlpha(baseColor, backgroundAlpha),
1231
+ borderColor: baseColor,
1232
+ borderWidth: dataset.borderWidth || 2,
1233
+ tension: this.chartType === "line" ? dataset.tension ?? this.tension : 0,
1234
+ fill: this.chartType === "line" ? dataset.fill ?? this.fill : false,
1235
+ stepped: this.chartType === "line" ? dataset.stepped ?? this.stepped : false
1236
+ };
1237
+ });
1170
1238
  return processedData;
1171
1239
  }
1172
1240
  processSeriesData(data) {
1173
1241
  const labels = data.labels || [];
1174
1242
  const datasets = [];
1243
+ const count = data.series?.length || 0;
1244
+ this.ensureColorPool(count);
1245
+ const backgroundAlpha = this.chartType === "line" ? 0.25 : 0.65;
1175
1246
  data.series.forEach((series, index) => {
1247
+ const baseColor = series.borderColor || this.getColor(index);
1176
1248
  datasets.push({
1177
1249
  label: series.name || series.label || `Series ${index + 1}`,
1178
1250
  data: series.data || [],
1179
- backgroundColor: series.backgroundColor || this.colors[index % this.colors.length].replace("0.8", "0.6"),
1180
- borderColor: series.borderColor || this.colors[index % this.colors.length],
1251
+ backgroundColor: series.backgroundColor || this.withAlpha(baseColor, backgroundAlpha),
1252
+ borderColor: baseColor,
1181
1253
  borderWidth: series.borderWidth || 2,
1182
1254
  tension: this.chartType === "line" ? series.tension ?? this.tension : 0,
1183
1255
  fill: this.chartType === "line" ? series.fill ?? this.fill : false,
@@ -1808,24 +1880,7 @@ class MetricsChart extends SeriesChart {
1808
1880
  ...options,
1809
1881
  chartType: options.chartType || "line",
1810
1882
  title: options.title || "Metrics",
1811
- colors: options.colors || [
1812
- "rgba(54, 162, 235, 0.8)",
1813
- // Blue
1814
- "rgba(255, 99, 132, 0.8)",
1815
- // Red
1816
- "rgba(75, 192, 192, 0.8)",
1817
- // Green
1818
- "rgba(255, 206, 86, 0.8)",
1819
- // Yellow
1820
- "rgba(153, 102, 255, 0.8)",
1821
- // Purple
1822
- "rgba(255, 159, 64, 0.8)",
1823
- // Orange
1824
- "rgba(199, 199, 199, 0.8)",
1825
- // Grey
1826
- "rgba(83, 102, 255, 0.8)"
1827
- // Indigo
1828
- ],
1883
+ colors: options.colors,
1829
1884
  yAxis: options.yAxis || { label: "Count", beginAtZero: true },
1830
1885
  tooltip: options.tooltip || { y: "number" },
1831
1886
  width: options.width,
@@ -1860,6 +1915,8 @@ class MetricsChart extends SeriesChart {
1860
1915
  { value: "incident_evt", label: "System Events" },
1861
1916
  { value: "incidents", label: "Incidents" }
1862
1917
  ];
1918
+ this.maxDatasets = Number.isFinite(options.maxDatasets) ? options.maxDatasets : null;
1919
+ this.groupRemainingLabel = options.groupRemainingLabel || "Other";
1863
1920
  this.isLoading = false;
1864
1921
  this.lastFetch = null;
1865
1922
  if (!this.dateStart || !this.dateEnd) {
@@ -2008,18 +2065,42 @@ class MetricsChart extends SeriesChart {
2008
2065
  }
2009
2066
  processMetricsData(data) {
2010
2067
  const { data: metricsData, labels } = data;
2011
- const datasets = [];
2012
- Object.keys(metricsData).forEach((metric, index) => {
2013
- const values = metricsData[metric];
2068
+ const metricEntries = Object.entries(metricsData || {});
2069
+ const rankedEntries = metricEntries.map(([metric, values]) => {
2014
2070
  const sanitizedValues = values.map((val) => {
2015
2071
  if (val === null || val === void 0 || val === "") return 0;
2016
2072
  return typeof val === "number" ? val : parseFloat(val) || 0;
2017
2073
  });
2074
+ const total = sanitizedValues.reduce((sum, val) => sum + val, 0);
2075
+ return { metric, values: sanitizedValues, total };
2076
+ });
2077
+ rankedEntries.sort((a, b) => b.total - a.total);
2078
+ let visibleEntries = rankedEntries;
2079
+ let otherEntry = null;
2080
+ if (this.maxDatasets && this.maxDatasets > 0 && rankedEntries.length > this.maxDatasets) {
2081
+ visibleEntries = rankedEntries.slice(0, this.maxDatasets);
2082
+ const remaining = rankedEntries.slice(this.maxDatasets);
2083
+ const otherValues = labels.map(
2084
+ (_, index) => remaining.reduce((sum, entry) => sum + (entry.values[index] || 0), 0)
2085
+ );
2086
+ otherEntry = {
2087
+ metric: this.groupRemainingLabel,
2088
+ values: otherValues,
2089
+ total: otherValues.reduce((sum, val) => sum + val, 0),
2090
+ isGrouped: true
2091
+ };
2092
+ }
2093
+ const datasets = [];
2094
+ const allEntries = otherEntry ? [...visibleEntries, otherEntry] : visibleEntries;
2095
+ this.ensureColorPool(allEntries.length);
2096
+ const backgroundAlpha = this.chartType === "line" ? 0.25 : 0.65;
2097
+ allEntries.forEach((entry, index) => {
2098
+ const baseColor = this.getColor(index);
2018
2099
  datasets.push({
2019
- label: this.formatMetricLabel(metric),
2020
- data: sanitizedValues,
2021
- backgroundColor: this.colors[index % this.colors.length].replace("0.8", "0.6"),
2022
- borderColor: this.colors[index % this.colors.length],
2100
+ label: this.formatMetricLabel(entry.metric),
2101
+ data: entry.values,
2102
+ backgroundColor: this.withAlpha(baseColor, backgroundAlpha),
2103
+ borderColor: baseColor,
2023
2104
  borderWidth: 2,
2024
2105
  tension: this.chartType === "line" ? 0.4 : 0,
2025
2106
  fill: false,
@@ -3199,4 +3280,4 @@ export {
3199
3280
  MetricsMiniChart as b,
3200
3281
  MetricsMiniChartWidget as c
3201
3282
  };
3202
- //# sourceMappingURL=MetricsMiniChartWidget-DdZ3zNve.js.map
3283
+ //# sourceMappingURL=MetricsMiniChartWidget-DL5stA6A.js.map