@funnest/charts-ui 0.11.48 → 0.11.50

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.
@@ -0,0 +1,8 @@
1
+ import type { WidgetContext } from '../context.js';
2
+ /**
3
+ * 리플레이 날짜 (from the replay bar's 📅): the start day — and, if wanted, an end day the replay
4
+ * stops at — on the animated range calendar (replay-range.ts), then 여기서 시작.
5
+ */
6
+ export declare function ReplayDateDialog({ ctx }: {
7
+ ctx: WidgetContext;
8
+ }): import("preact").JSX.Element;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * 리플레이 시작 날짜 — designbookmark.com/motion/date-range, rebuilt for the chart (plain DOM, the
3
+ * same springs as its tokens.css: fade 420/32, soft 260/24, the month push 420/41).
4
+ *
5
+ * Nothing sweeps. Tapping a day opens a dot on it (the start); tapping a later day — or dragging
6
+ * to it — fades a band in from the start to there and opens the end's dot (the end is optional:
7
+ * replay stops by itself there). While choosing, a light band follows the pointer at once. Tapping
8
+ * the start again clears. Each mark has one fade value eased out over FADE seconds, the same way
9
+ * in and out; day text turns with the band; a dot carries its own number, so the switch is exactly
10
+ * where it covers. Months slide sideways (‹ ›), years too (« »), and the grid's height follows the
11
+ * month's rows. Texts (the month, the sentence under the grid, the day count) roll.
12
+ *
13
+ * Days are whole UTC days (the chart's bars are UTC); days after today can't be picked.
14
+ */
15
+ export interface ReplayRangeText {
16
+ /** "2026년 3월" for a month. */
17
+ month(y: number, m: number): string;
18
+ /** "3월 11일" for a day (index from 1970-01-01, UTC). */
19
+ day(d: number): string;
20
+ /** Short weekday names, Sunday first. */
21
+ weekdays: string[];
22
+ /** The sentence under the grid. */
23
+ pickStart: string;
24
+ startOnly(start: string): string;
25
+ range(start: string, end: string): string;
26
+ /** The chip: how many days the range has. */
27
+ days(n: number): string;
28
+ prevMonth: string;
29
+ nextMonth: string;
30
+ prevYear: string;
31
+ nextYear: string;
32
+ grid: string;
33
+ }
34
+ export interface ReplayRange {
35
+ destroy(): void;
36
+ }
37
+ /** Mounts the picker into `root`; `onChange` gets the start and end (UTC ms of the days, or null). */
38
+ export declare function mountReplayRange(root: HTMLElement, opts: {
39
+ text: ReplayRangeText;
40
+ at: number;
41
+ onChange(start: number | null, end: number | null): void;
42
+ }): ReplayRange;
package/dist/context.d.ts CHANGED
@@ -43,6 +43,7 @@ export interface UiState {
43
43
  kind: 'volumeSettings';
44
44
  } | {
45
45
  kind: 'goToDate';
46
+ replay?: boolean;
46
47
  } | null;
47
48
  /** Intervals pinned as toolbar chips (★ in the interval menu). */
48
49
  favoriteIntervals: Resolution[];
@@ -70,7 +71,7 @@ export interface UiState {
70
71
  * calendar, 'eye' display, 'clock' time, and the chart's own rows' (undo, redo, smooth, lock,
71
72
  * ratio, reset, settings).
72
73
  */
73
- export type MenuIconName = 'alert' | 'line' | 'date' | 'eye' | 'clock' | 'undo' | 'redo' | 'smooth' | 'lock' | 'ratio' | 'reset' | 'settings';
74
+ export type MenuIconName = 'alert' | 'line' | 'date' | 'eye' | 'clock' | 'undo' | 'redo' | 'smooth' | 'lock' | 'ratio' | 'reset' | 'settings' | 'copy';
74
75
  /** A row in the chart's right-click menu, or a divider. */
75
76
  export type ContextMenuItem = {
76
77
  label: string;
package/dist/i18n.d.ts CHANGED
@@ -162,6 +162,18 @@ export declare const STRINGS: {
162
162
  replayExit: string;
163
163
  replaySpeed: string;
164
164
  replayRestart: string;
165
+ replayDate: string;
166
+ replayRandom: string;
167
+ replayDateTitle: string;
168
+ replayStartHere: string;
169
+ replayPlayRange: string;
170
+ replayRangePick: string;
171
+ replayRangeFrom: string;
172
+ replayRangeSpan: string;
173
+ replayRangeDays: string;
174
+ replayUnsupported: string;
175
+ replayShortcutPlay: string;
176
+ replayShortcutStep: string;
165
177
  replayDone: string;
166
178
  searchIndicators: string;
167
179
  moreTools: string;
@@ -224,6 +236,15 @@ export declare const STRINGS: {
224
236
  onIndicatorSection: string;
225
237
  moveIndicatorUp: string;
226
238
  moveIndicatorDown: string;
239
+ moveToChart: string;
240
+ moveToPane: string;
241
+ placement: string;
242
+ placementMain: string;
243
+ placementPane: string;
244
+ scaleLabel: string;
245
+ scalePrice: string;
246
+ scaleOwn: string;
247
+ scaleLeft: string;
227
248
  textEditHint: string;
228
249
  hideVolume: string;
229
250
  volumeSettings: string;
@@ -540,6 +561,18 @@ export declare const STRINGS: {
540
561
  replayExit: string;
541
562
  replaySpeed: string;
542
563
  replayRestart: string;
564
+ replayDate: string;
565
+ replayRandom: string;
566
+ replayDateTitle: string;
567
+ replayStartHere: string;
568
+ replayPlayRange: string;
569
+ replayRangePick: string;
570
+ replayRangeFrom: string;
571
+ replayRangeSpan: string;
572
+ replayRangeDays: string;
573
+ replayUnsupported: string;
574
+ replayShortcutPlay: string;
575
+ replayShortcutStep: string;
543
576
  replayDone: string;
544
577
  searchIndicators: string;
545
578
  moreTools: string;
@@ -602,6 +635,15 @@ export declare const STRINGS: {
602
635
  onIndicatorSection: string;
603
636
  moveIndicatorUp: string;
604
637
  moveIndicatorDown: string;
638
+ moveToChart: string;
639
+ moveToPane: string;
640
+ placement: string;
641
+ placementMain: string;
642
+ placementPane: string;
643
+ scaleLabel: string;
644
+ scalePrice: string;
645
+ scaleOwn: string;
646
+ scaleLeft: string;
605
647
  textEditHint: string;
606
648
  hideVolume: string;
607
649
  volumeSettings: string;
package/dist/icons.d.ts CHANGED
@@ -47,12 +47,18 @@ export declare const SmallCloseIcon: () => import("preact").JSX.Element;
47
47
  export declare const EyeIcon: () => import("preact").JSX.Element;
48
48
  export declare const EyeOffIcon: () => import("preact").JSX.Element;
49
49
  export declare const ChevronUpIcon: () => import("preact").JSX.Element;
50
+ /** 차트 위로: up out of its pane onto the candles. */
51
+ export declare const ToChartIcon: () => import("preact").JSX.Element;
52
+ /** 아래 칸으로: down into a pane of its own. */
53
+ export declare const ToPaneIcon: () => import("preact").JSX.Element;
50
54
  /** A sturdy horseshoe: wide arms, the poles filled in (a thin U read as faint next to the other tools). */
51
55
  export declare const MagnetIcon: () => import("preact").JSX.Element;
52
56
  export declare const StarIcon: ({ filled }: {
53
57
  filled?: boolean;
54
58
  }) => import("preact").JSX.Element;
55
59
  export declare const CalendarIcon: () => import("preact").JSX.Element;
60
+ /** 무작위 봉 (리플레이): a die. */
61
+ export declare const DiceIcon: () => import("preact").JSX.Element;
56
62
  export declare const ClockIcon: () => import("preact").JSX.Element;
57
63
  export declare const WifiIcon: ({ bars }: {
58
64
  bars?: 0 | 1 | 2 | 3;
package/dist/index.js CHANGED
@@ -596,7 +596,19 @@ var STRINGS = {
596
596
  replayStep: "\uD55C \uBD09 \uC55E\uC73C\uB85C",
597
597
  replayExit: "\uB9AC\uD50C\uB808\uC774 \uC885\uB8CC",
598
598
  replaySpeed: "\uC18D\uB3C4",
599
- replayRestart: "\uC2DC\uC791 \uC9C0\uC810 \uB2E4\uC2DC \uACE0\uB974\uAE30",
599
+ replayRestart: "\uC2DC\uC791\uD560 \uBD09 \uB2E4\uC2DC \uACE0\uB974\uAE30",
600
+ replayDate: "\uB0A0\uC9DC \uC120\uD0DD",
601
+ replayRandom: "\uBB34\uC791\uC704 \uBD09",
602
+ replayDateTitle: "\uB9AC\uD50C\uB808\uC774 \uC2DC\uC791 \uB0A0\uC9DC",
603
+ replayStartHere: "\uC5EC\uAE30\uC11C \uC2DC\uC791",
604
+ replayPlayRange: "\uC774 \uAD6C\uAC04 \uC7AC\uC0DD",
605
+ replayRangePick: "\uC2DC\uC791\uD560 \uB0A0\uC9DC\uB97C \uB204\uB974\uC138\uC694",
606
+ replayRangeFrom: "{start}\uBD80\uD130",
607
+ replayRangeSpan: "{start} \u2013 {end}",
608
+ replayRangeDays: "{n}\uC77C",
609
+ replayUnsupported: "\uC774 \uCC28\uD2B8 \uC885\uB958\uB294 \uB9AC\uD50C\uB808\uC774\uB97C \uD560 \uC218 \uC5C6\uC5B4\uC694",
610
+ replayShortcutPlay: "Shift+\u2193",
611
+ replayShortcutStep: "Shift+\u2192",
600
612
  replayDone: "\uB05D\uAE4C\uC9C0 \uC7AC\uC0DD\uD588\uC5B4\uC694",
601
613
  searchIndicators: "\uC9C0\uD45C \uAC80\uC0C9",
602
614
  moreTools: "\uB3C4\uAD6C \uB354 \uBCF4\uAE30",
@@ -659,6 +671,15 @@ var STRINGS = {
659
671
  onIndicatorSection: "{name} \uC704\uC5D0 \uD45C\uC2DC",
660
672
  moveIndicatorUp: "\uC704\uB85C \uC62E\uAE30\uAE30",
661
673
  moveIndicatorDown: "\uC544\uB798\uB85C \uC62E\uAE30\uAE30",
674
+ moveToChart: "\uCC28\uD2B8 \uC704\uB85C \uC62E\uAE30\uAE30",
675
+ moveToPane: "\uC544\uB798 \uCE78\uC73C\uB85C \uC62E\uAE30\uAE30",
676
+ placement: "\uC704\uCE58",
677
+ placementMain: "\uCC28\uD2B8 \uC704",
678
+ placementPane: "\uC544\uB798 \uCE78",
679
+ scaleLabel: "\uB208\uAE08",
680
+ scalePrice: "\uAC00\uACA9 \uB208\uAE08",
681
+ scaleOwn: "\uC790\uAE30 \uB208\uAE08 (\uC228\uAE40)",
682
+ scaleLeft: "\uC790\uAE30 \uB208\uAE08 (\uC67C\uCABD\uC5D0 \uD45C\uC2DC)",
662
683
  textEditHint: "Enter\uB85C \uC800\uC7A5 \xB7 Shift+Enter \uC904\uBC14\uAFC8 \xB7 Esc \uCDE8\uC18C",
663
684
  hideVolume: "\uAC70\uB798\uB7C9 \uC228\uAE30\uAE30",
664
685
  volumeSettings: "\uAC70\uB798\uB7C9 \uC124\uC815",
@@ -976,7 +997,19 @@ var STRINGS = {
976
997
  replayStep: "Step forward",
977
998
  replayExit: "Exit replay",
978
999
  replaySpeed: "Speed",
979
- replayRestart: "Pick a new start",
1000
+ replayRestart: "Pick a new start bar",
1001
+ replayDate: "Select date",
1002
+ replayRandom: "Random bar",
1003
+ replayDateTitle: "Replay start date",
1004
+ replayStartHere: "Start here",
1005
+ replayPlayRange: "Play this range",
1006
+ replayRangePick: "Tap the day to start from",
1007
+ replayRangeFrom: "From {start}",
1008
+ replayRangeSpan: "{start} \u2013 {end}",
1009
+ replayRangeDays: "{n} days",
1010
+ replayUnsupported: "Replay isn't available for this chart type",
1011
+ replayShortcutPlay: "Shift+\u2193",
1012
+ replayShortcutStep: "Shift+\u2192",
980
1013
  replayDone: "Reached the end",
981
1014
  searchIndicators: "Search indicators",
982
1015
  moreTools: "More tools",
@@ -1039,6 +1072,15 @@ var STRINGS = {
1039
1072
  onIndicatorSection: "Drawn on {name}",
1040
1073
  moveIndicatorUp: "Move up",
1041
1074
  moveIndicatorDown: "Move down",
1075
+ moveToChart: "Move onto the chart",
1076
+ moveToPane: "Move to its own pane",
1077
+ placement: "Place",
1078
+ placementMain: "On the chart",
1079
+ placementPane: "Own pane",
1080
+ scaleLabel: "Scale",
1081
+ scalePrice: "Price scale",
1082
+ scaleOwn: "Own scale (hidden)",
1083
+ scaleLeft: "Own scale (on the left)",
1042
1084
  textEditHint: "Enter to save \xB7 Shift+Enter for a new line \xB7 Esc to cancel",
1043
1085
  hideVolume: "Hide volume",
1044
1086
  volumeSettings: "Volume settings",
@@ -1687,6 +1729,8 @@ var EyeIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: [
1687
1729
  ] });
1688
1730
  var EyeOffIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M3 3l14 14M8.2 5a8 8 0 0 1 1.8-.5c5 0 8 5.5 8 5.5a14 14 0 0 1-2.2 2.9M5.4 6.4A14 14 0 0 0 2 10s3 5.5 8 5.5a7.7 7.7 0 0 0 3.6-.9" }) });
1689
1731
  var ChevronUpIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M5 12l5-5 5 5" }) });
1732
+ var ToChartIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M4 16h12M10 13V4M6.5 7.5L10 4l3.5 3.5" }) });
1733
+ var ToPaneIcon = () => /* @__PURE__ */ a3(Icon, { size: 14, children: /* @__PURE__ */ a3("path", { d: "M4 16h12M10 4v9M6.5 9.5L10 13l3.5-3.5" }) });
1690
1734
  var MagnetIcon = () => /* @__PURE__ */ a3(Icon, { children: [
1691
1735
  /* @__PURE__ */ a3("path", { d: "M3 3h4.5v7a2.5 2.5 0 0 0 5 0V3H17v7a7 7 0 0 1-14 0z" }),
1692
1736
  /* @__PURE__ */ a3("path", { d: "M3 3h4.5v3.2H3zM12.5 3H17v3.2h-4.5z", fill: "currentColor" })
@@ -1702,6 +1746,12 @@ var CalendarIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
1702
1746
  /* @__PURE__ */ a3("rect", { x: "3.5", y: "4.5", width: "13", height: "12", rx: "2" }),
1703
1747
  /* @__PURE__ */ a3("path", { d: "M3.5 8.5h13M7 3v3M13 3v3" })
1704
1748
  ] });
1749
+ var DiceIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
1750
+ /* @__PURE__ */ a3("rect", { x: "3.5", y: "3.5", width: "13", height: "13", rx: "3" }),
1751
+ /* @__PURE__ */ a3("circle", { cx: "7.2", cy: "7.2", r: "1.1", fill: "currentColor", stroke: "none" }),
1752
+ /* @__PURE__ */ a3("circle", { cx: "12.8", cy: "12.8", r: "1.1", fill: "currentColor", stroke: "none" }),
1753
+ /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "1.1", fill: "currentColor", stroke: "none" })
1754
+ ] });
1705
1755
  var ClockIcon = () => /* @__PURE__ */ a3(Icon, { size: 13, children: [
1706
1756
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
1707
1757
  /* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
@@ -3013,6 +3063,522 @@ function GoToDateDialog({ ctx }) {
3013
3063
  ] }) });
3014
3064
  }
3015
3065
 
3066
+ // src/components/replay-range.ts
3067
+ var reduce = () => typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
3068
+ var S2 = (x2, k2, c3) => ({ x: x2, v: 0, t: x2, k: k2, c: reduce() ? 2 * Math.sqrt(k2) : c3 });
3069
+ var step = (s3, dt) => {
3070
+ const a4 = -s3.k * (s3.x - s3.t) - s3.c * s3.v;
3071
+ s3.v += a4 * dt;
3072
+ s3.x += s3.v * dt;
3073
+ };
3074
+ var clamp = (v3, a4, b) => Math.max(a4, Math.min(b, v3));
3075
+ var f22 = (n2) => n2.toFixed(2);
3076
+ var FADE_SPRING = [420, 32];
3077
+ var SOFT = [260, 24];
3078
+ var PUSH = [420, 41];
3079
+ var FADE = 0.19;
3080
+ var PREVIEW = 0.5;
3081
+ var CAP = 18;
3082
+ var CH = 40;
3083
+ var R = 18;
3084
+ var DAY3 = 864e5;
3085
+ function mountReplayRange(root, opts) {
3086
+ const { text } = opts;
3087
+ const TODAY = Math.floor(Date.now() / DAY3);
3088
+ const el = (tag, cls, parent = root) => {
3089
+ const e3 = parent.appendChild(document.createElement(tag));
3090
+ e3.className = cls;
3091
+ return e3;
3092
+ };
3093
+ let clock = 0;
3094
+ const out = (u3) => 1 - Math.pow(1 - u3, 3);
3095
+ const inn = (u3) => u3 * u3 * u3;
3096
+ const F3 = (v3 = 0) => ({ from: v3, to: v3, t0: -1e3 });
3097
+ const val = (f4) => {
3098
+ const u3 = reduce() ? 1 : clamp((clock - f4.t0) / FADE, 0, 1);
3099
+ return f4.from + (f4.to - f4.from) * (f4.to >= f4.from ? out(u3) : inn(u3));
3100
+ };
3101
+ const fadeTo = (f4, to) => {
3102
+ if (f4.to === to) return;
3103
+ f4.from = val(f4);
3104
+ f4.to = to;
3105
+ f4.t0 = clock;
3106
+ };
3107
+ const snap = (f4, v3) => {
3108
+ f4.from = f4.to = v3;
3109
+ f4.t0 = -1e3;
3110
+ };
3111
+ const done = (f4) => clock - f4.t0 >= FADE;
3112
+ root.style.setProperty("--fnc-rd-fade", `${FADE}s`);
3113
+ function roller(host) {
3114
+ const a5 = host.appendChild(document.createElement("span"));
3115
+ const b2 = host.appendChild(document.createElement("span"));
3116
+ const P2 = S2(0, ...FADE_SPRING);
3117
+ let cur2 = a5;
3118
+ let old = b2;
3119
+ let dir = 1;
3120
+ return {
3121
+ set(t3, d3 = 1) {
3122
+ if (cur2.textContent === t3) return;
3123
+ if (P2.x > 0.02 && cur2.textContent) {
3124
+ cur2.textContent = t3;
3125
+ return;
3126
+ }
3127
+ dir = d3;
3128
+ old.textContent = t3;
3129
+ [cur2, old] = [old, cur2];
3130
+ P2.x = 1;
3131
+ P2.v = 0;
3132
+ P2.t = 0;
3133
+ },
3134
+ put(t3) {
3135
+ cur2.textContent = t3;
3136
+ old.textContent = "";
3137
+ P2.x = P2.t = P2.v = 0;
3138
+ },
3139
+ frame: (dt) => step(P2, dt),
3140
+ render() {
3141
+ const p3 = clamp(P2.x, 0, 1);
3142
+ cur2.style.transform = `translateY(${f22(p3 * 100 * dir)}%)`;
3143
+ cur2.style.opacity = (1 - p3).toFixed(3);
3144
+ cur2.style.filter = `blur(${f22(p3 * 2)}px)`;
3145
+ cur2.style.visibility = "visible";
3146
+ old.style.transform = `translateY(${f22((p3 - 1) * 100 * dir)}%)`;
3147
+ old.style.opacity = p3.toFixed(3);
3148
+ old.style.filter = `blur(${f22((1 - p3) * 2)}px)`;
3149
+ old.style.visibility = p3 < 2e-3 ? "hidden" : "visible";
3150
+ }
3151
+ };
3152
+ }
3153
+ const head = el("div", "fnc-rd-head");
3154
+ const titleEl = el("span", "fnc-rd-title fnc-rd-roll", head);
3155
+ const nav = el("div", "fnc-rd-nav", head);
3156
+ const arrow = (label, path) => {
3157
+ const b2 = el("button", "fnc-rd-arrow", nav);
3158
+ b2.type = "button";
3159
+ b2.setAttribute("aria-label", label);
3160
+ b2.dataset.tip = label;
3161
+ b2.innerHTML = `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${path}"/></svg>`;
3162
+ return b2;
3163
+ };
3164
+ const prevYear = arrow(text.prevYear, "M12.5 6l-6 6 6 6M18.5 6l-6 6 6 6");
3165
+ const prev = arrow(text.prevMonth, "M14.5 6l-6 6 6 6");
3166
+ const next = arrow(text.nextMonth, "M9.5 6l6 6-6 6");
3167
+ const nextYear = arrow(text.nextYear, "M5.5 6l6 6-6 6M11.5 6l6 6-6 6");
3168
+ const week = el("div", "fnc-rd-week");
3169
+ for (const w3 of text.weekdays) el("span", "", week).textContent = w3;
3170
+ const view = el("div", "fnc-rd-view");
3171
+ view.setAttribute("role", "grid");
3172
+ view.setAttribute("aria-label", text.grid);
3173
+ const foot = el("div", "fnc-rd-foot");
3174
+ const sumEl = el("span", "fnc-rd-sum fnc-rd-roll", foot);
3175
+ const chip = el("span", "fnc-rd-chip", foot);
3176
+ const nightsEl = el("span", "fnc-rd-roll", chip);
3177
+ const sr = el("p", "fnc-rd-sr");
3178
+ sr.setAttribute("role", "status");
3179
+ const title = roller(titleEl);
3180
+ const sum = roller(sumEl);
3181
+ const nights = roller(nightsEl);
3182
+ const monthOf = (y3, m3) => {
3183
+ const d0 = Date.UTC(y3, m3, 1);
3184
+ const n2 = new Date(d0);
3185
+ return { y: n2.getUTCFullYear(), m: n2.getUTCMonth(), first: Math.round(d0 / DAY3), len: new Date(Date.UTC(n2.getUTCFullYear(), n2.getUTCMonth() + 1, 0)).getUTCDate(), offset: n2.getUTCDay() };
3186
+ };
3187
+ const todayDate = new Date(TODAY * DAY3);
3188
+ const atDate = new Date(Math.min(opts.at, TODAY * DAY3));
3189
+ let cur = monthOf(atDate.getUTCFullYear(), atDate.getUTCMonth());
3190
+ const rowsOf = (M) => Math.ceil((M.offset + M.len) / 7);
3191
+ let a4 = null;
3192
+ let b = null;
3193
+ let hover = null;
3194
+ let mode = "idle";
3195
+ let drag = false;
3196
+ const bands = [];
3197
+ const dots = [];
3198
+ const H2 = S2(rowsOf(cur) * CH, ...SOFT);
3199
+ const CHIP = F3(0);
3200
+ const live = [];
3201
+ let active;
3202
+ const timers = [];
3203
+ const after = (sec, fn) => timers.push({ t: sec, fn });
3204
+ const band = () => bands.find((x2) => x2.live);
3205
+ const killBand = () => {
3206
+ const x2 = band();
3207
+ if (x2) {
3208
+ x2.live = false;
3209
+ fadeTo(x2.f, 0);
3210
+ }
3211
+ };
3212
+ function setPreview(e3) {
3213
+ let x2 = band();
3214
+ if (a4 === null || e3 === null || e3 <= a4) {
3215
+ if (x2 && x2.f.to !== 1) {
3216
+ x2.live = false;
3217
+ snap(x2.f, 0);
3218
+ }
3219
+ return;
3220
+ }
3221
+ if (!x2) {
3222
+ x2 = { a: a4, b: e3, f: F3(0), live: true };
3223
+ bands.push(x2);
3224
+ }
3225
+ x2.a = a4;
3226
+ x2.b = e3;
3227
+ snap(x2.f, PREVIEW);
3228
+ }
3229
+ function commitBand() {
3230
+ if (a4 === null || b === null) return;
3231
+ let x2 = band();
3232
+ if (!x2) {
3233
+ x2 = { a: a4, b, f: F3(0), live: true };
3234
+ bands.push(x2);
3235
+ }
3236
+ x2.a = a4;
3237
+ x2.b = b;
3238
+ fadeTo(x2.f, 1);
3239
+ }
3240
+ function setDot(role, d3) {
3241
+ const m3 = dots.find((x2) => x2.role === role);
3242
+ if (m3 && m3.d === d3) {
3243
+ fadeTo(m3.f, 1);
3244
+ return;
3245
+ }
3246
+ if (m3) {
3247
+ m3.role = null;
3248
+ fadeTo(m3.f, 0);
3249
+ }
3250
+ if (d3 === null) return;
3251
+ let n2 = dots.find((x2) => x2.role === null && x2.d === d3);
3252
+ if (!n2) {
3253
+ n2 = { d: d3, f: F3(0), role };
3254
+ dots.push(n2);
3255
+ }
3256
+ n2.role = role;
3257
+ fadeTo(n2.f, 1);
3258
+ }
3259
+ function texts() {
3260
+ if (a4 === null) sum.set(text.pickStart);
3261
+ else if (b === null) sum.set(text.startOnly(text.day(a4)));
3262
+ else sum.set(text.range(text.day(a4), text.day(b)));
3263
+ if (a4 !== null && b !== null) {
3264
+ const t3 = text.days(b - a4 + 1);
3265
+ if (val(CHIP) < 0.02) nights.put(t3);
3266
+ else nights.set(t3);
3267
+ fadeTo(CHIP, 1);
3268
+ } else fadeTo(CHIP, 0);
3269
+ paint();
3270
+ opts.onChange(a4 === null ? null : a4 * DAY3, b === null ? null : b * DAY3);
3271
+ }
3272
+ function build(M) {
3273
+ const host = el("div", "fnc-rd-month", view);
3274
+ const rows = rowsOf(M);
3275
+ const bl = el("div", "fnc-rd-layer", host);
3276
+ const cells = Array.from({ length: M.len }, (_3, k2) => {
3277
+ const e3 = el("div", "fnc-rd-day", host);
3278
+ e3.textContent = String(k2 + 1);
3279
+ const d3 = M.first + k2;
3280
+ e3.setAttribute("role", "gridcell");
3281
+ e3.setAttribute("aria-label", text.day(d3));
3282
+ if (d3 > TODAY) e3.classList.add("is-future");
3283
+ if (d3 === TODAY) e3.classList.add("is-today");
3284
+ return { e: e3, d: d3, col: (M.offset + k2) % 7, row: Math.floor((M.offset + k2) / 7) };
3285
+ });
3286
+ const dl = el("div", "fnc-rd-layer", host);
3287
+ return { M, el: host, rows, bl, dl, bandEls: [], dotEls: [], cells, X: S2(0, ...PUSH), A: S2(1, ...PUSH) };
3288
+ }
3289
+ const cw = () => view.clientWidth / 7;
3290
+ const place = (o4) => {
3291
+ const w3 = cw();
3292
+ o4.cells.forEach((c3) => {
3293
+ c3.e.style.width = `${f22(w3)}px`;
3294
+ c3.e.style.transform = `translate(${f22(c3.col * w3)}px,${c3.row * CH}px)`;
3295
+ });
3296
+ };
3297
+ const track = (o4, d3) => (o4.M.offset + d3 - o4.M.first) * cw() + cw() / 2;
3298
+ function paint() {
3299
+ const x2 = band();
3300
+ const on = !!x2 && x2.f.to === 1;
3301
+ live.forEach((o4) => o4.cells.forEach((c3) => c3.e.classList.toggle("is-in", on && c3.d >= x2.a && c3.d <= x2.b)));
3302
+ }
3303
+ const canGo = (M) => M.first <= TODAY;
3304
+ function navState() {
3305
+ const nm = monthOf(cur.y, cur.m + 1);
3306
+ const ny = monthOf(cur.y + 1, cur.m);
3307
+ next.disabled = !canGo(nm);
3308
+ nextYear.disabled = !canGo(ny) && !canGo(nm);
3309
+ }
3310
+ function go(y3, m3, dir) {
3311
+ let M = monthOf(y3, m3);
3312
+ if (!canGo(M)) M = monthOf(todayDate.getUTCFullYear(), todayDate.getUTCMonth());
3313
+ if (M.first === cur.first) return;
3314
+ const old = active;
3315
+ const W2 = view.clientWidth;
3316
+ old.X.t = -dir * W2;
3317
+ old.A.t = 0;
3318
+ after(0.9, () => {
3319
+ old.el.remove();
3320
+ live.splice(live.indexOf(old), 1);
3321
+ });
3322
+ cur = M;
3323
+ active = build(M);
3324
+ live.push(active);
3325
+ place(active);
3326
+ paint();
3327
+ active.X.x = old.X.x + dir * W2;
3328
+ active.X.t = 0;
3329
+ active.X.v = old.X.v;
3330
+ active.A.x = 0.4;
3331
+ active.A.t = 1;
3332
+ active.A.v = 0;
3333
+ H2.t = rowsOf(M) * CH;
3334
+ title.set(text.month(M.y, M.m), dir);
3335
+ navState();
3336
+ }
3337
+ prev.onclick = () => go(cur.y, cur.m - 1, -1);
3338
+ next.onclick = () => go(cur.y, cur.m + 1, 1);
3339
+ prevYear.onclick = () => go(cur.y - 1, cur.m, -1);
3340
+ nextYear.onclick = () => go(cur.y + 1, cur.m, 1);
3341
+ const dayAt = (e3) => {
3342
+ const r3 = view.getBoundingClientRect();
3343
+ const w3 = cw();
3344
+ const col2 = Math.floor((e3.clientX - r3.left - active.X.x) / w3);
3345
+ const row2 = Math.floor((e3.clientY - r3.top) / CH);
3346
+ const c3 = active.cells.find((x2) => x2.col === col2 && x2.row === row2);
3347
+ return c3 && c3.d <= TODAY ? c3.d : null;
3348
+ };
3349
+ function clear() {
3350
+ killBand();
3351
+ setDot("a", null);
3352
+ setDot("b", null);
3353
+ a4 = b = hover = null;
3354
+ mode = "idle";
3355
+ drag = false;
3356
+ texts();
3357
+ }
3358
+ function commit(d3) {
3359
+ b = d3;
3360
+ hover = null;
3361
+ mode = "done";
3362
+ drag = false;
3363
+ commitBand();
3364
+ setDot("b", b);
3365
+ texts();
3366
+ if (a4 !== null) sr.textContent = text.range(text.day(a4), text.day(b));
3367
+ }
3368
+ function down(d3) {
3369
+ if (d3 === null) return;
3370
+ if (mode !== "idle" && d3 === a4) {
3371
+ clear();
3372
+ return;
3373
+ }
3374
+ if (mode === "end" && a4 !== null && d3 > a4) {
3375
+ commit(d3);
3376
+ return;
3377
+ }
3378
+ killBand();
3379
+ setDot("b", null);
3380
+ a4 = d3;
3381
+ b = null;
3382
+ hover = null;
3383
+ mode = "end";
3384
+ drag = true;
3385
+ setDot("a", a4);
3386
+ texts();
3387
+ sr.textContent = text.startOnly(text.day(a4));
3388
+ }
3389
+ function move(d3) {
3390
+ if (mode !== "end" || d3 === hover) return;
3391
+ hover = d3;
3392
+ setPreview(d3);
3393
+ }
3394
+ function up() {
3395
+ if (!drag) return;
3396
+ drag = false;
3397
+ if (mode === "end" && a4 !== null && hover !== null && hover > a4) commit(hover);
3398
+ }
3399
+ view.addEventListener("pointerdown", (e3) => {
3400
+ view.setPointerCapture(e3.pointerId);
3401
+ down(dayAt(e3));
3402
+ });
3403
+ view.addEventListener("pointermove", (e3) => {
3404
+ if (!drag && !(e3.pointerType === "mouse" && mode === "end")) return;
3405
+ move(dayAt(e3));
3406
+ });
3407
+ view.addEventListener("pointerleave", (e3) => {
3408
+ if (!drag && e3.pointerType === "mouse" && mode === "end") move(null);
3409
+ });
3410
+ view.addEventListener("pointerup", up);
3411
+ view.addEventListener("pointercancel", up);
3412
+ active = build(cur);
3413
+ live.push(active);
3414
+ title.put(text.month(cur.y, cur.m));
3415
+ navState();
3416
+ texts();
3417
+ const ro = new ResizeObserver(() => live.forEach(place));
3418
+ ro.observe(view);
3419
+ place(active);
3420
+ function frame(dt) {
3421
+ clock += dt;
3422
+ for (let i3 = timers.length - 1; i3 >= 0; i3--) if ((timers[i3].t -= dt) <= 0) timers.splice(i3, 1)[0].fn();
3423
+ step(H2, dt);
3424
+ title.frame(dt);
3425
+ sum.frame(dt);
3426
+ nights.frame(dt);
3427
+ live.forEach((o4) => {
3428
+ step(o4.X, dt);
3429
+ step(o4.A, dt);
3430
+ });
3431
+ for (let i3 = bands.length - 1; i3 >= 0; i3--) if (!bands[i3].live && done(bands[i3].f) && val(bands[i3].f) < 1e-3) bands.splice(i3, 1);
3432
+ for (let i3 = dots.length - 1; i3 >= 0; i3--) if (dots[i3].role === null && done(dots[i3].f)) dots.splice(i3, 1);
3433
+ }
3434
+ function render() {
3435
+ view.style.height = `${f22(H2.x)}px`;
3436
+ const cp = val(CHIP);
3437
+ chip.style.opacity = cp.toFixed(3);
3438
+ chip.style.transform = `scale(${f22(0.9 + 0.1 * cp)})`;
3439
+ title.render();
3440
+ sum.render();
3441
+ nights.render();
3442
+ const w3 = cw();
3443
+ const rowLen = 7 * w3;
3444
+ live.forEach((o4) => {
3445
+ o4.el.style.transform = `translateX(${f22(o4.X.x)}px)`;
3446
+ o4.el.style.opacity = clamp(o4.A.x, 0, 1).toFixed(3);
3447
+ const m0 = o4.M.offset * w3;
3448
+ const m1 = (o4.M.offset + o4.M.len) * w3;
3449
+ bands.forEach((x2, i3) => {
3450
+ const els = o4.bandEls[i3] ??= Array.from({ length: o4.rows }, () => el("span", "fnc-rd-band", o4.bl));
3451
+ const al = val(x2.f);
3452
+ const sy = 0.9 + 0.1 * clamp(al / PREVIEW, 0, 1);
3453
+ const lo0 = track(o4, x2.a) - CAP;
3454
+ const hi0 = track(o4, x2.b) + CAP;
3455
+ const lo = Math.max(lo0, m0);
3456
+ const hi = Math.min(hi0, m1);
3457
+ els.forEach((e3, r3) => {
3458
+ const r0 = r3 * rowLen;
3459
+ const l3 = Math.max(lo, r0 + 2);
3460
+ const rr = Math.min(hi, r0 + rowLen - 2);
3461
+ if (al < 2e-3 || rr - l3 < 1) {
3462
+ e3.style.opacity = "0";
3463
+ return;
3464
+ }
3465
+ e3.style.opacity = al.toFixed(3);
3466
+ e3.style.width = `${f22(rr - l3)}px`;
3467
+ e3.style.transform = `translate(${f22(l3 - r0)}px,${r3 * CH + 2}px) scaleY(${sy.toFixed(4)})`;
3468
+ const capL = l3 === lo0 ? CAP : 8;
3469
+ const capR = rr === hi0 ? CAP : 8;
3470
+ e3.style.borderRadius = `${capL}px ${capR}px ${capR}px ${capL}px`;
3471
+ });
3472
+ });
3473
+ for (let i3 = bands.length; i3 < o4.bandEls.length; i3++) o4.bandEls[i3].forEach((e3) => e3.style.opacity = "0");
3474
+ dots.forEach((x2, i3) => {
3475
+ const e3 = o4.dotEls[i3] ??= el("span", "fnc-rd-dot", o4.dl);
3476
+ e3.classList.toggle("is-today", x2.d === TODAY);
3477
+ const p3 = val(x2.f);
3478
+ const k2 = x2.d - o4.M.first;
3479
+ if (p3 < 2e-3 || k2 < 0 || k2 >= o4.M.len) {
3480
+ e3.style.visibility = "hidden";
3481
+ return;
3482
+ }
3483
+ const n2 = String(k2 + 1);
3484
+ if (e3.textContent !== n2) e3.textContent = n2;
3485
+ const x0 = track(o4, x2.d);
3486
+ const row2 = Math.floor(x0 / rowLen);
3487
+ e3.style.visibility = "visible";
3488
+ e3.style.transform = `translate(${f22(x0 - row2 * rowLen)}px,${row2 * CH + CH / 2}px)`;
3489
+ e3.style.clipPath = `circle(${f22(R * p3)}px at 50% 50%)`;
3490
+ });
3491
+ for (let i3 = dots.length; i3 < o4.dotEls.length; i3++) o4.dotEls[i3].style.visibility = "hidden";
3492
+ });
3493
+ }
3494
+ let last = performance.now();
3495
+ let raf = requestAnimationFrame(function loop(now) {
3496
+ const dt = Math.min((now - last) / 1e3, 1 / 30);
3497
+ last = now;
3498
+ for (let k2 = 0; k2 < 4; k2++) frame(dt / 4);
3499
+ render();
3500
+ raf = requestAnimationFrame(loop);
3501
+ });
3502
+ return {
3503
+ destroy() {
3504
+ cancelAnimationFrame(raf);
3505
+ ro.disconnect();
3506
+ root.textContent = "";
3507
+ }
3508
+ };
3509
+ }
3510
+
3511
+ // src/components/replay-date.tsx
3512
+ var DAY4 = 864e5;
3513
+ function ReplayDateDialog({ ctx }) {
3514
+ const s3 = useStore(ctx.store);
3515
+ const t3 = stringsOf(s3);
3516
+ const host = T2(null);
3517
+ const [range, setRange] = d2({ start: null, end: null });
3518
+ const [busy, setBusy] = d2(false);
3519
+ const close = () => ctx.store.set({ dialog: null });
3520
+ const locale = s3.locale === "en" ? "en-US" : "ko-KR";
3521
+ const text = w2(() => {
3522
+ const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
3523
+ const month = new Intl.DateTimeFormat(locale, { year: "numeric", month: "long", timeZone: "UTC" });
3524
+ const day = new Intl.DateTimeFormat(locale, { month: s3.locale === "en" ? "short" : "long", day: "numeric", timeZone: "UTC" });
3525
+ const dayYear = new Intl.DateTimeFormat(locale, { year: "numeric", month: s3.locale === "en" ? "short" : "long", day: "numeric", timeZone: "UTC" });
3526
+ const wd = new Intl.DateTimeFormat(locale, { weekday: "narrow", timeZone: "UTC" });
3527
+ const fill = (tpl, vars) => tpl.replace(/\{(\w+)\}/g, (_3, k2) => vars[k2] ?? "");
3528
+ return {
3529
+ month: (y3, m3) => month.format(Date.UTC(y3, m3, 1)),
3530
+ day: (d3) => (new Date(d3 * DAY4).getUTCFullYear() === thisYear ? day : dayYear).format(d3 * DAY4),
3531
+ // 2023-01-01 was a Sunday.
3532
+ weekdays: Array.from({ length: 7 }, (_3, i3) => wd.format(Date.UTC(2023, 0, 1 + i3))),
3533
+ pickStart: t3.replayRangePick,
3534
+ startOnly: (start2) => fill(t3.replayRangeFrom, { start: start2 }),
3535
+ range: (start2, end) => fill(t3.replayRangeSpan, { start: start2, end }),
3536
+ days: (n2) => fill(t3.replayRangeDays, { n: String(n2) }),
3537
+ prevMonth: t3.prevMonth,
3538
+ nextMonth: t3.nextMonth,
3539
+ prevYear: t3.prevYear,
3540
+ nextYear: t3.nextYear,
3541
+ grid: t3.replayDateTitle
3542
+ };
3543
+ }, [locale]);
3544
+ A2(() => {
3545
+ if (!host.current) return;
3546
+ const at = ctx.chart.getVisibleTimeRange()?.from ?? Date.now();
3547
+ const picker = mountReplayRange(host.current, { text, at, onChange: (start2, end) => setRange({ start: start2, end }) });
3548
+ return () => picker.destroy();
3549
+ }, [text]);
3550
+ const start = async () => {
3551
+ if (range.start === null || busy) return;
3552
+ setBusy(true);
3553
+ try {
3554
+ await ctx.chart.startReplayAt(range.start, range.end === null ? null : range.end + DAY4 - 1);
3555
+ close();
3556
+ } finally {
3557
+ setBusy(false);
3558
+ }
3559
+ };
3560
+ return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3(
3561
+ "div",
3562
+ {
3563
+ class: "fnc-dialog fnc-rd-dialog",
3564
+ role: "dialog",
3565
+ "aria-modal": "true",
3566
+ "aria-label": t3.replayDateTitle,
3567
+ onKeyDown: (e3) => {
3568
+ if (e3.key === "Escape") close();
3569
+ if (e3.key === "Enter") void start();
3570
+ },
3571
+ children: [
3572
+ /* @__PURE__ */ a3("div", { class: "fnc-rd", ref: host }),
3573
+ /* @__PURE__ */ a3("div", { class: "fnc-rd-actions", children: [
3574
+ /* @__PURE__ */ a3("button", { type: "button", class: "fnc-btn fnc-rd-cancel", onClick: close, children: t3.cancel }),
3575
+ /* @__PURE__ */ a3("button", { type: "button", class: "fnc-btn fnc-rd-go", disabled: range.start === null || busy, onClick: () => void start(), children: range.end === null ? t3.replayStartHere : t3.replayPlayRange })
3576
+ ] })
3577
+ ]
3578
+ }
3579
+ ) });
3580
+ }
3581
+
3016
3582
  // src/components/indicator-settings.tsx
3017
3583
  import {
3018
3584
  maLines,
@@ -3103,6 +3669,9 @@ function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
3103
3669
  const [display, setDisplay] = d2(() => ({ ...config?.display ?? {} }));
3104
3670
  const [timeframe, setTimeframe] = d2(config?.timeframe ?? "");
3105
3671
  const [waitClose, setWaitClose] = d2(config?.waitClose !== false);
3672
+ const nativeMain = !!def?.overlay;
3673
+ const [placement, setPlacement] = d2(config?.placement ?? (nativeMain ? "main" : "pane"));
3674
+ const [scale, setScale] = d2(config?.scale);
3106
3675
  const [menu, setMenu] = d2(false);
3107
3676
  const close = () => ctx.store.set({ dialog: null });
3108
3677
  if (!config || !def) return null;
@@ -3138,12 +3707,12 @@ function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
3138
3707
  const collect = () => {
3139
3708
  const params = {};
3140
3709
  for (const spec of def.params) {
3141
- const clamp = (n2) => Math.min(spec.max ?? Infinity, Math.max(spec.min ?? -Infinity, n2));
3142
- 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 }));
3710
+ const clamp2 = (n2) => Math.min(spec.max ?? Infinity, Math.max(spec.min ?? -Infinity, n2));
3711
+ if (spec.kind === "lines") params[spec.key] = lines.filter((l3) => Number(l3.period) > 0).map((l3) => ({ period: clamp2(Math.round(Number(l3.period))), source: l3.source }));
3143
3712
  else if (spec.kind === "source") params[spec.key] = values[spec.key] ?? "close";
3144
3713
  else {
3145
3714
  const n2 = Number(values[spec.key]);
3146
- if (Number.isFinite(n2)) params[spec.key] = clamp(n2);
3715
+ if (Number.isFinite(n2)) params[spec.key] = clamp2(n2);
3147
3716
  }
3148
3717
  }
3149
3718
  const kept = hasLines ? rows.filter((_3, i3) => Number(lines[i3]?.period) > 0) : rows;
@@ -3162,7 +3731,14 @@ function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
3162
3731
  const apply = (e3) => {
3163
3732
  e3.preventDefault();
3164
3733
  const c3 = collect();
3165
- ctx.chart.updateIndicator(id, { params: c3.params, styles: c3.styles, display: c3.display, timeframe: c3.timeframe, waitClose: c3.waitClose });
3734
+ ctx.chart.updateIndicator(id, {
3735
+ params: c3.params,
3736
+ styles: c3.styles,
3737
+ display: c3.display,
3738
+ timeframe: c3.timeframe,
3739
+ waitClose: c3.waitClose,
3740
+ ...onIndicator ? {} : { placement, ...scale ? { scale } : {} }
3741
+ });
3166
3742
  close();
3167
3743
  };
3168
3744
  const reset = () => {
@@ -3313,6 +3889,32 @@ function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
3313
3889
  /* @__PURE__ */ a3(ColorField, { t: t3, value: display.fillColor ?? (/^#[0-9a-f]{6}$/i.test(probe.fill?.color ?? "") ? `${probe.fill.color}26` : "#3182f626"), label: t3.color, onChange: (fillColor) => setD({ fillColor }) })
3314
3890
  ] })
3315
3891
  ] }),
3892
+ !onIndicator && /* @__PURE__ */ a3($, { children: [
3893
+ /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
3894
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.placement }),
3895
+ /* @__PURE__ */ a3("select", { class: "fnc-select fnc-select-source", value: placement, "aria-label": t3.placement, onChange: (e3) => setPlacement(e3.currentTarget.value), children: [
3896
+ /* @__PURE__ */ a3("option", { value: "main", children: t3.placementMain }),
3897
+ /* @__PURE__ */ a3("option", { value: "pane", children: t3.placementPane })
3898
+ ] })
3899
+ ] }),
3900
+ placement === "main" && /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
3901
+ /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.scaleLabel }),
3902
+ /* @__PURE__ */ a3(
3903
+ "select",
3904
+ {
3905
+ class: "fnc-select fnc-select-source",
3906
+ value: scale ?? (nativeMain ? "price" : "own"),
3907
+ "aria-label": t3.scaleLabel,
3908
+ onChange: (e3) => setScale(e3.currentTarget.value),
3909
+ children: [
3910
+ /* @__PURE__ */ a3("option", { value: "price", children: t3.scalePrice }),
3911
+ /* @__PURE__ */ a3("option", { value: "own", children: t3.scaleOwn }),
3912
+ /* @__PURE__ */ a3("option", { value: "left", children: t3.scaleLeft })
3913
+ ]
3914
+ }
3915
+ )
3916
+ ] })
3917
+ ] }),
3316
3918
  /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.outputValues }),
3317
3919
  /* @__PURE__ */ a3("div", { class: "fnc-row", children: [
3318
3920
  /* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: t3.precision }),
@@ -4209,6 +4811,40 @@ var CSS = (
4209
4811
  .fnc-cal-day.is-on { background: var(--fnc-accent); color: #fff; font-weight: 700; }
4210
4812
  .fnc-cal-day:disabled { opacity: 0.3; cursor: default; }
4211
4813
  .fnc-goto-actions { display: flex; gap: 8px; }
4814
+ /* \uB9AC\uD50C\uB808\uC774 \uB0A0\uC9DC (replay-range.ts): designbookmark's date range in the chart's own colors and radius. */
4815
+ .fnc-rd-dialog { width: min(340px, calc(100% - 32px)); padding: 16px 14px 14px; }
4816
+ /* A card on phones too (other dialogs fill the screen there): it's small, and the chart stays behind it. */
4817
+ .fnc-root .fnc-dialog.fnc-rd-dialog { align-self: center; height: auto; max-height: none; width: min(360px, calc(100% - 24px)); border-radius: 16px; }
4818
+ .fnc-rd { position: relative; user-select: none; -webkit-user-select: none; }
4819
+ .fnc-rd-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 2px 0 6px; }
4820
+ .fnc-rd-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--fnc-text); }
4821
+ .fnc-rd-nav { display: flex; gap: 4px; }
4822
+ .fnc-rd-arrow { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--fnc-surface); color: var(--fnc-text); display: grid; place-items: center; cursor: pointer; transition: background-color .15s, opacity .2s; }
4823
+ .fnc-rd-arrow:hover:not(:disabled) { background: color-mix(in srgb, var(--fnc-text) 12%, transparent); }
4824
+ .fnc-rd-arrow:disabled { opacity: .3; cursor: default; }
4825
+ .fnc-rd-arrow svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
4826
+ .fnc-rd-arrow:focus-visible { outline: 2px solid var(--fnc-text-2); outline-offset: 2px; }
4827
+ .fnc-rd-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 12px; height: 20px; font-size: 11.5px; font-weight: 500; color: var(--fnc-text-2); text-align: center; }
4828
+ .fnc-rd-view { position: relative; margin-top: 4px; overflow: hidden; touch-action: none; will-change: height; }
4829
+ .fnc-rd-month { position: absolute; left: 0; top: 0; width: 100%; will-change: transform, opacity; }
4830
+ .fnc-rd-layer { position: absolute; inset: 0; pointer-events: none; }
4831
+ .fnc-rd-band { position: absolute; left: 0; top: 0; height: 36px; background: color-mix(in srgb, var(--fnc-accent) 16%, transparent); opacity: 0; will-change: transform, width, opacity; }
4832
+ .fnc-rd-dot { position: absolute; left: 0; top: 0; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: var(--fnc-accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; visibility: hidden; will-change: transform, clip-path; }
4833
+ .fnc-rd-dot.is-today::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #fff; }
4834
+ .fnc-rd-day { position: absolute; left: 0; top: 0; height: 40px; display: grid; place-items: center; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--fnc-text-2); font-variant-numeric: tabular-nums; will-change: transform; transition: color var(--fnc-rd-fade, .19s) cubic-bezier(.55, .055, .675, .19); }
4835
+ .fnc-rd-day.is-in { color: var(--fnc-text); transition-timing-function: cubic-bezier(.215, .61, .355, 1); }
4836
+ .fnc-rd-day.is-future { opacity: .35; cursor: default; }
4837
+ .fnc-rd-day.is-today::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--fnc-text-2); }
4838
+ .fnc-rd-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; height: 32px; padding: 0 2px 0 6px; }
4839
+ .fnc-rd-sum { min-width: 0; font-size: 13px; font-weight: 500; color: var(--fnc-text-2); }
4840
+ .fnc-rd-chip { flex: none; height: 26px; padding: 0 11px; border-radius: 999px; background: color-mix(in srgb, var(--fnc-accent) 14%, transparent); color: var(--fnc-accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; opacity: 0; will-change: transform, opacity; }
4841
+ .fnc-rd-roll { display: inline-grid; overflow: hidden; }
4842
+ .fnc-rd-roll span { grid-area: 1 / 1; white-space: nowrap; will-change: transform, opacity, filter; }
4843
+ .fnc-rd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
4844
+ .fnc-rd-actions { display: flex; gap: 8px; margin-top: 12px; }
4845
+ .fnc-rd-dialog .fnc-rd-cancel { flex: none; width: auto; white-space: nowrap; height: 38px; padding: 0 16px; border-radius: var(--fnc-radius); background: var(--fnc-surface); font-weight: 600; }
4846
+ .fnc-rd-dialog .fnc-rd-go { flex: 1; width: auto; height: 38px; border-radius: var(--fnc-radius); background: var(--fnc-accent); color: #fff; font-weight: 700; }
4847
+ .fnc-rd-dialog .fnc-rd-go:disabled { opacity: .4; cursor: default; }
4212
4848
  .fnc-goto-dialog .fnc-goto-today { flex: none; width: auto; white-space: nowrap; height: 36px; padding: 0 16px; border-radius: var(--fnc-radius); background: var(--fnc-surface); font-weight: 600; }
4213
4849
  .fnc-goto-dialog .fnc-goto-go { flex: 1; height: 36px; }
4214
4850
 
@@ -4698,6 +5334,8 @@ var CSS = (
4698
5334
  .fnc-tools-icon svg { width: 100%; height: 100%; }
4699
5335
  .fnc-tools-item svg { flex: none; color: var(--fnc-text-2); }
4700
5336
  .fnc-tools-item[aria-pressed='true'] { background: var(--fnc-surface); color: var(--fnc-text); }
5337
+ /* Why an item is off (\uB9AC\uD50C\uB808\uC774 on a renko chart\u2026). */
5338
+ .fnc-tools-note { margin: -2px 12px 4px 40px; font-size: 11.5px; line-height: 1.4; color: var(--fnc-text-2); white-space: normal; }
4701
5339
 
4702
5340
  /* \u2500\u2500 Drawing tool groups \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
4703
5341
  .fnc-tool-group { position: relative; display: flex; }
@@ -4937,6 +5575,8 @@ var CSS = (
4937
5575
  .fnc-replay-hint { gap: 8px; padding: 4px 4px 4px 12px; font-size: 13px; color: var(--fnc-text); }
4938
5576
  .fnc-replay-hint svg { color: var(--fnc-text-2); }
4939
5577
  .fnc-replay-note { padding: 0 6px; font-size: 12px; color: var(--fnc-text-2); }
5578
+ /* \uB0A0\uC9DC \uC120\uD0DD \xB7 \uBB34\uC791\uC704 \uBD09 while picking the start: an icon and a word. */
5579
+ .fnc-replay .fnc-btn.fnc-replay-word { width: auto; gap: 5px; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--fnc-text); }
4940
5580
 
4941
5581
  /* Indicator picker search (shown when custom indicators make the list long) */
4942
5582
  .fnc-ind-search { height: 48px; padding: 0 16px; }
@@ -6148,7 +6788,7 @@ function Dialogs({ ctx }) {
6148
6788
  if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id, Dialog }, dialog.id);
6149
6789
  if (dialog?.kind === "chartSettings") return /* @__PURE__ */ a3(SettingsDialog, { ctx });
6150
6790
  if (dialog?.kind === "volumeSettings") return /* @__PURE__ */ a3(VolumeSettings, { ctx, Dialog });
6151
- if (dialog?.kind === "goToDate") return /* @__PURE__ */ a3(GoToDateDialog, { ctx });
6791
+ if (dialog?.kind === "goToDate") return dialog.replay ? /* @__PURE__ */ a3(ReplayDateDialog, { ctx }) : /* @__PURE__ */ a3(GoToDateDialog, { ctx });
6152
6792
  return null;
6153
6793
  }
6154
6794
 
@@ -6889,8 +7529,10 @@ function ToolsMenu({ ctx }) {
6889
7529
  s3.replay.active ? t3.replayExit : t3.replay,
6890
7530
  /* @__PURE__ */ a3(ReplayIcon, {}),
6891
7531
  () => s3.replay.active ? ctx.chart.stopReplay() : ctx.chart.setReplaySelecting(true),
6892
- { pressed: s3.replay.active || s3.replay.selecting }
7532
+ // Renko · Kagi · P&F · line break · 볼륨 풋프린트 don't replay (as TradingView's).
7533
+ { pressed: s3.replay.active || s3.replay.selecting, disabled: !s3.replay.active && !s3.replay.supported }
6893
7534
  ),
7535
+ !s3.replay.active && !s3.replay.supported && /* @__PURE__ */ a3("p", { class: "fnc-tools-note", children: t3.replayUnsupported }),
6894
7536
  item("fnc-btn-screenshot", t3.screenshot, /* @__PURE__ */ a3(CameraIcon, {}), ctx.screenshot),
6895
7537
  /* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
6896
7538
  (ctx.toolsMenuItems?.(ctx.chart) ?? []).map(
@@ -7022,6 +7664,11 @@ var GLYPHS = {
7022
7664
  clock: /* @__PURE__ */ a3($, { children: [
7023
7665
  /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
7024
7666
  /* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
7667
+ ] }),
7668
+ // Two sheets, one over the other (가격 복사).
7669
+ copy: /* @__PURE__ */ a3($, { children: [
7670
+ /* @__PURE__ */ a3("rect", { x: "7", y: "7", width: "9.5", height: "9.5", rx: "1.8" }),
7671
+ /* @__PURE__ */ a3("path", { d: "M13 7V5.3A1.8 1.8 0 0 0 11.2 3.5H5.3A1.8 1.8 0 0 0 3.5 5.3v5.9A1.8 1.8 0 0 0 5.3 13H7" })
7025
7672
  ] })
7026
7673
  };
7027
7674
  function MenuIcon({ name }) {
@@ -7230,6 +7877,19 @@ function IndicatorItem({ ctx, item, values = true }) {
7230
7877
  e3.stopPropagation();
7231
7878
  ctx.chart.moveIndicator(item.id, 1);
7232
7879
  }, children: /* @__PURE__ */ a3(ChevronDownIcon, {}) }),
7880
+ !item.parent && /* @__PURE__ */ a3(
7881
+ "button",
7882
+ {
7883
+ class: "fnc-ind-btn",
7884
+ "data-tip": item.placement === "main" ? t3.moveToPane : t3.moveToChart,
7885
+ "aria-label": `${item.title} ${item.placement === "main" ? t3.moveToPane : t3.moveToChart}`,
7886
+ onClick: (e3) => {
7887
+ e3.stopPropagation();
7888
+ ctx.chart.setIndicatorPlacement(item.id, item.placement === "main" ? "pane" : "main");
7889
+ },
7890
+ children: item.placement === "main" ? /* @__PURE__ */ a3(ToPaneIcon, {}) : /* @__PURE__ */ a3(ToChartIcon, {})
7891
+ }
7892
+ ),
7233
7893
  item.hostable && ctx.chart.indicatorsOnIndicator().length > 0 && /* @__PURE__ */ a3(
7234
7894
  "button",
7235
7895
  {
@@ -7578,18 +8238,28 @@ function ReplayBar({ ctx }) {
7578
8238
  const { plotWidth, panesHeight } = s3.layout;
7579
8239
  if (plotWidth <= 0 || !r3.active && !r3.selecting) return null;
7580
8240
  const style = { left: `${plotWidth / 2}px`, top: `${panesHeight - CONTROL_OFFSET}px` };
8241
+ const pickDate = () => ctx.store.set({ dialog: { kind: "goToDate", replay: true } });
8242
+ const pickRandom = () => void ctx.chart.startReplayRandom();
7581
8243
  if (!r3.active) {
7582
8244
  return /* @__PURE__ */ a3("div", { class: "fnc-replay fnc-replay-hint", style, role: "status", children: [
7583
8245
  /* @__PURE__ */ a3(ReplayIcon, {}),
7584
8246
  /* @__PURE__ */ a3("span", { children: t3.replayPick }),
8247
+ /* @__PURE__ */ a3("button", { class: "fnc-btn fnc-replay-word", "data-tip": t3.replayDate, onClick: pickDate, children: [
8248
+ /* @__PURE__ */ a3(CalendarIcon, {}),
8249
+ /* @__PURE__ */ a3("span", { children: t3.replayDate })
8250
+ ] }),
8251
+ /* @__PURE__ */ a3("button", { class: "fnc-btn fnc-replay-word", "data-tip": t3.replayRandom, onClick: pickRandom, children: [
8252
+ /* @__PURE__ */ a3(DiceIcon, {}),
8253
+ /* @__PURE__ */ a3("span", { children: t3.replayRandom })
8254
+ ] }),
7585
8255
  /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "aria-label": t3.cancel, "data-tip": `${t3.cancel} (Esc)`, onClick: () => ctx.chart.setReplaySelecting(false), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
7586
8256
  ] });
7587
8257
  }
7588
8258
  const done = r3.remaining === 0;
7589
- const button = (label, onClick, icon, disabled = false) => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": label, "aria-label": label, disabled, onClick, children: icon });
8259
+ const button = (label, onClick, icon, disabled = false, shortcut = "") => /* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": shortcut ? `${label} (${shortcut})` : label, "aria-label": label, disabled, onClick, children: icon });
7590
8260
  return /* @__PURE__ */ a3("div", { class: "fnc-replay", style, role: "toolbar", "aria-label": t3.replay, children: [
7591
- r3.playing ? button(t3.replayPause, () => ctx.chart.replayPause(), /* @__PURE__ */ a3(PauseIcon, {})) : button(t3.replayPlay, () => ctx.chart.replayPlay(), /* @__PURE__ */ a3(PlayIcon, {}), done),
7592
- button(t3.replayStep, () => ctx.chart.replayStep(), /* @__PURE__ */ a3(StepIcon, {}), done),
8261
+ r3.playing ? button(t3.replayPause, () => ctx.chart.replayPause(), /* @__PURE__ */ a3(PauseIcon, {}), false, t3.replayShortcutPlay) : button(t3.replayPlay, () => ctx.chart.replayPlay(), /* @__PURE__ */ a3(PlayIcon, {}), done, t3.replayShortcutPlay),
8262
+ button(t3.replayStep, () => ctx.chart.replayStep(), /* @__PURE__ */ a3(StepIcon, {}), done, t3.replayShortcutStep),
7593
8263
  /* @__PURE__ */ a3("div", { class: "fnc-seg fnc-seg-sm", role: "radiogroup", "aria-label": t3.replaySpeed, children: REPLAY_SPEEDS.map((speed) => /* @__PURE__ */ a3(
7594
8264
  "button",
7595
8265
  {
@@ -7603,6 +8273,8 @@ function ReplayBar({ ctx }) {
7603
8273
  done && /* @__PURE__ */ a3("span", { class: "fnc-replay-note", children: t3.replayDone }),
7604
8274
  /* @__PURE__ */ a3("div", { class: "fnc-sep" }),
7605
8275
  button(t3.replayRestart, () => ctx.chart.setReplaySelecting(true), /* @__PURE__ */ a3(ReplayIcon, {})),
8276
+ button(t3.replayDate, pickDate, /* @__PURE__ */ a3(CalendarIcon, {})),
8277
+ button(t3.replayRandom, pickRandom, /* @__PURE__ */ a3(DiceIcon, {})),
7606
8278
  button(t3.replayExit, () => ctx.chart.stopReplay(), /* @__PURE__ */ a3(SmallCloseIcon, {}))
7607
8279
  ] });
7608
8280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.48",
3
+ "version": "0.11.50",
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.11.48"
45
+ "@funnest/charts": "0.11.50"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"