@funnest/charts-ui 0.8.5 → 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,13 +4418,17 @@ 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
 
4400
4427
  /* \uB0A0\uC9DC\uB85C \uC774\uB3D9: a date typed or picked on a month calendar. */
4401
4428
  .fnc-goto-dialog { width: min(320px, calc(100% - 32px)); }
4402
4429
  .fnc-goto-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px 16px; }
4403
- .fnc-goto-input { height: 38px; font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
4430
+ /* flex: none \u2014 the base .fnc-input grows (flex: 1), which in this column squeezed it to its text height. */
4431
+ .fnc-goto-dialog .fnc-goto-input { flex: none; height: 42px; padding: 0 12px; font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
4404
4432
  .fnc-goto-input[aria-invalid="true"] { box-shadow: 0 0 0 1px var(--fnc-down, #f04452); }
4405
4433
  .fnc-cal-head { display: flex; align-items: center; gap: 2px; }
4406
4434
  .fnc-cal-head b { flex: 1; text-align: center; font-size: 14px; }
@@ -5345,6 +5373,7 @@ function createPane(shell, config) {
5345
5373
  priceAxisActions: config.priceAxisActions,
5346
5374
  drawingActions: config.drawingActions,
5347
5375
  toolsMenuItems: config.toolsMenuItems,
5376
+ settingsToggles: config.settingsToggles,
5348
5377
  legendValues: config.legendValues ?? "always",
5349
5378
  onIndicatorsClick: config.onIndicatorsClick,
5350
5379
  slots: shell.slots,
@@ -5432,6 +5461,7 @@ function createTradingChart(container, options) {
5432
5461
  contextMenuItems,
5433
5462
  priceAxisActions,
5434
5463
  drawingActions,
5464
+ settingsToggles,
5435
5465
  toolsMenuItems,
5436
5466
  legendValues,
5437
5467
  onIndicatorsClick,
@@ -5468,6 +5498,7 @@ function createTradingChart(container, options) {
5468
5498
  contextMenuItems,
5469
5499
  priceAxisActions,
5470
5500
  drawingActions,
5501
+ settingsToggles,
5471
5502
  toolsMenuItems,
5472
5503
  legendValues,
5473
5504
  onIndicatorsClick,
@@ -5548,6 +5579,7 @@ function createMultiChart(container, options) {
5548
5579
  contextMenuItems,
5549
5580
  priceAxisActions,
5550
5581
  drawingActions,
5582
+ settingsToggles,
5551
5583
  toolsMenuItems,
5552
5584
  legendValues,
5553
5585
  onIndicatorsClick,
@@ -5626,6 +5658,7 @@ function createMultiChart(container, options) {
5626
5658
  contextMenuItems,
5627
5659
  priceAxisActions,
5628
5660
  drawingActions,
5661
+ settingsToggles,
5629
5662
  toolsMenuItems,
5630
5663
  legendValues,
5631
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.5",
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.5"
45
+ "@funnest/charts": "0.8.7"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"