@design.estate/dees-catalog 3.50.2 → 3.51.0

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,22 @@ 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 */
150679
- }
150680
-
150681
- /* ApexCharts theme overrides */
150682
- .apexcharts-canvas {
150683
- background: transparent !important;
150684
- }
150685
-
150686
- .apexcharts-inner {
150687
- background: transparent !important;
150677
+ top: 44px;
150678
+ left: 0;
150679
+ bottom: 0;
150680
+ right: 0;
150688
150681
  }
150689
-
150690
- .apexcharts-graphical {
150691
- background: transparent !important;
150682
+ .lw-tooltip {
150683
+ position: absolute;
150684
+ z-index: 100;
150685
+ pointer-events: none;
150686
+ padding: 12px;
150687
+ border-radius: 6px;
150688
+ border: 1px solid;
150689
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
150690
+ font-size: 12px;
150691
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
150692
+ min-width: 140px;
150692
150693
  }
150693
150694
  `
150694
150695
  ];
@@ -150713,7 +150714,7 @@ _DeesChartArea_decorators = [customElement("dees-chart-area")];
150713
150714
  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) {
150714
150715
  constructor() {
150715
150716
  super();
150716
- __privateAdd(this, _chart, __runInitializers(_init54, 8, this)), __runInitializers(_init54, 11, this);
150717
+ __privateAdd(this, _chart, __runInitializers(_init54, 8, this, null)), __runInitializers(_init54, 11, this);
150717
150718
  __privateAdd(this, _label5, __runInitializers(_init54, 12, this, "Untitled Chart")), __runInitializers(_init54, 15, this);
150718
150719
  __privateAdd(this, _series, __runInitializers(_init54, 16, this, [])), __runInitializers(_init54, 19, this);
150719
150720
  __privateAdd(this, _yAxisFormatter, __runInitializers(_init54, 20, this, /* @__PURE__ */ __name((val) => `${val} Mbps`, "yAxisFormatter"))), __runInitializers(_init54, 23, this);
@@ -150722,304 +150723,296 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
150722
150723
  __privateAdd(this, _yAxisScaling, __runInitializers(_init54, 32, this, "dynamic")), __runInitializers(_init54, 35, this);
150723
150724
  __privateAdd(this, _yAxisMax, __runInitializers(_init54, 36, this, 100)), __runInitializers(_init54, 39, this);
150724
150725
  __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");
150728
150726
  __publicField(this, "internalChartData", []);
150729
150727
  __publicField(this, "autoScrollTimer", null);
150730
- __publicField(this, "DEBUG_RESIZE", false);
150731
- // Set to true to enable resize debugging
150732
- // Chart color schemes
150728
+ __publicField(this, "lcBundle", null);
150729
+ __publicField(this, "seriesApis", /* @__PURE__ */ new Map());
150730
+ __publicField(this, "priceLines", /* @__PURE__ */ new Map());
150731
+ __publicField(this, "tooltipEl", null);
150733
150732
  __publicField(this, "CHART_COLORS", {
150734
150733
  dark: [
150735
150734
  "hsl(217.2 91.2% 59.8%)",
150736
- // Blue
150737
150735
  "hsl(173.4 80.4% 40%)",
150738
- // Teal
150739
150736
  "hsl(280.3 87.4% 66.7%)",
150740
- // Purple
150741
150737
  "hsl(24.6 95% 53.1%)"
150742
- // Orange
150743
150738
  ],
150744
150739
  light: [
150745
150740
  "hsl(222.2 47.4% 51.2%)",
150746
- // Blue (shadcn primary)
150747
150741
  "hsl(142.1 76.2% 36.3%)",
150748
- // Green (shadcn success)
150749
150742
  "hsl(280.3 47.7% 50.2%)",
150750
- // Purple (muted)
150751
150743
  "hsl(20.5 90.2% 48.2%)"
150752
- // Orange (shadcn destructive variant)
150753
150744
  ]
150754
150745
  });
150755
150746
  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
150747
  this.registerGarbageFunction(async () => {
150774
- if (this.resizeTimeout) {
150775
- clearTimeout(this.resizeTimeout);
150776
- }
150777
- if (this.resizeObserver) {
150778
- this.resizeObserver.disconnect();
150779
- }
150780
150748
  this.stopAutoScroll();
150781
150749
  if (this.chart) {
150782
150750
  try {
150783
- this.chart.destroy();
150751
+ this.chart.remove();
150784
150752
  this.chart = null;
150785
- } catch (error) {
150786
- console.error("Error destroying chart:", error);
150753
+ this.seriesApis.clear();
150754
+ this.priceLines.clear();
150755
+ } catch (e11) {
150756
+ console.error("Error destroying chart:", e11);
150787
150757
  }
150788
150758
  }
150789
150759
  });
150790
150760
  }
150791
- // Override getter to return internal chart data
150792
150761
  get chartSeries() {
150793
150762
  return this.internalChartData.length > 0 ? this.internalChartData : this.series;
150794
150763
  }
150795
- async connectedCallback() {
150796
- super.connectedCallback();
150797
- if (this.chart) {
150798
- await new Promise((resolve2) => requestAnimationFrame(resolve2));
150799
- await this.resizeChart();
150800
- }
150801
- }
150802
150764
  render() {
150803
150765
  return renderChartArea(this);
150804
150766
  }
150767
+ // --- Helpers ---
150768
+ convertDataToLC(data) {
150769
+ return data.map((point4) => {
150770
+ const ms = typeof point4.x === "number" ? point4.x : new Date(point4.x).getTime();
150771
+ return { time: Math.floor(ms / 1e3), value: point4.y };
150772
+ }).sort((a5, b5) => a5.time - b5.time);
150773
+ }
150774
+ hslToRgba(hslColor, alpha) {
150775
+ const match2 = hslColor.match(/hsl\(([^)]+)\)/);
150776
+ if (!match2) return hslColor;
150777
+ const parts = match2[1].trim().split(/\s+/);
150778
+ if (parts.length < 3) return hslColor;
150779
+ const h8 = parseFloat(parts[0]) / 360;
150780
+ const s10 = parseFloat(parts[1]) / 100;
150781
+ const l6 = parseFloat(parts[2]) / 100;
150782
+ let r11, g4, b5;
150783
+ if (s10 === 0) {
150784
+ r11 = g4 = b5 = l6;
150785
+ } else {
150786
+ const hue2rgb = /* @__PURE__ */ __name((p7, q, t9) => {
150787
+ if (t9 < 0) t9 += 1;
150788
+ if (t9 > 1) t9 -= 1;
150789
+ if (t9 < 1 / 6) return p7 + (q - p7) * 6 * t9;
150790
+ if (t9 < 1 / 2) return q;
150791
+ if (t9 < 2 / 3) return p7 + (q - p7) * (2 / 3 - t9) * 6;
150792
+ return p7;
150793
+ }, "hue2rgb");
150794
+ const q2 = l6 < 0.5 ? l6 * (1 + s10) : l6 + s10 - l6 * s10;
150795
+ const p22 = 2 * l6 - q2;
150796
+ r11 = hue2rgb(p22, q2, h8 + 1 / 3);
150797
+ g4 = hue2rgb(p22, q2, h8);
150798
+ b5 = hue2rgb(p22, q2, h8 - 1 / 3);
150799
+ }
150800
+ return `rgba(${Math.round(r11 * 255)}, ${Math.round(g4 * 255)}, ${Math.round(b5 * 255)}, ${alpha})`;
150801
+ }
150802
+ getSeriesColors(isDark) {
150803
+ return isDark ? this.CHART_COLORS.dark : this.CHART_COLORS.light;
150804
+ }
150805
+ applyTheme() {
150806
+ if (!this.chart || !this.lcBundle) return;
150807
+ const isDark = !this.goBright;
150808
+ const colors8 = this.getSeriesColors(isDark);
150809
+ this.chart.applyOptions({
150810
+ layout: {
150811
+ background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
150812
+ textColor: isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)",
150813
+ attributionLogo: false
150814
+ },
150815
+ grid: {
150816
+ vertLines: { visible: false },
150817
+ horzLines: { color: isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 94%)" }
150818
+ }
150819
+ });
150820
+ let idx = 0;
150821
+ for (const [, api2] of this.seriesApis) {
150822
+ const color2 = colors8[idx % colors8.length];
150823
+ api2.applyOptions({
150824
+ topColor: this.hslToRgba(color2, isDark ? 0.2 : 0.3),
150825
+ bottomColor: this.hslToRgba(color2, 0),
150826
+ lineColor: color2
150827
+ });
150828
+ idx++;
150829
+ }
150830
+ }
150831
+ recreateSeries(chartSeries) {
150832
+ if (!this.chart || !this.lcBundle) return;
150833
+ const isDark = !this.goBright;
150834
+ const colors8 = this.getSeriesColors(isDark);
150835
+ for (const [, api2] of this.seriesApis) {
150836
+ this.chart.removeSeries(api2);
150837
+ }
150838
+ this.seriesApis.clear();
150839
+ this.priceLines.clear();
150840
+ chartSeries.forEach((s10, index2) => {
150841
+ const color2 = colors8[index2 % colors8.length];
150842
+ const api2 = this.chart.addSeries(this.lcBundle.AreaSeries, {
150843
+ topColor: this.hslToRgba(color2, isDark ? 0.2 : 0.3),
150844
+ bottomColor: this.hslToRgba(color2, 0),
150845
+ lineColor: color2,
150846
+ lineWidth: 2,
150847
+ lineType: this.lcBundle.LineType.Curved,
150848
+ lastValueVisible: false,
150849
+ priceLineVisible: false,
150850
+ crosshairMarkerVisible: true,
150851
+ crosshairMarkerRadius: 4
150852
+ });
150853
+ api2.setData(this.convertDataToLC(s10.data));
150854
+ this.updatePriceLines(s10.name || `series-${index2}`, api2, s10.data, color2);
150855
+ if (this.yAxisScaling !== "dynamic") {
150856
+ api2.applyOptions({
150857
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({
150858
+ priceRange: { minValue: 0, maxValue: this.yAxisMax }
150859
+ }), "autoscaleInfoProvider")
150860
+ });
150861
+ }
150862
+ this.seriesApis.set(s10.name || `series-${index2}`, api2);
150863
+ });
150864
+ }
150865
+ updatePriceLines(name, api2, data, color2) {
150866
+ const existing = this.priceLines.get(name);
150867
+ if (existing) {
150868
+ for (const line of existing) {
150869
+ api2.removePriceLine(line);
150870
+ }
150871
+ }
150872
+ if (data.length === 0) {
150873
+ this.priceLines.set(name, []);
150874
+ return;
150875
+ }
150876
+ const values = data.map((d5) => d5.y);
150877
+ const avg = values.reduce((sum, v5) => sum + v5, 0) / values.length;
150878
+ const max3 = Math.max(...values);
150879
+ const lines = [];
150880
+ lines.push(api2.createPriceLine({
150881
+ price: Math.round(avg * 100) / 100,
150882
+ color: this.hslToRgba(color2, 0.5),
150883
+ lineWidth: 1,
150884
+ lineStyle: 2,
150885
+ // Dashed
150886
+ axisLabelVisible: true,
150887
+ title: "avg"
150888
+ }));
150889
+ if (avg > 0 && (max3 - avg) / avg > 0.1) {
150890
+ lines.push(api2.createPriceLine({
150891
+ price: max3,
150892
+ color: this.hslToRgba(color2, 0.8),
150893
+ lineWidth: 1,
150894
+ lineStyle: 1,
150895
+ // Dotted
150896
+ axisLabelVisible: true,
150897
+ title: "max"
150898
+ }));
150899
+ }
150900
+ this.priceLines.set(name, lines);
150901
+ }
150902
+ setupTooltip() {
150903
+ if (!this.chart) return;
150904
+ this.tooltipEl = document.createElement("div");
150905
+ this.tooltipEl.className = "lw-tooltip";
150906
+ this.tooltipEl.style.display = "none";
150907
+ this.shadowRoot.querySelector(".chartContainer")?.appendChild(this.tooltipEl);
150908
+ this.chart.subscribeCrosshairMove((param) => {
150909
+ if (!this.tooltipEl) return;
150910
+ if (!param.point || !param.time || param.point.x < 0 || param.point.y < 0) {
150911
+ this.tooltipEl.style.display = "none";
150912
+ return;
150913
+ }
150914
+ const isDark = !this.goBright;
150915
+ const bgColor = isDark ? "hsl(0 0% 9%)" : "hsl(0 0% 100%)";
150916
+ const textColor = isDark ? "hsl(0 0% 95%)" : "hsl(0 0% 9%)";
150917
+ const borderColor = isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 89.8%)";
150918
+ const colors8 = this.getSeriesColors(isDark);
150919
+ let html9 = "";
150920
+ let idx = 0;
150921
+ let hasData = false;
150922
+ for (const [name, api2] of this.seriesApis) {
150923
+ const data = param.seriesData.get(api2);
150924
+ if (data && "value" in data && data.value !== void 0) {
150925
+ hasData = true;
150926
+ const color2 = colors8[idx % colors8.length];
150927
+ const formatted = this.yAxisFormatter(data.value);
150928
+ html9 += `<div style="display:flex;align-items:center;gap:8px;margin:${idx > 0 ? "6px" : "0"} 0;">
150929
+ <span style="display:inline-block;width:10px;height:10px;background:${color2};border-radius:2px;"></span>
150930
+ <span style="font-weight:500;">${name}:</span>
150931
+ <span style="margin-left:auto;font-weight:600;">${formatted}</span>
150932
+ </div>`;
150933
+ }
150934
+ idx++;
150935
+ }
150936
+ if (!hasData) {
150937
+ this.tooltipEl.style.display = "none";
150938
+ return;
150939
+ }
150940
+ this.tooltipEl.innerHTML = html9;
150941
+ Object.assign(this.tooltipEl.style, {
150942
+ display: "block",
150943
+ background: bgColor,
150944
+ color: textColor,
150945
+ borderColor
150946
+ });
150947
+ const containerWidth = this.shadowRoot.querySelector(".chartContainer").clientWidth;
150948
+ let left = param.point.x + 16;
150949
+ if (left + 200 > containerWidth) left = param.point.x - 216;
150950
+ this.tooltipEl.style.left = `${left}px`;
150951
+ this.tooltipEl.style.top = `${param.point.y - 16}px`;
150952
+ });
150953
+ }
150954
+ // --- Lifecycle ---
150805
150955
  async firstUpdated() {
150806
150956
  await this.domtoolsPromise;
150807
- const ApexChartsLib = await DeesServiceLibLoader.getInstance().loadApexCharts();
150957
+ this.lcBundle = await DeesServiceLibLoader.getInstance().loadLightweightCharts();
150808
150958
  await new Promise((resolve2) => requestAnimationFrame(resolve2));
150809
- const mainbox = this.shadowRoot.querySelector(".mainbox");
150810
150959
  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;
150960
+ if (!chartContainer) return;
150845
150961
  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
- }
150962
+ try {
150963
+ this.chart = this.lcBundle.createChart(chartContainer, {
150964
+ autoSize: true,
150965
+ layout: {
150966
+ background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
150967
+ textColor: isDark ? "hsl(0 0% 63.9%)" : "hsl(0 0% 20%)",
150968
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
150969
+ fontSize: 12,
150970
+ attributionLogo: false
150905
150971
  },
150906
- axisBorder: {
150907
- show: false
150908
- // Hide x-axis border
150972
+ grid: {
150973
+ vertLines: { visible: false },
150974
+ horzLines: { color: isDark ? "hsl(0 0% 14.9%)" : "hsl(0 0% 94%)" }
150909
150975
  },
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
- }
150976
+ rightPriceScale: {
150977
+ borderVisible: false,
150978
+ scaleMargins: { top: 0.1, bottom: 0.1 }
150927
150979
  },
150928
- axisBorder: {
150929
- show: false
150930
- // Hide y-axis border
150980
+ timeScale: {
150981
+ borderVisible: false,
150982
+ timeVisible: true,
150983
+ secondsVisible: true
150931
150984
  },
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"
150985
+ crosshair: {
150986
+ mode: this.lcBundle.CrosshairMode.Magnet
150946
150987
  },
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
- }
150976
- },
150977
- yaxis: {
150978
- lines: {
150979
- show: true
150980
- }
150988
+ handleScroll: false,
150989
+ handleScale: false
150990
+ });
150991
+ const chartSeries = this.series.length > 0 ? this.series : [
150992
+ {
150993
+ name: "cpu",
150994
+ data: [
150995
+ { x: "2025-01-15T03:00:00", y: 25 },
150996
+ { x: "2025-01-15T07:00:00", y: 30 },
150997
+ { x: "2025-01-15T11:00:00", y: 20 },
150998
+ { x: "2025-01-15T15:00:00", y: 35 },
150999
+ { x: "2025-01-15T19:00:00", y: 25 }
151000
+ ]
150981
151001
  },
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");
151002
+ {
151003
+ name: "memory",
151004
+ data: [
151005
+ { x: "2025-01-15T03:00:00", y: 10 },
151006
+ { x: "2025-01-15T07:00:00", y: 12 },
151007
+ { x: "2025-01-15T11:00:00", y: 10 },
151008
+ { x: "2025-01-15T15:00:00", y: 30 },
151009
+ { x: "2025-01-15T19:00:00", y: 40 }
151010
+ ]
151021
151011
  }
151022
- }
151012
+ ];
151013
+ this.internalChartData = chartSeries;
151014
+ this.recreateSeries(chartSeries);
151015
+ this.setupTooltip();
151023
151016
  } catch (error) {
151024
151017
  console.error("Failed to initialize chart:", error);
151025
151018
  }
@@ -151027,37 +151020,14 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
151027
151020
  async updated(changedProperties) {
151028
151021
  super.updated(changedProperties);
151029
151022
  if (changedProperties.has("goBright") && this.chart) {
151030
- await this.updateChartTheme();
151023
+ this.applyTheme();
151031
151024
  }
151032
151025
  if (changedProperties.has("series") && this.chart && this.series.length > 0) {
151033
151026
  await this.updateSeries(this.series);
151034
151027
  }
151035
151028
  if (changedProperties.has("yAxisFormatter") && this.chart) {
151036
- await this.chart.updateOptions({
151037
- yaxis: {
151038
- labels: {
151039
- formatter: this.yAxisFormatter
151040
- }
151041
- }
151042
- });
151043
151029
  }
151044
151030
  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
151031
  if (this.realtimeMode && this.rollingWindow > 0 && this.autoScrollInterval > 0) {
151062
151032
  this.startAutoScroll();
151063
151033
  } else {
@@ -151071,157 +151041,120 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
151071
151041
  }
151072
151042
  }
151073
151043
  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
151044
+ for (const [, api2] of this.seriesApis) {
151045
+ if (this.yAxisScaling === "dynamic") {
151046
+ api2.applyOptions({ autoscaleInfoProvider: void 0 });
151047
+ } else {
151048
+ api2.applyOptions({
151049
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({ priceRange: { minValue: 0, maxValue: this.yAxisMax } }), "autoscaleInfoProvider")
151050
+ });
151078
151051
  }
151079
- });
151052
+ }
151080
151053
  }
151081
151054
  }
151055
+ // --- Public API ---
151082
151056
  async updateSeries(newSeries, animate = true) {
151083
- if (!this.chart) {
151084
- return;
151085
- }
151057
+ if (!this.chart) return;
151086
151058
  try {
151087
151059
  this.internalChartData = newSeries;
151088
151060
  if (this.rollingWindow > 0 && this.realtimeMode) {
151089
151061
  const now2 = Date.now();
151090
151062
  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 };
151063
+ if (newSeries.length !== this.seriesApis.size) {
151064
+ this.recreateSeries(newSeries);
151065
+ } else {
151066
+ const colors8 = this.getSeriesColors(!this.goBright);
151067
+ newSeries.forEach((s10, index2) => {
151068
+ const name = s10.name || `series-${index2}`;
151069
+ const api2 = this.seriesApis.get(name);
151070
+ if (!api2) return;
151071
+ const filtered = s10.data.filter((point4) => {
151072
+ const ms = typeof point4.x === "number" ? point4.x : new Date(point4.x).getTime();
151073
+ return ms > cutoffTime;
151074
+ });
151075
+ api2.setData(this.convertDataToLC(filtered));
151076
+ this.updatePriceLines(name, api2, filtered, colors8[index2 % colors8.length]);
151077
+ });
151078
+ }
151079
+ try {
151080
+ this.chart.timeScale().setVisibleRange({
151081
+ from: Math.floor(cutoffTime / 1e3),
151082
+ to: Math.floor(now2 / 1e3)
151083
+ });
151084
+ } catch (e11) {
151085
+ }
151086
+ if (this.yAxisScaling === "dynamic") {
151087
+ const allValues = newSeries.flatMap(
151088
+ (s10) => s10.data.filter((p7) => {
151089
+ const ms = typeof p7.x === "number" ? p7.x : new Date(p7.x).getTime();
151090
+ return ms > cutoffTime;
151091
+ }).map((d5) => d5.y)
151092
+ );
151093
+ if (allValues.length > 0) {
151094
+ const dynamicMax = Math.ceil(Math.max(...allValues) * 1.1);
151095
+ for (const [, api2] of this.seriesApis) {
151096
+ api2.applyOptions({
151097
+ autoscaleInfoProvider: /* @__PURE__ */ __name(() => ({ priceRange: { minValue: 0, maxValue: dynamicMax } }), "autoscaleInfoProvider")
151098
+ });
151126
151099
  }
151127
151100
  }
151128
- await this.chart.updateOptions(options, false, false);
151129
151101
  }
151130
151102
  } else {
151131
- await this.chart.updateSeries(newSeries, animate);
151103
+ if (newSeries.length !== this.seriesApis.size) {
151104
+ this.recreateSeries(newSeries);
151105
+ } else {
151106
+ const colors8 = this.getSeriesColors(!this.goBright);
151107
+ newSeries.forEach((s10, index2) => {
151108
+ const name = s10.name || `series-${index2}`;
151109
+ const api2 = this.seriesApis.get(name);
151110
+ if (!api2) return;
151111
+ api2.setData(this.convertDataToLC(s10.data));
151112
+ this.updatePriceLines(name, api2, s10.data, colors8[index2 % colors8.length]);
151113
+ });
151114
+ }
151132
151115
  }
151133
151116
  } catch (error) {
151134
151117
  console.error("Failed to update chart series:", error);
151135
151118
  }
151136
151119
  }
151137
- // Update just the x-axis for smooth scrolling in realtime mode
151138
- // Public for advanced usage in demos, but typically handled automatically
151139
151120
  async updateTimeWindow() {
151140
- if (!this.chart || this.rollingWindow <= 0) {
151141
- return;
151142
- }
151121
+ if (!this.chart || this.rollingWindow <= 0) return;
151143
151122
  const now2 = Date.now();
151144
151123
  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);
151124
+ try {
151125
+ this.chart.timeScale().setVisibleRange({
151126
+ from: Math.floor(cutoffTime / 1e3),
151127
+ to: Math.floor(now2 / 1e3)
151128
+ });
151129
+ } catch (e11) {
151130
+ }
151162
151131
  }
151163
151132
  async appendData(newData) {
151164
- if (!this.chart) {
151165
- return;
151166
- }
151167
- this.chart.appendData(newData);
151133
+ if (!this.chart) return;
151134
+ newData.forEach((s10, index2) => {
151135
+ const name = s10.name || `series-${index2}`;
151136
+ const api2 = this.seriesApis.get(name);
151137
+ if (!api2 || s10.data.length === 0) return;
151138
+ for (const point4 of s10.data) {
151139
+ const lcPoints = this.convertDataToLC([point4]);
151140
+ if (lcPoints.length > 0) api2.update(lcPoints[0]);
151141
+ }
151142
+ });
151168
151143
  }
151169
- async updateOptions(options, redrawPaths, animate) {
151170
- if (!this.chart) {
151171
- return;
151172
- }
151173
- return this.chart.updateOptions(options, redrawPaths, animate);
151144
+ async updateOptions(options) {
151145
+ if (!this.chart) return;
151146
+ this.chart.applyOptions(options);
151174
151147
  }
151175
151148
  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);
151149
+ if (this.chart) {
151150
+ this.chart.timeScale().fitContent();
151212
151151
  }
151213
151152
  }
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
151153
  async forceResize() {
151219
151154
  await this.resizeChart();
151220
151155
  }
151221
151156
  startAutoScroll() {
151222
- if (this.autoScrollTimer) {
151223
- return;
151224
- }
151157
+ if (this.autoScrollTimer) return;
151225
151158
  this.autoScrollTimer = window.setInterval(() => {
151226
151159
  this.updateTimeWindow();
151227
151160
  }, this.autoScrollInterval);
@@ -151232,42 +151165,6 @@ var _DeesChartArea = class _DeesChartArea extends (_a53 = DeesElement, _chart_de
151232
151165
  this.autoScrollTimer = null;
151233
151166
  }
151234
151167
  }
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
151168
  };
151272
151169
  _init54 = __decoratorStart(_a53);
151273
151170
  _chart = new WeakMap();
@@ -168595,6 +168492,7 @@ var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a89 = DeesElement, _
168595
168492
  terminal.style.top = "var(--banner-area-height, 0px)";
168596
168493
  terminal.style.left = "240px";
168597
168494
  terminal.style.right = "0px";
168495
+ terminal.style.height = "auto";
168598
168496
  terminal.style.bottom = "24px";
168599
168497
  terminal.style.opacity = "0";
168600
168498
  terminal.style.transform = "translateY(8px) scale(0.99)";
@@ -174727,7 +174625,7 @@ init_group_runtime();
174727
174625
  // ts_web/00_commitinfo_data.ts
174728
174626
  var commitinfo = {
174729
174627
  name: "@design.estate/dees-catalog",
174730
- version: "3.50.2",
174628
+ version: "3.51.0",
174731
174629
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
174732
174630
  };
174733
174631
  export {
@@ -176693,4 +176591,4 @@ ibantools/jsnext/ibantools.js:
176693
176591
  * @preferred
176694
176592
  *)
176695
176593
  */
176696
- //# sourceMappingURL=bundle-1775159010741.js.map
176594
+ //# sourceMappingURL=bundle-1775211113131.js.map