@funnest/charts-ui 0.8.6 → 0.8.7

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 CHANGED
@@ -101,6 +101,16 @@ export interface ToolsMenuItem {
101
101
  disabled?: boolean;
102
102
  onSelect(chart: Chart): void;
103
103
  }
104
+ /** A switch an app adds to 차트 설정 (e.g. extended hours for a stock), under its own heading. */
105
+ export interface SettingsToggle {
106
+ label: string;
107
+ /** A line under the label. */
108
+ hint?: string;
109
+ checked: boolean;
110
+ onChange(checked: boolean): void;
111
+ }
112
+ /** The app's switches for 차트 설정, asked when it opens (for the pane's chart); none: no section. */
113
+ export type SettingsToggles = (chart: Chart) => SettingsToggle[];
104
114
  /** The app's rows for the 도구 menu, asked each time it opens (for the pane's chart). */
105
115
  export type ToolsMenuItems = (chart: Chart) => ToolsMenuItem[];
106
116
  /**
@@ -152,6 +162,7 @@ export interface WidgetContext {
152
162
  priceAxisActions: PriceAxisActions | undefined;
153
163
  drawingActions: DrawingActions | undefined;
154
164
  toolsMenuItems: ToolsMenuItems | undefined;
165
+ settingsToggles: SettingsToggles | undefined;
155
166
  legendValues: LegendValues;
156
167
  /** The app's own indicator browser for the 지표 button (instead of the built-in picker). */
157
168
  onIndicatorsClick: ((chart: Chart) => void) | undefined;
package/dist/i18n.d.ts CHANGED
@@ -53,6 +53,7 @@ export declare const STRINGS: {
53
53
  settingsTheme: string;
54
54
  settingsCandles: string;
55
55
  settingsDisplay: string;
56
+ settingsSymbol: string;
56
57
  settingsGrid: string;
57
58
  settingUpColor: string;
58
59
  settingDownColor: string;
@@ -252,6 +253,7 @@ export declare const STRINGS: {
252
253
  settingsTheme: string;
253
254
  settingsCandles: string;
254
255
  settingsDisplay: string;
256
+ settingsSymbol: string;
255
257
  settingsGrid: string;
256
258
  settingUpColor: string;
257
259
  settingDownColor: string;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export { createMultiChart } from './multi-chart.js';
8
8
  export type { MultiChart, MultiChartEvents, MultiChartOptions, MultiChartState, PaneSpec } from './multi-chart.js';
9
9
  export { LAYOUT_GROUPS, LAYOUTS, MAX_PANES, paneCount } from './layouts.js';
10
10
  export type { LayoutId, SplitNode, SplitSizes } from './layouts.js';
11
- export type { ContextMenuItem, ContextMenuItems, DrawingAction, DrawingActions, IntervalGroup, PriceAxisActions, LayoutSync, LegendValues, SearchCategory, SearchExchange, ToolsMenuItem, ToolsMenuItems } from './context.js';
11
+ export type { ContextMenuItem, ContextMenuItems, DrawingAction, DrawingActions, IntervalGroup, PriceAxisActions, SettingsToggle, SettingsToggles, LayoutSync, LegendValues, SearchCategory, SearchExchange, ToolsMenuItem, ToolsMenuItems } from './context.js';
12
12
  export type { ColorScheme, TradingChart, TradingChartOptions, TradingChartSlots } from './trading-chart.js';
13
13
  export { resolutionLabel, STRINGS, stringsOf, type Strings } from './i18n.js';
package/dist/index.js CHANGED
@@ -479,6 +479,7 @@ var STRINGS = {
479
479
  settingsTheme: "\uD14C\uB9C8",
480
480
  settingsCandles: "\uCE94\uB4E4",
481
481
  settingsDisplay: "\uD45C\uC2DC",
482
+ settingsSymbol: "\uC774 \uC885\uBAA9",
482
483
  settingsGrid: "\uACA9\uC790",
483
484
  settingUpColor: "\uC0C1\uC2B9 \uC0C9",
484
485
  settingDownColor: "\uD558\uB77D \uC0C9",
@@ -680,6 +681,7 @@ var STRINGS = {
680
681
  settingsTheme: "Theme",
681
682
  settingsCandles: "Candles",
682
683
  settingsDisplay: "Display",
684
+ settingsSymbol: "This symbol",
683
685
  settingsGrid: "Grid",
684
686
  settingUpColor: "Up color",
685
687
  settingDownColor: "Down color",
@@ -1848,6 +1850,8 @@ function SettingsDialog({ ctx }) {
1848
1850
  const { locale } = useStore(ctx.store);
1849
1851
  const t3 = stringsOf(ctx.store.get());
1850
1852
  const [settings, setSettings] = d2(ctx.chart.settings);
1853
+ const [, bump] = d2(0);
1854
+ const appToggles = ctx.settingsToggles?.(ctx.chart) ?? [];
1851
1855
  A2(() => ctx.chart.on("settingsChange", setSettings), [ctx.chart]);
1852
1856
  const close = () => ctx.store.set({ dialog: null });
1853
1857
  const set = (patch) => ctx.chart.setSettings(patch);
@@ -1929,6 +1933,26 @@ function SettingsDialog({ ctx }) {
1929
1933
  )
1930
1934
  ] }))
1931
1935
  ] })),
1936
+ appToggles.length > 0 && /* @__PURE__ */ a3("div", { class: "fnc-section", children: t3.settingsSymbol }),
1937
+ appToggles.map((item) => /* @__PURE__ */ a3("label", { class: "fnc-row fnc-toggle-row", children: [
1938
+ /* @__PURE__ */ a3("span", { children: [
1939
+ item.label,
1940
+ item.hint && /* @__PURE__ */ a3("small", { class: "fnc-toggle-hint", children: item.hint })
1941
+ ] }),
1942
+ /* @__PURE__ */ a3(
1943
+ "input",
1944
+ {
1945
+ type: "checkbox",
1946
+ role: "switch",
1947
+ class: "fnc-switch",
1948
+ checked: item.checked,
1949
+ onChange: (e3) => {
1950
+ item.onChange(e3.currentTarget.checked);
1951
+ bump((n2) => n2 + 1);
1952
+ }
1953
+ }
1954
+ )
1955
+ ] })),
1932
1956
  /* @__PURE__ */ a3("div", { class: "fnc-form-actions", children: [
1933
1957
  /* @__PURE__ */ a3("button", { type: "button", class: "fnc-action fnc-action-danger", onClick: () => ctx.chart.setSettings(DEFAULT_CHART_SETTINGS), children: t3.resetDefaults }),
1934
1958
  /* @__PURE__ */ a3("button", { type: "submit", class: "fnc-action fnc-action-primary", children: t3.done })
@@ -4394,6 +4418,9 @@ var CSS = (
4394
4418
  @media (hover: none) {
4395
4419
  .fnc-nav { display: none; }
4396
4420
  }
4421
+ /* \uCC28\uD2B8 \uC124\uC815: an app switch's line under its label. */
4422
+ .fnc-toggle-hint { display: block; margin-top: 2px; font-size: 12px; color: var(--fnc-text-2); }
4423
+
4397
4424
  /* A setting in a menu (\uBD80\uB4DC\uB7EC\uC6B4 \uC2A4\uD06C\uB864\xB7\uD655\uB300): the check at the end. */
4398
4425
  .fnc-menu-check svg { margin-left: auto; color: var(--fnc-accent); }
4399
4426
 
@@ -5346,6 +5373,7 @@ function createPane(shell, config) {
5346
5373
  priceAxisActions: config.priceAxisActions,
5347
5374
  drawingActions: config.drawingActions,
5348
5375
  toolsMenuItems: config.toolsMenuItems,
5376
+ settingsToggles: config.settingsToggles,
5349
5377
  legendValues: config.legendValues ?? "always",
5350
5378
  onIndicatorsClick: config.onIndicatorsClick,
5351
5379
  slots: shell.slots,
@@ -5433,6 +5461,7 @@ function createTradingChart(container, options) {
5433
5461
  contextMenuItems,
5434
5462
  priceAxisActions,
5435
5463
  drawingActions,
5464
+ settingsToggles,
5436
5465
  toolsMenuItems,
5437
5466
  legendValues,
5438
5467
  onIndicatorsClick,
@@ -5469,6 +5498,7 @@ function createTradingChart(container, options) {
5469
5498
  contextMenuItems,
5470
5499
  priceAxisActions,
5471
5500
  drawingActions,
5501
+ settingsToggles,
5472
5502
  toolsMenuItems,
5473
5503
  legendValues,
5474
5504
  onIndicatorsClick,
@@ -5549,6 +5579,7 @@ function createMultiChart(container, options) {
5549
5579
  contextMenuItems,
5550
5580
  priceAxisActions,
5551
5581
  drawingActions,
5582
+ settingsToggles,
5552
5583
  toolsMenuItems,
5553
5584
  legendValues,
5554
5585
  onIndicatorsClick,
@@ -5627,6 +5658,7 @@ function createMultiChart(container, options) {
5627
5658
  contextMenuItems,
5628
5659
  priceAxisActions,
5629
5660
  drawingActions,
5661
+ settingsToggles,
5630
5662
  toolsMenuItems,
5631
5663
  legendValues,
5632
5664
  onIndicatorsClick,
package/dist/pane.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource preact */
2
2
  import { type Chart, type ChartOptions, type ChartType, type Datafeed, type Resolution } from '@funnest/charts';
3
- import type { ContextMenuItems, DrawingActions, IntervalGroup, LegendValues, MultiControls, PriceAxisActions, SearchCategory, SearchExchange, ToolsMenuItems, UiState, WidgetContext } from './context.js';
3
+ import type { ContextMenuItems, DrawingActions, IntervalGroup, LegendValues, MultiControls, PriceAxisActions, SearchCategory, SearchExchange, SettingsToggles, ToolsMenuItems, UiState, WidgetContext } from './context.js';
4
4
  import { type Shell } from './shell.js';
5
5
  import type { Strings } from './i18n.js';
6
6
  import { Store } from './store.js';
@@ -23,6 +23,7 @@ export interface PaneConfig {
23
23
  priceAxisActions?: PriceAxisActions | undefined;
24
24
  drawingActions?: DrawingActions | undefined;
25
25
  toolsMenuItems?: ToolsMenuItems | undefined;
26
+ settingsToggles?: SettingsToggles | undefined;
26
27
  legendValues?: LegendValues | undefined;
27
28
  onIndicatorsClick?: ((chart: Chart) => void) | undefined;
28
29
  multi?: MultiControls | undefined;
@@ -1,6 +1,6 @@
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, DrawingActions, IntervalGroup, LegendValues, PriceAxisActions, SearchCategory, SearchExchange, ToolsMenuItems } from './context.js';
3
+ import type { ContextMenuItems, DrawingActions, IntervalGroup, LegendValues, PriceAxisActions, SearchCategory, SearchExchange, SettingsToggles, ToolsMenuItems } from './context.js';
4
4
  import type { Strings } from './i18n.js';
5
5
  import { type ColorScheme, type TradingChartSlots } from './shell.js';
6
6
  export type { ColorScheme, TradingChartSlots } from './shell.js';
@@ -62,6 +62,8 @@ export interface TradingChartOptions extends Omit<ChartOptions, 'datafeed'> {
62
62
  priceAxisActions?: PriceAxisActions;
63
63
  /** Buttons on the bar of a selected drawing (e.g. 알림 on a trend line) — how phones reach drawing actions. */
64
64
  drawingActions?: DrawingActions;
65
+ /** The app's own switches in 차트 설정 (e.g. extended hours for US stocks), asked when it opens. */
66
+ settingsToggles?: SettingsToggles;
65
67
  /**
66
68
  * Extra rows for the 도구 (tools) menu, above 차트 설정 — e.g. the app's own display settings.
67
69
  * Called each time the menu opens, with the pane's chart.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
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.8.6"
45
+ "@funnest/charts": "0.8.7"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"