dipping-charts 0.1.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.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/dist/__tests__/FullFeaturedChart.test.d.ts +2 -0
  4. package/dist/__tests__/FullFeaturedChart.test.d.ts.map +1 -0
  5. package/dist/__tests__/indicators-accuracy.test.d.ts +2 -0
  6. package/dist/__tests__/indicators-accuracy.test.d.ts.map +1 -0
  7. package/dist/__tests__/indicators.test.d.ts +2 -0
  8. package/dist/__tests__/indicators.test.d.ts.map +1 -0
  9. package/dist/__tests__/setup.d.ts +1 -0
  10. package/dist/__tests__/setup.d.ts.map +1 -0
  11. package/dist/__tests__/validateCandle.test.d.ts +2 -0
  12. package/dist/__tests__/validateCandle.test.d.ts.map +1 -0
  13. package/dist/chart/index.d.ts +2 -0
  14. package/dist/chart/index.js +5 -0
  15. package/dist/chart/index.js.map +1 -0
  16. package/dist/components/TradingChart.d.ts +24 -0
  17. package/dist/components/TradingChart.d.ts.map +1 -0
  18. package/dist/components/TradingChart.js +100 -0
  19. package/dist/components/TradingChart.js.map +1 -0
  20. package/dist/components/index.d.ts +3 -0
  21. package/dist/components/index.d.ts.map +1 -0
  22. package/dist/dipping-charts.css +1 -0
  23. package/dist/index.d.ts +5 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +28 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/indicators/atr.d.ts +15 -0
  28. package/dist/indicators/atr.d.ts.map +1 -0
  29. package/dist/indicators/atr.js +30 -0
  30. package/dist/indicators/atr.js.map +1 -0
  31. package/dist/indicators/bollingerBands.d.ts +11 -0
  32. package/dist/indicators/bollingerBands.d.ts.map +1 -0
  33. package/dist/indicators/bollingerBands.js +39 -0
  34. package/dist/indicators/bollingerBands.js.map +1 -0
  35. package/dist/indicators/currencyStrength.d.ts +43 -0
  36. package/dist/indicators/currencyStrength.d.ts.map +1 -0
  37. package/dist/indicators/currencyStrength.js +53 -0
  38. package/dist/indicators/currencyStrength.js.map +1 -0
  39. package/dist/indicators/ema.d.ts +11 -0
  40. package/dist/indicators/ema.d.ts.map +1 -0
  41. package/dist/indicators/ema.js +24 -0
  42. package/dist/indicators/ema.js.map +1 -0
  43. package/dist/indicators/index.d.ts +19 -0
  44. package/dist/indicators/index.d.ts.map +1 -0
  45. package/dist/indicators/index.js +23 -0
  46. package/dist/indicators/index.js.map +1 -0
  47. package/dist/indicators/macd.d.ts +11 -0
  48. package/dist/indicators/macd.d.ts.map +1 -0
  49. package/dist/indicators/macd.js +52 -0
  50. package/dist/indicators/macd.js.map +1 -0
  51. package/dist/indicators/rsi.d.ts +11 -0
  52. package/dist/indicators/rsi.d.ts.map +1 -0
  53. package/dist/indicators/rsi.js +29 -0
  54. package/dist/indicators/rsi.js.map +1 -0
  55. package/dist/indicators/sma.d.ts +13 -0
  56. package/dist/indicators/sma.d.ts.map +1 -0
  57. package/dist/indicators/sma.js +22 -0
  58. package/dist/indicators/sma.js.map +1 -0
  59. package/dist/indicators/stochastic.d.ts +15 -0
  60. package/dist/indicators/stochastic.d.ts.map +1 -0
  61. package/dist/indicators/stochastic.js +34 -0
  62. package/dist/indicators/stochastic.js.map +1 -0
  63. package/dist/indicators/types.d.ts +102 -0
  64. package/dist/indicators/types.d.ts.map +1 -0
  65. package/dist/indicators/vwap.d.ts +14 -0
  66. package/dist/indicators/vwap.d.ts.map +1 -0
  67. package/dist/indicators/vwap.js +17 -0
  68. package/dist/indicators/vwap.js.map +1 -0
  69. package/dist/indicators/williamsR.d.ts +17 -0
  70. package/dist/indicators/williamsR.d.ts.map +1 -0
  71. package/dist/indicators/williamsR.js +19 -0
  72. package/dist/indicators/williamsR.js.map +1 -0
  73. package/dist/react/FullFeaturedChart.d.ts +3 -0
  74. package/dist/react/FullFeaturedChart.d.ts.map +1 -0
  75. package/dist/react/FullFeaturedChart.js +640 -0
  76. package/dist/react/FullFeaturedChart.js.map +1 -0
  77. package/dist/react/components/IndicatorSettings.d.ts +20 -0
  78. package/dist/react/components/IndicatorSettings.d.ts.map +1 -0
  79. package/dist/react/components/IndicatorSettings.js +748 -0
  80. package/dist/react/components/IndicatorSettings.js.map +1 -0
  81. package/dist/react/hooks/useChart.d.ts +15 -0
  82. package/dist/react/hooks/useChart.d.ts.map +1 -0
  83. package/dist/react/hooks/useChart.js +155 -0
  84. package/dist/react/hooks/useChart.js.map +1 -0
  85. package/dist/react/hooks/useIndicators.d.ts +10 -0
  86. package/dist/react/hooks/useIndicators.d.ts.map +1 -0
  87. package/dist/react/hooks/useIndicators.js +264 -0
  88. package/dist/react/hooks/useIndicators.js.map +1 -0
  89. package/dist/react/hooks/useLineTools.d.ts +26 -0
  90. package/dist/react/hooks/useLineTools.d.ts.map +1 -0
  91. package/dist/react/hooks/useLineTools.js +189 -0
  92. package/dist/react/hooks/useLineTools.js.map +1 -0
  93. package/dist/react/hooks/useShiftSnap.d.ts +12 -0
  94. package/dist/react/hooks/useShiftSnap.d.ts.map +1 -0
  95. package/dist/react/hooks/useShiftSnap.js +54 -0
  96. package/dist/react/hooks/useShiftSnap.js.map +1 -0
  97. package/dist/react/index.d.ts +14 -0
  98. package/dist/react/index.d.ts.map +1 -0
  99. package/dist/react/index.js +18 -0
  100. package/dist/react/index.js.map +1 -0
  101. package/dist/react/loadLightweightCharts.d.ts +18 -0
  102. package/dist/react/loadLightweightCharts.d.ts.map +1 -0
  103. package/dist/react/loadLightweightCharts.js +32 -0
  104. package/dist/react/loadLightweightCharts.js.map +1 -0
  105. package/dist/react/locale.d.ts +79 -0
  106. package/dist/react/locale.d.ts.map +1 -0
  107. package/dist/react/locale.js +158 -0
  108. package/dist/react/locale.js.map +1 -0
  109. package/dist/react/types.d.ts +130 -0
  110. package/dist/react/types.d.ts.map +1 -0
  111. package/dist/types/index.d.ts +24 -0
  112. package/dist/types/index.d.ts.map +1 -0
  113. package/dist/utils/getToolId.d.ts +9 -0
  114. package/dist/utils/getToolId.d.ts.map +1 -0
  115. package/dist/utils/getToolId.js +12 -0
  116. package/dist/utils/getToolId.js.map +1 -0
  117. package/dist/utils/mockData.d.ts +10 -0
  118. package/dist/utils/mockData.d.ts.map +1 -0
  119. package/dist/utils/mockData.js +61 -0
  120. package/dist/utils/mockData.js.map +1 -0
  121. package/dist/utils/snapCrosshair.d.ts +25 -0
  122. package/dist/utils/snapCrosshair.d.ts.map +1 -0
  123. package/dist/utils/validateCandle.d.ts +30 -0
  124. package/dist/utils/validateCandle.d.ts.map +1 -0
  125. package/dist/utils/validateCandle.js +21 -0
  126. package/dist/utils/validateCandle.js.map +1 -0
  127. package/examples/css/base.css +209 -0
  128. package/examples/css/chart.css +282 -0
  129. package/examples/css/indicators.css +255 -0
  130. package/examples/index.html +163 -0
  131. package/examples/js/chart.js +370 -0
  132. package/examples/js/indicators.js +27 -0
  133. package/examples/js/main.js +6 -0
  134. package/examples/js/ui.js +1641 -0
  135. package/lib/lightweight-charts.standalone.production.js +7 -0
  136. package/package.json +106 -0
  137. package/src/react/FullFeaturedChart.css +1007 -0
@@ -0,0 +1,748 @@
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { useState as w, useRef as z, useEffect as C } from "react";
3
+ import { createPortal as N } from "react-dom";
4
+ import { getLocaleStrings as B } from "../locale.js";
5
+ const T = [
6
+ "#3C4043",
7
+ "#1A73E8",
8
+ "#9334E6",
9
+ "#B80000",
10
+ "#E37400",
11
+ "#F9AB00",
12
+ "#007B83",
13
+ "#1E8E3E",
14
+ "#5F6368",
15
+ "#4285F4",
16
+ "#A142F4",
17
+ "#D93025",
18
+ "#F57C00",
19
+ "#FDD835",
20
+ "#12B5CB",
21
+ "#34A853",
22
+ "#9AA0A6",
23
+ "#8AB4F8",
24
+ "#C58AF9",
25
+ "#EE675C",
26
+ "#FF8A65",
27
+ "#FFB300",
28
+ "#4DB6AC",
29
+ "#81C995",
30
+ "#DADCE0",
31
+ "#AECBFA",
32
+ "#D7AEFB",
33
+ "#F28B82",
34
+ "#FFAB91",
35
+ "#FFD54F",
36
+ "#80DEEA",
37
+ "#A5D6A7"
38
+ ], k = ["#26a69a", "#ef5350", "#2196f3", "#ff6f00", "#ab47bc", "#66bb6a", "#ffa726", "#42a5f5"];
39
+ function R(o) {
40
+ return {
41
+ sma: { title: o.ind_sma, desc: o.ind_sma_desc, defaultValue: 20 },
42
+ ema: { title: o.ind_ema, desc: o.ind_ema_desc, defaultValue: 12 },
43
+ rsi: { title: o.ind_rsi, desc: o.ind_rsi_desc, defaultValue: 14 },
44
+ macd: { title: o.ind_macd, desc: o.ind_macd_desc, defaultValue: 26 },
45
+ bbands: { title: o.ind_bbands, desc: o.ind_bbands_desc, defaultValue: 20 },
46
+ stochastic: { title: o.ind_stochastic, desc: o.ind_stochastic_desc, defaultValue: 14 },
47
+ atr: { title: o.ind_atr, desc: o.ind_atr_desc, defaultValue: 14 },
48
+ vwap: { title: o.ind_vwap, desc: o.ind_vwap_desc, defaultValue: 0 },
49
+ williamsR: { title: o.ind_williamsR, desc: o.ind_williamsR_desc, defaultValue: 14 }
50
+ };
51
+ }
52
+ function u({ currentColor: o, onSelect: f, onClose: g, position: s, colorTitle: v = "Color" }) {
53
+ const b = z(null);
54
+ C(() => {
55
+ const t = (d) => {
56
+ b.current && !b.current.contains(d.target) && g();
57
+ }, y = setTimeout(() => {
58
+ document.addEventListener("mousedown", t);
59
+ }, 100);
60
+ return () => {
61
+ clearTimeout(y), document.removeEventListener("mousedown", t);
62
+ };
63
+ }, [g]);
64
+ const x = /* @__PURE__ */ r(
65
+ "div",
66
+ {
67
+ ref: b,
68
+ className: "color-palette-popup show",
69
+ style: {
70
+ top: s.top,
71
+ left: s.left
72
+ },
73
+ onClick: (t) => t.stopPropagation(),
74
+ children: [
75
+ /* @__PURE__ */ e("div", { className: "color-palette-title", children: v }),
76
+ /* @__PURE__ */ e("div", { className: "color-palette-grid", children: T.map((t) => /* @__PURE__ */ e(
77
+ "div",
78
+ {
79
+ className: `color-palette-item ${t === o ? "selected" : ""}`,
80
+ style: { background: t },
81
+ onClick: (y) => {
82
+ y.stopPropagation(), f(t), g();
83
+ }
84
+ },
85
+ t
86
+ )) })
87
+ ]
88
+ }
89
+ );
90
+ return N(x, document.body);
91
+ }
92
+ function A({
93
+ indicator: o,
94
+ configs: f,
95
+ isChecked: g,
96
+ onConfigChange: s,
97
+ macdColors: v,
98
+ onMacdColorsChange: b,
99
+ locale: x = "en"
100
+ }) {
101
+ const t = B(x), y = R(t), [d, a] = w(null);
102
+ if (!o)
103
+ return /* @__PURE__ */ e("div", { className: "indicator-empty-state", children: t.selectIndicator });
104
+ const c = y[o], n = f[o];
105
+ if (!g || n.length === 0)
106
+ return /* @__PURE__ */ r("div", { children: [
107
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
108
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
109
+ /* @__PURE__ */ e("div", { className: "indicator-empty-state", children: t.enableIndicator })
110
+ ] });
111
+ const h = (l, i, p) => {
112
+ l.preventDefault(), l.stopPropagation();
113
+ const m = l.target.getBoundingClientRect();
114
+ a({
115
+ index: i,
116
+ type: p,
117
+ position: { top: m.bottom + 5, left: m.left }
118
+ });
119
+ };
120
+ if (o === "rsi") {
121
+ const l = n[0];
122
+ return /* @__PURE__ */ r("div", { children: [
123
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
124
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
125
+ /* @__PURE__ */ r("div", { style: { marginTop: 16 }, children: [
126
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, alignItems: "flex-start", marginBottom: 12 }, children: [
127
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
128
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.color }),
129
+ /* @__PURE__ */ e(
130
+ "div",
131
+ {
132
+ className: "period-color-picker",
133
+ style: { background: l.color, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
134
+ onClick: (i) => h(i, 0)
135
+ }
136
+ )
137
+ ] }),
138
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
139
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.period }),
140
+ /* @__PURE__ */ e(
141
+ "input",
142
+ {
143
+ type: "number",
144
+ value: l.value,
145
+ onChange: (i) => s(o, [{ ...l, value: parseInt(i.target.value) || 14 }]),
146
+ min: "1",
147
+ max: "500",
148
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
149
+ }
150
+ )
151
+ ] })
152
+ ] }),
153
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, alignItems: "flex-start" }, children: [
154
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
155
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.oversold }),
156
+ /* @__PURE__ */ e(
157
+ "input",
158
+ {
159
+ type: "number",
160
+ value: l.oversold ?? 30,
161
+ onChange: (i) => s(o, [{ ...l, oversold: parseInt(i.target.value) || 30 }]),
162
+ min: "0",
163
+ max: "100",
164
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
165
+ }
166
+ )
167
+ ] }),
168
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
169
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.overbought }),
170
+ /* @__PURE__ */ e(
171
+ "input",
172
+ {
173
+ type: "number",
174
+ value: l.overbought ?? 70,
175
+ onChange: (i) => s(o, [{ ...l, overbought: parseInt(i.target.value) || 70 }]),
176
+ min: "0",
177
+ max: "100",
178
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
179
+ }
180
+ )
181
+ ] })
182
+ ] })
183
+ ] }),
184
+ d && d.index === 0 && /* @__PURE__ */ e(
185
+ u,
186
+ {
187
+ currentColor: l.color,
188
+ onSelect: (i) => s(o, [{ ...l, color: i }]),
189
+ onClose: () => a(null),
190
+ position: d.position,
191
+ colorTitle: t.colorPaletteTitle
192
+ }
193
+ )
194
+ ] });
195
+ }
196
+ if (o === "macd") {
197
+ const l = n[0];
198
+ return /* @__PURE__ */ r("div", { children: [
199
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
200
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
201
+ /* @__PURE__ */ r("div", { style: { marginTop: 16 }, children: [
202
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8, marginBottom: 12 }, children: [
203
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
204
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.ind_macd }),
205
+ /* @__PURE__ */ e(
206
+ "div",
207
+ {
208
+ className: "period-color-picker",
209
+ style: { background: v.line, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
210
+ onClick: (i) => h(i, void 0, "macd-line")
211
+ }
212
+ )
213
+ ] }),
214
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
215
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.signal }),
216
+ /* @__PURE__ */ e(
217
+ "div",
218
+ {
219
+ className: "period-color-picker",
220
+ style: { background: v.signal, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
221
+ onClick: (i) => h(i, void 0, "macd-signal")
222
+ }
223
+ )
224
+ ] })
225
+ ] }),
226
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8, marginBottom: 12 }, children: [
227
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
228
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.bullish }),
229
+ /* @__PURE__ */ e(
230
+ "div",
231
+ {
232
+ className: "period-color-picker",
233
+ style: { background: l.histUpColor || "#26a69a", width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
234
+ onClick: (i) => h(i, void 0, "hist-up")
235
+ }
236
+ )
237
+ ] }),
238
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
239
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.bearish }),
240
+ /* @__PURE__ */ e(
241
+ "div",
242
+ {
243
+ className: "period-color-picker",
244
+ style: { background: l.histDownColor || "#ef5350", width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
245
+ onClick: (i) => h(i, void 0, "hist-down")
246
+ }
247
+ )
248
+ ] })
249
+ ] }),
250
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8 }, children: [
251
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
252
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.fast }),
253
+ /* @__PURE__ */ e(
254
+ "input",
255
+ {
256
+ type: "number",
257
+ value: l.fastPeriod,
258
+ onChange: (i) => s(o, [{ ...l, fastPeriod: parseInt(i.target.value) || 12 }]),
259
+ min: "1",
260
+ max: "500",
261
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
262
+ }
263
+ )
264
+ ] }),
265
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
266
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.slow }),
267
+ /* @__PURE__ */ e(
268
+ "input",
269
+ {
270
+ type: "number",
271
+ value: l.slowPeriod,
272
+ onChange: (i) => s(o, [{ ...l, slowPeriod: parseInt(i.target.value) || 26 }]),
273
+ min: "1",
274
+ max: "500",
275
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
276
+ }
277
+ )
278
+ ] }),
279
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
280
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.signal }),
281
+ /* @__PURE__ */ e(
282
+ "input",
283
+ {
284
+ type: "number",
285
+ value: l.signalPeriod,
286
+ onChange: (i) => s(o, [{ ...l, signalPeriod: parseInt(i.target.value) || 9 }]),
287
+ min: "1",
288
+ max: "500",
289
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
290
+ }
291
+ )
292
+ ] })
293
+ ] })
294
+ ] }),
295
+ d && d.type === "macd-line" && /* @__PURE__ */ e(
296
+ u,
297
+ {
298
+ currentColor: v.line,
299
+ onSelect: (i) => b({ ...v, line: i }),
300
+ onClose: () => a(null),
301
+ position: d.position,
302
+ colorTitle: t.colorPaletteTitle
303
+ }
304
+ ),
305
+ d && d.type === "macd-signal" && /* @__PURE__ */ e(
306
+ u,
307
+ {
308
+ currentColor: v.signal,
309
+ onSelect: (i) => b({ ...v, signal: i }),
310
+ onClose: () => a(null),
311
+ position: d.position,
312
+ colorTitle: t.colorPaletteTitle
313
+ }
314
+ ),
315
+ d && d.type === "hist-up" && /* @__PURE__ */ e(
316
+ u,
317
+ {
318
+ currentColor: l.histUpColor || "#26a69a",
319
+ onSelect: (i) => s(o, [{ ...l, histUpColor: i }]),
320
+ onClose: () => a(null),
321
+ position: d.position,
322
+ colorTitle: t.colorPaletteTitle
323
+ }
324
+ ),
325
+ d && d.type === "hist-down" && /* @__PURE__ */ e(
326
+ u,
327
+ {
328
+ currentColor: l.histDownColor || "#ef5350",
329
+ onSelect: (i) => s(o, [{ ...l, histDownColor: i }]),
330
+ onClose: () => a(null),
331
+ position: d.position,
332
+ colorTitle: t.colorPaletteTitle
333
+ }
334
+ )
335
+ ] });
336
+ }
337
+ if (o === "bbands") {
338
+ const l = n[0];
339
+ return /* @__PURE__ */ r("div", { children: [
340
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
341
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
342
+ /* @__PURE__ */ r("div", { style: { marginTop: 16 }, children: [
343
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8, marginBottom: 12 }, children: [
344
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
345
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.upper }),
346
+ /* @__PURE__ */ e(
347
+ "div",
348
+ {
349
+ className: "period-color-picker",
350
+ style: { background: l.upperColor, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
351
+ onClick: (i) => h(i, void 0, "bb-upper")
352
+ }
353
+ )
354
+ ] }),
355
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
356
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.middle }),
357
+ /* @__PURE__ */ e(
358
+ "div",
359
+ {
360
+ className: "period-color-picker",
361
+ style: { background: l.middleColor, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
362
+ onClick: (i) => h(i, void 0, "bb-middle")
363
+ }
364
+ )
365
+ ] }),
366
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
367
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.lower }),
368
+ /* @__PURE__ */ e(
369
+ "div",
370
+ {
371
+ className: "period-color-picker",
372
+ style: { background: l.lowerColor, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
373
+ onClick: (i) => h(i, void 0, "bb-lower")
374
+ }
375
+ )
376
+ ] })
377
+ ] }),
378
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8 }, children: [
379
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
380
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.period }),
381
+ /* @__PURE__ */ e(
382
+ "input",
383
+ {
384
+ type: "number",
385
+ value: l.value,
386
+ onChange: (i) => s(o, [{ ...l, value: parseInt(i.target.value) || 20 }]),
387
+ min: "1",
388
+ max: "500",
389
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40 }
390
+ }
391
+ )
392
+ ] }),
393
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
394
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.stdDev }),
395
+ /* @__PURE__ */ e(
396
+ "input",
397
+ {
398
+ type: "number",
399
+ value: l.stdDev,
400
+ onChange: (i) => s(o, [{ ...l, stdDev: parseFloat(i.target.value) || 2 }]),
401
+ min: "0.5",
402
+ max: "5",
403
+ step: "0.1",
404
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40 }
405
+ }
406
+ )
407
+ ] }),
408
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
409
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.thickness }),
410
+ /* @__PURE__ */ r(
411
+ "div",
412
+ {
413
+ style: { width: "100%", height: 40, border: "1px solid #e0e0e0", borderRadius: 6, display: "flex", alignItems: "center", justifyContent: "center", fontSize: 14, fontWeight: 500, cursor: "pointer", background: "white" },
414
+ onClick: () => s(o, [{ ...l, thickness: l.thickness % 5 + 1 }]),
415
+ children: [
416
+ l.thickness,
417
+ "px"
418
+ ]
419
+ }
420
+ )
421
+ ] })
422
+ ] })
423
+ ] }),
424
+ d && d.type === "bb-upper" && /* @__PURE__ */ e(
425
+ u,
426
+ {
427
+ currentColor: l.upperColor,
428
+ onSelect: (i) => s(o, [{ ...l, upperColor: i }]),
429
+ onClose: () => a(null),
430
+ position: d.position,
431
+ colorTitle: t.colorPaletteTitle
432
+ }
433
+ ),
434
+ d && d.type === "bb-middle" && /* @__PURE__ */ e(
435
+ u,
436
+ {
437
+ currentColor: l.middleColor,
438
+ onSelect: (i) => s(o, [{ ...l, middleColor: i }]),
439
+ onClose: () => a(null),
440
+ position: d.position,
441
+ colorTitle: t.colorPaletteTitle
442
+ }
443
+ ),
444
+ d && d.type === "bb-lower" && /* @__PURE__ */ e(
445
+ u,
446
+ {
447
+ currentColor: l.lowerColor,
448
+ onSelect: (i) => s(o, [{ ...l, lowerColor: i }]),
449
+ onClose: () => a(null),
450
+ position: d.position,
451
+ colorTitle: t.colorPaletteTitle
452
+ }
453
+ )
454
+ ] });
455
+ }
456
+ if (o === "stochastic") {
457
+ const l = n[0];
458
+ return /* @__PURE__ */ r("div", { children: [
459
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
460
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
461
+ /* @__PURE__ */ r("div", { style: { marginTop: 16 }, children: [
462
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8, marginBottom: 12 }, children: [
463
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
464
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.kLine }),
465
+ /* @__PURE__ */ e(
466
+ "div",
467
+ {
468
+ className: "period-color-picker",
469
+ style: { background: l.kColor, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
470
+ onClick: (i) => h(i, void 0, "stoch-k")
471
+ }
472
+ )
473
+ ] }),
474
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
475
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.dLine }),
476
+ /* @__PURE__ */ e(
477
+ "div",
478
+ {
479
+ className: "period-color-picker",
480
+ style: { background: l.dColor, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
481
+ onClick: (i) => h(i, void 0, "stoch-d")
482
+ }
483
+ )
484
+ ] })
485
+ ] }),
486
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: 8 }, children: [
487
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
488
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.kPeriod }),
489
+ /* @__PURE__ */ e(
490
+ "input",
491
+ {
492
+ type: "number",
493
+ value: l.kPeriod,
494
+ onChange: (i) => s(o, [{ ...l, kPeriod: parseInt(i.target.value) || 14 }]),
495
+ min: "1",
496
+ max: "500",
497
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
498
+ }
499
+ )
500
+ ] }),
501
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
502
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.dPeriod }),
503
+ /* @__PURE__ */ e(
504
+ "input",
505
+ {
506
+ type: "number",
507
+ value: l.dPeriod,
508
+ onChange: (i) => s(o, [{ ...l, dPeriod: parseInt(i.target.value) || 3 }]),
509
+ min: "1",
510
+ max: "500",
511
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
512
+ }
513
+ )
514
+ ] }),
515
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
516
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.smooth }),
517
+ /* @__PURE__ */ e(
518
+ "input",
519
+ {
520
+ type: "number",
521
+ value: l.smooth,
522
+ onChange: (i) => s(o, [{ ...l, smooth: parseInt(i.target.value) || 3 }]),
523
+ min: "1",
524
+ max: "500",
525
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
526
+ }
527
+ )
528
+ ] })
529
+ ] })
530
+ ] }),
531
+ d && d.type === "stoch-k" && /* @__PURE__ */ e(
532
+ u,
533
+ {
534
+ currentColor: l.kColor,
535
+ onSelect: (i) => s(o, [{ ...l, kColor: i }]),
536
+ onClose: () => a(null),
537
+ position: d.position,
538
+ colorTitle: t.colorPaletteTitle
539
+ }
540
+ ),
541
+ d && d.type === "stoch-d" && /* @__PURE__ */ e(
542
+ u,
543
+ {
544
+ currentColor: l.dColor,
545
+ onSelect: (i) => s(o, [{ ...l, dColor: i }]),
546
+ onClose: () => a(null),
547
+ position: d.position,
548
+ colorTitle: t.colorPaletteTitle
549
+ }
550
+ )
551
+ ] });
552
+ }
553
+ if (o === "vwap") {
554
+ const l = n[0];
555
+ return /* @__PURE__ */ r("div", { children: [
556
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
557
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
558
+ /* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, alignItems: "flex-start" }, children: [
559
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
560
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.color }),
561
+ /* @__PURE__ */ e(
562
+ "div",
563
+ {
564
+ className: "period-color-picker",
565
+ style: { background: l.color, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
566
+ onClick: (i) => h(i, 0)
567
+ }
568
+ )
569
+ ] }),
570
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
571
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.thickness }),
572
+ /* @__PURE__ */ r(
573
+ "div",
574
+ {
575
+ style: { width: "100%", height: 40, border: "1px solid #e0e0e0", borderRadius: 6, display: "flex", alignItems: "center", justifyContent: "center", fontSize: 14, fontWeight: 500, cursor: "pointer", background: "white" },
576
+ onClick: () => s(o, [{ ...l, thickness: l.thickness % 5 + 1 }]),
577
+ children: [
578
+ l.thickness,
579
+ "px"
580
+ ]
581
+ }
582
+ )
583
+ ] })
584
+ ] }) }),
585
+ d && d.index === 0 && /* @__PURE__ */ e(
586
+ u,
587
+ {
588
+ currentColor: l.color,
589
+ onSelect: (i) => s(o, [{ ...l, color: i }]),
590
+ onClose: () => a(null),
591
+ position: d.position,
592
+ colorTitle: t.colorPaletteTitle
593
+ }
594
+ )
595
+ ] });
596
+ }
597
+ if (o === "atr" || o === "williamsR") {
598
+ const l = n[0];
599
+ return /* @__PURE__ */ r("div", { children: [
600
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
601
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
602
+ /* @__PURE__ */ e("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, alignItems: "flex-start" }, children: [
603
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
604
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.color }),
605
+ /* @__PURE__ */ e(
606
+ "div",
607
+ {
608
+ className: "period-color-picker",
609
+ style: { background: l.color, width: "100%", height: 40, cursor: "pointer", borderRadius: 6, border: "1px solid #e0e0e0" },
610
+ onClick: (i) => h(i, 0)
611
+ }
612
+ )
613
+ ] }),
614
+ /* @__PURE__ */ r("div", { style: { flex: 1 }, children: [
615
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, color: "#666", marginBottom: 8 }, children: t.period }),
616
+ /* @__PURE__ */ e(
617
+ "input",
618
+ {
619
+ type: "number",
620
+ value: l.value,
621
+ onChange: (i) => s(o, [{ ...l, value: parseInt(i.target.value) || 14 }]),
622
+ min: "1",
623
+ max: "500",
624
+ style: { width: "100%", padding: 8, border: "1px solid #e0e0e0", borderRadius: 6, fontSize: 14, height: 40, boxSizing: "border-box" }
625
+ }
626
+ )
627
+ ] })
628
+ ] }) }),
629
+ d && d.index === 0 && /* @__PURE__ */ e(
630
+ u,
631
+ {
632
+ currentColor: l.color,
633
+ onSelect: (i) => s(o, [{ ...l, color: i }]),
634
+ onClose: () => a(null),
635
+ position: d.position,
636
+ colorTitle: t.colorPaletteTitle
637
+ }
638
+ )
639
+ ] });
640
+ }
641
+ return /* @__PURE__ */ r("div", { children: [
642
+ /* @__PURE__ */ e("div", { className: "indicator-settings-title", children: c.title }),
643
+ /* @__PURE__ */ e("div", { className: "indicator-settings-desc", children: c.desc }),
644
+ n.map((l, i) => /* @__PURE__ */ r("div", { className: "indicator-period-row", children: [
645
+ /* @__PURE__ */ e("span", { className: "period-label-col", children: t.periodN(i + 1) }),
646
+ /* @__PURE__ */ e(
647
+ "div",
648
+ {
649
+ className: "period-color-picker",
650
+ style: { background: l.color, cursor: "pointer" },
651
+ onClick: (p) => h(p, i)
652
+ }
653
+ ),
654
+ /* @__PURE__ */ r(
655
+ "div",
656
+ {
657
+ className: "period-thickness-display",
658
+ onClick: () => {
659
+ const p = [...n];
660
+ p[i] = { ...p[i], thickness: p[i].thickness % 5 + 1 }, s(o, p);
661
+ },
662
+ children: [
663
+ l.thickness,
664
+ "px"
665
+ ]
666
+ }
667
+ ),
668
+ /* @__PURE__ */ r(
669
+ "select",
670
+ {
671
+ className: "period-source-dropdown",
672
+ value: l.source,
673
+ onChange: (p) => {
674
+ const m = [...n];
675
+ m[i] = { ...m[i], source: p.target.value }, s(o, m);
676
+ },
677
+ children: [
678
+ /* @__PURE__ */ e("option", { value: "close", children: t.src_close }),
679
+ /* @__PURE__ */ e("option", { value: "open", children: t.src_open }),
680
+ /* @__PURE__ */ e("option", { value: "high", children: t.src_high }),
681
+ /* @__PURE__ */ e("option", { value: "low", children: t.src_low })
682
+ ]
683
+ }
684
+ ),
685
+ /* @__PURE__ */ e(
686
+ "input",
687
+ {
688
+ type: "number",
689
+ className: "period-value-field",
690
+ value: l.value,
691
+ onChange: (p) => {
692
+ const m = [...n];
693
+ m[i] = { ...m[i], value: parseInt(p.target.value) || 1 }, s(o, m);
694
+ },
695
+ min: "1",
696
+ max: "500"
697
+ }
698
+ ),
699
+ n.length > 1 && /* @__PURE__ */ e(
700
+ "button",
701
+ {
702
+ className: "period-delete-btn",
703
+ onClick: () => {
704
+ const p = n.filter((m, S) => S !== i);
705
+ s(o, p);
706
+ },
707
+ children: "×"
708
+ }
709
+ )
710
+ ] }, i)),
711
+ /* @__PURE__ */ e(
712
+ "button",
713
+ {
714
+ className: "add-period-button",
715
+ onClick: () => {
716
+ const l = n[n.length - 1], i = (k.indexOf(l.color) + 1) % k.length;
717
+ s(o, [
718
+ ...n,
719
+ {
720
+ color: k[i],
721
+ thickness: 2,
722
+ source: "close",
723
+ value: c.defaultValue
724
+ }
725
+ ]);
726
+ },
727
+ children: t.addPeriod
728
+ }
729
+ ),
730
+ d && d.index !== void 0 && /* @__PURE__ */ e(
731
+ u,
732
+ {
733
+ currentColor: n[d.index].color,
734
+ onSelect: (l) => {
735
+ const i = [...n];
736
+ i[d.index] = { ...i[d.index], color: l }, s(o, i);
737
+ },
738
+ onClose: () => a(null),
739
+ position: d.position,
740
+ colorTitle: t.colorPaletteTitle
741
+ }
742
+ )
743
+ ] });
744
+ }
745
+ export {
746
+ A as IndicatorSettings
747
+ };
748
+ //# sourceMappingURL=IndicatorSettings.js.map