@fintatech/fintachart 3.1.10 → 3.1.12

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/CHANGELOG.md CHANGED
@@ -5,6 +5,83 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.12] - 2026-08-11
9
+
10
+ ### Added
11
+
12
+ - Added **date-range presets bar** in the bottom toolbar (`1D 5D 1M 3M 6M YTD 1Y 5Y All` + a calendar button opening a **custom date range** popup with From/To inputs). Presets switch to a suitable timeframe (resolved against `supportedTimeFrames`) and show the requested period; the custom range auto-picks a timeframe targeting ~200 bars. New public API `Chart.setVisibleDateRange(startDate, endDate?, timeFrame?)` — loads missing history (batched `moreBars` requests) before applying the range; `startDate: null` shows all available history. New `calendar` SVG icon and `dateRange.*` localization keys (en, uk).
13
+ - Custom in-house **date picker** for the date-range popup (`ToolbarCalendar`). The native `<input type="date">` fields are replaced with read-only text fields carrying a `calendar` icon and a themed calendar panel with month/year navigation, "Today" and "Clear" actions. New `dateRange.clear`, `dateRange.today`, `dateRange.months` and `dateRange.weekdaysShort` localization keys (en, uk).
14
+ - Compact **drop-up menu** for the date range, shown whenever the inline preset chips no longer fit the bottom bar. Lists every preset with a descriptive hint (e.g. "5 days in 15 minutes intervals") plus a "Go to…" item that opens the custom-range popup. New `dateRange.label`, `dateRange.goto` and `dateRange.menu.*` localization keys (en, uk).
15
+ - Mobile layout for the bottom toolbar: phones always get the drop-up menu (inline chips are too small as touch targets and never fit), and the bar gains responsive `tcdBarNarrow` (< 480 px) / `tcdBarTiny` (< 330 px) modes so the timezone selector shrinks instead of breaking the layout. A new `onDocumentTap` helper de-duplicates `touchend` / `click` (700 ms window) so a single tap doesn't both open and close the menu (`Toolbar`).
16
+ - **Render Quality** setting (Low / Medium / High) in the Main Settings dialog (`tcdMainSettings_renderQuality`). Exposed as `Chart.renderQuality`, it caps device-pixel-ratio (`HtmlHelper.dprCap` → 1 / 2 / unlimited), scales `horizontalScale.maxVisibleBars` (base 750 mobile / 2000 desktop, ×0.5 / ×1 / ×1.5) and clamps `RefreshOptimizer.interval` (30 fps / 60 fps / native), trading sharpness for speed on weak devices. New `theme.dialog.renderQuality.*` localization keys (en, uk).
17
+ - Indicator values in the **OHLC card**. New public `Indicator.hoverValues(record?)` returning one `IIndicatorHoverValue { name, color, value }` per plot (falling back to the last record when the hovered one is out of range). The primary pane's card lists every indicator on the chart, including those living on their own sub-panes; sub-pane cards list only their own. New `tcdOHLCCard_indicators*` style hooks (`Indicator`, `Pane`, `Toolbar`, `OHLCCard.scss`).
18
+ - Shape rendering driven by indicator data: an indicator can now emit drawing shapes together with its values, including shapes arriving with real-time stream updates (`Indicator`).
19
+ - **BBCode** parsing and rendering in text shapes — new `Utils/BBCode.ts` module wired into `TextShape`, so indicator-supplied and user text can carry inline markup.
20
+
21
+ ### Changed
22
+
23
+ - Chart rendering optimization pass (`Chart`, `Pane`, `CanvasRenderer`, `CanvasLayer`, `RefreshOptimizer`, `DomUtils`): `window.resize` handling is now `requestAnimationFrame`-throttled behind a pending guard with `isDisposed` / `_rootDiv` checks; new throttled `Chart.refreshOnTickAsync()` (25 ms floor, called from `DatafeedCore`) keeps an active feed from forcing a full repaint every tick, and its timer is cleared in `dispose()`; bounding rects are cached via `DomUtils.cachedBoundingRect` (used by `CrossHairComponent` instead of `offsetWidth`, removing layout thrash); gradients are cached; wheel and move events accumulate before dispatch (`MouseWheelMotionEvent`, `MoveMotionEvent`); horizontal-scale ticks are built only for the visible window (`FloatingHorizontalAxisAdapter`).
24
+ - `BarPlot.drawBars` accepts an optional `yCache: Float64Array[]`, so open/close/high/low pixel coordinates are computed once per repaint instead of calling `coordinateMapper.yByValue` per bar.
25
+ - `TradingSessionHoursCheck()` re-enabled (`ChartTypeBase`) — the whole body had been commented out. RTH/ETH bar recalculation, the `TRADING_SESSION_UPDATE` event, indicator refresh and scale refresh work again.
26
+ - Dev-only on-screen FPS / frame-time meter added to `Chart` (localhost and private IPs only) for rendering diagnostics.
27
+
28
+ ### Fixed
29
+
30
+ - Flickering and initialization errors for charts in inactive (hidden) tabs (`Chart`, `HorizontalScale`). The `hasRenderSize()` guards were removed from `paint()`, `refresh()` and `InitializeVisualDimensions()` so a hidden chart still initializes and paints at 0 px — canvases, axes and renderers exist by the time positions or orders arrive in a background tab. `HorizontalScale` keeps the last valid column width instead of poisoning pixel→record conversions (and ignores pixel scrolls with an invalid width), and the hidden→visible transition refreshes synchronously so the first painted frame is already correct.
31
+ - Trade label overlapping when several positions are on the chart (`PositionBar`, `PositionTPSL`, `STTP`, `OrderBar`, `OrderLabel`, `StopLoss`, `TakeProfit`, `HorizontalAxis`). The `kind` / `quantity` text widths were module-level globals shared by every position bar and are now per-instance fields.
32
+ - OHLC cards could be dragged outside the chart and break; they are now clamped to the chart bounds (`Chart`, `Pane`, `Draggable`, `OHLCCard.scss`).
33
+ - Volume bar normalization in the OHLC card (`Pane`).
34
+ - Duplicate indicator "frames" appearing on save, caused by an unmanaged restore-indicators timer (`Chart`).
35
+ - Incorrect rendering of shapes arriving with real-time indicator updates (`Indicator`, `TextShape`).
36
+ - Incorrect parsing of numbers written with a thousand separator in the shape settings "Points" tab (`ShapeCoordinatePane`).
37
+ - Horizontal-scale glitches when applying a custom date range (`Chart`, `FloatingHorizontalAxisAdapter`).
38
+ - Assorted mobile fixes: compare-instrument settings, chart snapshot handling, pane interaction, shape templates, instrument search, toolbar drop-downs and drag panes (`CompareInstrumentSettings`, `ChartSnapshotHandler`, `Pane`, `ShapeTemplateSettings`, `InstrumentSearch`, `Toolbar`, `ToolbarDropDownButton`, `DragPane`, `Draggable`).
39
+
40
+ ## [3.1.11] - 2026-07-06
41
+
42
+ ### Added
43
+
44
+ - Position drawing shape: leverage-based position sizing. New `leverage` option on `PositionDrawingShape` (defaults to `1`) drives `Qty = (accountSize × leverage) / entryPrice` — stop distance no longer affects sizing. New calc outputs `accountTooSmall` / `minLotSize` (derived from `instrument.mappings[provider].minOrderSize / contractSize`), new `ShapeEvent.ACCOUNT_TOO_SMALL_CHANGED` event, and an in-canvas "Account size is too small for this instrument" warning. Settings dialog gains a Leverage input. Aligns with TradingView's position-tool sizing model.
45
+ - **"Default"** button in the Indicator Settings dialog (`tcdIndicatorDialog_btn_default`) resets the indicator's parameters via a confirmation prompt: builds a fresh indicator of the same type, applies `resetDefaults()`, dispatches an `UpdateIndicatorCommand` (so the change is undoable), and rebuilds all tab controls without closing the dialog. Visibility tab is now also revealed when applicable.
46
+ - `TradingTool.getDisplayedBidAsk(fallbackPrice?)` protected helper returning current `{ bid, ask }` from `chart.lastBid` / `chart.lastAsk`, falling back to the last close or supplied price when the live quote is missing or non-positive. Used by SL/TP validation for open positions.
47
+ - New chart-level toast localization keys for the copy-image flow: `toolbar.snapshot.copyImageSuccess`, `toolbar.snapshot.copyImageDownloaded`, `toolbar.snapshot.copyImageFailed` (en, uk).
48
+ - Draggable **OHLC card** overlay showing O/H/L/C plus **Volume** and **Change**, toggled from a new toolbar **"OHLC Cards"** menu. Ships five display variants — Compact, Outline, Compact Row, Bluetab, and Progress Bars — with an `open-OHLC-card` toolbar icon and en/uk localization (`OHLCCard`, `Pane`, `Toolbar`, `Draggable`).
49
+ - Two new indicator parameters — **Multiplier** and **Box Ratio Smoothing** — exposed across the volume/flow indicators (AD Index, Chaikin Money Flow, Chaikin Oscillator, Ease of Movement, OBV, TRIX, Volume Oscillator), wired through `IndicatorParam` and the parameter-control factory with en/uk labels.
50
+ - Pending-confirmation state for chart trading via `TradingTool.setDimmed(value)`: an order or position dims (its theme colors multiplied) while a placement or modification awaits backend confirmation, preventing duplicate actions. Take-profit and stop-loss lines are now also supported on open-position bars (`OrderBar`, `PositionBar`, `StopLoss`, `TakeProfit`, `TradingTool`).
51
+
52
+ ### Changed
53
+
54
+ - Order-entry panel ("trade from the chart"): the quantity calculator gains preset value buttons populated from the instrument's static quantities plus a toggleable "set" action, and limit/stop inputs now seed through `NumericField.setValue` for correct tick formatting (`Toolbar`).
55
+ - Stop-limit order rendering improved (`OrderBar`, `STTP`, `Chart`), with dedicated stop-limit color tokens added to all bundled themes (default, dark, fintatech dark, gray, olive, orange, purple, sky, teal).
56
+ - Position drawing tool: Open P&L formula corrected, and its color rendering and context menu updated (`PositionDrawingShape`, `OrderBar`, `PositionShapeContextMenu`, en/uk).
57
+ - Fibonacci drawing settings and drawing-template behavior reworked (`FibonacciShapeSettings`, `ShapeCoordinatePane`, `ShapeSettingsDragPane`, `ShapeTemplateSettings`, `ColorPicker`), including the templates drop-down styling.
58
+ - Shape settings dialog restyled with updated drop-down handling and a refreshed "Points" modal (`ShapeSettingsDialog`, `ToolbarDropDownButton`).
59
+ - Alert editing from the chart's trading context menu improved (`TradingContextMenu`).
60
+ - `ChartSnapshotHandler.saveToClipboard()` rewritten: now uses the async `navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })])` pattern that satisfies Safari/Firefox's "user activation must be the same task as the write" rule. Adds a one-shot `window.focus` retry on `NotAllowedError: document is not focused`, a `clipboardUnavailableReason()` pre-check, and a graceful fallback that downloads the image and surfaces a `copyImageDownloaded` / `copyImageFailed` chart toast when the clipboard write cannot succeed. Fixes "Impossible to copy chart image" in the embedded widget.
61
+ - SL/TP validation for an open position now clamps against the live bid/ask instead of the position's entry price (`PositionBar`, `StopLoss`, `TakeProfit`, `TradingTool`): longs require `SL < bid` and `TP > ask`; shorts require `SL > ask` and `TP < bid`. Shift-key bypass remains available only for pending orders — for positions, validation always runs. Out-of-range values now snap via `formatValue(...)` to honor tick precision.
62
+ - Crosshair behavior on touch devices (`Chart.bindTouchPan`, `Pane`): when `crossHairType` is `CROSS` or `CROSS_BARS`, touch-pan is now disabled on `Chart` and pane drag short-circuits on mobile, so the crosshair stays put under the finger instead of scrolling the chart. Desktop crosshair drag is unaffected; the non-crosshair drag path no longer requires `PointerKind.MOUSE`, restoring touch-scroll parity when the crosshair is off.
63
+ - Scroll-to-latest-bar, zoom hotkeys, and arrow-key panning now refresh with `primaryPane.isPreservingAutoScaling` instead of forcing auto-scale on every refresh (`Chart`, `HotkeysHandler`, `Pane`). The user's current vertical zoom is preserved across these actions when auto-scale has been opted out of.
64
+ - Currency conversion in `TradingTool` simplified to `profitUSD = profitInQuote * rate`. Removed the prior USD-base branch that inverted the rate based on `conversionRate.symbol` (caused incorrect P/L when the conversion symbol parser misclassified the pair).
65
+ - Instrument watermark now reads the exchange from `instrument.mappings[provider].exchange` and only appends the " - exchange" suffix when that mapping exists; missing `provider` / `mappings` no longer throws (`InstrumentWatermark`).
66
+ - Mobile shape selection: tapping a selectable drawing now opens its settings pane — the previous `!UserAgent.isMobile` gate on `Shape.showSettingsPane()` blocked this on phones/tablets. Now gated on `selected && _shapeState !== MOVING` instead.
67
+ - Mobile shape interaction: pane click now hides all shape tooltips first (so a stale tooltip can't intercept the next tap); long-press context menu uses `clickHitTest(point)` so the press only fires on the shape's hit region; touch-pan is suppressed only when the touch starts outside the panes frame or hits a shape. Toolbar drop-down buttons with children on mobile always toggle the dropdown on tap, regardless of which sub-target was hit.
68
+ - Toolbar "remove all" interactions on mobile: lock-shapes button now calls `e.preventDefault()` so the click doesn't bubble to the dropdown and dismiss it before the action runs.
69
+ - `Dialog.close()` preserves the prior `hotkeysEnabled` state when `_keyboardEnabledState` is null (`?? this.config.chart.hotkeysEnabled`), so closing a freshly-opened "reset to defaults" dialog no longer leaves hotkeys disabled.
70
+ - `ChartSnapshotHandler` now reads `this.chart.rootDiv` directly (previously `this.chart.rootDiv.get(0)`, a leftover jQuery-style access) and removed the unused `MimeType.PNG` enum export.
71
+ - Event-handler typing: `event.evt` is explicitly narrowed to `globalThis.MouseEvent` for the `shiftKey` check in `StopLoss` / `TakeProfit` to avoid a Konva ambient-type collision.
72
+
73
+ ### Fixed
74
+
75
+ - Chart logo/asset now re-renders correctly when a chart is restored from saved state (`InstrumentWatermark`).
76
+ - `Chart.restoreVisibleRange` now handles edge cases where the chart has few visible records.
77
+ - Chart navigation: the timeframe picker and toolbar drop-down toggle no longer misbehave (`TimeFramePicker`, `ToolbarDropDownButton`).
78
+ - Incorrect take-profit / stop-loss label behavior on the chart (`PositionTPSL`, `STTP`).
79
+ - Chart-type selector failing to open on Chrome (`Toolbar`, `ToolbarDropDownButton`).
80
+ - Incorrect chart behavior while the chart is inactive or backgrounded (`Chart`).
81
+ - Mobile chart lag during history scrolling (`Chart`, `Pane`, `HorizontalAxis`, `RefreshOptimizer`).
82
+ - Duplicated indicator title "frames" on the chart (`Chart`).
83
+ - Assorted mobile chart-behavior fixes across dialogs, context menu, instrument search, and toolbar (`Chart`, `Dialog`, `ContextMenu`, `InstrumentSearch`, `Toolbar`).
84
+
8
85
  ## [3.1.10] - 2026-05-18
9
86
 
10
87
  ### Fixed
@@ -135,6 +212,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
135
212
 
136
213
  - Initial public release of `@fintatech/fintachart`
137
214
 
215
+ [3.1.12]: https://github.com/fintatech/fintachart/releases/tag/v3.1.12
216
+ [3.1.11]: https://github.com/fintatech/fintachart/releases/tag/v3.1.11
138
217
  [3.1.10]: https://github.com/fintatech/fintachart/releases/tag/v3.1.10
139
218
  [3.1.9]: https://github.com/fintatech/fintachart/releases/tag/v3.1.9
140
219
  [3.1.8]: https://github.com/fintatech/fintachart/releases/tag/v3.1.8