lightweight-charts-drawing 0.6.1 → 0.6.2

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
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.2 (15/10/2026)
4
+
5
+ ### Changed
6
+
7
+ - Drawing points are on whole bars, as in the reference app: a time between
8
+ two bars (a point drawn on another interval, a time in a gap between
9
+ sessions) is drawn on the bar that holds it, the last bar opening at or
10
+ before it (`timeToX`, `timeToBarIndex`, `timeToXFallback`); it was
11
+ interpolated between the two bars. The stored time is kept, so the point
12
+ comes back to its own bar on its own interval.
13
+ - Drags follow the reference line tool rules: a point that stays on its bar
14
+ keeps its stored time (price-only anchor drags and body moves), a point
15
+ moved to another bar takes that bar's open time (`applyDrag`,
16
+ `translateDrawing`).
17
+
18
+ ### Added
19
+
20
+ - `FutureAxis.pastSlots` / `pastTime` (optional): bars before the first
21
+ loaded bar on the host's trading calendar (whole bars both ways); without
22
+ them, calendar time with the median bar interval as before.
23
+ - `FutureAxis.timeKey` (optional): where a time sits when the bar that holds
24
+ it is looked for (a host maps a daily bar time to its session open).
25
+ - `FutureAxis` exported from the package entry.
26
+ - Unit tests (`npm test`, vitest).
27
+
3
28
  ## 0.6.1 (15/10/2026)
4
29
 
5
30
  ### Added
package/dist/index.d.ts CHANGED
@@ -692,14 +692,26 @@ declare type FourPoint = {
692
692
  * finalized with a double-click (the spec carries `variableLength: true`). */
693
693
  declare type FreehandKind = "polyline" | "path" | "brush" | "highlighter";
694
694
 
695
- /** Bars after the last bar on the symbol's trading calendar (the host knows the sessions). The time scale continues
695
+ /** The symbol's trading calendar around the loaded bars (the host knows the sessions). The time scale continues
696
696
  * after the last bar with the bars the symbol would open: the rest of the session, then the next sessions (nights,
697
- * weekends and holidays skipped). Times are epoch seconds. */
698
- declare type FutureAxis = {
697
+ * weekends and holidays skipped); before the first loaded bar it counts the bars the symbol had. Times are epoch
698
+ * seconds. A time is drawn on the bar that holds it (the last bar opening at or before it). */
699
+ export declare type FutureAxis = {
699
700
  /** Future bars that open after `lastTime` and at or before `time` (0 = still on the last bar). */
700
701
  slots: (time: number, lastTime: number) => number;
701
702
  /** Open time of the k-th future bar (k >= 1), null past the host's range. */
702
703
  time: (k: number, lastTime: number) => number | null;
704
+ /** Bars from the bar that holds `time` to the first loaded bar (opening at `firstTime`), that bar counted
705
+ * (>= 1 for a time before the first bar). Absent = calendar time with the median bar interval. */
706
+ pastSlots?: (time: number, firstTime: number) => number;
707
+ /** Open time of the k-th bar before the first loaded bar (k >= 1), null past the host's range. Give it with
708
+ * `pastSlots`. */
709
+ pastTime?: (k: number, firstTime: number) => number | null;
710
+ /** Where a time sits when the bar that holds it is looked for, non-decreasing over the bar times. The host maps a
711
+ * daily bar time to its session open (the reference opens a daily bar there: a pre-market time belongs to the
712
+ * previous daily bar, a point drawn on a daily bar goes to the first intraday bar of its day). Identity when
713
+ * absent. */
714
+ timeKey?: (time: number) => number;
703
715
  };
704
716
 
705
717
  /** One regression trend line (TV study plot style). */
@@ -1298,9 +1310,9 @@ export declare type TimeAxisLabel = {
1298
1310
 
1299
1311
  /** Shared time→x with the off-bar fallback, for non-drawing renderers (event
1300
1312
  * markers, etc.) that paint at arbitrary times. Mirrors the `timeToX` method:
1301
- * try lightweight-charts' exact mapping first, then the gap-aware logical
1302
- * interpolation (future bars on `future` when given). `sec` is UNIX seconds.
1303
- * Returns null with no data. */
1313
+ * try lightweight-charts' exact mapping first, then the bar that holds the
1314
+ * time (off the loaded bars: the host's calendar `future` when given).
1315
+ * `sec` is UNIX seconds. Returns null with no data. */
1304
1316
  export declare function timeToXFallback(chart: IChartApi, sec: number, bars: OHLC[], future?: FutureAxis | null): number | null;
1305
1317
 
1306
1318
  /** TV _onAnchoredChange: anchoring stores the current screen point as pane