@luxalgo/vela 0.8.5 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/{DataProvider-DdqMxKdl.d.cts → DataProvider-B5i0_yY4.d.cts} +1 -1
  2. package/dist/{DataProvider-BUdlkx9I.d.ts → DataProvider-CPFgSyAm.d.ts} +1 -1
  3. package/dist/{chunk-QYIO37K7.js → chunk-3H6JO4VL.js} +2405 -1542
  4. package/dist/{chunk-BN4DNS3O.js → chunk-BLVL7WXF.js} +1156 -468
  5. package/dist/chunk-O6L27KRB.js +1331 -0
  6. package/dist/{chunk-WY5H4S4I.js → chunk-PZN4RS4T.js} +91 -36
  7. package/dist/{chunk-ALTGHKIM.js → chunk-Q7POFYNE.js} +516 -406
  8. package/dist/{chunk-AUOB7A5Y.js → chunk-WHPQQYH7.js} +29 -13
  9. package/dist/{contributions-D8xuYc9U.d.cts → contributions-BfBaF6eE.d.ts} +71 -22
  10. package/dist/{contributions-P9fBBuY1.d.ts → contributions-DupwEkzc.d.cts} +71 -22
  11. package/dist/index.cjs +4040 -2087
  12. package/dist/index.d.cts +53 -25
  13. package/dist/index.d.ts +53 -25
  14. package/dist/index.js +5 -5
  15. package/dist/{keymap-CGOz5F5f.d.cts → keymap-C48ughm6.d.ts} +9 -6
  16. package/dist/{keymap-CGOz5F5f.d.ts → keymap-W0hiajU6.d.cts} +9 -6
  17. package/dist/locales/ar.cjs +2262 -0
  18. package/dist/locales/ar.d.cts +5 -0
  19. package/dist/locales/ar.d.ts +5 -0
  20. package/dist/locales/ar.js +2260 -0
  21. package/dist/locales/de.cjs +2262 -0
  22. package/dist/locales/de.d.cts +5 -0
  23. package/dist/locales/de.d.ts +5 -0
  24. package/dist/locales/de.js +2260 -0
  25. package/dist/locales/en.cjs +2262 -0
  26. package/dist/locales/en.d.cts +5 -0
  27. package/dist/locales/en.d.ts +5 -0
  28. package/dist/locales/en.js +2260 -0
  29. package/dist/locales/es.cjs +2262 -0
  30. package/dist/locales/es.d.cts +5 -0
  31. package/dist/locales/es.d.ts +5 -0
  32. package/dist/locales/es.js +2260 -0
  33. package/dist/locales/fr.cjs +2262 -0
  34. package/dist/locales/fr.d.cts +5 -0
  35. package/dist/locales/fr.d.ts +5 -0
  36. package/dist/locales/fr.js +2260 -0
  37. package/dist/locales/he.cjs +2262 -0
  38. package/dist/locales/he.d.cts +5 -0
  39. package/dist/locales/he.d.ts +5 -0
  40. package/dist/locales/he.js +2260 -0
  41. package/dist/locales/hi.cjs +2262 -0
  42. package/dist/locales/hi.d.cts +5 -0
  43. package/dist/locales/hi.d.ts +5 -0
  44. package/dist/locales/hi.js +2260 -0
  45. package/dist/locales/id.cjs +2262 -0
  46. package/dist/locales/id.d.cts +5 -0
  47. package/dist/locales/id.d.ts +5 -0
  48. package/dist/locales/id.js +2260 -0
  49. package/dist/locales/it.cjs +2262 -0
  50. package/dist/locales/it.d.cts +5 -0
  51. package/dist/locales/it.d.ts +5 -0
  52. package/dist/locales/it.js +2260 -0
  53. package/dist/locales/ja.cjs +2262 -0
  54. package/dist/locales/ja.d.cts +5 -0
  55. package/dist/locales/ja.d.ts +5 -0
  56. package/dist/locales/ja.js +2260 -0
  57. package/dist/locales/ko.cjs +2262 -0
  58. package/dist/locales/ko.d.cts +5 -0
  59. package/dist/locales/ko.d.ts +5 -0
  60. package/dist/locales/ko.js +2260 -0
  61. package/dist/locales/ms.cjs +2262 -0
  62. package/dist/locales/ms.d.cts +5 -0
  63. package/dist/locales/ms.d.ts +5 -0
  64. package/dist/locales/ms.js +2260 -0
  65. package/dist/locales/pl.cjs +2262 -0
  66. package/dist/locales/pl.d.cts +5 -0
  67. package/dist/locales/pl.d.ts +5 -0
  68. package/dist/locales/pl.js +2260 -0
  69. package/dist/locales/pt-BR.cjs +2262 -0
  70. package/dist/locales/pt-BR.d.cts +5 -0
  71. package/dist/locales/pt-BR.d.ts +5 -0
  72. package/dist/locales/pt-BR.js +2260 -0
  73. package/dist/locales/ru.cjs +2262 -0
  74. package/dist/locales/ru.d.cts +5 -0
  75. package/dist/locales/ru.d.ts +5 -0
  76. package/dist/locales/ru.js +2260 -0
  77. package/dist/locales/th.cjs +2262 -0
  78. package/dist/locales/th.d.cts +5 -0
  79. package/dist/locales/th.d.ts +5 -0
  80. package/dist/locales/th.js +2260 -0
  81. package/dist/locales/tr.cjs +2262 -0
  82. package/dist/locales/tr.d.cts +5 -0
  83. package/dist/locales/tr.d.ts +5 -0
  84. package/dist/locales/tr.js +2260 -0
  85. package/dist/locales/vi.cjs +2262 -0
  86. package/dist/locales/vi.d.cts +5 -0
  87. package/dist/locales/vi.d.ts +5 -0
  88. package/dist/locales/vi.js +2260 -0
  89. package/dist/locales/zh-Hans.cjs +2262 -0
  90. package/dist/locales/zh-Hans.d.cts +5 -0
  91. package/dist/locales/zh-Hans.d.ts +5 -0
  92. package/dist/locales/zh-Hans.js +2260 -0
  93. package/dist/locales/zh-Hant.cjs +2262 -0
  94. package/dist/locales/zh-Hant.d.cts +5 -0
  95. package/dist/locales/zh-Hant.d.ts +5 -0
  96. package/dist/locales/zh-Hant.js +2260 -0
  97. package/dist/{options-BI5Tp32b.d.ts → options-B7aL1pbf.d.ts} +74 -9
  98. package/dist/{options-BI5Tp32b.d.cts → options-I1H2HDWw.d.cts} +74 -9
  99. package/dist/{plugin-B8F1nor8.d.cts → plugin-BGz-Vsdv.d.cts} +81 -35
  100. package/dist/{plugin-D5Z-Q6TX.d.ts → plugin-BZHypj8h.d.ts} +81 -35
  101. package/dist/plugin.cjs +1268 -319
  102. package/dist/plugin.d.cts +7 -6
  103. package/dist/plugin.d.ts +7 -6
  104. package/dist/plugin.js +3 -3
  105. package/dist/providers/binance.cjs +1 -1
  106. package/dist/providers/binance.d.cts +3 -2
  107. package/dist/providers/binance.d.ts +3 -2
  108. package/dist/providers/binance.js +1 -1
  109. package/dist/providers/coinbase.cjs +1 -1
  110. package/dist/providers/coinbase.d.cts +3 -2
  111. package/dist/providers/coinbase.d.ts +3 -2
  112. package/dist/providers/coinbase.js +1 -1
  113. package/dist/providers/hyperliquid.cjs +1 -1
  114. package/dist/providers/hyperliquid.d.cts +3 -2
  115. package/dist/providers/hyperliquid.d.ts +3 -2
  116. package/dist/providers/hyperliquid.js +1 -1
  117. package/dist/{side-panel-_2UK1gSm.d.ts → side-panel-BEQJqSjR.d.cts} +14 -2
  118. package/dist/{side-panel-_2UK1gSm.d.cts → side-panel-Ud0SBAnE.d.ts} +14 -2
  119. package/dist/{statusline-model-CTwtDIca.d.cts → statusline-model-Dfb_GD9u.d.ts} +14 -3
  120. package/dist/{statusline-model-D9kWC9X5.d.ts → statusline-model-PHt0YhmI.d.cts} +14 -3
  121. package/dist/types-Bwf63xGI.d.cts +2518 -0
  122. package/dist/types-Bwf63xGI.d.ts +2518 -0
  123. package/dist/ui.cjs +1008 -56
  124. package/dist/ui.d.cts +21 -2
  125. package/dist/ui.d.ts +21 -2
  126. package/dist/ui.js +3 -3
  127. package/dist/vela.global.js +4005 -2054
  128. package/dist/vela.global.min.js +57 -57
  129. package/dist/widget.cjs +5384 -2698
  130. package/dist/widget.d.cts +100 -26
  131. package/dist/widget.d.ts +100 -26
  132. package/dist/widget.js +19 -11
  133. package/dist/workspace.cjs +5373 -2705
  134. package/dist/workspace.d.cts +63 -15
  135. package/dist/workspace.d.ts +63 -15
  136. package/dist/workspace.js +6 -6
  137. package/package.json +9 -2
  138. package/dist/chunk-I2U4NZD2.js +0 -340
  139. /package/dist/{chunk-W5YPYZ2P.js → chunk-3EYCX2L4.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-WY5H4S4I.js';
2
- import { injectStyles, holdForExit, announceSurface } from './chunk-I2U4NZD2.js';
1
+ import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-PZN4RS4T.js';
2
+ import { msg, textOf, injectStyles, holdForExit, announceSurface } from './chunk-O6L27KRB.js';
3
3
  import * as tooltip from '@zag-js/tooltip';
4
4
  import * as dialog from '@zag-js/dialog';
5
5
 
@@ -16,7 +16,15 @@ var KEY_ALIASES = {
16
16
  up: "arrowup",
17
17
  down: "arrowdown"
18
18
  };
19
- var MAC_GLYPHS = { meta: "\u2318", ctrl: "\u2303", alt: "\u2325", shift: "\u21E7" };
19
+ var MAC_GLYPHS = { meta: "⌘", ctrl: "⌃", alt: "⌥", shift: "⇧" };
20
+ var KEY_TEXT = {
21
+ ctrl: msg("ui.keys.ctrl", "Ctrl"),
22
+ alt: msg("ui.keys.alt", "Alt"),
23
+ shift: msg("ui.keys.shift", "Shift"),
24
+ meta: msg("ui.keys.meta", "Win"),
25
+ space: msg("ui.keys.space", "Space"),
26
+ general: msg("ui.keys.general", "General")
27
+ };
20
28
  function parseChord(spec, mac) {
21
29
  const parts = spec.toLowerCase().split("+").map((p) => p.trim()).filter((p, i, a) => p !== "" || a[i - 1] === "");
22
30
  const chord = { ctrl: false, meta: false, alt: false, shift: false, key: "" };
@@ -31,10 +39,16 @@ function parseChord(spec, mac) {
31
39
  }
32
40
  return chord;
33
41
  }
42
+ function chordKeyOf(ev) {
43
+ const key = String(ev.key ?? "").toLowerCase();
44
+ if (key.length !== 1 || /^[a-z0-9]$/.test(key) || !/\p{L}/u.test(key)) return key;
45
+ const m = /^Key([A-Z])$|^Digit([0-9])$/.exec(ev.code ?? "");
46
+ return m ? (m[1] ?? m[2]).toLowerCase() : key;
47
+ }
34
48
  function eventMatches(ev, c) {
35
49
  return ev.ctrlKey === c.ctrl && ev.metaKey === c.meta && ev.altKey === c.alt && // Shift is part of producing many printable keys ('?', '+') — only enforce it
36
50
  // when the chord names a non-printable/letter key where shift is a real modifier.
37
- (c.key.length > 1 || /^[a-z0-9 ]$/.test(c.key) ? ev.shiftKey === c.shift : true) && ev.key.toLowerCase() === c.key;
51
+ (c.key.length > 1 || /^[a-z0-9 ]$/.test(c.key) ? ev.shiftKey === c.shift : true) && chordKeyOf(ev) === c.key;
38
52
  }
39
53
  function isEditableTarget(ev) {
40
54
  const t = ev.target;
@@ -44,13 +58,14 @@ function isEditableTarget(ev) {
44
58
  if (t.isContentEditable === true) return true;
45
59
  return (typeof t.getAttribute === "function" ? t.getAttribute("role") : null) === "textbox";
46
60
  }
47
- function displayChord(spec, mac) {
61
+ function displayChord(spec, mac, i18n) {
48
62
  const c = parseChord(spec, mac);
49
- const keyLabel = c.key === " " ? "Space" : c.key.length === 1 ? c.key.toUpperCase() : c.key.charAt(0).toUpperCase() + c.key.slice(1);
63
+ const name = (m) => textOf(i18n, m);
64
+ const keyLabel = c.key === " " ? name(KEY_TEXT.space) : c.key.length === 1 ? c.key.toUpperCase() : c.key.charAt(0).toUpperCase() + c.key.slice(1);
50
65
  if (mac) {
51
66
  return (c.ctrl ? MAC_GLYPHS.ctrl : "") + (c.alt ? MAC_GLYPHS.alt : "") + (c.shift ? MAC_GLYPHS.shift : "") + (c.meta ? MAC_GLYPHS.meta : "") + keyLabel;
52
67
  }
53
- const mods = [c.ctrl && "Ctrl", c.alt && "Alt", c.shift && "Shift", c.meta && "Win"].filter(Boolean);
68
+ const mods = [c.ctrl && name(KEY_TEXT.ctrl), c.alt && name(KEY_TEXT.alt), c.shift && name(KEY_TEXT.shift), c.meta && name(KEY_TEXT.meta)].filter(Boolean);
54
69
  return [...mods, keyLabel].join("+");
55
70
  }
56
71
  var KeymapManager = class {
@@ -81,17 +96,18 @@ var KeymapManager = class {
81
96
  if (keys === null) this.rebinds.delete(id);
82
97
  else this.rebinds.set(id, Array.isArray(keys) ? [...keys] : [keys]);
83
98
  }
84
- /** Snapshot for a shortcuts help panel / rebinding UI. */
85
- bindings() {
99
+ /** Snapshot for a shortcuts help panel / rebinding UI: labels, categories and key
100
+ * names in `i18n`'s language (English when absent). */
101
+ bindings(i18n) {
86
102
  return [...this.descriptors.values()].map((d) => {
87
103
  const keys = this.activeKeys(d);
88
104
  return {
89
105
  id: d.id,
90
- label: d.label,
91
- category: d.category ?? "General",
106
+ label: textOf(i18n, d.label),
107
+ category: textOf(i18n, d.category ?? KEY_TEXT.general),
92
108
  scope: d.scope ?? this.baseScope,
93
109
  keys,
94
- display: keys.map((k) => displayChord(k, this.mac))
110
+ display: keys.map((k) => displayChord(k, this.mac, i18n))
95
111
  };
96
112
  });
97
113
  }
@@ -252,7 +268,7 @@ var DRAWER_CSS = `
252
268
  z-index: var(--vela-z-dialog);
253
269
  }
254
270
  /* Inside a shell that declares a size class, the sheet scopes to the SHELL's bounds
255
- (the widget root is position:relative) instead of the whole viewport \u2014 an embedded
271
+ (the widget root is position:relative) instead of the whole viewport — an embedded
256
272
  chart must not curtain the host page. */
257
273
  [data-layout] .vela-drawer-backdrop, [data-layout] .vela-drawer-positioner { position: absolute; }
258
274
  .vela-drawer {
@@ -1,5 +1,6 @@
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, bh as DrawingToolDefaults, bi as DrawingToolTemplate, 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-BI5Tp32b.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-DdqMxKdl.cjs';
1
+ import { y as Millis, aq as InputSchema, an as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, m as IndicatorModel, l as MoveTarget, aJ as PaneAxis, b0 as SeriesSpec, al as Fill, J as Background, aS as PriceLine, a8 as DrawingLine, a4 as DrawingBox, a7 as DrawingLabel, ac as DrawingPolyline, a9 as DrawingLinefill, ah as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, B as DrawingTypeKey, z as SnapMode, aa as DrawingMode, v as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, p as LegendActionView, q as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, s as ClickEvent, A as AxisLongPressEvent, w as DataWindowReadout, o as SymbolPickerFn, W as WallClock, bi as PaneInfo, ak as DrawingsOption, ae as DrawingSeriesGateway, bj as DrawingToolDefaults, bk as DrawingToolTemplate, D as Drawing, t as TimelineMark, u as MarkGroup, b as VelaOptions, G as AddIndicatorOptions, aI as MarketSwitch, F as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-B7aL1pbf.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-CPFgSyAm.js';
3
+ import { M as MessageLike, T as Translator, c as LocaleChangedEvent, b as LocalizationOptions } from './types-Bwf63xGI.js';
3
4
 
4
5
  /**
5
6
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -553,14 +554,15 @@ interface NativeIndicator {
553
554
  */
554
555
  interface NativeIndicatorDescriptor {
555
556
  readonly type: string;
556
- /** Full display name (picker, settings header, handle title). */
557
- readonly title: string;
557
+ /** Full display name (picker, settings header, handle title). A message (`msg()`)
558
+ * reads in the chart's language. */
559
+ readonly title: MessageLike;
558
560
  /**
559
561
  * Compact name for the on-chart legend chip, the settings-dialog header and the
560
562
  * object tree's indicator rows.
561
563
  * Absent ⇒ {@link title}. The picker keeps the full title either way.
562
564
  */
563
- readonly shortTitle?: string;
565
+ readonly shortTitle?: MessageLike;
564
566
  readonly paneHint: 'price' | 'new';
565
567
  readonly overlay: boolean;
566
568
  /** Whether instances react to viewport changes (drives the orchestrator's viewport poke). */
@@ -628,12 +630,19 @@ interface NativeIndicatorInfo {
628
630
  declare function registerNativeIndicator(descriptor: NativeIndicatorDescriptor): void;
629
631
  /** Remove a registered native-indicator type (mainly for tests). */
630
632
  declare function unregisterNativeIndicator(type: string): void;
631
- /** Look up a registered native-indicator descriptor (undefined if the type isn't registered). */
632
- declare function getNativeIndicator(type: string): NativeIndicatorDescriptor | undefined;
633
+ /** A registered descriptor as the read APIs hand it out: its names as plain text. */
634
+ type ResolvedNativeIndicatorDescriptor = NativeIndicatorDescriptor & {
635
+ readonly title: string;
636
+ readonly shortTitle?: string;
637
+ };
638
+ /** Look up a registered native-indicator descriptor (undefined if the type isn't registered).
639
+ * Its names read in `i18n`'s language (English without one). */
640
+ declare function getNativeIndicator(type: string, i18n?: Translator): ResolvedNativeIndicatorDescriptor | undefined;
633
641
  /** All registered native-indicator types (for a host "add native indicator" menu). */
634
642
  declare function nativeIndicatorTypes(): string[];
635
- /** All registered native-indicator descriptors (for building a catalog with metadata + capability). */
636
- declare function nativeIndicatorDescriptors(): NativeIndicatorDescriptor[];
643
+ /** All registered native-indicator descriptors (for building a catalog with metadata +
644
+ * capability), their names in `i18n`'s language (English without one). */
645
+ declare function nativeIndicatorDescriptors(i18n?: Translator): ResolvedNativeIndicatorDescriptor[];
637
646
 
638
647
  /**
639
648
  * Why a script computed. The distinction that matters most is `'tick'` vs `'bar'`: a tick
@@ -926,6 +935,12 @@ interface VelaEventMap extends Record<string, unknown> {
926
935
  * leave the app theme alone.
927
936
  */
928
937
  "theme:changed": VelaTheme;
938
+ /**
939
+ * The chart's localization changed through `chart.setLocale(...)` — after the chart has
940
+ * re-rendered its text and numbers. Carries the resolved locale and chrome direction so
941
+ * host chrome around the chart can follow.
942
+ */
943
+ "locale:changed": LocaleChangedEvent;
929
944
  /**
930
945
  * The base price style is switching `from` → `to` (candles, line, area, a chart-type
931
946
  * id, …). Fires synchronously BEFORE the chart repaints in the new style, whatever
@@ -1285,7 +1300,7 @@ declare class RendererControl {
1285
1300
  /** Contribute host settings tabs (callback rows) to the renderer's settings dialog —
1286
1301
  * e.g. the widget's Status line toggles. Silent no-op without a dialog. */
1287
1302
  setSettingsSections(sections: ReadonlyArray<{
1288
- title: string;
1303
+ title: MessageLike;
1289
1304
  rows: readonly unknown[];
1290
1305
  id?: string;
1291
1306
  }>): this;
@@ -1402,10 +1417,14 @@ interface AddInit {
1402
1417
  */
1403
1418
  declare class DrawingController {
1404
1419
  private readonly events;
1420
+ /** The chart's translator: the toolbar reaches the renderer labelled in its language. */
1421
+ private readonly i18n;
1405
1422
  private readonly store;
1406
1423
  private readonly history;
1407
1424
  private readonly port;
1408
1425
  private readonly enabled;
1426
+ /** The toolbar as last configured — re-read in the chart's language on {@link relocalize}. */
1427
+ private toolbarOption;
1409
1428
  private activeTool;
1410
1429
  /** Mirror of the renderer's sticky magnet mode (the renderer default is 'off'). */
1411
1430
  private snapMode;
@@ -1422,7 +1441,9 @@ declare class DrawingController {
1422
1441
  /** Per-tool saved looks ("styles"), in the order they were saved. */
1423
1442
  private templates;
1424
1443
  private readonly subs;
1425
- constructor(renderer: IChartRenderer, events: TypedEventBus<VelaEventMap>, option: DrawingsOption | undefined, seriesGateway?: DrawingSeriesGateway);
1444
+ constructor(renderer: IChartRenderer, events: TypedEventBus<VelaEventMap>, option: DrawingsOption | undefined, seriesGateway?: DrawingSeriesGateway,
1445
+ /** The chart's translator: the toolbar reaches the renderer labelled in its language. */
1446
+ i18n?: () => Translator | null);
1426
1447
  /** Whether the active renderer supports interactive drawings. */
1427
1448
  get supported(): boolean;
1428
1449
  setTool(type: DrawingTypeKey | null): void;
@@ -1461,6 +1482,8 @@ declare class DrawingController {
1461
1482
  removeToolTemplate(type: DrawingTypeKey, name: string): void;
1462
1483
  private pushTemplates;
1463
1484
  setToolbar(option: DrawingsOption): void;
1485
+ /** The chart's language changed: hand the renderer the toolbar relabelled in it. */
1486
+ relocalize(): void;
1464
1487
  /** Display (or clear) another chart's in-progress placement as a ghost — silently
1465
1488
  * inert on a renderer without the optional `setExternalGhost` seam. */
1466
1489
  setExternalGhost(doc: SerializedDrawing | null): void;
@@ -1764,7 +1787,27 @@ declare class Vela {
1764
1787
  private readonly drawingsControl;
1765
1788
  private readonly marksControl;
1766
1789
  private readonly replayControl;
1790
+ private readonly localeState;
1791
+ private readonly rendererPort;
1767
1792
  constructor(container: HTMLElement | string, options?: VelaOptions, deps?: VelaDeps);
1793
+ /**
1794
+ * The chart's translator: its resolved locale and direction, `t()` for messages, and
1795
+ * `format` for numbers and dates in the chart's locale. The same object for the
1796
+ * chart's lifetime; it reads the new settings after {@link setLocale}.
1797
+ */
1798
+ get i18n(): Translator;
1799
+ /**
1800
+ * Change the chart's language, direction or formatting at runtime — a locale tag
1801
+ * (`chart.setLocale('de')`) or any {@link LocalizationOptions} fields. Fields you pass
1802
+ * replace their current value (an explicit `undefined` restores the default); the
1803
+ * others are kept. The chart re-renders its text, axes and readouts in place (no
1804
+ * indicator re-run) and emits `locale:changed`. Register the locale's pack
1805
+ * (`registerLocale`) first for translated text.
1806
+ */
1807
+ setLocale(next: string | LocalizationOptions): this;
1808
+ /** Hand the renderer the translator and the root attributes the host asked for: `lang`
1809
+ * once a locale is set, `dir` once a direction is (unset, the host page decides). */
1810
+ private pushLocalization;
1768
1811
  /**
1769
1812
  * Register a scripting engine so `addIndicator({ language })` can run that
1770
1813
  * language. Vela ships NO engine — install the one you need (Pine Script:
@@ -1969,6 +2012,10 @@ interface WidgetContext {
1969
2012
  * (Dialog/Menu/Tooltip) from an action; without an explicit host they portal to
1970
2013
  * the body, OUTSIDE the theme variables. A multi-chart shell hands its own root. */
1971
2014
  host: HTMLElement;
2015
+ /** The shell's translator: `i18n.t(msg(...))` for text an action or panel renders,
2016
+ * `i18n.format` for its numbers and dates, `i18n.direction` for its layout. It follows
2017
+ * `setLocale`; listen to the shell's `locale:changed` to re-render. */
2018
+ i18n: Translator;
1972
2019
  /** The widget's feedback pill (bottom-center, auto-hides). */
1973
2020
  toast(message: string, kind?: 'info' | 'success' | 'error'): void;
1974
2021
  /** Add a SCRIPT indicator to the active chart THROUGH THE SHELL — unlike the raw
@@ -2037,8 +2084,9 @@ interface WidgetActionDescriptor {
2037
2084
  id: string;
2038
2085
  target: WidgetActionTarget;
2039
2086
  /** Always required, even icon-only: it is the button's aria-label and tooltip, the
2040
- * mobile drawer row's text, and the context-menu item's label. */
2041
- label: string;
2087
+ * mobile drawer row's text, and the context-menu item's label. A message
2088
+ * (`msg(id, 'English')`) follows the shell's language; a plain string shows as is. */
2089
+ label: MessageLike;
2042
2090
  /** Icon id from the `vela/ui` icon registry (register yours with `registerIcon`). */
2043
2091
  icon?: string;
2044
2092
  /** Topbar only: render the DESKTOP button icon-only, like the built-in tools — the
@@ -2104,7 +2152,7 @@ interface SidePanelHeader {
2104
2152
  slot: HTMLElement;
2105
2153
  /** Replace the header title (an empty string hides it). The topbar toggle keeps the
2106
2154
  * DECLARED `title` as its tooltip. */
2107
- setTitle(title: string): void;
2155
+ setTitle(title: MessageLike): void;
2108
2156
  /** Whether the panel covers every chart right now (see `maximizable`). */
2109
2157
  readonly maximized: boolean;
2110
2158
  /** Maximize the panel over the shell's charts, or restore it — what its header button
@@ -2124,8 +2172,8 @@ interface SidePanelHeader {
2124
2172
  interface SidePanelDescriptor {
2125
2173
  /** Stable id — re-registering an id replaces it. Also the key its width persists under. */
2126
2174
  id: string;
2127
- /** Header title, and the tooltip of its topbar button. */
2128
- title: string;
2175
+ /** Header title, and the tooltip of its topbar button. A message follows the shell's language. */
2176
+ title: MessageLike;
2129
2177
  /** Icon id from the `vela/ui` icon registry (register yours with `registerIcon`). */
2130
2178
  icon: string;
2131
2179
  /** Sort key among the panel buttons (ascending; default 100 — after the built-ins). */
@@ -2208,7 +2256,8 @@ interface LegendActionDescriptor {
2208
2256
  id: string;
2209
2257
  /** Icon id from the `vela/ui` icon registry (register yours with `registerIcon`). */
2210
2258
  icon: string;
2211
- tooltip: string;
2259
+ /** Hover text. A message follows the chart's language. */
2260
+ tooltip: MessageLike;
2212
2261
  /** Sort key within the contributed group (ascending; default 0). */
2213
2262
  order?: number;
2214
2263
  /** Per-indicator gate — omitted ⇒ shown on every row. */
@@ -2225,10 +2274,10 @@ declare function legendActions(): LegendActionDescriptor[];
2225
2274
  * indicator — the same signature as a legend action's `run`. */
2226
2275
  type LegendCalloutItem = {
2227
2276
  type: 'text';
2228
- text: string;
2277
+ text: MessageLike;
2229
2278
  } | {
2230
2279
  type: 'button';
2231
- label: string;
2280
+ label: MessageLike;
2232
2281
  /** Emphasized (selection-colored) button — the panel's main action. */
2233
2282
  primary?: boolean;
2234
2283
  /** Close the panel after `run` (default true). */
@@ -2237,7 +2286,7 @@ type LegendCalloutItem = {
2237
2286
  };
2238
2287
  /** The panel a clickable callout deploys: an optional heading over ordered blocks. */
2239
2288
  interface LegendCalloutContent {
2240
- title?: string;
2289
+ title?: MessageLike;
2241
2290
  items: LegendCalloutItem[];
2242
2291
  }
2243
2292
  /** A callout's resolved presentation for one row — what {@link LegendCalloutDescriptor.callout} returns. */
@@ -2248,8 +2297,8 @@ interface LegendCalloutSpec {
2248
2297
  background: string;
2249
2298
  /** Icon ink (default: the legend row's text color). */
2250
2299
  color?: string;
2251
- /** Hover text; also the bubble's accessible name. */
2252
- tooltip: string;
2300
+ /** Hover text; also the bubble's accessible name. A message follows the chart's language. */
2301
+ tooltip: MessageLike;
2253
2302
  /** Deployed panel — presence makes the bubble clickable. */
2254
2303
  content?: LegendCalloutContent;
2255
2304
  }
@@ -1,5 +1,6 @@
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, bh as DrawingToolDefaults, bi as DrawingToolTemplate, 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-BI5Tp32b.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-BUdlkx9I.js';
1
+ import { y as Millis, aq as InputSchema, an as IndicatorMeta, P as PriceStyle, O as OHLCV, I as InputValue, m as IndicatorModel, l as MoveTarget, aJ as PaneAxis, b0 as SeriesSpec, al as Fill, J as Background, aS as PriceLine, a8 as DrawingLine, a4 as DrawingBox, a7 as DrawingLabel, ac as DrawingPolyline, a9 as DrawingLinefill, ah as DrawingTable, h as IndicatorStatus, a as VisibleRange, c as VelaTheme, S as SerializedDrawing, B as DrawingTypeKey, z as SnapMode, aa as DrawingMode, v as MarkClickEvent, e as IChartRenderer, R as RendererCapabilities, p as LegendActionView, q as LegendCalloutView, U as Unsubscribe, C as CrosshairEvent, s as ClickEvent, A as AxisLongPressEvent, w as DataWindowReadout, o as SymbolPickerFn, W as WallClock, bi as PaneInfo, ak as DrawingsOption, ae as DrawingSeriesGateway, bj as DrawingToolDefaults, bk as DrawingToolTemplate, D as Drawing, t as TimelineMark, u as MarkGroup, b as VelaOptions, G as AddIndicatorOptions, aI as MarketSwitch, F as MarketSnapshot, V as VisibleRangePreset, T as ThemeName } from './options-I1H2HDWw.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-B5i0_yY4.cjs';
3
+ import { M as MessageLike, T as Translator, c as LocaleChangedEvent, b as LocalizationOptions } from './types-Bwf63xGI.cjs';
3
4
 
4
5
  /**
5
6
  * A strategy's broker state at ONE bar — the flat summary a host reads while a script
@@ -553,14 +554,15 @@ interface NativeIndicator {
553
554
  */
554
555
  interface NativeIndicatorDescriptor {
555
556
  readonly type: string;
556
- /** Full display name (picker, settings header, handle title). */
557
- readonly title: string;
557
+ /** Full display name (picker, settings header, handle title). A message (`msg()`)
558
+ * reads in the chart's language. */
559
+ readonly title: MessageLike;
558
560
  /**
559
561
  * Compact name for the on-chart legend chip, the settings-dialog header and the
560
562
  * object tree's indicator rows.
561
563
  * Absent ⇒ {@link title}. The picker keeps the full title either way.
562
564
  */
563
- readonly shortTitle?: string;
565
+ readonly shortTitle?: MessageLike;
564
566
  readonly paneHint: 'price' | 'new';
565
567
  readonly overlay: boolean;
566
568
  /** Whether instances react to viewport changes (drives the orchestrator's viewport poke). */
@@ -628,12 +630,19 @@ interface NativeIndicatorInfo {
628
630
  declare function registerNativeIndicator(descriptor: NativeIndicatorDescriptor): void;
629
631
  /** Remove a registered native-indicator type (mainly for tests). */
630
632
  declare function unregisterNativeIndicator(type: string): void;
631
- /** Look up a registered native-indicator descriptor (undefined if the type isn't registered). */
632
- declare function getNativeIndicator(type: string): NativeIndicatorDescriptor | undefined;
633
+ /** A registered descriptor as the read APIs hand it out: its names as plain text. */
634
+ type ResolvedNativeIndicatorDescriptor = NativeIndicatorDescriptor & {
635
+ readonly title: string;
636
+ readonly shortTitle?: string;
637
+ };
638
+ /** Look up a registered native-indicator descriptor (undefined if the type isn't registered).
639
+ * Its names read in `i18n`'s language (English without one). */
640
+ declare function getNativeIndicator(type: string, i18n?: Translator): ResolvedNativeIndicatorDescriptor | undefined;
633
641
  /** All registered native-indicator types (for a host "add native indicator" menu). */
634
642
  declare function nativeIndicatorTypes(): string[];
635
- /** All registered native-indicator descriptors (for building a catalog with metadata + capability). */
636
- declare function nativeIndicatorDescriptors(): NativeIndicatorDescriptor[];
643
+ /** All registered native-indicator descriptors (for building a catalog with metadata +
644
+ * capability), their names in `i18n`'s language (English without one). */
645
+ declare function nativeIndicatorDescriptors(i18n?: Translator): ResolvedNativeIndicatorDescriptor[];
637
646
 
638
647
  /**
639
648
  * Why a script computed. The distinction that matters most is `'tick'` vs `'bar'`: a tick
@@ -926,6 +935,12 @@ interface VelaEventMap extends Record<string, unknown> {
926
935
  * leave the app theme alone.
927
936
  */
928
937
  "theme:changed": VelaTheme;
938
+ /**
939
+ * The chart's localization changed through `chart.setLocale(...)` — after the chart has
940
+ * re-rendered its text and numbers. Carries the resolved locale and chrome direction so
941
+ * host chrome around the chart can follow.
942
+ */
943
+ "locale:changed": LocaleChangedEvent;
929
944
  /**
930
945
  * The base price style is switching `from` → `to` (candles, line, area, a chart-type
931
946
  * id, …). Fires synchronously BEFORE the chart repaints in the new style, whatever
@@ -1285,7 +1300,7 @@ declare class RendererControl {
1285
1300
  /** Contribute host settings tabs (callback rows) to the renderer's settings dialog —
1286
1301
  * e.g. the widget's Status line toggles. Silent no-op without a dialog. */
1287
1302
  setSettingsSections(sections: ReadonlyArray<{
1288
- title: string;
1303
+ title: MessageLike;
1289
1304
  rows: readonly unknown[];
1290
1305
  id?: string;
1291
1306
  }>): this;
@@ -1402,10 +1417,14 @@ interface AddInit {
1402
1417
  */
1403
1418
  declare class DrawingController {
1404
1419
  private readonly events;
1420
+ /** The chart's translator: the toolbar reaches the renderer labelled in its language. */
1421
+ private readonly i18n;
1405
1422
  private readonly store;
1406
1423
  private readonly history;
1407
1424
  private readonly port;
1408
1425
  private readonly enabled;
1426
+ /** The toolbar as last configured — re-read in the chart's language on {@link relocalize}. */
1427
+ private toolbarOption;
1409
1428
  private activeTool;
1410
1429
  /** Mirror of the renderer's sticky magnet mode (the renderer default is 'off'). */
1411
1430
  private snapMode;
@@ -1422,7 +1441,9 @@ declare class DrawingController {
1422
1441
  /** Per-tool saved looks ("styles"), in the order they were saved. */
1423
1442
  private templates;
1424
1443
  private readonly subs;
1425
- constructor(renderer: IChartRenderer, events: TypedEventBus<VelaEventMap>, option: DrawingsOption | undefined, seriesGateway?: DrawingSeriesGateway);
1444
+ constructor(renderer: IChartRenderer, events: TypedEventBus<VelaEventMap>, option: DrawingsOption | undefined, seriesGateway?: DrawingSeriesGateway,
1445
+ /** The chart's translator: the toolbar reaches the renderer labelled in its language. */
1446
+ i18n?: () => Translator | null);
1426
1447
  /** Whether the active renderer supports interactive drawings. */
1427
1448
  get supported(): boolean;
1428
1449
  setTool(type: DrawingTypeKey | null): void;
@@ -1461,6 +1482,8 @@ declare class DrawingController {
1461
1482
  removeToolTemplate(type: DrawingTypeKey, name: string): void;
1462
1483
  private pushTemplates;
1463
1484
  setToolbar(option: DrawingsOption): void;
1485
+ /** The chart's language changed: hand the renderer the toolbar relabelled in it. */
1486
+ relocalize(): void;
1464
1487
  /** Display (or clear) another chart's in-progress placement as a ghost — silently
1465
1488
  * inert on a renderer without the optional `setExternalGhost` seam. */
1466
1489
  setExternalGhost(doc: SerializedDrawing | null): void;
@@ -1764,7 +1787,27 @@ declare class Vela {
1764
1787
  private readonly drawingsControl;
1765
1788
  private readonly marksControl;
1766
1789
  private readonly replayControl;
1790
+ private readonly localeState;
1791
+ private readonly rendererPort;
1767
1792
  constructor(container: HTMLElement | string, options?: VelaOptions, deps?: VelaDeps);
1793
+ /**
1794
+ * The chart's translator: its resolved locale and direction, `t()` for messages, and
1795
+ * `format` for numbers and dates in the chart's locale. The same object for the
1796
+ * chart's lifetime; it reads the new settings after {@link setLocale}.
1797
+ */
1798
+ get i18n(): Translator;
1799
+ /**
1800
+ * Change the chart's language, direction or formatting at runtime — a locale tag
1801
+ * (`chart.setLocale('de')`) or any {@link LocalizationOptions} fields. Fields you pass
1802
+ * replace their current value (an explicit `undefined` restores the default); the
1803
+ * others are kept. The chart re-renders its text, axes and readouts in place (no
1804
+ * indicator re-run) and emits `locale:changed`. Register the locale's pack
1805
+ * (`registerLocale`) first for translated text.
1806
+ */
1807
+ setLocale(next: string | LocalizationOptions): this;
1808
+ /** Hand the renderer the translator and the root attributes the host asked for: `lang`
1809
+ * once a locale is set, `dir` once a direction is (unset, the host page decides). */
1810
+ private pushLocalization;
1768
1811
  /**
1769
1812
  * Register a scripting engine so `addIndicator({ language })` can run that
1770
1813
  * language. Vela ships NO engine — install the one you need (Pine Script:
@@ -1969,6 +2012,10 @@ interface WidgetContext {
1969
2012
  * (Dialog/Menu/Tooltip) from an action; without an explicit host they portal to
1970
2013
  * the body, OUTSIDE the theme variables. A multi-chart shell hands its own root. */
1971
2014
  host: HTMLElement;
2015
+ /** The shell's translator: `i18n.t(msg(...))` for text an action or panel renders,
2016
+ * `i18n.format` for its numbers and dates, `i18n.direction` for its layout. It follows
2017
+ * `setLocale`; listen to the shell's `locale:changed` to re-render. */
2018
+ i18n: Translator;
1972
2019
  /** The widget's feedback pill (bottom-center, auto-hides). */
1973
2020
  toast(message: string, kind?: 'info' | 'success' | 'error'): void;
1974
2021
  /** Add a SCRIPT indicator to the active chart THROUGH THE SHELL — unlike the raw
@@ -2037,8 +2084,9 @@ interface WidgetActionDescriptor {
2037
2084
  id: string;
2038
2085
  target: WidgetActionTarget;
2039
2086
  /** Always required, even icon-only: it is the button's aria-label and tooltip, the
2040
- * mobile drawer row's text, and the context-menu item's label. */
2041
- label: string;
2087
+ * mobile drawer row's text, and the context-menu item's label. A message
2088
+ * (`msg(id, 'English')`) follows the shell's language; a plain string shows as is. */
2089
+ label: MessageLike;
2042
2090
  /** Icon id from the `vela/ui` icon registry (register yours with `registerIcon`). */
2043
2091
  icon?: string;
2044
2092
  /** Topbar only: render the DESKTOP button icon-only, like the built-in tools — the
@@ -2104,7 +2152,7 @@ interface SidePanelHeader {
2104
2152
  slot: HTMLElement;
2105
2153
  /** Replace the header title (an empty string hides it). The topbar toggle keeps the
2106
2154
  * DECLARED `title` as its tooltip. */
2107
- setTitle(title: string): void;
2155
+ setTitle(title: MessageLike): void;
2108
2156
  /** Whether the panel covers every chart right now (see `maximizable`). */
2109
2157
  readonly maximized: boolean;
2110
2158
  /** Maximize the panel over the shell's charts, or restore it — what its header button
@@ -2124,8 +2172,8 @@ interface SidePanelHeader {
2124
2172
  interface SidePanelDescriptor {
2125
2173
  /** Stable id — re-registering an id replaces it. Also the key its width persists under. */
2126
2174
  id: string;
2127
- /** Header title, and the tooltip of its topbar button. */
2128
- title: string;
2175
+ /** Header title, and the tooltip of its topbar button. A message follows the shell's language. */
2176
+ title: MessageLike;
2129
2177
  /** Icon id from the `vela/ui` icon registry (register yours with `registerIcon`). */
2130
2178
  icon: string;
2131
2179
  /** Sort key among the panel buttons (ascending; default 100 — after the built-ins). */
@@ -2208,7 +2256,8 @@ interface LegendActionDescriptor {
2208
2256
  id: string;
2209
2257
  /** Icon id from the `vela/ui` icon registry (register yours with `registerIcon`). */
2210
2258
  icon: string;
2211
- tooltip: string;
2259
+ /** Hover text. A message follows the chart's language. */
2260
+ tooltip: MessageLike;
2212
2261
  /** Sort key within the contributed group (ascending; default 0). */
2213
2262
  order?: number;
2214
2263
  /** Per-indicator gate — omitted ⇒ shown on every row. */
@@ -2225,10 +2274,10 @@ declare function legendActions(): LegendActionDescriptor[];
2225
2274
  * indicator — the same signature as a legend action's `run`. */
2226
2275
  type LegendCalloutItem = {
2227
2276
  type: 'text';
2228
- text: string;
2277
+ text: MessageLike;
2229
2278
  } | {
2230
2279
  type: 'button';
2231
- label: string;
2280
+ label: MessageLike;
2232
2281
  /** Emphasized (selection-colored) button — the panel's main action. */
2233
2282
  primary?: boolean;
2234
2283
  /** Close the panel after `run` (default true). */
@@ -2237,7 +2286,7 @@ type LegendCalloutItem = {
2237
2286
  };
2238
2287
  /** The panel a clickable callout deploys: an optional heading over ordered blocks. */
2239
2288
  interface LegendCalloutContent {
2240
- title?: string;
2289
+ title?: MessageLike;
2241
2290
  items: LegendCalloutItem[];
2242
2291
  }
2243
2292
  /** A callout's resolved presentation for one row — what {@link LegendCalloutDescriptor.callout} returns. */
@@ -2248,8 +2297,8 @@ interface LegendCalloutSpec {
2248
2297
  background: string;
2249
2298
  /** Icon ink (default: the legend row's text color). */
2250
2299
  color?: string;
2251
- /** Hover text; also the bubble's accessible name. */
2252
- tooltip: string;
2300
+ /** Hover text; also the bubble's accessible name. A message follows the chart's language. */
2301
+ tooltip: MessageLike;
2253
2302
  /** Deployed panel — presence makes the bubble clickable. */
2254
2303
  content?: LegendCalloutContent;
2255
2304
  }