@tradecanvas/chart 1.53.0 → 1.53.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.
- package/dist/{LayoutSession-D7uQq3jX.js → LayoutSession-B2WYXhzD.js} +2 -2
- package/dist/{LayoutSession-D7uQq3jX.js.map → LayoutSession-B2WYXhzD.js.map} +1 -1
- package/dist/{LayoutSession-nlhT-EH7.cjs → LayoutSession-DTb03S73.cjs} +2 -2
- package/dist/{LayoutSession-nlhT-EH7.cjs.map → LayoutSession-DTb03S73.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/widget/ChartWidget.d.ts +7 -0
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/index.cjs +2 -2
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +59 -32
- package/dist/widget/index.js.map +1 -1
- package/package.json +3 -3
package/dist/widget/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as e, a as t, c as n, d as r, f as i, i as a, n as o, o as s, r as c, t as l } from "../LayoutSession-
|
|
1
|
+
import { O as e, a as t, c as n, d as r, f as i, i as a, n as o, o as s, r as c, t as l } from "../LayoutSession-B2WYXhzD.js";
|
|
2
2
|
import { a as u, c as d, i as f, n as p, o as m, r as h, s as ee, t as g } from "../i18n-CwCzRLKW.js";
|
|
3
3
|
import { CHART_STYLE_KEYS as _, CHART_TYPE_ICONS as v, DARK_THEME as y, DEFAULT_SIGNAL_STYLE as b, DEFAULT_TRADE_ZONE_STYLE as x, DEFAULT_TRADING_CONFIG as S, DRAWING_TOOL_ICONS as te, LIGHT_THEME as ne, PHI as re, PRICE_SOURCES as ie, SANS_FONT_FAMILY as ae, UI_ICONS as oe, barTimeUnit as se, formatPrice as ce, iconSvg as le, indicatorSource as ue, isTimeFrame as de, isValidTimeZone as fe, marketStatus as pe, offsetAt as me, parseIndicatorSource as he, phiStep as ge, readChartStyleOverrides as _e, readChartTypeOptions as ve, readIndicatorPlotStyles as ye, readNews as be, readQuote as xe, resampleBars as Se, sanitizeDrawingOptions as Ce, sanitizeDrawingStyle as we, stepDecimals as Te, symbolTimeZone as Ee, tickBarCount as De, timeParts as Oe, timeframeFollowsDays as ke, timeframeToMs as C, tzLabel as Ae, wallToUtc as je, zoneOffsetMinutes as Me, zonedDateFormatter as Ne } from "@tradecanvas/commons";
|
|
4
4
|
import { ChartStateManager as Pe, INDICATOR_CATEGORIES as Fe, INTERVAL_LIMITS as Ie, INTERVAL_UNITS as Le, MAX_ALERT_BARS as Re, MIN_ALERT_BARS as ze, RANGE_PRESETS as Be, ResamplingAdapter as Ve, SYMBOL_INDICATOR_IDS as He, indicatorCategory as Ue, indicatorValuePrecision as We, isSeriesPalette as Ge, plotColor as Ke, plotShown as qe, rangePresetStart as Je, servesTimeframe as Ye, sourceParam as Xe, withResampling as w } from "@tradecanvas/core";
|
|
@@ -11358,6 +11358,7 @@ var Od = 4, kd = 7, Ad = 17, jd = 3, Md = 150, Nd = 5e3, Pd = 8, Fd = 6e4, Id =
|
|
|
11358
11358
|
replayStepsKey = null;
|
|
11359
11359
|
replayStep = "auto";
|
|
11360
11360
|
replayStartSeq = 0;
|
|
11361
|
+
replayPickTime = null;
|
|
11361
11362
|
replayStartPending = !1;
|
|
11362
11363
|
replayPlayWanted = !1;
|
|
11363
11364
|
replayStepsCache = null;
|
|
@@ -11763,9 +11764,14 @@ var Od = 4, kd = 7, Ad = 17, jd = 3, Md = 150, Nd = 5e3, Pd = 8, Fd = 6e4, Id =
|
|
|
11763
11764
|
this.chart.on("chartTypeChange", () => {
|
|
11764
11765
|
this.compareScaleHeld && this.showHeldScale(), this.scheduleLegend();
|
|
11765
11766
|
}), this.chart.on("barClick", (e) => {
|
|
11766
|
-
if (!this.replayBar?.isMounted()
|
|
11767
|
-
let t = e.payload
|
|
11767
|
+
if (!this.replayBar?.isMounted()) return;
|
|
11768
|
+
let { barIndex: t, bar: n } = e.payload;
|
|
11768
11769
|
if (typeof t == "number") {
|
|
11770
|
+
if (this.seriesPending()) {
|
|
11771
|
+
let e = n?.time ?? this.chart.getData()[t]?.time;
|
|
11772
|
+
this.replayBar.getMode() === "select" && typeof e == "number" && (this.replayPickTime = e);
|
|
11773
|
+
return;
|
|
11774
|
+
}
|
|
11769
11775
|
if (this.replayBar.getMode() === "select") {
|
|
11770
11776
|
this.startReplayAt(t, !1, !0);
|
|
11771
11777
|
return;
|
|
@@ -14516,6 +14522,21 @@ var Od = 4, kd = 7, Ad = 17, jd = 3, Md = 150, Nd = 5e3, Pd = 8, Fd = 6e4, Id =
|
|
|
14516
14522
|
let e = this.replayBar;
|
|
14517
14523
|
!e?.isMounted() || e.getMode() !== "replay" || (this.syncReplayBar(), !(this.replayStep === "bar" || this.chartFetchesReplaySteps()) && this.replayStepsKey !== this.replayStepsKeyNow() && this.startReplayAt(this.chart.getReplayBarIndex(), this.chart.getReplayState() === "playing"));
|
|
14518
14524
|
}
|
|
14525
|
+
startPickedReplay() {
|
|
14526
|
+
let e = this.replayPickTime;
|
|
14527
|
+
if (e === null) return;
|
|
14528
|
+
if (this.loading.hasFailed() || this.replayBar?.getMode() !== "select") {
|
|
14529
|
+
this.replayPickTime = null;
|
|
14530
|
+
return;
|
|
14531
|
+
}
|
|
14532
|
+
if (this.seriesPending()) return;
|
|
14533
|
+
this.replayPickTime = null;
|
|
14534
|
+
let t = this.chart.getData();
|
|
14535
|
+
if (!rf(t, e)) return;
|
|
14536
|
+
let n = 0;
|
|
14537
|
+
for (; n + 1 < t.length && t[n + 1].time <= e;) n++;
|
|
14538
|
+
this.startReplayAt(n, !1, !0);
|
|
14539
|
+
}
|
|
14519
14540
|
seriesPending() {
|
|
14520
14541
|
return this.loading.isActive() && !this.loading.hasFailed();
|
|
14521
14542
|
}
|
|
@@ -14599,7 +14620,7 @@ var Od = 4, kd = 7, Ad = 17, jd = 3, Md = 150, Nd = 5e3, Pd = 8, Fd = 6e4, Id =
|
|
|
14599
14620
|
}
|
|
14600
14621
|
syncReplayBar() {
|
|
14601
14622
|
let e = this.replayBar;
|
|
14602
|
-
if (!e?.isMounted() || (e.setPending(this.seriesPending()), this.liftOverReplayBar(), e.getMode() !== "replay")) return;
|
|
14623
|
+
if (!e?.isMounted() || (e.setPending(this.seriesPending()), this.startPickedReplay(), this.liftOverReplayBar(), e.getMode() !== "replay")) return;
|
|
14603
14624
|
if (this.replayStartPending) {
|
|
14604
14625
|
e.setState("paused");
|
|
14605
14626
|
return;
|
|
@@ -14653,7 +14674,7 @@ var Od = 4, kd = 7, Ad = 17, jd = 3, Md = 150, Nd = 5e3, Pd = 8, Fd = 6e4, Id =
|
|
|
14653
14674
|
this.teardownReplayUi(), this.chart.replayStop();
|
|
14654
14675
|
}
|
|
14655
14676
|
teardownReplayUi() {
|
|
14656
|
-
this.replayStartSeq++, this.replayStartPending = !1, this.replayPlayWanted = !1, this.replayPollInterval &&= (clearInterval(this.replayPollInterval), null), this.removeReplayShade();
|
|
14677
|
+
this.replayStartSeq++, this.replayPickTime = null, this.replayStartPending = !1, this.replayPlayWanted = !1, this.replayPollInterval &&= (clearInterval(this.replayPollInterval), null), this.removeReplayShade();
|
|
14657
14678
|
let e = !!this.replayBar?.element()?.contains(document.activeElement);
|
|
14658
14679
|
this.replayBar?.unmount(), this.replayBar = null, this.replayBarsTotal = null, this.replayStepTime = null, this.toolbar?.setActive("replay", !1), this.root.removeAttribute("data-tcw-replay"), this.root.style.removeProperty("--tcw-replay-lift"), this.bodyEl()?.style.removeProperty("--tcw-replay-lift"), e && this.focusAfterReplay();
|
|
14659
14680
|
}
|
|
@@ -14951,23 +14972,29 @@ function tf(e) {
|
|
|
14951
14972
|
function nf(e) {
|
|
14952
14973
|
return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
|
|
14953
14974
|
}
|
|
14975
|
+
function rf(e, t) {
|
|
14976
|
+
let n = e.length;
|
|
14977
|
+
if (n === 0 || t < e[0].time) return !1;
|
|
14978
|
+
let r = e[n - 1].time;
|
|
14979
|
+
return t < r + (n > 1 ? r - e[n - 2].time : 0) || t === r;
|
|
14980
|
+
}
|
|
14954
14981
|
//#endregion
|
|
14955
14982
|
//#region src/widget/ChartWidgetGrid.ts
|
|
14956
|
-
var
|
|
14983
|
+
var af = {
|
|
14957
14984
|
symbol: !1,
|
|
14958
14985
|
interval: !1,
|
|
14959
14986
|
crosshair: !0,
|
|
14960
14987
|
time: !1,
|
|
14961
14988
|
drawings: !1,
|
|
14962
14989
|
replay: !1
|
|
14963
|
-
},
|
|
14990
|
+
}, of = [
|
|
14964
14991
|
"symbol",
|
|
14965
14992
|
"interval",
|
|
14966
14993
|
"crosshair",
|
|
14967
14994
|
"time",
|
|
14968
14995
|
"drawings",
|
|
14969
14996
|
"replay"
|
|
14970
|
-
],
|
|
14997
|
+
], sf = {
|
|
14971
14998
|
"1x1": {
|
|
14972
14999
|
cols: 1,
|
|
14973
15000
|
rows: 1
|
|
@@ -15001,25 +15028,25 @@ var rf = {
|
|
|
15001
15028
|
rows: 3
|
|
15002
15029
|
}
|
|
15003
15030
|
};
|
|
15004
|
-
function sf(e) {
|
|
15005
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(of, e);
|
|
15006
|
-
}
|
|
15007
15031
|
function cf(e) {
|
|
15032
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(sf, e);
|
|
15033
|
+
}
|
|
15034
|
+
function lf(e) {
|
|
15008
15035
|
return JSON.parse(JSON.stringify(e));
|
|
15009
15036
|
}
|
|
15010
|
-
function
|
|
15037
|
+
function uf(e, t, n = 16) {
|
|
15011
15038
|
let r = (20 - 2 * (e - 1)) / e, i = (20 - 2 * (t - 1)) / t, a = "";
|
|
15012
15039
|
for (let n = 0; n < t; n++) for (let t = 0; t < e; t++) a += `<rect x="${2 + t * (r + 2)}" y="${2 + n * (i + 2)}" width="${r}" height="${i}" rx="1"/>`;
|
|
15013
15040
|
return `<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${a}</svg>`;
|
|
15014
15041
|
}
|
|
15015
|
-
function
|
|
15042
|
+
function df(e) {
|
|
15016
15043
|
if (typeof e != "object" || !e) return null;
|
|
15017
15044
|
let t = e;
|
|
15018
|
-
if (t.v !== 1 || t.kind !== "grid" || !
|
|
15045
|
+
if (t.v !== 1 || t.kind !== "grid" || !cf(t.layout) || !Array.isArray(t.cells)) return null;
|
|
15019
15046
|
let n = t.cells.map(Rl);
|
|
15020
15047
|
if (n.some((e) => e === null)) return null;
|
|
15021
|
-
let r = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, i = { ...
|
|
15022
|
-
for (let e of
|
|
15048
|
+
let r = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, i = { ...af };
|
|
15049
|
+
for (let e of of) typeof r[e] == "boolean" && (i[e] = r[e]);
|
|
15023
15050
|
let a = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
|
|
15024
15051
|
return {
|
|
15025
15052
|
v: 1,
|
|
@@ -15030,7 +15057,7 @@ function uf(e) {
|
|
|
15030
15057
|
cells: n
|
|
15031
15058
|
};
|
|
15032
15059
|
}
|
|
15033
|
-
var
|
|
15060
|
+
var ff = class {
|
|
15034
15061
|
root;
|
|
15035
15062
|
cellsEl;
|
|
15036
15063
|
cells = [];
|
|
@@ -15059,8 +15086,8 @@ var df = class {
|
|
|
15059
15086
|
!(e.ctrlKey || e.metaKey) || e.altKey || e.shiftKey || e.key !== "s" && e.key !== "S" || !this.layoutsUI || Z() || !Pl(this.root, !0) || (e.preventDefault(), this.layoutsUI.save());
|
|
15060
15087
|
};
|
|
15061
15088
|
constructor(e, t = {}) {
|
|
15062
|
-
this.options = t, this.layout =
|
|
15063
|
-
...
|
|
15089
|
+
this.options = t, this.layout = cf(t.layout) ? t.layout : "1x2", this.sync = {
|
|
15090
|
+
...af,
|
|
15064
15091
|
...t.sync
|
|
15065
15092
|
}, this.t = p(m(t.widget?.locale, t.widget?.messages)), pn(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ko(this.root, Do(t.widget?.ui), { variables: t.widget?.ui !== void 0 }), t.bar !== !1 && this.root.appendChild(this.buildBar()), this.cellsEl = document.createElement("div"), this.cellsEl.className = "tcw-grid-cells", this.root.appendChild(this.cellsEl), e.appendChild(this.root), this.stopNarrow = Ul(this.root), this.applyShape();
|
|
15066
15093
|
for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
|
|
@@ -15098,7 +15125,7 @@ var df = class {
|
|
|
15098
15125
|
return this.layout;
|
|
15099
15126
|
}
|
|
15100
15127
|
setLayout(e) {
|
|
15101
|
-
if (e === this.layout || !
|
|
15128
|
+
if (e === this.layout || !cf(e)) return;
|
|
15102
15129
|
this.layout = e;
|
|
15103
15130
|
let t = this.shapeCount();
|
|
15104
15131
|
for (; this.cells.length > t;) {
|
|
@@ -15188,7 +15215,7 @@ var df = class {
|
|
|
15188
15215
|
return JSON.stringify(this.captureLayout());
|
|
15189
15216
|
}
|
|
15190
15217
|
async applyLayoutContent(e) {
|
|
15191
|
-
let t =
|
|
15218
|
+
let t = df(zl(e));
|
|
15192
15219
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
15193
15220
|
}
|
|
15194
15221
|
destroy() {
|
|
@@ -15199,11 +15226,11 @@ var df = class {
|
|
|
15199
15226
|
}
|
|
15200
15227
|
}
|
|
15201
15228
|
shapeCount() {
|
|
15202
|
-
let { cols: e, rows: t } =
|
|
15229
|
+
let { cols: e, rows: t } = sf[this.layout];
|
|
15203
15230
|
return e * t;
|
|
15204
15231
|
}
|
|
15205
15232
|
applyShape() {
|
|
15206
|
-
let { cols: e, rows: t } =
|
|
15233
|
+
let { cols: e, rows: t } = sf[this.layout];
|
|
15207
15234
|
this.cellsEl.style.gridTemplateColumns = `repeat(${e}, minmax(0, 1fr))`, this.cellsEl.style.gridTemplateRows = `repeat(${t}, minmax(0, 1fr))`;
|
|
15208
15235
|
}
|
|
15209
15236
|
createCell(e) {
|
|
@@ -15264,7 +15291,7 @@ var df = class {
|
|
|
15264
15291
|
t.replaySeekToTime(n);
|
|
15265
15292
|
return;
|
|
15266
15293
|
}
|
|
15267
|
-
let r =
|
|
15294
|
+
let r = pf(t.getData(), n);
|
|
15268
15295
|
r >= 0 && t.replayStart({
|
|
15269
15296
|
startIndex: r,
|
|
15270
15297
|
paused: !0
|
|
@@ -15309,7 +15336,7 @@ var df = class {
|
|
|
15309
15336
|
copyDrawings(e) {
|
|
15310
15337
|
let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
|
|
15311
15338
|
this.quietly(() => {
|
|
15312
|
-
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(
|
|
15339
|
+
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(lf(n));
|
|
15313
15340
|
});
|
|
15314
15341
|
}
|
|
15315
15342
|
mergeDrawings() {
|
|
@@ -15321,7 +15348,7 @@ var df = class {
|
|
|
15321
15348
|
let e = /* @__PURE__ */ new Map();
|
|
15322
15349
|
for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
|
|
15323
15350
|
let n = [...e.values()];
|
|
15324
|
-
for (let e of t) e.widget.getChart().setDrawings(
|
|
15351
|
+
for (let e of t) e.widget.getChart().setDrawings(lf(n));
|
|
15325
15352
|
}
|
|
15326
15353
|
});
|
|
15327
15354
|
}
|
|
@@ -15357,20 +15384,20 @@ var df = class {
|
|
|
15357
15384
|
e.className = "tcw-grid-bar", e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", this.t("grid.bar")), this.tabsEl = document.createElement("div"), this.tabsEl.className = "tcw-grid-group tcw-grid-tabs", this.root.classList.add("tcw-grid-has-tabs"), this.tabsEl.setAttribute("role", "group"), this.tabsEl.setAttribute("aria-label", this.t("grid.charts")), e.appendChild(this.tabsEl);
|
|
15358
15385
|
let t = document.createElement("div");
|
|
15359
15386
|
t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
|
|
15360
|
-
let n = this.options.layoutChoices?.filter(
|
|
15387
|
+
let n = this.options.layoutChoices?.filter(cf) ?? Object.keys(sf);
|
|
15361
15388
|
for (let e of n) {
|
|
15362
|
-
let { cols: n, rows: r } =
|
|
15389
|
+
let { cols: n, rows: r } = sf[e], i = n * r === 1 ? this.t("grid.single") : h(this.t("grid.layoutOption"), {
|
|
15363
15390
|
count: n * r,
|
|
15364
15391
|
cols: n,
|
|
15365
15392
|
rows: r
|
|
15366
15393
|
}), a = document.createElement("button");
|
|
15367
|
-
a.type = "button", a.className = "tcw-btn-icon", a.title = i, a.setAttribute("aria-label", i), a.innerHTML =
|
|
15394
|
+
a.type = "button", a.className = "tcw-btn-icon", a.title = i, a.setAttribute("aria-label", i), a.innerHTML = uf(n, r), a.addEventListener("click", () => this.setLayout(e)), this.layoutButtons.set(e, a), t.appendChild(a);
|
|
15368
15395
|
}
|
|
15369
15396
|
let r = document.createElement("div");
|
|
15370
15397
|
r.className = "tcw-grid-group", r.setAttribute("role", "group"), r.setAttribute("aria-label", this.t("grid.sync"));
|
|
15371
15398
|
let i = document.createElement("span");
|
|
15372
15399
|
i.className = "tcw-grid-label", i.innerHTML = `${M("link", 13)}<span>${N(this.t("grid.sync"))}</span>`, r.appendChild(i);
|
|
15373
|
-
for (let e of
|
|
15400
|
+
for (let e of of) {
|
|
15374
15401
|
let t = document.createElement("button");
|
|
15375
15402
|
t.type = "button", t.className = "tcw-btn tcw-grid-sync", t.textContent = this.t(`grid.sync.${e}`), t.title = this.t(`grid.sync.${e}.hint`), t.addEventListener("click", () => this.setSync({ [e]: !this.sync[e] })), this.syncButtons.set(e, t), r.appendChild(t);
|
|
15376
15403
|
}
|
|
@@ -15431,12 +15458,12 @@ var df = class {
|
|
|
15431
15458
|
this.cells[this.active]?.widget.toast(e, t);
|
|
15432
15459
|
}
|
|
15433
15460
|
};
|
|
15434
|
-
function
|
|
15461
|
+
function pf(e, t) {
|
|
15435
15462
|
let n = -1;
|
|
15436
15463
|
for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
|
|
15437
15464
|
return n;
|
|
15438
15465
|
}
|
|
15439
15466
|
//#endregion
|
|
15440
|
-
export { v as CHART_TYPE_ICONS, Gd as ChartWidget,
|
|
15467
|
+
export { v as CHART_TYPE_ICONS, Gd as ChartWidget, ff as ChartWidgetGrid, af as DEFAULT_GRID_SYNC, te as DRAWING_TOOL_ICONS, d as EN_MESSAGES, sf as GRID_SHAPES, l as LayoutSession, o as MAX_LAYOUT_NAME, oe as UI_ICONS, ee as VI_MESSAGES, Jt as WIDGET_FEATURES, yo as WIDGET_UI_PRESETS, ko as applyWidgetUI, c as cleanLayoutName, _n as createChartTypeIcon, M as createIcon, gn as createToolIcon, f as findWidgetLocale, le as iconSvg, a as localStorageLayouts, t as memoryLayouts, df as readGridLayout, Oa as readWatchlists, Rl as readWidgetLayout, u as registerWidgetLocale, Do as resolveWidgetUI, Oo as widgetUIVariables };
|
|
15441
15468
|
|
|
15442
15469
|
//# sourceMappingURL=index.js.map
|