@trdrs/quickcharts 5.7.1 → 5.9.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/CHANGELOG.md +18 -0
- package/README.md +139 -9
- package/dist/{ar-N6ZTWN65.js → ar-UCEHBM7A.js} +13 -2
- package/dist/ar-UCEHBM7A.js.map +1 -0
- package/dist/{assets-BFaYQSN_.d.ts → assets-BlTu7v6I.d.ts} +14 -0
- package/dist/{ca_ES-VHYHWEYE.js → ca_ES-BFGULOZT.js} +13 -2
- package/dist/ca_ES-BFGULOZT.js.map +1 -0
- package/dist/{chunk-ETG46YGK.js → chunk-QDGOF34R.js} +5 -56
- package/dist/chunk-QDGOF34R.js.map +1 -0
- package/dist/{de-IYDL4R7X.js → de-GCEC2EYH.js} +13 -2
- package/dist/de-GCEC2EYH.js.map +1 -0
- package/dist/drawings.d.ts +2 -2
- package/dist/drawings.js +1 -1
- package/dist/{es-LBKNPA3H.js → es-ZB54BYRR.js} +13 -2
- package/dist/es-ZB54BYRR.js.map +1 -0
- package/dist/feature-manifest.json +11 -1
- package/dist/{fr-MHNDYCBF.js → fr-G4UQFXAQ.js} +13 -2
- package/dist/fr-G4UQFXAQ.js.map +1 -0
- package/dist/{he_IL-BMEFQ3ZN.js → he_IL-WWCSQOSV.js} +13 -2
- package/dist/he_IL-WWCSQOSV.js.map +1 -0
- package/dist/{id_ID-TXN53FZX.js → id_ID-7F2V4KIE.js} +13 -2
- package/dist/id_ID-7F2V4KIE.js.map +1 -0
- package/dist/index.d.ts +72 -10
- package/dist/index.js +1046 -802
- package/dist/index.js.map +1 -1
- package/dist/{it-OGBC7TOS.js → it-ACKDFMK4.js} +13 -2
- package/dist/it-ACKDFMK4.js.map +1 -0
- package/dist/{ja-53733PVE.js → ja-O64YJRIH.js} +13 -2
- package/dist/ja-O64YJRIH.js.map +1 -0
- package/dist/{ko-3VKR42AF.js → ko-ZVNVRNQC.js} +13 -2
- package/dist/ko-ZVNVRNQC.js.map +1 -0
- package/dist/{ms_MY-MS365YCK.js → ms_MY-3OXH5BKH.js} +13 -2
- package/dist/ms_MY-3OXH5BKH.js.map +1 -0
- package/dist/{pl-LW3WQV2B.js → pl-22JL2HZV.js} +13 -2
- package/dist/pl-22JL2HZV.js.map +1 -0
- package/dist/{pt-ODOVBTAY.js → pt-P4JJ5ICZ.js} +13 -2
- package/dist/{pt-ODOVBTAY.js.map → pt-P4JJ5ICZ.js.map} +1 -1
- package/dist/quickcharts.css +202 -101
- package/dist/{ru-IPHJS4OI.js → ru-YC5ROSB7.js} +13 -2
- package/dist/ru-YC5ROSB7.js.map +1 -0
- package/dist/{sv-EPVCTIWY.js → sv-X5EQXKFO.js} +13 -2
- package/dist/sv-X5EQXKFO.js.map +1 -0
- package/dist/{symbols-CCYUK8MU.d.ts → symbols-DNMxzgfN.d.ts} +5 -0
- package/dist/symbols.d.ts +1 -1
- package/dist/{th-QONC4EYZ.js → th-3JWJOZ46.js} +13 -2
- package/dist/th-3JWJOZ46.js.map +1 -0
- package/dist/theme-manifest.json +22 -0
- package/dist/{tr-JIO34LZJ.js → tr-E3WXPPX4.js} +13 -2
- package/dist/tr-E3WXPPX4.js.map +1 -0
- package/dist/{vi-6TAWAJKM.js → vi-4YVVQQHU.js} +13 -2
- package/dist/vi-4YVVQQHU.js.map +1 -0
- package/dist/{zh-2BABI2QN.js → zh-GTCA4GAB.js} +13 -2
- package/dist/zh-GTCA4GAB.js.map +1 -0
- package/dist/{zh_TW-L2X3VH4E.js → zh_TW-47TPXCBL.js} +13 -2
- package/dist/zh_TW-47TPXCBL.js.map +1 -0
- package/package.json +1 -1
- package/dist/ar-N6ZTWN65.js.map +0 -1
- package/dist/ca_ES-VHYHWEYE.js.map +0 -1
- package/dist/chunk-ETG46YGK.js.map +0 -1
- package/dist/de-IYDL4R7X.js.map +0 -1
- package/dist/es-LBKNPA3H.js.map +0 -1
- package/dist/fr-MHNDYCBF.js.map +0 -1
- package/dist/he_IL-BMEFQ3ZN.js.map +0 -1
- package/dist/id_ID-TXN53FZX.js.map +0 -1
- package/dist/it-OGBC7TOS.js.map +0 -1
- package/dist/ja-53733PVE.js.map +0 -1
- package/dist/ko-3VKR42AF.js.map +0 -1
- package/dist/ms_MY-MS365YCK.js.map +0 -1
- package/dist/pl-LW3WQV2B.js.map +0 -1
- package/dist/ru-IPHJS4OI.js.map +0 -1
- package/dist/sv-EPVCTIWY.js.map +0 -1
- package/dist/th-QONC4EYZ.js.map +0 -1
- package/dist/tr-JIO34LZJ.js.map +0 -1
- package/dist/vi-6TAWAJKM.js.map +0 -1
- package/dist/zh-2BABI2QN.js.map +0 -1
- package/dist/zh_TW-L2X3VH4E.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -54,7 +54,6 @@ import {
|
|
|
54
54
|
clampFavoritesPosition,
|
|
55
55
|
commitText,
|
|
56
56
|
contrastOf,
|
|
57
|
-
createColorControl,
|
|
58
57
|
createColorPalette,
|
|
59
58
|
cursorButtonArmed,
|
|
60
59
|
dismissOnOutside,
|
|
@@ -83,6 +82,7 @@ import {
|
|
|
83
82
|
magnetSnap,
|
|
84
83
|
menuKeys,
|
|
85
84
|
nextCell,
|
|
85
|
+
normalizeVisibility,
|
|
86
86
|
ownPointer,
|
|
87
87
|
ownsEscape,
|
|
88
88
|
paintedPosition,
|
|
@@ -94,7 +94,6 @@ import {
|
|
|
94
94
|
placePanel,
|
|
95
95
|
pruneFavorites,
|
|
96
96
|
pushEscapeOwner,
|
|
97
|
-
readColor,
|
|
98
97
|
rememberDrawingToolbarTool,
|
|
99
98
|
removableDrawings,
|
|
100
99
|
removeRows,
|
|
@@ -109,13 +108,14 @@ import {
|
|
|
109
108
|
toolRegistry,
|
|
110
109
|
viewportOf,
|
|
111
110
|
visibilityPreset,
|
|
111
|
+
visibleAt,
|
|
112
112
|
volumeText,
|
|
113
113
|
withAlpha,
|
|
114
114
|
withColumn,
|
|
115
115
|
withRow,
|
|
116
116
|
withoutColumn,
|
|
117
117
|
withoutRow
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-QDGOF34R.js";
|
|
119
119
|
import {
|
|
120
120
|
ResourceAbortError,
|
|
121
121
|
memorySaveLoadAdapter
|
|
@@ -1349,6 +1349,10 @@ var search = {
|
|
|
1349
1349
|
/** The checkmark on a row already on the chart. */
|
|
1350
1350
|
"search.addedMark": "{symbol} is on the chart. Click to remove.",
|
|
1351
1351
|
"search.compareEmpty": "No symbols here yet. Why not add some?",
|
|
1352
|
+
/** The pill on a row that lists one instrument on several venues: its accessible name and tooltip.
|
|
1353
|
+
* `{count}` is how many other venues the instrument lists on, which the pill opens beneath the
|
|
1354
|
+
* row; whether they are showing is the pill's expanded state. */
|
|
1355
|
+
"search.moreListings": { one: "{count} more listing", other: "{count} more listings" },
|
|
1352
1356
|
// The asset-class filter strip: the chip for every class, and the strip's own name.
|
|
1353
1357
|
"search.allClasses": "All",
|
|
1354
1358
|
"search.classFilter": "Asset class",
|
|
@@ -1775,7 +1779,23 @@ var settings = {
|
|
|
1775
1779
|
"settings.lineStyleDotted": "Dotted",
|
|
1776
1780
|
"settings.labelsOnPriceScale": "Labels on price scale",
|
|
1777
1781
|
/** The whole instance's visibility, on the Visibility tab. */
|
|
1778
|
-
"settings.showIndicator": "Show this indicator"
|
|
1782
|
+
"settings.showIndicator": "Show this indicator",
|
|
1783
|
+
/** The two colors of a plot drawn in two: its rising bars, and its falling bars. */
|
|
1784
|
+
"settings.growing": "Growing",
|
|
1785
|
+
"settings.falling": "Falling",
|
|
1786
|
+
/** The Style page's two sections: what the indicator writes on the price scale and in the status
|
|
1787
|
+
* line, and the inputs the status line writes after its name. */
|
|
1788
|
+
"settings.outputValues": "Output values",
|
|
1789
|
+
"settings.inputValues": "Input values",
|
|
1790
|
+
"settings.valuesInStatusLine": "Values in status line",
|
|
1791
|
+
"settings.inputsInStatusLine": "Inputs in status line",
|
|
1792
|
+
/** The footer's menu: put back the indicator's own settings, or keep these as the settings its
|
|
1793
|
+
* next copies start from. */
|
|
1794
|
+
"settings.defaults": "Defaults",
|
|
1795
|
+
"settings.resetSettings": "Reset settings",
|
|
1796
|
+
"settings.saveAsDefault": "Save as default",
|
|
1797
|
+
/** Under the Visibility page while one timeframe is left on. */
|
|
1798
|
+
"settings.indicatorPinnedNote": "An indicator stays on at least one timeframe, so it can always be reached again."
|
|
1779
1799
|
};
|
|
1780
1800
|
|
|
1781
1801
|
// src/i18n/en/toast.ts
|
|
@@ -1826,26 +1846,26 @@ function readingDirection(i18n) {
|
|
|
1826
1846
|
return BUILT_IN_LOCALES.find((l) => l.code === i18n.locale())?.dir ?? "ltr";
|
|
1827
1847
|
}
|
|
1828
1848
|
var chartDictionaries = createDictionaryLoader(en, {
|
|
1829
|
-
de: () => import("./de-
|
|
1830
|
-
fr: () => import("./fr-
|
|
1831
|
-
es: () => import("./es-
|
|
1832
|
-
it: () => import("./it-
|
|
1833
|
-
ca_ES: () => import("./ca_ES-
|
|
1834
|
-
pl: () => import("./pl-
|
|
1835
|
-
sv: () => import("./sv-
|
|
1836
|
-
tr: () => import("./tr-
|
|
1837
|
-
ru: () => import("./ru-
|
|
1838
|
-
pt: () => import("./pt-
|
|
1839
|
-
id_ID: () => import("./id_ID-
|
|
1840
|
-
ms_MY: () => import("./ms_MY-
|
|
1841
|
-
th: () => import("./th-
|
|
1842
|
-
vi: () => import("./vi-
|
|
1843
|
-
ja: () => import("./ja-
|
|
1844
|
-
ko: () => import("./ko-
|
|
1845
|
-
zh: () => import("./zh-
|
|
1846
|
-
zh_TW: () => import("./zh_TW-
|
|
1847
|
-
ar: () => import("./ar-
|
|
1848
|
-
he_IL: () => import("./he_IL-
|
|
1849
|
+
de: () => import("./de-GCEC2EYH.js"),
|
|
1850
|
+
fr: () => import("./fr-G4UQFXAQ.js"),
|
|
1851
|
+
es: () => import("./es-ZB54BYRR.js"),
|
|
1852
|
+
it: () => import("./it-ACKDFMK4.js"),
|
|
1853
|
+
ca_ES: () => import("./ca_ES-BFGULOZT.js"),
|
|
1854
|
+
pl: () => import("./pl-22JL2HZV.js"),
|
|
1855
|
+
sv: () => import("./sv-X5EQXKFO.js"),
|
|
1856
|
+
tr: () => import("./tr-E3WXPPX4.js"),
|
|
1857
|
+
ru: () => import("./ru-YC5ROSB7.js"),
|
|
1858
|
+
pt: () => import("./pt-P4JJ5ICZ.js"),
|
|
1859
|
+
id_ID: () => import("./id_ID-7F2V4KIE.js"),
|
|
1860
|
+
ms_MY: () => import("./ms_MY-3OXH5BKH.js"),
|
|
1861
|
+
th: () => import("./th-3JWJOZ46.js"),
|
|
1862
|
+
vi: () => import("./vi-4YVVQQHU.js"),
|
|
1863
|
+
ja: () => import("./ja-O64YJRIH.js"),
|
|
1864
|
+
ko: () => import("./ko-ZVNVRNQC.js"),
|
|
1865
|
+
zh: () => import("./zh-GTCA4GAB.js"),
|
|
1866
|
+
zh_TW: () => import("./zh_TW-47TPXCBL.js"),
|
|
1867
|
+
ar: () => import("./ar-UCEHBM7A.js"),
|
|
1868
|
+
he_IL: () => import("./he_IL-WWCSQOSV.js")
|
|
1849
1869
|
});
|
|
1850
1870
|
var dynamic = (t) => t;
|
|
1851
1871
|
var source = null;
|
|
@@ -1927,6 +1947,8 @@ var THEME_ROLES = [
|
|
|
1927
1947
|
// ── canvas: the chart plot area itself ──────────────────────────────────────────────────────
|
|
1928
1948
|
{ id: "canvas.background", family: "canvas", kind: "color", description: "The fill behind the plotted series." },
|
|
1929
1949
|
{ id: "canvas.paneBorder", family: "canvas", kind: "color", description: "The divider between stacked panes and around the plot area." },
|
|
1950
|
+
{ id: "canvas.paneDivider", family: "canvas", kind: "color", description: "The line between stacked panes." },
|
|
1951
|
+
{ id: "canvas.paneDividerHover", family: "canvas", kind: "color", description: "The band over the line between stacked panes while the pointer is on it." },
|
|
1930
1952
|
{ id: "canvas.watermark", family: "canvas", kind: "color", description: "The text a watermark writes large behind the bars." },
|
|
1931
1953
|
// ── series: direction, before any chart appearance override ─────────────────────────────────
|
|
1932
1954
|
{ id: "series.up", family: "series", kind: "color", description: "A rising value: up volume, a rising indicator tint, a positive series default." },
|
|
@@ -2354,6 +2376,8 @@ function canvasTheme(theme) {
|
|
|
2354
2376
|
return {
|
|
2355
2377
|
background: theme["canvas.background"],
|
|
2356
2378
|
paneBorder: theme["canvas.paneBorder"],
|
|
2379
|
+
paneDivider: theme["canvas.paneDivider"],
|
|
2380
|
+
paneDividerHover: theme["canvas.paneDividerHover"],
|
|
2357
2381
|
watermark: theme["canvas.watermark"],
|
|
2358
2382
|
grid: theme["scale.grid"],
|
|
2359
2383
|
axisText: theme["scale.text"],
|
|
@@ -3860,25 +3884,21 @@ function toCandles(bars) {
|
|
|
3860
3884
|
}
|
|
3861
3885
|
|
|
3862
3886
|
// src/internal/indicators/definitions.ts
|
|
3863
|
-
var int = (defval, min
|
|
3864
|
-
var float = (defval, min, max) => ({
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
});
|
|
3870
|
-
var enumOf = (options2, defval = 0) => ({ kind: "enum", default: defval, options: options2 });
|
|
3871
|
-
var source2 = (defval = 0) => ({ kind: "enum", default: defval, options: PRICE_SOURCES });
|
|
3887
|
+
var int = (defval, min, max, about) => ({ kind: "int", default: defval, min, max, ...about });
|
|
3888
|
+
var float = (defval, min, max, about) => ({ kind: "float", default: defval, min, max, step: 0.1, ...about });
|
|
3889
|
+
var enumOf = (options2, defval, about) => ({ kind: "enum", default: defval, options: options2, ...about });
|
|
3890
|
+
var bool = (defval, about) => ({ kind: "bool", default: defval, ...about });
|
|
3891
|
+
var SOURCE_TITLES = ["Close", "Open", "High", "Low", "(H + L)/2", "(H + L + C)/3", "(O + H + L + C)/4"];
|
|
3892
|
+
var source2 = (defval = 0, group) => ({ kind: "enum", default: defval, options: SOURCE_TITLES, title: "Source", ...group ? { group } : {} });
|
|
3872
3893
|
var sourceOf = (inputs2, key = "source") => inputs2[key] != null ? PRICE_SOURCES[inputs2[key]] : void 0;
|
|
3873
|
-
var line = (lineWidth = 2) => ({ kind: "line", lineWidth });
|
|
3874
|
-
var SMOOTHING_TYPES = ["None", "SMA", "EMA", "RMA", "WMA"];
|
|
3894
|
+
var line = (title, lineWidth = 2) => ({ kind: "line", lineWidth, title });
|
|
3895
|
+
var SMOOTHING_TYPES = ["None", "SMA", "EMA", "SMMA (RMA)", "WMA"];
|
|
3875
3896
|
var SMOOTHING_MA = [null, "sma", "ema", "rma", "wma"];
|
|
3876
3897
|
var smoothingInputs = () => ({
|
|
3877
|
-
smoothingLine: enumOf(SMOOTHING_TYPES, 0),
|
|
3878
|
-
smoothingLength: int(14, 1, 5e3)
|
|
3898
|
+
smoothingLine: enumOf(SMOOTHING_TYPES, 0, { title: "Type", group: "Smoothing" }),
|
|
3899
|
+
smoothingLength: int(14, 1, 5e3, { title: "Length", group: "Smoothing", enabledWhen: { input: "smoothingLine", values: [1, 2, 3, 4] } })
|
|
3879
3900
|
});
|
|
3880
|
-
var
|
|
3881
|
-
var smoothedPlot = { kind: "line", lineWidth: 1, color: SMOOTHED };
|
|
3901
|
+
var smoothedPlot = (title) => ({ kind: "line", lineWidth: 1, color: SMOOTHED, title });
|
|
3882
3902
|
function smoothSeries(values, typeIdx, length) {
|
|
3883
3903
|
const type = SMOOTHING_MA[typeIdx] ?? null;
|
|
3884
3904
|
return type ? maArr(values, length, type) : new Array(values.length).fill(NaN);
|
|
@@ -3888,16 +3908,20 @@ var macdMaOf = (idx) => idx === 1 ? "sma" : "ema";
|
|
|
3888
3908
|
function manifest(id, tag, pane, category, inputs2, plots, extra) {
|
|
3889
3909
|
return { id, tag, pane, category, inputs: inputs2, plots, ...extra };
|
|
3890
3910
|
}
|
|
3891
|
-
var levelsOf = (entries) => Object.fromEntries(Object.entries(entries).map(([k, price]) => [k, { price, color: LEVEL, lineStyle: "dashed" }]));
|
|
3892
|
-
var hlinesBackground = { background: { between: ["upper", "lower"], color: OSCILLATOR_BACKGROUND } };
|
|
3893
|
-
var
|
|
3894
|
-
var
|
|
3895
|
-
var offsetInput = () => int(0, -500, 500);
|
|
3911
|
+
var levelsOf = (entries) => Object.fromEntries(Object.entries(entries).map(([k, [price, title]]) => [k, { price, color: LEVEL, lineStyle: "dashed", title }]));
|
|
3912
|
+
var hlinesBackground = (title = "Background") => ({ background: { between: ["upper", "lower"], color: OSCILLATOR_BACKGROUND, title } });
|
|
3913
|
+
var channelPlots = (basisWidth) => ({ upper: line("Upper", 1), basis: { kind: "line", lineWidth: basisWidth, lineStyle: "dashed", title: "Basis" }, lower: line("Lower", 1) });
|
|
3914
|
+
var channelFill = { fills: { background: { between: ["upper", "lower"], color: BAND_BACKGROUND, title: "Background" } } };
|
|
3915
|
+
var offsetInput = () => int(0, -500, 500, { title: "Offset" });
|
|
3916
|
+
var titlesOf = (entries) => Object.fromEntries(Object.entries(entries ?? {}).flatMap(([key, spec]) => spec.title ? [[key, spec.title]] : []));
|
|
3896
3917
|
function define(def) {
|
|
3897
3918
|
const { compute, ...rest } = def;
|
|
3919
|
+
const { inputs: inputs2, plots, levels, fills } = def.manifest;
|
|
3898
3920
|
return {
|
|
3899
3921
|
...rest,
|
|
3900
|
-
|
|
3922
|
+
plotTitles: { ...titlesOf(plots), ...titlesOf(levels), ...titlesOf(fills) },
|
|
3923
|
+
inputTitles: titlesOf(inputs2),
|
|
3924
|
+
compute: (bars, inputs3) => compute(toCandles(bars), inputs3)
|
|
3901
3925
|
};
|
|
3902
3926
|
}
|
|
3903
3927
|
var volumeIndicator = define({
|
|
@@ -3911,15 +3935,18 @@ var volumeIndicator = define({
|
|
|
3911
3935
|
"VOL",
|
|
3912
3936
|
"overlay",
|
|
3913
3937
|
"vol",
|
|
3914
|
-
{ showMa: enumOf(["No", "Yes"], 0), maLength: int(20, 1, 5e3), colorPrevClose: enumOf(["No", "Yes"], 0), ...smoothingInputs() },
|
|
3915
3938
|
{
|
|
3916
|
-
|
|
3917
|
-
|
|
3939
|
+
showMa: bool(0, { title: "Show MA" }),
|
|
3940
|
+
maLength: int(20, 1, 5e3, { title: "MA Length", enabledWhen: { input: "showMa", values: [1] } }),
|
|
3941
|
+
colorPrevClose: bool(0, { title: "Color based on previous close" }),
|
|
3942
|
+
...smoothingInputs()
|
|
3943
|
+
},
|
|
3944
|
+
{
|
|
3945
|
+
volumeMa: { kind: "line", lineWidth: 1, color: SMOOTHED, scale: "volume", title: "Volume MA" },
|
|
3946
|
+
smoothedMa: { kind: "line", lineWidth: 1, color: VOLUME_SMOOTHED, scale: "volume", title: "Smoothed MA" }
|
|
3918
3947
|
},
|
|
3919
3948
|
{ needsVolume: true }
|
|
3920
3949
|
),
|
|
3921
|
-
plotTitles: { volumeMa: "Volume MA", smoothedMa: "Smoothed MA" },
|
|
3922
|
-
inputTitles: { showMa: "Show MA", maLength: "MA Length", colorPrevClose: "Color Based On Previous Close", ...SMOOTHING_TITLES },
|
|
3923
3950
|
compute: (candles, p) => {
|
|
3924
3951
|
const volumes = volume(candles);
|
|
3925
3952
|
const volumeMa = p.showMa === 1 ? smaArr(volumes, p.maLength) : new Array(candles.length).fill(NaN);
|
|
@@ -3937,11 +3964,9 @@ var smaIndicator = define({
|
|
|
3937
3964
|
"SMA",
|
|
3938
3965
|
"overlay",
|
|
3939
3966
|
"ma",
|
|
3940
|
-
{ period: int(20, 1, 5e3), source: source2(), offset: offsetInput(), ...smoothingInputs() },
|
|
3941
|
-
{ sma: line(), smoothedMa: smoothedPlot }
|
|
3967
|
+
{ period: int(20, 1, 5e3, { title: "Length" }), source: source2(), offset: offsetInput(), ...smoothingInputs() },
|
|
3968
|
+
{ sma: line("MA"), smoothedMa: smoothedPlot("SMA-based MA") }
|
|
3942
3969
|
),
|
|
3943
|
-
plotTitles: { sma: "SMA", smoothedMa: "Smoothed MA" },
|
|
3944
|
-
inputTitles: { period: "Length", source: "Source", offset: "Offset", ...SMOOTHING_TITLES },
|
|
3945
3970
|
compute: (candles, p) => {
|
|
3946
3971
|
const ma = shiftArr(sma(candles, p.period, sourceOf(p)), p.offset);
|
|
3947
3972
|
return { sma: ma, smoothedMa: smoothSeries(ma, p.smoothingLine, p.smoothingLength) };
|
|
@@ -3958,11 +3983,9 @@ var emaIndicator = define({
|
|
|
3958
3983
|
"EMA",
|
|
3959
3984
|
"overlay",
|
|
3960
3985
|
"ma",
|
|
3961
|
-
{ period: int(14, 1, 5e3), source: source2(), offset: offsetInput(), ...smoothingInputs() },
|
|
3962
|
-
{ ema: line(), smoothedMa: smoothedPlot }
|
|
3986
|
+
{ period: int(14, 1, 5e3, { title: "Length" }), source: source2(), offset: offsetInput(), ...smoothingInputs() },
|
|
3987
|
+
{ ema: line("EMA"), smoothedMa: smoothedPlot("EMA-based MA") }
|
|
3963
3988
|
),
|
|
3964
|
-
plotTitles: { ema: "EMA", smoothedMa: "Smoothed MA" },
|
|
3965
|
-
inputTitles: { period: "Length", source: "Source", offset: "Offset", ...SMOOTHING_TITLES },
|
|
3966
3989
|
compute: (candles, p) => {
|
|
3967
3990
|
const ma = shiftArr(ema(candles, p.period, sourceOf(p)), p.offset);
|
|
3968
3991
|
return { ema: ma, smoothedMa: smoothSeries(ma, p.smoothingLine, p.smoothingLength) };
|
|
@@ -3974,9 +3997,7 @@ var hmaIndicator = define({
|
|
|
3974
3997
|
descriptionKey: "indicator.hmaDescription",
|
|
3975
3998
|
tag: "HMA",
|
|
3976
3999
|
category: "ma",
|
|
3977
|
-
manifest: manifest("hma", "HMA", "overlay", "ma", { period: int(16, 2, 5e3) }, { hma: line() }),
|
|
3978
|
-
plotTitles: { hma: "HMA" },
|
|
3979
|
-
inputTitles: { period: "Length" },
|
|
4000
|
+
manifest: manifest("hma", "HMA", "overlay", "ma", { period: int(16, 2, 5e3, { title: "Length" }) }, { hma: line("HMA") }),
|
|
3980
4001
|
compute: (candles, p) => ({ hma: hma(candles, p.period) })
|
|
3981
4002
|
});
|
|
3982
4003
|
var vwmaIndicator = define({
|
|
@@ -3985,9 +4006,7 @@ var vwmaIndicator = define({
|
|
|
3985
4006
|
descriptionKey: "indicator.vwmaDescription",
|
|
3986
4007
|
tag: "VWMA",
|
|
3987
4008
|
category: "ma",
|
|
3988
|
-
manifest: manifest("vwma", "VWMA", "overlay", "ma", { period: int(20, 1, 5e3), source: source2() }, { vwma: line() }, { needsVolume: true }),
|
|
3989
|
-
plotTitles: { vwma: "VWMA" },
|
|
3990
|
-
inputTitles: { period: "Length", source: "Source" },
|
|
4009
|
+
manifest: manifest("vwma", "VWMA", "overlay", "ma", { period: int(20, 1, 5e3, { title: "Length" }), source: source2() }, { vwma: line("VWMA") }, { needsVolume: true }),
|
|
3991
4010
|
compute: (candles, p) => ({ vwma: vwma(candles, p.period, sourceOf(p)) })
|
|
3992
4011
|
});
|
|
3993
4012
|
var bollingerIndicator = define({
|
|
@@ -4001,12 +4020,10 @@ var bollingerIndicator = define({
|
|
|
4001
4020
|
"BB",
|
|
4002
4021
|
"overlay",
|
|
4003
4022
|
"band",
|
|
4004
|
-
{ period: int(20, 1, 5e3), stdDev: float(2, 0.1, 50) },
|
|
4005
|
-
|
|
4006
|
-
|
|
4023
|
+
{ period: int(20, 1, 5e3, { title: "Length" }), stdDev: float(2, 0.1, 50, { title: "StdDev" }) },
|
|
4024
|
+
channelPlots(2),
|
|
4025
|
+
channelFill
|
|
4007
4026
|
),
|
|
4008
|
-
plotTitles: BAND_TITLES,
|
|
4009
|
-
inputTitles: { period: "Length", stdDev: "StdDev" },
|
|
4010
4027
|
compute: (candles, p) => {
|
|
4011
4028
|
const r = bollinger(candles, p.period, p.stdDev);
|
|
4012
4029
|
return { upper: r.upper, basis: r.middle, lower: r.lower };
|
|
@@ -4018,17 +4035,7 @@ var donchianIndicator = define({
|
|
|
4018
4035
|
descriptionKey: "indicator.donchianDescription",
|
|
4019
4036
|
tag: "DC",
|
|
4020
4037
|
category: "band",
|
|
4021
|
-
manifest: manifest(
|
|
4022
|
-
"donchian",
|
|
4023
|
-
"DC",
|
|
4024
|
-
"overlay",
|
|
4025
|
-
"band",
|
|
4026
|
-
{ period: int(20, 1, 5e3), offset: offsetInput() },
|
|
4027
|
-
{ upper: line(1), basis: { kind: "line", lineWidth: 1, lineStyle: "dashed" }, lower: line(1) },
|
|
4028
|
-
{ fills: { background: { between: ["upper", "lower"], color: BAND_BACKGROUND } } }
|
|
4029
|
-
),
|
|
4030
|
-
plotTitles: BAND_TITLES,
|
|
4031
|
-
inputTitles: { period: "Length", offset: "Offset" },
|
|
4038
|
+
manifest: manifest("donchian", "DC", "overlay", "band", { period: int(20, 1, 5e3, { title: "Length" }), offset: offsetInput() }, channelPlots(1), channelFill),
|
|
4032
4039
|
compute: (candles, p) => {
|
|
4033
4040
|
const r = donchian(candles, p.period);
|
|
4034
4041
|
return { upper: shiftArr(r.upper, p.offset), basis: shiftArr(r.middle, p.offset), lower: shiftArr(r.lower, p.offset) };
|
|
@@ -4045,12 +4052,15 @@ var keltnerIndicator = define({
|
|
|
4045
4052
|
"KC",
|
|
4046
4053
|
"overlay",
|
|
4047
4054
|
"band",
|
|
4048
|
-
{
|
|
4049
|
-
|
|
4050
|
-
|
|
4055
|
+
{
|
|
4056
|
+
period: int(20, 1, 5e3, { title: "Length" }),
|
|
4057
|
+
multiplier: float(2, 0.1, 50, { title: "Multiplier" }),
|
|
4058
|
+
bandsStyle: enumOf(["Average True Range", "Range"], 0, { title: "Bands Style" }),
|
|
4059
|
+
atrPeriod: int(10, 1, 5e3, { title: "ATR Length" })
|
|
4060
|
+
},
|
|
4061
|
+
channelPlots(1),
|
|
4062
|
+
channelFill
|
|
4051
4063
|
),
|
|
4052
|
-
plotTitles: BAND_TITLES,
|
|
4053
|
-
inputTitles: { period: "Length", atrPeriod: "ATR Length", multiplier: "Multiplier", bandsStyle: "Bands Style" },
|
|
4054
4064
|
compute: (candles, p) => {
|
|
4055
4065
|
const r = keltner(candles, p.period, p.atrPeriod, p.multiplier, p.bandsStyle === 1 ? "high-low" : "true-range");
|
|
4056
4066
|
return { upper: r.upper, basis: r.middle, lower: r.lower };
|
|
@@ -4067,16 +4077,14 @@ var supertrendIndicator = define({
|
|
|
4067
4077
|
"ST",
|
|
4068
4078
|
"overlay",
|
|
4069
4079
|
"band",
|
|
4070
|
-
{ period: int(10, 1, 5e3), multiplier: float(3, 0.1, 50) },
|
|
4080
|
+
{ period: int(10, 1, 5e3, { title: "ATR Length" }), multiplier: float(3, 0.1, 50, { title: "Factor", step: 0.01 }) },
|
|
4071
4081
|
{
|
|
4072
|
-
up: { kind: "line", lineWidth: 2, color: UP },
|
|
4073
|
-
down: { kind: "line", lineWidth: 2, color: DOWN },
|
|
4074
|
-
upArrow: { kind: "marker", shape: "arrow-up", location: "absolute", color: UP },
|
|
4075
|
-
downArrow: { kind: "marker", shape: "arrow-down", location: "absolute", color: DOWN }
|
|
4082
|
+
up: { kind: "line", lineWidth: 2, color: UP, title: "Up Trend" },
|
|
4083
|
+
down: { kind: "line", lineWidth: 2, color: DOWN, title: "Down Trend" },
|
|
4084
|
+
upArrow: { kind: "marker", shape: "arrow-up", location: "absolute", color: UP, title: "Buy signal" },
|
|
4085
|
+
downArrow: { kind: "marker", shape: "arrow-down", location: "absolute", color: DOWN, title: "Sell signal" }
|
|
4076
4086
|
}
|
|
4077
4087
|
),
|
|
4078
|
-
plotTitles: { up: "Up trend", down: "Down trend", upArrow: "Buy signal", downArrow: "Sell signal" },
|
|
4079
|
-
inputTitles: { period: "ATR Length", multiplier: "Factor" },
|
|
4080
4088
|
compute: (candles, p) => {
|
|
4081
4089
|
const r = supertrend(candles, p.period, p.multiplier);
|
|
4082
4090
|
const upArrow = new Array(candles.length).fill(NaN);
|
|
@@ -4099,11 +4107,13 @@ var psarIndicator = define({
|
|
|
4099
4107
|
"PSAR",
|
|
4100
4108
|
"overlay",
|
|
4101
4109
|
"band",
|
|
4102
|
-
{
|
|
4103
|
-
|
|
4110
|
+
{
|
|
4111
|
+
start: float(0.02, 1e-3, 1, { title: "Start", step: 0.01 }),
|
|
4112
|
+
step: float(0.02, 1e-3, 1, { title: "Increment", step: 0.01 }),
|
|
4113
|
+
max: float(0.2, 0.01, 1, { title: "Max value", step: 0.01 })
|
|
4114
|
+
},
|
|
4115
|
+
{ psar: { kind: "line", dots: true, title: "PSAR" } }
|
|
4104
4116
|
),
|
|
4105
|
-
plotTitles: { psar: "PSAR" },
|
|
4106
|
-
inputTitles: { start: "Start", step: "Increment", max: "Maximum" },
|
|
4107
4117
|
compute: (candles, p) => ({ psar: psar(candles, p.step, p.max, p.start) })
|
|
4108
4118
|
});
|
|
4109
4119
|
var rsiIndicator = define({
|
|
@@ -4117,12 +4127,10 @@ var rsiIndicator = define({
|
|
|
4117
4127
|
"RSI",
|
|
4118
4128
|
"pane",
|
|
4119
4129
|
"osc",
|
|
4120
|
-
{ period: int(14, 2, 5e3), source: source2(), ...smoothingInputs() },
|
|
4121
|
-
{ rsi: line(), smoothedMa: smoothedPlot },
|
|
4122
|
-
{ levels: levelsOf({ upper: 70, middle: 50, lower: 30 }), fills:
|
|
4130
|
+
{ period: int(14, 2, 5e3, { title: "RSI Length", group: "RSI Settings" }), source: source2(0, "RSI Settings"), ...smoothingInputs() },
|
|
4131
|
+
{ rsi: line("RSI"), smoothedMa: smoothedPlot("RSI-based MA") },
|
|
4132
|
+
{ levels: levelsOf({ upper: [70, "RSI Upper Band"], middle: [50, "RSI Middle Band"], lower: [30, "RSI Lower Band"] }), fills: hlinesBackground("RSI Background Fill") }
|
|
4123
4133
|
),
|
|
4124
|
-
plotTitles: { rsi: "RSI", smoothedMa: "Smoothed MA", upper: "Upper band", middle: "Middle band", lower: "Lower band", background: "Background" },
|
|
4125
|
-
inputTitles: { period: "RSI Length", source: "Source", ...SMOOTHING_TITLES },
|
|
4126
4134
|
compute: (candles, p) => {
|
|
4127
4135
|
const r = rsi(candles, p.period, sourceOf(p));
|
|
4128
4136
|
return { rsi: r, smoothedMa: smoothSeries(r, p.smoothingLine, p.smoothingLength) };
|
|
@@ -4140,17 +4148,15 @@ var macdIndicator = define({
|
|
|
4140
4148
|
"pane",
|
|
4141
4149
|
"osc",
|
|
4142
4150
|
{
|
|
4143
|
-
fast: int(12, 1, 5e3),
|
|
4144
|
-
slow: int(26, 1, 5e3),
|
|
4145
4151
|
source: source2(),
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4152
|
+
fast: int(12, 1, 5e3, { title: "Fast length" }),
|
|
4153
|
+
slow: int(26, 1, 5e3, { title: "Slow length" }),
|
|
4154
|
+
signal: int(9, 1, 5e3, { title: "Signal length" }),
|
|
4155
|
+
oscMaType: enumOf(MACD_MA_TYPES, 0, { title: "Oscillator MA type" }),
|
|
4156
|
+
signalMaType: enumOf(MACD_MA_TYPES, 0, { title: "Signal MA type" })
|
|
4149
4157
|
},
|
|
4150
|
-
{ histogram: { kind: "histogram", up: UP, down: DOWN }, macd: line(), signal: { kind: "line", lineWidth: 1, color: SIGNAL } }
|
|
4158
|
+
{ histogram: { kind: "histogram", up: UP, down: DOWN, title: "Histogram" }, macd: line("MACD"), signal: { kind: "line", lineWidth: 1, color: SIGNAL, title: "Signal line" } }
|
|
4151
4159
|
),
|
|
4152
|
-
plotTitles: { histogram: "Histogram", macd: "MACD", signal: "Signal" },
|
|
4153
|
-
inputTitles: { fast: "Fast Length", slow: "Slow Length", source: "Source", signal: "Signal Smoothing", oscMaType: "Oscillator MA Type", signalMaType: "Signal Line MA Type" },
|
|
4154
4160
|
compute: (candles, p) => {
|
|
4155
4161
|
const r = macd(candles, {
|
|
4156
4162
|
fast: p.fast,
|
|
@@ -4174,12 +4180,10 @@ var stochasticIndicator = define({
|
|
|
4174
4180
|
"STOCH",
|
|
4175
4181
|
"pane",
|
|
4176
4182
|
"osc",
|
|
4177
|
-
{ k: int(14, 1, 5e3), smooth: int(3, 1, 5e3), d: int(3, 1, 5e3) },
|
|
4178
|
-
{ k: line(), d: { kind: "line", lineWidth: 1, color: SIGNAL } },
|
|
4179
|
-
{ levels: levelsOf({ upper: 80, lower: 20 }), fills:
|
|
4183
|
+
{ k: int(14, 1, 5e3, { title: "%K Length" }), smooth: int(3, 1, 5e3, { title: "%K Smoothing" }), d: int(3, 1, 5e3, { title: "%D Smoothing" }) },
|
|
4184
|
+
{ k: line("%K"), d: { kind: "line", lineWidth: 1, color: SIGNAL, title: "%D" } },
|
|
4185
|
+
{ levels: levelsOf({ upper: [80, "Upper Band"], lower: [20, "Lower Band"] }), fills: hlinesBackground() }
|
|
4180
4186
|
),
|
|
4181
|
-
plotTitles: { k: "%K", d: "%D", ...LIMIT_TITLES },
|
|
4182
|
-
inputTitles: { k: "%K Length", smooth: "%K Smoothing", d: "%D Smoothing" },
|
|
4183
4187
|
compute: (candles, p) => {
|
|
4184
4188
|
const r = stochastic(candles, p.k, p.smooth, p.d);
|
|
4185
4189
|
return { k: r.k, d: r.d };
|
|
@@ -4196,12 +4200,15 @@ var stochrsiIndicator = define({
|
|
|
4196
4200
|
"STOCHRSI",
|
|
4197
4201
|
"pane",
|
|
4198
4202
|
"osc",
|
|
4199
|
-
{
|
|
4200
|
-
|
|
4201
|
-
|
|
4203
|
+
{
|
|
4204
|
+
k: int(3, 1, 5e3, { title: "K" }),
|
|
4205
|
+
d: int(3, 1, 5e3, { title: "D" }),
|
|
4206
|
+
rsiPeriod: int(14, 2, 5e3, { title: "RSI Length" }),
|
|
4207
|
+
stochPeriod: int(14, 1, 5e3, { title: "Stochastic Length" })
|
|
4208
|
+
},
|
|
4209
|
+
{ k: line("K"), d: { kind: "line", lineWidth: 1, color: SIGNAL, title: "D" } },
|
|
4210
|
+
{ levels: levelsOf({ upper: [80, "Upper Band"], lower: [20, "Lower Band"] }), fills: hlinesBackground() }
|
|
4202
4211
|
),
|
|
4203
|
-
plotTitles: { k: "%K", d: "%D", ...LIMIT_TITLES },
|
|
4204
|
-
inputTitles: { rsiPeriod: "RSI Length", stochPeriod: "Stochastic Length", k: "%K Smoothing", d: "%D Smoothing" },
|
|
4205
4212
|
compute: (candles, p) => {
|
|
4206
4213
|
const r = stochRsi(candles, p.rsiPeriod, p.stochPeriod, p.k, p.d);
|
|
4207
4214
|
return { k: r.k, d: r.d };
|
|
@@ -4218,11 +4225,9 @@ var adxIndicator = define({
|
|
|
4218
4225
|
"ADX",
|
|
4219
4226
|
"pane",
|
|
4220
4227
|
"osc",
|
|
4221
|
-
{
|
|
4222
|
-
{ adx: line(), plusDI: { kind: "line", lineWidth: 1, color: UP }, minusDI: { kind: "line", lineWidth: 1, color: DOWN } }
|
|
4228
|
+
{ adxSmoothing: int(14, 1, 5e3, { title: "ADX Smoothing" }), period: int(14, 1, 5e3, { title: "DI Length" }) },
|
|
4229
|
+
{ adx: line("ADX"), plusDI: { kind: "line", lineWidth: 1, color: UP, title: "+DI" }, minusDI: { kind: "line", lineWidth: 1, color: DOWN, title: "-DI" } }
|
|
4223
4230
|
),
|
|
4224
|
-
plotTitles: { adx: "ADX", plusDI: "+DI", minusDI: "\u2212DI" },
|
|
4225
|
-
inputTitles: { period: "DI Length", adxSmoothing: "ADX Smoothing" },
|
|
4226
4231
|
compute: (candles, p) => {
|
|
4227
4232
|
const r = adx(candles, p.period, p.adxSmoothing);
|
|
4228
4233
|
return { adx: r.adx, plusDI: r.plusDI, minusDI: r.minusDI };
|
|
@@ -4234,9 +4239,7 @@ var atrIndicator = define({
|
|
|
4234
4239
|
descriptionKey: "indicator.atrDescription",
|
|
4235
4240
|
tag: "ATR",
|
|
4236
4241
|
category: "osc",
|
|
4237
|
-
manifest: manifest("atr", "ATR", "pane", "osc", { period: int(14, 1, 5e3) }, { atr: line() }),
|
|
4238
|
-
plotTitles: { atr: "ATR" },
|
|
4239
|
-
inputTitles: { period: "Length" },
|
|
4242
|
+
manifest: manifest("atr", "ATR", "pane", "osc", { period: int(14, 1, 5e3, { title: "Length" }) }, { atr: line("ATR") }),
|
|
4240
4243
|
compute: (candles, p) => ({ atr: atr(candles, p.period) })
|
|
4241
4244
|
});
|
|
4242
4245
|
var cciIndicator = define({
|
|
@@ -4250,12 +4253,10 @@ var cciIndicator = define({
|
|
|
4250
4253
|
"CCI",
|
|
4251
4254
|
"pane",
|
|
4252
4255
|
"osc",
|
|
4253
|
-
{ period: int(20, 1, 5e3), source: source2(5), ...smoothingInputs() },
|
|
4254
|
-
{ cci: line(), smoothedMa: smoothedPlot },
|
|
4255
|
-
{ levels: levelsOf({ upper: 100, lower: -100 }), fills:
|
|
4256
|
+
{ period: int(20, 1, 5e3, { title: "Length" }), source: source2(5), ...smoothingInputs() },
|
|
4257
|
+
{ cci: line("CCI"), smoothedMa: smoothedPlot("CCI-based MA") },
|
|
4258
|
+
{ levels: levelsOf({ upper: [100, "Upper Band"], lower: [-100, "Lower Band"] }), fills: hlinesBackground() }
|
|
4256
4259
|
),
|
|
4257
|
-
plotTitles: { cci: "CCI", smoothedMa: "Smoothed MA", ...LIMIT_TITLES },
|
|
4258
|
-
inputTitles: { period: "Length", source: "Source", ...SMOOTHING_TITLES },
|
|
4259
4260
|
compute: (candles, p) => {
|
|
4260
4261
|
const r = cci(candles, p.period, sourceOf(p));
|
|
4261
4262
|
return { cci: r, smoothedMa: smoothSeries(r, p.smoothingLine, p.smoothingLength) };
|
|
@@ -4272,12 +4273,10 @@ var williamsIndicator = define({
|
|
|
4272
4273
|
"%R",
|
|
4273
4274
|
"pane",
|
|
4274
4275
|
"osc",
|
|
4275
|
-
{ period: int(14, 1, 5e3) },
|
|
4276
|
-
{ williams: line() },
|
|
4277
|
-
{ levels: levelsOf({ upper: -20, lower: -80 }), fills:
|
|
4276
|
+
{ period: int(14, 1, 5e3, { title: "Length" }) },
|
|
4277
|
+
{ williams: line("%R") },
|
|
4278
|
+
{ levels: levelsOf({ upper: [-20, "Upper Band"], lower: [-80, "Lower Band"] }), fills: hlinesBackground() }
|
|
4278
4279
|
),
|
|
4279
|
-
plotTitles: { williams: "%R", ...LIMIT_TITLES },
|
|
4280
|
-
inputTitles: { period: "Length" },
|
|
4281
4280
|
compute: (candles, p) => ({ williams: williamsR(candles, p.period) })
|
|
4282
4281
|
});
|
|
4283
4282
|
var rocIndicator = define({
|
|
@@ -4286,9 +4285,7 @@ var rocIndicator = define({
|
|
|
4286
4285
|
descriptionKey: "indicator.rocDescription",
|
|
4287
4286
|
tag: "ROC",
|
|
4288
4287
|
category: "osc",
|
|
4289
|
-
manifest: manifest("roc", "ROC", "pane", "osc", { period: int(12, 1, 5e3), source: source2() }, { roc: line() }, { levels: levelsOf({ zero: 0 }) }),
|
|
4290
|
-
plotTitles: { roc: "ROC", zero: "Zero line" },
|
|
4291
|
-
inputTitles: { period: "Length", source: "Source" },
|
|
4288
|
+
manifest: manifest("roc", "ROC", "pane", "osc", { period: int(12, 1, 5e3, { title: "Length" }), source: source2() }, { roc: line("ROC") }, { levels: levelsOf({ zero: [0, "Zero Line"] }) }),
|
|
4292
4289
|
compute: (candles, p) => ({ roc: roc(candles, p.period, sourceOf(p)) })
|
|
4293
4290
|
});
|
|
4294
4291
|
var momentumIndicator = define({
|
|
@@ -4297,9 +4294,7 @@ var momentumIndicator = define({
|
|
|
4297
4294
|
descriptionKey: "indicator.momentumDescription",
|
|
4298
4295
|
tag: "MOM",
|
|
4299
4296
|
category: "osc",
|
|
4300
|
-
manifest: manifest("momentum", "MOM", "pane", "osc", { period: int(10, 1, 5e3), source: source2() }, { momentum: line() }, { levels: levelsOf({ zero: 0 }) }),
|
|
4301
|
-
plotTitles: { momentum: "Momentum", zero: "Zero line" },
|
|
4302
|
-
inputTitles: { period: "Length", source: "Source" },
|
|
4297
|
+
manifest: manifest("momentum", "MOM", "pane", "osc", { period: int(10, 1, 5e3, { title: "Length" }), source: source2() }, { momentum: line("MOM") }, { levels: levelsOf({ zero: [0, "Zero Line"] }) }),
|
|
4303
4298
|
compute: (candles, p) => ({ momentum: momentum(candles, p.period, sourceOf(p)) })
|
|
4304
4299
|
});
|
|
4305
4300
|
var vwapIndicator = define({
|
|
@@ -4313,12 +4308,10 @@ var vwapIndicator = define({
|
|
|
4313
4308
|
"VWAP",
|
|
4314
4309
|
"overlay",
|
|
4315
4310
|
"vol",
|
|
4316
|
-
{ anchorPeriod: enumOf(["Session", "Week", "Month"], 0), source: source2(5) },
|
|
4317
|
-
{ vwap: line() },
|
|
4311
|
+
{ anchorPeriod: enumOf(["Session", "Week", "Month"], 0, { title: "Anchor Period", group: "VWAP Settings" }), source: source2(5, "VWAP Settings") },
|
|
4312
|
+
{ vwap: line("VWAP") },
|
|
4318
4313
|
{ needsVolume: true }
|
|
4319
4314
|
),
|
|
4320
|
-
plotTitles: { vwap: "VWAP" },
|
|
4321
|
-
inputTitles: { anchorPeriod: "Anchor Period", source: "Source" },
|
|
4322
4315
|
compute: (candles, p) => ({ vwap: vwap(candles, VWAP_ANCHORS[p.anchorPeriod] ?? "session", sourceOf(p) ?? "hlc3") })
|
|
4323
4316
|
});
|
|
4324
4317
|
var obvIndicator = define({
|
|
@@ -4327,9 +4320,7 @@ var obvIndicator = define({
|
|
|
4327
4320
|
descriptionKey: "indicator.obvDescription",
|
|
4328
4321
|
tag: "OBV",
|
|
4329
4322
|
category: "vol",
|
|
4330
|
-
manifest: manifest("obv", "OBV", "pane", "vol", { ...smoothingInputs() }, { obv: line(), smoothedMa: smoothedPlot }, { needsVolume: true }),
|
|
4331
|
-
plotTitles: { obv: "OBV", smoothedMa: "Smoothed MA" },
|
|
4332
|
-
inputTitles: { ...SMOOTHING_TITLES },
|
|
4323
|
+
manifest: manifest("obv", "OBV", "pane", "vol", { ...smoothingInputs() }, { obv: line("OBV"), smoothedMa: smoothedPlot("OBV-based MA") }, { needsVolume: true }),
|
|
4333
4324
|
compute: (candles, p) => {
|
|
4334
4325
|
const r = obv(candles);
|
|
4335
4326
|
return { obv: r, smoothedMa: smoothSeries(r, p.smoothingLine, p.smoothingLength) };
|
|
@@ -4346,12 +4337,10 @@ var mfiIndicator = define({
|
|
|
4346
4337
|
"MFI",
|
|
4347
4338
|
"pane",
|
|
4348
4339
|
"vol",
|
|
4349
|
-
{ period: int(14, 1, 5e3) },
|
|
4350
|
-
{ mfi: line() },
|
|
4351
|
-
{ needsVolume: true, levels: levelsOf({ upper: 80, lower: 20 }), fills:
|
|
4340
|
+
{ period: int(14, 1, 5e3, { title: "Length" }) },
|
|
4341
|
+
{ mfi: line("MFI") },
|
|
4342
|
+
{ needsVolume: true, levels: levelsOf({ upper: [80, "Overbought"], lower: [20, "Oversold"] }), fills: hlinesBackground() }
|
|
4352
4343
|
),
|
|
4353
|
-
plotTitles: { mfi: "MFI", ...LIMIT_TITLES },
|
|
4354
|
-
inputTitles: { period: "Length" },
|
|
4355
4344
|
compute: (candles, p) => ({ mfi: mfi(candles, p.period) })
|
|
4356
4345
|
});
|
|
4357
4346
|
|
|
@@ -5388,7 +5377,8 @@ function chartLookOptions(settings2, canvas, ui) {
|
|
|
5388
5377
|
background: c.backgroundType === "gradient" ? { type: ColorType.VerticalGradient, topColor: c.background, bottomColor: c.backgroundBottom } : { type: ColorType.Solid, color: c.background },
|
|
5389
5378
|
textColor: c.scaleTextColor,
|
|
5390
5379
|
fontSize: c.scaleTextSize,
|
|
5391
|
-
fontFamily: canvas.fontFamily
|
|
5380
|
+
fontFamily: canvas.fontFamily,
|
|
5381
|
+
panes: ui.dividers === false ? { separatorColor: "transparent", separatorHoverColor: "transparent", enableResize: false } : { separatorColor: canvas.paneDivider, separatorHoverColor: canvas.paneDividerHover, enableResize: true }
|
|
5392
5382
|
},
|
|
5393
5383
|
grid: {
|
|
5394
5384
|
vertLines: { visible: c.verticalGrid, color: c.verticalGridColor, style: strokeLineStyle(c.verticalGridStyle) },
|
|
@@ -8505,12 +8495,6 @@ function selectChevron(icons) {
|
|
|
8505
8495
|
slot.appendChild(icons.icon("chevronDown18", 18));
|
|
8506
8496
|
return slot;
|
|
8507
8497
|
}
|
|
8508
|
-
function selectField(select, icons) {
|
|
8509
|
-
const box2 = document.createElement("span");
|
|
8510
|
-
box2.className = "qc-select";
|
|
8511
|
-
box2.append(select, selectChevron(icons));
|
|
8512
|
-
return box2;
|
|
8513
|
-
}
|
|
8514
8498
|
|
|
8515
8499
|
// src/ui/drawings/fields.ts
|
|
8516
8500
|
function row(label3, ...controls) {
|
|
@@ -8668,8 +8652,8 @@ function multiDropdown(icons, box2, props) {
|
|
|
8668
8652
|
}
|
|
8669
8653
|
function numberInput(t, icons, props) {
|
|
8670
8654
|
const input = el("input", { type: "number", class: "qc-field qc-drawing-number", "aria-label": props.label });
|
|
8671
|
-
const
|
|
8672
|
-
input.value = Number.isFinite(props.value) ?
|
|
8655
|
+
const written3 = (v) => props.decimals === void 0 ? String(v) : v.toFixed(props.decimals);
|
|
8656
|
+
input.value = Number.isFinite(props.value) ? written3(props.value) : "";
|
|
8673
8657
|
input.step = props.step === void 0 ? "any" : String(props.step);
|
|
8674
8658
|
if (props.min !== void 0) input.min = String(props.min);
|
|
8675
8659
|
if (props.max !== void 0) input.max = String(props.max);
|
|
@@ -8686,7 +8670,7 @@ function numberInput(t, icons, props) {
|
|
|
8686
8670
|
const decimalsOf = (n) => String(n).split(".")[1]?.length ?? 0;
|
|
8687
8671
|
const decimals = props.decimals ?? Math.max(decimalsOf(s), decimalsOf(Number(input.value) || 0));
|
|
8688
8672
|
const next = Number(v.toFixed(decimals));
|
|
8689
|
-
input.value =
|
|
8673
|
+
input.value = written3(next);
|
|
8690
8674
|
props.onChange(next);
|
|
8691
8675
|
};
|
|
8692
8676
|
const steppers = el(
|
|
@@ -9078,6 +9062,25 @@ function visibilityRangeRow(t, icons, props) {
|
|
|
9078
9062
|
out.classList.add("qc-drawing-visibility-row");
|
|
9079
9063
|
return out;
|
|
9080
9064
|
}
|
|
9065
|
+
var VISIBILITY_UNITS = [
|
|
9066
|
+
{ key: "seconds", label: "drawing.unitSeconds", max: 59 },
|
|
9067
|
+
{ key: "minutes", label: "drawing.unitMinutes", max: 59 },
|
|
9068
|
+
{ key: "hours", label: "drawing.unitHours", max: 24 },
|
|
9069
|
+
{ key: "days", label: "drawing.unitDays", max: 366 },
|
|
9070
|
+
{ key: "weeks", label: "drawing.unitWeeks", max: 52 },
|
|
9071
|
+
{ key: "months", label: "drawing.unitMonths", max: 12 }
|
|
9072
|
+
];
|
|
9073
|
+
function timeframeVisibilityRows(t, icons, visibility, patch, pinnedNote) {
|
|
9074
|
+
const enabled = (visibility.ticks ? 1 : 0) + VISIBILITY_UNITS.reduce((n, unit) => n + (visibility[unit.key].on ? 1 : 0), 0);
|
|
9075
|
+
const pinned = (on) => enabled === 1 && on;
|
|
9076
|
+
const out = [toggleRow(t("drawing.unitTicks"), visibility.ticks, (v) => patch({ ticks: v }), pinned(visibility.ticks))];
|
|
9077
|
+
for (const { key, label: label3, max } of VISIBILITY_UNITS) {
|
|
9078
|
+
const range2 = visibility[key];
|
|
9079
|
+
out.push(visibilityRangeRow(t, icons, { label: t(label3), range: range2, max, disabled: pinned(range2.on), onChange: (next) => patch({ [key]: next }) }));
|
|
9080
|
+
}
|
|
9081
|
+
if (enabled === 1) out.push(el("span", { class: "qc-muted qc-drawing-note", text: pinnedNote }));
|
|
9082
|
+
return out;
|
|
9083
|
+
}
|
|
9081
9084
|
|
|
9082
9085
|
// src/ui/drawings/glyphPicker.ts
|
|
9083
9086
|
var KIND_LABEL = {
|
|
@@ -10158,17 +10161,10 @@ var ICONS = {
|
|
|
10158
10161
|
legendEye: { viewBox: "0 0 18 18", body: solid(drawEye(LEGEND_EYE)) },
|
|
10159
10162
|
legendEyeOff: { viewBox: "0 0 18 18", body: solid(drawEye(LEGEND_EYE)) + '<path stroke="currentColor" stroke-linecap="round" d="M3.5 2.5 14.5 16.5"/>' },
|
|
10160
10163
|
legendSettings: { viewBox: "0 0 18 18", body: solid(wall([[2, 9], [4.73, 3], [13.27, 3], [16, 9], [13.27, 15], [4.73, 15]], 0, 0) + ring(9, 9, 2.5)) },
|
|
10161
|
-
// THE trash, on the 18 grid every row control that carries one uses: the legend's
|
|
10162
|
-
//
|
|
10164
|
+
// THE trash, on the 18 grid every row control that carries one uses: the legend's rows, the
|
|
10165
|
+
// saved-layout rows and the timeframe list's custom rows.
|
|
10163
10166
|
trash: { viewBox: "0 0 18 18", body: solid(bin([3, 15, 5], [6, 12, 3, 1.5], [[3.939, 5], [14.061, 5], [12.953, 15], [5.047, 15]])) },
|
|
10164
10167
|
legendChevron: { viewBox: "0 0 15 15", body: solid(polyline([[4, 6], [7.5, 9], [11, 6]], 1.3, { cap: "round" })) },
|
|
10165
|
-
paneCollapse: { viewBox: "0 0 18 18", body: '<path stroke="currentColor" d="M3 4.5h12M3 13.5h12M9 6.5v-2M7.5 6l1.5 1.5L10.5 6M9 11.5v2M7.5 12l1.5-1.5L10.5 12" />' },
|
|
10166
|
-
paneRestore: { viewBox: "0 0 18 18", body: '<path stroke="currentColor" d="M3 4.5h12M3 13.5h12M9 5v3M7.5 7.5L9 9l1.5-1.5M9 13v-3M7.5 10.5L9 9l1.5 1.5" />' },
|
|
10167
|
-
paneMaximize: { viewBox: "0 0 18 18", body: '<path stroke="currentColor" d="M3.5 4.5h11v9h-11z" /> <path stroke="currentColor" d="M6 9h6M9 6.5v5M7.5 8L9 6.5 10.5 8M7.5 10L9 11.5 10.5 10" />' },
|
|
10168
|
-
// Move a pane: an arrow up the middle of the grid, its head opening four units each way, and the
|
|
10169
|
-
// same arrow pointing down.
|
|
10170
|
-
paneUp: { viewBox: "0 0 18 18", body: '<path stroke="currentColor" d="M9 14.5v-11M5 7.5l4-4 4 4" />' },
|
|
10171
|
-
paneDown: { viewBox: "0 0 18 18", body: '<path stroke="currentColor" d="M9 3.5v11M5 10.5l4 4 4-4" />' },
|
|
10172
10168
|
/** The product's own mark, on its native 120 grid. Every chart carries it in the plot's corner. */
|
|
10173
10169
|
productMark: {
|
|
10174
10170
|
viewBox: "0 0 120 120",
|
|
@@ -10410,20 +10406,25 @@ var ICONS = {
|
|
|
10410
10406
|
settingsCanvas: { viewBox: "0 0 28 28", body: solid(pencil([6, 22], 18.5, 2.8, 2)) },
|
|
10411
10407
|
// Events: a calendar page, its band under the top edge and its two rings standing up through it.
|
|
10412
10408
|
settingsEvents: { viewBox: "0 0 28 28", body: solid(frame(5, 6, 23, 22, 2.5) + box(6, 10, 22, 11) + box(9, 4, 10, 8) + box(18, 4, 19, 8)) },
|
|
10413
|
-
// A pane's own buttons, on a 15 grid
|
|
10414
|
-
//
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
//
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10409
|
+
// A pane's own buttons, on a 15 grid. Collapse: two one-unit chevrons pointing at each other
|
|
10410
|
+
// across the middle. Expand: the same two pointing apart. The upper part is drawn first and the
|
|
10411
|
+
// lower second, the order a button's hover moves them in.
|
|
10412
|
+
paneCollapse15: { viewBox: "0 0 15 15", body: '<path stroke="currentColor" d="M11 2 7.5 5 4 2"/><path stroke="currentColor" d="M4 13l3.5-3 3.5 3"/>' },
|
|
10413
|
+
paneExpand15: { viewBox: "0 0 15 15", body: '<path stroke="currentColor" d="m4 5 3.5-3L11 5"/><path stroke="currentColor" d="M11 10l-3.5 3L4 10"/>' },
|
|
10414
|
+
// Move up: a one-unit stem up the middle under a head opening four units each way. Move down: the
|
|
10415
|
+
// same arrow pointing down.
|
|
10416
|
+
paneUp15: { viewBox: "0 0 15 15", body: '<path fill="currentColor" d="M11.83 6.12l-.66.76L8 4.1V12H7V4.1L3.83 6.88l-.66-.76L7.5 2.34l4.33 3.78z"/>' },
|
|
10417
|
+
paneDown15: { viewBox: "0 0 15 15", body: '<path fill="currentColor" d="M11.83 8.88l-.66-.76L8 10.9V3H7v7.9L3.83 8.12l-.66.76 4.33 3.78 4.33-3.78z"/>' },
|
|
10418
|
+
// Maximize: a rounded frame with the middle of its sides left open, its upper half drawn first and
|
|
10419
|
+
// its lower half second.
|
|
10422
10420
|
paneMaximize15: {
|
|
10423
10421
|
viewBox: "0 0 15 15",
|
|
10424
|
-
body:
|
|
10425
|
-
|
|
10426
|
-
|
|
10422
|
+
body: '<path fill="currentColor" d="M4.5 3C3.67 3 3 3.67 3 4.5V6H2V4.5A2.5 2.5 0 0 1 4.5 2h6A2.5 2.5 0 0 1 13 4.5V6h-1V4.5c0-.83-.67-1.5-1.5-1.5h-6z"/><path fill="currentColor" d="M4.5 12A1.5 1.5 0 0 1 3 10.5V9H2v1.5A2.5 2.5 0 0 0 4.5 13h6a2.5 2.5 0 0 0 2.5-2.5V9h-1v1.5c0 .83-.67 1.5-1.5 1.5h-6z"/>'
|
|
10423
|
+
},
|
|
10424
|
+
// Delete a pane: a bin on the 15 grid, its lid and handle above a body narrowing to its foot.
|
|
10425
|
+
trash15: {
|
|
10426
|
+
viewBox: "0 0 15 15",
|
|
10427
|
+
body: '<path fill="currentColor" d="M6.5 2a.5.5 0 0 0-.5.5V3h3v-.5a.5.5 0 0 0-.5-.5h-2ZM10 3h3v1h-1.05l-.86 8.65A1.5 1.5 0 0 1 9.59 14H5.4a1.5 1.5 0 0 1-1.49-1.35L3.05 4H2V3h3v-.5C5 1.67 5.67 1 6.5 1h2c.83 0 1.5.67 1.5 1.5V3ZM4.05 4l.86 8.55a.5.5 0 0 0 .5.45H9.6a.5.5 0 0 0 .5-.45L10.94 4h-6.9Z"/>'
|
|
10427
10428
|
}
|
|
10428
10429
|
};
|
|
10429
10430
|
var COMPARE_EMPTY_MARK = {
|
|
@@ -10614,49 +10615,6 @@ function switchRow(options2) {
|
|
|
10614
10615
|
});
|
|
10615
10616
|
return row2;
|
|
10616
10617
|
}
|
|
10617
|
-
function tabList(options2) {
|
|
10618
|
-
const element = h("div", { class: "qc-tabs", role: "tablist", "aria-label": options2.label });
|
|
10619
|
-
const panelId = `${options2.id}-panel`;
|
|
10620
|
-
options2.panel.id = panelId;
|
|
10621
|
-
const buttons = /* @__PURE__ */ new Map();
|
|
10622
|
-
const set2 = (id) => {
|
|
10623
|
-
for (const [tabId, b] of buttons) {
|
|
10624
|
-
const selected = tabId === id;
|
|
10625
|
-
b.setAttribute("aria-selected", String(selected));
|
|
10626
|
-
b.setAttribute("tabindex", selected ? "0" : "-1");
|
|
10627
|
-
if (selected) options2.panel.setAttribute("aria-labelledby", b.id);
|
|
10628
|
-
}
|
|
10629
|
-
};
|
|
10630
|
-
for (const tab of options2.tabs) {
|
|
10631
|
-
const b = h("button", { type: "button", class: "qc-tab", role: "tab", id: `${options2.id}-tab-${tab.id}`, "aria-controls": panelId, "aria-selected": "false", tabindex: "-1" }, tab.label);
|
|
10632
|
-
b.addEventListener("click", () => {
|
|
10633
|
-
set2(tab.id);
|
|
10634
|
-
options2.onChange(tab.id);
|
|
10635
|
-
});
|
|
10636
|
-
buttons.set(tab.id, b);
|
|
10637
|
-
element.appendChild(b);
|
|
10638
|
-
}
|
|
10639
|
-
element.addEventListener("keydown", (event) => {
|
|
10640
|
-
const ids = options2.tabs.map((t) => t.id);
|
|
10641
|
-
const current = ids.findIndex((id2) => buttons.get(id2) === document.activeElement);
|
|
10642
|
-
let next = -1;
|
|
10643
|
-
if (event.key === "ArrowRight") next = (current + 1) % ids.length;
|
|
10644
|
-
else if (event.key === "ArrowLeft") next = (current - 1 + ids.length) % ids.length;
|
|
10645
|
-
else if (event.key === "Home") next = 0;
|
|
10646
|
-
else if (event.key === "End") next = ids.length - 1;
|
|
10647
|
-
if (next < 0) return;
|
|
10648
|
-
event.preventDefault();
|
|
10649
|
-
const id = ids[next];
|
|
10650
|
-
set2(id);
|
|
10651
|
-
buttons.get(id)?.focus();
|
|
10652
|
-
options2.onChange(id);
|
|
10653
|
-
});
|
|
10654
|
-
set2(options2.value);
|
|
10655
|
-
return { element, set: set2 };
|
|
10656
|
-
}
|
|
10657
|
-
function fieldRow(label3, control, options2 = {}) {
|
|
10658
|
-
return h("label", { class: `qc-field-row${options2.className ? ` ${options2.className}` : ""}` }, h("span", { class: "qc-field-label" }, label3), control);
|
|
10659
|
-
}
|
|
10660
10618
|
|
|
10661
10619
|
// src/ui/chrome/prompt.ts
|
|
10662
10620
|
var NAME_MAX = 64;
|
|
@@ -12347,14 +12305,6 @@ var TEXT_SIZES = ["8", "10", "11", "12", "14", "16", "18", "20", "22", "24", "28
|
|
|
12347
12305
|
var ACROSS_LABEL2 = { top: "drawing.top", middle: "drawing.middle", bottom: "drawing.bottom" };
|
|
12348
12306
|
var BOX_ACROSS_LABEL = { top: "drawing.top", middle: "drawing.inside", bottom: "drawing.bottom" };
|
|
12349
12307
|
var ORIENTATION_LABEL = { horizontal: "drawing.horizontal", vertical: "drawing.vertical" };
|
|
12350
|
-
var VISIBILITY_ROWS = [
|
|
12351
|
-
{ key: "seconds", label: "drawing.unitSeconds", max: 59 },
|
|
12352
|
-
{ key: "minutes", label: "drawing.unitMinutes", max: 59 },
|
|
12353
|
-
{ key: "hours", label: "drawing.unitHours", max: 24 },
|
|
12354
|
-
{ key: "days", label: "drawing.unitDays", max: 366 },
|
|
12355
|
-
{ key: "weeks", label: "drawing.unitWeeks", max: 52 },
|
|
12356
|
-
{ key: "months", label: "drawing.unitMonths", max: 12 }
|
|
12357
|
-
];
|
|
12358
12308
|
var label2 = (t, table) => (value) => table[value] ? t(table[value]) : value;
|
|
12359
12309
|
var textField = (value, ariaLabel, onInput, options2 = {}) => {
|
|
12360
12310
|
const input = el("input", { class: "qc-field qc-drawing-input", "aria-label": ariaLabel, "data-width": "short", placeholder: options2.placeholder });
|
|
@@ -13510,17 +13460,7 @@ function angleRow(ctx) {
|
|
|
13510
13460
|
);
|
|
13511
13461
|
}
|
|
13512
13462
|
function visibilityRows(ctx) {
|
|
13513
|
-
|
|
13514
|
-
const visibility = drawing2.options.visibility ?? DEFAULT_VISIBILITY;
|
|
13515
|
-
const enabled = (visibility.ticks ? 1 : 0) + VISIBILITY_ROWS.reduce((n, r) => n + (visibility[r.key].on ? 1 : 0), 0);
|
|
13516
|
-
const pinned = (on) => enabled === 1 && on;
|
|
13517
|
-
const out = [toggleRow(t("drawing.unitTicks"), visibility.ticks, (v) => ctx.patchVisibility({ ticks: v }), pinned(visibility.ticks))];
|
|
13518
|
-
for (const { key, label: text2, max } of VISIBILITY_ROWS) {
|
|
13519
|
-
const range2 = visibility[key];
|
|
13520
|
-
out.push(visibilityRangeRow(t, ctx.icons, { label: t(text2), range: range2, max, disabled: pinned(range2.on), onChange: (next) => ctx.patchVisibility({ [key]: next }) }));
|
|
13521
|
-
}
|
|
13522
|
-
if (enabled === 1) out.push(el("span", { class: "qc-muted qc-drawing-note", text: t("drawing.timeframePinnedNote") }));
|
|
13523
|
-
return out;
|
|
13463
|
+
return timeframeVisibilityRows(ctx.t, ctx.icons, ctx.drawing.options.visibility ?? DEFAULT_VISIBILITY, (patch) => ctx.patchVisibility(patch), ctx.t("drawing.timeframePinnedNote"));
|
|
13524
13464
|
}
|
|
13525
13465
|
|
|
13526
13466
|
// src/ui/drawings/settingsDialog.ts
|
|
@@ -14255,6 +14195,23 @@ function indicatorHidden(ov) {
|
|
|
14255
14195
|
function manifestInputDefaults(m) {
|
|
14256
14196
|
return Object.fromEntries(Object.entries(m.inputs ?? {}).map(([k, spec]) => [k, spec.default]));
|
|
14257
14197
|
}
|
|
14198
|
+
function manifestTitle(key, spec) {
|
|
14199
|
+
return spec?.title ?? key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (c) => c.toUpperCase());
|
|
14200
|
+
}
|
|
14201
|
+
function inputApplies(m, key, values) {
|
|
14202
|
+
const rule = m.inputs?.[key]?.enabledWhen;
|
|
14203
|
+
if (!rule) return true;
|
|
14204
|
+
const value = values[rule.input] ?? m.inputs?.[rule.input]?.default;
|
|
14205
|
+
return value !== void 0 && rule.values.includes(value);
|
|
14206
|
+
}
|
|
14207
|
+
function declaredInputValue(spec, value) {
|
|
14208
|
+
if (spec.kind === "bool") return value ? 1 : 0;
|
|
14209
|
+
let next = spec.kind === "float" ? value : Math.round(value);
|
|
14210
|
+
if (spec.kind === "enum") next = Math.min(Math.max(0, next), Math.max(0, (spec.options?.length ?? 1) - 1));
|
|
14211
|
+
if (spec.min !== void 0) next = Math.max(spec.min, next);
|
|
14212
|
+
if (spec.max !== void 0) next = Math.min(spec.max, next);
|
|
14213
|
+
return next;
|
|
14214
|
+
}
|
|
14258
14215
|
function effectivePlotColor(m, key, ov, instanceColor) {
|
|
14259
14216
|
return ov?.plots?.[key]?.color ?? m.plots[key]?.color ?? instanceColor;
|
|
14260
14217
|
}
|
|
@@ -14884,57 +14841,6 @@ function sweepEmptyPanes(chart, main) {
|
|
|
14884
14841
|
for (let k = empties.length - 1; k >= 0; k--) chart.removePane(empties[k]);
|
|
14885
14842
|
}
|
|
14886
14843
|
|
|
14887
|
-
// src/panePlan.ts
|
|
14888
|
-
var COLLAPSED_H = 30;
|
|
14889
|
-
var MAIN_MIN_H = 80;
|
|
14890
|
-
var total = (h2) => Object.values(h2).reduce((s, v) => s + v, 0);
|
|
14891
|
-
function planPaneOp(state, op) {
|
|
14892
|
-
const heights = { ...state.heights };
|
|
14893
|
-
const remembered = { ...state.remembered };
|
|
14894
|
-
const target = op.pane;
|
|
14895
|
-
const mainIndex = state.main ?? 0;
|
|
14896
|
-
if (target === mainIndex || heights[target] === void 0) return { apply: {}, remembered };
|
|
14897
|
-
const sum = total(heights);
|
|
14898
|
-
const main = heights[mainIndex] ?? 0;
|
|
14899
|
-
if (op.kind === "collapse") {
|
|
14900
|
-
const cur2 = heights[target];
|
|
14901
|
-
if (cur2 <= COLLAPSED_H) return { apply: {}, remembered };
|
|
14902
|
-
remembered[target] = cur2;
|
|
14903
|
-
return { apply: { [target]: COLLAPSED_H, [mainIndex]: main + (cur2 - COLLAPSED_H) }, remembered };
|
|
14904
|
-
}
|
|
14905
|
-
if (op.kind === "maximize") {
|
|
14906
|
-
const cur2 = heights[target];
|
|
14907
|
-
const others = Object.entries(heights).filter(([i]) => Number(i) !== mainIndex && Number(i) !== target);
|
|
14908
|
-
const apply = {};
|
|
14909
|
-
let freed = 0;
|
|
14910
|
-
for (const [i, h2] of others) {
|
|
14911
|
-
if (h2 > COLLAPSED_H) {
|
|
14912
|
-
remembered[Number(i)] = h2;
|
|
14913
|
-
apply[Number(i)] = COLLAPSED_H;
|
|
14914
|
-
freed += h2 - COLLAPSED_H;
|
|
14915
|
-
}
|
|
14916
|
-
}
|
|
14917
|
-
const mainGives = Math.max(0, main - MAIN_MIN_H);
|
|
14918
|
-
if (mainGives > 0) apply[mainIndex] = main - mainGives;
|
|
14919
|
-
const grown = cur2 + freed + mainGives;
|
|
14920
|
-
if (grown === cur2 && Object.keys(apply).length === 0) return { apply: {}, remembered };
|
|
14921
|
-
remembered[target] = remembered[target] ?? cur2;
|
|
14922
|
-
apply[target] = grown;
|
|
14923
|
-
void sum;
|
|
14924
|
-
return { apply, remembered };
|
|
14925
|
-
}
|
|
14926
|
-
const want = remembered[target];
|
|
14927
|
-
const cur = heights[target];
|
|
14928
|
-
if (want === void 0 || want === cur) return { apply: {}, remembered };
|
|
14929
|
-
const delta = want - cur;
|
|
14930
|
-
const nextRemembered = { ...remembered };
|
|
14931
|
-
delete nextRemembered[target];
|
|
14932
|
-
return { apply: { [target]: want, [mainIndex]: Math.max(MAIN_MIN_H, main - delta) }, remembered: nextRemembered };
|
|
14933
|
-
}
|
|
14934
|
-
function isCollapsed(height) {
|
|
14935
|
-
return height !== void 0 && height > 0 && height <= COLLAPSED_H;
|
|
14936
|
-
}
|
|
14937
|
-
|
|
14938
14844
|
// src/openResource.ts
|
|
14939
14845
|
var isAbort = (error) => typeof error === "object" && error !== null && error.name === "AbortError";
|
|
14940
14846
|
var ResourceRollbackError = class extends Error {
|
|
@@ -15072,6 +14978,57 @@ function openResourceController(deps) {
|
|
|
15072
14978
|
};
|
|
15073
14979
|
}
|
|
15074
14980
|
|
|
14981
|
+
// src/panePlan.ts
|
|
14982
|
+
var COLLAPSED_H = 30;
|
|
14983
|
+
var MAIN_MIN_H = 80;
|
|
14984
|
+
var total = (h2) => Object.values(h2).reduce((s, v) => s + v, 0);
|
|
14985
|
+
function planPaneOp(state, op) {
|
|
14986
|
+
const heights = { ...state.heights };
|
|
14987
|
+
const remembered = { ...state.remembered };
|
|
14988
|
+
const target = op.pane;
|
|
14989
|
+
const mainIndex = state.main ?? 0;
|
|
14990
|
+
if (target === mainIndex || heights[target] === void 0) return { apply: {}, remembered };
|
|
14991
|
+
const sum = total(heights);
|
|
14992
|
+
const main = heights[mainIndex] ?? 0;
|
|
14993
|
+
if (op.kind === "collapse") {
|
|
14994
|
+
const cur2 = heights[target];
|
|
14995
|
+
if (cur2 <= COLLAPSED_H) return { apply: {}, remembered };
|
|
14996
|
+
remembered[target] = cur2;
|
|
14997
|
+
return { apply: { [target]: COLLAPSED_H, [mainIndex]: main + (cur2 - COLLAPSED_H) }, remembered };
|
|
14998
|
+
}
|
|
14999
|
+
if (op.kind === "maximize") {
|
|
15000
|
+
const cur2 = heights[target];
|
|
15001
|
+
const others = Object.entries(heights).filter(([i]) => Number(i) !== mainIndex && Number(i) !== target);
|
|
15002
|
+
const apply = {};
|
|
15003
|
+
let freed = 0;
|
|
15004
|
+
for (const [i, h2] of others) {
|
|
15005
|
+
if (h2 > COLLAPSED_H) {
|
|
15006
|
+
remembered[Number(i)] = h2;
|
|
15007
|
+
apply[Number(i)] = COLLAPSED_H;
|
|
15008
|
+
freed += h2 - COLLAPSED_H;
|
|
15009
|
+
}
|
|
15010
|
+
}
|
|
15011
|
+
const mainGives = Math.max(0, main - MAIN_MIN_H);
|
|
15012
|
+
if (mainGives > 0) apply[mainIndex] = main - mainGives;
|
|
15013
|
+
const grown = cur2 + freed + mainGives;
|
|
15014
|
+
if (grown === cur2 && Object.keys(apply).length === 0) return { apply: {}, remembered };
|
|
15015
|
+
remembered[target] = remembered[target] ?? cur2;
|
|
15016
|
+
apply[target] = grown;
|
|
15017
|
+
void sum;
|
|
15018
|
+
return { apply, remembered };
|
|
15019
|
+
}
|
|
15020
|
+
const want = remembered[target];
|
|
15021
|
+
const cur = heights[target];
|
|
15022
|
+
if (want === void 0 || want === cur) return { apply: {}, remembered };
|
|
15023
|
+
const delta = want - cur;
|
|
15024
|
+
const nextRemembered = { ...remembered };
|
|
15025
|
+
delete nextRemembered[target];
|
|
15026
|
+
return { apply: { [target]: want, [mainIndex]: Math.max(MAIN_MIN_H, main - delta) }, remembered: nextRemembered };
|
|
15027
|
+
}
|
|
15028
|
+
function isCollapsed(height) {
|
|
15029
|
+
return height !== void 0 && height > 0 && height <= COLLAPSED_H;
|
|
15030
|
+
}
|
|
15031
|
+
|
|
15075
15032
|
// src/widget/paneOps.ts
|
|
15076
15033
|
var MAIN_PANE_KEY = "main";
|
|
15077
15034
|
var indicatorPaneKey = (id) => `indicator:${id}`;
|
|
@@ -15079,7 +15036,8 @@ var comparePaneKey = (symbol) => `compare:${symbol}`;
|
|
|
15079
15036
|
var PANE_MOVE_COMMAND = { up: "chart.panes.moveUp", down: "chart.panes.moveDown" };
|
|
15080
15037
|
function attachPaneOps(deps) {
|
|
15081
15038
|
const remembered = /* @__PURE__ */ new Map();
|
|
15082
|
-
|
|
15039
|
+
let maximizedKey = null;
|
|
15040
|
+
let sharesBefore = /* @__PURE__ */ new Map();
|
|
15083
15041
|
let wanted = [];
|
|
15084
15042
|
const keys = () => {
|
|
15085
15043
|
const main = deps.mainPane();
|
|
@@ -15141,7 +15099,6 @@ function attachPaneOps(deps) {
|
|
|
15141
15099
|
for (const [i, h2] of Object.entries(plan.apply)) {
|
|
15142
15100
|
const index = Number(i);
|
|
15143
15101
|
panes[index]?.setHeight(h2);
|
|
15144
|
-
if (index !== main) deps.indicators.setPaneCollapsed(index, h2 <= COLLAPSED_H);
|
|
15145
15102
|
}
|
|
15146
15103
|
};
|
|
15147
15104
|
const canMove = (pane, direction) => {
|
|
@@ -15150,30 +15107,45 @@ function attachPaneOps(deps) {
|
|
|
15150
15107
|
if (!Number.isInteger(pane) || pane < 0 || pane >= count2) return false;
|
|
15151
15108
|
return direction === "up" ? pane > 0 : pane < count2 - 1;
|
|
15152
15109
|
};
|
|
15110
|
+
const keyAt = (byIndex, index) => byIndex[index] ?? `#${index}`;
|
|
15111
|
+
const maximize = (pane) => {
|
|
15112
|
+
const panes = deps.chart.panes();
|
|
15113
|
+
if (panes.length < 2 || typeof panes[0]?.setStretchFactor !== "function") return;
|
|
15114
|
+
const byIndex = keys();
|
|
15115
|
+
sharesBefore = new Map(panes.map((p, index) => [keyAt(byIndex, index), p.getStretchFactor()]));
|
|
15116
|
+
const total2 = [...sharesBefore.values()].reduce((sum, share) => sum + share, 0);
|
|
15117
|
+
maximizedKey = keyAt(byIndex, pane);
|
|
15118
|
+
panes.forEach((p, index) => p.setStretchFactor(index === pane ? total2 : 0));
|
|
15119
|
+
deps.maximizing?.(true);
|
|
15120
|
+
};
|
|
15121
|
+
const endMaximize = () => {
|
|
15122
|
+
if (maximizedKey === null) return;
|
|
15123
|
+
const byIndex = keys();
|
|
15124
|
+
deps.chart.panes().forEach((p, index) => {
|
|
15125
|
+
const share = sharesBefore.get(keyAt(byIndex, index));
|
|
15126
|
+
if (share !== void 0) p.setStretchFactor(share);
|
|
15127
|
+
});
|
|
15128
|
+
maximizedKey = null;
|
|
15129
|
+
sharesBefore = /* @__PURE__ */ new Map();
|
|
15130
|
+
deps.maximizing?.(false);
|
|
15131
|
+
};
|
|
15132
|
+
const hidden = (pane) => maximizedKey !== null && keyAt(keys(), pane) !== maximizedKey;
|
|
15133
|
+
const conceal = () => {
|
|
15134
|
+
deps.chart.panes().forEach((p, index) => {
|
|
15135
|
+
const element = p.getHTMLElement?.();
|
|
15136
|
+
if (element) element.style.visibility = hidden(index) || ops.collapsed(index) ? "hidden" : "";
|
|
15137
|
+
});
|
|
15138
|
+
};
|
|
15153
15139
|
const ops = {
|
|
15154
15140
|
run(pane, op) {
|
|
15155
|
-
const
|
|
15156
|
-
if (
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
if (at2 === main || isCollapsed(heightOf(at2))) continue;
|
|
15162
|
-
apply(at2, "collapse");
|
|
15163
|
-
collapsedForMain.add(key);
|
|
15164
|
-
}
|
|
15165
|
-
} else if (op === "restore") {
|
|
15166
|
-
for (const [index, key] of Object.entries(byIndex)) {
|
|
15167
|
-
if (!collapsedForMain.has(key)) continue;
|
|
15168
|
-
apply(Number(index), "restore");
|
|
15169
|
-
}
|
|
15170
|
-
collapsedForMain.clear();
|
|
15171
|
-
}
|
|
15172
|
-
} else {
|
|
15173
|
-
const key = keys()[pane];
|
|
15174
|
-
if (key) collapsedForMain.delete(key);
|
|
15175
|
-
apply(pane, op);
|
|
15141
|
+
const maximizedHere = maximizedKey !== null && keyAt(keys(), pane) === maximizedKey;
|
|
15142
|
+
if (op === "restore" && maximizedHere) endMaximize();
|
|
15143
|
+
else {
|
|
15144
|
+
endMaximize();
|
|
15145
|
+
if (op === "maximize") maximize(pane);
|
|
15146
|
+
else if (pane !== deps.mainPane()) apply(pane, op);
|
|
15176
15147
|
}
|
|
15148
|
+
conceal();
|
|
15177
15149
|
deps.indicators.recompute();
|
|
15178
15150
|
},
|
|
15179
15151
|
canMove,
|
|
@@ -15190,6 +15162,7 @@ function attachPaneOps(deps) {
|
|
|
15190
15162
|
}
|
|
15191
15163
|
wanted = next;
|
|
15192
15164
|
deps.chart.swapPanes(pane, neighbour);
|
|
15165
|
+
conceal();
|
|
15193
15166
|
if (!settle()) deps.moved?.();
|
|
15194
15167
|
return true;
|
|
15195
15168
|
},
|
|
@@ -15202,20 +15175,21 @@ function attachPaneOps(deps) {
|
|
|
15202
15175
|
main: () => deps.mainPane(),
|
|
15203
15176
|
remembered: (key) => remembered.get(key),
|
|
15204
15177
|
keyOf: (pane) => keys()[pane],
|
|
15205
|
-
collapsed: (pane) => pane !== deps.mainPane() && isCollapsed(heightOf(pane)),
|
|
15206
|
-
maximized(pane)
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
return Object.entries(byIndex).some(([index, key2]) => collapsedForMain.has(key2) && isCollapsed(heightOf(Number(index))));
|
|
15210
|
-
}
|
|
15211
|
-
const key = keys()[pane];
|
|
15212
|
-
const height = key ? remembered.get(key) : void 0;
|
|
15213
|
-
return height !== void 0 && !isCollapsed(heightOf(pane)) && heightOf(pane) > height;
|
|
15214
|
-
},
|
|
15178
|
+
collapsed: (pane) => pane !== deps.mainPane() && !hidden(pane) && isCollapsed(heightOf(pane)),
|
|
15179
|
+
maximized: (pane) => maximizedKey !== null && keyAt(keys(), pane) === maximizedKey,
|
|
15180
|
+
hidden,
|
|
15181
|
+
conceal,
|
|
15215
15182
|
prune() {
|
|
15216
|
-
const
|
|
15183
|
+
const byIndex = keys();
|
|
15184
|
+
const alive = new Set(Object.values(byIndex));
|
|
15217
15185
|
for (const key of remembered.keys()) if (!alive.has(key)) remembered.delete(key);
|
|
15218
|
-
|
|
15186
|
+
if (maximizedKey !== null) {
|
|
15187
|
+
const drawnKeys = deps.chart.panes().map((_, index) => keyAt(byIndex, index));
|
|
15188
|
+
if (!drawnKeys.includes(maximizedKey) || drawnKeys.some((key) => !sharesBefore.has(key))) {
|
|
15189
|
+
endMaximize();
|
|
15190
|
+
conceal();
|
|
15191
|
+
}
|
|
15192
|
+
}
|
|
15219
15193
|
const owned = new Set(owners2());
|
|
15220
15194
|
wanted = wanted.filter((key) => owned.has(key));
|
|
15221
15195
|
}
|
|
@@ -15317,7 +15291,7 @@ function parseNamedRecords(value, label3, read) {
|
|
|
15317
15291
|
}
|
|
15318
15292
|
function parseOverrides(value) {
|
|
15319
15293
|
if (!record(value)) throw new Error("chart content indicator overrides are not a record");
|
|
15320
|
-
assertKeys(value, ["plots", "levels", "fills", "precision", "display"], "overrides");
|
|
15294
|
+
assertKeys(value, ["plots", "levels", "fills", "precision", "display", "visibility"], "overrides");
|
|
15321
15295
|
const overrides = {};
|
|
15322
15296
|
if (value.plots !== void 0) {
|
|
15323
15297
|
overrides.plots = parseNamedRecords(value.plots, "plots", (entry, key) => {
|
|
@@ -15376,8 +15350,42 @@ function parseOverrides(value) {
|
|
|
15376
15350
|
}
|
|
15377
15351
|
overrides.display = display;
|
|
15378
15352
|
}
|
|
15353
|
+
if (value.visibility !== void 0) overrides.visibility = parseVisibility(value.visibility);
|
|
15379
15354
|
return overrides;
|
|
15380
15355
|
}
|
|
15356
|
+
function parseVisibility(value) {
|
|
15357
|
+
if (!record(value)) throw new Error("chart content indicator visibility is not a record");
|
|
15358
|
+
const units = ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
15359
|
+
assertKeys(value, ["ticks", ...units], "visibility");
|
|
15360
|
+
const partial = {};
|
|
15361
|
+
const ticks = optionalBoolean(value.ticks, "visibility ticks");
|
|
15362
|
+
if (ticks !== void 0) partial.ticks = ticks;
|
|
15363
|
+
for (const unit of units) {
|
|
15364
|
+
const range2 = value[unit];
|
|
15365
|
+
if (range2 === void 0) continue;
|
|
15366
|
+
if (!record(range2)) throw new Error(`chart content indicator visibility ${unit} is not a record`);
|
|
15367
|
+
assertKeys(range2, ["on", "from", "to"], `visibility ${unit}`);
|
|
15368
|
+
const on = optionalBoolean(range2.on, `visibility ${unit} switch`);
|
|
15369
|
+
const span = DEFAULT_VISIBILITY[unit];
|
|
15370
|
+
const from = range2.from === void 0 ? span.from : finite(range2.from, `visibility ${unit} from`);
|
|
15371
|
+
const to = range2.to === void 0 ? span.to : finite(range2.to, `visibility ${unit} to`);
|
|
15372
|
+
if (from < span.from || to > span.to || from > to) throw new Error(`chart content indicator visibility ${unit} range is outside its unit`);
|
|
15373
|
+
partial[unit] = { on: on ?? span.on, from, to };
|
|
15374
|
+
}
|
|
15375
|
+
return normalizeVisibility(partial);
|
|
15376
|
+
}
|
|
15377
|
+
function parseIndicatorDefault(value) {
|
|
15378
|
+
try {
|
|
15379
|
+
if (!record(value)) return null;
|
|
15380
|
+
assertKeys(value, ["inputs", "overrides"], "default");
|
|
15381
|
+
return {
|
|
15382
|
+
...value.inputs !== void 0 ? { inputs: parseInputs(value.inputs) } : {},
|
|
15383
|
+
...value.overrides !== void 0 ? { overrides: parseOverrides(value.overrides) } : {}
|
|
15384
|
+
};
|
|
15385
|
+
} catch {
|
|
15386
|
+
return null;
|
|
15387
|
+
}
|
|
15388
|
+
}
|
|
15381
15389
|
function savedIndicatorFields(saved) {
|
|
15382
15390
|
return {
|
|
15383
15391
|
id: saved.id,
|
|
@@ -15510,18 +15518,34 @@ function indicatorMarkOf(inst, t) {
|
|
|
15510
15518
|
return typeof tag === "string" && tag ? tag : indicatorTitleOf(inst, t);
|
|
15511
15519
|
}
|
|
15512
15520
|
function indicatorInputsOf(inst) {
|
|
15513
|
-
const
|
|
15521
|
+
const manifest2 = inst.definition.manifest;
|
|
15522
|
+
const inputs2 = manifest2.inputs;
|
|
15514
15523
|
if (!inputs2) return "";
|
|
15515
|
-
const
|
|
15516
|
-
|
|
15524
|
+
const values = { ...manifestInputDefaults(manifest2), ...inst.inputs };
|
|
15525
|
+
const parts = Object.entries(inputs2).flatMap(([key, spec]) => {
|
|
15526
|
+
if (spec.kind === "bool" || !inputApplies(manifest2, key, values)) return [];
|
|
15527
|
+
const value = values[key] ?? spec.default;
|
|
15517
15528
|
if (spec.kind === "enum" && spec.options) {
|
|
15518
15529
|
const label3 = spec.options[value] ?? String(value);
|
|
15519
|
-
return label3.charAt(0).toUpperCase() + label3.slice(1);
|
|
15530
|
+
return [label3.charAt(0).toUpperCase() + label3.slice(1)];
|
|
15520
15531
|
}
|
|
15521
|
-
return String(value);
|
|
15532
|
+
return [String(value)];
|
|
15522
15533
|
});
|
|
15523
15534
|
return parts.length ? `(${parts.join(", ")})` : "";
|
|
15524
15535
|
}
|
|
15536
|
+
function indicatorDrawsOn(instance, timeframe2) {
|
|
15537
|
+
const visibility = instance.overrides?.visibility;
|
|
15538
|
+
return !visibility || visibleAt(visibility, parseTimeframeContext(timeframe2));
|
|
15539
|
+
}
|
|
15540
|
+
function paintingNothing(manifest2, overrides) {
|
|
15541
|
+
const off = (keys, own) => Object.fromEntries(keys.map((key) => [key, { ...own?.[key], visible: false }]));
|
|
15542
|
+
return {
|
|
15543
|
+
...overrides,
|
|
15544
|
+
plots: off(Object.keys(manifest2.plots), overrides?.plots),
|
|
15545
|
+
levels: off(Object.keys(manifest2.levels ?? {}), overrides?.levels),
|
|
15546
|
+
fills: off(Object.keys(manifest2.fills ?? {}), overrides?.fills)
|
|
15547
|
+
};
|
|
15548
|
+
}
|
|
15525
15549
|
function pinnedColor(instance) {
|
|
15526
15550
|
const primary = Object.keys(instance.definition.manifest.plots)[0];
|
|
15527
15551
|
return primary ? instance.overrides?.plots?.[primary]?.color : void 0;
|
|
@@ -15535,40 +15559,6 @@ function withHidden(instance, hidden) {
|
|
|
15535
15559
|
const { overrides: _overrides, ...bare } = instance;
|
|
15536
15560
|
return Object.keys(overrides).length > 0 ? { ...bare, overrides } : bare;
|
|
15537
15561
|
}
|
|
15538
|
-
var FLOOR_CONFIRM_READINGS = 4;
|
|
15539
|
-
function collapsedReadings(rows2, paneOf, heights, commanded, streaks = {}, main = 0) {
|
|
15540
|
-
const collapsed = {};
|
|
15541
|
-
const nextStreaks = {};
|
|
15542
|
-
let measured = true;
|
|
15543
|
-
for (const row2 of rows2) {
|
|
15544
|
-
if (!row2.pane) continue;
|
|
15545
|
-
const index = paneOf[row2.id];
|
|
15546
|
-
if (index === void 0 || index < 0 || index === main) {
|
|
15547
|
-
collapsed[row2.id] = false;
|
|
15548
|
-
continue;
|
|
15549
|
-
}
|
|
15550
|
-
if (commanded.has(index)) {
|
|
15551
|
-
collapsed[row2.id] = true;
|
|
15552
|
-
continue;
|
|
15553
|
-
}
|
|
15554
|
-
const height = heights[index];
|
|
15555
|
-
if (height === void 0 || height === 0) {
|
|
15556
|
-
collapsed[row2.id] = false;
|
|
15557
|
-
measured = false;
|
|
15558
|
-
continue;
|
|
15559
|
-
}
|
|
15560
|
-
if (!isCollapsed(height)) {
|
|
15561
|
-
collapsed[row2.id] = false;
|
|
15562
|
-
continue;
|
|
15563
|
-
}
|
|
15564
|
-
const streak = (streaks[row2.id] ?? 0) + 1;
|
|
15565
|
-
nextStreaks[row2.id] = streak;
|
|
15566
|
-
const confirmed = streak >= FLOOR_CONFIRM_READINGS;
|
|
15567
|
-
collapsed[row2.id] = confirmed;
|
|
15568
|
-
if (!confirmed) measured = false;
|
|
15569
|
-
}
|
|
15570
|
-
return { collapsed, measured, streaks: nextStreaks };
|
|
15571
|
-
}
|
|
15572
15562
|
var TICK_CAP_MS = 1e3;
|
|
15573
15563
|
function createIndicatorCatalog() {
|
|
15574
15564
|
const carried = /* @__PURE__ */ new Map();
|
|
@@ -15584,13 +15574,12 @@ function createIndicatorCatalog() {
|
|
|
15584
15574
|
}
|
|
15585
15575
|
function attachIndicatorsPlane(deps) {
|
|
15586
15576
|
let instances = [];
|
|
15577
|
+
const previews = /* @__PURE__ */ new Map();
|
|
15587
15578
|
let allHidden = false;
|
|
15588
15579
|
let chips = [];
|
|
15589
15580
|
let readings = /* @__PURE__ */ new Map();
|
|
15590
15581
|
let lastRecompute = 0;
|
|
15591
15582
|
let trailer = null;
|
|
15592
|
-
const commandedIds = /* @__PURE__ */ new Set();
|
|
15593
|
-
let floorStreaks = {};
|
|
15594
15583
|
let paletteCursor = 0;
|
|
15595
15584
|
const withMintedColor = (instance) => {
|
|
15596
15585
|
if (instance.color !== void 0 || pinnedColor(instance) !== void 0) return instance;
|
|
@@ -15598,6 +15587,13 @@ function attachIndicatorsPlane(deps) {
|
|
|
15598
15587
|
if (held !== void 0) return { ...instance, color: held };
|
|
15599
15588
|
return { ...instance, color: INDICATOR_PALETTE[paletteCursor++ % INDICATOR_PALETTE.length] };
|
|
15600
15589
|
};
|
|
15590
|
+
const withSavedDefault = (instance) => {
|
|
15591
|
+
const id = instance.definition.manifest.id;
|
|
15592
|
+
if (instance.inputs !== void 0 || instance.overrides !== void 0 || !id) return instance;
|
|
15593
|
+
const saved = deps.defaults?.read(id);
|
|
15594
|
+
if (!saved) return instance;
|
|
15595
|
+
return { ...instance, ...saved.inputs ? { inputs: saved.inputs } : {}, ...saved.overrides ? { overrides: saved.overrides } : {} };
|
|
15596
|
+
};
|
|
15601
15597
|
const mainPane = () => deps.mainPane?.() ?? 0;
|
|
15602
15598
|
const renderer = attachIndicators(deps.chart, {
|
|
15603
15599
|
candles: deps.candleSeries,
|
|
@@ -15607,36 +15603,6 @@ function attachIndicatorsPlane(deps) {
|
|
|
15607
15603
|
symbolPriceFormat: () => ({ key: deps.formatKey(), formatter: (price) => deps.formatter().format(price), minMove: deps.minMove() }),
|
|
15608
15604
|
neutral: () => deps.canvas().neutral
|
|
15609
15605
|
});
|
|
15610
|
-
const syncCollapsedReadings = (rows2) => {
|
|
15611
|
-
const heights = deps.chart.panes().map((p) => p.getHeight());
|
|
15612
|
-
const paneOf = renderer.paneOf();
|
|
15613
|
-
const commandedPanes = new Set([...commandedIds].map((id) => paneOf[id]).filter((pane) => pane !== void 0));
|
|
15614
|
-
const { collapsed, measured, streaks } = collapsedReadings(rows2, paneOf, heights, commandedPanes, floorStreaks, mainPane());
|
|
15615
|
-
floorStreaks = streaks;
|
|
15616
|
-
let changed = false;
|
|
15617
|
-
for (const row2 of rows2) {
|
|
15618
|
-
if (!row2.pane) continue;
|
|
15619
|
-
const next = collapsed[row2.id] ?? false;
|
|
15620
|
-
if (next !== row2.collapsed) {
|
|
15621
|
-
row2.collapsed = next;
|
|
15622
|
-
changed = true;
|
|
15623
|
-
}
|
|
15624
|
-
}
|
|
15625
|
-
if (changed) deps.onChips();
|
|
15626
|
-
return measured;
|
|
15627
|
-
};
|
|
15628
|
-
const SETTLE_FRAMES = 30;
|
|
15629
|
-
const scheduleCollapsedSync = (rows2) => {
|
|
15630
|
-
if (typeof requestAnimationFrame !== "function" || !rows2.some((c) => c.pane)) return;
|
|
15631
|
-
let left = SETTLE_FRAMES;
|
|
15632
|
-
const look = () => {
|
|
15633
|
-
if (deps.disposed() || chips !== rows2 || left <= 0) return;
|
|
15634
|
-
left -= 1;
|
|
15635
|
-
if (syncCollapsedReadings(rows2)) return;
|
|
15636
|
-
requestAnimationFrame(look);
|
|
15637
|
-
};
|
|
15638
|
-
requestAnimationFrame(look);
|
|
15639
|
-
};
|
|
15640
15606
|
const permitted = (inst) => indicatorPermitted(deps.access, inst.definition);
|
|
15641
15607
|
const offered = (inst) => indicatorOffered(deps.offered ?? null, inst.definition);
|
|
15642
15608
|
const admitted = (next) => next.flatMap((instance) => {
|
|
@@ -15649,6 +15615,7 @@ function attachIndicatorsPlane(deps) {
|
|
|
15649
15615
|
const before = instances;
|
|
15650
15616
|
deps.catalog.carry(next);
|
|
15651
15617
|
instances = [...next];
|
|
15618
|
+
for (const id of [...previews.keys()]) if (!instances.some((instance) => instance.id === id)) previews.delete(id);
|
|
15652
15619
|
renderer.prune(new Set(instances.map((instance) => instance.id)));
|
|
15653
15620
|
recompute();
|
|
15654
15621
|
const afterIds = new Set(instances.map((instance) => instance.id));
|
|
@@ -15661,7 +15628,6 @@ function attachIndicatorsPlane(deps) {
|
|
|
15661
15628
|
}
|
|
15662
15629
|
};
|
|
15663
15630
|
function recompute() {
|
|
15664
|
-
for (const id of commandedIds) if (!instances.some((inst) => inst.id === id)) commandedIds.delete(id);
|
|
15665
15631
|
lastRecompute = Date.now();
|
|
15666
15632
|
const bars = deps.bars();
|
|
15667
15633
|
const next = [];
|
|
@@ -15669,14 +15635,13 @@ function attachIndicatorsPlane(deps) {
|
|
|
15669
15635
|
const times = bars.map((b) => b.t);
|
|
15670
15636
|
const hasVolume = bars.some((b) => b.v > 0);
|
|
15671
15637
|
if (bars.length === 0 && instances.length > 0) renderer.blank();
|
|
15672
|
-
const paneOfMap = renderer.paneOf();
|
|
15673
|
-
const main = mainPane();
|
|
15674
15638
|
const formatter2 = deps.formatter();
|
|
15675
|
-
|
|
15639
|
+
const timeframe2 = deps.timeframe?.() ?? "";
|
|
15640
|
+
for (const held of instances) {
|
|
15641
|
+
const inst = previews.get(held.id) ?? held;
|
|
15676
15642
|
const def = inst.definition;
|
|
15677
15643
|
const title = indicatorTitleOf(inst, deps.i18n.t);
|
|
15678
15644
|
const placement = def.manifest.pane === "pane" ? "pane" : "overlay";
|
|
15679
|
-
const paneIdx = placement === "pane" ? paneOfMap[inst.id] : void 0;
|
|
15680
15645
|
const base = {
|
|
15681
15646
|
id: inst.id,
|
|
15682
15647
|
title: indicatorMarkOf(inst, deps.i18n.t),
|
|
@@ -15687,44 +15652,44 @@ function attachIndicatorsPlane(deps) {
|
|
|
15687
15652
|
// turns the picker off (its own library adds) would otherwise leave no way back out.
|
|
15688
15653
|
removable: true,
|
|
15689
15654
|
removeLabel: deps.i18n.t("legend.removeIndicator"),
|
|
15690
|
-
pane: placement === "pane"
|
|
15691
|
-
// What the widget was told, not what the layout momentarily looks like. A pane is born at
|
|
15692
|
-
// the floor height and rebalanced a frame or two later, so geometry cannot be trusted here;
|
|
15693
|
-
// the settle loop below corroborates it afterwards.
|
|
15694
|
-
collapsed: paneIdx !== void 0 && paneIdx !== main && commandedIds.has(inst.id)
|
|
15655
|
+
pane: placement === "pane"
|
|
15695
15656
|
};
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
renderer.remove(inst.id);
|
|
15699
|
-
next.push({ ...base, value: null, hidden: true });
|
|
15700
|
-
continue;
|
|
15701
|
-
}
|
|
15657
|
+
const hidden = allHidden || indicatorHidden(inst.overrides);
|
|
15658
|
+
const paintsNothing = hidden || !indicatorDrawsOn(inst, timeframe2);
|
|
15702
15659
|
if (bars.length === 0) {
|
|
15703
|
-
next.push({ ...base, value: null, hidden
|
|
15660
|
+
next.push({ ...base, value: null, hidden });
|
|
15704
15661
|
continue;
|
|
15705
15662
|
}
|
|
15706
15663
|
if (def.manifest.needsVolume && !hasVolume) {
|
|
15707
15664
|
const note = deps.i18n.t("host.noVolume");
|
|
15708
15665
|
renderer.render(inst.id, { placement, title, plots: [], unavailable: note });
|
|
15709
|
-
next.push({ ...base, value: null, note, hidden
|
|
15666
|
+
next.push({ ...base, value: null, note, hidden });
|
|
15710
15667
|
continue;
|
|
15711
15668
|
}
|
|
15712
15669
|
let channels;
|
|
15713
15670
|
try {
|
|
15714
15671
|
channels = def.compute(bars, { ...manifestInputDefaults(def.manifest), ...inst.inputs ?? {} });
|
|
15715
15672
|
} catch {
|
|
15716
|
-
next.push({ ...base, value: null, hidden
|
|
15673
|
+
next.push({ ...base, value: null, hidden });
|
|
15717
15674
|
continue;
|
|
15718
15675
|
}
|
|
15719
|
-
const
|
|
15720
|
-
const
|
|
15676
|
+
const overrides = paintsNothing ? paintingNothing(def.manifest, inst.overrides) : inst.overrides;
|
|
15677
|
+
const manifest2 = overriddenManifest(def.manifest, overrides);
|
|
15678
|
+
const own = applyPlotOverrides(buildManifestPlots({ manifest: manifest2, plots: channels }, times, title, inst.color ?? deps.canvas().neutral), overrides);
|
|
15721
15679
|
const scale = deps.scaleLabels?.() ?? { name: false, value: true };
|
|
15680
|
+
const { barColors, shade, ...rest } = own;
|
|
15722
15681
|
const built = {
|
|
15723
|
-
...
|
|
15682
|
+
...rest,
|
|
15683
|
+
// An instance that paints nothing recolors no bar and tints no pane either.
|
|
15684
|
+
...paintsNothing ? {} : { ...barColors ? { barColors } : {}, ...shade ? { shade } : {} },
|
|
15724
15685
|
display: { ...own.display, labelsOnPriceScale: own.display?.labelsOnPriceScale !== false && scale.value },
|
|
15725
15686
|
...scale.name ? { scaleTitle: own.title } : {}
|
|
15726
15687
|
};
|
|
15727
15688
|
renderer.render(inst.id, built);
|
|
15689
|
+
if (paintsNothing) {
|
|
15690
|
+
next.push({ ...base, value: null, hidden });
|
|
15691
|
+
continue;
|
|
15692
|
+
}
|
|
15728
15693
|
const volume2 = def.manifest.id === "volume";
|
|
15729
15694
|
const data = volume2 ? bars.map((bar) => ({ time: bar.t, value: bar.v })) : built.plots[0]?.data ?? [];
|
|
15730
15695
|
const precision = volume2 ? deps.volumePrecision?.() ?? 0 : built.precision;
|
|
@@ -15736,7 +15701,6 @@ function attachIndicatorsPlane(deps) {
|
|
|
15736
15701
|
chips = next;
|
|
15737
15702
|
readings = nextReadings;
|
|
15738
15703
|
deps.onChips();
|
|
15739
|
-
scheduleCollapsedSync(next);
|
|
15740
15704
|
}
|
|
15741
15705
|
return {
|
|
15742
15706
|
renderer,
|
|
@@ -15748,7 +15712,7 @@ function attachIndicatorsPlane(deps) {
|
|
|
15748
15712
|
add(instance) {
|
|
15749
15713
|
deps.catalog.carry([instance]);
|
|
15750
15714
|
if (!offered(instance) || !permitted(instance)) return false;
|
|
15751
|
-
const minted = withMintedColor(instance);
|
|
15715
|
+
const minted = withMintedColor(withSavedDefault(instance));
|
|
15752
15716
|
instances = [...instances.filter((i) => i.id !== minted.id), minted];
|
|
15753
15717
|
recompute();
|
|
15754
15718
|
deps.onEvent({ kind: "added", id: instance.id });
|
|
@@ -15756,6 +15720,7 @@ function attachIndicatorsPlane(deps) {
|
|
|
15756
15720
|
},
|
|
15757
15721
|
remove(id) {
|
|
15758
15722
|
if (!instances.some((i) => i.id === id)) return;
|
|
15723
|
+
previews.delete(id);
|
|
15759
15724
|
instances = instances.filter((i) => i.id !== id);
|
|
15760
15725
|
renderer.prune(new Set(instances.map((i) => i.id)));
|
|
15761
15726
|
recompute();
|
|
@@ -15766,6 +15731,11 @@ function attachIndicatorsPlane(deps) {
|
|
|
15766
15731
|
recompute();
|
|
15767
15732
|
deps.onEvent({ kind: "changed", id });
|
|
15768
15733
|
},
|
|
15734
|
+
preview(id, instance) {
|
|
15735
|
+
if (instance) previews.set(id, instance);
|
|
15736
|
+
else if (!previews.delete(id)) return;
|
|
15737
|
+
recompute();
|
|
15738
|
+
},
|
|
15769
15739
|
hidden: () => instances.filter((instance) => indicatorHidden(instance.overrides)).map((instance) => instance.id),
|
|
15770
15740
|
setHidden(ids) {
|
|
15771
15741
|
const hidden = new Set(ids);
|
|
@@ -15796,14 +15766,6 @@ function attachIndicatorsPlane(deps) {
|
|
|
15796
15766
|
return { dropped };
|
|
15797
15767
|
},
|
|
15798
15768
|
restoreHeld: (held) => replace2(held, "changed"),
|
|
15799
|
-
setPaneCollapsed(paneIndex, collapsed) {
|
|
15800
|
-
if (paneIndex < 0 || paneIndex === mainPane()) return;
|
|
15801
|
-
for (const [id, pane] of Object.entries(renderer.paneOf())) if (pane === paneIndex) {
|
|
15802
|
-
if (collapsed) commandedIds.add(id);
|
|
15803
|
-
else commandedIds.delete(id);
|
|
15804
|
-
}
|
|
15805
|
-
floorStreaks = {};
|
|
15806
|
-
},
|
|
15807
15769
|
setAllHidden(hidden) {
|
|
15808
15770
|
if (allHidden === hidden) return;
|
|
15809
15771
|
allHidden = hidden;
|
|
@@ -16824,6 +16786,15 @@ function sameJsonState(left, right) {
|
|
|
16824
16786
|
function createExtensionHost(deps, extensions = []) {
|
|
16825
16787
|
const attached = [];
|
|
16826
16788
|
let hostLive = true;
|
|
16789
|
+
let quiet = 0;
|
|
16790
|
+
const quietly = (run) => {
|
|
16791
|
+
quiet++;
|
|
16792
|
+
try {
|
|
16793
|
+
return run();
|
|
16794
|
+
} finally {
|
|
16795
|
+
quiet--;
|
|
16796
|
+
}
|
|
16797
|
+
};
|
|
16827
16798
|
const detachOne = (record3) => {
|
|
16828
16799
|
if (!record3.live) return;
|
|
16829
16800
|
record3.live = false;
|
|
@@ -17042,6 +17013,13 @@ function createExtensionHost(deps, extensions = []) {
|
|
|
17042
17013
|
} catch {
|
|
17043
17014
|
}
|
|
17044
17015
|
},
|
|
17016
|
+
stateChanged() {
|
|
17017
|
+
if (!record3.live || !hostLive || quiet > 0) return;
|
|
17018
|
+
try {
|
|
17019
|
+
deps.stateChanged?.();
|
|
17020
|
+
} catch {
|
|
17021
|
+
}
|
|
17022
|
+
},
|
|
17045
17023
|
contributeHideLayer(layer) {
|
|
17046
17024
|
const taken = !record3.live || record3.hideLayers.has(layer.id) || attached.some((a) => a.live && a.hideLayers.has(layer.id)) || layer.id === "drawings" || layer.id === "indicators" || layer.id === "all";
|
|
17047
17025
|
if (taken) return { hidden: () => false, setHidden: () => {
|
|
@@ -17065,7 +17043,7 @@ function createExtensionHost(deps, extensions = []) {
|
|
|
17065
17043
|
}
|
|
17066
17044
|
};
|
|
17067
17045
|
try {
|
|
17068
|
-
record3.handle = extension.attach(context);
|
|
17046
|
+
record3.handle = quietly(() => extension.attach(context));
|
|
17069
17047
|
} catch {
|
|
17070
17048
|
detachOne(record3);
|
|
17071
17049
|
return;
|
|
@@ -17185,7 +17163,7 @@ function createExtensionHost(deps, extensions = []) {
|
|
|
17185
17163
|
for (const record3 of liveRecords()) {
|
|
17186
17164
|
if (!record3.handle.serialize) continue;
|
|
17187
17165
|
try {
|
|
17188
|
-
const state = record3.handle.serialize();
|
|
17166
|
+
const state = quietly(() => record3.handle.serialize());
|
|
17189
17167
|
if (state !== void 0) out[record3.extension.id] = state;
|
|
17190
17168
|
} catch {
|
|
17191
17169
|
}
|
|
@@ -17195,21 +17173,23 @@ function createExtensionHost(deps, extensions = []) {
|
|
|
17195
17173
|
restore(state) {
|
|
17196
17174
|
if (!hostLive || !state || typeof state !== "object" || Array.isArray(state)) return false;
|
|
17197
17175
|
const byId2 = state;
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
const
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
if (
|
|
17176
|
+
return quietly(() => {
|
|
17177
|
+
let complete = true;
|
|
17178
|
+
for (const record3 of liveRecords()) {
|
|
17179
|
+
const supplied = Object.hasOwn(byId2, record3.extension.id);
|
|
17180
|
+
try {
|
|
17181
|
+
const expected = supplied ? JSON.stringify(byId2[record3.extension.id]) : void 0;
|
|
17182
|
+
if (record3.handle.restore && supplied) record3.handle.restore(byId2[record3.extension.id]);
|
|
17183
|
+
const actual = record3.handle.serialize ? JSON.stringify(record3.handle.serialize()) : void 0;
|
|
17184
|
+
if (actual !== void 0 || record3.handle.restore) {
|
|
17185
|
+
if (!supplied || !record3.handle.restore || expected === void 0 || actual === void 0 || !sameJsonState(JSON.parse(expected), JSON.parse(actual))) complete = false;
|
|
17186
|
+
}
|
|
17187
|
+
} catch {
|
|
17188
|
+
complete = false;
|
|
17207
17189
|
}
|
|
17208
|
-
} catch {
|
|
17209
|
-
complete = false;
|
|
17210
17190
|
}
|
|
17211
|
-
|
|
17212
|
-
|
|
17191
|
+
return complete;
|
|
17192
|
+
});
|
|
17213
17193
|
},
|
|
17214
17194
|
subscriberCount() {
|
|
17215
17195
|
let total2 = 0;
|
|
@@ -17335,7 +17315,8 @@ function attachExtensionsPlane(deps) {
|
|
|
17335
17315
|
setHide: deps.setHide,
|
|
17336
17316
|
hideLayersChanged: deps.hideLayersChanged,
|
|
17337
17317
|
...deps.legendRowsChanged ? { legendRowsChanged: deps.legendRowsChanged } : {},
|
|
17338
|
-
...deps.refreshMarks ? { refreshMarks: deps.refreshMarks } : {}
|
|
17318
|
+
...deps.refreshMarks ? { refreshMarks: deps.refreshMarks } : {},
|
|
17319
|
+
...deps.stateChanged ? { stateChanged: deps.stateChanged } : {}
|
|
17339
17320
|
},
|
|
17340
17321
|
deps.extensions
|
|
17341
17322
|
);
|
|
@@ -17573,6 +17554,7 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17573
17554
|
const groups = /* @__PURE__ */ new Map();
|
|
17574
17555
|
chipRows.dataset.legendPane = "0";
|
|
17575
17556
|
let paneTops = {};
|
|
17557
|
+
let hiddenPanes = /* @__PURE__ */ new Set();
|
|
17576
17558
|
const rows2 = /* @__PURE__ */ new Map();
|
|
17577
17559
|
const groupFor = (pane) => {
|
|
17578
17560
|
if (pane === mainPane) return chipRows;
|
|
@@ -17615,16 +17597,12 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17615
17597
|
const r = gear.getBoundingClientRect();
|
|
17616
17598
|
controls.onSettings?.(chip.id, { x: r.x, y: r.y, w: r.width, h: r.height });
|
|
17617
17599
|
});
|
|
17618
|
-
const moveUp = chipButton(controls.icons.glyph(ICONS.paneUp, { size: 18 }), "", () => controls.onPaneMove?.(chip.id, "up"));
|
|
17619
|
-
const moveDown = chipButton(controls.icons.glyph(ICONS.paneDown, { size: 18 }), "", () => controls.onPaneMove?.(chip.id, "down"));
|
|
17620
|
-
const collapse = chipButton("", "", () => controls.onPaneOp?.(chip.id, chip.collapsed ? "restore" : "collapse"));
|
|
17621
|
-
const maximize = chipButton(controls.icons.glyph(ICONS.paneMaximize, { size: 18 }), "", () => controls.onPaneOp?.(chip.id, chip.maximized ? "restore" : "maximize"));
|
|
17622
17600
|
const eye2 = chipButton("", "", () => controls.onToggleEye(chip.id));
|
|
17623
17601
|
eye2.classList.add("qc-legend-eye");
|
|
17624
17602
|
const remove = chipButton(controls.icons.glyph(ICONS.trash, { size: 18 }), "", () => controls.onRemove?.(chip.id));
|
|
17625
17603
|
const actions2 = document.createElement("span");
|
|
17626
17604
|
actions2.className = "qc-legend-actions";
|
|
17627
|
-
actions2.append(eye2, gear,
|
|
17605
|
+
actions2.append(eye2, gear, remove);
|
|
17628
17606
|
const nameButton = (button3, text2) => {
|
|
17629
17607
|
button3.title = text2;
|
|
17630
17608
|
button3.setAttribute("aria-label", text2);
|
|
@@ -17674,16 +17652,6 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17674
17652
|
else delete value.dataset.qcTone;
|
|
17675
17653
|
gear.hidden = !chip.hasInputs || !controls.onSettings;
|
|
17676
17654
|
nameButton(gear, chip.settingsLabel ?? strings.t("legend.indicatorSettings"));
|
|
17677
|
-
moveUp.hidden = !chip.pane || !controls.onPaneMove || chip.hidden || !chip.canMoveUp;
|
|
17678
|
-
moveDown.hidden = !chip.pane || !controls.onPaneMove || chip.hidden || !chip.canMoveDown;
|
|
17679
|
-
nameButton(moveUp, strings.t("legend.movePaneUp"));
|
|
17680
|
-
nameButton(moveDown, strings.t("legend.movePaneDown"));
|
|
17681
|
-
collapse.hidden = !chip.pane || !controls.onPaneOp || chip.hidden;
|
|
17682
|
-
collapse.replaceChildren(controls.icons.glyph(chip.collapsed ? ICONS.paneRestore : ICONS.paneCollapse, { size: 18 }));
|
|
17683
|
-
nameButton(collapse, strings.t(chip.collapsed ? "legend.restorePane" : "legend.collapsePane"));
|
|
17684
|
-
maximize.hidden = collapse.hidden || !!chip.collapsed;
|
|
17685
|
-
nameButton(maximize, strings.t(chip.maximized ? "legend.restorePane" : "legend.maximizePane"));
|
|
17686
|
-
maximize.setAttribute("aria-pressed", String(chip.maximized === true));
|
|
17687
17655
|
const eyeState = String(chip.hidden);
|
|
17688
17656
|
if (eye2.dataset.hidden !== eyeState) {
|
|
17689
17657
|
eye2.replaceChildren(controls.icons.glyph(chip.hidden ? ICONS.legendEyeOff : ICONS.legendEye, { size: 18 }));
|
|
@@ -17739,7 +17707,11 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17739
17707
|
const origin = paneTops[mainPane] ?? 0;
|
|
17740
17708
|
if (origin > 0) root.style.setProperty("--qcd-legend-top", `${origin}px`);
|
|
17741
17709
|
else root.style.removeProperty("--qcd-legend-top");
|
|
17742
|
-
for (const [pane, group] of groups)
|
|
17710
|
+
for (const [pane, group] of groups) {
|
|
17711
|
+
group.style.top = `${(paneTops[pane] ?? 0) - origin}px`;
|
|
17712
|
+
group.hidden = hiddenPanes.has(pane);
|
|
17713
|
+
}
|
|
17714
|
+
root.dataset.qcMainHidden = String(hiddenPanes.has(mainPane));
|
|
17743
17715
|
};
|
|
17744
17716
|
let fit = INITIAL_LEGEND_FIT;
|
|
17745
17717
|
let valueShaped2 = false;
|
|
@@ -17926,6 +17898,10 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17926
17898
|
paneTops = tops;
|
|
17927
17899
|
placeGroups();
|
|
17928
17900
|
},
|
|
17901
|
+
setHiddenPanes(panes) {
|
|
17902
|
+
hiddenPanes = panes;
|
|
17903
|
+
placeGroups();
|
|
17904
|
+
},
|
|
17929
17905
|
setSlotRows(elements) {
|
|
17930
17906
|
const keep = new Set(elements);
|
|
17931
17907
|
for (const [element, slot] of slotOf) {
|
|
@@ -18238,11 +18214,11 @@ var CONTROL_ICONS = byMeaning({
|
|
|
18238
18214
|
visible: [ICONS.legendEye],
|
|
18239
18215
|
hidden: [ICONS.legendEyeOff],
|
|
18240
18216
|
collapse: [ICONS.legendChevron],
|
|
18241
|
-
paneCollapse: [ICONS.
|
|
18242
|
-
paneRestore: [ICONS.
|
|
18243
|
-
paneMaximize: [ICONS.
|
|
18244
|
-
paneMoveUp: [ICONS.
|
|
18245
|
-
paneMoveDown: [ICONS.
|
|
18217
|
+
paneCollapse: [ICONS.paneCollapse15],
|
|
18218
|
+
paneRestore: [ICONS.paneExpand15],
|
|
18219
|
+
paneMaximize: [ICONS.paneMaximize15],
|
|
18220
|
+
paneMoveUp: [ICONS.paneUp15],
|
|
18221
|
+
paneMoveDown: [ICONS.paneDown15],
|
|
18246
18222
|
marketStatus: [ICONS.marketStatus],
|
|
18247
18223
|
replayStatus: [ICONS.replayStatus],
|
|
18248
18224
|
replayMark: [ICONS.replayMark],
|
|
@@ -18258,7 +18234,7 @@ var CONTROL_ICONS = byMeaning({
|
|
|
18258
18234
|
check: [ICONS.check],
|
|
18259
18235
|
close: [ICONS.close, ICONS.closeThin, ICONS.dialogClose],
|
|
18260
18236
|
remove: [ICONS.close18, ICONS.removeRow],
|
|
18261
|
-
delete: [ICONS.trash, ICONS.trash28],
|
|
18237
|
+
delete: [ICONS.trash, ICONS.trash28, ICONS.trash15],
|
|
18262
18238
|
add: [ICONS.plus, ICONS.plusThin],
|
|
18263
18239
|
bold: [ICONS.textBold],
|
|
18264
18240
|
italic: [ICONS.textItalic],
|
|
@@ -18484,60 +18460,126 @@ function createIconResolver(deps) {
|
|
|
18484
18460
|
};
|
|
18485
18461
|
}
|
|
18486
18462
|
|
|
18487
|
-
// src/
|
|
18488
|
-
var
|
|
18489
|
-
function
|
|
18490
|
-
const
|
|
18491
|
-
|
|
18492
|
-
|
|
18493
|
-
|
|
18494
|
-
|
|
18495
|
-
|
|
18496
|
-
|
|
18497
|
-
|
|
18498
|
-
|
|
18499
|
-
|
|
18500
|
-
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
|
|
18509
|
-
|
|
18463
|
+
// src/ui/indicators/rows.ts
|
|
18464
|
+
var PRECISIONS2 = ["0", "1", "2", "3", "4", "5", "6", "7", "8"];
|
|
18465
|
+
function disable(node) {
|
|
18466
|
+
for (const control of node.querySelectorAll("button, input")) control.disabled = true;
|
|
18467
|
+
if (node instanceof HTMLButtonElement || node instanceof HTMLInputElement) node.disabled = true;
|
|
18468
|
+
}
|
|
18469
|
+
function inputRows(ctx) {
|
|
18470
|
+
const out = [];
|
|
18471
|
+
let group;
|
|
18472
|
+
for (const [key, spec] of Object.entries(ctx.manifest.inputs ?? {})) {
|
|
18473
|
+
if (spec.group !== group || out.length === 0) {
|
|
18474
|
+
if (out.length > 0) out.push(groupGap());
|
|
18475
|
+
if (spec.group) out.push(sectionTitle(spec.group));
|
|
18476
|
+
group = spec.group;
|
|
18477
|
+
}
|
|
18478
|
+
const title = manifestTitle(key, spec);
|
|
18479
|
+
const value = ctx.values[key] ?? spec.default;
|
|
18480
|
+
const applies = inputApplies(ctx.manifest, key, ctx.values);
|
|
18481
|
+
const take = (next) => ctx.onInput(key, declaredInputValue(spec, next));
|
|
18482
|
+
let line3;
|
|
18483
|
+
if (spec.kind === "bool") {
|
|
18484
|
+
line3 = toggleRow(title, value === 1, (on) => take(on ? 1 : 0), !applies);
|
|
18485
|
+
} else if (spec.kind === "enum") {
|
|
18486
|
+
const options2 = (spec.options ?? []).map((_, index) => String(index));
|
|
18487
|
+
const list = dropdown(ctx.icons, ctx.box, title, options2, String(value), (index) => spec.options?.[Number(index)] ?? index, (index) => take(Number(index)), "short");
|
|
18488
|
+
if (!applies) disable(list);
|
|
18489
|
+
line3 = row(title, list);
|
|
18510
18490
|
} else {
|
|
18511
|
-
const
|
|
18512
|
-
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18491
|
+
const field = numberInput(ctx.t, ctx.icons, {
|
|
18492
|
+
label: title,
|
|
18493
|
+
value,
|
|
18494
|
+
onChange: take,
|
|
18495
|
+
...spec.step !== void 0 ? { step: spec.step } : spec.kind === "int" ? { step: 1 } : {},
|
|
18496
|
+
...spec.min !== void 0 ? { min: spec.min } : {},
|
|
18497
|
+
...spec.max !== void 0 ? { max: spec.max } : {},
|
|
18498
|
+
width: "field"
|
|
18499
|
+
});
|
|
18500
|
+
if (!applies) disable(field);
|
|
18501
|
+
line3 = row(title, field);
|
|
18502
|
+
}
|
|
18503
|
+
line3.dataset.input = key;
|
|
18504
|
+
out.push(line3);
|
|
18522
18505
|
}
|
|
18523
|
-
return
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
};
|
|
18506
|
+
return out;
|
|
18507
|
+
}
|
|
18508
|
+
function styleRows2(ctx) {
|
|
18509
|
+
const { t, manifest: manifest2, overrides } = ctx;
|
|
18510
|
+
const out = [];
|
|
18511
|
+
const swatch = (label3, value, onPick, stroke2) => swatchButton(t, ctx.box, {
|
|
18512
|
+
label: label3,
|
|
18513
|
+
value,
|
|
18514
|
+
onPick,
|
|
18515
|
+
...stroke2?.thickness !== void 0 && stroke2.onThickness ? { thickness: stroke2.thickness, onThickness: stroke2.onThickness } : {},
|
|
18516
|
+
...stroke2?.lineStyle !== void 0 && stroke2.onLineStyle ? { lineStyle: stroke2.lineStyle, onLineStyle: stroke2.onLineStyle } : {},
|
|
18517
|
+
...stroke2?.lineStyle !== void 0 && !stroke2.onThickness ? { strokeFace: true } : {}
|
|
18518
|
+
});
|
|
18519
|
+
const plot = (key, patch) => ctx.onOverrides({ ...overrides, plots: { ...overrides.plots, [key]: { ...overrides.plots?.[key], ...patch } } });
|
|
18520
|
+
const level = (key, patch) => ctx.onOverrides({ ...overrides, levels: { ...overrides.levels, [key]: { ...overrides.levels?.[key], ...patch } } });
|
|
18521
|
+
const fill = (key, patch) => ctx.onOverrides({ ...overrides, fills: { ...overrides.fills, [key]: { ...overrides.fills?.[key], ...patch } } });
|
|
18522
|
+
const display = (patch) => ctx.onOverrides({ ...overrides, display: { ...overrides.display, ...patch } });
|
|
18523
|
+
for (const [key, spec] of Object.entries(manifest2.plots)) {
|
|
18524
|
+
const title = manifestTitle(key, spec);
|
|
18525
|
+
const own = overrides.plots?.[key];
|
|
18526
|
+
const visible = own?.visible !== false;
|
|
18527
|
+
const show = (on) => plot(key, { visible: on });
|
|
18528
|
+
if (spec.kind === "histogram" && (spec.up !== void 0 || spec.down !== void 0)) {
|
|
18529
|
+
out.push(toggleRow(title, visible, show));
|
|
18530
|
+
out.push(colorRow(t("settings.growing"), swatch(t("settings.upColorOf", { name: title }), own?.up ?? spec.up ?? ctx.instanceColor, (color3) => plot(key, { up: color3 }))));
|
|
18531
|
+
out.push(colorRow(t("settings.falling"), swatch(t("settings.downColorOf", { name: title }), own?.down ?? spec.down ?? ctx.instanceColor, (color3) => plot(key, { down: color3 }))));
|
|
18532
|
+
out.push(el("div", { class: "qc-indicator-color-gap", "aria-hidden": "true" }));
|
|
18533
|
+
continue;
|
|
18534
|
+
}
|
|
18535
|
+
const color2 = own?.color ?? spec.color ?? ctx.instanceColor;
|
|
18536
|
+
const pick = (next) => plot(key, { color: next });
|
|
18537
|
+
out.push(checkRow(title, visible, show, [swatch(t("settings.colorOf", { name: title }), color2, pick, strokeOf(spec, own, (patch) => plot(key, patch)))]));
|
|
18538
|
+
}
|
|
18539
|
+
for (const [key, spec] of Object.entries(manifest2.levels ?? {})) {
|
|
18540
|
+
const title = manifestTitle(key, spec);
|
|
18541
|
+
const own = overrides.levels?.[key];
|
|
18542
|
+
const price = numberInput(t, ctx.icons, { label: title, value: own?.price ?? spec.price, onChange: (value) => level(key, { price: value }), width: "field" });
|
|
18543
|
+
const stroke2 = { lineStyle: own?.lineStyle ?? spec.lineStyle ?? "solid", onLineStyle: (value) => level(key, { lineStyle: value }) };
|
|
18544
|
+
out.push(checkRow(title, own?.visible !== false, (on) => level(key, { visible: on }), [swatch(t("settings.colorOf", { name: title }), own?.color ?? spec.color ?? ctx.neutral, (color2) => level(key, { color: color2 }), stroke2), price]));
|
|
18545
|
+
}
|
|
18546
|
+
for (const [key, spec] of Object.entries(manifest2.fills ?? {})) {
|
|
18547
|
+
const title = manifestTitle(key, spec);
|
|
18548
|
+
const own = overrides.fills?.[key];
|
|
18549
|
+
out.push(checkRow(title, own?.visible !== false, (on) => fill(key, { visible: on }), [swatch(t("settings.colorOf", { name: title }), own?.color ?? spec.color ?? ctx.neutral, (color2) => fill(key, { color: color2 }))]));
|
|
18550
|
+
}
|
|
18551
|
+
out.push(groupGap(), sectionTitle(t("settings.outputValues")));
|
|
18552
|
+
const precision = overrides.precision === void 0 ? "default" : String(overrides.precision);
|
|
18553
|
+
out.push(
|
|
18554
|
+
row(
|
|
18555
|
+
t("settings.precision"),
|
|
18556
|
+
dropdown(ctx.icons, ctx.box, t("settings.precision"), ["default", ...PRECISIONS2], precision, (value) => value === "default" ? t("settings.precisionDefault") : value, (value) => {
|
|
18557
|
+
const { precision: _precision, ...rest } = overrides;
|
|
18558
|
+
ctx.onOverrides(value === "default" ? rest : { ...rest, precision: Number(value) });
|
|
18559
|
+
})
|
|
18560
|
+
)
|
|
18561
|
+
);
|
|
18562
|
+
out.push(toggleRow(t("settings.labelsOnPriceScale"), overrides.display?.labelsOnPriceScale !== false, (on) => display({ labelsOnPriceScale: on })));
|
|
18563
|
+
out.push(toggleRow(t("settings.valuesInStatusLine"), overrides.display?.valuesInStatusLine !== false, (on) => display({ valuesInStatusLine: on })));
|
|
18564
|
+
if (ctx.hasInputs) {
|
|
18565
|
+
out.push(sectionTitle(t("settings.inputValues")));
|
|
18566
|
+
out.push(toggleRow(t("settings.inputsInStatusLine"), overrides.display?.inputsInStatusLine !== false, (on) => display({ inputsInStatusLine: on })));
|
|
18567
|
+
}
|
|
18568
|
+
return out;
|
|
18569
|
+
}
|
|
18570
|
+
function colorRow(label3, control) {
|
|
18571
|
+
const line3 = row(label3, control);
|
|
18572
|
+
line3.classList.add("qc-indicator-color-row");
|
|
18573
|
+
return line3;
|
|
18574
|
+
}
|
|
18575
|
+
function strokeOf(spec, own, patch) {
|
|
18576
|
+
if (spec.kind !== "line" && spec.kind !== "area") return void 0;
|
|
18577
|
+
const thickness = { thickness: own?.lineWidth ?? spec.lineWidth ?? 1, onThickness: (value) => patch({ lineWidth: value }) };
|
|
18578
|
+
if (spec.dots) return thickness;
|
|
18579
|
+
return { ...thickness, lineStyle: own?.lineStyle ?? spec.lineStyle ?? "solid", onLineStyle: (value) => patch({ lineStyle: value }) };
|
|
18540
18580
|
}
|
|
18581
|
+
|
|
18582
|
+
// src/inputsEditor.ts
|
|
18541
18583
|
function openInputsEditor(container, rect, inputs2, current, onApply, strings = createChartI18n()) {
|
|
18542
18584
|
const icons = createIconResolver({ document: container.ownerDocument, direction: () => readingDirection(strings), diagnostics: createIconDiagnostics() });
|
|
18543
18585
|
mountInputsEditor(container, rect, inputs2, current, onApply, strings, icons);
|
|
@@ -18551,14 +18593,34 @@ function mountInputsEditor(container, rect, inputs2, current, onApply, strings,
|
|
|
18551
18593
|
el2.style.left = `${Math.max(4, rect.x - host2.left)}px`;
|
|
18552
18594
|
el2.style.top = `${Math.max(4, rect.y - host2.top + rect.h + 4)}px`;
|
|
18553
18595
|
for (const type of ["pointerdown", "pointerup", "pointermove"]) el2.addEventListener(type, (e) => e.stopPropagation());
|
|
18596
|
+
const manifest2 = { pane: "overlay", plots: {}, inputs: inputs2 };
|
|
18597
|
+
let values = { ...manifestInputDefaults(manifest2), ...current };
|
|
18598
|
+
const page = document.createElement("div");
|
|
18599
|
+
page.className = "qc-drawing-page qc-inputs-page";
|
|
18600
|
+
page.dataset.tab = "inputs";
|
|
18601
|
+
const render = () => {
|
|
18602
|
+
page.replaceChildren(
|
|
18603
|
+
...inputRows({
|
|
18604
|
+
t: strings.t,
|
|
18605
|
+
icons,
|
|
18606
|
+
box: container,
|
|
18607
|
+
manifest: manifest2,
|
|
18608
|
+
values,
|
|
18609
|
+
onInput: (key, value) => {
|
|
18610
|
+
values = { ...values, [key]: value };
|
|
18611
|
+
render();
|
|
18612
|
+
}
|
|
18613
|
+
})
|
|
18614
|
+
);
|
|
18615
|
+
};
|
|
18616
|
+
render();
|
|
18617
|
+
el2.appendChild(page);
|
|
18554
18618
|
const dismiss = () => {
|
|
18555
18619
|
unsubscribe();
|
|
18556
18620
|
el2.remove();
|
|
18557
18621
|
};
|
|
18558
|
-
const fields = buildInputFields(icons, inputs2, current);
|
|
18559
|
-
for (const row2 of fields.rows) el2.appendChild(row2);
|
|
18560
18622
|
const apply = () => {
|
|
18561
|
-
onApply(
|
|
18623
|
+
onApply(Object.fromEntries(Object.keys(inputs2).map((key) => [key, values[key]])));
|
|
18562
18624
|
dismiss();
|
|
18563
18625
|
};
|
|
18564
18626
|
const buttons = document.createElement("div");
|
|
@@ -18582,11 +18644,13 @@ function mountInputsEditor(container, rect, inputs2, current, onApply, strings,
|
|
|
18582
18644
|
});
|
|
18583
18645
|
el2.addEventListener("keydown", (e) => {
|
|
18584
18646
|
e.stopPropagation();
|
|
18585
|
-
if (e.key === "Enter")
|
|
18586
|
-
|
|
18647
|
+
if (e.key === "Enter") {
|
|
18648
|
+
if (e.target instanceof HTMLInputElement && e.target.type !== "checkbox") e.target.dispatchEvent(new Event("change"));
|
|
18649
|
+
apply();
|
|
18650
|
+
} else if (e.key === "Escape") dismiss();
|
|
18587
18651
|
});
|
|
18588
18652
|
container.appendChild(el2);
|
|
18589
|
-
|
|
18653
|
+
page.querySelector("input.qc-field:not(:disabled), button:not(:disabled)")?.focus?.();
|
|
18590
18654
|
}
|
|
18591
18655
|
|
|
18592
18656
|
// src/ui/chrome/menu.ts
|
|
@@ -18907,13 +18971,13 @@ function attachLegendPlane(deps) {
|
|
|
18907
18971
|
let hovered = null;
|
|
18908
18972
|
let named2 = null;
|
|
18909
18973
|
let namedTimeframe = null;
|
|
18910
|
-
let
|
|
18974
|
+
let written3 = "";
|
|
18911
18975
|
const writeIdentity = () => {
|
|
18912
18976
|
if (named2 === null || namedTimeframe === null) return;
|
|
18913
18977
|
const identity = legendIdentity(named2, deps.symbolInfo(), namedTimeframe, deps.settings().statusLine.titleSource);
|
|
18914
18978
|
const key = JSON.stringify(identity);
|
|
18915
|
-
if (key ===
|
|
18916
|
-
|
|
18979
|
+
if (key === written3) return;
|
|
18980
|
+
written3 = key;
|
|
18917
18981
|
legend2?.setIdentity(identity);
|
|
18918
18982
|
};
|
|
18919
18983
|
legend2 = mountChartLegend(deps.chrome, deps.i18n, {
|
|
@@ -18973,18 +19037,6 @@ function attachLegendPlane(deps) {
|
|
|
18973
19037
|
deps.i18n,
|
|
18974
19038
|
deps.icons
|
|
18975
19039
|
);
|
|
18976
|
-
},
|
|
18977
|
-
onPaneOp: (id, op) => {
|
|
18978
|
-
const paneIdx = deps.indicators.renderer.paneOf()[id];
|
|
18979
|
-
if (paneIdx === void 0 || paneIdx === deps.paneOps.main()) return;
|
|
18980
|
-
deps.paneOps.run(paneIdx, op);
|
|
18981
|
-
},
|
|
18982
|
-
// A move is a command, as the pane's own buttons run it, so the policy that refuses it refuses
|
|
18983
|
-
// it here too.
|
|
18984
|
-
onPaneMove: (id, direction) => {
|
|
18985
|
-
const paneIdx = deps.indicators.renderer.paneOf()[id];
|
|
18986
|
-
if (paneIdx === void 0 || paneIdx === deps.paneOps.main()) return;
|
|
18987
|
-
deps.commands.execute(PANE_MOVE_COMMAND[direction], paneIdx);
|
|
18988
19040
|
}
|
|
18989
19041
|
});
|
|
18990
19042
|
function reading() {
|
|
@@ -19030,20 +19082,15 @@ function attachLegendPlane(deps) {
|
|
|
19030
19082
|
const paneOf = deps.indicators.renderer.paneOf();
|
|
19031
19083
|
const main = deps.paneOps.main();
|
|
19032
19084
|
legend2?.setMainPane(main);
|
|
19085
|
+
legend2?.setHiddenPanes(new Set(deps.chart.panes().flatMap((_, index) => deps.paneOps.hidden(index) ? [index] : [])));
|
|
19033
19086
|
const shown2 = (command2) => deps.shown?.(command2) ?? true;
|
|
19034
|
-
const moves = { up: shown2(PANE_MOVE_COMMAND.up), down: shown2(PANE_MOVE_COMMAND.down) };
|
|
19035
19087
|
legend2?.setChips([
|
|
19036
19088
|
...deps.indicators.chipsAt(hovered).map((row2) => {
|
|
19037
19089
|
const paneIndex = paneOf[row2.id] ?? main;
|
|
19038
|
-
const remembered = deps.paneOps.remembered(indicatorPaneKey(row2.id));
|
|
19039
|
-
const own = row2.pane === true && paneIndex !== main;
|
|
19040
19090
|
return {
|
|
19041
19091
|
...row2,
|
|
19042
19092
|
indicator: true,
|
|
19043
19093
|
paneIndex,
|
|
19044
|
-
maximized: remembered !== void 0 && !row2.collapsed && (deps.chart.panes()[paneIndex]?.getHeight() ?? 0) > remembered,
|
|
19045
|
-
canMoveUp: own && moves.up && deps.paneOps.canMove(paneIndex, "up"),
|
|
19046
|
-
canMoveDown: own && moves.down && deps.paneOps.canMove(paneIndex, "down"),
|
|
19047
19094
|
...shown2(row2.hidden ? "chart.indicators.show" : "chart.indicators.hide") ? {} : { hideable: false },
|
|
19048
19095
|
...shown2("chart.indicators.remove") ? {} : { removable: false }
|
|
19049
19096
|
};
|
|
@@ -20982,7 +21029,7 @@ var INSET = 4;
|
|
|
20982
21029
|
var BUTTONS = [
|
|
20983
21030
|
{ action: "moveUp", icon: ICONS.paneUp15, label: "legend.movePaneUp" },
|
|
20984
21031
|
{ action: "moveDown", icon: ICONS.paneDown15, label: "legend.movePaneDown" },
|
|
20985
|
-
{ action: "delete", icon: ICONS.
|
|
21032
|
+
{ action: "delete", icon: ICONS.trash15, label: "chrome.deletePane" },
|
|
20986
21033
|
{ action: "collapse", icon: ICONS.paneCollapse15, label: "legend.collapsePane" },
|
|
20987
21034
|
{ action: "expand", icon: ICONS.paneExpand15, label: "legend.restorePane" },
|
|
20988
21035
|
{ action: "maximize", icon: ICONS.paneMaximize15, label: "legend.maximizePane" },
|
|
@@ -20990,17 +21037,44 @@ var BUTTONS = [
|
|
|
20990
21037
|
];
|
|
20991
21038
|
function paneActions(pane, count2, permits) {
|
|
20992
21039
|
const out = [];
|
|
21040
|
+
if (pane.hidden) return out;
|
|
20993
21041
|
if (permits.up && pane.index > 0) out.push("moveUp");
|
|
20994
21042
|
if (permits.down && pane.index < count2 - 1) out.push("moveDown");
|
|
20995
21043
|
if (pane.main) {
|
|
20996
21044
|
if (count2 > 1) out.push(pane.maximized ? "restore" : "maximize");
|
|
20997
21045
|
return out;
|
|
20998
21046
|
}
|
|
21047
|
+
if (pane.maximized) {
|
|
21048
|
+
out.push("restore");
|
|
21049
|
+
return out;
|
|
21050
|
+
}
|
|
20999
21051
|
if (permits.remove) out.push("delete");
|
|
21000
21052
|
out.push(pane.collapsed ? "expand" : "collapse");
|
|
21001
|
-
|
|
21053
|
+
out.push("maximize");
|
|
21002
21054
|
return out;
|
|
21003
21055
|
}
|
|
21056
|
+
var PRESSED = { collapse: false, expand: true, maximize: false, restore: true };
|
|
21057
|
+
var STIR = { moveUp: [-2], moveDown: [2], collapse: [1, -1], restore: [1, -1], expand: [-1, 1], maximize: [-1, 1], delete: [] };
|
|
21058
|
+
function durationOf(element, role) {
|
|
21059
|
+
const value = getComputedStyle(element).getPropertyValue(role).trim();
|
|
21060
|
+
const n = Number.parseFloat(value);
|
|
21061
|
+
if (!Number.isFinite(n)) return 0;
|
|
21062
|
+
return value.endsWith("ms") ? n : value.endsWith("s") ? n * 1e3 : n;
|
|
21063
|
+
}
|
|
21064
|
+
function stir(button3, action) {
|
|
21065
|
+
const offsets = STIR[action];
|
|
21066
|
+
const svg = button3.querySelector("svg");
|
|
21067
|
+
if (!svg || offsets.length === 0) return;
|
|
21068
|
+
const parts = offsets.length === 1 ? [svg] : [...svg.querySelectorAll("path")];
|
|
21069
|
+
if (parts.length !== offsets.length) return;
|
|
21070
|
+
const duration = durationOf(button3, "--qc-motion-durationSlower");
|
|
21071
|
+
if (!(duration > 0)) return;
|
|
21072
|
+
const easing = getComputedStyle(button3).getPropertyValue("--qc-motion-easingStandard").trim() || "ease";
|
|
21073
|
+
parts.forEach((part, index) => {
|
|
21074
|
+
if (typeof part.animate !== "function") return;
|
|
21075
|
+
part.animate([{ transform: "translateY(0)" }, { transform: `translateY(${offsets[index]}px)` }, { transform: "translateY(0)" }], { duration, easing });
|
|
21076
|
+
});
|
|
21077
|
+
}
|
|
21004
21078
|
function mountPaneButtons(deps) {
|
|
21005
21079
|
const t = deps.i18n.t;
|
|
21006
21080
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -21035,23 +21109,30 @@ function mountPaneButtons(deps) {
|
|
|
21035
21109
|
const group = groupFor(pane.index);
|
|
21036
21110
|
group.setAttribute("aria-label", t("chrome.paneButtons"));
|
|
21037
21111
|
group.dataset.qcVisibility = visibility;
|
|
21038
|
-
group.hidden = visibility === "never"
|
|
21112
|
+
group.hidden = visibility === "never";
|
|
21113
|
+
const shown2 = visibility === "always" || visibility === "hover" && (hovered === pane.index || onGroup === pane.index);
|
|
21114
|
+
group.dataset.qcShown = String(shown2);
|
|
21115
|
+
group.toggleAttribute("inert", !shown2);
|
|
21039
21116
|
group.style.top = `${Math.round(pane.top + INSET)}px`;
|
|
21040
21117
|
group.style.right = `${Math.round(deps.insetEnd() + INSET)}px`;
|
|
21041
|
-
const
|
|
21042
|
-
if (group.dataset.actions !==
|
|
21043
|
-
group.dataset.actions =
|
|
21118
|
+
const written3 = actions2.join(" ");
|
|
21119
|
+
if (group.dataset.actions !== written3) {
|
|
21120
|
+
group.dataset.actions = written3;
|
|
21044
21121
|
group.replaceChildren(
|
|
21045
21122
|
...actions2.map((action) => {
|
|
21046
21123
|
const spec = BUTTONS.find((entry) => entry.action === action);
|
|
21047
21124
|
const button3 = h("button", { type: "button", class: "qc-pane-button", "data-action": action });
|
|
21048
21125
|
button3.appendChild(deps.icons.glyph(spec.icon, { size: 15 }));
|
|
21049
21126
|
name(button3, t(spec.label));
|
|
21050
|
-
|
|
21127
|
+
const pressed = PRESSED[action];
|
|
21128
|
+
if (pressed !== void 0) button3.setAttribute("aria-pressed", String(pressed));
|
|
21051
21129
|
button3.addEventListener("click", () => {
|
|
21052
21130
|
deps.run(pane.index, action);
|
|
21053
21131
|
sync();
|
|
21054
21132
|
});
|
|
21133
|
+
button3.addEventListener("pointerenter", (event) => {
|
|
21134
|
+
if (event.pointerType !== "touch") stir(button3, action);
|
|
21135
|
+
});
|
|
21055
21136
|
return button3;
|
|
21056
21137
|
})
|
|
21057
21138
|
);
|
|
@@ -21082,8 +21163,8 @@ function mountPaneButtons(deps) {
|
|
|
21082
21163
|
hovered = null;
|
|
21083
21164
|
sync();
|
|
21084
21165
|
};
|
|
21085
|
-
deps.
|
|
21086
|
-
deps.
|
|
21166
|
+
deps.hoverRoot.addEventListener("pointermove", onMove);
|
|
21167
|
+
deps.hoverRoot.addEventListener("pointerleave", onLeave);
|
|
21087
21168
|
const offStrings = deps.i18n.onChange(() => {
|
|
21088
21169
|
for (const group of groups.values()) delete group.dataset.actions;
|
|
21089
21170
|
sync();
|
|
@@ -21093,8 +21174,8 @@ function mountPaneButtons(deps) {
|
|
|
21093
21174
|
sync,
|
|
21094
21175
|
destroy() {
|
|
21095
21176
|
offStrings();
|
|
21096
|
-
deps.
|
|
21097
|
-
deps.
|
|
21177
|
+
deps.hoverRoot.removeEventListener("pointermove", onMove);
|
|
21178
|
+
deps.hoverRoot.removeEventListener("pointerleave", onLeave);
|
|
21098
21179
|
for (const group of groups.values()) group.remove();
|
|
21099
21180
|
groups.clear();
|
|
21100
21181
|
}
|
|
@@ -22245,16 +22326,16 @@ function attachPriceLevels(deps) {
|
|
|
22245
22326
|
}
|
|
22246
22327
|
for (const level of levels) {
|
|
22247
22328
|
const options2 = priceLineOptions(level);
|
|
22248
|
-
const
|
|
22329
|
+
const written3 = JSON.stringify(options2);
|
|
22249
22330
|
const held = drawn2.get(level.key);
|
|
22250
22331
|
if (held) {
|
|
22251
|
-
if (held.options !==
|
|
22332
|
+
if (held.options !== written3) {
|
|
22252
22333
|
held.line.applyOptions(options2);
|
|
22253
|
-
held.options =
|
|
22334
|
+
held.options = written3;
|
|
22254
22335
|
}
|
|
22255
22336
|
continue;
|
|
22256
22337
|
}
|
|
22257
|
-
drawn2.set(level.key, { line: series2.createPriceLine(options2), options:
|
|
22338
|
+
drawn2.set(level.key, { line: series2.createPriceLine(options2), options: written3 });
|
|
22258
22339
|
}
|
|
22259
22340
|
};
|
|
22260
22341
|
return {
|
|
@@ -22281,6 +22362,7 @@ var PAGE_RUNWAY = 4;
|
|
|
22281
22362
|
var REPLAY_DEPTH = 2e4;
|
|
22282
22363
|
var REPLAY_PAGE_BARS = 2e3;
|
|
22283
22364
|
var SPAN_PAGE_MAX_BARS = 4e3;
|
|
22365
|
+
var RANGE_DEPTH = 2e4;
|
|
22284
22366
|
function barsForSpan(span, tf) {
|
|
22285
22367
|
const secs = rangeSpanSeconds(span, Math.floor(Date.now() / 1e3));
|
|
22286
22368
|
const parsed = parseTimeframe(tf);
|
|
@@ -22303,6 +22385,7 @@ var STYLE_KEY = "quickcharts.style.v1";
|
|
|
22303
22385
|
var SCALE_KEY = "quickcharts.scale.v1";
|
|
22304
22386
|
var PRICE_AXIS_KEY = "quickcharts.priceAxis.v1";
|
|
22305
22387
|
var HIDDEN_KEY = "quickcharts.indHidden.v1";
|
|
22388
|
+
var INDICATOR_DEFAULTS_KEY = "quickcharts.indicatorDefaults.v1";
|
|
22306
22389
|
var REPLAY_SPEED_KEY = "quickcharts.replaySpeed.v1";
|
|
22307
22390
|
var REPLAY_TIMEFRAME_KEY = "quickcharts.replayTf.v1";
|
|
22308
22391
|
var TIMEZONE_KEY = "quickcharts.timezone.v1";
|
|
@@ -22383,10 +22466,12 @@ function createChartInstance(deps) {
|
|
|
22383
22466
|
else chrome2.removeAttribute(CANVAS_INK_ATTRIBUTE);
|
|
22384
22467
|
};
|
|
22385
22468
|
paintChromeCanvas();
|
|
22469
|
+
let paneMaximized = false;
|
|
22386
22470
|
const lookOptions = () => chartLookOptions(eff, canvas(), {
|
|
22387
22471
|
crosshairLabels: deps.ui.crosshairLabels,
|
|
22388
22472
|
crosshairHorizontal: deps.ui.crosshairHorizontal,
|
|
22389
|
-
crosshairSolid: deps.ui.crosshairSolid
|
|
22473
|
+
crosshairSolid: deps.ui.crosshairSolid,
|
|
22474
|
+
dividers: !paneMaximized
|
|
22390
22475
|
});
|
|
22391
22476
|
const look = lookOptions();
|
|
22392
22477
|
let appliedRightOffset = eff.canvas.marginRight;
|
|
@@ -22634,6 +22719,18 @@ function createChartInstance(deps) {
|
|
|
22634
22719
|
scaleControls?.sync();
|
|
22635
22720
|
events.emit("scaleMode", next);
|
|
22636
22721
|
}
|
|
22722
|
+
const storedDefaults = () => {
|
|
22723
|
+
try {
|
|
22724
|
+
const parsed = JSON.parse(storage.get(INDICATOR_DEFAULTS_KEY) ?? "{}");
|
|
22725
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
22726
|
+
} catch {
|
|
22727
|
+
return {};
|
|
22728
|
+
}
|
|
22729
|
+
};
|
|
22730
|
+
const indicatorDefaults = {
|
|
22731
|
+
read: (definitionId) => parseIndicatorDefault(storedDefaults()[definitionId]),
|
|
22732
|
+
write: (definitionId, value) => storage.set(INDICATOR_DEFAULTS_KEY, JSON.stringify({ ...storedDefaults(), [definitionId]: value }))
|
|
22733
|
+
};
|
|
22637
22734
|
const indicators2 = attachIndicatorsPlane({
|
|
22638
22735
|
chart,
|
|
22639
22736
|
candleSeries,
|
|
@@ -22655,11 +22752,13 @@ function createChartInstance(deps) {
|
|
|
22655
22752
|
syncVolume();
|
|
22656
22753
|
syncScaleSources();
|
|
22657
22754
|
legend2.push();
|
|
22658
|
-
|
|
22755
|
+
syncPanes();
|
|
22659
22756
|
},
|
|
22660
22757
|
onEvent: (event) => events.emit("indicator", event),
|
|
22661
22758
|
catalog: deps.indicatorCatalog,
|
|
22662
|
-
mainPane
|
|
22759
|
+
mainPane,
|
|
22760
|
+
timeframe: () => tf,
|
|
22761
|
+
defaults: indicatorDefaults
|
|
22663
22762
|
});
|
|
22664
22763
|
const session2 = attachSession({
|
|
22665
22764
|
chart,
|
|
@@ -22715,7 +22814,7 @@ function createChartInstance(deps) {
|
|
|
22715
22814
|
onChips: () => {
|
|
22716
22815
|
paneOps.settle();
|
|
22717
22816
|
legend2.push();
|
|
22718
|
-
|
|
22817
|
+
syncPanes();
|
|
22719
22818
|
syncScaleSources();
|
|
22720
22819
|
},
|
|
22721
22820
|
onEvent: (entries) => events.emit("compare", entries)
|
|
@@ -22730,10 +22829,19 @@ function createChartInstance(deps) {
|
|
|
22730
22829
|
moved: () => {
|
|
22731
22830
|
plotArea.refresh();
|
|
22732
22831
|
scaleControls?.sync();
|
|
22733
|
-
|
|
22832
|
+
syncPanes();
|
|
22833
|
+
legend2.push();
|
|
22834
|
+
},
|
|
22835
|
+
maximizing: (on) => {
|
|
22836
|
+
paneMaximized = on;
|
|
22837
|
+
chart.applyOptions({ layout: lookOptions().layout });
|
|
22734
22838
|
legend2.push();
|
|
22735
22839
|
}
|
|
22736
22840
|
});
|
|
22841
|
+
function syncPanes() {
|
|
22842
|
+
paneOps.conceal();
|
|
22843
|
+
paneButtons?.sync();
|
|
22844
|
+
}
|
|
22737
22845
|
function movePane(pane, direction) {
|
|
22738
22846
|
if (disposed || !paneOps.move(pane, direction)) return;
|
|
22739
22847
|
indicators2.recompute();
|
|
@@ -22762,7 +22870,14 @@ function createChartInstance(deps) {
|
|
|
22762
22870
|
valueShaped: () => valueShaped(style),
|
|
22763
22871
|
sessionModel: () => session2.model(),
|
|
22764
22872
|
status: (nowSecs) => session2.status(nowSecs),
|
|
22765
|
-
openIndicatorSettings: (id) => deps.doors.openIndicatorSettings(handle, id
|
|
22873
|
+
openIndicatorSettings: (id) => deps.doors.openIndicatorSettings(handle, id, {
|
|
22874
|
+
preview: (instance) => indicators2.preview(id, instance),
|
|
22875
|
+
saveDefault: (instance) => {
|
|
22876
|
+
const definitionId = instance.definition.manifest.id;
|
|
22877
|
+
if (!definitionId) return;
|
|
22878
|
+
indicatorDefaults.write(definitionId, { ...instance.inputs ? { inputs: instance.inputs } : {}, ...instance.overrides ? { overrides: withHidden(instance, false).overrides ?? {} } : {} });
|
|
22879
|
+
}
|
|
22880
|
+
}),
|
|
22766
22881
|
legendValues: deps.ui.legendValues,
|
|
22767
22882
|
paneOps,
|
|
22768
22883
|
settings: () => eff,
|
|
@@ -22959,7 +23074,7 @@ function createChartInstance(deps) {
|
|
|
22959
23074
|
heightWatch?.observe(gestures);
|
|
22960
23075
|
chart.timeScale().subscribeVisibleLogicalRangeChange(() => {
|
|
22961
23076
|
levels?.refresh();
|
|
22962
|
-
|
|
23077
|
+
syncPanes();
|
|
22963
23078
|
holdRatio();
|
|
22964
23079
|
scaleControls?.sync();
|
|
22965
23080
|
});
|
|
@@ -23001,7 +23116,12 @@ function createChartInstance(deps) {
|
|
|
23001
23116
|
hideLayersChanged: () => drawings2.syncHideLayers(),
|
|
23002
23117
|
// A contributed legend row stands in the legend under the symbol's reading.
|
|
23003
23118
|
legendRowsChanged: () => legend2.setSlotRows(extensionsHost?.legendRows().map((row2) => row2.element) ?? []),
|
|
23004
|
-
refreshMarks: () => refreshMarks()
|
|
23119
|
+
refreshMarks: () => refreshMarks(),
|
|
23120
|
+
// Extension state rides the chart's content, so a change to it raises the same debounced
|
|
23121
|
+
// save-needed every other content change does, quiet under hydration like the rest.
|
|
23122
|
+
stateChanged: () => {
|
|
23123
|
+
if (!disposed) deps.contentChanged?.();
|
|
23124
|
+
}
|
|
23005
23125
|
});
|
|
23006
23126
|
extensionsHost = extensions.host;
|
|
23007
23127
|
legend2.setSlotRows(extensions.host.legendRows().map((row2) => row2.element));
|
|
@@ -23129,6 +23249,7 @@ function createChartInstance(deps) {
|
|
|
23129
23249
|
paneButtons = mountPaneButtons({
|
|
23130
23250
|
chrome: chrome2,
|
|
23131
23251
|
gestures,
|
|
23252
|
+
hoverRoot: deps.container,
|
|
23132
23253
|
i18n,
|
|
23133
23254
|
icons: deps.icons,
|
|
23134
23255
|
visibility: () => eff.canvas.paneButtons,
|
|
@@ -23141,7 +23262,8 @@ function createChartInstance(deps) {
|
|
|
23141
23262
|
top: paneTopIn(chart, index, gestures),
|
|
23142
23263
|
height: pane.getHeight(),
|
|
23143
23264
|
collapsed: paneOps.collapsed(index),
|
|
23144
|
-
maximized: paneOps.maximized(index)
|
|
23265
|
+
maximized: paneOps.maximized(index),
|
|
23266
|
+
hidden: paneOps.hidden(index)
|
|
23145
23267
|
}));
|
|
23146
23268
|
},
|
|
23147
23269
|
insetEnd: () => scaleWidth("right"),
|
|
@@ -23299,11 +23421,11 @@ function createChartInstance(deps) {
|
|
|
23299
23421
|
let builtFormatKey = "";
|
|
23300
23422
|
const setSymbolFormat = (format2) => {
|
|
23301
23423
|
symbolFormat = format2;
|
|
23302
|
-
const
|
|
23424
|
+
const written3 = writtenFormat();
|
|
23303
23425
|
builtFormatKey = formatKey();
|
|
23304
|
-
symbolFormatter = createPriceFormatter(
|
|
23426
|
+
symbolFormatter = createPriceFormatter(written3, { locale: i18n.tag() });
|
|
23305
23427
|
applyPriceFormat();
|
|
23306
|
-
drawings2.setPricing(format2 ? minMoveOf(
|
|
23428
|
+
drawings2.setPricing(format2 ? minMoveOf(written3) : null, (price) => symbolFormatter.format(price));
|
|
23307
23429
|
countdown?.refresh();
|
|
23308
23430
|
};
|
|
23309
23431
|
function applyLook() {
|
|
@@ -23353,7 +23475,7 @@ function createChartInstance(deps) {
|
|
|
23353
23475
|
paintChromeCanvas();
|
|
23354
23476
|
scaleControls?.sync();
|
|
23355
23477
|
scalePlus?.refresh();
|
|
23356
|
-
|
|
23478
|
+
syncPanes();
|
|
23357
23479
|
legend2.push();
|
|
23358
23480
|
extensions.host.themeChanged(settingsCanvas(c, eff));
|
|
23359
23481
|
countdown?.restyled();
|
|
@@ -23547,6 +23669,48 @@ function createChartInstance(deps) {
|
|
|
23547
23669
|
if (!disposed && myEpoch === epoch) place();
|
|
23548
23670
|
});
|
|
23549
23671
|
}
|
|
23672
|
+
function showRange(range2) {
|
|
23673
|
+
const parsed = parseTimeframe(tf);
|
|
23674
|
+
const before = () => {
|
|
23675
|
+
const oldest = bars[0];
|
|
23676
|
+
return !!oldest && range2.from < oldest.t && !noMoreHistory && bars.length < RANGE_DEPTH && (earliestBarSecs === null || oldest.t > earliestBarSecs);
|
|
23677
|
+
};
|
|
23678
|
+
if (disposed || replay2.active() || !(range2.to > range2.from) || !before()) {
|
|
23679
|
+
ranges.setVisibleRange(range2);
|
|
23680
|
+
return;
|
|
23681
|
+
}
|
|
23682
|
+
paging = true;
|
|
23683
|
+
const myEpoch = epoch;
|
|
23684
|
+
const myNavigation = navigationEpoch;
|
|
23685
|
+
const current = () => !disposed && myEpoch === epoch && myNavigation === navigationEpoch && !replay2.active();
|
|
23686
|
+
void (async () => {
|
|
23687
|
+
try {
|
|
23688
|
+
while (before()) {
|
|
23689
|
+
const oldest = bars[0].t;
|
|
23690
|
+
const count2 = parsed && parsed.unit !== "t" ? Math.min(SPAN_PAGE_MAX_BARS, Math.ceil((oldest - range2.from) / timeframeSeconds(parsed)) + PAGE_TRIGGER_BARS) : PAGE_BARS;
|
|
23691
|
+
const { olderBars, end } = await fetchOlder(oldest - 1, count2);
|
|
23692
|
+
if (disposed || myEpoch !== epoch) return;
|
|
23693
|
+
if (end) noMoreHistory = true;
|
|
23694
|
+
const first = bars[0]?.t;
|
|
23695
|
+
if (first === void 0 || replay2.active()) return;
|
|
23696
|
+
const merged2 = mergeBarSnapshot(bars, olderBars.filter((bar) => bar.t < first), true);
|
|
23697
|
+
if (merged2.length === bars.length) break;
|
|
23698
|
+
maintainTimeline(() => {
|
|
23699
|
+
bars = merged2;
|
|
23700
|
+
paintAll();
|
|
23701
|
+
});
|
|
23702
|
+
refreshMarks();
|
|
23703
|
+
if (!current()) return;
|
|
23704
|
+
}
|
|
23705
|
+
} catch {
|
|
23706
|
+
} finally {
|
|
23707
|
+
if (myEpoch === epoch) paging = false;
|
|
23708
|
+
}
|
|
23709
|
+
if (!current()) return;
|
|
23710
|
+
maintenanceRange = null;
|
|
23711
|
+
ranges.setVisibleRange(range2);
|
|
23712
|
+
})();
|
|
23713
|
+
}
|
|
23550
23714
|
let walkingBack = false;
|
|
23551
23715
|
async function replayFromFirst() {
|
|
23552
23716
|
if (!symbol || walkingBack || disposed) return;
|
|
@@ -23989,7 +24153,7 @@ function createChartInstance(deps) {
|
|
|
23989
24153
|
rangePreset: () => selectedRangePreset,
|
|
23990
24154
|
setVisibleRange: (range2) => {
|
|
23991
24155
|
beginNavigation();
|
|
23992
|
-
|
|
24156
|
+
showRange(range2);
|
|
23993
24157
|
},
|
|
23994
24158
|
logicalRange: () => ranges.logicalRange(),
|
|
23995
24159
|
setLogicalRange: (range2) => {
|
|
@@ -25757,192 +25921,180 @@ function mountBottomBar(deps) {
|
|
|
25757
25921
|
};
|
|
25758
25922
|
}
|
|
25759
25923
|
|
|
25760
|
-
// src/ui/
|
|
25761
|
-
|
|
25762
|
-
|
|
25763
|
-
|
|
25764
|
-
|
|
25765
|
-
|
|
25766
|
-
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
wrap.remove();
|
|
25773
|
-
anchor.setAttribute("aria-expanded", "false");
|
|
25774
|
-
onClosed();
|
|
25775
|
-
};
|
|
25776
|
-
function onKey(event) {
|
|
25777
|
-
if (event.key !== "Escape" || !ownsEscape(escape.token)) return;
|
|
25778
|
-
event.stopPropagation();
|
|
25779
|
-
event.preventDefault();
|
|
25780
|
-
close();
|
|
25781
|
-
anchor.focus({ preventScroll: true });
|
|
25782
|
-
}
|
|
25783
|
-
document.addEventListener("keydown", onKey, true);
|
|
25784
|
-
return close;
|
|
25785
|
-
}
|
|
25786
|
-
|
|
25787
|
-
// src/ui/chrome/indicatorSettings.ts
|
|
25788
|
-
var LINE_WIDTHS = [1, 2, 3, 4];
|
|
25789
|
-
var PRECISIONS2 = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
25790
|
-
var titleOf2 = (key, titles) => titles?.[key] ?? key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (c) => c.toUpperCase());
|
|
25791
|
-
var cloneOverrides = (ov) => JSON.parse(JSON.stringify(ov ?? {}));
|
|
25924
|
+
// src/ui/indicators/settingsDialog.ts
|
|
25925
|
+
var TAB_LABEL2 = { inputs: "settings.tabInputs", style: "settings.tabStyle", visibility: "settings.tabVisibility" };
|
|
25926
|
+
var nextDialogId = 0;
|
|
25927
|
+
var draftOf = (instance) => ({
|
|
25928
|
+
...instance,
|
|
25929
|
+
...instance.inputs ? { inputs: { ...instance.inputs } } : {},
|
|
25930
|
+
...instance.overrides ? { overrides: JSON.parse(JSON.stringify(instance.overrides)) } : {}
|
|
25931
|
+
});
|
|
25932
|
+
var written = (instance) => JSON.stringify(
|
|
25933
|
+
{ inputs: instance.inputs ?? {}, overrides: instance.overrides ?? {} },
|
|
25934
|
+
(_key, value) => value && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b))) : value
|
|
25935
|
+
);
|
|
25792
25936
|
function openIndicatorSettings(deps) {
|
|
25793
25937
|
const t = deps.i18n.t;
|
|
25794
|
-
const { instance,
|
|
25938
|
+
const { instance, session: session2 } = deps;
|
|
25795
25939
|
const manifest2 = instance.definition.manifest;
|
|
25796
|
-
const
|
|
25797
|
-
const
|
|
25798
|
-
const
|
|
25799
|
-
let
|
|
25800
|
-
|
|
25801
|
-
|
|
25802
|
-
const
|
|
25803
|
-
|
|
25804
|
-
|
|
25805
|
-
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
|
|
25809
|
-
|
|
25810
|
-
|
|
25811
|
-
|
|
25812
|
-
|
|
25813
|
-
|
|
25814
|
-
|
|
25815
|
-
onPick: (color2) => {
|
|
25816
|
-
control.update(color2);
|
|
25817
|
-
onChange(color2);
|
|
25818
|
-
},
|
|
25819
|
-
openPanel: (anchor, content, onClosed) => openInlinePanel(anchor, content, anchor.closest(".qc-settings-row") ?? anchor, onClosed)
|
|
25820
|
-
});
|
|
25821
|
-
controls.push(control);
|
|
25822
|
-
return control.element;
|
|
25823
|
-
};
|
|
25824
|
-
const select = (label3, options2, current, onChange) => {
|
|
25825
|
-
const el2 = h("select", { class: "qc-field", "aria-label": label3 });
|
|
25826
|
-
for (const o of options2) el2.appendChild(h("option", { value: o.value, selected: o.value === current }, o.text));
|
|
25827
|
-
el2.addEventListener("change", () => onChange(el2.value));
|
|
25828
|
-
return selectField(el2, deps.icons);
|
|
25829
|
-
};
|
|
25830
|
-
const lineStyleOptions = () => [
|
|
25831
|
-
{ value: "solid", text: t("settings.lineStyleSolid") },
|
|
25832
|
-
{ value: "dashed", text: t("settings.lineStyleDashed") },
|
|
25833
|
-
{ value: "dotted", text: t("settings.lineStyleDotted") }
|
|
25834
|
-
];
|
|
25835
|
-
const stylePage = () => {
|
|
25836
|
-
const page = h("div", { class: "qc-settings-page" });
|
|
25837
|
-
const plots = Object.entries(manifest2.plots);
|
|
25838
|
-
if (plots.length > 0) page.appendChild(h("div", { class: "qc-dialog-heading", role: "presentation" }, t("settings.plots")));
|
|
25839
|
-
for (const [key, spec] of plots) {
|
|
25840
|
-
const label3 = titleOf2(key, builtIn.plotTitles);
|
|
25841
|
-
const ov = overrides.plots?.[key];
|
|
25842
|
-
const row2 = h("div", { class: "qc-settings-row" }, h("span", { class: "qc-field-label" }, label3));
|
|
25843
|
-
row2.appendChild(colorField(t("settings.colorOf", { name: label3 }), ov?.color ?? spec.color ?? instance.color, (hex) => plotOverride(key).color = hex));
|
|
25844
|
-
if (spec.kind === "line" || spec.kind === "area") {
|
|
25845
|
-
row2.appendChild(
|
|
25846
|
-
select(t("settings.lineWidthOf", { name: label3 }), LINE_WIDTHS.map((w) => ({ value: String(w), text: String(w) })), String(ov?.lineWidth ?? spec.lineWidth ?? 1), (v) => plotOverride(key).lineWidth = Number(v))
|
|
25847
|
-
);
|
|
25848
|
-
row2.appendChild(select(t("settings.lineStyleOf", { name: label3 }), lineStyleOptions(), ov?.lineStyle ?? spec.lineStyle ?? "solid", (v) => plotOverride(key).lineStyle = v));
|
|
25849
|
-
}
|
|
25850
|
-
page.appendChild(row2);
|
|
25851
|
-
}
|
|
25852
|
-
const levels = Object.entries(manifest2.levels ?? {});
|
|
25853
|
-
if (levels.length > 0) page.appendChild(h("div", { class: "qc-dialog-heading", role: "presentation" }, t("settings.levels")));
|
|
25854
|
-
for (const [key, spec] of levels) {
|
|
25855
|
-
const label3 = titleOf2(key, builtIn.plotTitles);
|
|
25856
|
-
const ov = overrides.levels?.[key];
|
|
25857
|
-
page.appendChild(
|
|
25858
|
-
h(
|
|
25859
|
-
"div",
|
|
25860
|
-
{ class: "qc-settings-row" },
|
|
25861
|
-
h("span", { class: "qc-field-label" }, label3),
|
|
25862
|
-
colorField(t("settings.colorOf", { name: label3 }), ov?.color ?? spec.color, (hex) => levelOverride(key).color = hex),
|
|
25863
|
-
select(t("settings.lineStyleOf", { name: label3 }), lineStyleOptions(), ov?.lineStyle ?? spec.lineStyle ?? "solid", (v) => levelOverride(key).lineStyle = v)
|
|
25864
|
-
)
|
|
25865
|
-
);
|
|
25940
|
+
const hasInputs = Object.keys(manifest2.inputs ?? {}).length > 0;
|
|
25941
|
+
const tabs = [...hasInputs ? ["inputs"] : [], "style", "visibility"];
|
|
25942
|
+
const idBase = `qc-indicator-settings-${++nextDialogId}`;
|
|
25943
|
+
let tab = tabs[0];
|
|
25944
|
+
let draft = draftOf(instance);
|
|
25945
|
+
let settled = false;
|
|
25946
|
+
const editable = () => deps.commands.available("chart.indicators.update");
|
|
25947
|
+
const dialog = openDialog2({
|
|
25948
|
+
container: deps.overlays,
|
|
25949
|
+
title: t("settings.indicatorTitle", { name: indicatorTitleOf(instance, t) }),
|
|
25950
|
+
heading: indicatorMarkOf(instance, t),
|
|
25951
|
+
closeLabel: t("drawing.close"),
|
|
25952
|
+
icons: deps.icons,
|
|
25953
|
+
role: "indicator-settings",
|
|
25954
|
+
veil: false,
|
|
25955
|
+
motion: false,
|
|
25956
|
+
// Escape, the corner close or a press outside ends the session as the dialog begins to close.
|
|
25957
|
+
onClosing: () => {
|
|
25958
|
+
if (!settled) cancel();
|
|
25866
25959
|
}
|
|
25867
|
-
|
|
25868
|
-
|
|
25869
|
-
|
|
25870
|
-
|
|
25871
|
-
|
|
25872
|
-
|
|
25873
|
-
|
|
25874
|
-
|
|
25875
|
-
|
|
25876
|
-
|
|
25877
|
-
|
|
25878
|
-
|
|
25879
|
-
|
|
25880
|
-
)
|
|
25881
|
-
);
|
|
25882
|
-
page.appendChild(
|
|
25883
|
-
switchRow({
|
|
25884
|
-
label: t("settings.labelsOnPriceScale"),
|
|
25885
|
-
checked: overrides.display?.labelsOnPriceScale !== false,
|
|
25886
|
-
onChange: (on) => {
|
|
25887
|
-
overrides.display = { ...overrides.display, labelsOnPriceScale: on };
|
|
25888
|
-
}
|
|
25889
|
-
})
|
|
25890
|
-
);
|
|
25891
|
-
return page;
|
|
25892
|
-
};
|
|
25893
|
-
const visibilityPage = () => {
|
|
25894
|
-
const page = h("div", { class: "qc-settings-page" });
|
|
25895
|
-
page.appendChild(switchRow({ label: t("settings.showIndicator"), checked: !hidden, onChange: (on) => hidden = !on }));
|
|
25896
|
-
const section = (heading, entries, read, write) => {
|
|
25897
|
-
if (entries.length === 0) return;
|
|
25898
|
-
page.appendChild(h("div", { class: "qc-dialog-heading", role: "presentation" }, heading));
|
|
25899
|
-
for (const [key] of entries) {
|
|
25900
|
-
const label3 = titleOf2(key, builtIn.plotTitles);
|
|
25901
|
-
page.appendChild(switchRow({ label: t("settings.visibleOf", { name: label3 }), checked: read(key), onChange: (on) => write(key, on) }));
|
|
25902
|
-
}
|
|
25903
|
-
};
|
|
25904
|
-
section(t("settings.plots"), Object.entries(manifest2.plots), (k) => overrides.plots?.[k]?.visible !== false, (k, on) => plotOverride(k).visible = on);
|
|
25905
|
-
section(t("settings.levels"), Object.entries(manifest2.levels ?? {}), (k) => overrides.levels?.[k]?.visible !== false, (k, on) => levelOverride(k).visible = on);
|
|
25906
|
-
section(t("settings.fills"), Object.entries(manifest2.fills ?? {}), (k) => overrides.fills?.[k]?.visible !== false, (k, on) => fillOverride(k).visible = on);
|
|
25907
|
-
return page;
|
|
25960
|
+
});
|
|
25961
|
+
dialog.box.classList.add("qc-drawing-settings-dialog", "qc-indicator-settings-dialog");
|
|
25962
|
+
const strip = el("div", { class: "qc-drawing-tabs-slot" }, el("span", { class: "qc-drawing-tabs-track", "aria-hidden": "true" }));
|
|
25963
|
+
const page = el("div", { class: "qc-drawing-page", role: "tabpanel", id: `${idBase}-page` });
|
|
25964
|
+
dialog.body.before(strip);
|
|
25965
|
+
dialog.body.append(page);
|
|
25966
|
+
const tabId = (id) => `${idBase}-tab-${id}`;
|
|
25967
|
+
const hold = () => {
|
|
25968
|
+
const box2 = dialog.box;
|
|
25969
|
+
if (box2.style.position === "fixed" || !(box2.offsetWidth > 0)) return;
|
|
25970
|
+
box2.style.position = "fixed";
|
|
25971
|
+
box2.style.left = `${Math.round(box2.offsetLeft)}px`;
|
|
25972
|
+
box2.style.top = `${Math.round(box2.offsetTop)}px`;
|
|
25908
25973
|
};
|
|
25909
|
-
const
|
|
25910
|
-
|
|
25911
|
-
|
|
25912
|
-
|
|
25913
|
-
|
|
25914
|
-
|
|
25915
|
-
|
|
25916
|
-
|
|
25917
|
-
|
|
25918
|
-
|
|
25974
|
+
const focusField = () => {
|
|
25975
|
+
const field = page.querySelector("input.qc-field:not(:disabled)");
|
|
25976
|
+
if (!field) return false;
|
|
25977
|
+
field.focus({ preventScroll: true });
|
|
25978
|
+
field.select();
|
|
25979
|
+
return true;
|
|
25980
|
+
};
|
|
25981
|
+
const change = (next) => {
|
|
25982
|
+
if (settled) return;
|
|
25983
|
+
draft = next;
|
|
25984
|
+
session2.preview(draft);
|
|
25985
|
+
render();
|
|
25986
|
+
};
|
|
25987
|
+
const withOverrides = (overrides) => {
|
|
25988
|
+
const { overrides: _overrides, ...bare } = draft;
|
|
25989
|
+
return Object.keys(overrides).length > 0 ? { ...bare, overrides } : bare;
|
|
25990
|
+
};
|
|
25991
|
+
const render = () => {
|
|
25992
|
+
const base = { t, icons: deps.icons, box: dialog.layer };
|
|
25993
|
+
const overrides = draft.overrides ?? {};
|
|
25994
|
+
const rows2 = tab === "inputs" ? inputRows({ ...base, manifest: manifest2, values: { ...manifestInputDefaults(manifest2), ...draft.inputs }, onInput: (key, value) => change({ ...draft, inputs: { ...draft.inputs, [key]: value } }) }) : tab === "style" ? styleRows2({
|
|
25995
|
+
...base,
|
|
25996
|
+
manifest: manifest2,
|
|
25997
|
+
overrides,
|
|
25998
|
+
instanceColor: draft.color ?? deps.widget.theme.get()["series.neutral"],
|
|
25999
|
+
neutral: deps.widget.theme.get()["series.neutral"],
|
|
26000
|
+
hasInputs,
|
|
26001
|
+
onOverrides: (next) => change(withOverrides(next))
|
|
26002
|
+
}) : timeframeVisibilityRows(t, deps.icons, overrides.visibility ?? DEFAULT_VISIBILITY, (patch) => change(withOverrides({ ...overrides, visibility: { ...overrides.visibility ?? DEFAULT_VISIBILITY, ...patch } })), t("settings.indicatorPinnedNote"));
|
|
26003
|
+
page.replaceChildren(...rows2);
|
|
26004
|
+
page.dataset.tab = tab;
|
|
26005
|
+
if (!editable()) for (const control of page.querySelectorAll("button, input")) control.disabled = true;
|
|
26006
|
+
};
|
|
26007
|
+
strip.appendChild(
|
|
26008
|
+
dialogTabs(
|
|
26009
|
+
tabs,
|
|
26010
|
+
tab,
|
|
26011
|
+
(id) => t(TAB_LABEL2[id]),
|
|
26012
|
+
(id) => {
|
|
26013
|
+
hold();
|
|
25919
26014
|
tab = id;
|
|
25920
|
-
|
|
25921
|
-
|
|
25922
|
-
|
|
25923
|
-
|
|
25924
|
-
|
|
25925
|
-
|
|
25926
|
-
|
|
25927
|
-
|
|
25928
|
-
|
|
25929
|
-
|
|
25930
|
-
|
|
25931
|
-
|
|
25932
|
-
|
|
25933
|
-
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
|
|
25937
|
-
|
|
25938
|
-
|
|
25939
|
-
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
|
|
25943
|
-
|
|
26015
|
+
page.setAttribute("aria-labelledby", tabId(tab));
|
|
26016
|
+
render();
|
|
26017
|
+
focusField();
|
|
26018
|
+
},
|
|
26019
|
+
{ tab: tabId, panel: `${idBase}-page` }
|
|
26020
|
+
)
|
|
26021
|
+
);
|
|
26022
|
+
page.setAttribute("aria-labelledby", tabId(tab));
|
|
26023
|
+
const cancel = () => {
|
|
26024
|
+
if (settled) return;
|
|
26025
|
+
settled = true;
|
|
26026
|
+
session2.preview(null);
|
|
26027
|
+
dialog.close();
|
|
26028
|
+
};
|
|
26029
|
+
const ok = () => {
|
|
26030
|
+
if (settled) return;
|
|
26031
|
+
settled = true;
|
|
26032
|
+
session2.preview(null);
|
|
26033
|
+
if (written(draft) !== written(instance)) deps.commands.execute("chart.indicators.update", draft);
|
|
26034
|
+
dialog.close();
|
|
26035
|
+
};
|
|
26036
|
+
page.addEventListener("keydown", (event) => {
|
|
26037
|
+
if (event.key !== "Enter" || !(event.target instanceof HTMLInputElement) || event.target.type === "checkbox") return;
|
|
26038
|
+
event.preventDefault();
|
|
26039
|
+
event.target.dispatchEvent(new Event("change"));
|
|
26040
|
+
ok();
|
|
26041
|
+
});
|
|
26042
|
+
const defaults = el(
|
|
26043
|
+
"button",
|
|
26044
|
+
{ type: "button", class: "qc-field qc-drawing-template-button", "aria-label": t("settings.defaults"), "aria-haspopup": "menu", "aria-expanded": "false" },
|
|
26045
|
+
el("span", { class: "qc-drawing-select-value", text: t("settings.defaults") }),
|
|
26046
|
+
selectChevron(deps.icons)
|
|
26047
|
+
);
|
|
26048
|
+
let closeMenu = null;
|
|
26049
|
+
defaults.addEventListener("click", () => {
|
|
26050
|
+
if (closeMenu) {
|
|
26051
|
+
closeMenu();
|
|
26052
|
+
return;
|
|
25944
26053
|
}
|
|
26054
|
+
const menu2 = el("div", { class: "qc-drawing-menu qc-drawing-list qc-drawing-template-menu", role: "menu", "aria-label": t("settings.defaults") });
|
|
26055
|
+
const rowOf = (text2, enabled, onPick) => {
|
|
26056
|
+
const item = el("button", { type: "button", class: "qc-menu-row qc-drawing-list-row", role: "menuitem" }, el("span", { class: "qc-menu-label", text: text2 }));
|
|
26057
|
+
item.disabled = !enabled;
|
|
26058
|
+
item.addEventListener("click", () => {
|
|
26059
|
+
closeMenu?.();
|
|
26060
|
+
onPick();
|
|
26061
|
+
});
|
|
26062
|
+
return item;
|
|
26063
|
+
};
|
|
26064
|
+
menu2.append(
|
|
26065
|
+
// The definition's own inputs and look, the instance's color and its hidden state kept.
|
|
26066
|
+
rowOf(t("settings.resetSettings"), editable(), () => {
|
|
26067
|
+
const { inputs: _inputs, overrides: _overrides, ...bare } = draft;
|
|
26068
|
+
change(draft.overrides?.display?.hidden ? { ...bare, overrides: { display: { hidden: true } } } : bare);
|
|
26069
|
+
}),
|
|
26070
|
+
rowOf(t("settings.saveAsDefault"), true, () => session2.saveDefault(draft))
|
|
26071
|
+
);
|
|
26072
|
+
const unkeys = menuKeys(menu2, () => [...menu2.querySelectorAll('[role="menuitem"]')]);
|
|
26073
|
+
const close = openPopover(
|
|
26074
|
+
dialog.layer,
|
|
26075
|
+
defaults,
|
|
26076
|
+
menu2,
|
|
26077
|
+
"below",
|
|
26078
|
+
() => {
|
|
26079
|
+
unkeys();
|
|
26080
|
+
closeMenu = null;
|
|
26081
|
+
},
|
|
26082
|
+
defaults,
|
|
26083
|
+
() => reopenPopover(close, menu2, () => defaults),
|
|
26084
|
+
{ gap: 0, className: "qc-drawing-popover--list" }
|
|
26085
|
+
);
|
|
26086
|
+
closeMenu = close;
|
|
26087
|
+
focusFirst(menu2);
|
|
25945
26088
|
});
|
|
26089
|
+
dialog.footer.append(
|
|
26090
|
+
defaults,
|
|
26091
|
+
el("span", { class: "qc-drawing-footer-gap" }),
|
|
26092
|
+
button({ class: "qc-button qc-drawing-footer-button qc-drawing-cancel", label: t("drawing.cancel"), text: t("drawing.cancel"), onClick: cancel }),
|
|
26093
|
+
button({ class: "qc-button qc-button--primary qc-drawing-footer-button", label: t("drawing.ok"), text: t("drawing.ok"), disabled: !editable(), onClick: ok })
|
|
26094
|
+
);
|
|
26095
|
+
render();
|
|
26096
|
+
if (!focusField()) strip.querySelector('[aria-selected="true"]')?.focus({ preventScroll: true });
|
|
26097
|
+
return { element: dialog.box, close: cancel };
|
|
25946
26098
|
}
|
|
25947
26099
|
|
|
25948
26100
|
// src/ui/chrome/indicatorPickerData.ts
|
|
@@ -26117,7 +26269,7 @@ function openIndicatorPicker(deps) {
|
|
|
26117
26269
|
input.focus();
|
|
26118
26270
|
});
|
|
26119
26271
|
clear.hidden = true;
|
|
26120
|
-
const strip = h("div", { class: "qc-search-classes" });
|
|
26272
|
+
const strip = h("div", { class: "qc-search-classes qc-picker-kinds" });
|
|
26121
26273
|
const nav = h("nav", { class: "qc-picker-nav", "aria-label": t("picker.collections") });
|
|
26122
26274
|
const list = h("div", { class: "qc-picker-list", role: "table", "aria-label": t("picker.title") });
|
|
26123
26275
|
const vacant = h("div", { class: "qc-picker-empty" });
|
|
@@ -26357,7 +26509,7 @@ function openIndicatorPicker(deps) {
|
|
|
26357
26509
|
input.focus();
|
|
26358
26510
|
} else if (roveFocus(list, event)) event.preventDefault();
|
|
26359
26511
|
});
|
|
26360
|
-
box2.append(searchField(deps.icons, input, clear),
|
|
26512
|
+
box2.append(searchField(deps.icons, input, clear), h("div", { class: "qc-picker-body" }, strip, nav, h("div", { class: "qc-picker-content" }, list, vacant, status2)));
|
|
26361
26513
|
renderKinds();
|
|
26362
26514
|
renderNavigation();
|
|
26363
26515
|
redraw = render;
|
|
@@ -26468,6 +26620,28 @@ var PLACEMENTS2 = [
|
|
|
26468
26620
|
{ placement: "new-scale", label: "search.newScale" },
|
|
26469
26621
|
{ placement: "new-pane", label: "search.newPane" }
|
|
26470
26622
|
];
|
|
26623
|
+
function groupedHits(hits, added, open2) {
|
|
26624
|
+
const heads = [];
|
|
26625
|
+
const groups = /* @__PURE__ */ new Map();
|
|
26626
|
+
for (const row2 of hits) {
|
|
26627
|
+
const key = row2.group;
|
|
26628
|
+
const held = key ? groups.get(key) : void 0;
|
|
26629
|
+
if (key && held) {
|
|
26630
|
+
held.members.push(row2);
|
|
26631
|
+
held.head.members = held.members;
|
|
26632
|
+
held.head.open = open2.has(key);
|
|
26633
|
+
continue;
|
|
26634
|
+
}
|
|
26635
|
+
const head = { row: row2, added: added.has(row2.symbol) };
|
|
26636
|
+
if (key) groups.set(key, { head, members: [row2] });
|
|
26637
|
+
heads.push(head);
|
|
26638
|
+
}
|
|
26639
|
+
return heads.flatMap((head) => {
|
|
26640
|
+
if (!head.open || !head.members) return [head];
|
|
26641
|
+
const rest = head.members.slice(1);
|
|
26642
|
+
return [{ ...head, panel: "first" }, ...rest.map((row2, i) => ({ row: row2, added: added.has(row2.symbol), nested: true, panel: i === rest.length - 1 ? "last" : "middle" }))];
|
|
26643
|
+
});
|
|
26644
|
+
}
|
|
26471
26645
|
function rowLabels(row2) {
|
|
26472
26646
|
const names = symbolNames(row2);
|
|
26473
26647
|
return { ticker: names.mark, description: names.description, source: row2.exchange || row2.dataSource || "" };
|
|
@@ -26482,6 +26656,22 @@ function offeredOperators(spreads) {
|
|
|
26482
26656
|
}
|
|
26483
26657
|
return out;
|
|
26484
26658
|
}
|
|
26659
|
+
var NO_GROUPS = /* @__PURE__ */ new Set();
|
|
26660
|
+
function pileEdges() {
|
|
26661
|
+
const ns = "http://www.w3.org/2000/svg";
|
|
26662
|
+
const svg = document.createElementNS(ns, "svg");
|
|
26663
|
+
svg.setAttribute("class", "qc-search-pile-edges");
|
|
26664
|
+
svg.setAttribute("viewBox", "0 0 24 28");
|
|
26665
|
+
svg.setAttribute("width", "24");
|
|
26666
|
+
svg.setAttribute("height", "28");
|
|
26667
|
+
svg.setAttribute("aria-hidden", "true");
|
|
26668
|
+
const path = document.createElementNS(ns, "path");
|
|
26669
|
+
path.setAttribute("d", "M0.5 14A11.5 11.5 0 0 0 23.5 14M0.5 16A11.5 11.5 0 0 0 23.5 16");
|
|
26670
|
+
path.setAttribute("fill", "none");
|
|
26671
|
+
path.setAttribute("stroke", "currentColor");
|
|
26672
|
+
svg.appendChild(path);
|
|
26673
|
+
return svg;
|
|
26674
|
+
}
|
|
26485
26675
|
function dialogRows(input) {
|
|
26486
26676
|
const q = input.query.trim();
|
|
26487
26677
|
const addedSet = new Set(input.added.map((e) => e.symbol));
|
|
@@ -26498,16 +26688,17 @@ function dialogRows(input) {
|
|
|
26498
26688
|
const recent = input.recents.filter((r) => !seen.has(r.symbol)).map((row2) => ({ row: row2, added: false }));
|
|
26499
26689
|
return [...added, ...curated, ...recent];
|
|
26500
26690
|
}
|
|
26501
|
-
const
|
|
26691
|
+
const listed = (hits) => compare ? hits.map((row2) => ({ row: row2, added: addedSet.has(row2.symbol) })) : groupedHits(hits, addedSet, input.open ?? NO_GROUPS);
|
|
26502
26692
|
if (!compare && q === "") {
|
|
26503
26693
|
const seen = new Set(input.recents.map((r) => r.symbol));
|
|
26504
|
-
return [...input.recents.map((row2) => ({ row: row2, added: addedSet.has(row2.symbol) })), ...
|
|
26694
|
+
return [...input.recents.map((row2) => ({ row: row2, added: addedSet.has(row2.symbol) })), ...listed(input.hits.filter((r) => r.group || !seen.has(r.symbol)))];
|
|
26505
26695
|
}
|
|
26696
|
+
const base = listed(input.hits);
|
|
26506
26697
|
if (input.spreads === false) return base;
|
|
26507
26698
|
const expression = looksLikeSpread(q) && !isSymbolPair(q);
|
|
26508
26699
|
if (expression) {
|
|
26509
26700
|
const expr = spreadExpression(q);
|
|
26510
|
-
if (!
|
|
26701
|
+
if (!input.hits.some((r) => r.symbol.toUpperCase() === expr)) base.unshift({ row: { symbol: expr, name: expr, exchange: "", type: "spread" }, added: addedSet.has(expr) });
|
|
26511
26702
|
} else if (looksLikeSpread(q) && !input.loading && base.length === 0) {
|
|
26512
26703
|
const expr = spreadExpression(q);
|
|
26513
26704
|
base.push({ row: { symbol: expr, name: expr, exchange: "", type: "spread" }, added: addedSet.has(expr) });
|
|
@@ -26540,6 +26731,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26540
26731
|
const offerOps = operators.length > 0;
|
|
26541
26732
|
let active = request.changeFrom ? 0 : -1;
|
|
26542
26733
|
let rows2 = [];
|
|
26734
|
+
const openGroups = /* @__PURE__ */ new Set();
|
|
26543
26735
|
let opsOpen = false;
|
|
26544
26736
|
let observer = null;
|
|
26545
26737
|
let markDisposers = [];
|
|
@@ -26599,6 +26791,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26599
26791
|
for (const { row: row2, top } of narrower) row2.hidden = !selection.has(top);
|
|
26600
26792
|
cls = selection.filter();
|
|
26601
26793
|
active = -1;
|
|
26794
|
+
openGroups.clear();
|
|
26602
26795
|
search2().search(serverQuery(), cls);
|
|
26603
26796
|
render();
|
|
26604
26797
|
};
|
|
@@ -26614,6 +26807,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26614
26807
|
scoped = on;
|
|
26615
26808
|
scopeChip?.setAttribute("aria-pressed", String(on));
|
|
26616
26809
|
active = -1;
|
|
26810
|
+
openGroups.clear();
|
|
26617
26811
|
search2().search(serverQuery(), cls);
|
|
26618
26812
|
render();
|
|
26619
26813
|
};
|
|
@@ -26655,6 +26849,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26655
26849
|
input.value = next;
|
|
26656
26850
|
showClear(next !== "");
|
|
26657
26851
|
active = -1;
|
|
26852
|
+
openGroups.clear();
|
|
26658
26853
|
if (compare && next.trim() === "") session2().cancelPending();
|
|
26659
26854
|
else search2().search(serverQuery(), cls);
|
|
26660
26855
|
render();
|
|
@@ -26692,11 +26887,45 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26692
26887
|
for (const seg of matchSegments(text2, serverQuery())) span.appendChild(h("span", { class: seg.hit ? "qc-search-hit" : void 0 }, seg.text));
|
|
26693
26888
|
return span;
|
|
26694
26889
|
};
|
|
26890
|
+
const paintSource = (row2, fallback, cell2) => {
|
|
26891
|
+
const drop = row2.exchange ? deps.painters.venue?.({ exchange: row2.exchange, host: cell2, size: SOURCE_MARK_SIZE }) : row2.dataSource ? deps.painters.dataSource?.({ dataSource: row2.dataSource, host: cell2, size: SOURCE_MARK_SIZE }) : void 0;
|
|
26892
|
+
if (typeof drop === "function") {
|
|
26893
|
+
cell2.dataset.qcHost = "true";
|
|
26894
|
+
markDisposers.push(drop);
|
|
26895
|
+
} else cell2.textContent = fallback.charAt(0).toUpperCase();
|
|
26896
|
+
};
|
|
26897
|
+
const groupPill = (key, others, open2) => {
|
|
26898
|
+
const pill = h(
|
|
26899
|
+
"button",
|
|
26900
|
+
{ type: "button", class: "qc-search-more", "aria-expanded": String(open2), "data-symbol-group": key },
|
|
26901
|
+
h("span", { class: "qc-search-more-count" }, "+" + new Intl.NumberFormat(deps.i18n.tag()).format(others)),
|
|
26902
|
+
h("span", { class: "qc-search-more-chevron", "aria-hidden": "true" }, deps.icons.glyph(open2 ? ICONS.chevronUp : ICONS.chevronDown, { size: 16 }))
|
|
26903
|
+
);
|
|
26904
|
+
name(pill, t("search.moreListings", { count: others }));
|
|
26905
|
+
pill.addEventListener("mousedown", (e) => e.preventDefault());
|
|
26906
|
+
pill.addEventListener("click", (e) => {
|
|
26907
|
+
e.stopPropagation();
|
|
26908
|
+
toggleGroup(key);
|
|
26909
|
+
});
|
|
26910
|
+
return pill;
|
|
26911
|
+
};
|
|
26912
|
+
const rowKind = (entry) => entry.nested ? "nested" : entry.members ? "group" : "row";
|
|
26913
|
+
const toggleGroup = (key) => {
|
|
26914
|
+
const held = active >= 0 ? rows2[active] : void 0;
|
|
26915
|
+
if (!openGroups.delete(key)) openGroups.add(key);
|
|
26916
|
+
render();
|
|
26917
|
+
if (!held) return;
|
|
26918
|
+
const same = rows2.findIndex((r) => r.row === held.row && rowKind(r) === rowKind(held));
|
|
26919
|
+
const at2 = same >= 0 ? same : rows2.findIndex((r) => r.members !== void 0 && r.row.group === key);
|
|
26920
|
+
if (at2 >= 0) setActive(at2);
|
|
26921
|
+
};
|
|
26695
26922
|
const render = () => {
|
|
26923
|
+
const held = document.activeElement;
|
|
26924
|
+
const heldPill = held instanceof HTMLElement && held.classList.contains("qc-search-more") && list.contains(held) ? held.dataset.symbolGroup : void 0;
|
|
26696
26925
|
releaseMarks();
|
|
26697
26926
|
const state = search2().state();
|
|
26698
26927
|
const settled = state.query.trim() === serverQuery().trim();
|
|
26699
|
-
rows2 = dialogRows({ mode, query, hits: settled ? state.hits : [], loading: state.loading || !settled, recents: recentRows(), curated: deps.curated ?? [], added: chart?.compare.list() ?? [], spreads });
|
|
26928
|
+
rows2 = dialogRows({ mode, query, hits: settled ? state.hits : [], loading: state.loading || !settled, recents: recentRows(), curated: deps.curated ?? [], added: chart?.compare.list() ?? [], spreads, open: openGroups });
|
|
26700
26929
|
active = Math.min(active, rows2.length - 1);
|
|
26701
26930
|
const emptyStack = compare && query.trim() === "";
|
|
26702
26931
|
const addedCount = emptyStack ? chart?.compare.list().length ?? 0 : 0;
|
|
@@ -26706,15 +26935,26 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26706
26935
|
if (emptyStack && i === addedCount && rows2.length > addedCount) children.push(h("div", { class: "qc-dialog-heading", role: "presentation" }, t("search.recent")));
|
|
26707
26936
|
const r = entry.row;
|
|
26708
26937
|
const label3 = rowLabels(r);
|
|
26709
|
-
const option = h("div", {
|
|
26710
|
-
|
|
26711
|
-
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26715
|
-
|
|
26716
|
-
|
|
26717
|
-
|
|
26938
|
+
const option = h("div", {
|
|
26939
|
+
class: entry.nested ? "qc-search-row qc-search-row--nested" : "qc-search-row",
|
|
26940
|
+
role: "option",
|
|
26941
|
+
id: rowId(i),
|
|
26942
|
+
"aria-selected": String(i === active),
|
|
26943
|
+
"data-symbol-row": r.symbol,
|
|
26944
|
+
"data-symbol-group": entry.members ? r.group : void 0,
|
|
26945
|
+
"data-qc-panel": entry.panel,
|
|
26946
|
+
tabindex: "-1"
|
|
26947
|
+
});
|
|
26948
|
+
if (!entry.nested) {
|
|
26949
|
+
const mark = createSymbolBadge(label3.ticker);
|
|
26950
|
+
mark.element.replaceChildren();
|
|
26951
|
+
const dropMark = deps.painters.symbol?.({ symbol: r.symbol, host: mark.element, size: ROW_MARK_SIZE2 });
|
|
26952
|
+
if (typeof dropMark === "function") {
|
|
26953
|
+
mark.element.dataset.qcHost = "true";
|
|
26954
|
+
markDisposers.push(dropMark);
|
|
26955
|
+
} else mark.set(label3.ticker);
|
|
26956
|
+
option.appendChild(mark.element);
|
|
26957
|
+
}
|
|
26718
26958
|
option.appendChild(
|
|
26719
26959
|
h(
|
|
26720
26960
|
"span",
|
|
@@ -26724,19 +26964,22 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26724
26964
|
)
|
|
26725
26965
|
);
|
|
26726
26966
|
if (compare && entry.added) {
|
|
26727
|
-
const
|
|
26728
|
-
|
|
26729
|
-
option.appendChild(
|
|
26967
|
+
const mark = h("span", { class: "qc-search-added", title: t("search.addedMark", { symbol: label3.ticker }) });
|
|
26968
|
+
mark.appendChild(deps.icons.glyph(ICONS.check, { size: 18 }));
|
|
26969
|
+
option.appendChild(mark);
|
|
26730
26970
|
} else {
|
|
26731
26971
|
const source3 = h("span", { class: "qc-search-source" });
|
|
26972
|
+
if (label3.source) source3.appendChild(h("span", { class: "qc-search-exchange" }, label3.source));
|
|
26973
|
+
if (entry.members && r.group) source3.appendChild(groupPill(r.group, entry.members.length - 1, entry.open === true));
|
|
26732
26974
|
if (label3.source) {
|
|
26733
|
-
const sourceMark = h("span", { class: "qc-search-mark",
|
|
26734
|
-
|
|
26735
|
-
|
|
26736
|
-
|
|
26737
|
-
|
|
26738
|
-
|
|
26739
|
-
|
|
26975
|
+
const sourceMark = h("span", { class: "qc-search-mark", "aria-hidden": "true", title: label3.source });
|
|
26976
|
+
paintSource(r, label3.source, sourceMark);
|
|
26977
|
+
const venues = entry.members ? new Set(entry.members.map((m) => m.exchange).filter((x) => x !== "")) : null;
|
|
26978
|
+
if (venues && venues.size > 1) {
|
|
26979
|
+
const pile = h("span", { class: "qc-search-pile" });
|
|
26980
|
+
pile.append(pileEdges(), sourceMark);
|
|
26981
|
+
source3.appendChild(pile);
|
|
26982
|
+
} else source3.appendChild(sourceMark);
|
|
26740
26983
|
}
|
|
26741
26984
|
option.appendChild(source3);
|
|
26742
26985
|
if (compare) {
|
|
@@ -26767,6 +27010,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26767
27010
|
children.push(empty);
|
|
26768
27011
|
}
|
|
26769
27012
|
replace(list, ...children);
|
|
27013
|
+
if (heldPill !== void 0) [...list.querySelectorAll(".qc-search-more")].find((p) => p.dataset.symbolGroup === heldPill)?.focus({ preventScroll: true });
|
|
26770
27014
|
if (!emptyStack && settled && !state.loading && !state.failed && state.hasMore && rows2.length > 0) {
|
|
26771
27015
|
sentinel.hidden = false;
|
|
26772
27016
|
list.appendChild(sentinel);
|
|
@@ -29471,7 +29715,7 @@ function createSettingsForm(page, deps) {
|
|
|
29471
29715
|
}
|
|
29472
29716
|
|
|
29473
29717
|
// src/ui/settings/pages.ts
|
|
29474
|
-
var
|
|
29718
|
+
var LINE_WIDTHS = [1, 2, 3, 4];
|
|
29475
29719
|
var PRICE_SOURCES3 = [
|
|
29476
29720
|
{ value: "open", key: "settings.sourceOpen" },
|
|
29477
29721
|
{ value: "high", key: "settings.sourceHigh" },
|
|
@@ -29560,14 +29804,14 @@ function lineRows(form, ctx, section) {
|
|
|
29560
29804
|
if (s.colorType === "gradient") {
|
|
29561
29805
|
c.color({ color: s.gradientTopColor, onColor: (gradientTopColor) => set2({ gradientTopColor }), opacity: true, label: t("settings.topColorOf", { name: name2 }) });
|
|
29562
29806
|
c.color({ color: s.gradientBottomColor, onColor: (gradientBottomColor) => set2({ gradientBottomColor }), opacity: true, label: t("settings.bottomColorOf", { name: name2 }) });
|
|
29563
|
-
c.lineWidth({ value: s.lineWidth, options:
|
|
29807
|
+
c.lineWidth({ value: s.lineWidth, options: LINE_WIDTHS, onChange: (lineWidth) => set2({ lineWidth }) });
|
|
29564
29808
|
return;
|
|
29565
29809
|
}
|
|
29566
29810
|
c.color({
|
|
29567
29811
|
color: s.color,
|
|
29568
29812
|
onColor: (color2) => set2({ color: color2 }),
|
|
29569
29813
|
opacity: true,
|
|
29570
|
-
lineWidth: { value: s.lineWidth, options:
|
|
29814
|
+
lineWidth: { value: s.lineWidth, options: LINE_WIDTHS, onChange: (lineWidth) => set2({ lineWidth }) },
|
|
29571
29815
|
lineStyle: { value: s.lineStyle, onChange: (lineStyle2) => set2({ lineStyle: lineStyle2 }) }
|
|
29572
29816
|
});
|
|
29573
29817
|
}
|
|
@@ -29611,7 +29855,7 @@ function symbolPage(form, ctx) {
|
|
|
29611
29855
|
color: s.lineColor,
|
|
29612
29856
|
onColor: (lineColor) => set2({ lineColor }),
|
|
29613
29857
|
opacity: true,
|
|
29614
|
-
lineWidth: { value: s.lineWidth, options:
|
|
29858
|
+
lineWidth: { value: s.lineWidth, options: LINE_WIDTHS, onChange: (lineWidth) => set2({ lineWidth }) },
|
|
29615
29859
|
lineStyle: { value: s.lineStyle, onChange: (lineStyle2) => set2({ lineStyle: lineStyle2 }) }
|
|
29616
29860
|
})
|
|
29617
29861
|
});
|
|
@@ -29634,12 +29878,12 @@ function symbolPage(form, ctx) {
|
|
|
29634
29878
|
form.field({
|
|
29635
29879
|
id: "topLine",
|
|
29636
29880
|
label: t("settings.topLine"),
|
|
29637
|
-
controls: (c) => c.color({ color: s.topLineColor, onColor: (topLineColor) => set2({ topLineColor }), opacity: true, lineWidth: { value: s.topLineWidth, options:
|
|
29881
|
+
controls: (c) => c.color({ color: s.topLineColor, onColor: (topLineColor) => set2({ topLineColor }), opacity: true, lineWidth: { value: s.topLineWidth, options: LINE_WIDTHS, onChange: (topLineWidth) => set2({ topLineWidth }) } })
|
|
29638
29882
|
});
|
|
29639
29883
|
form.field({
|
|
29640
29884
|
id: "bottomLine",
|
|
29641
29885
|
label: t("settings.bottomLine"),
|
|
29642
|
-
controls: (c) => c.color({ color: s.bottomLineColor, onColor: (bottomLineColor) => set2({ bottomLineColor }), opacity: true, lineWidth: { value: s.bottomLineWidth, options:
|
|
29886
|
+
controls: (c) => c.color({ color: s.bottomLineColor, onColor: (bottomLineColor) => set2({ bottomLineColor }), opacity: true, lineWidth: { value: s.bottomLineWidth, options: LINE_WIDTHS, onChange: (bottomLineWidth) => set2({ bottomLineWidth }) } })
|
|
29643
29887
|
});
|
|
29644
29888
|
const top = t("settings.fillTopArea");
|
|
29645
29889
|
form.field({
|
|
@@ -29804,7 +30048,7 @@ function scalesPage(form, ctx) {
|
|
|
29804
30048
|
c.color({
|
|
29805
30049
|
color: labels.symbolLineColor,
|
|
29806
30050
|
onColor: (symbolLineColor) => setLabels({ symbolLineColor }),
|
|
29807
|
-
lineWidth: { value: labels.symbolLineWidth, options:
|
|
30051
|
+
lineWidth: { value: labels.symbolLineWidth, options: LINE_WIDTHS, onChange: (symbolLineWidth) => setLabels({ symbolLineWidth }) },
|
|
29808
30052
|
disabled: !labels.symbolName && !labels.symbolValue && !labels.symbolLine
|
|
29809
30053
|
});
|
|
29810
30054
|
c.nextLine();
|
|
@@ -29871,7 +30115,7 @@ function scalesPage(form, ctx) {
|
|
|
29871
30115
|
color: labels.previousCloseColor,
|
|
29872
30116
|
onColor: (previousCloseColor) => setLabels({ previousCloseColor }),
|
|
29873
30117
|
opacity: true,
|
|
29874
|
-
lineWidth: { value: labels.previousCloseLineWidth, options:
|
|
30118
|
+
lineWidth: { value: labels.previousCloseLineWidth, options: LINE_WIDTHS, onChange: (previousCloseLineWidth) => setLabels({ previousCloseLineWidth }) },
|
|
29875
30119
|
disabled: !labels.previousCloseValue && !labels.previousCloseLine
|
|
29876
30120
|
});
|
|
29877
30121
|
}
|
|
@@ -29891,7 +30135,7 @@ function scalesPage(form, ctx) {
|
|
|
29891
30135
|
c.color({
|
|
29892
30136
|
color: labels.highLowColor,
|
|
29893
30137
|
onColor: (highLowColor) => setLabels({ highLowColor }),
|
|
29894
|
-
lineWidth: { value: labels.highLowLineWidth, options:
|
|
30138
|
+
lineWidth: { value: labels.highLowLineWidth, options: LINE_WIDTHS, onChange: (highLowLineWidth) => setLabels({ highLowLineWidth }) },
|
|
29895
30139
|
disabled: !labels.highLowValue && !labels.highLowLine
|
|
29896
30140
|
});
|
|
29897
30141
|
}
|
|
@@ -29991,7 +30235,7 @@ function canvasPage(form, ctx) {
|
|
|
29991
30235
|
color: s.crosshairColor,
|
|
29992
30236
|
onColor: (crosshairColor) => set2({ crosshairColor }),
|
|
29993
30237
|
opacity: true,
|
|
29994
|
-
lineWidth: { value: s.crosshairWidth, options:
|
|
30238
|
+
lineWidth: { value: s.crosshairWidth, options: LINE_WIDTHS, onChange: (crosshairWidth) => set2({ crosshairWidth }) },
|
|
29995
30239
|
lineStyle: style(s.crosshairStyle, (crosshairStyle) => set2({ crosshairStyle }))
|
|
29996
30240
|
})
|
|
29997
30241
|
});
|
|
@@ -30054,7 +30298,7 @@ function eventsPage(form, ctx) {
|
|
|
30054
30298
|
color: s.sessionBreaksColor,
|
|
30055
30299
|
onColor: (sessionBreaksColor) => set2({ sessionBreaksColor }),
|
|
30056
30300
|
opacity: true,
|
|
30057
|
-
lineWidth: { value: s.sessionBreaksWidth, options:
|
|
30301
|
+
lineWidth: { value: s.sessionBreaksWidth, options: LINE_WIDTHS, onChange: (sessionBreaksWidth) => set2({ sessionBreaksWidth }) },
|
|
30058
30302
|
lineStyle: { value: s.sessionBreaksStyle, onChange: (sessionBreaksStyle) => set2({ sessionBreaksStyle }) }
|
|
30059
30303
|
})
|
|
30060
30304
|
});
|
|
@@ -30083,7 +30327,7 @@ var PAGE_ICONS = {
|
|
|
30083
30327
|
events: ICONS.settingsEvents
|
|
30084
30328
|
};
|
|
30085
30329
|
var EDGE = 20;
|
|
30086
|
-
var
|
|
30330
|
+
var nextDialogId2 = 0;
|
|
30087
30331
|
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
30088
30332
|
function viewerSettings(chart) {
|
|
30089
30333
|
try {
|
|
@@ -30093,7 +30337,7 @@ function viewerSettings(chart) {
|
|
|
30093
30337
|
return {};
|
|
30094
30338
|
}
|
|
30095
30339
|
}
|
|
30096
|
-
var
|
|
30340
|
+
var written2 = (partial) => JSON.stringify(
|
|
30097
30341
|
Object.keys(partial).sort().map((section) => {
|
|
30098
30342
|
const leaves = partial[section];
|
|
30099
30343
|
return [section, Object.keys(leaves).sort().map((leaf) => [leaf, leaves[leaf]])];
|
|
@@ -30109,7 +30353,7 @@ function guarded(run) {
|
|
|
30109
30353
|
}
|
|
30110
30354
|
function createChartSettingsDialog(deps) {
|
|
30111
30355
|
const t = () => deps.i18n.t;
|
|
30112
|
-
const dialogId = ++
|
|
30356
|
+
const dialogId = ++nextDialogId2;
|
|
30113
30357
|
const listeners = /* @__PURE__ */ new Set();
|
|
30114
30358
|
let session2 = null;
|
|
30115
30359
|
const tell = (open3) => {
|
|
@@ -30284,7 +30528,7 @@ function createChartSettingsDialog(deps) {
|
|
|
30284
30528
|
};
|
|
30285
30529
|
const restore = (s) => {
|
|
30286
30530
|
const chart = s.chart;
|
|
30287
|
-
if (
|
|
30531
|
+
if (written2(viewerSettings(chart)) !== written2(s.initial.settings)) {
|
|
30288
30532
|
chart.resetSettings();
|
|
30289
30533
|
if (holdsLeaves(s.initial.settings)) chart.applySettings(s.initial.settings);
|
|
30290
30534
|
}
|
|
@@ -30696,11 +30940,11 @@ function mountChrome(deps) {
|
|
|
30696
30940
|
request
|
|
30697
30941
|
});
|
|
30698
30942
|
};
|
|
30699
|
-
deps.doors.openIndicatorSettings = (chart, instanceId) => {
|
|
30943
|
+
deps.doors.openIndicatorSettings = (chart, instanceId, session2) => {
|
|
30700
30944
|
if (!ui.indicatorSettings) return false;
|
|
30701
30945
|
const instance = chart.indicators.get().find((i) => i.id === instanceId);
|
|
30702
30946
|
if (!instance) return false;
|
|
30703
|
-
openIndicatorSettings({ ...ctx, chart, instance });
|
|
30947
|
+
openIndicatorSettings({ ...ctx, chart, instance, session: session2 });
|
|
30704
30948
|
return true;
|
|
30705
30949
|
};
|
|
30706
30950
|
if (deps.drawingToolbarContainer && ui.drawingToolbar) {
|