@funnest/charts-ui 0.6.16 → 0.6.18
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 +3 -0
- package/dist/i18n.d.ts +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -34
- package/dist/pane.d.ts +2 -0
- package/dist/shell.d.ts +3 -1
- package/dist/trading-chart.d.ts +17 -1
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Chart, ChartContextMenu, ChartLayout, ChartType, CompareInfo, Datafeed, Drawing, DrawingType, IndicatorConfig, Locale, ReplayStatus, Resolution, SymbolInfo } from '@funnest/charts';
|
|
2
2
|
import type { LayoutId } from './layouts';
|
|
3
3
|
import type { WidgetStorage } from './storage';
|
|
4
|
+
import type { Strings } from './i18n';
|
|
4
5
|
import type { Store } from './store';
|
|
5
6
|
export interface UiState {
|
|
6
7
|
locale: Locale;
|
|
8
|
+
/** The app's replacements for built-in words (TradingChartOptions.strings). */
|
|
9
|
+
strings?: Partial<Strings> | undefined;
|
|
7
10
|
symbol: SymbolInfo | null;
|
|
8
11
|
resolution: Resolution;
|
|
9
12
|
loading: boolean;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -292,6 +292,14 @@ export declare const STRINGS: {
|
|
|
292
292
|
};
|
|
293
293
|
};
|
|
294
294
|
export type Strings = (typeof STRINGS)['ko'];
|
|
295
|
+
/**
|
|
296
|
+
* The widget's words: the built-in ones for its locale with the app's `strings` on top (a few
|
|
297
|
+
* replaced, or every one for a language of your own).
|
|
298
|
+
*/
|
|
299
|
+
export declare function stringsOf(s: {
|
|
300
|
+
locale: Locale;
|
|
301
|
+
strings?: Partial<Strings> | undefined;
|
|
302
|
+
}): Strings;
|
|
295
303
|
/**
|
|
296
304
|
* '1' → 1분, '60' → 1시간, '1D' → 일 (short) / 1일 (long), '12M' → 1년.
|
|
297
305
|
* Short labels are for the toolbar chips, long ones for the interval menu.
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export { LAYOUT_GROUPS, LAYOUTS, MAX_PANES, paneCount } from './layouts';
|
|
|
10
10
|
export type { LayoutId, SplitNode, SplitSizes } from './layouts';
|
|
11
11
|
export type { ContextMenuItem, ContextMenuItems, IntervalGroup, LayoutSync, SearchCategory, SearchExchange } from './context';
|
|
12
12
|
export type { ColorScheme, TradingChart, TradingChartOptions, TradingChartSlots } from './trading-chart';
|
|
13
|
-
export { resolutionLabel } from './i18n';
|
|
13
|
+
export { resolutionLabel, STRINGS, stringsOf, type Strings } from './i18n';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// src/trading-chart.tsx
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
browserLocale as browserLocale2
|
|
4
|
+
} from "@funnest/charts";
|
|
3
5
|
|
|
4
6
|
// ../../node_modules/.pnpm/preact@11.2.0/node_modules/preact/dist/preact.mjs
|
|
5
7
|
var n;
|
|
@@ -716,6 +718,13 @@ var STRINGS = {
|
|
|
716
718
|
pane: "Pane"
|
|
717
719
|
}
|
|
718
720
|
};
|
|
721
|
+
var merged = /* @__PURE__ */ new WeakMap();
|
|
722
|
+
function stringsOf(s3) {
|
|
723
|
+
if (!s3.strings) return STRINGS[s3.locale];
|
|
724
|
+
let byLocale = merged.get(s3.strings);
|
|
725
|
+
if (!byLocale) merged.set(s3.strings, byLocale = {});
|
|
726
|
+
return byLocale[s3.locale] ??= { ...STRINGS[s3.locale], ...s3.strings };
|
|
727
|
+
}
|
|
719
728
|
function resolutionLabel(resolution, locale, form = "short") {
|
|
720
729
|
const match = /^(\d*)([SDWM]?)$/i.exec(resolution.trim());
|
|
721
730
|
if (!match) return resolution;
|
|
@@ -965,7 +974,7 @@ function ToolGroup({
|
|
|
965
974
|
onPick
|
|
966
975
|
}) {
|
|
967
976
|
const s3 = useStore(ctx.store);
|
|
968
|
-
const t3 =
|
|
977
|
+
const t3 = stringsOf(s3);
|
|
969
978
|
const [chosen, setChosen] = d2(tools[0].type);
|
|
970
979
|
const armed = tools.find((d3) => d3.type === s3.drawingTool);
|
|
971
980
|
const current = armed ?? tools.find((d3) => d3.type === chosen) ?? tools[0];
|
|
@@ -1008,7 +1017,7 @@ function ToolGroup({
|
|
|
1008
1017
|
}
|
|
1009
1018
|
function DrawingToolbar({ ctx }) {
|
|
1010
1019
|
const s3 = useStore(ctx.store);
|
|
1011
|
-
const t3 =
|
|
1020
|
+
const t3 = stringsOf(s3);
|
|
1012
1021
|
const [openGroup, setOpenGroup] = d2(null);
|
|
1013
1022
|
const groups = toolGroups(ctx.chart.drawingDefinitions());
|
|
1014
1023
|
const pick = (tool) => {
|
|
@@ -1103,7 +1112,7 @@ function DashGlyph({ dash }) {
|
|
|
1103
1112
|
}
|
|
1104
1113
|
function SelectionBar({ ctx }) {
|
|
1105
1114
|
const s3 = useStore(ctx.store);
|
|
1106
|
-
const t3 =
|
|
1115
|
+
const t3 = stringsOf(s3);
|
|
1107
1116
|
const d3 = s3.selection;
|
|
1108
1117
|
const [offset, setOffset] = d2(() => readJson(POS_KEY, [0, 0]));
|
|
1109
1118
|
const [recent, setRecent] = d2(() => readJson(RECENT_KEY, []));
|
|
@@ -1313,7 +1322,7 @@ var SCALES = [
|
|
|
1313
1322
|
];
|
|
1314
1323
|
function SettingsDialog({ ctx }) {
|
|
1315
1324
|
const { locale } = useStore(ctx.store);
|
|
1316
|
-
const t3 =
|
|
1325
|
+
const t3 = stringsOf(ctx.store.get());
|
|
1317
1326
|
const [settings, setSettings] = d2(ctx.chart.settings);
|
|
1318
1327
|
A2(() => ctx.chart.on("settingsChange", setSettings), [ctx.chart]);
|
|
1319
1328
|
const close = () => ctx.store.set({ dialog: null });
|
|
@@ -1432,7 +1441,7 @@ function Dialog({ title, onClose, children, wide }) {
|
|
|
1432
1441
|
var SEARCH_THRESHOLD = 8;
|
|
1433
1442
|
function IndicatorPicker({ ctx }) {
|
|
1434
1443
|
const { locale } = useStore(ctx.store);
|
|
1435
|
-
const t3 =
|
|
1444
|
+
const t3 = stringsOf(ctx.store.get());
|
|
1436
1445
|
const [query, setQuery] = d2("");
|
|
1437
1446
|
const close = () => ctx.store.set({ dialog: null });
|
|
1438
1447
|
const add = (type) => {
|
|
@@ -1515,7 +1524,7 @@ function SourceSelect({ value, locale, label, onChange }) {
|
|
|
1515
1524
|
}
|
|
1516
1525
|
function IndicatorSettings({ ctx, id }) {
|
|
1517
1526
|
const { locale, indicators } = useStore(ctx.store);
|
|
1518
|
-
const t3 =
|
|
1527
|
+
const t3 = stringsOf(ctx.store.get());
|
|
1519
1528
|
const config = indicators.find((c3) => c3.id === id);
|
|
1520
1529
|
const def = config ? ctx.chart.indicatorDefinition(config.type) ?? null : null;
|
|
1521
1530
|
const hasLines = !!def?.params.some((p3) => p3.kind === "lines");
|
|
@@ -1695,7 +1704,7 @@ var GROUP_LABEL = {
|
|
|
1695
1704
|
};
|
|
1696
1705
|
function IntervalPicker({ ctx }) {
|
|
1697
1706
|
const s3 = useStore(ctx.store);
|
|
1698
|
-
const t3 =
|
|
1707
|
+
const t3 = stringsOf(s3);
|
|
1699
1708
|
const [open, setOpen] = d2(false);
|
|
1700
1709
|
const ref = T2(null);
|
|
1701
1710
|
const menuRef = useKeepInView(open);
|
|
@@ -1887,7 +1896,7 @@ function Sparkline({ values, up }) {
|
|
|
1887
1896
|
function SymbolSearch({ ctx }) {
|
|
1888
1897
|
const { locale, symbol: current, searchTarget } = useStore(ctx.store);
|
|
1889
1898
|
const comparing = searchTarget === "compare";
|
|
1890
|
-
const t3 =
|
|
1899
|
+
const t3 = stringsOf(ctx.store.get());
|
|
1891
1900
|
const [query, setQuery] = d2("");
|
|
1892
1901
|
const [category, setCategory] = d2(ctx.searchCategories[0]?.id ?? "all");
|
|
1893
1902
|
const [view, setView] = d2({ kind: "all" });
|
|
@@ -2266,7 +2275,7 @@ var SYNC_KEYS = [
|
|
|
2266
2275
|
function LayoutSection({ ctx, multi, close }) {
|
|
2267
2276
|
const s3 = useStore(ctx.store);
|
|
2268
2277
|
const m3 = useStore(multi.store);
|
|
2269
|
-
const t3 =
|
|
2278
|
+
const t3 = stringsOf(s3);
|
|
2270
2279
|
return /* @__PURE__ */ a3($, { children: [
|
|
2271
2280
|
/* @__PURE__ */ a3("div", { class: "fnc-tools-section", children: t3.layout }),
|
|
2272
2281
|
/* @__PURE__ */ a3("div", { class: "fnc-tools-layouts", children: LAYOUT_GROUPS.map((group) => /* @__PURE__ */ a3("div", { class: "fnc-layout-row", children: [
|
|
@@ -2305,7 +2314,7 @@ function LayoutSection({ ctx, multi, close }) {
|
|
|
2305
2314
|
}
|
|
2306
2315
|
function ToolsMenu({ ctx }) {
|
|
2307
2316
|
const s3 = useStore(ctx.store);
|
|
2308
|
-
const t3 =
|
|
2317
|
+
const t3 = stringsOf(s3);
|
|
2309
2318
|
const [open, setOpen] = d2(false);
|
|
2310
2319
|
const [scale, setScale] = d2(ctx.chart.settings.priceScale);
|
|
2311
2320
|
const ref = T2(null);
|
|
@@ -2402,7 +2411,7 @@ function ToolsMenu({ ctx }) {
|
|
|
2402
2411
|
// src/components/toolbar.tsx
|
|
2403
2412
|
function Toolbar({ ctx }) {
|
|
2404
2413
|
const s3 = useStore(ctx.store);
|
|
2405
|
-
const t3 =
|
|
2414
|
+
const t3 = stringsOf(s3);
|
|
2406
2415
|
const canSearch = typeof ctx.datafeed.searchSymbols === "function";
|
|
2407
2416
|
return /* @__PURE__ */ a3("div", { class: "fnc-toolbar", role: "toolbar", children: [
|
|
2408
2417
|
/* @__PURE__ */ a3(
|
|
@@ -2470,7 +2479,7 @@ function Toolbar({ ctx }) {
|
|
|
2470
2479
|
}
|
|
2471
2480
|
|
|
2472
2481
|
// src/pane.tsx
|
|
2473
|
-
import { createChart } from "@funnest/charts";
|
|
2482
|
+
import { browserLocale, createChart } from "@funnest/charts";
|
|
2474
2483
|
|
|
2475
2484
|
// src/components/overlay.tsx
|
|
2476
2485
|
import { formatCompact, formatPrice as formatPrice3 } from "@funnest/charts";
|
|
@@ -2480,7 +2489,7 @@ import { formatPrice as formatPrice2 } from "@funnest/charts";
|
|
|
2480
2489
|
var MARGIN2 = 8;
|
|
2481
2490
|
function ContextMenu({ ctx }) {
|
|
2482
2491
|
const s3 = useStore(ctx.store);
|
|
2483
|
-
const t3 =
|
|
2492
|
+
const t3 = stringsOf(s3);
|
|
2484
2493
|
const [target, setTarget] = d2(null);
|
|
2485
2494
|
const ref = T2(null);
|
|
2486
2495
|
A2(() => ctx.chart.on("contextMenu", setTarget), [ctx.chart]);
|
|
@@ -2559,7 +2568,7 @@ var ZOOM_STEP = 1.25;
|
|
|
2559
2568
|
var CONTROL_OFFSET = 52;
|
|
2560
2569
|
var dirClass = (v3) => v3 > 0 ? "fnc-up" : v3 < 0 ? "fnc-down" : "fnc-flat";
|
|
2561
2570
|
function IndicatorItem({ ctx, item }) {
|
|
2562
|
-
const t3 =
|
|
2571
|
+
const t3 = stringsOf(ctx.store.get());
|
|
2563
2572
|
return /* @__PURE__ */ a3(
|
|
2564
2573
|
"div",
|
|
2565
2574
|
{
|
|
@@ -2617,7 +2626,7 @@ function IndicatorItem({ ctx, item }) {
|
|
|
2617
2626
|
}
|
|
2618
2627
|
function Legend({ ctx }) {
|
|
2619
2628
|
const s3 = useStore(ctx.store);
|
|
2620
|
-
const t3 =
|
|
2629
|
+
const t3 = stringsOf(s3);
|
|
2621
2630
|
const [hover, setHover] = d2(null);
|
|
2622
2631
|
const [, refresh] = _2((n2) => n2 + 1, 0);
|
|
2623
2632
|
const [collapsed, setCollapsed] = d2(false);
|
|
@@ -2729,7 +2738,7 @@ function Legend({ ctx }) {
|
|
|
2729
2738
|
}
|
|
2730
2739
|
function NavControls({ ctx }) {
|
|
2731
2740
|
const s3 = useStore(ctx.store);
|
|
2732
|
-
const t3 =
|
|
2741
|
+
const t3 = stringsOf(s3);
|
|
2733
2742
|
const [showButtons, setShowButtons] = d2(ctx.chart.settings.navigationButtons);
|
|
2734
2743
|
A2(() => ctx.chart.on("settingsChange", (settings) => setShowButtons(settings.navigationButtons)), [ctx.chart]);
|
|
2735
2744
|
const { plotWidth, panesHeight } = s3.layout;
|
|
@@ -2789,7 +2798,7 @@ function PaneMaximize({ ctx, multi }) {
|
|
|
2789
2798
|
const s3 = useStore(ctx.store);
|
|
2790
2799
|
const m3 = useStore(multi.store);
|
|
2791
2800
|
if (s3.layout.plotWidth <= 0 || m3.narrow || m3.layout === "1" && m3.maximized === null) return null;
|
|
2792
|
-
const t3 =
|
|
2801
|
+
const t3 = stringsOf(s3);
|
|
2793
2802
|
const maximized = m3.maximized !== null;
|
|
2794
2803
|
const label = maximized ? t3.restorePane : t3.maximizePane;
|
|
2795
2804
|
return /* @__PURE__ */ a3(
|
|
@@ -2815,7 +2824,7 @@ var REPLAY_SPEEDS = [
|
|
|
2815
2824
|
];
|
|
2816
2825
|
function ReplayBar({ ctx }) {
|
|
2817
2826
|
const s3 = useStore(ctx.store);
|
|
2818
|
-
const t3 =
|
|
2827
|
+
const t3 = stringsOf(s3);
|
|
2819
2828
|
const r3 = s3.replay;
|
|
2820
2829
|
const { plotWidth, panesHeight } = s3.layout;
|
|
2821
2830
|
if (plotWidth <= 0 || !r3.active && !r3.selecting) return null;
|
|
@@ -2861,7 +2870,7 @@ function Overlay({ ctx }) {
|
|
|
2861
2870
|
}
|
|
2862
2871
|
|
|
2863
2872
|
// src/shell.ts
|
|
2864
|
-
import { darkTheme, lightTheme } from "@funnest/charts";
|
|
2873
|
+
import { darkTheme, directionColors, lightTheme } from "@funnest/charts";
|
|
2865
2874
|
|
|
2866
2875
|
// src/storage.ts
|
|
2867
2876
|
function createStorage(prefix) {
|
|
@@ -4087,7 +4096,7 @@ function createShell(container, options) {
|
|
|
4087
4096
|
let themePatch = { ...options.theme };
|
|
4088
4097
|
let panes = () => [];
|
|
4089
4098
|
const isDark = () => scheme === "system" ? !!darkQuery?.matches : scheme === "dark";
|
|
4090
|
-
const resolveTheme = () => ({ ...isDark() ? darkTheme : lightTheme, ...themePatch });
|
|
4099
|
+
const resolveTheme = () => ({ ...isDark() ? darkTheme : lightTheme, ...directionColors(options.direction), ...themePatch });
|
|
4091
4100
|
let theme = resolveTheme();
|
|
4092
4101
|
const root = div("fnc-root", container);
|
|
4093
4102
|
const applyScheme = () => {
|
|
@@ -4260,7 +4269,8 @@ function createPane(shell, config) {
|
|
|
4260
4269
|
canvasVars(chart.settings);
|
|
4261
4270
|
chart.on("settingsChange", canvasVars);
|
|
4262
4271
|
const store = new Store({
|
|
4263
|
-
locale: config.chartOptions.locale ??
|
|
4272
|
+
locale: config.chartOptions.locale ?? browserLocale(),
|
|
4273
|
+
strings: config.strings,
|
|
4264
4274
|
symbol: null,
|
|
4265
4275
|
resolution: config.resolution,
|
|
4266
4276
|
loading: false,
|
|
@@ -4402,12 +4412,16 @@ function createTradingChart(container, options) {
|
|
|
4402
4412
|
contextMenuItems,
|
|
4403
4413
|
onIndicatorsClick,
|
|
4404
4414
|
theme,
|
|
4415
|
+
strings,
|
|
4416
|
+
direction,
|
|
4405
4417
|
...chartOptions
|
|
4406
4418
|
} = options;
|
|
4407
|
-
const
|
|
4419
|
+
const locale = chartOptions.locale ??= browserLocale2();
|
|
4420
|
+
const displayTimezone = defaultDisplayTimezone(locale, chartOptions.displayTimezone);
|
|
4408
4421
|
const shell = createShell(container, {
|
|
4409
4422
|
colorScheme,
|
|
4410
4423
|
theme,
|
|
4424
|
+
direction: direction ?? (locale === "ko" ? "kr" : "global"),
|
|
4411
4425
|
storageKey,
|
|
4412
4426
|
drawingToolbar,
|
|
4413
4427
|
favoriteIntervals: favoriteIntervals ?? DEFAULT_FAVORITE_INTERVALS,
|
|
@@ -4428,7 +4442,8 @@ function createTradingChart(container, options) {
|
|
|
4428
4442
|
drawingToolbar,
|
|
4429
4443
|
attribution,
|
|
4430
4444
|
contextMenuItems,
|
|
4431
|
-
onIndicatorsClick
|
|
4445
|
+
onIndicatorsClick,
|
|
4446
|
+
strings
|
|
4432
4447
|
});
|
|
4433
4448
|
shell.main.insertBefore(pane.stage, shell.slots.bottom);
|
|
4434
4449
|
shell.setPanes(() => [pane]);
|
|
@@ -4444,9 +4459,9 @@ function createTradingChart(container, options) {
|
|
|
4444
4459
|
const current = pane.store.get().symbol;
|
|
4445
4460
|
return current ? pane.load(current.symbol, res) : Promise.resolve();
|
|
4446
4461
|
},
|
|
4447
|
-
setLocale: (
|
|
4448
|
-
pane.chart.setLocale(
|
|
4449
|
-
pane.store.set({ locale });
|
|
4462
|
+
setLocale: (locale2) => {
|
|
4463
|
+
pane.chart.setLocale(locale2);
|
|
4464
|
+
pane.store.set({ locale: locale2 });
|
|
4450
4465
|
},
|
|
4451
4466
|
save: () => pane.chart.save(),
|
|
4452
4467
|
load: (state) => pane.chart.load(state),
|
|
@@ -4463,11 +4478,11 @@ function createTradingChart(container, options) {
|
|
|
4463
4478
|
}
|
|
4464
4479
|
|
|
4465
4480
|
// src/multi-chart.tsx
|
|
4466
|
-
import { parseChartState } from "@funnest/charts";
|
|
4481
|
+
import { browserLocale as browserLocale3, parseChartState } from "@funnest/charts";
|
|
4467
4482
|
var DEFAULT_SYNC = { crosshair: true, time: false, symbol: false, interval: false };
|
|
4468
4483
|
function PaneTab({ pane, index, active, onSelect }) {
|
|
4469
4484
|
const s3 = useStore(pane.store);
|
|
4470
|
-
const t3 =
|
|
4485
|
+
const t3 = stringsOf(s3);
|
|
4471
4486
|
return /* @__PURE__ */ a3("button", { class: "fnc-pane-tab", role: "tab", "aria-selected": active, onClick: onSelect, children: [
|
|
4472
4487
|
/* @__PURE__ */ a3("span", { class: "fnc-pane-tab-num", children: index + 1 }),
|
|
4473
4488
|
s3.symbol?.name ?? `${t3.pane} ${index + 1}`,
|
|
@@ -4504,13 +4519,17 @@ function createMultiChart(container, options) {
|
|
|
4504
4519
|
contextMenuItems,
|
|
4505
4520
|
onIndicatorsClick,
|
|
4506
4521
|
theme,
|
|
4522
|
+
strings,
|
|
4523
|
+
direction,
|
|
4507
4524
|
...chartOptions
|
|
4508
4525
|
} = options;
|
|
4509
4526
|
if (paneSpecs.length === 0) throw new Error("funnest-charts: createMultiChart needs at least one pane");
|
|
4510
|
-
const
|
|
4527
|
+
const locale = chartOptions.locale ??= browserLocale3();
|
|
4528
|
+
const displayTimezone = defaultDisplayTimezone(locale, chartOptions.displayTimezone);
|
|
4511
4529
|
const shell = createShell(container, {
|
|
4512
4530
|
colorScheme,
|
|
4513
4531
|
theme,
|
|
4532
|
+
direction: direction ?? (locale === "ko" ? "kr" : "global"),
|
|
4514
4533
|
storageKey,
|
|
4515
4534
|
drawingToolbar,
|
|
4516
4535
|
favoriteIntervals: favoriteIntervals ?? DEFAULT_FAVORITE_INTERVALS,
|
|
@@ -4809,10 +4828,10 @@ function createMultiChart(container, options) {
|
|
|
4809
4828
|
const current = pane.store.get().symbol;
|
|
4810
4829
|
return current ? pane.load(current.symbol, res) : Promise.resolve();
|
|
4811
4830
|
},
|
|
4812
|
-
setLocale: (
|
|
4831
|
+
setLocale: (locale2) => {
|
|
4813
4832
|
for (const p3 of panes) {
|
|
4814
|
-
p3.chart.setLocale(
|
|
4815
|
-
p3.store.set({ locale });
|
|
4833
|
+
p3.chart.setLocale(locale2);
|
|
4834
|
+
p3.store.set({ locale: locale2 });
|
|
4816
4835
|
}
|
|
4817
4836
|
},
|
|
4818
4837
|
setTheme: shell.setTheme,
|
|
@@ -4857,8 +4876,10 @@ export {
|
|
|
4857
4876
|
LAYOUTS,
|
|
4858
4877
|
LAYOUT_GROUPS,
|
|
4859
4878
|
MAX_PANES,
|
|
4879
|
+
STRINGS,
|
|
4860
4880
|
createMultiChart,
|
|
4861
4881
|
createTradingChart,
|
|
4862
4882
|
paneCount,
|
|
4863
|
-
resolutionLabel
|
|
4883
|
+
resolutionLabel,
|
|
4884
|
+
stringsOf
|
|
4864
4885
|
};
|
package/dist/pane.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { type Chart, type ChartOptions, type ChartType, type Datafeed, type Resolution } from '@funnest/charts';
|
|
3
3
|
import type { ContextMenuItems, IntervalGroup, MultiControls, SearchCategory, SearchExchange, UiState, WidgetContext } from './context';
|
|
4
4
|
import { type Shell } from './shell';
|
|
5
|
+
import type { Strings } from './i18n';
|
|
5
6
|
import { Store } from './store';
|
|
6
7
|
export interface PaneConfig {
|
|
7
8
|
datafeed: Datafeed;
|
|
@@ -21,6 +22,7 @@ export interface PaneConfig {
|
|
|
21
22
|
contextMenuItems?: ContextMenuItems | undefined;
|
|
22
23
|
onIndicatorsClick?: ((chart: Chart) => void) | undefined;
|
|
23
24
|
multi?: MultiControls | undefined;
|
|
25
|
+
strings?: Partial<Strings> | undefined;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* One chart with its legend/navigation overlay and UI state. The toolbar and drawing bar
|
package/dist/shell.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
1
|
+
import { type DirectionPreset, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
2
2
|
import type { UiState } from './context';
|
|
3
3
|
import { type WidgetStorage } from './storage';
|
|
4
4
|
import type { Store } from './store';
|
|
@@ -35,6 +35,8 @@ export interface ShellPane {
|
|
|
35
35
|
export interface ShellOptions {
|
|
36
36
|
colorScheme: ColorScheme;
|
|
37
37
|
theme: Partial<ThemeTokens> | undefined;
|
|
38
|
+
/** Up/down colors under `theme` (TradingChartOptions.direction, resolved from the locale). */
|
|
39
|
+
direction: DirectionPreset;
|
|
38
40
|
storageKey: string | null;
|
|
39
41
|
drawingToolbar: boolean;
|
|
40
42
|
favoriteIntervals: readonly Resolution[];
|
package/dist/trading-chart.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
|
-
import { type Chart, type ChartOptions, type ChartType, type Datafeed, type Locale, type ChartState, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
2
|
+
import { type Chart, type ChartOptions, type ChartType, type Datafeed, type DirectionPreset, type Locale, type ChartState, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
3
3
|
import type { ContextMenuItems, IntervalGroup, SearchCategory, SearchExchange } from './context';
|
|
4
|
+
import type { Strings } from './i18n';
|
|
4
5
|
import { type ColorScheme, type TradingChartSlots } from './shell';
|
|
5
6
|
export type { ColorScheme, TradingChartSlots } from './shell';
|
|
6
7
|
/** Interval menu: 분 | 시간 | 일. '12M' is shown as 1년. */
|
|
@@ -62,6 +63,21 @@ export interface TradingChartOptions extends Omit<ChartOptions, 'datafeed'> {
|
|
|
62
63
|
* indicator browser). Called with the pane's chart; add indicators with chart.addIndicator().
|
|
63
64
|
*/
|
|
64
65
|
onIndicatorsClick?: (chart: Chart) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Language of the toolbar, menus and dates. Default: Korean when the browser is set to Korean,
|
|
68
|
+
* English otherwise.
|
|
69
|
+
*/
|
|
70
|
+
locale?: Locale;
|
|
71
|
+
/**
|
|
72
|
+
* Replace built-in words: a few (`{ indicators: 'Studies' }`) or all of them for a language of
|
|
73
|
+
* your own (start from `STRINGS.en`). Applied over whichever locale is active.
|
|
74
|
+
*/
|
|
75
|
+
strings?: Partial<Strings>;
|
|
76
|
+
/**
|
|
77
|
+
* Up/down colors: 'kr' red up · blue down, 'global' green up · red down. Default follows the
|
|
78
|
+
* locale ('kr' for Korean, 'global' otherwise). `theme.up` / `theme.down` still win.
|
|
79
|
+
*/
|
|
80
|
+
direction?: DirectionPreset;
|
|
65
81
|
}
|
|
66
82
|
export interface TradingChart {
|
|
67
83
|
/** The underlying engine, for anything the widget doesn't wrap. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
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.18"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"preact": "^11.2.0"
|