@funnest/charts-ui 0.6.3 → 0.6.5
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/context.d.ts +2 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/index.js +74 -2
- package/dist/pane.d.ts +2 -0
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -73,6 +73,8 @@ export interface WidgetContext {
|
|
|
73
73
|
/** IANA zone used for the status-bar clock (KST for Korean users by default). */
|
|
74
74
|
displayTimezone: string;
|
|
75
75
|
showLogo: boolean;
|
|
76
|
+
/** Ctrl/⌘+K opens symbol search (off when the page uses the shortcut for its own search). */
|
|
77
|
+
searchHotkey: boolean;
|
|
76
78
|
drawingToolbar: boolean;
|
|
77
79
|
/** Show the Funnest logo badge on the chart. */
|
|
78
80
|
attribution: boolean;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare const STRINGS: {
|
|
|
31
31
|
removeAll: string;
|
|
32
32
|
collapseDrawbar: string;
|
|
33
33
|
chartSettings: string;
|
|
34
|
+
settingsTheme: string;
|
|
34
35
|
settingsCandles: string;
|
|
35
36
|
settingsDisplay: string;
|
|
36
37
|
settingsGrid: string;
|
|
@@ -161,6 +162,7 @@ export declare const STRINGS: {
|
|
|
161
162
|
removeAll: string;
|
|
162
163
|
collapseDrawbar: string;
|
|
163
164
|
chartSettings: string;
|
|
165
|
+
settingsTheme: string;
|
|
164
166
|
settingsCandles: string;
|
|
165
167
|
settingsDisplay: string;
|
|
166
168
|
settingsGrid: string;
|
package/dist/index.js
CHANGED
|
@@ -454,6 +454,7 @@ var STRINGS = {
|
|
|
454
454
|
removeAll: "\uADF8\uB9AC\uAE30 \uBAA8\uB450 \uC0AD\uC81C",
|
|
455
455
|
collapseDrawbar: "\uADF8\uB9AC\uAE30 \uB3C4\uAD6C \uC811\uAE30",
|
|
456
456
|
chartSettings: "\uCC28\uD2B8 \uC124\uC815",
|
|
457
|
+
settingsTheme: "\uD14C\uB9C8",
|
|
457
458
|
settingsCandles: "\uCE94\uB4E4",
|
|
458
459
|
settingsDisplay: "\uD45C\uC2DC",
|
|
459
460
|
settingsGrid: "\uACA9\uC790",
|
|
@@ -586,6 +587,7 @@ var STRINGS = {
|
|
|
586
587
|
removeAll: "Remove all drawings",
|
|
587
588
|
collapseDrawbar: "Hide drawing tools",
|
|
588
589
|
chartSettings: "Chart settings",
|
|
590
|
+
settingsTheme: "Theme",
|
|
589
591
|
settingsCandles: "Candles",
|
|
590
592
|
settingsDisplay: "Display",
|
|
591
593
|
settingsGrid: "Grid",
|
|
@@ -1048,7 +1050,7 @@ import {
|
|
|
1048
1050
|
} from "@funnest/charts";
|
|
1049
1051
|
|
|
1050
1052
|
// src/components/settings-dialog.tsx
|
|
1051
|
-
import { DEFAULT_CHART_SETTINGS } from "@funnest/charts";
|
|
1053
|
+
import { CHART_THEMES, DEFAULT_CHART_SETTINGS, matchChartTheme } from "@funnest/charts";
|
|
1052
1054
|
function toHex(color) {
|
|
1053
1055
|
const ctx = document.createElement("canvas").getContext("2d");
|
|
1054
1056
|
if (!ctx) return "#000000";
|
|
@@ -1088,12 +1090,42 @@ function SettingsDialog({ ctx }) {
|
|
|
1088
1090
|
const close = () => ctx.store.set({ dialog: null });
|
|
1089
1091
|
const set = (patch) => ctx.chart.setSettings(patch);
|
|
1090
1092
|
const themeColor = (name) => toHex(getComputedStyle(ctx.root).getPropertyValue(name).trim());
|
|
1093
|
+
const currentTheme = matchChartTheme(settings);
|
|
1091
1094
|
return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3("div", { class: "fnc-dialog", role: "dialog", "aria-modal": "true", "aria-label": t3.chartSettings, onKeyDown: (e3) => e3.key === "Escape" && close(), children: [
|
|
1092
1095
|
/* @__PURE__ */ a3("div", { class: "fnc-dialog-head", children: [
|
|
1093
1096
|
/* @__PURE__ */ a3("b", { children: t3.chartSettings }),
|
|
1094
1097
|
/* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.close, onClick: close, children: /* @__PURE__ */ a3(CloseIcon, {}) })
|
|
1095
1098
|
] }),
|
|
1096
1099
|
/* @__PURE__ */ a3("form", { class: "fnc-form", onSubmit: (e3) => (e3.preventDefault(), close()), children: [
|
|
1100
|
+
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsTheme }),
|
|
1101
|
+
/* @__PURE__ */ a3("div", { class: "fnc-themes", role: "radiogroup", "aria-label": t3.settingsTheme, children: CHART_THEMES.map((theme) => {
|
|
1102
|
+
const c3 = theme.colors;
|
|
1103
|
+
const bg = c3.background ?? themeColor("--fnc-bg");
|
|
1104
|
+
const grid = c3.gridColor ?? themeColor("--fnc-border");
|
|
1105
|
+
const up = c3.upColor ?? themeColor("--fnc-up");
|
|
1106
|
+
const down = c3.downColor ?? themeColor("--fnc-down");
|
|
1107
|
+
return /* @__PURE__ */ a3(
|
|
1108
|
+
"button",
|
|
1109
|
+
{
|
|
1110
|
+
type: "button",
|
|
1111
|
+
role: "radio",
|
|
1112
|
+
class: "fnc-theme",
|
|
1113
|
+
"aria-checked": currentTheme?.id === theme.id,
|
|
1114
|
+
onClick: () => set({ ...c3 }),
|
|
1115
|
+
children: [
|
|
1116
|
+
/* @__PURE__ */ a3("svg", { class: "fnc-theme-swatch", viewBox: "0 0 56 36", "aria-hidden": "true", children: [
|
|
1117
|
+
/* @__PURE__ */ a3("rect", { x: "0.5", y: "0.5", width: "55", height: "35", rx: "5", fill: bg, stroke: grid }),
|
|
1118
|
+
/* @__PURE__ */ a3("path", { d: "M4 12h48M4 24h48", stroke: grid }),
|
|
1119
|
+
/* @__PURE__ */ a3("path", { d: "M21 6v24", stroke: up, "stroke-width": "1.5" }),
|
|
1120
|
+
/* @__PURE__ */ a3("rect", { x: "17", y: "11", width: "8", height: "13", rx: "1", fill: up }),
|
|
1121
|
+
/* @__PURE__ */ a3("path", { d: "M35 8v22", stroke: down, "stroke-width": "1.5" }),
|
|
1122
|
+
/* @__PURE__ */ a3("rect", { x: "31", y: "13", width: "8", height: "11", rx: "1", fill: down })
|
|
1123
|
+
] }),
|
|
1124
|
+
/* @__PURE__ */ a3("span", { children: theme.name[locale === "en" ? "en" : "ko"] })
|
|
1125
|
+
]
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
}) }),
|
|
1097
1129
|
/* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsCandles }),
|
|
1098
1130
|
["upColor", "downColor"].map((key) => /* @__PURE__ */ a3("label", { class: "fnc-row", children: [
|
|
1099
1131
|
/* @__PURE__ */ a3("span", { class: "fnc-row-label fnc-row-label-wide", children: key === "upColor" ? t3.settingUpColor : t3.settingDownColor }),
|
|
@@ -1791,7 +1823,7 @@ function SymbolSearch({ ctx }) {
|
|
|
1791
1823
|
t3.close
|
|
1792
1824
|
] }),
|
|
1793
1825
|
/* @__PURE__ */ a3("span", { class: "fnc-spacer" }),
|
|
1794
|
-
/* @__PURE__ */ a3("span", { children: [
|
|
1826
|
+
ctx.searchHotkey && /* @__PURE__ */ a3("span", { children: [
|
|
1795
1827
|
/* @__PURE__ */ a3("kbd", { class: "fnc-kbd", children: [
|
|
1796
1828
|
/Mac|iPhone|iPad/.test(navigator.platform) ? "\u2318" : "Ctrl",
|
|
1797
1829
|
" + K"
|
|
@@ -3453,6 +3485,23 @@ var CSS = (
|
|
|
3453
3485
|
.fnc-seg button[aria-checked='true'] { background: var(--fnc-bg); color: var(--fnc-text); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
|
|
3454
3486
|
.fnc-seg-sm button { min-width: 36px; height: 26px; padding: 0 6px; font-size: 12px; }
|
|
3455
3487
|
|
|
3488
|
+
/* \u2500\u2500 Chart themes (settings dialog) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
3489
|
+
.fnc-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; padding: 2px 0 6px; }
|
|
3490
|
+
.fnc-theme {
|
|
3491
|
+
display: flex;
|
|
3492
|
+
flex-direction: column;
|
|
3493
|
+
align-items: center;
|
|
3494
|
+
gap: 4px;
|
|
3495
|
+
padding: 6px 4px;
|
|
3496
|
+
border: 1px solid transparent;
|
|
3497
|
+
border-radius: var(--fnc-radius);
|
|
3498
|
+
font-size: 12px;
|
|
3499
|
+
color: var(--fnc-text-2);
|
|
3500
|
+
}
|
|
3501
|
+
.fnc-theme:hover { background: var(--fnc-surface); }
|
|
3502
|
+
.fnc-theme[aria-checked='true'] { border-color: var(--fnc-text-2); color: var(--fnc-text); font-weight: 700; }
|
|
3503
|
+
.fnc-theme-swatch { width: 56px; height: 36px; display: block; }
|
|
3504
|
+
|
|
3456
3505
|
/* \u2500\u2500 Compare legend rows \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 */
|
|
3457
3506
|
.fnc-cmp { display: flex; align-items: center; gap: 6px; min-height: 22px; font-size: 12px; color: var(--fnc-text-2); pointer-events: auto; }
|
|
3458
3507
|
.fnc-cmp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
|
|
@@ -3795,6 +3844,26 @@ function createPane(shell, config) {
|
|
|
3795
3844
|
displayTimezone: config.displayTimezone
|
|
3796
3845
|
});
|
|
3797
3846
|
chart.setChartType(config.chartType);
|
|
3847
|
+
const canvasVars = (s3) => {
|
|
3848
|
+
const muted = s3.textColor && /^#[0-9a-f]{6}$/i.test(s3.textColor) ? `${s3.textColor}99` : null;
|
|
3849
|
+
const vars = [
|
|
3850
|
+
["--fnc-bg", s3.background],
|
|
3851
|
+
["--fnc-text", s3.textColor],
|
|
3852
|
+
["--fnc-text-2", muted],
|
|
3853
|
+
["--fnc-border", s3.gridColor],
|
|
3854
|
+
["--fnc-surface", s3.gridColor],
|
|
3855
|
+
// Legend values and other up/down text match the candles.
|
|
3856
|
+
["--fnc-up", s3.upColor],
|
|
3857
|
+
["--fnc-down", s3.downColor]
|
|
3858
|
+
];
|
|
3859
|
+
for (const [name, value] of vars) {
|
|
3860
|
+
if (value) stage.style.setProperty(name, value);
|
|
3861
|
+
else stage.style.removeProperty(name);
|
|
3862
|
+
}
|
|
3863
|
+
chart.refreshTheme();
|
|
3864
|
+
};
|
|
3865
|
+
canvasVars(chart.settings);
|
|
3866
|
+
chart.on("settingsChange", canvasVars);
|
|
3798
3867
|
const store = new Store({
|
|
3799
3868
|
locale: config.chartOptions.locale ?? "ko",
|
|
3800
3869
|
symbol: null,
|
|
@@ -3852,6 +3921,7 @@ function createPane(shell, config) {
|
|
|
3852
3921
|
searchCategories: config.searchCategories,
|
|
3853
3922
|
displayTimezone: config.displayTimezone,
|
|
3854
3923
|
showLogo: config.symbolLogo,
|
|
3924
|
+
searchHotkey: config.searchHotkey,
|
|
3855
3925
|
drawingToolbar: config.drawingToolbar,
|
|
3856
3926
|
attribution: config.attribution,
|
|
3857
3927
|
contextMenuItems: config.contextMenuItems,
|
|
@@ -3951,6 +4021,7 @@ function createTradingChart(container, options) {
|
|
|
3951
4021
|
intervalGroups,
|
|
3952
4022
|
searchCategories,
|
|
3953
4023
|
symbolLogo,
|
|
4024
|
+
searchHotkey,
|
|
3954
4025
|
drawingToolbar,
|
|
3955
4026
|
attribution,
|
|
3956
4027
|
contextMenuItems
|
|
@@ -4087,6 +4158,7 @@ function createMultiChart(container, options) {
|
|
|
4087
4158
|
intervalGroups,
|
|
4088
4159
|
searchCategories,
|
|
4089
4160
|
symbolLogo,
|
|
4161
|
+
searchHotkey,
|
|
4090
4162
|
drawingToolbar,
|
|
4091
4163
|
// One badge for the whole widget, not one per pane.
|
|
4092
4164
|
attribution: attribution && index === 0,
|
package/dist/pane.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface PaneConfig {
|
|
|
14
14
|
symbolLogo: boolean;
|
|
15
15
|
drawingToolbar: boolean;
|
|
16
16
|
attribution: boolean;
|
|
17
|
+
/** Ctrl/⌘+K opens this widget's symbol search (its footer shows the hint only then). */
|
|
18
|
+
searchHotkey: boolean;
|
|
17
19
|
contextMenuItems?: ContextMenuItems | undefined;
|
|
18
20
|
multi?: MultiControls | undefined;
|
|
19
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
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.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|