@luxalgo/vela 0.8.5 → 0.9.0

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-BUdlkx9I.d.ts → DataProvider-BGlB1zSc.d.ts} +1 -1
  2. package/dist/{DataProvider-DdqMxKdl.d.cts → DataProvider-zJGp58kb.d.cts} +1 -1
  3. package/dist/{chunk-BN4DNS3O.js → chunk-4WAHYL7Y.js} +1125 -468
  4. package/dist/chunk-O6L27KRB.js +1331 -0
  5. package/dist/{chunk-WY5H4S4I.js → chunk-PZN4RS4T.js} +91 -36
  6. package/dist/{chunk-AUOB7A5Y.js → chunk-WHPQQYH7.js} +29 -13
  7. package/dist/{chunk-QYIO37K7.js → chunk-XIRSR3D6.js} +2374 -1529
  8. package/dist/{chunk-ALTGHKIM.js → chunk-YRCL3WMD.js} +510 -406
  9. package/dist/{contributions-D8xuYc9U.d.cts → contributions-BjefWpxQ.d.ts} +71 -22
  10. package/dist/{contributions-P9fBBuY1.d.ts → contributions-CpCJisTC.d.cts} +71 -22
  11. package/dist/index.cjs +4022 -2088
  12. package/dist/index.d.cts +51 -25
  13. package/dist/index.d.ts +51 -25
  14. package/dist/index.js +5 -5
  15. package/dist/{keymap-CGOz5F5f.d.ts → keymap-B9_FLhfJ.d.cts} +9 -6
  16. package/dist/{keymap-CGOz5F5f.d.cts → keymap-UolhuXH1.d.ts} +9 -6
  17. package/dist/locales/ar.cjs +2260 -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 +2258 -0
  21. package/dist/locales/de.cjs +2260 -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 +2258 -0
  25. package/dist/locales/en.cjs +2260 -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 +2258 -0
  29. package/dist/locales/es.cjs +2260 -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 +2258 -0
  33. package/dist/locales/fr.cjs +2260 -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 +2258 -0
  37. package/dist/locales/he.cjs +2260 -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 +2258 -0
  41. package/dist/locales/hi.cjs +2260 -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 +2258 -0
  45. package/dist/locales/id.cjs +2260 -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 +2258 -0
  49. package/dist/locales/it.cjs +2260 -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 +2258 -0
  53. package/dist/locales/ja.cjs +2260 -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 +2258 -0
  57. package/dist/locales/ko.cjs +2260 -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 +2258 -0
  61. package/dist/locales/ms.cjs +2260 -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 +2258 -0
  65. package/dist/locales/pl.cjs +2260 -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 +2258 -0
  69. package/dist/locales/pt-BR.cjs +2260 -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 +2258 -0
  73. package/dist/locales/ru.cjs +2260 -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 +2258 -0
  77. package/dist/locales/th.cjs +2260 -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 +2258 -0
  81. package/dist/locales/tr.cjs +2260 -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 +2258 -0
  85. package/dist/locales/vi.cjs +2260 -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 +2258 -0
  89. package/dist/locales/zh-Hans.cjs +2260 -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 +2258 -0
  93. package/dist/locales/zh-Hant.cjs +2260 -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 +2258 -0
  97. package/dist/{options-BI5Tp32b.d.cts → options-CpegHml_.d.cts} +74 -9
  98. package/dist/{options-BI5Tp32b.d.ts → options-D4L3_hv_.d.ts} +74 -9
  99. package/dist/{plugin-D5Z-Q6TX.d.ts → plugin-DTmulpKM.d.ts} +81 -35
  100. package/dist/{plugin-B8F1nor8.d.cts → plugin-DpNp4aBi.d.cts} +81 -35
  101. package/dist/plugin.cjs +1267 -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-BqUnpfev.d.cts} +13 -2
  118. package/dist/{side-panel-_2UK1gSm.d.cts → side-panel-CYmH1Opm.d.ts} +13 -2
  119. package/dist/{statusline-model-CTwtDIca.d.cts → statusline-model-C3yIY9WE.d.ts} +11 -3
  120. package/dist/{statusline-model-D9kWC9X5.d.ts → statusline-model-pGs3Xvp-.d.cts} +11 -3
  121. package/dist/types-BlrXRLIR.d.cts +2515 -0
  122. package/dist/types-BlrXRLIR.d.ts +2515 -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 +3987 -2055
  128. package/dist/vela.global.min.js +57 -57
  129. package/dist/widget.cjs +5330 -2699
  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 +5319 -2706
  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,9 +1,10 @@
1
- import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, I as InputValue, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-BI5Tp32b.cjs';
2
- import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-CTwtDIca.cjs';
3
- export { g as ChartState, D as DrawingToolsState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-CTwtDIca.cjs';
4
- import { K as KeymapManager } from './keymap-CGOz5F5f.cjs';
5
- import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, E as ExternalIndicatorEntry, R as ReplayState, a as ReplayBounds, b as VelaEventMap, c as ScriptRun } from './contributions-D8xuYc9U.cjs';
6
- import { M as MarketDataFeed } from './DataProvider-DdqMxKdl.cjs';
1
+ import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, I as InputValue, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-CpegHml_.cjs';
2
+ import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-pGs3Xvp-.cjs';
3
+ export { g as ChartState, D as DrawingToolsState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-pGs3Xvp-.cjs';
4
+ import { K as KeymapManager } from './keymap-B9_FLhfJ.cjs';
5
+ import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, E as ExternalIndicatorEntry, R as ReplayState, a as ReplayBounds, b as VelaEventMap, c as ScriptRun } from './contributions-CpCJisTC.cjs';
6
+ import { b as LocalizationOptions, M as MessageLike, T as Translator, c as LocaleChangedEvent } from './types-BlrXRLIR.cjs';
7
+ import { M as MarketDataFeed } from './DataProvider-zJGp58kb.cjs';
7
8
 
8
9
  /** The cells that follow `originId` under `setting` — PURE (never includes the origin). */
9
10
  declare function syncTargets(originId: string, setting: SyncSetting | undefined, cellIds: readonly string[]): string[];
@@ -81,6 +82,9 @@ interface CellDeps {
81
82
  engines: Record<string, () => ScriptingEngine>;
82
83
  /** The workspace's top-level chart options every cell's chart starts from. */
83
84
  chartDefaults: CellChartDefaults;
85
+ /** The workspace's CURRENT localization — a cell built after a `setLocale` starts in it
86
+ * (absent = the chart defaults: English). */
87
+ localization?(): LocalizationOptions;
84
88
  theme: VelaTheme;
85
89
  live: boolean;
86
90
  volume: boolean;
@@ -297,6 +301,9 @@ declare class ChartCell {
297
301
  /** The LIVE chart of this cell — never cache it across a layout change (the cell's
298
302
  * identity is what endures; the chart dies with the cell). */
299
303
  get chart(): Vela;
304
+ /** Re-read the cell's own chrome (status line, watermark, view controls, settings rows,
305
+ * native indicator names) in the chart's language, after `chart.setLocale`. */
306
+ relocalize(): void;
300
307
  get symbol(): string;
301
308
  get timeframe(): string;
302
309
  get priceStyle(): string;
@@ -362,6 +369,7 @@ declare class ChartCell {
362
369
  * then the manifest in the host's own order. */
363
370
  libraryRows(): Array<{
364
371
  name: string;
372
+ aliases?: string[];
365
373
  language?: string;
366
374
  category?: string;
367
375
  native?: boolean;
@@ -371,6 +379,7 @@ declare class ChartCell {
371
379
  /** The picker's on-chart rows: native instances first, then live script instances. */
372
380
  onChartRows(): Array<{
373
381
  name: string;
382
+ aliases?: string[];
374
383
  language?: string;
375
384
  native?: boolean;
376
385
  nativeType?: string;
@@ -583,7 +592,7 @@ interface WorkspaceWidgetContext extends WidgetContext {
583
592
  interface LayoutDefinition {
584
593
  /** Stable id (`'4'`, `'2h'`, a plugin's `'6-tall'`, …) — re-registering replaces. */
585
594
  id: string;
586
- /** Human-readable label for layout pickers. */
595
+ /** Human-readable label for layout pickers, in the language it was read in. */
587
596
  label: string;
588
597
  /** Column track weights (`fr` units), left to right. */
589
598
  cols: number[];
@@ -606,13 +615,20 @@ interface LayoutDefinition {
606
615
  }>;
607
616
  }
608
617
 
618
+ /** What {@link registerLayout} takes: a definition whose label may be a message
619
+ * (`msg()`), read in each picker's language. */
620
+ type LayoutRegistration = Omit<LayoutDefinition, 'label'> & {
621
+ label: MessageLike;
622
+ };
609
623
  /** Register (or replace) a workspace layout. Pickers read the registry live. */
610
- declare function registerLayout(def: LayoutDefinition): void;
624
+ declare function registerLayout(def: LayoutRegistration): void;
611
625
  declare function unregisterLayout(id: string): void;
612
- /** The definition behind a layout id (undefined for unknown ids). */
613
- declare function layoutDefinition(id: string): LayoutDefinition | undefined;
614
- /** Every registered layout (registration order) — drives layout pickers. */
615
- declare function layouts(): LayoutDefinition[];
626
+ /** The definition behind a layout id (undefined for unknown ids), labelled in `i18n`'s
627
+ * language (English without one). Read it again after `locale:changed`. */
628
+ declare function layoutDefinition(id: string, i18n?: Translator | null): LayoutDefinition | undefined;
629
+ /** Every registered layout (registration order), labelled in `i18n`'s language (English
630
+ * without one) — drives layout pickers. Read it again after `locale:changed`. */
631
+ declare function layouts(i18n?: Translator | null): LayoutDefinition[];
616
632
  /** Register the built-in presets (idempotent — called by the workspace entry point). */
617
633
  declare function registerBuiltinLayouts(): void;
618
634
  /** Picker canvas bound — dynamic layouts stay within a 4×4 grid (16 cells, the
@@ -623,7 +639,7 @@ declare const GRID_PICKER_MAX = 4;
623
639
  * picker canvas. Geometry matching a registered classic preset returns that preset
624
640
  * (id `'4'`, `'2h'`, …); anything else synthesizes a `g<rows>x<cols>` definition.
625
641
  */
626
- declare function layoutForGrid(rows: number, cols: number): LayoutDefinition;
642
+ declare function layoutForGrid(rows: number, cols: number, i18n?: Translator | null): LayoutDefinition;
627
643
  /**
628
644
  * Resolve a layout id to its definition, synthesizing the picker's dynamic ids
629
645
  * (`g<rows>x<cols>`) when they are not registered — the boot path for persisted
@@ -745,6 +761,9 @@ interface WorkspaceEventMap extends Record<string, unknown> {
745
761
  /** The persistable state changed (debounced ~500ms) — re-pull `getState()` if you
746
762
  * consume it. The signal custom persistence flows build on. */
747
763
  'state:changed': undefined;
764
+ /** The workspace's localization changed (`setLocale`), after every cell and the shared
765
+ * chrome have re-rendered. */
766
+ 'locale:changed': LocaleChangedEvent;
748
767
  }
749
768
  declare class VelaWorkspace {
750
769
  readonly root: HTMLElement;
@@ -765,6 +784,8 @@ declare class VelaWorkspace {
765
784
  private readonly splitters;
766
785
  private readonly resizeObserver;
767
786
  private readonly opts;
787
+ /** The workspace's ONE localization — every cell's chart and the shared chrome follow it. */
788
+ private readonly localeState;
768
789
  private def;
769
790
  /** Cell identities by SLOT POSITION — `order[i]` lives in the layout's i-th slot.
770
791
  * Names come from the `cells` declaration order (then the persisted document);
@@ -782,7 +803,8 @@ declare class VelaWorkspace {
782
803
  * mobile drawings stop, no pill (the headless `chart.drawings` API stays). */
783
804
  private readonly drawingsEnabled;
784
805
  /** The shared bar's content — `drawings: { tools | groups }` picks it. */
785
- private readonly toolbarDef;
806
+ /** The shared toolbar, labelled in the workspace's language (rebuilt when it changes). */
807
+ private toolbarDef;
786
808
  private destroyed;
787
809
  private readonly topbar;
788
810
  private readonly bottombar;
@@ -914,6 +936,28 @@ declare class VelaWorkspace {
914
936
  private compositeLayoutShot;
915
937
  setActiveCell(id: string | null): void;
916
938
  on<K extends keyof WorkspaceEventMap>(event: K, handler: (payload: WorkspaceEventMap[K]) => void): () => void;
939
+ /**
940
+ * The workspace's translator: its resolved locale and direction, `t()` for messages and
941
+ * `format` for numbers and dates. Every cell's chart carries the same settings
942
+ * (`cell.chart.i18n`), and contributed actions read it as `ctx.i18n`. The same object
943
+ * for the workspace's lifetime; it reads the new settings after {@link setLocale}.
944
+ */
945
+ get i18n(): Translator;
946
+ /**
947
+ * Change the language, direction or formatting of the whole workspace at runtime — a
948
+ * locale tag (`ws.setLocale('de')`) or any {@link LocalizationOptions} fields. Fields
949
+ * you pass replace their current value (an explicit `undefined` restores the default);
950
+ * the others are kept. Every cell re-renders in place, the shared chrome follows, and
951
+ * `locale:changed` fires. Register the locale's pack (`registerLocale`) first for
952
+ * translated text.
953
+ */
954
+ setLocale(next: string | LocalizationOptions): void;
955
+ /** Re-read the shared chrome in the current language. Dialogs, menus and drawers read
956
+ * it on their next open; what stays on screen is relabeled here. */
957
+ private relocalizeChrome;
958
+ /** `lang` once the host set a locale, `dir` once it set a direction; otherwise the
959
+ * attributes stay off and the host page decides. */
960
+ private applyRootAttributes;
917
961
  /** The context handed to contributed actions/attachments (rebuilt per invocation). */
918
962
  context(): WorkspaceWidgetContext;
919
963
  /** Re-project contributed topbar actions + side panels, and mount late-registered attachments. */
@@ -1197,6 +1241,10 @@ declare class VelaWorkspace {
1197
1241
  private openMoreDrawer;
1198
1242
  /** The contributed topbar actions the mobile menu lists, from one cluster. */
1199
1243
  private drawerActions;
1244
+ /** Display text in the workspace's language. */
1245
+ private t;
1246
+ /** The layout SYNC switches (the topbar dropdown and the mobile drawer list the same). */
1247
+ private syncRows;
1200
1248
  private openTimezoneDrawer;
1201
1249
  private openPriceScaleDrawer;
1202
1250
  /** The aggregated alerts bell — entries carry their cell; selecting one activates it. */
@@ -1236,4 +1284,4 @@ declare function resizeTracks(weights: readonly number[], index: number, deltaPx
1236
1284
  */
1237
1285
  declare function trackOffsets(weights: readonly number[], sizePx: number, gapPx: number): number[];
1238
1286
 
1239
- export { type CellBoot, type CellChartDefaults, type CellNativeInfo, type CellSeed, CellState, ChartCell, GRID_PICKER_MAX, type LayoutDefinition, type LayoutShape, type PooledCellState, SyncKind, SyncOptions, SyncSetting, TrackSizes, VelaWorkspace, type VelaWorkspaceOptions, type WorkspaceEventMap, WorkspaceReplay, type WorkspaceReplayEventMap, type WorkspaceReplayHost, type WorkspaceReplayStartOptions, type WorkspaceScriptRun, WorkspaceState, type WorkspaceStorage, type WorkspaceWidgetContext, activeAfterLayout, barClose, ensureLayout, evenTracks, gridStyles, lastOpenClosedBy, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, syncTargets, trackOffsets, unregisterLayout };
1287
+ export { type CellBoot, type CellChartDefaults, type CellNativeInfo, type CellSeed, CellState, ChartCell, GRID_PICKER_MAX, type LayoutDefinition, type LayoutRegistration, type LayoutShape, type PooledCellState, SyncKind, SyncOptions, SyncSetting, TrackSizes, VelaWorkspace, type VelaWorkspaceOptions, type WorkspaceEventMap, WorkspaceReplay, type WorkspaceReplayEventMap, type WorkspaceReplayHost, type WorkspaceReplayStartOptions, type WorkspaceScriptRun, WorkspaceState, type WorkspaceStorage, type WorkspaceWidgetContext, activeAfterLayout, barClose, ensureLayout, evenTracks, gridStyles, lastOpenClosedBy, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, syncTargets, trackOffsets, unregisterLayout };
@@ -1,9 +1,10 @@
1
- import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, I as InputValue, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-BI5Tp32b.js';
2
- import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-D9kWC9X5.js';
3
- export { g as ChartState, D as DrawingToolsState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-D9kWC9X5.js';
4
- import { K as KeymapManager } from './keymap-CGOz5F5f.js';
5
- import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, E as ExternalIndicatorEntry, R as ReplayState, a as ReplayBounds, b as VelaEventMap, c as ScriptRun } from './contributions-P9fBBuY1.js';
6
- import { M as MarketDataFeed } from './DataProvider-BUdlkx9I.js';
1
+ import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, I as InputValue, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-D4L3_hv_.js';
2
+ import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-C3yIY9WE.js';
3
+ export { g as ChartState, D as DrawingToolsState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-C3yIY9WE.js';
4
+ import { K as KeymapManager } from './keymap-UolhuXH1.js';
5
+ import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, E as ExternalIndicatorEntry, R as ReplayState, a as ReplayBounds, b as VelaEventMap, c as ScriptRun } from './contributions-BjefWpxQ.js';
6
+ import { b as LocalizationOptions, M as MessageLike, T as Translator, c as LocaleChangedEvent } from './types-BlrXRLIR.js';
7
+ import { M as MarketDataFeed } from './DataProvider-BGlB1zSc.js';
7
8
 
8
9
  /** The cells that follow `originId` under `setting` — PURE (never includes the origin). */
9
10
  declare function syncTargets(originId: string, setting: SyncSetting | undefined, cellIds: readonly string[]): string[];
@@ -81,6 +82,9 @@ interface CellDeps {
81
82
  engines: Record<string, () => ScriptingEngine>;
82
83
  /** The workspace's top-level chart options every cell's chart starts from. */
83
84
  chartDefaults: CellChartDefaults;
85
+ /** The workspace's CURRENT localization — a cell built after a `setLocale` starts in it
86
+ * (absent = the chart defaults: English). */
87
+ localization?(): LocalizationOptions;
84
88
  theme: VelaTheme;
85
89
  live: boolean;
86
90
  volume: boolean;
@@ -297,6 +301,9 @@ declare class ChartCell {
297
301
  /** The LIVE chart of this cell — never cache it across a layout change (the cell's
298
302
  * identity is what endures; the chart dies with the cell). */
299
303
  get chart(): Vela;
304
+ /** Re-read the cell's own chrome (status line, watermark, view controls, settings rows,
305
+ * native indicator names) in the chart's language, after `chart.setLocale`. */
306
+ relocalize(): void;
300
307
  get symbol(): string;
301
308
  get timeframe(): string;
302
309
  get priceStyle(): string;
@@ -362,6 +369,7 @@ declare class ChartCell {
362
369
  * then the manifest in the host's own order. */
363
370
  libraryRows(): Array<{
364
371
  name: string;
372
+ aliases?: string[];
365
373
  language?: string;
366
374
  category?: string;
367
375
  native?: boolean;
@@ -371,6 +379,7 @@ declare class ChartCell {
371
379
  /** The picker's on-chart rows: native instances first, then live script instances. */
372
380
  onChartRows(): Array<{
373
381
  name: string;
382
+ aliases?: string[];
374
383
  language?: string;
375
384
  native?: boolean;
376
385
  nativeType?: string;
@@ -583,7 +592,7 @@ interface WorkspaceWidgetContext extends WidgetContext {
583
592
  interface LayoutDefinition {
584
593
  /** Stable id (`'4'`, `'2h'`, a plugin's `'6-tall'`, …) — re-registering replaces. */
585
594
  id: string;
586
- /** Human-readable label for layout pickers. */
595
+ /** Human-readable label for layout pickers, in the language it was read in. */
587
596
  label: string;
588
597
  /** Column track weights (`fr` units), left to right. */
589
598
  cols: number[];
@@ -606,13 +615,20 @@ interface LayoutDefinition {
606
615
  }>;
607
616
  }
608
617
 
618
+ /** What {@link registerLayout} takes: a definition whose label may be a message
619
+ * (`msg()`), read in each picker's language. */
620
+ type LayoutRegistration = Omit<LayoutDefinition, 'label'> & {
621
+ label: MessageLike;
622
+ };
609
623
  /** Register (or replace) a workspace layout. Pickers read the registry live. */
610
- declare function registerLayout(def: LayoutDefinition): void;
624
+ declare function registerLayout(def: LayoutRegistration): void;
611
625
  declare function unregisterLayout(id: string): void;
612
- /** The definition behind a layout id (undefined for unknown ids). */
613
- declare function layoutDefinition(id: string): LayoutDefinition | undefined;
614
- /** Every registered layout (registration order) — drives layout pickers. */
615
- declare function layouts(): LayoutDefinition[];
626
+ /** The definition behind a layout id (undefined for unknown ids), labelled in `i18n`'s
627
+ * language (English without one). Read it again after `locale:changed`. */
628
+ declare function layoutDefinition(id: string, i18n?: Translator | null): LayoutDefinition | undefined;
629
+ /** Every registered layout (registration order), labelled in `i18n`'s language (English
630
+ * without one) — drives layout pickers. Read it again after `locale:changed`. */
631
+ declare function layouts(i18n?: Translator | null): LayoutDefinition[];
616
632
  /** Register the built-in presets (idempotent — called by the workspace entry point). */
617
633
  declare function registerBuiltinLayouts(): void;
618
634
  /** Picker canvas bound — dynamic layouts stay within a 4×4 grid (16 cells, the
@@ -623,7 +639,7 @@ declare const GRID_PICKER_MAX = 4;
623
639
  * picker canvas. Geometry matching a registered classic preset returns that preset
624
640
  * (id `'4'`, `'2h'`, …); anything else synthesizes a `g<rows>x<cols>` definition.
625
641
  */
626
- declare function layoutForGrid(rows: number, cols: number): LayoutDefinition;
642
+ declare function layoutForGrid(rows: number, cols: number, i18n?: Translator | null): LayoutDefinition;
627
643
  /**
628
644
  * Resolve a layout id to its definition, synthesizing the picker's dynamic ids
629
645
  * (`g<rows>x<cols>`) when they are not registered — the boot path for persisted
@@ -745,6 +761,9 @@ interface WorkspaceEventMap extends Record<string, unknown> {
745
761
  /** The persistable state changed (debounced ~500ms) — re-pull `getState()` if you
746
762
  * consume it. The signal custom persistence flows build on. */
747
763
  'state:changed': undefined;
764
+ /** The workspace's localization changed (`setLocale`), after every cell and the shared
765
+ * chrome have re-rendered. */
766
+ 'locale:changed': LocaleChangedEvent;
748
767
  }
749
768
  declare class VelaWorkspace {
750
769
  readonly root: HTMLElement;
@@ -765,6 +784,8 @@ declare class VelaWorkspace {
765
784
  private readonly splitters;
766
785
  private readonly resizeObserver;
767
786
  private readonly opts;
787
+ /** The workspace's ONE localization — every cell's chart and the shared chrome follow it. */
788
+ private readonly localeState;
768
789
  private def;
769
790
  /** Cell identities by SLOT POSITION — `order[i]` lives in the layout's i-th slot.
770
791
  * Names come from the `cells` declaration order (then the persisted document);
@@ -782,7 +803,8 @@ declare class VelaWorkspace {
782
803
  * mobile drawings stop, no pill (the headless `chart.drawings` API stays). */
783
804
  private readonly drawingsEnabled;
784
805
  /** The shared bar's content — `drawings: { tools | groups }` picks it. */
785
- private readonly toolbarDef;
806
+ /** The shared toolbar, labelled in the workspace's language (rebuilt when it changes). */
807
+ private toolbarDef;
786
808
  private destroyed;
787
809
  private readonly topbar;
788
810
  private readonly bottombar;
@@ -914,6 +936,28 @@ declare class VelaWorkspace {
914
936
  private compositeLayoutShot;
915
937
  setActiveCell(id: string | null): void;
916
938
  on<K extends keyof WorkspaceEventMap>(event: K, handler: (payload: WorkspaceEventMap[K]) => void): () => void;
939
+ /**
940
+ * The workspace's translator: its resolved locale and direction, `t()` for messages and
941
+ * `format` for numbers and dates. Every cell's chart carries the same settings
942
+ * (`cell.chart.i18n`), and contributed actions read it as `ctx.i18n`. The same object
943
+ * for the workspace's lifetime; it reads the new settings after {@link setLocale}.
944
+ */
945
+ get i18n(): Translator;
946
+ /**
947
+ * Change the language, direction or formatting of the whole workspace at runtime — a
948
+ * locale tag (`ws.setLocale('de')`) or any {@link LocalizationOptions} fields. Fields
949
+ * you pass replace their current value (an explicit `undefined` restores the default);
950
+ * the others are kept. Every cell re-renders in place, the shared chrome follows, and
951
+ * `locale:changed` fires. Register the locale's pack (`registerLocale`) first for
952
+ * translated text.
953
+ */
954
+ setLocale(next: string | LocalizationOptions): void;
955
+ /** Re-read the shared chrome in the current language. Dialogs, menus and drawers read
956
+ * it on their next open; what stays on screen is relabeled here. */
957
+ private relocalizeChrome;
958
+ /** `lang` once the host set a locale, `dir` once it set a direction; otherwise the
959
+ * attributes stay off and the host page decides. */
960
+ private applyRootAttributes;
917
961
  /** The context handed to contributed actions/attachments (rebuilt per invocation). */
918
962
  context(): WorkspaceWidgetContext;
919
963
  /** Re-project contributed topbar actions + side panels, and mount late-registered attachments. */
@@ -1197,6 +1241,10 @@ declare class VelaWorkspace {
1197
1241
  private openMoreDrawer;
1198
1242
  /** The contributed topbar actions the mobile menu lists, from one cluster. */
1199
1243
  private drawerActions;
1244
+ /** Display text in the workspace's language. */
1245
+ private t;
1246
+ /** The layout SYNC switches (the topbar dropdown and the mobile drawer list the same). */
1247
+ private syncRows;
1200
1248
  private openTimezoneDrawer;
1201
1249
  private openPriceScaleDrawer;
1202
1250
  /** The aggregated alerts bell — entries carry their cell; selecting one activates it. */
@@ -1236,4 +1284,4 @@ declare function resizeTracks(weights: readonly number[], index: number, deltaPx
1236
1284
  */
1237
1285
  declare function trackOffsets(weights: readonly number[], sizePx: number, gapPx: number): number[];
1238
1286
 
1239
- export { type CellBoot, type CellChartDefaults, type CellNativeInfo, type CellSeed, CellState, ChartCell, GRID_PICKER_MAX, type LayoutDefinition, type LayoutShape, type PooledCellState, SyncKind, SyncOptions, SyncSetting, TrackSizes, VelaWorkspace, type VelaWorkspaceOptions, type WorkspaceEventMap, WorkspaceReplay, type WorkspaceReplayEventMap, type WorkspaceReplayHost, type WorkspaceReplayStartOptions, type WorkspaceScriptRun, WorkspaceState, type WorkspaceStorage, type WorkspaceWidgetContext, activeAfterLayout, barClose, ensureLayout, evenTracks, gridStyles, lastOpenClosedBy, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, syncTargets, trackOffsets, unregisterLayout };
1287
+ export { type CellBoot, type CellChartDefaults, type CellNativeInfo, type CellSeed, CellState, ChartCell, GRID_PICKER_MAX, type LayoutDefinition, type LayoutRegistration, type LayoutShape, type PooledCellState, SyncKind, SyncOptions, SyncSetting, TrackSizes, VelaWorkspace, type VelaWorkspaceOptions, type WorkspaceEventMap, WorkspaceReplay, type WorkspaceReplayEventMap, type WorkspaceReplayHost, type WorkspaceReplayStartOptions, type WorkspaceScriptRun, WorkspaceState, type WorkspaceStorage, type WorkspaceWidgetContext, activeAfterLayout, barClose, ensureLayout, evenTracks, gridStyles, lastOpenClosedBy, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, syncTargets, trackOffsets, unregisterLayout };
package/dist/workspace.js CHANGED
@@ -1,7 +1,7 @@
1
- export { ChartCell, GRID_PICKER_MAX, VelaWorkspace, WorkspaceReplay, activeAfterLayout, barClose, decodeState, encodeState, ensureLayout, evenTracks, gridStyles, lastOpenClosedBy, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, sanitizeState, syncTargets, trackOffsets, unregisterLayout } from './chunk-BN4DNS3O.js';
2
- import './chunk-QYIO37K7.js';
3
- import './chunk-ALTGHKIM.js';
4
- import './chunk-AUOB7A5Y.js';
5
- import './chunk-WY5H4S4I.js';
6
- import './chunk-I2U4NZD2.js';
1
+ export { ChartCell, GRID_PICKER_MAX, VelaWorkspace, WorkspaceReplay, activeAfterLayout, barClose, decodeState, encodeState, ensureLayout, evenTracks, gridStyles, lastOpenClosedBy, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, sanitizeState, syncTargets, trackOffsets, unregisterLayout } from './chunk-4WAHYL7Y.js';
2
+ import './chunk-XIRSR3D6.js';
3
+ import './chunk-YRCL3WMD.js';
4
+ import './chunk-WHPQQYH7.js';
5
+ import './chunk-PZN4RS4T.js';
6
+ import './chunk-O6L27KRB.js';
7
7
  import './chunk-W4EJWLEO.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxalgo/vela",
3
- "version": "0.8.5",
3
+ "version": "0.9.0",
4
4
  "description": "The open-source core of Vela by LuxAlgo: a charting library with a native high-performance renderer, drawing tools, pluggable chart types and pluggable scripting engines.",
5
5
  "keywords": [
6
6
  "charting library",
@@ -75,6 +75,11 @@
75
75
  "types": "./dist/workspace.d.ts",
76
76
  "import": "./dist/workspace.js",
77
77
  "require": "./dist/workspace.cjs"
78
+ },
79
+ "./locales/*": {
80
+ "types": "./dist/locales/*.d.ts",
81
+ "import": "./dist/locales/*.js",
82
+ "require": "./dist/locales/*.cjs"
78
83
  }
79
84
  },
80
85
  "files": [
@@ -93,7 +98,9 @@
93
98
  "test": "vitest run",
94
99
  "test:watch": "vitest",
95
100
  "lint": "eslint .",
96
- "playground": "vite"
101
+ "playground": "vite",
102
+ "i18n:extract": "node scripts/i18n-extract.mjs",
103
+ "i18n:check": "node scripts/i18n-extract.mjs --check"
97
104
  },
98
105
  "devDependencies": {
99
106
  "eslint": "^9.0.0",