@luxalgo/vela 0.7.0 → 0.7.1

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 (45) hide show
  1. package/dist/{DataProvider-Bu9E5Zh5.d.ts → DataProvider-BALR0qPq.d.ts} +1 -1
  2. package/dist/{DataProvider-Ck2qyS_9.d.cts → DataProvider-D5uMiJYz.d.cts} +1 -1
  3. package/dist/{chunk-A4G64KVF.js → chunk-5RQGCZTX.js} +299 -110
  4. package/dist/{chunk-IFJJPXSV.js → chunk-BFA32GOU.js} +44 -16
  5. package/dist/{chunk-CZRNTHD6.js → chunk-BKHSQ4YM.js} +129 -125
  6. package/dist/{chunk-A347YL2P.js → chunk-QGVSNAX7.js} +67 -9
  7. package/dist/{chunk-UHXG5J7C.js → chunk-ZADTVRUO.js} +1 -1
  8. package/dist/{contributions-BjQ7hyIx.d.ts → contributions-BbhbZd3c.d.ts} +31 -9
  9. package/dist/{contributions-Cv2Mutvn.d.cts → contributions-CcBFe-91.d.cts} +31 -9
  10. package/dist/index.cjs +379 -156
  11. package/dist/index.d.cts +44 -17
  12. package/dist/index.d.ts +44 -17
  13. package/dist/index.js +4 -4
  14. package/dist/{options-ex2_gtKp.d.ts → options-C7b_Qssu.d.cts} +42 -1
  15. package/dist/{options-ex2_gtKp.d.cts → options-C7b_Qssu.d.ts} +42 -1
  16. package/dist/{plugin-CiyhU7pi.d.ts → plugin-Cnix5ZBh.d.ts} +6 -4
  17. package/dist/{plugin-absNH7Yn.d.cts → plugin-D6MlX4--.d.cts} +6 -4
  18. package/dist/plugin.cjs +39 -15
  19. package/dist/plugin.d.cts +4 -4
  20. package/dist/plugin.d.ts +4 -4
  21. package/dist/plugin.js +2 -2
  22. package/dist/providers/binance.d.cts +2 -2
  23. package/dist/providers/binance.d.ts +2 -2
  24. package/dist/providers/coinbase.d.cts +2 -2
  25. package/dist/providers/coinbase.d.ts +2 -2
  26. package/dist/providers/hyperliquid.d.cts +2 -2
  27. package/dist/providers/hyperliquid.d.ts +2 -2
  28. package/dist/{statusline-model-BXoU4Kua.d.ts → statusline-model-D8NL7o4L.d.ts} +3 -3
  29. package/dist/{statusline-model-cRhPBLPO.d.cts → statusline-model-DUKt7_TQ.d.cts} +3 -3
  30. package/dist/ui.cjs +8 -4
  31. package/dist/ui.d.cts +10 -7
  32. package/dist/ui.d.ts +10 -7
  33. package/dist/ui.js +2 -2
  34. package/dist/vela.global.js +379 -156
  35. package/dist/vela.global.min.js +70 -70
  36. package/dist/widget.cjs +406 -127
  37. package/dist/widget.d.cts +6 -6
  38. package/dist/widget.d.ts +6 -6
  39. package/dist/widget.js +6 -6
  40. package/dist/workspace.cjs +406 -127
  41. package/dist/workspace.d.cts +39 -6
  42. package/dist/workspace.d.ts +39 -6
  43. package/dist/workspace.js +5 -5
  44. package/package.json +1 -1
  45. /package/dist/{chunk-FE6V2YAQ.js → chunk-JU4CWEBF.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { x as Millis, an as InputSchema, al as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, aV as SeriesSpec, aj as Fill, G as Background, aM as PriceLine, a6 as DrawingLine, a2 as DrawingBox, a5 as DrawingLabel, aa as DrawingPolyline, a7 as DrawingLinefill, af as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a8 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, b8 as PaneInfo, ai as DrawingsOption, ac as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, E as AddIndicatorOptions, aG as MarketSwitch, aF as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-ex2_gtKp.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-Ck2qyS_9.cjs';
1
+ import { x as Millis, an as InputSchema, al as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, aW as SeriesSpec, aj as Fill, G as Background, aM as PriceLine, a6 as DrawingLine, a2 as DrawingBox, a5 as DrawingLabel, aa as DrawingPolyline, a7 as DrawingLinefill, af as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a8 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bc as PaneInfo, ai as DrawingsOption, ac as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, E as AddIndicatorOptions, aG as MarketSwitch, aF as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-C7b_Qssu.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-D5uMiJYz.cjs';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -282,9 +282,10 @@ interface IndicatorEventMap extends Record<string, unknown> {
282
282
  interface IndicatorHandle {
283
283
  readonly id: string;
284
284
  readonly title: string;
285
- /** The script source this indicator was added with. `undefined` for a NATIVE
286
- * (core-computed) indicator there is no script to show. What a host editor
287
- * opens when a legend action asks for "the code behind this row". */
285
+ /** The script source this indicator currently runs (the one it was added with,
286
+ * until {@link updateCode} replaces it). `undefined` for a NATIVE (core-computed)
287
+ * indicator there is no script to show. What a host editor opens when a legend
288
+ * action asks for "the code behind this row". */
288
289
  readonly source?: string;
289
290
  /** The registered type of a NATIVE (core-computed) indicator — `undefined` for a
290
291
  * script indicator. The two are exclusive: a handle has a `source` or a `nativeType`. */
@@ -309,6 +310,17 @@ interface IndicatorHandle {
309
310
  setProp(key: string, value: InputValue): void;
310
311
  /** Override several declaration props at once and re-run. */
311
312
  setProps(values: Record<string, InputValue>): void;
313
+ /**
314
+ * Replace the script and re-run it **in place** — same `id`, same legend row, same
315
+ * pane placement, same handle; the seam for a host editor's "run my edit" and for a
316
+ * library's "update to the new version". The new source is prepared first: only once
317
+ * it compiles is the running script stopped and the new one started, so a broken edit
318
+ * leaves the current indicator computing and painting and reports through `error`.
319
+ * Input and prop values survive where the new script still declares their key;
320
+ * anything else takes the new declaration default. No-op for a native indicator and
321
+ * for an unchanged source.
322
+ */
323
+ updateCode(source: string): void;
312
324
  /**
313
325
  * Hide or show the indicator. Hiding **suspends** it — its visuals are dropped (the legend
314
326
  * row stays, marked hidden) and its computation stops (the engine session is torn down), so a
@@ -439,6 +451,10 @@ interface NativeIndicatorOutput {
439
451
  }
440
452
  /** Services the host gives a running native indicator. */
441
453
  interface NativeIndicatorContext {
454
+ /** This instance's indicator id — the same id its `IndicatorHandle`, `inspect()` and
455
+ * the pane listing report. Lets an instance name itself to host code (a picker, a
456
+ * hit-test) and tell itself apart from siblings of a `multiInstance` type. */
457
+ readonly id: string;
442
458
  readonly symbol: string;
443
459
  readonly timeframe: string;
444
460
  readonly live: boolean;
@@ -475,11 +491,13 @@ interface NativeIndicator {
475
491
  onViewport(range: VisibleRange): void;
476
492
  /** Settings changed — recompute + emit. */
477
493
  setInputs(inputs: Record<string, InputValue>): void;
478
- /** Hidden — stop timers/fetches (free resources); the instance + its state are kept for resume. */
494
+ /** Hidden — stop timers/fetches (free resources); the instance + its state are kept for resume.
495
+ * Only ever called after `start` (an instance added hidden is not suspended — it is
496
+ * started when first shown). */
479
497
  suspend(): void;
480
498
  /** Shown again — resume + re-emit. */
481
499
  resume(): void;
482
- /** Removed — full teardown (clear caches, stop timers). */
500
+ /** Removed — full teardown (clear caches, stop timers). Only ever called after `start`. */
483
501
  stop(): void;
484
502
  }
485
503
  /**
@@ -515,8 +533,10 @@ interface NativeIndicatorDescriptor {
515
533
  /**
516
534
  * Allow several instances of this type on one chart — every add creates a new one (a study
517
535
  * like a moving average is typically stacked at different lengths). Absent ⇒ SINGLE instance
518
- * per type: a second add returns the existing handle. A type that pushes a bespoke layer
519
- * payload through `pushData` must stay single-instance (the layer is keyed by type).
536
+ * per type: a second add returns the existing handle. A type that paints through a renderer
537
+ * layer (`pushData`) gets ONE layer instance per indicator instance, each fed by that
538
+ * instance's own channel and painting on that instance's pane — so instances never
539
+ * overwrite each other (see `IndicatorModel.native.channel`).
520
540
  */
521
541
  readonly multiInstance?: boolean;
522
542
  inputsSchema(): InputSchema[];
@@ -574,6 +594,8 @@ type ScriptRunCause =
574
594
  | 'bar'
575
595
  /** An input was edited. */
576
596
  | 'inputs'
597
+ /** The script's source was replaced in place (`handle.updateCode`). */
598
+ | 'code'
577
599
  /** The visible range moved (viewport-aware scripts only). */
578
600
  | 'viewport'
579
601
  /** The chart's market changed and the script re-executed over the new bars. */