@funnest/charts-ui 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/interval-picker.d.ts +0 -6
- package/dist/components/range-bar.d.ts +8 -0
- package/dist/context.d.ts +4 -0
- package/dist/i18n.d.ts +48 -0
- package/dist/icons.d.ts +4 -0
- package/dist/index.js +314 -42
- package/dist/shell.d.ts +6 -2
- package/package.json +2 -2
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import type { WidgetContext } from '../context.js';
|
|
2
|
-
/**
|
|
3
|
-
* Favorite intervals as toolbar chips + a grouped menu (분 | 시간 | 일) where hovering a row
|
|
4
|
-
* reveals a ★ to pin/unpin it. The current interval is among the chips even when it isn't a
|
|
5
|
-
* favorite, in time order (15분 | 일 picking 1분 reads 1분 | 15분 | 일, not 15분 | 일 | 1분). On
|
|
6
|
-
* narrow screens only the menu trigger (showing the current interval) remains.
|
|
7
|
-
*/
|
|
8
2
|
export declare function IntervalPicker({ ctx }: {
|
|
9
3
|
ctx: WidgetContext;
|
|
10
4
|
}): import("preact").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WidgetContext } from '../context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Under the chart (like most chart sites): 기간 buttons, then 날짜로 이동 — a date; older history
|
|
4
|
+
* is loaded first when it's before what's on the chart. The date box opens upward.
|
|
5
|
+
*/
|
|
6
|
+
export declare function RangeBar({ ctx }: {
|
|
7
|
+
ctx: WidgetContext;
|
|
8
|
+
}): import("preact").JSX.Element | null;
|
package/dist/context.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface UiState {
|
|
|
37
37
|
} | null;
|
|
38
38
|
/** Intervals pinned as toolbar chips (★ in the interval menu). */
|
|
39
39
|
favoriteIntervals: Resolution[];
|
|
40
|
+
/** Intervals the user added (2시간, 3분…): listed in the interval menu, made from ones the feed sends. */
|
|
41
|
+
customIntervals: Resolution[];
|
|
40
42
|
/** Desktop: the left drawing bar folded away (a small tab brings it back). */
|
|
41
43
|
drawbarCollapsed: boolean;
|
|
42
44
|
/** Tools pinned at the top of the drawing bar (★ in a tool list). */
|
|
@@ -137,6 +139,8 @@ export interface WidgetContext {
|
|
|
137
139
|
selectSymbol(symbol: string): void;
|
|
138
140
|
selectResolution(resolution: Resolution): void;
|
|
139
141
|
toggleFavoriteInterval(resolution: Resolution): void;
|
|
142
|
+
addCustomInterval(resolution: Resolution): void;
|
|
143
|
+
removeCustomInterval(resolution: Resolution): void;
|
|
140
144
|
toggleFavoriteTool(tool: DrawingType): void;
|
|
141
145
|
setKeepDrawing(on: boolean): void;
|
|
142
146
|
setCursorMode(mode: CursorMode): void;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -23,7 +23,10 @@ export declare const STRINGS: {
|
|
|
23
23
|
candles: string;
|
|
24
24
|
hollowCandles: string;
|
|
25
25
|
heikinAshi: string;
|
|
26
|
+
ohlcBars: string;
|
|
26
27
|
line: string;
|
|
28
|
+
stepLine: string;
|
|
29
|
+
baseline: string;
|
|
27
30
|
area: string;
|
|
28
31
|
drawingTools: string;
|
|
29
32
|
cursor: string;
|
|
@@ -165,6 +168,27 @@ export declare const STRINGS: {
|
|
|
165
168
|
maximizePane: string;
|
|
166
169
|
restorePane: string;
|
|
167
170
|
pane: string;
|
|
171
|
+
ranges: string;
|
|
172
|
+
range1D: string;
|
|
173
|
+
range5D: string;
|
|
174
|
+
range1M: string;
|
|
175
|
+
range3M: string;
|
|
176
|
+
range6M: string;
|
|
177
|
+
rangeYTD: string;
|
|
178
|
+
range1Y: string;
|
|
179
|
+
range5Y: string;
|
|
180
|
+
rangeAll: string;
|
|
181
|
+
goToDate: string;
|
|
182
|
+
goTo: string;
|
|
183
|
+
customInterval: string;
|
|
184
|
+
addInterval: string;
|
|
185
|
+
removeInterval: string;
|
|
186
|
+
unitMinutes: string;
|
|
187
|
+
unitHours: string;
|
|
188
|
+
unitDays: string;
|
|
189
|
+
unitWeeks: string;
|
|
190
|
+
unitMonths: string;
|
|
191
|
+
intervalCustom: string;
|
|
168
192
|
};
|
|
169
193
|
en: {
|
|
170
194
|
searchSymbol: string;
|
|
@@ -189,7 +213,10 @@ export declare const STRINGS: {
|
|
|
189
213
|
candles: string;
|
|
190
214
|
hollowCandles: string;
|
|
191
215
|
heikinAshi: string;
|
|
216
|
+
ohlcBars: string;
|
|
192
217
|
line: string;
|
|
218
|
+
stepLine: string;
|
|
219
|
+
baseline: string;
|
|
193
220
|
area: string;
|
|
194
221
|
drawingTools: string;
|
|
195
222
|
cursor: string;
|
|
@@ -331,6 +358,27 @@ export declare const STRINGS: {
|
|
|
331
358
|
maximizePane: string;
|
|
332
359
|
restorePane: string;
|
|
333
360
|
pane: string;
|
|
361
|
+
ranges: string;
|
|
362
|
+
range1D: string;
|
|
363
|
+
range5D: string;
|
|
364
|
+
range1M: string;
|
|
365
|
+
range3M: string;
|
|
366
|
+
range6M: string;
|
|
367
|
+
rangeYTD: string;
|
|
368
|
+
range1Y: string;
|
|
369
|
+
range5Y: string;
|
|
370
|
+
rangeAll: string;
|
|
371
|
+
goToDate: string;
|
|
372
|
+
goTo: string;
|
|
373
|
+
customInterval: string;
|
|
374
|
+
addInterval: string;
|
|
375
|
+
removeInterval: string;
|
|
376
|
+
unitMinutes: string;
|
|
377
|
+
unitHours: string;
|
|
378
|
+
unitDays: string;
|
|
379
|
+
unitWeeks: string;
|
|
380
|
+
unitMonths: string;
|
|
381
|
+
intervalCustom: string;
|
|
334
382
|
};
|
|
335
383
|
};
|
|
336
384
|
export type Strings = (typeof STRINGS)['ko'];
|
package/dist/icons.d.ts
CHANGED
|
@@ -21,6 +21,9 @@ export declare const CandlesIcon: () => import("preact").JSX.Element;
|
|
|
21
21
|
export declare const HollowCandlesIcon: () => import("preact").JSX.Element;
|
|
22
22
|
export declare const HeikinAshiIcon: () => import("preact").JSX.Element;
|
|
23
23
|
export declare const LineChartIcon: () => import("preact").JSX.Element;
|
|
24
|
+
export declare const OhlcBarsIcon: () => import("preact").JSX.Element;
|
|
25
|
+
export declare const StepLineIcon: () => import("preact").JSX.Element;
|
|
26
|
+
export declare const BaselineIcon: () => import("preact").JSX.Element;
|
|
24
27
|
export declare const AreaChartIcon: () => import("preact").JSX.Element;
|
|
25
28
|
export declare const IndicatorIcon: () => import("preact").JSX.Element;
|
|
26
29
|
export declare const GearIcon: () => import("preact").JSX.Element;
|
|
@@ -32,6 +35,7 @@ export declare const MagnetIcon: () => import("preact").JSX.Element;
|
|
|
32
35
|
export declare const StarIcon: ({ filled }: {
|
|
33
36
|
filled?: boolean;
|
|
34
37
|
}) => import("preact").JSX.Element;
|
|
38
|
+
export declare const CalendarIcon: () => import("preact").JSX.Element;
|
|
35
39
|
export declare const ClockIcon: () => import("preact").JSX.Element;
|
|
36
40
|
export declare const WifiIcon: ({ bars }: {
|
|
37
41
|
bars?: 0 | 1 | 2 | 3;
|
package/dist/index.js
CHANGED
|
@@ -449,7 +449,10 @@ var STRINGS = {
|
|
|
449
449
|
candles: "\uCE94\uB4E4",
|
|
450
450
|
hollowCandles: "\uC18D \uBE48 \uCE94\uB4E4",
|
|
451
451
|
heikinAshi: "\uD558\uC774\uD0A8\uC544\uC2DC",
|
|
452
|
+
ohlcBars: "OHLC \uBC14",
|
|
452
453
|
line: "\uB77C\uC778",
|
|
454
|
+
stepLine: "\uACC4\uB2E8\uC120",
|
|
455
|
+
baseline: "\uBCA0\uC774\uC2A4\uB77C\uC778",
|
|
453
456
|
area: "\uC601\uC5ED",
|
|
454
457
|
drawingTools: "\uADF8\uB9AC\uAE30 \uB3C4\uAD6C",
|
|
455
458
|
cursor: "\uCEE4\uC11C",
|
|
@@ -592,7 +595,28 @@ var STRINGS = {
|
|
|
592
595
|
syncHint: "\uCF1C\uBA74 \uBAA8\uB4E0 \uCE78\uC774 \uAC19\uC774 \uC6C0\uC9C1\uC5EC\uC694",
|
|
593
596
|
maximizePane: "\uC774 \uCE78 \uD06C\uAC8C \uBCF4\uAE30",
|
|
594
597
|
restorePane: "\uBD84\uD560 \uD654\uBA74\uC73C\uB85C",
|
|
595
|
-
pane: "\uCE78"
|
|
598
|
+
pane: "\uCE78",
|
|
599
|
+
ranges: "\uAE30\uAC04",
|
|
600
|
+
range1D: "1\uC77C",
|
|
601
|
+
range5D: "5\uC77C",
|
|
602
|
+
range1M: "1\uAC1C\uC6D4",
|
|
603
|
+
range3M: "3\uAC1C\uC6D4",
|
|
604
|
+
range6M: "6\uAC1C\uC6D4",
|
|
605
|
+
rangeYTD: "\uC62C\uD574",
|
|
606
|
+
range1Y: "1\uB144",
|
|
607
|
+
range5Y: "5\uB144",
|
|
608
|
+
rangeAll: "\uC804\uCCB4",
|
|
609
|
+
goToDate: "\uB0A0\uC9DC\uB85C \uC774\uB3D9",
|
|
610
|
+
goTo: "\uC774\uB3D9",
|
|
611
|
+
customInterval: "\uC9C1\uC811 \uCD94\uAC00",
|
|
612
|
+
addInterval: "\uCD94\uAC00",
|
|
613
|
+
removeInterval: "\uC0AD\uC81C",
|
|
614
|
+
unitMinutes: "\uBD84",
|
|
615
|
+
unitHours: "\uC2DC\uAC04",
|
|
616
|
+
unitDays: "\uC77C",
|
|
617
|
+
unitWeeks: "\uC8FC",
|
|
618
|
+
unitMonths: "\uAC1C\uC6D4",
|
|
619
|
+
intervalCustom: "\uC9C1\uC811 \uCD94\uAC00\uD55C \uC8FC\uAE30"
|
|
596
620
|
},
|
|
597
621
|
en: {
|
|
598
622
|
searchSymbol: "Symbol search",
|
|
@@ -617,7 +641,10 @@ var STRINGS = {
|
|
|
617
641
|
candles: "Candles",
|
|
618
642
|
hollowCandles: "Hollow candles",
|
|
619
643
|
heikinAshi: "Heikin Ashi",
|
|
644
|
+
ohlcBars: "Bars",
|
|
620
645
|
line: "Line",
|
|
646
|
+
stepLine: "Step line",
|
|
647
|
+
baseline: "Baseline",
|
|
621
648
|
area: "Area",
|
|
622
649
|
drawingTools: "Drawing tools",
|
|
623
650
|
cursor: "Cursor",
|
|
@@ -758,7 +785,28 @@ var STRINGS = {
|
|
|
758
785
|
syncHint: "Linked panes move together",
|
|
759
786
|
maximizePane: "Maximize pane",
|
|
760
787
|
restorePane: "Back to split view",
|
|
761
|
-
pane: "Pane"
|
|
788
|
+
pane: "Pane",
|
|
789
|
+
ranges: "Range",
|
|
790
|
+
range1D: "1D",
|
|
791
|
+
range5D: "5D",
|
|
792
|
+
range1M: "1M",
|
|
793
|
+
range3M: "3M",
|
|
794
|
+
range6M: "6M",
|
|
795
|
+
rangeYTD: "YTD",
|
|
796
|
+
range1Y: "1Y",
|
|
797
|
+
range5Y: "5Y",
|
|
798
|
+
rangeAll: "All",
|
|
799
|
+
goToDate: "Go to date",
|
|
800
|
+
goTo: "Go",
|
|
801
|
+
customInterval: "Add custom",
|
|
802
|
+
addInterval: "Add",
|
|
803
|
+
removeInterval: "Remove",
|
|
804
|
+
unitMinutes: "minutes",
|
|
805
|
+
unitHours: "hours",
|
|
806
|
+
unitDays: "days",
|
|
807
|
+
unitWeeks: "weeks",
|
|
808
|
+
unitMonths: "months",
|
|
809
|
+
intervalCustom: "Custom intervals"
|
|
762
810
|
}
|
|
763
811
|
};
|
|
764
812
|
var merged = /* @__PURE__ */ new WeakMap();
|
|
@@ -852,6 +900,12 @@ var HeikinAshiIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
|
852
900
|
/* @__PURE__ */ a3("rect", { x: "13.3", y: "7.5", width: "3.4", height: "5", rx: "0.7" })
|
|
853
901
|
] });
|
|
854
902
|
var LineChartIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7" }) });
|
|
903
|
+
var OhlcBarsIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M6 4v12M3.5 7H6M6 13h2.5M14 3v13M11.5 12H14M14 6h2.5" }) });
|
|
904
|
+
var StepLineIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M3 14h4V9h4v3h3V5h3" }) });
|
|
905
|
+
var BaselineIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
906
|
+
/* @__PURE__ */ a3("path", { d: "M3 10h14", "stroke-dasharray": "2 2" }),
|
|
907
|
+
/* @__PURE__ */ a3("path", { d: "M3 12l3.5-5 3.5 3 3-6 4 9" })
|
|
908
|
+
] });
|
|
855
909
|
var AreaChartIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
856
910
|
/* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7" }),
|
|
857
911
|
/* @__PURE__ */ a3("path", { d: "M3 14l4.5-5 3.5 3 6-7V17H3z", fill: "currentColor", "fill-opacity": "0.25", stroke: "none" })
|
|
@@ -882,6 +936,10 @@ var StarIcon = ({ filled = false }) => /* @__PURE__ */ a3(Icon, { size: 16, chil
|
|
|
882
936
|
fill: filled ? "currentColor" : "none"
|
|
883
937
|
}
|
|
884
938
|
) });
|
|
939
|
+
var CalendarIcon = () => /* @__PURE__ */ a3(Icon, { size: 16, children: [
|
|
940
|
+
/* @__PURE__ */ a3("rect", { x: "3.5", y: "4.5", width: "13", height: "12", rx: "2" }),
|
|
941
|
+
/* @__PURE__ */ a3("path", { d: "M3.5 8.5h13M7 3v3M13 3v3" })
|
|
942
|
+
] });
|
|
885
943
|
var SettingsIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
886
944
|
/* @__PURE__ */ a3("path", { d: "M10 12.6a2.6 2.6 0 1 0 0-5.2 2.6 2.6 0 0 0 0 5.2z" }),
|
|
887
945
|
/* @__PURE__ */ a3("path", { d: "M16.2 12a1.3 1.3 0 0 0 .26 1.43l.05.05a1.6 1.6 0 1 1-2.26 2.26l-.05-.05a1.3 1.3 0 0 0-1.43-.26 1.3 1.3 0 0 0-.79 1.19v.14a1.6 1.6 0 0 1-3.2 0v-.07a1.3 1.3 0 0 0-.85-1.19 1.3 1.3 0 0 0-1.43.26l-.05.05a1.6 1.6 0 1 1-2.26-2.26l.05-.05A1.3 1.3 0 0 0 4.5 12a1.3 1.3 0 0 0-1.19-.79h-.14a1.6 1.6 0 0 1 0-3.2h.07a1.3 1.3 0 0 0 1.19-.85 1.3 1.3 0 0 0-.26-1.43l-.05-.05a1.6 1.6 0 1 1 2.26-2.26l.05.05a1.3 1.3 0 0 0 1.43.26h.06a1.3 1.3 0 0 0 .79-1.19v-.14a1.6 1.6 0 0 1 3.2 0v.07a1.3 1.3 0 0 0 .79 1.19 1.3 1.3 0 0 0 1.43-.26l.05-.05a1.6 1.6 0 1 1 2.26 2.26l-.05.05a1.3 1.3 0 0 0-.26 1.43v.06a1.3 1.3 0 0 0 1.19.79h.14a1.6 1.6 0 0 1 0 3.2h-.07a1.3 1.3 0 0 0-1.19.79z" })
|
|
@@ -1477,6 +1535,101 @@ function SelectionBar({ ctx }) {
|
|
|
1477
1535
|
] });
|
|
1478
1536
|
}
|
|
1479
1537
|
|
|
1538
|
+
// src/components/range-bar.tsx
|
|
1539
|
+
import { derivedBase } from "@funnest/charts";
|
|
1540
|
+
var DAY = 864e5;
|
|
1541
|
+
var RANGES = [
|
|
1542
|
+
{ id: "range1D", resolution: "1", from: (now) => now - DAY },
|
|
1543
|
+
{ id: "range5D", resolution: "5", from: (now) => now - 5 * DAY },
|
|
1544
|
+
{ id: "range1M", resolution: "30", from: (now) => now - 30 * DAY },
|
|
1545
|
+
{ id: "range3M", resolution: "60", from: (now) => now - 91 * DAY },
|
|
1546
|
+
{ id: "range6M", resolution: "120", from: (now) => now - 182 * DAY },
|
|
1547
|
+
{ id: "rangeYTD", resolution: "1D", from: (now) => Date.UTC(new Date(now).getUTCFullYear(), 0, 1) },
|
|
1548
|
+
{ id: "range1Y", resolution: "1D", from: (now) => now - 365 * DAY },
|
|
1549
|
+
{ id: "range5Y", resolution: "1W", from: (now) => now - 5 * 365 * DAY },
|
|
1550
|
+
{ id: "rangeAll", resolution: "1M", from: () => null }
|
|
1551
|
+
];
|
|
1552
|
+
var dateInput = (time) => new Date(time).toISOString().slice(0, 10);
|
|
1553
|
+
function RangeBar({ ctx }) {
|
|
1554
|
+
const s3 = useStore(ctx.store);
|
|
1555
|
+
const t3 = stringsOf(s3);
|
|
1556
|
+
const [dateOpen, setDateOpen] = d2(false);
|
|
1557
|
+
const [date, setDate] = d2("");
|
|
1558
|
+
const [busy, setBusy] = d2(false);
|
|
1559
|
+
if (s3.replay.active || s3.replay.selecting) return null;
|
|
1560
|
+
const supported = s3.symbol?.supportedResolutions;
|
|
1561
|
+
const usable = (resolution) => !supported || supported.includes(resolution) || !!derivedBase(resolution, supported) || resolution === "1M";
|
|
1562
|
+
const pick = async (r3) => {
|
|
1563
|
+
if (!s3.symbol || busy) return;
|
|
1564
|
+
setBusy(true);
|
|
1565
|
+
try {
|
|
1566
|
+
if (r3.resolution !== s3.resolution) {
|
|
1567
|
+
ctx.selectResolution(r3.resolution);
|
|
1568
|
+
await new Promise((resolve) => {
|
|
1569
|
+
const off = ctx.chart.on("dataChange", () => {
|
|
1570
|
+
off();
|
|
1571
|
+
resolve();
|
|
1572
|
+
});
|
|
1573
|
+
setTimeout(() => {
|
|
1574
|
+
off();
|
|
1575
|
+
resolve();
|
|
1576
|
+
}, 8e3);
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
const from = r3.from(Date.now());
|
|
1580
|
+
if (from === null) await ctx.chart.showAll();
|
|
1581
|
+
else await ctx.chart.showRange(from);
|
|
1582
|
+
} finally {
|
|
1583
|
+
setBusy(false);
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
const go = async () => {
|
|
1587
|
+
const time = Date.parse(`${date}T00:00:00Z`);
|
|
1588
|
+
if (!Number.isFinite(time) || busy) return;
|
|
1589
|
+
setBusy(true);
|
|
1590
|
+
try {
|
|
1591
|
+
await ctx.chart.goToTime(time);
|
|
1592
|
+
setDateOpen(false);
|
|
1593
|
+
} finally {
|
|
1594
|
+
setBusy(false);
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-ranges", "aria-label": t3.ranges, role: "group", "aria-busy": busy, children: [
|
|
1598
|
+
/* @__PURE__ */ a3("div", { class: "fnc-ranges-scroll", children: RANGES.map((r3) => /* @__PURE__ */ a3("button", { class: "fnc-range", disabled: busy || !usable(r3.resolution), onClick: () => void pick(r3), children: t3[r3.id] })) }),
|
|
1599
|
+
/* @__PURE__ */ a3("span", { class: "fnc-range-sep" }),
|
|
1600
|
+
/* @__PURE__ */ a3(
|
|
1601
|
+
"button",
|
|
1602
|
+
{
|
|
1603
|
+
class: "fnc-range fnc-range-date",
|
|
1604
|
+
"data-tip": t3.goToDate,
|
|
1605
|
+
"aria-label": t3.goToDate,
|
|
1606
|
+
"aria-expanded": dateOpen,
|
|
1607
|
+
onClick: () => {
|
|
1608
|
+
if (!dateOpen) setDate(dateInput(ctx.chart.getVisibleTimeRange()?.from ?? Date.now()));
|
|
1609
|
+
setDateOpen(!dateOpen);
|
|
1610
|
+
},
|
|
1611
|
+
children: /* @__PURE__ */ a3(CalendarIcon, {})
|
|
1612
|
+
}
|
|
1613
|
+
),
|
|
1614
|
+
dateOpen && /* @__PURE__ */ a3(
|
|
1615
|
+
"form",
|
|
1616
|
+
{
|
|
1617
|
+
class: "fnc-goto",
|
|
1618
|
+
onSubmit: (e3) => {
|
|
1619
|
+
e3.preventDefault();
|
|
1620
|
+
void go();
|
|
1621
|
+
},
|
|
1622
|
+
onKeyDown: (e3) => e3.key === "Escape" && setDateOpen(false),
|
|
1623
|
+
children: [
|
|
1624
|
+
/* @__PURE__ */ a3("span", { children: t3.goToDate }),
|
|
1625
|
+
/* @__PURE__ */ a3("input", { class: "fnc-input", type: "date", value: date, max: dateInput(Date.now()), onInput: (e3) => setDate(e3.target.value) }),
|
|
1626
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-goto-go", type: "submit", disabled: busy || !date, children: t3.goTo })
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1629
|
+
)
|
|
1630
|
+
] });
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1480
1633
|
// src/components/indicator-dialogs.tsx
|
|
1481
1634
|
import {
|
|
1482
1635
|
maLines,
|
|
@@ -1877,7 +2030,7 @@ function Dialogs({ ctx }) {
|
|
|
1877
2030
|
}
|
|
1878
2031
|
|
|
1879
2032
|
// src/components/interval-picker.tsx
|
|
1880
|
-
import { resolutionToMs } from "@funnest/charts";
|
|
2033
|
+
import { derivedBase as derivedBase2, resolutionToMs } from "@funnest/charts";
|
|
1881
2034
|
|
|
1882
2035
|
// src/components/keep-in-view.ts
|
|
1883
2036
|
var MARGIN = 8;
|
|
@@ -1917,6 +2070,13 @@ var GROUP_LABEL = {
|
|
|
1917
2070
|
hours: "intervalHours",
|
|
1918
2071
|
days: "intervalDays"
|
|
1919
2072
|
};
|
|
2073
|
+
var UNITS = [
|
|
2074
|
+
{ id: "unitMinutes", of: (n2) => String(n2) },
|
|
2075
|
+
{ id: "unitHours", of: (n2) => String(n2 * 60) },
|
|
2076
|
+
{ id: "unitDays", of: (n2) => `${n2}D` },
|
|
2077
|
+
{ id: "unitWeeks", of: (n2) => `${n2}W` },
|
|
2078
|
+
{ id: "unitMonths", of: (n2) => `${n2}M` }
|
|
2079
|
+
];
|
|
1920
2080
|
function IntervalPicker({ ctx }) {
|
|
1921
2081
|
const s3 = useStore(ctx.store);
|
|
1922
2082
|
const t3 = stringsOf(s3);
|
|
@@ -1935,8 +2095,19 @@ function IntervalPicker({ ctx }) {
|
|
|
1935
2095
|
};
|
|
1936
2096
|
}, [open]);
|
|
1937
2097
|
const supported = s3.symbol?.supportedResolutions;
|
|
1938
|
-
const isSupported = (r3) => !supported || supported.includes(r3);
|
|
1939
|
-
const
|
|
2098
|
+
const isSupported = (r3) => !supported || supported.includes(r3) || !!derivedBase2(r3, supported);
|
|
2099
|
+
const listed = new Set(ctx.intervalGroups.flatMap((g3) => g3.intervals));
|
|
2100
|
+
const custom = s3.customIntervals.filter((r3) => !listed.has(r3)).sort((a4, b) => resolutionToMs(a4) - resolutionToMs(b));
|
|
2101
|
+
const order = [...ctx.intervalGroups.flatMap((g3) => g3.intervals), ...custom];
|
|
2102
|
+
const [amount, setAmount] = d2("2");
|
|
2103
|
+
const [unit, setUnit] = d2(1);
|
|
2104
|
+
const add = () => {
|
|
2105
|
+
const n2 = Math.floor(Number(amount));
|
|
2106
|
+
if (!(n2 >= 1 && n2 <= 999)) return;
|
|
2107
|
+
const r3 = UNITS[unit].of(n2);
|
|
2108
|
+
if (!listed.has(r3)) ctx.addCustomInterval(r3);
|
|
2109
|
+
select(r3);
|
|
2110
|
+
};
|
|
1940
2111
|
const favorites = s3.favoriteIntervals;
|
|
1941
2112
|
const byTime = (a4, b) => order.includes(a4) && order.includes(b) ? order.indexOf(a4) - order.indexOf(b) : resolutionToMs(a4) - resolutionToMs(b);
|
|
1942
2113
|
const chips = [.../* @__PURE__ */ new Set([...favorites, ...s3.resolution ? [s3.resolution] : []])].sort(byTime);
|
|
@@ -1971,38 +2142,71 @@ function IntervalPicker({ ctx }) {
|
|
|
1971
2142
|
]
|
|
1972
2143
|
}
|
|
1973
2144
|
),
|
|
1974
|
-
open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-interval-menu", role: "menu", ref: menuRef, children:
|
|
1975
|
-
/* @__PURE__ */ a3("div", { class: "fnc-menu-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
/* @__PURE__ */ a3(
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2145
|
+
open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-interval-menu", role: "menu", ref: menuRef, children: [
|
|
2146
|
+
ctx.intervalGroups.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-menu-group", role: "group", "aria-label": t3[GROUP_LABEL[group.id]], children: [
|
|
2147
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-title", children: t3[GROUP_LABEL[group.id]] }),
|
|
2148
|
+
group.intervals.map((r3) => {
|
|
2149
|
+
const favorite = s3.favoriteIntervals.includes(r3);
|
|
2150
|
+
const ok = isSupported(r3);
|
|
2151
|
+
return /* @__PURE__ */ a3("div", { class: `fnc-menu-row${favorite ? " is-favorite" : ""}`, children: [
|
|
2152
|
+
/* @__PURE__ */ a3(
|
|
2153
|
+
"button",
|
|
2154
|
+
{
|
|
2155
|
+
class: "fnc-menu-item",
|
|
2156
|
+
role: "menuitemradio",
|
|
2157
|
+
"aria-checked": r3 === s3.resolution,
|
|
2158
|
+
disabled: !ok,
|
|
2159
|
+
"data-tip": ok ? void 0 : t3.unsupportedInterval,
|
|
2160
|
+
onClick: () => select(r3),
|
|
2161
|
+
children: resolutionLabel(r3, s3.locale, "long")
|
|
2162
|
+
}
|
|
2163
|
+
),
|
|
2164
|
+
/* @__PURE__ */ a3(
|
|
2165
|
+
"button",
|
|
2166
|
+
{
|
|
2167
|
+
class: "fnc-star",
|
|
2168
|
+
"aria-pressed": favorite,
|
|
2169
|
+
"aria-label": `${resolutionLabel(r3, s3.locale, "long")} ${favorite ? t3.removeFavorite : t3.addFavorite}`,
|
|
2170
|
+
"data-tip": favorite ? t3.removeFavorite : t3.addFavorite,
|
|
2171
|
+
onClick: () => ctx.toggleFavoriteInterval(r3),
|
|
2172
|
+
children: /* @__PURE__ */ a3(StarIcon, { filled: favorite })
|
|
2173
|
+
}
|
|
2174
|
+
)
|
|
2175
|
+
] });
|
|
2176
|
+
})
|
|
2177
|
+
] })),
|
|
2178
|
+
custom.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-menu-group", role: "group", "aria-label": t3.intervalCustom, children: [
|
|
2179
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-title", children: t3.intervalCustom }),
|
|
2180
|
+
custom.map((r3) => {
|
|
2181
|
+
const favorite = s3.favoriteIntervals.includes(r3);
|
|
2182
|
+
const ok = isSupported(r3);
|
|
2183
|
+
return /* @__PURE__ */ a3("div", { class: `fnc-menu-row${favorite ? " is-favorite" : ""}`, children: [
|
|
2184
|
+
/* @__PURE__ */ a3("button", { class: "fnc-menu-item", role: "menuitemradio", "aria-checked": r3 === s3.resolution, disabled: !ok, "data-tip": ok ? void 0 : t3.unsupportedInterval, onClick: () => select(r3), children: resolutionLabel(r3, s3.locale, "long") }),
|
|
2185
|
+
/* @__PURE__ */ a3("button", { class: "fnc-star", "aria-pressed": favorite, "aria-label": `${resolutionLabel(r3, s3.locale, "long")} ${favorite ? t3.removeFavorite : t3.addFavorite}`, "data-tip": favorite ? t3.removeFavorite : t3.addFavorite, onClick: () => ctx.toggleFavoriteInterval(r3), children: /* @__PURE__ */ a3(StarIcon, { filled: favorite }) }),
|
|
2186
|
+
/* @__PURE__ */ a3("button", { class: "fnc-star fnc-interval-remove", "aria-label": `${resolutionLabel(r3, s3.locale, "long")} ${t3.removeInterval}`, "data-tip": t3.removeInterval, onClick: () => ctx.removeCustomInterval(r3), children: /* @__PURE__ */ a3(SmallCloseIcon, {}) })
|
|
2187
|
+
] });
|
|
2188
|
+
})
|
|
2189
|
+
] }),
|
|
2190
|
+
/* @__PURE__ */ a3(
|
|
2191
|
+
"form",
|
|
2192
|
+
{
|
|
2193
|
+
class: "fnc-interval-add",
|
|
2194
|
+
"aria-label": t3.customInterval,
|
|
2195
|
+
onSubmit: (e3) => {
|
|
2196
|
+
e3.preventDefault();
|
|
2197
|
+
add();
|
|
2198
|
+
},
|
|
2199
|
+
children: [
|
|
2200
|
+
/* @__PURE__ */ a3("div", { class: "fnc-menu-title", children: t3.customInterval }),
|
|
2201
|
+
/* @__PURE__ */ a3("div", { class: "fnc-interval-add-row", children: [
|
|
2202
|
+
/* @__PURE__ */ a3("input", { class: "fnc-input", type: "number", min: 1, max: 999, inputMode: "numeric", value: amount, "aria-label": t3.customInterval, onInput: (e3) => setAmount(e3.target.value) }),
|
|
2203
|
+
/* @__PURE__ */ a3("div", { class: "fnc-interval-units", role: "radiogroup", "aria-label": t3.customInterval, children: UNITS.map((u3, i3) => /* @__PURE__ */ a3("button", { type: "button", role: "radio", "aria-checked": unit === i3, class: unit === i3 ? "is-on" : void 0, onClick: () => setUnit(i3), children: t3[u3.id] })) }),
|
|
2204
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn fnc-interval-add-go", type: "submit", children: t3.addInterval })
|
|
2205
|
+
] })
|
|
2206
|
+
]
|
|
2207
|
+
}
|
|
2208
|
+
)
|
|
2209
|
+
] })
|
|
2006
2210
|
] });
|
|
2007
2211
|
}
|
|
2008
2212
|
|
|
@@ -2477,7 +2681,10 @@ var TYPES = [
|
|
|
2477
2681
|
{ type: "candles", label: "candles", icon: CandlesIcon },
|
|
2478
2682
|
{ type: "hollow", label: "hollowCandles", icon: HollowCandlesIcon },
|
|
2479
2683
|
{ type: "heikin", label: "heikinAshi", icon: HeikinAshiIcon },
|
|
2684
|
+
{ type: "bars", label: "ohlcBars", icon: OhlcBarsIcon },
|
|
2480
2685
|
{ type: "line", label: "line", icon: LineChartIcon },
|
|
2686
|
+
{ type: "step", label: "stepLine", icon: StepLineIcon },
|
|
2687
|
+
{ type: "baseline", label: "baseline", icon: BaselineIcon },
|
|
2481
2688
|
{ type: "area", label: "area", icon: AreaChartIcon }
|
|
2482
2689
|
];
|
|
2483
2690
|
var SCALES2 = [
|
|
@@ -3616,6 +3823,18 @@ var CSS = (
|
|
|
3616
3823
|
.fnc-menu-row.is-favorite .fnc-star { opacity: 1; color: #FF9F0A; }
|
|
3617
3824
|
@media (hover: none) { .fnc-star { opacity: 0.5; } }
|
|
3618
3825
|
|
|
3826
|
+
/* \uC9C1\uC811 \uCD94\uAC00: the interval menu's last part \u2014 a number, its unit, \uCD94\uAC00. */
|
|
3827
|
+
.fnc-interval-remove:hover { color: var(--fnc-down, #f04452); }
|
|
3828
|
+
.fnc-menu-row.is-favorite .fnc-interval-remove { color: var(--fnc-text-2); }
|
|
3829
|
+
.fnc-interval-add { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding: 2px 6px 6px; border-top: 1px solid var(--fnc-border); }
|
|
3830
|
+
.fnc-interval-add .fnc-menu-title { padding: 6px 4px 0; }
|
|
3831
|
+
.fnc-interval-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
|
3832
|
+
.fnc-interval-add .fnc-input { flex: 0 0 64px; height: 32px; padding: 0 8px; font-size: 13px; }
|
|
3833
|
+
.fnc-interval-add-go { flex: 1; height: 32px; border-radius: var(--fnc-radius); background: var(--fnc-accent); color: #fff; font-size: 13px; font-weight: 700; }
|
|
3834
|
+
.fnc-interval-units { order: 3; display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 4px; }
|
|
3835
|
+
.fnc-interval-units button { height: 28px; padding: 0 9px; border: 1px solid var(--fnc-border); border-radius: 7px; background: transparent; color: var(--fnc-text-2); font-size: 12px; cursor: pointer; }
|
|
3836
|
+
.fnc-interval-units button.is-on { border-color: var(--fnc-text); color: var(--fnc-text); font-weight: 700; }
|
|
3837
|
+
|
|
3619
3838
|
/* Interval buttons keep their width; host content in the toolbar slot shrinks first. */
|
|
3620
3839
|
.fnc-interval-picker { flex: none; }
|
|
3621
3840
|
|
|
@@ -3911,6 +4130,36 @@ var CSS = (
|
|
|
3911
4130
|
@media (hover: none) {
|
|
3912
4131
|
.fnc-nav { display: none; }
|
|
3913
4132
|
}
|
|
4133
|
+
/* \uAE30\uAC04 \xB7 \uB0A0\uC9DC\uB85C \uC774\uB3D9: a row under the chart. */
|
|
4134
|
+
.fnc-rangebar-host { flex: none; border-top: 1px solid var(--fnc-border); }
|
|
4135
|
+
.fnc-rangebar-host:empty { display: none; }
|
|
4136
|
+
.fnc-ranges { position: relative; display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 6px; }
|
|
4137
|
+
.fnc-ranges-scroll { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
|
|
4138
|
+
.fnc-ranges-scroll::-webkit-scrollbar { display: none; }
|
|
4139
|
+
.fnc-range-sep { flex: none; width: 1px; height: 16px; margin: 0 4px; background: var(--fnc-border); }
|
|
4140
|
+
.fnc-range { flex: none; height: 26px; padding: 0 8px; border-radius: var(--fnc-radius); color: var(--fnc-text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
|
|
4141
|
+
.fnc-range:hover:not(:disabled) { background: var(--fnc-surface); color: var(--fnc-text); }
|
|
4142
|
+
.fnc-range:disabled { opacity: 0.35; cursor: default; }
|
|
4143
|
+
.fnc-range-date { display: flex; align-items: center; padding: 0 6px; }
|
|
4144
|
+
.fnc-goto {
|
|
4145
|
+
position: absolute;
|
|
4146
|
+
z-index: 30;
|
|
4147
|
+
bottom: calc(100% + 6px);
|
|
4148
|
+
left: 6px;
|
|
4149
|
+
display: flex;
|
|
4150
|
+
align-items: center;
|
|
4151
|
+
gap: 6px;
|
|
4152
|
+
padding: 8px;
|
|
4153
|
+
border-radius: calc(var(--fnc-radius) + 4px);
|
|
4154
|
+
background: var(--fnc-bg);
|
|
4155
|
+
box-shadow: 0 6px 20px rgb(0 0 0 / 0.2), 0 0 0 1px var(--fnc-border);
|
|
4156
|
+
white-space: nowrap;
|
|
4157
|
+
font-size: 12px;
|
|
4158
|
+
color: var(--fnc-text-2);
|
|
4159
|
+
}
|
|
4160
|
+
.fnc-goto .fnc-input { height: 32px; font-size: 13px; color-scheme: light dark; }
|
|
4161
|
+
.fnc-goto-go { height: 32px; padding: 0 12px; border-radius: var(--fnc-radius); background: var(--fnc-accent); color: #fff; font-weight: 700; }
|
|
4162
|
+
|
|
3914
4163
|
|
|
3915
4164
|
/* \u2500\u2500 Symbol search \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\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
3916
4165
|
.fnc-backdrop {
|
|
@@ -4203,8 +4452,9 @@ var CSS = (
|
|
|
4203
4452
|
.fnc-tools-menu { width: 300px; padding: 8px; gap: 2px; max-height: 72vh; overflow-y: auto; }
|
|
4204
4453
|
.fnc-tools-section { padding: 8px 6px 6px; font-size: 12px; font-weight: 700; color: var(--fnc-text-2); }
|
|
4205
4454
|
.fnc-tools-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 2px 4px; }
|
|
4206
|
-
.fnc-tools-seg[data-count="5"] { display: grid; grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); gap: 2px; }
|
|
4207
|
-
.fnc-tools-seg[data-count="
|
|
4455
|
+
.fnc-tools-seg[data-count="5"], .fnc-tools-seg[data-count="8"] { display: grid; grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); gap: 2px; }
|
|
4456
|
+
.fnc-tools-seg[data-count="8"] { grid-template-columns: repeat(4, 1fr); }
|
|
4457
|
+
.fnc-tools-seg[data-count="5"] button, .fnc-tools-seg[data-count="8"] button { flex-direction: column; gap: 2px; height: auto; min-height: 40px; padding: 5px 4px; font-size: 12px; white-space: normal; word-break: keep-all; text-align: center; line-height: 1.25; }
|
|
4208
4458
|
.fnc-tools-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 0 6px; }
|
|
4209
4459
|
.fnc-tools-seg svg { width: 16px; height: 16px; flex: none; }
|
|
4210
4460
|
.fnc-tools-layouts { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 4px; }
|
|
@@ -4518,6 +4768,7 @@ function createShell(container, options) {
|
|
|
4518
4768
|
const body = div("fnc-body", root);
|
|
4519
4769
|
const drawbarHost = options.drawingToolbar ? div("fnc-drawbar-host", body) : null;
|
|
4520
4770
|
const main = div("fnc-main", body);
|
|
4771
|
+
const rangeHost = div("fnc-rangebar-host", main);
|
|
4521
4772
|
main.appendChild(slots.bottom);
|
|
4522
4773
|
root.appendChild(slots.footer);
|
|
4523
4774
|
const refreshScheme = () => {
|
|
@@ -4528,6 +4779,7 @@ function createShell(container, options) {
|
|
|
4528
4779
|
const onSchemeChange = () => scheme === "system" && refreshScheme();
|
|
4529
4780
|
darkQuery?.addEventListener?.("change", onSchemeChange);
|
|
4530
4781
|
let favoriteIntervals = storage.get("favorite-intervals", [...options.favoriteIntervals]);
|
|
4782
|
+
let customIntervals = storage.get("custom-intervals", []);
|
|
4531
4783
|
let drawbarCollapsed = storage.get("drawbar-collapsed", false);
|
|
4532
4784
|
let favoriteTools = storage.get("favorite-tools", []);
|
|
4533
4785
|
let keepDrawing = storage.get("keep-drawing", false);
|
|
@@ -4550,10 +4802,11 @@ function createShell(container, options) {
|
|
|
4550
4802
|
body,
|
|
4551
4803
|
drawbarHost,
|
|
4552
4804
|
main,
|
|
4805
|
+
rangeHost,
|
|
4553
4806
|
slots,
|
|
4554
4807
|
storage,
|
|
4555
4808
|
theme: () => theme,
|
|
4556
|
-
sharedState: () => ({ fullscreen: isFullscreen(), favoriteIntervals, drawbarCollapsed, favoriteTools, keepDrawing, cursorMode }),
|
|
4809
|
+
sharedState: () => ({ fullscreen: isFullscreen(), favoriteIntervals, customIntervals, drawbarCollapsed, favoriteTools, keepDrawing, cursorMode }),
|
|
4557
4810
|
setCursorMode: (mode) => {
|
|
4558
4811
|
cursorMode = mode;
|
|
4559
4812
|
storage.set("cursor-mode", mode);
|
|
@@ -4603,6 +4856,21 @@ function createShell(container, options) {
|
|
|
4603
4856
|
storage.set("drawbar-collapsed", collapsed);
|
|
4604
4857
|
broadcast({ drawbarCollapsed });
|
|
4605
4858
|
},
|
|
4859
|
+
addCustomInterval: (res) => {
|
|
4860
|
+
if (customIntervals.includes(res)) return;
|
|
4861
|
+
customIntervals = [...customIntervals, res];
|
|
4862
|
+
storage.set("custom-intervals", customIntervals);
|
|
4863
|
+
broadcast({ customIntervals });
|
|
4864
|
+
},
|
|
4865
|
+
removeCustomInterval: (res) => {
|
|
4866
|
+
customIntervals = customIntervals.filter((r3) => r3 !== res);
|
|
4867
|
+
storage.set("custom-intervals", customIntervals);
|
|
4868
|
+
if (favoriteIntervals.includes(res)) {
|
|
4869
|
+
favoriteIntervals = favoriteIntervals.filter((r3) => r3 !== res);
|
|
4870
|
+
storage.set("favorite-intervals", favoriteIntervals);
|
|
4871
|
+
}
|
|
4872
|
+
broadcast({ customIntervals, favoriteIntervals });
|
|
4873
|
+
},
|
|
4606
4874
|
toggleFavoriteInterval: (res) => {
|
|
4607
4875
|
favoriteIntervals = favoriteIntervals.includes(res) ? favoriteIntervals.filter((r3) => r3 !== res) : [...favoriteIntervals, res];
|
|
4608
4876
|
storage.set("favorite-intervals", favoriteIntervals);
|
|
@@ -4786,6 +5054,8 @@ function createPane(shell, config) {
|
|
|
4786
5054
|
if (current) void load(current.symbol, res);
|
|
4787
5055
|
},
|
|
4788
5056
|
toggleFavoriteInterval: shell.toggleFavoriteInterval,
|
|
5057
|
+
addCustomInterval: shell.addCustomInterval,
|
|
5058
|
+
removeCustomInterval: shell.removeCustomInterval,
|
|
4789
5059
|
toggleFavoriteTool: shell.toggleFavoriteTool,
|
|
4790
5060
|
setKeepDrawing: shell.setKeepDrawing,
|
|
4791
5061
|
setCursorMode: shell.setCursorMode,
|
|
@@ -4897,10 +5167,11 @@ function createTradingChart(container, options) {
|
|
|
4897
5167
|
onIndicatorsClick,
|
|
4898
5168
|
strings
|
|
4899
5169
|
});
|
|
4900
|
-
shell.main.insertBefore(pane.stage, shell.
|
|
5170
|
+
shell.main.insertBefore(pane.stage, shell.rangeHost);
|
|
4901
5171
|
shell.setPanes(() => [pane]);
|
|
4902
5172
|
const unbindKeys = bindWidgetKeys(shell, () => pane, searchHotkey);
|
|
4903
5173
|
Q(/* @__PURE__ */ a3(Toolbar, { ctx: pane.ctx }), shell.toolbarHost);
|
|
5174
|
+
Q(/* @__PURE__ */ a3(RangeBar, { ctx: pane.ctx }), shell.rangeHost);
|
|
4904
5175
|
if (shell.drawbarHost) Q(/* @__PURE__ */ a3(DrawingToolbar, { ctx: pane.ctx }), shell.drawbarHost);
|
|
4905
5176
|
void pane.load(symbol, resolution);
|
|
4906
5177
|
return {
|
|
@@ -4993,7 +5264,7 @@ function createMultiChart(container, options) {
|
|
|
4993
5264
|
const tabsHost = div("fnc-pane-tabs-host");
|
|
4994
5265
|
shell.root.insertBefore(tabsHost, shell.body);
|
|
4995
5266
|
const grid = div("fnc-grid");
|
|
4996
|
-
shell.main.insertBefore(grid, shell.
|
|
5267
|
+
shell.main.insertBefore(grid, shell.rangeHost);
|
|
4997
5268
|
const parking = div("fnc-parking", shell.root);
|
|
4998
5269
|
const listeners = /* @__PURE__ */ new Map();
|
|
4999
5270
|
const emit = (event, payload) => {
|
|
@@ -5168,6 +5439,7 @@ function createMultiChart(container, options) {
|
|
|
5168
5439
|
function bindToolbar() {
|
|
5169
5440
|
const pane = panes[store.get().active];
|
|
5170
5441
|
Q(/* @__PURE__ */ a3(Toolbar, { ctx: pane.ctx }, store.get().active), shell.toolbarHost);
|
|
5442
|
+
Q(/* @__PURE__ */ a3(RangeBar, { ctx: pane.ctx }, store.get().active), shell.rangeHost);
|
|
5171
5443
|
if (shell.drawbarHost) Q(/* @__PURE__ */ a3(DrawingToolbar, { ctx: pane.ctx }, store.get().active), shell.drawbarHost);
|
|
5172
5444
|
}
|
|
5173
5445
|
function activate(index) {
|
package/dist/shell.d.ts
CHANGED
|
@@ -56,13 +56,15 @@ export interface Shell {
|
|
|
56
56
|
readonly toolbarHost: HTMLElement;
|
|
57
57
|
readonly body: HTMLElement;
|
|
58
58
|
readonly drawbarHost: HTMLElement | null;
|
|
59
|
-
/** Column right of the drawing bar: put the chart stage (or pane grid) here, before `
|
|
59
|
+
/** Column right of the drawing bar: put the chart stage (or pane grid) here, before `rangeHost`. */
|
|
60
60
|
readonly main: HTMLElement;
|
|
61
|
+
/** Under the chart: the 기간 / 날짜로 이동 bar (the active pane's). */
|
|
62
|
+
readonly rangeHost: HTMLElement;
|
|
61
63
|
readonly slots: TradingChartSlots;
|
|
62
64
|
readonly storage: WidgetStorage;
|
|
63
65
|
theme(): ThemeTokens;
|
|
64
66
|
/** Initial UI-state fields owned by the shell (same for every pane). */
|
|
65
|
-
sharedState(): Pick<UiState, 'fullscreen' | 'favoriteIntervals' | 'drawbarCollapsed' | 'favoriteTools' | 'keepDrawing' | 'cursorMode'>;
|
|
67
|
+
sharedState(): Pick<UiState, 'fullscreen' | 'favoriteIntervals' | 'customIntervals' | 'drawbarCollapsed' | 'favoriteTools' | 'keepDrawing' | 'cursorMode'>;
|
|
66
68
|
setCursorMode(mode: CursorMode): void;
|
|
67
69
|
/** Each tool's last color / style (saved; every pane starts with it). */
|
|
68
70
|
drawingDefaults(): DrawingDefaults;
|
|
@@ -77,6 +79,8 @@ export interface Shell {
|
|
|
77
79
|
toggleFullscreen(): void;
|
|
78
80
|
setDrawbarCollapsed(collapsed: boolean): void;
|
|
79
81
|
toggleFavoriteInterval(resolution: Resolution): void;
|
|
82
|
+
addCustomInterval(resolution: Resolution): void;
|
|
83
|
+
removeCustomInterval(resolution: Resolution): void;
|
|
80
84
|
destroy(): void;
|
|
81
85
|
}
|
|
82
86
|
export declare function createShell(container: HTMLElement, options: ShellOptions): Shell;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"NOTICE"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@funnest/charts": "0.
|
|
45
|
+
"@funnest/charts": "0.8.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|