@luxalgo/vela 0.8.4 → 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-Byo8pEv0.d.ts → DataProvider-BGlB1zSc.d.ts} +1 -1
  2. package/dist/{DataProvider-Bw58CjYy.d.cts → DataProvider-zJGp58kb.d.cts} +1 -1
  3. package/dist/{chunk-MOJ4T26N.js → chunk-4WAHYL7Y.js} +1151 -474
  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-UNUVPQFW.js → chunk-XIRSR3D6.js} +2837 -1604
  8. package/dist/{chunk-ALTGHKIM.js → chunk-YRCL3WMD.js} +510 -406
  9. package/dist/{contributions-BY3zSYiZ.d.ts → contributions-BjefWpxQ.d.ts} +106 -25
  10. package/dist/{contributions-DOm40g5-.d.cts → contributions-CpCJisTC.d.cts} +106 -25
  11. package/dist/index.cjs +4485 -2163
  12. package/dist/index.d.cts +67 -25
  13. package/dist/index.d.ts +67 -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-CSXbjMM5.d.cts → options-CpegHml_.d.cts} +110 -10
  98. package/dist/{options-CSXbjMM5.d.ts → options-D4L3_hv_.d.ts} +110 -10
  99. package/dist/{plugin-BDxUhGO3.d.ts → plugin-DTmulpKM.d.ts} +92 -40
  100. package/dist/{plugin-CiQVyETg.d.cts → plugin-DpNp4aBi.d.cts} +92 -40
  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-C9tYXuux.d.ts → statusline-model-C3yIY9WE.d.ts} +11 -3
  120. package/dist/{statusline-model-DUBX6Fib.d.cts → 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 +4451 -2131
  128. package/dist/vela.global.min.js +57 -57
  129. package/dist/widget.cjs +5819 -2780
  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 +5808 -2787
  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,16 +1,51 @@
1
- import { z as DrawingTypeKey, af as DrawingStyle, S as SerializedDrawing, D as Drawing, O as OHLCV, aY as SeriesKind, c as VelaTheme } from './options-CSXbjMM5.js';
2
- import { f as DataControl } from './contributions-BY3zSYiZ.js';
3
- import './side-panel-_2UK1gSm.js';
1
+ import { i as MessageDescriptor, a as MessageArgs, L as LocalePack, b as LocalizationOptions, T as Translator, M as MessageLike } from './types-BlrXRLIR.js';
2
+ import { B as DrawingTypeKey, ag as DrawingStyle, S as SerializedDrawing, D as Drawing, O as OHLCV, a_ as SeriesKind, c as VelaTheme } from './options-D4L3_hv_.js';
3
+ import { f as DataControl } from './contributions-BjefWpxQ.js';
4
+ import './side-panel-CYmH1Opm.js';
4
5
  import './icons-BZYbJXSV.js';
5
- import './keymap-CGOz5F5f.js';
6
- import './DataProvider-Byo8pEv0.js';
6
+ import './keymap-UolhuXH1.js';
7
+ import './DataProvider-BGlB1zSc.js';
8
+
9
+ /** Values a message interpolates. */
10
+ type MessageValues = Readonly<Record<string, string | number>>;
11
+
12
+ /**
13
+ * Declare a translatable message: a stable, dotted id and its English text in ICU message
14
+ * syntax (`'{count, plural, one {# bar} other {# bars}}'`). The descriptor is inert data;
15
+ * a translator's `t()` resolves it. The build extracts every `msg()` call with literal
16
+ * arguments into the English catalog, so keep both arguments string literals.
17
+ */
18
+ declare function msg(id: string, defaultMessage: string): MessageDescriptor;
19
+ /**
20
+ * A message with values bound to its arguments, for display text declared before its
21
+ * values are known to the code that renders it (`withValues(BAND, { n: 2 })` reads
22
+ * "Band #2"). A translator formats the bound values; values passed to `t()` win.
23
+ */
24
+ declare function withValues(message: MessageDescriptor, values: MessageArgs): MessageDescriptor;
25
+
26
+ /**
27
+ * Register a locale pack: a locale tag and its messages (id → ICU message). Several packs
28
+ * may share a tag (the core's, a plugin's, the host's); for the same id the pack
29
+ * registered last wins. Registration is a call, never an import side effect. Returns the
30
+ * disposer that removes this pack again.
31
+ */
32
+ declare function registerLocale(pack: LocalePack): () => void;
33
+ /** The tags of every registered pack, in registration order (duplicates collapsed). */
34
+ declare function registeredLocales(): string[];
35
+
36
+ /**
37
+ * A standalone translator for UI built outside a chart (a kit component, a host panel).
38
+ * Charts, workspaces and widgets carry their own as `i18n`.
39
+ */
40
+ declare function createTranslator(options?: LocalizationOptions): Translator;
7
41
 
8
42
  /** What a drawing type contributes to the toolbar + factory (renderer-neutral). */
9
43
  interface DrawingTypeMeta {
10
44
  type: DrawingTypeKey;
11
45
  /** Toolbar group id (e.g. `'lines'`, `'shapes'`, `'annotations'`). */
12
46
  group: string;
13
- label: string;
47
+ /** The tool's name (toolbar, settings, object tree); a message reads in the chart's language. */
48
+ label: MessageLike;
14
49
  /** Inline SVG markup for the toolbar button — no DOM, renderer paints it. */
15
50
  icon: string;
16
51
  defaultStyle: DrawingStyle;
@@ -20,7 +55,7 @@ interface DrawingTypeMeta {
20
55
  coversSeries?: boolean;
21
56
  /** One short sentence prompting the placement gesture, shown by the renderer at the
22
57
  * bottom of the chart while the tool is armed and no placement has started yet. */
23
- placementHint?: string;
58
+ placementHint?: MessageLike;
24
59
  /** Build an instance from a (partial) serialized record. Serves create + deserialize. */
25
60
  create(init: Partial<SerializedDrawing> & {
26
61
  paneId: string;
@@ -29,8 +64,15 @@ interface DrawingTypeMeta {
29
64
  /** Register (or replace) a drawing type. Built-ins register at module load; new
30
65
  * types (fibs/patterns) call this — no base/port/facade change. */
31
66
  declare function registerDrawingType(meta: DrawingTypeMeta): void;
32
- declare function getDrawingType(type: string): DrawingTypeMeta | undefined;
33
- declare function drawingTypes(): DrawingTypeMeta[];
67
+ /** A registered type as the read APIs hand it out: its label and hint as plain text. */
68
+ type ResolvedDrawingTypeMeta = DrawingTypeMeta & {
69
+ label: string;
70
+ placementHint?: string;
71
+ };
72
+ /** A registered drawing type, its label and hint in `i18n`'s language (English without one). */
73
+ declare function getDrawingType(type: string, i18n?: Translator): ResolvedDrawingTypeMeta | undefined;
74
+ /** Every registered drawing type, labels in `i18n`'s language (English without one). */
75
+ declare function drawingTypes(i18n?: Translator): ResolvedDrawingTypeMeta[];
34
76
  /** Build a fresh drawing of `type` on `paneId`, seeding the type's default style. */
35
77
  declare function createDrawing(type: DrawingTypeKey, init: Partial<SerializedDrawing> & {
36
78
  paneId: string;
@@ -184,17 +226,23 @@ interface SeriesDataEngineHost {
184
226
  }
185
227
  /**
186
228
  * A per-chart data engine behind a chart type: created on first entry into the style,
187
- * suspended/resumed as the user switches styles, stopped when the chart is destroyed.
229
+ * suspended/resumed as the user switches styles, replaced by a fresh engine when the
230
+ * market or the replay state changes, stopped when the chart is destroyed.
188
231
  * All methods are fire-and-forget from the chart's point of view — the engine owns its
189
- * own scheduling and pushes results through the host channels.
232
+ * own scheduling and pushes results through the host channels. The host forwards pushes
233
+ * only from the chart's current, unsuspended engine: work still in flight when the
234
+ * engine is suspended or stopped never reaches the scene.
190
235
  */
191
236
  interface SeriesDataEngine {
192
237
  start(host: SeriesDataEngineHost): void;
193
- /** The style was left — stop fetching/pushing, keep state for a cheap resume. */
238
+ /** The style was left, or a market switch began — stop fetching/pushing, keep state
239
+ * for a cheap resume. Host pushes are dropped from here until `resume()`. */
194
240
  suspend(): void;
195
- /** The style was re-entered. */
241
+ /** The style was re-entered — re-push what the layer shows (nothing pushed while
242
+ * suspended reached it). */
196
243
  resume(): void;
197
- /** The chart is going away — release everything. */
244
+ /** The chart is going away, or the engine is being replaced — release everything.
245
+ * Its host drops every push from here on. */
198
246
  stop(): void;
199
247
  /** The visible range changed (pan/zoom) while the style is active. */
200
248
  onViewport?(range: {
@@ -216,8 +264,9 @@ interface SeriesDataEngine {
216
264
  interface ChartTypeDefinition {
217
265
  /** The price-style id (`'heikinashi'`; a plugin might register `'footprint'`, `'renko'`…). */
218
266
  id: string;
219
- /** Human-readable label for style pickers. Defaults to the id. */
220
- label?: string;
267
+ /** Human-readable label for style pickers. Defaults to the id. A message (`msg()`)
268
+ * reads in the chart's language. */
269
+ label?: MessageLike;
221
270
  /** Raw `<svg>` markup for style pickers (surfaced as icon id `style-<id>`). */
222
271
  icon?: string;
223
272
  /** Optional SETTINGS SECTION rendered inside the chart-settings dialog — declarative
@@ -264,7 +313,7 @@ type SettingsRowWhen = SettingsRowCondition | readonly SettingsRowCondition[];
264
313
  interface SettingsRowSwatch {
265
314
  key: string;
266
315
  /** Names the color for the swatch's tooltip (`'Highlight color'`). */
267
- label: string;
316
+ label: MessageLike;
268
317
  defval: string;
269
318
  /**
270
319
  * Optional visibility gate, evaluated live against the values bag exactly like a
@@ -284,7 +333,7 @@ interface SettingsRowSwatch {
284
333
  interface SettingsRowWidth {
285
334
  key: string;
286
335
  /** Names the control for its tooltip (`'Line width'`). */
287
- label: string;
336
+ label: MessageLike;
288
337
  defval: number;
289
338
  }
290
339
  /**
@@ -296,7 +345,7 @@ interface SettingsRowWidth {
296
345
  interface SettingsRowInlineNumber {
297
346
  key: string;
298
347
  /** Names the input for its tooltip (`'Value area (%)'`). */
299
- label: string;
348
+ label: MessageLike;
300
349
  defval: number;
301
350
  min?: number;
302
351
  max?: number;
@@ -306,7 +355,7 @@ interface SettingsRowInlineNumber {
306
355
  * A select option: a bare string (value = label) or a `[value, label]` pair when the
307
356
  * stored id differs from the human-readable text (`['bidAskProfile', 'Bid × Ask Profile']`).
308
357
  */
309
- type SettingsSelectOption = string | readonly [value: string, label: string];
358
+ type SettingsSelectOption = string | readonly [value: string, label: MessageLike];
310
359
  /**
311
360
  * One INLINE CONTROL on a composite `row` — the composable unit every value row is
312
361
  * made of. Each keyed control stores under its own bag key; `label` names it for the
@@ -328,35 +377,35 @@ type SettingsSelectOption = string | readonly [value: string, label: string];
328
377
  type SettingsInlineControl = {
329
378
  kind: 'number';
330
379
  key: string;
331
- label: string;
380
+ label: MessageLike;
332
381
  defval: number;
333
382
  min?: number;
334
383
  max?: number;
335
384
  step?: number;
336
- placeholder?: string;
385
+ placeholder?: MessageLike;
337
386
  when?: SettingsRowWhen;
338
387
  } | {
339
388
  kind: 'color';
340
389
  key: string;
341
- label: string;
390
+ label: MessageLike;
342
391
  defval: string;
343
392
  when?: SettingsRowWhen;
344
393
  } | {
345
394
  kind: 'width';
346
395
  key: string;
347
- label: string;
396
+ label: MessageLike;
348
397
  defval: number;
349
398
  when?: SettingsRowWhen;
350
399
  } | {
351
400
  kind: 'select';
352
401
  key: string;
353
- label: string;
402
+ label: MessageLike;
354
403
  options: readonly SettingsSelectOption[];
355
404
  defval: string;
356
405
  when?: SettingsRowWhen;
357
406
  } | {
358
407
  kind: 'hint';
359
- text: string;
408
+ text: MessageLike;
360
409
  };
361
410
  /**
362
411
  * One declarative settings row. To add a NEW inline control kind, see
@@ -388,15 +437,15 @@ type SettingsInlineControl = {
388
437
  */
389
438
  type SettingsRowDescriptor = {
390
439
  kind: 'heading';
391
- label: string;
440
+ label: MessageLike;
392
441
  when?: SettingsRowWhen;
393
442
  } | {
394
443
  kind: 'header';
395
- label: string;
444
+ label: MessageLike;
396
445
  when?: SettingsRowWhen;
397
446
  } | {
398
447
  kind: 'row';
399
- label: string;
448
+ label: MessageLike;
400
449
  toggle?: {
401
450
  key: string;
402
451
  defval: boolean;
@@ -406,7 +455,7 @@ type SettingsRowDescriptor = {
406
455
  } | {
407
456
  kind: 'toggle';
408
457
  key: string;
409
- label: string;
458
+ label: MessageLike;
410
459
  defval: boolean;
411
460
  number?: SettingsRowInlineNumber;
412
461
  colors?: readonly SettingsRowSwatch[];
@@ -415,7 +464,7 @@ type SettingsRowDescriptor = {
415
464
  } | {
416
465
  kind: 'number';
417
466
  key: string;
418
- label: string;
467
+ label: MessageLike;
419
468
  defval: number;
420
469
  min?: number;
421
470
  max?: number;
@@ -424,26 +473,26 @@ type SettingsRowDescriptor = {
424
473
  } | {
425
474
  kind: 'color';
426
475
  key: string;
427
- label: string;
476
+ label: MessageLike;
428
477
  defval: string;
429
478
  when?: SettingsRowWhen;
430
479
  } | {
431
480
  kind: 'select';
432
481
  key: string;
433
- label: string;
482
+ label: MessageLike;
434
483
  options: readonly SettingsSelectOption[];
435
484
  defval: string;
436
485
  when?: SettingsRowWhen;
437
486
  } | {
438
487
  kind: 'range';
439
- label: string;
488
+ label: MessageLike;
440
489
  minKey: string;
441
490
  maxKey: string;
442
491
  defval: number;
443
492
  min?: number;
444
493
  max?: number;
445
494
  step?: number;
446
- placeholder?: string;
495
+ placeholder?: MessageLike;
447
496
  when?: SettingsRowWhen;
448
497
  };
449
498
  /** A value-carrying row (everything except the key-less `heading`/`header` titles). */
@@ -452,7 +501,7 @@ type SettingsValueRow = Exclude<SettingsRowDescriptor, {
452
501
  }>;
453
502
  /** The canonical row shape every {@link SettingsValueRow} reduces to (the `row` kind's fields). */
454
503
  interface NormalizedSettingsRow {
455
- label: string;
504
+ label: MessageLike;
456
505
  toggle?: {
457
506
  key: string;
458
507
  defval: boolean;
@@ -488,14 +537,14 @@ declare function settingsRowValueKeys(r: SettingsRowDescriptor): SettingsRowValu
488
537
  * present and not removable — the base instance.
489
538
  */
490
539
  interface ChartTypeSettingsInstance {
491
- label: string;
540
+ label: MessageLike;
492
541
  /** Boolean bag key controlling presence; omitted = always present, not removable. */
493
542
  enableKey?: string;
494
543
  rows: readonly SettingsRowDescriptor[];
495
544
  }
496
545
  /** An indented sub-entry under the section's rail tab, with its own pane of rows. */
497
546
  interface ChartTypeSettingsSubsection {
498
- title: string;
547
+ title: MessageLike;
499
548
  rows: readonly SettingsRowDescriptor[];
500
549
  /**
501
550
  * Boolean bag key that masters this pane. While it is false, every row EXCEPT the
@@ -524,7 +573,7 @@ interface ChartTypeSettingsSubsection {
524
573
  */
525
574
  interface ChartTypeSettingsSection {
526
575
  /** Section heading in the settings dialog. */
527
- title: string;
576
+ title: MessageLike;
528
577
  /** Flat form. Ignored when `instances` is declared. */
529
578
  rows?: readonly SettingsRowDescriptor[];
530
579
  /** How `rows` are presented: `'flat'` (default) renders headings as inline group
@@ -618,6 +667,9 @@ interface RendererLayerArgs {
618
667
  x: number;
619
668
  y: number;
620
669
  } | null;
670
+ /** The chart's translator: `i18n.t(msg(...))` for text a layer paints, and
671
+ * `i18n.format` for its numbers and dates, in the chart's locale. */
672
+ i18n: Translator;
621
673
  }
622
674
  /** How a layer dims/slims the BASE painting under it (see
623
675
  * {@link RendererLayerInstance.modulateBase}). Omitted fields keep their defaults. */
@@ -728,4 +780,4 @@ declare const CATEGORICAL: readonly string[];
728
780
  /** Pick a stable categorical color for a string key (same key ⇒ same color). */
729
781
  declare function categoricalColor(key: string): string;
730
782
 
731
- export { getDrawingType as $, ACCENT as A, BEARISH as B, CATEGORICAL as C, type DrawingTypeMeta as D, type SettingsRowInlineNumber as E, type SettingsRowSwatch as F, type SettingsRowValueKey as G, HIGHLIGHT as H, INFO as I, type SettingsRowWhen as J, type SettingsRowWidth as K, type SettingsValueRow as L, MARKER as M, NEUTRAL as N, TRADE_LONG as O, TRADE_SHORT as P, categoricalColor as Q, type RendererLayerArgs as R, type SettingsSelectOption as S, TRADE_EXIT as T, chartType as U, VALID as V, WARNING as W, chartTypes as X, createDrawing as Y, deserializeDrawing as Z, drawingTypes as _, ACCENT_BRIGHT as a, normalizeSettingsRow as a0, registerChartType as a1, registerDrawingType as a2, registerRendererDefaults as a3, registerRendererLayer as a4, rendererDefaults as a5, rendererLayers as a6, settingsRowValueKeys as a7, stableSeriesId as a8, tickerModifierIds as a9, unregisterChartType as aa, unregisterRendererDefaults as ab, unregisterRendererLayer as ac, BULLISH as b, type BarTransform as c, type BasePaintingModulation as d, CHIP_PLATE as e, CROSSHAIR as f, type ChartTypeDefinition as g, type ChartTypeSettingsInstance as h, type ChartTypeSettingsSection as i, type ChartTypeSettingsSubsection as j, INVALID as k, type IdentifiableKind as l, type NormalizedSettingsRow as m, type RendererLayerDefinition as n, type RendererLayerInstance as o, SERIES_LINE as p, SESSION_OFF as q, SESSION_POST as r, SESSION_PRE as s, SLATE as t, SLATE_DEEP as u, type SeriesDataEngine as v, type SeriesDataEngineHost as w, type SettingsInlineControl as x, type SettingsRowCondition as y, type SettingsRowDescriptor as z };
783
+ export { deserializeDrawing as $, ACCENT as A, BEARISH as B, CATEGORICAL as C, type DrawingTypeMeta as D, type SettingsRowDescriptor as E, type SettingsRowInlineNumber as F, type SettingsRowSwatch as G, HIGHLIGHT as H, INFO as I, type SettingsRowValueKey as J, type SettingsRowWhen as K, type SettingsRowWidth as L, MARKER as M, NEUTRAL as N, type SettingsValueRow as O, TRADE_LONG as P, TRADE_SHORT as Q, type RendererLayerArgs as R, type SettingsSelectOption as S, TRADE_EXIT as T, categoricalColor as U, VALID as V, WARNING as W, chartType as X, chartTypes as Y, createDrawing as Z, createTranslator as _, ACCENT_BRIGHT as a, drawingTypes as a0, getDrawingType as a1, msg as a2, normalizeSettingsRow as a3, registerChartType as a4, registerDrawingType as a5, registerLocale as a6, registerRendererDefaults as a7, registerRendererLayer as a8, registeredLocales as a9, rendererDefaults as aa, rendererLayers as ab, settingsRowValueKeys as ac, stableSeriesId as ad, tickerModifierIds as ae, unregisterChartType as af, unregisterRendererDefaults as ag, unregisterRendererLayer as ah, withValues as ai, BULLISH as b, type BarTransform as c, type BasePaintingModulation as d, CHIP_PLATE as e, CROSSHAIR as f, type ChartTypeDefinition as g, type ChartTypeSettingsInstance as h, type ChartTypeSettingsSection as i, type ChartTypeSettingsSubsection as j, INVALID as k, type IdentifiableKind as l, type MessageValues as m, type NormalizedSettingsRow as n, type RendererLayerDefinition as o, type RendererLayerInstance as p, SERIES_LINE as q, SESSION_OFF as r, SESSION_POST as s, SESSION_PRE as t, SLATE as u, SLATE_DEEP as v, type SeriesDataEngine as w, type SeriesDataEngineHost as x, type SettingsInlineControl as y, type SettingsRowCondition as z };
@@ -1,16 +1,51 @@
1
- import { z as DrawingTypeKey, af as DrawingStyle, S as SerializedDrawing, D as Drawing, O as OHLCV, aY as SeriesKind, c as VelaTheme } from './options-CSXbjMM5.cjs';
2
- import { f as DataControl } from './contributions-DOm40g5-.cjs';
3
- import './side-panel-_2UK1gSm.cjs';
1
+ import { i as MessageDescriptor, a as MessageArgs, L as LocalePack, b as LocalizationOptions, T as Translator, M as MessageLike } from './types-BlrXRLIR.cjs';
2
+ import { B as DrawingTypeKey, ag as DrawingStyle, S as SerializedDrawing, D as Drawing, O as OHLCV, a_ as SeriesKind, c as VelaTheme } from './options-CpegHml_.cjs';
3
+ import { f as DataControl } from './contributions-CpCJisTC.cjs';
4
+ import './side-panel-BqUnpfev.cjs';
4
5
  import './icons-BZYbJXSV.cjs';
5
- import './keymap-CGOz5F5f.cjs';
6
- import './DataProvider-Bw58CjYy.cjs';
6
+ import './keymap-B9_FLhfJ.cjs';
7
+ import './DataProvider-zJGp58kb.cjs';
8
+
9
+ /** Values a message interpolates. */
10
+ type MessageValues = Readonly<Record<string, string | number>>;
11
+
12
+ /**
13
+ * Declare a translatable message: a stable, dotted id and its English text in ICU message
14
+ * syntax (`'{count, plural, one {# bar} other {# bars}}'`). The descriptor is inert data;
15
+ * a translator's `t()` resolves it. The build extracts every `msg()` call with literal
16
+ * arguments into the English catalog, so keep both arguments string literals.
17
+ */
18
+ declare function msg(id: string, defaultMessage: string): MessageDescriptor;
19
+ /**
20
+ * A message with values bound to its arguments, for display text declared before its
21
+ * values are known to the code that renders it (`withValues(BAND, { n: 2 })` reads
22
+ * "Band #2"). A translator formats the bound values; values passed to `t()` win.
23
+ */
24
+ declare function withValues(message: MessageDescriptor, values: MessageArgs): MessageDescriptor;
25
+
26
+ /**
27
+ * Register a locale pack: a locale tag and its messages (id → ICU message). Several packs
28
+ * may share a tag (the core's, a plugin's, the host's); for the same id the pack
29
+ * registered last wins. Registration is a call, never an import side effect. Returns the
30
+ * disposer that removes this pack again.
31
+ */
32
+ declare function registerLocale(pack: LocalePack): () => void;
33
+ /** The tags of every registered pack, in registration order (duplicates collapsed). */
34
+ declare function registeredLocales(): string[];
35
+
36
+ /**
37
+ * A standalone translator for UI built outside a chart (a kit component, a host panel).
38
+ * Charts, workspaces and widgets carry their own as `i18n`.
39
+ */
40
+ declare function createTranslator(options?: LocalizationOptions): Translator;
7
41
 
8
42
  /** What a drawing type contributes to the toolbar + factory (renderer-neutral). */
9
43
  interface DrawingTypeMeta {
10
44
  type: DrawingTypeKey;
11
45
  /** Toolbar group id (e.g. `'lines'`, `'shapes'`, `'annotations'`). */
12
46
  group: string;
13
- label: string;
47
+ /** The tool's name (toolbar, settings, object tree); a message reads in the chart's language. */
48
+ label: MessageLike;
14
49
  /** Inline SVG markup for the toolbar button — no DOM, renderer paints it. */
15
50
  icon: string;
16
51
  defaultStyle: DrawingStyle;
@@ -20,7 +55,7 @@ interface DrawingTypeMeta {
20
55
  coversSeries?: boolean;
21
56
  /** One short sentence prompting the placement gesture, shown by the renderer at the
22
57
  * bottom of the chart while the tool is armed and no placement has started yet. */
23
- placementHint?: string;
58
+ placementHint?: MessageLike;
24
59
  /** Build an instance from a (partial) serialized record. Serves create + deserialize. */
25
60
  create(init: Partial<SerializedDrawing> & {
26
61
  paneId: string;
@@ -29,8 +64,15 @@ interface DrawingTypeMeta {
29
64
  /** Register (or replace) a drawing type. Built-ins register at module load; new
30
65
  * types (fibs/patterns) call this — no base/port/facade change. */
31
66
  declare function registerDrawingType(meta: DrawingTypeMeta): void;
32
- declare function getDrawingType(type: string): DrawingTypeMeta | undefined;
33
- declare function drawingTypes(): DrawingTypeMeta[];
67
+ /** A registered type as the read APIs hand it out: its label and hint as plain text. */
68
+ type ResolvedDrawingTypeMeta = DrawingTypeMeta & {
69
+ label: string;
70
+ placementHint?: string;
71
+ };
72
+ /** A registered drawing type, its label and hint in `i18n`'s language (English without one). */
73
+ declare function getDrawingType(type: string, i18n?: Translator): ResolvedDrawingTypeMeta | undefined;
74
+ /** Every registered drawing type, labels in `i18n`'s language (English without one). */
75
+ declare function drawingTypes(i18n?: Translator): ResolvedDrawingTypeMeta[];
34
76
  /** Build a fresh drawing of `type` on `paneId`, seeding the type's default style. */
35
77
  declare function createDrawing(type: DrawingTypeKey, init: Partial<SerializedDrawing> & {
36
78
  paneId: string;
@@ -184,17 +226,23 @@ interface SeriesDataEngineHost {
184
226
  }
185
227
  /**
186
228
  * A per-chart data engine behind a chart type: created on first entry into the style,
187
- * suspended/resumed as the user switches styles, stopped when the chart is destroyed.
229
+ * suspended/resumed as the user switches styles, replaced by a fresh engine when the
230
+ * market or the replay state changes, stopped when the chart is destroyed.
188
231
  * All methods are fire-and-forget from the chart's point of view — the engine owns its
189
- * own scheduling and pushes results through the host channels.
232
+ * own scheduling and pushes results through the host channels. The host forwards pushes
233
+ * only from the chart's current, unsuspended engine: work still in flight when the
234
+ * engine is suspended or stopped never reaches the scene.
190
235
  */
191
236
  interface SeriesDataEngine {
192
237
  start(host: SeriesDataEngineHost): void;
193
- /** The style was left — stop fetching/pushing, keep state for a cheap resume. */
238
+ /** The style was left, or a market switch began — stop fetching/pushing, keep state
239
+ * for a cheap resume. Host pushes are dropped from here until `resume()`. */
194
240
  suspend(): void;
195
- /** The style was re-entered. */
241
+ /** The style was re-entered — re-push what the layer shows (nothing pushed while
242
+ * suspended reached it). */
196
243
  resume(): void;
197
- /** The chart is going away — release everything. */
244
+ /** The chart is going away, or the engine is being replaced — release everything.
245
+ * Its host drops every push from here on. */
198
246
  stop(): void;
199
247
  /** The visible range changed (pan/zoom) while the style is active. */
200
248
  onViewport?(range: {
@@ -216,8 +264,9 @@ interface SeriesDataEngine {
216
264
  interface ChartTypeDefinition {
217
265
  /** The price-style id (`'heikinashi'`; a plugin might register `'footprint'`, `'renko'`…). */
218
266
  id: string;
219
- /** Human-readable label for style pickers. Defaults to the id. */
220
- label?: string;
267
+ /** Human-readable label for style pickers. Defaults to the id. A message (`msg()`)
268
+ * reads in the chart's language. */
269
+ label?: MessageLike;
221
270
  /** Raw `<svg>` markup for style pickers (surfaced as icon id `style-<id>`). */
222
271
  icon?: string;
223
272
  /** Optional SETTINGS SECTION rendered inside the chart-settings dialog — declarative
@@ -264,7 +313,7 @@ type SettingsRowWhen = SettingsRowCondition | readonly SettingsRowCondition[];
264
313
  interface SettingsRowSwatch {
265
314
  key: string;
266
315
  /** Names the color for the swatch's tooltip (`'Highlight color'`). */
267
- label: string;
316
+ label: MessageLike;
268
317
  defval: string;
269
318
  /**
270
319
  * Optional visibility gate, evaluated live against the values bag exactly like a
@@ -284,7 +333,7 @@ interface SettingsRowSwatch {
284
333
  interface SettingsRowWidth {
285
334
  key: string;
286
335
  /** Names the control for its tooltip (`'Line width'`). */
287
- label: string;
336
+ label: MessageLike;
288
337
  defval: number;
289
338
  }
290
339
  /**
@@ -296,7 +345,7 @@ interface SettingsRowWidth {
296
345
  interface SettingsRowInlineNumber {
297
346
  key: string;
298
347
  /** Names the input for its tooltip (`'Value area (%)'`). */
299
- label: string;
348
+ label: MessageLike;
300
349
  defval: number;
301
350
  min?: number;
302
351
  max?: number;
@@ -306,7 +355,7 @@ interface SettingsRowInlineNumber {
306
355
  * A select option: a bare string (value = label) or a `[value, label]` pair when the
307
356
  * stored id differs from the human-readable text (`['bidAskProfile', 'Bid × Ask Profile']`).
308
357
  */
309
- type SettingsSelectOption = string | readonly [value: string, label: string];
358
+ type SettingsSelectOption = string | readonly [value: string, label: MessageLike];
310
359
  /**
311
360
  * One INLINE CONTROL on a composite `row` — the composable unit every value row is
312
361
  * made of. Each keyed control stores under its own bag key; `label` names it for the
@@ -328,35 +377,35 @@ type SettingsSelectOption = string | readonly [value: string, label: string];
328
377
  type SettingsInlineControl = {
329
378
  kind: 'number';
330
379
  key: string;
331
- label: string;
380
+ label: MessageLike;
332
381
  defval: number;
333
382
  min?: number;
334
383
  max?: number;
335
384
  step?: number;
336
- placeholder?: string;
385
+ placeholder?: MessageLike;
337
386
  when?: SettingsRowWhen;
338
387
  } | {
339
388
  kind: 'color';
340
389
  key: string;
341
- label: string;
390
+ label: MessageLike;
342
391
  defval: string;
343
392
  when?: SettingsRowWhen;
344
393
  } | {
345
394
  kind: 'width';
346
395
  key: string;
347
- label: string;
396
+ label: MessageLike;
348
397
  defval: number;
349
398
  when?: SettingsRowWhen;
350
399
  } | {
351
400
  kind: 'select';
352
401
  key: string;
353
- label: string;
402
+ label: MessageLike;
354
403
  options: readonly SettingsSelectOption[];
355
404
  defval: string;
356
405
  when?: SettingsRowWhen;
357
406
  } | {
358
407
  kind: 'hint';
359
- text: string;
408
+ text: MessageLike;
360
409
  };
361
410
  /**
362
411
  * One declarative settings row. To add a NEW inline control kind, see
@@ -388,15 +437,15 @@ type SettingsInlineControl = {
388
437
  */
389
438
  type SettingsRowDescriptor = {
390
439
  kind: 'heading';
391
- label: string;
440
+ label: MessageLike;
392
441
  when?: SettingsRowWhen;
393
442
  } | {
394
443
  kind: 'header';
395
- label: string;
444
+ label: MessageLike;
396
445
  when?: SettingsRowWhen;
397
446
  } | {
398
447
  kind: 'row';
399
- label: string;
448
+ label: MessageLike;
400
449
  toggle?: {
401
450
  key: string;
402
451
  defval: boolean;
@@ -406,7 +455,7 @@ type SettingsRowDescriptor = {
406
455
  } | {
407
456
  kind: 'toggle';
408
457
  key: string;
409
- label: string;
458
+ label: MessageLike;
410
459
  defval: boolean;
411
460
  number?: SettingsRowInlineNumber;
412
461
  colors?: readonly SettingsRowSwatch[];
@@ -415,7 +464,7 @@ type SettingsRowDescriptor = {
415
464
  } | {
416
465
  kind: 'number';
417
466
  key: string;
418
- label: string;
467
+ label: MessageLike;
419
468
  defval: number;
420
469
  min?: number;
421
470
  max?: number;
@@ -424,26 +473,26 @@ type SettingsRowDescriptor = {
424
473
  } | {
425
474
  kind: 'color';
426
475
  key: string;
427
- label: string;
476
+ label: MessageLike;
428
477
  defval: string;
429
478
  when?: SettingsRowWhen;
430
479
  } | {
431
480
  kind: 'select';
432
481
  key: string;
433
- label: string;
482
+ label: MessageLike;
434
483
  options: readonly SettingsSelectOption[];
435
484
  defval: string;
436
485
  when?: SettingsRowWhen;
437
486
  } | {
438
487
  kind: 'range';
439
- label: string;
488
+ label: MessageLike;
440
489
  minKey: string;
441
490
  maxKey: string;
442
491
  defval: number;
443
492
  min?: number;
444
493
  max?: number;
445
494
  step?: number;
446
- placeholder?: string;
495
+ placeholder?: MessageLike;
447
496
  when?: SettingsRowWhen;
448
497
  };
449
498
  /** A value-carrying row (everything except the key-less `heading`/`header` titles). */
@@ -452,7 +501,7 @@ type SettingsValueRow = Exclude<SettingsRowDescriptor, {
452
501
  }>;
453
502
  /** The canonical row shape every {@link SettingsValueRow} reduces to (the `row` kind's fields). */
454
503
  interface NormalizedSettingsRow {
455
- label: string;
504
+ label: MessageLike;
456
505
  toggle?: {
457
506
  key: string;
458
507
  defval: boolean;
@@ -488,14 +537,14 @@ declare function settingsRowValueKeys(r: SettingsRowDescriptor): SettingsRowValu
488
537
  * present and not removable — the base instance.
489
538
  */
490
539
  interface ChartTypeSettingsInstance {
491
- label: string;
540
+ label: MessageLike;
492
541
  /** Boolean bag key controlling presence; omitted = always present, not removable. */
493
542
  enableKey?: string;
494
543
  rows: readonly SettingsRowDescriptor[];
495
544
  }
496
545
  /** An indented sub-entry under the section's rail tab, with its own pane of rows. */
497
546
  interface ChartTypeSettingsSubsection {
498
- title: string;
547
+ title: MessageLike;
499
548
  rows: readonly SettingsRowDescriptor[];
500
549
  /**
501
550
  * Boolean bag key that masters this pane. While it is false, every row EXCEPT the
@@ -524,7 +573,7 @@ interface ChartTypeSettingsSubsection {
524
573
  */
525
574
  interface ChartTypeSettingsSection {
526
575
  /** Section heading in the settings dialog. */
527
- title: string;
576
+ title: MessageLike;
528
577
  /** Flat form. Ignored when `instances` is declared. */
529
578
  rows?: readonly SettingsRowDescriptor[];
530
579
  /** How `rows` are presented: `'flat'` (default) renders headings as inline group
@@ -618,6 +667,9 @@ interface RendererLayerArgs {
618
667
  x: number;
619
668
  y: number;
620
669
  } | null;
670
+ /** The chart's translator: `i18n.t(msg(...))` for text a layer paints, and
671
+ * `i18n.format` for its numbers and dates, in the chart's locale. */
672
+ i18n: Translator;
621
673
  }
622
674
  /** How a layer dims/slims the BASE painting under it (see
623
675
  * {@link RendererLayerInstance.modulateBase}). Omitted fields keep their defaults. */
@@ -728,4 +780,4 @@ declare const CATEGORICAL: readonly string[];
728
780
  /** Pick a stable categorical color for a string key (same key ⇒ same color). */
729
781
  declare function categoricalColor(key: string): string;
730
782
 
731
- export { getDrawingType as $, ACCENT as A, BEARISH as B, CATEGORICAL as C, type DrawingTypeMeta as D, type SettingsRowInlineNumber as E, type SettingsRowSwatch as F, type SettingsRowValueKey as G, HIGHLIGHT as H, INFO as I, type SettingsRowWhen as J, type SettingsRowWidth as K, type SettingsValueRow as L, MARKER as M, NEUTRAL as N, TRADE_LONG as O, TRADE_SHORT as P, categoricalColor as Q, type RendererLayerArgs as R, type SettingsSelectOption as S, TRADE_EXIT as T, chartType as U, VALID as V, WARNING as W, chartTypes as X, createDrawing as Y, deserializeDrawing as Z, drawingTypes as _, ACCENT_BRIGHT as a, normalizeSettingsRow as a0, registerChartType as a1, registerDrawingType as a2, registerRendererDefaults as a3, registerRendererLayer as a4, rendererDefaults as a5, rendererLayers as a6, settingsRowValueKeys as a7, stableSeriesId as a8, tickerModifierIds as a9, unregisterChartType as aa, unregisterRendererDefaults as ab, unregisterRendererLayer as ac, BULLISH as b, type BarTransform as c, type BasePaintingModulation as d, CHIP_PLATE as e, CROSSHAIR as f, type ChartTypeDefinition as g, type ChartTypeSettingsInstance as h, type ChartTypeSettingsSection as i, type ChartTypeSettingsSubsection as j, INVALID as k, type IdentifiableKind as l, type NormalizedSettingsRow as m, type RendererLayerDefinition as n, type RendererLayerInstance as o, SERIES_LINE as p, SESSION_OFF as q, SESSION_POST as r, SESSION_PRE as s, SLATE as t, SLATE_DEEP as u, type SeriesDataEngine as v, type SeriesDataEngineHost as w, type SettingsInlineControl as x, type SettingsRowCondition as y, type SettingsRowDescriptor as z };
783
+ export { deserializeDrawing as $, ACCENT as A, BEARISH as B, CATEGORICAL as C, type DrawingTypeMeta as D, type SettingsRowDescriptor as E, type SettingsRowInlineNumber as F, type SettingsRowSwatch as G, HIGHLIGHT as H, INFO as I, type SettingsRowValueKey as J, type SettingsRowWhen as K, type SettingsRowWidth as L, MARKER as M, NEUTRAL as N, type SettingsValueRow as O, TRADE_LONG as P, TRADE_SHORT as Q, type RendererLayerArgs as R, type SettingsSelectOption as S, TRADE_EXIT as T, categoricalColor as U, VALID as V, WARNING as W, chartType as X, chartTypes as Y, createDrawing as Z, createTranslator as _, ACCENT_BRIGHT as a, drawingTypes as a0, getDrawingType as a1, msg as a2, normalizeSettingsRow as a3, registerChartType as a4, registerDrawingType as a5, registerLocale as a6, registerRendererDefaults as a7, registerRendererLayer as a8, registeredLocales as a9, rendererDefaults as aa, rendererLayers as ab, settingsRowValueKeys as ac, stableSeriesId as ad, tickerModifierIds as ae, unregisterChartType as af, unregisterRendererDefaults as ag, unregisterRendererLayer as ah, withValues as ai, BULLISH as b, type BarTransform as c, type BasePaintingModulation as d, CHIP_PLATE as e, CROSSHAIR as f, type ChartTypeDefinition as g, type ChartTypeSettingsInstance as h, type ChartTypeSettingsSection as i, type ChartTypeSettingsSubsection as j, INVALID as k, type IdentifiableKind as l, type MessageValues as m, type NormalizedSettingsRow as n, type RendererLayerDefinition as o, type RendererLayerInstance as p, SERIES_LINE as q, SESSION_OFF as r, SESSION_POST as s, SESSION_PRE as t, SLATE as u, SLATE_DEEP as v, type SeriesDataEngine as w, type SeriesDataEngineHost as x, type SettingsInlineControl as y, type SettingsRowCondition as z };