@funnest/charts-ui 0.9.6 → 0.10.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.
@@ -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,63 @@ 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
+ levelValuesLabel: string;
204
+ note: string;
205
+ noteText: string;
206
+ bold: string;
207
+ italic: string;
208
+ noteH: string;
209
+ noteV: string;
210
+ alignLeft: string;
211
+ alignCenter: string;
212
+ alignRight: string;
213
+ alignTop: string;
214
+ alignMiddle: string;
215
+ alignBottom: string;
216
+ textColor: string;
217
+ coordinates: string;
218
+ point: string;
219
+ price: string;
220
+ time: string;
164
221
  intervalMinutes: string;
165
222
  intervalHours: string;
166
223
  intervalDays: string;
@@ -388,6 +445,63 @@ export declare const STRINGS: {
388
445
  source: string;
389
446
  inputs: string;
390
447
  style: string;
448
+ tabInputs: string;
449
+ tabStyle: string;
450
+ tabVisibility: string;
451
+ calculation: string;
452
+ timeframe: string;
453
+ timeframeChart: string;
454
+ waitClose: string;
455
+ timeframeHint: string;
456
+ plotType: string;
457
+ kindLine: string;
458
+ kindStep: string;
459
+ kindArea: string;
460
+ kindHistogram: string;
461
+ kindColumns: string;
462
+ kindCircles: string;
463
+ kindCross: string;
464
+ indLevels: string;
465
+ fillBand: string;
466
+ outputValues: string;
467
+ precision: string;
468
+ precisionDefault: string;
469
+ axisLabels: string;
470
+ statusValues: string;
471
+ inputValues: string;
472
+ statusInputs: string;
473
+ visibilityHint: string;
474
+ visSeconds: string;
475
+ visMinutes: string;
476
+ visHours: string;
477
+ visDays: string;
478
+ visWeeks: string;
479
+ visMonths: string;
480
+ rangeFrom: string;
481
+ rangeTo: string;
482
+ defaults: string;
483
+ resetIndicator: string;
484
+ saveDefaults: string;
485
+ forgetDefaults: string;
486
+ ok: string;
487
+ levelValuesLabel: string;
488
+ note: string;
489
+ noteText: string;
490
+ bold: string;
491
+ italic: string;
492
+ noteH: string;
493
+ noteV: string;
494
+ alignLeft: string;
495
+ alignCenter: string;
496
+ alignRight: string;
497
+ alignTop: string;
498
+ alignMiddle: string;
499
+ alignBottom: string;
500
+ textColor: string;
501
+ coordinates: string;
502
+ point: string;
503
+ price: string;
504
+ time: string;
391
505
  intervalMinutes: string;
392
506
  intervalHours: string;
393
507
  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,63 @@ 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
+ levelValuesLabel: "\uAE30\uC900\uC120 \uAC12",
633
+ note: "\uD14D\uC2A4\uD2B8",
634
+ noteText: "\uD14D\uC2A4\uD2B8 \uC785\uB825",
635
+ bold: "\uAD75\uAC8C",
636
+ italic: "\uAE30\uC6B8\uC784",
637
+ noteH: "\uAC00\uB85C \uC704\uCE58",
638
+ noteV: "\uC138\uB85C \uC704\uCE58",
639
+ alignLeft: "\uC67C\uCABD",
640
+ alignCenter: "\uAC00\uC6B4\uB370",
641
+ alignRight: "\uC624\uB978\uCABD",
642
+ alignTop: "\uC704",
643
+ alignMiddle: "\uAC00\uC6B4\uB370",
644
+ alignBottom: "\uC544\uB798",
645
+ textColor: "\uAE00\uC790 \uC0C9",
646
+ coordinates: "\uC88C\uD45C",
647
+ point: "\uC810",
648
+ price: "\uAC00\uACA9",
649
+ time: "\uC2DC\uAC04",
593
650
  // intervals
594
651
  intervalMinutes: "\uBD84",
595
652
  intervalHours: "\uC2DC\uAC04",
@@ -819,6 +876,63 @@ var STRINGS = {
819
876
  source: "Source",
820
877
  inputs: "Inputs",
821
878
  style: "Style",
879
+ tabInputs: "Inputs",
880
+ tabStyle: "Style",
881
+ tabVisibility: "Visibility",
882
+ calculation: "Calculation",
883
+ timeframe: "Timeframe",
884
+ timeframeChart: "Chart",
885
+ waitClose: "Wait for timeframe closes",
886
+ timeframeHint: "Computed on bars of the chosen interval. Waiting for closes draws only finished bars, so what is drawn never changes.",
887
+ plotType: "Plot type",
888
+ kindLine: "Line",
889
+ kindStep: "Step line",
890
+ kindArea: "Area",
891
+ kindHistogram: "Histogram",
892
+ kindColumns: "Columns",
893
+ kindCircles: "Circles",
894
+ kindCross: "Cross",
895
+ indLevels: "Levels",
896
+ fillBand: "Background",
897
+ outputValues: "Output values",
898
+ precision: "Precision",
899
+ precisionDefault: "Default",
900
+ axisLabels: "Labels on price scale",
901
+ statusValues: "Values in status line",
902
+ inputValues: "Input values",
903
+ statusInputs: "Inputs in status line",
904
+ visibilityHint: "Shown only on charts of the checked units; narrow a range to show it only on those intervals (e.g. minutes 1\u201315).",
905
+ visSeconds: "Seconds",
906
+ visMinutes: "Minutes",
907
+ visHours: "Hours",
908
+ visDays: "Days",
909
+ visWeeks: "Weeks",
910
+ visMonths: "Months",
911
+ rangeFrom: "from",
912
+ rangeTo: "to",
913
+ defaults: "Defaults",
914
+ resetIndicator: "Reset settings",
915
+ saveDefaults: "Save as default",
916
+ forgetDefaults: "Forget saved default",
917
+ ok: "Ok",
918
+ levelValuesLabel: "Level values",
919
+ note: "Text",
920
+ noteText: "Type text",
921
+ bold: "Bold",
922
+ italic: "Italic",
923
+ noteH: "Horizontal",
924
+ noteV: "Vertical",
925
+ alignLeft: "Left",
926
+ alignCenter: "Center",
927
+ alignRight: "Right",
928
+ alignTop: "Top",
929
+ alignMiddle: "Middle",
930
+ alignBottom: "Bottom",
931
+ textColor: "Text color",
932
+ coordinates: "Coordinates",
933
+ point: "Point",
934
+ price: "Price",
935
+ time: "Time",
822
936
  intervalMinutes: "Minutes",
823
937
  intervalHours: "Hours",
824
938
  intervalDays: "Days",
@@ -905,6 +1019,74 @@ function a3(t3, e3, n2, u3, a4, i3) {
905
1019
  return (a4 || i3) && (s3.__source = a4, s3.__self = i3), n.vnode && n.vnode(s3), s3;
906
1020
  }
907
1021
 
1022
+ // src/components/interval-visibility.tsx
1023
+ var INTERVAL_UNITS = [
1024
+ { unit: "seconds", max: 59, label: (t3) => t3.visSeconds },
1025
+ { unit: "minutes", max: 59, label: (t3) => t3.visMinutes },
1026
+ { unit: "hours", max: 24, label: (t3) => t3.visHours },
1027
+ { unit: "days", max: 366, label: (t3) => t3.visDays },
1028
+ { unit: "weeks", max: 52, label: (t3) => t3.visWeeks },
1029
+ { unit: "months", max: 12, label: (t3) => t3.visMonths }
1030
+ ];
1031
+ function cleanIntervals(v3) {
1032
+ if (!v3) return void 0;
1033
+ const out = {};
1034
+ for (const { unit, max } of INTERVAL_UNITS) {
1035
+ const rule = v3[unit];
1036
+ if (rule === void 0) continue;
1037
+ if (rule === false) out[unit] = false;
1038
+ else {
1039
+ const lo = Math.max(1, Math.min(max, Math.round(rule[0]) || 1));
1040
+ const hi = Math.max(lo, Math.min(max, Math.round(rule[1]) || max));
1041
+ if (lo !== 1 || hi !== max) out[unit] = [lo, hi];
1042
+ }
1043
+ }
1044
+ return Object.keys(out).length ? out : void 0;
1045
+ }
1046
+ function IntervalVisibilityEditor({ t: t3, value, onChange }) {
1047
+ const v3 = value ?? {};
1048
+ const set = (unit, rule) => {
1049
+ const next = { ...v3 };
1050
+ if (rule === void 0) delete next[unit];
1051
+ else next[unit] = rule;
1052
+ onChange(next);
1053
+ };
1054
+ return /* @__PURE__ */ a3("div", { class: "fnc-rows fnc-vis", children: INTERVAL_UNITS.map(({ unit, max, label }) => {
1055
+ const rule = v3[unit];
1056
+ const on = rule !== false;
1057
+ const [lo, hi] = Array.isArray(rule) ? rule : [1, max];
1058
+ return /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
1059
+ /* @__PURE__ */ a3("label", { class: "fnc-vis-unit", children: [
1060
+ /* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked: on, onChange: (e3) => set(unit, e3.currentTarget.checked ? void 0 : false) }),
1061
+ label(t3)
1062
+ ] }),
1063
+ /* @__PURE__ */ a3(
1064
+ "input",
1065
+ {
1066
+ class: "fnc-input fnc-input-num",
1067
+ inputMode: "numeric",
1068
+ value: String(lo),
1069
+ disabled: !on,
1070
+ "aria-label": `${label(t3)} ${t3.rangeFrom}`,
1071
+ onChange: (e3) => set(unit, [Number(e3.currentTarget.value) || 1, hi])
1072
+ }
1073
+ ),
1074
+ /* @__PURE__ */ a3("span", { class: "fnc-vis-dash", children: "\u2013" }),
1075
+ /* @__PURE__ */ a3(
1076
+ "input",
1077
+ {
1078
+ class: "fnc-input fnc-input-num",
1079
+ inputMode: "numeric",
1080
+ value: String(hi),
1081
+ disabled: !on,
1082
+ "aria-label": `${label(t3)} ${t3.rangeTo}`,
1083
+ onChange: (e3) => set(unit, [lo, Number(e3.currentTarget.value) || max])
1084
+ }
1085
+ )
1086
+ ] });
1087
+ }) });
1088
+ }
1089
+
908
1090
  // src/icons.tsx
909
1091
  function Icon({ children, size = 20 }) {
910
1092
  return /* @__PURE__ */ a3(
@@ -1064,6 +1246,10 @@ var CalendarIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
1064
1246
  /* @__PURE__ */ a3("rect", { x: "3.5", y: "4.5", width: "13", height: "12", rx: "2" }),
1065
1247
  /* @__PURE__ */ a3("path", { d: "M3.5 8.5h13M7 3v3M13 3v3" })
1066
1248
  ] });
1249
+ var ClockIcon = () => /* @__PURE__ */ a3(Icon, { size: 13, children: [
1250
+ /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
1251
+ /* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
1252
+ ] });
1067
1253
  var SettingsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
1068
1254
  /* @__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
1255
  /* @__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 +1328,7 @@ var CopyIcon = () => /* @__PURE__ */ a3(Icon, { children: [
1142
1328
  /* @__PURE__ */ a3("rect", { x: "7", y: "7", width: "9.5", height: "9.5", rx: "1.8" }),
1143
1329
  /* @__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
1330
  ] });
1331
+ var TextIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M4.5 5V3.8h11V5M10 3.8v12.5M7.5 16.3h5" }) });
1145
1332
 
1146
1333
  // src/store.ts
1147
1334
  var Store = class {
@@ -1483,6 +1670,47 @@ function DashGlyph({ dash }) {
1483
1670
  const pattern = dash === "dashed" ? "4 3" : dash === "dotted" ? "1 3" : void 0;
1484
1671
  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
1672
  }
1673
+ function DrawingCoords({ ctx, drawing, t: t3 }) {
1674
+ const tz = ctx.chart.timeZone;
1675
+ const toLocal = (time) => new Date(time + timeZoneOffset(time, tz)).toISOString().slice(0, 16);
1676
+ const fromLocal = (text) => {
1677
+ const asUtc = Date.parse(`${text}:00Z`);
1678
+ if (!Number.isFinite(asUtc)) return null;
1679
+ const guess = asUtc - timeZoneOffset(asUtc, tz);
1680
+ return asUtc - timeZoneOffset(guess, tz);
1681
+ };
1682
+ const setPoint = (i3, patch) => ctx.chart.updateDrawing(drawing.id, { points: drawing.points.map((p3, j2) => j2 === i3 ? { ...p3, ...patch } : p3) });
1683
+ return /* @__PURE__ */ a3("div", { class: "fnc-coords", children: drawing.points.map((p3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-coord-row", children: [
1684
+ /* @__PURE__ */ a3("span", { class: "fnc-coord-name", children: drawing.points.length > 1 ? `${t3.point} ${i3 + 1}` : t3.point }),
1685
+ /* @__PURE__ */ a3(
1686
+ "input",
1687
+ {
1688
+ class: "fnc-input fnc-coord-price",
1689
+ type: "number",
1690
+ step: "any",
1691
+ defaultValue: String(p3.price),
1692
+ "aria-label": `${t3.point} ${i3 + 1} ${t3.price}`,
1693
+ onChange: (e3) => {
1694
+ const v3 = Number(e3.target.value);
1695
+ if (Number.isFinite(v3)) setPoint(i3, { price: v3 });
1696
+ }
1697
+ }
1698
+ ),
1699
+ /* @__PURE__ */ a3(
1700
+ "input",
1701
+ {
1702
+ class: "fnc-input fnc-coord-time",
1703
+ type: "datetime-local",
1704
+ defaultValue: toLocal(p3.time),
1705
+ "aria-label": `${t3.point} ${i3 + 1} ${t3.time}`,
1706
+ onChange: (e3) => {
1707
+ const time = fromLocal(e3.target.value);
1708
+ if (time !== null) setPoint(i3, { time });
1709
+ }
1710
+ }
1711
+ )
1712
+ ] }, `${drawing.id}:${i3}:${p3.time}:${p3.price}`)) });
1713
+ }
1486
1714
  function SelectionBar({ ctx }) {
1487
1715
  const s3 = useStore(ctx.store);
1488
1716
  const t3 = stringsOf(s3);
@@ -1899,6 +2127,108 @@ function SelectionBar({ ctx }) {
1899
2127
  ["back", t3.sendToBack]
1900
2128
  ].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
2129
  ] }),
2130
+ def && !def.text && /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
2131
+ /* @__PURE__ */ a3(
2132
+ "button",
2133
+ {
2134
+ class: style.text ? "fnc-btn fnc-btn-on" : "fnc-btn",
2135
+ "data-tip": t3.note,
2136
+ "aria-label": t3.note,
2137
+ "aria-expanded": menu === "note",
2138
+ onClick: () => setMenu(menu === "note" ? null : "note"),
2139
+ children: /* @__PURE__ */ a3(TextIcon, {})
2140
+ }
2141
+ ),
2142
+ menu === "note" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-note-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
2143
+ /* @__PURE__ */ a3(
2144
+ "textarea",
2145
+ {
2146
+ defaultValue: style.text ?? "",
2147
+ placeholder: t3.noteText,
2148
+ "aria-label": t3.noteText,
2149
+ onInput: (e3) => {
2150
+ const text = e3.target.value;
2151
+ const { text: _drop, ...rest } = style;
2152
+ setStyleRaw(text.trim() ? { ...rest, text } : rest);
2153
+ }
2154
+ },
2155
+ d3.id
2156
+ ),
2157
+ /* @__PURE__ */ a3("div", { class: "fnc-note-row", children: [
2158
+ /* @__PURE__ */ a3(
2159
+ "input",
2160
+ {
2161
+ type: "color",
2162
+ class: "fnc-color",
2163
+ "aria-label": t3.textColor,
2164
+ value: /^#[0-9a-f]{6}$/i.test(style.textColor ?? d3.color ?? "") ? style.textColor ?? d3.color : "#3182f6",
2165
+ onInput: (e3) => setStyle({ textColor: e3.target.value })
2166
+ }
2167
+ ),
2168
+ /* @__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: [
2169
+ n2,
2170
+ "px"
2171
+ ] })) }),
2172
+ /* @__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" }) }),
2173
+ /* @__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" }) })
2174
+ ] }),
2175
+ /* @__PURE__ */ a3("div", { class: "fnc-note-row", children: [
2176
+ /* @__PURE__ */ a3("span", { children: t3.noteH }),
2177
+ /* @__PURE__ */ a3("select", { class: "fnc-select", "aria-label": t3.noteH, value: style.textH ?? "center", onChange: (e3) => setStyle({ textH: e3.target.value }), children: [
2178
+ /* @__PURE__ */ a3("option", { value: "left", children: t3.alignLeft }),
2179
+ /* @__PURE__ */ a3("option", { value: "center", children: t3.alignCenter }),
2180
+ /* @__PURE__ */ a3("option", { value: "right", children: t3.alignRight })
2181
+ ] }),
2182
+ /* @__PURE__ */ a3("span", { children: t3.noteV }),
2183
+ /* @__PURE__ */ a3(
2184
+ "select",
2185
+ {
2186
+ class: "fnc-select",
2187
+ "aria-label": t3.noteV,
2188
+ value: style.textV ?? (def.note === "line" ? "top" : "middle"),
2189
+ onChange: (e3) => setStyle({ textV: e3.target.value }),
2190
+ children: [
2191
+ /* @__PURE__ */ a3("option", { value: "top", children: t3.alignTop }),
2192
+ /* @__PURE__ */ a3("option", { value: "middle", children: t3.alignMiddle }),
2193
+ /* @__PURE__ */ a3("option", { value: "bottom", children: t3.alignBottom })
2194
+ ]
2195
+ }
2196
+ )
2197
+ ] })
2198
+ ] })
2199
+ ] }),
2200
+ /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
2201
+ /* @__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, {}) }),
2202
+ 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 }) })
2203
+ ] }),
2204
+ /* @__PURE__ */ a3("div", { class: "fnc-selbar-menu", children: [
2205
+ /* @__PURE__ */ a3(
2206
+ "button",
2207
+ {
2208
+ class: style.intervals ? "fnc-btn fnc-btn-on" : "fnc-btn",
2209
+ "data-tip": t3.tabVisibility,
2210
+ "aria-label": t3.tabVisibility,
2211
+ "aria-expanded": menu === "visibility",
2212
+ onClick: () => setMenu(menu === "visibility" ? null : "visibility"),
2213
+ children: /* @__PURE__ */ a3(ClockIcon, {})
2214
+ }
2215
+ ),
2216
+ menu === "visibility" && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-selbar-pop fnc-visibility-menu", role: "menu", onKeyDown: (e3) => e3.key !== "Escape" && e3.stopPropagation(), children: [
2217
+ /* @__PURE__ */ a3("p", { class: "fnc-hint", children: t3.visibilityHint }),
2218
+ /* @__PURE__ */ a3(
2219
+ IntervalVisibilityEditor,
2220
+ {
2221
+ t: t3,
2222
+ value: style.intervals,
2223
+ onChange: (v3) => {
2224
+ const intervals = cleanIntervals(v3);
2225
+ const { intervals: _drop, ...rest } = style;
2226
+ setStyleRaw(intervals ? { ...rest, intervals } : rest);
2227
+ }
2228
+ }
2229
+ )
2230
+ ] })
2231
+ ] }),
1902
2232
  /* @__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
2233
  /* @__PURE__ */ a3(
1904
2234
  "button",
@@ -2013,11 +2343,7 @@ function RangeBar({ ctx }) {
2013
2343
  }
2014
2344
 
2015
2345
  // src/components/indicator-dialogs.tsx
2016
- import {
2017
- maLines,
2018
- PRICE_SOURCES,
2019
- SERIES_COLORS
2020
- } from "@funnest/charts";
2346
+ import "@funnest/charts";
2021
2347
 
2022
2348
  // src/components/go-to-date.tsx
2023
2349
  var DAY2 = 864e5;
@@ -2152,6 +2478,364 @@ function GoToDateDialog({ ctx }) {
2152
2478
  ] }) });
2153
2479
  }
2154
2480
 
2481
+ // src/components/indicator-settings.tsx
2482
+ import {
2483
+ maLines,
2484
+ PRICE_SOURCES,
2485
+ resolutionLabel as resolutionLabel2,
2486
+ resolutionToMs,
2487
+ SERIES_COLORS
2488
+ } from "@funnest/charts";
2489
+ var WIDTHS2 = [1, 2, 3, 4];
2490
+ var KINDS = ["line", "step", "area", "histogram", "columns", "circles", "cross"];
2491
+ var STYLES = ["solid", "dashed", "dotted"];
2492
+ var PRECISIONS = [0, 1, 2, 3, 4, 5, 6, 7, 8];
2493
+ var TIMEFRAMES = ["3", "5", "15", "30", "60", "120", "240", "1D", "1W", "1M"];
2494
+ var hex6 = (c3) => /^#[0-9a-f]{6}/i.test(c3) ? c3.slice(0, 7) : "#3182f6";
2495
+ var alphaOf = (c3) => /^#[0-9a-f]{8}$/i.test(c3) ? Math.round(parseInt(c3.slice(7, 9), 16) / 255 * 100) : 100;
2496
+ var withAlpha = (hex, pct) => {
2497
+ const base = hex6(hex);
2498
+ return pct >= 100 ? base : `${base}${Math.round(Math.max(0, pct) / 100 * 255).toString(16).padStart(2, "0")}`;
2499
+ };
2500
+ function ColorField({ value, label, onChange }) {
2501
+ const pct = alphaOf(value);
2502
+ return /* @__PURE__ */ a3("span", { class: "fnc-color-field", children: [
2503
+ /* @__PURE__ */ a3("input", { type: "color", class: "fnc-color", value: hex6(value), "aria-label": label, onInput: (e3) => onChange(withAlpha(e3.currentTarget.value, pct)) }),
2504
+ /* @__PURE__ */ a3(
2505
+ "input",
2506
+ {
2507
+ type: "range",
2508
+ class: "fnc-opacity",
2509
+ min: 0,
2510
+ max: 100,
2511
+ step: 5,
2512
+ value: pct,
2513
+ "aria-label": `${label} %`,
2514
+ title: `${pct}%`,
2515
+ onInput: (e3) => onChange(withAlpha(value, Number(e3.currentTarget.value)))
2516
+ }
2517
+ )
2518
+ ] });
2519
+ }
2520
+ function seriesRows(def, params, styles, lines) {
2521
+ const own = def.compute([], params).series;
2522
+ if (lines) {
2523
+ return lines.map((l3, i3) => {
2524
+ const key = `l${i3}`;
2525
+ const s3 = own[i3];
2526
+ const st = styles?.[key];
2527
+ const color = st?.color ?? s3?.color ?? SERIES_COLORS[i3 % SERIES_COLORS.length];
2528
+ 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" };
2529
+ });
2530
+ }
2531
+ return own.map((s3) => {
2532
+ const st = styles?.[s3.key];
2533
+ return {
2534
+ key: s3.key,
2535
+ label: s3.label,
2536
+ color: st?.color ?? s3.color,
2537
+ width: st?.width ?? s3.width,
2538
+ visible: st?.visible ?? s3.visible,
2539
+ lineStyle: st?.lineStyle ?? s3.lineStyle ?? "solid",
2540
+ kind: st?.kind ?? s3.kind,
2541
+ ownKind: s3.kind
2542
+ };
2543
+ });
2544
+ }
2545
+ function SourceSelect({ value, locale, label, onChange }) {
2546
+ 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] })) });
2547
+ }
2548
+ function Check({ label, checked, onChange }) {
2549
+ return /* @__PURE__ */ a3("label", { class: "fnc-row fnc-check-row", children: [
2550
+ /* @__PURE__ */ a3("input", { type: "checkbox", class: "fnc-check", checked, onChange: (e3) => onChange(e3.currentTarget.checked) }),
2551
+ /* @__PURE__ */ a3("span", { children: label })
2552
+ ] });
2553
+ }
2554
+ function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
2555
+ const { locale, indicators, resolution, customIntervals, symbol } = useStore(ctx.store);
2556
+ const t3 = stringsOf(ctx.store.get());
2557
+ const config = indicators.find((c3) => c3.id === id);
2558
+ const def = config ? ctx.chart.indicatorDefinition(config.type) ?? null : null;
2559
+ const hasLines = !!def?.params.some((p3) => p3.kind === "lines");
2560
+ const onIndicator = !!config?.on;
2561
+ const initLines = (c3, params = c3?.params) => params && hasLines ? maLines(params).map((l3) => ({ period: String(l3.period), source: l3.source })) : [];
2562
+ const [tab, setTab] = d2("inputs");
2563
+ const [lines, setLines] = d2(() => initLines(config));
2564
+ const [values, setValues] = d2(
2565
+ () => Object.fromEntries(Object.entries(config?.params ?? {}).filter(([, v3]) => !Array.isArray(v3)).map(([k2, v3]) => [k2, String(v3)]))
2566
+ );
2567
+ const [rows, setRows] = d2(() => config && def ? seriesRows(def, config.params, config.styles, hasLines ? initLines(config) : null) : []);
2568
+ const [display, setDisplay] = d2(() => ({ ...config?.display ?? {} }));
2569
+ const [timeframe, setTimeframe] = d2(config?.timeframe ?? "");
2570
+ const [waitClose, setWaitClose] = d2(config?.waitClose !== false);
2571
+ const [menu, setMenu] = d2(false);
2572
+ const close = () => ctx.store.set({ dialog: null });
2573
+ if (!config || !def) return null;
2574
+ const probe = def.compute([], config.params);
2575
+ const hasLevels = !!probe.levels?.length;
2576
+ const hasFill = !!probe.fill || !!probe.fills?.length;
2577
+ const chartMs = (() => {
2578
+ try {
2579
+ return resolutionToMs(resolution);
2580
+ } catch {
2581
+ return 0;
2582
+ }
2583
+ })();
2584
+ const supported = symbol?.supportedResolutions;
2585
+ const timeframes = [.../* @__PURE__ */ new Set([...TIMEFRAMES, ...customIntervals])].filter((r3) => {
2586
+ try {
2587
+ return resolutionToMs(r3) > chartMs && (!supported?.length || supported.includes(r3));
2588
+ } catch {
2589
+ return false;
2590
+ }
2591
+ }).sort((a4, b) => resolutionToMs(a4) - resolutionToMs(b));
2592
+ if (timeframe && !timeframes.includes(timeframe)) timeframes.push(timeframe);
2593
+ const patchRow = (i3, p3) => setRows(rows.map((r3, j2) => j2 === i3 ? { ...r3, ...p3 } : r3));
2594
+ const setLinesAndRows = (next) => {
2595
+ setLines(next);
2596
+ setRows(
2597
+ next.map((l3, i3) => {
2598
+ const r3 = rows[i3];
2599
+ 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" };
2600
+ })
2601
+ );
2602
+ };
2603
+ const collect = () => {
2604
+ const params = {};
2605
+ for (const spec of def.params) {
2606
+ const clamp = (n2) => Math.min(spec.max ?? Infinity, Math.max(spec.min ?? -Infinity, n2));
2607
+ 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 }));
2608
+ else if (spec.kind === "source") params[spec.key] = values[spec.key] ?? "close";
2609
+ else {
2610
+ const n2 = Number(values[spec.key]);
2611
+ if (Number.isFinite(n2)) params[spec.key] = clamp(n2);
2612
+ }
2613
+ }
2614
+ const kept = hasLines ? rows.filter((_3, i3) => Number(lines[i3]?.period) > 0) : rows;
2615
+ const styles = {};
2616
+ kept.forEach((r3, i3) => {
2617
+ const key = hasLines ? `l${i3}` : r3.key;
2618
+ styles[key] = { color: r3.color, width: r3.width, visible: r3.visible, ...r3.lineStyle !== "solid" ? { lineStyle: r3.lineStyle } : {}, ...r3.kind !== r3.ownKind ? { kind: r3.kind } : {} };
2619
+ });
2620
+ const d3 = { ...display };
2621
+ const intervals = cleanIntervals(d3.intervals);
2622
+ if (intervals) d3.intervals = intervals;
2623
+ else delete d3.intervals;
2624
+ for (const k2 of Object.keys(d3)) if (d3[k2] === void 0) delete d3[k2];
2625
+ return { params, styles, display: d3, timeframe, waitClose };
2626
+ };
2627
+ const apply = (e3) => {
2628
+ e3.preventDefault();
2629
+ const c3 = collect();
2630
+ ctx.chart.updateIndicator(id, { params: c3.params, styles: c3.styles, display: c3.display, timeframe: c3.timeframe, waitClose: c3.waitClose });
2631
+ close();
2632
+ };
2633
+ const reset = () => {
2634
+ const params = { ...def.defaults };
2635
+ const l3 = hasLines ? maLines(params).map((x2) => ({ period: String(x2.period), source: x2.source })) : [];
2636
+ setLines(l3);
2637
+ setValues(Object.fromEntries(Object.entries(params).filter(([, v3]) => !Array.isArray(v3)).map(([k2, v3]) => [k2, String(v3)])));
2638
+ setRows(seriesRows(def, params, void 0, hasLines ? l3 : null));
2639
+ setDisplay({});
2640
+ setTimeframe("");
2641
+ setWaitClose(true);
2642
+ setMenu(false);
2643
+ };
2644
+ const saveDefaults = () => {
2645
+ const c3 = collect();
2646
+ ctx.chart.saveIndicatorDefaults(config.type, { params: c3.params, styles: c3.styles, display: c3.display, ...c3.timeframe ? { timeframe: c3.timeframe } : {}, ...c3.waitClose ? {} : { waitClose: false } });
2647
+ setMenu(false);
2648
+ };
2649
+ const hasSaved = !!ctx.chart.indicatorDefaults(config.type);
2650
+ const forgetDefaults = () => {
2651
+ ctx.chart.saveIndicatorDefaults(config.type, null);
2652
+ setMenu(false);
2653
+ };
2654
+ const setD = (p3) => {
2655
+ const next = { ...display, ...p3 };
2656
+ for (const k2 of Object.keys(next)) if (next[k2] === void 0) delete next[k2];
2657
+ setDisplay(next);
2658
+ };
2659
+ 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];
2660
+ const styleLabel = (s3) => ({ solid: t3.lineSolid, dashed: t3.lineDashed, dotted: t3.lineDotted })[s3];
2661
+ return /* @__PURE__ */ a3(Dialog2, { title: def.name[locale], onClose: close, wide: true, children: [
2662
+ /* @__PURE__ */ a3("div", { class: "fnc-tabs fnc-settings-tabs", role: "tablist", children: [
2663
+ ["inputs", t3.tabInputs],
2664
+ ["style", t3.tabStyle],
2665
+ ["visibility", t3.tabVisibility]
2666
+ ].map(([k2, label]) => /* @__PURE__ */ a3("button", { type: "button", class: "fnc-tab", role: "tab", "aria-selected": tab === k2, onClick: () => setTab(k2), children: label })) }),
2667
+ /* @__PURE__ */ a3("form", { class: "fnc-form", onSubmit: apply, children: [
2668
+ tab === "inputs" && /* @__PURE__ */ a3($, { children: [
2669
+ hasLines ? /* @__PURE__ */ a3("div", { class: "fnc-rows", children: [
2670
+ lines.map((l3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2671
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label", children: [
2672
+ t3.period,
2673
+ i3 + 1
2674
+ ] }),
2675
+ /* @__PURE__ */ a3(
2676
+ "input",
2677
+ {
2678
+ class: "fnc-input fnc-input-period",
2679
+ inputMode: "numeric",
2680
+ value: l3.period,
2681
+ "aria-label": `${t3.period}${i3 + 1}`,
2682
+ onInput: (e3) => setLinesAndRows(lines.map((x2, j2) => j2 === i3 ? { ...x2, period: e3.currentTarget.value.replace(/\D/g, "") } : x2))
2683
+ }
2684
+ ),
2685
+ !onIndicator && /* @__PURE__ */ a3(SourceSelect, { value: l3.source, locale, label: t3.source, onChange: (source) => setLines(lines.map((x2, j2) => j2 === i3 ? { ...x2, source } : x2)) }),
2686
+ /* @__PURE__ */ a3(
2687
+ "button",
2688
+ {
2689
+ type: "button",
2690
+ class: "fnc-ind-btn",
2691
+ "aria-label": t3.removePeriod,
2692
+ "data-tip": t3.removePeriod,
2693
+ onClick: () => {
2694
+ setLines(lines.filter((_3, j2) => j2 !== i3));
2695
+ setRows(rows.filter((_3, j2) => j2 !== i3));
2696
+ },
2697
+ children: /* @__PURE__ */ a3(SmallCloseIcon, {})
2698
+ }
2699
+ )
2700
+ ] })),
2701
+ /* @__PURE__ */ a3(
2702
+ "button",
2703
+ {
2704
+ type: "button",
2705
+ class: "fnc-add-row",
2706
+ onClick: () => {
2707
+ const last = lines[lines.length - 1];
2708
+ setLinesAndRows([...lines, { period: String(last ? Number(last.period) * 2 || 10 : 5), source: "close" }]);
2709
+ },
2710
+ children: [
2711
+ "+ ",
2712
+ t3.addPeriod
2713
+ ]
2714
+ }
2715
+ )
2716
+ ] }) : def.params.filter((spec) => !(onIndicator && spec.kind === "source")).map((spec) => /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2717
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: spec.label[locale] }),
2718
+ 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 }) })
2719
+ ] })),
2720
+ /* @__PURE__ */ a3($, { children: [
2721
+ /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.calculation }),
2722
+ /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2723
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.timeframe }),
2724
+ /* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-source", value: timeframe, "aria-label": t3.timeframe, onChange: (e3) => setTimeframe(e3.currentTarget.value), children: [
2725
+ /* @__PURE__ */ a3("option", { value: "", children: t3.timeframeChart }),
2726
+ timeframes.map((r3) => /* @__PURE__ */ a3("option", { value: r3, children: resolutionLabel2(r3, locale, "long") }))
2727
+ ] })
2728
+ ] }),
2729
+ /* @__PURE__ */ a3(Check, { label: t3.waitClose, checked: waitClose, onChange: setWaitClose }),
2730
+ timeframe && /* @__PURE__ */ a3("p", { class: "fnc-hint", children: t3.timeframeHint })
2731
+ ] })
2732
+ ] }),
2733
+ tab === "style" && /* @__PURE__ */ a3($, { children: [
2734
+ /* @__PURE__ */ a3("div", { class: "fnc-rows", children: rows.map((r3, i3) => /* @__PURE__ */ a3("div", { class: "fnc-row fnc-style-row", children: [
2735
+ /* @__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 }) }),
2736
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", title: r3.label, children: r3.label }),
2737
+ /* @__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 }) }),
2738
+ /* @__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: [
2739
+ w3,
2740
+ "px"
2741
+ ] })) }),
2742
+ /* @__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) })) }),
2743
+ /* @__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) })) })
2744
+ ] })) }),
2745
+ (hasLevels || hasFill) && /* @__PURE__ */ a3($, { children: [
2746
+ hasLevels && /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2747
+ /* @__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 }) }),
2748
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.indLevels }),
2749
+ /* @__PURE__ */ a3(ColorField, { value: display.levelColor ?? "#8b95a1", label: t3.color, onChange: (levelColor) => setD({ levelColor }) })
2750
+ ] }),
2751
+ hasLevels && display.levels !== false && /* @__PURE__ */ a3("div", { class: "fnc-row fnc-level-values", children: [
2752
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.levelValuesLabel }),
2753
+ probe.levels.map((l3, i3) => {
2754
+ const own = typeof l3 === "number" ? l3 : l3.value;
2755
+ const v3 = display.levelValues?.[i3];
2756
+ return /* @__PURE__ */ a3(
2757
+ "input",
2758
+ {
2759
+ class: "fnc-input fnc-input-num",
2760
+ inputMode: "decimal",
2761
+ defaultValue: String(v3 ?? own),
2762
+ "aria-label": `${t3.levelValuesLabel} ${i3 + 1}`,
2763
+ onChange: (e3) => {
2764
+ const n2 = Number(e3.currentTarget.value);
2765
+ const next = probe.levels.map((x2, j2) => display.levelValues?.[j2] ?? (typeof x2 === "number" ? x2 : x2.value));
2766
+ next[i3] = Number.isFinite(n2) ? n2 : own;
2767
+ const same = next.every((x2, j2) => x2 === (typeof probe.levels[j2] === "number" ? probe.levels[j2] : probe.levels[j2].value));
2768
+ setD({ levelValues: same ? void 0 : next });
2769
+ }
2770
+ },
2771
+ `${i3}:${v3 ?? own}`
2772
+ );
2773
+ })
2774
+ ] }),
2775
+ hasFill && /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2776
+ /* @__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 }) }),
2777
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.fillBand }),
2778
+ /* @__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 }) })
2779
+ ] })
2780
+ ] }),
2781
+ /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.outputValues }),
2782
+ /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
2783
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.precision }),
2784
+ /* @__PURE__ */ a3(
2785
+ "select",
2786
+ {
2787
+ class: "fnc-select fnc-select-source",
2788
+ value: display.precision === void 0 ? "" : String(display.precision),
2789
+ "aria-label": t3.precision,
2790
+ onChange: (e3) => setD({ precision: e3.currentTarget.value === "" ? void 0 : Number(e3.currentTarget.value) }),
2791
+ children: [
2792
+ /* @__PURE__ */ a3("option", { value: "", children: t3.precisionDefault }),
2793
+ PRECISIONS.map((n2) => /* @__PURE__ */ a3("option", { value: String(n2), children: n2 === 0 ? "1" : `0.${"0".repeat(n2 - 1)}1` }))
2794
+ ]
2795
+ }
2796
+ )
2797
+ ] }),
2798
+ /* @__PURE__ */ a3(Check, { label: t3.axisLabels, checked: display.axisLabels !== false, onChange: (v3) => setD({ axisLabels: v3 ? void 0 : false }) }),
2799
+ /* @__PURE__ */ a3(Check, { label: t3.statusValues, checked: display.statusValues !== false, onChange: (v3) => setD({ statusValues: v3 ? void 0 : false }) }),
2800
+ /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.inputValues }),
2801
+ /* @__PURE__ */ a3(Check, { label: t3.statusInputs, checked: display.statusInputs !== false, onChange: (v3) => setD({ statusInputs: v3 ? void 0 : false }) })
2802
+ ] }),
2803
+ tab === "visibility" && /* @__PURE__ */ a3($, { children: [
2804
+ /* @__PURE__ */ a3("p", { class: "fnc-hint", children: t3.visibilityHint }),
2805
+ /* @__PURE__ */ a3(IntervalVisibilityEditor, { t: t3, value: display.intervals, onChange: (intervals) => setD({ intervals }) })
2806
+ ] }),
2807
+ /* @__PURE__ */ a3("div", { class: "fnc-form-actions fnc-form-actions-split", children: [
2808
+ /* @__PURE__ */ a3("div", { class: "fnc-defaults", children: [
2809
+ /* @__PURE__ */ a3("button", { type: "button", class: "fnc-action fnc-action-menu", "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu(!menu), children: [
2810
+ t3.defaults,
2811
+ " \u25BE"
2812
+ ] }),
2813
+ menu && /* @__PURE__ */ a3("div", { class: "fnc-defaults-menu", role: "menu", children: [
2814
+ /* @__PURE__ */ a3("button", { type: "button", role: "menuitem", onClick: reset, children: t3.resetIndicator }),
2815
+ /* @__PURE__ */ a3("button", { type: "button", role: "menuitem", onClick: saveDefaults, children: t3.saveDefaults }),
2816
+ hasSaved && /* @__PURE__ */ a3("button", { type: "button", role: "menuitem", onClick: forgetDefaults, children: t3.forgetDefaults }),
2817
+ /* @__PURE__ */ a3(
2818
+ "button",
2819
+ {
2820
+ type: "button",
2821
+ role: "menuitem",
2822
+ class: "fnc-danger",
2823
+ onClick: () => {
2824
+ ctx.chart.removeIndicator(id);
2825
+ close();
2826
+ },
2827
+ children: t3.remove
2828
+ }
2829
+ )
2830
+ ] })
2831
+ ] }),
2832
+ /* @__PURE__ */ a3("button", { type: "button", class: "fnc-action", onClick: close, children: t3.cancel }),
2833
+ /* @__PURE__ */ a3("button", { type: "submit", class: "fnc-action fnc-action-primary", children: t3.ok })
2834
+ ] })
2835
+ ] })
2836
+ ] });
2837
+ }
2838
+
2155
2839
  // src/components/settings-dialog.tsx
2156
2840
  import { CHART_THEMES, DEFAULT_CHART_SETTINGS, matchChartTheme } from "@funnest/charts";
2157
2841
  function toHex(color) {
@@ -2410,197 +3094,17 @@ function IndicatorPicker({ ctx }) {
2410
3094
  ] })
2411
3095
  ] });
2412
3096
  }
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
3097
  function Dialogs({ ctx }) {
2594
3098
  const { dialog } = useStore(ctx.store);
2595
3099
  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 });
3100
+ if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id, Dialog }, dialog.id);
2597
3101
  if (dialog?.kind === "chartSettings") return /* @__PURE__ */ a3(SettingsDialog, { ctx });
2598
3102
  if (dialog?.kind === "goToDate") return /* @__PURE__ */ a3(GoToDateDialog, { ctx });
2599
3103
  return null;
2600
3104
  }
2601
3105
 
2602
3106
  // src/components/interval-picker.tsx
2603
- import { derivedBase as derivedBase2, resolutionToMs } from "@funnest/charts";
3107
+ import { derivedBase as derivedBase2, resolutionToMs as resolutionToMs2 } from "@funnest/charts";
2604
3108
 
2605
3109
  // src/components/keep-in-view.ts
2606
3110
  var MARGIN = 8;
@@ -2667,7 +3171,7 @@ function IntervalPicker({ ctx }) {
2667
3171
  const supported = s3.symbol?.supportedResolutions;
2668
3172
  const isSupported = (r3) => !supported || supported.includes(r3) || !!derivedBase2(r3, supported);
2669
3173
  const listed = new Set(ctx.intervalGroups.flatMap((g3) => g3.intervals));
2670
- const custom = s3.customIntervals.filter((r3) => !listed.has(r3)).sort((a4, b) => resolutionToMs(a4) - resolutionToMs(b));
3174
+ const custom = s3.customIntervals.filter((r3) => !listed.has(r3)).sort((a4, b) => resolutionToMs2(a4) - resolutionToMs2(b));
2671
3175
  const order = [...ctx.intervalGroups.flatMap((g3) => g3.intervals), ...custom];
2672
3176
  const [amount, setAmount] = d2("2");
2673
3177
  const [unit, setUnit] = d2(1);
@@ -2679,7 +3183,7 @@ function IntervalPicker({ ctx }) {
2679
3183
  select(r3);
2680
3184
  };
2681
3185
  const favorites = s3.favoriteIntervals;
2682
- const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) : resolutionToMs(a4) - resolutionToMs(b);
3186
+ const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) : resolutionToMs2(a4) - resolutionToMs2(b);
2683
3187
  const chips = [.../* @__PURE__ */ new Set([...favorites, ...s3.resolution ? [s3.resolution] : []])].sort(byTime);
2684
3188
  const select = (r3) => {
2685
3189
  setOpen(false);
@@ -3671,7 +4175,7 @@ function IndicatorItem({ ctx, item }) {
3671
4175
  return /* @__PURE__ */ a3(
3672
4176
  "div",
3673
4177
  {
3674
- class: item.visible ? "fnc-ind" : "fnc-ind fnc-ind-hidden",
4178
+ class: item.visible && !item.offInterval ? "fnc-ind" : "fnc-ind fnc-ind-hidden",
3675
4179
  role: "button",
3676
4180
  tabIndex: 0,
3677
4181
  "aria-label": `${item.title} ${t3.indicatorSettings}`,
@@ -4961,6 +5465,68 @@ var CSS = (
4961
5465
  .fnc-input-period { flex: 0 0 72px; text-align: right; }
4962
5466
  .fnc-select-width { flex: 0 0 72px; }
4963
5467
  .fnc-select-source { flex: 1; }
5468
+ .fnc-select-style { flex: 0 0 76px; }
5469
+ .fnc-select-kind { flex: 1; min-width: 88px; }
5470
+ .fnc-settings-tabs { padding: 8px 16px; }
5471
+ .fnc-style-row .fnc-row-label-wide { overflow: hidden; text-overflow: ellipsis; }
5472
+ .fnc-check-row { gap: 10px; min-height: 34px; font-size: 14px; color: var(--fnc-text); cursor: pointer; }
5473
+ .fnc-hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--fnc-text-2); }
5474
+ .fnc-vis .fnc-row { min-height: 40px; }
5475
+ .fnc-vis-unit { display: flex; align-items: center; gap: 10px; width: 96px; flex: none; font-size: 14px; color: var(--fnc-text); cursor: pointer; }
5476
+ .fnc-input-num { flex: 0 0 72px; text-align: right; }
5477
+ .fnc-input-num:disabled { opacity: 0.4; }
5478
+ .fnc-vis-dash { color: var(--fnc-text-2); }
5479
+ .fnc-coords-menu, .fnc-visibility-menu { padding: 10px 12px; min-width: 300px; }
5480
+ .fnc-visibility-menu .fnc-hint { margin-bottom: 6px; max-width: 320px; }
5481
+ .fnc-visibility-menu .fnc-row { min-height: 34px; }
5482
+ .fnc-visibility-menu .fnc-input-num { height: 30px; flex-basis: 56px; font-size: 13px; }
5483
+ .fnc-coords { display: flex; flex-direction: column; gap: 8px; }
5484
+ .fnc-coord-row { display: flex; align-items: center; gap: 6px; }
5485
+ .fnc-coord-name { width: 40px; flex: none; font-size: 12px; color: var(--fnc-text-2); }
5486
+ .fnc-coord-price { flex: 0 0 110px; height: 32px; font-size: 13px; }
5487
+ .fnc-coord-time { flex: 0 0 180px; height: 32px; font-size: 13px; }
5488
+ .fnc-btn-on { color: var(--fnc-accent); }
5489
+ .fnc-color-field { display: flex; align-items: center; gap: 6px; flex: none; }
5490
+ .fnc-opacity { width: 64px; accent-color: var(--fnc-accent); }
5491
+ .fnc-level-values { flex-wrap: wrap; row-gap: 6px; }
5492
+ .fnc-level-values .fnc-input-num { flex: 0 0 64px; height: 34px; font-size: 14px; }
5493
+ .fnc-note-menu { padding: 10px 12px; width: 300px; display: flex; flex-direction: column; gap: 8px; }
5494
+ .fnc-note-menu textarea {
5495
+ min-height: 64px;
5496
+ padding: 8px 10px;
5497
+ border: 1px solid var(--fnc-border);
5498
+ border-radius: var(--fnc-radius);
5499
+ background: var(--fnc-bg);
5500
+ color: var(--fnc-text);
5501
+ font: inherit;
5502
+ font-size: 14px;
5503
+ resize: vertical;
5504
+ outline: none;
5505
+ }
5506
+ .fnc-note-menu textarea:focus { border-color: var(--fnc-accent); }
5507
+ .fnc-note-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fnc-text-2); }
5508
+ .fnc-note-row .fnc-select { height: 32px; font-size: 13px; flex: 1; }
5509
+ .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); }
5510
+ .fnc-note-toggle[aria-pressed='true'] { background: var(--fnc-text); color: var(--fnc-bg); border-color: var(--fnc-text); }
5511
+ .fnc-form-actions-split .fnc-defaults { position: relative; flex: 1; display: flex; }
5512
+ .fnc-form-actions-split .fnc-defaults > .fnc-action { flex: 1; }
5513
+ .fnc-defaults-menu {
5514
+ position: absolute;
5515
+ left: 0;
5516
+ bottom: calc(100% + 6px);
5517
+ min-width: 200px;
5518
+ display: flex;
5519
+ flex-direction: column;
5520
+ padding: 6px;
5521
+ border: 1px solid var(--fnc-border);
5522
+ border-radius: var(--fnc-radius);
5523
+ background: var(--fnc-bg);
5524
+ box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
5525
+ z-index: 2;
5526
+ }
5527
+ .fnc-defaults-menu button { height: 38px; padding: 0 12px; border-radius: 6px; text-align: left; font-size: 14px; color: var(--fnc-text); }
5528
+ .fnc-defaults-menu button:hover { background: var(--fnc-surface); }
5529
+ .fnc-defaults-menu .fnc-danger { color: var(--fnc-down, #f04452); }
4964
5530
  .fnc-toggle-row { justify-content: space-between; min-height: 36px; cursor: pointer; font-size: 14px; }
4965
5531
  .fnc-switch {
4966
5532
  appearance: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.9.6",
3
+ "version": "0.10.0",
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.9.6"
45
+ "@funnest/charts": "0.10.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"