@trdrs/quickcharts 5.8.0 → 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 +10 -0
- package/README.md +101 -5
- 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 +54 -8
- package/dist/index.js +959 -782
- 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 +172 -93
- 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;
|
|
@@ -17592,6 +17554,7 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17592
17554
|
const groups = /* @__PURE__ */ new Map();
|
|
17593
17555
|
chipRows.dataset.legendPane = "0";
|
|
17594
17556
|
let paneTops = {};
|
|
17557
|
+
let hiddenPanes = /* @__PURE__ */ new Set();
|
|
17595
17558
|
const rows2 = /* @__PURE__ */ new Map();
|
|
17596
17559
|
const groupFor = (pane) => {
|
|
17597
17560
|
if (pane === mainPane) return chipRows;
|
|
@@ -17634,16 +17597,12 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17634
17597
|
const r = gear.getBoundingClientRect();
|
|
17635
17598
|
controls.onSettings?.(chip.id, { x: r.x, y: r.y, w: r.width, h: r.height });
|
|
17636
17599
|
});
|
|
17637
|
-
const moveUp = chipButton(controls.icons.glyph(ICONS.paneUp, { size: 18 }), "", () => controls.onPaneMove?.(chip.id, "up"));
|
|
17638
|
-
const moveDown = chipButton(controls.icons.glyph(ICONS.paneDown, { size: 18 }), "", () => controls.onPaneMove?.(chip.id, "down"));
|
|
17639
|
-
const collapse = chipButton("", "", () => controls.onPaneOp?.(chip.id, chip.collapsed ? "restore" : "collapse"));
|
|
17640
|
-
const maximize = chipButton(controls.icons.glyph(ICONS.paneMaximize, { size: 18 }), "", () => controls.onPaneOp?.(chip.id, chip.maximized ? "restore" : "maximize"));
|
|
17641
17600
|
const eye2 = chipButton("", "", () => controls.onToggleEye(chip.id));
|
|
17642
17601
|
eye2.classList.add("qc-legend-eye");
|
|
17643
17602
|
const remove = chipButton(controls.icons.glyph(ICONS.trash, { size: 18 }), "", () => controls.onRemove?.(chip.id));
|
|
17644
17603
|
const actions2 = document.createElement("span");
|
|
17645
17604
|
actions2.className = "qc-legend-actions";
|
|
17646
|
-
actions2.append(eye2, gear,
|
|
17605
|
+
actions2.append(eye2, gear, remove);
|
|
17647
17606
|
const nameButton = (button3, text2) => {
|
|
17648
17607
|
button3.title = text2;
|
|
17649
17608
|
button3.setAttribute("aria-label", text2);
|
|
@@ -17693,16 +17652,6 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17693
17652
|
else delete value.dataset.qcTone;
|
|
17694
17653
|
gear.hidden = !chip.hasInputs || !controls.onSettings;
|
|
17695
17654
|
nameButton(gear, chip.settingsLabel ?? strings.t("legend.indicatorSettings"));
|
|
17696
|
-
moveUp.hidden = !chip.pane || !controls.onPaneMove || chip.hidden || !chip.canMoveUp;
|
|
17697
|
-
moveDown.hidden = !chip.pane || !controls.onPaneMove || chip.hidden || !chip.canMoveDown;
|
|
17698
|
-
nameButton(moveUp, strings.t("legend.movePaneUp"));
|
|
17699
|
-
nameButton(moveDown, strings.t("legend.movePaneDown"));
|
|
17700
|
-
collapse.hidden = !chip.pane || !controls.onPaneOp || chip.hidden;
|
|
17701
|
-
collapse.replaceChildren(controls.icons.glyph(chip.collapsed ? ICONS.paneRestore : ICONS.paneCollapse, { size: 18 }));
|
|
17702
|
-
nameButton(collapse, strings.t(chip.collapsed ? "legend.restorePane" : "legend.collapsePane"));
|
|
17703
|
-
maximize.hidden = collapse.hidden || !!chip.collapsed;
|
|
17704
|
-
nameButton(maximize, strings.t(chip.maximized ? "legend.restorePane" : "legend.maximizePane"));
|
|
17705
|
-
maximize.setAttribute("aria-pressed", String(chip.maximized === true));
|
|
17706
17655
|
const eyeState = String(chip.hidden);
|
|
17707
17656
|
if (eye2.dataset.hidden !== eyeState) {
|
|
17708
17657
|
eye2.replaceChildren(controls.icons.glyph(chip.hidden ? ICONS.legendEyeOff : ICONS.legendEye, { size: 18 }));
|
|
@@ -17758,7 +17707,11 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17758
17707
|
const origin = paneTops[mainPane] ?? 0;
|
|
17759
17708
|
if (origin > 0) root.style.setProperty("--qcd-legend-top", `${origin}px`);
|
|
17760
17709
|
else root.style.removeProperty("--qcd-legend-top");
|
|
17761
|
-
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));
|
|
17762
17715
|
};
|
|
17763
17716
|
let fit = INITIAL_LEGEND_FIT;
|
|
17764
17717
|
let valueShaped2 = false;
|
|
@@ -17945,6 +17898,10 @@ function mountChartLegend(container, strings, controls) {
|
|
|
17945
17898
|
paneTops = tops;
|
|
17946
17899
|
placeGroups();
|
|
17947
17900
|
},
|
|
17901
|
+
setHiddenPanes(panes) {
|
|
17902
|
+
hiddenPanes = panes;
|
|
17903
|
+
placeGroups();
|
|
17904
|
+
},
|
|
17948
17905
|
setSlotRows(elements) {
|
|
17949
17906
|
const keep = new Set(elements);
|
|
17950
17907
|
for (const [element, slot] of slotOf) {
|
|
@@ -18257,11 +18214,11 @@ var CONTROL_ICONS = byMeaning({
|
|
|
18257
18214
|
visible: [ICONS.legendEye],
|
|
18258
18215
|
hidden: [ICONS.legendEyeOff],
|
|
18259
18216
|
collapse: [ICONS.legendChevron],
|
|
18260
|
-
paneCollapse: [ICONS.
|
|
18261
|
-
paneRestore: [ICONS.
|
|
18262
|
-
paneMaximize: [ICONS.
|
|
18263
|
-
paneMoveUp: [ICONS.
|
|
18264
|
-
paneMoveDown: [ICONS.
|
|
18217
|
+
paneCollapse: [ICONS.paneCollapse15],
|
|
18218
|
+
paneRestore: [ICONS.paneExpand15],
|
|
18219
|
+
paneMaximize: [ICONS.paneMaximize15],
|
|
18220
|
+
paneMoveUp: [ICONS.paneUp15],
|
|
18221
|
+
paneMoveDown: [ICONS.paneDown15],
|
|
18265
18222
|
marketStatus: [ICONS.marketStatus],
|
|
18266
18223
|
replayStatus: [ICONS.replayStatus],
|
|
18267
18224
|
replayMark: [ICONS.replayMark],
|
|
@@ -18277,7 +18234,7 @@ var CONTROL_ICONS = byMeaning({
|
|
|
18277
18234
|
check: [ICONS.check],
|
|
18278
18235
|
close: [ICONS.close, ICONS.closeThin, ICONS.dialogClose],
|
|
18279
18236
|
remove: [ICONS.close18, ICONS.removeRow],
|
|
18280
|
-
delete: [ICONS.trash, ICONS.trash28],
|
|
18237
|
+
delete: [ICONS.trash, ICONS.trash28, ICONS.trash15],
|
|
18281
18238
|
add: [ICONS.plus, ICONS.plusThin],
|
|
18282
18239
|
bold: [ICONS.textBold],
|
|
18283
18240
|
italic: [ICONS.textItalic],
|
|
@@ -18503,60 +18460,126 @@ function createIconResolver(deps) {
|
|
|
18503
18460
|
};
|
|
18504
18461
|
}
|
|
18505
18462
|
|
|
18506
|
-
// src/
|
|
18507
|
-
var
|
|
18508
|
-
function
|
|
18509
|
-
const
|
|
18510
|
-
|
|
18511
|
-
|
|
18512
|
-
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
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);
|
|
18529
18490
|
} else {
|
|
18530
|
-
const
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
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);
|
|
18541
18505
|
}
|
|
18542
|
-
return
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
};
|
|
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;
|
|
18559
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 }) };
|
|
18580
|
+
}
|
|
18581
|
+
|
|
18582
|
+
// src/inputsEditor.ts
|
|
18560
18583
|
function openInputsEditor(container, rect, inputs2, current, onApply, strings = createChartI18n()) {
|
|
18561
18584
|
const icons = createIconResolver({ document: container.ownerDocument, direction: () => readingDirection(strings), diagnostics: createIconDiagnostics() });
|
|
18562
18585
|
mountInputsEditor(container, rect, inputs2, current, onApply, strings, icons);
|
|
@@ -18570,14 +18593,34 @@ function mountInputsEditor(container, rect, inputs2, current, onApply, strings,
|
|
|
18570
18593
|
el2.style.left = `${Math.max(4, rect.x - host2.left)}px`;
|
|
18571
18594
|
el2.style.top = `${Math.max(4, rect.y - host2.top + rect.h + 4)}px`;
|
|
18572
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);
|
|
18573
18618
|
const dismiss = () => {
|
|
18574
18619
|
unsubscribe();
|
|
18575
18620
|
el2.remove();
|
|
18576
18621
|
};
|
|
18577
|
-
const fields = buildInputFields(icons, inputs2, current);
|
|
18578
|
-
for (const row2 of fields.rows) el2.appendChild(row2);
|
|
18579
18622
|
const apply = () => {
|
|
18580
|
-
onApply(
|
|
18623
|
+
onApply(Object.fromEntries(Object.keys(inputs2).map((key) => [key, values[key]])));
|
|
18581
18624
|
dismiss();
|
|
18582
18625
|
};
|
|
18583
18626
|
const buttons = document.createElement("div");
|
|
@@ -18601,11 +18644,13 @@ function mountInputsEditor(container, rect, inputs2, current, onApply, strings,
|
|
|
18601
18644
|
});
|
|
18602
18645
|
el2.addEventListener("keydown", (e) => {
|
|
18603
18646
|
e.stopPropagation();
|
|
18604
|
-
if (e.key === "Enter")
|
|
18605
|
-
|
|
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();
|
|
18606
18651
|
});
|
|
18607
18652
|
container.appendChild(el2);
|
|
18608
|
-
|
|
18653
|
+
page.querySelector("input.qc-field:not(:disabled), button:not(:disabled)")?.focus?.();
|
|
18609
18654
|
}
|
|
18610
18655
|
|
|
18611
18656
|
// src/ui/chrome/menu.ts
|
|
@@ -18926,13 +18971,13 @@ function attachLegendPlane(deps) {
|
|
|
18926
18971
|
let hovered = null;
|
|
18927
18972
|
let named2 = null;
|
|
18928
18973
|
let namedTimeframe = null;
|
|
18929
|
-
let
|
|
18974
|
+
let written3 = "";
|
|
18930
18975
|
const writeIdentity = () => {
|
|
18931
18976
|
if (named2 === null || namedTimeframe === null) return;
|
|
18932
18977
|
const identity = legendIdentity(named2, deps.symbolInfo(), namedTimeframe, deps.settings().statusLine.titleSource);
|
|
18933
18978
|
const key = JSON.stringify(identity);
|
|
18934
|
-
if (key ===
|
|
18935
|
-
|
|
18979
|
+
if (key === written3) return;
|
|
18980
|
+
written3 = key;
|
|
18936
18981
|
legend2?.setIdentity(identity);
|
|
18937
18982
|
};
|
|
18938
18983
|
legend2 = mountChartLegend(deps.chrome, deps.i18n, {
|
|
@@ -18992,18 +19037,6 @@ function attachLegendPlane(deps) {
|
|
|
18992
19037
|
deps.i18n,
|
|
18993
19038
|
deps.icons
|
|
18994
19039
|
);
|
|
18995
|
-
},
|
|
18996
|
-
onPaneOp: (id, op) => {
|
|
18997
|
-
const paneIdx = deps.indicators.renderer.paneOf()[id];
|
|
18998
|
-
if (paneIdx === void 0 || paneIdx === deps.paneOps.main()) return;
|
|
18999
|
-
deps.paneOps.run(paneIdx, op);
|
|
19000
|
-
},
|
|
19001
|
-
// A move is a command, as the pane's own buttons run it, so the policy that refuses it refuses
|
|
19002
|
-
// it here too.
|
|
19003
|
-
onPaneMove: (id, direction) => {
|
|
19004
|
-
const paneIdx = deps.indicators.renderer.paneOf()[id];
|
|
19005
|
-
if (paneIdx === void 0 || paneIdx === deps.paneOps.main()) return;
|
|
19006
|
-
deps.commands.execute(PANE_MOVE_COMMAND[direction], paneIdx);
|
|
19007
19040
|
}
|
|
19008
19041
|
});
|
|
19009
19042
|
function reading() {
|
|
@@ -19049,20 +19082,15 @@ function attachLegendPlane(deps) {
|
|
|
19049
19082
|
const paneOf = deps.indicators.renderer.paneOf();
|
|
19050
19083
|
const main = deps.paneOps.main();
|
|
19051
19084
|
legend2?.setMainPane(main);
|
|
19085
|
+
legend2?.setHiddenPanes(new Set(deps.chart.panes().flatMap((_, index) => deps.paneOps.hidden(index) ? [index] : [])));
|
|
19052
19086
|
const shown2 = (command2) => deps.shown?.(command2) ?? true;
|
|
19053
|
-
const moves = { up: shown2(PANE_MOVE_COMMAND.up), down: shown2(PANE_MOVE_COMMAND.down) };
|
|
19054
19087
|
legend2?.setChips([
|
|
19055
19088
|
...deps.indicators.chipsAt(hovered).map((row2) => {
|
|
19056
19089
|
const paneIndex = paneOf[row2.id] ?? main;
|
|
19057
|
-
const remembered = deps.paneOps.remembered(indicatorPaneKey(row2.id));
|
|
19058
|
-
const own = row2.pane === true && paneIndex !== main;
|
|
19059
19090
|
return {
|
|
19060
19091
|
...row2,
|
|
19061
19092
|
indicator: true,
|
|
19062
19093
|
paneIndex,
|
|
19063
|
-
maximized: remembered !== void 0 && !row2.collapsed && (deps.chart.panes()[paneIndex]?.getHeight() ?? 0) > remembered,
|
|
19064
|
-
canMoveUp: own && moves.up && deps.paneOps.canMove(paneIndex, "up"),
|
|
19065
|
-
canMoveDown: own && moves.down && deps.paneOps.canMove(paneIndex, "down"),
|
|
19066
19094
|
...shown2(row2.hidden ? "chart.indicators.show" : "chart.indicators.hide") ? {} : { hideable: false },
|
|
19067
19095
|
...shown2("chart.indicators.remove") ? {} : { removable: false }
|
|
19068
19096
|
};
|
|
@@ -21001,7 +21029,7 @@ var INSET = 4;
|
|
|
21001
21029
|
var BUTTONS = [
|
|
21002
21030
|
{ action: "moveUp", icon: ICONS.paneUp15, label: "legend.movePaneUp" },
|
|
21003
21031
|
{ action: "moveDown", icon: ICONS.paneDown15, label: "legend.movePaneDown" },
|
|
21004
|
-
{ action: "delete", icon: ICONS.
|
|
21032
|
+
{ action: "delete", icon: ICONS.trash15, label: "chrome.deletePane" },
|
|
21005
21033
|
{ action: "collapse", icon: ICONS.paneCollapse15, label: "legend.collapsePane" },
|
|
21006
21034
|
{ action: "expand", icon: ICONS.paneExpand15, label: "legend.restorePane" },
|
|
21007
21035
|
{ action: "maximize", icon: ICONS.paneMaximize15, label: "legend.maximizePane" },
|
|
@@ -21009,17 +21037,44 @@ var BUTTONS = [
|
|
|
21009
21037
|
];
|
|
21010
21038
|
function paneActions(pane, count2, permits) {
|
|
21011
21039
|
const out = [];
|
|
21040
|
+
if (pane.hidden) return out;
|
|
21012
21041
|
if (permits.up && pane.index > 0) out.push("moveUp");
|
|
21013
21042
|
if (permits.down && pane.index < count2 - 1) out.push("moveDown");
|
|
21014
21043
|
if (pane.main) {
|
|
21015
21044
|
if (count2 > 1) out.push(pane.maximized ? "restore" : "maximize");
|
|
21016
21045
|
return out;
|
|
21017
21046
|
}
|
|
21047
|
+
if (pane.maximized) {
|
|
21048
|
+
out.push("restore");
|
|
21049
|
+
return out;
|
|
21050
|
+
}
|
|
21018
21051
|
if (permits.remove) out.push("delete");
|
|
21019
21052
|
out.push(pane.collapsed ? "expand" : "collapse");
|
|
21020
|
-
|
|
21053
|
+
out.push("maximize");
|
|
21021
21054
|
return out;
|
|
21022
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
|
+
}
|
|
21023
21078
|
function mountPaneButtons(deps) {
|
|
21024
21079
|
const t = deps.i18n.t;
|
|
21025
21080
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -21054,23 +21109,30 @@ function mountPaneButtons(deps) {
|
|
|
21054
21109
|
const group = groupFor(pane.index);
|
|
21055
21110
|
group.setAttribute("aria-label", t("chrome.paneButtons"));
|
|
21056
21111
|
group.dataset.qcVisibility = visibility;
|
|
21057
|
-
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);
|
|
21058
21116
|
group.style.top = `${Math.round(pane.top + INSET)}px`;
|
|
21059
21117
|
group.style.right = `${Math.round(deps.insetEnd() + INSET)}px`;
|
|
21060
|
-
const
|
|
21061
|
-
if (group.dataset.actions !==
|
|
21062
|
-
group.dataset.actions =
|
|
21118
|
+
const written3 = actions2.join(" ");
|
|
21119
|
+
if (group.dataset.actions !== written3) {
|
|
21120
|
+
group.dataset.actions = written3;
|
|
21063
21121
|
group.replaceChildren(
|
|
21064
21122
|
...actions2.map((action) => {
|
|
21065
21123
|
const spec = BUTTONS.find((entry) => entry.action === action);
|
|
21066
21124
|
const button3 = h("button", { type: "button", class: "qc-pane-button", "data-action": action });
|
|
21067
21125
|
button3.appendChild(deps.icons.glyph(spec.icon, { size: 15 }));
|
|
21068
21126
|
name(button3, t(spec.label));
|
|
21069
|
-
|
|
21127
|
+
const pressed = PRESSED[action];
|
|
21128
|
+
if (pressed !== void 0) button3.setAttribute("aria-pressed", String(pressed));
|
|
21070
21129
|
button3.addEventListener("click", () => {
|
|
21071
21130
|
deps.run(pane.index, action);
|
|
21072
21131
|
sync();
|
|
21073
21132
|
});
|
|
21133
|
+
button3.addEventListener("pointerenter", (event) => {
|
|
21134
|
+
if (event.pointerType !== "touch") stir(button3, action);
|
|
21135
|
+
});
|
|
21074
21136
|
return button3;
|
|
21075
21137
|
})
|
|
21076
21138
|
);
|
|
@@ -21101,8 +21163,8 @@ function mountPaneButtons(deps) {
|
|
|
21101
21163
|
hovered = null;
|
|
21102
21164
|
sync();
|
|
21103
21165
|
};
|
|
21104
|
-
deps.
|
|
21105
|
-
deps.
|
|
21166
|
+
deps.hoverRoot.addEventListener("pointermove", onMove);
|
|
21167
|
+
deps.hoverRoot.addEventListener("pointerleave", onLeave);
|
|
21106
21168
|
const offStrings = deps.i18n.onChange(() => {
|
|
21107
21169
|
for (const group of groups.values()) delete group.dataset.actions;
|
|
21108
21170
|
sync();
|
|
@@ -21112,8 +21174,8 @@ function mountPaneButtons(deps) {
|
|
|
21112
21174
|
sync,
|
|
21113
21175
|
destroy() {
|
|
21114
21176
|
offStrings();
|
|
21115
|
-
deps.
|
|
21116
|
-
deps.
|
|
21177
|
+
deps.hoverRoot.removeEventListener("pointermove", onMove);
|
|
21178
|
+
deps.hoverRoot.removeEventListener("pointerleave", onLeave);
|
|
21117
21179
|
for (const group of groups.values()) group.remove();
|
|
21118
21180
|
groups.clear();
|
|
21119
21181
|
}
|
|
@@ -22264,16 +22326,16 @@ function attachPriceLevels(deps) {
|
|
|
22264
22326
|
}
|
|
22265
22327
|
for (const level of levels) {
|
|
22266
22328
|
const options2 = priceLineOptions(level);
|
|
22267
|
-
const
|
|
22329
|
+
const written3 = JSON.stringify(options2);
|
|
22268
22330
|
const held = drawn2.get(level.key);
|
|
22269
22331
|
if (held) {
|
|
22270
|
-
if (held.options !==
|
|
22332
|
+
if (held.options !== written3) {
|
|
22271
22333
|
held.line.applyOptions(options2);
|
|
22272
|
-
held.options =
|
|
22334
|
+
held.options = written3;
|
|
22273
22335
|
}
|
|
22274
22336
|
continue;
|
|
22275
22337
|
}
|
|
22276
|
-
drawn2.set(level.key, { line: series2.createPriceLine(options2), options:
|
|
22338
|
+
drawn2.set(level.key, { line: series2.createPriceLine(options2), options: written3 });
|
|
22277
22339
|
}
|
|
22278
22340
|
};
|
|
22279
22341
|
return {
|
|
@@ -22323,6 +22385,7 @@ var STYLE_KEY = "quickcharts.style.v1";
|
|
|
22323
22385
|
var SCALE_KEY = "quickcharts.scale.v1";
|
|
22324
22386
|
var PRICE_AXIS_KEY = "quickcharts.priceAxis.v1";
|
|
22325
22387
|
var HIDDEN_KEY = "quickcharts.indHidden.v1";
|
|
22388
|
+
var INDICATOR_DEFAULTS_KEY = "quickcharts.indicatorDefaults.v1";
|
|
22326
22389
|
var REPLAY_SPEED_KEY = "quickcharts.replaySpeed.v1";
|
|
22327
22390
|
var REPLAY_TIMEFRAME_KEY = "quickcharts.replayTf.v1";
|
|
22328
22391
|
var TIMEZONE_KEY = "quickcharts.timezone.v1";
|
|
@@ -22403,10 +22466,12 @@ function createChartInstance(deps) {
|
|
|
22403
22466
|
else chrome2.removeAttribute(CANVAS_INK_ATTRIBUTE);
|
|
22404
22467
|
};
|
|
22405
22468
|
paintChromeCanvas();
|
|
22469
|
+
let paneMaximized = false;
|
|
22406
22470
|
const lookOptions = () => chartLookOptions(eff, canvas(), {
|
|
22407
22471
|
crosshairLabels: deps.ui.crosshairLabels,
|
|
22408
22472
|
crosshairHorizontal: deps.ui.crosshairHorizontal,
|
|
22409
|
-
crosshairSolid: deps.ui.crosshairSolid
|
|
22473
|
+
crosshairSolid: deps.ui.crosshairSolid,
|
|
22474
|
+
dividers: !paneMaximized
|
|
22410
22475
|
});
|
|
22411
22476
|
const look = lookOptions();
|
|
22412
22477
|
let appliedRightOffset = eff.canvas.marginRight;
|
|
@@ -22654,6 +22719,18 @@ function createChartInstance(deps) {
|
|
|
22654
22719
|
scaleControls?.sync();
|
|
22655
22720
|
events.emit("scaleMode", next);
|
|
22656
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
|
+
};
|
|
22657
22734
|
const indicators2 = attachIndicatorsPlane({
|
|
22658
22735
|
chart,
|
|
22659
22736
|
candleSeries,
|
|
@@ -22675,11 +22752,13 @@ function createChartInstance(deps) {
|
|
|
22675
22752
|
syncVolume();
|
|
22676
22753
|
syncScaleSources();
|
|
22677
22754
|
legend2.push();
|
|
22678
|
-
|
|
22755
|
+
syncPanes();
|
|
22679
22756
|
},
|
|
22680
22757
|
onEvent: (event) => events.emit("indicator", event),
|
|
22681
22758
|
catalog: deps.indicatorCatalog,
|
|
22682
|
-
mainPane
|
|
22759
|
+
mainPane,
|
|
22760
|
+
timeframe: () => tf,
|
|
22761
|
+
defaults: indicatorDefaults
|
|
22683
22762
|
});
|
|
22684
22763
|
const session2 = attachSession({
|
|
22685
22764
|
chart,
|
|
@@ -22735,7 +22814,7 @@ function createChartInstance(deps) {
|
|
|
22735
22814
|
onChips: () => {
|
|
22736
22815
|
paneOps.settle();
|
|
22737
22816
|
legend2.push();
|
|
22738
|
-
|
|
22817
|
+
syncPanes();
|
|
22739
22818
|
syncScaleSources();
|
|
22740
22819
|
},
|
|
22741
22820
|
onEvent: (entries) => events.emit("compare", entries)
|
|
@@ -22750,10 +22829,19 @@ function createChartInstance(deps) {
|
|
|
22750
22829
|
moved: () => {
|
|
22751
22830
|
plotArea.refresh();
|
|
22752
22831
|
scaleControls?.sync();
|
|
22753
|
-
|
|
22832
|
+
syncPanes();
|
|
22833
|
+
legend2.push();
|
|
22834
|
+
},
|
|
22835
|
+
maximizing: (on) => {
|
|
22836
|
+
paneMaximized = on;
|
|
22837
|
+
chart.applyOptions({ layout: lookOptions().layout });
|
|
22754
22838
|
legend2.push();
|
|
22755
22839
|
}
|
|
22756
22840
|
});
|
|
22841
|
+
function syncPanes() {
|
|
22842
|
+
paneOps.conceal();
|
|
22843
|
+
paneButtons?.sync();
|
|
22844
|
+
}
|
|
22757
22845
|
function movePane(pane, direction) {
|
|
22758
22846
|
if (disposed || !paneOps.move(pane, direction)) return;
|
|
22759
22847
|
indicators2.recompute();
|
|
@@ -22782,7 +22870,14 @@ function createChartInstance(deps) {
|
|
|
22782
22870
|
valueShaped: () => valueShaped(style),
|
|
22783
22871
|
sessionModel: () => session2.model(),
|
|
22784
22872
|
status: (nowSecs) => session2.status(nowSecs),
|
|
22785
|
-
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
|
+
}),
|
|
22786
22881
|
legendValues: deps.ui.legendValues,
|
|
22787
22882
|
paneOps,
|
|
22788
22883
|
settings: () => eff,
|
|
@@ -22979,7 +23074,7 @@ function createChartInstance(deps) {
|
|
|
22979
23074
|
heightWatch?.observe(gestures);
|
|
22980
23075
|
chart.timeScale().subscribeVisibleLogicalRangeChange(() => {
|
|
22981
23076
|
levels?.refresh();
|
|
22982
|
-
|
|
23077
|
+
syncPanes();
|
|
22983
23078
|
holdRatio();
|
|
22984
23079
|
scaleControls?.sync();
|
|
22985
23080
|
});
|
|
@@ -23154,6 +23249,7 @@ function createChartInstance(deps) {
|
|
|
23154
23249
|
paneButtons = mountPaneButtons({
|
|
23155
23250
|
chrome: chrome2,
|
|
23156
23251
|
gestures,
|
|
23252
|
+
hoverRoot: deps.container,
|
|
23157
23253
|
i18n,
|
|
23158
23254
|
icons: deps.icons,
|
|
23159
23255
|
visibility: () => eff.canvas.paneButtons,
|
|
@@ -23166,7 +23262,8 @@ function createChartInstance(deps) {
|
|
|
23166
23262
|
top: paneTopIn(chart, index, gestures),
|
|
23167
23263
|
height: pane.getHeight(),
|
|
23168
23264
|
collapsed: paneOps.collapsed(index),
|
|
23169
|
-
maximized: paneOps.maximized(index)
|
|
23265
|
+
maximized: paneOps.maximized(index),
|
|
23266
|
+
hidden: paneOps.hidden(index)
|
|
23170
23267
|
}));
|
|
23171
23268
|
},
|
|
23172
23269
|
insetEnd: () => scaleWidth("right"),
|
|
@@ -23324,11 +23421,11 @@ function createChartInstance(deps) {
|
|
|
23324
23421
|
let builtFormatKey = "";
|
|
23325
23422
|
const setSymbolFormat = (format2) => {
|
|
23326
23423
|
symbolFormat = format2;
|
|
23327
|
-
const
|
|
23424
|
+
const written3 = writtenFormat();
|
|
23328
23425
|
builtFormatKey = formatKey();
|
|
23329
|
-
symbolFormatter = createPriceFormatter(
|
|
23426
|
+
symbolFormatter = createPriceFormatter(written3, { locale: i18n.tag() });
|
|
23330
23427
|
applyPriceFormat();
|
|
23331
|
-
drawings2.setPricing(format2 ? minMoveOf(
|
|
23428
|
+
drawings2.setPricing(format2 ? minMoveOf(written3) : null, (price) => symbolFormatter.format(price));
|
|
23332
23429
|
countdown?.refresh();
|
|
23333
23430
|
};
|
|
23334
23431
|
function applyLook() {
|
|
@@ -23378,7 +23475,7 @@ function createChartInstance(deps) {
|
|
|
23378
23475
|
paintChromeCanvas();
|
|
23379
23476
|
scaleControls?.sync();
|
|
23380
23477
|
scalePlus?.refresh();
|
|
23381
|
-
|
|
23478
|
+
syncPanes();
|
|
23382
23479
|
legend2.push();
|
|
23383
23480
|
extensions.host.themeChanged(settingsCanvas(c, eff));
|
|
23384
23481
|
countdown?.restyled();
|
|
@@ -25824,192 +25921,180 @@ function mountBottomBar(deps) {
|
|
|
25824
25921
|
};
|
|
25825
25922
|
}
|
|
25826
25923
|
|
|
25827
|
-
// src/ui/
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
wrap.remove();
|
|
25840
|
-
anchor.setAttribute("aria-expanded", "false");
|
|
25841
|
-
onClosed();
|
|
25842
|
-
};
|
|
25843
|
-
function onKey(event) {
|
|
25844
|
-
if (event.key !== "Escape" || !ownsEscape(escape.token)) return;
|
|
25845
|
-
event.stopPropagation();
|
|
25846
|
-
event.preventDefault();
|
|
25847
|
-
close();
|
|
25848
|
-
anchor.focus({ preventScroll: true });
|
|
25849
|
-
}
|
|
25850
|
-
document.addEventListener("keydown", onKey, true);
|
|
25851
|
-
return close;
|
|
25852
|
-
}
|
|
25853
|
-
|
|
25854
|
-
// src/ui/chrome/indicatorSettings.ts
|
|
25855
|
-
var LINE_WIDTHS = [1, 2, 3, 4];
|
|
25856
|
-
var PRECISIONS2 = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
25857
|
-
var titleOf2 = (key, titles) => titles?.[key] ?? key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (c) => c.toUpperCase());
|
|
25858
|
-
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
|
+
);
|
|
25859
25936
|
function openIndicatorSettings(deps) {
|
|
25860
25937
|
const t = deps.i18n.t;
|
|
25861
|
-
const { instance,
|
|
25938
|
+
const { instance, session: session2 } = deps;
|
|
25862
25939
|
const manifest2 = instance.definition.manifest;
|
|
25863
|
-
const
|
|
25864
|
-
const
|
|
25865
|
-
const
|
|
25866
|
-
let
|
|
25867
|
-
|
|
25868
|
-
|
|
25869
|
-
const
|
|
25870
|
-
|
|
25871
|
-
|
|
25872
|
-
|
|
25873
|
-
|
|
25874
|
-
|
|
25875
|
-
|
|
25876
|
-
|
|
25877
|
-
|
|
25878
|
-
|
|
25879
|
-
|
|
25880
|
-
|
|
25881
|
-
|
|
25882
|
-
onPick: (color2) => {
|
|
25883
|
-
control.update(color2);
|
|
25884
|
-
onChange(color2);
|
|
25885
|
-
},
|
|
25886
|
-
openPanel: (anchor, content, onClosed) => openInlinePanel(anchor, content, anchor.closest(".qc-settings-row") ?? anchor, onClosed)
|
|
25887
|
-
});
|
|
25888
|
-
controls.push(control);
|
|
25889
|
-
return control.element;
|
|
25890
|
-
};
|
|
25891
|
-
const select = (label3, options2, current, onChange) => {
|
|
25892
|
-
const el2 = h("select", { class: "qc-field", "aria-label": label3 });
|
|
25893
|
-
for (const o of options2) el2.appendChild(h("option", { value: o.value, selected: o.value === current }, o.text));
|
|
25894
|
-
el2.addEventListener("change", () => onChange(el2.value));
|
|
25895
|
-
return selectField(el2, deps.icons);
|
|
25896
|
-
};
|
|
25897
|
-
const lineStyleOptions = () => [
|
|
25898
|
-
{ value: "solid", text: t("settings.lineStyleSolid") },
|
|
25899
|
-
{ value: "dashed", text: t("settings.lineStyleDashed") },
|
|
25900
|
-
{ value: "dotted", text: t("settings.lineStyleDotted") }
|
|
25901
|
-
];
|
|
25902
|
-
const stylePage = () => {
|
|
25903
|
-
const page = h("div", { class: "qc-settings-page" });
|
|
25904
|
-
const plots = Object.entries(manifest2.plots);
|
|
25905
|
-
if (plots.length > 0) page.appendChild(h("div", { class: "qc-dialog-heading", role: "presentation" }, t("settings.plots")));
|
|
25906
|
-
for (const [key, spec] of plots) {
|
|
25907
|
-
const label3 = titleOf2(key, builtIn.plotTitles);
|
|
25908
|
-
const ov = overrides.plots?.[key];
|
|
25909
|
-
const row2 = h("div", { class: "qc-settings-row" }, h("span", { class: "qc-field-label" }, label3));
|
|
25910
|
-
row2.appendChild(colorField(t("settings.colorOf", { name: label3 }), ov?.color ?? spec.color ?? instance.color, (hex) => plotOverride(key).color = hex));
|
|
25911
|
-
if (spec.kind === "line" || spec.kind === "area") {
|
|
25912
|
-
row2.appendChild(
|
|
25913
|
-
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))
|
|
25914
|
-
);
|
|
25915
|
-
row2.appendChild(select(t("settings.lineStyleOf", { name: label3 }), lineStyleOptions(), ov?.lineStyle ?? spec.lineStyle ?? "solid", (v) => plotOverride(key).lineStyle = v));
|
|
25916
|
-
}
|
|
25917
|
-
page.appendChild(row2);
|
|
25918
|
-
}
|
|
25919
|
-
const levels = Object.entries(manifest2.levels ?? {});
|
|
25920
|
-
if (levels.length > 0) page.appendChild(h("div", { class: "qc-dialog-heading", role: "presentation" }, t("settings.levels")));
|
|
25921
|
-
for (const [key, spec] of levels) {
|
|
25922
|
-
const label3 = titleOf2(key, builtIn.plotTitles);
|
|
25923
|
-
const ov = overrides.levels?.[key];
|
|
25924
|
-
page.appendChild(
|
|
25925
|
-
h(
|
|
25926
|
-
"div",
|
|
25927
|
-
{ class: "qc-settings-row" },
|
|
25928
|
-
h("span", { class: "qc-field-label" }, label3),
|
|
25929
|
-
colorField(t("settings.colorOf", { name: label3 }), ov?.color ?? spec.color, (hex) => levelOverride(key).color = hex),
|
|
25930
|
-
select(t("settings.lineStyleOf", { name: label3 }), lineStyleOptions(), ov?.lineStyle ?? spec.lineStyle ?? "solid", (v) => levelOverride(key).lineStyle = v)
|
|
25931
|
-
)
|
|
25932
|
-
);
|
|
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();
|
|
25933
25959
|
}
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
|
|
25937
|
-
|
|
25938
|
-
|
|
25939
|
-
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
|
|
25943
|
-
|
|
25944
|
-
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
)
|
|
25948
|
-
);
|
|
25949
|
-
page.appendChild(
|
|
25950
|
-
switchRow({
|
|
25951
|
-
label: t("settings.labelsOnPriceScale"),
|
|
25952
|
-
checked: overrides.display?.labelsOnPriceScale !== false,
|
|
25953
|
-
onChange: (on) => {
|
|
25954
|
-
overrides.display = { ...overrides.display, labelsOnPriceScale: on };
|
|
25955
|
-
}
|
|
25956
|
-
})
|
|
25957
|
-
);
|
|
25958
|
-
return page;
|
|
25959
|
-
};
|
|
25960
|
-
const visibilityPage = () => {
|
|
25961
|
-
const page = h("div", { class: "qc-settings-page" });
|
|
25962
|
-
page.appendChild(switchRow({ label: t("settings.showIndicator"), checked: !hidden, onChange: (on) => hidden = !on }));
|
|
25963
|
-
const section = (heading, entries, read, write) => {
|
|
25964
|
-
if (entries.length === 0) return;
|
|
25965
|
-
page.appendChild(h("div", { class: "qc-dialog-heading", role: "presentation" }, heading));
|
|
25966
|
-
for (const [key] of entries) {
|
|
25967
|
-
const label3 = titleOf2(key, builtIn.plotTitles);
|
|
25968
|
-
page.appendChild(switchRow({ label: t("settings.visibleOf", { name: label3 }), checked: read(key), onChange: (on) => write(key, on) }));
|
|
25969
|
-
}
|
|
25970
|
-
};
|
|
25971
|
-
section(t("settings.plots"), Object.entries(manifest2.plots), (k) => overrides.plots?.[k]?.visible !== false, (k, on) => plotOverride(k).visible = on);
|
|
25972
|
-
section(t("settings.levels"), Object.entries(manifest2.levels ?? {}), (k) => overrides.levels?.[k]?.visible !== false, (k, on) => levelOverride(k).visible = on);
|
|
25973
|
-
section(t("settings.fills"), Object.entries(manifest2.fills ?? {}), (k) => overrides.fills?.[k]?.visible !== false, (k, on) => fillOverride(k).visible = on);
|
|
25974
|
-
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`;
|
|
25975
25973
|
};
|
|
25976
|
-
const
|
|
25977
|
-
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
25982
|
-
|
|
25983
|
-
|
|
25984
|
-
|
|
25985
|
-
|
|
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();
|
|
25986
26014
|
tab = id;
|
|
25987
|
-
|
|
25988
|
-
|
|
25989
|
-
|
|
25990
|
-
|
|
25991
|
-
|
|
25992
|
-
|
|
25993
|
-
|
|
25994
|
-
|
|
25995
|
-
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
|
|
26007
|
-
|
|
26008
|
-
|
|
26009
|
-
|
|
26010
|
-
|
|
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;
|
|
26011
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);
|
|
26012
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 };
|
|
26013
26098
|
}
|
|
26014
26099
|
|
|
26015
26100
|
// src/ui/chrome/indicatorPickerData.ts
|
|
@@ -26535,6 +26620,28 @@ var PLACEMENTS2 = [
|
|
|
26535
26620
|
{ placement: "new-scale", label: "search.newScale" },
|
|
26536
26621
|
{ placement: "new-pane", label: "search.newPane" }
|
|
26537
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
|
+
}
|
|
26538
26645
|
function rowLabels(row2) {
|
|
26539
26646
|
const names = symbolNames(row2);
|
|
26540
26647
|
return { ticker: names.mark, description: names.description, source: row2.exchange || row2.dataSource || "" };
|
|
@@ -26549,6 +26656,22 @@ function offeredOperators(spreads) {
|
|
|
26549
26656
|
}
|
|
26550
26657
|
return out;
|
|
26551
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
|
+
}
|
|
26552
26675
|
function dialogRows(input) {
|
|
26553
26676
|
const q = input.query.trim();
|
|
26554
26677
|
const addedSet = new Set(input.added.map((e) => e.symbol));
|
|
@@ -26565,16 +26688,17 @@ function dialogRows(input) {
|
|
|
26565
26688
|
const recent = input.recents.filter((r) => !seen.has(r.symbol)).map((row2) => ({ row: row2, added: false }));
|
|
26566
26689
|
return [...added, ...curated, ...recent];
|
|
26567
26690
|
}
|
|
26568
|
-
const
|
|
26691
|
+
const listed = (hits) => compare ? hits.map((row2) => ({ row: row2, added: addedSet.has(row2.symbol) })) : groupedHits(hits, addedSet, input.open ?? NO_GROUPS);
|
|
26569
26692
|
if (!compare && q === "") {
|
|
26570
26693
|
const seen = new Set(input.recents.map((r) => r.symbol));
|
|
26571
|
-
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)))];
|
|
26572
26695
|
}
|
|
26696
|
+
const base = listed(input.hits);
|
|
26573
26697
|
if (input.spreads === false) return base;
|
|
26574
26698
|
const expression = looksLikeSpread(q) && !isSymbolPair(q);
|
|
26575
26699
|
if (expression) {
|
|
26576
26700
|
const expr = spreadExpression(q);
|
|
26577
|
-
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) });
|
|
26578
26702
|
} else if (looksLikeSpread(q) && !input.loading && base.length === 0) {
|
|
26579
26703
|
const expr = spreadExpression(q);
|
|
26580
26704
|
base.push({ row: { symbol: expr, name: expr, exchange: "", type: "spread" }, added: addedSet.has(expr) });
|
|
@@ -26607,6 +26731,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26607
26731
|
const offerOps = operators.length > 0;
|
|
26608
26732
|
let active = request.changeFrom ? 0 : -1;
|
|
26609
26733
|
let rows2 = [];
|
|
26734
|
+
const openGroups = /* @__PURE__ */ new Set();
|
|
26610
26735
|
let opsOpen = false;
|
|
26611
26736
|
let observer = null;
|
|
26612
26737
|
let markDisposers = [];
|
|
@@ -26666,6 +26791,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26666
26791
|
for (const { row: row2, top } of narrower) row2.hidden = !selection.has(top);
|
|
26667
26792
|
cls = selection.filter();
|
|
26668
26793
|
active = -1;
|
|
26794
|
+
openGroups.clear();
|
|
26669
26795
|
search2().search(serverQuery(), cls);
|
|
26670
26796
|
render();
|
|
26671
26797
|
};
|
|
@@ -26681,6 +26807,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26681
26807
|
scoped = on;
|
|
26682
26808
|
scopeChip?.setAttribute("aria-pressed", String(on));
|
|
26683
26809
|
active = -1;
|
|
26810
|
+
openGroups.clear();
|
|
26684
26811
|
search2().search(serverQuery(), cls);
|
|
26685
26812
|
render();
|
|
26686
26813
|
};
|
|
@@ -26722,6 +26849,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26722
26849
|
input.value = next;
|
|
26723
26850
|
showClear(next !== "");
|
|
26724
26851
|
active = -1;
|
|
26852
|
+
openGroups.clear();
|
|
26725
26853
|
if (compare && next.trim() === "") session2().cancelPending();
|
|
26726
26854
|
else search2().search(serverQuery(), cls);
|
|
26727
26855
|
render();
|
|
@@ -26759,11 +26887,45 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26759
26887
|
for (const seg of matchSegments(text2, serverQuery())) span.appendChild(h("span", { class: seg.hit ? "qc-search-hit" : void 0 }, seg.text));
|
|
26760
26888
|
return span;
|
|
26761
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
|
+
};
|
|
26762
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;
|
|
26763
26925
|
releaseMarks();
|
|
26764
26926
|
const state = search2().state();
|
|
26765
26927
|
const settled = state.query.trim() === serverQuery().trim();
|
|
26766
|
-
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 });
|
|
26767
26929
|
active = Math.min(active, rows2.length - 1);
|
|
26768
26930
|
const emptyStack = compare && query.trim() === "";
|
|
26769
26931
|
const addedCount = emptyStack ? chart?.compare.list().length ?? 0 : 0;
|
|
@@ -26773,15 +26935,26 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26773
26935
|
if (emptyStack && i === addedCount && rows2.length > addedCount) children.push(h("div", { class: "qc-dialog-heading", role: "presentation" }, t("search.recent")));
|
|
26774
26936
|
const r = entry.row;
|
|
26775
26937
|
const label3 = rowLabels(r);
|
|
26776
|
-
const option = h("div", {
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
26781
|
-
|
|
26782
|
-
|
|
26783
|
-
|
|
26784
|
-
|
|
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
|
+
}
|
|
26785
26958
|
option.appendChild(
|
|
26786
26959
|
h(
|
|
26787
26960
|
"span",
|
|
@@ -26791,19 +26964,22 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26791
26964
|
)
|
|
26792
26965
|
);
|
|
26793
26966
|
if (compare && entry.added) {
|
|
26794
|
-
const
|
|
26795
|
-
|
|
26796
|
-
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);
|
|
26797
26970
|
} else {
|
|
26798
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));
|
|
26799
26974
|
if (label3.source) {
|
|
26800
|
-
const sourceMark = h("span", { class: "qc-search-mark",
|
|
26801
|
-
|
|
26802
|
-
|
|
26803
|
-
|
|
26804
|
-
|
|
26805
|
-
|
|
26806
|
-
|
|
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);
|
|
26807
26983
|
}
|
|
26808
26984
|
option.appendChild(source3);
|
|
26809
26985
|
if (compare) {
|
|
@@ -26834,6 +27010,7 @@ function buildSearchSurface(deps, box2, frame2) {
|
|
|
26834
27010
|
children.push(empty);
|
|
26835
27011
|
}
|
|
26836
27012
|
replace(list, ...children);
|
|
27013
|
+
if (heldPill !== void 0) [...list.querySelectorAll(".qc-search-more")].find((p) => p.dataset.symbolGroup === heldPill)?.focus({ preventScroll: true });
|
|
26837
27014
|
if (!emptyStack && settled && !state.loading && !state.failed && state.hasMore && rows2.length > 0) {
|
|
26838
27015
|
sentinel.hidden = false;
|
|
26839
27016
|
list.appendChild(sentinel);
|
|
@@ -29538,7 +29715,7 @@ function createSettingsForm(page, deps) {
|
|
|
29538
29715
|
}
|
|
29539
29716
|
|
|
29540
29717
|
// src/ui/settings/pages.ts
|
|
29541
|
-
var
|
|
29718
|
+
var LINE_WIDTHS = [1, 2, 3, 4];
|
|
29542
29719
|
var PRICE_SOURCES3 = [
|
|
29543
29720
|
{ value: "open", key: "settings.sourceOpen" },
|
|
29544
29721
|
{ value: "high", key: "settings.sourceHigh" },
|
|
@@ -29627,14 +29804,14 @@ function lineRows(form, ctx, section) {
|
|
|
29627
29804
|
if (s.colorType === "gradient") {
|
|
29628
29805
|
c.color({ color: s.gradientTopColor, onColor: (gradientTopColor) => set2({ gradientTopColor }), opacity: true, label: t("settings.topColorOf", { name: name2 }) });
|
|
29629
29806
|
c.color({ color: s.gradientBottomColor, onColor: (gradientBottomColor) => set2({ gradientBottomColor }), opacity: true, label: t("settings.bottomColorOf", { name: name2 }) });
|
|
29630
|
-
c.lineWidth({ value: s.lineWidth, options:
|
|
29807
|
+
c.lineWidth({ value: s.lineWidth, options: LINE_WIDTHS, onChange: (lineWidth) => set2({ lineWidth }) });
|
|
29631
29808
|
return;
|
|
29632
29809
|
}
|
|
29633
29810
|
c.color({
|
|
29634
29811
|
color: s.color,
|
|
29635
29812
|
onColor: (color2) => set2({ color: color2 }),
|
|
29636
29813
|
opacity: true,
|
|
29637
|
-
lineWidth: { value: s.lineWidth, options:
|
|
29814
|
+
lineWidth: { value: s.lineWidth, options: LINE_WIDTHS, onChange: (lineWidth) => set2({ lineWidth }) },
|
|
29638
29815
|
lineStyle: { value: s.lineStyle, onChange: (lineStyle2) => set2({ lineStyle: lineStyle2 }) }
|
|
29639
29816
|
});
|
|
29640
29817
|
}
|
|
@@ -29678,7 +29855,7 @@ function symbolPage(form, ctx) {
|
|
|
29678
29855
|
color: s.lineColor,
|
|
29679
29856
|
onColor: (lineColor) => set2({ lineColor }),
|
|
29680
29857
|
opacity: true,
|
|
29681
|
-
lineWidth: { value: s.lineWidth, options:
|
|
29858
|
+
lineWidth: { value: s.lineWidth, options: LINE_WIDTHS, onChange: (lineWidth) => set2({ lineWidth }) },
|
|
29682
29859
|
lineStyle: { value: s.lineStyle, onChange: (lineStyle2) => set2({ lineStyle: lineStyle2 }) }
|
|
29683
29860
|
})
|
|
29684
29861
|
});
|
|
@@ -29701,12 +29878,12 @@ function symbolPage(form, ctx) {
|
|
|
29701
29878
|
form.field({
|
|
29702
29879
|
id: "topLine",
|
|
29703
29880
|
label: t("settings.topLine"),
|
|
29704
|
-
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 }) } })
|
|
29705
29882
|
});
|
|
29706
29883
|
form.field({
|
|
29707
29884
|
id: "bottomLine",
|
|
29708
29885
|
label: t("settings.bottomLine"),
|
|
29709
|
-
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 }) } })
|
|
29710
29887
|
});
|
|
29711
29888
|
const top = t("settings.fillTopArea");
|
|
29712
29889
|
form.field({
|
|
@@ -29871,7 +30048,7 @@ function scalesPage(form, ctx) {
|
|
|
29871
30048
|
c.color({
|
|
29872
30049
|
color: labels.symbolLineColor,
|
|
29873
30050
|
onColor: (symbolLineColor) => setLabels({ symbolLineColor }),
|
|
29874
|
-
lineWidth: { value: labels.symbolLineWidth, options:
|
|
30051
|
+
lineWidth: { value: labels.symbolLineWidth, options: LINE_WIDTHS, onChange: (symbolLineWidth) => setLabels({ symbolLineWidth }) },
|
|
29875
30052
|
disabled: !labels.symbolName && !labels.symbolValue && !labels.symbolLine
|
|
29876
30053
|
});
|
|
29877
30054
|
c.nextLine();
|
|
@@ -29938,7 +30115,7 @@ function scalesPage(form, ctx) {
|
|
|
29938
30115
|
color: labels.previousCloseColor,
|
|
29939
30116
|
onColor: (previousCloseColor) => setLabels({ previousCloseColor }),
|
|
29940
30117
|
opacity: true,
|
|
29941
|
-
lineWidth: { value: labels.previousCloseLineWidth, options:
|
|
30118
|
+
lineWidth: { value: labels.previousCloseLineWidth, options: LINE_WIDTHS, onChange: (previousCloseLineWidth) => setLabels({ previousCloseLineWidth }) },
|
|
29942
30119
|
disabled: !labels.previousCloseValue && !labels.previousCloseLine
|
|
29943
30120
|
});
|
|
29944
30121
|
}
|
|
@@ -29958,7 +30135,7 @@ function scalesPage(form, ctx) {
|
|
|
29958
30135
|
c.color({
|
|
29959
30136
|
color: labels.highLowColor,
|
|
29960
30137
|
onColor: (highLowColor) => setLabels({ highLowColor }),
|
|
29961
|
-
lineWidth: { value: labels.highLowLineWidth, options:
|
|
30138
|
+
lineWidth: { value: labels.highLowLineWidth, options: LINE_WIDTHS, onChange: (highLowLineWidth) => setLabels({ highLowLineWidth }) },
|
|
29962
30139
|
disabled: !labels.highLowValue && !labels.highLowLine
|
|
29963
30140
|
});
|
|
29964
30141
|
}
|
|
@@ -30058,7 +30235,7 @@ function canvasPage(form, ctx) {
|
|
|
30058
30235
|
color: s.crosshairColor,
|
|
30059
30236
|
onColor: (crosshairColor) => set2({ crosshairColor }),
|
|
30060
30237
|
opacity: true,
|
|
30061
|
-
lineWidth: { value: s.crosshairWidth, options:
|
|
30238
|
+
lineWidth: { value: s.crosshairWidth, options: LINE_WIDTHS, onChange: (crosshairWidth) => set2({ crosshairWidth }) },
|
|
30062
30239
|
lineStyle: style(s.crosshairStyle, (crosshairStyle) => set2({ crosshairStyle }))
|
|
30063
30240
|
})
|
|
30064
30241
|
});
|
|
@@ -30121,7 +30298,7 @@ function eventsPage(form, ctx) {
|
|
|
30121
30298
|
color: s.sessionBreaksColor,
|
|
30122
30299
|
onColor: (sessionBreaksColor) => set2({ sessionBreaksColor }),
|
|
30123
30300
|
opacity: true,
|
|
30124
|
-
lineWidth: { value: s.sessionBreaksWidth, options:
|
|
30301
|
+
lineWidth: { value: s.sessionBreaksWidth, options: LINE_WIDTHS, onChange: (sessionBreaksWidth) => set2({ sessionBreaksWidth }) },
|
|
30125
30302
|
lineStyle: { value: s.sessionBreaksStyle, onChange: (sessionBreaksStyle) => set2({ sessionBreaksStyle }) }
|
|
30126
30303
|
})
|
|
30127
30304
|
});
|
|
@@ -30150,7 +30327,7 @@ var PAGE_ICONS = {
|
|
|
30150
30327
|
events: ICONS.settingsEvents
|
|
30151
30328
|
};
|
|
30152
30329
|
var EDGE = 20;
|
|
30153
|
-
var
|
|
30330
|
+
var nextDialogId2 = 0;
|
|
30154
30331
|
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
30155
30332
|
function viewerSettings(chart) {
|
|
30156
30333
|
try {
|
|
@@ -30160,7 +30337,7 @@ function viewerSettings(chart) {
|
|
|
30160
30337
|
return {};
|
|
30161
30338
|
}
|
|
30162
30339
|
}
|
|
30163
|
-
var
|
|
30340
|
+
var written2 = (partial) => JSON.stringify(
|
|
30164
30341
|
Object.keys(partial).sort().map((section) => {
|
|
30165
30342
|
const leaves = partial[section];
|
|
30166
30343
|
return [section, Object.keys(leaves).sort().map((leaf) => [leaf, leaves[leaf]])];
|
|
@@ -30176,7 +30353,7 @@ function guarded(run) {
|
|
|
30176
30353
|
}
|
|
30177
30354
|
function createChartSettingsDialog(deps) {
|
|
30178
30355
|
const t = () => deps.i18n.t;
|
|
30179
|
-
const dialogId = ++
|
|
30356
|
+
const dialogId = ++nextDialogId2;
|
|
30180
30357
|
const listeners = /* @__PURE__ */ new Set();
|
|
30181
30358
|
let session2 = null;
|
|
30182
30359
|
const tell = (open3) => {
|
|
@@ -30351,7 +30528,7 @@ function createChartSettingsDialog(deps) {
|
|
|
30351
30528
|
};
|
|
30352
30529
|
const restore = (s) => {
|
|
30353
30530
|
const chart = s.chart;
|
|
30354
|
-
if (
|
|
30531
|
+
if (written2(viewerSettings(chart)) !== written2(s.initial.settings)) {
|
|
30355
30532
|
chart.resetSettings();
|
|
30356
30533
|
if (holdsLeaves(s.initial.settings)) chart.applySettings(s.initial.settings);
|
|
30357
30534
|
}
|
|
@@ -30763,11 +30940,11 @@ function mountChrome(deps) {
|
|
|
30763
30940
|
request
|
|
30764
30941
|
});
|
|
30765
30942
|
};
|
|
30766
|
-
deps.doors.openIndicatorSettings = (chart, instanceId) => {
|
|
30943
|
+
deps.doors.openIndicatorSettings = (chart, instanceId, session2) => {
|
|
30767
30944
|
if (!ui.indicatorSettings) return false;
|
|
30768
30945
|
const instance = chart.indicators.get().find((i) => i.id === instanceId);
|
|
30769
30946
|
if (!instance) return false;
|
|
30770
|
-
openIndicatorSettings({ ...ctx, chart, instance });
|
|
30947
|
+
openIndicatorSettings({ ...ctx, chart, instance, session: session2 });
|
|
30771
30948
|
return true;
|
|
30772
30949
|
};
|
|
30773
30950
|
if (deps.drawingToolbarContainer && ui.drawingToolbar) {
|