@funnest/charts-ui 0.9.6 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,11 +4,6 @@ import type { WidgetContext } from '../context.js';
|
|
|
4
4
|
export declare function DrawingToolbar({ ctx }: {
|
|
5
5
|
ctx: WidgetContext;
|
|
6
6
|
}): JSX.Element;
|
|
7
|
-
/**
|
|
8
|
-
* Floating bar for the selected drawing: move it by its grip (remembered; double-click resets),
|
|
9
|
-
* color (swatches, a custom one, recent customs), line width and style, text for text tools,
|
|
10
|
-
* lock, duplicate, delete (also the only way to delete on touch).
|
|
11
|
-
*/
|
|
12
7
|
export declare function SelectionBar({ ctx }: {
|
|
13
8
|
ctx: WidgetContext;
|
|
14
9
|
}): JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WidgetContext } from '../context.js';
|
|
2
|
+
import { type Strings } from '../i18n.js';
|
|
3
|
+
export declare function IndicatorSettings({ ctx, id, Dialog }: {
|
|
4
|
+
ctx: WidgetContext;
|
|
5
|
+
id: string;
|
|
6
|
+
Dialog: (p: {
|
|
7
|
+
title: string;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
wide?: boolean;
|
|
10
|
+
children: preact.ComponentChildren;
|
|
11
|
+
}) => preact.JSX.Element;
|
|
12
|
+
}): import("preact").JSX.Element | null;
|
|
13
|
+
export type { Strings };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
import type { IntervalUnit, IntervalVisibility } from '@funnest/charts';
|
|
3
|
+
import type { Strings } from '../i18n.js';
|
|
4
|
+
/** 보임: each interval unit, on or off, and the range of it (TradingView's Visibility tab). */
|
|
5
|
+
export declare const INTERVAL_UNITS: {
|
|
6
|
+
unit: IntervalUnit;
|
|
7
|
+
max: number;
|
|
8
|
+
label: (t: Strings) => string;
|
|
9
|
+
}[];
|
|
10
|
+
/** Drops units left at "all of it": nothing left → undefined (shown everywhere). */
|
|
11
|
+
export declare function cleanIntervals(v: IntervalVisibility | undefined): IntervalVisibility | undefined;
|
|
12
|
+
export declare function IntervalVisibilityEditor({ t, value, onChange }: {
|
|
13
|
+
t: Strings;
|
|
14
|
+
value: IntervalVisibility | undefined;
|
|
15
|
+
onChange: (v: IntervalVisibility) => void;
|
|
16
|
+
}): import("preact").JSX.Element;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -161,6 +161,66 @@ export declare const STRINGS: {
|
|
|
161
161
|
source: string;
|
|
162
162
|
inputs: string;
|
|
163
163
|
style: string;
|
|
164
|
+
tabInputs: string;
|
|
165
|
+
tabStyle: string;
|
|
166
|
+
tabVisibility: string;
|
|
167
|
+
calculation: string;
|
|
168
|
+
timeframe: string;
|
|
169
|
+
timeframeChart: string;
|
|
170
|
+
waitClose: string;
|
|
171
|
+
timeframeHint: string;
|
|
172
|
+
plotType: string;
|
|
173
|
+
kindLine: string;
|
|
174
|
+
kindStep: string;
|
|
175
|
+
kindArea: string;
|
|
176
|
+
kindHistogram: string;
|
|
177
|
+
kindColumns: string;
|
|
178
|
+
kindCircles: string;
|
|
179
|
+
kindCross: string;
|
|
180
|
+
indLevels: string;
|
|
181
|
+
fillBand: string;
|
|
182
|
+
outputValues: string;
|
|
183
|
+
precision: string;
|
|
184
|
+
precisionDefault: string;
|
|
185
|
+
axisLabels: string;
|
|
186
|
+
statusValues: string;
|
|
187
|
+
inputValues: string;
|
|
188
|
+
statusInputs: string;
|
|
189
|
+
visibilityHint: string;
|
|
190
|
+
visSeconds: string;
|
|
191
|
+
visMinutes: string;
|
|
192
|
+
visHours: string;
|
|
193
|
+
visDays: string;
|
|
194
|
+
visWeeks: string;
|
|
195
|
+
visMonths: string;
|
|
196
|
+
rangeFrom: string;
|
|
197
|
+
rangeTo: string;
|
|
198
|
+
defaults: string;
|
|
199
|
+
resetIndicator: string;
|
|
200
|
+
saveDefaults: string;
|
|
201
|
+
forgetDefaults: string;
|
|
202
|
+
ok: string;
|
|
203
|
+
lockView: string;
|
|
204
|
+
unlockView: string;
|
|
205
|
+
lockRatio: string;
|
|
206
|
+
levelValuesLabel: string;
|
|
207
|
+
note: string;
|
|
208
|
+
noteText: string;
|
|
209
|
+
bold: string;
|
|
210
|
+
italic: string;
|
|
211
|
+
noteH: string;
|
|
212
|
+
noteV: string;
|
|
213
|
+
alignLeft: string;
|
|
214
|
+
alignCenter: string;
|
|
215
|
+
alignRight: string;
|
|
216
|
+
alignTop: string;
|
|
217
|
+
alignMiddle: string;
|
|
218
|
+
alignBottom: string;
|
|
219
|
+
textColor: string;
|
|
220
|
+
coordinates: string;
|
|
221
|
+
point: string;
|
|
222
|
+
price: string;
|
|
223
|
+
time: string;
|
|
164
224
|
intervalMinutes: string;
|
|
165
225
|
intervalHours: string;
|
|
166
226
|
intervalDays: string;
|
|
@@ -388,6 +448,66 @@ export declare const STRINGS: {
|
|
|
388
448
|
source: string;
|
|
389
449
|
inputs: string;
|
|
390
450
|
style: string;
|
|
451
|
+
tabInputs: string;
|
|
452
|
+
tabStyle: string;
|
|
453
|
+
tabVisibility: string;
|
|
454
|
+
calculation: string;
|
|
455
|
+
timeframe: string;
|
|
456
|
+
timeframeChart: string;
|
|
457
|
+
waitClose: string;
|
|
458
|
+
timeframeHint: string;
|
|
459
|
+
plotType: string;
|
|
460
|
+
kindLine: string;
|
|
461
|
+
kindStep: string;
|
|
462
|
+
kindArea: string;
|
|
463
|
+
kindHistogram: string;
|
|
464
|
+
kindColumns: string;
|
|
465
|
+
kindCircles: string;
|
|
466
|
+
kindCross: string;
|
|
467
|
+
indLevels: string;
|
|
468
|
+
fillBand: string;
|
|
469
|
+
outputValues: string;
|
|
470
|
+
precision: string;
|
|
471
|
+
precisionDefault: string;
|
|
472
|
+
axisLabels: string;
|
|
473
|
+
statusValues: string;
|
|
474
|
+
inputValues: string;
|
|
475
|
+
statusInputs: string;
|
|
476
|
+
visibilityHint: string;
|
|
477
|
+
visSeconds: string;
|
|
478
|
+
visMinutes: string;
|
|
479
|
+
visHours: string;
|
|
480
|
+
visDays: string;
|
|
481
|
+
visWeeks: string;
|
|
482
|
+
visMonths: string;
|
|
483
|
+
rangeFrom: string;
|
|
484
|
+
rangeTo: string;
|
|
485
|
+
defaults: string;
|
|
486
|
+
resetIndicator: string;
|
|
487
|
+
saveDefaults: string;
|
|
488
|
+
forgetDefaults: string;
|
|
489
|
+
ok: string;
|
|
490
|
+
lockView: string;
|
|
491
|
+
unlockView: string;
|
|
492
|
+
lockRatio: string;
|
|
493
|
+
levelValuesLabel: string;
|
|
494
|
+
note: string;
|
|
495
|
+
noteText: string;
|
|
496
|
+
bold: string;
|
|
497
|
+
italic: string;
|
|
498
|
+
noteH: string;
|
|
499
|
+
noteV: string;
|
|
500
|
+
alignLeft: string;
|
|
501
|
+
alignCenter: string;
|
|
502
|
+
alignRight: string;
|
|
503
|
+
alignTop: string;
|
|
504
|
+
alignMiddle: string;
|
|
505
|
+
alignBottom: string;
|
|
506
|
+
textColor: string;
|
|
507
|
+
coordinates: string;
|
|
508
|
+
point: string;
|
|
509
|
+
price: string;
|
|
510
|
+
time: string;
|
|
391
511
|
intervalMinutes: string;
|
|
392
512
|
intervalHours: string;
|
|
393
513
|
intervalDays: string;
|
package/dist/index.js
CHANGED
|
@@ -270,7 +270,7 @@ n = { __e: function(n2, t3, r3, u3) {
|
|
|
270
270
|
}, e = /* @__PURE__ */ Symbol(), l = /(PointerCapture)$|Capture$/i, c = 0, a = {}, s = 0;
|
|
271
271
|
|
|
272
272
|
// src/components/drawing-toolbar.tsx
|
|
273
|
-
import { drawingLevels, drawingOption } from "@funnest/charts";
|
|
273
|
+
import { drawingLevels, drawingOption, timeZoneOffset } from "@funnest/charts";
|
|
274
274
|
|
|
275
275
|
// ../../node_modules/.pnpm/preact@11.2.0/node_modules/preact/hooks/dist/hooks.mjs
|
|
276
276
|
var t2;
|
|
@@ -590,6 +590,66 @@ var STRINGS = {
|
|
|
590
590
|
source: "\uAC00\uACA9 \uAE30\uC900",
|
|
591
591
|
inputs: "\uC785\uB825\uAC12",
|
|
592
592
|
style: "\uC2A4\uD0C0\uC77C",
|
|
593
|
+
tabInputs: "\uC778\uD48B",
|
|
594
|
+
tabStyle: "\uBAA8\uC2B5",
|
|
595
|
+
tabVisibility: "\uBCF4\uC784",
|
|
596
|
+
calculation: "\uACC4\uC0B0",
|
|
597
|
+
timeframe: "\uD0C0\uC784\uD504\uB808\uC784",
|
|
598
|
+
timeframeChart: "\uCC28\uD2B8",
|
|
599
|
+
waitClose: "\uD0C0\uC784\uD504\uB808\uC784 \uB9C8\uAC10 \uB300\uAE30",
|
|
600
|
+
timeframeHint: "\uC774 \uC9C0\uD45C\uB97C \uACE0\uB978 \uC2DC\uAC04 \uB2E8\uC704\uC758 \uBD09\uC73C\uB85C \uACC4\uC0B0\uD574\uC694. \uB9C8\uAC10 \uB300\uAE30\uB97C \uCF1C\uBA74 \uB2E4 \uB05D\uB09C \uBD09\uC758 \uAC12\uB9CC \uADF8\uB824\uC11C, \uADF8\uB824\uC9C4 \uC120\uC774 \uB098\uC911\uC5D0 \uBC14\uB00C\uC9C0 \uC54A\uC544\uC694.",
|
|
601
|
+
plotType: "\uADF8\uB9AC\uB294 \uBC29\uC2DD",
|
|
602
|
+
kindLine: "\uC120",
|
|
603
|
+
kindStep: "\uACC4\uB2E8",
|
|
604
|
+
kindArea: "\uC601\uC5ED",
|
|
605
|
+
kindHistogram: "\uD788\uC2A4\uD1A0\uADF8\uB7A8",
|
|
606
|
+
kindColumns: "\uB9C9\uB300",
|
|
607
|
+
kindCircles: "\uC810",
|
|
608
|
+
kindCross: "\uC2ED\uC790",
|
|
609
|
+
indLevels: "\uAE30\uC900\uC120",
|
|
610
|
+
fillBand: "\uBC30\uACBD",
|
|
611
|
+
outputValues: "\uCD9C\uB825 \uAC12",
|
|
612
|
+
precision: "\uC815\uBC00\uB3C4",
|
|
613
|
+
precisionDefault: "\uAE30\uBCF8\uC124\uC815",
|
|
614
|
+
axisLabels: "\uD504\uB77C\uC774\uC2A4 \uC2A4\uCF00\uC77C \uB77C\uBCA8",
|
|
615
|
+
statusValues: "\uC0C1\uD0DC \uB77C\uC778 \uBC38\uB958",
|
|
616
|
+
inputValues: "\uC785\uB825 \uAC12",
|
|
617
|
+
statusInputs: "\uC0C1\uD0DC \uD45C\uC2DC\uC904\uC758 \uC785\uB825\uAC12",
|
|
618
|
+
visibilityHint: "\uCCB4\uD06C\uD55C \uC2DC\uAC04 \uB2E8\uC704\uC758 \uCC28\uD2B8\uC5D0\uC11C\uB9CC \uBCF4\uC5EC\uC694. \uBC94\uC704\uB97C \uC881\uD788\uBA74 \uADF8 \uC548\uC758 \uC8FC\uAE30\uC5D0\uC11C\uB9CC \uBCF4\uC5EC\uC694 (\uC608: \uBD84 1\u201315).",
|
|
619
|
+
visSeconds: "\uCD08",
|
|
620
|
+
visMinutes: "\uBD84",
|
|
621
|
+
visHours: "\uC2DC\uAC04",
|
|
622
|
+
visDays: "\uC77C",
|
|
623
|
+
visWeeks: "\uC8FC",
|
|
624
|
+
visMonths: "\uAC1C\uC6D4",
|
|
625
|
+
rangeFrom: "\uBD80\uD130",
|
|
626
|
+
rangeTo: "\uAE4C\uC9C0",
|
|
627
|
+
defaults: "\uAE30\uBCF8\uC124\uC815",
|
|
628
|
+
resetIndicator: "\uAE30\uBCF8\uAC12\uC73C\uB85C \uC7AC\uC124\uC815",
|
|
629
|
+
saveDefaults: "\uAE30\uBCF8\uAC12\uC73C\uB85C \uC800\uC7A5",
|
|
630
|
+
forgetDefaults: "\uC800\uC7A5\uD55C \uAE30\uBCF8\uAC12 \uC9C0\uC6B0\uAE30",
|
|
631
|
+
ok: "\uD655\uC778",
|
|
632
|
+
lockView: "\uCC28\uD2B8 \uACE0\uC815",
|
|
633
|
+
unlockView: "\uCC28\uD2B8 \uACE0\uC815 \uD480\uAE30",
|
|
634
|
+
lockRatio: "\uAC00\uACA9 \uCD95 \uBE44\uC728 \uACE0\uC815",
|
|
635
|
+
levelValuesLabel: "\uAE30\uC900\uC120 \uAC12",
|
|
636
|
+
note: "\uD14D\uC2A4\uD2B8",
|
|
637
|
+
noteText: "\uD14D\uC2A4\uD2B8 \uC785\uB825",
|
|
638
|
+
bold: "\uAD75\uAC8C",
|
|
639
|
+
italic: "\uAE30\uC6B8\uC784",
|
|
640
|
+
noteH: "\uAC00\uB85C \uC704\uCE58",
|
|
641
|
+
noteV: "\uC138\uB85C \uC704\uCE58",
|
|
642
|
+
alignLeft: "\uC67C\uCABD",
|
|
643
|
+
alignCenter: "\uAC00\uC6B4\uB370",
|
|
644
|
+
alignRight: "\uC624\uB978\uCABD",
|
|
645
|
+
alignTop: "\uC704",
|
|
646
|
+
alignMiddle: "\uAC00\uC6B4\uB370",
|
|
647
|
+
alignBottom: "\uC544\uB798",
|
|
648
|
+
textColor: "\uAE00\uC790 \uC0C9",
|
|
649
|
+
coordinates: "\uC88C\uD45C",
|
|
650
|
+
point: "\uC810",
|
|
651
|
+
price: "\uAC00\uACA9",
|
|
652
|
+
time: "\uC2DC\uAC04",
|
|
593
653
|
// intervals
|
|
594
654
|
intervalMinutes: "\uBD84",
|
|
595
655
|
intervalHours: "\uC2DC\uAC04",
|
|
@@ -819,6 +879,66 @@ var STRINGS = {
|
|
|
819
879
|
source: "Source",
|
|
820
880
|
inputs: "Inputs",
|
|
821
881
|
style: "Style",
|
|
882
|
+
tabInputs: "Inputs",
|
|
883
|
+
tabStyle: "Style",
|
|
884
|
+
tabVisibility: "Visibility",
|
|
885
|
+
calculation: "Calculation",
|
|
886
|
+
timeframe: "Timeframe",
|
|
887
|
+
timeframeChart: "Chart",
|
|
888
|
+
waitClose: "Wait for timeframe closes",
|
|
889
|
+
timeframeHint: "Computed on bars of the chosen interval. Waiting for closes draws only finished bars, so what is drawn never changes.",
|
|
890
|
+
plotType: "Plot type",
|
|
891
|
+
kindLine: "Line",
|
|
892
|
+
kindStep: "Step line",
|
|
893
|
+
kindArea: "Area",
|
|
894
|
+
kindHistogram: "Histogram",
|
|
895
|
+
kindColumns: "Columns",
|
|
896
|
+
kindCircles: "Circles",
|
|
897
|
+
kindCross: "Cross",
|
|
898
|
+
indLevels: "Levels",
|
|
899
|
+
fillBand: "Background",
|
|
900
|
+
outputValues: "Output values",
|
|
901
|
+
precision: "Precision",
|
|
902
|
+
precisionDefault: "Default",
|
|
903
|
+
axisLabels: "Labels on price scale",
|
|
904
|
+
statusValues: "Values in status line",
|
|
905
|
+
inputValues: "Input values",
|
|
906
|
+
statusInputs: "Inputs in status line",
|
|
907
|
+
visibilityHint: "Shown only on charts of the checked units; narrow a range to show it only on those intervals (e.g. minutes 1\u201315).",
|
|
908
|
+
visSeconds: "Seconds",
|
|
909
|
+
visMinutes: "Minutes",
|
|
910
|
+
visHours: "Hours",
|
|
911
|
+
visDays: "Days",
|
|
912
|
+
visWeeks: "Weeks",
|
|
913
|
+
visMonths: "Months",
|
|
914
|
+
rangeFrom: "from",
|
|
915
|
+
rangeTo: "to",
|
|
916
|
+
defaults: "Defaults",
|
|
917
|
+
resetIndicator: "Reset settings",
|
|
918
|
+
saveDefaults: "Save as default",
|
|
919
|
+
forgetDefaults: "Forget saved default",
|
|
920
|
+
ok: "Ok",
|
|
921
|
+
lockView: "Lock chart",
|
|
922
|
+
unlockView: "Unlock chart",
|
|
923
|
+
lockRatio: "Lock price to bar ratio",
|
|
924
|
+
levelValuesLabel: "Level values",
|
|
925
|
+
note: "Text",
|
|
926
|
+
noteText: "Type text",
|
|
927
|
+
bold: "Bold",
|
|
928
|
+
italic: "Italic",
|
|
929
|
+
noteH: "Horizontal",
|
|
930
|
+
noteV: "Vertical",
|
|
931
|
+
alignLeft: "Left",
|
|
932
|
+
alignCenter: "Center",
|
|
933
|
+
alignRight: "Right",
|
|
934
|
+
alignTop: "Top",
|
|
935
|
+
alignMiddle: "Middle",
|
|
936
|
+
alignBottom: "Bottom",
|
|
937
|
+
textColor: "Text color",
|
|
938
|
+
coordinates: "Coordinates",
|
|
939
|
+
point: "Point",
|
|
940
|
+
price: "Price",
|
|
941
|
+
time: "Time",
|
|
822
942
|
intervalMinutes: "Minutes",
|
|
823
943
|
intervalHours: "Hours",
|
|
824
944
|
intervalDays: "Days",
|
|
@@ -905,6 +1025,74 @@ function a3(t3, e3, n2, u3, a4, i3) {
|
|
|
905
1025
|
return (a4 || i3) && (s3.__source = a4, s3.__self = i3), n.vnode && n.vnode(s3), s3;
|
|
906
1026
|
}
|
|
907
1027
|
|
|
1028
|
+
// src/components/interval-visibility.tsx
|
|
1029
|
+
var INTERVAL_UNITS = [
|
|
1030
|
+
{ unit: "seconds", max: 59, label: (t3) => t3.visSeconds },
|
|
1031
|
+
{ unit: "minutes", max: 59, label: (t3) => t3.visMinutes },
|
|
1032
|
+
{ unit: "hours", max: 24, label: (t3) => t3.visHours },
|
|
1033
|
+
{ unit: "days", max: 366, label: (t3) => t3.visDays },
|
|
1034
|
+
{ unit: "weeks", max: 52, label: (t3) => t3.visWeeks },
|
|
1035
|
+
{ unit: "months", max: 12, label: (t3) => t3.visMonths }
|
|
1036
|
+
];
|
|
1037
|
+
function cleanIntervals(v3) {
|
|
1038
|
+
if (!v3) return void 0;
|
|
1039
|
+
const out = {};
|
|
1040
|
+
for (const { unit, max } of INTERVAL_UNITS) {
|
|
1041
|
+
const rule = v3[unit];
|
|
1042
|
+
if (rule === void 0) continue;
|
|
1043
|
+
if (rule === false) out[unit] = false;
|
|
1044
|
+
else {
|
|
1045
|
+
const lo = Math.max(1, Math.min(max, Math.round(rule[0]) || 1));
|
|
1046
|
+
const hi = Math.max(lo, Math.min(max, Math.round(rule[1]) || max));
|
|
1047
|
+
if (lo !== 1 || hi !== max) out[unit] = [lo, hi];
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return Object.keys(out).length ? out : void 0;
|
|
1051
|
+
}
|
|
1052
|
+
function IntervalVisibilityEditor({ t: t3, value, onChange }) {
|
|
1053
|
+
const v3 = value ?? {};
|
|
1054
|
+
const set = (unit, rule) => {
|
|
1055
|
+
const next = { ...v3 };
|
|
1056
|
+
if (rule === void 0) delete next[unit];
|
|
1057
|
+
else next[unit] = rule;
|
|
1058
|
+
onChange(next);
|
|
1059
|
+
};
|
|
1060
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-rows fnc-vis", children: INTERVAL_UNITS.map(({ unit, max, label }) => {
|
|
1061
|
+
const rule = v3[unit];
|
|
1062
|
+
const on = rule !== false;
|
|
1063
|
+
const [lo, hi] = Array.isArray(rule) ? rule : [1, max];
|
|
1064
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
1065
|
+
/* @__PURE__ */ a3("label", { class: "fnc-vis-unit", children: [
|
|
1066
|
+
/* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked: on, onChange: (e3) => set(unit, e3.currentTarget.checked ? void 0 : false) }),
|
|
1067
|
+
label(t3)
|
|
1068
|
+
] }),
|
|
1069
|
+
/* @__PURE__ */ a3(
|
|
1070
|
+
"input",
|
|
1071
|
+
{
|
|
1072
|
+
class: "fnc-input fnc-input-num",
|
|
1073
|
+
inputMode: "numeric",
|
|
1074
|
+
value: String(lo),
|
|
1075
|
+
disabled: !on,
|
|
1076
|
+
"aria-label": `${label(t3)} ${t3.rangeFrom}`,
|
|
1077
|
+
onChange: (e3) => set(unit, [Number(e3.currentTarget.value) || 1, hi])
|
|
1078
|
+
}
|
|
1079
|
+
),
|
|
1080
|
+
/* @__PURE__ */ a3("span", { class: "fnc-vis-dash", children: "\u2013" }),
|
|
1081
|
+
/* @__PURE__ */ a3(
|
|
1082
|
+
"input",
|
|
1083
|
+
{
|
|
1084
|
+
class: "fnc-input fnc-input-num",
|
|
1085
|
+
inputMode: "numeric",
|
|
1086
|
+
value: String(hi),
|
|
1087
|
+
disabled: !on,
|
|
1088
|
+
"aria-label": `${label(t3)} ${t3.rangeTo}`,
|
|
1089
|
+
onChange: (e3) => set(unit, [lo, Number(e3.currentTarget.value) || max])
|
|
1090
|
+
}
|
|
1091
|
+
)
|
|
1092
|
+
] });
|
|
1093
|
+
}) });
|
|
1094
|
+
}
|
|
1095
|
+
|
|
908
1096
|
// src/icons.tsx
|
|
909
1097
|
function Icon({ children, size = 20 }) {
|
|
910
1098
|
return /* @__PURE__ */ a3(
|
|
@@ -1064,6 +1252,10 @@ var CalendarIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
|
|
|
1064
1252
|
/* @__PURE__ */ a3("rect", { x: "3.5", y: "4.5", width: "13", height: "12", rx: "2" }),
|
|
1065
1253
|
/* @__PURE__ */ a3("path", { d: "M3.5 8.5h13M7 3v3M13 3v3" })
|
|
1066
1254
|
] });
|
|
1255
|
+
var ClockIcon = () => /* @__PURE__ */ a3(Icon, { size: 13, children: [
|
|
1256
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
|
|
1257
|
+
/* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
|
|
1258
|
+
] });
|
|
1067
1259
|
var SettingsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
1068
1260
|
/* @__PURE__ */ a3("path", { d: "M10 12.6a2.6 2.6 0 1 0 0-5.2 2.6 2.6 0 0 0 0 5.2z" }),
|
|
1069
1261
|
/* @__PURE__ */ a3("path", { d: "M16.2 12a1.3 1.3 0 0 0 .26 1.43l.05.05a1.6 1.6 0 1 1-2.26 2.26l-.05-.05a1.3 1.3 0 0 0-1.43-.26 1.3 1.3 0 0 0-.79 1.19v.14a1.6 1.6 0 0 1-3.2 0v-.07a1.3 1.3 0 0 0-.85-1.19 1.3 1.3 0 0 0-1.43.26l-.05.05a1.6 1.6 0 1 1-2.26-2.26l.05-.05A1.3 1.3 0 0 0 4.5 12a1.3 1.3 0 0 0-1.19-.79h-.14a1.6 1.6 0 0 1 0-3.2h.07a1.3 1.3 0 0 0 1.19-.85 1.3 1.3 0 0 0-.26-1.43l-.05-.05a1.6 1.6 0 1 1 2.26-2.26l.05.05a1.3 1.3 0 0 0 1.43.26h.06a1.3 1.3 0 0 0 .79-1.19v-.14a1.6 1.6 0 0 1 3.2 0v.07a1.3 1.3 0 0 0 .79 1.19 1.3 1.3 0 0 0 1.43-.26l.05-.05a1.6 1.6 0 1 1 2.26 2.26l-.05.05a1.3 1.3 0 0 0-.26 1.43v.06a1.3 1.3 0 0 0 1.19.79h.14a1.6 1.6 0 0 1 0 3.2h-.07a1.3 1.3 0 0 0-1.19.79z" })
|
|
@@ -1142,6 +1334,7 @@ var CopyIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
|
1142
1334
|
/* @__PURE__ */ a3("rect", { x: "7", y: "7", width: "9.5", height: "9.5", rx: "1.8" }),
|
|
1143
1335
|
/* @__PURE__ */ a3("path", { d: "M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7" })
|
|
1144
1336
|
] });
|
|
1337
|
+
var TextIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M4.5 5V3.8h11V5M10 3.8v12.5M7.5 16.3h5" }) });
|
|
1145
1338
|
|
|
1146
1339
|
// src/store.ts
|
|
1147
1340
|
var Store = class {
|
|
@@ -1483,6 +1676,47 @@ function DashGlyph({ dash }) {
|
|
|
1483
1676
|
const pattern = dash === "dashed" ? "4 3" : dash === "dotted" ? "1 3" : void 0;
|
|
1484
1677
|
return /* @__PURE__ */ a3("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "aria-hidden": "true", children: /* @__PURE__ */ a3("path", { d: "M3 10h14", "stroke-dasharray": pattern }) });
|
|
1485
1678
|
}
|
|
1679
|
+
function DrawingCoords({ ctx, drawing, t: t3 }) {
|
|
1680
|
+
const tz = ctx.chart.timeZone;
|
|
1681
|
+
const toLocal = (time) => new Date(time + timeZoneOffset(time, tz)).toISOString().slice(0, 16);
|
|
1682
|
+
const fromLocal = (text) => {
|
|
1683
|
+
const asUtc = Date.parse(`${text}:00Z`);
|
|
1684
|
+
if (!Number.isFinite(asUtc)) return null;
|
|
1685
|
+
const guess = asUtc - timeZoneOffset(asUtc, tz);
|
|
1686
|
+
return asUtc - timeZoneOffset(guess, tz);
|
|
1687
|
+
};
|
|
1688
|
+
const setPoint = (i3, patch) => ctx.chart.updateDrawing(drawing.id, { points: drawing.points.map((p3, j2) => j2 === i3 ? { ...p3, ...patch } : p3) });
|
|
1689
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-coords", children: drawing.points.map((p3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-coord-row", children: [
|
|
1690
|
+
/* @__PURE__ */ a3("span", { class: "fnc-coord-name", children: drawing.points.length > 1 ? `${t3.point} ${i3 + 1}` : t3.point }),
|
|
1691
|
+
/* @__PURE__ */ a3(
|
|
1692
|
+
"input",
|
|
1693
|
+
{
|
|
1694
|
+
class: "fnc-input fnc-coord-price",
|
|
1695
|
+
type: "number",
|
|
1696
|
+
step: "any",
|
|
1697
|
+
defaultValue: String(p3.price),
|
|
1698
|
+
"aria-label": `${t3.point} ${i3 + 1} ${t3.price}`,
|
|
1699
|
+
onChange: (e3) => {
|
|
1700
|
+
const v3 = Number(e3.target.value);
|
|
1701
|
+
if (Number.isFinite(v3)) setPoint(i3, { price: v3 });
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
),
|
|
1705
|
+
/* @__PURE__ */ a3(
|
|
1706
|
+
"input",
|
|
1707
|
+
{
|
|
1708
|
+
class: "fnc-input fnc-coord-time",
|
|
1709
|
+
type: "datetime-local",
|
|
1710
|
+
defaultValue: toLocal(p3.time),
|
|
1711
|
+
"aria-label": `${t3.point} ${i3 + 1} ${t3.time}`,
|
|
1712
|
+
onChange: (e3) => {
|
|
1713
|
+
const time = fromLocal(e3.target.value);
|
|
1714
|
+
if (time !== null) setPoint(i3, { time });
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
)
|
|
1718
|
+
] }, `${drawing.id}:${i3}:${p3.time}:${p3.price}`)) });
|
|
1719
|
+
}
|
|
1486
1720
|
function SelectionBar({ ctx }) {
|
|
1487
1721
|
const s3 = useStore(ctx.store);
|
|
1488
1722
|
const t3 = stringsOf(s3);
|
|
@@ -1899,6 +2133,108 @@ function SelectionBar({ ctx }) {
|
|
|
1899
2133
|
["back", t3.sendToBack]
|
|
1900
2134
|
].map(([where, label]) => /* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitem", disabled: !ctx.chart.canMoveDrawing(d3.id, where), onClick: () => ctx.chart.moveDrawing(d3.id, where), children: label })) })
|
|
1901
2135
|
] }),
|
|
2136
|
+
def && !def.text && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
2137
|
+
/* @__PURE__ */ a3(
|
|
2138
|
+
"button",
|
|
2139
|
+
{
|
|
2140
|
+
class: style.text ? "fnc-btn fnc-btn-on" : "fnc-btn",
|
|
2141
|
+
"data-tip": t3.note,
|
|
2142
|
+
"aria-label": t3.note,
|
|
2143
|
+
"aria-expanded": menu === "note",
|
|
2144
|
+
onClick: () => setMenu(menu === "note" ? null : "note"),
|
|
2145
|
+
children: /* @__PURE__ */ a3(TextIcon, {})
|
|
2146
|
+
}
|
|
2147
|
+
),
|
|
2148
|
+
menu === "note" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-note-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
|
|
2149
|
+
/* @__PURE__ */ a3(
|
|
2150
|
+
"textarea",
|
|
2151
|
+
{
|
|
2152
|
+
defaultValue: style.text ?? "",
|
|
2153
|
+
placeholder: t3.noteText,
|
|
2154
|
+
"aria-label": t3.noteText,
|
|
2155
|
+
onInput: (e3) => {
|
|
2156
|
+
const text = e3.target.value;
|
|
2157
|
+
const { text: _drop, ...rest } = style;
|
|
2158
|
+
setStyleRaw(text.trim() ? { ...rest, text } : rest);
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
2161
|
+
d3.id
|
|
2162
|
+
),
|
|
2163
|
+
/* @__PURE__ */ a3("div", { class: "fnc-note-row", children: [
|
|
2164
|
+
/* @__PURE__ */ a3(
|
|
2165
|
+
"input",
|
|
2166
|
+
{
|
|
2167
|
+
type: "color",
|
|
2168
|
+
class: "fnc-color",
|
|
2169
|
+
"aria-label": t3.textColor,
|
|
2170
|
+
value: /^#[0-9a-f]{6}$/i.test(style.textColor ?? d3.color ?? "") ? style.textColor ?? d3.color : "#3182f6",
|
|
2171
|
+
onInput: (e3) => setStyle({ textColor: e3.target.value })
|
|
2172
|
+
}
|
|
2173
|
+
),
|
|
2174
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select", "aria-label": t3.fontSize, value: String(style.fontSize ?? 14), onChange: (e3) => setStyle({ fontSize: Number(e3.target.value) }), children: [10, 11, 12, 14, 16, 20, 24, 28, 32, 40].map((n2) => /* @__PURE__ */ a3("option", { value: String(n2), children: [
|
|
2175
|
+
n2,
|
|
2176
|
+
"px"
|
|
2177
|
+
] })) }),
|
|
2178
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-note-toggle", "aria-pressed": !!style.bold, "aria-label": t3.bold, onClick: () => setStyle({ bold: !style.bold }), children: /* @__PURE__ */ a3("b", { children: "B" }) }),
|
|
2179
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-note-toggle", "aria-pressed": !!style.italic, "aria-label": t3.italic, onClick: () => setStyle({ italic: !style.italic }), children: /* @__PURE__ */ a3("i", { children: "I" }) })
|
|
2180
|
+
] }),
|
|
2181
|
+
/* @__PURE__ */ a3("div", { class: "fnc-note-row", children: [
|
|
2182
|
+
/* @__PURE__ */ a3("span", { children: t3.noteH }),
|
|
2183
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select", "aria-label": t3.noteH, value: style.textH ?? "center", onChange: (e3) => setStyle({ textH: e3.target.value }), children: [
|
|
2184
|
+
/* @__PURE__ */ a3("option", { value: "left", children: t3.alignLeft }),
|
|
2185
|
+
/* @__PURE__ */ a3("option", { value: "center", children: t3.alignCenter }),
|
|
2186
|
+
/* @__PURE__ */ a3("option", { value: "right", children: t3.alignRight })
|
|
2187
|
+
] }),
|
|
2188
|
+
/* @__PURE__ */ a3("span", { children: t3.noteV }),
|
|
2189
|
+
/* @__PURE__ */ a3(
|
|
2190
|
+
"select",
|
|
2191
|
+
{
|
|
2192
|
+
class: "fnc-select",
|
|
2193
|
+
"aria-label": t3.noteV,
|
|
2194
|
+
value: style.textV ?? (def.note === "line" ? "top" : "middle"),
|
|
2195
|
+
onChange: (e3) => setStyle({ textV: e3.target.value }),
|
|
2196
|
+
children: [
|
|
2197
|
+
/* @__PURE__ */ a3("option", { value: "top", children: t3.alignTop }),
|
|
2198
|
+
/* @__PURE__ */ a3("option", { value: "middle", children: t3.alignMiddle }),
|
|
2199
|
+
/* @__PURE__ */ a3("option", { value: "bottom", children: t3.alignBottom })
|
|
2200
|
+
]
|
|
2201
|
+
}
|
|
2202
|
+
)
|
|
2203
|
+
] })
|
|
2204
|
+
] })
|
|
2205
|
+
] }),
|
|
2206
|
+
/* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
2207
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": t3.coordinates, "aria-label": t3.coordinates, "aria-expanded": menu === "coords", onClick: () => setMenu(menu === "coords" ? null : "coords"), children: /* @__PURE__ */ a3(CrossCursorIcon, {}) }),
|
|
2208
|
+
menu === "coords" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-coords-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: /* @__PURE__ */ a3(DrawingCoords, { ctx, drawing: d3, t: t3 }) })
|
|
2209
|
+
] }),
|
|
2210
|
+
/* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
|
|
2211
|
+
/* @__PURE__ */ a3(
|
|
2212
|
+
"button",
|
|
2213
|
+
{
|
|
2214
|
+
class: style.intervals ? "fnc-btn fnc-btn-on" : "fnc-btn",
|
|
2215
|
+
"data-tip": t3.tabVisibility,
|
|
2216
|
+
"aria-label": t3.tabVisibility,
|
|
2217
|
+
"aria-expanded": menu === "visibility",
|
|
2218
|
+
onClick: () => setMenu(menu === "visibility" ? null : "visibility"),
|
|
2219
|
+
children: /* @__PURE__ */ a3(ClockIcon, {})
|
|
2220
|
+
}
|
|
2221
|
+
),
|
|
2222
|
+
menu === "visibility" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-visibility-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
|
|
2223
|
+
/* @__PURE__ */ a3("p", { class: "fnc-hint", children: t3.visibilityHint }),
|
|
2224
|
+
/* @__PURE__ */ a3(
|
|
2225
|
+
IntervalVisibilityEditor,
|
|
2226
|
+
{
|
|
2227
|
+
t: t3,
|
|
2228
|
+
value: style.intervals,
|
|
2229
|
+
onChange: (v3) => {
|
|
2230
|
+
const intervals = cleanIntervals(v3);
|
|
2231
|
+
const { intervals: _drop, ...rest } = style;
|
|
2232
|
+
setStyleRaw(intervals ? { ...rest, intervals } : rest);
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
)
|
|
2236
|
+
] })
|
|
2237
|
+
] }),
|
|
1902
2238
|
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": locked ? t3.unlock : t3.lock, "aria-label": locked ? t3.unlock : t3.lock, "aria-pressed": locked, onClick: () => setStyle({ locked: !locked }), children: /* @__PURE__ */ a3(LockIcon, { open: !locked }) }),
|
|
1903
2239
|
/* @__PURE__ */ a3(
|
|
1904
2240
|
"button",
|
|
@@ -2013,11 +2349,7 @@ function RangeBar({ ctx }) {
|
|
|
2013
2349
|
}
|
|
2014
2350
|
|
|
2015
2351
|
// src/components/indicator-dialogs.tsx
|
|
2016
|
-
import
|
|
2017
|
-
maLines,
|
|
2018
|
-
PRICE_SOURCES,
|
|
2019
|
-
SERIES_COLORS
|
|
2020
|
-
} from "@funnest/charts";
|
|
2352
|
+
import "@funnest/charts";
|
|
2021
2353
|
|
|
2022
2354
|
// src/components/go-to-date.tsx
|
|
2023
2355
|
var DAY2 = 864e5;
|
|
@@ -2152,6 +2484,364 @@ function GoToDateDialog({ ctx }) {
|
|
|
2152
2484
|
] }) });
|
|
2153
2485
|
}
|
|
2154
2486
|
|
|
2487
|
+
// src/components/indicator-settings.tsx
|
|
2488
|
+
import {
|
|
2489
|
+
maLines,
|
|
2490
|
+
PRICE_SOURCES,
|
|
2491
|
+
resolutionLabel as resolutionLabel2,
|
|
2492
|
+
resolutionToMs,
|
|
2493
|
+
SERIES_COLORS
|
|
2494
|
+
} from "@funnest/charts";
|
|
2495
|
+
var WIDTHS2 = [1, 2, 3, 4];
|
|
2496
|
+
var KINDS = ["line", "step", "area", "histogram", "columns", "circles", "cross"];
|
|
2497
|
+
var STYLES = ["solid", "dashed", "dotted"];
|
|
2498
|
+
var PRECISIONS = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
2499
|
+
var TIMEFRAMES = ["3", "5", "15", "30", "60", "120", "240", "1D", "1W", "1M"];
|
|
2500
|
+
var hex6 = (c3) => /^#[0-9a-f]{6}/i.test(c3) ? c3.slice(0, 7) : "#3182f6";
|
|
2501
|
+
var alphaOf = (c3) => /^#[0-9a-f]{8}$/i.test(c3) ? Math.round(parseInt(c3.slice(7, 9), 16) / 255 * 100) : 100;
|
|
2502
|
+
var withAlpha = (hex, pct) => {
|
|
2503
|
+
const base = hex6(hex);
|
|
2504
|
+
return pct >= 100 ? base : `${base}${Math.round(Math.max(0, pct) / 100 * 255).toString(16).padStart(2, "0")}`;
|
|
2505
|
+
};
|
|
2506
|
+
function ColorField({ value, label, onChange }) {
|
|
2507
|
+
const pct = alphaOf(value);
|
|
2508
|
+
return /* @__PURE__ */ a3("span", { class: "fnc-color-field", children: [
|
|
2509
|
+
/* @__PURE__ */ a3("input", { type: "color", class: "fnc-color", value: hex6(value), "aria-label": label, onInput: (e3) => onChange(withAlpha(e3.currentTarget.value, pct)) }),
|
|
2510
|
+
/* @__PURE__ */ a3(
|
|
2511
|
+
"input",
|
|
2512
|
+
{
|
|
2513
|
+
type: "range",
|
|
2514
|
+
class: "fnc-opacity",
|
|
2515
|
+
min: 0,
|
|
2516
|
+
max: 100,
|
|
2517
|
+
step: 5,
|
|
2518
|
+
value: pct,
|
|
2519
|
+
"aria-label": `${label} %`,
|
|
2520
|
+
title: `${pct}%`,
|
|
2521
|
+
onInput: (e3) => onChange(withAlpha(value, Number(e3.currentTarget.value)))
|
|
2522
|
+
}
|
|
2523
|
+
)
|
|
2524
|
+
] });
|
|
2525
|
+
}
|
|
2526
|
+
function seriesRows(def, params, styles, lines) {
|
|
2527
|
+
const own = def.compute([], params).series;
|
|
2528
|
+
if (lines) {
|
|
2529
|
+
return lines.map((l3, i3) => {
|
|
2530
|
+
const key = `l${i3}`;
|
|
2531
|
+
const s3 = own[i3];
|
|
2532
|
+
const st = styles?.[key];
|
|
2533
|
+
const color = st?.color ?? s3?.color ?? SERIES_COLORS[i3 % SERIES_COLORS.length];
|
|
2534
|
+
return { key, label: `${l3.period || "?"}`, color, width: st?.width ?? s3?.width ?? 1, visible: st?.visible ?? true, lineStyle: st?.lineStyle ?? s3?.lineStyle ?? "solid", kind: st?.kind ?? "line", ownKind: "line" };
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
return own.map((s3) => {
|
|
2538
|
+
const st = styles?.[s3.key];
|
|
2539
|
+
return {
|
|
2540
|
+
key: s3.key,
|
|
2541
|
+
label: s3.label,
|
|
2542
|
+
color: st?.color ?? s3.color,
|
|
2543
|
+
width: st?.width ?? s3.width,
|
|
2544
|
+
visible: st?.visible ?? s3.visible,
|
|
2545
|
+
lineStyle: st?.lineStyle ?? s3.lineStyle ?? "solid",
|
|
2546
|
+
kind: st?.kind ?? s3.kind,
|
|
2547
|
+
ownKind: s3.kind
|
|
2548
|
+
};
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
function SourceSelect({ value, locale, label, onChange }) {
|
|
2552
|
+
return /* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-source", value, "aria-label": label, onChange: (e3) => onChange(e3.currentTarget.value), children: PRICE_SOURCES.map((s3) => /* @__PURE__ */ a3("option", { value: s3.value, children: s3.label[locale] })) });
|
|
2553
|
+
}
|
|
2554
|
+
function Check({ label, checked, onChange }) {
|
|
2555
|
+
return /* @__PURE__ */ a3("label", { class: "fnc-row fnc-check-row", children: [
|
|
2556
|
+
/* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked, onChange: (e3) => onChange(e3.currentTarget.checked) }),
|
|
2557
|
+
/* @__PURE__ */ a3("span", { children: label })
|
|
2558
|
+
] });
|
|
2559
|
+
}
|
|
2560
|
+
function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
|
|
2561
|
+
const { locale, indicators, resolution, customIntervals, symbol } = useStore(ctx.store);
|
|
2562
|
+
const t3 = stringsOf(ctx.store.get());
|
|
2563
|
+
const config = indicators.find((c3) => c3.id === id);
|
|
2564
|
+
const def = config ? ctx.chart.indicatorDefinition(config.type) ?? null : null;
|
|
2565
|
+
const hasLines = !!def?.params.some((p3) => p3.kind === "lines");
|
|
2566
|
+
const onIndicator = !!config?.on;
|
|
2567
|
+
const initLines = (c3, params = c3?.params) => params && hasLines ? maLines(params).map((l3) => ({ period: String(l3.period), source: l3.source })) : [];
|
|
2568
|
+
const [tab, setTab] = d2("inputs");
|
|
2569
|
+
const [lines, setLines] = d2(() => initLines(config));
|
|
2570
|
+
const [values, setValues] = d2(
|
|
2571
|
+
() => Object.fromEntries(Object.entries(config?.params ?? {}).filter(([, v3]) => !Array.isArray(v3)).map(([k2, v3]) => [k2, String(v3)]))
|
|
2572
|
+
);
|
|
2573
|
+
const [rows, setRows] = d2(() => config && def ? seriesRows(def, config.params, config.styles, hasLines ? initLines(config) : null) : []);
|
|
2574
|
+
const [display, setDisplay] = d2(() => ({ ...config?.display ?? {} }));
|
|
2575
|
+
const [timeframe, setTimeframe] = d2(config?.timeframe ?? "");
|
|
2576
|
+
const [waitClose, setWaitClose] = d2(config?.waitClose !== false);
|
|
2577
|
+
const [menu, setMenu] = d2(false);
|
|
2578
|
+
const close = () => ctx.store.set({ dialog: null });
|
|
2579
|
+
if (!config || !def) return null;
|
|
2580
|
+
const probe = def.compute([], config.params);
|
|
2581
|
+
const hasLevels = !!probe.levels?.length;
|
|
2582
|
+
const hasFill = !!probe.fill || !!probe.fills?.length;
|
|
2583
|
+
const chartMs = (() => {
|
|
2584
|
+
try {
|
|
2585
|
+
return resolutionToMs(resolution);
|
|
2586
|
+
} catch {
|
|
2587
|
+
return 0;
|
|
2588
|
+
}
|
|
2589
|
+
})();
|
|
2590
|
+
const supported = symbol?.supportedResolutions;
|
|
2591
|
+
const timeframes = [.../* @__PURE__ */ new Set([...TIMEFRAMES, ...customIntervals])].filter((r3) => {
|
|
2592
|
+
try {
|
|
2593
|
+
return resolutionToMs(r3) > chartMs && (!supported?.length || supported.includes(r3));
|
|
2594
|
+
} catch {
|
|
2595
|
+
return false;
|
|
2596
|
+
}
|
|
2597
|
+
}).sort((a4, b) => resolutionToMs(a4) - resolutionToMs(b));
|
|
2598
|
+
if (timeframe && !timeframes.includes(timeframe)) timeframes.push(timeframe);
|
|
2599
|
+
const patchRow = (i3, p3) => setRows(rows.map((r3, j2) => j2 === i3 ? { ...r3, ...p3 } : r3));
|
|
2600
|
+
const setLinesAndRows = (next) => {
|
|
2601
|
+
setLines(next);
|
|
2602
|
+
setRows(
|
|
2603
|
+
next.map((l3, i3) => {
|
|
2604
|
+
const r3 = rows[i3];
|
|
2605
|
+
return r3 ? { ...r3, label: l3.period || "?" } : { key: `l${i3}`, label: l3.period || "?", color: SERIES_COLORS[i3 % SERIES_COLORS.length], width: 1, visible: true, lineStyle: "solid", kind: "line", ownKind: "line" };
|
|
2606
|
+
})
|
|
2607
|
+
);
|
|
2608
|
+
};
|
|
2609
|
+
const collect = () => {
|
|
2610
|
+
const params = {};
|
|
2611
|
+
for (const spec of def.params) {
|
|
2612
|
+
const clamp = (n2) => Math.min(spec.max ?? Infinity, Math.max(spec.min ?? -Infinity, n2));
|
|
2613
|
+
if (spec.kind === "lines") params[spec.key] = lines.filter((l3) => Number(l3.period) > 0).map((l3) => ({ period: clamp(Math.round(Number(l3.period))), source: l3.source }));
|
|
2614
|
+
else if (spec.kind === "source") params[spec.key] = values[spec.key] ?? "close";
|
|
2615
|
+
else {
|
|
2616
|
+
const n2 = Number(values[spec.key]);
|
|
2617
|
+
if (Number.isFinite(n2)) params[spec.key] = clamp(n2);
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
const kept = hasLines ? rows.filter((_3, i3) => Number(lines[i3]?.period) > 0) : rows;
|
|
2621
|
+
const styles = {};
|
|
2622
|
+
kept.forEach((r3, i3) => {
|
|
2623
|
+
const key = hasLines ? `l${i3}` : r3.key;
|
|
2624
|
+
styles[key] = { color: r3.color, width: r3.width, visible: r3.visible, ...r3.lineStyle !== "solid" ? { lineStyle: r3.lineStyle } : {}, ...r3.kind !== r3.ownKind ? { kind: r3.kind } : {} };
|
|
2625
|
+
});
|
|
2626
|
+
const d3 = { ...display };
|
|
2627
|
+
const intervals = cleanIntervals(d3.intervals);
|
|
2628
|
+
if (intervals) d3.intervals = intervals;
|
|
2629
|
+
else delete d3.intervals;
|
|
2630
|
+
for (const k2 of Object.keys(d3)) if (d3[k2] === void 0) delete d3[k2];
|
|
2631
|
+
return { params, styles, display: d3, timeframe, waitClose };
|
|
2632
|
+
};
|
|
2633
|
+
const apply = (e3) => {
|
|
2634
|
+
e3.preventDefault();
|
|
2635
|
+
const c3 = collect();
|
|
2636
|
+
ctx.chart.updateIndicator(id, { params: c3.params, styles: c3.styles, display: c3.display, timeframe: c3.timeframe, waitClose: c3.waitClose });
|
|
2637
|
+
close();
|
|
2638
|
+
};
|
|
2639
|
+
const reset = () => {
|
|
2640
|
+
const params = { ...def.defaults };
|
|
2641
|
+
const l3 = hasLines ? maLines(params).map((x2) => ({ period: String(x2.period), source: x2.source })) : [];
|
|
2642
|
+
setLines(l3);
|
|
2643
|
+
setValues(Object.fromEntries(Object.entries(params).filter(([, v3]) => !Array.isArray(v3)).map(([k2, v3]) => [k2, String(v3)])));
|
|
2644
|
+
setRows(seriesRows(def, params, void 0, hasLines ? l3 : null));
|
|
2645
|
+
setDisplay({});
|
|
2646
|
+
setTimeframe("");
|
|
2647
|
+
setWaitClose(true);
|
|
2648
|
+
setMenu(false);
|
|
2649
|
+
};
|
|
2650
|
+
const saveDefaults = () => {
|
|
2651
|
+
const c3 = collect();
|
|
2652
|
+
ctx.chart.saveIndicatorDefaults(config.type, { params: c3.params, styles: c3.styles, display: c3.display, ...c3.timeframe ? { timeframe: c3.timeframe } : {}, ...c3.waitClose ? {} : { waitClose: false } });
|
|
2653
|
+
setMenu(false);
|
|
2654
|
+
};
|
|
2655
|
+
const hasSaved = !!ctx.chart.indicatorDefaults(config.type);
|
|
2656
|
+
const forgetDefaults = () => {
|
|
2657
|
+
ctx.chart.saveIndicatorDefaults(config.type, null);
|
|
2658
|
+
setMenu(false);
|
|
2659
|
+
};
|
|
2660
|
+
const setD = (p3) => {
|
|
2661
|
+
const next = { ...display, ...p3 };
|
|
2662
|
+
for (const k2 of Object.keys(next)) if (next[k2] === void 0) delete next[k2];
|
|
2663
|
+
setDisplay(next);
|
|
2664
|
+
};
|
|
2665
|
+
const kindLabel = (k2) => ({ line: t3.kindLine, step: t3.kindStep, area: t3.kindArea, histogram: t3.kindHistogram, columns: t3.kindColumns, circles: t3.kindCircles, cross: t3.kindCross })[k2];
|
|
2666
|
+
const styleLabel = (s3) => ({ solid: t3.lineSolid, dashed: t3.lineDashed, dotted: t3.lineDotted })[s3];
|
|
2667
|
+
return /* @__PURE__ */ a3(Dialog2, { title: def.name[locale], onClose: close, wide: true, children: [
|
|
2668
|
+
/* @__PURE__ */ a3("div", { class: "fnc-tabs fnc-settings-tabs", role: "tablist", children: [
|
|
2669
|
+
["inputs", t3.tabInputs],
|
|
2670
|
+
["style", t3.tabStyle],
|
|
2671
|
+
["visibility", t3.tabVisibility]
|
|
2672
|
+
].map(([k2, label]) => /* @__PURE__ */ a3("button", { type: "button", class: "fnc-tab", role: "tab", "aria-selected": tab === k2, onClick: () => setTab(k2), children: label })) }),
|
|
2673
|
+
/* @__PURE__ */ a3("form", { class: "fnc-form", onSubmit: apply, children: [
|
|
2674
|
+
tab === "inputs" && /* @__PURE__ */ a3($, { children: [
|
|
2675
|
+
hasLines ? /* @__PURE__ */ a3("div", { class: "fnc-rows", children: [
|
|
2676
|
+
lines.map((l3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2677
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label", children: [
|
|
2678
|
+
t3.period,
|
|
2679
|
+
i3 + 1
|
|
2680
|
+
] }),
|
|
2681
|
+
/* @__PURE__ */ a3(
|
|
2682
|
+
"input",
|
|
2683
|
+
{
|
|
2684
|
+
class: "fnc-input fnc-input-period",
|
|
2685
|
+
inputMode: "numeric",
|
|
2686
|
+
value: l3.period,
|
|
2687
|
+
"aria-label": `${t3.period}${i3 + 1}`,
|
|
2688
|
+
onInput: (e3) => setLinesAndRows(lines.map((x2, j2) => j2 === i3 ? { ...x2, period: e3.currentTarget.value.replace(/\D/g, "") } : x2))
|
|
2689
|
+
}
|
|
2690
|
+
),
|
|
2691
|
+
!onIndicator && /* @__PURE__ */ a3(SourceSelect, { value: l3.source, locale, label: t3.source, onChange: (source) => setLines(lines.map((x2, j2) => j2 === i3 ? { ...x2, source } : x2)) }),
|
|
2692
|
+
/* @__PURE__ */ a3(
|
|
2693
|
+
"button",
|
|
2694
|
+
{
|
|
2695
|
+
type: "button",
|
|
2696
|
+
class: "fnc-ind-btn",
|
|
2697
|
+
"aria-label": t3.removePeriod,
|
|
2698
|
+
"data-tip": t3.removePeriod,
|
|
2699
|
+
onClick: () => {
|
|
2700
|
+
setLines(lines.filter((_3, j2) => j2 !== i3));
|
|
2701
|
+
setRows(rows.filter((_3, j2) => j2 !== i3));
|
|
2702
|
+
},
|
|
2703
|
+
children: /* @__PURE__ */ a3(SmallCloseIcon, {})
|
|
2704
|
+
}
|
|
2705
|
+
)
|
|
2706
|
+
] })),
|
|
2707
|
+
/* @__PURE__ */ a3(
|
|
2708
|
+
"button",
|
|
2709
|
+
{
|
|
2710
|
+
type: "button",
|
|
2711
|
+
class: "fnc-add-row",
|
|
2712
|
+
onClick: () => {
|
|
2713
|
+
const last = lines[lines.length - 1];
|
|
2714
|
+
setLinesAndRows([...lines, { period: String(last ? Number(last.period) * 2 || 10 : 5), source: "close" }]);
|
|
2715
|
+
},
|
|
2716
|
+
children: [
|
|
2717
|
+
"+ ",
|
|
2718
|
+
t3.addPeriod
|
|
2719
|
+
]
|
|
2720
|
+
}
|
|
2721
|
+
)
|
|
2722
|
+
] }) : def.params.filter((spec) => !(onIndicator && spec.kind === "source")).map((spec) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2723
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: spec.label[locale] }),
|
|
2724
|
+
spec.kind === "source" ? /* @__PURE__ */ a3(SourceSelect, { value: values[spec.key] ?? "close", locale, label: spec.label[locale], onChange: (v3) => setValues({ ...values, [spec.key]: v3 }) }) : /* @__PURE__ */ a3("input", { class: "fnc-input", inputMode: "decimal", value: values[spec.key] ?? "", "aria-label": spec.label[locale], onInput: (e3) => setValues({ ...values, [spec.key]: e3.currentTarget.value }) })
|
|
2725
|
+
] })),
|
|
2726
|
+
/* @__PURE__ */ a3($, { children: [
|
|
2727
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.calculation }),
|
|
2728
|
+
/* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2729
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.timeframe }),
|
|
2730
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-source", value: timeframe, "aria-label": t3.timeframe, onChange: (e3) => setTimeframe(e3.currentTarget.value), children: [
|
|
2731
|
+
/* @__PURE__ */ a3("option", { value: "", children: t3.timeframeChart }),
|
|
2732
|
+
timeframes.map((r3) => /* @__PURE__ */ a3("option", { value: r3, children: resolutionLabel2(r3, locale, "long") }))
|
|
2733
|
+
] })
|
|
2734
|
+
] }),
|
|
2735
|
+
/* @__PURE__ */ a3(Check, { label: t3.waitClose, checked: waitClose, onChange: setWaitClose }),
|
|
2736
|
+
timeframe && /* @__PURE__ */ a3("p", { class: "fnc-hint", children: t3.timeframeHint })
|
|
2737
|
+
] })
|
|
2738
|
+
] }),
|
|
2739
|
+
tab === "style" && /* @__PURE__ */ a3($, { children: [
|
|
2740
|
+
/* @__PURE__ */ a3("div", { class: "fnc-rows", children: rows.map((r3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row fnc-style-row", children: [
|
|
2741
|
+
/* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked: r3.visible, "aria-label": r3.visible ? t3.hide : t3.show, onChange: (e3) => patchRow(i3, { visible: e3.currentTarget.checked }) }),
|
|
2742
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", title: r3.label, children: r3.label }),
|
|
2743
|
+
/* @__PURE__ */ a3(ColorField, { value: /^#[0-9a-f]{6}/i.test(r3.color) ? r3.color : hex6(r3.color), label: t3.color, onChange: (color) => patchRow(i3, { color }) }),
|
|
2744
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-width", value: r3.width, "aria-label": t3.lineWidth, onChange: (e3) => patchRow(i3, { width: Number(e3.currentTarget.value) }), children: WIDTHS2.map((w3) => /* @__PURE__ */ a3("option", { value: w3, children: [
|
|
2745
|
+
w3,
|
|
2746
|
+
"px"
|
|
2747
|
+
] })) }),
|
|
2748
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-style", value: r3.lineStyle, "aria-label": t3.lineStyle, onChange: (e3) => patchRow(i3, { lineStyle: e3.currentTarget.value }), children: STYLES.map((s3) => /* @__PURE__ */ a3("option", { value: s3, children: styleLabel(s3) })) }),
|
|
2749
|
+
/* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-kind", value: r3.kind, "aria-label": t3.plotType, onChange: (e3) => patchRow(i3, { kind: e3.currentTarget.value }), children: KINDS.map((k2) => /* @__PURE__ */ a3("option", { value: k2, children: kindLabel(k2) })) })
|
|
2750
|
+
] })) }),
|
|
2751
|
+
(hasLevels || hasFill) && /* @__PURE__ */ a3($, { children: [
|
|
2752
|
+
hasLevels && /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2753
|
+
/* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked: display.levels !== false, "aria-label": t3.indLevels, onChange: (e3) => setD({ levels: e3.currentTarget.checked ? void 0 : false }) }),
|
|
2754
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.indLevels }),
|
|
2755
|
+
/* @__PURE__ */ a3(ColorField, { value: display.levelColor ?? "#8b95a1", label: t3.color, onChange: (levelColor) => setD({ levelColor }) })
|
|
2756
|
+
] }),
|
|
2757
|
+
hasLevels && display.levels !== false && /* @__PURE__ */ a3("div", { class: "fnc-row fnc-level-values", children: [
|
|
2758
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.levelValuesLabel }),
|
|
2759
|
+
probe.levels.map((l3, i3) => {
|
|
2760
|
+
const own = typeof l3 === "number" ? l3 : l3.value;
|
|
2761
|
+
const v3 = display.levelValues?.[i3];
|
|
2762
|
+
return /* @__PURE__ */ a3(
|
|
2763
|
+
"input",
|
|
2764
|
+
{
|
|
2765
|
+
class: "fnc-input fnc-input-num",
|
|
2766
|
+
inputMode: "decimal",
|
|
2767
|
+
defaultValue: String(v3 ?? own),
|
|
2768
|
+
"aria-label": `${t3.levelValuesLabel} ${i3 + 1}`,
|
|
2769
|
+
onChange: (e3) => {
|
|
2770
|
+
const n2 = Number(e3.currentTarget.value);
|
|
2771
|
+
const next = probe.levels.map((x2, j2) => display.levelValues?.[j2] ?? (typeof x2 === "number" ? x2 : x2.value));
|
|
2772
|
+
next[i3] = Number.isFinite(n2) ? n2 : own;
|
|
2773
|
+
const same = next.every((x2, j2) => x2 === (typeof probe.levels[j2] === "number" ? probe.levels[j2] : probe.levels[j2].value));
|
|
2774
|
+
setD({ levelValues: same ? void 0 : next });
|
|
2775
|
+
}
|
|
2776
|
+
},
|
|
2777
|
+
`${i3}:${v3 ?? own}`
|
|
2778
|
+
);
|
|
2779
|
+
})
|
|
2780
|
+
] }),
|
|
2781
|
+
hasFill && /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2782
|
+
/* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked: display.fill !== false, "aria-label": t3.fillBand, onChange: (e3) => setD({ fill: e3.currentTarget.checked ? void 0 : false }) }),
|
|
2783
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.fillBand }),
|
|
2784
|
+
/* @__PURE__ */ a3(ColorField, { value: display.fillColor ?? (/^#[0-9a-f]{6}$/i.test(probe.fill?.color ?? "") ? `${probe.fill.color}26` : "#3182f626"), label: t3.color, onChange: (fillColor) => setD({ fillColor }) })
|
|
2785
|
+
] })
|
|
2786
|
+
] }),
|
|
2787
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.outputValues }),
|
|
2788
|
+
/* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2789
|
+
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.precision }),
|
|
2790
|
+
/* @__PURE__ */ a3(
|
|
2791
|
+
"select",
|
|
2792
|
+
{
|
|
2793
|
+
class: "fnc-select fnc-select-source",
|
|
2794
|
+
value: display.precision === void 0 ? "" : String(display.precision),
|
|
2795
|
+
"aria-label": t3.precision,
|
|
2796
|
+
onChange: (e3) => setD({ precision: e3.currentTarget.value === "" ? void 0 : Number(e3.currentTarget.value) }),
|
|
2797
|
+
children: [
|
|
2798
|
+
/* @__PURE__ */ a3("option", { value: "", children: t3.precisionDefault }),
|
|
2799
|
+
PRECISIONS.map((n2) => /* @__PURE__ */ a3("option", { value: String(n2), children: n2 === 0 ? "1" : `0.${"0".repeat(n2 - 1)}1` }))
|
|
2800
|
+
]
|
|
2801
|
+
}
|
|
2802
|
+
)
|
|
2803
|
+
] }),
|
|
2804
|
+
/* @__PURE__ */ a3(Check, { label: t3.axisLabels, checked: display.axisLabels !== false, onChange: (v3) => setD({ axisLabels: v3 ? void 0 : false }) }),
|
|
2805
|
+
/* @__PURE__ */ a3(Check, { label: t3.statusValues, checked: display.statusValues !== false, onChange: (v3) => setD({ statusValues: v3 ? void 0 : false }) }),
|
|
2806
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.inputValues }),
|
|
2807
|
+
/* @__PURE__ */ a3(Check, { label: t3.statusInputs, checked: display.statusInputs !== false, onChange: (v3) => setD({ statusInputs: v3 ? void 0 : false }) })
|
|
2808
|
+
] }),
|
|
2809
|
+
tab === "visibility" && /* @__PURE__ */ a3($, { children: [
|
|
2810
|
+
/* @__PURE__ */ a3("p", { class: "fnc-hint", children: t3.visibilityHint }),
|
|
2811
|
+
/* @__PURE__ */ a3(IntervalVisibilityEditor, { t: t3, value: display.intervals, onChange: (intervals) => setD({ intervals }) })
|
|
2812
|
+
] }),
|
|
2813
|
+
/* @__PURE__ */ a3("div", { class: "fnc-form-actions fnc-form-actions-split", children: [
|
|
2814
|
+
/* @__PURE__ */ a3("div", { class: "fnc-defaults", children: [
|
|
2815
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-action fnc-action-menu", "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu(!menu), children: [
|
|
2816
|
+
t3.defaults,
|
|
2817
|
+
" \u25BE"
|
|
2818
|
+
] }),
|
|
2819
|
+
menu && /* @__PURE__ */ a3("div", { class: "fnc-defaults-menu", role: "menu", children: [
|
|
2820
|
+
/* @__PURE__ */ a3("button", { type: "button", role: "menuitem", onClick: reset, children: t3.resetIndicator }),
|
|
2821
|
+
/* @__PURE__ */ a3("button", { type: "button", role: "menuitem", onClick: saveDefaults, children: t3.saveDefaults }),
|
|
2822
|
+
hasSaved && /* @__PURE__ */ a3("button", { type: "button", role: "menuitem", onClick: forgetDefaults, children: t3.forgetDefaults }),
|
|
2823
|
+
/* @__PURE__ */ a3(
|
|
2824
|
+
"button",
|
|
2825
|
+
{
|
|
2826
|
+
type: "button",
|
|
2827
|
+
role: "menuitem",
|
|
2828
|
+
class: "fnc-danger",
|
|
2829
|
+
onClick: () => {
|
|
2830
|
+
ctx.chart.removeIndicator(id);
|
|
2831
|
+
close();
|
|
2832
|
+
},
|
|
2833
|
+
children: t3.remove
|
|
2834
|
+
}
|
|
2835
|
+
)
|
|
2836
|
+
] })
|
|
2837
|
+
] }),
|
|
2838
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-action", onClick: close, children: t3.cancel }),
|
|
2839
|
+
/* @__PURE__ */ a3("button", { type: "submit", class: "fnc-action fnc-action-primary", children: t3.ok })
|
|
2840
|
+
] })
|
|
2841
|
+
] })
|
|
2842
|
+
] });
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2155
2845
|
// src/components/settings-dialog.tsx
|
|
2156
2846
|
import { CHART_THEMES, DEFAULT_CHART_SETTINGS, matchChartTheme } from "@funnest/charts";
|
|
2157
2847
|
function toHex(color) {
|
|
@@ -2171,7 +2861,9 @@ var SECTIONS = [
|
|
|
2171
2861
|
{ key: "extendedPriceLine", label: "settingExtendedPrice" },
|
|
2172
2862
|
{ key: "volume", label: "settingVolume" },
|
|
2173
2863
|
{ key: "navigationButtons", label: "settingNavButtons" },
|
|
2174
|
-
{ key: "smoothScroll", label: "smoothScroll" }
|
|
2864
|
+
{ key: "smoothScroll", label: "smoothScroll" },
|
|
2865
|
+
{ key: "lockView", label: "lockView" },
|
|
2866
|
+
{ key: "lockRatio", label: "lockRatio" }
|
|
2175
2867
|
]
|
|
2176
2868
|
},
|
|
2177
2869
|
{
|
|
@@ -2410,197 +3102,17 @@ function IndicatorPicker({ ctx }) {
|
|
|
2410
3102
|
] })
|
|
2411
3103
|
] });
|
|
2412
3104
|
}
|
|
2413
|
-
var WIDTHS2 = [1, 2, 3, 4];
|
|
2414
|
-
function defaultSeries(def, params) {
|
|
2415
|
-
return def.compute([], params).series.filter((s3) => s3.kind === "line");
|
|
2416
|
-
}
|
|
2417
|
-
function StyleControls({
|
|
2418
|
-
t: t3,
|
|
2419
|
-
row: row2,
|
|
2420
|
-
onChange
|
|
2421
|
-
}) {
|
|
2422
|
-
return /* @__PURE__ */ a3($, { children: [
|
|
2423
|
-
/* @__PURE__ */ a3(
|
|
2424
|
-
"input",
|
|
2425
|
-
{
|
|
2426
|
-
type: "checkbox",
|
|
2427
|
-
class: "fnc-check",
|
|
2428
|
-
checked: row2.visible,
|
|
2429
|
-
"aria-label": row2.visible ? t3.hide : t3.show,
|
|
2430
|
-
onChange: (e3) => onChange({ visible: e3.currentTarget.checked })
|
|
2431
|
-
}
|
|
2432
|
-
),
|
|
2433
|
-
/* @__PURE__ */ a3(
|
|
2434
|
-
"input",
|
|
2435
|
-
{
|
|
2436
|
-
type: "color",
|
|
2437
|
-
class: "fnc-color",
|
|
2438
|
-
value: row2.color,
|
|
2439
|
-
"aria-label": t3.color,
|
|
2440
|
-
onInput: (e3) => onChange({ color: e3.currentTarget.value })
|
|
2441
|
-
}
|
|
2442
|
-
),
|
|
2443
|
-
/* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-width", value: row2.width, "aria-label": t3.lineWidth, onChange: (e3) => onChange({ width: Number(e3.currentTarget.value) }), children: WIDTHS2.map((w3) => /* @__PURE__ */ a3("option", { value: w3, children: [
|
|
2444
|
-
w3,
|
|
2445
|
-
"px"
|
|
2446
|
-
] })) })
|
|
2447
|
-
] });
|
|
2448
|
-
}
|
|
2449
|
-
function SourceSelect({ value, locale, label, onChange }) {
|
|
2450
|
-
return /* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-source", value, "aria-label": label, onChange: (e3) => onChange(e3.currentTarget.value), children: PRICE_SOURCES.map((s3) => /* @__PURE__ */ a3("option", { value: s3.value, children: s3.label[locale] })) });
|
|
2451
|
-
}
|
|
2452
|
-
function IndicatorSettings({ ctx, id }) {
|
|
2453
|
-
const { locale, indicators } = useStore(ctx.store);
|
|
2454
|
-
const t3 = stringsOf(ctx.store.get());
|
|
2455
|
-
const config = indicators.find((c3) => c3.id === id);
|
|
2456
|
-
const def = config ? ctx.chart.indicatorDefinition(config.type) ?? null : null;
|
|
2457
|
-
const hasLines = !!def?.params.some((p3) => p3.kind === "lines");
|
|
2458
|
-
const onIndicator = !!config?.on;
|
|
2459
|
-
const [lines, setLines] = d2(() => {
|
|
2460
|
-
if (!config || !def || !hasLines) return [];
|
|
2461
|
-
const defaults = defaultSeries(def, config.params);
|
|
2462
|
-
return maLines(config.params).map((l3, i3) => {
|
|
2463
|
-
const style = config.styles?.[`l${i3}`];
|
|
2464
|
-
return {
|
|
2465
|
-
period: String(l3.period),
|
|
2466
|
-
source: l3.source,
|
|
2467
|
-
color: style?.color ?? defaults[i3]?.color ?? SERIES_COLORS[i3 % SERIES_COLORS.length],
|
|
2468
|
-
width: style?.width ?? defaults[i3]?.width ?? 1,
|
|
2469
|
-
visible: style?.visible ?? true
|
|
2470
|
-
};
|
|
2471
|
-
});
|
|
2472
|
-
});
|
|
2473
|
-
const [values, setValues] = d2(
|
|
2474
|
-
() => Object.fromEntries(Object.entries(config?.params ?? {}).filter(([, v3]) => !Array.isArray(v3)).map(([k2, v3]) => [k2, String(v3)]))
|
|
2475
|
-
);
|
|
2476
|
-
const [styles, setStyles] = d2(() => {
|
|
2477
|
-
if (!config || !def || hasLines) return [];
|
|
2478
|
-
return defaultSeries(def, config.params).map((s3) => {
|
|
2479
|
-
const style = config.styles?.[s3.key];
|
|
2480
|
-
return { key: s3.key, label: s3.label, color: style?.color ?? s3.color, width: style?.width ?? s3.width, visible: style?.visible ?? true };
|
|
2481
|
-
});
|
|
2482
|
-
});
|
|
2483
|
-
const close = () => ctx.store.set({ dialog: null });
|
|
2484
|
-
if (!config || !def) return null;
|
|
2485
|
-
const updateLine = (i3, patch) => setLines(lines.map((l3, j2) => j2 === i3 ? { ...l3, ...patch } : l3));
|
|
2486
|
-
const addLine = () => {
|
|
2487
|
-
const i3 = lines.length;
|
|
2488
|
-
const last = lines[i3 - 1];
|
|
2489
|
-
setLines([
|
|
2490
|
-
...lines,
|
|
2491
|
-
{
|
|
2492
|
-
period: String(last ? Number(last.period) * 2 || 10 : 5),
|
|
2493
|
-
source: "close",
|
|
2494
|
-
color: SERIES_COLORS[i3 % SERIES_COLORS.length],
|
|
2495
|
-
width: 1,
|
|
2496
|
-
visible: true
|
|
2497
|
-
}
|
|
2498
|
-
]);
|
|
2499
|
-
};
|
|
2500
|
-
const apply = (e3) => {
|
|
2501
|
-
e3.preventDefault();
|
|
2502
|
-
const params = {};
|
|
2503
|
-
const nextStyles = {};
|
|
2504
|
-
for (const spec of def.params) {
|
|
2505
|
-
const clamp = (n2) => Math.min(spec.max ?? Infinity, Math.max(spec.min ?? -Infinity, n2));
|
|
2506
|
-
if (spec.kind === "lines") {
|
|
2507
|
-
const valid = lines.filter((l3) => Number(l3.period) > 0);
|
|
2508
|
-
params[spec.key] = valid.map((l3) => ({ period: clamp(Math.round(Number(l3.period))), source: l3.source }));
|
|
2509
|
-
valid.forEach((l3, i3) => nextStyles[`l${i3}`] = { color: l3.color, width: l3.width, visible: l3.visible });
|
|
2510
|
-
} else if (spec.kind === "source") {
|
|
2511
|
-
params[spec.key] = values[spec.key] ?? "close";
|
|
2512
|
-
} else {
|
|
2513
|
-
const n2 = Number(values[spec.key]);
|
|
2514
|
-
if (Number.isFinite(n2)) params[spec.key] = clamp(n2);
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2517
|
-
for (const s3 of styles) nextStyles[s3.key] = { color: s3.color, width: s3.width, visible: s3.visible };
|
|
2518
|
-
ctx.chart.updateIndicator(id, { params, styles: nextStyles });
|
|
2519
|
-
close();
|
|
2520
|
-
};
|
|
2521
|
-
return /* @__PURE__ */ a3(Dialog, { title: `${def.name[locale]} \xB7 ${t3.indicatorSettings}`, onClose: close, wide: true, children: /* @__PURE__ */ a3("form", { class: "fnc-form", onSubmit: apply, children: [
|
|
2522
|
-
hasLines ? /* @__PURE__ */ a3("div", { class: "fnc-rows", children: [
|
|
2523
|
-
lines.map((l3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2524
|
-
/* @__PURE__ */ a3("span", { class: "fnc-row-label", children: [
|
|
2525
|
-
t3.period,
|
|
2526
|
-
i3 + 1
|
|
2527
|
-
] }),
|
|
2528
|
-
/* @__PURE__ */ a3(StyleControls, { t: t3, row: l3, onChange: (p3) => updateLine(i3, p3) }),
|
|
2529
|
-
!onIndicator && /* @__PURE__ */ a3(SourceSelect, { value: l3.source, locale, label: t3.source, onChange: (source) => updateLine(i3, { source }) }),
|
|
2530
|
-
/* @__PURE__ */ a3(
|
|
2531
|
-
"input",
|
|
2532
|
-
{
|
|
2533
|
-
class: "fnc-input fnc-input-period",
|
|
2534
|
-
inputMode: "numeric",
|
|
2535
|
-
value: l3.period,
|
|
2536
|
-
"aria-label": `${t3.period}${i3 + 1}`,
|
|
2537
|
-
onInput: (e3) => updateLine(i3, { period: e3.currentTarget.value.replace(/\D/g, "") })
|
|
2538
|
-
}
|
|
2539
|
-
),
|
|
2540
|
-
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-ind-btn", "aria-label": t3.removePeriod, "data-tip": t3.removePeriod, onClick: () => setLines(lines.filter((_3, j2) => j2 !== i3)), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
2541
|
-
] })),
|
|
2542
|
-
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-add-row", onClick: addLine, children: [
|
|
2543
|
-
"+ ",
|
|
2544
|
-
t3.addPeriod
|
|
2545
|
-
] })
|
|
2546
|
-
] }) : /* @__PURE__ */ a3($, { children: [
|
|
2547
|
-
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.inputs }),
|
|
2548
|
-
def.params.filter((spec) => !(onIndicator && spec.kind === "source")).map((spec) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2549
|
-
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: spec.label[locale] }),
|
|
2550
|
-
spec.kind === "source" ? /* @__PURE__ */ a3(
|
|
2551
|
-
SourceSelect,
|
|
2552
|
-
{
|
|
2553
|
-
value: values[spec.key] ?? "close",
|
|
2554
|
-
locale,
|
|
2555
|
-
label: spec.label[locale],
|
|
2556
|
-
onChange: (v3) => setValues({ ...values, [spec.key]: v3 })
|
|
2557
|
-
}
|
|
2558
|
-
) : /* @__PURE__ */ a3(
|
|
2559
|
-
"input",
|
|
2560
|
-
{
|
|
2561
|
-
class: "fnc-input",
|
|
2562
|
-
inputMode: "decimal",
|
|
2563
|
-
value: values[spec.key] ?? "",
|
|
2564
|
-
"aria-label": spec.label[locale],
|
|
2565
|
-
onInput: (e3) => setValues({ ...values, [spec.key]: e3.currentTarget.value })
|
|
2566
|
-
}
|
|
2567
|
-
)
|
|
2568
|
-
] })),
|
|
2569
|
-
styles.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.style }),
|
|
2570
|
-
styles.map((row2, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
|
|
2571
|
-
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: row2.label }),
|
|
2572
|
-
/* @__PURE__ */ a3(StyleControls, { t: t3, row: row2, onChange: (p3) => setStyles(styles.map((s3, j2) => j2 === i3 ? { ...s3, ...p3 } : s3)) })
|
|
2573
|
-
] }))
|
|
2574
|
-
] }),
|
|
2575
|
-
/* @__PURE__ */ a3("div", { class: "fnc-form-actions", children: [
|
|
2576
|
-
/* @__PURE__ */ a3(
|
|
2577
|
-
"button",
|
|
2578
|
-
{
|
|
2579
|
-
type: "button",
|
|
2580
|
-
class: "fnc-action fnc-action-danger",
|
|
2581
|
-
onClick: () => {
|
|
2582
|
-
ctx.chart.removeIndicator(id);
|
|
2583
|
-
close();
|
|
2584
|
-
},
|
|
2585
|
-
children: t3.remove
|
|
2586
|
-
}
|
|
2587
|
-
),
|
|
2588
|
-
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-action", onClick: close, children: t3.cancel }),
|
|
2589
|
-
/* @__PURE__ */ a3("button", { type: "submit", class: "fnc-action fnc-action-primary", children: t3.apply })
|
|
2590
|
-
] })
|
|
2591
|
-
] }) });
|
|
2592
|
-
}
|
|
2593
3105
|
function Dialogs({ ctx }) {
|
|
2594
3106
|
const { dialog } = useStore(ctx.store);
|
|
2595
3107
|
if (dialog?.kind === "indicators") return dialog.on ? /* @__PURE__ */ a3(IndicatorOnPicker, { ctx, on: dialog.on }) : /* @__PURE__ */ a3(IndicatorPicker, { ctx });
|
|
2596
|
-
if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id });
|
|
3108
|
+
if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id, Dialog }, dialog.id);
|
|
2597
3109
|
if (dialog?.kind === "chartSettings") return /* @__PURE__ */ a3(SettingsDialog, { ctx });
|
|
2598
3110
|
if (dialog?.kind === "goToDate") return /* @__PURE__ */ a3(GoToDateDialog, { ctx });
|
|
2599
3111
|
return null;
|
|
2600
3112
|
}
|
|
2601
3113
|
|
|
2602
3114
|
// src/components/interval-picker.tsx
|
|
2603
|
-
import { derivedBase as derivedBase2, resolutionToMs } from "@funnest/charts";
|
|
3115
|
+
import { derivedBase as derivedBase2, resolutionToMs as resolutionToMs2 } from "@funnest/charts";
|
|
2604
3116
|
|
|
2605
3117
|
// src/components/keep-in-view.ts
|
|
2606
3118
|
var MARGIN = 8;
|
|
@@ -2667,7 +3179,7 @@ function IntervalPicker({ ctx }) {
|
|
|
2667
3179
|
const supported = s3.symbol?.supportedResolutions;
|
|
2668
3180
|
const isSupported = (r3) => !supported || supported.includes(r3) || !!derivedBase2(r3, supported);
|
|
2669
3181
|
const listed = new Set(ctx.intervalGroups.flatMap((g3) => g3.intervals));
|
|
2670
|
-
const custom = s3.customIntervals.filter((r3) => !listed.has(r3)).sort((a4, b) =>
|
|
3182
|
+
const custom = s3.customIntervals.filter((r3) => !listed.has(r3)).sort((a4, b) => resolutionToMs2(a4) - resolutionToMs2(b));
|
|
2671
3183
|
const order = [...ctx.intervalGroups.flatMap((g3) => g3.intervals), ...custom];
|
|
2672
3184
|
const [amount, setAmount] = d2("2");
|
|
2673
3185
|
const [unit, setUnit] = d2(1);
|
|
@@ -2679,7 +3191,7 @@ function IntervalPicker({ ctx }) {
|
|
|
2679
3191
|
select(r3);
|
|
2680
3192
|
};
|
|
2681
3193
|
const favorites = s3.favoriteIntervals;
|
|
2682
|
-
const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) :
|
|
3194
|
+
const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) : resolutionToMs2(a4) - resolutionToMs2(b);
|
|
2683
3195
|
const chips = [.../* @__PURE__ */ new Set([...favorites, ...s3.resolution ? [s3.resolution] : []])].sort(byTime);
|
|
2684
3196
|
const select = (r3) => {
|
|
2685
3197
|
setOpen(false);
|
|
@@ -3550,12 +4062,14 @@ function ContextMenu({ ctx }) {
|
|
|
3550
4062
|
onSelect: () => ctx.chart.addDrawing({ type: "horizontal", points: [{ time, price }] })
|
|
3551
4063
|
});
|
|
3552
4064
|
}
|
|
3553
|
-
const smooth = ctx.chart.settings
|
|
4065
|
+
const { smoothScroll: smooth, lockView, lockRatio } = ctx.chart.settings;
|
|
3554
4066
|
items.push(
|
|
3555
4067
|
{ label: t3.goToDateMore, onSelect: () => ctx.store.set({ dialog: { kind: "goToDate" } }) },
|
|
3556
4068
|
{ label: t3.smoothScroll, checked: smooth, onSelect: () => ctx.chart.setSettings({ smoothScroll: !smooth }) },
|
|
4069
|
+
{ label: t3.lockView, checked: lockView, onSelect: () => ctx.chart.setSettings({ lockView: !lockView }) },
|
|
4070
|
+
{ label: t3.lockRatio, checked: lockRatio, onSelect: () => ctx.chart.setSettings({ lockRatio: !lockRatio }) },
|
|
3557
4071
|
"separator",
|
|
3558
|
-
{ label: t3.resetChart, onSelect: () => ctx.chart.resetView() },
|
|
4072
|
+
{ label: t3.resetChart, disabled: lockView, onSelect: () => ctx.chart.resetView() },
|
|
3559
4073
|
{ label: t3.chartSettingsMore, onSelect: () => ctx.store.set({ dialog: { kind: "chartSettings" } }) }
|
|
3560
4074
|
);
|
|
3561
4075
|
return /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-ctx-menu", role: "menu", ref, onContextMenu: (e3) => e3.preventDefault(), children: items.map(
|
|
@@ -3671,7 +4185,7 @@ function IndicatorItem({ ctx, item }) {
|
|
|
3671
4185
|
return /* @__PURE__ */ a3(
|
|
3672
4186
|
"div",
|
|
3673
4187
|
{
|
|
3674
|
-
class: item.visible ? "fnc-ind" : "fnc-ind fnc-ind-hidden",
|
|
4188
|
+
class: item.visible && !item.offInterval ? "fnc-ind" : "fnc-ind fnc-ind-hidden",
|
|
3675
4189
|
role: "button",
|
|
3676
4190
|
tabIndex: 0,
|
|
3677
4191
|
"aria-label": `${item.title} ${t3.indicatorSettings}`,
|
|
@@ -3912,7 +4426,14 @@ function NavControls({ ctx }) {
|
|
|
3912
4426
|
const s3 = useStore(ctx.store);
|
|
3913
4427
|
const t3 = stringsOf(s3);
|
|
3914
4428
|
const [showButtons, setShowButtons] = d2(ctx.chart.settings.navigationButtons);
|
|
3915
|
-
|
|
4429
|
+
const [locked, setLocked] = d2(ctx.chart.settings.lockView);
|
|
4430
|
+
A2(
|
|
4431
|
+
() => ctx.chart.on("settingsChange", (settings) => {
|
|
4432
|
+
setShowButtons(settings.navigationButtons);
|
|
4433
|
+
setLocked(settings.lockView);
|
|
4434
|
+
}),
|
|
4435
|
+
[ctx.chart]
|
|
4436
|
+
);
|
|
3916
4437
|
const { plotWidth, panesHeight } = s3.layout;
|
|
3917
4438
|
if (plotWidth <= 0) return null;
|
|
3918
4439
|
const top = panesHeight - CONTROL_OFFSET;
|
|
@@ -3920,12 +4441,23 @@ function NavControls({ ctx }) {
|
|
|
3920
4441
|
const button = (label, onClick, icon) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, onClick, children: icon });
|
|
3921
4442
|
const replaying = s3.replay.active || s3.replay.selecting;
|
|
3922
4443
|
return /* @__PURE__ */ a3($, { children: [
|
|
3923
|
-
showButtons && !replaying && /* @__PURE__ */ a3("div", { class: "fnc-nav", style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
|
|
3924
|
-
button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
|
|
3925
|
-
button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
|
|
3926
|
-
button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
|
|
3927
|
-
button(t3.scrollForward, () => ctx.chart.scrollBars(page()), /* @__PURE__ */ a3(ChevronRightIcon, {})),
|
|
3928
|
-
button(t3.resetView, () => ctx.chart.resetView(), /* @__PURE__ */ a3(ResetIcon, {}))
|
|
4444
|
+
(showButtons || locked) && !replaying && /* @__PURE__ */ a3("div", { class: locked ? "fnc-nav fnc-nav-locked" : "fnc-nav", style: { left: `${plotWidth / 2}px`, top: `${top}px` }, children: [
|
|
4445
|
+
!locked && button(t3.zoomOut, () => ctx.chart.zoom(1 / ZOOM_STEP), /* @__PURE__ */ a3(MinusIcon, {})),
|
|
4446
|
+
!locked && button(t3.zoomIn, () => ctx.chart.zoom(ZOOM_STEP), /* @__PURE__ */ a3(PlusIcon, {})),
|
|
4447
|
+
!locked && button(t3.scrollBack, () => ctx.chart.scrollBars(-page()), /* @__PURE__ */ a3(ChevronLeftIcon, {})),
|
|
4448
|
+
!locked && button(t3.scrollForward, () => ctx.chart.scrollBars(page()), /* @__PURE__ */ a3(ChevronRightIcon, {})),
|
|
4449
|
+
!locked && button(t3.resetView, () => ctx.chart.resetView(), /* @__PURE__ */ a3(ResetIcon, {})),
|
|
4450
|
+
/* @__PURE__ */ a3(
|
|
4451
|
+
"button",
|
|
4452
|
+
{
|
|
4453
|
+
class: locked ? "fnc-btn fnc-btn-on" : "fnc-btn",
|
|
4454
|
+
"data-tip": locked ? t3.unlockView : t3.lockView,
|
|
4455
|
+
"aria-label": locked ? t3.unlockView : t3.lockView,
|
|
4456
|
+
"aria-pressed": locked,
|
|
4457
|
+
onClick: () => ctx.chart.setSettings({ lockView: !locked }),
|
|
4458
|
+
children: /* @__PURE__ */ a3(LockIcon, { open: !locked })
|
|
4459
|
+
}
|
|
4460
|
+
)
|
|
3929
4461
|
] }),
|
|
3930
4462
|
!s3.atRealtime && /* @__PURE__ */ a3(
|
|
3931
4463
|
"button",
|
|
@@ -4961,6 +5493,70 @@ var CSS = (
|
|
|
4961
5493
|
.fnc-input-period { flex: 0 0 72px; text-align: right; }
|
|
4962
5494
|
.fnc-select-width { flex: 0 0 72px; }
|
|
4963
5495
|
.fnc-select-source { flex: 1; }
|
|
5496
|
+
.fnc-select-style { flex: 0 0 76px; }
|
|
5497
|
+
.fnc-select-kind { flex: 1; min-width: 88px; }
|
|
5498
|
+
.fnc-settings-tabs { padding: 8px 16px; }
|
|
5499
|
+
.fnc-style-row .fnc-row-label-wide { overflow: hidden; text-overflow: ellipsis; }
|
|
5500
|
+
.fnc-check-row { gap: 10px; min-height: 34px; font-size: 14px; color: var(--fnc-text); cursor: pointer; }
|
|
5501
|
+
.fnc-hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--fnc-text-2); }
|
|
5502
|
+
.fnc-vis .fnc-row { min-height: 40px; }
|
|
5503
|
+
.fnc-vis-unit { display: flex; align-items: center; gap: 10px; width: 96px; flex: none; font-size: 14px; color: var(--fnc-text); cursor: pointer; }
|
|
5504
|
+
.fnc-input-num { flex: 0 0 72px; text-align: right; }
|
|
5505
|
+
.fnc-input-num:disabled { opacity: 0.4; }
|
|
5506
|
+
.fnc-vis-dash { color: var(--fnc-text-2); }
|
|
5507
|
+
.fnc-coords-menu, .fnc-visibility-menu { padding: 10px 12px; min-width: 300px; }
|
|
5508
|
+
.fnc-visibility-menu .fnc-hint { margin-bottom: 6px; max-width: 320px; }
|
|
5509
|
+
.fnc-visibility-menu .fnc-row { min-height: 34px; }
|
|
5510
|
+
.fnc-visibility-menu .fnc-input-num { height: 30px; flex-basis: 56px; font-size: 13px; }
|
|
5511
|
+
.fnc-coords { display: flex; flex-direction: column; gap: 8px; }
|
|
5512
|
+
.fnc-coord-row { display: flex; align-items: center; gap: 6px; }
|
|
5513
|
+
.fnc-coord-name { width: 40px; flex: none; font-size: 12px; color: var(--fnc-text-2); }
|
|
5514
|
+
.fnc-coord-price { flex: 0 0 110px; height: 32px; font-size: 13px; }
|
|
5515
|
+
.fnc-coord-time { flex: 0 0 180px; height: 32px; font-size: 13px; }
|
|
5516
|
+
.fnc-btn-on { color: var(--fnc-accent); }
|
|
5517
|
+
/* \uCC28\uD2B8 \uACE0\uC815: the bar shows just the lock, always (not only on hover). */
|
|
5518
|
+
.fnc-nav.fnc-nav-locked { opacity: 1; display: flex; }
|
|
5519
|
+
.fnc-color-field { display: flex; align-items: center; gap: 6px; flex: none; }
|
|
5520
|
+
.fnc-opacity { width: 64px; accent-color: var(--fnc-accent); }
|
|
5521
|
+
.fnc-level-values { flex-wrap: wrap; row-gap: 6px; }
|
|
5522
|
+
.fnc-level-values .fnc-input-num { flex: 0 0 64px; height: 34px; font-size: 14px; }
|
|
5523
|
+
.fnc-note-menu { padding: 10px 12px; width: 300px; display: flex; flex-direction: column; gap: 8px; }
|
|
5524
|
+
.fnc-note-menu textarea {
|
|
5525
|
+
min-height: 64px;
|
|
5526
|
+
padding: 8px 10px;
|
|
5527
|
+
border: 1px solid var(--fnc-border);
|
|
5528
|
+
border-radius: var(--fnc-radius);
|
|
5529
|
+
background: var(--fnc-bg);
|
|
5530
|
+
color: var(--fnc-text);
|
|
5531
|
+
font: inherit;
|
|
5532
|
+
font-size: 14px;
|
|
5533
|
+
resize: vertical;
|
|
5534
|
+
outline: none;
|
|
5535
|
+
}
|
|
5536
|
+
.fnc-note-menu textarea:focus { border-color: var(--fnc-accent); }
|
|
5537
|
+
.fnc-note-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fnc-text-2); }
|
|
5538
|
+
.fnc-note-row .fnc-select { height: 32px; font-size: 13px; flex: 1; }
|
|
5539
|
+
.fnc-note-toggle { height: 32px; min-width: 36px; padding: 0 8px; border: 1px solid var(--fnc-border); border-radius: 6px; font-size: 13px; color: var(--fnc-text); }
|
|
5540
|
+
.fnc-note-toggle[aria-pressed='true'] { background: var(--fnc-text); color: var(--fnc-bg); border-color: var(--fnc-text); }
|
|
5541
|
+
.fnc-form-actions-split .fnc-defaults { position: relative; flex: 1; display: flex; }
|
|
5542
|
+
.fnc-form-actions-split .fnc-defaults > .fnc-action { flex: 1; }
|
|
5543
|
+
.fnc-defaults-menu {
|
|
5544
|
+
position: absolute;
|
|
5545
|
+
left: 0;
|
|
5546
|
+
bottom: calc(100% + 6px);
|
|
5547
|
+
min-width: 200px;
|
|
5548
|
+
display: flex;
|
|
5549
|
+
flex-direction: column;
|
|
5550
|
+
padding: 6px;
|
|
5551
|
+
border: 1px solid var(--fnc-border);
|
|
5552
|
+
border-radius: var(--fnc-radius);
|
|
5553
|
+
background: var(--fnc-bg);
|
|
5554
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
|
|
5555
|
+
z-index: 2;
|
|
5556
|
+
}
|
|
5557
|
+
.fnc-defaults-menu button { height: 38px; padding: 0 12px; border-radius: 6px; text-align: left; font-size: 14px; color: var(--fnc-text); }
|
|
5558
|
+
.fnc-defaults-menu button:hover { background: var(--fnc-surface); }
|
|
5559
|
+
.fnc-defaults-menu .fnc-danger { color: var(--fnc-down, #f04452); }
|
|
4964
5560
|
.fnc-toggle-row { justify-content: space-between; min-height: 36px; cursor: pointer; font-size: 14px; }
|
|
4965
5561
|
.fnc-switch {
|
|
4966
5562
|
appearance: none;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"NOTICE"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@funnest/charts": "0.
|
|
45
|
+
"@funnest/charts": "0.10.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|