@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
package/dist/widget.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { V as Vela, W as WidgetContext, a1 as SidePanelButton } from './contributions-P9fBBuY1.js';
2
- export { C as CellStateContext, i as ContextMenuPointer, aJ as DEFAULT_PANEL_ORDER, E as ExternalIndicatorEntry, O as OVERRIDABLE_TOPBAR_IDS, a2 as SidePanelDescriptor, a3 as SidePanelHandle, a5 as StatePersistenceHandler, a9 as SymbolRankingHook, ad as WidgetActionDescriptor, ae as WidgetActionTarget, af as WidgetAttachment, ap as registerSidePanel, aq as registerStatePersistence, ar as registerSymbolRanking, as as registerWidgetAction, at as registerWidgetAttachment, av as sidePanels, aw as statePersistenceHandlers, ax as symbolRanking, ay as topbarActionOverride, aD as unregisterSidePanel, aE as unregisterStatePersistence, aF as unregisterWidgetAction, aG as unregisterWidgetAttachment, aH as widgetActions, aI as widgetAttachments } from './contributions-P9fBBuY1.js';
3
- import { b as VelaOptions, d as MarketSession, T as ThemeName, c as VelaTheme, v as DataWindowReadout } from './options-BI5Tp32b.js';
4
- import { c as VelaShellOptions, W as WidgetHistory, b as RangePreset, f as WorkspaceState, j as TopbarComposition, a as StatuslinePart, P as PanelsState } from './statusline-model-D9kWC9X5.js';
5
- export { B as Bottombar, k as BottombarOptions, C as CellState, g as ChartState, D as DrawingToolsState, I as IndicatorLoader, l as IndicatorManifest, m as IndicatorManifestEntry, n as RANGE_PRESETS, R as ResolvedIndicator, o as ResolvedTopbarComposition, p as TOPBAR_BUILTIN_IDS, q as TOPBAR_DEFAULT_LEFT, r as TOPBAR_DEFAULT_RIGHT, V as VelaStorage, t as WidgetStorage, h as decodeState, i as encodeState, u as localStorageAdapter, v as pinnedTopbarActionIds, w as resolveIndicators, x as resolveTopbarComposition, s as sanitizeState, y as topbarHas } from './statusline-model-D9kWC9X5.js';
6
- import { K as KeymapManager } from './keymap-CGOz5F5f.js';
7
- import { a as SymbolDescriptor } from './DataProvider-BUdlkx9I.js';
8
- import { d as SidePanel } from './side-panel-_2UK1gSm.js';
9
- export { C as CONTEXT_MENU_BUILTIN_ORDER, D as DEFAULT_PANEL_MAX_WIDTH, a as DEFAULT_PANEL_MIN_WIDTH, b as DEFAULT_PANEL_WIDTH, S as SidePanelOptions, c as clampPanelWidth } from './side-panel-_2UK1gSm.js';
1
+ import { V as Vela, W as WidgetContext, a1 as SidePanelButton } from './contributions-BfBaF6eE.js';
2
+ export { C as CellStateContext, i as ContextMenuPointer, aJ as DEFAULT_PANEL_ORDER, E as ExternalIndicatorEntry, O as OVERRIDABLE_TOPBAR_IDS, a2 as SidePanelDescriptor, a3 as SidePanelHandle, a5 as StatePersistenceHandler, a9 as SymbolRankingHook, ad as WidgetActionDescriptor, ae as WidgetActionTarget, af as WidgetAttachment, ap as registerSidePanel, aq as registerStatePersistence, ar as registerSymbolRanking, as as registerWidgetAction, at as registerWidgetAttachment, av as sidePanels, aw as statePersistenceHandlers, ax as symbolRanking, ay as topbarActionOverride, aD as unregisterSidePanel, aE as unregisterStatePersistence, aF as unregisterWidgetAction, aG as unregisterWidgetAttachment, aH as widgetActions, aI as widgetAttachments } from './contributions-BfBaF6eE.js';
3
+ import { b as VelaOptions, d as MarketSession, T as ThemeName, c as VelaTheme, w as DataWindowReadout } from './options-B7aL1pbf.js';
4
+ import { c as VelaShellOptions, W as WidgetHistory, b as RangePreset, f as WorkspaceState, j as TopbarComposition, a as StatuslinePart, P as PanelsState } from './statusline-model-Dfb_GD9u.js';
5
+ export { B as Bottombar, k as BottombarOptions, C as CellState, g as ChartState, D as DrawingToolsState, I as IndicatorLoader, l as IndicatorManifest, m as IndicatorManifestEntry, n as RANGE_PRESETS, R as ResolvedIndicator, o as ResolvedTopbarComposition, p as TOPBAR_BUILTIN_IDS, q as TOPBAR_DEFAULT_LEFT, r as TOPBAR_DEFAULT_RIGHT, V as VelaStorage, t as WidgetStorage, h as decodeState, i as encodeState, u as localStorageAdapter, v as pinnedTopbarActionIds, w as resolveIndicators, x as resolveTopbarComposition, s as sanitizeState, y as topbarHas } from './statusline-model-Dfb_GD9u.js';
6
+ import { K as KeymapManager } from './keymap-C48ughm6.js';
7
+ import { T as Translator, b as LocalizationOptions, c as LocaleChangedEvent, M as MessageLike, i as MessageDescriptor } from './types-Bwf63xGI.js';
8
+ import { a as SymbolDescriptor } from './DataProvider-CPFgSyAm.js';
9
+ import { d as SidePanel } from './side-panel-Ud0SBAnE.js';
10
+ export { C as CONTEXT_MENU_BUILTIN_ORDER, D as DEFAULT_PANEL_MAX_WIDTH, a as DEFAULT_PANEL_MIN_WIDTH, b as DEFAULT_PANEL_WIDTH, S as SidePanelOptions, c as clampPanelWidth } from './side-panel-Ud0SBAnE.js';
10
11
 
11
12
  interface VelaWidgetOptions extends VelaOptions, VelaShellOptions {
12
13
  /** @deprecated No longer supported — the option is ignored (a console warning
@@ -41,13 +42,18 @@ declare class VelaWidget {
41
42
  setIndicatorValuesVisible(visible: boolean): void;
42
43
  setTheme(theme: ThemeName | VelaTheme): void;
43
44
  setTimezone(zone: string): void;
45
+ /** The widget's translator (see `VelaWorkspace.i18n`). */
46
+ get i18n(): Translator;
47
+ /** Change the language, direction or formatting at runtime (see `VelaWorkspace.setLocale`). */
48
+ setLocale(next: string | LocalizationOptions): void;
44
49
  applyRange(preset: RangePreset): void;
45
50
  /** The unified state document (`layout: '1'`, one cell). */
46
51
  getState(): WorkspaceState;
47
52
  /** Restore a state document IN PLACE — the chart instance survives. */
48
53
  applyState(state: unknown): void;
49
- /** Subscribe to `state:changed` (the only widget event — unknown names no-op). */
54
+ /** Subscribe to `state:changed` or `locale:changed` (unknown names no-op). */
50
55
  on(event: 'state:changed', handler: () => void): () => void;
56
+ on(event: 'locale:changed', handler: (payload: LocaleChangedEvent) => void): () => void;
51
57
  destroy(): void;
52
58
  }
53
59
 
@@ -57,7 +63,8 @@ type LayoutPickerShape = {
57
63
  cols: number;
58
64
  };
59
65
 
60
- declare function priceStyleLabel(id: string): string;
66
+ /** A price style's name, in `i18n`'s language (English without one). */
67
+ declare function priceStyleLabel(id: string, i18n?: Translator | null): string;
61
68
  interface TopbarOptions {
62
69
  symbol: string;
63
70
  onSymbolClick?: () => void;
@@ -112,6 +119,8 @@ interface TopbarOptions {
112
119
  * The shell that owns this bar also gates the matching mobile entries and
113
120
  * keyboard chords on the same composition — the bar only handles its own DOM. */
114
121
  composition?: TopbarComposition;
122
+ /** The shell's translator (labels, tooltips, menus). Absent: English. */
123
+ i18n?: Translator;
115
124
  }
116
125
  declare class Topbar {
117
126
  readonly el: HTMLElement;
@@ -160,6 +169,10 @@ declare class Topbar {
160
169
  private readonly onHairlineSync;
161
170
  private hairlineRo;
162
171
  private hairlineRaf;
172
+ /** Re-apply each fixed label in the current language (see {@link relocalize}). */
173
+ private readonly relabels;
174
+ private get i18n();
175
+ private t;
163
176
  constructor(host: HTMLElement, opts: TopbarOptions);
164
177
  setSymbol(symbol: string): void;
165
178
  setTimeframe(tf: string): void;
@@ -193,6 +206,10 @@ declare class Topbar {
193
206
  destroy(): void;
194
207
  /** One icon-only tool button with its kit tooltip, parked in `sink` for disposal. */
195
208
  private toolButton;
209
+ /** A kit tooltip whose text follows the language. */
210
+ private labeledTooltip;
211
+ /** Re-read every label, tooltip and menu in the current language. */
212
+ relocalize(): void;
196
213
  /** Paint each `.vela-sep` as exactly one device pixel, snapped to the pixel grid. */
197
214
  private syncHairlines;
198
215
  private tfItems;
@@ -271,6 +288,10 @@ declare class Statusline {
271
288
  private fitKey;
272
289
  /** Web fonts landing after the last fit change every width without a resize. */
273
290
  private readonly onFontsLoaded;
291
+ /** The bound chart's translator (English until {@link onChart}). */
292
+ private i18n;
293
+ private meta;
294
+ private t;
274
295
  constructor(host: HTMLElement, symbol: string,
275
296
  /** The avatar's icon URL for a raw symbol — the shell routes it to the owning
276
297
  * provider's `resolveSymbolIcon`. Absent ⇒ the initials badge. */
@@ -308,6 +329,8 @@ declare class Statusline {
308
329
  }) => boolean) | null, readout?: StatuslineReadout): void;
309
330
  /** The "· BINANCE · 1h" segment after the symbol — venue first, then resolution. */
310
331
  setMeta(timeframe: string, provider: string): void;
332
+ /** Re-read every label and value in the chart's language. */
333
+ relocalize(): void;
311
334
  /** Dress the market badge for a session state: its icon, tinted circle, and the
312
335
  * hover label. Callers with no session model leave the constructor's 'open'. */
313
336
  setMarketStatus(status: MarketStatus): void;
@@ -348,6 +371,7 @@ declare class Statusline {
348
371
  }
349
372
 
350
373
  declare class Watermark {
374
+ private readonly i18n;
351
375
  readonly el: HTMLElement;
352
376
  private readonly text;
353
377
  private readonly replayLine;
@@ -362,7 +386,11 @@ declare class Watermark {
362
386
  * canvas, so the mark stays out of its way. Starts true: the FIRST `load:start`
363
387
  * fires during chart construction, before any subscriber can see it. */
364
388
  private loading;
365
- constructor(host: HTMLElement, symbol: string, timeframe: string);
389
+ private readonly replayText;
390
+ private symbol;
391
+ private timeframe;
392
+ /** `i18n` reads the chart's translator (absent: English). */
393
+ constructor(host: HTMLElement, symbol: string, timeframe: string, i18n?: () => Translator | null | undefined);
366
394
  setVisible(visible: boolean): void;
367
395
  /** Show/hide the replay line (the host's toggle); it only ever shows while replaying. */
368
396
  setReplayVisible(visible: boolean): void;
@@ -372,6 +400,8 @@ declare class Watermark {
372
400
  setLoading(loading: boolean): void;
373
401
  private sync;
374
402
  update(symbol: string, timeframe: string): void;
403
+ /** Re-read the mark and the replay line in the chart's language. */
404
+ relocalize(): void;
375
405
  /** Measure the text at the cap and shrink it to the price pane's width. */
376
406
  private fit;
377
407
  destroy(): void;
@@ -388,6 +418,8 @@ interface SymbolPickerOptions {
388
418
  /** The row's icon URL — routed to the descriptor's OWNING provider
389
419
  * (`resolveSymbolIcon`). Absent or `undefined` per row ⇒ the initials badge. */
390
420
  iconFor?: (d: SymbolDescriptor) => string | undefined;
421
+ /** The shell's translator. Absent: English. */
422
+ i18n?: Translator;
391
423
  }
392
424
  declare class SymbolPicker {
393
425
  private readonly opts;
@@ -399,6 +431,7 @@ declare class SymbolPicker {
399
431
  private highlighted;
400
432
  private seed;
401
433
  private activeTab;
434
+ private readonly tabButtons;
402
435
  private tabs;
403
436
  private visible;
404
437
  /** The last filter pass returned fewer raw rows than asked — the pool is drained
@@ -434,6 +467,8 @@ declare class SymbolPicker {
434
467
  * keystroke; an async hook resolves onto the next repaint (stale-while-revalidate
435
468
  * in between, the raw pool before the first resolve). */
436
469
  private pool;
470
+ /** The dialog's fixed text in the shell's language, re-read on every open. */
471
+ relabel(): void;
437
472
  private computeRows;
438
473
  private refresh;
439
474
  /** Append the page the grown `visible` just uncovered — rows already on screen stay put. */
@@ -442,7 +477,12 @@ declare class SymbolPicker {
442
477
  }
443
478
 
444
479
  interface IndicatorRow {
480
+ /** The name the picker shows, in the shell's language. */
445
481
  name: string;
482
+ /** Other names search matches: the English name when {@link name} is a translation, and
483
+ * the short title (`RSI`) in both languages. A reader of any language still finds an
484
+ * indicator by the names its literature uses. */
485
+ aliases?: readonly string[];
446
486
  language?: string;
447
487
  category?: string;
448
488
  /** Core-computed (native) indicator — accent styling + 'native' routing. */
@@ -461,6 +501,8 @@ interface IndicatorPickerOptions {
461
501
  onRemove: (instanceIndex: number) => void;
462
502
  onOpenChange?: (open: boolean) => void;
463
503
  host?: HTMLElement;
504
+ /** The shell's translator. Absent: English. */
505
+ i18n?: Translator;
464
506
  }
465
507
  declare class IndicatorPicker {
466
508
  private readonly dialog;
@@ -470,6 +512,9 @@ declare class IndicatorPicker {
470
512
  private isOpen;
471
513
  constructor(opts: IndicatorPickerOptions);
472
514
  open(): void;
515
+ /** The dialog's fixed text in the shell's language, re-read on every open. */
516
+ relabel(): void;
517
+ private t;
473
518
  /** Re-render the lists if the dialog is open (async catalog updates land late). */
474
519
  sync(): void;
475
520
  close(): void;
@@ -481,12 +526,18 @@ interface TimeframeQuickOptions {
481
526
  onApply: (canonical: string) => void;
482
527
  onOpenChange?: (open: boolean) => void;
483
528
  host?: HTMLElement;
529
+ /** The shell's translator. Absent: English. */
530
+ i18n?: Translator;
484
531
  }
485
532
  declare class TimeframeQuick {
486
533
  private readonly dialog;
487
534
  private readonly input;
488
535
  private readonly hint;
536
+ private readonly i18n;
537
+ private t;
489
538
  constructor(opts: TimeframeQuickOptions);
539
+ /** The dialog's title in the shell's language, re-read on every open. */
540
+ relabel(): void;
490
541
  open(seed?: string): void;
491
542
  get isOpen(): boolean;
492
543
  /** Text typed at the entry that never reached its field: closed, it opens seeded
@@ -511,11 +562,13 @@ interface PanelDockDeps {
511
562
  context(): WidgetContext;
512
563
  /** The dock's persistable state changed (open panel, or a width). */
513
564
  changed?(): void;
565
+ /** The shell's translator (panel titles). Absent: English. */
566
+ i18n?: Translator;
514
567
  }
515
568
  /** A panel the SHELL owns and destroys — the dock only docks it. */
516
569
  interface BuiltInPanel {
517
570
  id: string;
518
- title: string;
571
+ title: MessageLike;
519
572
  icon: string;
520
573
  order: number;
521
574
  panel: SidePanel;
@@ -552,6 +605,8 @@ declare class PanelDock {
552
605
  /** The docked panels in dock order — what a non-topbar chrome (the mobile
553
606
  * three-dots drawer) lists so every panel stays reachable there too. */
554
607
  list(): ReadonlyArray<SidePanelButton>;
608
+ /** Re-read every panel's header and the toggle tooltips in the current language. */
609
+ relocalize(): void;
555
610
  /** The dock's persistable state, or null when there is nothing worth saving. */
556
611
  getState(): PanelsState | null;
557
612
  /**
@@ -608,7 +663,9 @@ declare class ObjectTree extends SidePanel {
608
663
  constructor(host: HTMLElement,
609
664
  /** The price row's avatar icon URL for a raw symbol — routed by the shell to the
610
665
  * owning provider's `resolveSymbolIcon`. Absent ⇒ the initials badge. */
611
- iconFor?: ((symbol: string) => string | undefined) | undefined);
666
+ iconFor?: ((symbol: string) => string | undefined) | undefined,
667
+ /** The shell's translator. Absent: English. */
668
+ i18n?: Translator);
612
669
  toggle(open?: boolean, instant?: boolean): void;
613
670
  setSymbol(symbol: string): void;
614
671
  /** (Re)bind to a chart instance — called after every widget rebuild. */
@@ -617,6 +674,7 @@ declare class ObjectTree extends SidePanel {
617
674
  private detach;
618
675
  /** Read the chart into the layout's input. Every chart query happens here, once a pass. */
619
676
  private snapshot;
677
+ relocalize(): void;
620
678
  /**
621
679
  * Repaint because something changed — unless the panel is mid-interaction. A live drag
622
680
  * resolves drops against the rows as currently rendered, and a rename lives in an input
@@ -742,15 +800,16 @@ interface DataWindowSection {
742
800
  * direction), then one section per indicator with a line per plot in the plot's own color.
743
801
  * Empty when the chart holds no bar to read.
744
802
  */
745
- declare function dataWindowSections(readout: DataWindowReadout): DataWindowSection[];
803
+ declare function dataWindowSections(readout: DataWindowReadout, i18n?: Translator | null): DataWindowSection[];
746
804
  declare class DataWindow extends SidePanel {
747
805
  private chart;
748
806
  private unsubs;
749
- constructor(host: HTMLElement);
807
+ constructor(host: HTMLElement, i18n?: Translator);
750
808
  toggle(open?: boolean, instant?: boolean): void;
751
809
  /** (Re)bind to a chart instance — called after every widget rebuild. */
752
810
  onChart(chart: Vela): void;
753
811
  destroy(): void;
812
+ relocalize(): void;
754
813
  private detach;
755
814
  private refresh;
756
815
  }
@@ -759,7 +818,9 @@ declare class ShortcutsHelp {
759
818
  private readonly dialog;
760
819
  private readonly list;
761
820
  private readonly keymap;
762
- constructor(keymap: KeymapManager, host?: HTMLElement, onOpenChange?: (open: boolean) => void);
821
+ private readonly i18n;
822
+ /** `i18n` returns the shell's current translator; the panel reads it each time it opens. */
823
+ constructor(keymap: KeymapManager, host?: HTMLElement, onOpenChange?: (open: boolean) => void, i18n?: () => Translator);
763
824
  open(): void;
764
825
  close(): void;
765
826
  destroy(): void;
@@ -821,33 +882,46 @@ interface ParsedTimeframe {
821
882
  /** Compact chip ("3M"). */
822
883
  short?: string;
823
884
  }
824
- /** Parse a typed timeframe string. `valid` is false for empty/garbage input (count ≥ 1). */
825
- declare function parseTimeframe(text: string): ParsedTimeframe;
885
+ /** Parse a typed timeframe string. `valid` is false for empty/garbage input (count ≥ 1).
886
+ * The labels read in `i18n`'s language (English without one). */
887
+ declare function parseTimeframe(text: string, i18n?: Translator | null): ParsedTimeframe;
826
888
  /** Duration in ms of an existing timeframe value (`1`, `60`, `4h`, `D`, `W`, …), NaN if unknown. */
827
889
  declare function timeframeMs(value: string): number;
828
- /** Compact display label for any timeframe value ("60" → "1h", "D" → "1D"). */
829
- declare function timeframeLabel(value: string): string;
890
+ /** Compact display label for any timeframe value ("60" → "1h", "D" → "1D"), in `i18n`'s
891
+ * language (English without one). */
892
+ declare function timeframeLabel(value: string, i18n?: Translator | null): string;
830
893
 
831
894
  interface TimezoneEntry {
832
895
  value: string;
896
+ /** The place the zone is named after, in English. */
833
897
  label: string;
898
+ /** The same name as a message, for pickers in other languages. */
899
+ name: MessageDescriptor;
834
900
  }
835
901
  declare const TIMEZONES: readonly TimezoneEntry[];
836
902
  /** The renderer's config default is the bare `'UTC'` alias — fold it (and any other
837
903
  * UTC spelling) onto the catalog's `'Etc/UTC'` so selection checks land on one entry. */
838
904
  declare function normalizeTimezone(zone: string): string;
839
- /** Current UTC offset of an IANA zone as `"UTC"`, `"UTC+2"` or `"UTC-9:30"`. */
905
+ /** Current UTC offset of an IANA zone as `"UTC"`, `"UTC+2"` or `"UTC-9:30"`. The
906
+ * formatter stays pinned to en-US whatever the chart's locale: the `GMT±h:mm` it emits is
907
+ * PARSED below, and a localized one could spell the offset differently. */
840
908
  declare function tzOffset(zone: string, date?: Date): string;
841
- /** Dropdown row label — UTC omits the offset prefix. */
842
- declare function tzMenuLabel(zone: string, location: string): string;
909
+ /** Dropdown row label — UTC omits the offset prefix. `location` is the zone's place name
910
+ * as the picker shows it; `i18n` places the offset the way its language writes it. */
911
+ declare function tzMenuLabel(zone: string, location: string, i18n?: Translator | null): string;
843
912
  /** Compact label for the bottom-bar button — just the offset ("UTC", "UTC+2", "UTC-9:30"). */
844
913
  declare function tzButtonLabel(zone: string): string;
845
914
 
846
915
  /** Sensible decimal count for a price magnitude (crypto-friendly). */
847
916
  declare function decimalsFor(ref: number): number;
848
- /** Locale-formatted price; `'—'` for null/non-finite. */
917
+ /** Locale-formatted price; `'—'` for null/non-finite.
918
+ * @deprecated English only. Format through the chart's translator:
919
+ * `chart.i18n.format.price(n, { decimals, grouping: true, surface: 'statusLine' })`. */
849
920
  declare function fmtPrice(n: number | null | undefined, dp?: number): string;
850
- /** Signed change + percent ("+123.45 (+1.23%)") from open→close; `''` when unavailable. */
921
+ /** Signed change + percent ("+123.45 (+1.23%)") from open→close; `''` when unavailable.
922
+ * @deprecated English only. Compose it from the chart's translator:
923
+ * `chart.i18n.format.price(diff, { decimals, grouping: true })` and
924
+ * `chart.i18n.format.percent(pct)`. */
851
925
  declare function fmtChange(open: number | null | undefined, close: number | null | undefined): string;
852
926
 
853
927
  export { type BuiltInPanel, ChartContextMenu, type ContextMenuCallbacks, DataWindow, type DataWindowLine, type DataWindowSection, IndicatorPicker, type IndicatorPickerOptions, type IndicatorRow, ObjectTree, type PanelChrome, PanelDock, type PanelDockDeps, PanelsState, type ParsedTimeframe, RangePreset, ShortcutsHelp, SidePanel, SidePanelButton, Statusline, type StatuslineMenuHooks, StatuslinePart, SymbolPicker, type SymbolPickerOptions, TIMEZONES, TimeframeQuick, type TimeframeQuickOptions, type TimezoneEntry, Topbar, TopbarComposition, type TopbarOptions, VelaShellOptions, VelaWidget, type VelaWidgetOptions, Watermark, WidgetContext, WorkspaceState, dataWindowSections, decimalsFor, filterSymbols, fmtChange, fmtPrice, normalizeTimezone, parseTimeframe, priceStyleLabel, timeframeLabel, timeframeMs, tzButtonLabel, tzMenuLabel, tzOffset };
package/dist/widget.js CHANGED
@@ -1,10 +1,10 @@
1
- import { VelaWorkspace } from './chunk-BN4DNS3O.js';
2
- export { Bottombar, ChartContextMenu, DataWindow, IndicatorPicker, ObjectTree, PanelDock, RANGE_PRESETS, ShortcutsHelp, Statusline, SymbolPicker, TimeframeQuick, Topbar, Watermark, dataWindowSections, decimalsFor, decodeState, encodeState, filterSymbols, fmtChange, fmtPrice, localStorageAdapter, parseTimeframe, priceStyleLabel, resolveIndicators, sanitizeState, timeframeLabel, timeframeMs } from './chunk-BN4DNS3O.js';
3
- import './chunk-QYIO37K7.js';
4
- export { CONTEXT_MENU_BUILTIN_ORDER, DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, OVERRIDABLE_TOPBAR_IDS, SidePanel, TIMEZONES, TOPBAR_BUILTIN_IDS, TOPBAR_DEFAULT_LEFT, TOPBAR_DEFAULT_RIGHT, clampPanelWidth, normalizeTimezone, pinnedTopbarActionIds, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, resolveTopbarComposition, sidePanels, statePersistenceHandlers, symbolRanking, topbarActionOverride, topbarHas, tzButtonLabel, tzMenuLabel, tzOffset, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-ALTGHKIM.js';
5
- import './chunk-AUOB7A5Y.js';
6
- import './chunk-WY5H4S4I.js';
7
- import './chunk-I2U4NZD2.js';
1
+ import { VelaWorkspace } from './chunk-BLVL7WXF.js';
2
+ export { Bottombar, ChartContextMenu, DataWindow, IndicatorPicker, ObjectTree, PanelDock, RANGE_PRESETS, ShortcutsHelp, Statusline, SymbolPicker, TimeframeQuick, Topbar, Watermark, dataWindowSections, decimalsFor, decodeState, encodeState, filterSymbols, fmtChange, fmtPrice, localStorageAdapter, parseTimeframe, priceStyleLabel, resolveIndicators, sanitizeState, timeframeLabel, timeframeMs } from './chunk-BLVL7WXF.js';
3
+ import './chunk-3H6JO4VL.js';
4
+ export { CONTEXT_MENU_BUILTIN_ORDER, DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, OVERRIDABLE_TOPBAR_IDS, SidePanel, TIMEZONES, TOPBAR_BUILTIN_IDS, TOPBAR_DEFAULT_LEFT, TOPBAR_DEFAULT_RIGHT, clampPanelWidth, normalizeTimezone, pinnedTopbarActionIds, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, resolveTopbarComposition, sidePanels, statePersistenceHandlers, symbolRanking, topbarActionOverride, topbarHas, tzButtonLabel, tzMenuLabel, tzOffset, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-Q7POFYNE.js';
5
+ import './chunk-WHPQQYH7.js';
6
+ import './chunk-PZN4RS4T.js';
7
+ import './chunk-O6L27KRB.js';
8
8
  import './chunk-W4EJWLEO.js';
9
9
 
10
10
  // src/widget/VelaWidget.ts
@@ -14,7 +14,7 @@ var VelaWidget = class {
14
14
  if (!deprecationWarned) {
15
15
  deprecationWarned = true;
16
16
  console.warn(
17
- "[vela] VelaWidget is deprecated and will be removed in a future release. Use `new VelaWorkspace(container, { ...options, layout: false })` \u2014 pass `persist: 'vela-widget'` to keep the same stored state. " + (opts.urlState ? "The `urlState` option is no longer supported and was ignored." : "")
17
+ "[vela] VelaWidget is deprecated and will be removed in a future release. Use `new VelaWorkspace(container, { ...options, layout: false })` — pass `persist: 'vela-widget'` to keep the same stored state. " + (opts.urlState ? "The `urlState` option is no longer supported and was ignored." : "")
18
18
  );
19
19
  }
20
20
  const { urlState: _urlState, height: _height, persist, ...rest } = opts;
@@ -75,6 +75,14 @@ var VelaWidget = class {
75
75
  setTimezone(zone) {
76
76
  this.ws.setTimezone(zone);
77
77
  }
78
+ /** The widget's translator (see `VelaWorkspace.i18n`). */
79
+ get i18n() {
80
+ return this.ws.i18n;
81
+ }
82
+ /** Change the language, direction or formatting at runtime (see `VelaWorkspace.setLocale`). */
83
+ setLocale(next) {
84
+ this.ws.setLocale(next);
85
+ }
78
86
  applyRange(preset) {
79
87
  this.ws.active.applyRange(preset);
80
88
  }
@@ -86,10 +94,10 @@ var VelaWidget = class {
86
94
  applyState(state) {
87
95
  this.ws.applyState(state);
88
96
  }
89
- /** Subscribe to `state:changed` (the only widget event — unknown names no-op). */
90
97
  on(event, handler) {
91
- if (event !== "state:changed") return () => void 0;
92
- return this.ws.on("state:changed", handler);
98
+ if (event === "state:changed") return this.ws.on("state:changed", handler);
99
+ if (event === "locale:changed") return this.ws.on("locale:changed", handler);
100
+ return () => void 0;
93
101
  }
94
102
  destroy() {
95
103
  this.ws.destroy();