@wick-charts/vue 0.1.2 → 0.2.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 (4) hide show
  1. package/README.md +200 -0
  2. package/dist/index.d.ts +1247 -109
  3. package/dist/index.js +4298 -1898
  4. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -9,59 +9,142 @@ declare const __VLS_component: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, Co
9
9
  theme: ChartTheme;
10
10
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
11
11
  containerRef: HTMLDivElement;
12
+ topOverlayRef: HTMLDivElement;
13
+ titleAnchor: HTMLDivElement;
14
+ infoBarAnchor: HTMLDivElement;
15
+ legendRightAnchor: HTMLDivElement;
16
+ legendAnchor: HTMLDivElement;
12
17
  }, HTMLDivElement>;
13
18
 
19
+ declare const __VLS_component_2: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
20
+
21
+ declare const __VLS_component_3: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{}>, {
22
+ position: "bottom" | "right";
23
+ mode: LegendMode;
24
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
25
+
26
+ declare const __VLS_component_4: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_9> & Readonly<{}>, {
27
+ format: ValueFormatter;
28
+ mode: PieLegendMode;
29
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
30
+
31
+ declare const __VLS_component_5: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
32
+ containerRef: HTMLDivElement;
33
+ }, any>;
34
+
35
+ declare const __VLS_component_6: DefineComponent<__VLS_Props_11, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_11> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
36
+
37
+ declare const __VLS_component_7: DefineComponent<__VLS_Props_12, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_12> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
38
+ containerRef: HTMLDivElement;
39
+ }, any>;
40
+
41
+ declare const __VLS_component_8: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
42
+
43
+ declare const __VLS_component_9: DefineComponent<__VLS_Props_14, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_14> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
44
+
14
45
  declare type __VLS_Props = {
15
46
  data: TimePoint[][];
16
47
  options?: Partial<BarSeriesOptions>;
17
- label?: string;
48
+ /** Stable series ID — same value across remounts. */
49
+ id?: string;
18
50
  };
19
51
 
20
52
  declare type __VLS_Props_10 = {
21
- seriesId: string;
53
+ /**
54
+ * Owning series id. **Optional** — when omitted, the first visible pie
55
+ * series is picked.
56
+ */
57
+ seriesId?: string;
58
+ /** Custom formatter for the slice value. Default: shared `formatCompact`. */
59
+ format?: ValueFormatter;
60
+ };
61
+
62
+ declare type __VLS_Props_11 = {
63
+ sub?: string;
64
+ };
65
+
66
+ declare type __VLS_Props_12 = {
67
+ sort?: SnapshotSort;
68
+ format?: TooltipFormatter;
69
+ };
70
+
71
+ declare type __VLS_Props_13 = {
72
+ /** Custom tick-label formatter. Overrides the built-in range-adaptive default. */
73
+ format?: ValueFormatter;
74
+ };
75
+
76
+ declare type __VLS_Props_14 = {
77
+ /**
78
+ * Owning series id. **Optional** — when omitted, the first visible
79
+ * single-layer time series is picked, falling back to the first visible
80
+ * multi-layer time series.
81
+ */
82
+ seriesId?: string;
22
83
  color?: string;
84
+ /** Custom formatter; routed through NumberFlow's `formatter` so the digit animation still plays. */
85
+ format?: ValueFormatter;
23
86
  };
24
87
 
25
88
  declare type __VLS_Props_2 = {
26
89
  data: OHLCInput[];
27
90
  options?: Partial<CandlestickSeriesOptions>;
91
+ /** Stable series ID — same value across remounts. */
92
+ id?: string;
28
93
  };
29
94
 
30
95
  declare type __VLS_Props_3 = {
31
96
  theme?: ChartTheme;
32
97
  axis?: AxisConfig;
98
+ /** Background grid configuration. Default: `{ visible: true }`. */
99
+ grid?: {
100
+ visible: boolean;
101
+ };
33
102
  };
34
103
 
35
104
  declare type __VLS_Props_4 = {
36
105
  data: TimePoint[][];
37
106
  options?: Partial<LineSeriesOptions>;
38
- label?: string;
107
+ /** Stable series ID — same value across remounts. */
108
+ id?: string;
39
109
  };
40
110
 
41
111
  declare type __VLS_Props_5 = {
42
112
  data: PieSliceData[];
43
113
  options?: Partial<PieSeriesOptions>;
114
+ /** Stable series ID — same value across remounts. */
115
+ id?: string;
44
116
  };
45
117
 
46
118
  declare type __VLS_Props_6 = {
47
- value: number;
48
- format?: Intl.NumberFormatOptions;
49
- locale?: string;
50
- spinDuration?: number;
119
+ sort?: SnapshotSort;
120
+ format?: TooltipFormatter;
51
121
  };
52
122
 
53
123
  declare type __VLS_Props_7 = {
54
- seriesId: string;
55
- format?: 'value' | 'percent';
124
+ items?: LegendItemOverride[];
125
+ position?: 'bottom' | 'right';
126
+ /** `'isolate'` shows only the clicked item; `'solo'` is a @deprecated alias. */
127
+ mode?: LegendMode;
56
128
  };
57
129
 
58
130
  declare type __VLS_Props_8 = {
59
- seriesId: string;
131
+ value: number;
132
+ /** Value-to-string formatter. Defaults to the current locale's `Intl.NumberFormat`. */
133
+ format?: (value: number) => string;
134
+ locale?: string;
135
+ spinDuration?: number;
60
136
  };
61
137
 
62
138
  declare type __VLS_Props_9 = {
139
+ /**
140
+ * Owning series id. **Optional** — when omitted, the first visible pie
141
+ * series is picked.
142
+ */
63
143
  seriesId?: string;
64
- sort?: TooltipSort;
144
+ /** 'value' shows only the value, 'percent' only the percent, 'both' shows both. Default: 'both'. */
145
+ mode?: PieLegendMode;
146
+ /** Custom formatter for the absolute slice value. */
147
+ format?: ValueFormatter;
65
148
  };
66
149
 
67
150
  declare function __VLS_template(): {
@@ -71,20 +154,297 @@ declare function __VLS_template(): {
71
154
  };
72
155
  refs: {
73
156
  containerRef: HTMLDivElement;
157
+ topOverlayRef: HTMLDivElement;
158
+ titleAnchor: HTMLDivElement;
159
+ infoBarAnchor: HTMLDivElement;
160
+ legendRightAnchor: HTMLDivElement;
161
+ legendAnchor: HTMLDivElement;
74
162
  };
75
163
  rootEl: HTMLDivElement;
76
164
  };
77
165
 
166
+ declare function __VLS_template_2(): {
167
+ attrs: Partial<{}>;
168
+ slots: Readonly<{
169
+ default?(ctx: {
170
+ snapshots: readonly SeriesSnapshot[];
171
+ time: number;
172
+ isHover: boolean;
173
+ }): unknown;
174
+ }> & {
175
+ default?(ctx: {
176
+ snapshots: readonly SeriesSnapshot[];
177
+ time: number;
178
+ isHover: boolean;
179
+ }): unknown;
180
+ };
181
+ refs: {};
182
+ rootEl: any;
183
+ };
184
+
185
+ declare function __VLS_template_3(): {
186
+ attrs: Partial<{}>;
187
+ slots: Readonly<{
188
+ default?(ctx: {
189
+ items: readonly LegendItem[];
190
+ }): unknown;
191
+ }> & {
192
+ default?(ctx: {
193
+ items: readonly LegendItem[];
194
+ }): unknown;
195
+ };
196
+ refs: {};
197
+ rootEl: any;
198
+ };
199
+
200
+ declare function __VLS_template_4(): {
201
+ attrs: Partial<{}>;
202
+ slots: Readonly<{
203
+ default?(ctx: {
204
+ slices: readonly SliceInfo[];
205
+ mode: PieLegendMode;
206
+ format: ValueFormatter;
207
+ }): unknown;
208
+ }> & {
209
+ default?(ctx: {
210
+ slices: readonly SliceInfo[];
211
+ mode: PieLegendMode;
212
+ format: ValueFormatter;
213
+ }): unknown;
214
+ };
215
+ refs: {};
216
+ rootEl: any;
217
+ };
218
+
219
+ declare function __VLS_template_5(): {
220
+ attrs: Partial<{}>;
221
+ slots: Readonly<{
222
+ default?(ctx: {
223
+ info: HoverInfo;
224
+ format: ValueFormatter;
225
+ }): unknown;
226
+ }> & {
227
+ default?(ctx: {
228
+ info: HoverInfo;
229
+ format: ValueFormatter;
230
+ }): unknown;
231
+ };
232
+ refs: {
233
+ containerRef: HTMLDivElement;
234
+ };
235
+ rootEl: any;
236
+ };
237
+
238
+ declare function __VLS_template_6(): {
239
+ attrs: Partial<{}>;
240
+ slots: {
241
+ default?(_: {}): any;
242
+ };
243
+ refs: {};
244
+ rootEl: any;
245
+ };
246
+
247
+ declare function __VLS_template_7(): {
248
+ attrs: Partial<{}>;
249
+ slots: Readonly<{
250
+ default?(ctx: {
251
+ snapshots: readonly SeriesSnapshot[];
252
+ time: number;
253
+ }): unknown;
254
+ }> & {
255
+ default?(ctx: {
256
+ snapshots: readonly SeriesSnapshot[];
257
+ time: number;
258
+ }): unknown;
259
+ };
260
+ refs: {
261
+ containerRef: HTMLDivElement;
262
+ };
263
+ rootEl: any;
264
+ };
265
+
266
+ declare function __VLS_template_8(): {
267
+ attrs: Partial<{}>;
268
+ slots: Readonly<{
269
+ default?(ctx: {
270
+ snapshots: readonly SeriesSnapshot[];
271
+ time: number;
272
+ isHover: boolean;
273
+ }): unknown;
274
+ }> & {
275
+ default?(ctx: {
276
+ snapshots: readonly SeriesSnapshot[];
277
+ time: number;
278
+ isHover: boolean;
279
+ }): unknown;
280
+ };
281
+ refs: {};
282
+ rootEl: any;
283
+ };
284
+
285
+ declare function __VLS_template_9(): {
286
+ attrs: Partial<{}>;
287
+ slots: Readonly<{
288
+ default?(ctx: {
289
+ value: number;
290
+ y: number;
291
+ bgColor: string;
292
+ isLive: boolean;
293
+ direction: YLabelDirection;
294
+ format: ValueFormatter;
295
+ }): unknown;
296
+ }> & {
297
+ default?(ctx: {
298
+ value: number;
299
+ y: number;
300
+ bgColor: string;
301
+ isLive: boolean;
302
+ direction: YLabelDirection;
303
+ format: ValueFormatter;
304
+ }): unknown;
305
+ };
306
+ refs: {};
307
+ rootEl: any;
308
+ };
309
+
78
310
  declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
79
311
 
312
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
313
+
314
+ declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
315
+
316
+ declare type __VLS_TemplateResult_4 = ReturnType<typeof __VLS_template_4>;
317
+
318
+ declare type __VLS_TemplateResult_5 = ReturnType<typeof __VLS_template_5>;
319
+
320
+ declare type __VLS_TemplateResult_6 = ReturnType<typeof __VLS_template_6>;
321
+
322
+ declare type __VLS_TemplateResult_7 = ReturnType<typeof __VLS_template_7>;
323
+
324
+ declare type __VLS_TemplateResult_8 = ReturnType<typeof __VLS_template_8>;
325
+
326
+ declare type __VLS_TemplateResult_9 = ReturnType<typeof __VLS_template_9>;
327
+
80
328
  declare type __VLS_WithTemplateSlots<T, S> = T & {
81
329
  new (): {
82
330
  $slots: S;
83
331
  };
84
332
  };
85
333
 
334
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
335
+ new (): {
336
+ $slots: S;
337
+ };
338
+ };
339
+
340
+ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
341
+ new (): {
342
+ $slots: S;
343
+ };
344
+ };
345
+
346
+ declare type __VLS_WithTemplateSlots_4<T, S> = T & {
347
+ new (): {
348
+ $slots: S;
349
+ };
350
+ };
351
+
352
+ declare type __VLS_WithTemplateSlots_5<T, S> = T & {
353
+ new (): {
354
+ $slots: S;
355
+ };
356
+ };
357
+
358
+ declare type __VLS_WithTemplateSlots_6<T, S> = T & {
359
+ new (): {
360
+ $slots: S;
361
+ };
362
+ };
363
+
364
+ declare type __VLS_WithTemplateSlots_7<T, S> = T & {
365
+ new (): {
366
+ $slots: S;
367
+ };
368
+ };
369
+
370
+ declare type __VLS_WithTemplateSlots_8<T, S> = T & {
371
+ new (): {
372
+ $slots: S;
373
+ };
374
+ };
375
+
376
+ declare type __VLS_WithTemplateSlots_9<T, S> = T & {
377
+ new (): {
378
+ $slots: S;
379
+ };
380
+ };
381
+
86
382
  export declare const andromeda: ThemePreset;
87
383
 
384
+ /**
385
+ * Chart-level animation configuration. Split into two independent domains so
386
+ * per-series defaults can't bleed into viewport-interaction timings:
387
+ *
388
+ * - `points` — animations applied to data: per-series entrance tween, live-
389
+ * tracking smoothing of the last candle/bar/line value, pulse cadence.
390
+ * These values act as defaults for each series. Per-series options always
391
+ * win unless the chart-level category is explicitly `false`, in which case
392
+ * the whole category is forced off.
393
+ *
394
+ * - `viewport` — animations applied to viewport interactions: post-gesture
395
+ * rebound duration and Y-axis range smoothing.
396
+ *
397
+ * User-initiated pan/zoom (wheel, drag, touch) always applies instantly. The
398
+ * latency of an exponential chase reads as laggy in practice. API-driven
399
+ * transitions (`fitToData`, `scrollToEnd`) and post-gesture rebound still
400
+ * tween via their own fixed-duration ease-out.
401
+ */
402
+ declare interface AnimationsConfig {
403
+ /**
404
+ * Data-series animations. `false` disables every point animation (entrance,
405
+ * live-smoothing, pulse) across every series. An object overrides individual
406
+ * categories; omitted fields fall back to the built-in defaults.
407
+ */
408
+ points?: false | {
409
+ /** Per-point entrance duration (ms). `false`/`0` disables. Default: 400. */
410
+ enterMs?: AnimationTime;
411
+ /**
412
+ * Exponential-smoothing time constant (ms) for live last-value chase.
413
+ * `false`/`0` disables smoothing — the last point snaps to the target.
414
+ * Default: 70 ms (equivalent to the legacy `liveSmoothRate = 14`).
415
+ */
416
+ smoothMs?: AnimationTime;
417
+ /** Pulse cycle period (ms) for the line last-point halo. Default: 600. */
418
+ pulseMs?: AnimationTime;
419
+ };
420
+ /**
421
+ * Viewport interaction animations. `false` disables both rebound and Y-axis
422
+ * smoothing — viewport changes snap instantly.
423
+ */
424
+ viewport?: false | {
425
+ /** Rebound (snap-back) duration after pan/zoom overshoot (ms). Default: 350. */
426
+ reboundMs?: AnimationTime;
427
+ /**
428
+ * Y-axis range transition scale. **Frame-count-based, calibrated at
429
+ * 60 Hz — not wall-clock ms.** Each render frame closes
430
+ * `min(1, 16 / yAxisMs)` of the remaining gap. Default 80 ≈ the
431
+ * legacy 0.2-per-frame closure. `false` / `0` snaps the Y range
432
+ * instantly. Unlike `smoothMs` / `entryMs` / `reboundMs`, the
433
+ * perceptual duration scales with frame time on refresh rates far
434
+ * from 60 Hz.
435
+ */
436
+ yAxisMs?: AnimationTime;
437
+ };
438
+ }
439
+
440
+ /** Options passed when creating a new {@link ChartInstance}. */
441
+ /**
442
+ * Time-value or boolean used throughout the animation API. `false` disables
443
+ * the category; a number configures its duration/time-constant in milliseconds
444
+ * (`0` also disables, useful when the caller wants a number shape).
445
+ */
446
+ declare type AnimationTime = number | false;
447
+
88
448
  /**
89
449
  * Defines a bound for the Y axis.
90
450
  *
@@ -103,11 +463,17 @@ export declare interface AxisConfig {
103
463
 
104
464
  export declare const ayuMirage: ThemePreset;
105
465
 
106
- export declare const BarSeries: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
107
- seriesId: (id: string) => any;
108
- }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
109
- onSeriesId?: ((id: string) => any) | undefined;
110
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
466
+ /**
467
+ * Entrance animation styles for bars.
468
+ * - `'none'` — no animation.
469
+ * - `'fade'` — opacity 0→1.
470
+ * - `'grow'` — height grows from baseline.
471
+ * - `'slide'` — translates in from the right with a fade.
472
+ * - `'fade-grow'` *(default)* — fade + grow combined.
473
+ */
474
+ declare type BarEntryAnimation = 'none' | 'fade' | 'grow' | 'slide' | 'fade-grow';
475
+
476
+ export declare const BarSeries: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
111
477
 
112
478
  /** Visual options for a bar series. */
113
479
  export declare interface BarSeriesOptions {
@@ -118,19 +484,100 @@ export declare interface BarSeriesOptions {
118
484
  barWidthRatio: number;
119
485
  /** Stacking mode. Default: 'off'. */
120
486
  stacking: StackingMode;
487
+ /**
488
+ * Entrance animation style for newly appended bars. Style is specific to
489
+ * the bar series; there is no chart-level override for style — only for
490
+ * duration. Default: `'fade-grow'`.
491
+ *
492
+ * @see entryMs — cross-linked duration for this animation.
493
+ */
494
+ entryAnimation?: BarEntryAnimation;
495
+ /** @deprecated Use {@link entryAnimation} instead. */
496
+ enterAnimation?: BarEntryAnimation;
497
+ /**
498
+ * Entrance animation duration in milliseconds. `false` or `0` disables the
499
+ * per-bar entrance (equivalent to `entryAnimation: 'none'`). Omit to inherit
500
+ * from {@link AnimationsConfig.points}.`entryMs` (default 400).
501
+ *
502
+ * When `animations.points.entryMs` is `false` at the chart level, the
503
+ * entrance is forced off regardless of this field.
504
+ *
505
+ * @see BarSeriesOptions.entryAnimation
506
+ */
507
+ entryMs?: number | false;
508
+ /** @deprecated Use {@link entryMs} instead. */
509
+ enterMs?: number | false;
510
+ /**
511
+ * Exponential-smoothing time constant (ms) for live-tracking the last
512
+ * bar's value under `updateLastPoint`. `0` or `false` snaps directly to the
513
+ * target (no smoothing). Omit to inherit from
514
+ * {@link AnimationsConfig.points}.`smoothMs` (default 70 ms).
515
+ *
516
+ * When `animations.points.smoothMs` is `false` at the chart level, smoothing
517
+ * is forced off regardless of this field.
518
+ */
519
+ smoothMs?: number | false;
121
520
  }
122
521
 
123
522
  /** @deprecated Use {@link StackingMode} instead. */
124
523
  export declare type BarStacking = StackingMode;
125
524
 
126
- /** Lookup a theme by name (defaults to "One Dark Pro") */
127
- export declare function buildTheme(themeName: string): ChartTheme;
525
+ /**
526
+ * Snapshot every visible series / layer at `time`. Used by hover overlays
527
+ * (`InfoBar` in hover mode, `Tooltip`). Hidden series and hidden layers are
528
+ * skipped automatically — the returned array reflects what the chart would
529
+ * actually be drawing.
530
+ *
531
+ * The result is cached per `(chart, cacheKey)` slot; as long as
532
+ * `chart.getOverlayVersion()` hasn't changed and `time`/`sort` match the
533
+ * cached call, the **same reference** is returned. This makes
534
+ * `React.memo((a, b) => a.snapshots === b.snapshots)` skip renders on
535
+ * crosshair moves that stay within one data point.
536
+ */
537
+ export declare function buildHoverSnapshots(chart: ChartInstance, args: BuildHoverSnapshotsArgs): readonly SeriesSnapshot[];
538
+
539
+ export declare interface BuildHoverSnapshotsArgs {
540
+ /** Timestamp to resolve each series at. Typically `crosshair.time`. */
541
+ time: number;
542
+ /** Sort the output by numeric value. Default: `'none'`. */
543
+ sort?: SnapshotSort;
544
+ /**
545
+ * Cache bucket key. Distinct buckets (e.g. `'tooltip'`, `'infobar-hover'`)
546
+ * let separate overlays cache independently so they don't invalidate each
547
+ * other on every call.
548
+ */
549
+ cacheKey: string;
550
+ }
551
+
552
+ /**
553
+ * Snapshot every visible series / layer at its own last point. For
554
+ * multi-layer renderers each layer contributes its own `time`, so ragged
555
+ * streams (layer 1 newer than layer 0) show correctly instead of stalling
556
+ * at the primary layer's timestamp.
557
+ *
558
+ * Cached by `(chart, cacheKey)` + `sort`, invalidated on
559
+ * `chart.getOverlayVersion()` bump. `time` is not an input, so the slot is
560
+ * stored with `time: null`.
561
+ */
562
+ export declare function buildLastSnapshots(chart: ChartInstance, args: BuildLastSnapshotsArgs): readonly SeriesSnapshot[];
563
+
564
+ export declare interface BuildLastSnapshotsArgs {
565
+ sort?: SnapshotSort;
566
+ cacheKey: string;
567
+ }
568
+
569
+ /**
570
+ * Entrance animation styles for candlesticks (shown when a new candle appears via `appendData`).
571
+ * - `'none'` — no animation.
572
+ * - `'fade'` — opacity 0→1.
573
+ * - `'unfold'` — body scales from the open line outward.
574
+ * - `'slide'` — translates in from the right with a fade.
575
+ * - `'fade-unfold'` *(default)* — fade + unfold combined; the default because a lone fade is
576
+ * hard to notice in streaming demos, while the body-unfold gives a clear visual anchor.
577
+ */
578
+ declare type CandlestickEntryAnimation = 'none' | 'fade' | 'unfold' | 'slide' | 'fade-unfold';
128
579
 
129
- export declare const CandlestickSeries: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
130
- seriesId: (id: string) => any;
131
- }, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
132
- onSeriesId?: ((id: string) => any) | undefined;
133
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
580
+ export declare const CandlestickSeries: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
134
581
 
135
582
  /** Visual options for a candlestick series. */
136
583
  export declare interface CandlestickSeriesOptions {
@@ -143,7 +590,42 @@ export declare interface CandlestickSeriesOptions {
143
590
  /** Width of candle body as a fraction of the available bar slot (0-1). */
144
591
  bodyWidthRatio: number;
145
592
  /** Apply a subtle vertical gradient to candle bodies. Default: true. */
593
+ bodyGradient?: boolean;
594
+ /** @deprecated Use {@link bodyGradient} instead. */
146
595
  candleGradient?: boolean;
596
+ /**
597
+ * Entrance animation style for newly appended candles. Style is specific to
598
+ * the candlestick; there is no chart-level override for style — only for
599
+ * duration. Default: `'unfold'`.
600
+ *
601
+ * @see entryMs — cross-linked duration for this animation.
602
+ */
603
+ entryAnimation?: CandlestickEntryAnimation;
604
+ /** @deprecated Use {@link entryAnimation} instead. */
605
+ enterAnimation?: CandlestickEntryAnimation;
606
+ /**
607
+ * Entrance animation duration in milliseconds. `false` or `0` disables the
608
+ * per-candle entrance (equivalent to `entryAnimation: 'none'`). Omit to
609
+ * inherit from {@link AnimationsConfig.points}.`entryMs` (default 400).
610
+ *
611
+ * When `animations.points.entryMs` is `false` at the chart level, the
612
+ * entrance is forced off regardless of this field.
613
+ *
614
+ * @see CandlestickSeriesOptions.entryAnimation
615
+ */
616
+ entryMs?: number | false;
617
+ /** @deprecated Use {@link entryMs} instead. */
618
+ enterMs?: number | false;
619
+ /**
620
+ * Exponential-smoothing time constant (ms) for live-tracking the last
621
+ * candle's O/H/L/C under `updateLastPoint`. `0` or `false` snaps directly
622
+ * to the target (no smoothing). Omit to inherit from
623
+ * {@link AnimationsConfig.points}.`smoothMs` (default 70 ms).
624
+ *
625
+ * When `animations.points.smoothMs` is `false` at the chart level, smoothing
626
+ * is forced off regardless of this field.
627
+ */
628
+ smoothMs?: number | false;
147
629
  }
148
630
 
149
631
  export declare const catppuccin: ThemePreset;
@@ -156,6 +638,14 @@ declare interface ChartEvents {
156
638
  viewportChange: () => void;
157
639
  dataUpdate: () => void;
158
640
  seriesChange: () => void;
641
+ /**
642
+ * Fired whenever any state that affects **overlay components** (InfoBar,
643
+ * Tooltip, Legend, YLabel, PieLegend, PieTooltip) changes. Superset of
644
+ * `dataUpdate` and `seriesChange` — also fires on visibility toggles,
645
+ * series option changes, and theme swaps. Overlay components should
646
+ * subscribe to this instead of stacking multiple listeners.
647
+ */
648
+ overlayChange: () => void;
159
649
  }
160
650
 
161
651
  /**
@@ -180,44 +670,38 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
180
670
  layers?: number;
181
671
  id?: string;
182
672
  }>): string;
183
- /** @deprecated Pass options as first argument: `addLineSeries({ layers: N, ...options })` */
184
- addLineSeries(layerCount: number, options?: Partial<LineSeriesOptions>): string;
185
- /** Set data for a specific layer within a line series. */
186
- setLineLayerData(id: string, layerIndex: number, data: TimePoint[]): void;
187
673
  /** Add a bar series and return its unique ID. */
188
674
  addBarSeries(options?: Partial<BarSeriesOptions & {
189
675
  layers?: number;
190
676
  id?: string;
191
677
  }>): string;
192
- /** @deprecated Pass options as first argument: `addBarSeries({ layers: N, ...options })` */
193
- addBarSeries(layerCount: number, options?: Partial<BarSeriesOptions>): string;
194
- /** Set data for a specific layer within a bar series. */
195
- setBarLayerData(id: string, layerIndex: number, data: TimePoint[]): void;
196
678
  /** Add a pie/donut series. Set `innerRadiusRatio > 0` for donut. */
197
679
  addPieSeries(options?: Partial<PieSeriesOptions & {
198
680
  id?: string;
199
681
  }>): string;
200
- /** Set data for a pie/donut series. */
201
- setPieData(id: string, data: PieSliceData[]): void;
202
682
  /** Remove a series by ID and clean up its resources. */
203
683
  removeSeries(id: string): void;
204
- /** Replace all data for a series (batch load). Accepts `Date` objects for time fields. */
205
- setSeriesData(id: string, data: OHLCInput[] | TimePointInput[]): void;
684
+ /**
685
+ * Replace all data for a series.
686
+ *
687
+ * - Single-layer series (candlestick, single-layer line/bar, pie): pass `data` directly.
688
+ * - Multi-layer series (line/bar with multiple layers): pass `layerIndex` to target a specific layer.
689
+ *
690
+ * For line/bar accepts `TimePointInput[]` (time may be `Date`); for candlestick accepts `OHLCInput[]`;
691
+ * for pie accepts `PieSliceData[]`. Time fields are normalized internally.
692
+ */
693
+ setSeriesData(id: string, data: unknown, layerIndex?: number): void;
206
694
  /** Append a new data point to the end of a series (real-time tick). */
207
- appendData(id: string, point: OHLCInput | TimePointInput): void;
695
+ appendData(id: string, point: OHLCInput | TimePointInput, layerIndex?: number): void;
208
696
  /** Update the last data point of a series in place (e.g. live candle update). */
209
- updateData(id: string, point: OHLCInput | TimePointInput): void;
697
+ updateData(id: string, point: OHLCInput | TimePointInput, layerIndex?: number): void;
210
698
  /** Update visual options (color, width, etc.) for an existing series. */
211
699
  updateSeriesOptions(id: string, options: Partial<CandlestickSeriesOptions> | Partial<LineSeriesOptions> | Partial<BarSeriesOptions> | Partial<PieSeriesOptions>): void;
212
700
  /**
213
- * Batch multiple updates: suppress recomputes until `fn` returns.
214
- * Equivalent to `beginUpdate()` / `endUpdate()` but safer (always calls endUpdate even on throw).
701
+ * Batch multiple updates: suppress recomputes until `fn` returns. Exceptions
702
+ * inside `fn` still flush the batch so counters don't leak across calls.
215
703
  */
216
704
  batch(fn: () => void): void;
217
- /** @deprecated Use {@link batch} instead. */
218
- beginUpdate(): void;
219
- /** @deprecated Use {@link batch} instead. */
220
- endUpdate(): void;
221
705
  /** Show or hide a series. Hidden series are not rendered and excluded from Y-range. */
222
706
  setSeriesVisible(seriesId: string, visible: boolean): void;
223
707
  isSeriesVisible(seriesId: string): boolean;
@@ -227,6 +711,22 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
227
711
  /** Auto-fit the viewport to show all data across every series. */
228
712
  fitContent(): void;
229
713
  getVisibleRange(): VisibleRange;
714
+ /**
715
+ * Imperatively set the visible time range.
716
+ *
717
+ * Two forms:
718
+ * - `{ from, to }` — explicit millisecond range. Cancels any in-flight
719
+ * animation and applies immediately. Auto-scroll stays on only if the
720
+ * tail is inside the new range (mirrors pan semantics).
721
+ * - `number N` — shorthand for "show the last N bars from the tail".
722
+ * Resolved against the current data bounds and data interval; keeps
723
+ * auto-scroll on so streaming ticks continue to track the tail.
724
+ * No-op if data hasn't loaded yet.
725
+ *
726
+ * Typical use: on mount, zoom to the last N bars while keeping the full
727
+ * buffer available for pan-back history inspection.
728
+ */
729
+ setVisibleRange(range: VisibleRange | number): void;
230
730
  getYRange(): YRange;
231
731
  getCrosshairPosition(): CrosshairPosition | null;
232
732
  /** Get the last visible value and whether the absolute last point is on screen. */
@@ -239,57 +739,129 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
239
739
  getLastData(seriesId: string): OHLCData | TimePoint | null;
240
740
  /** Find the data point closest to the given timestamp within one data interval. */
241
741
  getDataAtTime(seriesId: string, time: number): OHLCData | TimePoint | null;
242
- /** Get all layers' data at a given time for multi-layer series (Bar/Line with stacking). */
742
+ /**
743
+ * Get all layers' data at a given time for multi-layer series (Bar/Line
744
+ * with stacking). Each entry carries the owning `layerIndex` and the
745
+ * snapped sample time — callers must not derive layer identity from the
746
+ * array index, because hidden layers are filtered out.
747
+ */
243
748
  getLayerSnapshots(seriesId: string, time: number): {
749
+ layerIndex: number;
750
+ time: number;
244
751
  value: number;
245
752
  color: string;
246
753
  }[] | null;
247
754
  getSeriesIds(): string[];
755
+ /**
756
+ * Type of a registered series, or `null` for unknown ids. `'pie'` for
757
+ * `PieRenderer`; everything else is a time-series (`'time'`).
758
+ */
759
+ getSeriesType(seriesId: string): 'pie' | 'time' | null;
760
+ /**
761
+ * Filter `getSeriesIds()` by renderer type. `'pie'` returns pie series,
762
+ * `'time'` returns line/bar/candlestick.
763
+ *
764
+ * - `opts.visibleOnly` — exclude series with `isSeriesVisible=false`; for
765
+ * multi-layer series also exclude when every layer is hidden.
766
+ * - `opts.singleLayerOnly` — exclude series with more than one layer.
767
+ * Useful for YLabel fallback priority (stick to a single line first).
768
+ */
769
+ getSeriesIdsByType(type: 'pie' | 'time', opts?: {
770
+ visibleOnly?: boolean;
771
+ singleLayerOnly?: boolean;
772
+ }): string[];
773
+ /**
774
+ * Cumulative top last-value for stacked series — the point a YLabel badge
775
+ * anchors to on the rendered stack head. Falls back to `getLastValue` for
776
+ * series without stacked concepts (Candlestick, single-layer Line/Bar).
777
+ * Returns `null` for unknown ids or empty series.
778
+ */
779
+ getStackedLastValue(seriesId: string): {
780
+ value: number;
781
+ isLive: boolean;
782
+ } | null;
783
+ /**
784
+ * Per-layer last snapshots with each layer's own `time`. Returns `null`
785
+ * for single-layer renderers or when no visible layer has data. Used by
786
+ * overlay components that must display every layer in last-mode even
787
+ * when layers advance at different rates (ragged streams).
788
+ */
789
+ getLayerLastSnapshots(seriesId: string): {
790
+ layerIndex: number;
791
+ time: number;
792
+ value: number;
793
+ color: string;
794
+ }[] | null;
248
795
  /** Get the primary display color for a series. */
249
796
  getSeriesColor(seriesId: string): string | null;
250
797
  getSeriesLabel(seriesId: string): string | undefined;
251
- /** Get per-layer colors for a series. Returns null for non-bar/line series (e.g. candlestick, pie). */
798
+ /** Get per-layer colors for a series. Returns null for single-layer non-bar/line series. */
252
799
  getSeriesLayers(seriesId: string): {
253
800
  color: string;
254
801
  }[] | null;
255
- /** Get all pie slices with computed colors and percentages. Returns null for non-pie series. */
256
- getPieSlices(seriesId: string): {
257
- label: string;
258
- value: number;
259
- percent: number;
260
- color: string;
261
- }[] | null;
262
- /** Get the hovered pie slice info (label, value, percentage, color). Returns null if no hover. */
263
- getPieHoverInfo(seriesId: string): {
264
- label: string;
265
- value: number;
266
- percent: number;
267
- color: string;
268
- } | null;
269
- /** Apply a new theme and update candlestick series colors. Line series keep their individual colors. */
802
+ /** Get all slices with computed colors and percentages. Returns null for series without slice data (e.g. candlestick, line, bar). */
803
+ getSliceInfo(seriesId: string): SliceInfo[] | null;
804
+ /** Get hover info (label/value/percent/color) for the currently hovered element, or null. */
805
+ getHoverInfo(seriesId: string): HoverInfo | null;
806
+ /** Apply a new theme and update series colors where appropriate. */
270
807
  setTheme(theme: ChartTheme): void;
271
808
  getTheme(): ChartTheme;
272
809
  /** Update axis configuration and re-render. */
273
810
  setAxis(config: AxisConfig): void;
811
+ /**
812
+ * Apply label-density knobs driven by `<YAxis labelCount=… minLabelSpacing=…>`
813
+ * — kept separate from {@link setAxis} so component props don't force a
814
+ * Y-animation reset. Triggers a viewportChange + repaint so static charts
815
+ * react without waiting for pan/zoom.
816
+ */
817
+ setYAxisLabelDensity(params: {
818
+ labelCount?: number | null;
819
+ minLabelSpacing?: number | null;
820
+ }): void;
821
+ /** Label-density knobs for the time axis — mirror of {@link setYAxisLabelDensity}. */
822
+ setTimeAxisLabelDensity(params: {
823
+ labelCount?: number | null;
824
+ minLabelSpacing?: number | null;
825
+ }): void;
274
826
  getMediaSize(): Size;
275
827
  /** Returns layout metrics for the chart area, Y axis, and time axis. */
276
828
  getLayout(): ChartLayout;
277
829
  getDataInterval(): number;
278
- /** Update viewport padding at runtime. Refits the visible range to current data bounds. */
830
+ /**
831
+ * Update viewport padding at runtime. Refits the visible time range to
832
+ * current data bounds **only when horizontal padding (left/right) changes**
833
+ * — vertical padding only affects the Y-range computation, so touching it
834
+ * shouldn't reset the user's zoom / auto-scroll state. This matters when
835
+ * a wrapper re-applies padding reactively (e.g. in response to a Title /
836
+ * TooltipLegend ResizeObserver).
837
+ */
279
838
  setPadding(padding: ChartOptions['padding']): void;
280
839
  /** Show or hide the background grid. Takes effect on the next render frame. */
281
- setGrid(grid: boolean): void;
840
+ setGrid(grid: {
841
+ visible: boolean;
842
+ }): void;
843
+ /**
844
+ * Set the visual state for one side of the chart. Typically called in
845
+ * response to the `onEdgeReached` callback:
846
+ * - `loading` while a history fetch is in flight,
847
+ * - `no-data` once the fetch confirmed there's nothing more,
848
+ * - `idle` when the host no longer wants any edge affordance.
849
+ * The state persists until replaced. `has-more` is accepted for API
850
+ * symmetry and currently renders identically to `idle`.
851
+ */
852
+ setEdgeState(side: EdgeSide, state: EdgeState): void;
853
+ /** Read the current host-declared state for a given edge. */
854
+ getEdgeState(side: EdgeSide): EdgeState;
282
855
  /** Notify chart that a YLabel is present (affects right padding). */
283
856
  setYLabel(has: boolean): void;
284
- private updatePieHover;
285
857
  private updateViewportPadding;
286
858
  /** Tear down the chart: cancel animations, remove listeners, and detach the canvas. */
287
859
  destroy(): void;
860
+ /** The attached performance monitor, or `null` when instrumentation is disabled. */
861
+ getPerfMonitor(): PerfMonitor | null;
288
862
  /** Compute the earliest and latest timestamps across all series. */
289
863
  private getDataBounds;
290
864
  private onDataChanged;
291
- /** Check whether the last data point of any series falls within the visible time range. */
292
- private isLastPointVisible;
293
865
  private updateDataInterval;
294
866
  private updateYRange;
295
867
  /** Resolve an {@link AxisBound} to a concrete numeric value. */
@@ -303,8 +875,17 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
303
875
  private updateScales;
304
876
  /** Expensive: background, grid, all series. Only on data/viewport/resize change. */
305
877
  private renderMain;
306
- /** Cheap overlay: crosshair, nearest-point dots, pulse animation. */
878
+ /** Cheap overlay: crosshair, nearest-point dots, pulse animation, edge indicator. */
307
879
  private renderOverlay;
880
+ private drawEdgeIndicators;
881
+ /**
882
+ * Pick the boundary time to anchor the edge indicator at. Prefer the
883
+ * cached value emitted by the most recent `edgeReached` — that's the
884
+ * *exact* point the user overshot. Fall back to the current data edge
885
+ * when no gesture has fired yet (host might invoke `setEdgeState`
886
+ * directly on mount to show a "no-data" marker from the start).
887
+ */
888
+ private resolveEdgeBoundary;
308
889
  }
309
890
 
310
891
  /** Layout metrics describing the chart area, Y axis, and time axis sizes. */
@@ -314,7 +895,6 @@ export declare interface ChartLayout {
314
895
  xAxisHeight: number;
315
896
  }
316
897
 
317
- /** Options passed when creating a new {@link ChartInstance}. */
318
898
  export declare interface ChartOptions {
319
899
  theme?: ChartTheme;
320
900
  axis?: AxisConfig;
@@ -334,8 +914,50 @@ export declare interface ChartOptions {
334
914
  };
335
915
  /** Enable zoom, pan, and crosshair interactions. Defaults to true. */
336
916
  interactive?: boolean;
337
- /** Show the background grid. Defaults to true. */
338
- grid?: boolean;
917
+ /** Background grid configuration. Default: `{ visible: true }`. */
918
+ grid?: {
919
+ visible: boolean;
920
+ };
921
+ /**
922
+ * Animation control. Split into `points` (data-series animations) and
923
+ * `viewport` (pan/zoom rebound + Y-axis smoothing). See
924
+ * {@link AnimationsConfig} for the full shape and defaults.
925
+ *
926
+ * Shorthands:
927
+ * - `animations: true` (or omitted) uses built-in defaults.
928
+ * - `animations: false` disables every animation category.
929
+ * - `animations: { points: false }` disables all data-series animations.
930
+ * - `animations: { viewport: false }` disables rebound + Y-axis smoothing.
931
+ *
932
+ * Per-series options (`enterMs`, `smoothMs`, etc.) override chart-level
933
+ * defaults unless the category is explicitly `false` — then the chart-
934
+ * level gate wins.
935
+ */
936
+ animations?: boolean | AnimationsConfig;
937
+ /**
938
+ * Invoked after the user releases a pan/zoom gesture that pulled the
939
+ * viewport past a data edge by more than 10% of the visible range. Hosts
940
+ * typically respond by prefetching more history and calling
941
+ * {@link ChartInstance.setEdgeState} to show a spinner or "no more data"
942
+ * indicator at the corresponding edge.
943
+ */
944
+ onEdgeReached?: (info: EdgeReachedInfo) => void;
945
+ /**
946
+ * Runtime performance instrumentation. Opt-in — absent by default so the
947
+ * hot render path stays free of timing/counting overhead.
948
+ *
949
+ * - `false` / omitted — no instrumentation, no HUD, byte-identical to a perf-free build.
950
+ * - `true` — create an internal {@link PerfMonitor} and mount a visible HUD overlay.
951
+ * - `{ hud: true, ...options }` — same, with monitor options forwarded.
952
+ * - `{ hud: false, ...options }` — instrument but do not render a HUD (useful when
953
+ * the host app consumes stats via `monitor.onFrame` and renders its own UI).
954
+ * - `PerfMonitor` instance — attach to a pre-constructed monitor. Useful when several
955
+ * charts share one telemetry sink. HUD defaults to off in this mode.
956
+ */
957
+ perf?: boolean | PerfMonitor | (PerfMonitorOptions & {
958
+ hud?: boolean;
959
+ monitor?: PerfMonitor;
960
+ });
339
961
  }
340
962
 
341
963
  /**
@@ -399,6 +1021,8 @@ export declare interface ChartTheme {
399
1021
  };
400
1022
  }
401
1023
 
1024
+ export declare function computeTooltipPosition(args: TooltipPositionArgs): TooltipPosition;
1025
+
402
1026
  /**
403
1027
  * Build a complete {@link ThemePreset} from a partial config.
404
1028
  * Only `background` is required — everything else is derived from it.
@@ -425,6 +1049,27 @@ export declare function detectInterval(times: number[]): number;
425
1049
 
426
1050
  export declare const dracula: ThemePreset;
427
1051
 
1052
+ /** Payload for {@link ChartOptions.onEdgeReached}. */
1053
+ declare interface EdgeReachedInfo {
1054
+ side: EdgeSide;
1055
+ /** Time units the user pulled past the soft bound. */
1056
+ overshoot: number;
1057
+ /** Soft-bound timestamp that was crossed (dataStart - leftPad or dataEnd + rightPad). */
1058
+ boundaryTime: number;
1059
+ }
1060
+
1061
+ /** Which data side the user pulled past during a gesture. */
1062
+ declare type EdgeSide = 'left' | 'right';
1063
+
1064
+ /**
1065
+ * Host-controlled visual state for a chart edge:
1066
+ * - `idle`: nothing rendered (default).
1067
+ * - `loading`: a subtle spinner appears in the overshoot area.
1068
+ * - `no-data`: a dashed boundary line + "No more data" label appears at the data edge.
1069
+ * - `has-more`: reserved — currently behaves like `idle`. Use when more data exists but is not being fetched.
1070
+ */
1071
+ declare type EdgeState = 'idle' | 'loading' | 'no-data' | 'has-more';
1072
+
428
1073
  declare class EventEmitter<Events = Record<string, Listener>> {
429
1074
  private listeners;
430
1075
  on<K extends string & keyof Events>(event: K, listener: Events[K] & Listener): void;
@@ -433,10 +1078,37 @@ declare class EventEmitter<Events = Record<string, Listener>> {
433
1078
  removeAllListeners(): void;
434
1079
  }
435
1080
 
1081
+ /**
1082
+ * Compact notation for large magnitudes (K / M / B / T) with adaptive
1083
+ * precision for values below 1. Default decimal count for the compact
1084
+ * suffixes can be overridden via `opts.decimals`.
1085
+ */
1086
+ export declare function formatCompact(v: number, opts?: {
1087
+ decimals?: number;
1088
+ }): string;
1089
+
436
1090
  export declare function formatDate(timestamp: number): string;
437
1091
 
1092
+ /**
1093
+ * Full-precision display that adapts decimal count to the value's magnitude.
1094
+ * No K/M/B compression — callers wanting a short label should use
1095
+ * `formatCompact` instead.
1096
+ */
1097
+ export declare function formatPriceAdaptive(v: number): string;
1098
+
438
1099
  export declare function formatTime(timestamp: number, interval: number): string;
439
1100
 
1101
+ declare type FrameKind = 'main' | 'overlay';
1102
+
1103
+ declare interface FrameTimingSample {
1104
+ /** Wall-clock ms for the most recent frame. */
1105
+ last: number;
1106
+ /** Median frame time over the rolling window. */
1107
+ p50: number;
1108
+ /** Tail frame time (worst 5%) — useful for spotting stutter. */
1109
+ p95: number;
1110
+ }
1111
+
440
1112
  export declare const githubLight: ThemePreset;
441
1113
 
442
1114
  export declare const gruvbox: ThemePreset;
@@ -445,8 +1117,65 @@ export declare const handwritten: ThemePreset;
445
1117
 
446
1118
  export declare const highContrast: ThemePreset;
447
1119
 
1120
+ /** Shape returned by {@link SeriesRenderer.getHoverInfo} / per-slice entries of {@link SeriesRenderer.getSliceInfo}. */
1121
+ export declare interface HoverInfo {
1122
+ label: string;
1123
+ value: number;
1124
+ percent: number;
1125
+ color: string;
1126
+ }
1127
+
1128
+ export declare const InfoBar: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
1129
+
448
1130
  export declare const lavenderMist: ThemePreset;
449
1131
 
1132
+ export declare const Legend: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
1133
+
1134
+ /**
1135
+ * Canonical legend item — the unit every framework Legend passes to its
1136
+ * scoped slot (and the shape the built-in default UI consumes).
1137
+ *
1138
+ * Each item is **self-contained**: it carries its own identity and
1139
+ * pre-bound `toggle` / `isolate` closures, so slot code can freely sort,
1140
+ * filter, or remap items without risking a click on one row mutating the
1141
+ * wrong series.
1142
+ *
1143
+ * - `id` — row key for list rendering (React `key`, Vue `:key`,
1144
+ * Svelte `each … (key)`). Guaranteed unique within the array.
1145
+ * - `seriesId` — owning series id, **never includes a layer suffix**.
1146
+ * Use this for filtering/grouping; not unique across multi-layer rows.
1147
+ * - `layerIndex` — layer within a multi-layer series; `undefined` for
1148
+ * single-layer rows.
1149
+ * - `isDisabled` — current toggled-off state, derived from
1150
+ * `isSeriesVisible` / `isLayerVisible` plus local isolate-state in the
1151
+ * Legend component.
1152
+ */
1153
+ export declare interface LegendItem {
1154
+ readonly id: string;
1155
+ readonly seriesId: string;
1156
+ readonly layerIndex?: number;
1157
+ readonly label: string;
1158
+ readonly color: string;
1159
+ readonly isDisabled: boolean;
1160
+ /** Toggle just this item's visibility. */
1161
+ readonly toggle: () => void;
1162
+ /** Show only this item; calling again reveals everything (isolate/unisolate). */
1163
+ readonly isolate: () => void;
1164
+ }
1165
+
1166
+ /**
1167
+ * Minimal visual shape the {@link LegendProps.items} override accepts. The
1168
+ * canonical {@link LegendItem} (re-exported from `@wick-charts/core`) carries
1169
+ * the full identity + closures; those aren't meaningful for a pre-baked,
1170
+ * non-interactive legend.
1171
+ */
1172
+ declare interface LegendItemOverride {
1173
+ label: string;
1174
+ color: string;
1175
+ }
1176
+
1177
+ declare type LegendMode = 'toggle' | 'isolate' | 'solo';
1178
+
450
1179
  export declare const lightPink: ThemePreset;
451
1180
 
452
1181
  export declare const lightTheme: ChartTheme;
@@ -454,11 +1183,15 @@ export declare const lightTheme: ChartTheme;
454
1183
  /** @deprecated Use {@link TimePoint} instead. */
455
1184
  export declare type LineData = TimePoint;
456
1185
 
457
- export declare const LineSeries: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
458
- seriesId: (id: string) => any;
459
- }, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
460
- onSeriesId?: ((id: string) => any) | undefined;
461
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1186
+ /**
1187
+ * Entrance animation styles for new line points.
1188
+ * - `'none'` — new segments appear instantly.
1189
+ * - `'grow'` *(default)* — trailing segment reveals left-to-right.
1190
+ * - `'fade'` — geometry fixed; trailing segment strokes in with alpha 0→1.
1191
+ */
1192
+ declare type LineEntryAnimation = 'none' | 'grow' | 'fade';
1193
+
1194
+ export declare const LineSeries: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
462
1195
 
463
1196
  /** Visual options for a line series. */
464
1197
  export declare interface LineSeriesOptions {
@@ -466,13 +1199,59 @@ export declare interface LineSeriesOptions {
466
1199
  label?: string;
467
1200
  /** One color per layer. */
468
1201
  colors: string[];
469
- lineWidth: number;
470
- /** Whether to render a gradient area fill below the line (or between stacked layers). */
471
- areaFill: boolean;
472
- /** Whether to show an animated pulsing dot at the last data point. */
1202
+ /** Stroke width in CSS pixels. Default: 1. `0` hides the line stroke. */
1203
+ strokeWidth: number;
1204
+ /** Area-fill configuration. Default: `{ visible: true }`. */
1205
+ area: {
1206
+ visible: boolean;
1207
+ };
1208
+ /**
1209
+ * Whether to show an animated pulsing dot at the last data point.
1210
+ */
473
1211
  pulse: boolean;
1212
+ /**
1213
+ * Pulse cycle period in milliseconds. `false`/`0` disables the halo (both
1214
+ * the drawing and the associated animation loop). Omit to inherit from
1215
+ * {@link AnimationsConfig.points}.`pulseMs` (default 600 ms). When
1216
+ * `animations.points.pulseMs` is `false` at the chart level the pulse is
1217
+ * forced off regardless of this field.
1218
+ */
1219
+ pulseMs?: number | false;
474
1220
  /** Stacking mode. Default: 'off'. */
475
1221
  stacking: StackingMode;
1222
+ /**
1223
+ * Entrance animation style for new points. Style is specific to the line
1224
+ * series; there is no chart-level override for style — only for duration.
1225
+ * Default: `'grow'`.
1226
+ *
1227
+ * @see entryMs — cross-linked duration for this animation.
1228
+ */
1229
+ entryAnimation?: LineEntryAnimation;
1230
+ /** @deprecated Use {@link entryAnimation} instead. */
1231
+ enterAnimation?: LineEntryAnimation;
1232
+ /**
1233
+ * Entrance animation duration in milliseconds. `false` or `0` disables the
1234
+ * per-point entrance (equivalent to `entryAnimation: 'none'`). Omit to
1235
+ * inherit from {@link AnimationsConfig.points}.`entryMs` (default 400).
1236
+ *
1237
+ * When `animations.points.entryMs` is `false` at the chart level, the
1238
+ * entrance is forced off regardless of this field.
1239
+ *
1240
+ * @see LineSeriesOptions.entryAnimation
1241
+ */
1242
+ entryMs?: number | false;
1243
+ /** @deprecated Use {@link entryMs} instead. */
1244
+ enterMs?: number | false;
1245
+ /**
1246
+ * Exponential-smoothing time constant (ms) for live-tracking the last
1247
+ * point's value under `updateLastPoint`. `0` or `false` snaps directly to
1248
+ * the target (no smoothing). Omit to inherit from
1249
+ * {@link AnimationsConfig.points}.`smoothMs` (default 70 ms).
1250
+ *
1251
+ * When `animations.points.smoothMs` is `false` at the chart level, smoothing
1252
+ * is forced off regardless of this field.
1253
+ */
1254
+ smoothMs?: number | false;
476
1255
  }
477
1256
 
478
1257
  declare type Listener = (...args: any[]) => void;
@@ -490,7 +1269,7 @@ export declare const nightOwl: ThemePreset;
490
1269
  /** Convert a {@link TimeValue} (number ms or Date) to a millisecond timestamp. */
491
1270
  export declare function normalizeTime(t: TimeValue): number;
492
1271
 
493
- export declare const NumberFlow: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{}>, {
1272
+ export declare const NumberFlow: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{}>, {
494
1273
  locale: string;
495
1274
  spinDuration: number;
496
1275
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLSpanElement>;
@@ -516,30 +1295,216 @@ export declare const panda: ThemePreset;
516
1295
 
517
1296
  export declare const peachCream: ThemePreset;
518
1297
 
519
- export declare const PieLegend: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{}>, {
520
- format: "value" | "percent";
521
- }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1298
+ /**
1299
+ * Collects per-frame timing, draw-call counts, per-series render ms, and heap
1300
+ * usage. All collection sites short-circuit to no-ops when no monitor is
1301
+ * attached to the chart, so the zero-perf path remains byte-identical to a
1302
+ * monitorless build.
1303
+ *
1304
+ * Not thread-safe (there are no threads) — a single chart writes to a single
1305
+ * monitor. Multiple charts may share a monitor, but `perSeries` keys must be
1306
+ * unique across charts or samples will collide.
1307
+ */
1308
+ declare class PerfMonitor {
1309
+ /** Draw-call tally map for the main layer. Mutated in place by the counting context; cleared at the start of each frame. */
1310
+ readonly drawCallsMain: Map<string, number>;
1311
+ /** Draw-call tally map for the overlay layer. Same contract as `drawCallsMain`. */
1312
+ readonly drawCallsOverlay: Map<string, number>;
1313
+ private readonly mainMs;
1314
+ private readonly overlayMs;
1315
+ private readonly mainStamps;
1316
+ private readonly overlayStamps;
1317
+ private readonly perSeriesMs;
1318
+ private readonly perSeriesStamps;
1319
+ private readonly listeners;
1320
+ private readonly windowMs;
1321
+ private readonly maxSamples;
1322
+ private readonly heapInterval;
1323
+ private heapCounter;
1324
+ private heapMb;
1325
+ private mainFrameCount;
1326
+ private overlayFrameCount;
1327
+ /** Most recent frame timestamp across either layer — anchor for age-based trimming. */
1328
+ private lastStamp;
1329
+ constructor(options?: PerfMonitorOptions);
1330
+ /** Clear the draw-call tally for the given layer. Call at the start of each frame. */
1331
+ resetDrawCalls(kind: FrameKind): void;
1332
+ /** Record a completed frame's wall-clock duration and emit stats to subscribers. */
1333
+ recordFrame(kind: FrameKind, ms: number, timestamp: number): void;
1334
+ /** Record one series renderer's time slice inside the main pass. Called from inside `renderMain`, so the enclosing `recordFrame('main', …)` trim takes care of age. */
1335
+ recordSeries(id: string, ms: number, timestamp?: number): void;
1336
+ /** Drop samples older than `windowMs` behind the newest recorded stamp, and enforce the hard per-layer cap. */
1337
+ private trimAll;
1338
+ /** Subscribe to per-frame stat snapshots. Returns an unsubscribe function. */
1339
+ onFrame(cb: (stats: PerfStats) => void): () => void;
1340
+ /** Snapshot current stats. Safe to call outside frames. */
1341
+ getStats(): PerfStats;
1342
+ destroy(): void;
1343
+ private sampleHeap;
1344
+ }
1345
+
1346
+ declare interface PerfMonitorOptions {
1347
+ /**
1348
+ * Age of the rolling window in milliseconds. Samples older than this are
1349
+ * dropped from FPS / percentile calculations. Defaults to 5000 (5 seconds).
1350
+ *
1351
+ * Tradeoff: smaller windows react faster to load changes but are noisier;
1352
+ * larger windows smooth spikes but lag. 5 s is a balance — it's long
1353
+ * enough that p95 is meaningful and short enough that numbers visibly
1354
+ * settle when you stop interacting.
1355
+ */
1356
+ windowMs?: number;
1357
+ /**
1358
+ * Hard cap on retained samples per layer. Belt-and-suspenders against a
1359
+ * runaway high-FPS layer growing the buffer unbounded. Defaults to 2000.
1360
+ */
1361
+ maxSamples?: number;
1362
+ /** Sample `performance.memory` every Nth main frame. Defaults to 30 (~0.5s at 60fps). */
1363
+ heapSampleEveryNFrames?: number;
1364
+ }
1365
+
1366
+ declare interface PerfStats {
1367
+ /**
1368
+ * Main-layer renders per second, derived from the interval between recent main
1369
+ * frames. Charts render on demand (data change, pan, zoom, resize, streaming
1370
+ * tick), so `0` during an idle chart is normal — not a stutter. `0` until two
1371
+ * frames have been recorded.
1372
+ */
1373
+ mainRendersPerSec: number;
1374
+ /** Same as {@link mainRendersPerSec} but for the overlay (crosshair + pulse) layer. */
1375
+ overlayRendersPerSec: number;
1376
+ /** @deprecated Alias for {@link mainRendersPerSec}. Kept for older consumers. */
1377
+ fps: number;
1378
+ mainFrameMs: FrameTimingSample;
1379
+ overlayFrameMs: FrameTimingSample;
1380
+ /** Total frames recorded per layer. Lets consumers distinguish "no data yet" from "drew once and ms is 0". */
1381
+ frameCount: {
1382
+ main: number;
1383
+ overlay: number;
1384
+ };
1385
+ drawCalls: {
1386
+ main: Record<string, number>;
1387
+ overlay: Record<string, number>;
1388
+ };
1389
+ perSeries: Record<string, FrameTimingSample>;
1390
+ /** `null` on browsers without `performance.memory` (Firefox, Safari). */
1391
+ heapMb: number | null;
1392
+ }
1393
+
1394
+ /**
1395
+ * How per-slice labels are drawn on a pie/donut.
1396
+ *
1397
+ * - `'outside'` (default) — a short leader line runs from the slice edge to a
1398
+ * text block outside the pie. Reserves horizontal space so the pie shrinks
1399
+ * to fit. Matches the canonical infographic look.
1400
+ * - `'inside'` — text sits on the slice. Auto-skipped when the measured text
1401
+ * won't fit the slice chord at the label radius.
1402
+ * - `'none'` — the renderer draws no labels (PieLegend / PieTooltip still work).
1403
+ */
1404
+ declare interface PieLabelsOptions {
1405
+ /** Default: `'outside'`. */
1406
+ mode?: 'inside' | 'outside' | 'none';
1407
+ /** What to display per label. Default: `'both'` (e.g. `"BTC 42%"`). */
1408
+ content?: 'percent' | 'label' | 'both';
1409
+ /** Font size in CSS pixels. Default: 11. */
1410
+ fontSize?: number;
1411
+ /**
1412
+ * Slices narrower than this (in degrees) get no on-pie label. Default: 2.5°
1413
+ * (≈ 0.7% of the pie). Raise when many tiny slices would crowd the
1414
+ * de-cluster pass into unreadable overlaps.
1415
+ */
1416
+ minSliceAngle?: number;
1417
+ /** Leader-line radial segment length in CSS pixels. Default: 12. */
1418
+ elbowLen?: number;
1419
+ /** Gap between leader line and text in CSS pixels. Default: 6. */
1420
+ legPad?: number;
1421
+ /**
1422
+ * Radial distance in CSS pixels from the pie's outer edge to the natural
1423
+ * label anchor point. The label then extends horizontally outward by
1424
+ * {@link railWidth} before the text starts. Clamped internally against
1425
+ * {@link elbowLen}. Default: 14.
1426
+ */
1427
+ distance?: number;
1428
+ /**
1429
+ * Horizontal length of the final leader-line segment in CSS pixels — the
1430
+ * straight tail that runs from the radial elbow out to the text anchor.
1431
+ * Higher values give a longer visible "rail" before the label. Default: 16.
1432
+ */
1433
+ railWidth?: number;
1434
+ /**
1435
+ * Minimum vertical gap between adjacent outside labels on the same side,
1436
+ * expressed as a multiplier of {@link fontSize}. Default: 1.8.
1437
+ */
1438
+ labelGap?: number;
1439
+ /**
1440
+ * @deprecated No effect in the radial per-slice layout. A label's X is
1441
+ * pinned to its slice midangle, so forcing the "other" side would flip
1442
+ * text direction without moving the label and push text across the pie.
1443
+ * Kept in the option surface for backwards compatibility.
1444
+ */
1445
+ balanceSides?: boolean;
1446
+ }
1447
+
1448
+ export declare const PieLegend: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
1449
+
1450
+ declare type PieLegendMode = 'value' | 'percent' | 'both';
522
1451
 
523
- export declare const PieSeries: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
524
- seriesId: (id: string) => any;
525
- }, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{
526
- onSeriesId?: ((id: string) => any) | undefined;
527
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1452
+ export declare const PieSeries: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
528
1453
 
529
1454
  /** Visual options for a pie/donut series. `innerRadiusRatio > 0` makes it a donut. */
530
1455
  export declare interface PieSeriesOptions {
531
1456
  /** Palette fallback (defaults to theme.seriesColors). */
532
1457
  colors?: string[];
533
- /** 0 = pie, 0.6 = donut. Fraction of outer radius used as inner hole. */
1458
+ /** 0 = pie, 0.6 = donut. Fraction of the outer radius used as an inner hole. */
534
1459
  innerRadiusRatio: number;
535
- /** Gap between slices in radians (default 0.02). */
1460
+ /** Gap between slices in degrees. Default: 1.15° (≈ 0.02 rad). */
536
1461
  padAngle: number;
537
- /** Slice border color (default transparent). */
538
- strokeColor: string;
539
- /** Slice border width (default 0). */
540
- strokeWidth: number;
541
- /** Display label shown in tooltip. */
1462
+ /** Display the label shown in the tooltip. */
542
1463
  label?: string;
1464
+ /** Per-slice label rendering on the pie itself. See {@link PieLabelsOptions}. */
1465
+ sliceLabels?: PieLabelsOptions;
1466
+ /**
1467
+ * When `true`, enables pie motion effects: the outside-label entrance
1468
+ * draw-in on mount / data swap, and the hover-explode slice offset.
1469
+ * Default: `false` — labels paint fully on the first frame and hovered
1470
+ * slices stay in place (hover feedback is left to the tooltip / legend /
1471
+ * cursor). Enable for presentations where the motion adds narrative
1472
+ * value.
1473
+ */
1474
+ animate?: boolean;
1475
+ /**
1476
+ * Ambient *outer* drop-shadow behind each slice. Adds lift for flat
1477
+ * dashboards. Omit / `false` to disable (default). `true` uses soft
1478
+ * defaults; pass an object to tune individually.
1479
+ */
1480
+ shadow?: boolean | {
1481
+ /** Shadow color. Default: `rgba(0, 0, 0, 0.22)`. */
1482
+ color?: string;
1483
+ /** Blur radius in CSS pixels. Default: 24. */
1484
+ blur?: number;
1485
+ /** Horizontal offset in CSS pixels. Default: 0. */
1486
+ offsetX?: number;
1487
+ /** Vertical offset in CSS pixels. Default: 10. */
1488
+ offsetY?: number;
1489
+ };
1490
+ /**
1491
+ * Inner rim darkening — a dark band near each slice's outer edge that
1492
+ * gives the pie an "inset" / pressed look. Implemented by extending the
1493
+ * per-slice radial gradient with a dark edge stop, so it pairs naturally
1494
+ * with the existing depth gradient. Omit / `false` to disable (default).
1495
+ */
1496
+ innerShadow?: boolean | {
1497
+ /**
1498
+ * Rim color. Default: `rgba(0, 0, 0, 0.1)` (blended over the slice
1499
+ * color). Accepts any CSS color.
1500
+ */
1501
+ color?: string;
1502
+ /**
1503
+ * Fraction of the slice's radial span covered by the darkened band
1504
+ * (0..1). Default: 0.3 — darkening starts at 70% of the radius.
1505
+ */
1506
+ depth?: number;
1507
+ };
543
1508
  }
544
1509
 
545
1510
  /** Optional min/max constraints for the Y axis. Omit a side for automatic scaling. */
@@ -551,7 +1516,7 @@ export declare interface PieSliceData {
551
1516
  color?: string;
552
1517
  }
553
1518
 
554
- export declare const PieTooltip: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1519
+ export declare const PieTooltip: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;
555
1520
 
556
1521
  export declare const quietLight: ThemePreset;
557
1522
 
@@ -567,6 +1532,32 @@ export declare const rosePineDawn: ThemePreset;
567
1532
 
568
1533
  export declare const sandDune: ThemePreset;
569
1534
 
1535
+ /**
1536
+ * Frozen, per-row snapshot of a series at a single point in time. The shape
1537
+ * `buildHoverSnapshots` / `buildLastSnapshots` return to overlay slot
1538
+ * consumers.
1539
+ *
1540
+ * **Two identities, one snapshot:**
1541
+ * - `id` is the **row key** — guaranteed unique within the returned array,
1542
+ * safe for React `key`, Vue `:key`, Svelte `each … (key)`. For single-layer
1543
+ * series this equals the `seriesId`; for multi-layer series it's
1544
+ * `${seriesId}_layer${layerIndex}`.
1545
+ * - `seriesId` is the **owning series identity** — never carries a layer
1546
+ * suffix, not unique across multi-layer rows. Use it for filtering or
1547
+ * grouping (e.g. `snapshots.filter(s => s.seriesId === 'btc')`).
1548
+ *
1549
+ * `data` is a shallow clone, frozen along with the snapshot itself — a slot
1550
+ * consumer cannot accidentally mutate the chart's internal store.
1551
+ */
1552
+ export declare interface SeriesSnapshot {
1553
+ readonly id: string;
1554
+ readonly seriesId: string;
1555
+ readonly layerIndex?: number;
1556
+ readonly label?: string;
1557
+ readonly data: Readonly<OHLCData> | Readonly<TimePoint>;
1558
+ readonly color: string;
1559
+ }
1560
+
570
1561
  /** Supported primary series types. */
571
1562
  export declare type SeriesType = 'candlestick' | 'line' | 'bar' | 'pie';
572
1563
 
@@ -576,6 +1567,11 @@ declare interface Size {
576
1567
  height: number;
577
1568
  }
578
1569
 
1570
+ export declare type SliceInfo = HoverInfo;
1571
+
1572
+ /** Sort order applied to a snapshot list by the helper. */
1573
+ export declare type SnapshotSort = 'none' | 'asc' | 'desc';
1574
+
579
1575
  export declare const solarizedLight: ThemePreset;
580
1576
 
581
1577
  /** Stacking mode for bar/line series: off (overlap), normal (stacked), percent (100% stacked). */
@@ -615,9 +1611,6 @@ export declare interface ThemePreset {
615
1611
  backgroundSize?: string;
616
1612
  }
617
1613
 
618
- /** All built-in themes keyed by display name */
619
- export declare const themes: Record<string, ThemePreset>;
620
-
621
1614
  export declare const TimeAxis: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
622
1615
 
623
1616
  /** A single time-value data point for line and bar series. Time is a timestamp in milliseconds. */
@@ -636,19 +1629,50 @@ declare class TimeScale {
636
1629
  private to;
637
1630
  private width;
638
1631
  private pixelRatio;
639
- update(range: VisibleRange, mediaWidth: number, pixelRatio: number): void;
1632
+ private dataInterval;
1633
+ private labelCountHintValue;
1634
+ private minSpacingValue;
1635
+ private resolvedInterval;
1636
+ private lastInterval;
1637
+ /**
1638
+ * "want" (desired interval post-floor) at the time lastInterval was snapped.
1639
+ * Hysteresis band anchors to this so micro range drift back across a tier
1640
+ * boundary doesn't flip the label density — mirrors YScale, see there for
1641
+ * the full reasoning.
1642
+ */
1643
+ private lastWant;
1644
+ /** Identifies the dataInterval bucket whose tier list drove lastInterval. */
1645
+ private lastBucketKey;
1646
+ private get labelCountHint();
1647
+ private get minLabelSpacing();
1648
+ update(range: VisibleRange, mediaWidth: number, pixelRatio: number, dataInterval?: number): void;
1649
+ setLabelCount(n: number | null | undefined): void;
1650
+ setMinSpacing(px: number | null | undefined): void;
1651
+ private resetHysteresis;
640
1652
  timeToX(time: number): number;
641
1653
  timeToBitmapX(time: number): number;
642
1654
  xToTime(x: number): number;
643
1655
  pixelDeltaToTimeDelta(pixelDelta: number): number;
644
1656
  barWidthMedia(dataInterval: number): number;
645
1657
  barWidthBitmap(dataInterval: number): number;
1658
+ /**
1659
+ * Evenly spaced "nice" tick times. Resolution uses the cached
1660
+ * `dataInterval` set by `update()`; callers that bypass `update()` can
1661
+ * still pass it here for back-compat.
1662
+ */
646
1663
  niceTickValues(dataInterval: number): {
647
1664
  ticks: number[];
648
1665
  tickInterval: number;
649
1666
  };
650
1667
  getRange(): VisibleRange;
651
1668
  getMediaWidth(): number;
1669
+ /**
1670
+ * Resolve the next tick interval. Walks `niceTimeIntervals(dataInterval)`
1671
+ * looking for the smallest tier ≥ desired spacing; retains the previous
1672
+ * tier inside a ratio band so micro pan/zoom doesn't flip label density.
1673
+ */
1674
+ private resolveInterval;
1675
+ private countTicks;
652
1676
  }
653
1677
 
654
1678
  /**
@@ -657,11 +1681,51 @@ declare class TimeScale {
657
1681
  */
658
1682
  export declare type TimeValue = number | Date;
659
1683
 
660
- export declare const Tooltip: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_9> & Readonly<{}>, {
661
- sort: TooltipSort;
662
- }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1684
+ export declare const Title: __VLS_WithTemplateSlots_6<typeof __VLS_component_6, __VLS_TemplateResult_6["slots"]>;
1685
+
1686
+ export declare const Tooltip: __VLS_WithTemplateSlots_7<typeof __VLS_component_7, __VLS_TemplateResult_7["slots"]>;
1687
+
1688
+ /** Fields surfaced to a `Tooltip` / `TooltipLegend` formatter. */
1689
+ export declare type TooltipField = 'open' | 'high' | 'low' | 'close' | 'volume' | 'value';
1690
+
1691
+ /** Signature for the tooltip formatter — single prop, field hint. */
1692
+ export declare type TooltipFormatter = (value: number, field: TooltipField) => string;
1693
+
1694
+ export declare const TooltipLegend: __VLS_WithTemplateSlots_8<typeof __VLS_component_8, __VLS_TemplateResult_8["slots"]>;
1695
+
1696
+ export declare interface TooltipPosition {
1697
+ left: number;
1698
+ top: number;
1699
+ }
663
1700
 
664
- declare type TooltipSort = 'none' | 'asc' | 'desc';
1701
+ /**
1702
+ * Pure positioning for a floating tooltip. Flip the tooltip to the other
1703
+ * side of the cursor when the preferred side would overflow, then clamp
1704
+ * into `[0, chart - size]` so the flipped side can't spill past the
1705
+ * opposite edge either.
1706
+ *
1707
+ * Works for time-series tooltips anchoring to the crosshair and pie
1708
+ * tooltips anchoring to a slice centroid alike — pass the chart bounds
1709
+ * that match the overlay container (media size minus axis gutters for
1710
+ * time-series, full media size for pie).
1711
+ */
1712
+ export declare interface TooltipPositionArgs {
1713
+ /** Cursor or anchor x in CSS pixels, relative to the chart area origin. */
1714
+ x: number;
1715
+ /** Cursor or anchor y in CSS pixels, relative to the chart area origin. */
1716
+ y: number;
1717
+ /** Plot-area width in CSS pixels. */
1718
+ chartWidth: number;
1719
+ /** Plot-area height in CSS pixels. */
1720
+ chartHeight: number;
1721
+ /** Tooltip box width in CSS pixels. */
1722
+ tooltipWidth: number;
1723
+ /** Tooltip box height in CSS pixels. */
1724
+ tooltipHeight: number;
1725
+ /** Gap between anchor and tooltip. Defaults to 16. */
1726
+ offsetX?: number;
1727
+ offsetY?: number;
1728
+ }
665
1729
 
666
1730
  /** Font family and size tokens used across the chart. */
667
1731
  export declare interface Typography {
@@ -689,6 +1753,28 @@ export declare function useVisibleRange(chart: ChartInstance): Ref<VisibleRange>
689
1753
 
690
1754
  export declare function useYRange(chart: ChartInstance): Ref<YRange>;
691
1755
 
1756
+ /**
1757
+ * Default value formatters used across the chart library.
1758
+ *
1759
+ * Two shapes are exposed:
1760
+ * - `formatCompact` — compact K/M/B/T suffixes for large magnitudes, adaptive
1761
+ * precision for values < 1. Intended for axis labels, legends, pie slices.
1762
+ * - `formatPriceAdaptive` — full-precision display that scales decimal count
1763
+ * to the magnitude. Intended for tooltip rows where users want to read the
1764
+ * exact number.
1765
+ *
1766
+ * Both handle the full range of JS numbers the library is likely to see:
1767
+ * - 0, ±Infinity, NaN
1768
+ * - BTC-style sub-cent prices (0.00001234 → "0.00001234", not "1.234e-5")
1769
+ * - trillion-scale values (5.4e12 → "5.40T")
1770
+ * - Number.MAX_SAFE_INTEGER falls back to scientific notation (>= 1e15)
1771
+ *
1772
+ * Consumers can import these directly, or swap them in per-component via the
1773
+ * `format` prop on Tooltip/TooltipLegend/YAxis/etc. (see framework wrappers).
1774
+ */
1775
+ /** Signature for a value-to-string formatter (YAxis, YLabel, Pie, Sparkline, NumberFlow). */
1776
+ export declare type ValueFormatter = (value: number) => string;
1777
+
692
1778
  /** Time range (timestamps in milliseconds) of the currently visible portion of the chart. */
693
1779
  export declare interface VisibleRange {
694
1780
  from: number;
@@ -697,17 +1783,17 @@ export declare interface VisibleRange {
697
1783
 
698
1784
  /** Configuration for the X (time) axis. */
699
1785
  export declare interface XAxisConfig {
700
- /** Height in pixels. Default: 30. */
1786
+ /** Height in CSS pixels. Default: 30. */
701
1787
  height?: number;
702
1788
  /** Whether the axis is visible. Default: true. When false, height is treated as 0. */
703
1789
  visible?: boolean;
704
1790
  }
705
1791
 
706
- export declare const YAxis: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
1792
+ export declare const YAxis: DefineComponent<__VLS_Props_13, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_13> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
707
1793
 
708
1794
  /** Configuration for the Y axis. */
709
1795
  export declare interface YAxisConfig {
710
- /** Width in pixels. Default: 55. */
1796
+ /** Width in CSS pixels. Default: 55. */
711
1797
  width?: number;
712
1798
  /** Minimum bound. Default: 'auto'. */
713
1799
  min?: AxisBound;
@@ -717,7 +1803,10 @@ export declare interface YAxisConfig {
717
1803
  visible?: boolean;
718
1804
  }
719
1805
 
720
- export declare const YLabel: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
1806
+ export declare const YLabel: __VLS_WithTemplateSlots_9<typeof __VLS_component_9, __VLS_TemplateResult_9["slots"]>;
1807
+
1808
+ /** Direction of the current value vs. previous close. Drives the badge color in the default UI. */
1809
+ declare type YLabelDirection = 'up' | 'down' | 'neutral';
721
1810
 
722
1811
  /** Min/max value range for the Y axis. */
723
1812
  export declare interface YRange {
@@ -734,20 +1823,69 @@ declare class YScale {
734
1823
  private max;
735
1824
  private height;
736
1825
  private pixelRatio;
1826
+ private labelCountHintValue;
1827
+ private minSpacingValue;
1828
+ /** Cached {1,2,5}×10^k interval resolved at update-time; null when degenerate. */
1829
+ private resolvedInterval;
1830
+ /** Previous resolved interval — drives the ratio-band hysteresis. */
1831
+ private lastInterval;
1832
+ /**
1833
+ * rawInterval at the moment `lastInterval` was snapped. Anchoring the
1834
+ * hysteresis band to *raw-at-snap* (not `lastInterval`) is what creates
1835
+ * naturally asymmetric tier hysteresis: after an escalation the band
1836
+ * starts just above the tier boundary, so live range drift back across
1837
+ * the boundary doesn't instantly flip back.
1838
+ */
1839
+ private lastRawInterval;
1840
+ /** Custom formatter (driven by `<YAxis format=…>`). */
1841
+ private customFormat;
1842
+ private get labelCountHint();
1843
+ private get minLabelSpacing();
737
1844
  /** Recalculate the scale with a new Y range, chart height, and device pixel ratio. */
738
1845
  update(range: YRange, mediaHeight: number, pixelRatio: number): void;
1846
+ /** Desired label count. Invalid values (NaN, <2, Infinity) clear the hint. */
1847
+ setLabelCount(n: number | null | undefined): void;
1848
+ /** Minimum pixel gap between adjacent labels. */
1849
+ setMinSpacing(px: number | null | undefined): void;
1850
+ private resetHysteresis;
1851
+ /** Install (or clear) a custom formatter. */
1852
+ setFormat(fn: ValueFormatter | null): void;
1853
+ /** Read back the currently installed formatter — null when the built-in is active. */
1854
+ getFormat(): ValueFormatter | null;
739
1855
  /** Convert a value to a Y position in CSS (media) pixels. */
740
1856
  valueToY(value: number): number;
741
1857
  /** Convert a value to a Y position in physical (bitmap) pixels. */
742
1858
  valueToBitmapY(value: number): number;
743
1859
  /** Convert a Y position in CSS pixels back to a value. */
744
1860
  yToValue(y: number): number;
745
- /** Generate evenly spaced "nice" tick values that fit the current range and chart height. */
1861
+ /**
1862
+ * Generate evenly spaced "nice" tick values for the current range and
1863
+ * chart height. Pure read — resolution happens in `update()`.
1864
+ */
746
1865
  niceTickValues(): number[];
747
1866
  getRange(): YRange;
748
1867
  getMediaHeight(): number;
749
- /** Format a value for display, adapting decimal places to the visible range magnitude. */
1868
+ /**
1869
+ * Format a tick value for display. When a custom formatter is installed
1870
+ * (via {@link setFormat} or the `format` prop on `<YAxis>`), it wins;
1871
+ * otherwise decimals are driven by the resolved tick interval — so
1872
+ * ticks at step 100 never render as "42000.0" just because the visible
1873
+ * range happens to be < 1000.
1874
+ */
750
1875
  formatY(value: number): string;
1876
+ /**
1877
+ * Resolve the interval to a {1,2,5}×10^k tick size that satisfies the pixel
1878
+ * floor and (optionally) targets `labelCountHint` labels.
1879
+ *
1880
+ * Hysteresis: the band [0.8×, 1.25×] is anchored to **rawInterval at last
1881
+ * snap**, not to `lastInterval`. After an escalation (e.g. 100 → 200),
1882
+ * `lastRawInterval` sits just past the tier boundary, so typical live
1883
+ * range drift back across the boundary stays inside the band and does
1884
+ * *not* de-escalate. This prevents the 2-tier flicker users see when new
1885
+ * candles nudge the Y range across a raw-interval threshold.
1886
+ */
1887
+ private resolveInterval;
1888
+ private countTicks;
751
1889
  }
752
1890
 
753
1891
  export { }