@cngx/common 0.0.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/a11y/README.md +77 -0
- package/card/README.md +79 -0
- package/chart/README.md +31 -0
- package/data/README.md +883 -0
- package/dialog/README.md +84 -0
- package/display/README.md +30 -0
- package/fesm2022/cngx-common-a11y.mjs +1260 -0
- package/fesm2022/cngx-common-a11y.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +765 -0
- package/fesm2022/cngx-common-card.mjs.map +1 -0
- package/fesm2022/cngx-common-chart.mjs +2943 -0
- package/fesm2022/cngx-common-chart.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +2886 -0
- package/fesm2022/cngx-common-data.mjs.map +1 -0
- package/fesm2022/cngx-common-dialog.mjs +1366 -0
- package/fesm2022/cngx-common-dialog.mjs.map +1 -0
- package/fesm2022/cngx-common-display.mjs +1603 -0
- package/fesm2022/cngx-common-display.mjs.map +1 -0
- package/fesm2022/cngx-common-interactive.mjs +8185 -0
- package/fesm2022/cngx-common-interactive.mjs.map +1 -0
- package/fesm2022/cngx-common-layout.mjs +1335 -0
- package/fesm2022/cngx-common-layout.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1200 -0
- package/fesm2022/cngx-common-popover.mjs.map +1 -0
- package/fesm2022/cngx-common-stepper.mjs +1350 -0
- package/fesm2022/cngx-common-stepper.mjs.map +1 -0
- package/fesm2022/cngx-common-tabs.mjs +1551 -0
- package/fesm2022/cngx-common-tabs.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +34 -0
- package/fesm2022/cngx-common.mjs.map +1 -0
- package/interactive/README.md +211 -0
- package/layout/README.md +117 -0
- package/package.json +100 -0
- package/popover/README.md +218 -0
- package/stepper/README.md +102 -0
- package/tabs/README.md +32 -0
- package/types/cngx-common-a11y.d.ts +616 -0
- package/types/cngx-common-card.d.ts +413 -0
- package/types/cngx-common-chart.d.ts +1081 -0
- package/types/cngx-common-data.d.ts +1460 -0
- package/types/cngx-common-dialog.d.ts +772 -0
- package/types/cngx-common-display.d.ts +1136 -0
- package/types/cngx-common-interactive.d.ts +5013 -0
- package/types/cngx-common-layout.d.ts +737 -0
- package/types/cngx-common-popover.d.ts +520 -0
- package/types/cngx-common-stepper.d.ts +982 -0
- package/types/cngx-common-tabs.d.ts +1237 -0
- package/types/cngx-common.d.ts +13 -0
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
import * as _cngx_common_chart from '@cngx/common/chart';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { TemplateRef, InjectionToken, Signal } from '@angular/core';
|
|
4
|
+
import * as _cngx_common_data from '@cngx/common/data';
|
|
5
|
+
import { AsyncView } from '@cngx/common/data';
|
|
6
|
+
import { CngxAsyncState } from '@cngx/core/utils';
|
|
7
|
+
import * as i1 from '@cngx/common/layout';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Pure-TS linear scale. Maps a numeric domain `[d0, d1]` to a numeric
|
|
11
|
+
* range `[r0, r1]` via standard linear interpolation. Domain may be
|
|
12
|
+
* inverted (`d0 > d1`) for SVG Y-axes where the top of the chart is the
|
|
13
|
+
* highest data value but the lowest pixel coordinate.
|
|
14
|
+
*
|
|
15
|
+
* Values outside the domain extrapolate. Charts that need overflow
|
|
16
|
+
* clamping clamp at the data layer, not the scale.
|
|
17
|
+
*
|
|
18
|
+
* @param domain `[start, end]` data range. Equal endpoints collapse the
|
|
19
|
+
* scale to a constant function returning `range[0]`.
|
|
20
|
+
* @param range `[start, end]` output range (typically pixel coordinates).
|
|
21
|
+
* @returns `(v: number) => number` mapping domain values to range values.
|
|
22
|
+
*/
|
|
23
|
+
declare function createLinearScale(domain: readonly [number, number], range: readonly [number, number]): (v: number) => number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Pure-TS time scale. Reuses {@link createLinearScale} after coercing
|
|
27
|
+
* `Date` endpoints (and inputs) to epoch milliseconds. Supports
|
|
28
|
+
* inverted domains and bare-number timestamps interchangeably.
|
|
29
|
+
*
|
|
30
|
+
* @param domain `[start, end]` time range. `Date` and `number` are
|
|
31
|
+
* interchangeable on either endpoint.
|
|
32
|
+
* @param range `[start, end]` output range (typically pixel coordinates).
|
|
33
|
+
* @returns `(v: Date | number) => number` mapping time values to range
|
|
34
|
+
* values.
|
|
35
|
+
*/
|
|
36
|
+
declare function createTimeScale(domain: readonly [Date | number, Date | number], range: readonly [number, number]): (v: Date | number) => number;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Pure-TS band scale. Maps a discrete categorical domain to evenly
|
|
40
|
+
* spaced positions along a numeric range. Each band reserves equal
|
|
41
|
+
* width; padding shrinks the band by a fraction of its slot.
|
|
42
|
+
*
|
|
43
|
+
* Result is a callable carrying a `bandwidth()` method so layer atoms
|
|
44
|
+
* (`<cngx-bar>`, ...) can read both the position and the slot width.
|
|
45
|
+
*
|
|
46
|
+
* @param domain Ordered list of categorical values. Values are matched
|
|
47
|
+
* by reference equality on lookup; pass primitives or stable refs.
|
|
48
|
+
* @param range `[start, end]` output range.
|
|
49
|
+
* @param padding Fraction of each slot reserved as inter-band gap.
|
|
50
|
+
* Default `0` (no gap). Range `[0, 1)`.
|
|
51
|
+
* @returns Callable `(v: T) => number` returning the **leading edge** of
|
|
52
|
+
* the band, with a `bandwidth()` method returning the band width.
|
|
53
|
+
* Lookup of an unknown value returns `NaN`.
|
|
54
|
+
*/
|
|
55
|
+
interface BandScale<T> {
|
|
56
|
+
(v: T): number;
|
|
57
|
+
bandwidth(): number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Construct a {@link BandScale} from a categorical domain and a numeric
|
|
61
|
+
* range. See the type-level documentation above for parameter
|
|
62
|
+
* semantics.
|
|
63
|
+
*/
|
|
64
|
+
declare function createBandScale<T>(domain: readonly T[], range: readonly [number, number], padding?: number): BandScale<T>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Pure-TS ordinal scale. Maps a discrete categorical domain to a
|
|
68
|
+
* cycling palette of values (typically colours). When the domain is
|
|
69
|
+
* longer than the palette, mappings wrap modulo palette length.
|
|
70
|
+
*
|
|
71
|
+
* @param domain Ordered list of categorical values. Values are matched
|
|
72
|
+
* by reference equality on lookup.
|
|
73
|
+
* @param colors Palette to cycle through. Must have at least one entry;
|
|
74
|
+
* an empty palette throws synchronously at construction time.
|
|
75
|
+
* @returns Callable `(v: T) => string` returning the palette entry for
|
|
76
|
+
* `v`. Lookup of an unknown value returns the palette's first entry.
|
|
77
|
+
*/
|
|
78
|
+
declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly string[]): (v: T) => string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Common context shape passed into every chart slot template
|
|
82
|
+
* (loading, empty, error). Carries the chart's current rendered
|
|
83
|
+
* dimensions plus a `small` discriminator so consumers can switch
|
|
84
|
+
* between a compact and a richer fallback in the same template:
|
|
85
|
+
*
|
|
86
|
+
* ```html
|
|
87
|
+
* <ng-template cngxChartEmpty let-small="small">
|
|
88
|
+
* @if (small) {
|
|
89
|
+
* <span class="cngx-empty-compact">No data</span>
|
|
90
|
+
* } @else {
|
|
91
|
+
* <cngx-empty-state title="No telemetry yet" description="..." />
|
|
92
|
+
* }
|
|
93
|
+
* </ng-template>
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* The `small` flag is true when the chart's rendered width is below
|
|
97
|
+
* the threshold defined by the `--cngx-chart-small-width-px` CSS
|
|
98
|
+
* custom property (read from the chart at first render via the
|
|
99
|
+
* `CHART_SMALL_BREAKPOINT_PX` constant; default 400). Container-size
|
|
100
|
+
* based, not viewport-based, so it works correctly inside dashboard
|
|
101
|
+
* cells of any size.
|
|
102
|
+
*/
|
|
103
|
+
interface CngxChartSlotContext {
|
|
104
|
+
readonly width: number;
|
|
105
|
+
readonly height: number;
|
|
106
|
+
readonly small: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Threshold (px) below which `CngxChartSlotContext.small` is true.
|
|
110
|
+
* Hardcoded for v1; later releases may make this a config token.
|
|
111
|
+
*/
|
|
112
|
+
declare const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
113
|
+
/**
|
|
114
|
+
* Per-instance loading slot for `<cngx-chart>`. Project an
|
|
115
|
+
* `<ng-template cngxChartLoading>` to override the default centred
|
|
116
|
+
* spinner. The template receives a {@link CngxChartSlotContext} with
|
|
117
|
+
* the chart's rendered width/height plus a `small` flag for
|
|
118
|
+
* container-size-aware branching.
|
|
119
|
+
*
|
|
120
|
+
* ```html
|
|
121
|
+
* <cngx-chart [state]="state()">
|
|
122
|
+
* <ng-template cngxChartLoading let-small="small">
|
|
123
|
+
* @if (small) { <my-mini-spinner /> }
|
|
124
|
+
* @else { <my-branded-spinner /> }
|
|
125
|
+
* </ng-template>
|
|
126
|
+
* </cngx-chart>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare class CngxChartLoading {
|
|
130
|
+
readonly templateRef: TemplateRef<any>;
|
|
131
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartLoading, never>;
|
|
132
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartLoading, "ng-template[cngxChartLoading]", never, {}, {}, never, never, true, never>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Per-instance empty slot for `<cngx-chart>`. Receives a
|
|
136
|
+
* {@link CngxChartSlotContext} so the consumer can branch on chart
|
|
137
|
+
* size — typically a compact text fallback when `small` is true and
|
|
138
|
+
* a richer surface (`<cngx-empty-state>`, illustration, action) at
|
|
139
|
+
* regular sizes.
|
|
140
|
+
*/
|
|
141
|
+
declare class CngxChartEmpty {
|
|
142
|
+
readonly templateRef: TemplateRef<any>;
|
|
143
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartEmpty, never>;
|
|
144
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartEmpty, "ng-template[cngxChartEmpty]", never, {}, {}, never, never, true, never>;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Context for the `*cngxChartError` slot template. Extends the
|
|
148
|
+
* common slot context with the live error value via `$implicit` and
|
|
149
|
+
* `error` keys, so consumers can render a typed message AND branch
|
|
150
|
+
* on chart size.
|
|
151
|
+
*/
|
|
152
|
+
interface CngxChartErrorContext extends CngxChartSlotContext {
|
|
153
|
+
readonly $implicit: unknown;
|
|
154
|
+
readonly error: unknown;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* `*cngxChartError` slot — overrides the chart-level error placeholder.
|
|
158
|
+
* Receives a {@link CngxChartErrorContext}.
|
|
159
|
+
*/
|
|
160
|
+
declare class CngxChartError {
|
|
161
|
+
readonly templateRef: TemplateRef<any>;
|
|
162
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartError, never>;
|
|
163
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartError, "ng-template[cngxChartError]", never, {}, {}, never, never, true, never>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Numeric input shape every concrete scale accepts. Linear scales take
|
|
168
|
+
* `number`, time scales take `Date | number`, band scales take `string`
|
|
169
|
+
* or arbitrary references via {@link createBandScale}'s generic. The
|
|
170
|
+
* union narrows at the layer atom (`[cngxLine]`, `[cngxBar]`, ...);
|
|
171
|
+
* the chart context surface stays scale-agnostic.
|
|
172
|
+
*/
|
|
173
|
+
type XScaleInput = number | Date | string;
|
|
174
|
+
/**
|
|
175
|
+
* Generic scale function shape. Maps a domain value of type `TIn` to a
|
|
176
|
+
* range value (typically a pixel coordinate). Mirrors the result type
|
|
177
|
+
* of every `create*Scale` factory in `@cngx/common/chart`.
|
|
178
|
+
*/
|
|
179
|
+
type ScaleFn<TIn> = (v: TIn) => number;
|
|
180
|
+
/**
|
|
181
|
+
* Reactive context published by `<cngx-chart>` to its content children.
|
|
182
|
+
* Layer atoms (`[cngxLine]`, `[cngxBar]`, ...) and `[cngxAxis]` inject
|
|
183
|
+
* {@link CNGX_CHART_CONTEXT} to read the parent chart's scales,
|
|
184
|
+
* dimensions, data length, and data array without needing a direct
|
|
185
|
+
* reference to the parent class. Token is non-generic at the DI
|
|
186
|
+
* boundary; layer atoms call `data<T>()` to narrow the array to their
|
|
187
|
+
* own `<T>` — the single boundary cast lives inside `CngxChart`'s
|
|
188
|
+
* `data<U>()` method, not at every consumer site.
|
|
189
|
+
*/
|
|
190
|
+
interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
191
|
+
readonly xScale: Signal<ScaleFn<TX>>;
|
|
192
|
+
readonly yScale: Signal<ScaleFn<TY>>;
|
|
193
|
+
readonly dimensions: Signal<{
|
|
194
|
+
width: number;
|
|
195
|
+
height: number;
|
|
196
|
+
}>;
|
|
197
|
+
readonly dataLength: Signal<number>;
|
|
198
|
+
/**
|
|
199
|
+
* Generic-aware data accessor. Reads the chart's reactive data
|
|
200
|
+
* array; the consumer's `<T>` parameter narrows the returned type
|
|
201
|
+
* without a per-call cast at the consumer site. The chart performs
|
|
202
|
+
* one boundary cast in its implementation.
|
|
203
|
+
*/
|
|
204
|
+
data<T = unknown>(): readonly T[];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Injection token consumed by every chart child (`[cngxAxis]`, layer
|
|
208
|
+
* atoms, `<cngx-chart-data-table>`). `<cngx-chart>` provides itself
|
|
209
|
+
* via `useExisting`; child queries narrow the generic on the consumer
|
|
210
|
+
* side.
|
|
211
|
+
*/
|
|
212
|
+
declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, number>>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Top-level chart container. Hosts an `<svg>` viewBox, applies
|
|
216
|
+
* {@link CngxResizeObserver} via `hostDirectives` to track its rendered
|
|
217
|
+
* size, and provides {@link CNGX_CHART_CONTEXT} so child atoms
|
|
218
|
+
* (`[cngxAxis]`, layer atoms) read the live scales without injecting
|
|
219
|
+
* the concrete `CngxChart` class.
|
|
220
|
+
*
|
|
221
|
+
* Layer atoms and `[cngxAxis]` are attribute directives: consumers
|
|
222
|
+
* mount them on `<svg:g>` hosts inside the chart so the SVG namespace
|
|
223
|
+
* boundary stays clean. An element selector (`<cngx-axis>` etc.)
|
|
224
|
+
* inside `<svg>` would create an XHTML-namespaced custom element
|
|
225
|
+
* whose SVG-namespaced children would not lay out, leaving the chart
|
|
226
|
+
* blank in real browsers (jsdom is permissive and would mask this).
|
|
227
|
+
*
|
|
228
|
+
* Scales are derived from content-child `[cngxAxis]` directives:
|
|
229
|
+
* the X axis (top/bottom position) drives `xScale`, the Y axis
|
|
230
|
+
* (left/right) drives `yScale`. With no axis present, the
|
|
231
|
+
* corresponding scale falls back to a no-op `() => 0` and content
|
|
232
|
+
* children may render off-canvas — consumers must mount at least
|
|
233
|
+
* one axis per direction they actually use.
|
|
234
|
+
*
|
|
235
|
+
* The `[width]` / `[height]` inputs override the resize observer for
|
|
236
|
+
* fixed-dimension presets (inline sparkline at 80×24, etc.).
|
|
237
|
+
*/
|
|
238
|
+
declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, number> {
|
|
239
|
+
/**
|
|
240
|
+
* Raw data input. Aliased as `data` at the template-binding level so
|
|
241
|
+
* consumer markup stays `<cngx-chart [data]="rows">`. The public,
|
|
242
|
+
* typed read surface is the `data<U>()` method below — layer atoms
|
|
243
|
+
* call `this.ctx.data<T>()` to narrow without per-site casts.
|
|
244
|
+
*
|
|
245
|
+
* @internal — alias for the public `data<U>()` method
|
|
246
|
+
*/
|
|
247
|
+
readonly dataInput: _angular_core.InputSignal<readonly T[]>;
|
|
248
|
+
readonly width: _angular_core.InputSignal<number | undefined>;
|
|
249
|
+
readonly height: _angular_core.InputSignal<number | undefined>;
|
|
250
|
+
readonly preserveAspectRatio: _angular_core.InputSignal<string>;
|
|
251
|
+
/**
|
|
252
|
+
* Optional explicit `aria-label` override. When set, supersedes the
|
|
253
|
+
* auto-Summary derived from data + threshold layers. Use when the
|
|
254
|
+
* default summary phrasing does not fit the chart's domain.
|
|
255
|
+
*/
|
|
256
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
257
|
+
/**
|
|
258
|
+
* Numeric accessor used to project generic data to the values fed
|
|
259
|
+
* into the auto-Summary. Default `Number(d)` works for `readonly
|
|
260
|
+
* number[]` data; structured data must override.
|
|
261
|
+
*/
|
|
262
|
+
readonly summaryAccessor: _angular_core.InputSignal<(d: T, i: number) => number>;
|
|
263
|
+
/**
|
|
264
|
+
* Controls when the SR-only data-table view is exposed to assistive
|
|
265
|
+
* technology. `'auto'` (default) shows the table whenever the data
|
|
266
|
+
* has more than one point — a single value is announced via the
|
|
267
|
+
* `aria-label`, no table needed. `'off'` keeps the table hidden
|
|
268
|
+
* regardless. The table element is always present in the DOM —
|
|
269
|
+
* visibility flips through `aria-hidden`, the linked id on
|
|
270
|
+
* `aria-describedby` never disappears.
|
|
271
|
+
*/
|
|
272
|
+
readonly accessibleTable: _angular_core.InputSignal<"auto" | "off">;
|
|
273
|
+
/**
|
|
274
|
+
* Optional async-state envelope. When bound, the chart routes through
|
|
275
|
+
* the same skeleton / empty / error / content state machine that the
|
|
276
|
+
* preset molecules use. Without this input, the chart always renders
|
|
277
|
+
* its content (Pillar-2 always-in-DOM data-table id stays stable, but
|
|
278
|
+
* the SR data-table only flips out of `aria-hidden` when the active
|
|
279
|
+
* view is `'content'`).
|
|
280
|
+
*
|
|
281
|
+
* Accepts the standard `CngxAsyncState<T>` shape (any producer:
|
|
282
|
+
* `createManualState`, `createAsyncState`, `injectAsyncState`,
|
|
283
|
+
* `fromHttpResource`, `tap*` pipeline output). The chart provides
|
|
284
|
+
* `CNGX_STATEFUL` for downstream bridge directives — composing
|
|
285
|
+
* `<cngx-toast-on />` etc. inside the chart works automatically.
|
|
286
|
+
*/
|
|
287
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly T[]> | undefined>;
|
|
288
|
+
private readonly resize;
|
|
289
|
+
private readonly axes;
|
|
290
|
+
private readonly thresholds;
|
|
291
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
292
|
+
protected readonly dataTableId: string;
|
|
293
|
+
private readonly loadingSlot;
|
|
294
|
+
private readonly emptySlot;
|
|
295
|
+
private readonly errorSlot;
|
|
296
|
+
/** Resolved consumer-projected loading template (null when no slot bound). */
|
|
297
|
+
protected readonly loadingTpl: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
|
|
298
|
+
/** Resolved consumer-projected empty template (null when no slot bound). */
|
|
299
|
+
protected readonly emptyTpl: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
|
|
300
|
+
/** Resolved consumer-projected error template (null when no slot bound). */
|
|
301
|
+
protected readonly errorTpl: _angular_core.Signal<_angular_core.TemplateRef<any> | null>;
|
|
302
|
+
/**
|
|
303
|
+
* Common context for every slot template (loading, empty, error).
|
|
304
|
+
* Carries the chart's current rendered width/height plus a `small`
|
|
305
|
+
* flag flipped at the {@link CHART_SMALL_BREAKPOINT_PX} threshold,
|
|
306
|
+
* so consumers can branch on container size:
|
|
307
|
+
*
|
|
308
|
+
* ```html
|
|
309
|
+
* <ng-template cngxChartEmpty let-small="small">
|
|
310
|
+
* @if (small) { <span>No data</span> }
|
|
311
|
+
* @else { <cngx-empty-state title="No telemetry yet" /> }
|
|
312
|
+
* </ng-template>
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* Reads directly from the resize observer (host's actual painted
|
|
316
|
+
* size) — NOT from `dimensions()` which prefers the logical
|
|
317
|
+
* `[width]`/`[height]` inputs. This matters when an explicit
|
|
318
|
+
* `[width]="480"` chart squeezes via `max-width: 100%` on a narrow
|
|
319
|
+
* viewport: the rendered width is what the consumer cares about
|
|
320
|
+
* for fallback layout, not the logical viewBox dimension.
|
|
321
|
+
*/
|
|
322
|
+
protected readonly slotContext: _angular_core.Signal<CngxChartSlotContext>;
|
|
323
|
+
/**
|
|
324
|
+
* Error-slot context — extends {@link slotContext} with the live
|
|
325
|
+
* error value under `$implicit` and `error` keys, so a consumer can
|
|
326
|
+
* render a typed message AND branch on chart size in the same
|
|
327
|
+
* template.
|
|
328
|
+
*/
|
|
329
|
+
protected readonly errorContext: _angular_core.Signal<{
|
|
330
|
+
$implicit: {} | null;
|
|
331
|
+
error: {} | null;
|
|
332
|
+
width: number;
|
|
333
|
+
height: number;
|
|
334
|
+
small: boolean;
|
|
335
|
+
}>;
|
|
336
|
+
constructor();
|
|
337
|
+
readonly dataLength: _angular_core.Signal<number>;
|
|
338
|
+
/**
|
|
339
|
+
* Generic-aware data accessor satisfying {@link CngxChartContext.data}.
|
|
340
|
+
* The single boundary cast lives here; layer atoms call
|
|
341
|
+
* `this.ctx.data<T>()` and receive `readonly T[]` directly with no
|
|
342
|
+
* per-site `as` cast.
|
|
343
|
+
*/
|
|
344
|
+
data<U = T>(): readonly U[];
|
|
345
|
+
readonly dimensions: _angular_core.Signal<{
|
|
346
|
+
width: number;
|
|
347
|
+
height: number;
|
|
348
|
+
}>;
|
|
349
|
+
protected readonly viewBox: _angular_core.Signal<string>;
|
|
350
|
+
private readonly xScaleCache;
|
|
351
|
+
private readonly yScaleCache;
|
|
352
|
+
readonly xScale: _angular_core.Signal<ScaleFn<XScaleInput>>;
|
|
353
|
+
readonly yScale: _angular_core.Signal<ScaleFn<number>>;
|
|
354
|
+
/**
|
|
355
|
+
* Auto-Summary derived from `data` and `<cngx-threshold>` content
|
|
356
|
+
* children. Drives the host's reactive `aria-label`. Layer atoms do
|
|
357
|
+
* not contribute to the summary on Phase 3 — Phase 5/6 may extend
|
|
358
|
+
* with per-layer hints.
|
|
359
|
+
*/
|
|
360
|
+
readonly summary: _angular_core.Signal<_cngx_common_chart.CngxChartSummary>;
|
|
361
|
+
/**
|
|
362
|
+
* Active view for the optional state-machine envelope. Returns
|
|
363
|
+
* `'content'` when no `[state]` is bound, falling through to the
|
|
364
|
+
* default branch that renders the SVG content. Otherwise routes
|
|
365
|
+
* through {@link resolveAsyncView} using the same status / firstLoad
|
|
366
|
+
* / empty triple every preset and async-aware atom in the library
|
|
367
|
+
* uses.
|
|
368
|
+
*/
|
|
369
|
+
protected readonly activeView: _angular_core.Signal<AsyncView>;
|
|
370
|
+
/** True when the chart is currently rendering its skeleton view. */
|
|
371
|
+
protected readonly busy: _angular_core.Signal<boolean>;
|
|
372
|
+
/**
|
|
373
|
+
* Responsive mode is active when neither `[width]` nor `[height]` is
|
|
374
|
+
* bound. The host then fills its parent's width and derives height
|
|
375
|
+
* from the `--cngx-chart-aspect-ratio` CSS custom property (default
|
|
376
|
+
* `16 / 9`). The resize observer feeds `dimensions()` which drives
|
|
377
|
+
* the SVG sizing + scale math, so axes and layer atoms re-flow
|
|
378
|
+
* reactively as the parent resizes.
|
|
379
|
+
*/
|
|
380
|
+
protected readonly isResponsive: _angular_core.Signal<boolean>;
|
|
381
|
+
/**
|
|
382
|
+
* Aspect-ratio host style for the explicit-dimension case. Computed
|
|
383
|
+
* from `[width] / [height]` so the chart stays proportional when
|
|
384
|
+
* `max-width: 100%` shrinks the host below the explicit width on a
|
|
385
|
+
* narrow viewport (mobile portrait, constrained dashboard cell).
|
|
386
|
+
* Returns `null` in responsive mode so the
|
|
387
|
+
* `--cngx-chart-aspect-ratio` CSS variable on `.cngx-chart--responsive`
|
|
388
|
+
* wins, and `null` when only one of width/height is bound (caller
|
|
389
|
+
* intentionally drove just one dimension; we do not invent a ratio).
|
|
390
|
+
*/
|
|
391
|
+
protected readonly explicitAspectRatio: _angular_core.Signal<string | null>;
|
|
392
|
+
/**
|
|
393
|
+
* Reactive `aria-label` text the host announces. Skeleton / empty /
|
|
394
|
+
* error states announce localised i18n strings; the auto-Summary
|
|
395
|
+
* runs only in the content branch so AT does not read stale data
|
|
396
|
+
* during a refetch.
|
|
397
|
+
*/
|
|
398
|
+
protected readonly ariaLabelText: _angular_core.Signal<string>;
|
|
399
|
+
/** Numeric projection of `data` reused by the data-table view. */
|
|
400
|
+
protected readonly summaryValues: _angular_core.Signal<readonly number[]>;
|
|
401
|
+
/**
|
|
402
|
+
* Auto-mode predicate. Drives the data-table's `aria-hidden`
|
|
403
|
+
* binding. The id on `aria-describedby` is invariant — it stays on
|
|
404
|
+
* the host whether the table is active or not. Single-value charts
|
|
405
|
+
* speak via the `aria-label` summary; multi-value charts add the
|
|
406
|
+
* table for row-by-row exploration.
|
|
407
|
+
*/
|
|
408
|
+
protected readonly tableActive: _angular_core.Signal<boolean>;
|
|
409
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChart<any>, never>;
|
|
410
|
+
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: {}; }]>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Axis position. Top/bottom are X-axes; left/right are Y-axes. The
|
|
415
|
+
* parent `<cngx-chart>` collects content-child axes and routes their
|
|
416
|
+
* inputs to its `xScale` / `yScale` signals based on this discriminator.
|
|
417
|
+
*/
|
|
418
|
+
type CngxAxisPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
419
|
+
/**
|
|
420
|
+
* Axis scale type. The chart's scale-builder picks the matching
|
|
421
|
+
* `create*Scale` factory at the boundary; the axis itself stays
|
|
422
|
+
* scale-implementation-agnostic.
|
|
423
|
+
*/
|
|
424
|
+
type CngxAxisType = 'linear' | 'time' | 'band';
|
|
425
|
+
interface AxisLabelGeometry {
|
|
426
|
+
readonly transform: string;
|
|
427
|
+
readonly anchor: 'start' | 'middle' | 'end';
|
|
428
|
+
readonly baseline: 'auto' | 'middle' | 'hanging';
|
|
429
|
+
}
|
|
430
|
+
interface AxisGeometry {
|
|
431
|
+
readonly transform: string;
|
|
432
|
+
readonly line: {
|
|
433
|
+
readonly x1: number;
|
|
434
|
+
readonly y1: number;
|
|
435
|
+
readonly x2: number;
|
|
436
|
+
readonly y2: number;
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
interface TickRendering {
|
|
440
|
+
readonly key: string;
|
|
441
|
+
readonly transform: string;
|
|
442
|
+
readonly tickLine: {
|
|
443
|
+
readonly x1: number;
|
|
444
|
+
readonly y1: number;
|
|
445
|
+
readonly x2: number;
|
|
446
|
+
readonly y2: number;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Endpoint of the gridline that extends from this tick across the
|
|
450
|
+
* chart's perpendicular dimension. `(x1, y1)` is always `(0, 0)`
|
|
451
|
+
* (the tick's local origin); `(x2, y2)` reaches the opposite side
|
|
452
|
+
* of the chart area. Always present in the tick rendering — the
|
|
453
|
+
* `[showGrid]` input controls whether the line is rendered, not
|
|
454
|
+
* whether the geometry is computed.
|
|
455
|
+
*/
|
|
456
|
+
readonly gridLine: {
|
|
457
|
+
readonly x2: number;
|
|
458
|
+
readonly y2: number;
|
|
459
|
+
};
|
|
460
|
+
readonly label: {
|
|
461
|
+
readonly x: number;
|
|
462
|
+
readonly y: number;
|
|
463
|
+
readonly anchor: 'start' | 'middle' | 'end';
|
|
464
|
+
readonly baseline: 'auto' | 'middle' | 'hanging';
|
|
465
|
+
readonly text: string;
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Declarative axis directive. Lives as a content child of
|
|
470
|
+
* `<cngx-chart>`; its `position` + `type` + `domain` inputs feed the
|
|
471
|
+
* parent's scale derivation. Renders SVG ticks and labels in the
|
|
472
|
+
* coordinate system the parent publishes via {@link CNGX_CHART_CONTEXT}.
|
|
473
|
+
*
|
|
474
|
+
* Attribute-selector on `<svg:g>` — the host element IS the SVG group.
|
|
475
|
+
* This keeps the namespace boundary clean: a `<cngx-axis>` element
|
|
476
|
+
* inside `<svg>` would be in the XHTML namespace and SVG layout would
|
|
477
|
+
* not flow through it. By making the directive attribute-only, the
|
|
478
|
+
* host stays in the SVG namespace and the browser lays out tick lines
|
|
479
|
+
* and labels exactly where the geometry says.
|
|
480
|
+
*
|
|
481
|
+
* Host carries `aria-hidden="true"` — axis text is decoration; the
|
|
482
|
+
* semantic data view lives on the parent chart's auto-Summary and
|
|
483
|
+
* Data Table.
|
|
484
|
+
*/
|
|
485
|
+
declare class CngxAxis {
|
|
486
|
+
readonly position: _angular_core.InputSignal<CngxAxisPosition>;
|
|
487
|
+
readonly type: _angular_core.InputSignal<CngxAxisType>;
|
|
488
|
+
readonly domain: _angular_core.InputSignal<readonly unknown[] | undefined>;
|
|
489
|
+
readonly tickCount: _angular_core.InputSignal<number | undefined>;
|
|
490
|
+
readonly format: _angular_core.InputSignal<(v: unknown) => string>;
|
|
491
|
+
/**
|
|
492
|
+
* Render decorative gridlines extending from each tick across the
|
|
493
|
+
* chart's perpendicular dimension. Theming via the
|
|
494
|
+
* `--cngx-axis-grid-color` / `--cngx-axis-grid-opacity` /
|
|
495
|
+
* `--cngx-axis-grid-stroke-width` / `--cngx-axis-grid-dasharray`
|
|
496
|
+
* CSS custom properties (defaults: chart-level grid colour, 0.6
|
|
497
|
+
* opacity, 1px solid). Aliased as `[grid]` for terseness.
|
|
498
|
+
*/
|
|
499
|
+
readonly showGrid: _angular_core.InputSignal<boolean>;
|
|
500
|
+
/**
|
|
501
|
+
* Optional axis title rendered alongside the tick labels —
|
|
502
|
+
* "Months", "Revenue (k€)", etc. The title is positioned outside
|
|
503
|
+
* the tick labels (further from the chart area) and rotated -90°
|
|
504
|
+
* for left/right axes so it reads bottom-to-top. Theming via the
|
|
505
|
+
* `--cngx-axis-axis-label-color` and `--cngx-axis-axis-label-font-size`
|
|
506
|
+
* CSS custom properties (default: chart text colour + 12px). Aliased
|
|
507
|
+
* `[label]` for terseness.
|
|
508
|
+
*/
|
|
509
|
+
readonly axisLabel: _angular_core.InputSignal<string | null>;
|
|
510
|
+
private readonly ctx;
|
|
511
|
+
/**
|
|
512
|
+
* Tick values to render. Resolution order:
|
|
513
|
+
* 1. `type='band'` and `[domain]` provided → one tick per domain
|
|
514
|
+
* value.
|
|
515
|
+
* 2. linear/time + `[domain]` provided → `[ticks]`-many evenly
|
|
516
|
+
* spaced positions across the domain (default 5).
|
|
517
|
+
* 3. Otherwise → empty array. Axis still renders the line.
|
|
518
|
+
*/
|
|
519
|
+
readonly tickValues: _angular_core.Signal<readonly unknown[]>;
|
|
520
|
+
protected readonly hostClass: _angular_core.Signal<string>;
|
|
521
|
+
protected readonly axisLabelGeometry: _angular_core.Signal<AxisLabelGeometry | null>;
|
|
522
|
+
protected readonly axisGeometry: _angular_core.Signal<AxisGeometry | null>;
|
|
523
|
+
protected readonly tickRenderings: _angular_core.Signal<readonly TickRendering[]>;
|
|
524
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAxis, never>;
|
|
525
|
+
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>;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Single legend entry. `color` is optional — when omitted the swatch
|
|
530
|
+
* falls back to the chart-level primary token. `value` is intentionally
|
|
531
|
+
* unconstrained so consumers can carry their domain key (id, layer
|
|
532
|
+
* name, accessor return type, ...) for later interactions without a
|
|
533
|
+
* second lookup.
|
|
534
|
+
*/
|
|
535
|
+
interface CngxChartLegendItem<T = unknown> {
|
|
536
|
+
readonly label: string;
|
|
537
|
+
readonly color?: string | null;
|
|
538
|
+
readonly value?: T;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Presentational legend atom — a row (or column) of coloured swatches
|
|
542
|
+
* paired with labels. Decoupled from `<cngx-chart>` and the layer
|
|
543
|
+
* atoms by design: the consumer drives the items array, so the
|
|
544
|
+
* legend stays a pure rendering surface with zero opinions about
|
|
545
|
+
* series-discovery, visibility-toggling, or interaction.
|
|
546
|
+
*
|
|
547
|
+
* Compose alongside a chart wherever a multi-layer composition needs
|
|
548
|
+
* a label key:
|
|
549
|
+
*
|
|
550
|
+
* ```html
|
|
551
|
+
* <cngx-chart [data]="series">
|
|
552
|
+
* <svg:g cngxLine [data]="traffic" style="--cngx-line-color: #3b82f6"></svg:g>
|
|
553
|
+
* <svg:g cngxLine [data]="errors" style="--cngx-line-color: #d2452f"></svg:g>
|
|
554
|
+
* </cngx-chart>
|
|
555
|
+
* <cngx-chart-legend
|
|
556
|
+
* [items]="[
|
|
557
|
+
* { label: 'Traffic', color: '#3b82f6' },
|
|
558
|
+
* { label: 'Errors', color: '#d2452f' }
|
|
559
|
+
* ]"
|
|
560
|
+
* />
|
|
561
|
+
* ```
|
|
562
|
+
*
|
|
563
|
+
* Theming via `--cngx-chart-legend-gap`,
|
|
564
|
+
* `--cngx-chart-legend-swatch-size`, `--cngx-chart-legend-swatch-radius`,
|
|
565
|
+
* `--cngx-chart-legend-font-size`. `[orientation]` flips between row
|
|
566
|
+
* and column; `[align]` aligns along the main axis (`start`, `center`,
|
|
567
|
+
* `end`).
|
|
568
|
+
*/
|
|
569
|
+
declare class CngxChartLegend<T = unknown> {
|
|
570
|
+
readonly items: _angular_core.InputSignal<readonly CngxChartLegendItem<T>[]>;
|
|
571
|
+
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
572
|
+
readonly align: _angular_core.InputSignal<"start" | "end" | "center">;
|
|
573
|
+
protected readonly flexAlign: _angular_core.Signal<"center" | "flex-end" | "flex-start">;
|
|
574
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChartLegend<any>, never>;
|
|
575
|
+
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>;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Curve interpolators for line / area path builders. Each function
|
|
580
|
+
* returns the **interior** path commands that connect a series of
|
|
581
|
+
* points; the caller is responsible for the leading `M` and any
|
|
582
|
+
* trailing close commands.
|
|
583
|
+
*
|
|
584
|
+
* Pure TS, no DOM dependency, no Angular dep.
|
|
585
|
+
*/
|
|
586
|
+
type CngxCurve = 'linear' | 'monotone';
|
|
587
|
+
/** Pixel-space point fed into {@link buildCurvePath}. */
|
|
588
|
+
interface PathPoint {
|
|
589
|
+
readonly x: number;
|
|
590
|
+
readonly y: number;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Build the SVG `d` attribute for a sequence of points.
|
|
594
|
+
*
|
|
595
|
+
* @param points Pixel-coordinate points to connect.
|
|
596
|
+
* @param curve Interpolation strategy. `'linear'` joins points with
|
|
597
|
+
* straight `L` commands; `'monotone'` uses cubic Béziers with the
|
|
598
|
+
* monotone-X tangent rule (Fritsch-Carlson) so the curve never
|
|
599
|
+
* overshoots between data points.
|
|
600
|
+
* @returns The full path data starting with `M`. Returns `''` when
|
|
601
|
+
* the input is empty; `M x y` when the input has one point.
|
|
602
|
+
*/
|
|
603
|
+
declare function buildCurvePath(points: readonly PathPoint[], curve: CngxCurve): string;
|
|
604
|
+
|
|
605
|
+
/** Reads the Y value of a data row at index `i`. */
|
|
606
|
+
type LineYAccessor<T> = (d: T, i: number) => number;
|
|
607
|
+
/**
|
|
608
|
+
* Reads the X value of a data row at index `i`. Default behaviour
|
|
609
|
+
* (when omitted on a builder) is the row's positional index.
|
|
610
|
+
*/
|
|
611
|
+
type LineXAccessor<T> = (d: T, i: number) => XScaleInput;
|
|
612
|
+
/** Construction options for {@link createPathBuilder}. */
|
|
613
|
+
interface PathBuilderOptions<T> {
|
|
614
|
+
readonly y: LineYAccessor<T>;
|
|
615
|
+
readonly x?: LineXAccessor<T>;
|
|
616
|
+
readonly curve: CngxCurve;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Single-slot LRU cache around an SVG `d`-attribute builder. Returned
|
|
620
|
+
* by {@link createPathBuilder}; consumed by the `<cngx-line>` /
|
|
621
|
+
* `<cngx-area>` family.
|
|
622
|
+
*/
|
|
623
|
+
interface PathBuilder<T> {
|
|
624
|
+
/**
|
|
625
|
+
* Build the SVG `d` attribute for the given data + scales. Same
|
|
626
|
+
* `(data, xScale, yScale)` triple by reference returns the cached
|
|
627
|
+
* string without re-running the O(n) point projection.
|
|
628
|
+
*/
|
|
629
|
+
build(data: readonly T[], xScale: ScaleFn<XScaleInput>, yScale: ScaleFn<number>): string;
|
|
630
|
+
/**
|
|
631
|
+
* Number of times the internal point-projection + path-string
|
|
632
|
+
* concatenation has run since this builder was constructed. Exposed
|
|
633
|
+
* for the compute-guard isolated spec; not part of the public chart
|
|
634
|
+
* API.
|
|
635
|
+
*/
|
|
636
|
+
rebuildCount(): number;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Pure-TS path builder with single-slot LRU memo on
|
|
640
|
+
* `(data, xScale, yScale)` reference identity. Pure TS, no Angular
|
|
641
|
+
* dep. Compute guard only — does not know about signals or `equal`
|
|
642
|
+
* functions; the `d` computed in `<cngx-line>` carries the cascade
|
|
643
|
+
* guard separately.
|
|
644
|
+
*
|
|
645
|
+
* The cache returns the previous result when all three inputs are
|
|
646
|
+
* reference-equal to the previous call. Any reference mismatch
|
|
647
|
+
* triggers a rebuild and updates the slot.
|
|
648
|
+
*
|
|
649
|
+
* Each call to `createPathBuilder` returns a fresh builder with its
|
|
650
|
+
* own `lastData / lastX / lastY` slots — there is no cross-call /
|
|
651
|
+
* cross-consumer state. The cascade guard for layer atoms is the
|
|
652
|
+
* `equal: (a, b) => a === b` on the `builder` `computed`; combined
|
|
653
|
+
* with Angular signals' default behaviour of skipping re-emissions
|
|
654
|
+
* when the inputs to the `computed` are unchanged, two consecutive
|
|
655
|
+
* cascade ticks with the same `(y, x, curve)` produce the same
|
|
656
|
+
* builder instance.
|
|
657
|
+
*/
|
|
658
|
+
declare function createPathBuilder<T>(opts: PathBuilderOptions<T>): PathBuilder<T>;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Line layer atom. Renders a single SVG `<path>` connecting the data
|
|
662
|
+
* points projected through the parent chart's scales. Reads scales
|
|
663
|
+
* from {@link CNGX_CHART_CONTEXT}, NOT from a parent class.
|
|
664
|
+
*
|
|
665
|
+
* Attribute-selector on `<svg:g>` — the host element IS the SVG group.
|
|
666
|
+
* Element selectors create XHTML-namespaced custom elements inside
|
|
667
|
+
* SVG, which break layout for the namespaced children. Apply this
|
|
668
|
+
* directive on an `<svg:g>` host instead.
|
|
669
|
+
*
|
|
670
|
+
* The `d` string is cascade-guarded with string equality on its
|
|
671
|
+
* `computed` so downstream effects only re-run when the path
|
|
672
|
+
* geometry actually changes. The `createPathBuilder` cache provides
|
|
673
|
+
* the **compute guard** — same `(data, xScale, yScale)` triple by
|
|
674
|
+
* reference skips the per-datapoint projection work.
|
|
675
|
+
*/
|
|
676
|
+
declare class CngxLine<T = unknown> {
|
|
677
|
+
readonly accessor: _angular_core.InputSignal<LineYAccessor<T>>;
|
|
678
|
+
readonly xAccessor: _angular_core.InputSignal<LineXAccessor<T> | undefined>;
|
|
679
|
+
readonly color: _angular_core.InputSignal<string | null>;
|
|
680
|
+
readonly strokeWidth: _angular_core.InputSignal<string | number | null>;
|
|
681
|
+
readonly curve: _angular_core.InputSignal<CngxCurve>;
|
|
682
|
+
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
683
|
+
private readonly ctx;
|
|
684
|
+
private readonly builder;
|
|
685
|
+
private readonly resolvedData;
|
|
686
|
+
protected readonly d: _angular_core.Signal<string>;
|
|
687
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLine<any>, never>;
|
|
688
|
+
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>;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Area layer atom. Reuses {@link createPathBuilder} for the upper edge
|
|
693
|
+
* (same compute guard as `[cngxLine]`) and closes the polygon to a
|
|
694
|
+
* `[baseline]` (default `0`) so SVG can fill it.
|
|
695
|
+
*
|
|
696
|
+
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
697
|
+
*
|
|
698
|
+
* The `d` string is cascade-guarded with string equality on its
|
|
699
|
+
* `computed` so a no-op data refresh does not force a fill repaint.
|
|
700
|
+
*/
|
|
701
|
+
declare class CngxArea<T = unknown> {
|
|
702
|
+
readonly accessor: _angular_core.InputSignal<LineYAccessor<T>>;
|
|
703
|
+
readonly xAccessor: _angular_core.InputSignal<LineXAccessor<T> | undefined>;
|
|
704
|
+
readonly opacity: _angular_core.InputSignal<string | number | null>;
|
|
705
|
+
readonly curve: _angular_core.InputSignal<CngxCurve>;
|
|
706
|
+
readonly baseline: _angular_core.InputSignal<number>;
|
|
707
|
+
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
708
|
+
private readonly ctx;
|
|
709
|
+
private readonly builder;
|
|
710
|
+
private readonly resolvedData;
|
|
711
|
+
protected readonly d: _angular_core.Signal<string>;
|
|
712
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxArea<any>, never>;
|
|
713
|
+
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>;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** Reads the bar height (data-space Y) of a data row at index `i`. */
|
|
717
|
+
type BarYAccessor<T> = (d: T, i: number) => number;
|
|
718
|
+
interface BarRect {
|
|
719
|
+
readonly key: number;
|
|
720
|
+
readonly x: number;
|
|
721
|
+
readonly y: number;
|
|
722
|
+
readonly width: number;
|
|
723
|
+
readonly height: number;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Bar layer atom. Renders one `<rect>` per datapoint. Bar width comes
|
|
727
|
+
* from `dimensions.width / dataLength` (one slot per datapoint) shrunk
|
|
728
|
+
* by the optional `[gap]` ratio. Bar height runs from `yScale(value)`
|
|
729
|
+
* down to `yScale(baseline)` (default 0) — SVG bottom-anchored.
|
|
730
|
+
*
|
|
731
|
+
* Bar does NOT require a band X scale; the slot width is purely
|
|
732
|
+
* geometric. This keeps the atom usable with linear or band X axes
|
|
733
|
+
* interchangeably.
|
|
734
|
+
*
|
|
735
|
+
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
736
|
+
*/
|
|
737
|
+
declare class CngxBar<T = unknown> {
|
|
738
|
+
readonly accessor: _angular_core.InputSignal<BarYAccessor<T>>;
|
|
739
|
+
readonly gap: _angular_core.InputSignal<number>;
|
|
740
|
+
readonly baseline: _angular_core.InputSignal<number>;
|
|
741
|
+
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
742
|
+
private readonly ctx;
|
|
743
|
+
private readonly resolvedData;
|
|
744
|
+
protected readonly rects: _angular_core.Signal<readonly BarRect[]>;
|
|
745
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBar<any>, never>;
|
|
746
|
+
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>;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/** Reads the data-space X value of a scatter row at index `i`. */
|
|
750
|
+
type ScatterXAccessor<T> = (d: T, i: number) => XScaleInput;
|
|
751
|
+
/** Reads the data-space Y value of a scatter row at index `i`. */
|
|
752
|
+
type ScatterYAccessor<T> = (d: T, i: number) => number;
|
|
753
|
+
interface ScatterCircle {
|
|
754
|
+
readonly key: number;
|
|
755
|
+
readonly cx: number;
|
|
756
|
+
readonly cy: number;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Scatter layer atom. Renders one `<circle>` per datapoint. X and Y
|
|
760
|
+
* accessors are independent — neither defaults to index, since the
|
|
761
|
+
* defining trait of a scatter chart is two genuine data dimensions.
|
|
762
|
+
*
|
|
763
|
+
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
764
|
+
*/
|
|
765
|
+
declare class CngxScatter<T = unknown> {
|
|
766
|
+
readonly x: _angular_core.InputSignal<ScatterXAccessor<T>>;
|
|
767
|
+
readonly y: _angular_core.InputSignal<ScatterYAccessor<T>>;
|
|
768
|
+
readonly radius: _angular_core.InputSignal<number>;
|
|
769
|
+
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
770
|
+
private readonly ctx;
|
|
771
|
+
private readonly resolvedData;
|
|
772
|
+
protected readonly circles: _angular_core.Signal<readonly ScatterCircle[]>;
|
|
773
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxScatter<any>, never>;
|
|
774
|
+
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>;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Threshold reference atom. Renders a single horizontal `<line>` at
|
|
779
|
+
* `yScale(value)` spanning the chart's full width, plus an optional
|
|
780
|
+
* `<text>` label at the right edge.
|
|
781
|
+
*
|
|
782
|
+
* Common use: target threshold ("budget cap"), warning bands, or any
|
|
783
|
+
* "line at value" reference. Always reads scales from
|
|
784
|
+
* {@link CNGX_CHART_CONTEXT}.
|
|
785
|
+
*
|
|
786
|
+
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
787
|
+
*/
|
|
788
|
+
declare class CngxThreshold {
|
|
789
|
+
readonly value: _angular_core.InputSignal<number>;
|
|
790
|
+
readonly label: _angular_core.InputSignal<string | null>;
|
|
791
|
+
readonly dashed: _angular_core.InputSignal<boolean>;
|
|
792
|
+
private readonly ctx;
|
|
793
|
+
protected readonly geometry: _angular_core.Signal<{
|
|
794
|
+
width: number;
|
|
795
|
+
y: number;
|
|
796
|
+
} | null>;
|
|
797
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxThreshold, never>;
|
|
798
|
+
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>;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Band reference atom. Renders a `<rect>` across a vertical Y-range
|
|
803
|
+
* (`from..to`) spanning the chart's full width. Use to highlight a
|
|
804
|
+
* value range (e.g. "good zone", "watch zone") behind primary layers.
|
|
805
|
+
*
|
|
806
|
+
* Default opacity is low (`var(--cngx-band-opacity, 0.12)`) so the
|
|
807
|
+
* band sits behind line / area / bar layers without dominating.
|
|
808
|
+
*
|
|
809
|
+
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
810
|
+
*/
|
|
811
|
+
declare class CngxBand {
|
|
812
|
+
readonly from: _angular_core.InputSignal<number>;
|
|
813
|
+
readonly to: _angular_core.InputSignal<number>;
|
|
814
|
+
readonly label: _angular_core.InputSignal<string | null>;
|
|
815
|
+
readonly opacity: _angular_core.InputSignal<string | number | null>;
|
|
816
|
+
private readonly ctx;
|
|
817
|
+
protected readonly rect: _angular_core.Signal<{
|
|
818
|
+
width: number;
|
|
819
|
+
y: number;
|
|
820
|
+
height: number;
|
|
821
|
+
} | null>;
|
|
822
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBand, never>;
|
|
823
|
+
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>;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Summary input describing the chart's current data shape. Consumed by
|
|
828
|
+
* `CngxChartI18n.summary()` to produce the `aria-label` text the
|
|
829
|
+
* `<cngx-chart>` host announces to screen readers.
|
|
830
|
+
*/
|
|
831
|
+
interface CngxChartSummary {
|
|
832
|
+
readonly trend: 'up' | 'down' | 'flat';
|
|
833
|
+
readonly min: number;
|
|
834
|
+
readonly max: number;
|
|
835
|
+
readonly current: number;
|
|
836
|
+
readonly thresholds: readonly number[];
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* i18n surface for `@cngx/common/chart`. Mirrors the `CNGX_RECYCLER_I18N`
|
|
840
|
+
* shape from `@cngx/common/data` — factory defaults supply English;
|
|
841
|
+
* consumers override per-app via {@link provideChartI18n}.
|
|
842
|
+
*/
|
|
843
|
+
interface CngxChartI18n {
|
|
844
|
+
readonly summary: (input: CngxChartSummary) => string;
|
|
845
|
+
readonly dataTable: () => string;
|
|
846
|
+
readonly valueColumnLabel: () => string;
|
|
847
|
+
readonly trendChanged: (trend: 'up' | 'down' | 'flat') => string;
|
|
848
|
+
readonly thresholdAlert: (threshold: number) => string;
|
|
849
|
+
readonly empty: () => string;
|
|
850
|
+
readonly loading: () => string;
|
|
851
|
+
readonly error: () => string;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Injection token for chart i18n strings. Defaults to English via
|
|
855
|
+
* `factory:`. Override at app root with {@link provideChartI18n}.
|
|
856
|
+
*/
|
|
857
|
+
declare const CNGX_CHART_I18N: InjectionToken<CngxChartI18n>;
|
|
858
|
+
/**
|
|
859
|
+
* Provider helper for custom chart i18n strings.
|
|
860
|
+
*
|
|
861
|
+
* ```typescript
|
|
862
|
+
* providers: [provideChartI18n({
|
|
863
|
+
* summary: ({ trend, min, max, current, thresholds }) =>
|
|
864
|
+
* `${trend === 'up' ? 'Aufwärtstrend' : 'Abwärtstrend'}. Min ${min}, Max ${max}, aktuell ${current}.`,
|
|
865
|
+
* dataTable: () => 'Datentabelle',
|
|
866
|
+
* // ...remaining keys
|
|
867
|
+
* })]
|
|
868
|
+
* ```
|
|
869
|
+
*/
|
|
870
|
+
declare function provideChartI18n(i18n: CngxChartI18n): {
|
|
871
|
+
provide: typeof CNGX_CHART_I18N;
|
|
872
|
+
useValue: CngxChartI18n;
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Inline sparkline — a tiny line chart for KPI cards and dashboard
|
|
877
|
+
* tiles. Composes `<cngx-chart>` + `<cngx-line>` (+ optional
|
|
878
|
+
* `<cngx-area>`) with hidden axes that publish the scale domain
|
|
879
|
+
* derived from the `data` array.
|
|
880
|
+
*
|
|
881
|
+
* Default viewBox is 80×24, intended for inline placement next to a
|
|
882
|
+
* label or numeric value. Theming via `--cngx-sparkline-color`
|
|
883
|
+
* (atom-local) → `--cngx-chart-primary` (chart-level) cascade.
|
|
884
|
+
*
|
|
885
|
+
* The host carries `role="img"` and a reactive `aria-label` derived
|
|
886
|
+
* from the chart's auto-Summary; consumers can override via
|
|
887
|
+
* `[ariaLabel]`.
|
|
888
|
+
*/
|
|
889
|
+
declare class CngxSparkline {
|
|
890
|
+
readonly data: _angular_core.InputSignal<readonly number[]>;
|
|
891
|
+
readonly width: _angular_core.InputSignal<number>;
|
|
892
|
+
readonly height: _angular_core.InputSignal<number>;
|
|
893
|
+
readonly strokeWidth: _angular_core.InputSignal<string | number | null>;
|
|
894
|
+
readonly showArea: _angular_core.InputSignal<boolean>;
|
|
895
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly number[]> | undefined>;
|
|
896
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
897
|
+
private readonly preset;
|
|
898
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
899
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
900
|
+
protected readonly xDomain: _angular_core.Signal<readonly number[]>;
|
|
901
|
+
protected readonly yDomain: _angular_core.Signal<readonly number[]>;
|
|
902
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSparkline, never>;
|
|
903
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxSparkline, "cngx-sparkline", ["cngxSparkline"], { "data": { "alias": "data"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "showArea": { "alias": "showArea"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Mini horizontal bar — a single-value bounded indicator. Renders
|
|
908
|
+
* pure DOM (no SVG), positioned with CSS only. Host carries
|
|
909
|
+
* `role="meter"` per the WAI-ARIA pattern for single-value bounded
|
|
910
|
+
* indicators; `aria-valuenow` / `aria-valuemin` / `aria-valuemax`
|
|
911
|
+
* tell AT the exact reading without a separate Summary.
|
|
912
|
+
*/
|
|
913
|
+
declare class CngxMiniBar {
|
|
914
|
+
readonly value: _angular_core.InputSignal<number>;
|
|
915
|
+
readonly max: _angular_core.InputSignal<number>;
|
|
916
|
+
readonly min: _angular_core.InputSignal<number>;
|
|
917
|
+
readonly label: _angular_core.InputSignal<string | null>;
|
|
918
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
919
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
920
|
+
private readonly preset;
|
|
921
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
922
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
923
|
+
protected readonly percent: _angular_core.Signal<number>;
|
|
924
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMiniBar, never>;
|
|
925
|
+
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>;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Mini deviation bar — a single-value indicator that diverges from a
|
|
930
|
+
* `[baseline]` (default `0`) in either direction. Negative deviations
|
|
931
|
+
* render to the left of the baseline mark, positive to the right.
|
|
932
|
+
* Pure DOM, no SVG. Host carries `role="meter"`.
|
|
933
|
+
*
|
|
934
|
+
* Use cases: budget variance ("$+45k over"), score deltas ("−12%
|
|
935
|
+
* vs target"), KPI swing visualisations.
|
|
936
|
+
*/
|
|
937
|
+
declare class CngxDeviationBar {
|
|
938
|
+
readonly value: _angular_core.InputSignal<number>;
|
|
939
|
+
readonly baseline: _angular_core.InputSignal<number>;
|
|
940
|
+
readonly magnitude: _angular_core.InputSignal<number>;
|
|
941
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
942
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
943
|
+
private readonly preset;
|
|
944
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
945
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
946
|
+
protected readonly geometry: _angular_core.Signal<{
|
|
947
|
+
positive: boolean;
|
|
948
|
+
left: number;
|
|
949
|
+
width: number;
|
|
950
|
+
} | null>;
|
|
951
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDeviationBar, never>;
|
|
952
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxDeviationBar, "cngx-deviation-bar", ["cngxDeviationBar"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "baseline": { "alias": "baseline"; "required": false; "isSignal": true; }; "magnitude": { "alias": "magnitude"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Inline mini area — a tiny filled-area chart for KPI cards. Sibling
|
|
957
|
+
* of {@link CngxSparkline}; renders only the area (no line stroke).
|
|
958
|
+
* Default viewBox 80×24. Theming via `--cngx-mini-area-color`
|
|
959
|
+
* (atom-local) → `--cngx-chart-primary` (chart-level) cascade.
|
|
960
|
+
*/
|
|
961
|
+
declare class CngxMiniArea {
|
|
962
|
+
readonly data: _angular_core.InputSignal<readonly number[]>;
|
|
963
|
+
readonly width: _angular_core.InputSignal<number>;
|
|
964
|
+
readonly height: _angular_core.InputSignal<number>;
|
|
965
|
+
readonly opacity: _angular_core.InputSignal<string | number | null>;
|
|
966
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly number[]> | undefined>;
|
|
967
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
968
|
+
private readonly preset;
|
|
969
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
970
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
971
|
+
protected readonly xDomain: _angular_core.Signal<readonly number[]>;
|
|
972
|
+
protected readonly yDomain: _angular_core.Signal<readonly number[]>;
|
|
973
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMiniArea, never>;
|
|
974
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxMiniArea, "cngx-mini-area", ["cngxMiniArea"], { "data": { "alias": "data"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "opacity": { "alias": "opacity"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Circular donut gauge — a single-value bounded indicator. Renders a
|
|
979
|
+
* background ring + a foreground arc whose length is proportional to
|
|
980
|
+
* `value / max`. Host carries `role="meter"`; the optional `[label]`
|
|
981
|
+
* input renders an SR-only label inside the ring's centre.
|
|
982
|
+
*/
|
|
983
|
+
declare class CngxDonut {
|
|
984
|
+
readonly value: _angular_core.InputSignal<number>;
|
|
985
|
+
readonly max: _angular_core.InputSignal<number>;
|
|
986
|
+
readonly size: _angular_core.InputSignal<number>;
|
|
987
|
+
readonly thickness: _angular_core.InputSignal<number>;
|
|
988
|
+
readonly label: _angular_core.InputSignal<string | null>;
|
|
989
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
990
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
991
|
+
private readonly preset;
|
|
992
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
993
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
994
|
+
protected readonly center: _angular_core.Signal<number>;
|
|
995
|
+
protected readonly radius: _angular_core.Signal<number>;
|
|
996
|
+
protected readonly circumference: _angular_core.Signal<number>;
|
|
997
|
+
protected readonly dasharray: _angular_core.Signal<string>;
|
|
998
|
+
protected readonly dashoffset: _angular_core.Signal<number>;
|
|
999
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDonut, never>;
|
|
1000
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxDonut, "cngx-donut", ["cngxDonut"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "thickness": { "alias": "thickness"; "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>;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Bullet chart range entry — a colour band stretching from one value
|
|
1005
|
+
* to another along the bullet's axis. Typical use: traffic-light
|
|
1006
|
+
* bands ("good" / "fair" / "poor") behind the actual+target bar.
|
|
1007
|
+
*/
|
|
1008
|
+
interface CngxBulletRange {
|
|
1009
|
+
readonly from: number;
|
|
1010
|
+
readonly to: number;
|
|
1011
|
+
readonly color?: string;
|
|
1012
|
+
readonly label?: string;
|
|
1013
|
+
}
|
|
1014
|
+
interface RangeRendering {
|
|
1015
|
+
readonly key: string;
|
|
1016
|
+
readonly left: number;
|
|
1017
|
+
readonly width: number;
|
|
1018
|
+
readonly color: string | null;
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Bullet chart — Stephen Few's compact KPI visualisation. Three
|
|
1022
|
+
* stacked layers: background `[ranges]` (qualitative bands), an
|
|
1023
|
+
* `[actual]` filled bar, and a `[target]` vertical marker. Pure DOM,
|
|
1024
|
+
* no SVG. Host carries `role="meter"`.
|
|
1025
|
+
*/
|
|
1026
|
+
declare class CngxBullet {
|
|
1027
|
+
readonly actual: _angular_core.InputSignal<number>;
|
|
1028
|
+
readonly target: _angular_core.InputSignal<number | null>;
|
|
1029
|
+
readonly max: _angular_core.InputSignal<number | null>;
|
|
1030
|
+
readonly ranges: _angular_core.InputSignal<readonly CngxBulletRange[]>;
|
|
1031
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
1032
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
1033
|
+
private readonly preset;
|
|
1034
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
1035
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
1036
|
+
protected readonly maxValue: _angular_core.Signal<number>;
|
|
1037
|
+
protected readonly actualPercent: _angular_core.Signal<number>;
|
|
1038
|
+
protected readonly targetPercent: _angular_core.Signal<number>;
|
|
1039
|
+
protected readonly rangeRenderings: _angular_core.Signal<readonly RangeRendering[]>;
|
|
1040
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBullet, never>;
|
|
1041
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBullet, "cngx-bullet", ["cngxBullet"], { "actual": { "alias": "actual"; "required": true; "isSignal": true; }; "target": { "alias": "target"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "ranges": { "alias": "ranges"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/** One segment in a stacked-bar series: a value, a label, optional colour. */
|
|
1045
|
+
interface CngxStackedSegment {
|
|
1046
|
+
readonly value: number;
|
|
1047
|
+
readonly color?: string;
|
|
1048
|
+
readonly label: string;
|
|
1049
|
+
}
|
|
1050
|
+
interface SegmentRendering {
|
|
1051
|
+
readonly key: string;
|
|
1052
|
+
readonly left: number;
|
|
1053
|
+
readonly width: number;
|
|
1054
|
+
readonly color: string | null;
|
|
1055
|
+
readonly label: string;
|
|
1056
|
+
readonly value: number;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Single-bar stacked composition — visualises proportional shares of
|
|
1060
|
+
* a fixed total. Pure DOM, no SVG. Host carries `role="img"` because
|
|
1061
|
+
* a stacked bar communicates a multi-segment ratio, not a single
|
|
1062
|
+
* bounded reading; the SR description enumerates segments via the
|
|
1063
|
+
* auto-generated `aria-label` (or the `[ariaLabel]` override).
|
|
1064
|
+
*/
|
|
1065
|
+
declare class CngxStackedBar {
|
|
1066
|
+
readonly segments: _angular_core.InputSignal<readonly CngxStackedSegment[]>;
|
|
1067
|
+
readonly total: _angular_core.InputSignal<number | null>;
|
|
1068
|
+
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly CngxStackedSegment[]> | undefined>;
|
|
1069
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
1070
|
+
private readonly preset;
|
|
1071
|
+
protected readonly i18n: _cngx_common_chart.CngxChartI18n;
|
|
1072
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
1073
|
+
protected readonly resolvedTotal: _angular_core.Signal<number>;
|
|
1074
|
+
protected readonly segmentRenderings: _angular_core.Signal<readonly SegmentRendering[]>;
|
|
1075
|
+
protected readonly effectiveAriaLabel: _angular_core.Signal<string>;
|
|
1076
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStackedBar, never>;
|
|
1077
|
+
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>;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
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 };
|
|
1081
|
+
export type { BandScale, BarYAccessor, CngxAxisPosition, CngxAxisType, CngxBulletRange, CngxChartContext, CngxChartErrorContext, CngxChartI18n, CngxChartLegendItem, CngxChartSlotContext, CngxChartSummary, CngxCurve, CngxStackedSegment, LineXAccessor, LineYAccessor, PathBuilder, PathBuilderOptions, PathPoint, ScaleFn, ScatterXAccessor, ScatterYAccessor, XScaleInput };
|