web-mojo 2.2.7 → 2.2.9

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 (56) 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 +7509 -7428
  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-BxIeRwBQ.js +2 -0
  10. package/dist/chunks/ChatView-BxIeRwBQ.js.map +1 -0
  11. package/dist/chunks/{ChatView-pFVev6ZD.js → ChatView-DfhhZKoN.js} +282 -96
  12. package/dist/chunks/ChatView-DfhhZKoN.js.map +1 -0
  13. package/dist/chunks/{Dialog-LFifi2fg.js → Dialog-Cu_Dx46k.js} +3 -3
  14. package/dist/chunks/{Dialog-LFifi2fg.js.map → Dialog-Cu_Dx46k.js.map} +1 -1
  15. package/dist/chunks/{Dialog-DPGOKfct.js → Dialog-DX5h2QA9.js} +2 -2
  16. package/dist/chunks/{Dialog-DPGOKfct.js.map → Dialog-DX5h2QA9.js.map} +1 -1
  17. package/dist/chunks/{FormView-Xb_l8AD5.js → FormView-B_90L1RY.js} +683 -27
  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-CzqYq7d2.js → MetricsMiniChartWidget-Cg5Hyx28.js} +113 -54
  22. package/dist/chunks/MetricsMiniChartWidget-Cg5Hyx28.js.map +1 -0
  23. package/dist/chunks/MetricsMiniChartWidget-DNIU3bL-.js +2 -0
  24. package/dist/chunks/MetricsMiniChartWidget-DNIU3bL-.js.map +1 -0
  25. package/dist/chunks/{PDFViewer-BCn-y_36.js → PDFViewer--jlqnuVw.js} +2 -2
  26. package/dist/chunks/{PDFViewer-BCn-y_36.js.map → PDFViewer--jlqnuVw.js.map} +1 -1
  27. package/dist/chunks/{PDFViewer-BeWHRAeX.js → PDFViewer-DSmi78S6.js} +2 -2
  28. package/dist/chunks/{PDFViewer-BeWHRAeX.js.map → PDFViewer-DSmi78S6.js.map} +1 -1
  29. package/dist/chunks/{TokenManager-D2pm6lM8.js → TokenManager-CEOPgnsw.js} +2 -2
  30. package/dist/chunks/{TokenManager-D2pm6lM8.js.map → TokenManager-CEOPgnsw.js.map} +1 -1
  31. package/dist/chunks/{TokenManager-DZwzcAzD.js → TokenManager-DiQfilqw.js} +2 -2
  32. package/dist/chunks/{TokenManager-DZwzcAzD.js.map → TokenManager-DiQfilqw.js.map} +1 -1
  33. package/dist/chunks/{version-CmZ8J2xW.js → version-BlWcQoar.js} +2 -2
  34. package/dist/chunks/{version-CmZ8J2xW.js.map → version-BlWcQoar.js.map} +1 -1
  35. package/dist/chunks/{version-aJXsYzYB.js → version-CHVtoVR0.js} +4 -4
  36. package/dist/chunks/{version-aJXsYzYB.js.map → version-CHVtoVR0.js.map} +1 -1
  37. package/dist/core.css +183 -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.cjs.js.map +1 -1
  43. package/dist/index.es.js +96 -92
  44. package/dist/index.es.js.map +1 -1
  45. package/dist/lightbox.cjs.js +1 -1
  46. package/dist/lightbox.es.js +4 -4
  47. package/package.json +1 -1
  48. package/dist/chunks/ChatView-B2iog5Hu.js +0 -2
  49. package/dist/chunks/ChatView-B2iog5Hu.js.map +0 -1
  50. package/dist/chunks/ChatView-pFVev6ZD.js.map +0 -1
  51. package/dist/chunks/FormView-Clc_mN0d.js +0 -3
  52. package/dist/chunks/FormView-Clc_mN0d.js.map +0 -1
  53. package/dist/chunks/FormView-Xb_l8AD5.js.map +0 -1
  54. package/dist/chunks/MetricsMiniChartWidget-C8RQnqrd.js +0 -2
  55. package/dist/chunks/MetricsMiniChartWidget-C8RQnqrd.js.map +0 -1
  56. package/dist/chunks/MetricsMiniChartWidget-CzqYq7d2.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { D as Dialog } from "./Dialog-LFifi2fg.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,
@@ -2009,17 +2064,21 @@ class MetricsChart extends SeriesChart {
2009
2064
  processMetricsData(data) {
2010
2065
  const { data: metricsData, labels } = data;
2011
2066
  const datasets = [];
2012
- Object.keys(metricsData).forEach((metric, index) => {
2067
+ const metricKeys = Object.keys(metricsData || {});
2068
+ this.ensureColorPool(metricKeys.length);
2069
+ metricKeys.forEach((metric, index) => {
2013
2070
  const values = metricsData[metric];
2014
2071
  const sanitizedValues = values.map((val) => {
2015
2072
  if (val === null || val === void 0 || val === "") return 0;
2016
2073
  return typeof val === "number" ? val : parseFloat(val) || 0;
2017
2074
  });
2075
+ const baseColor = this.getColor(index);
2076
+ const backgroundAlpha = this.chartType === "line" ? 0.25 : 0.65;
2018
2077
  datasets.push({
2019
2078
  label: this.formatMetricLabel(metric),
2020
2079
  data: sanitizedValues,
2021
- backgroundColor: this.colors[index % this.colors.length].replace("0.8", "0.6"),
2022
- borderColor: this.colors[index % this.colors.length],
2080
+ backgroundColor: this.withAlpha(baseColor, backgroundAlpha),
2081
+ borderColor: baseColor,
2023
2082
  borderWidth: 2,
2024
2083
  tension: this.chartType === "line" ? 0.4 : 0,
2025
2084
  fill: false,
@@ -3199,4 +3258,4 @@ export {
3199
3258
  MetricsMiniChart as b,
3200
3259
  MetricsMiniChartWidget as c
3201
3260
  };
3202
- //# sourceMappingURL=MetricsMiniChartWidget-CzqYq7d2.js.map
3261
+ //# sourceMappingURL=MetricsMiniChartWidget-Cg5Hyx28.js.map