@tradecanvas/chart 1.44.0 → 1.45.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.
@@ -1,4 +1,4 @@
1
- import { C as e, a as t, c as n, i as r, n as i, o as a, r as o, t as s } from "../LayoutSession-Dh4Kqna4.js";
1
+ import { C as e, a as t, c as n, i as r, n as i, o as a, r as o, t as s } from "../LayoutSession-BI2ADwWW.js";
2
2
  import { a as c, c as l, i as u, n as d, o as f, r as p, s as m, t as h } from "../i18n-DjzoHpMJ.js";
3
3
  import { CHART_STYLE_KEYS as g, CHART_TYPE_ICONS as _, DARK_THEME as v, DEFAULT_SIGNAL_STYLE as y, DEFAULT_TRADE_ZONE_STYLE as b, DEFAULT_TRADING_CONFIG as x, DRAWING_TOOL_ICONS as ee, LIGHT_THEME as te, PHI as ne, PRICE_SOURCES as re, UI_ICONS as ie, barTimeUnit as ae, formatPrice as oe, iconSvg as se, indicatorSource as ce, isTimeFrame as le, isValidTimeZone as ue, marketStatus as de, offsetAt as fe, parseIndicatorSource as pe, phiStep as me, readChartStyleOverrides as he, readChartTypeOptions as ge, readIndicatorPlotStyles as _e, readNews as ve, readQuote as ye, sanitizeDrawingOptions as be, sanitizeDrawingStyle as xe, stepDecimals as Se, tickBarCount as Ce, timeParts as we, timeframeBucketStart as Te, timeframeToMs as S, tzLabel as Ee, wallToUtc as De, zoneOffsetMinutes as Oe } from "@tradecanvas/commons";
4
4
  import { ChartStateManager as ke, INDICATOR_CATEGORIES as Ae, INTERVAL_LIMITS as je, INTERVAL_UNITS as Me, MAX_ALERT_BARS as Ne, MIN_ALERT_BARS as Pe, RANGE_PRESETS as Fe, SYMBOL_INDICATOR_IDS as Ie, indicatorCategory as Le, indicatorValuePrecision as Re, isSeriesPalette as ze, plotColor as Be, plotShown as Ve, rangePresetStart as He, servesTimeframe as Ue, sourceParam as We, withResampling as Ge } from "@tradecanvas/core";
@@ -3020,10 +3020,10 @@ var V = [
3020
3020
  value: "indexedTo100",
3021
3021
  label: this.t("settings.scale.indexedTo100")
3022
3022
  }
3023
- ].filter((e) => e.value !== "logarithmic" || this.available.logScale !== !1), n = Ze(e.timezone, Date.now(), this.t("settings.timezone.local"), this.available.exchangeZone ? {
3023
+ ].filter((e) => e.value !== "logarithmic" || this.available.logScale !== !1), n = this.available.exchangeZone?.(), r = Ze(e.timezone, Date.now(), this.t("settings.timezone.local"), n === void 0 ? void 0 : {
3024
3024
  label: this.t("settings.timezone.exchange"),
3025
- zone: this.available.exchangeZone()
3026
- } : void 0);
3025
+ zone: n
3026
+ });
3027
3027
  this.addSection(void 0, [
3028
3028
  B(this.t("settings.priceScale"), e.scaleMode, t, (e) => this.patch({ scaleMode: e })),
3029
3029
  z(this.t("settings.autoScale"), e.autoScale, (e) => this.patch({ autoScale: e })),
@@ -3031,7 +3031,7 @@ var V = [
3031
3031
  z(this.t("settings.leftScale"), e.leftPriceScale, (e) => this.patch({ leftPriceScale: e })),
3032
3032
  z(this.t("settings.indicatorValues"), e.indicatorValueLabels, (e) => this.patch({ indicatorValueLabels: e })),
3033
3033
  ...this.available.barCountdown === !1 ? [] : [z(this.t("settings.barCountdown"), e.barCountdown, (e) => this.patch({ barCountdown: e }))],
3034
- B(this.t("settings.timezone"), e.timezone, n, (e) => this.patch({ timezone: e })),
3034
+ B(this.t("settings.timezone"), e.timezone, r, (e) => this.patch({ timezone: e })),
3035
3035
  B(this.t("settings.numberLocale"), e.numberLocale, bn(e.numberLocale), (e) => this.patch({ numberLocale: e }))
3036
3036
  ]), this.addSection(this.t("settings.section.axes"), kt.map((e) => this.lookRow(e)));
3037
3037
  }
@@ -10657,10 +10657,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
10657
10657
  now: () => this.clockNow(),
10658
10658
  options: () => ({
10659
10659
  current: this.settingsState.timezone,
10660
- list: Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), this.adapter?.resolveSymbol ? {
10661
- label: this.t("settings.timezone.exchange"),
10662
- zone: this.chart.getSymbolInfo()?.timezone ?? null
10663
- } : void 0)
10660
+ list: Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), this.exchangeChoice())
10664
10661
  }),
10665
10662
  onPick: (e) => this.changeSettings({ timezone: e })
10666
10663
  },
@@ -10713,7 +10710,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
10713
10710
  barCountdown: s.barCountdown,
10714
10711
  logScale: s.logScale,
10715
10712
  trading: s.trading !== !1,
10716
- exchangeZone: this.adapter?.resolveSymbol ? () => this.chart.getSymbolInfo()?.timezone ?? null : void 0
10713
+ exchangeZone: () => this.exchangeChoice()?.zone
10717
10714
  }, this.overlayHost), this.symbolSearch = new Vr({
10718
10715
  onPick: (e) => {
10719
10716
  this.setSymbol(e);
@@ -10964,8 +10961,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
10964
10961
  this.chart.on("ordersChange", () => e.setOrders(this.chart.getOrders()));
10965
10962
  }
10966
10963
  this.chart.on("dataUpdate", (e) => {
10967
- let t = e.payload;
10968
- t && t.bracket === "cancelled" && this.bracketBar?.hide();
10964
+ e.payload.kind === "bracket" && this.bracketBar?.hide();
10969
10965
  });
10970
10966
  }
10971
10967
  this.alertsPanel = new Hi(this.root, {
@@ -11623,12 +11619,15 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
11623
11619
  removableIndicators() {
11624
11620
  return this.chart.getActiveIndicators().filter((e) => !Ie.has(e.id)).map((e) => e.instanceId);
11625
11621
  }
11626
- timezoneChoices() {
11627
- let e = this.adapter?.resolveSymbol ? {
11622
+ exchangeChoice() {
11623
+ let e = this.chart.getExchangeTimezone() ?? null;
11624
+ if (!(e === null && !this.adapter?.resolveSymbol)) return {
11628
11625
  label: this.t("settings.timezone.exchange"),
11629
- zone: this.chart.getSymbolInfo()?.timezone ?? null
11630
- } : void 0;
11631
- return Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), e).map(({ value: e, label: t }) => ({
11626
+ zone: e
11627
+ };
11628
+ }
11629
+ timezoneChoices() {
11630
+ return Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), this.exchangeChoice()).map(({ value: e, label: t }) => ({
11632
11631
  value: e,
11633
11632
  label: t
11634
11633
  }));
@@ -12115,17 +12114,15 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
12115
12114
  this.lastLocalSwitchMs = performance.now() - e;
12116
12115
  }
12117
12116
  handleDataUpdate(e) {
12118
- if (!e || typeof e != "object") return;
12119
- let t = e;
12120
- if (typeof t.length == "number") {
12121
- t.length > 0 && this.loading.isActive() && (this.loading.end(), this.state.connectionState === "error" && this.setConnectionState("connected", this.t("status.live")));
12117
+ if (e.kind === "bars") {
12118
+ e.length > 0 && this.loading.isActive() && (this.loading.end(), this.state.connectionState === "error" && this.setConnectionState("connected", this.t("status.live")));
12122
12119
  return;
12123
12120
  }
12124
- if (t.error !== void 0) {
12125
- this.loading.isActive() && (this.loading.fail(this.t("status.connectionFailed")), this.setConnectionState("error", t.error || this.t("status.connectionFailed")));
12121
+ if (e.kind === "error") {
12122
+ this.loading.isActive() && (this.loading.fail(this.t("status.connectionFailed")), this.setConnectionState("error", e.error || this.t("status.connectionFailed")));
12126
12123
  return;
12127
12124
  }
12128
- switch (t.connection?.state) {
12125
+ if (e.kind === "connection") switch (e.connection.state) {
12129
12126
  case "connected":
12130
12127
  this.loading.hasFailed() && this.loading.end(), !this.loading.isActive() && this.state.connectionState !== "connected" && this.setConnectionState("connected", this.t("status.live"));
12131
12128
  break;