@cngx/common 0.1.0-rc.6 → 0.1.0-rc.8

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 (72) hide show
  1. package/card/README.md +2 -1
  2. package/chart/README.md +85 -0
  3. package/command/README.md +157 -0
  4. package/data/README.md +33 -1
  5. package/dialog/README.md +23 -1
  6. package/fesm2022/cngx-common-a11y.mjs +356 -180
  7. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  8. package/fesm2022/cngx-common-audio.mjs +84 -42
  9. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  10. package/fesm2022/cngx-common-card.mjs +311 -53
  11. package/fesm2022/cngx-common-card.mjs.map +1 -1
  12. package/fesm2022/cngx-common-chart.mjs +4360 -1625
  13. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  14. package/fesm2022/cngx-common-command.mjs +171 -0
  15. package/fesm2022/cngx-common-command.mjs.map +1 -0
  16. package/fesm2022/cngx-common-data.mjs +1556 -616
  17. package/fesm2022/cngx-common-data.mjs.map +1 -1
  18. package/fesm2022/cngx-common-dialog.mjs +518 -112
  19. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  20. package/fesm2022/cngx-common-display.mjs +468 -87
  21. package/fesm2022/cngx-common-display.mjs.map +1 -1
  22. package/fesm2022/cngx-common-interactive.mjs +2725 -1303
  23. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  24. package/fesm2022/cngx-common-layout.mjs +943 -164
  25. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  26. package/fesm2022/cngx-common-popover.mjs +769 -103
  27. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  28. package/fesm2022/cngx-common-stepper.mjs +816 -348
  29. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  30. package/fesm2022/cngx-common-tabs.mjs +2330 -1554
  31. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-common-timeline.mjs +1170 -0
  33. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  34. package/fesm2022/cngx-common.mjs +2 -2
  35. package/fesm2022/cngx-common.mjs.map +1 -1
  36. package/interactive/README.md +15 -4
  37. package/layout/README.md +21 -1
  38. package/package.json +11 -1
  39. package/popover/README.md +18 -2
  40. package/stepper/README.md +7 -5
  41. package/theming/components/cngx-accordion.css +4 -1
  42. package/theming/components/cngx-backdrop.css +12 -0
  43. package/theming/components/cngx-badge.css +22 -0
  44. package/theming/components/cngx-bottom-sheet.css +14 -2
  45. package/theming/components/cngx-breadcrumb.css +8 -0
  46. package/theming/components/cngx-button-toggle.css +73 -5
  47. package/theming/components/cngx-data-grid.css +234 -1
  48. package/theming/components/cngx-dialog.css +25 -0
  49. package/theming/components/cngx-divider.css +12 -0
  50. package/theming/components/cngx-listbox.css +48 -12
  51. package/theming/components/cngx-menu.css +91 -15
  52. package/theming/components/cngx-popover.css +24 -0
  53. package/theming/components/cngx-recycler-placeholder.css +196 -0
  54. package/theming/components/cngx-ripple.css +2 -2
  55. package/theming/components/cngx-slider.css +32 -1
  56. package/theming/components/cngx-tooltip.css +23 -0
  57. package/timeline/README.md +155 -0
  58. package/types/cngx-common-a11y.d.ts +101 -31
  59. package/types/cngx-common-audio.d.ts +32 -32
  60. package/types/cngx-common-card.d.ts +211 -20
  61. package/types/cngx-common-chart.d.ts +1605 -169
  62. package/types/cngx-common-command.d.ts +190 -0
  63. package/types/cngx-common-data.d.ts +842 -163
  64. package/types/cngx-common-dialog.d.ts +372 -28
  65. package/types/cngx-common-display.d.ts +432 -148
  66. package/types/cngx-common-interactive.d.ts +1553 -370
  67. package/types/cngx-common-layout.d.ts +613 -27
  68. package/types/cngx-common-popover.d.ts +376 -36
  69. package/types/cngx-common-stepper.d.ts +414 -114
  70. package/types/cngx-common-tabs.d.ts +597 -72
  71. package/types/cngx-common-timeline.d.ts +1125 -0
  72. package/types/cngx-common.d.ts +1 -1
@@ -1,10 +1,11 @@
1
- import * as _cngx_common_chart from '@cngx/common/chart';
2
1
  import * as _angular_core from '@angular/core';
3
- import { TemplateRef, InjectionToken, Signal } from '@angular/core';
2
+ import { Signal, InjectionToken, TemplateRef, Provider, DestroyRef } from '@angular/core';
3
+ import * as _cngx_common_chart from '@cngx/common/chart';
4
4
  import * as _cngx_common_data from '@cngx/common/data';
5
5
  import { AsyncView } from '@cngx/common/data';
6
6
  import { CngxAsyncState } from '@cngx/core/utils';
7
7
  import * as i1 from '@cngx/common/layout';
8
+ import { CngxMessage } from '@cngx/core/i18n';
8
9
 
9
10
  /**
10
11
  * Pure-TS linear scale. Maps a numeric domain `[d0, d1]` to a numeric
@@ -87,6 +88,230 @@ declare function createBandScale<T>(domain: readonly T[], range: readonly [numbe
87
88
  */
88
89
  declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly string[]): (v: T) => string;
89
90
 
91
+ /**
92
+ * Largest-Triangle-Three-Buckets downsampling. Reduces a dense series to
93
+ * `targetSize` points while preserving the perceptual shape of the line -
94
+ * peaks, troughs, and inflections survive where naive uniform (every-Nth)
95
+ * sampling would drop them. This is the realtime-charting literature's
96
+ * default downsampler (Steinarsson 2013).
97
+ *
98
+ * Pure TS: no Angular, no signal, no RxJS dependency. Tree-shakeable, so
99
+ * static-chart consumers that never buffer pay nothing. The `<cngx-chart>`
100
+ * buffer ({@link injectChartBuffer}) is the single downsampling boundary at
101
+ * v2; this is its algorithm.
102
+ *
103
+ * The first and last points are always kept. The middle `targetSize - 2`
104
+ * points are chosen one per bucket by the largest-triangle-area heuristic:
105
+ * for each bucket, the point forming the largest triangle with the previous
106
+ * selected point and the next bucket's average is retained.
107
+ *
108
+ * @param data source series, read-only.
109
+ * @param targetSize desired output length. When `>= data.length` (or `<= 0`),
110
+ * the input is returned unchanged by reference - no allocation, no copy.
111
+ * @param xAccessor projects a row to its numeric X (typically a timestamp or
112
+ * positional index).
113
+ * @param yAccessor projects a row to its numeric Y (the value the triangle
114
+ * area is computed against).
115
+ * @returns a fresh array of at most `targetSize` rows, or the input by
116
+ * reference when no reduction is needed.
117
+ *
118
+ * @category common/chart/buffer
119
+ */
120
+ declare function downsampleLTTB<T>(data: readonly T[], targetSize: number, xAccessor: (d: T, i: number) => number, yAccessor: (d: T, i: number) => number): readonly T[];
121
+
122
+ /**
123
+ * Construction options for {@link injectChartBuffer}.
124
+ *
125
+ * @category common/chart/buffer
126
+ */
127
+ interface ChartBufferOptions<T> {
128
+ /** Ring capacity - the maximum rows retained before eviction. */
129
+ readonly capacity: number;
130
+ /**
131
+ * When set and the ring holds more than this many rows, `points` is
132
+ * LTTB-downsampled to exactly this length. Omit to emit the raw window.
133
+ */
134
+ readonly downsampleTo?: number;
135
+ /** Projects a row to its numeric X for the LTTB triangle area. */
136
+ readonly xAccessor: (d: T, i: number) => number;
137
+ /** Projects a row to its numeric Y for the LTTB triangle area. */
138
+ readonly yAccessor: (d: T, i: number) => number;
139
+ }
140
+ /**
141
+ * The realtime feed handle returned by {@link injectChartBuffer}. Bind
142
+ * `points` to a chart data input; drive it from any high-frequency producer
143
+ * via `push` / `pushBatch`.
144
+ *
145
+ * @category common/chart/buffer
146
+ */
147
+ interface CngxChartBuffer<T> {
148
+ /**
149
+ * The current (optionally downsampled) window, rAF-coalesced. Carries an
150
+ * element-wise `equal` guard so a flush reselecting the same rows does not
151
+ * cascade downstream.
152
+ */
153
+ readonly points: Signal<readonly T[]>;
154
+ /** Append one row; schedules a flush for the next animation frame. */
155
+ push(value: T): void;
156
+ /** Append many rows in order; schedules a single flush. */
157
+ pushBatch(values: readonly T[]): void;
158
+ /** Empty the ring; the emptied window emits on the next flush. */
159
+ clear(): void;
160
+ /** The fixed ring capacity. */
161
+ readonly capacity: number;
162
+ /** Current retained row count, `0..capacity`, reflecting the last flush. */
163
+ readonly length: Signal<number>;
164
+ /** `true` while a flush is scheduled but not yet applied - drive a busy hint. */
165
+ readonly pendingFlush: Signal<boolean>;
166
+ }
167
+ /**
168
+ * Bounded, rAF-coalesced realtime feed for `<cngx-chart>`. Wraps a
169
+ * fixed-capacity ring ({@link createRingBuffer}) with an optional LTTB
170
+ * downsample ({@link downsampleLTTB}) and exposes the window as a `Signal`.
171
+ *
172
+ * Multiple `push` / `pushBatch` / `clear` calls within one animation frame
173
+ * collapse into a single `points` emission: each mutation writes the ring
174
+ * imperatively and schedules one `requestAnimationFrame(flush)`; the flush
175
+ * bumps a revision signal that `points` derives from. The flush is a plain
176
+ * callback writing a signal - not an `effect()` body - so no reactive
177
+ * exception class is involved.
178
+ *
179
+ * Runs in an injection context; the rAF handle is cancelled via `DestroyRef`.
180
+ *
181
+ * ```typescript
182
+ * export class Telemetry {
183
+ * private readonly buffer = injectChartBuffer<Sample>({
184
+ * capacity: 1000,
185
+ * downsampleTo: 600,
186
+ * xAccessor: (s) => s.t,
187
+ * yAccessor: (s) => s.value,
188
+ * });
189
+ * protected readonly points = this.buffer.points; // -> <cngx-chart [data]>
190
+ * onSample(s: Sample): void {
191
+ * this.buffer.push(s);
192
+ * }
193
+ * }
194
+ * ```
195
+ *
196
+ * @category common/chart/buffer
197
+ */
198
+ declare function injectChartBuffer<T>(opts: ChartBufferOptions<T>): CngxChartBuffer<T>;
199
+
200
+ /**
201
+ * Numeric input shape every concrete scale accepts. Linear scales take
202
+ * `number`, time scales take `Date | number`, band scales take `string`
203
+ * or arbitrary references via {@link createBandScale}'s generic. The
204
+ * union narrows at the layer atom (`[cngxLine]`, `[cngxBar]`, ...);
205
+ * the chart context surface stays scale-agnostic.
206
+ *
207
+ * @category common/chart
208
+ */
209
+ type XScaleInput = number | Date | string;
210
+ /**
211
+ * Generic scale function shape. Maps a domain value of type `TIn` to a
212
+ * range value (typically a pixel coordinate). Mirrors the result type
213
+ * of every `create*Scale` factory in `@cngx/common/chart`.
214
+ *
215
+ * @category common/chart
216
+ */
217
+ type ScaleFn<TIn> = (v: TIn) => number;
218
+ /**
219
+ * The rectangle the chart's scales map onto: the viewBox minus the
220
+ * space reserved for axis decoration, in viewBox user units. Without
221
+ * axes it equals the box.
222
+ *
223
+ * `x0`/`y0` are the top-left corner, `x1`/`y1` the bottom-right one,
224
+ * and `width`/`height` the extents between them. Every chart child that
225
+ * needs to know where the plot starts reads this rather than
226
+ * subtracting an inset from the box itself - one derivation, so the
227
+ * scales and the axis lines cannot drift apart.
228
+ *
229
+ * A collapsed plot (a box narrower than the room its axes need) reports
230
+ * `width` or `height` at or below `0`. Readers guard on the extent; the
231
+ * chart hands out its NOOP scale in the same case.
232
+ *
233
+ * @category common/chart
234
+ */
235
+ interface CngxChartPlotArea {
236
+ readonly x0: number;
237
+ readonly y0: number;
238
+ readonly x1: number;
239
+ readonly y1: number;
240
+ readonly width: number;
241
+ readonly height: number;
242
+ }
243
+ /**
244
+ * Reactive context published by `<cngx-chart>` to its content children.
245
+ * Layer atoms (`[cngxLine]`, `[cngxBar]`, ...) and `[cngxAxis]` inject
246
+ * {@link CNGX_CHART_CONTEXT} to read the parent chart's scales,
247
+ * dimensions, data length, and data array without needing a direct
248
+ * reference to the parent class. Token is non-generic at the DI
249
+ * boundary; layer atoms call `data<T>()` to narrow the array to their
250
+ * own `<T>` - the single boundary cast lives inside `CngxChart`'s
251
+ * `data<U>()` method, not at every consumer site.
252
+ *
253
+ * @category common/chart
254
+ */
255
+ interface CngxChartContext<TX = XScaleInput, TY = number> {
256
+ readonly xScale: Signal<ScaleFn<TX>>;
257
+ readonly yScale: Signal<ScaleFn<TY>>;
258
+ readonly dimensions: Signal<{
259
+ width: number;
260
+ height: number;
261
+ }>;
262
+ /**
263
+ * The plot rectangle inside the viewBox, after the room the projected
264
+ * axes need for their decoration. The chart's own scale ranges and
265
+ * `[cngxAxis]`'s line placement both read this single derivation, so
266
+ * ticks always line up with marks. A chart without axes gets the full
267
+ * box.
268
+ */
269
+ readonly plot: Signal<CngxChartPlotArea>;
270
+ readonly dataLength: Signal<number>;
271
+ /**
272
+ * Generic-aware data accessor. Reads the chart's reactive data
273
+ * array; the consumer's `<T>` parameter narrows the returned type
274
+ * without a per-call cast at the consumer site. The chart performs
275
+ * one boundary cast in its implementation.
276
+ */
277
+ data<T = unknown>(): readonly T[];
278
+ /**
279
+ * SVG-output gate (default `true`). Layer atoms wrap their own
280
+ * `<svg:path>` / `<svg:rect>` / `<svg:circle>` emission behind
281
+ * `@if (ctx.renderSvg())`. The chart shell drives this `false` only
282
+ * when Canvas mode is active - an atom asks "should I render my own
283
+ * SVG?", never "what mode am I in?".
284
+ */
285
+ readonly renderSvg: Signal<boolean>;
286
+ }
287
+ /**
288
+ * Injection token consumed by every chart child (`[cngxAxis]`, layer
289
+ * atoms, `<cngx-chart-data-table>`). `<cngx-chart>` provides itself
290
+ * via `useExisting`; child queries narrow the generic on the consumer
291
+ * side.
292
+ *
293
+ * @category common/chart
294
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
295
+ * @since 0.1.0
296
+ */
297
+ declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, number>>;
298
+ /**
299
+ * Inject the parent chart's reactive context. Throws a clear dev-mode
300
+ * error when the consumer is not mounted as a content child of
301
+ * `<cngx-chart>`. The `consumerName` argument is interpolated into the
302
+ * error message so the consumer-class name surfaces at the call site
303
+ * rather than a generic guard string.
304
+ *
305
+ * Use it from custom layer directives mounted on `<svg:g>` hosts to
306
+ * read `plot`, the scales and `renderSvg` the same way the built-in
307
+ * layer atoms do.
308
+ *
309
+ * @category common/chart
310
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
311
+ * @since 0.1.0
312
+ */
313
+ declare function injectChartContext(consumerName: string): CngxChartContext;
314
+
90
315
  /**
91
316
  * Common context shape passed into every chart slot template
92
317
  * (loading, empty, error). Carries the chart's current rendered
@@ -104,11 +329,9 @@ declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly st
104
329
  * ```
105
330
  *
106
331
  * The `small` flag is true when the chart's rendered width is below
107
- * the threshold defined by the `--cngx-chart-small-width-px` CSS
108
- * custom property (read from the chart at first render via the
109
- * `CHART_SMALL_BREAKPOINT_PX` constant; default 400). Container-size
110
- * based, not viewport-based, so it works correctly inside dashboard
111
- * cells of any size.
332
+ * the exported `CHART_SMALL_BREAKPOINT_PX` constant (400).
333
+ * Container-size based, not viewport-based, so it works correctly
334
+ * inside dashboard cells of any size.
112
335
  *
113
336
  * @category common/chart
114
337
  */
@@ -116,6 +339,23 @@ interface CngxChartSlotContext {
116
339
  readonly width: number;
117
340
  readonly height: number;
118
341
  readonly small: boolean;
342
+ /**
343
+ * The rectangle the chart's marks occupy: the viewBox minus the room
344
+ * the projected axes reserved for their decoration. Without axes it
345
+ * equals the box.
346
+ *
347
+ * Slot templates paint over the chart, and since the axis gutter
348
+ * landed the box is no longer the drawing surface - a fallback
349
+ * centred on `width`/`height` sits off-centre from the marks it
350
+ * replaces. Align to this instead when the fallback should line up
351
+ * with the plot rather than with the host.
352
+ *
353
+ * In viewBox user units. `width`/`height` above stay the *rendered*
354
+ * host size, so the two are in different spaces whenever an explicit
355
+ * `[width]` chart is squeezed; use the `--cngx-chart-plot-*` custom
356
+ * properties for CSS-side alignment, which are resolution-independent.
357
+ */
358
+ readonly plot: CngxChartPlotArea;
119
359
  }
120
360
  /**
121
361
  * Threshold (px) below which `CngxChartSlotContext.small` is true.
@@ -143,7 +383,7 @@ declare const CHART_SMALL_BREAKPOINT_PX = 400;
143
383
  * @category common/chart
144
384
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
145
385
  * @since 0.1.0
146
- * @relatedTo CngxChartEmpty, CngxChartError, CngxChart
386
+ * @relatedTo CngxChartSlotContext, CngxChartEmpty, CngxChartError, CngxChart
147
387
  */
148
388
  declare class CngxChartLoading {
149
389
  readonly templateRef: TemplateRef<any>;
@@ -157,10 +397,18 @@ declare class CngxChartLoading {
157
397
  * a richer surface (`<cngx-empty-state>`, illustration, action) at
158
398
  * regular sizes.
159
399
  *
400
+ * ```html
401
+ * <cngx-chart [state]="state()">
402
+ * <ng-template cngxChartEmpty let-small="small" let-plot="plot">
403
+ * <span>No readings in this range ({{ plot.width }} wide)</span>
404
+ * </ng-template>
405
+ * </cngx-chart>
406
+ * ```
407
+ *
160
408
  * @category common/chart
161
409
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
162
410
  * @since 0.1.0
163
- * @relatedTo CngxChartLoading, CngxChartError, CngxChart
411
+ * @relatedTo CngxChartSlotContext, CngxChartLoading, CngxChartError, CngxChart
164
412
  */
165
413
  declare class CngxChartEmpty {
166
414
  readonly templateRef: TemplateRef<any>;
@@ -183,74 +431,232 @@ interface CngxChartErrorContext extends CngxChartSlotContext {
183
431
  * `*cngxChartError` slot - overrides the chart-level error placeholder.
184
432
  * Receives a {@link CngxChartErrorContext}.
185
433
  *
434
+ * ```html
435
+ * <cngx-chart [state]="state()">
436
+ * <ng-template cngxChartError let-error let-small="small">
437
+ * <span>Could not load: {{ error?.message }}</span>
438
+ * </ng-template>
439
+ * </cngx-chart>
440
+ * ```
441
+ *
186
442
  * @category common/chart
187
443
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
188
444
  * @since 0.1.0
189
- * @relatedTo CngxChartLoading, CngxChartEmpty, CngxChart
445
+ * @relatedTo CngxChartErrorContext, CngxChartLoading, CngxChartEmpty, CngxChart
190
446
  */
191
447
  declare class CngxChartError {
192
448
  readonly templateRef: TemplateRef<any>;
193
449
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartError, never>;
194
450
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartError, "ng-template[cngxChartError]", never, {}, {}, never, never, true, never>;
195
451
  }
196
-
197
452
  /**
198
- * Numeric input shape every concrete scale accepts. Linear scales take
199
- * `number`, time scales take `Date | number`, band scales take `string`
200
- * or arbitrary references via {@link createBandScale}'s generic. The
201
- * union narrows at the layer atom (`[cngxLine]`, `[cngxBar]`, ...);
202
- * the chart context surface stays scale-agnostic.
453
+ * Context for the connection-lifecycle slots (`*cngxChartConnectionError`,
454
+ * `*cngxChartReconnecting`). Extends the common slot context with the live
455
+ * connection error value via `$implicit` / `error`, mirroring
456
+ * {@link CngxChartErrorContext}. The connection channel is separate from
457
+ * the data `[state]` channel, so this context reflects `[connectionState]`.
203
458
  *
204
459
  * @category common/chart
205
460
  */
206
- type XScaleInput = number | Date | string;
461
+ interface CngxChartConnectionContext extends CngxChartSlotContext {
462
+ readonly $implicit: unknown;
463
+ readonly error: unknown;
464
+ }
207
465
  /**
208
- * Generic scale function shape. Maps a domain value of type `TIn` to a
209
- * range value (typically a pixel coordinate). Mirrors the result type
210
- * of every `create*Scale` factory in `@cngx/common/chart`.
466
+ * `*cngxChartConnectionError` slot - overrides the default banner shown
467
+ * when `[connectionState]` reports `'error'` (connection lost). Overlaid on
468
+ * top of the data view with `role="alert"`; receives a
469
+ * {@link CngxChartConnectionContext}.
470
+ *
471
+ * ```html
472
+ * <cngx-chart [connectionState]="socket">
473
+ * <ng-template cngxChartConnectionError let-error>
474
+ * <span>Live feed lost: {{ error?.message }}</span>
475
+ * </ng-template>
476
+ * </cngx-chart>
477
+ * ```
211
478
  *
212
479
  * @category common/chart
480
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
481
+ * @since 0.1.0
482
+ * @relatedTo CngxChartConnectionContext, CngxChartReconnecting, CngxChart
213
483
  */
214
- type ScaleFn<TIn> = (v: TIn) => number;
484
+ declare class CngxChartConnectionError {
485
+ readonly templateRef: TemplateRef<any>;
486
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartConnectionError, never>;
487
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartConnectionError, "ng-template[cngxChartConnectionError]", never, {}, {}, never, never, true, never>;
488
+ }
215
489
  /**
216
- * Reactive context published by `<cngx-chart>` to its content children.
217
- * Layer atoms (`[cngxLine]`, `[cngxBar]`, ...) and `[cngxAxis]` inject
218
- * {@link CNGX_CHART_CONTEXT} to read the parent chart's scales,
219
- * dimensions, data length, and data array without needing a direct
220
- * reference to the parent class. Token is non-generic at the DI
221
- * boundary; layer atoms call `data<T>()` to narrow the array to their
222
- * own `<T>` - the single boundary cast lives inside `CngxChart`'s
223
- * `data<U>()` method, not at every consumer site.
490
+ * `*cngxChartReconnecting` slot - overrides the default subtle indicator
491
+ * shown when `[connectionState]` reports `'refreshing'` (reconnecting).
492
+ * Overlaid with `role="status"` (polite); receives a
493
+ * {@link CngxChartConnectionContext}.
494
+ *
495
+ * ```html
496
+ * <cngx-chart [connectionState]="socket">
497
+ * <ng-template cngxChartReconnecting let-small="small">
498
+ * <span>{{ small ? 'Reconnecting' : 'Reconnecting to the live feed' }}</span>
499
+ * </ng-template>
500
+ * </cngx-chart>
501
+ * ```
224
502
  *
225
503
  * @category common/chart
504
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
505
+ * @since 0.1.0
506
+ * @relatedTo CngxChartConnectionContext, CngxChartConnectionError, CngxChart
226
507
  */
227
- interface CngxChartContext<TX = XScaleInput, TY = number> {
228
- readonly xScale: Signal<ScaleFn<TX>>;
229
- readonly yScale: Signal<ScaleFn<TY>>;
230
- readonly dimensions: Signal<{
231
- width: number;
232
- height: number;
233
- }>;
234
- readonly dataLength: Signal<number>;
508
+ declare class CngxChartReconnecting {
509
+ readonly templateRef: TemplateRef<any>;
510
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartReconnecting, never>;
511
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartReconnecting, "ng-template[cngxChartReconnecting]", never, {}, {}, never, never, true, never>;
512
+ }
513
+ /**
514
+ * `*cngxChartOverlay` slot - projects HTML *on top of the marks*, inside
515
+ * the plot area. Unlike the loading / empty / error slots (which replace
516
+ * the marks in their respective fallback arms), the overlay renders in the
517
+ * `@default` content arm alongside the drawn chart, so it is where
518
+ * crosshair readouts, hover tooltips, annotation callouts and brush
519
+ * affordances belong.
520
+ *
521
+ * The chart positions the overlay frame itself, inset to the plot area via
522
+ * the `--cngx-chart-plot-*` custom properties it already publishes - the
523
+ * consumer performs no `exportAs`, no `plot()` / `dimensions()` arithmetic,
524
+ * and needs no wrapper of their own to act as a containing block. Receives
525
+ * the shared {@link CngxChartSlotContext}, so `plot` / `width` / `height` /
526
+ * `small` are all readable from the template:
527
+ *
528
+ * ```html
529
+ * <cngx-chart [data]="series()" [width]="480" [height]="200">
530
+ * <svg:g cngxAxis position="left" type="linear" [domain]="[0, 100000]"></svg:g>
531
+ * <svg:g cngxLine></svg:g>
532
+ * <ng-template cngxChartOverlay let-plot="plot">
533
+ * <div class="my-callout">{{ plot.width }}x{{ plot.height }} plot</div>
534
+ * </ng-template>
535
+ * </cngx-chart>
536
+ * ```
537
+ *
538
+ * Pointer events: the frame is `pointer-events: none`, so it never
539
+ * intercepts a click, hover or drag meant for the marks beneath it. An
540
+ * interactive element inside the overlay opts back in per element with
541
+ * `pointer-events: auto`. The default is off deliberately - an overlay
542
+ * that silently swallows every pointer event on the chart is invisible
543
+ * until some other interaction (a tooltip, a brush) stops firing, and
544
+ * that is a debugging session; opting a single element back in is one
545
+ * declaration.
546
+ *
547
+ * Accessibility: the chart host is `role="img"` with an auto-summary
548
+ * `aria-label`, so assistive technology sees the chart as a single
549
+ * labelled graphic and never traverses into the overlay. Treat overlay
550
+ * content as *visual* - a hover readout, a tint, an annotation callout.
551
+ * Any state that has to reach AT belongs on the reactive summary or the
552
+ * SR data-table (the `aria-describedby` channel the chart already owns),
553
+ * not on an element projected here.
554
+ *
555
+ * @category common/chart
556
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
557
+ * @since 0.1.0
558
+ * @relatedTo CngxChartSlotContext, CngxChartLoading, CngxChartEmpty, CngxChartError, CngxChart
559
+ */
560
+ declare class CngxChartOverlay {
561
+ readonly templateRef: TemplateRef<any>;
562
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartOverlay, never>;
563
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartOverlay, "ng-template[cngxChartOverlay]", never, {}, {}, never, never, true, never>;
564
+ }
565
+
566
+ /**
567
+ * Backend-agnostic geometry a layer atom publishes for rendering. A
568
+ * discriminated union: each variant carries exactly the primitives its
569
+ * kind needs, and nothing more. Both the SVG self-render path and the
570
+ * Canvas renderer paint against this same shape, so a single
571
+ * layer-authoring API drives either backend.
572
+ *
573
+ * Coordinates are already scale-projected (pixel space); `color` is
574
+ * `null` when the atom defers to its CSS custom property (the SVG path
575
+ * reads the var directly, the Canvas renderer resolves it via
576
+ * `getComputedStyle`).
577
+ *
578
+ * @category common/chart/layers
579
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
580
+ * @since 0.1.0
581
+ */
582
+ type LayerGeometry = {
583
+ readonly kind: 'line' | 'area';
584
+ readonly d: string;
585
+ readonly color: string | null;
586
+ readonly strokeWidth: number | string | null;
587
+ readonly fill?: string | null;
588
+ readonly opacity?: number | null;
235
589
  /**
236
- * Generic-aware data accessor. Reads the chart's reactive data
237
- * array; the consumer's `<T>` parameter narrows the returned type
238
- * without a per-call cast at the consumer site. The chart performs
239
- * one boundary cast in its implementation.
590
+ * Optional point-marker pass a mark layer emits alongside its
591
+ * path - the scale-projected centres of the datapoints the layer
592
+ * chooses to mark (e.g. the lone datum of a warming series). Both
593
+ * the SVG template and the Canvas renderer paint these as small
594
+ * filled circles in the layer's resolved colour. Absent / empty
595
+ * when the layer draws no markers.
240
596
  */
241
- data<T = unknown>(): readonly T[];
597
+ readonly points?: readonly {
598
+ readonly cx: number;
599
+ readonly cy: number;
600
+ }[];
601
+ } | {
602
+ readonly kind: 'bar';
603
+ readonly rects: readonly {
604
+ readonly x: number;
605
+ readonly y: number;
606
+ readonly w: number;
607
+ readonly h: number;
608
+ readonly color: string | null;
609
+ }[];
610
+ } | {
611
+ readonly kind: 'scatter';
612
+ readonly marks: readonly {
613
+ readonly cx: number;
614
+ readonly cy: number;
615
+ readonly r: number;
616
+ readonly color: string | null;
617
+ }[];
618
+ } | {
619
+ readonly kind: 'threshold';
620
+ readonly x1: number;
621
+ readonly y1: number;
622
+ readonly x2: number;
623
+ readonly y2: number;
624
+ readonly color: string | null;
625
+ readonly dashed: boolean;
626
+ } | {
627
+ readonly kind: 'band';
628
+ readonly x: number;
629
+ readonly y: number;
630
+ readonly w: number;
631
+ readonly h: number;
632
+ readonly color: string | null;
633
+ readonly opacity: number | null;
634
+ };
635
+ /**
636
+ * Contract every layer atom (`[cngxLine]`, `[cngxBar]`, ...) self-provides
637
+ * via {@link CNGX_CHART_LAYER}. The chart shell and the Canvas renderer
638
+ * read layer geometry through this token instead of scraping the DOM.
639
+ *
640
+ * @category common/chart/layers
641
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
642
+ * @since 0.1.0
643
+ */
644
+ interface CngxChartLayer {
645
+ /** The layer's scale-projected geometry, cascade-guarded by an `equal` fn. */
646
+ readonly geometry: Signal<LayerGeometry>;
242
647
  }
243
648
  /**
244
- * Injection token consumed by every chart child (`[cngxAxis]`, layer
245
- * atoms, `<cngx-chart-data-table>`). `<cngx-chart>` provides itself
246
- * via `useExisting`; child queries narrow the generic on the consumer
247
- * side.
649
+ * Injection token each layer atom provides via
650
+ * `{ provide: CNGX_CHART_LAYER, useExisting: CngxX }`. A
651
+ * `contentChildren(CNGX_CHART_LAYER, { descendants: true })` query on the
652
+ * chart shell collects every mounted layer's geometry through DI.
248
653
  *
249
- * @category common/chart
250
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
654
+ * @category common/chart/layers
655
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
251
656
  * @since 0.1.0
657
+ * @relatedTo CngxLine, CngxArea, CngxBar, CngxScatter, CngxThreshold, CngxBand
252
658
  */
253
- declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, number>>;
659
+ declare const CNGX_CHART_LAYER: InjectionToken<CngxChartLayer>;
254
660
 
255
661
  /**
256
662
  * Top-level chart container. Hosts an `<svg>` viewBox, applies
@@ -276,21 +682,55 @@ declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, n
276
682
  * The `[width]` / `[height]` inputs override the resize observer for
277
683
  * fixed-dimension presets (inline sparkline at 80×24, etc.).
278
684
  *
685
+ * ## The plot area
686
+ *
687
+ * Marks are mapped onto the *plot area*, not onto the whole viewBox:
688
+ * the viewBox minus the room the projected axes need for their tick
689
+ * labels and titles. The chart publishes the resulting rectangle on
690
+ * {@link CngxChartContext.plot}, and both its own scale ranges and
691
+ * every `[cngxAxis]` line resolve against that one derivation, so a
692
+ * tick can never drift away from the mark it labels.
693
+ *
694
+ * The reserved room is derived, not configured. Which sides reserve
695
+ * comes from the projected axis set; how much each side reserves comes
696
+ * from the axis itself, which sizes the gutter from the tick labels it
697
+ * already formats. There is no input, no CSS custom property and no DI
698
+ * token to tune it - a chart without axes reserves nothing and fills
699
+ * its box exactly as it did before the plot area existed, as does one
700
+ * whose axes are {@link CngxAxisDomain}, which draws nothing.
701
+ *
702
+ * Every axis reserves on its own side and a little on the two
703
+ * perpendicular ones, because a tick label is centred on its tick and
704
+ * the end ticks sit on the plot corners.
705
+ *
706
+ * Nothing here reads the DOM. The gutter is arithmetic over label
707
+ * strings, so it is at final width in the first painted frame and
708
+ * renders identically under SSR. The cost is that one character's
709
+ * width is an estimate rather than the font's real advance width; a
710
+ * consumer restyling `--cngx-axis-font-size` gets labels at their own
711
+ * size inside a gutter sized for the default.
712
+ *
279
713
  * @category common/chart
280
714
  * @docsKind primary
281
715
  * @wcag AA
282
716
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart.component.ts
283
717
  * @since 0.1.0
284
718
  * @relatedTo CngxAxis, CngxLine, CngxArea, CngxBar, CngxChartLegend
285
- */
286
- /**
719
+ *
287
720
  * <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
288
721
  * <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
289
722
  * <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
290
723
  * <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
724
+ * <example-url>http://localhost:4200/#/common/chart/primitives/overlay-aligned-to-the-plot</example-url>
291
725
  * <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
292
726
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
293
727
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
728
+ * @slot cngxChartLoading Replaces the centred spinner shown during the first load.
729
+ * @slot cngxChartEmpty Rendered when the data resolves to nothing.
730
+ * @slot cngxChartError Rendered when the load fails; gets the error.
731
+ * @slot cngxChartConnectionError Rendered over the chart when the live connection drops.
732
+ * @slot cngxChartReconnecting Rendered over the chart while the connection retries.
733
+ * @slot cngxChartOverlay HTML layered over the marks in the content view; the chart insets it to the plot area, pointer-events off by default.
294
734
  */
295
735
  declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, number> {
296
736
  /**
@@ -337,25 +777,55 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
337
777
  *
338
778
  * Accepts the standard `CngxAsyncState<T>` shape (any producer:
339
779
  * `createManualState`, `createAsyncState`, `injectAsyncState`,
340
- * `fromHttpResource`, `tap*` pipeline output). The chart provides
341
- * `CNGX_STATEFUL` for downstream bridge directives - composing
342
- * `<cngx-toast-on />` etc. inside the chart works automatically.
780
+ * `fromHttpResource`, `tap*` pipeline output). The chart exposes its
781
+ * state via this explicit input, not a `CNGX_STATEFUL` provision - bind
782
+ * bridges directly, e.g. `<cngx-toast-on [state]="chart.state()">`. The
783
+ * separate `[connectionState]` input tracks connection lifecycle so the
784
+ * two channels never contend for a single precedence seat.
343
785
  */
344
786
  readonly state: _angular_core.InputSignal<CngxAsyncState<readonly T[]> | undefined>;
787
+ /**
788
+ * Optional connection-lifecycle envelope, additive and independent of
789
+ * `[state]`. Bind a websocket/SSE adapter's `CngxAsyncState<unknown>` so
790
+ * connection blips surface via the `*cngxChartConnectionError` /
791
+ * `*cngxChartReconnecting` overlays without overriding the data view.
792
+ * Consumers care only about the status surface, hence `unknown` as `T`.
793
+ */
794
+ readonly connectionState: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
345
795
  private readonly resize;
796
+ private readonly hostEl;
797
+ private readonly destroyRef;
798
+ private readonly rendererFactory;
799
+ private readonly threshold;
346
800
  private readonly axes;
347
801
  private readonly thresholds;
348
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
802
+ private readonly layers;
803
+ protected readonly i18n: Signal<Required<_cngx_common_chart.CngxChartI18n>>;
349
804
  protected readonly dataTableId: string;
805
+ protected readonly hatchId: string;
806
+ protected readonly hatchFill: {
807
+ diagonal: string;
808
+ horizontal: string;
809
+ };
350
810
  private readonly loadingSlot;
351
811
  private readonly emptySlot;
352
812
  private readonly errorSlot;
813
+ private readonly connectionErrorSlot;
814
+ private readonly reconnectingSlot;
815
+ private readonly overlaySlot;
816
+ private readonly overlaySlots;
353
817
  /** Resolved consumer-projected loading template (null when no slot bound). */
354
- protected readonly loadingTpl: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
818
+ protected readonly loadingTpl: Signal<_angular_core.TemplateRef<any> | null>;
355
819
  /** Resolved consumer-projected empty template (null when no slot bound). */
356
- protected readonly emptyTpl: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
820
+ protected readonly emptyTpl: Signal<_angular_core.TemplateRef<any> | null>;
357
821
  /** Resolved consumer-projected error template (null when no slot bound). */
358
- protected readonly errorTpl: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
822
+ protected readonly errorTpl: Signal<_angular_core.TemplateRef<any> | null>;
823
+ /** Resolved consumer-projected connection-error template. */
824
+ protected readonly connectionErrorTpl: Signal<_angular_core.TemplateRef<any> | null>;
825
+ /** Resolved consumer-projected reconnecting template. */
826
+ protected readonly reconnectingTpl: Signal<_angular_core.TemplateRef<any> | null>;
827
+ /** Resolved consumer-projected overlay template (null when no slot bound). */
828
+ protected readonly overlayTpl: Signal<_angular_core.TemplateRef<any> | null>;
359
829
  /**
360
830
  * Common context for every slot template (loading, empty, error).
361
831
  * Carries the chart's current rendered width/height plus a `small`
@@ -376,22 +846,59 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
376
846
  * viewport: the rendered width is what the consumer cares about
377
847
  * for fallback layout, not the logical viewBox dimension.
378
848
  */
379
- protected readonly slotContext: _angular_core.Signal<CngxChartSlotContext>;
849
+ protected readonly slotContext: Signal<CngxChartSlotContext>;
380
850
  /**
381
851
  * Error-slot context - extends {@link slotContext} with the live
382
852
  * error value under `$implicit` and `error` keys, so a consumer can
383
853
  * render a typed message AND branch on chart size in the same
384
854
  * template.
385
855
  */
386
- protected readonly errorContext: _angular_core.Signal<{
856
+ protected readonly errorContext: Signal<{
387
857
  $implicit: {} | null;
388
858
  error: {} | null;
389
859
  width: number;
390
860
  height: number;
391
861
  small: boolean;
862
+ plot: CngxChartPlotArea;
392
863
  }>;
864
+ /**
865
+ * Connection-lifecycle view derived from `[connectionState]`'s status.
866
+ * NOT routed through `resolveAsyncView` - that `AsyncView` union has no
867
+ * `'refreshing'` member and folds a refreshing status into the data
868
+ * view. The connection channel maps status directly: `'error'` ->
869
+ * connection-lost overlay, `'refreshing'` -> reconnecting overlay,
870
+ * everything else -> no overlay. Independent of `activeView()`.
871
+ */
872
+ protected readonly connectionView: Signal<"error" | "none" | "reconnecting">;
873
+ /**
874
+ * Text of the default connection overlay (a `role="alert"` /
875
+ * `role="status"` live region). Only the connection view is tracked;
876
+ * the copy is read untracked, so a runtime copy or locale flip does not
877
+ * rewrite a shown announcement - the next transition speaks the new one.
878
+ */
879
+ protected readonly connectionOverlayText: Signal<string>;
880
+ /**
881
+ * Context for the connection-slot templates - the connection-channel
882
+ * twin of {@link errorContext}, carrying the live connection error.
883
+ */
884
+ protected readonly connectionCtx: Signal<CngxChartConnectionContext>;
885
+ /**
886
+ * Current/previous pair for the connection channel's status,
887
+ * unbound-safe via the `'idle'` fallback.
888
+ */
889
+ private readonly connectionTransition;
890
+ /**
891
+ * Text for the always-in-DOM polite live region that voices the
892
+ * recovery transition. The lost/reconnecting overlays announce
893
+ * themselves through their `role="alert"` / `role="status"` - but
894
+ * on recovery they simply vanish, which is a silent state change
895
+ * (Pillar 2). This computed says {@link CngxChartI18n.connectionRestored}
896
+ * exactly on the error/refreshing -> success edge and clears again
897
+ * on the next connection transition. Pure derivation, no `effect()`.
898
+ */
899
+ protected readonly connectionRestoredAnnouncement: Signal<string>;
393
900
  constructor();
394
- readonly dataLength: _angular_core.Signal<number>;
901
+ readonly dataLength: Signal<number>;
395
902
  /**
396
903
  * Generic-aware data accessor satisfying {@link CngxChartContext.data}.
397
904
  * The single boundary cast lives here; layer atoms call
@@ -399,22 +906,108 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
399
906
  * per-site `as` cast.
400
907
  */
401
908
  data<U = T>(): readonly U[];
402
- readonly dimensions: _angular_core.Signal<{
909
+ readonly dimensions: Signal<{
403
910
  width: number;
404
911
  height: number;
405
912
  }>;
406
- protected readonly viewBox: _angular_core.Signal<string>;
913
+ /**
914
+ * Room the projected axes need for their decoration, per side.
915
+ * Chart-internal: it exists only to produce {@link plot}, which is
916
+ * what every reader actually wants.
917
+ *
918
+ * Which sides reserve is derived from the same `axes()` query the
919
+ * scale lookups below already read - a consumer input would be a
920
+ * second source for something the chart can see. How much each side
921
+ * reserves is the axis's own {@link CngxChartAxis.reservation}: the
922
+ * chart never learns what a tick label is, and the axis never learns
923
+ * where the plot ends. A side with no axis on it stays `0`, which is
924
+ * why a chart whose axes all draw nothing resolves to
925
+ * {@link ZERO_INSET} and renders exactly as it did before the inset
926
+ * existed.
927
+ */
928
+ private readonly inset;
929
+ /**
930
+ * The plot inset as percentages of the host box, published as the
931
+ * `--cngx-chart-plot-*` custom properties.
932
+ *
933
+ * Custom properties inherit downwards, so these reach the chart's own
934
+ * subtree. An overlay outside the host does not see them and reads
935
+ * {@link plot} off the exported instance instead
936
+ * (`#chart="cngxChart"`) - projected content lands inside the `<svg>`,
937
+ * so an HTML overlay is always a sibling.
938
+ *
939
+ * Percentages rather than pixels, because a user unit is not always a
940
+ * CSS pixel: an explicit `[width]="520"` chart squeezed by
941
+ * `max-width: 100%` keeps a 520-unit viewBox inside a 400px box. A
942
+ * fraction of the viewBox survives that scaling where a px value
943
+ * would not. Block values resolve against the containing block's
944
+ * height and inline values against its width, matching what `top` and
945
+ * `inset-inline-end` expect.
946
+ *
947
+ * Exact while the host's aspect ratio matches the viewBox, which is
948
+ * what {@link explicitAspectRatio} holds it to whenever both `[width]`
949
+ * and `[height]` are bound. Bind only one and it returns `null` on
950
+ * purpose (the consumer drove one dimension deliberately); the SVG
951
+ * then letterboxes under `preserveAspectRatio`, and these percentages
952
+ * address the host box rather than the letterboxed drawing area. The
953
+ * error is the letterbox margin - zero until the host is forced away
954
+ * from the viewBox ratio. Bind both dimensions when an overlay has to
955
+ * land on the plot edge exactly.
956
+ */
957
+ protected readonly plotVars: Signal<{
958
+ inlineStart: string;
959
+ inlineEnd: string;
960
+ blockStart: string;
961
+ blockEnd: string;
962
+ }>;
963
+ /**
964
+ * The plot rectangle published on {@link CngxChartContext}: the
965
+ * viewBox minus {@link inset}. Both scale ranges below and every
966
+ * `[cngxAxis]` resolve against this one derivation, so there is no
967
+ * second place where the box and the reserved room are subtracted
968
+ * from each other and no way for the two to disagree.
969
+ */
970
+ readonly plot: Signal<CngxChartPlotArea>;
971
+ /**
972
+ * Render backend: `'canvas'` once the datapoint count exceeds the
973
+ * configured threshold, `'svg'` otherwise. The threshold is a DI
974
+ * constant ({@link CNGX_CHART_RENDERER_THRESHOLD}, default `500`),
975
+ * resolved once at construction; a consumer tunes it via
976
+ * `withChartRendererThreshold(...)` or replaces the whole factory.
977
+ */
978
+ readonly renderMode: Signal<"svg" | "canvas">;
979
+ /**
980
+ * SVG-output gate published on {@link CngxChartContext}. Derived from
981
+ * {@link renderMode} - layer atoms self-render their SVG only in SVG
982
+ * mode. Single source of truth; the renderer never writes it.
983
+ */
984
+ readonly renderSvg: Signal<boolean>;
985
+ /**
986
+ * Aggregate layer geometries the Canvas backend paints. Element-wise
987
+ * guarded: an unchanged layer contributes a reference-stable geometry
988
+ * object (its own `equal` fn holds), so the mapped array is
989
+ * element-wise-equal and the paint cascade short-circuits.
990
+ */
991
+ protected readonly geometries: Signal<readonly LayerGeometry[]>;
992
+ protected readonly viewBox: Signal<string>;
407
993
  private readonly xScaleCache;
408
994
  private readonly yScaleCache;
409
- readonly xScale: _angular_core.Signal<ScaleFn<XScaleInput>>;
410
- readonly yScale: _angular_core.Signal<ScaleFn<number>>;
995
+ readonly xScale: Signal<ScaleFn<XScaleInput>>;
996
+ readonly yScale: Signal<ScaleFn<number>>;
411
997
  /**
412
998
  * Auto-Summary derived from `data` and `<cngx-threshold>` content
413
999
  * children. Drives the host's reactive `aria-label`. Layer atoms do
414
- * not contribute to the summary on Phase 3 - Phase 5/6 may extend
415
- * with per-layer hints.
1000
+ * not contribute to the summary today; per-layer hints may extend it
1001
+ * later.
416
1002
  */
417
- readonly summary: _angular_core.Signal<_cngx_common_chart.CngxChartSummary>;
1003
+ readonly summary: Signal<_cngx_common_chart.CngxChartSummary>;
1004
+ /**
1005
+ * The most recent significant transition (trend-flip or threshold-cross)
1006
+ * derived from {@link summary}, or `null`. The chart stays
1007
+ * pure-derivation - a companion `<cngx-chart-announcer>` subscribes to
1008
+ * this surface and voices it to assistive technology.
1009
+ */
1010
+ readonly significantChange: Signal<_cngx_common_chart.CngxSignificantChange | null>;
418
1011
  /**
419
1012
  * Active view for the optional state-machine envelope. Returns
420
1013
  * `'content'` when no `[state]` is bound, falling through to the
@@ -423,18 +1016,26 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
423
1016
  * / empty triple every preset and async-aware atom in the library
424
1017
  * uses.
425
1018
  */
426
- protected readonly activeView: _angular_core.Signal<AsyncView>;
1019
+ protected readonly activeView: Signal<AsyncView>;
427
1020
  /** True when the chart is currently rendering its skeleton view. */
428
- protected readonly busy: _angular_core.Signal<boolean>;
1021
+ protected readonly busy: Signal<boolean>;
1022
+ /**
1023
+ * True when a fallback view (skeleton / empty / error / none) has
1024
+ * replaced the data content. The Canvas overlay is a sibling of the
1025
+ * `@switch` and would otherwise keep painting the chart on top of the
1026
+ * fallback in canvas mode - this gates it off so the fallback stands
1027
+ * alone.
1028
+ */
1029
+ protected readonly contentHidden: Signal<boolean>;
429
1030
  /**
430
1031
  * Responsive mode is active when neither `[width]` nor `[height]` is
431
1032
  * bound. The host then fills its parent's width and derives height
432
1033
  * from the `--cngx-chart-aspect-ratio` CSS custom property (default
433
- * `16 / 9`). The resize observer feeds `dimensions()` which drives
1034
+ * `5 / 2`). The resize observer feeds `dimensions()` which drives
434
1035
  * the SVG sizing + scale math, so axes and layer atoms re-flow
435
1036
  * reactively as the parent resizes.
436
1037
  */
437
- protected readonly isResponsive: _angular_core.Signal<boolean>;
1038
+ protected readonly isResponsive: Signal<boolean>;
438
1039
  /**
439
1040
  * Aspect-ratio host style for the explicit-dimension case. Computed
440
1041
  * from `[width] / [height]` so the chart stays proportional when
@@ -445,26 +1046,292 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
445
1046
  * wins, and `null` when only one of width/height is bound (caller
446
1047
  * intentionally drove just one dimension; we do not invent a ratio).
447
1048
  */
448
- protected readonly explicitAspectRatio: _angular_core.Signal<string | null>;
1049
+ protected readonly explicitAspectRatio: Signal<string | null>;
449
1050
  /**
450
1051
  * Reactive `aria-label` text the host announces. Skeleton / empty /
451
1052
  * error states announce localised i18n strings; the auto-Summary
452
1053
  * runs only in the content branch so AT does not read stale data
453
1054
  * during a refetch.
454
1055
  */
455
- protected readonly ariaLabelText: _angular_core.Signal<string>;
456
- /** Numeric projection of `data` reused by the data-table view. */
457
- protected readonly summaryValues: _angular_core.Signal<readonly number[]>;
1056
+ protected readonly ariaLabelText: Signal<string>;
1057
+ /**
1058
+ * The single numeric projection of `data` through `summaryAccessor`.
1059
+ * Both {@link summary} and the data-table view derive from it, so the
1060
+ * projection runs once per data change and its `sameNumberArr` equal
1061
+ * stops the cascade when a refresh produces identical values.
1062
+ */
1063
+ protected readonly summaryValues: Signal<readonly number[]>;
1064
+ /**
1065
+ * Auto-mode predicate. Drives the data-table's `aria-hidden`
1066
+ * binding. The id on `aria-describedby` is invariant - it stays on
1067
+ * the host whether the table is active or not. Single-value charts
1068
+ * speak via the `aria-label` summary; multi-value charts add the
1069
+ * table for row-by-row exploration.
1070
+ */
1071
+ protected readonly tableActive: Signal<boolean>;
1072
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChart<any>, never>;
1073
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChart<any>, "cngx-chart", ["cngxChart"], { "dataInput": { "alias": "data"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "preserveAspectRatio": { "alias": "preserveAspectRatio"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "summaryAccessor": { "alias": "summaryAccessor"; "required": false; "isSignal": true; }; "accessibleTable": { "alias": "accessibleTable"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "connectionState": { "alias": "connectionState"; "required": false; "isSignal": true; }; }, {}, ["axes", "thresholds", "layers", "loadingSlot", "emptySlot", "errorSlot", "connectionErrorSlot", "reconnectingSlot", "overlaySlot", "overlaySlots"], ["*"], true, [{ directive: typeof i1.CngxResizeObserver; inputs: {}; outputs: {}; }]>;
1074
+ }
1075
+
1076
+ /**
1077
+ * The chart section of a {@link CngxLanguagePack}: the copy of
1078
+ * `@cngx/common/chart`. Numbers reach the messages already formatted for
1079
+ * the app locale. `summary` and `stackedBarSummary` are assembled from
1080
+ * several keys, so a pack owns their words, their order and their list
1081
+ * separator.
1082
+ *
1083
+ * @category common/chart/i18n
1084
+ * @since 0.1.0
1085
+ * @relatedTo CNGX_CHART_I18N
1086
+ */
1087
+ interface CngxChartLanguageSection {
1088
+ /** `{trend}`, `{min}`, `{max}`, `{current}`, `{thresholds}`: the chart's accessible name. */
1089
+ readonly summary: CngxMessage;
1090
+ readonly summaryTrendUp: string;
1091
+ readonly summaryTrendDown: string;
1092
+ readonly summaryTrendFlat: string;
1093
+ /** The `{thresholds}` part of `summary` when no threshold is crossed. */
1094
+ readonly summaryNoThresholds: string;
1095
+ /** Plural on `{count}`: the `{thresholds}` part of `summary`. */
1096
+ readonly summaryThresholds: CngxMessage;
1097
+ /** Caption of the screen-reader data table. */
1098
+ readonly dataTable: string;
1099
+ /** Header of the data table's index column. */
1100
+ readonly indexColumnLabel: string;
1101
+ /** Header of the data table's value column. */
1102
+ readonly valueColumnLabel: string;
1103
+ readonly trendChangedUp: string;
1104
+ readonly trendChangedDown: string;
1105
+ readonly trendFlattened: string;
1106
+ /** `{threshold}`: announced when a threshold is crossed. */
1107
+ readonly thresholdAlert: CngxMessage;
1108
+ readonly connectionLost: string;
1109
+ readonly connectionReconnecting: string;
1110
+ readonly connectionRestored: string;
1111
+ readonly empty: string;
1112
+ readonly loading: string;
1113
+ readonly error: string;
1114
+ /** Accessible name of a stacked bar with no segments. */
1115
+ readonly stackedBarEmpty: string;
1116
+ /** `{total}`, `{segments}`: accessible name of a stacked bar. */
1117
+ readonly stackedBarSummary: CngxMessage;
1118
+ /** `{label}`, `{value}`: one stacked-bar segment, in its tooltip and in the summary. */
1119
+ readonly stackedBarSegmentTitle: CngxMessage;
1120
+ /** Joins the segments of `stackedBarSummary`. */
1121
+ readonly listSeparator: string;
1122
+ }
1123
+ /**
1124
+ * The English chart section: the single source of the chart's English copy.
1125
+ * `CNGX_CHART_I18N` defaults to it.
1126
+ *
1127
+ * @category common/chart/i18n
1128
+ * @since 0.1.0
1129
+ * @relatedTo CNGX_CHART_I18N
1130
+ */
1131
+ declare const CNGX_CHART_LANGUAGE_EN: CngxChartLanguageSection;
1132
+ declare module '@cngx/core/i18n' {
1133
+ interface CngxLanguagePack {
1134
+ readonly chart: CngxChartLanguageSection;
1135
+ }
1136
+ }
1137
+
1138
+ /**
1139
+ * Summary input describing the chart's current data shape. Consumed by
1140
+ * `CngxChartI18n.summary()` to produce the `aria-label` text the
1141
+ * `<cngx-chart>` host announces to screen readers.
1142
+ *
1143
+ * @category common/chart/i18n
1144
+ */
1145
+ interface CngxChartSummary {
1146
+ readonly trend: 'up' | 'down' | 'flat';
1147
+ readonly min: number;
1148
+ readonly max: number;
1149
+ readonly current: number;
1150
+ readonly thresholds: readonly number[];
1151
+ }
1152
+ /**
1153
+ * i18n surface for `@cngx/common/chart`. Mirrors the `CNGX_RECYCLER_I18N`
1154
+ * shape from `@cngx/common/data` - factory defaults supply English;
1155
+ * consumers override per-app via {@link provideChartI18n}.
1156
+ *
1157
+ * @category common/chart/i18n
1158
+ */
1159
+ interface CngxChartI18n {
1160
+ readonly summary: (input: CngxChartSummary) => string;
1161
+ readonly dataTable: () => string;
1162
+ /**
1163
+ * Header of the data table's index column. Optional so pre-existing full
1164
+ * overrides keep compiling; English `#`.
1165
+ */
1166
+ readonly indexColumnLabel?: () => string;
1167
+ readonly valueColumnLabel: () => string;
1168
+ readonly trendChanged: (trend: 'up' | 'down' | 'flat') => string;
1169
+ readonly thresholdAlert: (threshold: number) => string;
1170
+ readonly connectionLost: () => string;
1171
+ readonly connectionReconnecting: () => string;
1172
+ readonly connectionRestored: () => string;
1173
+ readonly empty: () => string;
1174
+ readonly loading: () => string;
1175
+ readonly error: () => string;
1176
+ /**
1177
+ * Accname for a `<cngx-stacked-bar>` with no segments. Optional so
1178
+ * pre-existing full overrides keep compiling; the token factory
1179
+ * supplies English and the component falls back to its built-in
1180
+ * phrasing when a custom override omits the key.
1181
+ */
1182
+ readonly stackedBarEmpty?: () => string;
1183
+ /**
1184
+ * Auto-generated accname for a `<cngx-stacked-bar>`: the total plus
1185
+ * one label/value pair per segment. Optional for the same
1186
+ * compatibility reason as {@link CngxChartI18n.stackedBarEmpty}.
1187
+ */
1188
+ readonly stackedBarSummary?: (total: number, segments: readonly {
1189
+ readonly label: string;
1190
+ readonly value: number;
1191
+ }[]) => string;
1192
+ /**
1193
+ * Tooltip of one stacked-bar segment. Receives the segment label and its
1194
+ * value, already formatted for the app locale. Optional for the same
1195
+ * compatibility reason as {@link CngxChartI18n.stackedBarEmpty}; English
1196
+ * `label: value`.
1197
+ */
1198
+ readonly stackedBarSegmentTitle?: (label: string, value: string) => string;
1199
+ }
1200
+ /**
1201
+ * Injection token for chart i18n strings, a `Signal` so the copy follows a
1202
+ * runtime language switch. Defaults to English via `factory:`, with numbers
1203
+ * in the root app locale (`CNGX_LOCALE`, falling back to `LOCALE_ID`), read
1204
+ * live. Override at app root with {@link provideChartI18n}; every key left
1205
+ * at its default still follows the app locale at the use site, including a
1206
+ * runtime `CNGX_LOCALE` flip.
1207
+ *
1208
+ * @category common/chart/i18n
1209
+ * @wcag AA
1210
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/i18n/chart-i18n.ts
1211
+ * @since 0.1.0
1212
+ */
1213
+ declare const CNGX_CHART_I18N: InjectionToken<Signal<CngxChartI18n>>;
1214
+ /**
1215
+ * Branded feature-fn for {@link provideChartI18n}.
1216
+ *
1217
+ * @category common/chart/i18n
1218
+ */
1219
+ type CngxChartI18nFeature = ((bundle: Signal<CngxChartI18n>) => Signal<CngxChartI18n>) & {
1220
+ readonly _target: 'i18n';
1221
+ };
1222
+ /**
1223
+ * Override chart copy via a partial bundle - unset keys keep the language
1224
+ * pack's copy, or the English default, and keep following the app locale.
1225
+ * Pass a `Signal` to switch the language at runtime.
1226
+ *
1227
+ * @category common/chart/i18n
1228
+ */
1229
+ declare function withChartI18nLabels(overrides: Partial<CngxChartI18n> | Signal<Partial<CngxChartI18n>>): CngxChartI18nFeature;
1230
+ /**
1231
+ * Provider for the chart i18n bundle. The features apply on top of the
1232
+ * active language pack, so a consumer localises only the keys they care
1233
+ * about; every key left out keeps the pack's copy and follows the app locale.
1234
+ *
1235
+ * ```typescript
1236
+ * providers: [
1237
+ * provideChartI18n(
1238
+ * withChartI18nLabels({
1239
+ * dataTable: () => 'Datentabelle',
1240
+ * }),
1241
+ * ),
1242
+ * ]
1243
+ * ```
1244
+ *
1245
+ * @category common/chart/i18n
1246
+ */
1247
+ declare function provideChartI18n(...features: readonly CngxChartI18nFeature[]): Provider;
1248
+
1249
+ /** @internal */
1250
+ type Trend = 'up' | 'down' | 'flat';
1251
+ /**
1252
+ * A significant, AT-worthy transition derived from the chart summary:
1253
+ * either the trend flipped, or the current value crossed a threshold.
1254
+ * A discriminated union - each variant carries exactly its own fields.
1255
+ *
1256
+ * @category common/chart
1257
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/significant-change.ts
1258
+ * @since 0.1.0
1259
+ */
1260
+ type CngxSignificantChange = {
1261
+ readonly kind: 'trend-flip';
1262
+ readonly from: Trend;
1263
+ readonly to: Trend;
1264
+ } | {
1265
+ readonly kind: 'threshold-cross';
1266
+ readonly threshold: number;
1267
+ readonly direction: 'up' | 'down';
1268
+ };
1269
+ /**
1270
+ * Derive the most recent significant transition from a chart-summary
1271
+ * signal, or `null` when the latest update carried no significance.
1272
+ *
1273
+ * Mirrors `createTransitionTracker`'s current/previous discipline: an
1274
+ * internal `linkedSignal` holds the current summary and the one before it
1275
+ * (structural-equality guarded), and the public signal is a `computed`
1276
+ * with its own structural `equal` - so a summary that re-emits an
1277
+ * equivalent shape yields the same `null` reference and never re-fires a
1278
+ * downstream effect. Threshold crossings take precedence over trend flips
1279
+ * (they are operationally more significant).
1280
+ *
1281
+ * The chart stays pure-derivation: effects that react to the event live in
1282
+ * the companion announcer, not here.
1283
+ *
1284
+ * @param summary the chart's `CngxChartSummary` signal.
1285
+ *
1286
+ * @category common/chart
1287
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/significant-change.ts
1288
+ * @since 0.1.0
1289
+ */
1290
+ declare function createSignificantChangeTracker(summary: Signal<CngxChartSummary>): Signal<CngxSignificantChange | null>;
1291
+
1292
+ /**
1293
+ * Companion live-region announcer for `<cngx-chart>`. Mount it next to a
1294
+ * chart and bind the chart instance; it voices the chart's
1295
+ * `significantChange()` events to assistive technology through two
1296
+ * always-in-DOM regions with a severity split (W3C ARIA practice):
1297
+ *
1298
+ * - trend flips -> a polite `role="status"` region (informational);
1299
+ * - threshold crossings -> an assertive `role="alert"` region
1300
+ * (operationally significant, warrants interruption).
1301
+ *
1302
+ * Both announcements are pure-derivation `computed`s the template
1303
+ * interpolates - there is no `effect()` bridge and nothing to wrap in
1304
+ * `untracked()` (same shape as `CngxRecyclerAnnouncer`). Text is localised
1305
+ * through {@link CNGX_CHART_I18N}.
1306
+ *
1307
+ * ```html
1308
+ * <cngx-chart #c [data]="points()" />
1309
+ * <cngx-chart-announcer [cngxChartAnnouncer]="c" />
1310
+ * ```
1311
+ *
1312
+ * @category common/chart
1313
+ * @docsKind primary
1314
+ * @wcag AA
1315
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-announcer.component.ts
1316
+ * @since 0.1.0
1317
+ * @relatedTo CngxChart, createSignificantChangeTracker
1318
+ *
1319
+ * <example-url>http://localhost:4200/#/common/chart/realtime/streaming-telemetry</example-url>
1320
+ */
1321
+ declare class CngxChartAnnouncer {
1322
+ /** The chart instance whose `significantChange()` this announcer voices. */
1323
+ readonly chart: _angular_core.InputSignal<CngxChart<unknown>>;
1324
+ private readonly i18n;
458
1325
  /**
459
- * Auto-mode predicate. Drives the data-table's `aria-hidden`
460
- * binding. The id on `aria-describedby` is invariant - it stays on
461
- * the host whether the table is active or not. Single-value charts
462
- * speak via the `aria-label` summary; multi-value charts add the
463
- * table for row-by-row exploration.
1326
+ * Polite (informational) text for trend flips; empty otherwise. The copy
1327
+ * is read untracked: only the chart event re-derives a live region, so a
1328
+ * copy or locale flip never re-speaks a shown announcement.
464
1329
  */
465
- protected readonly tableActive: _angular_core.Signal<boolean>;
466
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChart<any>, never>;
467
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChart<any>, "cngx-chart", ["cngxChart"], { "dataInput": { "alias": "data"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "preserveAspectRatio": { "alias": "preserveAspectRatio"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "summaryAccessor": { "alias": "summaryAccessor"; "required": false; "isSignal": true; }; "accessibleTable": { "alias": "accessibleTable"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; }, {}, ["axes", "thresholds", "loadingSlot", "emptySlot", "errorSlot"], ["*"], true, [{ directive: typeof i1.CngxResizeObserver; inputs: {}; outputs: {}; }]>;
1330
+ protected readonly politeAnnouncement: _angular_core.Signal<string>;
1331
+ /** Assertive (interrupting) text for threshold crossings; empty otherwise. Copy untracked, as above. */
1332
+ protected readonly assertiveAnnouncement: _angular_core.Signal<string>;
1333
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartAnnouncer, never>;
1334
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChartAnnouncer, "cngx-chart-announcer", never, { "chart": { "alias": "cngxChartAnnouncer"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
468
1335
  }
469
1336
 
470
1337
  /**
@@ -483,6 +1350,69 @@ type CngxAxisPosition = 'top' | 'right' | 'bottom' | 'left';
483
1350
  * @category common/chart/axis
484
1351
  */
485
1352
  type CngxAxisType = 'linear' | 'time' | 'band';
1353
+
1354
+ /**
1355
+ * What `<cngx-chart>` needs from an axis, and nothing more.
1356
+ *
1357
+ * Two things travel over this contract. The scale half (`position` /
1358
+ * `type` / `domain`) tells the chart which scale to build and over what
1359
+ * range of values. The geometry half (`reservation` /
1360
+ * `crossReservation`) tells it how much of the box that axis's
1361
+ * decoration needs, so the chart can shrink the plot area to fit.
1362
+ *
1363
+ * Both implementations in the library are axes in the loose sense but
1364
+ * differ in what they do: {@link CngxAxis} draws ticks, labels and a
1365
+ * title and reserves room for them; `CngxAxisDomain` draws nothing and
1366
+ * reserves nothing, existing purely to publish a scale domain. The
1367
+ * chart cannot tell them apart, which is the point - it places and
1368
+ * sizes against the contract, never against a concrete class.
1369
+ *
1370
+ * Implement it on your own directive when you need an axis the chart
1371
+ * participates with but the library does not ship: a logarithmic scale
1372
+ * publisher, an axis whose domain comes from a service, a decoration
1373
+ * you draw yourself. Provide it with `useExisting` and the chart picks
1374
+ * the directive up through its content query.
1375
+ *
1376
+ * @category common/chart/axis
1377
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/chart-axis.ts
1378
+ * @since 0.1.0
1379
+ * @relatedTo CngxAxis, CngxAxisDomain, CngxChart
1380
+ */
1381
+ interface CngxChartAxis {
1382
+ /** Which edge of the plot area this axis occupies. */
1383
+ readonly position: Signal<CngxAxisPosition>;
1384
+ /** Scale kind the chart builds for this axis's dimension. */
1385
+ readonly type: Signal<CngxAxisType>;
1386
+ /** Value range the scale maps from. `undefined` yields a NOOP scale. */
1387
+ readonly domain: Signal<readonly unknown[] | undefined>;
1388
+ /**
1389
+ * How far this axis's decoration extends perpendicular to its own
1390
+ * line, in viewBox user units. The chart reserves it on the side
1391
+ * {@link position} names. Return `0` to claim no room.
1392
+ */
1393
+ readonly reservation: Signal<number>;
1394
+ /**
1395
+ * How far this axis's decoration extends *along* its own line, past
1396
+ * the plot corner at either end. The chart reserves it on the two
1397
+ * sides perpendicular to {@link position}. Return `0` to claim no
1398
+ * room.
1399
+ */
1400
+ readonly crossReservation: Signal<number>;
1401
+ }
1402
+ /**
1403
+ * Contract token every axis provides and `<cngx-chart>` queries.
1404
+ *
1405
+ * The chart's content query resolves this rather than a concrete class,
1406
+ * so a consumer-authored axis participates in scale building and plot
1407
+ * insetting on equal terms with the ones the library ships.
1408
+ *
1409
+ * @category common/chart/axis
1410
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/chart-axis.ts
1411
+ * @since 0.1.0
1412
+ * @relatedTo CngxChartAxis, CngxAxis, CngxAxisDomain
1413
+ */
1414
+ declare const CNGX_CHART_AXIS: InjectionToken<CngxChartAxis>;
1415
+
486
1416
  /** @internal */
487
1417
  interface AxisLabelGeometry {
488
1418
  readonly transform: string;
@@ -560,7 +1490,7 @@ interface TickRendering {
560
1490
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
561
1491
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
562
1492
  */
563
- declare class CngxAxis {
1493
+ declare class CngxAxis implements CngxChartAxis {
564
1494
  readonly position: _angular_core.InputSignal<CngxAxisPosition>;
565
1495
  readonly type: _angular_core.InputSignal<CngxAxisType>;
566
1496
  readonly domain: _angular_core.InputSignal<readonly unknown[] | undefined>;
@@ -586,6 +1516,12 @@ declare class CngxAxis {
586
1516
  */
587
1517
  readonly axisLabel: _angular_core.InputSignal<string | null>;
588
1518
  private readonly ctx;
1519
+ private readonly locale;
1520
+ /**
1521
+ * The bound `[format]`, or the default tick formatter bound to the app
1522
+ * locale (`CNGX_LOCALE`), so a locale flip re-formats the default labels.
1523
+ */
1524
+ private readonly resolvedFormat;
589
1525
  /**
590
1526
  * Tick values to render. Resolution order:
591
1527
  * 1. `type='band'` and `[domain]` provided → one tick per domain
@@ -595,7 +1531,84 @@ declare class CngxAxis {
595
1531
  * 3. Otherwise → empty array. Axis still renders the line.
596
1532
  */
597
1533
  readonly tickValues: _angular_core.Signal<readonly unknown[]>;
1534
+ /**
1535
+ * How far this axis's decoration extends perpendicular to its own
1536
+ * line, in viewBox user units. The parent chart reads it to size the
1537
+ * plot inset on the side {@link position} names; nothing else
1538
+ * consumes it.
1539
+ *
1540
+ * The magnitude is derived, not configured. A vertical axis reserves
1541
+ * for the tick gap plus the *longest formatted tick label*, because a
1542
+ * left label grows leftward with its character count. A horizontal
1543
+ * axis reserves the tick gap plus one line box, because a bottom
1544
+ * label grows downward by its height no matter how long it is. An
1545
+ * axis carrying a {@link axisLabel} title reserves at least the
1546
+ * title's own fixed offset plus its line box, since
1547
+ * `buildAxisLabelGeometry` places the title at a constant distance
1548
+ * from the line rather than beyond the ticks - so the two extents
1549
+ * are alternatives, not addends.
1550
+ *
1551
+ * Character width is an estimate ({@link CHAR_ADVANCE_RATIO}), which
1552
+ * is the one value here that is not derived from state the axis
1553
+ * owns. Everything else comes from {@link tickValues} and
1554
+ * {@link format}, which the component already computes to render the
1555
+ * labels themselves - so this reads no DOM, measures no text, and
1556
+ * returns the same number under SSR as in the browser.
1557
+ *
1558
+ * Acyclic by construction: {@link tickValues} reads `domain` /
1559
+ * `ticks` / `type` and never the scale, so
1560
+ * `reservation -> inset -> plot -> scale -> tickRenderings` has no
1561
+ * back edge.
1562
+ */
1563
+ readonly reservation: _angular_core.Signal<number>;
1564
+ /**
1565
+ * How far this axis's decoration extends *along* its own line, past
1566
+ * the plot corner at either end. The parent chart reserves it on the
1567
+ * two sides perpendicular to {@link position}.
1568
+ *
1569
+ * A tick label is centred on its tick, and the extreme ticks sit
1570
+ * exactly on the plot corners - so half of the first and last label
1571
+ * hangs outside the plot no matter how much room the axis's own side
1572
+ * reserves. A left axis's topmost label overhangs upward by half a
1573
+ * line box; a bottom axis's last label overhangs rightward by half
1574
+ * its width. Reserving only on the side the axis occupies leaves
1575
+ * both of those painting outside the viewBox, which is the defect
1576
+ * this pairs with {@link reservation} to close.
1577
+ *
1578
+ * The widest label stands in for the two extreme ones. Being wrong
1579
+ * here means over-reserving by a few units on an axis whose ends
1580
+ * happen to carry its shortest labels, which is cheaper than the
1581
+ * per-end bookkeeping the exact answer would need.
1582
+ */
1583
+ readonly crossReservation: _angular_core.Signal<number>;
1584
+ /**
1585
+ * Estimated width of the widest formatted tick label, in viewBox user
1586
+ * units. Split out so a horizontal axis reads it only where label
1587
+ * width actually matters - its own reservation is a line box, and
1588
+ * only its cross-axis overhang depends on the strings.
1589
+ */
1590
+ private readonly widestTickLabel;
1591
+ /**
1592
+ * Character count of the widest formatted tick label. Split out so
1593
+ * that {@link reservation} on a horizontal axis never reads it - a
1594
+ * bottom label's own gutter is its height, so tracking the label
1595
+ * strings there would add a dependency that cannot change the result.
1596
+ * {@link crossReservation} does read it in the horizontal case, where
1597
+ * the label's width is exactly what overhangs the plot corner.
1598
+ */
1599
+ private readonly longestTickLabel;
598
1600
  protected readonly hostClass: _angular_core.Signal<string>;
1601
+ /**
1602
+ * The chart's plot area, or `null` once it has collapsed on either
1603
+ * dimension - the same condition under which the chart hands out its
1604
+ * NOOP scale, so a collapsed chart renders no axis rather than an
1605
+ * axis against a backwards range.
1606
+ *
1607
+ * The rectangle itself is the chart's derivation, read straight off
1608
+ * the context. The axis narrows it to a render/do-not-render
1609
+ * decision; it never reconstructs it from the box.
1610
+ */
1611
+ private readonly plot;
599
1612
  protected readonly axisLabelGeometry: _angular_core.Signal<AxisLabelGeometry | null>;
600
1613
  protected readonly axisGeometry: _angular_core.Signal<AxisGeometry | null>;
601
1614
  protected readonly tickRenderings: _angular_core.Signal<readonly TickRendering[]>;
@@ -603,12 +1616,70 @@ declare class CngxAxis {
603
1616
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAxis, "[cngxAxis]", ["cngxAxis"], { "position": { "alias": "position"; "required": true; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "domain": { "alias": "domain"; "required": false; "isSignal": true; }; "tickCount": { "alias": "ticks"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "showGrid": { "alias": "grid"; "required": false; "isSignal": true; }; "axisLabel": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
604
1617
  }
605
1618
 
1619
+ /**
1620
+ * Declares a scale domain to the parent `<cngx-chart>` without drawing
1621
+ * anything.
1622
+ *
1623
+ * A chart builds its `xScale` from whichever projected axis occupies a
1624
+ * horizontal edge and its `yScale` from a vertical one. Usually that
1625
+ * axis also draws ticks and labels, and `[cngxAxis]` is what you want.
1626
+ * Sometimes the domain is all you need: a sparkline has no room for
1627
+ * decoration, but its line still has to know that y runs 0 to 100.
1628
+ *
1629
+ * ```html
1630
+ * <cngx-chart [data]="readings()">
1631
+ * <svg:g cngxAxisDomain position="bottom" type="band" [domain]="labels()"></svg:g>
1632
+ * <svg:g cngxAxisDomain position="left" [domain]="[0, 100]"></svg:g>
1633
+ * <svg:g cngxLine></svg:g>
1634
+ * </cngx-chart>
1635
+ * ```
1636
+ *
1637
+ * Reserving nothing is the behavioural difference that matters. The
1638
+ * chart shrinks its plot area by the room each axis's decoration needs;
1639
+ * this one has none, so an 80x24 sparkline keeps all 80x24 for its mark
1640
+ * instead of losing a gutter to ticks nobody draws.
1641
+ *
1642
+ * Attribute-selector on `<svg:g>` for the same reason `[cngxAxis]` is:
1643
+ * a `<cngx-axis-domain>` element inside `<svg>` would land in the XHTML
1644
+ * namespace. Nothing renders either way, but the host stays a legal SVG
1645
+ * child.
1646
+ *
1647
+ * @category common/chart/axis
1648
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/axis-domain.ts
1649
+ * @since 0.1.0
1650
+ * @relatedTo CngxAxis, CngxChart, CngxChartAxis
1651
+ *
1652
+ * <example-url>http://localhost:4200/#/ui/chart-panel/basic/titled-panel-with-legend</example-url>
1653
+ * <example-url>http://localhost:4200/#/ui/chart-panel/slots/actions-and-footer</example-url>
1654
+ */
1655
+ declare class CngxAxisDomain implements CngxChartAxis {
1656
+ /** Which edge the scale this publishes belongs to. */
1657
+ readonly position: _angular_core.InputSignal<CngxAxisPosition>;
1658
+ /** Scale kind the chart builds for this dimension. */
1659
+ readonly type: _angular_core.InputSignal<CngxAxisType>;
1660
+ /** Value range the scale maps from. */
1661
+ readonly domain: _angular_core.InputSignal<readonly unknown[] | undefined>;
1662
+ /**
1663
+ * Always `0`. Not an opt-out from a gutter this directive would
1664
+ * otherwise get - it draws nothing, so there is nothing to reserve
1665
+ * for, and the number stays derived from what the unit does.
1666
+ */
1667
+ readonly reservation: Signal<number>;
1668
+ /** Always `0`, for the same reason as {@link reservation}. */
1669
+ readonly crossReservation: Signal<number>;
1670
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAxisDomain, never>;
1671
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAxisDomain, "[cngxAxisDomain]", ["cngxAxisDomain"], { "position": { "alias": "position"; "required": true; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "domain": { "alias": "domain"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1672
+ }
1673
+
606
1674
  /**
607
1675
  * Single legend entry. `color` is optional - when omitted the swatch
608
- * falls back to the chart-level primary token. `value` is intentionally
609
- * unconstrained so consumers can carry their domain key (id, layer
610
- * name, accessor return type, ...) for later interactions without a
611
- * second lookup.
1676
+ * falls back to the chart-level primary token. `value` is rendered as a
1677
+ * trailing `.cngx-chart-legend__value` node when present (`!= null`, so a
1678
+ * literal `0` still shows), turning a legend into a readout. A number value
1679
+ * renders in the app locale (`6,6` in German); any other value as text. It stays
1680
+ * intentionally unconstrained so the same field a consumer weights in the
1681
+ * row can still carry their domain key (id, layer name, accessor return
1682
+ * type, ...) for later interactions without a second lookup.
612
1683
  *
613
1684
  * @category common/chart/legend
614
1685
  */
@@ -642,10 +1713,21 @@ interface CngxChartLegendItem<T = unknown> {
642
1713
  *
643
1714
  * Theming via `--cngx-chart-legend-gap`,
644
1715
  * `--cngx-chart-legend-swatch-size`, `--cngx-chart-legend-swatch-radius`,
645
- * `--cngx-chart-legend-font-size`. `[orientation]` flips between row
1716
+ * `--cngx-chart-legend-font-size`. A rendered `value` carries its own
1717
+ * `--cngx-chart-legend-value-color` and `--cngx-chart-legend-value-font-weight`
1718
+ * so a legend doubling as a readout can weight the number apart from the
1719
+ * label without a wrapper element. `[orientation]` flips between row
646
1720
  * and column; `[align]` aligns along the main axis (`start`, `center`,
647
1721
  * `end`).
648
1722
  *
1723
+ * Under forced colors the swatches turn into a four-step pattern by
1724
+ * entry index (solid, 45deg hatch, hollow, 0deg hatch). The stacked-bar
1725
+ * segments and the chart series carry the same step by index: lines as
1726
+ * solid, dashed, dotted, dash-dot; bars and scatter points as the swatch
1727
+ * patterns. Series count line, bar and scatter layers in source order
1728
+ * (areas, thresholds, bands and axes do not count), so list the entries
1729
+ * in the order of those layers.
1730
+ *
649
1731
  * @category common/chart/legend
650
1732
  * @docsKind primary
651
1733
  * @wcag AA
@@ -657,6 +1739,9 @@ declare class CngxChartLegend<T = unknown> {
657
1739
  readonly items: _angular_core.InputSignal<readonly CngxChartLegendItem<T>[]>;
658
1740
  readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
659
1741
  readonly align: _angular_core.InputSignal<"start" | "end" | "center">;
1742
+ private readonly locale;
1743
+ /** @internal Each item's value as display text; numbers in the app locale. */
1744
+ protected readonly displayValues: _angular_core.Signal<string[]>;
660
1745
  protected readonly flexAlign: _angular_core.Signal<"center" | "flex-end" | "flex-start">;
661
1746
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartLegend<any>, never>;
662
1747
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChartLegend<any>, "cngx-chart-legend", ["cngxChartLegend"], { "items": { "alias": "items"; "required": true; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
@@ -720,6 +1805,19 @@ interface PathBuilderOptions<T> {
720
1805
  readonly x?: LineXAccessor<T>;
721
1806
  readonly curve: CngxCurve;
722
1807
  }
1808
+ /**
1809
+ * One run of consecutive finite points, as produced by
1810
+ * {@link PathBuilder.buildSegments}. `firstX` / `lastX` are the run's
1811
+ * projected end coordinates, exposed so an area layer can close the
1812
+ * run to its baseline without re-projecting the data.
1813
+ *
1814
+ * @category common/chart/path
1815
+ */
1816
+ interface PathSegment {
1817
+ readonly d: string;
1818
+ readonly firstX: number;
1819
+ readonly lastX: number;
1820
+ }
723
1821
  /**
724
1822
  * Single-slot LRU cache around an SVG `d`-attribute builder. Returned
725
1823
  * by {@link createPathBuilder}; consumed by the `<cngx-line>` /
@@ -732,8 +1830,23 @@ interface PathBuilder<T> {
732
1830
  * Build the SVG `d` attribute for the given data + scales. Same
733
1831
  * `(data, xScale, yScale)` triple by reference returns the cached
734
1832
  * string without re-running the O(n) point projection.
1833
+ *
1834
+ * A row whose projected `x` or `y` is non-finite (a `NaN` value, an
1835
+ * invalid Date, a log scale fed zero) is not emitted as a path
1836
+ * command - it breaks the path into subpaths, d3's `defined()`
1837
+ * semantics. One `NaN` therefore renders as a gap in the line rather
1838
+ * than invalidating the whole `d` string.
735
1839
  */
736
1840
  build(data: readonly T[], xScale: ScaleFn<XScaleInput>, yScale: ScaleFn<number>): string;
1841
+ /**
1842
+ * The same projection split at non-finite rows: one entry per run of
1843
+ * consecutive finite points, carrying the run's path data and its
1844
+ * first/last projected `x`. `<cngx-area>` consumes this to close
1845
+ * every run to the baseline individually - closing the joined string
1846
+ * once would fill straight across the gaps. Shares the single-slot
1847
+ * cache with {@link build}.
1848
+ */
1849
+ buildSegments(data: readonly T[], xScale: ScaleFn<XScaleInput>, yScale: ScaleFn<number>): readonly PathSegment[];
737
1850
  /**
738
1851
  * Number of times the internal point-projection + path-string
739
1852
  * concatenation has run since this builder was constructed. Exposed
@@ -766,12 +1879,23 @@ interface PathBuilder<T> {
766
1879
  */
767
1880
  declare function createPathBuilder<T>(opts: PathBuilderOptions<T>): PathBuilder<T>;
768
1881
 
1882
+ /**
1883
+ * Scale-projected centre of a single point marker on a line / area
1884
+ * layer.
1885
+ *
1886
+ * @internal
1887
+ */
1888
+ interface PointMark {
1889
+ readonly cx: number;
1890
+ readonly cy: number;
1891
+ }
1892
+
769
1893
  /**
770
1894
  * Line layer atom. Renders a single SVG `<path>` connecting the data
771
1895
  * points projected through the parent chart's scales. Reads scales
772
1896
  * from {@link CNGX_CHART_CONTEXT}, NOT from a parent class.
773
1897
  *
774
- * Attribute-selector on `<svg:g>` — the host element IS the SVG group.
1898
+ * Attribute-selector on `<svg:g>` - the host element IS the SVG group.
775
1899
  * Element selectors create XHTML-namespaced custom elements inside
776
1900
  * SVG, which break layout for the namespaced children. Apply this
777
1901
  * directive on an `<svg:g>` host instead.
@@ -779,9 +1903,14 @@ declare function createPathBuilder<T>(opts: PathBuilderOptions<T>): PathBuilder<
779
1903
  * The `d` string is cascade-guarded with string equality on its
780
1904
  * `computed` so downstream effects only re-run when the path
781
1905
  * geometry actually changes. The `createPathBuilder` cache provides
782
- * the **compute guard** — same `(data, xScale, yScale)` triple by
1906
+ * the **compute guard** - same `(data, xScale, yScale)` triple by
783
1907
  * reference skips the per-datapoint projection work.
784
1908
  *
1909
+ * A single-point series draws no visible path (`M x y` has no length),
1910
+ * so a series shorter than two points paints a point marker instead of
1911
+ * nothing. `[points]` controls this: `'auto'` (default) marks only the
1912
+ * one-datum case, `'always'` marks every datum, `'never'` suppresses it.
1913
+ *
785
1914
  * @category common/chart/layers
786
1915
  * @docsKind primary
787
1916
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/line.component.ts
@@ -796,19 +1925,34 @@ declare function createPathBuilder<T>(opts: PathBuilderOptions<T>): PathBuilder<
796
1925
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
797
1926
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
798
1927
  */
799
- declare class CngxLine<T = unknown> {
1928
+ declare class CngxLine<T = unknown> implements CngxChartLayer {
800
1929
  readonly accessor: _angular_core.InputSignal<LineYAccessor<T>>;
801
1930
  readonly xAccessor: _angular_core.InputSignal<LineXAccessor<T> | undefined>;
802
1931
  readonly color: _angular_core.InputSignal<string | null>;
803
1932
  readonly strokeWidth: _angular_core.InputSignal<string | number | null>;
804
1933
  readonly curve: _angular_core.InputSignal<CngxCurve>;
805
1934
  readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
806
- private readonly ctx;
1935
+ /**
1936
+ * Point-marker mode. `'auto'` (default) draws a marker only when the
1937
+ * resolved series has exactly one datum - the frame a warming buffer
1938
+ * passes through on every reload, which paints nothing otherwise.
1939
+ * `'always'` marks every datum; `'never'` suppresses markers.
1940
+ */
1941
+ readonly points: _angular_core.InputSignal<"auto" | "always" | "never">;
1942
+ protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
807
1943
  private readonly builder;
808
1944
  private readonly resolvedData;
809
1945
  protected readonly d: _angular_core.Signal<string>;
1946
+ readonly geometry: _angular_core.Signal<LayerGeometry>;
1947
+ /**
1948
+ * Template view of the geometry's marker pass. Forwards the array
1949
+ * reference the `geometry` computed already holds - `lineAreaGeomEqual`
1950
+ * keeps that reference stable across a no-op refresh, so this
1951
+ * projection stays stable too without a second equality guard.
1952
+ */
1953
+ protected readonly pointMarks: _angular_core.Signal<readonly PointMark[]>;
810
1954
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLine<any>, never>;
811
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxLine<any>, "[cngxLine]", ["cngxLine"], { "accessor": { "alias": "accessor"; "required": false; "isSignal": true; }; "xAccessor": { "alias": "xAccessor"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1955
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxLine<any>, "[cngxLine]", ["cngxLine"], { "accessor": { "alias": "accessor"; "required": false; "isSignal": true; }; "xAccessor": { "alias": "xAccessor"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "points": { "alias": "points"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
812
1956
  }
813
1957
 
814
1958
  /**
@@ -816,11 +1960,16 @@ declare class CngxLine<T = unknown> {
816
1960
  * (same compute guard as `[cngxLine]`) and closes the polygon to a
817
1961
  * `[baseline]` (default `0`) so SVG can fill it.
818
1962
  *
819
- * Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
1963
+ * Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
820
1964
  *
821
1965
  * The `d` string is cascade-guarded with string equality on its
822
1966
  * `computed` so a no-op data refresh does not force a fill repaint.
823
1967
  *
1968
+ * A single-datum area closes on itself at one x and covers no pixels,
1969
+ * so a series shorter than two points paints a point marker instead of
1970
+ * nothing. `[points]` mirrors {@link CngxLine}: `'auto'` (default) marks
1971
+ * only the one-datum case, `'always'` every datum, `'never'` none.
1972
+ *
824
1973
  * @category common/chart/layers
825
1974
  * @docsKind primary
826
1975
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/area.component.ts
@@ -835,19 +1984,34 @@ declare class CngxLine<T = unknown> {
835
1984
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
836
1985
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
837
1986
  */
838
- declare class CngxArea<T = unknown> {
1987
+ declare class CngxArea<T = unknown> implements CngxChartLayer {
839
1988
  readonly accessor: _angular_core.InputSignal<LineYAccessor<T>>;
840
1989
  readonly xAccessor: _angular_core.InputSignal<LineXAccessor<T> | undefined>;
841
1990
  readonly opacity: _angular_core.InputSignal<string | number | null>;
1991
+ readonly color: _angular_core.InputSignal<string | null>;
842
1992
  readonly curve: _angular_core.InputSignal<CngxCurve>;
843
1993
  readonly baseline: _angular_core.InputSignal<number>;
844
1994
  readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
845
- private readonly ctx;
1995
+ /**
1996
+ * Point-marker mode, mirroring {@link CngxLine}. `'auto'` (default)
1997
+ * draws a marker only for a single-datum series - an area closed on
1998
+ * itself at one x covers no pixels and paints nothing otherwise.
1999
+ * `'always'` marks every datum; `'never'` suppresses markers.
2000
+ */
2001
+ readonly points: _angular_core.InputSignal<"auto" | "always" | "never">;
2002
+ protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
846
2003
  private readonly builder;
847
2004
  private readonly resolvedData;
848
2005
  protected readonly d: _angular_core.Signal<string>;
2006
+ readonly geometry: _angular_core.Signal<LayerGeometry>;
2007
+ /**
2008
+ * Template view of the geometry's marker pass. Forwards the reference
2009
+ * the `geometry` computed already holds - `lineAreaGeomEqual` keeps it
2010
+ * stable across a no-op refresh, so no second equality guard is needed.
2011
+ */
2012
+ protected readonly pointMarks: _angular_core.Signal<readonly PointMark[]>;
849
2013
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxArea<any>, never>;
850
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxArea<any>, "[cngxArea]", ["cngxArea"], { "accessor": { "alias": "accessor"; "required": false; "isSignal": true; }; "xAccessor": { "alias": "xAccessor"; "required": false; "isSignal": true; }; "opacity": { "alias": "opacity"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "baseline": { "alias": "baseline"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2014
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxArea<any>, "[cngxArea]", ["cngxArea"], { "accessor": { "alias": "accessor"; "required": false; "isSignal": true; }; "xAccessor": { "alias": "xAccessor"; "required": false; "isSignal": true; }; "opacity": { "alias": "opacity"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "baseline": { "alias": "baseline"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "points": { "alias": "points"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
851
2015
  }
852
2016
 
853
2017
  /**
@@ -868,13 +2032,13 @@ interface BarRect {
868
2032
  * Bar layer atom. Renders one `<rect>` per datapoint. Bar width comes
869
2033
  * from `dimensions.width / dataLength` (one slot per datapoint) shrunk
870
2034
  * by the optional `[gap]` ratio. Bar height runs from `yScale(value)`
871
- * down to `yScale(baseline)` (default 0) — SVG bottom-anchored.
2035
+ * down to `yScale(baseline)` (default 0) - SVG bottom-anchored.
872
2036
  *
873
2037
  * Bar does NOT require a band X scale; the slot width is purely
874
2038
  * geometric. This keeps the atom usable with linear or band X axes
875
2039
  * interchangeably.
876
2040
  *
877
- * Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
2041
+ * Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
878
2042
  *
879
2043
  * @category common/chart/layers
880
2044
  * @docsKind primary
@@ -890,16 +2054,18 @@ interface BarRect {
890
2054
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
891
2055
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
892
2056
  */
893
- declare class CngxBar<T = unknown> {
2057
+ declare class CngxBar<T = unknown> implements CngxChartLayer {
894
2058
  readonly accessor: _angular_core.InputSignal<BarYAccessor<T>>;
895
2059
  readonly gap: _angular_core.InputSignal<number>;
896
2060
  readonly baseline: _angular_core.InputSignal<number>;
897
2061
  readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
898
- private readonly ctx;
2062
+ readonly color: _angular_core.InputSignal<string | null>;
2063
+ protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
899
2064
  private readonly resolvedData;
900
2065
  protected readonly rects: _angular_core.Signal<readonly BarRect[]>;
2066
+ readonly geometry: _angular_core.Signal<LayerGeometry>;
901
2067
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBar<any>, never>;
902
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBar<any>, "[cngxBar]", ["cngxBar"], { "accessor": { "alias": "accessor"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "baseline": { "alias": "baseline"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2068
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBar<any>, "[cngxBar]", ["cngxBar"], { "accessor": { "alias": "accessor"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "baseline": { "alias": "baseline"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
903
2069
  }
904
2070
 
905
2071
  /**
@@ -941,16 +2107,18 @@ interface ScatterCircle {
941
2107
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
942
2108
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
943
2109
  */
944
- declare class CngxScatter<T = unknown> {
2110
+ declare class CngxScatter<T = unknown> implements CngxChartLayer {
945
2111
  readonly x: _angular_core.InputSignal<ScatterXAccessor<T>>;
946
2112
  readonly y: _angular_core.InputSignal<ScatterYAccessor<T>>;
947
2113
  readonly radius: _angular_core.InputSignal<number>;
948
2114
  readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
949
- private readonly ctx;
2115
+ readonly color: _angular_core.InputSignal<string | null>;
2116
+ protected readonly ctx: _cngx_common_chart.CngxChartContext<XScaleInput, number>;
950
2117
  private readonly resolvedData;
951
2118
  protected readonly circles: _angular_core.Signal<readonly ScatterCircle[]>;
2119
+ readonly geometry: _angular_core.Signal<LayerGeometry>;
952
2120
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxScatter<any>, never>;
953
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxScatter<any>, "[cngxScatter]", ["cngxScatter"], { "x": { "alias": "x"; "required": true; "isSignal": true; }; "y": { "alias": "y"; "required": true; "isSignal": true; }; "radius": { "alias": "radius"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2121
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxScatter<any>, "[cngxScatter]", ["cngxScatter"], { "x": { "alias": "x"; "required": true; "isSignal": true; }; "y": { "alias": "y"; "required": true; "isSignal": true; }; "radius": { "alias": "radius"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
954
2122
  }
955
2123
 
956
2124
  /**
@@ -978,17 +2146,20 @@ declare class CngxScatter<T = unknown> {
978
2146
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
979
2147
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
980
2148
  */
981
- declare class CngxThreshold {
2149
+ declare class CngxThreshold implements CngxChartLayer {
982
2150
  readonly value: _angular_core.InputSignal<number>;
983
2151
  readonly label: _angular_core.InputSignal<string | null>;
984
2152
  readonly dashed: _angular_core.InputSignal<boolean>;
985
- private readonly ctx;
986
- protected readonly geometry: _angular_core.Signal<{
987
- width: number;
2153
+ readonly color: _angular_core.InputSignal<string | null>;
2154
+ protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
2155
+ protected readonly bounds: _angular_core.Signal<{
2156
+ x1: number;
2157
+ x2: number;
988
2158
  y: number;
989
2159
  } | null>;
2160
+ readonly geometry: _angular_core.Signal<LayerGeometry>;
990
2161
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxThreshold, never>;
991
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxThreshold, "[cngxThreshold]", ["cngxThreshold"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "dashed": { "alias": "dashed"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2162
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxThreshold, "[cngxThreshold]", ["cngxThreshold"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "dashed": { "alias": "dashed"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
992
2163
  }
993
2164
 
994
2165
  /**
@@ -999,7 +2170,7 @@ declare class CngxThreshold {
999
2170
  * Default opacity is low (`var(--cngx-band-opacity, 0.12)`) so the
1000
2171
  * band sits behind line / area / bar layers without dominating.
1001
2172
  *
1002
- * Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
2173
+ * Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
1003
2174
  *
1004
2175
  * @category common/chart/layers
1005
2176
  * @docsKind primary
@@ -1015,80 +2186,284 @@ declare class CngxThreshold {
1015
2186
  * <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
1016
2187
  * <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
1017
2188
  */
1018
- declare class CngxBand {
2189
+ declare class CngxBand implements CngxChartLayer {
1019
2190
  readonly from: _angular_core.InputSignal<number>;
1020
2191
  readonly to: _angular_core.InputSignal<number>;
1021
2192
  readonly label: _angular_core.InputSignal<string | null>;
1022
2193
  readonly opacity: _angular_core.InputSignal<string | number | null>;
1023
- private readonly ctx;
2194
+ readonly color: _angular_core.InputSignal<string | null>;
2195
+ protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
1024
2196
  protected readonly rect: _angular_core.Signal<{
2197
+ x: number;
1025
2198
  width: number;
1026
2199
  y: number;
1027
2200
  height: number;
1028
2201
  } | null>;
2202
+ readonly geometry: _angular_core.Signal<LayerGeometry>;
1029
2203
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBand, never>;
1030
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBand, "[cngxBand]", ["cngxBand"], { "from": { "alias": "from"; "required": true; "isSignal": true; }; "to": { "alias": "to"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "opacity": { "alias": "opacity"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2204
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBand, "[cngxBand]", ["cngxBand"], { "from": { "alias": "from"; "required": true; "isSignal": true; }; "to": { "alias": "to"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "opacity": { "alias": "opacity"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1031
2205
  }
1032
2206
 
1033
2207
  /**
1034
- * Summary input describing the chart's current data shape. Consumed by
1035
- * `CngxChartI18n.summary()` to produce the `aria-label` text the
1036
- * `<cngx-chart>` host announces to screen readers.
2208
+ * Construction dependencies shared by every renderer backend. The
2209
+ * renderer reads scales / dimensions through the chart context and
2210
+ * schedules its own teardown through the `DestroyRef` - it never injects
2211
+ * the concrete `CngxChart` class.
1037
2212
  *
1038
- * @category common/chart/i18n
2213
+ * @category common/chart/renderer
1039
2214
  */
1040
- interface CngxChartSummary {
1041
- readonly trend: 'up' | 'down' | 'flat';
1042
- readonly min: number;
1043
- readonly max: number;
1044
- readonly current: number;
1045
- readonly thresholds: readonly number[];
2215
+ interface ChartRendererDeps {
2216
+ readonly ctx: CngxChartContext;
2217
+ readonly destroyRef: DestroyRef;
2218
+ /**
2219
+ * Whether the host currently matches `(forced-colors: active)`. The
2220
+ * renderer controller fills it from one media-query signal and repaints
2221
+ * on every flip; the Canvas backend reads it to paint in the system
2222
+ * palette. The SVG backend ignores it (its layers carry their own
2223
+ * forced-colors CSS), and a custom backend registered through
2224
+ * {@link CNGX_CHART_RENDERER_FACTORY} may ignore it too.
2225
+ */
2226
+ readonly forcedColors?: Signal<boolean>;
1046
2227
  }
1047
2228
  /**
1048
- * i18n surface for `@cngx/common/chart`. Mirrors the `CNGX_RECYCLER_I18N`
1049
- * shape from `@cngx/common/data` - factory defaults supply English;
1050
- * consumers override per-app via {@link provideChartI18n}.
2229
+ * A rendering backend for `<cngx-chart>`. Both backends compose against
2230
+ * the same {@link LayerGeometry} surface the layer atoms publish, so a
2231
+ * single chart-authoring API drives either one with no consumer change.
1051
2232
  *
1052
- * @category common/chart/i18n
2233
+ * The SVG backend is a passthrough (layer atoms self-render); the Canvas
2234
+ * backend paints the geometries onto a `<canvas>` 2D context.
2235
+ *
2236
+ * @category common/chart/renderer
2237
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer.ts
2238
+ * @since 0.1.0
1053
2239
  */
1054
- interface CngxChartI18n {
1055
- readonly summary: (input: CngxChartSummary) => string;
1056
- readonly dataTable: () => string;
1057
- readonly valueColumnLabel: () => string;
1058
- readonly trendChanged: (trend: 'up' | 'down' | 'flat') => string;
1059
- readonly thresholdAlert: (threshold: number) => string;
1060
- readonly empty: () => string;
1061
- readonly loading: () => string;
1062
- readonly error: () => string;
2240
+ interface CngxChartRenderer {
2241
+ /** Which backend this instance is. */
2242
+ readonly mode: 'svg' | 'canvas';
2243
+ /** Attach to the chart host (insert a `<canvas>`, wire teardown, ...). */
2244
+ mount(host: HTMLElement, ctx: CngxChartContext): void;
2245
+ /** Paint the current layer geometries. Called on every geometry emission. */
2246
+ paint(geometries: readonly LayerGeometry[]): void;
2247
+ /** Detach and release resources. */
2248
+ destroy(): void;
2249
+ /** Drop any cached theme colors (called on layout/theming reflow). Optional. */
2250
+ invalidateColorCache?(): void;
1063
2251
  }
1064
2252
  /**
1065
- * Injection token for chart i18n strings. Defaults to English via
1066
- * `factory:`. Override at app root with {@link provideChartI18n}.
2253
+ * Builds a {@link CngxChartRenderer} for the requested `mode`. The
2254
+ * default implementation ({@link createDefaultChartRenderer}) dispatches
2255
+ * to the SVG or Canvas backend; consumers override the whole factory via
2256
+ * {@link CNGX_CHART_RENDERER_FACTORY} to add a third backend (WebGL, ...)
2257
+ * without touching layer atoms.
2258
+ *
2259
+ * @category common/chart/renderer
2260
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer.ts
2261
+ * @since 0.1.0
2262
+ */
2263
+ type CngxChartRendererFactory = (mode: 'svg' | 'canvas', deps: ChartRendererDeps) => CngxChartRenderer;
2264
+
2265
+ /**
2266
+ * SVG passthrough renderer. Layer atoms render their own `<svg:path>` /
2267
+ * `<svg:rect>` / `<svg:circle>`, gated by the chart shell's `renderSvg`
2268
+ * computed, so this backend has nothing to do: every method is a no-op.
2269
+ * It never writes back to the chart context - `renderSvg` ownership stays
2270
+ * in the chart shell as the single source of truth.
1067
2271
  *
1068
- * @category common/chart/i18n
1069
- * @wcag AA
1070
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/i18n/chart-i18n.ts
2272
+ * @param _deps unused; kept for factory signature symmetry with
2273
+ * {@link createCanvasRenderer}.
2274
+ *
2275
+ * @category common/chart/renderer
2276
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/svg-renderer.ts
2277
+ * @since 0.1.0
2278
+ */
2279
+ declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
2280
+
2281
+ /**
2282
+ * Canvas rendering backend. Mounts a `<canvas>` absolutely positioned
2283
+ * over the chart's SVG frame and paints each {@link LayerGeometry} onto
2284
+ * its 2D context: `Path2D` stroke/fill for line/area, per-mark loops for
2285
+ * bar/scatter, `moveTo`/`lineTo` for threshold, `fillRect` for band.
2286
+ *
2287
+ * Colors resolve through a closure-local cache: the first `paint()` reads
2288
+ * each CSS custom property once via `getComputedStyle(host)`; subsequent
2289
+ * paints hit the cache, so the paint hot path performs zero synchronous
2290
+ * DOM reads. {@link CngxChartRenderer.invalidateColorCache} clears it -
2291
+ * the renderer controller calls it on a `dimensions()` change (a proxy
2292
+ * for layout / theming reflow). It never writes the chart context's
2293
+ * `renderSvg` gate; the shell owns that.
2294
+ *
2295
+ * The plot inset needs no handling here. Every geometry this backend
2296
+ * paints was derived from `ctx.xScale()` / `ctx.yScale()`, whose ranges
2297
+ * are already the inset plot area, so canvas marks land exactly where
2298
+ * SVG marks would without the renderer knowing an inset exists. Axis
2299
+ * decoration never reaches this file at all: there is no axis branch in
2300
+ * {@link KIND_VARS} and no text call anywhere in the backend, because
2301
+ * `CngxAxis` renders its own SVG ungated by `renderSvg` in both modes.
2302
+ * The two paths therefore cannot disagree on where the plot area is,
2303
+ * and only one of them ever draws an axis.
2304
+ *
2305
+ * They do differ on what happens past the box edge: a canvas clips
2306
+ * natively at the element bounds, and since the SVG root no longer sets
2307
+ * `overflow: visible` it now clips there too. Out-of-domain data is cut
2308
+ * off on both paths.
2309
+ *
2310
+ * Under forced colors the canvas follows the same contract as the SVG
2311
+ * layers, since the browser never forces canvas pixels: every mark paints
2312
+ * CanvasText, ignoring `[color]` and the colour tokens; areas and bands keep
2313
+ * their opacity; line, bar and scatter take the legend's four-step cycle by
2314
+ * series index (lines solid / dashed / dotted / dash-dot, bars and points
2315
+ * solid / 45deg hatch / hollow / 0deg hatch), with area, threshold and band
2316
+ * not counting. CanvasText and Canvas are resolved through a probe element
2317
+ * opted out of forcing and cached like the author colours. Chromium also
2318
+ * resolves the system keywords on a 2D context to the forced palette, but
2319
+ * other engines are unverified, so the backend paints the probed values.
2320
+ * The renderer controller watches `(forced-colors: active)` and
2321
+ * `(prefers-color-scheme: dark)` and invalidates the colour cache before
2322
+ * repainting on a flip, so a contrast-theme switch repaints at once. One
2323
+ * difference from SVG: a layer wrapped in an extra `<svg:g>` still counts
2324
+ * here, since the backend only sees the layer order.
2325
+ *
2326
+ * @category common/chart/renderer
2327
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/canvas-renderer.ts
2328
+ * @since 0.1.0
2329
+ */
2330
+ declare function createCanvasRenderer(deps: ChartRendererDeps): CngxChartRenderer;
2331
+
2332
+ /**
2333
+ * Datapoint count above which `<cngx-chart>` auto-switches from SVG to
2334
+ * Canvas rendering. Default `500` - the point at which the SVG backend's
2335
+ * per-layer DOM-node cost starts to dominate on a mid-range laptop.
2336
+ *
2337
+ * Override enterprise-wide via {@link withChartRendererThreshold} (or a
2338
+ * bare provider) to tune the SVG/Canvas crossover for a given app's
2339
+ * hardware profile.
2340
+ *
2341
+ * @category common/chart/renderer
2342
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-threshold.ts
2343
+ * @since 0.1.0
2344
+ * @relatedTo provideChartRenderer, withChartRendererThreshold
2345
+ */
2346
+ declare const CNGX_CHART_RENDERER_THRESHOLD: InjectionToken<number>;
2347
+
2348
+ /**
2349
+ * The default renderer factory: dispatches `'svg'` to
2350
+ * {@link createSvgRenderer} and `'canvas'` to {@link createCanvasRenderer}.
2351
+ * Inlines the two-backend switch; a consumer wanting a third backend
2352
+ * (WebGL, ...) supplies a whole replacement via
2353
+ * {@link withChartRendererFactory}.
2354
+ *
2355
+ * @category common/chart/renderer
2356
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
2357
+ * @since 0.1.0
2358
+ */
2359
+ declare const createDefaultChartRenderer: CngxChartRendererFactory;
2360
+ /**
2361
+ * The renderer-factory the chart shell resolves to build its backend.
2362
+ * Default {@link createDefaultChartRenderer}; override enterprise-wide via
2363
+ * {@link withChartRendererFactory} to add a backend without touching layer
2364
+ * atoms.
2365
+ *
2366
+ * @category common/chart/renderer
2367
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
2368
+ * @since 0.1.0
2369
+ * @relatedTo provideChartRenderer, withChartRendererFactory
2370
+ */
2371
+ declare const CNGX_CHART_RENDERER_FACTORY: InjectionToken<CngxChartRendererFactory>;
2372
+ /**
2373
+ * A single renderer-config override produced by a `with*` feature and
2374
+ * folded by {@link provideChartRenderer}.
2375
+ *
2376
+ * @category common/chart/renderer
2377
+ */
2378
+ interface CngxChartRendererFeature {
2379
+ readonly providers: Provider[];
2380
+ }
2381
+ /**
2382
+ * Override the SVG->Canvas auto-switch cutoff (default `500`).
2383
+ *
2384
+ * @category common/chart/renderer
2385
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
2386
+ * @since 0.1.0
2387
+ */
2388
+ declare function withChartRendererThreshold(n: number): CngxChartRendererFeature;
2389
+ /**
2390
+ * Replace the renderer factory - e.g. to force one backend or add a
2391
+ * third. Consumers wanting a heuristic swap supply a custom factory here
2392
+ * (the heuristic-swap axis ships no dedicated token at v2).
2393
+ *
2394
+ * @category common/chart/renderer
2395
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
1071
2396
  * @since 0.1.0
1072
2397
  */
1073
- declare const CNGX_CHART_I18N: InjectionToken<CngxChartI18n>;
2398
+ declare function withChartRendererFactory(fn: CngxChartRendererFactory): CngxChartRendererFeature;
1074
2399
  /**
1075
- * Provider helper for custom chart i18n strings.
2400
+ * Aggregate renderer-config features into a provider set. Place in a
2401
+ * bootstrap `providers` array (app-wide) or a component's `viewProviders`
2402
+ * (subtree scope).
1076
2403
  *
1077
2404
  * ```typescript
1078
- * providers: [provideChartI18n({
1079
- * summary: ({ trend, min, max, current, thresholds }) =>
1080
- * `${trend === 'up' ? 'Aufwärtstrend' : 'Abwärtstrend'}. Min ${min}, Max ${max}, aktuell ${current}.`,
1081
- * dataTable: () => 'Datentabelle',
1082
- * // ...remaining keys
1083
- * })]
2405
+ * provideChartRenderer(withChartRendererThreshold(2000))
1084
2406
  * ```
1085
2407
  *
1086
- * @category common/chart/i18n
2408
+ * @category common/chart/renderer
2409
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
2410
+ * @since 0.1.0
2411
+ * @relatedTo withChartRendererThreshold, withChartRendererFactory
1087
2412
  */
1088
- declare function provideChartI18n(i18n: CngxChartI18n): {
1089
- provide: typeof CNGX_CHART_I18N;
1090
- useValue: CngxChartI18n;
1091
- };
2413
+ declare function provideChartRenderer(...features: CngxChartRendererFeature[]): Provider[];
2414
+
2415
+ /**
2416
+ * Construction dependencies for {@link createChartRendererController}.
2417
+ *
2418
+ * @category common/chart/renderer
2419
+ */
2420
+ interface ChartRendererControllerDeps {
2421
+ readonly host: HTMLElement;
2422
+ readonly ctx: CngxChartContext;
2423
+ readonly mode: Signal<'svg' | 'canvas'>;
2424
+ readonly geometries: Signal<readonly LayerGeometry[]>;
2425
+ readonly factory: CngxChartRendererFactory;
2426
+ readonly destroyRef: DestroyRef;
2427
+ }
2428
+ /**
2429
+ * Handle returned by {@link createChartRendererController}.
2430
+ *
2431
+ * @category common/chart/renderer
2432
+ */
2433
+ interface CngxChartRendererController {
2434
+ readonly currentMode: Signal<'svg' | 'canvas'>;
2435
+ destroy(): void;
2436
+ }
2437
+ /**
2438
+ * Owns the renderer mount / destroy / paint reactive lifecycle so the
2439
+ * chart shell holds no rendering brain. Installs two effects:
2440
+ *
2441
+ * - **mount** - tracks `mode()`; on change, destroys the previous backend,
2442
+ * builds the new one via `factory`, mounts it, and seeds the first paint.
2443
+ * - **paint** - tracks `geometries()`, the (structurally-deduped)
2444
+ * dimensions and the `(forced-colors: active)` /
2445
+ * `(prefers-color-scheme: dark)` media queries; repaints on every
2446
+ * geometry emission and invalidates the backend's color cache when the
2447
+ * dimensions or either media query actually change, so a contrast-theme
2448
+ * or OS colour-scheme switch repaints at once instead of after the next
2449
+ * resize.
2450
+ *
2451
+ * Both effects wrap their imperative renderer calls in `untracked()` so
2452
+ * the renderer's own signal reads never feed back into the effect graph.
2453
+ * The dimensions are tracked through a `linkedSignal` guarded by
2454
+ * {@link dimensionsEqual}, so a resize observer re-emitting the same
2455
+ * width/height literal does not trigger a redundant cache invalidation.
2456
+ *
2457
+ * Must run in an injection context (the chart shell calls it from a field
2458
+ * initialiser / constructor). Ships as a plain `create*` factory the shell
2459
+ * calls directly - no DI token, since the only second consumer today is a
2460
+ * test double, which injects a fake `factory` through the deps.
2461
+ *
2462
+ * @category common/chart/renderer
2463
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer-controller.ts
2464
+ * @since 0.1.0
2465
+ */
2466
+ declare function createChartRendererController(deps: ChartRendererControllerDeps): CngxChartRendererController;
1092
2467
 
1093
2468
  /**
1094
2469
  * Inline sparkline - a tiny line chart for KPI cards and dashboard
@@ -1124,8 +2499,10 @@ declare class CngxSparkline {
1124
2499
  readonly state: _angular_core.InputSignal<CngxAsyncState<readonly number[]> | undefined>;
1125
2500
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1126
2501
  private readonly preset;
1127
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2502
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
1128
2503
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2504
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2505
+ protected readonly busy: _angular_core.Signal<boolean>;
1129
2506
  protected readonly xDomain: _angular_core.Signal<readonly number[]>;
1130
2507
  protected readonly yDomain: _angular_core.Signal<readonly number[]>;
1131
2508
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSparkline, never>;
@@ -1139,6 +2516,12 @@ declare class CngxSparkline {
1139
2516
  * indicators; `aria-valuenow` / `aria-valuemin` / `aria-valuemax`
1140
2517
  * tell AT the exact reading without a separate Summary.
1141
2518
  *
2519
+ * `label` renders a visible caption above the track and doubles as the
2520
+ * host's accessible name: with `label` bound and `[aria-label]` unbound
2521
+ * the meter names itself from the caption, so it is no longer an unnamed
2522
+ * `role="meter"`. A bound `[aria-label]` always wins and overrides the
2523
+ * visible caption.
2524
+ *
1142
2525
  * @category common/chart/presets
1143
2526
  * @docsKind primary
1144
2527
  * @wcag AA
@@ -1157,8 +2540,17 @@ declare class CngxMiniBar {
1157
2540
  readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
1158
2541
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1159
2542
  private readonly preset;
1160
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2543
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
1161
2544
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2545
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2546
+ protected readonly busy: _angular_core.Signal<boolean>;
2547
+ /**
2548
+ * Meter value attributes render only in the content view: keeping
2549
+ * `aria-valuenow` while the skeleton or error fallback shows would
2550
+ * announce a stale reading for a value that is not on screen.
2551
+ */
2552
+ protected readonly showsMeterValue: _angular_core.Signal<boolean>;
2553
+ constructor();
1162
2554
  protected readonly percent: _angular_core.Signal<number>;
1163
2555
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMiniBar, never>;
1164
2556
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxMiniBar, "cngx-mini-bar", ["cngxMiniBar"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
@@ -1190,8 +2582,26 @@ declare class CngxDeviationBar {
1190
2582
  readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
1191
2583
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1192
2584
  private readonly preset;
1193
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2585
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
1194
2586
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2587
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2588
+ protected readonly busy: _angular_core.Signal<boolean>;
2589
+ /**
2590
+ * Meter value attributes render only in the content view: keeping
2591
+ * `aria-valuenow` while the skeleton or error fallback shows would
2592
+ * announce a stale reading for a value that is not on screen.
2593
+ */
2594
+ protected readonly showsMeterValue: _angular_core.Signal<boolean>;
2595
+ constructor();
2596
+ /**
2597
+ * The meter's valid range is centred on the baseline, not on zero:
2598
+ * a deviation bar with `[baseline]="100" [magnitude]="50"` reads
2599
+ * values in `[50, 150]`. Anchoring min/max at `±magnitude` alone
2600
+ * puts any non-zero-baseline reading outside its own declared range,
2601
+ * which is invalid meter semantics.
2602
+ */
2603
+ protected readonly minValue: _angular_core.Signal<number>;
2604
+ protected readonly maxValue: _angular_core.Signal<number>;
1195
2605
  protected readonly geometry: _angular_core.Signal<{
1196
2606
  positive: boolean;
1197
2607
  left: number;
@@ -1225,8 +2635,10 @@ declare class CngxMiniArea {
1225
2635
  readonly state: _angular_core.InputSignal<CngxAsyncState<readonly number[]> | undefined>;
1226
2636
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1227
2637
  private readonly preset;
1228
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2638
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
1229
2639
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2640
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2641
+ protected readonly busy: _angular_core.Signal<boolean>;
1230
2642
  protected readonly xDomain: _angular_core.Signal<readonly number[]>;
1231
2643
  protected readonly yDomain: _angular_core.Signal<readonly number[]>;
1232
2644
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMiniArea, never>;
@@ -1237,7 +2649,10 @@ declare class CngxMiniArea {
1237
2649
  * Circular donut gauge - a single-value bounded indicator. Renders a
1238
2650
  * background ring + a foreground arc whose length is proportional to
1239
2651
  * `value / max`. Host carries `role="meter"`; the optional `[label]`
1240
- * input renders an SR-only label inside the ring's centre.
2652
+ * input renders a visible label inside the ring's centre and doubles
2653
+ * as the host's accessible name when `[aria-label]` is unbound - the
2654
+ * same fallback `CngxMiniBar` uses. A bound `[aria-label]` always
2655
+ * wins.
1241
2656
  *
1242
2657
  * @category common/chart/presets
1243
2658
  * @docsKind primary
@@ -1258,8 +2673,17 @@ declare class CngxDonut {
1258
2673
  readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
1259
2674
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1260
2675
  private readonly preset;
1261
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2676
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
1262
2677
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2678
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2679
+ protected readonly busy: _angular_core.Signal<boolean>;
2680
+ /**
2681
+ * Meter value attributes render only in the content view: keeping
2682
+ * `aria-valuenow` while the skeleton or error fallback shows would
2683
+ * announce a stale reading for a value that is not on screen.
2684
+ */
2685
+ protected readonly showsMeterValue: _angular_core.Signal<boolean>;
2686
+ constructor();
1263
2687
  protected readonly center: _angular_core.Signal<number>;
1264
2688
  protected readonly radius: _angular_core.Signal<number>;
1265
2689
  protected readonly circumference: _angular_core.Signal<number>;
@@ -1313,8 +2737,17 @@ declare class CngxBullet {
1313
2737
  readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
1314
2738
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1315
2739
  private readonly preset;
1316
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2740
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
1317
2741
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2742
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2743
+ protected readonly busy: _angular_core.Signal<boolean>;
2744
+ /**
2745
+ * Meter value attributes render only in the content view: keeping
2746
+ * `aria-valuenow` while the skeleton or error fallback shows would
2747
+ * announce a stale reading for a value that is not on screen.
2748
+ */
2749
+ protected readonly showsMeterValue: _angular_core.Signal<boolean>;
2750
+ constructor();
1318
2751
  protected readonly maxValue: _angular_core.Signal<number>;
1319
2752
  protected readonly actualPercent: _angular_core.Signal<number>;
1320
2753
  protected readonly targetPercent: _angular_core.Signal<number>;
@@ -1339,8 +2772,8 @@ interface SegmentRendering {
1339
2772
  readonly left: number;
1340
2773
  readonly width: number;
1341
2774
  readonly color: string | null;
1342
- readonly label: string;
1343
- readonly value: number;
2775
+ /** `<label>: <value>` with the value in the app locale. */
2776
+ readonly title: string;
1344
2777
  }
1345
2778
  /**
1346
2779
  * Single-bar stacked composition - visualises proportional shares of
@@ -1365,8 +2798,11 @@ declare class CngxStackedBar {
1365
2798
  readonly state: _angular_core.InputSignal<CngxAsyncState<readonly CngxStackedSegment[]> | undefined>;
1366
2799
  readonly ariaLabel: _angular_core.InputSignal<string | null>;
1367
2800
  private readonly preset;
1368
- protected readonly i18n: _cngx_common_chart.CngxChartI18n;
2801
+ protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
2802
+ private readonly locale;
1369
2803
  protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
2804
+ /** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
2805
+ protected readonly busy: _angular_core.Signal<boolean>;
1370
2806
  protected readonly resolvedTotal: _angular_core.Signal<number>;
1371
2807
  protected readonly segmentRenderings: _angular_core.Signal<readonly SegmentRendering[]>;
1372
2808
  protected readonly effectiveAriaLabel: _angular_core.Signal<string>;
@@ -1374,5 +2810,5 @@ declare class CngxStackedBar {
1374
2810
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStackedBar, "cngx-stacked-bar", ["cngxStackedBar"], { "segments": { "alias": "segments"; "required": true; "isSignal": true; }; "total": { "alias": "total"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1375
2811
  }
1376
2812
 
1377
- export { CHART_SMALL_BREAKPOINT_PX, CNGX_CHART_CONTEXT, CNGX_CHART_I18N, CngxArea, CngxAxis, CngxBand, CngxBar, CngxBullet, CngxChart, CngxChartEmpty, CngxChartError, CngxChartLegend, CngxChartLoading, CngxDeviationBar, CngxDonut, CngxLine, CngxMiniArea, CngxMiniBar, CngxScatter, CngxSparkline, CngxStackedBar, CngxThreshold, buildCurvePath, createBandScale, createLinearScale, createOrdinalScale, createPathBuilder, createTimeScale, provideChartI18n };
1378
- export type { BandScale, BarYAccessor, CngxAxisPosition, CngxAxisType, CngxBulletRange, CngxChartContext, CngxChartErrorContext, CngxChartI18n, CngxChartLegendItem, CngxChartSlotContext, CngxChartSummary, CngxCurve, CngxStackedSegment, LineXAccessor, LineYAccessor, PathBuilder, PathBuilderOptions, PathPoint, ScaleFn, ScatterXAccessor, ScatterYAccessor, XScaleInput };
2813
+ export { CHART_SMALL_BREAKPOINT_PX, CNGX_CHART_AXIS, CNGX_CHART_CONTEXT, CNGX_CHART_I18N, CNGX_CHART_LANGUAGE_EN, CNGX_CHART_LAYER, CNGX_CHART_RENDERER_FACTORY, CNGX_CHART_RENDERER_THRESHOLD, CngxArea, CngxAxis, CngxAxisDomain, CngxBand, CngxBar, CngxBullet, CngxChart, CngxChartAnnouncer, CngxChartConnectionError, CngxChartEmpty, CngxChartError, CngxChartLegend, CngxChartLoading, CngxChartOverlay, CngxChartReconnecting, CngxDeviationBar, CngxDonut, CngxLine, CngxMiniArea, CngxMiniBar, CngxScatter, CngxSparkline, CngxStackedBar, CngxThreshold, buildCurvePath, createBandScale, createCanvasRenderer, createChartRendererController, createDefaultChartRenderer, createLinearScale, createOrdinalScale, createPathBuilder, createSignificantChangeTracker, createSvgRenderer, createTimeScale, downsampleLTTB, injectChartBuffer, injectChartContext, provideChartI18n, provideChartRenderer, withChartI18nLabels, withChartRendererFactory, withChartRendererThreshold };
2814
+ export type { BandScale, BarYAccessor, ChartBufferOptions, ChartRendererControllerDeps, ChartRendererDeps, CngxAxisPosition, CngxAxisType, CngxBulletRange, CngxChartAxis, CngxChartBuffer, CngxChartConnectionContext, CngxChartContext, CngxChartErrorContext, CngxChartI18n, CngxChartI18nFeature, CngxChartLanguageSection, CngxChartLayer, CngxChartLegendItem, CngxChartPlotArea, CngxChartRenderer, CngxChartRendererController, CngxChartRendererFactory, CngxChartRendererFeature, CngxChartSlotContext, CngxChartSummary, CngxCurve, CngxSignificantChange, CngxStackedSegment, LayerGeometry, LineXAccessor, LineYAccessor, PathBuilder, PathBuilderOptions, PathPoint, PathSegment, ScaleFn, ScatterXAccessor, ScatterYAccessor, XScaleInput };