@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:
@@ -150641,7 +150648,6 @@ var chartAreaStyles = [
150641
150648
  :host {
150642
150649
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
150643
150650
  color: ${cssManager.bdTheme("hsl(0 0% 3.9%)", "hsl(0 0% 98%)")};
150644
- font-weight: 400;
150645
150651
  font-size: 14px;
150646
150652
  }
150647
150653
  .mainbox {
@@ -150653,7 +150659,6 @@ var chartAreaStyles = [
150653
150659
  border-radius: 8px;
150654
150660
  overflow: hidden;
150655
150661
  }
150656
-
150657
150662
  .chartTitle {
150658
150663
  position: absolute;
150659
150664
  top: 0;
@@ -150669,26 +150674,59 @@ var chartAreaStyles = [
150669
150674
  }
150670
150675
  .chartContainer {
150671
150676
  position: absolute;
150672
- top: 0px;
150673
- left: 0px;
150674
- bottom: 0px;
150675
- right: 0px;
150676
- padding: 44px 16px 16px 0px;
150677
- overflow: hidden;
150678
- background: transparent; /* Ensure container doesn't override chart background */
150677
+ top: 44px;
150678
+ left: 0;
150679
+ bottom: 32px;
150680
+ right: 0;
150679
150681
  }
150680
-
150681
- /* ApexCharts theme overrides */
150682
- .apexcharts-canvas {
150683
- background: transparent !important;
150682
+ .statsBar {
150683
+ position: absolute;
150684
+ bottom: 0;
150685
+ left: 0;
150686
+ right: 0;
150687
+ height: 32px;
150688
+ display: flex;
150689
+ align-items: center;
150690
+ gap: 24px;
150691
+ padding: 0 16px;
150692
+ border-top: 1px solid ${cssManager.bdTheme("hsl(0 0% 89.8%)", "hsl(0 0% 14.9%)")};
150693
+ font-size: 11px;
150694
+ color: ${cssManager.bdTheme("hsl(0 0% 45%)", "hsl(0 0% 55%)")};
150684
150695
  }
150685
-
150686
- .apexcharts-inner {
150687
- background: transparent !important;
150696
+ .statsSeries {
150697
+ display: flex;
150698
+ align-items: center;
150699
+ gap: 8px;
150688
150700
  }
150689
-
150690
- .apexcharts-graphical {
150691
- background: transparent !important;
150701
+ .statsSeries + .statsSeries {
150702
+ padding-left: 24px;
150703
+ border-left: 1px solid ${cssManager.bdTheme("hsl(0 0% 89.8%)", "hsl(0 0% 14.9%)")};
150704
+ }
150705
+ .statsColor {
150706
+ width: 8px;
150707
+ height: 8px;
150708
+ border-radius: 2px;
150709
+ flex-shrink: 0;
150710
+ }
150711
+ .statsName {
150712
+ font-weight: 500;
150713
+ color: ${cssManager.bdTheme("hsl(0 0% 20%)", "hsl(0 0% 80%)")};
150714
+ margin-right: 4px;
150715
+ }
150716
+ .statsItem strong {
150717
+ color: ${cssManager.bdTheme("hsl(0 0% 15%)", "hsl(0 0% 90%)")};
150718
+ }
150719
+ .lw-tooltip {
150720
+ position: absolute;
150721
+ z-index: 100;
150722
+ pointer-events: none;
150723
+ padding: 12px;
150724
+ border-radius: 6px;
150725
+ border: 1px solid;
150726
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
150727
+ font-size: 12px;
150728
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
150729
+ min-width: 140px;
150692
150730
  }
150693
150731
  `
150694
150732
  ];
@@ -150700,6 +150738,20 @@ var renderChartArea = /* @__PURE__ */ __name((component) => {
150700
150738
  <div class="mainbox">
150701
150739
  <div class="chartTitle">${component.label}</div>
150702
150740
  <div class="chartContainer"></div>
150741
+ ${component.seriesStats.length > 0 ? b2`
150742
+ <div class="statsBar">
150743
+ ${component.seriesStats.map((s10) => b2`
150744
+ <div class="statsSeries">
150745
+ <span class="statsColor" style="background:${s10.color}"></span>
150746
+ <span class="statsName">${s10.name}</span>
150747
+ <span class="statsItem">latest <strong>${component.yAxisFormatter(s10.latest)}</strong></span>
150748
+ <span class="statsItem">min <strong>${component.yAxisFormatter(s10.min)}</strong></span>
150749
+ <span class="statsItem">max <strong>${component.yAxisFormatter(s10.max)}</strong></span>
150750
+ <span class="statsItem">avg <strong>${component.yAxisFormatter(s10.avg)}</strong></span>
150751
+ </div>
150752
+ `)}
150753
+ </div>
150754
+ ` : ""}
150703
150755
  </div>
150704
150756
  `;
150705
150757
  }, "renderChartArea");
@@ -150708,318 +150760,327 @@ var renderChartArea = /* @__PURE__ */ __name((component) => {
150708
150760
  init_dist_ts30();
150709
150761
  init_dist_ts29();
150710
150762
  init_services();
150711
- 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;
150763
+ 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;
150712
150764
  _DeesChartArea_decorators = [customElement("dees-chart-area")];
150713
- 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) {
150765
+ 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) {
150714
150766
  constructor() {
150715
150767
  super();
150716
- __privateAdd(this, _chart, __runInitializers(_init54, 8, this)), __runInitializers(_init54, 11, this);
150717
- __privateAdd(this, _label5, __runInitializers(_init54, 12, this, "Untitled Chart")), __runInitializers(_init54, 15, this);
150718
- __privateAdd(this, _series, __runInitializers(_init54, 16, this, [])), __runInitializers(_init54, 19, this);
150719
- __privateAdd(this, _yAxisFormatter, __runInitializers(_init54, 20, this, /* @__PURE__ */ __name((val) => `${val} Mbps`, "yAxisFormatter"))), __runInitializers(_init54, 23, this);
150720
- __privateAdd(this, _rollingWindow, __runInitializers(_init54, 24, this, 0)), __runInitializers(_init54, 27, this);
150721
- __privateAdd(this, _realtimeMode, __runInitializers(_init54, 28, this, false)), __runInitializers(_init54, 31, this);
150722
- __privateAdd(this, _yAxisScaling, __runInitializers(_init54, 32, this, "dynamic")), __runInitializers(_init54, 35, this);
150723
- __privateAdd(this, _yAxisMax, __runInitializers(_init54, 36, this, 100)), __runInitializers(_init54, 39, this);
150724
- __privateAdd(this, _autoScrollInterval, __runInitializers(_init54, 40, this, 1e3)), __runInitializers(_init54, 43, this);
150725
- // Auto-scroll interval in milliseconds (0 to disable)
150726
- __publicField(this, "resizeObserver");
150727
- __publicField(this, "resizeTimeout");
150768
+ __privateAdd(this, _chart, __runInitializers(_init54, 8, this, null)), __runInitializers(_init54, 11, this);
150769
+ __privateAdd(this, _seriesStats, __runInitializers(_init54, 12, this, [])), __runInitializers(_init54, 15, this);
150770
+ __privateAdd(this, _label5, __runInitializers(_init54, 16, this, "Untitled Chart")), __runInitializers(_init54, 19, this);
150771
+ __privateAdd(this, _series, __runInitializers(_init54, 20, this, [])), __runInitializers(_init54, 23, this);
150772
+ __privateAdd(this, _yAxisFormatter, __runInitializers(_init54, 24, this, /* @__PURE__ */ __name((val) => `${val} Mbps`, "yAxisFormatter"))), __runInitializers(_init54, 27, this);
150773
+ __privateAdd(this, _rollingWindow, __runInitializers(_init54, 28, this, 0)), __runInitializers(_init54, 31, this);
150774
+ __privateAdd(this, _realtimeMode, __runInitializers(_init54, 32, this, false)), __runInitializers(_init54, 35, this);
150775
+ __privateAdd(this, _yAxisScaling, __runInitializers(_init54, 36, this, "dynamic")), __runInitializers(_init54, 39, this);
150776
+ __privateAdd(this, _yAxisMax, __runInitializers(_init54, 40, this, 100)), __runInitializers(_init54, 43, this);
150777
+ __privateAdd(this, _autoScrollInterval, __runInitializers(_init54, 44, this, 1e3)), __runInitializers(_init54, 47, this);
150728
150778
  __publicField(this, "internalChartData", []);
150729
150779
  __publicField(this, "autoScrollTimer", null);
150730
- __publicField(this, "DEBUG_RESIZE", false);
150731
- // Set to true to enable resize debugging
150732
- // Chart color schemes
150780
+ __publicField(this, "lcBundle", null);
150781
+ __publicField(this, "seriesApis", /* @__PURE__ */ new Map());
150782
+ __publicField(this, "priceLines", /* @__PURE__ */ new Map());
150783
+ __publicField(this, "tooltipEl", null);
150733
150784
  __publicField(this, "CHART_COLORS", {
150734
150785
  dark: [
150735
150786
  "hsl(217.2 91.2% 59.8%)",
150736
- // Blue
150737
150787
  "hsl(173.4 80.4% 40%)",
150738
- // Teal
150739
150788
  "hsl(280.3 87.4% 66.7%)",
150740
- // Purple
150741
150789
  "hsl(24.6 95% 53.1%)"
150742
- // Orange
150743
150790
  ],
150744
150791
  light: [
150745
150792
  "hsl(222.2 47.4% 51.2%)",
150746
- // Blue (shadcn primary)
150747
150793
  "hsl(142.1 76.2% 36.3%)",
150748
- // Green (shadcn success)
150749
150794
  "hsl(280.3 47.7% 50.2%)",
150750
- // Purple (muted)
150751
150795
  "hsl(20.5 90.2% 48.2%)"
150752
- // Orange (shadcn destructive variant)
150753
150796
  ]
150754
150797
  });
150755
150798
  domtools_elementbasic_exports.setup();
150756
- this.resizeObserver = new ResizeObserver((entries) => {
150757
- if (this.resizeTimeout) {
150758
- clearTimeout(this.resizeTimeout);
150759
- }
150760
- this.resizeTimeout = window.setTimeout(() => {
150761
- if (this.chart) {
150762
- if (this.DEBUG_RESIZE && entries.length > 0) {
150763
- const entry = entries[0];
150764
- console.log("DeesChartArea - Resize detected:", {
150765
- width: entry.contentRect.width,
150766
- height: entry.contentRect.height
150767
- });
150768
- }
150769
- this.resizeChart();
150770
- }
150771
- }, 100);
150772
- });
150773
150799
  this.registerGarbageFunction(async () => {
150774
- if (this.resizeTimeout) {
150775
- clearTimeout(this.resizeTimeout);
150776
- }
150777
- if (this.resizeObserver) {
150778
- this.resizeObserver.disconnect();
150779
- }
150780
150800
  this.stopAutoScroll();
150781
150801
  if (this.chart) {
150782
150802
  try {
150783
- this.chart.destroy();
150803
+ this.chart.remove();
150784
150804
  this.chart = null;
150785
- } catch (error) {
150786
- console.error("Error destroying chart:", error);
150805
+ this.seriesApis.clear();
150806
+ this.priceLines.clear();
150807
+ } catch (e11) {
150808
+ console.error("Error destroying chart:", e11);
150787
150809
  }
150788
150810
  }
150789
150811
  });
150790
150812
  }
150791
- // Override getter to return internal chart data
150792
150813
  get chartSeries() {
150793
150814
  return this.internalChartData.length > 0 ? this.internalChartData : this.series;
150794
150815
  }
150795
- async connectedCallback() {
150796
- super.connectedCallback();
150797
- if (this.chart) {
150798
- await new Promise((resolve2) => requestAnimationFrame(resolve2));
150799
- await this.resizeChart();
150800
- }
150801
- }
150802
150816
  render() {
150803
150817
  return renderChartArea(this);
150804
150818
  }
150819
+ // --- Helpers ---
150820
+ convertDataToLC(data) {
150821
+ return data.map((point4) => {
150822
+ const ms = typeof point4.x === "number" ? point4.x : new Date(point4.x).getTime();
150823
+ return { time: Math.floor(ms / 1e3), value: point4.y };
150824
+ }).sort((a5, b5) => a5.time - b5.time);
150825
+ }
150826
+ hslToRgba(hslColor, alpha) {
150827
+ const match2 = hslColor.match(/hsl\(([^)]+)\)/);
150828
+ if (!match2) return hslColor;
150829
+ const parts = match2[1].trim().split(/\s+/);
150830
+ if (parts.length < 3) return hslColor;
150831
+ const h8 = parseFloat(parts[0]) / 360;
150832
+ const s10 = parseFloat(parts[1]) / 100;
150833
+ const l6 = parseFloat(parts[2]) / 100;
150834
+ let r11, g4, b5;
150835
+ if (s10 === 0) {
150836
+ r11 = g4 = b5 = l6;
150837
+ } else {
150838
+ const hue2rgb = /* @__PURE__ */ __name((p7, q, t9) => {
150839
+ if (t9 < 0) t9 += 1;
150840
+ if (t9 > 1) t9 -= 1;
150841
+ if (t9 < 1 / 6) return p7 + (q - p7) * 6 * t9;
150842
+ if (t9 < 1 / 2) return q;
150843
+ if (t9 < 2 / 3) return p7 + (q - p7) * (2 / 3 - t9) * 6;
150844
+ return p7;
150845
+ }, "hue2rgb");
150846
+ const q2 = l6 < 0.5 ? l6 * (1 + s10) : l6 + s10 - l6 * s10;
150847
+ const p22 = 2 * l6 - q2;
150848
+ r11 = hue2rgb(p22, q2, h8 + 1 / 3);
150849
+ g4 = hue2rgb(p22, q2, h8);
150850
+ b5 = hue2rgb(p22, q2, h8 - 1 / 3);
150851
+ }
150852
+ return `rgba(${Math.round(r11 * 255)}, ${Math.round(g4 * 255)}, ${Math.round(b5 * 255)}, ${alpha})`;
150853
+ }
150854
+ getSeriesColors(isDark) {
150855
+ return isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light;
150856
+ }
150857
+ applyTheme() {
150858
+ if (!this.chart || !this.lcBundle) return;
150859
+ const isDark = !this.goBright;
150860
+ const colors8 = this.getSeriesColors(isDark);
150861
+ this.chart.applyOptions({
150862
+ layout: {
150863
+ background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
150864
+ textColor: isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)",
150865
+ attributionLogo: false
150866
+ },
150867
+ grid: {
150868
+ vertLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" },
150869
+ horzLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" }
150870
+ }
150871
+ });
150872
+ let idx = 0;
150873
+ for (const [, api2] of this.seriesApis) {
150874
+ const color2 = colors8[idx % colors8.length];
150875
+ api2.applyOptions({
150876
+ topColor: this.hslToRgba(color2, isDark ? 0.4 : 0.5),
150877
+ bottomColor: this.hslToRgba(color2, 0),
150878
+ lineColor: color2
150879
+ });
150880
+ idx++;
150881
+ }
150882
+ }
150883
+ recreateSeries(chartSeries) {
150884
+ if (!this.chart || !this.lcBundle) return;
150885
+ const isDark = !this.goBright;
150886
+ const colors8 = this.getSeriesColors(isDark);
150887
+ for (const [, api2] of this.seriesApis) {
150888
+ this.chart.removeSeries(api2);
150889
+ }
150890
+ this.seriesApis.clear();
150891
+ this.priceLines.clear();
150892
+ chartSeries.forEach((s10, index2) => {
150893
+ const color2 = colors8[index2 % colors8.length];
150894
+ const api2 = this.chart.addSeries(this.lcBundle.AreaSeries, {
150895
+ topColor: this.hslToRgba(color2, isDark ? 0.4 : 0.5),
150896
+ bottomColor: this.hslToRgba(color2, 0),
150897
+ lineColor: color2,
150898
+ lineWidth: 2,
150899
+ lineType: this.lcBundle.LineType.Curved,
150900
+ lastValueVisible: false,
150901
+ priceLineVisible: false,
150902
+ crosshairMarkerVisible: true,
150903
+ crosshairMarkerRadius: 4
150904
+ });
150905
+ api2.setData(this.convertDataToLC(s10.data));
150906
+ this.updatePriceLines(s10.name || `series-${index2}`, api2, s10.data, color2);
150907
+ if (this.yAxisScaling !== "dynamic") {
150908
+ api2.applyOptions({
150909
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({
150910
+ priceRange: { minValue: 0, maxValue: this.yAxisMax }
150911
+ }), "autoscaleInfoProvider")
150912
+ });
150913
+ }
150914
+ this.seriesApis.set(s10.name || `series-${index2}`, api2);
150915
+ });
150916
+ this.computeStats(chartSeries);
150917
+ }
150918
+ computeStats(chartSeries) {
150919
+ const isDark = !this.goBright;
150920
+ const colors8 = this.getSeriesColors(isDark);
150921
+ this.seriesStats = chartSeries.map((s10, index2) => {
150922
+ const values = s10.data.map((d5) => d5.y);
150923
+ if (values.length === 0) {
150924
+ return { name: s10.name || `series-${index2}`, latest: 0, min: 0, max: 0, avg: 0, color: colors8[index2 % colors8.length] };
150925
+ }
150926
+ const latest = values[values.length - 1];
150927
+ const min3 = Math.min(...values);
150928
+ const max3 = Math.max(...values);
150929
+ const avg = Math.round(values.reduce((sum, v5) => sum + v5, 0) / values.length * 100) / 100;
150930
+ return { name: s10.name || `series-${index2}`, latest, min: min3, max: max3, avg, color: colors8[index2 % colors8.length] };
150931
+ });
150932
+ }
150933
+ updatePriceLines(name, api2, data, color2) {
150934
+ const existing = this.priceLines.get(name);
150935
+ if (existing) {
150936
+ for (const line of existing) {
150937
+ api2.removePriceLine(line);
150938
+ }
150939
+ }
150940
+ if (data.length === 0) {
150941
+ this.priceLines.set(name, []);
150942
+ return;
150943
+ }
150944
+ const values = data.map((d5) => d5.y);
150945
+ const avg = values.reduce((sum, v5) => sum + v5, 0) / values.length;
150946
+ const max3 = Math.max(...values);
150947
+ const lines = [];
150948
+ lines.push(api2.createPriceLine({
150949
+ price: Math.round(avg * 100) / 100,
150950
+ color: this.hslToRgba(color2, 0.5),
150951
+ lineWidth: 1,
150952
+ lineStyle: 2,
150953
+ // Dashed
150954
+ axisLabelVisible: true,
150955
+ title: "avg"
150956
+ }));
150957
+ if (avg > 0 && (max3 - avg) / avg > 0.1) {
150958
+ lines.push(api2.createPriceLine({
150959
+ price: max3,
150960
+ color: this.hslToRgba(color2, 0.8),
150961
+ lineWidth: 1,
150962
+ lineStyle: 1,
150963
+ // Dotted
150964
+ axisLabelVisible: true,
150965
+ title: "max"
150966
+ }));
150967
+ }
150968
+ this.priceLines.set(name, lines);
150969
+ }
150970
+ setupTooltip() {
150971
+ if (!this.chart) return;
150972
+ this.tooltipEl = document.createElement("div");
150973
+ this.tooltipEl.className = "lw-tooltip";
150974
+ this.tooltipEl.style.display = "none";
150975
+ this.shadowRoot.querySelector(".chartContainer")?.appendChild(this.tooltipEl);
150976
+ this.chart.subscribeCrosshairMove((param) => {
150977
+ if (!this.tooltipEl) return;
150978
+ if (!param.point || !param.time || param.point.x < 0 || param.point.y < 0) {
150979
+ this.tooltipEl.style.display = "none";
150980
+ return;
150981
+ }
150982
+ const isDark = !this.goBright;
150983
+ const bgColor = isDark ? "hsl(0 0% 9%)" : "hsl(0 0% 100%)";
150984
+ const textColor = isDark ? "hsl(0 0% 95%)" : "hsl(0 0% 9%)";
150985
+ const borderColor = isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 89.8%)";
150986
+ const colors8 = this.getSeriesColors(isDark);
150987
+ let html9 = "";
150988
+ let idx = 0;
150989
+ let hasData = false;
150990
+ for (const [name, api2] of this.seriesApis) {
150991
+ const data = param.seriesData.get(api2);
150992
+ if (data && "value" in data && data.value !== void 0) {
150993
+ hasData = true;
150994
+ const color2 = colors8[idx % colors8.length];
150995
+ const formatted = this.yAxisFormatter(data.value);
150996
+ html9 += `<div style="display:flex;align-items:center;gap:8px;margin:${idx > 0 ? "6px" : "0"} 0;">
150997
+ <span style="display:inline-block;width:10px;height:10px;background:${color2};border-radius:2px;"></span>
150998
+ <span style="font-weight:500;">${name}:</span>
150999
+ <span style="margin-left:auto;font-weight:600;">${formatted}</span>
151000
+ </div>`;
151001
+ }
151002
+ idx++;
151003
+ }
151004
+ if (!hasData) {
151005
+ this.tooltipEl.style.display = "none";
151006
+ return;
151007
+ }
151008
+ this.tooltipEl.innerHTML = html9;
151009
+ Object.assign(this.tooltipEl.style, {
151010
+ display: "block",
151011
+ background: bgColor,
151012
+ color: textColor,
151013
+ borderColor
151014
+ });
151015
+ const containerWidth = this.shadowRoot.querySelector(".chartContainer").clientWidth;
151016
+ let left = param.point.x + 16;
151017
+ if (left + 200 > containerWidth) left = param.point.x - 216;
151018
+ this.tooltipEl.style.left = `${left}px`;
151019
+ this.tooltipEl.style.top = `${param.point.y - 16}px`;
151020
+ });
151021
+ }
151022
+ // --- Lifecycle ---
150805
151023
  async firstUpdated() {
150806
151024
  await this.domtoolsPromise;
150807
- const ApexChartsLib = await DeesServiceLibLoader.getInstance().loadApexCharts();
151025
+ this.lcBundle = await DeesServiceLibLoader.getInstance().loadLightweightCharts();
150808
151026
  await new Promise((resolve2) => requestAnimationFrame(resolve2));
150809
- const mainbox = this.shadowRoot.querySelector(".mainbox");
150810
151027
  const chartContainer = this.shadowRoot.querySelector(".chartContainer");
150811
- if (!mainbox || !chartContainer) {
150812
- console.error("Chart containers not found");
150813
- return;
150814
- }
150815
- const styleChartContainer = window.getComputedStyle(chartContainer);
150816
- const paddingTop = parseInt(styleChartContainer.paddingTop, 10);
150817
- const paddingBottom = parseInt(styleChartContainer.paddingBottom, 10);
150818
- const paddingLeft = parseInt(styleChartContainer.paddingLeft, 10);
150819
- const paddingRight = parseInt(styleChartContainer.paddingRight, 10);
150820
- const initialWidth = mainbox.clientWidth - paddingLeft - paddingRight;
150821
- const initialHeight = mainbox.offsetHeight - paddingTop - paddingBottom;
150822
- const chartSeries = this.series.length > 0 ? this.series : [
150823
- {
150824
- name: "cpu",
150825
- data: [
150826
- { x: "2025-01-15T03:00:00", y: 25 },
150827
- { x: "2025-01-15T07:00:00", y: 30 },
150828
- { x: "2025-01-15T11:00:00", y: 20 },
150829
- { x: "2025-01-15T15:00:00", y: 35 },
150830
- { x: "2025-01-15T19:00:00", y: 25 }
150831
- ]
150832
- },
150833
- {
150834
- name: "memory",
150835
- data: [
150836
- { x: "2025-01-15T03:00:00", y: 10 },
150837
- { x: "2025-01-15T07:00:00", y: 12 },
150838
- { x: "2025-01-15T11:00:00", y: 10 },
150839
- { x: "2025-01-15T15:00:00", y: 30 },
150840
- { x: "2025-01-15T19:00:00", y: 40 }
150841
- ]
150842
- }
150843
- ];
150844
- this.internalChartData = chartSeries;
151028
+ if (!chartContainer) return;
150845
151029
  const isDark = !this.goBright;
150846
- const theme = isDark ? "dark" : "light";
150847
- var options = {
150848
- series: chartSeries,
150849
- chart: {
150850
- width: initialWidth || 100,
150851
- // Use actual width or fallback
150852
- height: initialHeight || 100,
150853
- // Use actual height or fallback
150854
- type: "area",
150855
- background: "transparent",
150856
- // Transparent background to inherit from container
150857
- toolbar: {
150858
- show: false
150859
- // This line disables the toolbar
150860
- },
150861
- animations: {
150862
- enabled: !this.realtimeMode,
150863
- // Disable animations in realtime mode
150864
- speed: 400,
150865
- animateGradually: {
150866
- enabled: false,
150867
- // Disable gradual animation for cleaner updates
150868
- delay: 0
150869
- },
150870
- dynamicAnimation: {
150871
- enabled: !this.realtimeMode,
150872
- speed: 350
150873
- }
150874
- },
150875
- zoom: {
150876
- enabled: false
150877
- // Disable zoom for cleaner interaction
150878
- },
150879
- selection: {
150880
- enabled: false
150881
- // Disable selection
150882
- }
150883
- },
150884
- dataLabels: {
150885
- enabled: false
150886
- },
150887
- stroke: {
150888
- width: 2,
150889
- curve: "smooth"
150890
- },
150891
- xaxis: {
150892
- type: "datetime",
150893
- // Time-series data
150894
- labels: {
150895
- format: "HH:mm:ss",
150896
- // Time formatting with seconds
150897
- datetimeUTC: false,
150898
- style: {
150899
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
150900
- // Label color
150901
- fontSize: "12px",
150902
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
150903
- fontWeight: "400"
150904
- }
151030
+ try {
151031
+ this.chart = this.lcBundle.createChart(chartContainer, {
151032
+ autoSize: true,
151033
+ layout: {
151034
+ background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
151035
+ textColor: isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)",
151036
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
151037
+ fontSize: 12,
151038
+ attributionLogo: false
150905
151039
  },
150906
- axisBorder: {
150907
- show: false
150908
- // Hide x-axis border
151040
+ grid: {
151041
+ vertLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" },
151042
+ horzLines: { color: isDark ? "hsl(0 0% 8.5%)" : "hsl(0 0% 95.5%)" }
150909
151043
  },
150910
- axisTicks: {
150911
- show: false
150912
- // Hide x-axis ticks
150913
- }
150914
- },
150915
- yaxis: {
150916
- min: 0,
150917
- max: this.yAxisScaling === "dynamic" ? void 0 : this.yAxisMax,
150918
- labels: {
150919
- formatter: this.yAxisFormatter,
150920
- style: {
150921
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
150922
- // Label color
150923
- fontSize: "12px",
150924
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
150925
- fontWeight: "400"
150926
- }
151044
+ rightPriceScale: {
151045
+ borderVisible: false,
151046
+ scaleMargins: { top: 0.1, bottom: 0.1 }
150927
151047
  },
150928
- axisBorder: {
150929
- show: false
150930
- // Hide y-axis border
151048
+ timeScale: {
151049
+ borderVisible: false,
151050
+ timeVisible: true,
151051
+ secondsVisible: true
150931
151052
  },
150932
- axisTicks: {
150933
- show: false
150934
- // Hide y-axis ticks
150935
- }
150936
- },
150937
- tooltip: {
150938
- shared: true,
150939
- // Enables the tooltip to display across series
150940
- intersect: false,
150941
- // Allows hovering anywhere on the chart
150942
- followCursor: true,
150943
- // Makes tooltip follow mouse even between points
150944
- x: {
150945
- format: "dd/MM/yy HH:mm"
150946
- },
150947
- custom: /* @__PURE__ */ __name(({ series, dataPointIndex, w: w4 }) => {
150948
- const currentTheme = w4.config.theme.mode;
150949
- const isDarkMode = currentTheme === "dark";
150950
- const bgColor = isDarkMode ? "hsl(0 0% 9%)" : "hsl(0 0% 100%)";
150951
- const textColor = isDarkMode ? "hsl(0 0% 95%)" : "hsl(0 0% 9%)";
150952
- const borderColor = isDarkMode ? "hsl(0 0% 14.9%)" : "hsl(0 0% 89.8%)";
150953
- const formatter2 = w4.config.yaxis[0]?.labels?.formatter || ((val) => val.toString());
150954
- 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;">`;
150955
- series.forEach((s10, index2) => {
150956
- const label = w4.globals.seriesNames[index2];
150957
- const value2 = s10[dataPointIndex];
150958
- const color2 = w4.globals.colors[index2];
150959
- const formattedValue = formatter2(value2);
150960
- tooltipContent += `<div style="display: flex; align-items: center; gap: 8px; margin: ${index2 > 0 ? "6px" : "0"} 0;">
150961
- <span style="display: inline-block; width: 10px; height: 10px; background: ${color2}; border-radius: 2px;"></span>
150962
- <span style="font-weight: 500;">${label}:</span>
150963
- <span style="margin-left: auto; font-weight: 600;">${formattedValue}</span>
150964
- </div>`;
150965
- });
150966
- tooltipContent += `</div>`;
150967
- return tooltipContent;
150968
- }, "custom")
150969
- },
150970
- grid: {
150971
- xaxis: {
150972
- lines: {
150973
- show: false
150974
- // Hide vertical grid lines for cleaner look
150975
- }
151053
+ crosshair: {
151054
+ mode: this.lcBundle.CrosshairMode.Magnet
150976
151055
  },
150977
- yaxis: {
150978
- lines: {
150979
- show: true
150980
- }
151056
+ handleScroll: false,
151057
+ handleScale: false
151058
+ });
151059
+ const chartSeries = this.series.length > 0 ? this.series : [
151060
+ {
151061
+ name: "cpu",
151062
+ data: [
151063
+ { x: "2025-01-15T03:00:00", y: 25 },
151064
+ { x: "2025-01-15T07:00:00", y: 30 },
151065
+ { x: "2025-01-15T11:00:00", y: 20 },
151066
+ { x: "2025-01-15T15:00:00", y: 35 },
151067
+ { x: "2025-01-15T19:00:00", y: 25 }
151068
+ ]
150981
151069
  },
150982
- borderColor: isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 94%)",
150983
- // Very subtle grid lines
150984
- strokeDashArray: 0,
150985
- // Solid line
150986
- padding: {
150987
- top: 10,
150988
- right: 20,
150989
- bottom: 10,
150990
- left: 20
150991
- }
150992
- },
150993
- fill: {
150994
- type: "gradient",
150995
- // Gradient fill for the area
150996
- gradient: {
150997
- shade: isDark ? "dark" : "light",
150998
- type: "vertical",
150999
- shadeIntensity: 0.1,
151000
- opacityFrom: isDark ? 0.2 : 0.3,
151001
- opacityTo: 0,
151002
- stops: [0, 100]
151003
- }
151004
- },
151005
- colors: isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light,
151006
- theme: {
151007
- mode: theme
151008
- }
151009
- };
151010
- try {
151011
- this.chart = new ApexChartsLib(this.shadowRoot.querySelector(".chartContainer"), options);
151012
- await this.chart.render();
151013
- await new Promise((resolve2) => setTimeout(resolve2, 100));
151014
- await this.resizeChart();
151015
- const mainbox2 = this.shadowRoot.querySelector(".mainbox");
151016
- if (mainbox2 && this.resizeObserver) {
151017
- this.resizeObserver.disconnect();
151018
- this.resizeObserver.observe(mainbox2);
151019
- if (this.DEBUG_RESIZE) {
151020
- console.log("DeesChartArea - ResizeObserver attached to mainbox");
151070
+ {
151071
+ name: "memory",
151072
+ data: [
151073
+ { x: "2025-01-15T03:00:00", y: 10 },
151074
+ { x: "2025-01-15T07:00:00", y: 12 },
151075
+ { x: "2025-01-15T11:00:00", y: 10 },
151076
+ { x: "2025-01-15T15:00:00", y: 30 },
151077
+ { x: "2025-01-15T19:00:00", y: 40 }
151078
+ ]
151021
151079
  }
151022
- }
151080
+ ];
151081
+ this.internalChartData = chartSeries;
151082
+ this.recreateSeries(chartSeries);
151083
+ this.setupTooltip();
151023
151084
  } catch (error) {
151024
151085
  console.error("Failed to initialize chart:", error);
151025
151086
  }
@@ -151027,37 +151088,14 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
151027
151088
  async updated(changedProperties) {
151028
151089
  super.updated(changedProperties);
151029
151090
  if (changedProperties.has("goBright") && this.chart) {
151030
- await this.updateChartTheme();
151091
+ this.applyTheme();
151031
151092
  }
151032
151093
  if (changedProperties.has("series") && this.chart && this.series.length > 0) {
151033
151094
  await this.updateSeries(this.series);
151034
151095
  }
151035
151096
  if (changedProperties.has("yAxisFormatter") && this.chart) {
151036
- await this.chart.updateOptions({
151037
- yaxis: {
151038
- labels: {
151039
- formatter: this.yAxisFormatter
151040
- }
151041
- }
151042
- });
151043
151097
  }
151044
151098
  if (changedProperties.has("realtimeMode") && this.chart) {
151045
- await this.chart.updateOptions({
151046
- chart: {
151047
- animations: {
151048
- enabled: !this.realtimeMode,
151049
- speed: 400,
151050
- animateGradually: {
151051
- enabled: false,
151052
- delay: 0
151053
- },
151054
- dynamicAnimation: {
151055
- enabled: !this.realtimeMode,
151056
- speed: 350
151057
- }
151058
- }
151059
- }
151060
- });
151061
151099
  if (this.realtimeMode && this.rollingWindow > 0 && this.autoScrollInterval > 0) {
151062
151100
  this.startAutoScroll();
151063
151101
  } else {
@@ -151071,157 +151109,122 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
151071
151109
  }
151072
151110
  }
151073
151111
  if ((changedProperties.has("yAxisScaling") || changedProperties.has("yAxisMax")) && this.chart) {
151074
- await this.chart.updateOptions({
151075
- yaxis: {
151076
- min: 0,
151077
- max: this.yAxisScaling === "dynamic" ? void 0 : this.yAxisMax
151112
+ for (const [, api2] of this.seriesApis) {
151113
+ if (this.yAxisScaling === "dynamic") {
151114
+ api2.applyOptions({ autoscaleInfoProvider: void 0 });
151115
+ } else {
151116
+ api2.applyOptions({
151117
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({ priceRange: { minValue: 0, maxValue: this.yAxisMax } }), "autoscaleInfoProvider")
151118
+ });
151078
151119
  }
151079
- });
151120
+ }
151080
151121
  }
151081
151122
  }
151123
+ // --- Public API ---
151082
151124
  async updateSeries(newSeries, animate = true) {
151083
- if (!this.chart) {
151084
- return;
151085
- }
151125
+ if (!this.chart) return;
151086
151126
  try {
151087
151127
  this.internalChartData = newSeries;
151088
151128
  if (this.rollingWindow > 0 && this.realtimeMode) {
151089
151129
  const now2 = Date.now();
151090
151130
  const cutoffTime = now2 - this.rollingWindow;
151091
- const filteredSeries = newSeries.map((series) => ({
151092
- name: series.name,
151093
- data: series.data.filter((point4) => {
151094
- if (typeof point4 === "object" && point4 !== null && "x" in point4) {
151095
- return new Date(point4.x).getTime() > cutoffTime;
151096
- }
151097
- return false;
151098
- })
151099
- }));
151100
- if (filteredSeries.some((s10) => s10.data.length > 0)) {
151101
- const isDark = !this.goBright;
151102
- const options = {
151103
- series: filteredSeries,
151104
- xaxis: {
151105
- min: cutoffTime,
151106
- max: now2,
151107
- labels: {
151108
- format: "HH:mm:ss",
151109
- datetimeUTC: false,
151110
- style: {
151111
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
151112
- fontSize: "12px",
151113
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
151114
- fontWeight: "400"
151115
- }
151116
- },
151117
- tickAmount: 6
151118
- }
151119
- };
151120
- if (this.yAxisScaling === "dynamic") {
151121
- const allValues = filteredSeries.flatMap((s10) => s10.data.map((d5) => d5.y));
151122
- if (allValues.length > 0) {
151123
- const maxValue = Math.max(...allValues);
151124
- const dynamicMax = Math.ceil(maxValue * 1.1);
151125
- options.yaxis = { min: 0, max: dynamicMax };
151131
+ if (newSeries.length !== this.seriesApis.size) {
151132
+ this.recreateSeries(newSeries);
151133
+ } else {
151134
+ const colors8 = this.getSeriesColors(!this.goBright);
151135
+ newSeries.forEach((s10, index2) => {
151136
+ const name = s10.name || `series-${index2}`;
151137
+ const api2 = this.seriesApis.get(name);
151138
+ if (!api2) return;
151139
+ const filtered = s10.data.filter((point4) => {
151140
+ const ms = typeof point4.x === "number" ? point4.x : new Date(point4.x).getTime();
151141
+ return ms > cutoffTime;
151142
+ });
151143
+ api2.setData(this.convertDataToLC(filtered));
151144
+ this.updatePriceLines(name, api2, filtered, colors8[index2 % colors8.length]);
151145
+ });
151146
+ this.computeStats(newSeries);
151147
+ }
151148
+ try {
151149
+ this.chart.timeScale().setVisibleRange({
151150
+ from: Math.floor(cutoffTime / 1e3),
151151
+ to: Math.floor(now2 / 1e3)
151152
+ });
151153
+ } catch (e11) {
151154
+ }
151155
+ if (this.yAxisScaling === "dynamic") {
151156
+ const allValues = newSeries.flatMap(
151157
+ (s10) => s10.data.filter((p7) => {
151158
+ const ms = typeof p7.x === "number" ? p7.x : new Date(p7.x).getTime();
151159
+ return ms > cutoffTime;
151160
+ }).map((d5) => d5.y)
151161
+ );
151162
+ if (allValues.length > 0) {
151163
+ const dynamicMax = Math.ceil(Math.max(...allValues) * 1.1);
151164
+ for (const [, api2] of this.seriesApis) {
151165
+ api2.applyOptions({
151166
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({ priceRange: { minValue: 0, maxValue: dynamicMax } }), "autoscaleInfoProvider")
151167
+ });
151126
151168
  }
151127
151169
  }
151128
- await this.chart.updateOptions(options, false, false);
151129
151170
  }
151130
151171
  } else {
151131
- await this.chart.updateSeries(newSeries, animate);
151172
+ if (newSeries.length !== this.seriesApis.size) {
151173
+ this.recreateSeries(newSeries);
151174
+ } else {
151175
+ const colors8 = this.getSeriesColors(!this.goBright);
151176
+ newSeries.forEach((s10, index2) => {
151177
+ const name = s10.name || `series-${index2}`;
151178
+ const api2 = this.seriesApis.get(name);
151179
+ if (!api2) return;
151180
+ api2.setData(this.convertDataToLC(s10.data));
151181
+ this.updatePriceLines(name, api2, s10.data, colors8[index2 % colors8.length]);
151182
+ });
151183
+ this.computeStats(newSeries);
151184
+ }
151132
151185
  }
151133
151186
  } catch (error) {
151134
151187
  console.error("Failed to update chart series:", error);
151135
151188
  }
151136
151189
  }
151137
- // Update just the x-axis for smooth scrolling in realtime mode
151138
- // Public for advanced usage in demos, but typically handled automatically
151139
151190
  async updateTimeWindow() {
151140
- if (!this.chart || this.rollingWindow <= 0) {
151141
- return;
151142
- }
151191
+ if (!this.chart || this.rollingWindow <= 0) return;
151143
151192
  const now2 = Date.now();
151144
151193
  const cutoffTime = now2 - this.rollingWindow;
151145
- await this.chart.updateOptions({
151146
- xaxis: {
151147
- min: cutoffTime,
151148
- max: now2,
151149
- labels: {
151150
- format: "HH:mm:ss",
151151
- datetimeUTC: false,
151152
- style: {
151153
- colors: [!this.goBright ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"],
151154
- fontSize: "12px",
151155
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
151156
- fontWeight: "400"
151157
- }
151158
- },
151159
- tickAmount: 6
151160
- }
151161
- }, false, false);
151194
+ try {
151195
+ this.chart.timeScale().setVisibleRange({
151196
+ from: Math.floor(cutoffTime / 1e3),
151197
+ to: Math.floor(now2 / 1e3)
151198
+ });
151199
+ } catch (e11) {
151200
+ }
151162
151201
  }
151163
151202
  async appendData(newData) {
151164
- if (!this.chart) {
151165
- return;
151166
- }
151167
- this.chart.appendData(newData);
151203
+ if (!this.chart) return;
151204
+ newData.forEach((s10, index2) => {
151205
+ const name = s10.name || `series-${index2}`;
151206
+ const api2 = this.seriesApis.get(name);
151207
+ if (!api2 || s10.data.length === 0) return;
151208
+ for (const point4 of s10.data) {
151209
+ const lcPoints = this.convertDataToLC([point4]);
151210
+ if (lcPoints.length > 0) api2.update(lcPoints[0]);
151211
+ }
151212
+ });
151168
151213
  }
151169
- async updateOptions(options, redrawPaths, animate) {
151170
- if (!this.chart) {
151171
- return;
151172
- }
151173
- return this.chart.updateOptions(options, redrawPaths, animate);
151214
+ async updateOptions(options) {
151215
+ if (!this.chart) return;
151216
+ this.chart.applyOptions(options);
151174
151217
  }
151175
151218
  async resizeChart() {
151176
- if (!this.chart) {
151177
- return;
151178
- }
151179
- if (this.DEBUG_RESIZE) {
151180
- console.log("DeesChartArea - resizeChart called");
151181
- }
151182
- try {
151183
- const mainbox = this.shadowRoot.querySelector(".mainbox");
151184
- const chartContainer = this.shadowRoot.querySelector(".chartContainer");
151185
- if (!mainbox || !chartContainer) {
151186
- return;
151187
- }
151188
- void mainbox.offsetHeight;
151189
- const styleChartContainer = window.getComputedStyle(chartContainer);
151190
- const paddingTop = parseInt(styleChartContainer.paddingTop, 10);
151191
- const paddingBottom = parseInt(styleChartContainer.paddingBottom, 10);
151192
- const paddingLeft = parseInt(styleChartContainer.paddingLeft, 10);
151193
- const paddingRight = parseInt(styleChartContainer.paddingRight, 10);
151194
- const actualWidth = mainbox.clientWidth - paddingLeft - paddingRight;
151195
- const actualHeight = mainbox.offsetHeight - paddingTop - paddingBottom;
151196
- if (actualWidth > 0 && actualHeight > 0) {
151197
- if (this.DEBUG_RESIZE) {
151198
- console.log("DeesChartArea - Updating chart dimensions:", {
151199
- width: actualWidth,
151200
- height: actualHeight
151201
- });
151202
- }
151203
- await this.chart.updateOptions({
151204
- chart: {
151205
- width: actualWidth,
151206
- height: actualHeight
151207
- }
151208
- }, true, false);
151209
- }
151210
- } catch (error) {
151211
- console.error("Failed to resize chart:", error);
151219
+ if (this.chart) {
151220
+ this.chart.timeScale().fitContent();
151212
151221
  }
151213
151222
  }
151214
- /**
151215
- * Manually trigger a chart resize. Useful when automatic detection doesn't work.
151216
- * This is a convenience method that can be called from outside the component.
151217
- */
151218
151223
  async forceResize() {
151219
151224
  await this.resizeChart();
151220
151225
  }
151221
151226
  startAutoScroll() {
151222
- if (this.autoScrollTimer) {
151223
- return;
151224
- }
151227
+ if (this.autoScrollTimer) return;
151225
151228
  this.autoScrollTimer = window.setInterval(() => {
151226
151229
  this.updateTimeWindow();
151227
151230
  }, this.autoScrollInterval);
@@ -151232,45 +151235,10 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
151232
151235
  this.autoScrollTimer = null;
151233
151236
  }
151234
151237
  }
151235
- async updateChartTheme() {
151236
- if (!this.chart) {
151237
- return;
151238
- }
151239
- const isDark = !this.goBright;
151240
- const theme = isDark ? "dark" : "light";
151241
- await this.chart.updateOptions({
151242
- theme: {
151243
- mode: theme
151244
- },
151245
- colors: isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light,
151246
- xaxis: {
151247
- labels: {
151248
- style: {
151249
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"]
151250
- }
151251
- }
151252
- },
151253
- yaxis: {
151254
- labels: {
151255
- style: {
151256
- colors: [isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)"]
151257
- }
151258
- }
151259
- },
151260
- grid: {
151261
- borderColor: isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 94%)"
151262
- },
151263
- fill: {
151264
- gradient: {
151265
- shade: isDark ? "dark" : "light",
151266
- opacityFrom: isDark ? 0.2 : 0.3
151267
- }
151268
- }
151269
- });
151270
- }
151271
151238
  };
151272
151239
  _init54 = __decoratorStart(_a53);
151273
151240
  _chart = new WeakMap();
151241
+ _seriesStats = new WeakMap();
151274
151242
  _label5 = new WeakMap();
151275
151243
  _series = new WeakMap();
151276
151244
  _yAxisFormatter = new WeakMap();
@@ -151280,6 +151248,7 @@ _yAxisScaling = new WeakMap();
151280
151248
  _yAxisMax = new WeakMap();
151281
151249
  _autoScrollInterval = new WeakMap();
151282
151250
  __decorateElement(_init54, 4, "chart", _chart_dec, _DeesChartArea, _chart);
151251
+ __decorateElement(_init54, 4, "seriesStats", _seriesStats_dec, _DeesChartArea, _seriesStats);
151283
151252
  __decorateElement(_init54, 4, "label", _label_dec5, _DeesChartArea, _label5);
151284
151253
  __decorateElement(_init54, 4, "series", _series_dec, _DeesChartArea, _series);
151285
151254
  __decorateElement(_init54, 4, "yAxisFormatter", _yAxisFormatter_dec, _DeesChartArea, _yAxisFormatter);
@@ -168595,6 +168564,7 @@ var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a89 = DeesElement, _
168595
168564
  terminal.style.top = "var(--banner-area-height, 0px)";
168596
168565
  terminal.style.left = "240px";
168597
168566
  terminal.style.right = "0px";
168567
+ terminal.style.height = "auto";
168598
168568
  terminal.style.bottom = "24px";
168599
168569
  terminal.style.opacity = "0";
168600
168570
  terminal.style.transform = "translateY(8px) scale(0.99)";
@@ -174727,7 +174697,7 @@ init_group_runtime();
174727
174697
  // ts_web/00_commitinfo_data.ts
174728
174698
  var commitinfo = {
174729
174699
  name: "@design.estate/dees-catalog",
174730
- version: "3.50.2",
174700
+ version: "3.51.1",
174731
174701
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
174732
174702
  };
174733
174703
  export {
@@ -176693,4 +176663,4 @@ ibantools/jsnext/ibantools.js:
176693
176663
  * @preferred
176694
176664
  *)
176695
176665
  */
176696
- //# sourceMappingURL=bundle-1775159010741.js.map
176666
+ //# sourceMappingURL=bundle-1775213154635.js.map