@design.estate/dees-catalog 3.50.2 → 3.51.1

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.
@@ -108413,7 +108413,7 @@ var init_versions = __esm({
108413
108413
  xtermAddonFit: "0.8.0",
108414
108414
  xtermAddonSearch: "0.13.0",
108415
108415
  highlightJs: "11.11.1",
108416
- apexcharts: "5.10.4",
108416
+ lightweightCharts: "5.1.0",
108417
108417
  tiptap: "2.27.2",
108418
108418
  fontawesome: "7.2.0"
108419
108419
  };
@@ -108436,14 +108436,14 @@ var init_DeesServiceLibLoader = __esm({
108436
108436
  xtermFitAddonLib = null;
108437
108437
  xtermSearchAddonLib = null;
108438
108438
  highlightJsLib = null;
108439
- apexChartsLib = null;
108439
+ lightweightChartsLib = null;
108440
108440
  tiptapLib = null;
108441
108441
  // Loading promises to prevent duplicate concurrent loads
108442
108442
  xtermLoadingPromise = null;
108443
108443
  xtermFitAddonLoadingPromise = null;
108444
108444
  xtermSearchAddonLoadingPromise = null;
108445
108445
  highlightJsLoadingPromise = null;
108446
- apexChartsLoadingPromise = null;
108446
+ lightweightChartsLoadingPromise = null;
108447
108447
  tiptapLoadingPromise = null;
108448
108448
  constructor() {
108449
108449
  }
@@ -108575,26 +108575,33 @@ body > div[style*="top: -50000px"][style*="width: 50000px"] {
108575
108575
  return this.highlightJsLoadingPromise;
108576
108576
  }
108577
108577
  /**
108578
- * Load ApexCharts charting library from CDN
108579
- * @returns Promise resolving to ApexCharts constructor
108578
+ * Load TradingView Lightweight Charts from CDN
108579
+ * @returns Promise resolving to Lightweight Charts bundle
108580
108580
  */
108581
- async loadApexCharts() {
108582
- if (this.apexChartsLib) {
108583
- return this.apexChartsLib;
108581
+ async loadLightweightCharts() {
108582
+ if (this.lightweightChartsLib) {
108583
+ return this.lightweightChartsLib;
108584
108584
  }
108585
- if (this.apexChartsLoadingPromise) {
108586
- return this.apexChartsLoadingPromise;
108585
+ if (this.lightweightChartsLoadingPromise) {
108586
+ return this.lightweightChartsLoadingPromise;
108587
108587
  }
108588
- this.apexChartsLoadingPromise = (async () => {
108589
- const url = `${CDN_BASE}/apexcharts@${CDN_VERSIONS.apexcharts}/+esm`;
108588
+ this.lightweightChartsLoadingPromise = (async () => {
108589
+ const url = `${CDN_BASE}/lightweight-charts@${CDN_VERSIONS.lightweightCharts}/+esm`;
108590
108590
  const module = await import(
108591
108591
  /* @vite-ignore */
108592
108592
  url
108593
108593
  );
108594
- this.apexChartsLib = module.default;
108595
- return this.apexChartsLib;
108594
+ this.lightweightChartsLib = {
108595
+ createChart: module.createChart,
108596
+ AreaSeries: module.AreaSeries,
108597
+ LineSeries: module.LineSeries,
108598
+ ColorType: module.ColorType,
108599
+ LineType: module.LineType,
108600
+ CrosshairMode: module.CrosshairMode
108601
+ };
108602
+ return this.lightweightChartsLib;
108596
108603
  })();
108597
- return this.apexChartsLoadingPromise;
108604
+ return this.lightweightChartsLoadingPromise;
108598
108605
  }
108599
108606
  /**
108600
108607
  * Load Tiptap rich text editor and extensions from CDN
@@ -108664,7 +108671,7 @@ body > div[style*="top: -50000px"][style*="width: 50000px"] {
108664
108671
  this.loadXtermFitAddon(),
108665
108672
  this.loadXtermSearchAddon(),
108666
108673
  this.loadHighlightJs(),
108667
- this.loadApexCharts(),
108674
+ this.loadLightweightCharts(),
108668
108675
  this.loadTiptap()
108669
108676
  ]);
108670
108677
  }
@@ -108681,8 +108688,8 @@ body > div[style*="top: -50000px"][style*="width: 50000px"] {
108681
108688
  return this.xtermSearchAddonLib !== null;
108682
108689
  case "highlightJs":
108683
108690
  return this.highlightJsLib !== null;
108684
- case "apexCharts":
108685
- return this.apexChartsLib !== null;
108691
+ case "lightweightCharts":
108692
+ return this.lightweightChartsLib !== null;
108686
108693
  case "tiptap":
108687
108694
  return this.tiptapLib !== null;
108688
108695
  default:
@@ -155980,7 +155987,6 @@ var chartAreaStyles = [
155980
155987
  :host {
155981
155988
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
155982
155989
  color: ${cssManager.bdTheme("hsl(0 0% 3.9%)", "hsl(0 0% 98%)")};
155983
- font-weight: 400;
155984
155990
  font-size: 14px;
155985
155991
  }
155986
155992
  .mainbox {
@@ -155992,7 +155998,6 @@ var chartAreaStyles = [
155992
155998
  border-radius: 8px;
155993
155999
  overflow: hidden;
155994
156000
  }
155995
-
155996
156001
  .chartTitle {
155997
156002
  position: absolute;
155998
156003
  top: 0;
@@ -156008,26 +156013,59 @@ var chartAreaStyles = [
156008
156013
  }
156009
156014
  .chartContainer {
156010
156015
  position: absolute;
156011
- top: 0px;
156012
- left: 0px;
156013
- bottom: 0px;
156014
- right: 0px;
156015
- padding: 44px 16px 16px 0px;
156016
- overflow: hidden;
156017
- background: transparent; /* Ensure container doesn't override chart background */
156016
+ top: 44px;
156017
+ left: 0;
156018
+ bottom: 32px;
156019
+ right: 0;
156018
156020
  }
156019
-
156020
- /* ApexCharts theme overrides */
156021
- .apexcharts-canvas {
156022
- background: transparent !important;
156021
+ .statsBar {
156022
+ position: absolute;
156023
+ bottom: 0;
156024
+ left: 0;
156025
+ right: 0;
156026
+ height: 32px;
156027
+ display: flex;
156028
+ align-items: center;
156029
+ gap: 24px;
156030
+ padding: 0 16px;
156031
+ border-top: 1px solid ${cssManager.bdTheme("hsl(0 0% 89.8%)", "hsl(0 0% 14.9%)")};
156032
+ font-size: 11px;
156033
+ color: ${cssManager.bdTheme("hsl(0 0% 45%)", "hsl(0 0% 55%)")};
156023
156034
  }
156024
-
156025
- .apexcharts-inner {
156026
- background: transparent !important;
156035
+ .statsSeries {
156036
+ display: flex;
156037
+ align-items: center;
156038
+ gap: 8px;
156027
156039
  }
156028
-
156029
- .apexcharts-graphical {
156030
- background: transparent !important;
156040
+ .statsSeries + .statsSeries {
156041
+ padding-left: 24px;
156042
+ border-left: 1px solid ${cssManager.bdTheme("hsl(0 0% 89.8%)", "hsl(0 0% 14.9%)")};
156043
+ }
156044
+ .statsColor {
156045
+ width: 8px;
156046
+ height: 8px;
156047
+ border-radius: 2px;
156048
+ flex-shrink: 0;
156049
+ }
156050
+ .statsName {
156051
+ font-weight: 500;
156052
+ color: ${cssManager.bdTheme("hsl(0 0% 20%)", "hsl(0 0% 80%)")};
156053
+ margin-right: 4px;
156054
+ }
156055
+ .statsItem strong {
156056
+ color: ${cssManager.bdTheme("hsl(0 0% 15%)", "hsl(0 0% 90%)")};
156057
+ }
156058
+ .lw-tooltip {
156059
+ position: absolute;
156060
+ z-index: 100;
156061
+ pointer-events: none;
156062
+ padding: 12px;
156063
+ border-radius: 6px;
156064
+ border: 1px solid;
156065
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
156066
+ font-size: 12px;
156067
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
156068
+ min-width: 140px;
156031
156069
  }
156032
156070
  `
156033
156071
  ];
@@ -156039,6 +156077,20 @@ var renderChartArea = /* @__PURE__ */ __name((component) => {
156039
156077
  <div class="mainbox">
156040
156078
  <div class="chartTitle">${component.label}</div>
156041
156079
  <div class="chartContainer"></div>
156080
+ ${component.seriesStats.length > 0 ? b2`
156081
+ <div class="statsBar">
156082
+ ${component.seriesStats.map((s10) => b2`
156083
+ <div class="statsSeries">
156084
+ <span class="statsColor" style="background:${s10.color}"></span>
156085
+ <span class="statsName">${s10.name}</span>
156086
+ <span class="statsItem">latest <strong>${component.yAxisFormatter(s10.latest)}</strong></span>
156087
+ <span class="statsItem">min <strong>${component.yAxisFormatter(s10.min)}</strong></span>
156088
+ <span class="statsItem">max <strong>${component.yAxisFormatter(s10.max)}</strong></span>
156089
+ <span class="statsItem">avg <strong>${component.yAxisFormatter(s10.avg)}</strong></span>
156090
+ </div>
156091
+ `)}
156092
+ </div>
156093
+ ` : ""}
156042
156094
  </div>
156043
156095
  `;
156044
156096
  }, "renderChartArea");
@@ -156047,318 +156099,327 @@ var renderChartArea = /* @__PURE__ */ __name((component) => {
156047
156099
  init_dist_ts30();
156048
156100
  init_dist_ts29();
156049
156101
  init_services();
156050
- var _autoScrollInterval_dec, _yAxisMax_dec, _yAxisScaling_dec, _realtimeMode_dec, _rollingWindow_dec, _yAxisFormatter_dec, _series_dec, _label_dec5, _chart_dec, _a53, _DeesChartArea_decorators, _init54, _chart, _label5, _series, _yAxisFormatter, _rollingWindow, _realtimeMode, _yAxisScaling, _yAxisMax, _autoScrollInterval;
156102
+ var _autoScrollInterval_dec, _yAxisMax_dec, _yAxisScaling_dec, _realtimeMode_dec, _rollingWindow_dec, _yAxisFormatter_dec, _series_dec, _label_dec5, _seriesStats_dec, _chart_dec, _a53, _DeesChartArea_decorators, _init54, _chart, _seriesStats, _label5, _series, _yAxisFormatter, _rollingWindow, _realtimeMode, _yAxisScaling, _yAxisMax, _autoScrollInterval;
156051
156103
  _DeesChartArea_decorators = [customElement("dees-chart-area")];
156052
- var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_dec = [r5()], _label_dec5 = [n5()], _series_dec = [n5({ type: Array })], _yAxisFormatter_dec = [n5({ attribute: false })], _rollingWindow_dec = [n5({ type: Number })], _realtimeMode_dec = [n5({ type: Boolean })], _yAxisScaling_dec = [n5({ type: String })], _yAxisMax_dec = [n5({ type: Number })], _autoScrollInterval_dec = [n5({ type: Number })], _a53) {
156104
+ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_dec = [r5()], _seriesStats_dec = [r5()], _label_dec5 = [n5()], _series_dec = [n5({ type: Array })], _yAxisFormatter_dec = [n5({ attribute: false })], _rollingWindow_dec = [n5({ type: Number })], _realtimeMode_dec = [n5({ type: Boolean })], _yAxisScaling_dec = [n5({ type: String })], _yAxisMax_dec = [n5({ type: Number })], _autoScrollInterval_dec = [n5({ type: Number })], _a53) {
156053
156105
  constructor() {
156054
156106
  super();
156055
- __privateAdd(this, _chart, __runInitializers(_init54, 8, this)), __runInitializers(_init54, 11, this);
156056
- __privateAdd(this, _label5, __runInitializers(_init54, 12, this, "Untitled Chart")), __runInitializers(_init54, 15, this);
156057
- __privateAdd(this, _series, __runInitializers(_init54, 16, this, [])), __runInitializers(_init54, 19, this);
156058
- __privateAdd(this, _yAxisFormatter, __runInitializers(_init54, 20, this, /* @__PURE__ */ __name((val) => `${val} Mbps`, "yAxisFormatter"))), __runInitializers(_init54, 23, this);
156059
- __privateAdd(this, _rollingWindow, __runInitializers(_init54, 24, this, 0)), __runInitializers(_init54, 27, this);
156060
- __privateAdd(this, _realtimeMode, __runInitializers(_init54, 28, this, false)), __runInitializers(_init54, 31, this);
156061
- __privateAdd(this, _yAxisScaling, __runInitializers(_init54, 32, this, "dynamic")), __runInitializers(_init54, 35, this);
156062
- __privateAdd(this, _yAxisMax, __runInitializers(_init54, 36, this, 100)), __runInitializers(_init54, 39, this);
156063
- __privateAdd(this, _autoScrollInterval, __runInitializers(_init54, 40, this, 1e3)), __runInitializers(_init54, 43, this);
156064
- // Auto-scroll interval in milliseconds (0 to disable)
156065
- __publicField(this, "resizeObserver");
156066
- __publicField(this, "resizeTimeout");
156107
+ __privateAdd(this, _chart, __runInitializers(_init54, 8, this, null)), __runInitializers(_init54, 11, this);
156108
+ __privateAdd(this, _seriesStats, __runInitializers(_init54, 12, this, [])), __runInitializers(_init54, 15, this);
156109
+ __privateAdd(this, _label5, __runInitializers(_init54, 16, this, "Untitled Chart")), __runInitializers(_init54, 19, this);
156110
+ __privateAdd(this, _series, __runInitializers(_init54, 20, this, [])), __runInitializers(_init54, 23, this);
156111
+ __privateAdd(this, _yAxisFormatter, __runInitializers(_init54, 24, this, /* @__PURE__ */ __name((val) => `${val} Mbps`, "yAxisFormatter"))), __runInitializers(_init54, 27, this);
156112
+ __privateAdd(this, _rollingWindow, __runInitializers(_init54, 28, this, 0)), __runInitializers(_init54, 31, this);
156113
+ __privateAdd(this, _realtimeMode, __runInitializers(_init54, 32, this, false)), __runInitializers(_init54, 35, this);
156114
+ __privateAdd(this, _yAxisScaling, __runInitializers(_init54, 36, this, "dynamic")), __runInitializers(_init54, 39, this);
156115
+ __privateAdd(this, _yAxisMax, __runInitializers(_init54, 40, this, 100)), __runInitializers(_init54, 43, this);
156116
+ __privateAdd(this, _autoScrollInterval, __runInitializers(_init54, 44, this, 1e3)), __runInitializers(_init54, 47, this);
156067
156117
  __publicField(this, "internalChartData", []);
156068
156118
  __publicField(this, "autoScrollTimer", null);
156069
- __publicField(this, "DEBUG_RESIZE", false);
156070
- // Set to true to enable resize debugging
156071
- // Chart color schemes
156119
+ __publicField(this, "lcBundle", null);
156120
+ __publicField(this, "seriesApis", /* @__PURE__ */ new Map());
156121
+ __publicField(this, "priceLines", /* @__PURE__ */ new Map());
156122
+ __publicField(this, "tooltipEl", null);
156072
156123
  __publicField(this, "CHART_COLORS", {
156073
156124
  dark: [
156074
156125
  "hsl(217.2 91.2% 59.8%)",
156075
- // Blue
156076
156126
  "hsl(173.4 80.4% 40%)",
156077
- // Teal
156078
156127
  "hsl(280.3 87.4% 66.7%)",
156079
- // Purple
156080
156128
  "hsl(24.6 95% 53.1%)"
156081
- // Orange
156082
156129
  ],
156083
156130
  light: [
156084
156131
  "hsl(222.2 47.4% 51.2%)",
156085
- // Blue (shadcn primary)
156086
156132
  "hsl(142.1 76.2% 36.3%)",
156087
- // Green (shadcn success)
156088
156133
  "hsl(280.3 47.7% 50.2%)",
156089
- // Purple (muted)
156090
156134
  "hsl(20.5 90.2% 48.2%)"
156091
- // Orange (shadcn destructive variant)
156092
156135
  ]
156093
156136
  });
156094
156137
  domtools_elementbasic_exports.setup();
156095
- this.resizeObserver = new ResizeObserver((entries) => {
156096
- if (this.resizeTimeout) {
156097
- clearTimeout(this.resizeTimeout);
156098
- }
156099
- this.resizeTimeout = window.setTimeout(() => {
156100
- if (this.chart) {
156101
- if (this.DEBUG_RESIZE && entries.length > 0) {
156102
- const entry = entries[0];
156103
- console.log("DeesChartArea - Resize detected:", {
156104
- width: entry.contentRect.width,
156105
- height: entry.contentRect.height
156106
- });
156107
- }
156108
- this.resizeChart();
156109
- }
156110
- }, 100);
156111
- });
156112
156138
  this.registerGarbageFunction(async () => {
156113
- if (this.resizeTimeout) {
156114
- clearTimeout(this.resizeTimeout);
156115
- }
156116
- if (this.resizeObserver) {
156117
- this.resizeObserver.disconnect();
156118
- }
156119
156139
  this.stopAutoScroll();
156120
156140
  if (this.chart) {
156121
156141
  try {
156122
- this.chart.destroy();
156142
+ this.chart.remove();
156123
156143
  this.chart = null;
156124
- } catch (error) {
156125
- console.error("Error destroying chart:", error);
156144
+ this.seriesApis.clear();
156145
+ this.priceLines.clear();
156146
+ } catch (e11) {
156147
+ console.error("Error destroying chart:", e11);
156126
156148
  }
156127
156149
  }
156128
156150
  });
156129
156151
  }
156130
- // Override getter to return internal chart data
156131
156152
  get chartSeries() {
156132
156153
  return this.internalChartData.length > 0 ? this.internalChartData : this.series;
156133
156154
  }
156134
- async connectedCallback() {
156135
- super.connectedCallback();
156136
- if (this.chart) {
156137
- await new Promise((resolve2) => requestAnimationFrame(resolve2));
156138
- await this.resizeChart();
156139
- }
156140
- }
156141
156155
  render() {
156142
156156
  return renderChartArea(this);
156143
156157
  }
156158
+ // --- Helpers ---
156159
+ convertDataToLC(data) {
156160
+ return data.map((point4) => {
156161
+ const ms = typeof point4.x === "number" ? point4.x : new Date(point4.x).getTime();
156162
+ return { time: Math.floor(ms / 1e3), value: point4.y };
156163
+ }).sort((a5, b5) => a5.time - b5.time);
156164
+ }
156165
+ hslToRgba(hslColor, alpha) {
156166
+ const match2 = hslColor.match(/hsl\(([^)]+)\)/);
156167
+ if (!match2) return hslColor;
156168
+ const parts = match2[1].trim().split(/\s+/);
156169
+ if (parts.length < 3) return hslColor;
156170
+ const h8 = parseFloat(parts[0]) / 360;
156171
+ const s10 = parseFloat(parts[1]) / 100;
156172
+ const l6 = parseFloat(parts[2]) / 100;
156173
+ let r11, g4, b5;
156174
+ if (s10 === 0) {
156175
+ r11 = g4 = b5 = l6;
156176
+ } else {
156177
+ const hue2rgb = /* @__PURE__ */ __name((p7, q, t9) => {
156178
+ if (t9 < 0) t9 += 1;
156179
+ if (t9 > 1) t9 -= 1;
156180
+ if (t9 < 1 / 6) return p7 + (q - p7) * 6 * t9;
156181
+ if (t9 < 1 / 2) return q;
156182
+ if (t9 < 2 / 3) return p7 + (q - p7) * (2 / 3 - t9) * 6;
156183
+ return p7;
156184
+ }, "hue2rgb");
156185
+ const q2 = l6 < 0.5 ? l6 * (1 + s10) : l6 + s10 - l6 * s10;
156186
+ const p22 = 2 * l6 - q2;
156187
+ r11 = hue2rgb(p22, q2, h8 + 1 / 3);
156188
+ g4 = hue2rgb(p22, q2, h8);
156189
+ b5 = hue2rgb(p22, q2, h8 - 1 / 3);
156190
+ }
156191
+ return `rgba(${Math.round(r11 * 255)}, ${Math.round(g4 * 255)}, ${Math.round(b5 * 255)}, ${alpha})`;
156192
+ }
156193
+ getSeriesColors(isDark) {
156194
+ return isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light;
156195
+ }
156196
+ applyTheme() {
156197
+ if (!this.chart || !this.lcBundle) return;
156198
+ const isDark = !this.goBright;
156199
+ const colors8 = this.getSeriesColors(isDark);
156200
+ this.chart.applyOptions({
156201
+ layout: {
156202
+ background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
156203
+ textColor: isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)",
156204
+ attributionLogo: false
156205
+ },
156206
+ grid: {
156207
+ vertLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" },
156208
+ horzLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" }
156209
+ }
156210
+ });
156211
+ let idx = 0;
156212
+ for (const [, api2] of this.seriesApis) {
156213
+ const color2 = colors8[idx % colors8.length];
156214
+ api2.applyOptions({
156215
+ topColor: this.hslToRgba(color2, isDark ? 0.4 : 0.5),
156216
+ bottomColor: this.hslToRgba(color2, 0),
156217
+ lineColor: color2
156218
+ });
156219
+ idx++;
156220
+ }
156221
+ }
156222
+ recreateSeries(chartSeries) {
156223
+ if (!this.chart || !this.lcBundle) return;
156224
+ const isDark = !this.goBright;
156225
+ const colors8 = this.getSeriesColors(isDark);
156226
+ for (const [, api2] of this.seriesApis) {
156227
+ this.chart.removeSeries(api2);
156228
+ }
156229
+ this.seriesApis.clear();
156230
+ this.priceLines.clear();
156231
+ chartSeries.forEach((s10, index2) => {
156232
+ const color2 = colors8[index2 % colors8.length];
156233
+ const api2 = this.chart.addSeries(this.lcBundle.AreaSeries, {
156234
+ topColor: this.hslToRgba(color2, isDark ? 0.4 : 0.5),
156235
+ bottomColor: this.hslToRgba(color2, 0),
156236
+ lineColor: color2,
156237
+ lineWidth: 2,
156238
+ lineType: this.lcBundle.LineType.Curved,
156239
+ lastValueVisible: false,
156240
+ priceLineVisible: false,
156241
+ crosshairMarkerVisible: true,
156242
+ crosshairMarkerRadius: 4
156243
+ });
156244
+ api2.setData(this.convertDataToLC(s10.data));
156245
+ this.updatePriceLines(s10.name || `series-${index2}`, api2, s10.data, color2);
156246
+ if (this.yAxisScaling !== "dynamic") {
156247
+ api2.applyOptions({
156248
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({
156249
+ priceRange: { minValue: 0, maxValue: this.yAxisMax }
156250
+ }), "autoscaleInfoProvider")
156251
+ });
156252
+ }
156253
+ this.seriesApis.set(s10.name || `series-${index2}`, api2);
156254
+ });
156255
+ this.computeStats(chartSeries);
156256
+ }
156257
+ computeStats(chartSeries) {
156258
+ const isDark = !this.goBright;
156259
+ const colors8 = this.getSeriesColors(isDark);
156260
+ this.seriesStats = chartSeries.map((s10, index2) => {
156261
+ const values = s10.data.map((d5) => d5.y);
156262
+ if (values.length === 0) {
156263
+ return { name: s10.name || `series-${index2}`, latest: 0, min: 0, max: 0, avg: 0, color: colors8[index2 % colors8.length] };
156264
+ }
156265
+ const latest = values[values.length - 1];
156266
+ const min3 = Math.min(...values);
156267
+ const max3 = Math.max(...values);
156268
+ const avg = Math.round(values.reduce((sum, v5) => sum + v5, 0) / values.length * 100) / 100;
156269
+ return { name: s10.name || `series-${index2}`, latest, min: min3, max: max3, avg, color: colors8[index2 % colors8.length] };
156270
+ });
156271
+ }
156272
+ updatePriceLines(name, api2, data, color2) {
156273
+ const existing = this.priceLines.get(name);
156274
+ if (existing) {
156275
+ for (const line of existing) {
156276
+ api2.removePriceLine(line);
156277
+ }
156278
+ }
156279
+ if (data.length === 0) {
156280
+ this.priceLines.set(name, []);
156281
+ return;
156282
+ }
156283
+ const values = data.map((d5) => d5.y);
156284
+ const avg = values.reduce((sum, v5) => sum + v5, 0) / values.length;
156285
+ const max3 = Math.max(...values);
156286
+ const lines = [];
156287
+ lines.push(api2.createPriceLine({
156288
+ price: Math.round(avg * 100) / 100,
156289
+ color: this.hslToRgba(color2, 0.5),
156290
+ lineWidth: 1,
156291
+ lineStyle: 2,
156292
+ // Dashed
156293
+ axisLabelVisible: true,
156294
+ title: "avg"
156295
+ }));
156296
+ if (avg > 0 && (max3 - avg) / avg > 0.1) {
156297
+ lines.push(api2.createPriceLine({
156298
+ price: max3,
156299
+ color: this.hslToRgba(color2, 0.8),
156300
+ lineWidth: 1,
156301
+ lineStyle: 1,
156302
+ // Dotted
156303
+ axisLabelVisible: true,
156304
+ title: "max"
156305
+ }));
156306
+ }
156307
+ this.priceLines.set(name, lines);
156308
+ }
156309
+ setupTooltip() {
156310
+ if (!this.chart) return;
156311
+ this.tooltipEl = document.createElement("div");
156312
+ this.tooltipEl.className = "lw-tooltip";
156313
+ this.tooltipEl.style.display = "none";
156314
+ this.shadowRoot.querySelector(".chartContainer")?.appendChild(this.tooltipEl);
156315
+ this.chart.subscribeCrosshairMove((param) => {
156316
+ if (!this.tooltipEl) return;
156317
+ if (!param.point || !param.time || param.point.x < 0 || param.point.y < 0) {
156318
+ this.tooltipEl.style.display = "none";
156319
+ return;
156320
+ }
156321
+ const isDark = !this.goBright;
156322
+ const bgColor = isDark ? "hsl(0 0% 9%)" : "hsl(0 0% 100%)";
156323
+ const textColor = isDark ? "hsl(0 0% 95%)" : "hsl(0 0% 9%)";
156324
+ const borderColor = isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 89.8%)";
156325
+ const colors8 = this.getSeriesColors(isDark);
156326
+ let html9 = "";
156327
+ let idx = 0;
156328
+ let hasData = false;
156329
+ for (const [name, api2] of this.seriesApis) {
156330
+ const data = param.seriesData.get(api2);
156331
+ if (data && "value" in data && data.value !== void 0) {
156332
+ hasData = true;
156333
+ const color2 = colors8[idx % colors8.length];
156334
+ const formatted = this.yAxisFormatter(data.value);
156335
+ html9 += `<div style="display:flex;align-items:center;gap:8px;margin:${idx > 0 ? "6px" : "0"} 0;">
156336
+ <span style="display:inline-block;width:10px;height:10px;background:${color2};border-radius:2px;"></span>
156337
+ <span style="font-weight:500;">${name}:</span>
156338
+ <span style="margin-left:auto;font-weight:600;">${formatted}</span>
156339
+ </div>`;
156340
+ }
156341
+ idx++;
156342
+ }
156343
+ if (!hasData) {
156344
+ this.tooltipEl.style.display = "none";
156345
+ return;
156346
+ }
156347
+ this.tooltipEl.innerHTML = html9;
156348
+ Object.assign(this.tooltipEl.style, {
156349
+ display: "block",
156350
+ background: bgColor,
156351
+ color: textColor,
156352
+ borderColor
156353
+ });
156354
+ const containerWidth = this.shadowRoot.querySelector(".chartContainer").clientWidth;
156355
+ let left = param.point.x + 16;
156356
+ if (left + 200 > containerWidth) left = param.point.x - 216;
156357
+ this.tooltipEl.style.left = `${left}px`;
156358
+ this.tooltipEl.style.top = `${param.point.y - 16}px`;
156359
+ });
156360
+ }
156361
+ // --- Lifecycle ---
156144
156362
  async firstUpdated() {
156145
156363
  await this.domtoolsPromise;
156146
- const ApexChartsLib = await DeesServiceLibLoader.getInstance().loadApexCharts();
156364
+ this.lcBundle = await DeesServiceLibLoader.getInstance().loadLightweightCharts();
156147
156365
  await new Promise((resolve2) => requestAnimationFrame(resolve2));
156148
- const mainbox = this.shadowRoot.querySelector(".mainbox");
156149
156366
  const chartContainer = this.shadowRoot.querySelector(".chartContainer");
156150
- if (!mainbox || !chartContainer) {
156151
- console.error("Chart containers not found");
156152
- return;
156153
- }
156154
- const styleChartContainer = window.getComputedStyle(chartContainer);
156155
- const paddingTop = parseInt(styleChartContainer.paddingTop, 10);
156156
- const paddingBottom = parseInt(styleChartContainer.paddingBottom, 10);
156157
- const paddingLeft = parseInt(styleChartContainer.paddingLeft, 10);
156158
- const paddingRight = parseInt(styleChartContainer.paddingRight, 10);
156159
- const initialWidth = mainbox.clientWidth - paddingLeft - paddingRight;
156160
- const initialHeight = mainbox.offsetHeight - paddingTop - paddingBottom;
156161
- const chartSeries = this.series.length > 0 ? this.series : [
156162
- {
156163
- name: "cpu",
156164
- data: [
156165
- { x: "2025-01-15T03:00:00", y: 25 },
156166
- { x: "2025-01-15T07:00:00", y: 30 },
156167
- { x: "2025-01-15T11:00:00", y: 20 },
156168
- { x: "2025-01-15T15:00:00", y: 35 },
156169
- { x: "2025-01-15T19:00:00", y: 25 }
156170
- ]
156171
- },
156172
- {
156173
- name: "memory",
156174
- data: [
156175
- { x: "2025-01-15T03:00:00", y: 10 },
156176
- { x: "2025-01-15T07:00:00", y: 12 },
156177
- { x: "2025-01-15T11:00:00", y: 10 },
156178
- { x: "2025-01-15T15:00:00", y: 30 },
156179
- { x: "2025-01-15T19:00:00", y: 40 }
156180
- ]
156181
- }
156182
- ];
156183
- this.internalChartData = chartSeries;
156367
+ if (!chartContainer) return;
156184
156368
  const isDark = !this.goBright;
156185
- const theme = isDark ? "dark" : "light";
156186
- var options = {
156187
- series: chartSeries,
156188
- chart: {
156189
- width: initialWidth || 100,
156190
- // Use actual width or fallback
156191
- height: initialHeight || 100,
156192
- // Use actual height or fallback
156193
- type: "area",
156194
- background: "transparent",
156195
- // Transparent background to inherit from container
156196
- toolbar: {
156197
- show: false
156198
- // This line disables the toolbar
156199
- },
156200
- animations: {
156201
- enabled: !this.realtimeMode,
156202
- // Disable animations in realtime mode
156203
- speed: 400,
156204
- animateGradually: {
156205
- enabled: false,
156206
- // Disable gradual animation for cleaner updates
156207
- delay: 0
156208
- },
156209
- dynamicAnimation: {
156210
- enabled: !this.realtimeMode,
156211
- speed: 350
156212
- }
156213
- },
156214
- zoom: {
156215
- enabled: false
156216
- // Disable zoom for cleaner interaction
156217
- },
156218
- selection: {
156219
- enabled: false
156220
- // Disable selection
156221
- }
156222
- },
156223
- dataLabels: {
156224
- enabled: false
156225
- },
156226
- stroke: {
156227
- width: 2,
156228
- curve: "smooth"
156229
- },
156230
- xaxis: {
156231
- type: "datetime",
156232
- // Time-series data
156233
- labels: {
156234
- format: "HH:mm:ss",
156235
- // Time formatting with seconds
156236
- datetimeUTC: false,
156237
- style: {
156238
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
156239
- // Label color
156240
- fontSize: "12px",
156241
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
156242
- fontWeight: "400"
156243
- }
156369
+ try {
156370
+ this.chart = this.lcBundle.createChart(chartContainer, {
156371
+ autoSize: true,
156372
+ layout: {
156373
+ background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
156374
+ textColor: isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)",
156375
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
156376
+ fontSize: 12,
156377
+ attributionLogo: false
156244
156378
  },
156245
- axisBorder: {
156246
- show: false
156247
- // Hide x-axis border
156379
+ grid: {
156380
+ vertLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" },
156381
+ horzLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" }
156248
156382
  },
156249
- axisTicks: {
156250
- show: false
156251
- // Hide x-axis ticks
156252
- }
156253
- },
156254
- yaxis: {
156255
- min: 0,
156256
- max: this.yAxisScaling === "dynamic" ? void 0 : this.yAxisMax,
156257
- labels: {
156258
- formatter: this.yAxisFormatter,
156259
- style: {
156260
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
156261
- // Label color
156262
- fontSize: "12px",
156263
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
156264
- fontWeight: "400"
156265
- }
156383
+ rightPriceScale: {
156384
+ borderVisible: false,
156385
+ scaleMargins: { top: 0.1, bottom: 0.1 }
156266
156386
  },
156267
- axisBorder: {
156268
- show: false
156269
- // Hide y-axis border
156387
+ timeScale: {
156388
+ borderVisible: false,
156389
+ timeVisible: true,
156390
+ secondsVisible: true
156270
156391
  },
156271
- axisTicks: {
156272
- show: false
156273
- // Hide y-axis ticks
156274
- }
156275
- },
156276
- tooltip: {
156277
- shared: true,
156278
- // Enables the tooltip to display across series
156279
- intersect: false,
156280
- // Allows hovering anywhere on the chart
156281
- followCursor: true,
156282
- // Makes tooltip follow mouse even between points
156283
- x: {
156284
- format: "dd/MM/yy HH:mm"
156285
- },
156286
- custom: /* @__PURE__ */ __name(({ series, dataPointIndex, w: w4 }) => {
156287
- const currentTheme = w4.config.theme.mode;
156288
- const isDarkMode = currentTheme === "dark";
156289
- const bgColor = isDarkMode ? "hsl(0 0% 9%)" : "hsl(0 0% 100%)";
156290
- const textColor = isDarkMode ? "hsl(0 0% 95%)" : "hsl(0 0% 9%)";
156291
- const borderColor = isDarkMode ? "hsl(0 0% 14.9%)" : "hsl(0 0% 89.8%)";
156292
- const formatter2 = w4.config.yaxis[0]?.labels?.formatter || ((val) => val.toString());
156293
- let tooltipContent = `<div style="padding: 12px; background: ${bgColor}; color: ${textColor}; border-radius: 6px; box-shadow: 0 2px 8px 0 hsl(0 0% 0% / ${isDarkMode ? "0.2" : "0.1"}); border: 1px solid ${borderColor};font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 12px;">`;
156294
- series.forEach((s10, index2) => {
156295
- const label = w4.globals.seriesNames[index2];
156296
- const value2 = s10[dataPointIndex];
156297
- const color2 = w4.globals.colors[index2];
156298
- const formattedValue = formatter2(value2);
156299
- tooltipContent += `<div style="display: flex; align-items: center; gap: 8px; margin: ${index2 > 0 ? "6px" : "0"} 0;">
156300
- <span style="display: inline-block; width: 10px; height: 10px; background: ${color2}; border-radius: 2px;"></span>
156301
- <span style="font-weight: 500;">${label}:</span>
156302
- <span style="margin-left: auto; font-weight: 600;">${formattedValue}</span>
156303
- </div>`;
156304
- });
156305
- tooltipContent += `</div>`;
156306
- return tooltipContent;
156307
- }, "custom")
156308
- },
156309
- grid: {
156310
- xaxis: {
156311
- lines: {
156312
- show: false
156313
- // Hide vertical grid lines for cleaner look
156314
- }
156392
+ crosshair: {
156393
+ mode: this.lcBundle.CrosshairMode.Magnet
156315
156394
  },
156316
- yaxis: {
156317
- lines: {
156318
- show: true
156319
- }
156395
+ handleScroll: false,
156396
+ handleScale: false
156397
+ });
156398
+ const chartSeries = this.series.length > 0 ? this.series : [
156399
+ {
156400
+ name: "cpu",
156401
+ data: [
156402
+ { x: "2025-01-15T03:00:00", y: 25 },
156403
+ { x: "2025-01-15T07:00:00", y: 30 },
156404
+ { x: "2025-01-15T11:00:00", y: 20 },
156405
+ { x: "2025-01-15T15:00:00", y: 35 },
156406
+ { x: "2025-01-15T19:00:00", y: 25 }
156407
+ ]
156320
156408
  },
156321
- borderColor: isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 94%)",
156322
- // Very subtle grid lines
156323
- strokeDashArray: 0,
156324
- // Solid line
156325
- padding: {
156326
- top: 10,
156327
- right: 20,
156328
- bottom: 10,
156329
- left: 20
156330
- }
156331
- },
156332
- fill: {
156333
- type: "gradient",
156334
- // Gradient fill for the area
156335
- gradient: {
156336
- shade: isDark ? "dark" : "light",
156337
- type: "vertical",
156338
- shadeIntensity: 0.1,
156339
- opacityFrom: isDark ? 0.2 : 0.3,
156340
- opacityTo: 0,
156341
- stops: [0, 100]
156342
- }
156343
- },
156344
- colors: isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light,
156345
- theme: {
156346
- mode: theme
156347
- }
156348
- };
156349
- try {
156350
- this.chart = new ApexChartsLib(this.shadowRoot.querySelector(".chartContainer"), options);
156351
- await this.chart.render();
156352
- await new Promise((resolve2) => setTimeout(resolve2, 100));
156353
- await this.resizeChart();
156354
- const mainbox2 = this.shadowRoot.querySelector(".mainbox");
156355
- if (mainbox2 && this.resizeObserver) {
156356
- this.resizeObserver.disconnect();
156357
- this.resizeObserver.observe(mainbox2);
156358
- if (this.DEBUG_RESIZE) {
156359
- console.log("DeesChartArea - ResizeObserver attached to mainbox");
156409
+ {
156410
+ name: "memory",
156411
+ data: [
156412
+ { x: "2025-01-15T03:00:00", y: 10 },
156413
+ { x: "2025-01-15T07:00:00", y: 12 },
156414
+ { x: "2025-01-15T11:00:00", y: 10 },
156415
+ { x: "2025-01-15T15:00:00", y: 30 },
156416
+ { x: "2025-01-15T19:00:00", y: 40 }
156417
+ ]
156360
156418
  }
156361
- }
156419
+ ];
156420
+ this.internalChartData = chartSeries;
156421
+ this.recreateSeries(chartSeries);
156422
+ this.setupTooltip();
156362
156423
  } catch (error) {
156363
156424
  console.error("Failed to initialize chart:", error);
156364
156425
  }
@@ -156366,37 +156427,14 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
156366
156427
  async updated(changedProperties) {
156367
156428
  super.updated(changedProperties);
156368
156429
  if (changedProperties.has("goBright") && this.chart) {
156369
- await this.updateChartTheme();
156430
+ this.applyTheme();
156370
156431
  }
156371
156432
  if (changedProperties.has("series") && this.chart && this.series.length > 0) {
156372
156433
  await this.updateSeries(this.series);
156373
156434
  }
156374
156435
  if (changedProperties.has("yAxisFormatter") && this.chart) {
156375
- await this.chart.updateOptions({
156376
- yaxis: {
156377
- labels: {
156378
- formatter: this.yAxisFormatter
156379
- }
156380
- }
156381
- });
156382
156436
  }
156383
156437
  if (changedProperties.has("realtimeMode") && this.chart) {
156384
- await this.chart.updateOptions({
156385
- chart: {
156386
- animations: {
156387
- enabled: !this.realtimeMode,
156388
- speed: 400,
156389
- animateGradually: {
156390
- enabled: false,
156391
- delay: 0
156392
- },
156393
- dynamicAnimation: {
156394
- enabled: !this.realtimeMode,
156395
- speed: 350
156396
- }
156397
- }
156398
- }
156399
- });
156400
156438
  if (this.realtimeMode && this.rollingWindow > 0 && this.autoScrollInterval > 0) {
156401
156439
  this.startAutoScroll();
156402
156440
  } else {
@@ -156410,157 +156448,122 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
156410
156448
  }
156411
156449
  }
156412
156450
  if ((changedProperties.has("yAxisScaling") || changedProperties.has("yAxisMax")) && this.chart) {
156413
- await this.chart.updateOptions({
156414
- yaxis: {
156415
- min: 0,
156416
- max: this.yAxisScaling === "dynamic" ? void 0 : this.yAxisMax
156451
+ for (const [, api2] of this.seriesApis) {
156452
+ if (this.yAxisScaling === "dynamic") {
156453
+ api2.applyOptions({ autoscaleInfoProvider: void 0 });
156454
+ } else {
156455
+ api2.applyOptions({
156456
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({ priceRange: { minValue: 0, maxValue: this.yAxisMax } }), "autoscaleInfoProvider")
156457
+ });
156417
156458
  }
156418
- });
156459
+ }
156419
156460
  }
156420
156461
  }
156462
+ // --- Public API ---
156421
156463
  async updateSeries(newSeries, animate = true) {
156422
- if (!this.chart) {
156423
- return;
156424
- }
156464
+ if (!this.chart) return;
156425
156465
  try {
156426
156466
  this.internalChartData = newSeries;
156427
156467
  if (this.rollingWindow > 0 && this.realtimeMode) {
156428
156468
  const now2 = Date.now();
156429
156469
  const cutoffTime = now2 - this.rollingWindow;
156430
- const filteredSeries = newSeries.map((series) => ({
156431
- name: series.name,
156432
- data: series.data.filter((point4) => {
156433
- if (typeof point4 === "object" && point4 !== null && "x" in point4) {
156434
- return new Date(point4.x).getTime() > cutoffTime;
156435
- }
156436
- return false;
156437
- })
156438
- }));
156439
- if (filteredSeries.some((s10) => s10.data.length > 0)) {
156440
- const isDark = !this.goBright;
156441
- const options = {
156442
- series: filteredSeries,
156443
- xaxis: {
156444
- min: cutoffTime,
156445
- max: now2,
156446
- labels: {
156447
- format: "HH:mm:ss",
156448
- datetimeUTC: false,
156449
- style: {
156450
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
156451
- fontSize: "12px",
156452
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
156453
- fontWeight: "400"
156454
- }
156455
- },
156456
- tickAmount: 6
156457
- }
156458
- };
156459
- if (this.yAxisScaling === "dynamic") {
156460
- const allValues = filteredSeries.flatMap((s10) => s10.data.map((d5) => d5.y));
156461
- if (allValues.length > 0) {
156462
- const maxValue = Math.max(...allValues);
156463
- const dynamicMax = Math.ceil(maxValue * 1.1);
156464
- options.yaxis = { min: 0, max: dynamicMax };
156470
+ if (newSeries.length !== this.seriesApis.size) {
156471
+ this.recreateSeries(newSeries);
156472
+ } else {
156473
+ const colors8 = this.getSeriesColors(!this.goBright);
156474
+ newSeries.forEach((s10, index2) => {
156475
+ const name = s10.name || `series-${index2}`;
156476
+ const api2 = this.seriesApis.get(name);
156477
+ if (!api2) return;
156478
+ const filtered = s10.data.filter((point4) => {
156479
+ const ms = typeof point4.x === "number" ? point4.x : new Date(point4.x).getTime();
156480
+ return ms > cutoffTime;
156481
+ });
156482
+ api2.setData(this.convertDataToLC(filtered));
156483
+ this.updatePriceLines(name, api2, filtered, colors8[index2 % colors8.length]);
156484
+ });
156485
+ this.computeStats(newSeries);
156486
+ }
156487
+ try {
156488
+ this.chart.timeScale().setVisibleRange({
156489
+ from: Math.floor(cutoffTime / 1e3),
156490
+ to: Math.floor(now2 / 1e3)
156491
+ });
156492
+ } catch (e11) {
156493
+ }
156494
+ if (this.yAxisScaling === "dynamic") {
156495
+ const allValues = newSeries.flatMap(
156496
+ (s10) => s10.data.filter((p7) => {
156497
+ const ms = typeof p7.x === "number" ? p7.x : new Date(p7.x).getTime();
156498
+ return ms > cutoffTime;
156499
+ }).map((d5) => d5.y)
156500
+ );
156501
+ if (allValues.length > 0) {
156502
+ const dynamicMax = Math.ceil(Math.max(...allValues) * 1.1);
156503
+ for (const [, api2] of this.seriesApis) {
156504
+ api2.applyOptions({
156505
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({ priceRange: { minValue: 0, maxValue: dynamicMax } }), "autoscaleInfoProvider")
156506
+ });
156465
156507
  }
156466
156508
  }
156467
- await this.chart.updateOptions(options, false, false);
156468
156509
  }
156469
156510
  } else {
156470
- await this.chart.updateSeries(newSeries, animate);
156511
+ if (newSeries.length !== this.seriesApis.size) {
156512
+ this.recreateSeries(newSeries);
156513
+ } else {
156514
+ const colors8 = this.getSeriesColors(!this.goBright);
156515
+ newSeries.forEach((s10, index2) => {
156516
+ const name = s10.name || `series-${index2}`;
156517
+ const api2 = this.seriesApis.get(name);
156518
+ if (!api2) return;
156519
+ api2.setData(this.convertDataToLC(s10.data));
156520
+ this.updatePriceLines(name, api2, s10.data, colors8[index2 % colors8.length]);
156521
+ });
156522
+ this.computeStats(newSeries);
156523
+ }
156471
156524
  }
156472
156525
  } catch (error) {
156473
156526
  console.error("Failed to update chart series:", error);
156474
156527
  }
156475
156528
  }
156476
- // Update just the x-axis for smooth scrolling in realtime mode
156477
- // Public for advanced usage in demos, but typically handled automatically
156478
156529
  async updateTimeWindow() {
156479
- if (!this.chart || this.rollingWindow <= 0) {
156480
- return;
156481
- }
156530
+ if (!this.chart || this.rollingWindow <= 0) return;
156482
156531
  const now2 = Date.now();
156483
156532
  const cutoffTime = now2 - this.rollingWindow;
156484
- await this.chart.updateOptions({
156485
- xaxis: {
156486
- min: cutoffTime,
156487
- max: now2,
156488
- labels: {
156489
- format: "HH:mm:ss",
156490
- datetimeUTC: false,
156491
- style: {
156492
- colors: [!this.goBright ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
156493
- fontSize: "12px",
156494
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
156495
- fontWeight: "400"
156496
- }
156497
- },
156498
- tickAmount: 6
156499
- }
156500
- }, false, false);
156533
+ try {
156534
+ this.chart.timeScale().setVisibleRange({
156535
+ from: Math.floor(cutoffTime / 1e3),
156536
+ to: Math.floor(now2 / 1e3)
156537
+ });
156538
+ } catch (e11) {
156539
+ }
156501
156540
  }
156502
156541
  async appendData(newData) {
156503
- if (!this.chart) {
156504
- return;
156505
- }
156506
- this.chart.appendData(newData);
156542
+ if (!this.chart) return;
156543
+ newData.forEach((s10, index2) => {
156544
+ const name = s10.name || `series-${index2}`;
156545
+ const api2 = this.seriesApis.get(name);
156546
+ if (!api2 || s10.data.length === 0) return;
156547
+ for (const point4 of s10.data) {
156548
+ const lcPoints = this.convertDataToLC([point4]);
156549
+ if (lcPoints.length > 0) api2.update(lcPoints[0]);
156550
+ }
156551
+ });
156507
156552
  }
156508
- async updateOptions(options, redrawPaths, animate) {
156509
- if (!this.chart) {
156510
- return;
156511
- }
156512
- return this.chart.updateOptions(options, redrawPaths, animate);
156553
+ async updateOptions(options) {
156554
+ if (!this.chart) return;
156555
+ this.chart.applyOptions(options);
156513
156556
  }
156514
156557
  async resizeChart() {
156515
- if (!this.chart) {
156516
- return;
156517
- }
156518
- if (this.DEBUG_RESIZE) {
156519
- console.log("DeesChartArea - resizeChart called");
156520
- }
156521
- try {
156522
- const mainbox = this.shadowRoot.querySelector(".mainbox");
156523
- const chartContainer = this.shadowRoot.querySelector(".chartContainer");
156524
- if (!mainbox || !chartContainer) {
156525
- return;
156526
- }
156527
- void mainbox.offsetHeight;
156528
- const styleChartContainer = window.getComputedStyle(chartContainer);
156529
- const paddingTop = parseInt(styleChartContainer.paddingTop, 10);
156530
- const paddingBottom = parseInt(styleChartContainer.paddingBottom, 10);
156531
- const paddingLeft = parseInt(styleChartContainer.paddingLeft, 10);
156532
- const paddingRight = parseInt(styleChartContainer.paddingRight, 10);
156533
- const actualWidth = mainbox.clientWidth - paddingLeft - paddingRight;
156534
- const actualHeight = mainbox.offsetHeight - paddingTop - paddingBottom;
156535
- if (actualWidth > 0 && actualHeight > 0) {
156536
- if (this.DEBUG_RESIZE) {
156537
- console.log("DeesChartArea - Updating chart dimensions:", {
156538
- width: actualWidth,
156539
- height: actualHeight
156540
- });
156541
- }
156542
- await this.chart.updateOptions({
156543
- chart: {
156544
- width: actualWidth,
156545
- height: actualHeight
156546
- }
156547
- }, true, false);
156548
- }
156549
- } catch (error) {
156550
- console.error("Failed to resize chart:", error);
156558
+ if (this.chart) {
156559
+ this.chart.timeScale().fitContent();
156551
156560
  }
156552
156561
  }
156553
- /**
156554
- * Manually trigger a chart resize. Useful when automatic detection doesn't work.
156555
- * This is a convenience method that can be called from outside the component.
156556
- */
156557
156562
  async forceResize() {
156558
156563
  await this.resizeChart();
156559
156564
  }
156560
156565
  startAutoScroll() {
156561
- if (this.autoScrollTimer) {
156562
- return;
156563
- }
156566
+ if (this.autoScrollTimer) return;
156564
156567
  this.autoScrollTimer = window.setInterval(() => {
156565
156568
  this.updateTimeWindow();
156566
156569
  }, this.autoScrollInterval);
@@ -156571,45 +156574,10 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
156571
156574
  this.autoScrollTimer = null;
156572
156575
  }
156573
156576
  }
156574
- async updateChartTheme() {
156575
- if (!this.chart) {
156576
- return;
156577
- }
156578
- const isDark = !this.goBright;
156579
- const theme = isDark ? "dark" : "light";
156580
- await this.chart.updateOptions({
156581
- theme: {
156582
- mode: theme
156583
- },
156584
- colors: isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light,
156585
- xaxis: {
156586
- labels: {
156587
- style: {
156588
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"]
156589
- }
156590
- }
156591
- },
156592
- yaxis: {
156593
- labels: {
156594
- style: {
156595
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"]
156596
- }
156597
- }
156598
- },
156599
- grid: {
156600
- borderColor: isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 94%)"
156601
- },
156602
- fill: {
156603
- gradient: {
156604
- shade: isDark ? "dark" : "light",
156605
- opacityFrom: isDark ? 0.2 : 0.3
156606
- }
156607
- }
156608
- });
156609
- }
156610
156577
  };
156611
156578
  _init54 = __decoratorStart(_a53);
156612
156579
  _chart = new WeakMap();
156580
+ _seriesStats = new WeakMap();
156613
156581
  _label5 = new WeakMap();
156614
156582
  _series = new WeakMap();
156615
156583
  _yAxisFormatter = new WeakMap();
@@ -156619,6 +156587,7 @@ _yAxisScaling = new WeakMap();
156619
156587
  _yAxisMax = new WeakMap();
156620
156588
  _autoScrollInterval = new WeakMap();
156621
156589
  __decorateElement(_init54, 4, "chart", _chart_dec, _DeesChartArea, _chart);
156590
+ __decorateElement(_init54, 4, "seriesStats", _seriesStats_dec, _DeesChartArea, _seriesStats);
156622
156591
  __decorateElement(_init54, 4, "label", _label_dec5, _DeesChartArea, _label5);
156623
156592
  __decorateElement(_init54, 4, "series", _series_dec, _DeesChartArea, _series);
156624
156593
  __decorateElement(_init54, 4, "yAxisFormatter", _yAxisFormatter_dec, _DeesChartArea, _yAxisFormatter);
@@ -173934,6 +173903,7 @@ var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a89 = DeesElement, _
173934
173903
  terminal.style.top = "var(--banner-area-height, 0px)";
173935
173904
  terminal.style.left = "240px";
173936
173905
  terminal.style.right = "0px";
173906
+ terminal.style.height = "auto";
173937
173907
  terminal.style.bottom = "24px";
173938
173908
  terminal.style.opacity = "0";
173939
173909
  terminal.style.transform = "translateY(8px) scale(0.99)";