@tradecanvas/chart 1.45.0 → 1.46.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-BI2ADwWW.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-B-avgafz.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";
@@ -10032,7 +10032,11 @@ function Xc(e) {
10032
10032
  let t = e.startsWith("#") ? e.slice(1) : e;
10033
10033
  for (let e of t.split("&")) {
10034
10034
  let t = e.indexOf("=");
10035
- if (t > 0 && e.slice(0, t) === Yc) return decodeURIComponent(e.slice(t + 1));
10035
+ if (!(t <= 0 || e.slice(0, t) !== Yc)) try {
10036
+ return decodeURIComponent(e.slice(t + 1));
10037
+ } catch {
10038
+ return null;
10039
+ }
10036
10040
  }
10037
10041
  return null;
10038
10042
  }
@@ -11055,7 +11059,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
11055
11059
  "indicatorRemove",
11056
11060
  "indicatorChange"
11057
11061
  ]) this.chart.on(e, () => this.refreshCompareDialog());
11058
- if (this.setupDock(), this.commandPalette = new Rr({
11062
+ this.setupDock(), this.commandPalette = new Rr({
11059
11063
  onIndicator: (e) => this.handleAddIndicator(e),
11060
11064
  onChartType: (e) => this.handleChartType(e),
11061
11065
  onDrawingTool: (e) => this.handleDrawingTool(e),
@@ -11105,10 +11109,18 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
11105
11109
  }
11106
11110
  }, document.addEventListener("keydown", this.boundGlobalKeydown), document.addEventListener("fullscreenchange", this.onFullscreenChange), this.unregisterKeys = Us(this.root, [this.portal]), t.adapter ? (this.adapter = t.adapter, this.connectStream()) : this.chart.setDataTimeframe(this.state.timeframe), this.watchlist && (this.watchlistInterval = setInterval(() => this.tickWatchlist(), 1e3)), this.markSwitchedOff(), requestAnimationFrame(() => {
11107
11111
  this.destroyed || (this.toolbar?.tidy(), this.sidebar?.tidy());
11108
- }), this.refreshMarket(), this.updateUI(), t.onReady?.(this.chart), t.shareUrl && typeof location < "u") {
11109
- let e = Xc(location.hash);
11110
- e && this.importState(e);
11111
- }
11112
+ }), this.refreshMarket(), this.updateUI(), queueMicrotask(() => {
11113
+ if (!this.destroyed) try {
11114
+ t.onReady?.(this.chart, this);
11115
+ } finally {
11116
+ this.destroyed || this.restoreSharedView();
11117
+ }
11118
+ });
11119
+ }
11120
+ restoreSharedView() {
11121
+ if (!this.options.shareUrl || typeof location > "u") return;
11122
+ let e = Xc(location.hash);
11123
+ e && this.importState(e);
11112
11124
  }
11113
11125
  setSymbols(e) {
11114
11126
  this.symbols = e;