@luxalgo/vela 0.6.10 → 0.6.11

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.
Files changed (41) hide show
  1. package/dist/{DataProvider-CWmp31dA.d.ts → DataProvider-BBf-jc6W.d.ts} +1 -1
  2. package/dist/{DataProvider-l_eLMly_.d.cts → DataProvider-p0TEyhlX.d.cts} +1 -1
  3. package/dist/{chunk-FFOP37FQ.js → chunk-73PEA4MU.js} +131 -33
  4. package/dist/{chunk-NMTQXNT4.js → chunk-IO3NYSQV.js} +65 -22
  5. package/dist/{chunk-4KZVZ7QQ.js → chunk-MTLJKZDZ.js} +9 -1
  6. package/dist/{contributions-BCz6Dr6a.d.ts → contributions-Bbe2R-mQ.d.ts} +16 -2
  7. package/dist/{contributions-D9vTzm5p.d.cts → contributions-CO01zWve.d.cts} +16 -2
  8. package/dist/index.cjs +139 -32
  9. package/dist/index.d.cts +12 -6
  10. package/dist/index.d.ts +12 -6
  11. package/dist/index.js +3 -3
  12. package/dist/{options-DSqHsQyN.d.cts → options-yp7sA96q.d.cts} +8 -1
  13. package/dist/{options-DSqHsQyN.d.ts → options-yp7sA96q.d.ts} +8 -1
  14. package/dist/{plugin-Bt8hLR8Z.d.cts → plugin-CkkH8QnX.d.cts} +3 -3
  15. package/dist/{plugin-CH7pfMrE.d.ts → plugin-DwxjM3Ni.d.ts} +3 -3
  16. package/dist/plugin.cjs +9 -0
  17. package/dist/plugin.d.cts +4 -4
  18. package/dist/plugin.d.ts +4 -4
  19. package/dist/plugin.js +2 -2
  20. package/dist/providers/binance.d.cts +2 -2
  21. package/dist/providers/binance.d.ts +2 -2
  22. package/dist/providers/coinbase.d.cts +2 -2
  23. package/dist/providers/coinbase.d.ts +2 -2
  24. package/dist/providers/hyperliquid.d.cts +2 -2
  25. package/dist/providers/hyperliquid.d.ts +2 -2
  26. package/dist/{statusline-5K7y4Ya2.d.ts → statusline-CHPDuKNp.d.ts} +13 -5
  27. package/dist/{statusline-TYLQmoeh.d.cts → statusline-DTHZUFqK.d.cts} +13 -5
  28. package/dist/ui.d.cts +1 -1
  29. package/dist/ui.d.ts +1 -1
  30. package/dist/vela.global.js +139 -32
  31. package/dist/vela.global.min.js +43 -43
  32. package/dist/widget.cjs +201 -52
  33. package/dist/widget.d.cts +6 -6
  34. package/dist/widget.d.ts +6 -6
  35. package/dist/widget.js +4 -4
  36. package/dist/workspace.cjs +201 -52
  37. package/dist/workspace.d.cts +20 -11
  38. package/dist/workspace.d.ts +20 -11
  39. package/dist/workspace.js +3 -3
  40. package/package.json +1 -1
  41. /package/dist/{chunk-AOGZBKUE.js → chunk-H26BEHF4.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { u as Millis, af as InputSchema, ad as IndicatorMeta, P as PriceStyle, O as OHLCV, m as InputValue, k as IndicatorModel, j as MoveTarget, ar as PaneAxis, aE as SeriesSpec, ab as Fill, B as Background, aw as PriceLine, a1 as DrawingLine, Z as DrawingBox, a0 as DrawingLabel, a5 as DrawingPolyline, a2 as DrawingLinefill, a7 as DrawingTable, g as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, w as DrawingTypeKey, v as SnapMode, a3 as DrawingMode, I as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, A as AxisLongPressEvent, s as DataWindowReadout, n as SymbolPickerFn, aS as PaneInfo, aa as DrawingsOption, D as Drawing, b as VelaOptions, y as AddIndicatorOptions, aq as MarketSwitch, ap as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-DSqHsQyN.js';
2
- import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-CWmp31dA.js';
1
+ import { u as Millis, af as InputSchema, ad as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, ar as PaneAxis, aE as SeriesSpec, ab as Fill, B as Background, aw as PriceLine, a1 as DrawingLine, Z as DrawingBox, a0 as DrawingLabel, a5 as DrawingPolyline, a2 as DrawingLinefill, a7 as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, w as DrawingTypeKey, v as SnapMode, a3 as DrawingMode, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, A as AxisLongPressEvent, s as DataWindowReadout, n as SymbolPickerFn, aT as PaneInfo, aa as DrawingsOption, D as Drawing, b as VelaOptions, y as AddIndicatorOptions, aq as MarketSwitch, ap as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-yp7sA96q.js';
2
+ import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-BBf-jc6W.js';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -294,6 +294,12 @@ interface IndicatorHandle {
294
294
  readonly props: readonly InputSchema[];
295
295
  /** Whether the indicator is currently shown (vs hidden). Hidden indicators stop computing. */
296
296
  readonly visible: boolean;
297
+ /** The CURRENT stored input values (declaration defaults merged with every edit so
298
+ * far) — what state persistence diffs against the schema's `defval`s. */
299
+ inputValues(): Record<string, InputValue>;
300
+ /** The CURRENT stored declaration-prop values (overrides only — props keep no
301
+ * merged defaults; absent keys mean the declaration value). */
302
+ propValues(): Record<string, InputValue>;
297
303
  setInput(key: string, value: InputValue): void;
298
304
  setInputs(values: Record<string, InputValue>): void;
299
305
  /** Override one declaration prop and re-run (a prop change replays the whole script). */
@@ -661,6 +667,10 @@ interface VelaEventMap extends Record<string, unknown> {
661
667
  "indicator:removed": {
662
668
  id: string;
663
669
  };
670
+ /** An indicator's stored input/prop VALUES changed (settings dialog, `setInputs`) — what state persistence listens to. */
671
+ "indicator:inputs": {
672
+ id: string;
673
+ };
664
674
  "indicator:error": {
665
675
  id: string;
666
676
  error: Error;
@@ -1516,6 +1526,10 @@ interface ExternalIndicatorEntry {
1516
1526
  script: string;
1517
1527
  /** Engine language (default: the chart's default engine). */
1518
1528
  language?: string;
1529
+ /** Input-value overrides applied at add time (what a persistence handler restores). */
1530
+ inputs?: Record<string, InputValue>;
1531
+ /** Declaration-prop overrides applied at add time. */
1532
+ props?: Record<string, InputValue>;
1519
1533
  }
1520
1534
  /** Where an action is projected. */
1521
1535
  type WidgetActionTarget = 'topbar' | 'context:body' | 'context:price-axis' | 'context:time-axis';
@@ -1,5 +1,5 @@
1
- import { u as Millis, af as InputSchema, ad as IndicatorMeta, P as PriceStyle, O as OHLCV, m as InputValue, k as IndicatorModel, j as MoveTarget, ar as PaneAxis, aE as SeriesSpec, ab as Fill, B as Background, aw as PriceLine, a1 as DrawingLine, Z as DrawingBox, a0 as DrawingLabel, a5 as DrawingPolyline, a2 as DrawingLinefill, a7 as DrawingTable, g as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, w as DrawingTypeKey, v as SnapMode, a3 as DrawingMode, I as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, A as AxisLongPressEvent, s as DataWindowReadout, n as SymbolPickerFn, aS as PaneInfo, aa as DrawingsOption, D as Drawing, b as VelaOptions, y as AddIndicatorOptions, aq as MarketSwitch, ap as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-DSqHsQyN.cjs';
2
- import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-l_eLMly_.cjs';
1
+ import { u as Millis, af as InputSchema, ad as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, ar as PaneAxis, aE as SeriesSpec, ab as Fill, B as Background, aw as PriceLine, a1 as DrawingLine, Z as DrawingBox, a0 as DrawingLabel, a5 as DrawingPolyline, a2 as DrawingLinefill, a7 as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, w as DrawingTypeKey, v as SnapMode, a3 as DrawingMode, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, A as AxisLongPressEvent, s as DataWindowReadout, n as SymbolPickerFn, aT as PaneInfo, aa as DrawingsOption, D as Drawing, b as VelaOptions, y as AddIndicatorOptions, aq as MarketSwitch, ap as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-yp7sA96q.cjs';
2
+ import { S as SymbolInfo, B as BarRange, M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, b as ProviderCapabilities } from './DataProvider-p0TEyhlX.cjs';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -294,6 +294,12 @@ interface IndicatorHandle {
294
294
  readonly props: readonly InputSchema[];
295
295
  /** Whether the indicator is currently shown (vs hidden). Hidden indicators stop computing. */
296
296
  readonly visible: boolean;
297
+ /** The CURRENT stored input values (declaration defaults merged with every edit so
298
+ * far) — what state persistence diffs against the schema's `defval`s. */
299
+ inputValues(): Record<string, InputValue>;
300
+ /** The CURRENT stored declaration-prop values (overrides only — props keep no
301
+ * merged defaults; absent keys mean the declaration value). */
302
+ propValues(): Record<string, InputValue>;
297
303
  setInput(key: string, value: InputValue): void;
298
304
  setInputs(values: Record<string, InputValue>): void;
299
305
  /** Override one declaration prop and re-run (a prop change replays the whole script). */
@@ -661,6 +667,10 @@ interface VelaEventMap extends Record<string, unknown> {
661
667
  "indicator:removed": {
662
668
  id: string;
663
669
  };
670
+ /** An indicator's stored input/prop VALUES changed (settings dialog, `setInputs`) — what state persistence listens to. */
671
+ "indicator:inputs": {
672
+ id: string;
673
+ };
664
674
  "indicator:error": {
665
675
  id: string;
666
676
  error: Error;
@@ -1516,6 +1526,10 @@ interface ExternalIndicatorEntry {
1516
1526
  script: string;
1517
1527
  /** Engine language (default: the chart's default engine). */
1518
1528
  language?: string;
1529
+ /** Input-value overrides applied at add time (what a persistence handler restores). */
1530
+ inputs?: Record<string, InputValue>;
1531
+ /** Declaration-prop overrides applied at add time. */
1532
+ props?: Record<string, InputValue>;
1519
1533
  }
1520
1534
  /** Where an action is projected. */
1521
1535
  type WidgetActionTarget = 'topbar' | 'context:body' | 'context:price-axis' | 'context:time-axis';
package/dist/index.cjs CHANGED
@@ -154,6 +154,12 @@ var IndicatorHandleImpl = class {
154
154
  get visible() {
155
155
  return this.visibleState;
156
156
  }
157
+ inputValues() {
158
+ return this.controller.inputValuesOf(this.id);
159
+ }
160
+ propValues() {
161
+ return this.controller.propValuesOf(this.id);
162
+ }
157
163
  setInput(key, value) {
158
164
  this.controller.applyInputs(this.id, { [key]: value });
159
165
  }
@@ -7296,6 +7302,7 @@ var RUN_EMIT_THROTTLE_MS = 1e3;
7296
7302
  var PREVIEW_BARS = 300;
7297
7303
  var SINGLE_LOAD_BARS = 5e3;
7298
7304
  var CHUNK_BARS = 1e4;
7305
+ var FIRST_PAINT_BARS = 100;
7299
7306
  var GAP_FACTOR = 1.5;
7300
7307
  var HEAL_COOLDOWN_MS = 5e3;
7301
7308
  var EngineOrchestrator = class _EngineOrchestrator {
@@ -7565,6 +7572,7 @@ var EngineOrchestrator = class _EngineOrchestrator {
7565
7572
  let painted = false;
7566
7573
  const paint = (bars, final) => {
7567
7574
  if (this.generation !== gen || !final && bars.length === 0) return;
7575
+ if (!painted && !final && bars.length < Math.min(requested, FIRST_PAINT_BARS)) return;
7568
7576
  this.setBarSeries(bars, painted ? { preserveView: true } : void 0);
7569
7577
  if (!painted && bars.length > 0) {
7570
7578
  painted = true;
@@ -8195,6 +8203,15 @@ var EngineOrchestrator = class _EngineOrchestrator {
8195
8203
  record.pendingCause = "inputs";
8196
8204
  if (record.session) record.session.update(record.inputValues);
8197
8205
  else if (record.native && !record.hidden) record.native.instance.setInputs(record.inputValues);
8206
+ this.events.emit("indicator:inputs", { id });
8207
+ }
8208
+ /** IndicatorController: the CURRENT stored input values (defaults merged with edits). */
8209
+ inputValuesOf(id) {
8210
+ return { ...this.registry.get(id)?.inputValues };
8211
+ }
8212
+ /** IndicatorController: the CURRENT declaration-prop overrides. */
8213
+ propValuesOf(id) {
8214
+ return { ...this.registry.get(id)?.propValues };
8198
8215
  }
8199
8216
  /** IndicatorController: re-run an indicator with merged declaration-prop overrides.
8200
8217
  * Same lifecycle as {@link applyInputs} — a prop change replays the whole script.
@@ -8208,6 +8225,7 @@ var EngineOrchestrator = class _EngineOrchestrator {
8208
8225
  if (!record.hidden) this.setLoading(record, true);
8209
8226
  record.pendingCause = "inputs";
8210
8227
  record.session.update(record.inputValues, record.propValues);
8228
+ this.events.emit("indicator:inputs", { id });
8211
8229
  }
8212
8230
  /** IndicatorController: tear down an indicator and (if now empty) its pane. */
8213
8231
  /** Live handles of every indicator on the chart (script + native), insertion order. */
@@ -10995,6 +11013,14 @@ function inputVisible(when, values) {
10995
11013
  const conds = Array.isArray(when) ? when : [when];
10996
11014
  return conds.every((c) => c.anyOf ? c.anyOf.some((x) => x === values[c.key]) : values[c.key] === c.equals);
10997
11015
  }
11016
+ function inputDeltas(schema, values) {
11017
+ const out = {};
11018
+ for (const s of schema) {
11019
+ const v = values[s.key];
11020
+ if (v !== void 0 && JSON.stringify(v) !== JSON.stringify(s.defval)) out[s.key] = v;
11021
+ }
11022
+ return Object.keys(out).length > 0 ? out : void 0;
11023
+ }
10998
11024
 
10999
11025
  // src/ui/components/select/controller.ts
11000
11026
  function selectController(opts) {
@@ -16778,6 +16804,7 @@ var DOUBLE_TAP_MS = 350;
16778
16804
  var DOUBLE_TAP_SLOP = 30;
16779
16805
  var TIME_SCALE_K = 4e-3;
16780
16806
  var WHEEL_ZOOM_K = 4e-3;
16807
+ var WHEEL_PRICE_DRAG_PX = 0.25;
16781
16808
  function wheelZoomAnchor(coords, cursorX, rightEdge) {
16782
16809
  if (rightEdge) return { logical: coords.rightEdgeLogical, x: coords.width };
16783
16810
  return { logical: coords.xToLogical(cursorX), x: cursorX };
@@ -16908,7 +16935,7 @@ var InputController = class {
16908
16935
  this.capture(e.pointerId);
16909
16936
  return;
16910
16937
  }
16911
- if (e.shiftKey && this.regionAt(x, y) === "data" && this.deps.drawingsMeasureStart?.(x, y)) {
16938
+ if (e.shiftKey && this.regionAt(x, y) === "data" && this.deps.drawingsMeasureStart?.(x, y, this.snapMode(e))) {
16912
16939
  this.region = "drawing";
16913
16940
  this.capture(e.pointerId);
16914
16941
  return;
@@ -17022,7 +17049,7 @@ var InputController = class {
17022
17049
  const wasTouch = e.pointerType === "touch";
17023
17050
  const tapRelease = this.dragging && !this.moved && (!wasTouch || Math.hypot(x - this.startX, y - this.startY) <= TOUCH_TAP_SLOP);
17024
17051
  if (this.dragging && this.region === "drawing") {
17025
- this.deps.drawingsPointerUp?.(x, y);
17052
+ this.deps.drawingsPointerUp?.(x, y, this.snapMode(e));
17026
17053
  } else if (tapRelease && this.region === "data") {
17027
17054
  this.deps.onClick(x, y);
17028
17055
  } else if (this.dragging && this.region === "data") {
@@ -17043,7 +17070,7 @@ var InputController = class {
17043
17070
  if (e.pointerType === "touch") this.touches.delete(e.pointerId);
17044
17071
  this.cancelLongPress();
17045
17072
  if (!this.dragging) return;
17046
- if (this.region === "drawing" && !Number.isNaN(this.cursorX)) this.deps.drawingsPointerUp?.(this.cursorX, this.cursorY);
17073
+ if (this.region === "drawing" && !Number.isNaN(this.cursorX)) this.deps.drawingsPointerUp?.(this.cursorX, this.cursorY, this.snapMode(e));
17047
17074
  if (this.region === "crosshair" || e.pointerType === "touch") this.deps.onPointerMove(null, null);
17048
17075
  this.endGesture(e);
17049
17076
  };
@@ -17059,6 +17086,12 @@ var InputController = class {
17059
17086
  this.onWheel = (e) => {
17060
17087
  e.preventDefault();
17061
17088
  this.deps.drawingsClearTransient?.();
17089
+ const { x, y } = this.local(e);
17090
+ if (this.regionAt(x, y) === "price" && e.deltaY !== 0) {
17091
+ this.deps.beginPriceScale(x, y);
17092
+ this.deps.priceScaleBy(e.deltaY * WHEEL_PRICE_DRAG_PX);
17093
+ return;
17094
+ }
17062
17095
  const coords = this.deps.getCoords();
17063
17096
  const vp = coords.getViewport();
17064
17097
  const pan = wheelPanDelta(e.deltaX, e.deltaY, e.shiftKey);
@@ -17066,9 +17099,8 @@ var InputController = class {
17066
17099
  this.deps.apply({ barSpacing: vp.barSpacing, rightOffset: wheelPanRightOffset(vp.rightOffset, pan, coords.pxPerBar()) });
17067
17100
  return;
17068
17101
  }
17069
- const cursorX = this.local(e).x;
17070
17102
  const rightEdge = this.rightEdgeZoom && !(e.ctrlKey || e.metaKey);
17071
- const anchor = wheelZoomAnchor(coords, cursorX, rightEdge);
17103
+ const anchor = wheelZoomAnchor(coords, x, rightEdge);
17072
17104
  const target = clampBarSpacing(vp.barSpacing * Math.exp(-e.deltaY * WHEEL_ZOOM_K));
17073
17105
  this.deps.zoomTo(target, anchor.logical, anchor.x);
17074
17106
  };
@@ -18550,6 +18582,15 @@ function drawingSetEmpty(s) {
18550
18582
  function fontSizePx(size) {
18551
18583
  return size === "auto" ? 12 : namedFontSize(size);
18552
18584
  }
18585
+ function lineCoversWindow(a, b, extend, lo, hi) {
18586
+ const minX = Math.min(a, b);
18587
+ const maxX = Math.max(a, b);
18588
+ if (a === b) return a >= lo && a <= hi;
18589
+ if (extend === "both") return true;
18590
+ if (extend === "left") return maxX >= lo;
18591
+ if (extend === "right") return minX <= hi;
18592
+ return maxX >= lo && minX <= hi;
18593
+ }
18553
18594
  var DrawingSceneRenderer = class {
18554
18595
  constructor(deps, set = EMPTY_DRAWING_SET) {
18555
18596
  this.deps = deps;
@@ -18614,7 +18655,7 @@ var DrawingSceneRenderer = class {
18614
18655
  };
18615
18656
  for (const ln of this.set.lines) {
18616
18657
  if (ln.invisible) continue;
18617
- if (!visible(this.logicalOf(ln.xloc, ln.x1), this.logicalOf(ln.xloc, ln.x2), ln.extend)) continue;
18658
+ if (!lineCoversWindow(this.logicalOf(ln.xloc, ln.x1), this.logicalOf(ln.xloc, ln.x2), ln.extend, lo, hi)) continue;
18618
18659
  fold(ln.y1);
18619
18660
  fold(ln.y2);
18620
18661
  }
@@ -22554,6 +22595,22 @@ var DrawingInteraction = class {
22554
22595
  this.snapAt = changed ? { point: snapped, paneId } : null;
22555
22596
  return snapped;
22556
22597
  }
22598
+ /**
22599
+ * Resolve a cursor pixel through the magnet and return the snapped pixel — the same
22600
+ * conversion drawing placement uses. Updates the snap-ring marker. The measure
22601
+ * ruler goes through this so its endpoints follow weak/strong/Ctrl magnet too.
22602
+ */
22603
+ snapCursor(x, y, mode) {
22604
+ const proj = this.deps.projector();
22605
+ const paneId = proj.paneIdAtY(y) ?? "price";
22606
+ const point = this.resolve(x, y, paneId, mode);
22607
+ const sy = proj.yOf(point.price, paneId);
22608
+ return { x: proj.xOf(point.time), y: sy ?? y };
22609
+ }
22610
+ /** Drop the snap-ring marker (a transient mode ended without going through `up`). */
22611
+ clearSnapMarker() {
22612
+ this.snapAt = null;
22613
+ }
22557
22614
  /** Resolve a pixel to a data point with the segment angle locked to 45° steps around
22558
22615
  * `pivot` (Shift held on a line tool). Works in PIXEL space — the user reasons about
22559
22616
  * the angle they see, not about time/price units. The magnet is bypassed: snapping
@@ -24591,30 +24648,39 @@ var MeasureOverlay = class {
24591
24648
  isFinished() {
24592
24649
  return this.state === "finished";
24593
24650
  }
24594
- /** A press: begin the measurement, or finish it on the second click. */
24595
- down(x, y) {
24651
+ /** A press: begin the measurement, or finish it on the second click.
24652
+ * `x,y` are the raw cursor (drag-slop vs click-move-click). `gx,gy` are the
24653
+ * graphic endpoints — magnet-snapped when the magnet is on, else the same as `x,y`. */
24654
+ down(x, y, gx = x, gy = y) {
24596
24655
  if (this.state === "measuring") {
24597
- this.end = { x, y };
24656
+ this.end = { x: gx, y: gy };
24598
24657
  this.state = "finished";
24599
24658
  return;
24600
24659
  }
24601
- this.start = { x, y };
24602
- this.end = { x, y };
24660
+ this.start = { x: gx, y: gy };
24661
+ this.end = { x: gx, y: gy };
24603
24662
  this.pressX = x;
24604
24663
  this.pressY = y;
24605
24664
  this.state = "measuring";
24606
24665
  }
24666
+ /** Size the in-progress ruler. `x,y` are the graphic (magnet-snapped) cursor. */
24607
24667
  move(x, y) {
24608
24668
  if (this.state === "measuring") this.end = { x, y };
24609
24669
  }
24610
24670
  /** A release: finish if the press was actually dragged (press-drag-release), else wait
24611
- * for the second click (click-move-click). */
24612
- up(x, y) {
24671
+ * for the second click (click-move-click). `x,y` are the raw cursor (slop); `gx,gy`
24672
+ * are the graphic end (magnet-snapped when the magnet is on). */
24673
+ up(x, y, gx = x, gy = y) {
24613
24674
  if (this.state === "measuring" && Math.hypot(x - this.pressX, y - this.pressY) > DRAG_SLOP3) {
24614
- this.end = { x, y };
24675
+ this.end = { x: gx, y: gy };
24615
24676
  this.state = "finished";
24616
24677
  }
24617
24678
  }
24679
+ /** Current graphic endpoints in media pixels, or null when idle. */
24680
+ points() {
24681
+ if (!this.start || !this.end) return null;
24682
+ return { start: this.start, end: this.end };
24683
+ }
24618
24684
  clear() {
24619
24685
  this.state = "idle";
24620
24686
  this.start = null;
@@ -24991,11 +25057,13 @@ var UserDrawingController = class {
24991
25057
  }
24992
25058
  /** Shift+press on the empty plot: arm the measure ruler AND start it at (x, y) in one
24993
25059
  * gesture — the equivalent of clicking the toolbar's Measure button, then pressing.
24994
- * Returns false when a mode/tool is already active (the normal press path owns it). */
24995
- beginMeasureAt(x, y) {
25060
+ * `snap` is the effective magnet (sticky mode, or Ctrl/Cmd-forced strong). Returns
25061
+ * false when a mode/tool is already active (the normal press path owns it). */
25062
+ beginMeasureAt(x, y, snap = "off") {
24996
25063
  if (this.measureMode || this.eraserMode || this.activeTool != null) return false;
24997
25064
  this.withModeIntent(() => this.toggleMeasure());
24998
- this.measure.down(x, y);
25065
+ const g = this.interaction.snapCursor(x, y, snap);
25066
+ this.measure.down(x, y, g.x, g.y);
24999
25067
  this.render();
25000
25068
  return true;
25001
25069
  }
@@ -25017,7 +25085,8 @@ var UserDrawingController = class {
25017
25085
  return;
25018
25086
  }
25019
25087
  if (this.measureMode) {
25020
- this.measure.down(x, y);
25088
+ const g = this.interaction.snapCursor(x, y, snap);
25089
+ this.measure.down(x, y, g.x, g.y);
25021
25090
  if (this.measure.isFinished()) this.withModeIntent(() => this.exitMeasure(false));
25022
25091
  this.render();
25023
25092
  return;
@@ -25030,7 +25099,8 @@ var UserDrawingController = class {
25030
25099
  return;
25031
25100
  }
25032
25101
  if (this.measureMode) {
25033
- this.measure.move(x, y);
25102
+ const g = this.interaction.snapCursor(x, y, snap);
25103
+ this.measure.move(g.x, g.y);
25034
25104
  this.render();
25035
25105
  return;
25036
25106
  }
@@ -25048,13 +25118,14 @@ var UserDrawingController = class {
25048
25118
  this.render();
25049
25119
  }
25050
25120
  }
25051
- pointerUp(x, y) {
25121
+ pointerUp(x, y, snap = "off") {
25052
25122
  if (this.eraserMode) {
25053
25123
  this.erasing = false;
25054
25124
  return;
25055
25125
  }
25056
25126
  if (this.measureMode) {
25057
- this.measure.up(x, y);
25127
+ const g = this.interaction.snapCursor(x, y, snap);
25128
+ this.measure.up(x, y, g.x, g.y);
25058
25129
  if (this.measure.isFinished()) this.withModeIntent(() => this.exitMeasure(false));
25059
25130
  this.render();
25060
25131
  return;
@@ -25099,6 +25170,7 @@ var UserDrawingController = class {
25099
25170
  /** Leave ruler mode. `clearGraphic` keeps a just-finished measurement on screen (false). */
25100
25171
  exitMeasure(clearGraphic = true) {
25101
25172
  this.measureMode = false;
25173
+ this.interaction.clearSnapMarker();
25102
25174
  if (clearGraphic) this.measure.clear();
25103
25175
  this.toolbar.setMeasureActive(false);
25104
25176
  this.render();
@@ -25239,15 +25311,28 @@ var UserDrawingController = class {
25239
25311
  if (this.eraserMode) return "pointer";
25240
25312
  return this.interaction.cursorAt(x, y);
25241
25313
  }
25242
- /** Right-click while placing: cancel the in-progress drawing and revert to the
25243
- * pointer the gesture is an explicit escape, so it disarms even in
25244
- * stay-in-drawing-mode (where Escape would leave the tool armed). Returns whether
25245
- * the press was consumed; false lets the host's context menu open normally. */
25314
+ /** Right-click: an explicit escape back to the pointer. Cancels an in-progress
25315
+ * placement or measurement, and also plain-disarms an armed-but-idle drawing
25316
+ * tool or the eraser — so a right-click ALWAYS reverts to the pointer, even in
25317
+ * stay-in-drawing-mode (where Escape would leave a drawing tool armed).
25318
+ * Persistent toggles (magnet, stay-mode, favorites) are untouched. Returns
25319
+ * whether the press was consumed; false lets the host's context menu open
25320
+ * normally. */
25246
25321
  cancelPlacement() {
25247
- if (!this.interaction.isPlacing()) return false;
25248
- this.interaction.cancel();
25249
- if (this.activeTool != null) this.emit({ kind: "arm", type: null });
25250
- return true;
25322
+ if (this.measureMode || this.eraserMode) {
25323
+ this.withModeIntent(() => this.measureMode ? this.exitMeasure() : this.exitEraser());
25324
+ return true;
25325
+ }
25326
+ if (this.interaction.isPlacing()) {
25327
+ this.interaction.cancel();
25328
+ if (this.activeTool != null) this.emit({ kind: "arm", type: null });
25329
+ return true;
25330
+ }
25331
+ if (this.activeTool != null) {
25332
+ this.emit({ kind: "arm", type: null });
25333
+ return true;
25334
+ }
25335
+ return false;
25251
25336
  }
25252
25337
  /** Double-click over a drawing → suppress the chart's view reset (single-click already
25253
25338
  * opens settings). Returns true only when a drawing is under the cursor. */
@@ -25273,6 +25358,10 @@ var UserDrawingController = class {
25273
25358
  return true;
25274
25359
  }
25275
25360
  if (this.interaction.cancel()) return true;
25361
+ if (this.measureMode) {
25362
+ this.withModeIntent(() => this.exitMeasure());
25363
+ return true;
25364
+ }
25276
25365
  if (this.selectedIds.size) {
25277
25366
  this.clearSelection();
25278
25367
  return true;
@@ -27831,13 +27920,13 @@ var NativeRenderer = class {
27831
27920
  resetView: () => this.resetView(),
27832
27921
  // User drawings claim a gesture before pan when armed / over a drawing.
27833
27922
  drawingsClaim: (x, y) => this.userDrawings?.claim(x, y) ?? false,
27834
- drawingsMeasureStart: (x, y) => this.userDrawings?.beginMeasureAt(x, y) ?? false,
27923
+ drawingsMeasureStart: (x, y, snap) => this.userDrawings?.beginMeasureAt(x, y, snap) ?? false,
27835
27924
  drawingsDeleteAt: (x, y) => this.userDrawings?.deleteAt(x, y) ?? false,
27836
27925
  drawingsCancelPlacement: () => this.userDrawings?.cancelPlacement() ?? false,
27837
27926
  drawingsSnapMode: () => this.snapMode,
27838
27927
  drawingsPointerDown: (x, y, snap, shift) => this.userDrawings?.pointerDown(x, y, snap, shift),
27839
27928
  drawingsPointerMove: (x, y, snap, shift) => this.userDrawings?.pointerMove(x, y, snap, shift),
27840
- drawingsPointerUp: (x, y) => this.userDrawings?.pointerUp(x, y),
27929
+ drawingsPointerUp: (x, y, snap) => this.userDrawings?.pointerUp(x, y, snap),
27841
27930
  drawingsCursor: (x, y) => this.userDrawings?.cursorAt(x, y) ?? null,
27842
27931
  drawingsDblClick: (x, y) => this.userDrawings?.dblClick(x, y) ?? false,
27843
27932
  drawingsClearTransient: () => this.userDrawings?.clearTransient()
@@ -28152,7 +28241,8 @@ var NativeRenderer = class {
28152
28241
  }
28153
28242
  const skipFit = opts?.preserveView === true && this.didInitialFit;
28154
28243
  if (this.coords.width > 0 && !skipFit) {
28155
- this.fitContent();
28244
+ if (this.didInitialFit) this.reframeKeepZoom();
28245
+ else this.fitContent();
28156
28246
  this.didInitialFit = true;
28157
28247
  }
28158
28248
  if (!this.introPlayed && this.bars.length > 0) {
@@ -28800,6 +28890,7 @@ var NativeRenderer = class {
28800
28890
  this.scaleDragHeight = res.height;
28801
28891
  this.scaleDragStart = { ...res.holder.scale };
28802
28892
  res.holder.manualScale = { ...res.holder.scale };
28893
+ this.axisScaleButtons?.reposition();
28803
28894
  this.scheduler.invalidate(4 /* Full */);
28804
28895
  }
28805
28896
  /** Rescale the grabbed scale around its center by the total drag (down ⇒ zoom out). */
@@ -28831,6 +28922,7 @@ var NativeRenderer = class {
28831
28922
  const res = this.resolveScaleHolder(x, y);
28832
28923
  if (!res) return;
28833
28924
  res.holder.manualScale = null;
28925
+ this.axisScaleButtons?.reposition();
28834
28926
  this.scheduler.invalidate(4 /* Full */);
28835
28927
  }
28836
28928
  /**
@@ -29468,6 +29560,20 @@ var NativeRenderer = class {
29468
29560
  this.coords.setViewport(v);
29469
29561
  this.targetBarSpacing = v.barSpacing;
29470
29562
  }
29563
+ /** Re-frame after a series replacement (a symbol/timeframe switch): keep the user's
29564
+ * zoom (bar spacing), re-anchor the newest bars at the default right offset.
29565
+ * `clampViewport`'s fit-all-bars floor deliberately does NOT apply — a progressive
29566
+ * head may still be backfilling toward the previous depth, and raising the spacing
29567
+ * to its temporary bar count would lose the zoom this exists to keep. */
29568
+ reframeKeepZoom() {
29569
+ this.animator?.stop();
29570
+ this.panVelocity = 0;
29571
+ for (const pane of this.scene.panes.values()) pane.manualScale = null;
29572
+ for (const sl of this.scene.indicatorScales.values()) sl.manualScale = null;
29573
+ const v = { barSpacing: clampBarSpacing(this.coords.getViewport().barSpacing), rightOffset: defaultViewport().rightOffset };
29574
+ this.coords.setViewport(v);
29575
+ this.targetBarSpacing = v.barSpacing;
29576
+ }
29471
29577
  paneBoundsFor(paneId) {
29472
29578
  const p = this.scene.panes.get(paneId);
29473
29579
  return { top: p?.bounds.top ?? 0, height: p?.bounds.height ?? 0, rightAxis: this.rightAxisW };
@@ -30662,6 +30768,7 @@ exports.drawingTypes = drawingTypes;
30662
30768
  exports.getDrawingType = getDrawingType;
30663
30769
  exports.getNativeIndicator = getNativeIndicator;
30664
30770
  exports.iconMarkup = iconMarkup;
30771
+ exports.inputDeltas = inputDeltas;
30665
30772
  exports.inputVisible = inputVisible;
30666
30773
  exports.legendActions = legendActions;
30667
30774
  exports.legendCallouts = legendCallouts;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as DrawingsDocument, R as Resolved } from './contributions-D9vTzm5p.cjs';
2
- export { B as BarsChangeReason, C as CellStateContext, b as ContextSelect, c as DataControl, d as DrawingsControl, e as EngineAlert, f as EngineCapabilities, g as EngineContextSnapshot, h as EngineFactory, i as EngineWarning, j as ExecutionHandlers, k as ExecutionMarket, l as ExecutionRequest, m as ExecutionSession, E as ExternalIndicatorEntry, F as FetchSeries, n as IndicatorEventMap, I as IndicatorHandle, o as IndicatorSummary, L as LegendActionDescriptor, p as LegendCalloutContent, q as LegendCalloutDescriptor, r as LegendCalloutItem, s as LegendCalloutSpec, t as LegendIndicatorInfo, N as NativeIndicator, u as NativeIndicatorContext, v as NativeIndicatorDescriptor, w as NativeIndicatorInfo, x as NativeIndicatorOutput, O as OVERRIDABLE_TOPBAR_IDS, P as ParsedSymbol, y as PreparedScript, z as RendererControl, A as RunIndicatorResult, G as SceneInspection, a as ScriptRun, H as ScriptRunCause, J as ScriptRunResult, S as ScriptingEngine, K as SidePanelButton, M as SidePanelDescriptor, Q as SidePanelHandle, T as SidePanelHeader, U as StatePersistenceHandler, X as StrategyFill, Y as StrategyState, Z as StrategyTrade, _ as SymbolRankingHook, $ as TypedEventBus, V as Vela, a0 as VelaDeps, a1 as VelaEventMap, a2 as VisibleBarRange, a3 as WidgetActionDescriptor, a4 as WidgetActionTarget, a5 as WidgetAttachment, W as WidgetContext, a6 as getNativeIndicator, a7 as legendActions, a8 as legendCallouts, a9 as nativeIndicatorDescriptors, aa as nativeIndicatorTypes, ab as registerDefaultEngine, ac as registerLegendAction, ad as registerLegendCallout, ae as registerNativeIndicator, af as registerSidePanel, ag as registerStatePersistence, ah as registerSymbolRanking, ai as registerWidgetAction, aj as registerWidgetAttachment, ak as resolveEngines, al as sidePanels, am as statePersistenceHandlers, an as symbolRanking, ao as topbarActionOverride, ap as unregisterDefaultEngine, aq as unregisterLegendAction, ar as unregisterLegendCallout, as as unregisterNativeIndicator, at as unregisterSidePanel, au as unregisterStatePersistence, av as unregisterWidgetAction, aw as unregisterWidgetAttachment, ax as widgetActions, ay as widgetAttachments } from './contributions-D9vTzm5p.cjs';
3
- import { D as Drawing, S as SerializedDrawing, U as Unsubscribe, L as LineStyle, P as PriceStyle, I as IChartRenderer, R as RendererCapabilities, e as RendererDisplayOptions, f as IndicatorRenderHandle, g as IndicatorStatus, c as VelaTheme, O as OHLCV, h as Pane, i as PaneAction, j as MoveTarget, k as IndicatorModel, l as ScenePatch, m as InputValue, n as SymbolPickerFn, o as LegendActionView, p as LegendCalloutView, q as InputChangeEvent, T as ThemeName, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, a as VisibleRange, s as DataWindowReadout, t as IDrawingsRendererPort, u as Millis, v as SnapMode, w as DrawingTypeKey, x as ToolbarDefinition, M as MarketConfig } from './options-DSqHsQyN.cjs';
4
- export { y as AddIndicatorOptions, B as Background, z as BoxFontFamily, E as BoxHAlign, F as BoxTextSize, G as BoxVAlign, H as CandleBarColor, J as CandleSeries, K as CandleStyle, Q as DataWindowGroup, W as DataWindowOHLC, X as DataWindowRow, Y as DirtyRange, Z as DrawingBox, _ as DrawingExtend, $ as DrawingIntent, a0 as DrawingLabel, a1 as DrawingLine, a2 as DrawingLinefill, a3 as DrawingMode, a4 as DrawingPoint, a5 as DrawingPolyline, a6 as DrawingStyle, a7 as DrawingTable, a8 as DrawingText, a9 as DrawingXLoc, aa as DrawingsOption, ab as Fill, ac as FillGradientStop, ad as IndicatorMeta, ae as InputCondition, af as InputSchema, ag as InputType, ah as InputWhen, ai as LabelStyle, aj as LabelYLoc, ak as LineLikeKind, al as LineLikeSeries, am as LineLikeStyle, an as MarkerPoint, ao as MarkerSeries, ap as MarketSnapshot, aq as MarketSwitch, ar as PaneAxis, as as PaneAxisBand, at as PaneHint, au as PaneKind, av as PolylinePoint, aw as PriceLine, ax as Projector, ay as ProviderName, az as RendererConstructor, aA as Scene, aB as SchemaPatch, aC as SeriesKind, aD as SeriesPoint, aE as SeriesSpec, aF as SeriesValueDelta, aG as SettingsField, aH as SettingsSchema, aI as SettingsVisibilityPolicy, aJ as TableCell, aK as TableMerge, aL as TablePosition, aM as ToolbarGroupConfig, aN as TradeExecution, aO as ValuePatch, b as VelaOptions, V as VisibleRangePreset, aP as buildToolbar, aQ as defaultToolbar, aR as inputVisible } from './options-DSqHsQyN.cjs';
5
- import { M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, S as SymbolInfo, b as ProviderCapabilities, B as BarRange } from './DataProvider-l_eLMly_.cjs';
6
- export { A as ACCENT, a as ACCENT_BRIGHT, B as BEARISH, b as BULLISH, c as BarTransform, d as BasePaintingModulation, C as CATEGORICAL, e as CROSSHAIR, f as ChartTypeDefinition, g as ChartTypeSettingsInstance, h as ChartTypeSettingsSection, i as ChartTypeSettingsSubsection, D as DrawingTypeMeta, H as HIGHLIGHT, I as INFO, j as INVALID, k as IdentifiableKind, M as MARKER, N as NEUTRAL, l as NormalizedSettingsRow, R as RendererLayerArgs, m as RendererLayerDefinition, n as RendererLayerInstance, S as SERIES_LINE, o as SESSION_OFF, p as SESSION_POST, q as SESSION_PRE, r as SLATE, s as SLATE_DEEP, t as SeriesDataEngine, u as SeriesDataEngineHost, v as SettingsInlineControl, w as SettingsRowCondition, x as SettingsRowDescriptor, y as SettingsRowInlineNumber, z as SettingsRowSwatch, E as SettingsRowValueKey, F as SettingsRowWhen, G as SettingsRowWidth, J as SettingsSelectOption, K as SettingsValueRow, T as TRADE_EXIT, L as TRADE_LONG, O as TRADE_SHORT, V as VALID, W as WARNING, P as categoricalColor, Q as chartType, U as chartTypes, X as createDrawing, Y as deserializeDrawing, Z as drawingTypes, _ as getDrawingType, $ as normalizeSettingsRow, a0 as registerChartType, a1 as registerDrawingType, a2 as registerRendererDefaults, a3 as registerRendererLayer, a4 as rendererDefaults, a5 as rendererLayers, a6 as settingsRowValueKeys, a7 as stableSeriesId, a8 as tickerModifierIds, a9 as unregisterChartType, aa as unregisterRendererDefaults, ab as unregisterRendererLayer } from './plugin-Bt8hLR8Z.cjs';
1
+ import { D as DrawingsDocument, R as Resolved } from './contributions-CO01zWve.cjs';
2
+ export { B as BarsChangeReason, C as CellStateContext, b as ContextSelect, c as DataControl, d as DrawingsControl, e as EngineAlert, f as EngineCapabilities, g as EngineContextSnapshot, h as EngineFactory, i as EngineWarning, j as ExecutionHandlers, k as ExecutionMarket, l as ExecutionRequest, m as ExecutionSession, E as ExternalIndicatorEntry, F as FetchSeries, n as IndicatorEventMap, I as IndicatorHandle, o as IndicatorSummary, L as LegendActionDescriptor, p as LegendCalloutContent, q as LegendCalloutDescriptor, r as LegendCalloutItem, s as LegendCalloutSpec, t as LegendIndicatorInfo, N as NativeIndicator, u as NativeIndicatorContext, v as NativeIndicatorDescriptor, w as NativeIndicatorInfo, x as NativeIndicatorOutput, O as OVERRIDABLE_TOPBAR_IDS, P as ParsedSymbol, y as PreparedScript, z as RendererControl, A as RunIndicatorResult, G as SceneInspection, a as ScriptRun, H as ScriptRunCause, J as ScriptRunResult, S as ScriptingEngine, K as SidePanelButton, M as SidePanelDescriptor, Q as SidePanelHandle, T as SidePanelHeader, U as StatePersistenceHandler, X as StrategyFill, Y as StrategyState, Z as StrategyTrade, _ as SymbolRankingHook, $ as TypedEventBus, V as Vela, a0 as VelaDeps, a1 as VelaEventMap, a2 as VisibleBarRange, a3 as WidgetActionDescriptor, a4 as WidgetActionTarget, a5 as WidgetAttachment, W as WidgetContext, a6 as getNativeIndicator, a7 as legendActions, a8 as legendCallouts, a9 as nativeIndicatorDescriptors, aa as nativeIndicatorTypes, ab as registerDefaultEngine, ac as registerLegendAction, ad as registerLegendCallout, ae as registerNativeIndicator, af as registerSidePanel, ag as registerStatePersistence, ah as registerSymbolRanking, ai as registerWidgetAction, aj as registerWidgetAttachment, ak as resolveEngines, al as sidePanels, am as statePersistenceHandlers, an as symbolRanking, ao as topbarActionOverride, ap as unregisterDefaultEngine, aq as unregisterLegendAction, ar as unregisterLegendCallout, as as unregisterNativeIndicator, at as unregisterSidePanel, au as unregisterStatePersistence, av as unregisterWidgetAction, aw as unregisterWidgetAttachment, ax as widgetActions, ay as widgetAttachments } from './contributions-CO01zWve.cjs';
3
+ import { D as Drawing, S as SerializedDrawing, U as Unsubscribe, L as LineStyle, P as PriceStyle, e as IChartRenderer, R as RendererCapabilities, f as RendererDisplayOptions, g as IndicatorRenderHandle, h as IndicatorStatus, c as VelaTheme, O as OHLCV, i as Pane, j as PaneAction, k as MoveTarget, l as IndicatorModel, m as ScenePatch, I as InputValue, n as SymbolPickerFn, o as LegendActionView, p as LegendCalloutView, q as InputChangeEvent, T as ThemeName, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, a as VisibleRange, s as DataWindowReadout, t as IDrawingsRendererPort, u as Millis, v as SnapMode, w as DrawingTypeKey, x as ToolbarDefinition, M as MarketConfig } from './options-yp7sA96q.cjs';
4
+ export { y as AddIndicatorOptions, B as Background, z as BoxFontFamily, E as BoxHAlign, F as BoxTextSize, G as BoxVAlign, H as CandleBarColor, J as CandleSeries, K as CandleStyle, Q as DataWindowGroup, W as DataWindowOHLC, X as DataWindowRow, Y as DirtyRange, Z as DrawingBox, _ as DrawingExtend, $ as DrawingIntent, a0 as DrawingLabel, a1 as DrawingLine, a2 as DrawingLinefill, a3 as DrawingMode, a4 as DrawingPoint, a5 as DrawingPolyline, a6 as DrawingStyle, a7 as DrawingTable, a8 as DrawingText, a9 as DrawingXLoc, aa as DrawingsOption, ab as Fill, ac as FillGradientStop, ad as IndicatorMeta, ae as InputCondition, af as InputSchema, ag as InputType, ah as InputWhen, ai as LabelStyle, aj as LabelYLoc, ak as LineLikeKind, al as LineLikeSeries, am as LineLikeStyle, an as MarkerPoint, ao as MarkerSeries, ap as MarketSnapshot, aq as MarketSwitch, ar as PaneAxis, as as PaneAxisBand, at as PaneHint, au as PaneKind, av as PolylinePoint, aw as PriceLine, ax as Projector, ay as ProviderName, az as RendererConstructor, aA as Scene, aB as SchemaPatch, aC as SeriesKind, aD as SeriesPoint, aE as SeriesSpec, aF as SeriesValueDelta, aG as SettingsField, aH as SettingsSchema, aI as SettingsVisibilityPolicy, aJ as TableCell, aK as TableMerge, aL as TablePosition, aM as ToolbarGroupConfig, aN as TradeExecution, aO as ValuePatch, b as VelaOptions, V as VisibleRangePreset, aP as buildToolbar, aQ as defaultToolbar, aR as inputDeltas, aS as inputVisible } from './options-yp7sA96q.cjs';
5
+ import { M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, S as SymbolInfo, b as ProviderCapabilities, B as BarRange } from './DataProvider-p0TEyhlX.cjs';
6
+ export { A as ACCENT, a as ACCENT_BRIGHT, B as BEARISH, b as BULLISH, c as BarTransform, d as BasePaintingModulation, C as CATEGORICAL, e as CROSSHAIR, f as ChartTypeDefinition, g as ChartTypeSettingsInstance, h as ChartTypeSettingsSection, i as ChartTypeSettingsSubsection, D as DrawingTypeMeta, H as HIGHLIGHT, I as INFO, j as INVALID, k as IdentifiableKind, M as MARKER, N as NEUTRAL, l as NormalizedSettingsRow, R as RendererLayerArgs, m as RendererLayerDefinition, n as RendererLayerInstance, S as SERIES_LINE, o as SESSION_OFF, p as SESSION_POST, q as SESSION_PRE, r as SLATE, s as SLATE_DEEP, t as SeriesDataEngine, u as SeriesDataEngineHost, v as SettingsInlineControl, w as SettingsRowCondition, x as SettingsRowDescriptor, y as SettingsRowInlineNumber, z as SettingsRowSwatch, E as SettingsRowValueKey, F as SettingsRowWhen, G as SettingsRowWidth, J as SettingsSelectOption, K as SettingsValueRow, T as TRADE_EXIT, L as TRADE_LONG, O as TRADE_SHORT, V as VALID, W as WARNING, P as categoricalColor, Q as chartType, U as chartTypes, X as createDrawing, Y as deserializeDrawing, Z as drawingTypes, _ as getDrawingType, $ as normalizeSettingsRow, a0 as registerChartType, a1 as registerDrawingType, a2 as registerRendererDefaults, a3 as registerRendererLayer, a4 as rendererDefaults, a5 as rendererLayers, a6 as settingsRowValueKeys, a7 as stableSeriesId, a8 as tickerModifierIds, a9 as unregisterChartType, aa as unregisterRendererDefaults, ab as unregisterRendererLayer } from './plugin-CkkH8QnX.cjs';
7
7
  export { D as DEFAULT_PANEL_MAX_WIDTH, a as DEFAULT_PANEL_MIN_WIDTH, b as DEFAULT_PANEL_WIDTH, S as SidePanelOptions, c as clampPanelWidth } from './side-panel-CT9ZwIGz.cjs';
8
8
  export { i as iconMarkup, r as registerIcon } from './icons-BZYbJXSV.cjs';
9
9
  export { a as KeyBindingDescriptor, R as ResolvedBinding } from './keymap-CGOz5F5f.cjs';
@@ -883,6 +883,12 @@ declare class NativeRenderer implements IChartRenderer {
883
883
  * (trade markers always target the price pane, whatever pane their model landed on). */
884
884
  private tradesScaleHints;
885
885
  private fitContent;
886
+ /** Re-frame after a series replacement (a symbol/timeframe switch): keep the user's
887
+ * zoom (bar spacing), re-anchor the newest bars at the default right offset.
888
+ * `clampViewport`'s fit-all-bars floor deliberately does NOT apply — a progressive
889
+ * head may still be backfilling toward the previous depth, and raising the spacing
890
+ * to its temporary bar count would lose the zoom this exists to keep. */
891
+ private reframeKeepZoom;
886
892
  private paneBoundsFor;
887
893
  /** The display title of a study pane's master (pane-scale) indicator — merged own-scale
888
894
  * indicators don't name the pane. Null when the pane holds no indicators. */
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as DrawingsDocument, R as Resolved } from './contributions-BCz6Dr6a.js';
2
- export { B as BarsChangeReason, C as CellStateContext, b as ContextSelect, c as DataControl, d as DrawingsControl, e as EngineAlert, f as EngineCapabilities, g as EngineContextSnapshot, h as EngineFactory, i as EngineWarning, j as ExecutionHandlers, k as ExecutionMarket, l as ExecutionRequest, m as ExecutionSession, E as ExternalIndicatorEntry, F as FetchSeries, n as IndicatorEventMap, I as IndicatorHandle, o as IndicatorSummary, L as LegendActionDescriptor, p as LegendCalloutContent, q as LegendCalloutDescriptor, r as LegendCalloutItem, s as LegendCalloutSpec, t as LegendIndicatorInfo, N as NativeIndicator, u as NativeIndicatorContext, v as NativeIndicatorDescriptor, w as NativeIndicatorInfo, x as NativeIndicatorOutput, O as OVERRIDABLE_TOPBAR_IDS, P as ParsedSymbol, y as PreparedScript, z as RendererControl, A as RunIndicatorResult, G as SceneInspection, a as ScriptRun, H as ScriptRunCause, J as ScriptRunResult, S as ScriptingEngine, K as SidePanelButton, M as SidePanelDescriptor, Q as SidePanelHandle, T as SidePanelHeader, U as StatePersistenceHandler, X as StrategyFill, Y as StrategyState, Z as StrategyTrade, _ as SymbolRankingHook, $ as TypedEventBus, V as Vela, a0 as VelaDeps, a1 as VelaEventMap, a2 as VisibleBarRange, a3 as WidgetActionDescriptor, a4 as WidgetActionTarget, a5 as WidgetAttachment, W as WidgetContext, a6 as getNativeIndicator, a7 as legendActions, a8 as legendCallouts, a9 as nativeIndicatorDescriptors, aa as nativeIndicatorTypes, ab as registerDefaultEngine, ac as registerLegendAction, ad as registerLegendCallout, ae as registerNativeIndicator, af as registerSidePanel, ag as registerStatePersistence, ah as registerSymbolRanking, ai as registerWidgetAction, aj as registerWidgetAttachment, ak as resolveEngines, al as sidePanels, am as statePersistenceHandlers, an as symbolRanking, ao as topbarActionOverride, ap as unregisterDefaultEngine, aq as unregisterLegendAction, ar as unregisterLegendCallout, as as unregisterNativeIndicator, at as unregisterSidePanel, au as unregisterStatePersistence, av as unregisterWidgetAction, aw as unregisterWidgetAttachment, ax as widgetActions, ay as widgetAttachments } from './contributions-BCz6Dr6a.js';
3
- import { D as Drawing, S as SerializedDrawing, U as Unsubscribe, L as LineStyle, P as PriceStyle, I as IChartRenderer, R as RendererCapabilities, e as RendererDisplayOptions, f as IndicatorRenderHandle, g as IndicatorStatus, c as VelaTheme, O as OHLCV, h as Pane, i as PaneAction, j as MoveTarget, k as IndicatorModel, l as ScenePatch, m as InputValue, n as SymbolPickerFn, o as LegendActionView, p as LegendCalloutView, q as InputChangeEvent, T as ThemeName, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, a as VisibleRange, s as DataWindowReadout, t as IDrawingsRendererPort, u as Millis, v as SnapMode, w as DrawingTypeKey, x as ToolbarDefinition, M as MarketConfig } from './options-DSqHsQyN.js';
4
- export { y as AddIndicatorOptions, B as Background, z as BoxFontFamily, E as BoxHAlign, F as BoxTextSize, G as BoxVAlign, H as CandleBarColor, J as CandleSeries, K as CandleStyle, Q as DataWindowGroup, W as DataWindowOHLC, X as DataWindowRow, Y as DirtyRange, Z as DrawingBox, _ as DrawingExtend, $ as DrawingIntent, a0 as DrawingLabel, a1 as DrawingLine, a2 as DrawingLinefill, a3 as DrawingMode, a4 as DrawingPoint, a5 as DrawingPolyline, a6 as DrawingStyle, a7 as DrawingTable, a8 as DrawingText, a9 as DrawingXLoc, aa as DrawingsOption, ab as Fill, ac as FillGradientStop, ad as IndicatorMeta, ae as InputCondition, af as InputSchema, ag as InputType, ah as InputWhen, ai as LabelStyle, aj as LabelYLoc, ak as LineLikeKind, al as LineLikeSeries, am as LineLikeStyle, an as MarkerPoint, ao as MarkerSeries, ap as MarketSnapshot, aq as MarketSwitch, ar as PaneAxis, as as PaneAxisBand, at as PaneHint, au as PaneKind, av as PolylinePoint, aw as PriceLine, ax as Projector, ay as ProviderName, az as RendererConstructor, aA as Scene, aB as SchemaPatch, aC as SeriesKind, aD as SeriesPoint, aE as SeriesSpec, aF as SeriesValueDelta, aG as SettingsField, aH as SettingsSchema, aI as SettingsVisibilityPolicy, aJ as TableCell, aK as TableMerge, aL as TablePosition, aM as ToolbarGroupConfig, aN as TradeExecution, aO as ValuePatch, b as VelaOptions, V as VisibleRangePreset, aP as buildToolbar, aQ as defaultToolbar, aR as inputVisible } from './options-DSqHsQyN.js';
5
- import { M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, S as SymbolInfo, b as ProviderCapabilities, B as BarRange } from './DataProvider-CWmp31dA.js';
6
- export { A as ACCENT, a as ACCENT_BRIGHT, B as BEARISH, b as BULLISH, c as BarTransform, d as BasePaintingModulation, C as CATEGORICAL, e as CROSSHAIR, f as ChartTypeDefinition, g as ChartTypeSettingsInstance, h as ChartTypeSettingsSection, i as ChartTypeSettingsSubsection, D as DrawingTypeMeta, H as HIGHLIGHT, I as INFO, j as INVALID, k as IdentifiableKind, M as MARKER, N as NEUTRAL, l as NormalizedSettingsRow, R as RendererLayerArgs, m as RendererLayerDefinition, n as RendererLayerInstance, S as SERIES_LINE, o as SESSION_OFF, p as SESSION_POST, q as SESSION_PRE, r as SLATE, s as SLATE_DEEP, t as SeriesDataEngine, u as SeriesDataEngineHost, v as SettingsInlineControl, w as SettingsRowCondition, x as SettingsRowDescriptor, y as SettingsRowInlineNumber, z as SettingsRowSwatch, E as SettingsRowValueKey, F as SettingsRowWhen, G as SettingsRowWidth, J as SettingsSelectOption, K as SettingsValueRow, T as TRADE_EXIT, L as TRADE_LONG, O as TRADE_SHORT, V as VALID, W as WARNING, P as categoricalColor, Q as chartType, U as chartTypes, X as createDrawing, Y as deserializeDrawing, Z as drawingTypes, _ as getDrawingType, $ as normalizeSettingsRow, a0 as registerChartType, a1 as registerDrawingType, a2 as registerRendererDefaults, a3 as registerRendererLayer, a4 as rendererDefaults, a5 as rendererLayers, a6 as settingsRowValueKeys, a7 as stableSeriesId, a8 as tickerModifierIds, a9 as unregisterChartType, aa as unregisterRendererDefaults, ab as unregisterRendererLayer } from './plugin-CH7pfMrE.js';
1
+ import { D as DrawingsDocument, R as Resolved } from './contributions-Bbe2R-mQ.js';
2
+ export { B as BarsChangeReason, C as CellStateContext, b as ContextSelect, c as DataControl, d as DrawingsControl, e as EngineAlert, f as EngineCapabilities, g as EngineContextSnapshot, h as EngineFactory, i as EngineWarning, j as ExecutionHandlers, k as ExecutionMarket, l as ExecutionRequest, m as ExecutionSession, E as ExternalIndicatorEntry, F as FetchSeries, n as IndicatorEventMap, I as IndicatorHandle, o as IndicatorSummary, L as LegendActionDescriptor, p as LegendCalloutContent, q as LegendCalloutDescriptor, r as LegendCalloutItem, s as LegendCalloutSpec, t as LegendIndicatorInfo, N as NativeIndicator, u as NativeIndicatorContext, v as NativeIndicatorDescriptor, w as NativeIndicatorInfo, x as NativeIndicatorOutput, O as OVERRIDABLE_TOPBAR_IDS, P as ParsedSymbol, y as PreparedScript, z as RendererControl, A as RunIndicatorResult, G as SceneInspection, a as ScriptRun, H as ScriptRunCause, J as ScriptRunResult, S as ScriptingEngine, K as SidePanelButton, M as SidePanelDescriptor, Q as SidePanelHandle, T as SidePanelHeader, U as StatePersistenceHandler, X as StrategyFill, Y as StrategyState, Z as StrategyTrade, _ as SymbolRankingHook, $ as TypedEventBus, V as Vela, a0 as VelaDeps, a1 as VelaEventMap, a2 as VisibleBarRange, a3 as WidgetActionDescriptor, a4 as WidgetActionTarget, a5 as WidgetAttachment, W as WidgetContext, a6 as getNativeIndicator, a7 as legendActions, a8 as legendCallouts, a9 as nativeIndicatorDescriptors, aa as nativeIndicatorTypes, ab as registerDefaultEngine, ac as registerLegendAction, ad as registerLegendCallout, ae as registerNativeIndicator, af as registerSidePanel, ag as registerStatePersistence, ah as registerSymbolRanking, ai as registerWidgetAction, aj as registerWidgetAttachment, ak as resolveEngines, al as sidePanels, am as statePersistenceHandlers, an as symbolRanking, ao as topbarActionOverride, ap as unregisterDefaultEngine, aq as unregisterLegendAction, ar as unregisterLegendCallout, as as unregisterNativeIndicator, at as unregisterSidePanel, au as unregisterStatePersistence, av as unregisterWidgetAction, aw as unregisterWidgetAttachment, ax as widgetActions, ay as widgetAttachments } from './contributions-Bbe2R-mQ.js';
3
+ import { D as Drawing, S as SerializedDrawing, U as Unsubscribe, L as LineStyle, P as PriceStyle, e as IChartRenderer, R as RendererCapabilities, f as RendererDisplayOptions, g as IndicatorRenderHandle, h as IndicatorStatus, c as VelaTheme, O as OHLCV, i as Pane, j as PaneAction, k as MoveTarget, l as IndicatorModel, m as ScenePatch, I as InputValue, n as SymbolPickerFn, o as LegendActionView, p as LegendCalloutView, q as InputChangeEvent, T as ThemeName, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, a as VisibleRange, s as DataWindowReadout, t as IDrawingsRendererPort, u as Millis, v as SnapMode, w as DrawingTypeKey, x as ToolbarDefinition, M as MarketConfig } from './options-yp7sA96q.js';
4
+ export { y as AddIndicatorOptions, B as Background, z as BoxFontFamily, E as BoxHAlign, F as BoxTextSize, G as BoxVAlign, H as CandleBarColor, J as CandleSeries, K as CandleStyle, Q as DataWindowGroup, W as DataWindowOHLC, X as DataWindowRow, Y as DirtyRange, Z as DrawingBox, _ as DrawingExtend, $ as DrawingIntent, a0 as DrawingLabel, a1 as DrawingLine, a2 as DrawingLinefill, a3 as DrawingMode, a4 as DrawingPoint, a5 as DrawingPolyline, a6 as DrawingStyle, a7 as DrawingTable, a8 as DrawingText, a9 as DrawingXLoc, aa as DrawingsOption, ab as Fill, ac as FillGradientStop, ad as IndicatorMeta, ae as InputCondition, af as InputSchema, ag as InputType, ah as InputWhen, ai as LabelStyle, aj as LabelYLoc, ak as LineLikeKind, al as LineLikeSeries, am as LineLikeStyle, an as MarkerPoint, ao as MarkerSeries, ap as MarketSnapshot, aq as MarketSwitch, ar as PaneAxis, as as PaneAxisBand, at as PaneHint, au as PaneKind, av as PolylinePoint, aw as PriceLine, ax as Projector, ay as ProviderName, az as RendererConstructor, aA as Scene, aB as SchemaPatch, aC as SeriesKind, aD as SeriesPoint, aE as SeriesSpec, aF as SeriesValueDelta, aG as SettingsField, aH as SettingsSchema, aI as SettingsVisibilityPolicy, aJ as TableCell, aK as TableMerge, aL as TablePosition, aM as ToolbarGroupConfig, aN as TradeExecution, aO as ValuePatch, b as VelaOptions, V as VisibleRangePreset, aP as buildToolbar, aQ as defaultToolbar, aR as inputDeltas, aS as inputVisible } from './options-yp7sA96q.js';
5
+ import { M as MarketDataFeed, D as DataProvider, P as ProviderInfo, a as SymbolDescriptor, S as SymbolInfo, b as ProviderCapabilities, B as BarRange } from './DataProvider-BBf-jc6W.js';
6
+ export { A as ACCENT, a as ACCENT_BRIGHT, B as BEARISH, b as BULLISH, c as BarTransform, d as BasePaintingModulation, C as CATEGORICAL, e as CROSSHAIR, f as ChartTypeDefinition, g as ChartTypeSettingsInstance, h as ChartTypeSettingsSection, i as ChartTypeSettingsSubsection, D as DrawingTypeMeta, H as HIGHLIGHT, I as INFO, j as INVALID, k as IdentifiableKind, M as MARKER, N as NEUTRAL, l as NormalizedSettingsRow, R as RendererLayerArgs, m as RendererLayerDefinition, n as RendererLayerInstance, S as SERIES_LINE, o as SESSION_OFF, p as SESSION_POST, q as SESSION_PRE, r as SLATE, s as SLATE_DEEP, t as SeriesDataEngine, u as SeriesDataEngineHost, v as SettingsInlineControl, w as SettingsRowCondition, x as SettingsRowDescriptor, y as SettingsRowInlineNumber, z as SettingsRowSwatch, E as SettingsRowValueKey, F as SettingsRowWhen, G as SettingsRowWidth, J as SettingsSelectOption, K as SettingsValueRow, T as TRADE_EXIT, L as TRADE_LONG, O as TRADE_SHORT, V as VALID, W as WARNING, P as categoricalColor, Q as chartType, U as chartTypes, X as createDrawing, Y as deserializeDrawing, Z as drawingTypes, _ as getDrawingType, $ as normalizeSettingsRow, a0 as registerChartType, a1 as registerDrawingType, a2 as registerRendererDefaults, a3 as registerRendererLayer, a4 as rendererDefaults, a5 as rendererLayers, a6 as settingsRowValueKeys, a7 as stableSeriesId, a8 as tickerModifierIds, a9 as unregisterChartType, aa as unregisterRendererDefaults, ab as unregisterRendererLayer } from './plugin-DwxjM3Ni.js';
7
7
  export { D as DEFAULT_PANEL_MAX_WIDTH, a as DEFAULT_PANEL_MIN_WIDTH, b as DEFAULT_PANEL_WIDTH, S as SidePanelOptions, c as clampPanelWidth } from './side-panel-CT9ZwIGz.js';
8
8
  export { i as iconMarkup, r as registerIcon } from './icons-BZYbJXSV.js';
9
9
  export { a as KeyBindingDescriptor, R as ResolvedBinding } from './keymap-CGOz5F5f.js';
@@ -883,6 +883,12 @@ declare class NativeRenderer implements IChartRenderer {
883
883
  * (trade markers always target the price pane, whatever pane their model landed on). */
884
884
  private tradesScaleHints;
885
885
  private fitContent;
886
+ /** Re-frame after a series replacement (a symbol/timeframe switch): keep the user's
887
+ * zoom (bar spacing), re-anchor the newest bars at the default right offset.
888
+ * `clampViewport`'s fit-all-bars floor deliberately does NOT apply — a progressive
889
+ * head may still be backfilling toward the previous depth, and raising the spacing
890
+ * to its temporary bar count would lose the zoom this exists to keep. */
891
+ private reframeKeepZoom;
886
892
  private paneBoundsFor;
887
893
  /** The display title of a study pane's master (pane-scale) indicator — merged own-scale
888
894
  * indicators don't name the pane. Null when the pane holds no indicators. */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { stableSeriesId } from './chunk-AOGZBKUE.js';
2
- export { BarStore, CachingDataFeed, DARK_THEME, DataControl, DrawingStore, DrawingToolbar, DrawingsControl, LIGHT_THEME, MultiProviderFeed, NativeRenderer, RendererControl, TypedEventBus, Vela, buildToolbar, defaultToolbar, resolveTheme, sharedBarStore, timeframeToMs } from './chunk-FFOP37FQ.js';
3
- export { DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_WIDTH, Drawing, OVERRIDABLE_TOPBAR_IDS, chartType, chartTypes, clampPanelWidth, createDrawing, deserializeDrawing, drawingTypes, getDrawingType, getNativeIndicator, inputVisible, legendActions, legendCallouts, nativeIndicatorDescriptors, nativeIndicatorTypes, normalizeSettingsRow, registerChartType, registerDefaultEngine, registerDrawingType, registerLegendAction, registerLegendCallout, registerNativeIndicator, registerRendererDefaults, registerRendererLayer, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, rendererDefaults, rendererLayers, resolveEngines, settingsRowValueKeys, sidePanels, statePersistenceHandlers, symbolRanking, tickerModifierIds, topbarActionOverride, unregisterChartType, unregisterDefaultEngine, unregisterLegendAction, unregisterLegendCallout, unregisterNativeIndicator, unregisterRendererDefaults, unregisterRendererLayer, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-4KZVZ7QQ.js';
1
+ export { stableSeriesId } from './chunk-H26BEHF4.js';
2
+ export { BarStore, CachingDataFeed, DARK_THEME, DataControl, DrawingStore, DrawingToolbar, DrawingsControl, LIGHT_THEME, MultiProviderFeed, NativeRenderer, RendererControl, TypedEventBus, Vela, buildToolbar, defaultToolbar, resolveTheme, sharedBarStore, timeframeToMs } from './chunk-73PEA4MU.js';
3
+ export { DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_WIDTH, Drawing, OVERRIDABLE_TOPBAR_IDS, chartType, chartTypes, clampPanelWidth, createDrawing, deserializeDrawing, drawingTypes, getDrawingType, getNativeIndicator, inputDeltas, inputVisible, legendActions, legendCallouts, nativeIndicatorDescriptors, nativeIndicatorTypes, normalizeSettingsRow, registerChartType, registerDefaultEngine, registerDrawingType, registerLegendAction, registerLegendCallout, registerNativeIndicator, registerRendererDefaults, registerRendererLayer, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, rendererDefaults, rendererLayers, resolveEngines, settingsRowValueKeys, sidePanels, statePersistenceHandlers, symbolRanking, tickerModifierIds, topbarActionOverride, unregisterChartType, unregisterDefaultEngine, unregisterLegendAction, unregisterLegendCallout, unregisterNativeIndicator, unregisterRendererDefaults, unregisterRendererLayer, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-MTLJKZDZ.js';
4
4
  import './chunk-MHY7MVXH.js';
5
5
  export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CROSSHAIR, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, categoricalColor, iconMarkup, registerIcon } from './chunk-KG4YT3TI.js';