@funnest/charts-ui 0.11.48 → 0.11.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/replay-date.d.ts +8 -0
- package/dist/components/replay-range.d.ts +42 -0
- package/dist/context.d.ts +2 -1
- package/dist/i18n.d.ts +24 -0
- package/dist/icons.d.ts +2 -0
- package/dist/index.js +613 -10
- package/package.json +2 -2
|
@@ -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;
|
|
@@ -540,6 +552,18 @@ export declare const STRINGS: {
|
|
|
540
552
|
replayExit: string;
|
|
541
553
|
replaySpeed: string;
|
|
542
554
|
replayRestart: string;
|
|
555
|
+
replayDate: string;
|
|
556
|
+
replayRandom: string;
|
|
557
|
+
replayDateTitle: string;
|
|
558
|
+
replayStartHere: string;
|
|
559
|
+
replayPlayRange: string;
|
|
560
|
+
replayRangePick: string;
|
|
561
|
+
replayRangeFrom: string;
|
|
562
|
+
replayRangeSpan: string;
|
|
563
|
+
replayRangeDays: string;
|
|
564
|
+
replayUnsupported: string;
|
|
565
|
+
replayShortcutPlay: string;
|
|
566
|
+
replayShortcutStep: string;
|
|
543
567
|
replayDone: string;
|
|
544
568
|
searchIndicators: string;
|
|
545
569
|
moreTools: string;
|
package/dist/icons.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export declare const StarIcon: ({ filled }: {
|
|
|
53
53
|
filled?: boolean;
|
|
54
54
|
}) => import("preact").JSX.Element;
|
|
55
55
|
export declare const CalendarIcon: () => import("preact").JSX.Element;
|
|
56
|
+
/** 무작위 봉 (리플레이): a die. */
|
|
57
|
+
export declare const DiceIcon: () => import("preact").JSX.Element;
|
|
56
58
|
export declare const ClockIcon: () => import("preact").JSX.Element;
|
|
57
59
|
export declare const WifiIcon: ({ bars }: {
|
|
58
60
|
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 \
|
|
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",
|
|
@@ -976,7 +988,19 @@ var STRINGS = {
|
|
|
976
988
|
replayStep: "Step forward",
|
|
977
989
|
replayExit: "Exit replay",
|
|
978
990
|
replaySpeed: "Speed",
|
|
979
|
-
replayRestart: "Pick a new start",
|
|
991
|
+
replayRestart: "Pick a new start bar",
|
|
992
|
+
replayDate: "Select date",
|
|
993
|
+
replayRandom: "Random bar",
|
|
994
|
+
replayDateTitle: "Replay start date",
|
|
995
|
+
replayStartHere: "Start here",
|
|
996
|
+
replayPlayRange: "Play this range",
|
|
997
|
+
replayRangePick: "Tap the day to start from",
|
|
998
|
+
replayRangeFrom: "From {start}",
|
|
999
|
+
replayRangeSpan: "{start} \u2013 {end}",
|
|
1000
|
+
replayRangeDays: "{n} days",
|
|
1001
|
+
replayUnsupported: "Replay isn't available for this chart type",
|
|
1002
|
+
replayShortcutPlay: "Shift+\u2193",
|
|
1003
|
+
replayShortcutStep: "Shift+\u2192",
|
|
980
1004
|
replayDone: "Reached the end",
|
|
981
1005
|
searchIndicators: "Search indicators",
|
|
982
1006
|
moreTools: "More tools",
|
|
@@ -1702,6 +1726,12 @@ var CalendarIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
|
|
|
1702
1726
|
/* @__PURE__ */ a3("rect", { x: "3.5", y: "4.5", width: "13", height: "12", rx: "2" }),
|
|
1703
1727
|
/* @__PURE__ */ a3("path", { d: "M3.5 8.5h13M7 3v3M13 3v3" })
|
|
1704
1728
|
] });
|
|
1729
|
+
var DiceIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
|
|
1730
|
+
/* @__PURE__ */ a3("rect", { x: "3.5", y: "3.5", width: "13", height: "13", rx: "3" }),
|
|
1731
|
+
/* @__PURE__ */ a3("circle", { cx: "7.2", cy: "7.2", r: "1.1", fill: "currentColor", stroke: "none" }),
|
|
1732
|
+
/* @__PURE__ */ a3("circle", { cx: "12.8", cy: "12.8", r: "1.1", fill: "currentColor", stroke: "none" }),
|
|
1733
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "1.1", fill: "currentColor", stroke: "none" })
|
|
1734
|
+
] });
|
|
1705
1735
|
var ClockIcon = () => /* @__PURE__ */ a3(Icon, { size: 13, children: [
|
|
1706
1736
|
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
|
|
1707
1737
|
/* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
|
|
@@ -3013,6 +3043,522 @@ function GoToDateDialog({ ctx }) {
|
|
|
3013
3043
|
] }) });
|
|
3014
3044
|
}
|
|
3015
3045
|
|
|
3046
|
+
// src/components/replay-range.ts
|
|
3047
|
+
var reduce = () => typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3048
|
+
var S2 = (x2, k2, c3) => ({ x: x2, v: 0, t: x2, k: k2, c: reduce() ? 2 * Math.sqrt(k2) : c3 });
|
|
3049
|
+
var step = (s3, dt) => {
|
|
3050
|
+
const a4 = -s3.k * (s3.x - s3.t) - s3.c * s3.v;
|
|
3051
|
+
s3.v += a4 * dt;
|
|
3052
|
+
s3.x += s3.v * dt;
|
|
3053
|
+
};
|
|
3054
|
+
var clamp = (v3, a4, b) => Math.max(a4, Math.min(b, v3));
|
|
3055
|
+
var f22 = (n2) => n2.toFixed(2);
|
|
3056
|
+
var FADE_SPRING = [420, 32];
|
|
3057
|
+
var SOFT = [260, 24];
|
|
3058
|
+
var PUSH = [420, 41];
|
|
3059
|
+
var FADE = 0.19;
|
|
3060
|
+
var PREVIEW = 0.5;
|
|
3061
|
+
var CAP = 18;
|
|
3062
|
+
var CH = 40;
|
|
3063
|
+
var R = 18;
|
|
3064
|
+
var DAY3 = 864e5;
|
|
3065
|
+
function mountReplayRange(root, opts) {
|
|
3066
|
+
const { text } = opts;
|
|
3067
|
+
const TODAY = Math.floor(Date.now() / DAY3);
|
|
3068
|
+
const el = (tag, cls, parent = root) => {
|
|
3069
|
+
const e3 = parent.appendChild(document.createElement(tag));
|
|
3070
|
+
e3.className = cls;
|
|
3071
|
+
return e3;
|
|
3072
|
+
};
|
|
3073
|
+
let clock = 0;
|
|
3074
|
+
const out = (u3) => 1 - Math.pow(1 - u3, 3);
|
|
3075
|
+
const inn = (u3) => u3 * u3 * u3;
|
|
3076
|
+
const F3 = (v3 = 0) => ({ from: v3, to: v3, t0: -1e3 });
|
|
3077
|
+
const val = (f4) => {
|
|
3078
|
+
const u3 = reduce() ? 1 : clamp((clock - f4.t0) / FADE, 0, 1);
|
|
3079
|
+
return f4.from + (f4.to - f4.from) * (f4.to >= f4.from ? out(u3) : inn(u3));
|
|
3080
|
+
};
|
|
3081
|
+
const fadeTo = (f4, to) => {
|
|
3082
|
+
if (f4.to === to) return;
|
|
3083
|
+
f4.from = val(f4);
|
|
3084
|
+
f4.to = to;
|
|
3085
|
+
f4.t0 = clock;
|
|
3086
|
+
};
|
|
3087
|
+
const snap = (f4, v3) => {
|
|
3088
|
+
f4.from = f4.to = v3;
|
|
3089
|
+
f4.t0 = -1e3;
|
|
3090
|
+
};
|
|
3091
|
+
const done = (f4) => clock - f4.t0 >= FADE;
|
|
3092
|
+
root.style.setProperty("--fnc-rd-fade", `${FADE}s`);
|
|
3093
|
+
function roller(host) {
|
|
3094
|
+
const a5 = host.appendChild(document.createElement("span"));
|
|
3095
|
+
const b2 = host.appendChild(document.createElement("span"));
|
|
3096
|
+
const P2 = S2(0, ...FADE_SPRING);
|
|
3097
|
+
let cur2 = a5;
|
|
3098
|
+
let old = b2;
|
|
3099
|
+
let dir = 1;
|
|
3100
|
+
return {
|
|
3101
|
+
set(t3, d3 = 1) {
|
|
3102
|
+
if (cur2.textContent === t3) return;
|
|
3103
|
+
if (P2.x > 0.02 && cur2.textContent) {
|
|
3104
|
+
cur2.textContent = t3;
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
3107
|
+
dir = d3;
|
|
3108
|
+
old.textContent = t3;
|
|
3109
|
+
[cur2, old] = [old, cur2];
|
|
3110
|
+
P2.x = 1;
|
|
3111
|
+
P2.v = 0;
|
|
3112
|
+
P2.t = 0;
|
|
3113
|
+
},
|
|
3114
|
+
put(t3) {
|
|
3115
|
+
cur2.textContent = t3;
|
|
3116
|
+
old.textContent = "";
|
|
3117
|
+
P2.x = P2.t = P2.v = 0;
|
|
3118
|
+
},
|
|
3119
|
+
frame: (dt) => step(P2, dt),
|
|
3120
|
+
render() {
|
|
3121
|
+
const p3 = clamp(P2.x, 0, 1);
|
|
3122
|
+
cur2.style.transform = `translateY(${f22(p3 * 100 * dir)}%)`;
|
|
3123
|
+
cur2.style.opacity = (1 - p3).toFixed(3);
|
|
3124
|
+
cur2.style.filter = `blur(${f22(p3 * 2)}px)`;
|
|
3125
|
+
cur2.style.visibility = "visible";
|
|
3126
|
+
old.style.transform = `translateY(${f22((p3 - 1) * 100 * dir)}%)`;
|
|
3127
|
+
old.style.opacity = p3.toFixed(3);
|
|
3128
|
+
old.style.filter = `blur(${f22((1 - p3) * 2)}px)`;
|
|
3129
|
+
old.style.visibility = p3 < 2e-3 ? "hidden" : "visible";
|
|
3130
|
+
}
|
|
3131
|
+
};
|
|
3132
|
+
}
|
|
3133
|
+
const head = el("div", "fnc-rd-head");
|
|
3134
|
+
const titleEl = el("span", "fnc-rd-title fnc-rd-roll", head);
|
|
3135
|
+
const nav = el("div", "fnc-rd-nav", head);
|
|
3136
|
+
const arrow = (label, path) => {
|
|
3137
|
+
const b2 = el("button", "fnc-rd-arrow", nav);
|
|
3138
|
+
b2.type = "button";
|
|
3139
|
+
b2.setAttribute("aria-label", label);
|
|
3140
|
+
b2.dataset.tip = label;
|
|
3141
|
+
b2.innerHTML = `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${path}"/></svg>`;
|
|
3142
|
+
return b2;
|
|
3143
|
+
};
|
|
3144
|
+
const prevYear = arrow(text.prevYear, "M12.5 6l-6 6 6 6M18.5 6l-6 6 6 6");
|
|
3145
|
+
const prev = arrow(text.prevMonth, "M14.5 6l-6 6 6 6");
|
|
3146
|
+
const next = arrow(text.nextMonth, "M9.5 6l6 6-6 6");
|
|
3147
|
+
const nextYear = arrow(text.nextYear, "M5.5 6l6 6-6 6M11.5 6l6 6-6 6");
|
|
3148
|
+
const week = el("div", "fnc-rd-week");
|
|
3149
|
+
for (const w3 of text.weekdays) el("span", "", week).textContent = w3;
|
|
3150
|
+
const view = el("div", "fnc-rd-view");
|
|
3151
|
+
view.setAttribute("role", "grid");
|
|
3152
|
+
view.setAttribute("aria-label", text.grid);
|
|
3153
|
+
const foot = el("div", "fnc-rd-foot");
|
|
3154
|
+
const sumEl = el("span", "fnc-rd-sum fnc-rd-roll", foot);
|
|
3155
|
+
const chip = el("span", "fnc-rd-chip", foot);
|
|
3156
|
+
const nightsEl = el("span", "fnc-rd-roll", chip);
|
|
3157
|
+
const sr = el("p", "fnc-rd-sr");
|
|
3158
|
+
sr.setAttribute("role", "status");
|
|
3159
|
+
const title = roller(titleEl);
|
|
3160
|
+
const sum = roller(sumEl);
|
|
3161
|
+
const nights = roller(nightsEl);
|
|
3162
|
+
const monthOf = (y3, m3) => {
|
|
3163
|
+
const d0 = Date.UTC(y3, m3, 1);
|
|
3164
|
+
const n2 = new Date(d0);
|
|
3165
|
+
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() };
|
|
3166
|
+
};
|
|
3167
|
+
const todayDate = new Date(TODAY * DAY3);
|
|
3168
|
+
const atDate = new Date(Math.min(opts.at, TODAY * DAY3));
|
|
3169
|
+
let cur = monthOf(atDate.getUTCFullYear(), atDate.getUTCMonth());
|
|
3170
|
+
const rowsOf = (M) => Math.ceil((M.offset + M.len) / 7);
|
|
3171
|
+
let a4 = null;
|
|
3172
|
+
let b = null;
|
|
3173
|
+
let hover = null;
|
|
3174
|
+
let mode = "idle";
|
|
3175
|
+
let drag = false;
|
|
3176
|
+
const bands = [];
|
|
3177
|
+
const dots = [];
|
|
3178
|
+
const H2 = S2(rowsOf(cur) * CH, ...SOFT);
|
|
3179
|
+
const CHIP = F3(0);
|
|
3180
|
+
const live = [];
|
|
3181
|
+
let active;
|
|
3182
|
+
const timers = [];
|
|
3183
|
+
const after = (sec, fn) => timers.push({ t: sec, fn });
|
|
3184
|
+
const band = () => bands.find((x2) => x2.live);
|
|
3185
|
+
const killBand = () => {
|
|
3186
|
+
const x2 = band();
|
|
3187
|
+
if (x2) {
|
|
3188
|
+
x2.live = false;
|
|
3189
|
+
fadeTo(x2.f, 0);
|
|
3190
|
+
}
|
|
3191
|
+
};
|
|
3192
|
+
function setPreview(e3) {
|
|
3193
|
+
let x2 = band();
|
|
3194
|
+
if (a4 === null || e3 === null || e3 <= a4) {
|
|
3195
|
+
if (x2 && x2.f.to !== 1) {
|
|
3196
|
+
x2.live = false;
|
|
3197
|
+
snap(x2.f, 0);
|
|
3198
|
+
}
|
|
3199
|
+
return;
|
|
3200
|
+
}
|
|
3201
|
+
if (!x2) {
|
|
3202
|
+
x2 = { a: a4, b: e3, f: F3(0), live: true };
|
|
3203
|
+
bands.push(x2);
|
|
3204
|
+
}
|
|
3205
|
+
x2.a = a4;
|
|
3206
|
+
x2.b = e3;
|
|
3207
|
+
snap(x2.f, PREVIEW);
|
|
3208
|
+
}
|
|
3209
|
+
function commitBand() {
|
|
3210
|
+
if (a4 === null || b === null) return;
|
|
3211
|
+
let x2 = band();
|
|
3212
|
+
if (!x2) {
|
|
3213
|
+
x2 = { a: a4, b, f: F3(0), live: true };
|
|
3214
|
+
bands.push(x2);
|
|
3215
|
+
}
|
|
3216
|
+
x2.a = a4;
|
|
3217
|
+
x2.b = b;
|
|
3218
|
+
fadeTo(x2.f, 1);
|
|
3219
|
+
}
|
|
3220
|
+
function setDot(role, d3) {
|
|
3221
|
+
const m3 = dots.find((x2) => x2.role === role);
|
|
3222
|
+
if (m3 && m3.d === d3) {
|
|
3223
|
+
fadeTo(m3.f, 1);
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
if (m3) {
|
|
3227
|
+
m3.role = null;
|
|
3228
|
+
fadeTo(m3.f, 0);
|
|
3229
|
+
}
|
|
3230
|
+
if (d3 === null) return;
|
|
3231
|
+
let n2 = dots.find((x2) => x2.role === null && x2.d === d3);
|
|
3232
|
+
if (!n2) {
|
|
3233
|
+
n2 = { d: d3, f: F3(0), role };
|
|
3234
|
+
dots.push(n2);
|
|
3235
|
+
}
|
|
3236
|
+
n2.role = role;
|
|
3237
|
+
fadeTo(n2.f, 1);
|
|
3238
|
+
}
|
|
3239
|
+
function texts() {
|
|
3240
|
+
if (a4 === null) sum.set(text.pickStart);
|
|
3241
|
+
else if (b === null) sum.set(text.startOnly(text.day(a4)));
|
|
3242
|
+
else sum.set(text.range(text.day(a4), text.day(b)));
|
|
3243
|
+
if (a4 !== null && b !== null) {
|
|
3244
|
+
const t3 = text.days(b - a4 + 1);
|
|
3245
|
+
if (val(CHIP) < 0.02) nights.put(t3);
|
|
3246
|
+
else nights.set(t3);
|
|
3247
|
+
fadeTo(CHIP, 1);
|
|
3248
|
+
} else fadeTo(CHIP, 0);
|
|
3249
|
+
paint();
|
|
3250
|
+
opts.onChange(a4 === null ? null : a4 * DAY3, b === null ? null : b * DAY3);
|
|
3251
|
+
}
|
|
3252
|
+
function build(M) {
|
|
3253
|
+
const host = el("div", "fnc-rd-month", view);
|
|
3254
|
+
const rows = rowsOf(M);
|
|
3255
|
+
const bl = el("div", "fnc-rd-layer", host);
|
|
3256
|
+
const cells = Array.from({ length: M.len }, (_3, k2) => {
|
|
3257
|
+
const e3 = el("div", "fnc-rd-day", host);
|
|
3258
|
+
e3.textContent = String(k2 + 1);
|
|
3259
|
+
const d3 = M.first + k2;
|
|
3260
|
+
e3.setAttribute("role", "gridcell");
|
|
3261
|
+
e3.setAttribute("aria-label", text.day(d3));
|
|
3262
|
+
if (d3 > TODAY) e3.classList.add("is-future");
|
|
3263
|
+
if (d3 === TODAY) e3.classList.add("is-today");
|
|
3264
|
+
return { e: e3, d: d3, col: (M.offset + k2) % 7, row: Math.floor((M.offset + k2) / 7) };
|
|
3265
|
+
});
|
|
3266
|
+
const dl = el("div", "fnc-rd-layer", host);
|
|
3267
|
+
return { M, el: host, rows, bl, dl, bandEls: [], dotEls: [], cells, X: S2(0, ...PUSH), A: S2(1, ...PUSH) };
|
|
3268
|
+
}
|
|
3269
|
+
const cw = () => view.clientWidth / 7;
|
|
3270
|
+
const place = (o4) => {
|
|
3271
|
+
const w3 = cw();
|
|
3272
|
+
o4.cells.forEach((c3) => {
|
|
3273
|
+
c3.e.style.width = `${f22(w3)}px`;
|
|
3274
|
+
c3.e.style.transform = `translate(${f22(c3.col * w3)}px,${c3.row * CH}px)`;
|
|
3275
|
+
});
|
|
3276
|
+
};
|
|
3277
|
+
const track = (o4, d3) => (o4.M.offset + d3 - o4.M.first) * cw() + cw() / 2;
|
|
3278
|
+
function paint() {
|
|
3279
|
+
const x2 = band();
|
|
3280
|
+
const on = !!x2 && x2.f.to === 1;
|
|
3281
|
+
live.forEach((o4) => o4.cells.forEach((c3) => c3.e.classList.toggle("is-in", on && c3.d >= x2.a && c3.d <= x2.b)));
|
|
3282
|
+
}
|
|
3283
|
+
const canGo = (M) => M.first <= TODAY;
|
|
3284
|
+
function navState() {
|
|
3285
|
+
const nm = monthOf(cur.y, cur.m + 1);
|
|
3286
|
+
const ny = monthOf(cur.y + 1, cur.m);
|
|
3287
|
+
next.disabled = !canGo(nm);
|
|
3288
|
+
nextYear.disabled = !canGo(ny) && !canGo(nm);
|
|
3289
|
+
}
|
|
3290
|
+
function go(y3, m3, dir) {
|
|
3291
|
+
let M = monthOf(y3, m3);
|
|
3292
|
+
if (!canGo(M)) M = monthOf(todayDate.getUTCFullYear(), todayDate.getUTCMonth());
|
|
3293
|
+
if (M.first === cur.first) return;
|
|
3294
|
+
const old = active;
|
|
3295
|
+
const W2 = view.clientWidth;
|
|
3296
|
+
old.X.t = -dir * W2;
|
|
3297
|
+
old.A.t = 0;
|
|
3298
|
+
after(0.9, () => {
|
|
3299
|
+
old.el.remove();
|
|
3300
|
+
live.splice(live.indexOf(old), 1);
|
|
3301
|
+
});
|
|
3302
|
+
cur = M;
|
|
3303
|
+
active = build(M);
|
|
3304
|
+
live.push(active);
|
|
3305
|
+
place(active);
|
|
3306
|
+
paint();
|
|
3307
|
+
active.X.x = old.X.x + dir * W2;
|
|
3308
|
+
active.X.t = 0;
|
|
3309
|
+
active.X.v = old.X.v;
|
|
3310
|
+
active.A.x = 0.4;
|
|
3311
|
+
active.A.t = 1;
|
|
3312
|
+
active.A.v = 0;
|
|
3313
|
+
H2.t = rowsOf(M) * CH;
|
|
3314
|
+
title.set(text.month(M.y, M.m), dir);
|
|
3315
|
+
navState();
|
|
3316
|
+
}
|
|
3317
|
+
prev.onclick = () => go(cur.y, cur.m - 1, -1);
|
|
3318
|
+
next.onclick = () => go(cur.y, cur.m + 1, 1);
|
|
3319
|
+
prevYear.onclick = () => go(cur.y - 1, cur.m, -1);
|
|
3320
|
+
nextYear.onclick = () => go(cur.y + 1, cur.m, 1);
|
|
3321
|
+
const dayAt = (e3) => {
|
|
3322
|
+
const r3 = view.getBoundingClientRect();
|
|
3323
|
+
const w3 = cw();
|
|
3324
|
+
const col2 = Math.floor((e3.clientX - r3.left - active.X.x) / w3);
|
|
3325
|
+
const row2 = Math.floor((e3.clientY - r3.top) / CH);
|
|
3326
|
+
const c3 = active.cells.find((x2) => x2.col === col2 && x2.row === row2);
|
|
3327
|
+
return c3 && c3.d <= TODAY ? c3.d : null;
|
|
3328
|
+
};
|
|
3329
|
+
function clear() {
|
|
3330
|
+
killBand();
|
|
3331
|
+
setDot("a", null);
|
|
3332
|
+
setDot("b", null);
|
|
3333
|
+
a4 = b = hover = null;
|
|
3334
|
+
mode = "idle";
|
|
3335
|
+
drag = false;
|
|
3336
|
+
texts();
|
|
3337
|
+
}
|
|
3338
|
+
function commit(d3) {
|
|
3339
|
+
b = d3;
|
|
3340
|
+
hover = null;
|
|
3341
|
+
mode = "done";
|
|
3342
|
+
drag = false;
|
|
3343
|
+
commitBand();
|
|
3344
|
+
setDot("b", b);
|
|
3345
|
+
texts();
|
|
3346
|
+
if (a4 !== null) sr.textContent = text.range(text.day(a4), text.day(b));
|
|
3347
|
+
}
|
|
3348
|
+
function down(d3) {
|
|
3349
|
+
if (d3 === null) return;
|
|
3350
|
+
if (mode !== "idle" && d3 === a4) {
|
|
3351
|
+
clear();
|
|
3352
|
+
return;
|
|
3353
|
+
}
|
|
3354
|
+
if (mode === "end" && a4 !== null && d3 > a4) {
|
|
3355
|
+
commit(d3);
|
|
3356
|
+
return;
|
|
3357
|
+
}
|
|
3358
|
+
killBand();
|
|
3359
|
+
setDot("b", null);
|
|
3360
|
+
a4 = d3;
|
|
3361
|
+
b = null;
|
|
3362
|
+
hover = null;
|
|
3363
|
+
mode = "end";
|
|
3364
|
+
drag = true;
|
|
3365
|
+
setDot("a", a4);
|
|
3366
|
+
texts();
|
|
3367
|
+
sr.textContent = text.startOnly(text.day(a4));
|
|
3368
|
+
}
|
|
3369
|
+
function move(d3) {
|
|
3370
|
+
if (mode !== "end" || d3 === hover) return;
|
|
3371
|
+
hover = d3;
|
|
3372
|
+
setPreview(d3);
|
|
3373
|
+
}
|
|
3374
|
+
function up() {
|
|
3375
|
+
if (!drag) return;
|
|
3376
|
+
drag = false;
|
|
3377
|
+
if (mode === "end" && a4 !== null && hover !== null && hover > a4) commit(hover);
|
|
3378
|
+
}
|
|
3379
|
+
view.addEventListener("pointerdown", (e3) => {
|
|
3380
|
+
view.setPointerCapture(e3.pointerId);
|
|
3381
|
+
down(dayAt(e3));
|
|
3382
|
+
});
|
|
3383
|
+
view.addEventListener("pointermove", (e3) => {
|
|
3384
|
+
if (!drag && !(e3.pointerType === "mouse" && mode === "end")) return;
|
|
3385
|
+
move(dayAt(e3));
|
|
3386
|
+
});
|
|
3387
|
+
view.addEventListener("pointerleave", (e3) => {
|
|
3388
|
+
if (!drag && e3.pointerType === "mouse" && mode === "end") move(null);
|
|
3389
|
+
});
|
|
3390
|
+
view.addEventListener("pointerup", up);
|
|
3391
|
+
view.addEventListener("pointercancel", up);
|
|
3392
|
+
active = build(cur);
|
|
3393
|
+
live.push(active);
|
|
3394
|
+
title.put(text.month(cur.y, cur.m));
|
|
3395
|
+
navState();
|
|
3396
|
+
texts();
|
|
3397
|
+
const ro = new ResizeObserver(() => live.forEach(place));
|
|
3398
|
+
ro.observe(view);
|
|
3399
|
+
place(active);
|
|
3400
|
+
function frame(dt) {
|
|
3401
|
+
clock += dt;
|
|
3402
|
+
for (let i3 = timers.length - 1; i3 >= 0; i3--) if ((timers[i3].t -= dt) <= 0) timers.splice(i3, 1)[0].fn();
|
|
3403
|
+
step(H2, dt);
|
|
3404
|
+
title.frame(dt);
|
|
3405
|
+
sum.frame(dt);
|
|
3406
|
+
nights.frame(dt);
|
|
3407
|
+
live.forEach((o4) => {
|
|
3408
|
+
step(o4.X, dt);
|
|
3409
|
+
step(o4.A, dt);
|
|
3410
|
+
});
|
|
3411
|
+
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);
|
|
3412
|
+
for (let i3 = dots.length - 1; i3 >= 0; i3--) if (dots[i3].role === null && done(dots[i3].f)) dots.splice(i3, 1);
|
|
3413
|
+
}
|
|
3414
|
+
function render() {
|
|
3415
|
+
view.style.height = `${f22(H2.x)}px`;
|
|
3416
|
+
const cp = val(CHIP);
|
|
3417
|
+
chip.style.opacity = cp.toFixed(3);
|
|
3418
|
+
chip.style.transform = `scale(${f22(0.9 + 0.1 * cp)})`;
|
|
3419
|
+
title.render();
|
|
3420
|
+
sum.render();
|
|
3421
|
+
nights.render();
|
|
3422
|
+
const w3 = cw();
|
|
3423
|
+
const rowLen = 7 * w3;
|
|
3424
|
+
live.forEach((o4) => {
|
|
3425
|
+
o4.el.style.transform = `translateX(${f22(o4.X.x)}px)`;
|
|
3426
|
+
o4.el.style.opacity = clamp(o4.A.x, 0, 1).toFixed(3);
|
|
3427
|
+
const m0 = o4.M.offset * w3;
|
|
3428
|
+
const m1 = (o4.M.offset + o4.M.len) * w3;
|
|
3429
|
+
bands.forEach((x2, i3) => {
|
|
3430
|
+
const els = o4.bandEls[i3] ??= Array.from({ length: o4.rows }, () => el("span", "fnc-rd-band", o4.bl));
|
|
3431
|
+
const al = val(x2.f);
|
|
3432
|
+
const sy = 0.9 + 0.1 * clamp(al / PREVIEW, 0, 1);
|
|
3433
|
+
const lo0 = track(o4, x2.a) - CAP;
|
|
3434
|
+
const hi0 = track(o4, x2.b) + CAP;
|
|
3435
|
+
const lo = Math.max(lo0, m0);
|
|
3436
|
+
const hi = Math.min(hi0, m1);
|
|
3437
|
+
els.forEach((e3, r3) => {
|
|
3438
|
+
const r0 = r3 * rowLen;
|
|
3439
|
+
const l3 = Math.max(lo, r0 + 2);
|
|
3440
|
+
const rr = Math.min(hi, r0 + rowLen - 2);
|
|
3441
|
+
if (al < 2e-3 || rr - l3 < 1) {
|
|
3442
|
+
e3.style.opacity = "0";
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3445
|
+
e3.style.opacity = al.toFixed(3);
|
|
3446
|
+
e3.style.width = `${f22(rr - l3)}px`;
|
|
3447
|
+
e3.style.transform = `translate(${f22(l3 - r0)}px,${r3 * CH + 2}px) scaleY(${sy.toFixed(4)})`;
|
|
3448
|
+
const capL = l3 === lo0 ? CAP : 8;
|
|
3449
|
+
const capR = rr === hi0 ? CAP : 8;
|
|
3450
|
+
e3.style.borderRadius = `${capL}px ${capR}px ${capR}px ${capL}px`;
|
|
3451
|
+
});
|
|
3452
|
+
});
|
|
3453
|
+
for (let i3 = bands.length; i3 < o4.bandEls.length; i3++) o4.bandEls[i3].forEach((e3) => e3.style.opacity = "0");
|
|
3454
|
+
dots.forEach((x2, i3) => {
|
|
3455
|
+
const e3 = o4.dotEls[i3] ??= el("span", "fnc-rd-dot", o4.dl);
|
|
3456
|
+
e3.classList.toggle("is-today", x2.d === TODAY);
|
|
3457
|
+
const p3 = val(x2.f);
|
|
3458
|
+
const k2 = x2.d - o4.M.first;
|
|
3459
|
+
if (p3 < 2e-3 || k2 < 0 || k2 >= o4.M.len) {
|
|
3460
|
+
e3.style.visibility = "hidden";
|
|
3461
|
+
return;
|
|
3462
|
+
}
|
|
3463
|
+
const n2 = String(k2 + 1);
|
|
3464
|
+
if (e3.textContent !== n2) e3.textContent = n2;
|
|
3465
|
+
const x0 = track(o4, x2.d);
|
|
3466
|
+
const row2 = Math.floor(x0 / rowLen);
|
|
3467
|
+
e3.style.visibility = "visible";
|
|
3468
|
+
e3.style.transform = `translate(${f22(x0 - row2 * rowLen)}px,${row2 * CH + CH / 2}px)`;
|
|
3469
|
+
e3.style.clipPath = `circle(${f22(R * p3)}px at 50% 50%)`;
|
|
3470
|
+
});
|
|
3471
|
+
for (let i3 = dots.length; i3 < o4.dotEls.length; i3++) o4.dotEls[i3].style.visibility = "hidden";
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
let last = performance.now();
|
|
3475
|
+
let raf = requestAnimationFrame(function loop(now) {
|
|
3476
|
+
const dt = Math.min((now - last) / 1e3, 1 / 30);
|
|
3477
|
+
last = now;
|
|
3478
|
+
for (let k2 = 0; k2 < 4; k2++) frame(dt / 4);
|
|
3479
|
+
render();
|
|
3480
|
+
raf = requestAnimationFrame(loop);
|
|
3481
|
+
});
|
|
3482
|
+
return {
|
|
3483
|
+
destroy() {
|
|
3484
|
+
cancelAnimationFrame(raf);
|
|
3485
|
+
ro.disconnect();
|
|
3486
|
+
root.textContent = "";
|
|
3487
|
+
}
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
|
|
3491
|
+
// src/components/replay-date.tsx
|
|
3492
|
+
var DAY4 = 864e5;
|
|
3493
|
+
function ReplayDateDialog({ ctx }) {
|
|
3494
|
+
const s3 = useStore(ctx.store);
|
|
3495
|
+
const t3 = stringsOf(s3);
|
|
3496
|
+
const host = T2(null);
|
|
3497
|
+
const [range, setRange] = d2({ start: null, end: null });
|
|
3498
|
+
const [busy, setBusy] = d2(false);
|
|
3499
|
+
const close = () => ctx.store.set({ dialog: null });
|
|
3500
|
+
const locale = s3.locale === "en" ? "en-US" : "ko-KR";
|
|
3501
|
+
const text = w2(() => {
|
|
3502
|
+
const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
|
|
3503
|
+
const month = new Intl.DateTimeFormat(locale, { year: "numeric", month: "long", timeZone: "UTC" });
|
|
3504
|
+
const day = new Intl.DateTimeFormat(locale, { month: s3.locale === "en" ? "short" : "long", day: "numeric", timeZone: "UTC" });
|
|
3505
|
+
const dayYear = new Intl.DateTimeFormat(locale, { year: "numeric", month: s3.locale === "en" ? "short" : "long", day: "numeric", timeZone: "UTC" });
|
|
3506
|
+
const wd = new Intl.DateTimeFormat(locale, { weekday: "narrow", timeZone: "UTC" });
|
|
3507
|
+
const fill = (tpl, vars) => tpl.replace(/\{(\w+)\}/g, (_3, k2) => vars[k2] ?? "");
|
|
3508
|
+
return {
|
|
3509
|
+
month: (y3, m3) => month.format(Date.UTC(y3, m3, 1)),
|
|
3510
|
+
day: (d3) => (new Date(d3 * DAY4).getUTCFullYear() === thisYear ? day : dayYear).format(d3 * DAY4),
|
|
3511
|
+
// 2023-01-01 was a Sunday.
|
|
3512
|
+
weekdays: Array.from({ length: 7 }, (_3, i3) => wd.format(Date.UTC(2023, 0, 1 + i3))),
|
|
3513
|
+
pickStart: t3.replayRangePick,
|
|
3514
|
+
startOnly: (start2) => fill(t3.replayRangeFrom, { start: start2 }),
|
|
3515
|
+
range: (start2, end) => fill(t3.replayRangeSpan, { start: start2, end }),
|
|
3516
|
+
days: (n2) => fill(t3.replayRangeDays, { n: String(n2) }),
|
|
3517
|
+
prevMonth: t3.prevMonth,
|
|
3518
|
+
nextMonth: t3.nextMonth,
|
|
3519
|
+
prevYear: t3.prevYear,
|
|
3520
|
+
nextYear: t3.nextYear,
|
|
3521
|
+
grid: t3.replayDateTitle
|
|
3522
|
+
};
|
|
3523
|
+
}, [locale]);
|
|
3524
|
+
A2(() => {
|
|
3525
|
+
if (!host.current) return;
|
|
3526
|
+
const at = ctx.chart.getVisibleTimeRange()?.from ?? Date.now();
|
|
3527
|
+
const picker = mountReplayRange(host.current, { text, at, onChange: (start2, end) => setRange({ start: start2, end }) });
|
|
3528
|
+
return () => picker.destroy();
|
|
3529
|
+
}, [text]);
|
|
3530
|
+
const start = async () => {
|
|
3531
|
+
if (range.start === null || busy) return;
|
|
3532
|
+
setBusy(true);
|
|
3533
|
+
try {
|
|
3534
|
+
await ctx.chart.startReplayAt(range.start, range.end === null ? null : range.end + DAY4 - 1);
|
|
3535
|
+
close();
|
|
3536
|
+
} finally {
|
|
3537
|
+
setBusy(false);
|
|
3538
|
+
}
|
|
3539
|
+
};
|
|
3540
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3(
|
|
3541
|
+
"div",
|
|
3542
|
+
{
|
|
3543
|
+
class: "fnc-dialog fnc-rd-dialog",
|
|
3544
|
+
role: "dialog",
|
|
3545
|
+
"aria-modal": "true",
|
|
3546
|
+
"aria-label": t3.replayDateTitle,
|
|
3547
|
+
onKeyDown: (e3) => {
|
|
3548
|
+
if (e3.key === "Escape") close();
|
|
3549
|
+
if (e3.key === "Enter") void start();
|
|
3550
|
+
},
|
|
3551
|
+
children: [
|
|
3552
|
+
/* @__PURE__ */ a3("div", { class: "fnc-rd", ref: host }),
|
|
3553
|
+
/* @__PURE__ */ a3("div", { class: "fnc-rd-actions", children: [
|
|
3554
|
+
/* @__PURE__ */ a3("button", { type: "button", class: "fnc-btn fnc-rd-cancel", onClick: close, children: t3.cancel }),
|
|
3555
|
+
/* @__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 })
|
|
3556
|
+
] })
|
|
3557
|
+
]
|
|
3558
|
+
}
|
|
3559
|
+
) });
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3016
3562
|
// src/components/indicator-settings.tsx
|
|
3017
3563
|
import {
|
|
3018
3564
|
maLines,
|
|
@@ -3138,12 +3684,12 @@ function IndicatorSettings({ ctx, id, Dialog: Dialog2 }) {
|
|
|
3138
3684
|
const collect = () => {
|
|
3139
3685
|
const params = {};
|
|
3140
3686
|
for (const spec of def.params) {
|
|
3141
|
-
const
|
|
3142
|
-
if (spec.kind === "lines") params[spec.key] = lines.filter((l3) => Number(l3.period) > 0).map((l3) => ({ period:
|
|
3687
|
+
const clamp2 = (n2) => Math.min(spec.max ?? Infinity, Math.max(spec.min ?? -Infinity, n2));
|
|
3688
|
+
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
3689
|
else if (spec.kind === "source") params[spec.key] = values[spec.key] ?? "close";
|
|
3144
3690
|
else {
|
|
3145
3691
|
const n2 = Number(values[spec.key]);
|
|
3146
|
-
if (Number.isFinite(n2)) params[spec.key] =
|
|
3692
|
+
if (Number.isFinite(n2)) params[spec.key] = clamp2(n2);
|
|
3147
3693
|
}
|
|
3148
3694
|
}
|
|
3149
3695
|
const kept = hasLines ? rows.filter((_3, i3) => Number(lines[i3]?.period) > 0) : rows;
|
|
@@ -4209,6 +4755,40 @@ var CSS = (
|
|
|
4209
4755
|
.fnc-cal-day.is-on { background: var(--fnc-accent); color: #fff; font-weight: 700; }
|
|
4210
4756
|
.fnc-cal-day:disabled { opacity: 0.3; cursor: default; }
|
|
4211
4757
|
.fnc-goto-actions { display: flex; gap: 8px; }
|
|
4758
|
+
/* \uB9AC\uD50C\uB808\uC774 \uB0A0\uC9DC (replay-range.ts): designbookmark's date range in the chart's own colors and radius. */
|
|
4759
|
+
.fnc-rd-dialog { width: min(340px, calc(100% - 32px)); padding: 16px 14px 14px; }
|
|
4760
|
+
/* A card on phones too (other dialogs fill the screen there): it's small, and the chart stays behind it. */
|
|
4761
|
+
.fnc-root .fnc-dialog.fnc-rd-dialog { align-self: center; height: auto; max-height: none; width: min(360px, calc(100% - 24px)); border-radius: 16px; }
|
|
4762
|
+
.fnc-rd { position: relative; user-select: none; -webkit-user-select: none; }
|
|
4763
|
+
.fnc-rd-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 2px 0 6px; }
|
|
4764
|
+
.fnc-rd-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--fnc-text); }
|
|
4765
|
+
.fnc-rd-nav { display: flex; gap: 4px; }
|
|
4766
|
+
.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; }
|
|
4767
|
+
.fnc-rd-arrow:hover:not(:disabled) { background: color-mix(in srgb, var(--fnc-text) 12%, transparent); }
|
|
4768
|
+
.fnc-rd-arrow:disabled { opacity: .3; cursor: default; }
|
|
4769
|
+
.fnc-rd-arrow svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
4770
|
+
.fnc-rd-arrow:focus-visible { outline: 2px solid var(--fnc-text-2); outline-offset: 2px; }
|
|
4771
|
+
.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; }
|
|
4772
|
+
.fnc-rd-view { position: relative; margin-top: 4px; overflow: hidden; touch-action: none; will-change: height; }
|
|
4773
|
+
.fnc-rd-month { position: absolute; left: 0; top: 0; width: 100%; will-change: transform, opacity; }
|
|
4774
|
+
.fnc-rd-layer { position: absolute; inset: 0; pointer-events: none; }
|
|
4775
|
+
.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; }
|
|
4776
|
+
.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; }
|
|
4777
|
+
.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; }
|
|
4778
|
+
.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); }
|
|
4779
|
+
.fnc-rd-day.is-in { color: var(--fnc-text); transition-timing-function: cubic-bezier(.215, .61, .355, 1); }
|
|
4780
|
+
.fnc-rd-day.is-future { opacity: .35; cursor: default; }
|
|
4781
|
+
.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); }
|
|
4782
|
+
.fnc-rd-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; height: 32px; padding: 0 2px 0 6px; }
|
|
4783
|
+
.fnc-rd-sum { min-width: 0; font-size: 13px; font-weight: 500; color: var(--fnc-text-2); }
|
|
4784
|
+
.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; }
|
|
4785
|
+
.fnc-rd-roll { display: inline-grid; overflow: hidden; }
|
|
4786
|
+
.fnc-rd-roll span { grid-area: 1 / 1; white-space: nowrap; will-change: transform, opacity, filter; }
|
|
4787
|
+
.fnc-rd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
4788
|
+
.fnc-rd-actions { display: flex; gap: 8px; margin-top: 12px; }
|
|
4789
|
+
.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; }
|
|
4790
|
+
.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; }
|
|
4791
|
+
.fnc-rd-dialog .fnc-rd-go:disabled { opacity: .4; cursor: default; }
|
|
4212
4792
|
.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
4793
|
.fnc-goto-dialog .fnc-goto-go { flex: 1; height: 36px; }
|
|
4214
4794
|
|
|
@@ -4698,6 +5278,8 @@ var CSS = (
|
|
|
4698
5278
|
.fnc-tools-icon svg { width: 100%; height: 100%; }
|
|
4699
5279
|
.fnc-tools-item svg { flex: none; color: var(--fnc-text-2); }
|
|
4700
5280
|
.fnc-tools-item[aria-pressed='true'] { background: var(--fnc-surface); color: var(--fnc-text); }
|
|
5281
|
+
/* Why an item is off (\uB9AC\uD50C\uB808\uC774 on a renko chart\u2026). */
|
|
5282
|
+
.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
5283
|
|
|
4702
5284
|
/* \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
5285
|
.fnc-tool-group { position: relative; display: flex; }
|
|
@@ -4937,6 +5519,8 @@ var CSS = (
|
|
|
4937
5519
|
.fnc-replay-hint { gap: 8px; padding: 4px 4px 4px 12px; font-size: 13px; color: var(--fnc-text); }
|
|
4938
5520
|
.fnc-replay-hint svg { color: var(--fnc-text-2); }
|
|
4939
5521
|
.fnc-replay-note { padding: 0 6px; font-size: 12px; color: var(--fnc-text-2); }
|
|
5522
|
+
/* \uB0A0\uC9DC \uC120\uD0DD \xB7 \uBB34\uC791\uC704 \uBD09 while picking the start: an icon and a word. */
|
|
5523
|
+
.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
5524
|
|
|
4941
5525
|
/* Indicator picker search (shown when custom indicators make the list long) */
|
|
4942
5526
|
.fnc-ind-search { height: 48px; padding: 0 16px; }
|
|
@@ -6148,7 +6732,7 @@ function Dialogs({ ctx }) {
|
|
|
6148
6732
|
if (dialog?.kind === "indicatorSettings") return /* @__PURE__ */ a3(IndicatorSettings, { ctx, id: dialog.id, Dialog }, dialog.id);
|
|
6149
6733
|
if (dialog?.kind === "chartSettings") return /* @__PURE__ */ a3(SettingsDialog, { ctx });
|
|
6150
6734
|
if (dialog?.kind === "volumeSettings") return /* @__PURE__ */ a3(VolumeSettings, { ctx, Dialog });
|
|
6151
|
-
if (dialog?.kind === "goToDate") return /* @__PURE__ */ a3(GoToDateDialog, { ctx });
|
|
6735
|
+
if (dialog?.kind === "goToDate") return dialog.replay ? /* @__PURE__ */ a3(ReplayDateDialog, { ctx }) : /* @__PURE__ */ a3(GoToDateDialog, { ctx });
|
|
6152
6736
|
return null;
|
|
6153
6737
|
}
|
|
6154
6738
|
|
|
@@ -6889,8 +7473,10 @@ function ToolsMenu({ ctx }) {
|
|
|
6889
7473
|
s3.replay.active ? t3.replayExit : t3.replay,
|
|
6890
7474
|
/* @__PURE__ */ a3(ReplayIcon, {}),
|
|
6891
7475
|
() => s3.replay.active ? ctx.chart.stopReplay() : ctx.chart.setReplaySelecting(true),
|
|
6892
|
-
|
|
7476
|
+
// Renko · Kagi · P&F · line break · 볼륨 풋프린트 don't replay (as TradingView's).
|
|
7477
|
+
{ pressed: s3.replay.active || s3.replay.selecting, disabled: !s3.replay.active && !s3.replay.supported }
|
|
6893
7478
|
),
|
|
7479
|
+
!s3.replay.active && !s3.replay.supported && /* @__PURE__ */ a3("p", { class: "fnc-tools-note", children: t3.replayUnsupported }),
|
|
6894
7480
|
item("fnc-btn-screenshot", t3.screenshot, /* @__PURE__ */ a3(CameraIcon, {}), ctx.screenshot),
|
|
6895
7481
|
/* @__PURE__ */ a3("div", { class: "fnc-tools-sep" }),
|
|
6896
7482
|
(ctx.toolsMenuItems?.(ctx.chart) ?? []).map(
|
|
@@ -7022,6 +7608,11 @@ var GLYPHS = {
|
|
|
7022
7608
|
clock: /* @__PURE__ */ a3($, { children: [
|
|
7023
7609
|
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "7" }),
|
|
7024
7610
|
/* @__PURE__ */ a3("path", { d: "M10 6v4l2.5 1.5" })
|
|
7611
|
+
] }),
|
|
7612
|
+
// Two sheets, one over the other (가격 복사).
|
|
7613
|
+
copy: /* @__PURE__ */ a3($, { children: [
|
|
7614
|
+
/* @__PURE__ */ a3("rect", { x: "7", y: "7", width: "9.5", height: "9.5", rx: "1.8" }),
|
|
7615
|
+
/* @__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
7616
|
] })
|
|
7026
7617
|
};
|
|
7027
7618
|
function MenuIcon({ name }) {
|
|
@@ -7578,18 +8169,28 @@ function ReplayBar({ ctx }) {
|
|
|
7578
8169
|
const { plotWidth, panesHeight } = s3.layout;
|
|
7579
8170
|
if (plotWidth <= 0 || !r3.active && !r3.selecting) return null;
|
|
7580
8171
|
const style = { left: `${plotWidth / 2}px`, top: `${panesHeight - CONTROL_OFFSET}px` };
|
|
8172
|
+
const pickDate = () => ctx.store.set({ dialog: { kind: "goToDate", replay: true } });
|
|
8173
|
+
const pickRandom = () => void ctx.chart.startReplayRandom();
|
|
7581
8174
|
if (!r3.active) {
|
|
7582
8175
|
return /* @__PURE__ */ a3("div", { class: "fnc-replay fnc-replay-hint", style, role: "status", children: [
|
|
7583
8176
|
/* @__PURE__ */ a3(ReplayIcon, {}),
|
|
7584
8177
|
/* @__PURE__ */ a3("span", { children: t3.replayPick }),
|
|
8178
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-replay-word", "data-tip": t3.replayDate, onClick: pickDate, children: [
|
|
8179
|
+
/* @__PURE__ */ a3(CalendarIcon, {}),
|
|
8180
|
+
/* @__PURE__ */ a3("span", { children: t3.replayDate })
|
|
8181
|
+
] }),
|
|
8182
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-replay-word", "data-tip": t3.replayRandom, onClick: pickRandom, children: [
|
|
8183
|
+
/* @__PURE__ */ a3(DiceIcon, {}),
|
|
8184
|
+
/* @__PURE__ */ a3("span", { children: t3.replayRandom })
|
|
8185
|
+
] }),
|
|
7585
8186
|
/* @__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
8187
|
] });
|
|
7587
8188
|
}
|
|
7588
8189
|
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 });
|
|
8190
|
+
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
8191
|
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),
|
|
8192
|
+
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),
|
|
8193
|
+
button(t3.replayStep, () => ctx.chart.replayStep(), /* @__PURE__ */ a3(StepIcon, {}), done, t3.replayShortcutStep),
|
|
7593
8194
|
/* @__PURE__ */ a3("div", { class: "fnc-seg fnc-seg-sm", role: "radiogroup", "aria-label": t3.replaySpeed, children: REPLAY_SPEEDS.map((speed) => /* @__PURE__ */ a3(
|
|
7594
8195
|
"button",
|
|
7595
8196
|
{
|
|
@@ -7603,6 +8204,8 @@ function ReplayBar({ ctx }) {
|
|
|
7603
8204
|
done && /* @__PURE__ */ a3("span", { class: "fnc-replay-note", children: t3.replayDone }),
|
|
7604
8205
|
/* @__PURE__ */ a3("div", { class: "fnc-sep" }),
|
|
7605
8206
|
button(t3.replayRestart, () => ctx.chart.setReplaySelecting(true), /* @__PURE__ */ a3(ReplayIcon, {})),
|
|
8207
|
+
button(t3.replayDate, pickDate, /* @__PURE__ */ a3(CalendarIcon, {})),
|
|
8208
|
+
button(t3.replayRandom, pickRandom, /* @__PURE__ */ a3(DiceIcon, {})),
|
|
7606
8209
|
button(t3.replayExit, () => ctx.chart.stopReplay(), /* @__PURE__ */ a3(SmallCloseIcon, {}))
|
|
7607
8210
|
] });
|
|
7608
8211
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.49",
|
|
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.
|
|
45
|
+
"@funnest/charts": "0.11.49"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|