acttrader-charts 1.0.12 → 1.0.13

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/README.md CHANGED
@@ -218,7 +218,7 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
218
218
  | `theme` | | `"dark"` | `"dark"` or `"light"` |
219
219
  | `series` | | `"candlestick"` | Initial chart type |
220
220
  | `showVolume` | | `true` | Show volume overlay |
221
- | `showUI` | | `true` | Render top / bottom / left bars |
221
+ | `showUI` | | `true` | Render top / bottom / left bars. When `false`, the loading overlay is also suppressed (mobile wrappers provide their own) |
222
222
  | `showDrawingTools` | | `true` | Show drawing toolbar and pencil button |
223
223
  | `timeframe` | | `"1D"` | Initial timeframe |
224
224
  | `duration` | | — | Initial active duration button |
@@ -295,12 +295,15 @@ import { DEFAULT_UI_CONFIG } from 'acttrader-charts';
295
295
  | Component key | Configurable properties |
296
296
  |---|---|
297
297
  | `drawingToolbar` | `iconBtnSize`, `iconFontSize`, `iconFontFamily`, `flyoutLabelFontSize`, `flyoutLabelFontFamily`, `shortcutFontSize`, `soonBadgeFontSize`, `flyoutHeadingFontSize`, `flyoutHeadingLetterSpacing`, `scrollBtnHeight`, `scrollBtnFontSize`, `barPadding`, `btnGap` |
298
- | `topBar` | `height`, `dropBtnFontSize`, `dropBtnFontFamily`, `drawBtnSize`, `drawBtnIconFontSize`, `flyoutRowFontSize`, `flyoutRowFontFamily`, `flyoutCategoryFontSize`, `flyoutCategoryLetterSpacing`, `flyoutCheckFontSize`, `streamDotSize` |
298
+ | `topBar` | `height`, `dropBtnFontSize`, `dropBtnFontFamily`, `drawBtnSize`, `drawBtnIconFontSize`, `iconBtnSize`, `mobileIconBtnSize`, `mobileDrawBtnIconSize`, `flyoutRowFontSize`, `flyoutRowFontFamily`, `flyoutCategoryFontSize`, `flyoutCategoryLetterSpacing`, `flyoutCheckFontSize`, `streamDotSize` |
299
299
  | `bottomBar` | `height`, `btnFontSize`, `btnFontFamily` |
300
300
  | `priceAxis` | `fontSize`, `fontFamily` |
301
301
  | `timeAxis` | `fontSize`, `fontFamily` |
302
302
  | `crosshair` | `labelHeight`, `labelPaddingX`, `fontSize`, `fontFamily` |
303
303
  | `indicatorOverlay` | `pillFontSize`, `pillFontFamily`, `dotFontSize`, `pillIconFontSize`, `collapseBtnFontSize`, `collapseBtnFontFamily`, `dropdownRowFontSize`, `dropdownRowFontFamily`, `dropdownIconFontSize` |
304
+ | `tradeButton` | `size`, `mobileSize`, `iconSize`, `mobileIconSize` |
305
+
306
+ **Mobile icon sizing:** When the chart container is narrower than `drawingToolbar.mobileBreakpoint` (default `480`), the top-bar icon buttons (settings, fullscreen, drawing toggle) and the floating trade ⊕ button use their mobile sizes automatically. Defaults: top-bar icon buttons grow `26px → 28px` (icon SVG +2px), trade button grows `22px → 24px` (icon `14px → 16px`). Override any of these values via `uiConfig.topBar.mobileIconBtnSize`, `uiConfig.topBar.mobileDrawBtnIconSize`, or `uiConfig.tradeButton.mobileSize` / `mobileIconSize`.
304
307
 
305
308
  **Example:**
306
309
 
@@ -324,6 +327,7 @@ import {
324
327
  DEFAULT_TOP_BAR_CONFIG,
325
328
  DEFAULT_PRICE_AXIS_CONFIG,
326
329
  DEFAULT_CROSSHAIR_CONFIG,
330
+ DEFAULT_TRADE_BUTTON_CONFIG,
327
331
  // ...
328
332
  } from 'acttrader-charts';
329
333
  ```
@@ -472,6 +476,8 @@ chart.setLoading(loading: boolean): this
472
476
  ```ts
473
477
  chart.setSeries(series: SeriesType): this
474
478
  chart.setTheme('dark' | 'light'): this
479
+ chart.setTimeframe(tf: Timeframe): this // change timeframe and reload data
480
+ chart.setThemeOverrides(overrides: ChartConfig['themeOverrides']): this // update per-theme color overrides at runtime
475
481
  chart.setVolume(show: boolean): this
476
482
  ```
477
483
 
@@ -49,6 +49,12 @@ interface TopBarUiConfig {
49
49
  drawBtnSize: string;
50
50
  /** Font size for the icon inside the drawing toggle button */
51
51
  drawBtnIconFontSize: string;
52
+ /** Size (width = height) of icon-only buttons (settings, fullscreen) — desktop */
53
+ iconBtnSize: string;
54
+ /** Size (width = height) of icon-only buttons — mobile override */
55
+ mobileIconBtnSize: string;
56
+ /** SVG icon dimension inside the drawing toggle button — mobile override */
57
+ mobileDrawBtnIconSize: string;
52
58
  /** Font size for flyout list rows */
53
59
  flyoutRowFontSize: string;
54
60
  /** Font family for flyout list rows */
@@ -112,6 +118,16 @@ interface IndicatorOverlayUiConfig {
112
118
  /** Font size for gear ⚙ and remove ✕ icons inside dropdown rows */
113
119
  dropdownIconFontSize: string;
114
120
  }
121
+ interface TradeButtonUiConfig {
122
+ /** Button diameter (px) — desktop */
123
+ size: number;
124
+ /** Button diameter (px) — mobile override */
125
+ mobileSize: number;
126
+ /** SVG icon dimension (px) — desktop */
127
+ iconSize: number;
128
+ /** SVG icon dimension (px) — mobile override */
129
+ mobileIconSize: number;
130
+ }
115
131
  interface UiConfig {
116
132
  drawingToolbar: DrawingToolbarUiConfig;
117
133
  topBar: TopBarUiConfig;
@@ -120,6 +136,7 @@ interface UiConfig {
120
136
  timeAxis: TimeAxisUiConfig;
121
137
  crosshair: CrosshairUiConfig;
122
138
  indicatorOverlay: IndicatorOverlayUiConfig;
139
+ tradeButton: TradeButtonUiConfig;
123
140
  }
124
141
  declare const DEFAULT_DRAWING_TOOLBAR_CONFIG: DrawingToolbarUiConfig;
125
142
  declare const DEFAULT_TOP_BAR_CONFIG: TopBarUiConfig;
@@ -128,6 +145,7 @@ declare const DEFAULT_PRICE_AXIS_CONFIG: PriceAxisUiConfig;
128
145
  declare const DEFAULT_TIME_AXIS_CONFIG: TimeAxisUiConfig;
129
146
  declare const DEFAULT_CROSSHAIR_CONFIG: CrosshairUiConfig;
130
147
  declare const DEFAULT_INDICATOR_OVERLAY_CONFIG: IndicatorOverlayUiConfig;
148
+ declare const DEFAULT_TRADE_BUTTON_CONFIG: TradeButtonUiConfig;
131
149
  declare const DEFAULT_UI_CONFIG: UiConfig;
132
150
  type DeepPartial$1<T> = {
133
151
  [K in keyof T]?: T[K] extends object ? DeepPartial$1<T[K]> : T[K];
@@ -1222,4 +1240,4 @@ declare class MACD implements IIndicator {
1222
1240
  render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
1223
1241
  }
1224
1242
 
1225
- export { type IndicatorResult as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_LABELS as E, DEFAULT_PRICE_AXIS_CONFIG as F, DEFAULT_TIME_AXIS_CONFIG as G, DEFAULT_TOP_BAR_CONFIG as H, type IIndicator as I, DEFAULT_UI_CONFIG as J, type DataLoaderParams as K, type DeepPartial$1 as L, type DeepPartialChartTheme as M, type DialogLabels as N, type OHLCVBar as O, type PriceRange as P, type DrawingToolbarColors as Q, type DrawingToolbarLabels as R, type SeriesType as S, type TradeLevelType as T, type DrawingToolbarUiConfig as U, type Viewport as V, type Duration as W, EMA as X, type IndicatorOverlayColors as Y, type IndicatorOverlayUiConfig as Z, type IndicatorParams as _, type ChartEventMap as a, type IndicatorStateEntry as a0, LIGHT_THEME as a1, MACD as a2, type OhlcLabels as a3, type OrderSubmit as a4, type Padding as a5, type PendingOrderLevel as a6, type PositionLevel as a7, type PositionRenderStyle as a8, type PriceAxisUiConfig as a9, RSI as aa, SMA as ab, type Theme as ac, type TimeAxisUiConfig as ad, type Timeframe as ae, type TopBarColors as af, type TopBarLabels as ag, type TopBarUiConfig as ah, type TradeDisplayFilter as ai, type TradeLabels as aj, type TradeLevel as ak, type TradeLevelColors as al, type TradePanelColors as am, type UiConfig as an, deepMergeTheme as ao, resolveCssVarsInTheme as ap, resolveLabels as aq, resolveUiConfig as ar, type PriceSource as as, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type DrawingPoint as e, ScaleManager as f, type DrawingHandle as g, type SerializedDrawing as h, type Tick as i, type StreamStatus as j, type ActiveIndicatorState as k, type BottomBarColors as l, type BottomBarLabels as m, type BottomBarUiConfig as n, type CanvasColorSettings as o, type ChartLabels as p, type ChartMiscLabels as q, type ChartTheme as r, type ChartThemeUi as s, type CrosshairPosition as t, type CrosshairUiConfig as u, DARK_THEME as v, DEFAULT_BOTTOM_BAR_CONFIG as w, DEFAULT_CROSSHAIR_CONFIG as x, DEFAULT_DRAWING_TOOLBAR_CONFIG as y, DEFAULT_INDICATOR_OVERLAY_CONFIG as z };
1243
+ export { type IndicatorOverlayUiConfig as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_INDICATOR_OVERLAY_CONFIG as E, DEFAULT_LABELS as F, DEFAULT_PRICE_AXIS_CONFIG as G, DEFAULT_TIME_AXIS_CONFIG as H, type IIndicator as I, DEFAULT_TOP_BAR_CONFIG as J, DEFAULT_TRADE_BUTTON_CONFIG as K, DEFAULT_UI_CONFIG as L, type DataLoaderParams as M, type DeepPartial$1 as N, type OHLCVBar as O, type PriceRange as P, type DeepPartialChartTheme as Q, type DialogLabels as R, type SeriesType as S, type Timeframe as T, type DrawingToolbarColors as U, type Viewport as V, type DrawingToolbarLabels as W, type DrawingToolbarUiConfig as X, type Duration as Y, EMA as Z, type IndicatorOverlayColors as _, type ChartEventMap as a, type IndicatorParams as a0, type IndicatorResult as a1, type IndicatorStateEntry as a2, LIGHT_THEME as a3, MACD as a4, type OhlcLabels as a5, type OrderSubmit as a6, type Padding as a7, type PendingOrderLevel as a8, type PositionLevel as a9, type PositionRenderStyle as aa, type PriceAxisUiConfig as ab, RSI as ac, SMA as ad, type Theme as ae, type TimeAxisUiConfig as af, type TopBarColors as ag, type TopBarLabels as ah, type TopBarUiConfig as ai, type TradeButtonUiConfig as aj, type TradeDisplayFilter as ak, type TradeLabels as al, type TradeLevel as am, type TradeLevelColors as an, type TradePanelColors as ao, type UiConfig as ap, deepMergeTheme as aq, resolveCssVarsInTheme as ar, resolveLabels as as, resolveUiConfig as at, type PriceSource as au, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type TradeLevelType as e, type DrawingPoint as f, ScaleManager as g, type DrawingHandle as h, type SerializedDrawing as i, type Tick as j, type StreamStatus as k, type ActiveIndicatorState as l, type BottomBarColors as m, type BottomBarLabels as n, type BottomBarUiConfig as o, type CanvasColorSettings as p, type ChartLabels as q, type ChartMiscLabels as r, type ChartTheme as s, type ChartThemeUi as t, type CrosshairPosition as u, type CrosshairUiConfig as v, DARK_THEME as w, DEFAULT_BOTTOM_BAR_CONFIG as x, DEFAULT_CROSSHAIR_CONFIG as y, DEFAULT_DRAWING_TOOLBAR_CONFIG as z };
@@ -49,6 +49,12 @@ interface TopBarUiConfig {
49
49
  drawBtnSize: string;
50
50
  /** Font size for the icon inside the drawing toggle button */
51
51
  drawBtnIconFontSize: string;
52
+ /** Size (width = height) of icon-only buttons (settings, fullscreen) — desktop */
53
+ iconBtnSize: string;
54
+ /** Size (width = height) of icon-only buttons — mobile override */
55
+ mobileIconBtnSize: string;
56
+ /** SVG icon dimension inside the drawing toggle button — mobile override */
57
+ mobileDrawBtnIconSize: string;
52
58
  /** Font size for flyout list rows */
53
59
  flyoutRowFontSize: string;
54
60
  /** Font family for flyout list rows */
@@ -112,6 +118,16 @@ interface IndicatorOverlayUiConfig {
112
118
  /** Font size for gear ⚙ and remove ✕ icons inside dropdown rows */
113
119
  dropdownIconFontSize: string;
114
120
  }
121
+ interface TradeButtonUiConfig {
122
+ /** Button diameter (px) — desktop */
123
+ size: number;
124
+ /** Button diameter (px) — mobile override */
125
+ mobileSize: number;
126
+ /** SVG icon dimension (px) — desktop */
127
+ iconSize: number;
128
+ /** SVG icon dimension (px) — mobile override */
129
+ mobileIconSize: number;
130
+ }
115
131
  interface UiConfig {
116
132
  drawingToolbar: DrawingToolbarUiConfig;
117
133
  topBar: TopBarUiConfig;
@@ -120,6 +136,7 @@ interface UiConfig {
120
136
  timeAxis: TimeAxisUiConfig;
121
137
  crosshair: CrosshairUiConfig;
122
138
  indicatorOverlay: IndicatorOverlayUiConfig;
139
+ tradeButton: TradeButtonUiConfig;
123
140
  }
124
141
  declare const DEFAULT_DRAWING_TOOLBAR_CONFIG: DrawingToolbarUiConfig;
125
142
  declare const DEFAULT_TOP_BAR_CONFIG: TopBarUiConfig;
@@ -128,6 +145,7 @@ declare const DEFAULT_PRICE_AXIS_CONFIG: PriceAxisUiConfig;
128
145
  declare const DEFAULT_TIME_AXIS_CONFIG: TimeAxisUiConfig;
129
146
  declare const DEFAULT_CROSSHAIR_CONFIG: CrosshairUiConfig;
130
147
  declare const DEFAULT_INDICATOR_OVERLAY_CONFIG: IndicatorOverlayUiConfig;
148
+ declare const DEFAULT_TRADE_BUTTON_CONFIG: TradeButtonUiConfig;
131
149
  declare const DEFAULT_UI_CONFIG: UiConfig;
132
150
  type DeepPartial$1<T> = {
133
151
  [K in keyof T]?: T[K] extends object ? DeepPartial$1<T[K]> : T[K];
@@ -1222,4 +1240,4 @@ declare class MACD implements IIndicator {
1222
1240
  render(ctx: CanvasRenderingContext2D, results: IndicatorResult[], scale: ScaleManager, viewport: Viewport, paneHeight: number, rangeOverride?: PriceRange): void;
1223
1241
  }
1224
1242
 
1225
- export { type IndicatorResult as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_LABELS as E, DEFAULT_PRICE_AXIS_CONFIG as F, DEFAULT_TIME_AXIS_CONFIG as G, DEFAULT_TOP_BAR_CONFIG as H, type IIndicator as I, DEFAULT_UI_CONFIG as J, type DataLoaderParams as K, type DeepPartial$1 as L, type DeepPartialChartTheme as M, type DialogLabels as N, type OHLCVBar as O, type PriceRange as P, type DrawingToolbarColors as Q, type DrawingToolbarLabels as R, type SeriesType as S, type TradeLevelType as T, type DrawingToolbarUiConfig as U, type Viewport as V, type Duration as W, EMA as X, type IndicatorOverlayColors as Y, type IndicatorOverlayUiConfig as Z, type IndicatorParams as _, type ChartEventMap as a, type IndicatorStateEntry as a0, LIGHT_THEME as a1, MACD as a2, type OhlcLabels as a3, type OrderSubmit as a4, type Padding as a5, type PendingOrderLevel as a6, type PositionLevel as a7, type PositionRenderStyle as a8, type PriceAxisUiConfig as a9, RSI as aa, SMA as ab, type Theme as ac, type TimeAxisUiConfig as ad, type Timeframe as ae, type TopBarColors as af, type TopBarLabels as ag, type TopBarUiConfig as ah, type TradeDisplayFilter as ai, type TradeLabels as aj, type TradeLevel as ak, type TradeLevelColors as al, type TradePanelColors as am, type UiConfig as an, deepMergeTheme as ao, resolveCssVarsInTheme as ap, resolveLabels as aq, resolveUiConfig as ar, type PriceSource as as, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type DrawingPoint as e, ScaleManager as f, type DrawingHandle as g, type SerializedDrawing as h, type Tick as i, type StreamStatus as j, type ActiveIndicatorState as k, type BottomBarColors as l, type BottomBarLabels as m, type BottomBarUiConfig as n, type CanvasColorSettings as o, type ChartLabels as p, type ChartMiscLabels as q, type ChartTheme as r, type ChartThemeUi as s, type CrosshairPosition as t, type CrosshairUiConfig as u, DARK_THEME as v, DEFAULT_BOTTOM_BAR_CONFIG as w, DEFAULT_CROSSHAIR_CONFIG as x, DEFAULT_DRAWING_TOOLBAR_CONFIG as y, DEFAULT_INDICATOR_OVERLAY_CONFIG as z };
1243
+ export { type IndicatorOverlayUiConfig as $, type AnyLevel as A, BollingerBands as B, type ChartConfig as C, type DrawingToolType as D, DEFAULT_INDICATOR_OVERLAY_CONFIG as E, DEFAULT_LABELS as F, DEFAULT_PRICE_AXIS_CONFIG as G, DEFAULT_TIME_AXIS_CONFIG as H, type IIndicator as I, DEFAULT_TOP_BAR_CONFIG as J, DEFAULT_TRADE_BUTTON_CONFIG as K, DEFAULT_UI_CONFIG as L, type DataLoaderParams as M, type DeepPartial$1 as N, type OHLCVBar as O, type PriceRange as P, type DeepPartialChartTheme as Q, type DialogLabels as R, type SeriesType as S, type Timeframe as T, type DrawingToolbarColors as U, type Viewport as V, type DrawingToolbarLabels as W, type DrawingToolbarUiConfig as X, type Duration as Y, EMA as Z, type IndicatorOverlayColors as _, type ChartEventMap as a, type IndicatorParams as a0, type IndicatorResult as a1, type IndicatorStateEntry as a2, LIGHT_THEME as a3, MACD as a4, type OhlcLabels as a5, type OrderSubmit as a6, type Padding as a7, type PendingOrderLevel as a8, type PositionLevel as a9, type PositionRenderStyle as aa, type PriceAxisUiConfig as ab, RSI as ac, SMA as ad, type Theme as ae, type TimeAxisUiConfig as af, type TopBarColors as ag, type TopBarLabels as ah, type TopBarUiConfig as ai, type TradeButtonUiConfig as aj, type TradeDisplayFilter as ak, type TradeLabels as al, type TradeLevel as am, type TradeLevelColors as an, type TradePanelColors as ao, type UiConfig as ap, deepMergeTheme as aq, resolveCssVarsInTheme as ar, resolveLabels as as, resolveUiConfig as at, type PriceSource as au, type ChartState as b, type IDrawing as c, type IWebSocketAdapter as d, type TradeLevelType as e, type DrawingPoint as f, ScaleManager as g, type DrawingHandle as h, type SerializedDrawing as i, type Tick as j, type StreamStatus as k, type ActiveIndicatorState as l, type BottomBarColors as m, type BottomBarLabels as n, type BottomBarUiConfig as o, type CanvasColorSettings as p, type ChartLabels as q, type ChartMiscLabels as r, type ChartTheme as s, type ChartThemeUi as t, type CrosshairPosition as u, type CrosshairUiConfig as v, DARK_THEME as w, DEFAULT_BOTTOM_BAR_CONFIG as x, DEFAULT_CROSSHAIR_CONFIG as y, DEFAULT_DRAWING_TOOLBAR_CONFIG as z };
package/dist/index.cjs CHANGED
@@ -428,6 +428,9 @@ var DEFAULT_TOP_BAR_CONFIG = {
428
428
  dropBtnFontFamily: INTER_FONT,
429
429
  drawBtnSize: "26px",
430
430
  drawBtnIconFontSize: "14px",
431
+ iconBtnSize: "26px",
432
+ mobileIconBtnSize: "28px",
433
+ mobileDrawBtnIconSize: "16px",
431
434
  flyoutRowFontSize: "12px",
432
435
  flyoutRowFontFamily: INTER_FONT,
433
436
  flyoutCategoryFontSize: "10px",
@@ -465,6 +468,12 @@ var DEFAULT_INDICATOR_OVERLAY_CONFIG = {
465
468
  dropdownRowFontFamily: INTER_FONT,
466
469
  dropdownIconFontSize: "10px"
467
470
  };
471
+ var DEFAULT_TRADE_BUTTON_CONFIG = {
472
+ size: 22,
473
+ mobileSize: 24,
474
+ iconSize: 14,
475
+ mobileIconSize: 16
476
+ };
468
477
  var DEFAULT_UI_CONFIG = {
469
478
  drawingToolbar: DEFAULT_DRAWING_TOOLBAR_CONFIG,
470
479
  topBar: DEFAULT_TOP_BAR_CONFIG,
@@ -472,7 +481,8 @@ var DEFAULT_UI_CONFIG = {
472
481
  priceAxis: DEFAULT_PRICE_AXIS_CONFIG,
473
482
  timeAxis: DEFAULT_TIME_AXIS_CONFIG,
474
483
  crosshair: DEFAULT_CROSSHAIR_CONFIG,
475
- indicatorOverlay: DEFAULT_INDICATOR_OVERLAY_CONFIG
484
+ indicatorOverlay: DEFAULT_INDICATOR_OVERLAY_CONFIG,
485
+ tradeButton: DEFAULT_TRADE_BUTTON_CONFIG
476
486
  };
477
487
  function resolveUiConfig(override) {
478
488
  if (!override) return DEFAULT_UI_CONFIG;
@@ -483,7 +493,8 @@ function resolveUiConfig(override) {
483
493
  priceAxis: { ...DEFAULT_PRICE_AXIS_CONFIG, ...override.priceAxis },
484
494
  timeAxis: { ...DEFAULT_TIME_AXIS_CONFIG, ...override.timeAxis },
485
495
  crosshair: { ...DEFAULT_CROSSHAIR_CONFIG, ...override.crosshair },
486
- indicatorOverlay: { ...DEFAULT_INDICATOR_OVERLAY_CONFIG, ...override.indicatorOverlay }
496
+ indicatorOverlay: { ...DEFAULT_INDICATOR_OVERLAY_CONFIG, ...override.indicatorOverlay },
497
+ tradeButton: { ...DEFAULT_TRADE_BUTTON_CONFIG, ...override.tradeButton }
487
498
  };
488
499
  }
489
500
 
@@ -3237,6 +3248,9 @@ var TopBar = class {
3237
3248
  this.fullscreenBtn.innerHTML = active ? ICON_FULLSCREEN_EXIT : ICON_FULLSCREEN_ENTER;
3238
3249
  this.fullscreenBtn.title = active ? this.labels.exitFullscreenTitle : this.labels.toggleFullscreenTitle;
3239
3250
  this.applyIconBtnStyles(this.fullscreenBtn, this.theme, active);
3251
+ if (this.isMobileLayout) {
3252
+ this.resizeSvg(this.fullscreenBtn, this.getSvgSize(this.fullscreenBtn) + 2);
3253
+ }
3240
3254
  }
3241
3255
  setDrawingsBtnActive(active) {
3242
3256
  if (!this.drawingBtn) return;
@@ -3289,6 +3303,21 @@ var TopBar = class {
3289
3303
  }
3290
3304
  this.durationSep.style.display = btnDisplay;
3291
3305
  this.durationDropBtn.style.display = isMobile ? "" : "none";
3306
+ const containerSize = isMobile ? this.cfg.mobileIconBtnSize : this.cfg.iconBtnSize;
3307
+ for (const btn of [this.fullscreenBtn, this.settingsBtn, this.drawingBtn]) {
3308
+ if (!btn) continue;
3309
+ btn.style.width = containerSize;
3310
+ btn.style.height = containerSize;
3311
+ }
3312
+ const delta = isMobile ? 2 : -2;
3313
+ this.resizeSvg(this.fullscreenBtn, this.getSvgSize(this.fullscreenBtn) + delta);
3314
+ if (this.settingsBtn) {
3315
+ this.resizeSvg(this.settingsBtn, this.getSvgSize(this.settingsBtn) + delta);
3316
+ }
3317
+ if (this.drawingBtn) {
3318
+ const drawIconSize = isMobile ? parseInt(this.cfg.mobileDrawBtnIconSize, 10) : parseInt(this.cfg.drawBtnIconFontSize, 10);
3319
+ this.resizeSvg(this.drawingBtn, drawIconSize);
3320
+ }
3292
3321
  }
3293
3322
  setIndicatorOptions(options) {
3294
3323
  this.indicatorOptions = options;
@@ -3695,13 +3724,14 @@ var TopBar = class {
3695
3724
  }
3696
3725
  applyIconBtnStyles(btn, theme, active) {
3697
3726
  btn.dataset.active = String(active);
3727
+ const size = this.isMobileLayout ? this.cfg.mobileIconBtnSize : this.cfg.iconBtnSize;
3698
3728
  Object.assign(btn.style, {
3699
3729
  background: active ? theme.ui.accentBg : "transparent",
3700
3730
  color: active ? theme.ui.accentText : theme.topBar.btnColor,
3701
3731
  border: `1px solid ${active ? theme.ui.accent : theme.axisBorder}`,
3702
3732
  borderRadius: "5px",
3703
- width: "26px",
3704
- height: "26px",
3733
+ width: size,
3734
+ height: size,
3705
3735
  cursor: "pointer",
3706
3736
  outline: "none",
3707
3737
  display: "flex",
@@ -3712,6 +3742,20 @@ var TopBar = class {
3712
3742
  transition: "border-color 0.12s, background 0.12s"
3713
3743
  });
3714
3744
  }
3745
+ resizeSvg(btn, size) {
3746
+ if (!btn) return;
3747
+ const svg = btn.querySelector("svg");
3748
+ if (svg) {
3749
+ svg.setAttribute("width", String(size));
3750
+ svg.setAttribute("height", String(size));
3751
+ }
3752
+ }
3753
+ getSvgSize(btn) {
3754
+ if (!btn) return 0;
3755
+ const svg = btn.querySelector("svg");
3756
+ if (!svg) return 0;
3757
+ return parseInt(svg.getAttribute("width") ?? "0", 10);
3758
+ }
3715
3759
  };
3716
3760
 
3717
3761
  // src/ui/BottomBar.ts
@@ -12228,9 +12272,11 @@ var ChartSettingsDialog = class {
12228
12272
 
12229
12273
  // src/ui/TradeButton.ts
12230
12274
  var TradeButton = class {
12231
- constructor(theme, priceAxisWidth, onClick, labels = DEFAULT_LABELS.trade) {
12275
+ constructor(theme, priceAxisWidth, onClick, labels = DEFAULT_LABELS.trade, cfg = DEFAULT_TRADE_BUTTON_CONFIG) {
12232
12276
  this._visible = false;
12277
+ this._isMobile = false;
12233
12278
  this.theme = theme;
12279
+ this.cfg = cfg;
12234
12280
  this.el = document.createElement("button");
12235
12281
  this.el.innerHTML = ICON_PLUS_CIRCLE;
12236
12282
  this.el.title = labels.placeOrderTitle;
@@ -12238,8 +12284,8 @@ var TradeButton = class {
12238
12284
  position: "absolute",
12239
12285
  right: `${priceAxisWidth + 26}px`,
12240
12286
  top: "0",
12241
- width: "22px",
12242
- height: "22px",
12287
+ width: `${cfg.size}px`,
12288
+ height: `${cfg.size}px`,
12243
12289
  borderRadius: "50%",
12244
12290
  border: `1px solid ${theme.axisBorder}`,
12245
12291
  background: theme.tooltip.background,
@@ -12258,6 +12304,7 @@ var TradeButton = class {
12258
12304
  pointerEvents: "auto",
12259
12305
  userSelect: "none"
12260
12306
  });
12307
+ this.applyIconSize(cfg.iconSize);
12261
12308
  this.el.addEventListener("click", (e) => {
12262
12309
  e.stopPropagation();
12263
12310
  onClick();
@@ -12305,6 +12352,27 @@ var TradeButton = class {
12305
12352
  right: `${priceAxisWidth + 26}px`
12306
12353
  });
12307
12354
  }
12355
+ /**
12356
+ * Toggle mobile sizing. When `isMobile` is true, the button diameter and
12357
+ * inner SVG icon are swapped for the configured mobile values; when false,
12358
+ * they revert to desktop values.
12359
+ */
12360
+ setMobileMode(isMobile) {
12361
+ if (this._isMobile === isMobile) return;
12362
+ this._isMobile = isMobile;
12363
+ const size = isMobile ? this.cfg.mobileSize : this.cfg.size;
12364
+ const iconSize = isMobile ? this.cfg.mobileIconSize : this.cfg.iconSize;
12365
+ this.el.style.width = `${size}px`;
12366
+ this.el.style.height = `${size}px`;
12367
+ this.applyIconSize(iconSize);
12368
+ }
12369
+ applyIconSize(size) {
12370
+ const svg = this.el.querySelector("svg");
12371
+ if (svg) {
12372
+ svg.setAttribute("width", String(size));
12373
+ svg.setAttribute("height", String(size));
12374
+ }
12375
+ }
12308
12376
  };
12309
12377
 
12310
12378
  // src/ui/TradePopover.ts
@@ -16486,7 +16554,7 @@ var _ChartEngine = class _ChartEngine {
16486
16554
  Math.min(Math.ceil(this.viewport.endIndex), Math.round(rawBarIndex))
16487
16555
  );
16488
16556
  const bar = this.dataStore.all[clamped] ?? null;
16489
- this.crosshair = isInChartArea && !this.tradePopover?.isVisible ? { x, y, barIndex: clamped, price, bar } : null;
16557
+ this.crosshair = isInChartArea && !this.tradePopover?.isVisible && this.selectedTradeLabel === null ? { x, y, barIndex: clamped, price, bar } : null;
16490
16558
  if (this.crosshair) this.emitter.emit("crosshair", this.crosshair);
16491
16559
  const hoveringDotLevel = this.positionRenderStyle === "dot" && this.hoveredTradeLabel !== null;
16492
16560
  if (this.tradeButton) {
@@ -17005,7 +17073,7 @@ var _ChartEngine = class _ChartEngine {
17005
17073
  Math.min(Math.ceil(this.viewport.endIndex), Math.round(rawBarIndex))
17006
17074
  );
17007
17075
  const bar = this.dataStore.all[clamped] ?? null;
17008
- this.crosshair = { x, y, barIndex: clamped, price, bar };
17076
+ this.crosshair = this.selectedTradeLabel === null ? { x, y, barIndex: clamped, price, bar } : null;
17009
17077
  if (this.tradeButton) {
17010
17078
  this.tradeButton.setY(y);
17011
17079
  if (this._isTradingActive) {
@@ -17615,30 +17683,32 @@ var _ChartEngine = class _ChartEngine {
17615
17683
  padding: "0 2px"
17616
17684
  });
17617
17685
  this.canvasWrap.appendChild(this.textInputEl);
17618
- this.loadingOverlayEl = document.createElement("div");
17619
- Object.assign(this.loadingOverlayEl.style, {
17620
- display: "none",
17621
- position: "absolute",
17622
- top: "0",
17623
- left: "0",
17624
- width: "100%",
17625
- height: "100%",
17626
- alignItems: "center",
17627
- justifyContent: "center",
17628
- pointerEvents: "none",
17629
- zIndex: "20"
17630
- });
17631
- const loadingLabel = document.createElement("span");
17632
- loadingLabel.textContent = this.labels.chart.loading;
17633
- Object.assign(loadingLabel.style, {
17634
- color: "rgba(200,200,200,0.9)",
17635
- fontSize: "13px",
17636
- background: "rgba(0,0,0,0.45)",
17637
- padding: "4px 12px",
17638
- borderRadius: "4px"
17639
- });
17640
- this.loadingOverlayEl.appendChild(loadingLabel);
17641
- this.canvasWrap.appendChild(this.loadingOverlayEl);
17686
+ if (showUI) {
17687
+ this.loadingOverlayEl = document.createElement("div");
17688
+ Object.assign(this.loadingOverlayEl.style, {
17689
+ display: "none",
17690
+ position: "absolute",
17691
+ top: "0",
17692
+ left: "0",
17693
+ width: "100%",
17694
+ height: "100%",
17695
+ alignItems: "center",
17696
+ justifyContent: "center",
17697
+ pointerEvents: "none",
17698
+ zIndex: "20"
17699
+ });
17700
+ const loadingLabel = document.createElement("span");
17701
+ loadingLabel.textContent = this.labels.chart.loading;
17702
+ Object.assign(loadingLabel.style, {
17703
+ color: "rgba(200,200,200,0.9)",
17704
+ fontSize: "13px",
17705
+ background: "rgba(0,0,0,0.45)",
17706
+ padding: "4px 12px",
17707
+ borderRadius: "4px"
17708
+ });
17709
+ this.loadingOverlayEl.appendChild(loadingLabel);
17710
+ this.canvasWrap.appendChild(this.loadingOverlayEl);
17711
+ }
17642
17712
  if (showUI) {
17643
17713
  this.siEl = document.createElement("div");
17644
17714
  Object.assign(this.siEl.style, {
@@ -17770,7 +17840,8 @@ var _ChartEngine = class _ChartEngine {
17770
17840
  );
17771
17841
  }
17772
17842
  },
17773
- this.labels.trade
17843
+ this.labels.trade,
17844
+ this.uiConfig.tradeButton
17774
17845
  );
17775
17846
  this.canvasWrap.appendChild(this.tradeButton.el);
17776
17847
  this.tradeButton.el.addEventListener("mouseenter", () => {
@@ -18370,6 +18441,30 @@ var _ChartEngine = class _ChartEngine {
18370
18441
  this.emitStateChange();
18371
18442
  return this;
18372
18443
  }
18444
+ /** Programmatically change the active timeframe and reload data. */
18445
+ setTimeframe(tf) {
18446
+ this.timeframe = tf;
18447
+ this.topBar?.setTimeframe(tf);
18448
+ this.emitter.emit("timeframeChange", { timeframe: tf });
18449
+ this.emitStateChange();
18450
+ this.updateCountdownState();
18451
+ this.triggerLoad("timeframe");
18452
+ return this;
18453
+ }
18454
+ /** Update per-theme deep-partial color overrides and rebuild the active theme. */
18455
+ setThemeOverrides(overrides) {
18456
+ this.themeOverrides = overrides;
18457
+ this.theme = this.buildTheme(this.themeName);
18458
+ this.topBar?.setTheme(this.theme);
18459
+ this.bottomBar?.setTheme(this.theme);
18460
+ this.leftBar?.setTheme(this.theme);
18461
+ this.tradeButton?.setTheme(this.theme, this.priceAxisWidth);
18462
+ this.tradePopover?.setTheme(this.theme);
18463
+ this.indicatorSettingsDialog?.setTheme(this.theme);
18464
+ this.chartSettingsDialog?.setTheme(this.theme);
18465
+ this.scheduleRender();
18466
+ return this;
18467
+ }
18373
18468
  setSeries(series) {
18374
18469
  this.series = series;
18375
18470
  this.topBar?.setSeries(series);
@@ -19011,12 +19106,13 @@ var _ChartEngine = class _ChartEngine {
19011
19106
  return this;
19012
19107
  }
19013
19108
  /**
19014
- * Set or clear the estimated PNL text shown on a draft order's SL or TP bracket line.
19015
- * Pass `null` to clear the text. No-op if no draft order is active.
19109
+ * Set or clear the estimated PNL text shown on the SL or TP bracket line.
19110
+ * Applies to the currently active bracket host — a draft order while drafting,
19111
+ * or the selected/hovered level while editing an existing pending order or position.
19112
+ * Pass `null` to clear the text.
19016
19113
  * Use this to display the consumer-calculated estimated profit/loss next to the bracket.
19017
19114
  */
19018
19115
  setDraftBracketPnl(type, pnlText) {
19019
- if (!this.draftOrderLabel) return this;
19020
19116
  if (type === "sl") {
19021
19117
  this.draftBracketPnl = { ...this.draftBracketPnl, sl: pnlText ?? void 0 };
19022
19118
  } else {
@@ -19094,6 +19190,7 @@ var _ChartEngine = class _ChartEngine {
19094
19190
  */
19095
19191
  selectLevel(label) {
19096
19192
  this.selectedTradeLabel = label;
19193
+ if (label !== null) this.crosshair = null;
19097
19194
  this.renderTradeLayer();
19098
19195
  return this;
19099
19196
  }
@@ -19619,16 +19716,14 @@ var _ChartEngine = class _ChartEngine {
19619
19716
  if (!level) return;
19620
19717
  if (label === this.draftOrderLabel) {
19621
19718
  const mainEntry = changes.find((c) => c.field === "main");
19622
- const slEntry = changes.find((c) => c.field === "stopLoss" && c.isNew);
19623
- const tpEntry = changes.find((c) => c.field === "takeProfit" && c.isNew);
19624
19719
  const draft = level;
19625
19720
  this._onOrderSubmit?.({
19626
19721
  price: mainEntry?.newPrice ?? draft.price,
19627
19722
  lots: this._minLots,
19628
19723
  side: draft.side,
19629
19724
  orderType: draft.orderType,
19630
- ...slEntry ? { stopLoss: slEntry.newPrice } : {},
19631
- ...tpEntry ? { takeProfit: tpEntry.newPrice } : {}
19725
+ ...draft.stopLossPrice !== void 0 ? { stopLoss: draft.stopLossPrice } : {},
19726
+ ...draft.takeProfitPrice !== void 0 ? { takeProfit: draft.takeProfitPrice } : {}
19632
19727
  });
19633
19728
  this.emitter.emit("tradeLevelConfirmed", {
19634
19729
  label,
@@ -20198,6 +20293,7 @@ var _ChartEngine = class _ChartEngine {
20198
20293
  this._mobileLayout = isMobile;
20199
20294
  this.leftBar?.setMobileMode(isMobile);
20200
20295
  this.topBar?.setMobileLayout(isMobile);
20296
+ this.tradeButton?.setMobileMode(isMobile);
20201
20297
  if (this.siEl) {
20202
20298
  this.siEl.style.flexDirection = isMobile ? "column" : "row";
20203
20299
  this.siEl.style.alignItems = isMobile ? "flex-start" : "center";
@@ -20362,7 +20458,7 @@ var _ChartEngine = class _ChartEngine {
20362
20458
  Math.min(Math.ceil(this.viewport.endIndex), Math.round(rawBarIndex))
20363
20459
  );
20364
20460
  const bar = this.dataStore.all[clamped] ?? null;
20365
- this.crosshair = { x, y, barIndex: clamped, price, bar };
20461
+ this.crosshair = this.selectedTradeLabel === null ? { x, y, barIndex: clamped, price, bar } : null;
20366
20462
  if (this.tradeButton) {
20367
20463
  this.tradeButton.setY(y);
20368
20464
  if (this._isTradingActive) {
@@ -20838,6 +20934,7 @@ exports.DEFAULT_LABELS = DEFAULT_LABELS;
20838
20934
  exports.DEFAULT_PRICE_AXIS_CONFIG = DEFAULT_PRICE_AXIS_CONFIG;
20839
20935
  exports.DEFAULT_TIME_AXIS_CONFIG = DEFAULT_TIME_AXIS_CONFIG;
20840
20936
  exports.DEFAULT_TOP_BAR_CONFIG = DEFAULT_TOP_BAR_CONFIG;
20937
+ exports.DEFAULT_TRADE_BUTTON_CONFIG = DEFAULT_TRADE_BUTTON_CONFIG;
20841
20938
  exports.DEFAULT_UI_CONFIG = DEFAULT_UI_CONFIG;
20842
20939
  exports.DatePriceRange = DatePriceRange;
20843
20940
  exports.DateRange = DateRange;