@funnest/charts-ui 0.6.27 → 0.6.29
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/context-menu.d.ts +1 -1
- package/dist/components/drawing-toolbar.d.ts +1 -1
- package/dist/components/indicator-dialogs.d.ts +1 -1
- package/dist/components/interval-picker.d.ts +1 -1
- package/dist/components/layout-menu.d.ts +1 -1
- package/dist/components/overlay.d.ts +1 -1
- package/dist/components/settings-dialog.d.ts +1 -1
- package/dist/components/symbol-search.d.ts +1 -1
- package/dist/components/toolbar.d.ts +1 -1
- package/dist/components/tools-menu.d.ts +1 -1
- package/dist/context.d.ts +8 -5
- package/dist/i18n.d.ts +18 -0
- package/dist/icons.d.ts +4 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +201 -9
- package/dist/multi-chart.d.ts +4 -4
- package/dist/pane.d.ts +4 -4
- package/dist/shell.d.ts +7 -5
- package/dist/trading-chart.d.ts +4 -4
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WidgetContext } from '../context';
|
|
1
|
+
import type { WidgetContext } from '../context.js';
|
|
2
2
|
/**
|
|
3
3
|
* Right-click menu on the chart (mouse only): undo/redo, the host's own items
|
|
4
4
|
* (`contextMenuItems`), a horizontal line at the clicked price, reset and settings.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'preact';
|
|
2
|
-
import type { WidgetContext } from '../context';
|
|
2
|
+
import type { WidgetContext } from '../context.js';
|
|
3
3
|
/** Left vertical tool bar (TradingView layout). On narrow screens it slides in over the chart. */
|
|
4
4
|
export declare function DrawingToolbar({ ctx }: {
|
|
5
5
|
ctx: WidgetContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WidgetContext } from '../context';
|
|
1
|
+
import type { WidgetContext } from '../context.js';
|
|
2
2
|
/**
|
|
3
3
|
* Favorite intervals as toolbar chips + a grouped menu (분 | 시간 | 일) where hovering a row
|
|
4
4
|
* reveals a ★ to pin/unpin it. On narrow screens only the menu trigger (showing the current
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WidgetContext } from '../context';
|
|
1
|
+
import type { WidgetContext } from '../context.js';
|
|
2
2
|
/**
|
|
3
3
|
* Symbol search: category tabs, an exchange/favorites sidebar (exchange filter shows as a chip
|
|
4
4
|
* in the input), ★ favorites, recent searches, match highlighting and — when the datafeed
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSX } from 'preact';
|
|
2
|
-
import type { WidgetContext } from '../context';
|
|
2
|
+
import type { WidgetContext } from '../context.js';
|
|
3
3
|
/**
|
|
4
4
|
* One "도구" button for the chart's less frequent tools, so the toolbar keeps symbol, interval,
|
|
5
5
|
* market info and 지표 in view: chart type, split layout (+ sync), compare, replay, price axis,
|
package/dist/context.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Chart, ChartContextMenu, ChartLayout, ChartType, CompareInfo, Datafeed, Drawing, DrawingType, IndicatorConfig, LegendItem, Locale, ReplayStatus, Resolution, SymbolInfo } from '@funnest/charts';
|
|
2
|
-
import type { LayoutId } from './layouts';
|
|
3
|
-
import type { WidgetStorage } from './storage';
|
|
4
|
-
import type { Strings } from './i18n';
|
|
5
|
-
import type { Store } from './store';
|
|
1
|
+
import type { Chart, ChartContextMenu, ChartLayout, ChartType, CompareInfo, CursorMode, Datafeed, Drawing, DrawingType, IndicatorConfig, LegendItem, Locale, ReplayStatus, Resolution, SymbolInfo } from '@funnest/charts';
|
|
2
|
+
import type { LayoutId } from './layouts.js';
|
|
3
|
+
import type { WidgetStorage } from './storage.js';
|
|
4
|
+
import type { Strings } from './i18n.js';
|
|
5
|
+
import type { Store } from './store.js';
|
|
6
6
|
export interface UiState {
|
|
7
7
|
locale: Locale;
|
|
8
8
|
/** The app's replacements for built-in words (TradingChartOptions.strings). */
|
|
@@ -45,6 +45,8 @@ export interface UiState {
|
|
|
45
45
|
keepDrawing: boolean;
|
|
46
46
|
/** Every drawing hidden (the drawing bar's 👁). */
|
|
47
47
|
drawingsHidden: boolean;
|
|
48
|
+
/** How the pointer looks (the drawing bar's cursor menu; same in every pane). */
|
|
49
|
+
cursorMode: CursorMode;
|
|
48
50
|
canUndo: boolean;
|
|
49
51
|
canRedo: boolean;
|
|
50
52
|
compares: CompareInfo[];
|
|
@@ -137,6 +139,7 @@ export interface WidgetContext {
|
|
|
137
139
|
toggleFavoriteInterval(resolution: Resolution): void;
|
|
138
140
|
toggleFavoriteTool(tool: DrawingType): void;
|
|
139
141
|
setKeepDrawing(on: boolean): void;
|
|
142
|
+
setCursorMode(mode: CursorMode): void;
|
|
140
143
|
/** Hides or shows the drawings of every pane. */
|
|
141
144
|
setDrawingsHidden(hidden: boolean): void;
|
|
142
145
|
setSearchOpen(open: boolean, target?: 'symbol' | 'compare'): void;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -30,6 +30,12 @@ export declare const STRINGS: {
|
|
|
30
30
|
fibonacci: string;
|
|
31
31
|
removeAll: string;
|
|
32
32
|
keepDrawing: string;
|
|
33
|
+
cursorModes: string;
|
|
34
|
+
cursorCross: string;
|
|
35
|
+
cursorDot: string;
|
|
36
|
+
cursorArrow: string;
|
|
37
|
+
cursorDemo: string;
|
|
38
|
+
cursorEraser: string;
|
|
33
39
|
lockAll: string;
|
|
34
40
|
unlockAll: string;
|
|
35
41
|
hideAll: string;
|
|
@@ -101,6 +107,9 @@ export declare const STRINGS: {
|
|
|
101
107
|
addIndicator: string;
|
|
102
108
|
indicatorSettings: string;
|
|
103
109
|
removeIndicator: string;
|
|
110
|
+
moveIndicatorUp: string;
|
|
111
|
+
moveIndicatorDown: string;
|
|
112
|
+
textEditHint: string;
|
|
104
113
|
hideVolume: string;
|
|
105
114
|
volumeDesc: string;
|
|
106
115
|
apply: string;
|
|
@@ -185,6 +194,12 @@ export declare const STRINGS: {
|
|
|
185
194
|
fibonacci: string;
|
|
186
195
|
removeAll: string;
|
|
187
196
|
keepDrawing: string;
|
|
197
|
+
cursorModes: string;
|
|
198
|
+
cursorCross: string;
|
|
199
|
+
cursorDot: string;
|
|
200
|
+
cursorArrow: string;
|
|
201
|
+
cursorDemo: string;
|
|
202
|
+
cursorEraser: string;
|
|
188
203
|
lockAll: string;
|
|
189
204
|
unlockAll: string;
|
|
190
205
|
hideAll: string;
|
|
@@ -256,6 +271,9 @@ export declare const STRINGS: {
|
|
|
256
271
|
addIndicator: string;
|
|
257
272
|
indicatorSettings: string;
|
|
258
273
|
removeIndicator: string;
|
|
274
|
+
moveIndicatorUp: string;
|
|
275
|
+
moveIndicatorDown: string;
|
|
276
|
+
textEditHint: string;
|
|
259
277
|
hideVolume: string;
|
|
260
278
|
volumeDesc: string;
|
|
261
279
|
apply: string;
|
package/dist/icons.d.ts
CHANGED
|
@@ -61,6 +61,10 @@ export declare const PaletteIcon: () => import("preact").JSX.Element;
|
|
|
61
61
|
export declare const LockIcon: ({ open }: {
|
|
62
62
|
open?: boolean;
|
|
63
63
|
}) => import("preact").JSX.Element;
|
|
64
|
+
export declare const CrossCursorIcon: () => import("preact").JSX.Element;
|
|
65
|
+
export declare const DotCursorIcon: () => import("preact").JSX.Element;
|
|
66
|
+
export declare const DemoCursorIcon: () => import("preact").JSX.Element;
|
|
67
|
+
export declare const EraserIcon: () => import("preact").JSX.Element;
|
|
64
68
|
/** 연속 그리기: a pencil that keeps going. */
|
|
65
69
|
export declare const KeepDrawingIcon: () => import("preact").JSX.Element;
|
|
66
70
|
export declare const DrawingsEyeIcon: ({ off }: {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Preact is bundled internally; only a vanilla API is exposed, so consumers
|
|
4
4
|
* need no framework (React/Vue/Svelte/plain HTML all work).
|
|
5
5
|
*/
|
|
6
|
-
export { createTradingChart, DEFAULT_FAVORITE_INTERVALS, DEFAULT_INTERVAL_GROUPS, DEFAULT_SEARCH_CATEGORIES, } from './trading-chart';
|
|
7
|
-
export { createMultiChart } from './multi-chart';
|
|
8
|
-
export type { MultiChart, MultiChartEvents, MultiChartOptions, MultiChartState, PaneSpec } from './multi-chart';
|
|
9
|
-
export { LAYOUT_GROUPS, LAYOUTS, MAX_PANES, paneCount } from './layouts';
|
|
10
|
-
export type { LayoutId, SplitNode, SplitSizes } from './layouts';
|
|
11
|
-
export type { ContextMenuItem, ContextMenuItems, IntervalGroup, LayoutSync, LegendValues, SearchCategory, SearchExchange, ToolsMenuItem, ToolsMenuItems } from './context';
|
|
12
|
-
export type { ColorScheme, TradingChart, TradingChartOptions, TradingChartSlots } from './trading-chart';
|
|
13
|
-
export { resolutionLabel, STRINGS, stringsOf, type Strings } from './i18n';
|
|
6
|
+
export { createTradingChart, DEFAULT_FAVORITE_INTERVALS, DEFAULT_INTERVAL_GROUPS, DEFAULT_SEARCH_CATEGORIES, } from './trading-chart.js';
|
|
7
|
+
export { createMultiChart } from './multi-chart.js';
|
|
8
|
+
export type { MultiChart, MultiChartEvents, MultiChartOptions, MultiChartState, PaneSpec } from './multi-chart.js';
|
|
9
|
+
export { LAYOUT_GROUPS, LAYOUTS, MAX_PANES, paneCount } from './layouts.js';
|
|
10
|
+
export type { LayoutId, SplitNode, SplitSizes } from './layouts.js';
|
|
11
|
+
export type { ContextMenuItem, ContextMenuItems, IntervalGroup, LayoutSync, LegendValues, SearchCategory, SearchExchange, ToolsMenuItem, ToolsMenuItems } from './context.js';
|
|
12
|
+
export type { ColorScheme, TradingChart, TradingChartOptions, TradingChartSlots } from './trading-chart.js';
|
|
13
|
+
export { resolutionLabel, STRINGS, stringsOf, type Strings } from './i18n.js';
|
package/dist/index.js
CHANGED
|
@@ -456,6 +456,12 @@ var STRINGS = {
|
|
|
456
456
|
fibonacci: "\uD53C\uBCF4\uB098\uCE58 \uB418\uB3CC\uB9BC",
|
|
457
457
|
removeAll: "\uADF8\uB9AC\uAE30 \uBAA8\uB450 \uC0AD\uC81C",
|
|
458
458
|
keepDrawing: "\uC5F0\uC18D \uADF8\uB9AC\uAE30 (\uB3C4\uAD6C \uC720\uC9C0)",
|
|
459
|
+
cursorModes: "\uCEE4\uC11C \uC885\uB958",
|
|
460
|
+
cursorCross: "\uC2ED\uC790",
|
|
461
|
+
cursorDot: "\uC810",
|
|
462
|
+
cursorArrow: "\uD654\uC0B4\uD45C",
|
|
463
|
+
cursorDemo: "\uB370\uBAA8 \uCEE4\uC11C",
|
|
464
|
+
cursorEraser: "\uC9C0\uC6B0\uAC1C",
|
|
459
465
|
lockAll: "\uADF8\uB9BC \uBAA8\uB450 \uC7A0\uADF8\uAE30",
|
|
460
466
|
unlockAll: "\uADF8\uB9BC \uBAA8\uB450 \uC7A0\uAE08 \uD480\uAE30",
|
|
461
467
|
hideAll: "\uADF8\uB9BC \uBAA8\uB450 \uC228\uAE30\uAE30",
|
|
@@ -527,6 +533,9 @@ var STRINGS = {
|
|
|
527
533
|
addIndicator: "\uC9C0\uD45C \uCD94\uAC00",
|
|
528
534
|
indicatorSettings: "\uC9C0\uD45C \uC124\uC815",
|
|
529
535
|
removeIndicator: "\uC9C0\uD45C \uC0AD\uC81C",
|
|
536
|
+
moveIndicatorUp: "\uC704\uB85C \uC62E\uAE30\uAE30",
|
|
537
|
+
moveIndicatorDown: "\uC544\uB798\uB85C \uC62E\uAE30\uAE30",
|
|
538
|
+
textEditHint: "Enter\uB85C \uC800\uC7A5 \xB7 Shift+Enter \uC904\uBC14\uAFC8 \xB7 Esc \uCDE8\uC18C",
|
|
530
539
|
hideVolume: "\uAC70\uB798\uB7C9 \uC228\uAE30\uAE30",
|
|
531
540
|
volumeDesc: "\uBD09\uB9C8\uB2E4 \uAC70\uB798\uB41C \uC591 (\uAC00\uACA9 \uC544\uB798 \uC601\uC5ED)",
|
|
532
541
|
apply: "\uC801\uC6A9",
|
|
@@ -613,6 +622,12 @@ var STRINGS = {
|
|
|
613
622
|
fibonacci: "Fib retracement",
|
|
614
623
|
removeAll: "Remove all drawings",
|
|
615
624
|
keepDrawing: "Stay in drawing mode",
|
|
625
|
+
cursorModes: "Cursors",
|
|
626
|
+
cursorCross: "Cross",
|
|
627
|
+
cursorDot: "Dot",
|
|
628
|
+
cursorArrow: "Arrow",
|
|
629
|
+
cursorDemo: "Demonstration",
|
|
630
|
+
cursorEraser: "Eraser",
|
|
616
631
|
lockAll: "Lock all drawings",
|
|
617
632
|
unlockAll: "Unlock all drawings",
|
|
618
633
|
hideAll: "Hide all drawings",
|
|
@@ -684,6 +699,9 @@ var STRINGS = {
|
|
|
684
699
|
addIndicator: "Add indicator",
|
|
685
700
|
indicatorSettings: "Indicator settings",
|
|
686
701
|
removeIndicator: "Remove indicator",
|
|
702
|
+
moveIndicatorUp: "Move up",
|
|
703
|
+
moveIndicatorDown: "Move down",
|
|
704
|
+
textEditHint: "Enter to save \xB7 Shift+Enter for a new line \xB7 Esc to cancel",
|
|
687
705
|
hideVolume: "Hide volume",
|
|
688
706
|
volumeDesc: "How much traded in each bar (pane under the price)",
|
|
689
707
|
apply: "Apply",
|
|
@@ -904,6 +922,16 @@ var LockIcon = ({ open = false }) => /* @__PURE__ */ a3(Icon, { children: [
|
|
|
904
922
|
/* @__PURE__ */ a3("rect", { x: "4.5", y: "9", width: "11", height: "8", rx: "1.8" }),
|
|
905
923
|
/* @__PURE__ */ a3("path", { d: open ? "M7 9V6.5a3 3 0 0 1 5.8-1" : "M7 9V6.5a3 3 0 0 1 6 0V9" })
|
|
906
924
|
] });
|
|
925
|
+
var CrossCursorIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("path", { d: "M10 3v14M3 10h14" }) });
|
|
926
|
+
var DotCursorIcon = () => /* @__PURE__ */ a3(Icon, { children: /* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.6", fill: "currentColor" }) });
|
|
927
|
+
var DemoCursorIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
928
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "6.5", opacity: "0.5" }),
|
|
929
|
+
/* @__PURE__ */ a3("circle", { cx: "10", cy: "10", r: "2.2", fill: "currentColor" })
|
|
930
|
+
] });
|
|
931
|
+
var EraserIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
932
|
+
/* @__PURE__ */ a3("path", { d: "M3 13.5 11.5 5l5 5L9.5 17H6z" }),
|
|
933
|
+
/* @__PURE__ */ a3("path", { d: "M7 9.5l5 5" })
|
|
934
|
+
] });
|
|
907
935
|
var KeepDrawingIcon = () => /* @__PURE__ */ a3(Icon, { children: [
|
|
908
936
|
/* @__PURE__ */ a3("path", { d: "M3.5 13.5 11 6l3 3-7.5 7.5H3.5z" }),
|
|
909
937
|
/* @__PURE__ */ a3("path", { d: "M13 3.5a3.5 3.5 0 0 1 3.5 3.5M15 2l1.5 1.5L15 5" })
|
|
@@ -1036,6 +1064,59 @@ function ToolGroup({
|
|
|
1036
1064
|
}) })
|
|
1037
1065
|
] });
|
|
1038
1066
|
}
|
|
1067
|
+
var CURSORS = [
|
|
1068
|
+
{ mode: "cross", label: "cursorCross", Icon: CrossCursorIcon },
|
|
1069
|
+
{ mode: "dot", label: "cursorDot", Icon: DotCursorIcon },
|
|
1070
|
+
{ mode: "arrow", label: "cursorArrow", Icon: CursorIcon },
|
|
1071
|
+
{ mode: "demo", label: "cursorDemo", Icon: DemoCursorIcon },
|
|
1072
|
+
{ mode: "eraser", label: "cursorEraser", Icon: EraserIcon }
|
|
1073
|
+
];
|
|
1074
|
+
function CursorGroup({ ctx, open, onOpen, onPick }) {
|
|
1075
|
+
const s3 = useStore(ctx.store);
|
|
1076
|
+
const t3 = stringsOf(s3);
|
|
1077
|
+
const ref = T2(null);
|
|
1078
|
+
const current = CURSORS.find((c3) => c3.mode === s3.cursorMode) ?? CURSORS[0];
|
|
1079
|
+
A2(() => {
|
|
1080
|
+
if (!open) return;
|
|
1081
|
+
const close = (e3) => !ref.current?.contains(e3.target) && onOpen(false);
|
|
1082
|
+
const esc = (e3) => e3.key === "Escape" && onOpen(false);
|
|
1083
|
+
document.addEventListener("pointerdown", close, true);
|
|
1084
|
+
document.addEventListener("keydown", esc);
|
|
1085
|
+
return () => {
|
|
1086
|
+
document.removeEventListener("pointerdown", close, true);
|
|
1087
|
+
document.removeEventListener("keydown", esc);
|
|
1088
|
+
};
|
|
1089
|
+
}, [open]);
|
|
1090
|
+
const name = `${t3.cursor}: ${t3[current.label]}`;
|
|
1091
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-tool-group", ref, "data-open": open, children: [
|
|
1092
|
+
/* @__PURE__ */ a3("button", { class: "fnc-btn", "data-tip": name, "aria-label": name, "aria-pressed": s3.drawingTool === null, onClick: onPick, children: /* @__PURE__ */ a3(current.Icon, {}) }),
|
|
1093
|
+
/* @__PURE__ */ a3("button", { class: "fnc-tool-more", "aria-label": `${t3.cursorModes}: ${t3[current.label]}`, "aria-haspopup": "menu", "aria-expanded": open, onClick: () => onOpen(!open), children: [
|
|
1094
|
+
/* @__PURE__ */ a3("span", { class: "fnc-tool-corner", children: /* @__PURE__ */ a3(CornerIcon, {}) }),
|
|
1095
|
+
/* @__PURE__ */ a3("span", { class: "fnc-tool-chevron", children: /* @__PURE__ */ a3(ChevronRightIcon, {}) })
|
|
1096
|
+
] }),
|
|
1097
|
+
open && /* @__PURE__ */ a3("div", { class: "fnc-menu fnc-tool-menu", role: "menu", children: [
|
|
1098
|
+
/* @__PURE__ */ a3("div", { class: "fnc-tool-section", role: "presentation", children: t3.cursorModes }),
|
|
1099
|
+
CURSORS.map((c3) => /* @__PURE__ */ a3(
|
|
1100
|
+
"button",
|
|
1101
|
+
{
|
|
1102
|
+
class: "fnc-menu-item",
|
|
1103
|
+
role: "menuitemradio",
|
|
1104
|
+
"aria-checked": c3.mode === current.mode,
|
|
1105
|
+
onClick: () => {
|
|
1106
|
+
ctx.setCursorMode(c3.mode);
|
|
1107
|
+
onOpen(false);
|
|
1108
|
+
onPick();
|
|
1109
|
+
},
|
|
1110
|
+
children: [
|
|
1111
|
+
/* @__PURE__ */ a3(c3.Icon, {}),
|
|
1112
|
+
/* @__PURE__ */ a3("span", { children: t3[c3.label] })
|
|
1113
|
+
]
|
|
1114
|
+
},
|
|
1115
|
+
c3.mode
|
|
1116
|
+
))
|
|
1117
|
+
] })
|
|
1118
|
+
] });
|
|
1119
|
+
}
|
|
1039
1120
|
function DrawingToolbar({ ctx }) {
|
|
1040
1121
|
const s3 = useStore(ctx.store);
|
|
1041
1122
|
const t3 = stringsOf(s3);
|
|
@@ -1044,14 +1125,14 @@ function DrawingToolbar({ ctx }) {
|
|
|
1044
1125
|
F2(() => {
|
|
1045
1126
|
const el = barRef.current;
|
|
1046
1127
|
if (!el) return;
|
|
1047
|
-
const
|
|
1128
|
+
const fit2 = () => {
|
|
1048
1129
|
el.removeAttribute("data-fit");
|
|
1049
1130
|
if (el.scrollHeight <= el.clientHeight) return;
|
|
1050
1131
|
el.dataset.fit = "compact";
|
|
1051
1132
|
if (el.scrollHeight > el.clientHeight) el.dataset.fit = "scroll";
|
|
1052
1133
|
};
|
|
1053
|
-
|
|
1054
|
-
const ro = new ResizeObserver(
|
|
1134
|
+
fit2();
|
|
1135
|
+
const ro = new ResizeObserver(fit2);
|
|
1055
1136
|
ro.observe(el);
|
|
1056
1137
|
return () => ro.disconnect();
|
|
1057
1138
|
}, []);
|
|
@@ -1077,7 +1158,7 @@ function DrawingToolbar({ ctx }) {
|
|
|
1077
1158
|
"data-open": s3.drawbarOpen,
|
|
1078
1159
|
"data-collapsed": s3.drawbarCollapsed,
|
|
1079
1160
|
children: [
|
|
1080
|
-
/* @__PURE__ */ a3(
|
|
1161
|
+
/* @__PURE__ */ a3(CursorGroup, { ctx, open: openGroup === "__cursor", onOpen: (open) => setOpenGroup(open ? "__cursor" : null), onPick: () => pick(null) }),
|
|
1081
1162
|
favorites.length > 0 && /* @__PURE__ */ a3($, { children: [
|
|
1082
1163
|
favorites.map((def) => /* @__PURE__ */ a3(
|
|
1083
1164
|
"button",
|
|
@@ -1788,7 +1869,7 @@ function useKeepInView(open) {
|
|
|
1788
1869
|
const el = ref.current;
|
|
1789
1870
|
if (!open || !el) return;
|
|
1790
1871
|
el.style.translate = "";
|
|
1791
|
-
const
|
|
1872
|
+
const fit2 = () => {
|
|
1792
1873
|
el.style.translate = "";
|
|
1793
1874
|
el.style.maxHeight = "";
|
|
1794
1875
|
const r3 = el.getBoundingClientRect();
|
|
@@ -1805,9 +1886,9 @@ function useKeepInView(open) {
|
|
|
1805
1886
|
if (r3.left + dx < minX) dx = minX - r3.left;
|
|
1806
1887
|
if (dx) el.style.translate = `${Math.round(dx)}px 0`;
|
|
1807
1888
|
};
|
|
1808
|
-
|
|
1809
|
-
window.addEventListener("resize",
|
|
1810
|
-
return () => window.removeEventListener("resize",
|
|
1889
|
+
fit2();
|
|
1890
|
+
window.addEventListener("resize", fit2);
|
|
1891
|
+
return () => window.removeEventListener("resize", fit2);
|
|
1811
1892
|
}, [open]);
|
|
1812
1893
|
return ref;
|
|
1813
1894
|
}
|
|
@@ -2725,6 +2806,14 @@ function IndicatorItem({ ctx, item }) {
|
|
|
2725
2806
|
/* @__PURE__ */ a3("span", { class: "fnc-ind-title", children: item.title }),
|
|
2726
2807
|
item.visible && item.values.map((v3) => /* @__PURE__ */ a3("b", { style: { color: v3.color }, "data-tip": v3.label, children: v3.value })),
|
|
2727
2808
|
/* @__PURE__ */ a3("span", { class: "fnc-ind-actions", children: [
|
|
2809
|
+
ctx.chart.canMoveIndicator(item.id, -1) && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.moveIndicatorUp, "aria-label": `${item.title} ${t3.moveIndicatorUp}`, onClick: (e3) => {
|
|
2810
|
+
e3.stopPropagation();
|
|
2811
|
+
ctx.chart.moveIndicator(item.id, -1);
|
|
2812
|
+
}, children: /* @__PURE__ */ a3(ChevronUpIcon, {}) }),
|
|
2813
|
+
ctx.chart.canMoveIndicator(item.id, 1) && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.moveIndicatorDown, "aria-label": `${item.title} ${t3.moveIndicatorDown}`, onClick: (e3) => {
|
|
2814
|
+
e3.stopPropagation();
|
|
2815
|
+
ctx.chart.moveIndicator(item.id, 1);
|
|
2816
|
+
}, children: /* @__PURE__ */ a3(ChevronDownIcon, {}) }),
|
|
2728
2817
|
/* @__PURE__ */ a3(
|
|
2729
2818
|
"button",
|
|
2730
2819
|
{
|
|
@@ -2777,6 +2866,8 @@ function VolumeItem({ ctx, value }) {
|
|
|
2777
2866
|
/* @__PURE__ */ a3("span", { class: "fnc-ind-title", children: t3.settingVolume }),
|
|
2778
2867
|
value !== null && /* @__PURE__ */ a3("b", { class: "fnc-flat", children: value }),
|
|
2779
2868
|
/* @__PURE__ */ a3("span", { class: "fnc-ind-actions", children: [
|
|
2869
|
+
ctx.chart.canMoveIndicator("volume", -1) && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.moveIndicatorUp, "aria-label": `${t3.settingVolume} ${t3.moveIndicatorUp}`, onClick: () => ctx.chart.moveIndicator("volume", -1), children: /* @__PURE__ */ a3(ChevronUpIcon, {}) }),
|
|
2870
|
+
ctx.chart.canMoveIndicator("volume", 1) && /* @__PURE__ */ a3("button", { class: "fnc-ind-btn", "data-tip": t3.moveIndicatorDown, "aria-label": `${t3.settingVolume} ${t3.moveIndicatorDown}`, onClick: () => ctx.chart.moveIndicator("volume", 1), children: /* @__PURE__ */ a3(ChevronDownIcon, {}) }),
|
|
2780
2871
|
/* @__PURE__ */ a3(
|
|
2781
2872
|
"button",
|
|
2782
2873
|
{
|
|
@@ -3030,6 +3121,93 @@ function ReplayBar({ ctx }) {
|
|
|
3030
3121
|
button(t3.replayExit, () => ctx.chart.stopReplay(), /* @__PURE__ */ a3(SmallCloseIcon, {}))
|
|
3031
3122
|
] });
|
|
3032
3123
|
}
|
|
3124
|
+
var TEXT_MAX = 200;
|
|
3125
|
+
function TextEditor({ ctx }) {
|
|
3126
|
+
const t3 = stringsOf(useStore(ctx.store));
|
|
3127
|
+
const [edit, setEdit] = d2(null);
|
|
3128
|
+
const ref = T2(null);
|
|
3129
|
+
A2(() => {
|
|
3130
|
+
let pressed = false;
|
|
3131
|
+
let pending = null;
|
|
3132
|
+
const down = () => pressed = true;
|
|
3133
|
+
const up = () => {
|
|
3134
|
+
pressed = false;
|
|
3135
|
+
const open = pending;
|
|
3136
|
+
pending = null;
|
|
3137
|
+
if (open) setTimeout(open, 0);
|
|
3138
|
+
};
|
|
3139
|
+
window.addEventListener("pointerdown", down, true);
|
|
3140
|
+
window.addEventListener("pointerup", up, true);
|
|
3141
|
+
window.addEventListener("pointercancel", up, true);
|
|
3142
|
+
const off = ctx.chart.on("drawingTextEdit", ({ id, x: x2, y: y3 }) => {
|
|
3143
|
+
const open = () => {
|
|
3144
|
+
const d3 = ctx.chart.getDrawings().find((x3) => x3.id === id);
|
|
3145
|
+
if (d3) setEdit({ id, x: x2, y: y3, before: d3.style?.text ?? "" });
|
|
3146
|
+
};
|
|
3147
|
+
if (pressed) pending = open;
|
|
3148
|
+
else open();
|
|
3149
|
+
});
|
|
3150
|
+
return () => {
|
|
3151
|
+
off();
|
|
3152
|
+
window.removeEventListener("pointerdown", down, true);
|
|
3153
|
+
window.removeEventListener("pointerup", up, true);
|
|
3154
|
+
window.removeEventListener("pointercancel", up, true);
|
|
3155
|
+
};
|
|
3156
|
+
}, [ctx.chart]);
|
|
3157
|
+
F2(() => {
|
|
3158
|
+
const el = ref.current;
|
|
3159
|
+
if (!el || !edit) return;
|
|
3160
|
+
el.value = edit.before;
|
|
3161
|
+
el.focus();
|
|
3162
|
+
el.select();
|
|
3163
|
+
fit(el);
|
|
3164
|
+
}, [edit]);
|
|
3165
|
+
if (!edit) return null;
|
|
3166
|
+
const write = (text) => {
|
|
3167
|
+
const d3 = ctx.chart.getDrawings().find((x2) => x2.id === edit.id);
|
|
3168
|
+
if (d3) ctx.chart.updateDrawing(edit.id, { style: { ...d3.style, text } });
|
|
3169
|
+
};
|
|
3170
|
+
const close = (keep) => {
|
|
3171
|
+
if (!keep) write(edit.before);
|
|
3172
|
+
setEdit(null);
|
|
3173
|
+
};
|
|
3174
|
+
const width = 220;
|
|
3175
|
+
const left = Math.max(4, Math.min(edit.x - 8, ctx.chart.layout.plotWidth - width - 4));
|
|
3176
|
+
return /* @__PURE__ */ a3("div", { class: "fnc-text-edit", style: { left: `${left}px`, top: `${Math.max(4, edit.y - 18)}px`, width: `${width}px` }, children: [
|
|
3177
|
+
/* @__PURE__ */ a3(
|
|
3178
|
+
"textarea",
|
|
3179
|
+
{
|
|
3180
|
+
ref,
|
|
3181
|
+
rows: 1,
|
|
3182
|
+
maxLength: TEXT_MAX,
|
|
3183
|
+
"aria-label": t3.drawingText,
|
|
3184
|
+
placeholder: t3.textPlaceholder,
|
|
3185
|
+
onInput: (e3) => {
|
|
3186
|
+
const el = e3.target;
|
|
3187
|
+
fit(el);
|
|
3188
|
+
write(el.value);
|
|
3189
|
+
},
|
|
3190
|
+
onKeyDown: (e3) => {
|
|
3191
|
+
e3.stopPropagation();
|
|
3192
|
+
if (e3.key === "Escape") {
|
|
3193
|
+
e3.preventDefault();
|
|
3194
|
+
close(false);
|
|
3195
|
+
} else if (e3.key === "Enter" && !e3.shiftKey && !e3.isComposing) {
|
|
3196
|
+
e3.preventDefault();
|
|
3197
|
+
close(true);
|
|
3198
|
+
}
|
|
3199
|
+
},
|
|
3200
|
+
onBlur: () => close(true),
|
|
3201
|
+
onPointerDown: (e3) => e3.stopPropagation()
|
|
3202
|
+
}
|
|
3203
|
+
),
|
|
3204
|
+
/* @__PURE__ */ a3("small", { children: t3.textEditHint })
|
|
3205
|
+
] });
|
|
3206
|
+
}
|
|
3207
|
+
function fit(el) {
|
|
3208
|
+
el.style.height = "auto";
|
|
3209
|
+
el.style.height = `${Math.min(el.scrollHeight, 5 * 20 + 8)}px`;
|
|
3210
|
+
}
|
|
3033
3211
|
function Overlay({ ctx }) {
|
|
3034
3212
|
return /* @__PURE__ */ a3($, { children: [
|
|
3035
3213
|
/* @__PURE__ */ a3(Attribution, { ctx }),
|
|
@@ -3037,6 +3215,7 @@ function Overlay({ ctx }) {
|
|
|
3037
3215
|
/* @__PURE__ */ a3(NavControls, { ctx }),
|
|
3038
3216
|
/* @__PURE__ */ a3(ReplayBar, { ctx }),
|
|
3039
3217
|
/* @__PURE__ */ a3(SelectionBar, { ctx }),
|
|
3218
|
+
/* @__PURE__ */ a3(TextEditor, { ctx }),
|
|
3040
3219
|
/* @__PURE__ */ a3(PaneTools, { ctx }),
|
|
3041
3220
|
/* @__PURE__ */ a3(ContextMenu, { ctx })
|
|
3042
3221
|
] });
|
|
@@ -3284,6 +3463,9 @@ var CSS = (
|
|
|
3284
3463
|
.fnc-part-reset { margin-top: 4px; border-top: 1px solid var(--fnc-border); color: var(--fnc-text-2); }
|
|
3285
3464
|
.fnc-selbar-text { width: 150px; height: 28px; padding: 0 8px; border: 1px solid var(--fnc-border); border-radius: var(--fnc-radius); background: var(--fnc-surface); color: var(--fnc-text); font: inherit; font-size: 13px; outline: none; }
|
|
3286
3465
|
.fnc-selbar-text:focus { border-color: var(--fnc-text-2); }
|
|
3466
|
+
.fnc-text-edit { position: absolute; z-index: 30; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
|
|
3467
|
+
.fnc-text-edit textarea { width: 100%; min-height: 32px; padding: 6px 8px; border: 1px solid var(--fnc-text-2); border-radius: var(--fnc-radius); background: var(--fnc-surface); color: var(--fnc-text); font: inherit; font-size: 13px; line-height: 20px; resize: none; outline: none; box-shadow: var(--fnc-shadow, 0 6px 20px rgba(0,0,0,.25)); }
|
|
3468
|
+
.fnc-text-edit small { color: var(--fnc-text-3, var(--fnc-text-2)); font-size: 11px; white-space: nowrap; text-shadow: 0 0 3px var(--fnc-bg, transparent); }
|
|
3287
3469
|
.fnc-overlay { pointer-events: none; }
|
|
3288
3470
|
.fnc-overlay button { pointer-events: auto; }
|
|
3289
3471
|
|
|
@@ -4328,6 +4510,7 @@ function createShell(container, options) {
|
|
|
4328
4510
|
let favoriteTools = storage.get("favorite-tools", []);
|
|
4329
4511
|
let keepDrawing = storage.get("keep-drawing", false);
|
|
4330
4512
|
let drawingDefaults = storage.get("drawing-defaults", {});
|
|
4513
|
+
let cursorMode = storage.get("cursor-mode", "cross");
|
|
4331
4514
|
const broadcast = (patch) => {
|
|
4332
4515
|
for (const p3 of panes()) p3.store.set(patch);
|
|
4333
4516
|
};
|
|
@@ -4348,7 +4531,13 @@ function createShell(container, options) {
|
|
|
4348
4531
|
slots,
|
|
4349
4532
|
storage,
|
|
4350
4533
|
theme: () => theme,
|
|
4351
|
-
sharedState: () => ({ fullscreen: isFullscreen(), favoriteIntervals, drawbarCollapsed, favoriteTools, keepDrawing }),
|
|
4534
|
+
sharedState: () => ({ fullscreen: isFullscreen(), favoriteIntervals, drawbarCollapsed, favoriteTools, keepDrawing, cursorMode }),
|
|
4535
|
+
setCursorMode: (mode) => {
|
|
4536
|
+
cursorMode = mode;
|
|
4537
|
+
storage.set("cursor-mode", mode);
|
|
4538
|
+
for (const p3 of panes()) p3.chart.setCursorMode(mode);
|
|
4539
|
+
broadcast({ cursorMode });
|
|
4540
|
+
},
|
|
4352
4541
|
drawingDefaults: () => drawingDefaults,
|
|
4353
4542
|
saveDrawingDefaults: (defaults) => {
|
|
4354
4543
|
drawingDefaults = defaults;
|
|
@@ -4469,6 +4658,7 @@ function createPane(shell, config) {
|
|
|
4469
4658
|
});
|
|
4470
4659
|
chart.setChartType(config.chartType);
|
|
4471
4660
|
chart.setKeepDrawingTool(shell.sharedState().keepDrawing);
|
|
4661
|
+
chart.setCursorMode(shell.sharedState().cursorMode);
|
|
4472
4662
|
chart.setDrawingDefaults(shell.drawingDefaults());
|
|
4473
4663
|
const canvasVars = (s3) => {
|
|
4474
4664
|
const muted = s3.textColor && /^#[0-9a-f]{6}$/i.test(s3.textColor) ? `${s3.textColor}99` : null;
|
|
@@ -4530,6 +4720,7 @@ function createPane(shell, config) {
|
|
|
4530
4720
|
chart.on("indicatorsChange", (indicators) => store.set({ indicators })),
|
|
4531
4721
|
chart.on("magnetChange", (magnet) => store.set({ magnet })),
|
|
4532
4722
|
chart.on("drawingsHiddenChange", (drawingsHidden) => store.set({ drawingsHidden })),
|
|
4723
|
+
chart.on("cursorModeChange", (cursorMode) => store.set({ cursorMode })),
|
|
4533
4724
|
// A color or style picked for a drawing: remembered for the tool, in every pane.
|
|
4534
4725
|
chart.on("drawingDefaultsChange", (defaults) => shell.saveDrawingDefaults(defaults)),
|
|
4535
4726
|
chart.on("chartTypeChange", (chartType) => store.set({ chartType })),
|
|
@@ -4575,6 +4766,7 @@ function createPane(shell, config) {
|
|
|
4575
4766
|
toggleFavoriteInterval: shell.toggleFavoriteInterval,
|
|
4576
4767
|
toggleFavoriteTool: shell.toggleFavoriteTool,
|
|
4577
4768
|
setKeepDrawing: shell.setKeepDrawing,
|
|
4769
|
+
setCursorMode: shell.setCursorMode,
|
|
4578
4770
|
setDrawingsHidden: shell.setDrawingsHidden,
|
|
4579
4771
|
setSearchOpen: (open, target = "symbol") => store.set(open ? { searchOpen: true, searchTarget: target } : { searchOpen: false }),
|
|
4580
4772
|
screenshot: () => {
|
package/dist/multi-chart.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
2
|
import { type Chart, type ChartState, type Locale, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
3
|
-
import type { LayoutSync } from './context';
|
|
4
|
-
import { type LayoutId, type SplitSizes } from './layouts';
|
|
5
|
-
import { type ColorScheme, type TradingChartSlots } from './shell';
|
|
6
|
-
import { type TradingChartOptions } from './trading-chart';
|
|
3
|
+
import type { LayoutSync } from './context.js';
|
|
4
|
+
import { type LayoutId, type SplitSizes } from './layouts.js';
|
|
5
|
+
import { type ColorScheme, type TradingChartSlots } from './shell.js';
|
|
6
|
+
import { type TradingChartOptions } from './trading-chart.js';
|
|
7
7
|
export interface PaneSpec {
|
|
8
8
|
symbol: string;
|
|
9
9
|
/** Default: the widget's `resolution`, else '1D'. */
|
package/dist/pane.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
2
|
import { type Chart, type ChartOptions, type ChartType, type Datafeed, type Resolution } from '@funnest/charts';
|
|
3
|
-
import type { ContextMenuItems, IntervalGroup, LegendValues, MultiControls, SearchCategory, SearchExchange, ToolsMenuItems, UiState, WidgetContext } from './context';
|
|
4
|
-
import { type Shell } from './shell';
|
|
5
|
-
import type { Strings } from './i18n';
|
|
6
|
-
import { Store } from './store';
|
|
3
|
+
import type { ContextMenuItems, IntervalGroup, LegendValues, MultiControls, SearchCategory, SearchExchange, ToolsMenuItems, UiState, WidgetContext } from './context.js';
|
|
4
|
+
import { type Shell } from './shell.js';
|
|
5
|
+
import type { Strings } from './i18n.js';
|
|
6
|
+
import { Store } from './store.js';
|
|
7
7
|
export interface PaneConfig {
|
|
8
8
|
datafeed: Datafeed;
|
|
9
9
|
chartOptions: Omit<ChartOptions, 'datafeed' | 'theme'>;
|
package/dist/shell.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type DirectionPreset, type DrawingDefaults, type DrawingType, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
2
|
-
import type { UiState } from './context';
|
|
3
|
-
import { type WidgetStorage } from './storage';
|
|
4
|
-
import type { Store } from './store';
|
|
1
|
+
import { type CursorMode, type DirectionPreset, type DrawingDefaults, type DrawingType, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
2
|
+
import type { UiState } from './context.js';
|
|
3
|
+
import { type WidgetStorage } from './storage.js';
|
|
4
|
+
import type { Store } from './store.js';
|
|
5
5
|
export type ColorScheme = 'light' | 'dark' | 'system';
|
|
6
6
|
/**
|
|
7
7
|
* Empty elements inside the widget layout where the host app mounts its own UI (any framework):
|
|
@@ -33,6 +33,7 @@ export interface ShellPane {
|
|
|
33
33
|
setKeepDrawingTool(on: boolean): void;
|
|
34
34
|
setDrawingsHidden(hidden: boolean): void;
|
|
35
35
|
setDrawingDefaults(defaults: DrawingDefaults): void;
|
|
36
|
+
setCursorMode(mode: CursorMode): void;
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
export interface ShellOptions {
|
|
@@ -61,7 +62,8 @@ export interface Shell {
|
|
|
61
62
|
readonly storage: WidgetStorage;
|
|
62
63
|
theme(): ThemeTokens;
|
|
63
64
|
/** Initial UI-state fields owned by the shell (same for every pane). */
|
|
64
|
-
sharedState(): Pick<UiState, 'fullscreen' | 'favoriteIntervals' | 'drawbarCollapsed' | 'favoriteTools' | 'keepDrawing'>;
|
|
65
|
+
sharedState(): Pick<UiState, 'fullscreen' | 'favoriteIntervals' | 'drawbarCollapsed' | 'favoriteTools' | 'keepDrawing' | 'cursorMode'>;
|
|
66
|
+
setCursorMode(mode: CursorMode): void;
|
|
65
67
|
/** Each tool's last color / style (saved; every pane starts with it). */
|
|
66
68
|
drawingDefaults(): DrawingDefaults;
|
|
67
69
|
saveDrawingDefaults(defaults: DrawingDefaults): void;
|
package/dist/trading-chart.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
2
|
import { type Chart, type ChartOptions, type ChartType, type Datafeed, type DirectionPreset, type Locale, type ChartState, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
3
|
-
import type { ContextMenuItems, IntervalGroup, LegendValues, SearchCategory, SearchExchange, ToolsMenuItems } from './context';
|
|
4
|
-
import type { Strings } from './i18n';
|
|
5
|
-
import { type ColorScheme, type TradingChartSlots } from './shell';
|
|
6
|
-
export type { ColorScheme, TradingChartSlots } from './shell';
|
|
3
|
+
import type { ContextMenuItems, IntervalGroup, LegendValues, SearchCategory, SearchExchange, ToolsMenuItems } from './context.js';
|
|
4
|
+
import type { Strings } from './i18n.js';
|
|
5
|
+
import { type ColorScheme, type TradingChartSlots } from './shell.js';
|
|
6
|
+
export type { ColorScheme, TradingChartSlots } from './shell.js';
|
|
7
7
|
/** Interval menu: 분 | 시간 | 일. '12M' is shown as 1년. */
|
|
8
8
|
export declare const DEFAULT_INTERVAL_GROUPS: readonly IntervalGroup[];
|
|
9
9
|
/** Toolbar chips until the user stars their own. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.29",
|
|
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.6.
|
|
45
|
+
"@funnest/charts": "0.6.29"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|