@luxalgo/vela 0.8.2 → 0.8.3

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/dist/{DataProvider-DpOWZD8F.d.ts → DataProvider-oH78tYXL.d.ts} +1 -1
  2. package/dist/{DataProvider-COGDs9Xg.d.cts → DataProvider-wbtJ3-Sa.d.cts} +1 -1
  3. package/dist/{chunk-R2JMNIHY.js → chunk-2IPXYM4B.js} +258 -169
  4. package/dist/{chunk-NLDTVFOI.js → chunk-G7B7ZCBF.js} +129 -10
  5. package/dist/{chunk-T3DZIR5Y.js → chunk-HMHA733L.js} +306 -168
  6. package/dist/{chunk-DPAA3SRT.js → chunk-KWI3YDBW.js} +254 -9
  7. package/dist/{chunk-27UTYE7T.js → chunk-TO3GIK7Z.js} +49 -7
  8. package/dist/{chunk-HKNO24GD.js → chunk-VHGACEHO.js} +50 -1
  9. package/dist/{contributions-Cgm9RJYP.d.cts → contributions-BhOBRenr.d.cts} +44 -4
  10. package/dist/{contributions-bWgwyiVi.d.ts → contributions-HGqnNb_P.d.ts} +44 -4
  11. package/dist/index.cjs +497 -79
  12. package/dist/index.d.cts +34 -14
  13. package/dist/index.d.ts +34 -14
  14. package/dist/index.js +5 -5
  15. package/dist/{options-NAUHiQEC.d.ts → options-lMUwmRwh.d.cts} +66 -1
  16. package/dist/{options-NAUHiQEC.d.cts → options-lMUwmRwh.d.ts} +66 -1
  17. package/dist/{plugin-CqxWoDKS.d.ts → plugin-Cr2Pj8q8.d.ts} +4 -4
  18. package/dist/{plugin-CjjzZX2F.d.cts → plugin-Do5J5xuF.d.cts} +4 -4
  19. package/dist/plugin.cjs +18 -0
  20. package/dist/plugin.d.cts +5 -5
  21. package/dist/plugin.d.ts +5 -5
  22. package/dist/plugin.js +3 -3
  23. package/dist/providers/binance.d.cts +2 -2
  24. package/dist/providers/binance.d.ts +2 -2
  25. package/dist/providers/coinbase.d.cts +2 -2
  26. package/dist/providers/coinbase.d.ts +2 -2
  27. package/dist/providers/hyperliquid.d.cts +2 -2
  28. package/dist/providers/hyperliquid.d.ts +2 -2
  29. package/dist/{side-panel-wMNfgyZb.d.cts → side-panel-_2UK1gSm.d.cts} +45 -3
  30. package/dist/{side-panel-wMNfgyZb.d.ts → side-panel-_2UK1gSm.d.ts} +45 -3
  31. package/dist/{statusline-model-Dpfpq54A.d.cts → statusline-model-B-2xGlB_.d.cts} +3 -3
  32. package/dist/{statusline-model-Dih6FGWP.d.ts → statusline-model-CY1wzxHg.d.ts} +3 -3
  33. package/dist/ui.cjs +224 -14
  34. package/dist/ui.d.cts +119 -87
  35. package/dist/ui.d.ts +119 -87
  36. package/dist/ui.js +3 -3
  37. package/dist/vela.global.js +497 -79
  38. package/dist/vela.global.min.js +86 -52
  39. package/dist/widget.cjs +850 -167
  40. package/dist/widget.d.cts +24 -10
  41. package/dist/widget.d.ts +24 -10
  42. package/dist/widget.js +7 -7
  43. package/dist/workspace.cjs +849 -167
  44. package/dist/workspace.d.cts +47 -20
  45. package/dist/workspace.d.ts +47 -20
  46. package/dist/workspace.js +6 -6
  47. package/package.json +1 -1
  48. /package/dist/{chunk-JU4CWEBF.js → chunk-W5YPYZ2P.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { svg24, NEUTRAL, BEARISH, WARNING, BULLISH, INFO, ACCENT_BRIGHT, VALID, INVALID, MARKER, ACCENT, injectStyles, iconEl, announceSurface } from './chunk-HKNO24GD.js';
1
+ import { svg24, NEUTRAL, BEARISH, WARNING, BULLISH, INFO, ACCENT_BRIGHT, VALID, INVALID, MARKER, ACCENT, injectStyles, iconEl, announceSurface, holdForExit } from './chunk-VHGACEHO.js';
2
2
 
3
3
  // src/core/model/series.ts
4
4
  function isLineLikeSeries(spec) {
@@ -5905,6 +5905,100 @@ function inputDeltas(schema, values) {
5905
5905
  return Object.keys(out).length > 0 ? out : void 0;
5906
5906
  }
5907
5907
 
5908
+ // src/core/timezones.ts
5909
+ var TIMEZONES = [
5910
+ { value: "Etc/UTC", label: "UTC" },
5911
+ { value: "Etc/GMT+12", label: "International Date Line West" },
5912
+ { value: "Pacific/Pago_Pago", label: "Pago Pago" },
5913
+ { value: "Pacific/Honolulu", label: "Honolulu" },
5914
+ { value: "Pacific/Marquesas", label: "Marquesas Islands" },
5915
+ { value: "America/Anchorage", label: "Anchorage" },
5916
+ { value: "America/Los_Angeles", label: "Los Angeles" },
5917
+ { value: "America/Phoenix", label: "Phoenix" },
5918
+ { value: "America/Denver", label: "Denver" },
5919
+ { value: "America/Chicago", label: "Chicago" },
5920
+ { value: "America/Mexico_City", label: "Mexico City" },
5921
+ { value: "America/New_York", label: "New York" },
5922
+ { value: "America/Bogota", label: "Bogot\xE1" },
5923
+ { value: "America/Caracas", label: "Caracas" },
5924
+ { value: "America/Santiago", label: "Santiago" },
5925
+ { value: "America/St_Johns", label: "St. John's" },
5926
+ { value: "America/Sao_Paulo", label: "S\xE3o Paulo" },
5927
+ { value: "America/Argentina/Buenos_Aires", label: "Buenos Aires" },
5928
+ { value: "America/Noronha", label: "Fernando de Noronha" },
5929
+ { value: "Atlantic/Azores", label: "Azores" },
5930
+ { value: "Atlantic/Reykjavik", label: "Reykjavik" },
5931
+ { value: "Europe/London", label: "London" },
5932
+ { value: "Europe/Paris", label: "Paris" },
5933
+ { value: "Europe/Berlin", label: "Berlin" },
5934
+ { value: "Europe/Athens", label: "Athens" },
5935
+ { value: "Africa/Cairo", label: "Cairo" },
5936
+ { value: "Africa/Johannesburg", label: "Johannesburg" },
5937
+ { value: "Europe/Moscow", label: "Moscow" },
5938
+ { value: "Europe/Istanbul", label: "Istanbul" },
5939
+ { value: "Asia/Tehran", label: "Tehran" },
5940
+ { value: "Asia/Dubai", label: "Dubai" },
5941
+ { value: "Asia/Kabul", label: "Kabul" },
5942
+ { value: "Asia/Karachi", label: "Karachi" },
5943
+ { value: "Asia/Kolkata", label: "Mumbai" },
5944
+ { value: "Asia/Kathmandu", label: "Kathmandu" },
5945
+ { value: "Asia/Dhaka", label: "Dhaka" },
5946
+ { value: "Asia/Yangon", label: "Yangon" },
5947
+ { value: "Asia/Bangkok", label: "Bangkok" },
5948
+ { value: "Asia/Shanghai", label: "Shanghai" },
5949
+ { value: "Asia/Hong_Kong", label: "Hong Kong" },
5950
+ { value: "Asia/Singapore", label: "Singapore" },
5951
+ { value: "Australia/Eucla", label: "Eucla" },
5952
+ { value: "Asia/Tokyo", label: "Tokyo" },
5953
+ { value: "Asia/Seoul", label: "Seoul" },
5954
+ { value: "Australia/Adelaide", label: "Adelaide" },
5955
+ { value: "Australia/Sydney", label: "Sydney" },
5956
+ { value: "Australia/Lord_Howe", label: "Lord Howe Island" },
5957
+ { value: "Pacific/Noumea", label: "Noum\xE9a" },
5958
+ { value: "Pacific/Auckland", label: "Auckland" },
5959
+ { value: "Pacific/Chatham", label: "Chatham Islands" },
5960
+ { value: "Pacific/Apia", label: "Apia" },
5961
+ { value: "Pacific/Kiritimati", label: "Kiritimati" }
5962
+ ];
5963
+ var EXCHANGE_TIMEZONE = "exchange";
5964
+ function isExchangeTimezone(zone) {
5965
+ return zone === EXCHANGE_TIMEZONE;
5966
+ }
5967
+ function resolveTimezone(zone, exchangeZone) {
5968
+ if (!isExchangeTimezone(zone)) return zone;
5969
+ return exchangeZone && exchangeZone !== "" ? exchangeZone : "Etc/UTC";
5970
+ }
5971
+ function normalizeTimezone(zone) {
5972
+ return zone === "UTC" || zone === "Etc/UTC" || zone === "Etc/GMT" ? "Etc/UTC" : zone;
5973
+ }
5974
+ function timezoneMenuRows(current) {
5975
+ const active = normalizeTimezone(current);
5976
+ const [utc, ...zones] = TIMEZONES.map((t) => ({ value: t.value, label: tzMenuLabel(t.value, t.label), checked: t.value === active }));
5977
+ return [utc, { value: EXCHANGE_TIMEZONE, label: "Exchange", checked: isExchangeTimezone(current) }, ...zones];
5978
+ }
5979
+ function tzOffset(zone, date = /* @__PURE__ */ new Date()) {
5980
+ try {
5981
+ const parts = new Intl.DateTimeFormat("en-US", { timeZone: zone, timeZoneName: "shortOffset" }).formatToParts(date);
5982
+ const raw = parts.find((p) => p.type === "timeZoneName")?.value ?? "";
5983
+ const m = raw.match(/GMT(?:(\+|-)(\d{1,2})(?::(\d{2}))?)?/);
5984
+ if (!m || !m[1]) return "UTC";
5985
+ const sign = m[1] === "-" ? "-" : "+";
5986
+ const hrs = m[2] ?? "0";
5987
+ const mins = m[3] ?? "";
5988
+ return mins ? `UTC${sign}${hrs}:${mins}` : `UTC${sign}${hrs}`;
5989
+ } catch {
5990
+ return "UTC";
5991
+ }
5992
+ }
5993
+ function tzMenuLabel(zone, location) {
5994
+ if (normalizeTimezone(zone) === "Etc/UTC") return location;
5995
+ return `(${tzOffset(zone)}) ${location}`;
5996
+ }
5997
+ function tzButtonLabel(zone) {
5998
+ if (normalizeTimezone(zone) === "Etc/UTC") return "UTC";
5999
+ return tzOffset(zone);
6000
+ }
6001
+
5908
6002
  // src/renderers/native/layers.ts
5909
6003
  function foldBaseModulation(acc, next) {
5910
6004
  if (next == null) return acc;
@@ -6128,6 +6222,127 @@ function resolveEngines(overrides) {
6128
6222
  return { ...Object.fromEntries(defaultEngines), ...overrides };
6129
6223
  }
6130
6224
 
6225
+ // src/widget/context-menu-model.ts
6226
+ var SETTINGS_SECTION = {
6227
+ body: "Canvas",
6228
+ "price-axis": "Scales and lines",
6229
+ "time-axis": "Scales and lines"
6230
+ };
6231
+ function settingsItem(zone, label, icon) {
6232
+ return { id: `settings:${SETTINGS_SECTION[zone]}`, label, ...icon ? { icon } : {}, separatorBefore: true };
6233
+ }
6234
+ function settingsSectionOf(id) {
6235
+ return id.slice("settings:".length) || void 0;
6236
+ }
6237
+ var SCALE_CHOICES = [
6238
+ ["regular", "Regular"],
6239
+ ["percent", "Percent"],
6240
+ ["indexed", "Indexed to 100"],
6241
+ ["log", "Logarithmic"]
6242
+ ];
6243
+ function paneScaleAt(panes, y) {
6244
+ return panes.find((p) => y >= p.top && y < p.top + p.height) ?? panes[0] ?? null;
6245
+ }
6246
+ function scaleChoiceOf(scale) {
6247
+ if (scale.log) return "log";
6248
+ if (scale.mode === "percent") return "percent";
6249
+ if (scale.mode === "indexed") return "indexed";
6250
+ return "regular";
6251
+ }
6252
+ function mainScale(pane) {
6253
+ return pane === null || pane.kind === "price";
6254
+ }
6255
+ function scaleWrites(choice, pane) {
6256
+ const mode = choice === "percent" ? "percent" : choice === "indexed" ? "indexed" : "price";
6257
+ const log = choice === "log";
6258
+ if (mainScale(pane)) {
6259
+ return [
6260
+ ["scaleMode", mode],
6261
+ ["logScale", log]
6262
+ ];
6263
+ }
6264
+ return [
6265
+ ["scaleMode", { pane: pane.id, mode }],
6266
+ ["logScale", { pane: pane.id, value: log }]
6267
+ ];
6268
+ }
6269
+ function invertWrite(next, pane) {
6270
+ return mainScale(pane) ? ["invertScale", next] : ["invertScale", { pane: pane.id, value: next }];
6271
+ }
6272
+ function priceAxisItems(s) {
6273
+ return [
6274
+ { id: "auto", label: "Auto (fits data to screen)", checked: s.auto },
6275
+ { id: "invert", label: "Invert scale", checked: s.invert },
6276
+ ...SCALE_CHOICES.map(([choice, label], i) => ({
6277
+ id: `scale:${choice}`,
6278
+ label,
6279
+ checked: s.choice === choice,
6280
+ separatorBefore: i === 0
6281
+ })),
6282
+ {
6283
+ id: "labels",
6284
+ label: "Labels",
6285
+ separatorBefore: true,
6286
+ submenu: [
6287
+ { id: "toggle:axisLabels", label: "Price axis labels", checked: s.axisLabels },
6288
+ { id: "toggle:priceLabel", label: "Last price label", checked: s.priceLabel },
6289
+ { id: "toggle:countdown", label: "Countdown to bar close", checked: s.countdown }
6290
+ ]
6291
+ },
6292
+ {
6293
+ id: "levels",
6294
+ label: "Levels",
6295
+ submenu: [{ id: "toggle:currentPriceLine", label: "Last Price Line", checked: s.priceLine }]
6296
+ },
6297
+ settingsItem("price-axis", "More settings\u2026")
6298
+ ];
6299
+ }
6300
+ function timeAxisItems(timezone) {
6301
+ return [
6302
+ {
6303
+ id: "timezone",
6304
+ label: "Time zone",
6305
+ submenu: timezoneMenuRows(timezone).map((r) => ({ id: `tz:${r.value}`, label: r.label, checked: r.checked }))
6306
+ },
6307
+ settingsItem("time-axis", "More settings\u2026")
6308
+ ];
6309
+ }
6310
+ function bodyItems(counts) {
6311
+ return [
6312
+ { id: "reset-view", label: "Reset chart view", icon: "reset" },
6313
+ { id: "remove-drawings", label: "Remove drawings", icon: "eraser", disabled: counts.drawings === 0, separatorBefore: true },
6314
+ { id: "remove-indicators", label: "Remove indicators", icon: "indicators", disabled: counts.indicators === 0 },
6315
+ settingsItem("body", "Settings\u2026", "gear")
6316
+ ];
6317
+ }
6318
+ var CONTEXT_MENU_BUILTIN_ORDER = {
6319
+ body: { "reset-view": -30, "remove-drawings": -20, "remove-indicators": -10, settings: 1e3 },
6320
+ "price-axis": {
6321
+ auto: -80,
6322
+ invert: -70,
6323
+ "scale:regular": -60,
6324
+ "scale:percent": -50,
6325
+ "scale:indexed": -40,
6326
+ "scale:log": -30,
6327
+ labels: -20,
6328
+ levels: -10,
6329
+ settings: 1e3
6330
+ },
6331
+ "time-axis": { timezone: -10, settings: 1e3 }
6332
+ };
6333
+ function composeMenu(zone, builtin, contributed) {
6334
+ const ranks = CONTEXT_MENU_BUILTIN_ORDER[zone];
6335
+ const rows = [];
6336
+ let group = 0;
6337
+ for (const item of builtin) {
6338
+ if (item.separatorBefore) group += 1;
6339
+ rows.push({ item, rank: ranks[item.id.startsWith("settings") ? "settings" : item.id] ?? 0, group });
6340
+ }
6341
+ for (const { item, order } of contributed) rows.push({ item, rank: order ?? 0, group: -1 });
6342
+ rows.sort((a, b) => a.rank - b.rank);
6343
+ return rows.map(({ item, group: g }, i) => ({ ...item, separatorBefore: i > 0 && rows[i - 1].group !== g }));
6344
+ }
6345
+
6131
6346
  // src/widget/side-panel.ts
6132
6347
  var STYLE_ID = "vela-widget-sidepanel";
6133
6348
  var DEFAULT_PANEL_WIDTH = 280;
@@ -6298,6 +6513,11 @@ var SidePanel = class {
6298
6513
  this.maximizedOn = false;
6299
6514
  /** Set while the close is announced, so a listener's own close does not re-enter. */
6300
6515
  this.closing = false;
6516
+ /** Open as far as the dock and the host are concerned — a closed panel can still be on
6517
+ * screen while its exit animation runs. */
6518
+ this.isOpen = false;
6519
+ /** The exit animation of a close; a reopen cancels it. */
6520
+ this.exit = null;
6301
6521
  const doc = host.ownerDocument;
6302
6522
  injectStyles(STYLE_ID, CSS, doc);
6303
6523
  this.minWidth = opts.resizable ? opts.minWidth ?? DEFAULT_PANEL_MIN_WIDTH : 1;
@@ -6346,20 +6566,44 @@ var SidePanel = class {
6346
6566
  host.appendChild(this.el);
6347
6567
  }
6348
6568
  get open() {
6349
- return !this.el.hidden;
6569
+ return this.isOpen;
6350
6570
  }
6351
- /** Open/close the panel — a bare call flips it. */
6352
- toggle(open = this.el.hidden) {
6353
- if (open === !this.el.hidden || !open && this.closing) return;
6571
+ /**
6572
+ * Open/close the panel — a bare call flips it. The panel reports closed at once, but a
6573
+ * close keeps it on screen, marked `data-closing`, while a host exit animation runs.
6574
+ * `instant` skips that, and also cuts short the exit of a panel already closing: a panel
6575
+ * handing the dock to another leaves at once.
6576
+ */
6577
+ toggle(open = !this.isOpen, instant = false) {
6578
+ if (open === this.isOpen) {
6579
+ if (!open && instant) this.exit?.finish();
6580
+ return;
6581
+ }
6582
+ if (!open && this.closing) return;
6354
6583
  if (!open) {
6355
6584
  this.closing = true;
6356
6585
  announceSurface(this.el, false, "panel");
6357
6586
  this.closing = false;
6358
6587
  }
6359
- this.el.hidden = !open;
6360
- if (!open) this.setMaximized(false);
6588
+ this.isOpen = open;
6589
+ if (open) {
6590
+ if (this.exit) {
6591
+ this.exit.cancel();
6592
+ this.exit = null;
6593
+ this.setMaximized(false);
6594
+ }
6595
+ this.el.hidden = false;
6596
+ } else {
6597
+ const hide = () => {
6598
+ this.exit = null;
6599
+ this.el.hidden = true;
6600
+ this.setMaximized(false);
6601
+ };
6602
+ if (instant) hide();
6603
+ else this.exit = holdForExit(this.el, hide);
6604
+ }
6361
6605
  this.onOpenChange?.(open);
6362
- if (open && !this.el.hidden) announceSurface(this.el, true, "panel");
6606
+ if (open && this.isOpen) announceSurface(this.el, true, "panel");
6363
6607
  }
6364
6608
  /** Whether the panel covers every chart right now. */
6365
6609
  get maximized() {
@@ -6433,6 +6677,7 @@ var SidePanel = class {
6433
6677
  }
6434
6678
  destroy() {
6435
6679
  if (this.open) announceSurface(this.el, false, "panel");
6680
+ this.exit?.finish();
6436
6681
  this.el.remove();
6437
6682
  }
6438
6683
  /** The drag handle on the panel's inner (left) edge — the panel is docked right, so dragging
@@ -6477,4 +6722,4 @@ var SidePanel = class {
6477
6722
  }
6478
6723
  };
6479
6724
 
6480
- export { AnchoredVwap, ArrowMark, Callout, CalloutBase, Comment, DEDEKIND_CURVATURE_OPTIONS, DEFAULT_DRAWING_COLOR, DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, DIRECTION_OPTIONS, DedekindTessellation, Drawing, FibRatios, FibRetracement, FibSpiral, FixedRangeVolumeProfile, GANN_SQUARE_ARCS, GLYPH_OPTIONS, GannSquare, GlyphStamp, LINE_STYLE_OPTIONS, MACH_NUMBER_OPTIONS, MACH_WAVE_COUNT_OPTIONS, MAGNIFIER_TIMEFRAME_OPTIONS, MachFigure, Magnifier, MeasureBox, Note, OVERRIDABLE_TOPBAR_IDS, PatternDrawing, PositionTool, PriceLabel, PriceNote, RadialFib, RegressionChannel, STAMP_SIZE_OPTIONS, SegmentDrawing, SidePanel, Signpost, TEXT_SIZE_OPTIONS, TOPBAR_BUILTIN_IDS, TOPBAR_DEFAULT_LEFT, TOPBAR_DEFAULT_RIGHT, TextLabel, chartType, chartTypes, clampPanelWidth, createDrawing, deserializeDrawing, drawingTypes, foldBaseModulation, formatDuration, getDrawingType, getNativeIndicator, inputDeltas, inputVisible, isLineLikeSeries, legendActions, legendActionsProviderFor, legendCallouts, legendCalloutsProviderFor, lineSegmentIntersection, magnifierTimeframeLabel, mobilePlacement, nativeIndicatorDescriptors, nativeIndicatorTypes, nativeInstanceChannel, normalizeSettingsRow, pinnedTopbarActionIds, registerChartType, registerDefaultEngine, registerDrawingType, registerLegendAction, registerLegendCallout, registerNativeIndicator, registerRendererDefaults, registerRendererLayer, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, rendererDefaults, rendererLayers, resetDrawingSettings, resolveEngines, resolveTopbarComposition, seriesInScale, seriesShownOn, settingsRowValueKeys, settingsRowVisible, sidePanels, stableSeriesId, statePersistenceHandlers, symbolRanking, tickerModifierIds, topbarActionOverride, topbarHas, unregisterChartType, unregisterDefaultEngine, unregisterLegendAction, unregisterLegendCallout, unregisterNativeIndicator, unregisterRendererDefaults, unregisterRendererLayer, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments };
6725
+ export { AnchoredVwap, ArrowMark, CONTEXT_MENU_BUILTIN_ORDER, Callout, CalloutBase, Comment, DEDEKIND_CURVATURE_OPTIONS, DEFAULT_DRAWING_COLOR, DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, DIRECTION_OPTIONS, DedekindTessellation, Drawing, FibRatios, FibRetracement, FibSpiral, FixedRangeVolumeProfile, GANN_SQUARE_ARCS, GLYPH_OPTIONS, GannSquare, GlyphStamp, LINE_STYLE_OPTIONS, MACH_NUMBER_OPTIONS, MACH_WAVE_COUNT_OPTIONS, MAGNIFIER_TIMEFRAME_OPTIONS, MachFigure, Magnifier, MeasureBox, Note, OVERRIDABLE_TOPBAR_IDS, PatternDrawing, PositionTool, PriceLabel, PriceNote, RadialFib, RegressionChannel, STAMP_SIZE_OPTIONS, SegmentDrawing, SidePanel, Signpost, TEXT_SIZE_OPTIONS, TIMEZONES, TOPBAR_BUILTIN_IDS, TOPBAR_DEFAULT_LEFT, TOPBAR_DEFAULT_RIGHT, TextLabel, bodyItems, chartType, chartTypes, clampPanelWidth, composeMenu, createDrawing, deserializeDrawing, drawingTypes, foldBaseModulation, formatDuration, getDrawingType, getNativeIndicator, inputDeltas, inputVisible, invertWrite, isExchangeTimezone, isLineLikeSeries, legendActions, legendActionsProviderFor, legendCallouts, legendCalloutsProviderFor, lineSegmentIntersection, magnifierTimeframeLabel, mobilePlacement, nativeIndicatorDescriptors, nativeIndicatorTypes, nativeInstanceChannel, normalizeSettingsRow, normalizeTimezone, paneScaleAt, pinnedTopbarActionIds, priceAxisItems, registerChartType, registerDefaultEngine, registerDrawingType, registerLegendAction, registerLegendCallout, registerNativeIndicator, registerRendererDefaults, registerRendererLayer, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, rendererDefaults, rendererLayers, resetDrawingSettings, resolveEngines, resolveTimezone, resolveTopbarComposition, scaleChoiceOf, scaleWrites, seriesInScale, seriesShownOn, settingsRowValueKeys, settingsRowVisible, settingsSectionOf, sidePanels, stableSeriesId, statePersistenceHandlers, symbolRanking, tickerModifierIds, timeAxisItems, timezoneMenuRows, topbarActionOverride, topbarHas, tzButtonLabel, tzMenuLabel, tzOffset, unregisterChartType, unregisterDefaultEngine, unregisterLegendAction, unregisterLegendCallout, unregisterNativeIndicator, unregisterRendererDefaults, unregisterRendererLayer, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments };
@@ -1,5 +1,5 @@
1
- import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-NLDTVFOI.js';
2
- import { injectStyles, announceSurface } from './chunk-HKNO24GD.js';
1
+ import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-G7B7ZCBF.js';
2
+ import { injectStyles, holdForExit, announceSurface } from './chunk-VHGACEHO.js';
3
3
  import * as tooltip from '@zag-js/tooltip';
4
4
  import * as dialog from '@zag-js/dialog';
5
5
 
@@ -345,6 +345,9 @@ var Drawer = class {
345
345
  constructor(opts = {}) {
346
346
  this.opener = null;
347
347
  this.wasOpen = false;
348
+ /** The sheet and scrim's exit animation after a close; a reopen cancels it. */
349
+ this.exit = null;
350
+ this.destroyed = false;
348
351
  const doc = (opts.host ?? document.body).ownerDocument;
349
352
  injectStyles(DRAWER_STYLE_ID, DRAWER_CSS, doc);
350
353
  const host = opts.host ?? doc.body;
@@ -372,13 +375,21 @@ var Drawer = class {
372
375
  const mid = String(this.ctrl.props.id);
373
376
  this.handle = runMachine(this.ctrl.machine, this.ctrl.props, (service) => {
374
377
  const api = this.ctrl.connect(service);
375
- if (this.wasOpen && !api.open) this.announce(false);
378
+ const closing = this.wasOpen && !api.open;
379
+ if (closing) this.announce(false);
376
380
  spreadProps(this.backdrop, api.getBackdropProps(), mid);
377
381
  spreadProps(this.positioner, api.getPositionerProps(), mid);
378
382
  spreadProps(this.panel, api.getContentProps(), mid);
379
383
  spreadProps(this.titleEl, api.getTitleProps(), mid);
380
- this.backdrop.style.display = api.open ? "" : "none";
381
- this.positioner.style.display = api.open ? "" : "none";
384
+ if (api.open) {
385
+ this.exit?.cancel();
386
+ this.exit = null;
387
+ this.setShown(true);
388
+ } else if (closing) {
389
+ this.holdExit();
390
+ } else if (!this.exit) {
391
+ this.setShown(false);
392
+ }
382
393
  if (api.open && !this.wasOpen) this.announce(true);
383
394
  if (this.wasOpen && !api.open) this.restoreOpener();
384
395
  this.wasOpen = api.open;
@@ -490,6 +501,36 @@ var Drawer = class {
490
501
  setTitle(title) {
491
502
  this.titleEl.textContent = title;
492
503
  }
504
+ setShown(shown) {
505
+ this.backdrop.style.display = shown ? "" : "none";
506
+ this.positioner.style.display = shown ? "" : "none";
507
+ }
508
+ /** Keep the just-closed sheet up through its exit animation, then hide it — or
509
+ * remove it, when it was destroyed meanwhile. `spreadProps` re-applies the close
510
+ * props' `hidden` only when its value changes, so lifting it keeps the sheet and
511
+ * scrim up until the exit ends. The positioner spans the host: inert, it lets
512
+ * clicks through to the page while the sheet animates out. */
513
+ holdExit() {
514
+ const held = [this.panel, this.backdrop];
515
+ for (const el of held) el.hidden = false;
516
+ this.exit = holdForExit(
517
+ held,
518
+ () => {
519
+ this.exit = null;
520
+ if (this.destroyed) {
521
+ this.detach();
522
+ } else if (!this.open) {
523
+ for (const el of held) el.hidden = true;
524
+ this.setShown(false);
525
+ }
526
+ },
527
+ { inert: [this.positioner] }
528
+ );
529
+ }
530
+ detach() {
531
+ this.backdrop.remove();
532
+ this.positioner.remove();
533
+ }
493
534
  /** Closing hands focus back to whatever opened it (Escape, the ✕, hide(), or a
494
535
  * teardown that outruns the machine's close notification). */
495
536
  restoreOpener() {
@@ -512,14 +553,15 @@ var Drawer = class {
512
553
  this.ctrl.connect(this.handle.service).setOpen(false);
513
554
  }
514
555
  destroy() {
556
+ if (this.wasOpen && !this.open) this.handle.flush();
515
557
  this.handle.stop();
558
+ this.destroyed = true;
516
559
  if (this.wasOpen) {
517
560
  this.wasOpen = false;
518
561
  this.announce(false);
519
562
  }
520
563
  this.restoreOpener();
521
- this.backdrop.remove();
522
- this.positioner.remove();
564
+ if (!this.exit) this.detach();
523
565
  }
524
566
  };
525
567
 
@@ -282,4 +282,53 @@ function announceSurface(el, open, kind, trigger = null) {
282
282
  );
283
283
  }
284
284
 
285
- export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, announceSurface, categoricalColor, icon, iconAt, iconEl, iconMarkup, injectStyles, isDarkColor, mix, overlayScrollbarCss, registerIcon, svg16, svg24, svg24Solid, withAlpha };
285
+ // src/ui/surface-exit.ts
286
+ var CLOSING_ATTR = "data-closing";
287
+ var SURFACE_EXIT_CAP_MS = 1e3;
288
+ function animationsOf(els) {
289
+ return els.flatMap((el) => el.getAnimations({ subtree: true }));
290
+ }
291
+ function ends(a) {
292
+ return Number.isFinite(a.effect?.getComputedTiming().endTime ?? Number.POSITIVE_INFINITY);
293
+ }
294
+ function holdForExit(els, done, opts = {}) {
295
+ const list = Array.isArray(els) ? els : [els];
296
+ if (list.length === 0 || !list.every((el) => typeof el.getAnimations === "function")) {
297
+ done();
298
+ return null;
299
+ }
300
+ const before = new Set(animationsOf(list));
301
+ for (const el of list) el.setAttribute(CLOSING_ATTR, "");
302
+ const exit = animationsOf(list).filter((a) => !before.has(a) && ends(a));
303
+ if (exit.length === 0) {
304
+ for (const el of list) el.removeAttribute(CLOSING_ATTR);
305
+ done();
306
+ return null;
307
+ }
308
+ const frozen = [...list, ...opts.inert ?? []];
309
+ const wasInert = frozen.map((el) => el.inert);
310
+ for (const el of frozen) el.inert = true;
311
+ let settled = false;
312
+ const settle = (complete) => {
313
+ if (settled) return;
314
+ settled = true;
315
+ clearTimeout(cap);
316
+ for (const el of list) el.removeAttribute(CLOSING_ATTR);
317
+ frozen.forEach((el, i) => {
318
+ el.inert = wasInert[i];
319
+ });
320
+ if (complete) done();
321
+ };
322
+ const cap = setTimeout(() => settle(true), SURFACE_EXIT_CAP_MS);
323
+ let pending = exit.length;
324
+ const one = () => {
325
+ if (--pending === 0) settle(true);
326
+ };
327
+ for (const a of exit) a.finished.then(one, one);
328
+ return {
329
+ cancel: () => settle(false),
330
+ finish: () => settle(true)
331
+ };
332
+ }
333
+
334
+ export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, announceSurface, categoricalColor, holdForExit, icon, iconAt, iconEl, iconMarkup, injectStyles, isDarkColor, mix, overlayScrollbarCss, registerIcon, svg16, svg24, svg24Solid, withAlpha };
@@ -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-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';
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, a_ as SeriesSpec, ak as Fill, H as Background, aQ 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, bg 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-lMUwmRwh.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-wbtJ3-Sa.cjs';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -905,6 +905,21 @@ interface VelaEventMap extends Record<string, unknown> {
905
905
  * leave the app theme alone.
906
906
  */
907
907
  "theme:changed": VelaTheme;
908
+ /**
909
+ * The base price style is switching `from` → `to` (candles, line, area, a chart-type
910
+ * id, …). Fires synchronously BEFORE the chart repaints in the new style, whatever
911
+ * the path: the topbar style menu, `ctx.setPriceStyle`,
912
+ * `chart.renderer.set('priceStyle', …)`, the settings dialog, `applyConfig` and
913
+ * config templates, or a state restore. Never fires for the style the chart was
914
+ * created with, nor for a set to the style already shown. While it runs the chart
915
+ * still shows `from`, so a listener can capture the outgoing frame
916
+ * (`chart.renderer.screenshotCanvas()`) to animate the switch. Listeners must not
917
+ * change the price style again from inside it.
918
+ */
919
+ "priceStyle:change": {
920
+ from: string;
921
+ to: string;
922
+ };
908
923
  /** A study pane was reordered one slot (`dir`) — carries enough to invert for undo/redo. */
909
924
  "pane:moved": {
910
925
  paneId: string;
@@ -1889,6 +1904,26 @@ interface WidgetContext {
1889
1904
  * `state:changed` + storage write follows). Only needed for state with no shell
1890
1905
  * event of its own — indicator adds/removals already trigger the save cycle. */
1891
1906
  stateChanged(): void;
1907
+ /** Where the right-click that opened a context menu landed. Set on the context handed
1908
+ * to `context:*` actions (`when` and `run`); absent everywhere else. */
1909
+ pointer?: ContextMenuPointer;
1910
+ }
1911
+ /**
1912
+ * What the chart's crosshair reported when a context menu opened ({@link WidgetContext.pointer}),
1913
+ * on the chart that received the right-click — in a workspace, the cell under the pointer.
1914
+ * Captured once at open: moving through the menu before picking a row does not change it.
1915
+ * The axis menus get what the crosshair reports over the axis: off the plot, `price` and
1916
+ * `paneKind` are null, while `time` still names the bar column under the pointer (on the
1917
+ * time axis, the bar above the click; null past the last bar).
1918
+ */
1919
+ interface ContextMenuPointer {
1920
+ /** The value under the pointer on the pane it landed on: a price on the price pane, an
1921
+ * indicator value on a study pane (see `paneKind`). Null off the plot. */
1922
+ price: number | null;
1923
+ /** Open time of the bar under the pointer; null off the bars. */
1924
+ time: number | null;
1925
+ /** The kind of pane the pointer is on; null off the plot. */
1926
+ paneKind: 'price' | 'study' | null;
1892
1927
  }
1893
1928
  /** What {@link WidgetContext.addIndicator} takes: a named script, ready to run. */
1894
1929
  interface ExternalIndicatorEntry {
@@ -1930,7 +1965,12 @@ interface WidgetActionDescriptor {
1930
1965
  * one the flag is ignored (with a console warning) and the label renders. The piece
1931
1966
  * that makes a `'screenshot'` slot override pixel-faithful to the native button. */
1932
1967
  iconOnly?: boolean;
1933
- /** Sort key within the contributed group (ascending; default 0). */
1968
+ /** Sort key (ascending; default 0; ties keep registration order). On the topbar it orders
1969
+ * the contributed group. In a context menu (`context:*`) contributed rows sort TOGETHER
1970
+ * with the menu's built-in rows, which sit at the ranks of `CONTEXT_MENU_BUILTIN_ORDER`:
1971
+ * the built-in actions below 0 and the settings row at 1000. So an action without
1972
+ * `order` lands after the built-in actions and before the settings row, `order: -100`
1973
+ * leads the menu, and on a tie the built-in row comes first. */
1934
1974
  order?: number;
1935
1975
  /** Topbar only: which cluster the button joins. `'right'` (default) is the
1936
1976
  * right-hand tools cluster; `'left'` puts it with the PRIMARY chrome buttons —
@@ -2249,4 +2289,4 @@ declare function unregisterDefaultEngine(language: string): void;
2249
2289
  * language. The shell layers (widget, workspace cell) register exactly this result. */
2250
2290
  declare function resolveEngines(overrides?: Record<string, EngineFactory>): Record<string, EngineFactory>;
2251
2291
 
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 };
2292
+ export { type ScriptRunCause as $, type LegendIndicatorInfo as A, type BarsChangeReason as B, type CellStateContext as C, type DrawingsDocument as D, type ExternalIndicatorEntry as E, type FetchSeries as F, type NativeIndicatorContext as G, type NativeIndicatorDescriptor as H, type IndicatorHandle as I, type NativeIndicatorInfo as J, type NativeIndicatorOutput as K, type LegendActionDescriptor as L, MarksControl as M, type NativeIndicator as N, OVERRIDABLE_TOPBAR_IDS as O, type ParsedSymbol as P, type PreparedScript as Q, type ReplayState as R, type ScriptingEngine as S, RendererControl as T, ReplayControl as U, Vela as V, type WidgetContext as W, type ReplayEndReason as X, type ReplayStartOptions as Y, type RunIndicatorResult as Z, type SceneInspection as _, type ReplayBounds as a, type ScriptRunResult as a0, type SidePanelButton as a1, type SidePanelDescriptor as a2, type SidePanelHandle as a3, type SidePanelHeader as a4, type StatePersistenceHandler as a5, type StrategyFill as a6, type StrategyState as a7, type StrategyTrade as a8, type SymbolRankingHook as a9, unregisterLegendAction as aA, unregisterLegendCallout as aB, unregisterNativeIndicator as aC, unregisterSidePanel as aD, unregisterStatePersistence as aE, unregisterWidgetAction as aF, unregisterWidgetAttachment as aG, widgetActions as aH, widgetAttachments as aI, DEFAULT_PANEL_ORDER as aJ, TypedEventBus as aa, type VelaDeps as ab, type VisibleBarRange as ac, type WidgetActionDescriptor as ad, type WidgetActionTarget as ae, type WidgetAttachment as af, getNativeIndicator as ag, legendActions as ah, legendCallouts as ai, nativeIndicatorDescriptors as aj, nativeIndicatorTypes as ak, registerDefaultEngine as al, registerLegendAction as am, registerLegendCallout as an, registerNativeIndicator as ao, registerSidePanel as ap, registerStatePersistence as aq, registerSymbolRanking as ar, registerWidgetAction as as, registerWidgetAttachment as at, resolveEngines as au, sidePanels as av, statePersistenceHandlers as aw, symbolRanking as ax, topbarActionOverride as ay, unregisterDefaultEngine 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 ContextMenuPointer as i, type ContextSelect as j, DrawingsControl as k, type EngineAlert as l, type EngineCapabilities as m, type EngineContextSnapshot as n, type EngineFactory as o, type EngineWarning as p, type ExecutionHandlers as q, type ExecutionMarket as r, type ExecutionRequest as s, type ExecutionSession as t, type IndicatorEventMap as u, type IndicatorSummary as v, type LegendCalloutContent as w, type LegendCalloutDescriptor as x, type LegendCalloutItem as y, type LegendCalloutSpec 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-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';
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, a_ as SeriesSpec, ak as Fill, H as Background, aQ 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, bg 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-lMUwmRwh.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-oH78tYXL.js';
3
3
 
4
4
  /**
5
5
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -905,6 +905,21 @@ interface VelaEventMap extends Record<string, unknown> {
905
905
  * leave the app theme alone.
906
906
  */
907
907
  "theme:changed": VelaTheme;
908
+ /**
909
+ * The base price style is switching `from` → `to` (candles, line, area, a chart-type
910
+ * id, …). Fires synchronously BEFORE the chart repaints in the new style, whatever
911
+ * the path: the topbar style menu, `ctx.setPriceStyle`,
912
+ * `chart.renderer.set('priceStyle', …)`, the settings dialog, `applyConfig` and
913
+ * config templates, or a state restore. Never fires for the style the chart was
914
+ * created with, nor for a set to the style already shown. While it runs the chart
915
+ * still shows `from`, so a listener can capture the outgoing frame
916
+ * (`chart.renderer.screenshotCanvas()`) to animate the switch. Listeners must not
917
+ * change the price style again from inside it.
918
+ */
919
+ "priceStyle:change": {
920
+ from: string;
921
+ to: string;
922
+ };
908
923
  /** A study pane was reordered one slot (`dir`) — carries enough to invert for undo/redo. */
909
924
  "pane:moved": {
910
925
  paneId: string;
@@ -1889,6 +1904,26 @@ interface WidgetContext {
1889
1904
  * `state:changed` + storage write follows). Only needed for state with no shell
1890
1905
  * event of its own — indicator adds/removals already trigger the save cycle. */
1891
1906
  stateChanged(): void;
1907
+ /** Where the right-click that opened a context menu landed. Set on the context handed
1908
+ * to `context:*` actions (`when` and `run`); absent everywhere else. */
1909
+ pointer?: ContextMenuPointer;
1910
+ }
1911
+ /**
1912
+ * What the chart's crosshair reported when a context menu opened ({@link WidgetContext.pointer}),
1913
+ * on the chart that received the right-click — in a workspace, the cell under the pointer.
1914
+ * Captured once at open: moving through the menu before picking a row does not change it.
1915
+ * The axis menus get what the crosshair reports over the axis: off the plot, `price` and
1916
+ * `paneKind` are null, while `time` still names the bar column under the pointer (on the
1917
+ * time axis, the bar above the click; null past the last bar).
1918
+ */
1919
+ interface ContextMenuPointer {
1920
+ /** The value under the pointer on the pane it landed on: a price on the price pane, an
1921
+ * indicator value on a study pane (see `paneKind`). Null off the plot. */
1922
+ price: number | null;
1923
+ /** Open time of the bar under the pointer; null off the bars. */
1924
+ time: number | null;
1925
+ /** The kind of pane the pointer is on; null off the plot. */
1926
+ paneKind: 'price' | 'study' | null;
1892
1927
  }
1893
1928
  /** What {@link WidgetContext.addIndicator} takes: a named script, ready to run. */
1894
1929
  interface ExternalIndicatorEntry {
@@ -1930,7 +1965,12 @@ interface WidgetActionDescriptor {
1930
1965
  * one the flag is ignored (with a console warning) and the label renders. The piece
1931
1966
  * that makes a `'screenshot'` slot override pixel-faithful to the native button. */
1932
1967
  iconOnly?: boolean;
1933
- /** Sort key within the contributed group (ascending; default 0). */
1968
+ /** Sort key (ascending; default 0; ties keep registration order). On the topbar it orders
1969
+ * the contributed group. In a context menu (`context:*`) contributed rows sort TOGETHER
1970
+ * with the menu's built-in rows, which sit at the ranks of `CONTEXT_MENU_BUILTIN_ORDER`:
1971
+ * the built-in actions below 0 and the settings row at 1000. So an action without
1972
+ * `order` lands after the built-in actions and before the settings row, `order: -100`
1973
+ * leads the menu, and on a tie the built-in row comes first. */
1934
1974
  order?: number;
1935
1975
  /** Topbar only: which cluster the button joins. `'right'` (default) is the
1936
1976
  * right-hand tools cluster; `'left'` puts it with the PRIMARY chrome buttons —
@@ -2249,4 +2289,4 @@ declare function unregisterDefaultEngine(language: string): void;
2249
2289
  * language. The shell layers (widget, workspace cell) register exactly this result. */
2250
2290
  declare function resolveEngines(overrides?: Record<string, EngineFactory>): Record<string, EngineFactory>;
2251
2291
 
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 };
2292
+ export { type ScriptRunCause as $, type LegendIndicatorInfo as A, type BarsChangeReason as B, type CellStateContext as C, type DrawingsDocument as D, type ExternalIndicatorEntry as E, type FetchSeries as F, type NativeIndicatorContext as G, type NativeIndicatorDescriptor as H, type IndicatorHandle as I, type NativeIndicatorInfo as J, type NativeIndicatorOutput as K, type LegendActionDescriptor as L, MarksControl as M, type NativeIndicator as N, OVERRIDABLE_TOPBAR_IDS as O, type ParsedSymbol as P, type PreparedScript as Q, type ReplayState as R, type ScriptingEngine as S, RendererControl as T, ReplayControl as U, Vela as V, type WidgetContext as W, type ReplayEndReason as X, type ReplayStartOptions as Y, type RunIndicatorResult as Z, type SceneInspection as _, type ReplayBounds as a, type ScriptRunResult as a0, type SidePanelButton as a1, type SidePanelDescriptor as a2, type SidePanelHandle as a3, type SidePanelHeader as a4, type StatePersistenceHandler as a5, type StrategyFill as a6, type StrategyState as a7, type StrategyTrade as a8, type SymbolRankingHook as a9, unregisterLegendAction as aA, unregisterLegendCallout as aB, unregisterNativeIndicator as aC, unregisterSidePanel as aD, unregisterStatePersistence as aE, unregisterWidgetAction as aF, unregisterWidgetAttachment as aG, widgetActions as aH, widgetAttachments as aI, DEFAULT_PANEL_ORDER as aJ, TypedEventBus as aa, type VelaDeps as ab, type VisibleBarRange as ac, type WidgetActionDescriptor as ad, type WidgetActionTarget as ae, type WidgetAttachment as af, getNativeIndicator as ag, legendActions as ah, legendCallouts as ai, nativeIndicatorDescriptors as aj, nativeIndicatorTypes as ak, registerDefaultEngine as al, registerLegendAction as am, registerLegendCallout as an, registerNativeIndicator as ao, registerSidePanel as ap, registerStatePersistence as aq, registerSymbolRanking as ar, registerWidgetAction as as, registerWidgetAttachment as at, resolveEngines as au, sidePanels as av, statePersistenceHandlers as aw, symbolRanking as ax, topbarActionOverride as ay, unregisterDefaultEngine 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 ContextMenuPointer as i, type ContextSelect as j, DrawingsControl as k, type EngineAlert as l, type EngineCapabilities as m, type EngineContextSnapshot as n, type EngineFactory as o, type EngineWarning as p, type ExecutionHandlers as q, type ExecutionMarket as r, type ExecutionRequest as s, type ExecutionSession as t, type IndicatorEventMap as u, type IndicatorSummary as v, type LegendCalloutContent as w, type LegendCalloutDescriptor as x, type LegendCalloutItem as y, type LegendCalloutSpec as z };