@luxalgo/vela 0.8.1 → 0.8.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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/{DataProvider-BrlxntPN.d.cts → DataProvider-COGDs9Xg.d.cts} +1 -1
  3. package/dist/{DataProvider-DwFIoV4r.d.ts → DataProvider-DpOWZD8F.d.ts} +1 -1
  4. package/dist/{chunk-LMBYEGUR.js → chunk-27UTYE7T.js} +25 -2
  5. package/dist/{chunk-EZ5FWVLA.js → chunk-DPAA3SRT.js} +94 -13
  6. package/dist/{chunk-BZQM2XO7.js → chunk-HKNO24GD.js} +13 -1
  7. package/dist/{chunk-NELQJCGK.js → chunk-NLDTVFOI.js} +41 -3
  8. package/dist/{chunk-DBDXKZUF.js → chunk-R2JMNIHY.js} +53 -13
  9. package/dist/{chunk-ATGTCWHJ.js → chunk-T3DZIR5Y.js} +171 -32
  10. package/dist/{contributions-tjNExo1o.d.ts → contributions-Cgm9RJYP.d.cts} +38 -11
  11. package/dist/{contributions-CtlptxR8.d.cts → contributions-bWgwyiVi.d.ts} +38 -11
  12. package/dist/index.cjs +239 -37
  13. package/dist/index.d.cts +8 -8
  14. package/dist/index.d.ts +8 -8
  15. package/dist/index.js +4 -4
  16. package/dist/{options-BnEPUuVV.d.ts → options-NAUHiQEC.d.cts} +3 -3
  17. package/dist/{options-BnEPUuVV.d.cts → options-NAUHiQEC.d.ts} +3 -3
  18. package/dist/{plugin-BWxJRKzS.d.cts → plugin-CjjzZX2F.d.cts} +4 -4
  19. package/dist/{plugin-e2WUEtiI.d.ts → plugin-CqxWoDKS.d.ts} +4 -4
  20. package/dist/plugin.cjs +20 -6
  21. package/dist/plugin.d.cts +5 -5
  22. package/dist/plugin.d.ts +5 -5
  23. package/dist/plugin.js +2 -2
  24. package/dist/providers/binance.d.cts +2 -2
  25. package/dist/providers/binance.d.ts +2 -2
  26. package/dist/providers/coinbase.d.cts +2 -2
  27. package/dist/providers/coinbase.d.ts +2 -2
  28. package/dist/providers/hyperliquid.d.cts +2 -2
  29. package/dist/providers/hyperliquid.d.ts +2 -2
  30. package/dist/{side-panel-HF0IAzwf.d.cts → side-panel-wMNfgyZb.d.cts} +13 -0
  31. package/dist/{side-panel-HF0IAzwf.d.ts → side-panel-wMNfgyZb.d.ts} +13 -0
  32. package/dist/{statusline-model-zKXtGIjj.d.ts → statusline-model-Dih6FGWP.d.ts} +3 -3
  33. package/dist/{statusline-model-DFY7tuHj.d.cts → statusline-model-Dpfpq54A.d.cts} +3 -3
  34. package/dist/ui.cjs +77 -2
  35. package/dist/ui.d.cts +28 -2
  36. package/dist/ui.d.ts +28 -2
  37. package/dist/ui.js +3 -3
  38. package/dist/vela.global.js +239 -37
  39. package/dist/vela.global.min.js +52 -52
  40. package/dist/widget.cjs +383 -50
  41. package/dist/widget.d.cts +20 -10
  42. package/dist/widget.d.ts +20 -10
  43. package/dist/widget.js +7 -7
  44. package/dist/workspace.cjs +383 -50
  45. package/dist/workspace.d.cts +5 -5
  46. package/dist/workspace.d.ts +5 -5
  47. package/dist/workspace.js +6 -6
  48. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- import { deserializeDrawing, chartTypes, rendererLayers, isLineLikeSeries, seriesShownOn, foldBaseModulation, registerChartType, rendererDefaults, getDrawingType, settingsRowVisible, normalizeSettingsRow, Magnifier, TextLabel, Callout, resetDrawingSettings, registerNativeIndicator, chartType, getNativeIndicator, nativeIndicatorDescriptors, nativeInstanceChannel, drawingTypes, settingsRowValueKeys, formatDuration, RegressionChannel, FixedRangeVolumeProfile, DEFAULT_DRAWING_COLOR, SegmentDrawing, ArrowMark, GlyphStamp, RadialFib, FibSpiral, DedekindTessellation, MachFigure, GannSquare, FibRatios, MeasureBox, PositionTool, AnchoredVwap, PatternDrawing, Comment, PriceNote, Signpost, Note, PriceLabel, GANN_SQUARE_ARCS, magnifierTimeframeLabel, lineSegmentIntersection, MAGNIFIER_TIMEFRAME_OPTIONS, GLYPH_OPTIONS, STAMP_SIZE_OPTIONS, LINE_STYLE_OPTIONS, DEDEKIND_CURVATURE_OPTIONS, MACH_NUMBER_OPTIONS, MACH_WAVE_COUNT_OPTIONS, TEXT_SIZE_OPTIONS, createDrawing, inputVisible, seriesInScale, tickerModifierIds, CalloutBase, DIRECTION_OPTIONS, stableSeriesId } from './chunk-EZ5FWVLA.js';
2
- import { themeTokens, Dialog, closeOpenPopovers, closeWidthPopover, fieldSection, buildFieldControl, fieldSeparator, fieldGrid, fieldRow, CALLOUT_STYLE_ID, CALLOUT_CSS, Popover, blendOver, splitColor, CalloutBubble, Menu, TextArea, NumberInput, buildColorPicker, isPopoverOpen, DatePicker, eventDismissedPopover, toggleSelectList, normalizeDateInput, openPopoverTrigger, fieldGridColumns, FIELD_GAP_PX, STATIC_TOKENS } from './chunk-NELQJCGK.js';
3
- import { icon, iconAt, withAlpha, WARNING, ACCENT, NEUTRAL, INFO, BULLISH, BEARISH, isDarkColor, injectStyles, SERIES_LINE, CHIP_PLATE, CROSSHAIR, TRADE_EXIT, TRADE_SHORT, TRADE_LONG, iconMarkup, overlayScrollbarCss, SLATE_DEEP, VALID, INVALID, SLATE, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, svg24, svg24Solid } from './chunk-BZQM2XO7.js';
1
+ import { deserializeDrawing, chartTypes, rendererLayers, isLineLikeSeries, seriesShownOn, foldBaseModulation, registerChartType, rendererDefaults, getDrawingType, settingsRowVisible, normalizeSettingsRow, Magnifier, TextLabel, Callout, resetDrawingSettings, registerNativeIndicator, chartType, getNativeIndicator, nativeIndicatorDescriptors, nativeInstanceChannel, drawingTypes, settingsRowValueKeys, formatDuration, RegressionChannel, FixedRangeVolumeProfile, DEFAULT_DRAWING_COLOR, SegmentDrawing, ArrowMark, GlyphStamp, RadialFib, FibSpiral, DedekindTessellation, MachFigure, GannSquare, FibRatios, MeasureBox, PositionTool, AnchoredVwap, PatternDrawing, Comment, PriceNote, Signpost, Note, PriceLabel, GANN_SQUARE_ARCS, magnifierTimeframeLabel, lineSegmentIntersection, MAGNIFIER_TIMEFRAME_OPTIONS, GLYPH_OPTIONS, STAMP_SIZE_OPTIONS, LINE_STYLE_OPTIONS, DEDEKIND_CURVATURE_OPTIONS, MACH_NUMBER_OPTIONS, MACH_WAVE_COUNT_OPTIONS, TEXT_SIZE_OPTIONS, createDrawing, inputVisible, seriesInScale, tickerModifierIds, CalloutBase, DIRECTION_OPTIONS, FibRetracement, stableSeriesId } from './chunk-DPAA3SRT.js';
2
+ import { themeTokens, Dialog, closeOpenPopovers, closeWidthPopover, fieldSection, buildFieldControl, fieldSeparator, fieldGrid, fieldRow, CALLOUT_STYLE_ID, CALLOUT_CSS, Popover, blendOver, splitColor, CalloutBubble, Menu, TextArea, NumberInput, buildColorPicker, isPopoverOpen, DatePicker, eventDismissedPopover, toggleSelectList, normalizeDateInput, openPopoverTrigger, fieldGridColumns, FIELD_GAP_PX, STATIC_TOKENS } from './chunk-NLDTVFOI.js';
3
+ import { icon, iconAt, withAlpha, WARNING, ACCENT, NEUTRAL, INFO, BULLISH, BEARISH, announceSurface, isDarkColor, injectStyles, SERIES_LINE, CHIP_PLATE, CROSSHAIR, TRADE_EXIT, TRADE_SHORT, TRADE_LONG, iconMarkup, overlayScrollbarCss, SLATE_DEEP, VALID, INVALID, SLATE, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, svg24, svg24Solid } from './chunk-HKNO24GD.js';
4
4
 
5
5
  // src/core/events/EventBus.ts
6
6
  var TypedEventBus = class {
@@ -3013,6 +3013,7 @@ var DrawingToolbar = class {
3013
3013
  );
3014
3014
  }
3015
3015
  }
3016
+ announceSurface(fly, true, "menu", cell);
3016
3017
  }
3017
3018
  openMagnetFlyout() {
3018
3019
  const cell = this.magnetCell;
@@ -3036,6 +3037,7 @@ var DrawingToolbar = class {
3036
3037
  })
3037
3038
  );
3038
3039
  }
3040
+ announceSurface(fly, true, "menu", cell);
3039
3041
  }
3040
3042
  flyoutHeader(text) {
3041
3043
  const t = this.theme;
@@ -3104,9 +3106,11 @@ var DrawingToolbar = class {
3104
3106
  }
3105
3107
  closeFlyout() {
3106
3108
  this.starEls.clear();
3107
- if (this.flyout) {
3108
- this.flyout.remove();
3109
+ const fly = this.flyout;
3110
+ if (fly) {
3109
3111
  this.flyout = null;
3112
+ announceSurface(fly, false, "menu", this.flyoutCell);
3113
+ fly.remove();
3110
3114
  this.flyoutCell?.classList.remove("vela-open");
3111
3115
  this.flyoutCell = null;
3112
3116
  this.flyoutOwnerId = null;
@@ -5791,15 +5795,23 @@ var Batch = class {
5791
5795
  this.seg(x + w, y + h, x, y + h, lineWidth, c);
5792
5796
  this.seg(x, y + h, x, y, lineWidth, c);
5793
5797
  }
5794
- /** Filled circle (triangle fan). */
5798
+ /**
5799
+ * Filled circle (triangle fan), feathered like a line: the rim is padded by {@link AA_PAD} and
5800
+ * edgeDist runs from 0 at the center to the padded radius at the rim, with edgeHalf = r. The
5801
+ * distance grows linearly along each spoke, so the shader's line feather gives a round soft edge.
5802
+ */
5795
5803
  circle(cx, cy, r, c, segments = 16) {
5796
- let px = cx + r;
5804
+ const ext = r + AA_PAD;
5805
+ let px = cx + ext;
5797
5806
  let py = cy;
5807
+ this.ensure(segments * 3);
5798
5808
  for (let i = 1; i <= segments; i += 1) {
5799
5809
  const a = i / segments * Math.PI * 2;
5800
- const nx = cx + Math.cos(a) * r;
5801
- const ny = cy + Math.sin(a) * r;
5802
- this.tri(cx, cy, c, px, py, c, nx, ny, c);
5810
+ const nx = cx + Math.cos(a) * ext;
5811
+ const ny = cy + Math.sin(a) * ext;
5812
+ this.v(cx, cy, c, 0, r);
5813
+ this.v(px, py, c, ext, r);
5814
+ this.v(nx, ny, c, ext, r);
5803
5815
  px = nx;
5804
5816
  py = ny;
5805
5817
  }
@@ -5980,7 +5992,7 @@ var WebGL2Backend = class {
5980
5992
  }
5981
5993
  mount(canvas) {
5982
5994
  this.canvas = canvas;
5983
- this.gl = canvas.getContext("webgl2", { alpha: true, antialias: true, depth: false, stencil: false, premultipliedAlpha: true });
5995
+ this.gl = canvas.getContext("webgl2", { alpha: true, antialias: false, depth: false, stencil: false, premultipliedAlpha: true });
5984
5996
  if (!this.gl) return;
5985
5997
  if (!this.initGL()) {
5986
5998
  this.gl = null;
@@ -7432,7 +7444,7 @@ var InputController = class {
7432
7444
  this.deps.drawingsPointerUp?.(x, y, this.snapMode(e));
7433
7445
  } else if (tapRelease && this.region === "data") {
7434
7446
  this.deps.onClick(x, y);
7435
- } else if (this.dragging && this.region === "data") {
7447
+ } else if (this.dragging && this.region === "data" && wasTouch) {
7436
7448
  const stale = e.timeStamp - this.lastT > FLING_STALE_MS;
7437
7449
  if (!stale && Math.abs(this.vx) > FLING_MIN_SPEED) {
7438
7450
  const pitch = this.deps.getCoords().pxPerBar();
@@ -13846,6 +13858,12 @@ var DrawingInteraction = class {
13846
13858
  activeDragId() {
13847
13859
  return this.state.kind === "pressed" && this.state.moved ? this.state.id : null;
13848
13860
  }
13861
+ /** The store drawings a live drag is moving — the pressed one and its riders — or none
13862
+ * before the drag passes the slop. A Ctrl-drag moves copies, so its sources stay put. */
13863
+ movingIds() {
13864
+ if (this.state.kind !== "pressed" || !this.state.moved || this.state.clones) return /* @__PURE__ */ new Set();
13865
+ return /* @__PURE__ */ new Set([this.state.id, ...this.state.riders.map((r) => r.id)]);
13866
+ }
13849
13867
  /** The drawing under a press that has not been released yet (drag or click undecided), or null. */
13850
13868
  pressedId() {
13851
13869
  return this.state.kind === "pressed" ? this.state.id : null;
@@ -14504,6 +14522,17 @@ var DrawingSettingsDialog = class {
14504
14522
  }
14505
14523
  }));
14506
14524
  }
14525
+ if (drawing instanceof FibRetracement) {
14526
+ const fib = drawing;
14527
+ grid.appendChild(fieldRow({
14528
+ label: "Reverse",
14529
+ bool: true,
14530
+ toggle: {
14531
+ checked: fib.reverse,
14532
+ onChange: (v) => actions.patch({ reverse: v })
14533
+ }
14534
+ }));
14535
+ }
14507
14536
  levels.forEach((lv, i) => {
14508
14537
  const row = document.createElement("div");
14509
14538
  row.className = "vela-field-span";
@@ -15657,6 +15686,8 @@ var UserDrawingController = class {
15657
15686
  this.drawings = [];
15658
15687
  /** Ids painted on an interleave layer this frame — the top canvas paints only their handles. */
15659
15688
  this.sliced = /* @__PURE__ */ new Set();
15689
+ /** Interleaved drawings mid-drag: painted on the top canvas, left out of their slice. */
15690
+ this.lifted = /* @__PURE__ */ new Set();
15660
15691
  /** Cached slice canvases, keyed `paneId|beforeZ`, reused across frames to avoid churn. */
15661
15692
  this.sliceCache = /* @__PURE__ */ new Map();
15662
15693
  /** Series boundaries per pane as of the last `prepareSlices` — lets a repaint between data
@@ -15744,7 +15775,7 @@ var UserDrawingController = class {
15744
15775
  selectedIds: () => this.selectedIds,
15745
15776
  emit: (i) => this.emit(i),
15746
15777
  changed: () => {
15747
- this.invalidateSlices();
15778
+ this.syncLift();
15748
15779
  this.render();
15749
15780
  },
15750
15781
  openSettings: (id, x, y) => this.openSettingsById(id, x, y),
@@ -16370,6 +16401,20 @@ var UserDrawingController = class {
16370
16401
  /** A drawing that paints inside the series stack changed (content, not hover): its pixels
16371
16402
  * live in the backend composite, so this layer alone can't show the change — ask for a
16372
16403
  * data frame, which re-runs `prepareSlices` before the backend composites. */
16404
+ /** A drawing being dragged leaves its interleave slice for the top canvas, so each pointer
16405
+ * move repaints one 2D layer instead of re-rasterizing and re-uploading a plot-sized slice
16406
+ * texture through the data frame. The slices rebuild once as the drag starts and once as it
16407
+ * ends (release, cancel), when the lifted set changes. */
16408
+ syncLift() {
16409
+ const moving = this.interaction.movingIds();
16410
+ let same = moving.size === this.lifted.size;
16411
+ if (same) {
16412
+ for (const id of moving) if (!this.lifted.has(id)) same = false;
16413
+ }
16414
+ if (same) return;
16415
+ this.lifted = new Set(moving);
16416
+ this.invalidateSlices();
16417
+ }
16373
16418
  invalidateSlices() {
16374
16419
  if (this.sliced.size > 0 || this.drawings.some((d) => this.isInterleaved(d))) this.deps.requestDataPaint();
16375
16420
  }
@@ -16388,7 +16433,7 @@ var UserDrawingController = class {
16388
16433
  const theme = this.deps.theme();
16389
16434
  const buckets = /* @__PURE__ */ new Map();
16390
16435
  for (const d of this.drawings) {
16391
- if (!d.visible) continue;
16436
+ if (!d.visible || this.lifted.has(d.id)) continue;
16392
16437
  const beforeZ = sliceKeyFor(d.zIndex, this.lastBounds.get(d.paneId) ?? []);
16393
16438
  if (beforeZ === null) continue;
16394
16439
  const key = `${d.paneId}|${beforeZ}`;
@@ -16440,8 +16485,9 @@ var UserDrawingController = class {
16440
16485
  mutedLabel: edited instanceof TextLabel ? edited.id : null
16441
16486
  };
16442
16487
  this.painter.seriesLook = this.deps.seriesLook();
16443
- this.painter.paintAll(ctx, this.drawings.filter((d) => !this.isInterleaved(d)), proj, this.deps.theme(), targets);
16444
- this.painter.paintHighlights(ctx, this.drawings.filter((d) => this.isInterleaved(d)), proj, handleIdsFor(targets));
16488
+ const onTop = (d) => !this.isInterleaved(d) || this.lifted.has(d.id);
16489
+ this.painter.paintAll(ctx, this.drawings.filter(onTop), proj, this.deps.theme(), targets);
16490
+ this.painter.paintHighlights(ctx, this.drawings.filter((d) => !onTop(d)), proj, handleIdsFor(targets));
16445
16491
  const clones = this.interaction.dragClones();
16446
16492
  if (clones) this.painter.paintAll(ctx, clones, proj, this.deps.theme(), { selected: new Set(clones.map((c) => c.id)) });
16447
16493
  this.layoutTextEditor();
@@ -21904,7 +21950,7 @@ var IndicatorHandleImpl = class {
21904
21950
  this.controller.applyProps(this.id, values);
21905
21951
  }
21906
21952
  updateCode(source) {
21907
- this.controller.updateCode(this.id, source);
21953
+ return this.controller.updateCode(this.id, source);
21908
21954
  }
21909
21955
  setVisible(visible) {
21910
21956
  this.controller.setVisible(this.id, visible);
@@ -23719,20 +23765,26 @@ var EngineOrchestrator = class _EngineOrchestrator {
23719
23765
  /**
23720
23766
  * IndicatorController: replace a SCRIPT indicator's source in place (see
23721
23767
  * {@link IndicatorHandle.updateCode}). Prepare-first: the running session keeps
23722
- * computing until the new source has compiled, so a broken edit costs the user
23723
- * nothing but an `error` event. Natives have no script — warn and leave them alone.
23768
+ * computing until the new source has compiled; then the new code runs on TRIAL until
23769
+ * its first model lands, and a failure before that puts the previous code back.
23770
+ * Natives have no script — warn and leave them alone.
23724
23771
  */
23725
23772
  updateCode(id, source) {
23726
23773
  const record = this.registry.get(id);
23727
23774
  const handle = this.handles.get(id);
23728
- if (!record || !handle) return;
23775
+ if (!record || !handle) return Promise.resolve({ ok: false, error: new Error(`[vela] updateCode("${id}") \u2014 the indicator is no longer on the chart.`) });
23729
23776
  if (record.native) {
23730
23777
  console.warn(`[vela] updateCode("${id}") \u2014 a native indicator has no script to update.`);
23731
- return;
23778
+ return Promise.resolve({ ok: false, error: new Error(`[vela] updateCode("${id}") \u2014 a native indicator has no script to update.`) });
23732
23779
  }
23733
- if (source === record.source && record.pendingSource === void 0) return;
23734
- record.pendingSource = source;
23735
- void this.swapSource(id, source, handle);
23780
+ const busy = record.pendingSource !== void 0 || record.codeTrial !== void 0;
23781
+ if (!busy && source === record.source) return Promise.resolve({ ok: true, error: null });
23782
+ return new Promise((resolve) => {
23783
+ (record.codeWaiters ?? (record.codeWaiters = [])).push(resolve);
23784
+ if (record.pendingSource === source || record.pendingSource === void 0 && record.codeTrial && record.source === source) return;
23785
+ record.pendingSource = source;
23786
+ void this.swapSource(id, source, handle);
23787
+ });
23736
23788
  }
23737
23789
  async swapSource(id, source, handle) {
23738
23790
  const engine = this.registry.get(id)?.engine ?? this.engineFor(this.registry.get(id)?.options?.language);
@@ -23743,26 +23795,41 @@ var EngineOrchestrator = class _EngineOrchestrator {
23743
23795
  const record2 = this.registry.get(id);
23744
23796
  if (record2?.pendingSource === source) {
23745
23797
  record2.pendingSource = void 0;
23746
- this.fail(id, handle, err);
23798
+ this.rejectCode(id, record2, handle, err);
23747
23799
  }
23748
23800
  return;
23749
23801
  }
23750
23802
  const record = this.registry.get(id);
23751
23803
  if (!record || record.pendingSource !== source) return;
23752
23804
  record.pendingSource = void 0;
23805
+ const previous = record.codeTrial?.previous ?? {
23806
+ source: record.source,
23807
+ engine: record.engine,
23808
+ prepared: record.prepared,
23809
+ inputValues: record.inputValues,
23810
+ propValues: record.propValues,
23811
+ inputs: [...handle.inputs],
23812
+ props: [...handle.props]
23813
+ };
23814
+ record.inputValues = valuesOnSchema(prepared.inputs, record.inputValues, record.prepared?.inputs);
23815
+ record.propValues = valuesOnSchema(prepared.props ?? [], record.propValues, record.prepared?.props);
23753
23816
  record.source = source;
23754
23817
  record.engine = engine;
23755
23818
  record.prepared = prepared;
23756
23819
  handle.setSource(source);
23757
- record.inputValues = valuesOnSchema(prepared.inputs, record.inputValues);
23758
- record.propValues = valuesOnSchema(prepared.props ?? [], record.propValues);
23759
23820
  handle.setSchema(prepared.inputs);
23760
23821
  handle.setPropsSchema(prepared.props ?? []);
23761
23822
  record.session?.stop();
23762
23823
  record.session = void 0;
23763
23824
  record.pendingStructural = true;
23764
23825
  record.pendingCause = "code";
23765
- if (record.hidden) return;
23826
+ if (record.hidden) {
23827
+ record.codeTrial = void 0;
23828
+ if (record.renderHandle) this.renderer.setIndicatorInputs(record.renderHandle, record.inputValues, record.propValues);
23829
+ this.settleCode(record, { ok: true, error: null });
23830
+ return;
23831
+ }
23832
+ record.codeTrial = { previous };
23766
23833
  if (record.renderHandle) {
23767
23834
  this.renderer.setIndicatorInputs(record.renderHandle, record.inputValues, record.propValues);
23768
23835
  this.setLoading(record, true);
@@ -23770,6 +23837,46 @@ var EngineOrchestrator = class _EngineOrchestrator {
23770
23837
  this.mountLoadingPlaceholder(id, record);
23771
23838
  }
23772
23839
  this.executeIndicator(id, handle);
23840
+ if (this.bars.length === 0 && record.codeTrial) {
23841
+ record.codeTrial = void 0;
23842
+ this.settleCode(record, { ok: true, error: null });
23843
+ }
23844
+ }
23845
+ /** Resolve every `updateCode` caller waiting on this record's chain of edits. */
23846
+ settleCode(record, result) {
23847
+ const waiters = record.codeWaiters;
23848
+ record.codeWaiters = void 0;
23849
+ if (waiters) for (const resolve of waiters) resolve(result);
23850
+ }
23851
+ /**
23852
+ * An update failed — at prepare, or on trial before its first model. A trial puts the
23853
+ * previous code back (source, engine, prepared script, values, schema) and restarts it;
23854
+ * its visuals were never dropped, so the chart keeps painting throughout. Then the
23855
+ * failure reports the usual way and every waiting caller learns it.
23856
+ */
23857
+ rejectCode(id, record, handle, err) {
23858
+ const trial = record.codeTrial;
23859
+ record.codeTrial = void 0;
23860
+ this.fail(id, handle, err);
23861
+ if (trial) {
23862
+ const p = trial.previous;
23863
+ record.session?.stop();
23864
+ record.session = void 0;
23865
+ record.source = p.source;
23866
+ record.engine = p.engine;
23867
+ record.prepared = p.prepared;
23868
+ record.inputValues = p.inputValues;
23869
+ record.propValues = p.propValues;
23870
+ handle.setSource(p.source);
23871
+ handle.setSchema(p.inputs);
23872
+ handle.setPropsSchema(p.props);
23873
+ record.pendingStructural = true;
23874
+ record.pendingCause = void 0;
23875
+ if (record.renderHandle) this.renderer.setIndicatorInputs(record.renderHandle, record.inputValues, record.propValues);
23876
+ if (!record.hidden) this.executeIndicator(id, handle);
23877
+ }
23878
+ const error = err instanceof Error ? err : new Error(String(err));
23879
+ this.settleCode(record, { ok: false, error });
23773
23880
  }
23774
23881
  /** IndicatorController: tear down an indicator and (if now empty) its pane. */
23775
23882
  /** Live handles of every indicator on the chart (script + native), insertion order. */
@@ -23784,6 +23891,7 @@ var EngineOrchestrator = class _EngineOrchestrator {
23784
23891
  removeIndicator(id) {
23785
23892
  const record = this.registry.remove(id);
23786
23893
  if (record?.native?.type === "volume") this.volumeOptedOut = true;
23894
+ if (record) this.settleCode(record, { ok: false, error: new Error(`[vela] updateCode("${id}") \u2014 the indicator was removed.`) });
23787
23895
  record?.session?.stop();
23788
23896
  if (record?.native?.started) record.native.instance.stop();
23789
23897
  this.handles.delete(id);
@@ -23811,6 +23919,10 @@ var EngineOrchestrator = class _EngineOrchestrator {
23811
23919
  if (!visible) {
23812
23920
  record.session?.stop();
23813
23921
  record.session = void 0;
23922
+ if (record.codeTrial) {
23923
+ record.codeTrial = void 0;
23924
+ this.settleCode(record, { ok: true, error: null });
23925
+ }
23814
23926
  if (record.native?.started) record.native.instance.suspend();
23815
23927
  if (record.renderHandle) this.renderer.setIndicatorVisible?.(record.renderHandle, false);
23816
23928
  else if (record.native) this.mountHiddenNativeRow(id, record);
@@ -23898,6 +24010,7 @@ var EngineOrchestrator = class _EngineOrchestrator {
23898
24010
  this.viewportUnsub?.();
23899
24011
  this.paneActionUnsub?.();
23900
24012
  for (const record of this.registry.all()) {
24013
+ this.settleCode(record, { ok: false, error: new Error("[vela] updateCode \u2014 the chart was destroyed.") });
23901
24014
  record.session?.stop();
23902
24015
  if (record.native?.started) record.native.instance.stop();
23903
24016
  }
@@ -23966,7 +24079,8 @@ var EngineOrchestrator = class _EngineOrchestrator {
23966
24079
  const record = this.registry.get(id);
23967
24080
  if (!record || !record.engine || !record.prepared || record.hidden) return;
23968
24081
  const mode = this.config.live && !record.prepared.reactsToViewport && record.engine.capabilities.streaming ? "live" : "static";
23969
- record.session = record.engine.execute(
24082
+ const prepared = record.prepared;
24083
+ const session = record.engine.execute(
23970
24084
  {
23971
24085
  prepared: record.prepared,
23972
24086
  market: this.market(),
@@ -23987,6 +24101,10 @@ var EngineOrchestrator = class _EngineOrchestrator {
23987
24101
  const cause = record.pendingCause ?? "history";
23988
24102
  if (!this.applyModel(id, model)) return;
23989
24103
  record.pendingCause = void 0;
24104
+ if (record.codeTrial) {
24105
+ record.codeTrial = void 0;
24106
+ this.settleCode(record, { ok: true, error: null });
24107
+ }
23990
24108
  this.emitContextChanged(id);
23991
24109
  this.emitScriptRun(id, cause, first);
23992
24110
  },
@@ -23997,9 +24115,17 @@ var EngineOrchestrator = class _EngineOrchestrator {
23997
24115
  handle.emit("alert", { id: a.id, message: a.message, title: a.title, time: a.time });
23998
24116
  },
23999
24117
  onWarning: (w) => this.events.emit("warning", w),
24000
- onError: (err) => this.fail(id, handle, err)
24118
+ onError: (err) => {
24119
+ if (record.codeTrial) this.rejectCode(id, record, handle, err);
24120
+ else this.fail(id, handle, err);
24121
+ }
24001
24122
  }
24002
24123
  );
24124
+ if (record.prepared !== prepared) {
24125
+ session.stop();
24126
+ return;
24127
+ }
24128
+ record.session = session;
24003
24129
  this.emitContextChanged(id);
24004
24130
  }
24005
24131
  /**
@@ -24500,7 +24626,7 @@ function yieldToPaint() {
24500
24626
  }
24501
24627
  return new Promise((resolve) => setTimeout(resolve, 0));
24502
24628
  }
24503
- function valuesOnSchema(schema, previous) {
24629
+ function valuesOnSchema(schema, previous, oldSchema = []) {
24504
24630
  const out = {};
24505
24631
  const declared = /* @__PURE__ */ new Set();
24506
24632
  for (const s of schema) {
@@ -24508,9 +24634,22 @@ function valuesOnSchema(schema, previous) {
24508
24634
  declared.add(s.key);
24509
24635
  declared.add(s.title);
24510
24636
  }
24511
- for (const [k, v] of Object.entries(previous)) if (declared.has(k)) out[k] = v;
24637
+ const oldDefaults = /* @__PURE__ */ new Map();
24638
+ for (const s of oldSchema) {
24639
+ oldDefaults.set(s.key, s.defval);
24640
+ if (!oldDefaults.has(s.title)) oldDefaults.set(s.title, s.defval);
24641
+ }
24642
+ for (const [k, v] of Object.entries(previous)) {
24643
+ if (!declared.has(k)) continue;
24644
+ if (oldDefaults.has(k) && sameInputValue(oldDefaults.get(k), v)) continue;
24645
+ out[k] = v;
24646
+ }
24512
24647
  return out;
24513
24648
  }
24649
+ function sameInputValue(a, b) {
24650
+ if (a === b) return true;
24651
+ return typeof a === "object" && a !== null && typeof b === "object" && b !== null && JSON.stringify(a) === JSON.stringify(b);
24652
+ }
24514
24653
  function blankedModel(model) {
24515
24654
  return {
24516
24655
  ...model,
@@ -1,5 +1,5 @@
1
- import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, aW as SeriesSpec, ak as Fill, H as Background, aM as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bc as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-BnEPUuVV.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-DwFIoV4r.js';
1
+ import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, aW as SeriesSpec, ak as Fill, H as Background, aM as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bc as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-NAUHiQEC.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-COGDs9Xg.cjs';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -292,6 +292,13 @@ interface IndicatorEventMap extends Record<string, unknown> {
292
292
  time: number;
293
293
  };
294
294
  }
295
+ /** How a {@link IndicatorHandle.updateCode} call ended. Never a rejection. */
296
+ interface CodeUpdateResult {
297
+ /** The new code is the one running (or, hidden, the one that will run when shown). */
298
+ ok: boolean;
299
+ /** Why the update did not land — the previous code is running again. Null on success. */
300
+ error: Error | null;
301
+ }
295
302
  /**
296
303
  * What `chart.addIndicator(...)` returns to the developer. The handle is usable
297
304
  * synchronously; data renders when execution resolves (see `on('ready')`).
@@ -331,13 +338,23 @@ interface IndicatorHandle {
331
338
  * Replace the script and re-run it **in place** — same `id`, same legend row, same
332
339
  * pane placement, same handle; the seam for a host editor's "run my edit" and for a
333
340
  * library's "update to the new version". The new source is prepared first: only once
334
- * it compiles is the running script stopped and the new one started, so a broken edit
335
- * leaves the current indicator computing and painting and reports through `error`.
336
- * Input and prop values survive where the new script still declares their key;
337
- * anything else takes the new declaration default. No-op for a native indicator and
338
- * for an unchanged source.
341
+ * it compiles is the running script stopped and the new one started. Until the new
342
+ * code's first run has landed, a failure — at compile time or at run time — puts the
343
+ * previous code back, with its input and prop values, and reports through `error`; the
344
+ * visuals on the chart are never dropped in between.
345
+ *
346
+ * An edited input or prop value survives where the new script still declares its key;
347
+ * a value still at its old declared default takes the NEW default, and anything else
348
+ * takes the new declaration default — all before the first run, so the new code
349
+ * computes once, with its final values.
350
+ *
351
+ * Resolves once the new code's first run has landed (`{ ok: true }`), or with
352
+ * `{ ok: false, error }` after a failure. A HIDDEN indicator resolves as soon as the
353
+ * source has compiled — it computes nothing until shown. An unchanged source resolves
354
+ * at once; a call superseded by a later one resolves with that later call's outcome.
355
+ * Never rejects; a native indicator resolves `ok: false`.
339
356
  */
340
- updateCode(source: string): void;
357
+ updateCode(source: string): Promise<CodeUpdateResult>;
341
358
  /**
342
359
  * Hide or show the indicator. Hiding **suspends** it — its visuals are dropped (the legend
343
360
  * row stays, marked hidden) and its computation stops (the engine session is torn down), so a
@@ -1965,6 +1982,11 @@ interface SidePanelHeader {
1965
1982
  /** Replace the header title (an empty string hides it). The topbar toggle keeps the
1966
1983
  * DECLARED `title` as its tooltip. */
1967
1984
  setTitle(title: string): void;
1985
+ /** Whether the panel covers every chart right now (see `maximizable`). */
1986
+ readonly maximized: boolean;
1987
+ /** Maximize the panel over the shell's charts, or restore it — what its header button
1988
+ * does. A no-op unless the descriptor is `maximizable`. Closing restores it too. */
1989
+ setMaximized(maximized: boolean): void;
1968
1990
  }
1969
1991
  /**
1970
1992
  * A contributed SIDE PANEL — a docked column in the shell's panel dock, alongside the object
@@ -1996,6 +2018,10 @@ interface SidePanelDescriptor {
1996
2018
  * column that shrinks the chart). For panels wide enough that a column would crush
1997
2019
  * the plot. The dock stays exclusive either way. */
1998
2020
  overlay?: boolean;
2021
+ /** A header button that maximizes the panel over every chart of the shell, and restores
2022
+ * it (default false). For panels that are sometimes the main work surface, like an
2023
+ * editor; the contribution can drive it too ({@link SidePanelHeader.setMaximized}). */
2024
+ maximizable?: boolean;
1999
2025
  mount(ctx: WidgetContext, body: HTMLElement, header: SidePanelHeader): SidePanelHandle | void;
2000
2026
  }
2001
2027
  /** One panel toggle, as the shell's chrome consumes it (data, never DOM). */
@@ -2042,8 +2068,9 @@ declare function widgetActions(target: WidgetActionTarget, ctx?: WidgetContext):
2042
2068
  interface LegendIndicatorInfo {
2043
2069
  id: string;
2044
2070
  title: string;
2045
- /** The script source the indicator was added with; undefined for a NATIVE
2046
- * (core-computed) indicator. The usual `when` gate for source-centric actions. */
2071
+ /** The script source the indicator runs NOW (read at click time, so an in-place code
2072
+ * update shows through); undefined for a NATIVE (core-computed) indicator. The usual
2073
+ * `when` gate for source-centric actions. */
2047
2074
  source?: string;
2048
2075
  }
2049
2076
  /**
@@ -2222,4 +2249,4 @@ declare function unregisterDefaultEngine(language: string): void;
2222
2249
  * language. The shell layers (widget, workspace cell) register exactly this result. */
2223
2250
  declare function resolveEngines(overrides?: Record<string, EngineFactory>): Record<string, EngineFactory>;
2224
2251
 
2225
- export { type SidePanelButton as $, type NativeIndicatorDescriptor as A, type BarsChangeReason as B, type CellStateContext as C, type DrawingsDocument as D, type ExternalIndicatorEntry as E, type FetchSeries as F, type NativeIndicatorInfo as G, type NativeIndicatorOutput as H, type IndicatorHandle as I, type PreparedScript as J, RendererControl as K, type LegendActionDescriptor as L, MarksControl as M, type NativeIndicator as N, OVERRIDABLE_TOPBAR_IDS as O, type ParsedSymbol as P, ReplayControl as Q, type ReplayState as R, type ScriptingEngine as S, type ReplayEndReason as T, type ReplayStartOptions as U, Vela as V, type WidgetContext as W, type RunIndicatorResult as X, type SceneInspection as Y, type ScriptRunCause as Z, type ScriptRunResult as _, type ReplayBounds as a, type SidePanelDescriptor as a0, type SidePanelHandle as a1, type SidePanelHeader as a2, type StatePersistenceHandler as a3, type StrategyFill as a4, type StrategyState as a5, type StrategyTrade as a6, type SymbolRankingHook as a7, TypedEventBus as a8, type VelaDeps as a9, unregisterNativeIndicator as aA, unregisterSidePanel as aB, unregisterStatePersistence as aC, unregisterWidgetAction as aD, unregisterWidgetAttachment as aE, widgetActions as aF, widgetAttachments as aG, DEFAULT_PANEL_ORDER as aH, type VisibleBarRange as aa, type WidgetActionDescriptor as ab, type WidgetActionTarget as ac, type WidgetAttachment as ad, getNativeIndicator as ae, legendActions as af, legendCallouts as ag, nativeIndicatorDescriptors as ah, nativeIndicatorTypes as ai, registerDefaultEngine as aj, registerLegendAction as ak, registerLegendCallout as al, registerNativeIndicator as am, registerSidePanel as an, registerStatePersistence as ao, registerSymbolRanking as ap, registerWidgetAction as aq, registerWidgetAttachment as ar, resolveEngines as as, sidePanels as at, statePersistenceHandlers as au, symbolRanking as av, topbarActionOverride as aw, unregisterDefaultEngine as ax, unregisterLegendAction as ay, unregisterLegendCallout as az, type VelaEventMap as b, type ScriptRun as c, type Resolved as d, type ReplayTick as e, DataControl as f, type ReplayTickSource as g, type ContextSelect as h, DrawingsControl as i, type EngineAlert as j, type EngineCapabilities as k, type EngineContextSnapshot as l, type EngineFactory as m, type EngineWarning as n, type ExecutionHandlers as o, type ExecutionMarket as p, type ExecutionRequest as q, type ExecutionSession as r, type IndicatorEventMap as s, type IndicatorSummary as t, type LegendCalloutContent as u, type LegendCalloutDescriptor as v, type LegendCalloutItem as w, type LegendCalloutSpec as x, type LegendIndicatorInfo as y, type NativeIndicatorContext as z };
2252
+ export { type ScriptRunResult as $, type NativeIndicatorContext as A, type BarsChangeReason as B, type CellStateContext as C, type DrawingsDocument as D, type ExternalIndicatorEntry as E, type FetchSeries as F, type NativeIndicatorDescriptor as G, type NativeIndicatorInfo as H, type IndicatorHandle as I, type NativeIndicatorOutput as J, type PreparedScript as K, type LegendActionDescriptor as L, MarksControl as M, type NativeIndicator as N, OVERRIDABLE_TOPBAR_IDS as O, type ParsedSymbol as P, RendererControl as Q, type ReplayState as R, type ScriptingEngine as S, ReplayControl as T, type ReplayEndReason as U, Vela as V, type WidgetContext as W, type ReplayStartOptions as X, type RunIndicatorResult as Y, type SceneInspection as Z, type ScriptRunCause as _, type ReplayBounds as a, type SidePanelButton as a0, type SidePanelDescriptor as a1, type SidePanelHandle as a2, type SidePanelHeader as a3, type StatePersistenceHandler as a4, type StrategyFill as a5, type StrategyState as a6, type StrategyTrade as a7, type SymbolRankingHook as a8, TypedEventBus as a9, unregisterLegendCallout as aA, unregisterNativeIndicator as aB, unregisterSidePanel as aC, unregisterStatePersistence as aD, unregisterWidgetAction as aE, unregisterWidgetAttachment as aF, widgetActions as aG, widgetAttachments as aH, DEFAULT_PANEL_ORDER as aI, type VelaDeps as aa, type VisibleBarRange as ab, type WidgetActionDescriptor as ac, type WidgetActionTarget as ad, type WidgetAttachment as ae, getNativeIndicator as af, legendActions as ag, legendCallouts as ah, nativeIndicatorDescriptors as ai, nativeIndicatorTypes as aj, registerDefaultEngine as ak, registerLegendAction as al, registerLegendCallout as am, registerNativeIndicator as an, registerSidePanel as ao, registerStatePersistence as ap, registerSymbolRanking as aq, registerWidgetAction as ar, registerWidgetAttachment as as, resolveEngines as at, sidePanels as au, statePersistenceHandlers as av, symbolRanking as aw, topbarActionOverride as ax, unregisterDefaultEngine as ay, unregisterLegendAction as az, type VelaEventMap as b, type ScriptRun as c, type Resolved as d, type ReplayTick as e, DataControl as f, type ReplayTickSource as g, type CodeUpdateResult as h, type ContextSelect as i, DrawingsControl as j, type EngineAlert as k, type EngineCapabilities as l, type EngineContextSnapshot as m, type EngineFactory as n, type EngineWarning as o, type ExecutionHandlers as p, type ExecutionMarket as q, type ExecutionRequest as r, type ExecutionSession as s, type IndicatorEventMap as t, type IndicatorSummary as u, type LegendCalloutContent as v, type LegendCalloutDescriptor as w, type LegendCalloutItem as x, type LegendCalloutSpec as y, type LegendIndicatorInfo as z };
@@ -1,5 +1,5 @@
1
- import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, aW as SeriesSpec, ak as Fill, H as Background, aM as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bc as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-BnEPUuVV.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-BrlxntPN.cjs';
1
+ import { x as Millis, ao as InputSchema, am as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, l as IndicatorModel, k as MoveTarget, aH as PaneAxis, aW as SeriesSpec, ak as Fill, H as Background, aM as PriceLine, a7 as DrawingLine, a3 as DrawingBox, a6 as DrawingLabel, ab as DrawingPolyline, a8 as DrawingLinefill, ag as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, z as DrawingTypeKey, y as SnapMode, a9 as DrawingMode, u as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, o as LegendActionView, p as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, r as ClickEvent, A as AxisLongPressEvent, v as DataWindowReadout, n as SymbolPickerFn, W as WallClock, bc as PaneInfo, aj as DrawingsOption, ad as DrawingSeriesGateway, D as Drawing, s as TimelineMark, t as MarkGroup, b as VelaOptions, F as AddIndicatorOptions, aG as MarketSwitch, E as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-NAUHiQEC.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-DpOWZD8F.js';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -292,6 +292,13 @@ interface IndicatorEventMap extends Record<string, unknown> {
292
292
  time: number;
293
293
  };
294
294
  }
295
+ /** How a {@link IndicatorHandle.updateCode} call ended. Never a rejection. */
296
+ interface CodeUpdateResult {
297
+ /** The new code is the one running (or, hidden, the one that will run when shown). */
298
+ ok: boolean;
299
+ /** Why the update did not land — the previous code is running again. Null on success. */
300
+ error: Error | null;
301
+ }
295
302
  /**
296
303
  * What `chart.addIndicator(...)` returns to the developer. The handle is usable
297
304
  * synchronously; data renders when execution resolves (see `on('ready')`).
@@ -331,13 +338,23 @@ interface IndicatorHandle {
331
338
  * Replace the script and re-run it **in place** — same `id`, same legend row, same
332
339
  * pane placement, same handle; the seam for a host editor's "run my edit" and for a
333
340
  * library's "update to the new version". The new source is prepared first: only once
334
- * it compiles is the running script stopped and the new one started, so a broken edit
335
- * leaves the current indicator computing and painting and reports through `error`.
336
- * Input and prop values survive where the new script still declares their key;
337
- * anything else takes the new declaration default. No-op for a native indicator and
338
- * for an unchanged source.
341
+ * it compiles is the running script stopped and the new one started. Until the new
342
+ * code's first run has landed, a failure — at compile time or at run time — puts the
343
+ * previous code back, with its input and prop values, and reports through `error`; the
344
+ * visuals on the chart are never dropped in between.
345
+ *
346
+ * An edited input or prop value survives where the new script still declares its key;
347
+ * a value still at its old declared default takes the NEW default, and anything else
348
+ * takes the new declaration default — all before the first run, so the new code
349
+ * computes once, with its final values.
350
+ *
351
+ * Resolves once the new code's first run has landed (`{ ok: true }`), or with
352
+ * `{ ok: false, error }` after a failure. A HIDDEN indicator resolves as soon as the
353
+ * source has compiled — it computes nothing until shown. An unchanged source resolves
354
+ * at once; a call superseded by a later one resolves with that later call's outcome.
355
+ * Never rejects; a native indicator resolves `ok: false`.
339
356
  */
340
- updateCode(source: string): void;
357
+ updateCode(source: string): Promise<CodeUpdateResult>;
341
358
  /**
342
359
  * Hide or show the indicator. Hiding **suspends** it — its visuals are dropped (the legend
343
360
  * row stays, marked hidden) and its computation stops (the engine session is torn down), so a
@@ -1965,6 +1982,11 @@ interface SidePanelHeader {
1965
1982
  /** Replace the header title (an empty string hides it). The topbar toggle keeps the
1966
1983
  * DECLARED `title` as its tooltip. */
1967
1984
  setTitle(title: string): void;
1985
+ /** Whether the panel covers every chart right now (see `maximizable`). */
1986
+ readonly maximized: boolean;
1987
+ /** Maximize the panel over the shell's charts, or restore it — what its header button
1988
+ * does. A no-op unless the descriptor is `maximizable`. Closing restores it too. */
1989
+ setMaximized(maximized: boolean): void;
1968
1990
  }
1969
1991
  /**
1970
1992
  * A contributed SIDE PANEL — a docked column in the shell's panel dock, alongside the object
@@ -1996,6 +2018,10 @@ interface SidePanelDescriptor {
1996
2018
  * column that shrinks the chart). For panels wide enough that a column would crush
1997
2019
  * the plot. The dock stays exclusive either way. */
1998
2020
  overlay?: boolean;
2021
+ /** A header button that maximizes the panel over every chart of the shell, and restores
2022
+ * it (default false). For panels that are sometimes the main work surface, like an
2023
+ * editor; the contribution can drive it too ({@link SidePanelHeader.setMaximized}). */
2024
+ maximizable?: boolean;
1999
2025
  mount(ctx: WidgetContext, body: HTMLElement, header: SidePanelHeader): SidePanelHandle | void;
2000
2026
  }
2001
2027
  /** One panel toggle, as the shell's chrome consumes it (data, never DOM). */
@@ -2042,8 +2068,9 @@ declare function widgetActions(target: WidgetActionTarget, ctx?: WidgetContext):
2042
2068
  interface LegendIndicatorInfo {
2043
2069
  id: string;
2044
2070
  title: string;
2045
- /** The script source the indicator was added with; undefined for a NATIVE
2046
- * (core-computed) indicator. The usual `when` gate for source-centric actions. */
2071
+ /** The script source the indicator runs NOW (read at click time, so an in-place code
2072
+ * update shows through); undefined for a NATIVE (core-computed) indicator. The usual
2073
+ * `when` gate for source-centric actions. */
2047
2074
  source?: string;
2048
2075
  }
2049
2076
  /**
@@ -2222,4 +2249,4 @@ declare function unregisterDefaultEngine(language: string): void;
2222
2249
  * language. The shell layers (widget, workspace cell) register exactly this result. */
2223
2250
  declare function resolveEngines(overrides?: Record<string, EngineFactory>): Record<string, EngineFactory>;
2224
2251
 
2225
- export { type SidePanelButton as $, type NativeIndicatorDescriptor as A, type BarsChangeReason as B, type CellStateContext as C, type DrawingsDocument as D, type ExternalIndicatorEntry as E, type FetchSeries as F, type NativeIndicatorInfo as G, type NativeIndicatorOutput as H, type IndicatorHandle as I, type PreparedScript as J, RendererControl as K, type LegendActionDescriptor as L, MarksControl as M, type NativeIndicator as N, OVERRIDABLE_TOPBAR_IDS as O, type ParsedSymbol as P, ReplayControl as Q, type ReplayState as R, type ScriptingEngine as S, type ReplayEndReason as T, type ReplayStartOptions as U, Vela as V, type WidgetContext as W, type RunIndicatorResult as X, type SceneInspection as Y, type ScriptRunCause as Z, type ScriptRunResult as _, type ReplayBounds as a, type SidePanelDescriptor as a0, type SidePanelHandle as a1, type SidePanelHeader as a2, type StatePersistenceHandler as a3, type StrategyFill as a4, type StrategyState as a5, type StrategyTrade as a6, type SymbolRankingHook as a7, TypedEventBus as a8, type VelaDeps as a9, unregisterNativeIndicator as aA, unregisterSidePanel as aB, unregisterStatePersistence as aC, unregisterWidgetAction as aD, unregisterWidgetAttachment as aE, widgetActions as aF, widgetAttachments as aG, DEFAULT_PANEL_ORDER as aH, type VisibleBarRange as aa, type WidgetActionDescriptor as ab, type WidgetActionTarget as ac, type WidgetAttachment as ad, getNativeIndicator as ae, legendActions as af, legendCallouts as ag, nativeIndicatorDescriptors as ah, nativeIndicatorTypes as ai, registerDefaultEngine as aj, registerLegendAction as ak, registerLegendCallout as al, registerNativeIndicator as am, registerSidePanel as an, registerStatePersistence as ao, registerSymbolRanking as ap, registerWidgetAction as aq, registerWidgetAttachment as ar, resolveEngines as as, sidePanels as at, statePersistenceHandlers as au, symbolRanking as av, topbarActionOverride as aw, unregisterDefaultEngine as ax, unregisterLegendAction as ay, unregisterLegendCallout as az, type VelaEventMap as b, type ScriptRun as c, type Resolved as d, type ReplayTick as e, DataControl as f, type ReplayTickSource as g, type ContextSelect as h, DrawingsControl as i, type EngineAlert as j, type EngineCapabilities as k, type EngineContextSnapshot as l, type EngineFactory as m, type EngineWarning as n, type ExecutionHandlers as o, type ExecutionMarket as p, type ExecutionRequest as q, type ExecutionSession as r, type IndicatorEventMap as s, type IndicatorSummary as t, type LegendCalloutContent as u, type LegendCalloutDescriptor as v, type LegendCalloutItem as w, type LegendCalloutSpec as x, type LegendIndicatorInfo as y, type NativeIndicatorContext as z };
2252
+ export { type ScriptRunResult as $, type NativeIndicatorContext as A, type BarsChangeReason as B, type CellStateContext as C, type DrawingsDocument as D, type ExternalIndicatorEntry as E, type FetchSeries as F, type NativeIndicatorDescriptor as G, type NativeIndicatorInfo as H, type IndicatorHandle as I, type NativeIndicatorOutput as J, type PreparedScript as K, type LegendActionDescriptor as L, MarksControl as M, type NativeIndicator as N, OVERRIDABLE_TOPBAR_IDS as O, type ParsedSymbol as P, RendererControl as Q, type ReplayState as R, type ScriptingEngine as S, ReplayControl as T, type ReplayEndReason as U, Vela as V, type WidgetContext as W, type ReplayStartOptions as X, type RunIndicatorResult as Y, type SceneInspection as Z, type ScriptRunCause as _, type ReplayBounds as a, type SidePanelButton as a0, type SidePanelDescriptor as a1, type SidePanelHandle as a2, type SidePanelHeader as a3, type StatePersistenceHandler as a4, type StrategyFill as a5, type StrategyState as a6, type StrategyTrade as a7, type SymbolRankingHook as a8, TypedEventBus as a9, unregisterLegendCallout as aA, unregisterNativeIndicator as aB, unregisterSidePanel as aC, unregisterStatePersistence as aD, unregisterWidgetAction as aE, unregisterWidgetAttachment as aF, widgetActions as aG, widgetAttachments as aH, DEFAULT_PANEL_ORDER as aI, type VelaDeps as aa, type VisibleBarRange as ab, type WidgetActionDescriptor as ac, type WidgetActionTarget as ad, type WidgetAttachment as ae, getNativeIndicator as af, legendActions as ag, legendCallouts as ah, nativeIndicatorDescriptors as ai, nativeIndicatorTypes as aj, registerDefaultEngine as ak, registerLegendAction as al, registerLegendCallout as am, registerNativeIndicator as an, registerSidePanel as ao, registerStatePersistence as ap, registerSymbolRanking as aq, registerWidgetAction as ar, registerWidgetAttachment as as, resolveEngines as at, sidePanels as au, statePersistenceHandlers as av, symbolRanking as aw, topbarActionOverride as ax, unregisterDefaultEngine as ay, unregisterLegendAction as az, type VelaEventMap as b, type ScriptRun as c, type Resolved as d, type ReplayTick as e, DataControl as f, type ReplayTickSource as g, type CodeUpdateResult as h, type ContextSelect as i, DrawingsControl as j, type EngineAlert as k, type EngineCapabilities as l, type EngineContextSnapshot as m, type EngineFactory as n, type EngineWarning as o, type ExecutionHandlers as p, type ExecutionMarket as q, type ExecutionRequest as r, type ExecutionSession as s, type IndicatorEventMap as t, type IndicatorSummary as u, type LegendCalloutContent as v, type LegendCalloutDescriptor as w, type LegendCalloutItem as x, type LegendCalloutSpec as y, type LegendIndicatorInfo as z };