@tradecanvas/chart 1.44.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.
- package/dist/Chart.d.ts +79 -11
- package/dist/Chart.d.ts.map +1 -1
- package/dist/DataManager.d.ts +2 -0
- package/dist/DataManager.d.ts.map +1 -1
- package/dist/{LayoutSession-Dh4Kqna4.js → LayoutSession-B-avgafz.js} +86 -41
- package/dist/LayoutSession-B-avgafz.js.map +1 -0
- package/dist/LayoutSession-Dlf4mt43.cjs +2 -0
- package/dist/LayoutSession-Dlf4mt43.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/widget/ChartWidget.d.ts +19 -5
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetSettings.d.ts +2 -2
- package/dist/widget/WidgetSettings.d.ts.map +1 -1
- package/dist/widget/index.cjs +3 -3
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +39 -30
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/types.d.ts +34 -4
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetShareState.d.ts +1 -1
- package/dist/widget/widgetShareState.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-CvLuKb2X.cjs +0 -2
- package/dist/LayoutSession-CvLuKb2X.cjs.map +0 -1
- package/dist/LayoutSession-Dh4Kqna4.js.map +0 -1
package/dist/widget/index.js
CHANGED
|
@@ -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-
|
|
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";
|
|
@@ -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"),
|
|
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:
|
|
3026
|
-
}
|
|
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,
|
|
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
|
}
|
|
@@ -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
|
|
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
|
}
|
|
@@ -10657,10 +10661,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
10657
10661
|
now: () => this.clockNow(),
|
|
10658
10662
|
options: () => ({
|
|
10659
10663
|
current: this.settingsState.timezone,
|
|
10660
|
-
list: Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), this.
|
|
10661
|
-
label: this.t("settings.timezone.exchange"),
|
|
10662
|
-
zone: this.chart.getSymbolInfo()?.timezone ?? null
|
|
10663
|
-
} : void 0)
|
|
10664
|
+
list: Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), this.exchangeChoice())
|
|
10664
10665
|
}),
|
|
10665
10666
|
onPick: (e) => this.changeSettings({ timezone: e })
|
|
10666
10667
|
},
|
|
@@ -10713,7 +10714,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
10713
10714
|
barCountdown: s.barCountdown,
|
|
10714
10715
|
logScale: s.logScale,
|
|
10715
10716
|
trading: s.trading !== !1,
|
|
10716
|
-
exchangeZone:
|
|
10717
|
+
exchangeZone: () => this.exchangeChoice()?.zone
|
|
10717
10718
|
}, this.overlayHost), this.symbolSearch = new Vr({
|
|
10718
10719
|
onPick: (e) => {
|
|
10719
10720
|
this.setSymbol(e);
|
|
@@ -10964,8 +10965,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
10964
10965
|
this.chart.on("ordersChange", () => e.setOrders(this.chart.getOrders()));
|
|
10965
10966
|
}
|
|
10966
10967
|
this.chart.on("dataUpdate", (e) => {
|
|
10967
|
-
|
|
10968
|
-
t && t.bracket === "cancelled" && this.bracketBar?.hide();
|
|
10968
|
+
e.payload.kind === "bracket" && this.bracketBar?.hide();
|
|
10969
10969
|
});
|
|
10970
10970
|
}
|
|
10971
10971
|
this.alertsPanel = new Hi(this.root, {
|
|
@@ -11059,7 +11059,7 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
11059
11059
|
"indicatorRemove",
|
|
11060
11060
|
"indicatorChange"
|
|
11061
11061
|
]) this.chart.on(e, () => this.refreshCompareDialog());
|
|
11062
|
-
|
|
11062
|
+
this.setupDock(), this.commandPalette = new Rr({
|
|
11063
11063
|
onIndicator: (e) => this.handleAddIndicator(e),
|
|
11064
11064
|
onChartType: (e) => this.handleChartType(e),
|
|
11065
11065
|
onDrawingTool: (e) => this.handleDrawingTool(e),
|
|
@@ -11109,10 +11109,18 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
11109
11109
|
}
|
|
11110
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(() => {
|
|
11111
11111
|
this.destroyed || (this.toolbar?.tidy(), this.sidebar?.tidy());
|
|
11112
|
-
}), this.refreshMarket(), this.updateUI(),
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
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);
|
|
11116
11124
|
}
|
|
11117
11125
|
setSymbols(e) {
|
|
11118
11126
|
this.symbols = e;
|
|
@@ -11623,12 +11631,15 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
11623
11631
|
removableIndicators() {
|
|
11624
11632
|
return this.chart.getActiveIndicators().filter((e) => !Ie.has(e.id)).map((e) => e.instanceId);
|
|
11625
11633
|
}
|
|
11626
|
-
|
|
11627
|
-
let e = this.
|
|
11634
|
+
exchangeChoice() {
|
|
11635
|
+
let e = this.chart.getExchangeTimezone() ?? null;
|
|
11636
|
+
if (!(e === null && !this.adapter?.resolveSymbol)) return {
|
|
11628
11637
|
label: this.t("settings.timezone.exchange"),
|
|
11629
|
-
zone:
|
|
11630
|
-
}
|
|
11631
|
-
|
|
11638
|
+
zone: e
|
|
11639
|
+
};
|
|
11640
|
+
}
|
|
11641
|
+
timezoneChoices() {
|
|
11642
|
+
return Ze(this.settingsState.timezone, Date.now(), this.t("settings.timezone.local"), this.exchangeChoice()).map(({ value: e, label: t }) => ({
|
|
11632
11643
|
value: e,
|
|
11633
11644
|
label: t
|
|
11634
11645
|
}));
|
|
@@ -12115,17 +12126,15 @@ var Cl = 4, wl = 7, Tl = 17, El = 3, Dl = [
|
|
|
12115
12126
|
this.lastLocalSwitchMs = performance.now() - e;
|
|
12116
12127
|
}
|
|
12117
12128
|
handleDataUpdate(e) {
|
|
12118
|
-
if (
|
|
12119
|
-
|
|
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")));
|
|
12129
|
+
if (e.kind === "bars") {
|
|
12130
|
+
e.length > 0 && this.loading.isActive() && (this.loading.end(), this.state.connectionState === "error" && this.setConnectionState("connected", this.t("status.live")));
|
|
12122
12131
|
return;
|
|
12123
12132
|
}
|
|
12124
|
-
if (
|
|
12125
|
-
this.loading.isActive() && (this.loading.fail(this.t("status.connectionFailed")), this.setConnectionState("error",
|
|
12133
|
+
if (e.kind === "error") {
|
|
12134
|
+
this.loading.isActive() && (this.loading.fail(this.t("status.connectionFailed")), this.setConnectionState("error", e.error || this.t("status.connectionFailed")));
|
|
12126
12135
|
return;
|
|
12127
12136
|
}
|
|
12128
|
-
switch (
|
|
12137
|
+
if (e.kind === "connection") switch (e.connection.state) {
|
|
12129
12138
|
case "connected":
|
|
12130
12139
|
this.loading.hasFailed() && this.loading.end(), !this.loading.isActive() && this.state.connectionState !== "connected" && this.setConnectionState("connected", this.t("status.live"));
|
|
12131
12140
|
break;
|