@cngx/common 0.1.0-rc.7 → 0.1.0-rc.9
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/card/README.md +2 -1
- package/command/README.md +29 -0
- package/data/README.md +15 -3
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +517 -184
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +62 -17
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +301 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1221 -479
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +97 -16
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1496 -499
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +236 -61
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +364 -93
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2040 -1046
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +955 -125
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +1293 -89
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +997 -453
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1794 -1265
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +151 -61
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +37 -1
- package/package.json +20 -7
- package/popover/README.md +58 -2
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +91 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +11 -8
- package/theming/components/cngx-accordion.css +1 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-button-toggle.css +29 -3
- package/theming/components/cngx-data-grid.css +168 -1
- package/theming/components/cngx-dialog.css +13 -0
- package/theming/components/cngx-listbox.css +21 -12
- package/theming/components/cngx-menu.css +56 -16
- package/theming/components/cngx-popover-sheet.css +402 -0
- package/theming/components/cngx-popover.css +28 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +12 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +205 -28
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +345 -48
- package/types/cngx-common-command.d.ts +50 -10
- package/types/cngx-common-data.d.ts +743 -92
- package/types/cngx-common-dialog.d.ts +161 -10
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +910 -226
- package/types/cngx-common-layout.d.ts +603 -32
- package/types/cngx-common-popover.d.ts +612 -49
- package/types/cngx-common-stepper.d.ts +526 -237
- package/types/cngx-common-tabs.d.ts +358 -75
- package/types/cngx-common-timeline.d.ts +108 -22
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { CngxRuntimeError, clamp, cngxDevWarn, arrayEqual } from '@cngx/utils';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, DestroyRef, signal, computed, InjectionToken, input, ViewEncapsulation, ChangeDetectionStrategy, Component, TemplateRef, Directive, linkedSignal, untracked, effect, ElementRef, contentChildren, contentChild,
|
|
3
|
+
import { inject, DestroyRef, signal, computed, InjectionToken, input, ViewEncapsulation, ChangeDetectionStrategy, Component, TemplateRef, Directive, linkedSignal, untracked, effect, ElementRef, contentChildren, contentChild, afterNextRender } from '@angular/core';
|
|
3
4
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
5
|
import * as i1 from '@cngx/common/layout';
|
|
5
6
|
import { CngxResizeObserver } from '@cngx/common/layout';
|
|
6
7
|
import { resolveAsyncView } from '@cngx/common/data';
|
|
7
|
-
import { nextUid } from '@cngx/core/utils';
|
|
8
|
+
import { numberFormatterFor, createOverrideMerge, nextUid, injectLocale, createMediaQuerySignal, createTransitionTracker, dateTimeFormatterFor } from '@cngx/core/utils';
|
|
9
|
+
import { formatMessage, createLanguageSection, createSectionBundle } from '@cngx/core/i18n';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Pure-TS linear scale. Maps a numeric domain `[d0, d1]` to a numeric
|
|
@@ -69,7 +71,10 @@ function createBandScale(domain, range, padding = 0) {
|
|
|
69
71
|
const n = domain.length;
|
|
70
72
|
const span = r1 - r0;
|
|
71
73
|
const slot = n === 0 ? 0 : span / n;
|
|
72
|
-
|
|
74
|
+
// Clamp to the documented [0, 1) contract: padding >= 1 would flip
|
|
75
|
+
// the bandwidth negative and a negative padding would overlap bands.
|
|
76
|
+
const p = Math.min(Math.max(padding, 0), 1);
|
|
77
|
+
const inner = slot * (1 - p);
|
|
73
78
|
const offset = (slot - inner) / 2;
|
|
74
79
|
const lookup = new Map();
|
|
75
80
|
for (let i = 0; i < n; i++) {
|
|
@@ -90,7 +95,8 @@ function createBandScale(domain, range, padding = 0) {
|
|
|
90
95
|
* @param domain Ordered list of categorical values. Values are matched
|
|
91
96
|
* by reference equality on lookup.
|
|
92
97
|
* @param colors Palette to cycle through. Must have at least one entry;
|
|
93
|
-
* an empty palette throws
|
|
98
|
+
* an empty palette throws a `CngxRuntimeError` (`CNGX1049`)
|
|
99
|
+
* synchronously at construction time.
|
|
94
100
|
* @returns Callable `(v: T) => string` returning the palette entry for
|
|
95
101
|
* `v`. Lookup of an unknown value returns the palette's first entry.
|
|
96
102
|
*
|
|
@@ -98,7 +104,9 @@ function createBandScale(domain, range, padding = 0) {
|
|
|
98
104
|
*/
|
|
99
105
|
function createOrdinalScale(domain, colors) {
|
|
100
106
|
if (colors.length === 0) {
|
|
101
|
-
throw new
|
|
107
|
+
throw new CngxRuntimeError('CNGX1049', typeof ngDevMode !== 'undefined' &&
|
|
108
|
+
ngDevMode &&
|
|
109
|
+
'createOrdinalScale(): colors palette must not be empty');
|
|
102
110
|
}
|
|
103
111
|
const lookup = new Map();
|
|
104
112
|
for (let i = 0; i < domain.length; i++) {
|
|
@@ -288,13 +296,16 @@ function slotContextEqual(a, b) {
|
|
|
288
296
|
* is allocated once; no growth, no per-push allocation.
|
|
289
297
|
*
|
|
290
298
|
* @param capacity positive integer maximum element count.
|
|
291
|
-
* @throws when `capacity` is not a positive
|
|
299
|
+
* @throws `CngxRuntimeError` (`CNGX1050`) when `capacity` is not a positive
|
|
300
|
+
* integer.
|
|
292
301
|
*
|
|
293
302
|
* @category common/chart/buffer
|
|
294
303
|
*/
|
|
295
304
|
function createRingBuffer(capacity) {
|
|
296
305
|
if (!Number.isInteger(capacity) || capacity <= 0) {
|
|
297
|
-
throw new
|
|
306
|
+
throw new CngxRuntimeError('CNGX1050', typeof ngDevMode !== 'undefined' &&
|
|
307
|
+
ngDevMode &&
|
|
308
|
+
`createRingBuffer(): capacity must be a positive integer, got ${capacity}`);
|
|
298
309
|
}
|
|
299
310
|
const store = new Array(capacity);
|
|
300
311
|
let head = 0; // next write slot
|
|
@@ -388,6 +399,12 @@ function injectChartBuffer(opts) {
|
|
|
388
399
|
if (rafHandle !== null) {
|
|
389
400
|
return;
|
|
390
401
|
}
|
|
402
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
403
|
+
// SSR / non-browser: there is no frame to coalesce onto, so flush
|
|
404
|
+
// synchronously instead of dropping the push on the floor.
|
|
405
|
+
flush();
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
391
408
|
pending.set(true);
|
|
392
409
|
rafHandle = requestAnimationFrame(flush);
|
|
393
410
|
}
|
|
@@ -446,19 +463,26 @@ const CNGX_CHART_AXIS = new InjectionToken('CNGX_CHART_AXIS');
|
|
|
446
463
|
*/
|
|
447
464
|
const CNGX_CHART_CONTEXT = new InjectionToken('CngxChartContext');
|
|
448
465
|
/**
|
|
449
|
-
* Inject the parent chart's reactive context. Throws a
|
|
450
|
-
*
|
|
451
|
-
* `<cngx-chart
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
466
|
+
* Inject the parent chart's reactive context. Throws a `CngxRuntimeError`
|
|
467
|
+
* with code `CNGX1048` when the consumer is not mounted as a content child
|
|
468
|
+
* of `<cngx-chart>`, in development and production alike. The `selector`
|
|
469
|
+
* argument is the consumer's public selector without brackets (`'cngxLine'`)
|
|
470
|
+
* and names it in the development message.
|
|
471
|
+
*
|
|
472
|
+
* Use it from custom layer directives mounted on `<svg:g>` hosts to
|
|
473
|
+
* read `plot`, the scales and `renderSvg` the same way the built-in
|
|
474
|
+
* layer atoms do.
|
|
475
|
+
*
|
|
476
|
+
* @category common/chart
|
|
477
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
478
|
+
* @since 0.1.0
|
|
457
479
|
*/
|
|
458
|
-
function injectChartContext(
|
|
480
|
+
function injectChartContext(selector) {
|
|
459
481
|
const ctx = inject(CNGX_CHART_CONTEXT, { optional: true });
|
|
460
482
|
if (!ctx) {
|
|
461
|
-
throw new
|
|
483
|
+
throw new CngxRuntimeError('CNGX1048', typeof ngDevMode !== 'undefined' &&
|
|
484
|
+
ngDevMode &&
|
|
485
|
+
`[${selector}] must be placed inside <cngx-chart>.`);
|
|
462
486
|
}
|
|
463
487
|
return ctx;
|
|
464
488
|
}
|
|
@@ -505,7 +529,8 @@ class CngxThreshold {
|
|
|
505
529
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
506
530
|
label = input(null, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
507
531
|
dashed = input(false, ...(ngDevMode ? [{ debugName: "dashed" }] : /* istanbul ignore next */ []));
|
|
508
|
-
|
|
532
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
533
|
+
ctx = injectChartContext('cngxThreshold');
|
|
509
534
|
bounds = computed(() => {
|
|
510
535
|
// Spans the plot, not the box - a threshold line running under
|
|
511
536
|
// the left axis's tick labels reads as a stray rule through the
|
|
@@ -526,12 +551,12 @@ class CngxThreshold {
|
|
|
526
551
|
y1: y,
|
|
527
552
|
x2: b?.x2 ?? 0,
|
|
528
553
|
y2: y,
|
|
529
|
-
color:
|
|
554
|
+
color: this.color(),
|
|
530
555
|
dashed: this.dashed(),
|
|
531
556
|
};
|
|
532
557
|
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: thresholdGeomEqual });
|
|
533
558
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxThreshold, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
534
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxThreshold, isStandalone: true, selector: "[cngxThreshold]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dashed: { classPropertyName: "dashed", publicName: "dashed", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxThreshold }], exportAs: ["cngxThreshold"], ngImport: i0, template: `
|
|
559
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxThreshold, isStandalone: true, selector: "[cngxThreshold]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dashed: { classPropertyName: "dashed", publicName: "dashed", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxThreshold }], exportAs: ["cngxThreshold"], ngImport: i0, template: `
|
|
535
560
|
@if (bounds(); as g) {
|
|
536
561
|
@if (ctx.renderSvg()) {
|
|
537
562
|
<svg:line
|
|
@@ -540,6 +565,7 @@ class CngxThreshold {
|
|
|
540
565
|
[attr.y1]="g.y"
|
|
541
566
|
[attr.x2]="g.x2"
|
|
542
567
|
[attr.y2]="g.y"
|
|
568
|
+
[style.stroke]="color()"
|
|
543
569
|
[attr.stroke-dasharray]="dashed() ? '4 3' : null"
|
|
544
570
|
/>
|
|
545
571
|
}
|
|
@@ -561,7 +587,7 @@ class CngxThreshold {
|
|
|
561
587
|
</svg:text>
|
|
562
588
|
}
|
|
563
589
|
}
|
|
564
|
-
`, isInline: true, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
590
|
+
`, isInline: true, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}@media(forced-colors:active){.cngx-threshold__line{stroke:CanvasText!important}.cngx-threshold__label{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
565
591
|
}
|
|
566
592
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxThreshold, decorators: [{
|
|
567
593
|
type: Component,
|
|
@@ -574,6 +600,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
574
600
|
[attr.y1]="g.y"
|
|
575
601
|
[attr.x2]="g.x2"
|
|
576
602
|
[attr.y2]="g.y"
|
|
603
|
+
[style.stroke]="color()"
|
|
577
604
|
[attr.stroke-dasharray]="dashed() ? '4 3' : null"
|
|
578
605
|
/>
|
|
579
606
|
}
|
|
@@ -595,8 +622,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
595
622
|
</svg:text>
|
|
596
623
|
}
|
|
597
624
|
}
|
|
598
|
-
`, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}\n"] }]
|
|
599
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], dashed: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashed", required: false }] }] } });
|
|
625
|
+
`, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}@media(forced-colors:active){.cngx-threshold__line{stroke:CanvasText!important}.cngx-threshold__label{fill:CanvasText}}\n"] }]
|
|
626
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], dashed: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashed", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
600
627
|
/** @internal */
|
|
601
628
|
function thresholdGeomEqual(a, b) {
|
|
602
629
|
if (a === b) {
|
|
@@ -613,9 +640,146 @@ function thresholdGeomEqual(a, b) {
|
|
|
613
640
|
a.dashed === b.dashed);
|
|
614
641
|
}
|
|
615
642
|
|
|
643
|
+
const FRACTION_OPTIONS = {
|
|
644
|
+
maximumSignificantDigits: 12,
|
|
645
|
+
useGrouping: false,
|
|
646
|
+
};
|
|
647
|
+
const INTEGER_OPTIONS = {
|
|
648
|
+
maximumFractionDigits: 0,
|
|
649
|
+
useGrouping: false,
|
|
650
|
+
};
|
|
616
651
|
/**
|
|
617
|
-
*
|
|
618
|
-
*
|
|
652
|
+
* Strip floating-point arithmetic noise from a number destined for
|
|
653
|
+
* human-facing text and format it in `locale`: `6.6000000000000005`
|
|
654
|
+
* becomes `'6.6'` (`'6,6'` in `de`), `2.2` stays `'2.2'`, `25` stays
|
|
655
|
+
* `'25'`. 12 significant digits keep every sensible chart value intact
|
|
656
|
+
* while collapsing the trailing 1e-15 noise accumulated float math
|
|
657
|
+
* produces; integers keep every digit. No grouping, so en-US output
|
|
658
|
+
* matches the plain `String(v)` it replaced for every value `String`
|
|
659
|
+
* prints without an exponent; exponential magnitudes print positionally
|
|
660
|
+
* instead (`1e-7` -> `0.0000001`, `1e21` -> 22 digits). Non-finite values
|
|
661
|
+
* format in `locale` too (`∞`, `-∞`, `NaN`), never as the English
|
|
662
|
+
* `Infinity`.
|
|
663
|
+
*
|
|
664
|
+
* Shared by the default axis tick formatter, the default i18n summary
|
|
665
|
+
* and the SR data table, so all three read the same value the same way.
|
|
666
|
+
*
|
|
667
|
+
* @internal
|
|
668
|
+
*/
|
|
669
|
+
function formatChartNumber(v, locale) {
|
|
670
|
+
const options = Number.isInteger(v) ? INTEGER_OPTIONS : FRACTION_OPTIONS;
|
|
671
|
+
// Intl prints -0 as "-0"; String(-0) is "0".
|
|
672
|
+
return numberFormatterFor(locale, options).format(v === 0 ? 0 : v);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* The English chart section: the single source of the chart's English copy.
|
|
677
|
+
* `CNGX_CHART_I18N` defaults to it.
|
|
678
|
+
*
|
|
679
|
+
* @category common/chart/i18n
|
|
680
|
+
* @since 0.1.0
|
|
681
|
+
* @relatedTo CNGX_CHART_I18N
|
|
682
|
+
*/
|
|
683
|
+
const CNGX_CHART_LANGUAGE_EN = {
|
|
684
|
+
summary: '{trend}. Min {min}, max {max}, current {current}. {thresholds}',
|
|
685
|
+
summaryTrendUp: 'Trending up',
|
|
686
|
+
summaryTrendDown: 'Trending down',
|
|
687
|
+
summaryTrendFlat: 'Flat',
|
|
688
|
+
summaryNoThresholds: 'No thresholds.',
|
|
689
|
+
summaryThresholds: { one: 'One threshold crossing.', other: '{count} threshold crossings.' },
|
|
690
|
+
dataTable: 'Data table',
|
|
691
|
+
indexColumnLabel: '#',
|
|
692
|
+
valueColumnLabel: 'Value',
|
|
693
|
+
trendChangedUp: 'Trend changed to up',
|
|
694
|
+
trendChangedDown: 'Trend changed to down',
|
|
695
|
+
trendFlattened: 'Trend flattened',
|
|
696
|
+
thresholdAlert: 'Threshold {threshold} crossed',
|
|
697
|
+
connectionLost: 'Connection lost',
|
|
698
|
+
connectionReconnecting: 'Reconnecting',
|
|
699
|
+
connectionRestored: 'Connection restored',
|
|
700
|
+
empty: 'No data',
|
|
701
|
+
loading: 'Loading',
|
|
702
|
+
error: 'Error loading chart',
|
|
703
|
+
stackedBarEmpty: 'Empty stacked bar',
|
|
704
|
+
stackedBarSummary: 'Total {total}. {segments}.',
|
|
705
|
+
stackedBarSegmentTitle: '{label}: {value}',
|
|
706
|
+
listSeparator: ', ',
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
/** @internal The section word for each trend in the summary sentence. */
|
|
710
|
+
const SUMMARY_TREND_KEY = {
|
|
711
|
+
up: 'summaryTrendUp',
|
|
712
|
+
down: 'summaryTrendDown',
|
|
713
|
+
flat: 'summaryTrendFlat',
|
|
714
|
+
};
|
|
715
|
+
/** @internal The section phrase announced when the trend changes. */
|
|
716
|
+
const TREND_CHANGED_KEY = {
|
|
717
|
+
up: 'trendChangedUp',
|
|
718
|
+
down: 'trendChangedDown',
|
|
719
|
+
flat: 'trendFlattened',
|
|
720
|
+
};
|
|
721
|
+
/** @internal Turns a chart section into the token's keys for a locale. */
|
|
722
|
+
function chartBundleFrom(section, locale) {
|
|
723
|
+
const num = (v) => formatChartNumber(v, locale);
|
|
724
|
+
const segmentTitle = (label, value) => formatMessage(section.stackedBarSegmentTitle, { label, value }, locale);
|
|
725
|
+
return {
|
|
726
|
+
summary: ({ trend, min, max, current, thresholds }) => {
|
|
727
|
+
const trendText = section[SUMMARY_TREND_KEY[trend]];
|
|
728
|
+
const thresholdText = thresholds.length === 0
|
|
729
|
+
? section.summaryNoThresholds
|
|
730
|
+
: formatMessage(section.summaryThresholds, { count: thresholds.length }, locale);
|
|
731
|
+
return formatMessage(section.summary, {
|
|
732
|
+
trend: trendText,
|
|
733
|
+
min: num(min),
|
|
734
|
+
max: num(max),
|
|
735
|
+
current: num(current),
|
|
736
|
+
thresholds: thresholdText,
|
|
737
|
+
}, locale);
|
|
738
|
+
},
|
|
739
|
+
dataTable: () => section.dataTable,
|
|
740
|
+
indexColumnLabel: () => section.indexColumnLabel,
|
|
741
|
+
valueColumnLabel: () => section.valueColumnLabel,
|
|
742
|
+
trendChanged: (trend) => section[TREND_CHANGED_KEY[trend]],
|
|
743
|
+
thresholdAlert: (threshold) => formatMessage(section.thresholdAlert, { threshold: num(threshold) }, locale),
|
|
744
|
+
connectionLost: () => section.connectionLost,
|
|
745
|
+
connectionReconnecting: () => section.connectionReconnecting,
|
|
746
|
+
connectionRestored: () => section.connectionRestored,
|
|
747
|
+
empty: () => section.empty,
|
|
748
|
+
loading: () => section.loading,
|
|
749
|
+
error: () => section.error,
|
|
750
|
+
stackedBarEmpty: () => section.stackedBarEmpty,
|
|
751
|
+
stackedBarSummary: (total, segments) => formatMessage(section.stackedBarSummary, {
|
|
752
|
+
total: num(total),
|
|
753
|
+
segments: segments
|
|
754
|
+
.map((s) => segmentTitle(s.label, num(s.value)))
|
|
755
|
+
.join(section.listSeparator),
|
|
756
|
+
}, locale),
|
|
757
|
+
stackedBarSegmentTitle: segmentTitle,
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* The default chart copy for one section and one number locale - the single
|
|
762
|
+
* source every fallback path resolves against. Numbers inside the copy
|
|
763
|
+
* (summary min / max / current, threshold, stacked-bar values) format in
|
|
764
|
+
* `locale`; the words come from `section`.
|
|
765
|
+
*
|
|
766
|
+
* @internal
|
|
767
|
+
*/
|
|
768
|
+
const createChartI18nDefaults = chartBundleFrom;
|
|
769
|
+
/** @internal The English chart section with the active pack's chart section on top. */
|
|
770
|
+
const injectChartSection = createLanguageSection('chart', CNGX_CHART_LANGUAGE_EN);
|
|
771
|
+
/** @internal Builds and reads the token, formatted for the reading locale. */
|
|
772
|
+
const chartBundle = createSectionBundle({
|
|
773
|
+
section: injectChartSection,
|
|
774
|
+
toBundle: chartBundleFrom,
|
|
775
|
+
});
|
|
776
|
+
/**
|
|
777
|
+
* Injection token for chart i18n strings, a `Signal` so the copy follows a
|
|
778
|
+
* runtime language switch. Defaults to English via `factory:`, with numbers
|
|
779
|
+
* in the root app locale (`CNGX_LOCALE`, falling back to `LOCALE_ID`), read
|
|
780
|
+
* live. Override at app root with {@link provideChartI18n}; every key left
|
|
781
|
+
* at its default still follows the app locale at the use site, including a
|
|
782
|
+
* runtime `CNGX_LOCALE` flip.
|
|
619
783
|
*
|
|
620
784
|
* @category common/chart/i18n
|
|
621
785
|
* @wcag AA
|
|
@@ -624,48 +788,55 @@ function thresholdGeomEqual(a, b) {
|
|
|
624
788
|
*/
|
|
625
789
|
const CNGX_CHART_I18N = new InjectionToken('CngxChartI18n', {
|
|
626
790
|
providedIn: 'root',
|
|
627
|
-
factory: () => (
|
|
628
|
-
summary: ({ trend, min, max, current, thresholds }) => {
|
|
629
|
-
const trendText = trend === 'up' ? 'Trending up' : trend === 'down' ? 'Trending down' : 'Flat';
|
|
630
|
-
const thresholdText = thresholds.length === 0
|
|
631
|
-
? 'No thresholds.'
|
|
632
|
-
: thresholds.length === 1
|
|
633
|
-
? 'One threshold crossing.'
|
|
634
|
-
: `${thresholds.length} threshold crossings.`;
|
|
635
|
-
return `${trendText}. Min ${min}, max ${max}, current ${current}. ${thresholdText}`;
|
|
636
|
-
},
|
|
637
|
-
dataTable: () => 'Data table',
|
|
638
|
-
valueColumnLabel: () => 'Value',
|
|
639
|
-
trendChanged: (trend) => trend === 'up'
|
|
640
|
-
? 'Trend changed to up'
|
|
641
|
-
: trend === 'down'
|
|
642
|
-
? 'Trend changed to down'
|
|
643
|
-
: 'Trend flattened',
|
|
644
|
-
thresholdAlert: (threshold) => `Threshold ${threshold} crossed`,
|
|
645
|
-
connectionLost: () => 'Connection lost',
|
|
646
|
-
connectionReconnecting: () => 'Reconnecting',
|
|
647
|
-
connectionRestored: () => 'Connection restored',
|
|
648
|
-
empty: () => 'No data',
|
|
649
|
-
loading: () => 'Loading',
|
|
650
|
-
error: () => 'Error loading chart',
|
|
651
|
-
}),
|
|
791
|
+
factory: () => chartBundle.build(),
|
|
652
792
|
});
|
|
793
|
+
/** @internal */
|
|
794
|
+
function defineChartI18nFeature(fn) {
|
|
795
|
+
return Object.assign(fn, { _target: 'i18n' });
|
|
796
|
+
}
|
|
653
797
|
/**
|
|
654
|
-
*
|
|
798
|
+
* Override chart copy via a partial bundle - unset keys keep the language
|
|
799
|
+
* pack's copy, or the English default, and keep following the app locale.
|
|
800
|
+
* Pass a `Signal` to switch the language at runtime.
|
|
801
|
+
*
|
|
802
|
+
* @category common/chart/i18n
|
|
803
|
+
*/
|
|
804
|
+
function withChartI18nLabels(overrides) {
|
|
805
|
+
return defineChartI18nFeature((bundle) => createOverrideMerge(bundle, overrides));
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Provider for the chart i18n bundle. The features apply on top of the
|
|
809
|
+
* active language pack, so a consumer localises only the keys they care
|
|
810
|
+
* about; every key left out keeps the pack's copy and follows the app locale.
|
|
655
811
|
*
|
|
656
812
|
* ```typescript
|
|
657
|
-
* providers: [
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
813
|
+
* providers: [
|
|
814
|
+
* provideChartI18n(
|
|
815
|
+
* withChartI18nLabels({
|
|
816
|
+
* dataTable: () => 'Datentabelle',
|
|
817
|
+
* }),
|
|
818
|
+
* ),
|
|
819
|
+
* ]
|
|
663
820
|
* ```
|
|
664
821
|
*
|
|
665
822
|
* @category common/chart/i18n
|
|
666
823
|
*/
|
|
667
|
-
function provideChartI18n(
|
|
668
|
-
return {
|
|
824
|
+
function provideChartI18n(...features) {
|
|
825
|
+
return {
|
|
826
|
+
provide: CNGX_CHART_I18N,
|
|
827
|
+
useFactory: () => chartBundle.build(features),
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* @internal - the chart i18n bundle for the reading site. Every key the
|
|
832
|
+
* token value leaves out, or leaves at its default, follows the use site's
|
|
833
|
+
* pack section and locale; a key the consumer set stays theirs verbatim.
|
|
834
|
+
* One signal per (token value, pack section, locale), shared by every chart
|
|
835
|
+
* part under one injector.
|
|
836
|
+
*/
|
|
837
|
+
function injectChartI18n() {
|
|
838
|
+
// resolve() fills every key the value leaves out from the complete section bundle.
|
|
839
|
+
return chartBundle.resolve(inject(CNGX_CHART_I18N));
|
|
669
840
|
}
|
|
670
841
|
|
|
671
842
|
/**
|
|
@@ -700,7 +871,8 @@ class CngxChartDataTable {
|
|
|
700
871
|
*/
|
|
701
872
|
id = input(undefined, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
702
873
|
defaultId = nextUid('cngx-chart-data-table');
|
|
703
|
-
i18n =
|
|
874
|
+
i18n = injectChartI18n();
|
|
875
|
+
locale = injectLocale();
|
|
704
876
|
/**
|
|
705
877
|
* Resolved host id - the explicit `[id]` input wins over the
|
|
706
878
|
* per-instance default. The host binding reads this signal so
|
|
@@ -708,8 +880,14 @@ class CngxChartDataTable {
|
|
|
708
880
|
* changes.
|
|
709
881
|
*/
|
|
710
882
|
resolvedId = computed(() => this.id() ?? this.defaultId, ...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
711
|
-
caption = computed(() => this.i18n.dataTable(), ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
712
|
-
|
|
883
|
+
caption = computed(() => this.i18n().dataTable(), ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
884
|
+
indexColumnLabel = computed(() => this.i18n().indexColumnLabel(), ...(ngDevMode ? [{ debugName: "indexColumnLabel" }] : /* istanbul ignore next */ []));
|
|
885
|
+
valueColumnLabel = computed(() => this.i18n().valueColumnLabel(), ...(ngDevMode ? [{ debugName: "valueColumnLabel" }] : /* istanbul ignore next */ []));
|
|
886
|
+
/** Noise-stripped display text in the app locale - see {@link formatChartNumber}. */
|
|
887
|
+
fmt = computed(() => {
|
|
888
|
+
const locale = this.locale();
|
|
889
|
+
return (v) => formatChartNumber(v, locale);
|
|
890
|
+
}, ...(ngDevMode ? [{ debugName: "fmt" }] : /* istanbul ignore next */ []));
|
|
713
891
|
rows = computed(() => {
|
|
714
892
|
const vs = this.values();
|
|
715
893
|
const out = new Array(vs.length);
|
|
@@ -741,15 +919,15 @@ class CngxChartDataTable {
|
|
|
741
919
|
</caption>
|
|
742
920
|
<thead>
|
|
743
921
|
<tr>
|
|
744
|
-
<th scope="col"
|
|
922
|
+
<th scope="col">{{ indexColumnLabel() }}</th>
|
|
745
923
|
<th scope="col">{{ valueColumnLabel() }}</th>
|
|
746
924
|
</tr>
|
|
747
925
|
</thead>
|
|
748
926
|
<tbody>
|
|
749
927
|
@for (row of rows(); track row.index) {
|
|
750
928
|
<tr>
|
|
751
|
-
<th scope="row">{{ row.index + 1 }}</th>
|
|
752
|
-
<td>{{ row.value }}</td>
|
|
929
|
+
<th scope="row">{{ fmt()(row.index + 1) }}</th>
|
|
930
|
+
<td>{{ fmt()(row.value) }}</td>
|
|
753
931
|
</tr>
|
|
754
932
|
}
|
|
755
933
|
</tbody>
|
|
@@ -770,15 +948,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
770
948
|
</caption>
|
|
771
949
|
<thead>
|
|
772
950
|
<tr>
|
|
773
|
-
<th scope="col"
|
|
951
|
+
<th scope="col">{{ indexColumnLabel() }}</th>
|
|
774
952
|
<th scope="col">{{ valueColumnLabel() }}</th>
|
|
775
953
|
</tr>
|
|
776
954
|
</thead>
|
|
777
955
|
<tbody>
|
|
778
956
|
@for (row of rows(); track row.index) {
|
|
779
957
|
<tr>
|
|
780
|
-
<th scope="row">{{ row.index + 1 }}</th>
|
|
781
|
-
<td>{{ row.value }}</td>
|
|
958
|
+
<th scope="row">{{ fmt()(row.index + 1) }}</th>
|
|
959
|
+
<td>{{ fmt()(row.value) }}</td>
|
|
782
960
|
</tr>
|
|
783
961
|
}
|
|
784
962
|
</tbody>
|
|
@@ -1009,6 +1187,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1009
1187
|
}]
|
|
1010
1188
|
}] });
|
|
1011
1189
|
|
|
1190
|
+
/**
|
|
1191
|
+
* Shared numeric helpers for the chart presets and the auto-summary.
|
|
1192
|
+
* Pure TS, no Angular dep, only the Level-0 `clamp` kernel imported -
|
|
1193
|
+
* which is why it lives in the core `chart/` folder: presets compose
|
|
1194
|
+
* `chart/`, so a helper both sides consume must not sit in `presets/`.
|
|
1195
|
+
* Internal - the presets and the summary are the API surface.
|
|
1196
|
+
*/
|
|
1197
|
+
/**
|
|
1198
|
+
* Single-pass min/max scan. Returns `null` for an empty input so the
|
|
1199
|
+
* caller decides its own fallback domain.
|
|
1200
|
+
*
|
|
1201
|
+
* @internal
|
|
1202
|
+
*/
|
|
1203
|
+
function scanMinMax(values) {
|
|
1204
|
+
if (values.length === 0) {
|
|
1205
|
+
return null;
|
|
1206
|
+
}
|
|
1207
|
+
let min = values[0];
|
|
1208
|
+
let max = values[0];
|
|
1209
|
+
for (let i = 1; i < values.length; i++) {
|
|
1210
|
+
const v = values[i];
|
|
1211
|
+
if (v < min) {
|
|
1212
|
+
min = v;
|
|
1213
|
+
}
|
|
1214
|
+
if (v > max) {
|
|
1215
|
+
max = v;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return { min, max };
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Positional x-domain for an index-keyed preset series: `[0, n - 1]`,
|
|
1222
|
+
* falling back to `[0, 1]` below two points so the scale never
|
|
1223
|
+
* degenerates to a zero-width domain.
|
|
1224
|
+
*
|
|
1225
|
+
* @internal
|
|
1226
|
+
*/
|
|
1227
|
+
function presetIndexDomain(length) {
|
|
1228
|
+
return length < 2 ? [0, 1] : [0, length - 1];
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Value y-domain for a preset series: `[min, max]` of the data, padded
|
|
1232
|
+
* to `[v - 1, v + 1]` when the series is flat (a zero-height domain
|
|
1233
|
+
* would collapse the scale) and `[0, 1]` when it is empty.
|
|
1234
|
+
*
|
|
1235
|
+
* @internal
|
|
1236
|
+
*/
|
|
1237
|
+
function presetValueDomain(values) {
|
|
1238
|
+
const scan = scanMinMax(values);
|
|
1239
|
+
if (scan === null) {
|
|
1240
|
+
return [0, 1];
|
|
1241
|
+
}
|
|
1242
|
+
if (scan.min === scan.max) {
|
|
1243
|
+
return [scan.min - 1, scan.max + 1];
|
|
1244
|
+
}
|
|
1245
|
+
return [scan.min, scan.max];
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Position of `value` inside `[min, max]` as a ratio clamped to
|
|
1249
|
+
* `[0, 1]`. A degenerate range (`max <= min`) yields `0` - every
|
|
1250
|
+
* preset renders an empty fill rather than dividing by zero.
|
|
1251
|
+
*
|
|
1252
|
+
* @internal
|
|
1253
|
+
*/
|
|
1254
|
+
function clampedRatio(value, min, max) {
|
|
1255
|
+
if (max <= min) {
|
|
1256
|
+
return 0;
|
|
1257
|
+
}
|
|
1258
|
+
return clamp((value - min) / (max - min), 0, 1);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1012
1261
|
/**
|
|
1013
1262
|
* Pure helper that derives a `CngxChartSummary` from already-projected
|
|
1014
1263
|
* numeric values plus a list of threshold values. The chart component
|
|
@@ -1029,20 +1278,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1029
1278
|
* @internal
|
|
1030
1279
|
*/
|
|
1031
1280
|
function computeChartSummary(values, thresholds) {
|
|
1032
|
-
|
|
1281
|
+
const scan = scanMinMax(values);
|
|
1282
|
+
if (scan === null) {
|
|
1033
1283
|
return { trend: 'flat', min: 0, max: 0, current: 0, thresholds: [] };
|
|
1034
1284
|
}
|
|
1035
|
-
|
|
1036
|
-
let max = values[0];
|
|
1037
|
-
for (let i = 1; i < values.length; i++) {
|
|
1038
|
-
const v = values[i];
|
|
1039
|
-
if (v < min) {
|
|
1040
|
-
min = v;
|
|
1041
|
-
}
|
|
1042
|
-
if (v > max) {
|
|
1043
|
-
max = v;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1285
|
+
const { min, max } = scan;
|
|
1046
1286
|
const first = values[0];
|
|
1047
1287
|
const current = values[values.length - 1];
|
|
1048
1288
|
const range = max - min;
|
|
@@ -1134,9 +1374,13 @@ function createSignificantChangeTracker(summary) {
|
|
|
1134
1374
|
*
|
|
1135
1375
|
* - **mount** - tracks `mode()`; on change, destroys the previous backend,
|
|
1136
1376
|
* builds the new one via `factory`, mounts it, and seeds the first paint.
|
|
1137
|
-
* - **paint** - tracks `geometries()
|
|
1138
|
-
* dimensions
|
|
1139
|
-
*
|
|
1377
|
+
* - **paint** - tracks `geometries()`, the (structurally-deduped)
|
|
1378
|
+
* dimensions and the `(forced-colors: active)` /
|
|
1379
|
+
* `(prefers-color-scheme: dark)` media queries; repaints on every
|
|
1380
|
+
* geometry emission and invalidates the backend's color cache when the
|
|
1381
|
+
* dimensions or either media query actually change, so a contrast-theme
|
|
1382
|
+
* or OS colour-scheme switch repaints at once instead of after the next
|
|
1383
|
+
* resize.
|
|
1140
1384
|
*
|
|
1141
1385
|
* Both effects wrap their imperative renderer calls in `untracked()` so
|
|
1142
1386
|
* the renderer's own signal reads never feed back into the effect graph.
|
|
@@ -1160,6 +1404,11 @@ function createChartRendererController(deps) {
|
|
|
1160
1404
|
// the redundant re-paints / cache invalidations.
|
|
1161
1405
|
const dims = linkedSignal(() => deps.ctx.dimensions(), { ...(ngDevMode ? { debugName: "dims" } : /* istanbul ignore next */ {}), equal: dimensionsEqual });
|
|
1162
1406
|
let lastDims = untracked(dims);
|
|
1407
|
+
const view = deps.host.ownerDocument.defaultView;
|
|
1408
|
+
const forced = createMediaQuerySignal('(forced-colors: active)', deps.destroyRef, view);
|
|
1409
|
+
const darkScheme = createMediaQuerySignal('(prefers-color-scheme: dark)', deps.destroyRef, view);
|
|
1410
|
+
let lastForced = untracked(forced);
|
|
1411
|
+
let lastDark = untracked(darkScheme);
|
|
1163
1412
|
// Mount effect: rebuild the backend whenever the mode flips, then seed
|
|
1164
1413
|
// the first paint (the paint effect does not track `mode`, so the fresh
|
|
1165
1414
|
// backend would otherwise stay blank until the next geometry change).
|
|
@@ -1167,19 +1416,29 @@ function createChartRendererController(deps) {
|
|
|
1167
1416
|
const mode = deps.mode();
|
|
1168
1417
|
untracked(() => {
|
|
1169
1418
|
current?.destroy();
|
|
1170
|
-
current = deps.factory(mode, {
|
|
1419
|
+
current = deps.factory(mode, {
|
|
1420
|
+
ctx: deps.ctx,
|
|
1421
|
+
destroyRef: deps.destroyRef,
|
|
1422
|
+
forcedColors: forced,
|
|
1423
|
+
});
|
|
1171
1424
|
current.mount(deps.host, deps.ctx);
|
|
1172
1425
|
current.paint(deps.geometries());
|
|
1173
1426
|
});
|
|
1174
1427
|
});
|
|
1175
1428
|
// Paint effect: repaint on geometry change; invalidate the color cache
|
|
1176
|
-
// only when the deduped dimensions actually
|
|
1429
|
+
// only when the deduped dimensions or a palette media query actually
|
|
1430
|
+
// changed (a palette flip re-resolves colors like a theming reflow).
|
|
1177
1431
|
effect(() => {
|
|
1178
1432
|
const geometries = deps.geometries();
|
|
1179
1433
|
const nextDims = dims();
|
|
1434
|
+
const nextForced = forced();
|
|
1435
|
+
const nextDark = darkScheme();
|
|
1180
1436
|
untracked(() => {
|
|
1181
|
-
|
|
1437
|
+
const paletteChanged = nextForced !== lastForced || nextDark !== lastDark;
|
|
1438
|
+
if (nextDims !== lastDims || paletteChanged) {
|
|
1182
1439
|
lastDims = nextDims;
|
|
1440
|
+
lastForced = nextForced;
|
|
1441
|
+
lastDark = nextDark;
|
|
1183
1442
|
current?.invalidateColorCache?.();
|
|
1184
1443
|
}
|
|
1185
1444
|
current?.paint(geometries);
|
|
@@ -1192,6 +1451,112 @@ function createChartRendererController(deps) {
|
|
|
1192
1451
|
};
|
|
1193
1452
|
}
|
|
1194
1453
|
|
|
1454
|
+
/**
|
|
1455
|
+
* @internal Mount a hidden probe under `host` that resolves `CanvasText` /
|
|
1456
|
+
* `Canvas` to concrete colours. Two child spans carry the keywords and opt
|
|
1457
|
+
* out with `forced-color-adjust: none`; without it a forced `color: Canvas`
|
|
1458
|
+
* would compute to the forced text colour. The probe lives as long as the
|
|
1459
|
+
* renderer, so a re-read on a palette flip is two style reads and never a
|
|
1460
|
+
* host mutation inside `paint()`. Falls back to the keywords when the host
|
|
1461
|
+
* resolves nothing (jsdom).
|
|
1462
|
+
*/
|
|
1463
|
+
function createSystemColorProbe(host) {
|
|
1464
|
+
const doc = host.ownerDocument;
|
|
1465
|
+
const root = doc.createElement('span');
|
|
1466
|
+
root.className = 'cngx-chart__palette-probe';
|
|
1467
|
+
root.setAttribute('aria-hidden', 'true');
|
|
1468
|
+
root.style.display = 'none';
|
|
1469
|
+
const swatch = (keyword) => {
|
|
1470
|
+
const el = doc.createElement('span');
|
|
1471
|
+
el.style.setProperty('forced-color-adjust', 'none');
|
|
1472
|
+
el.style.color = keyword;
|
|
1473
|
+
root.appendChild(el);
|
|
1474
|
+
return el;
|
|
1475
|
+
};
|
|
1476
|
+
const ink = swatch('CanvasText');
|
|
1477
|
+
// Lowercase on purpose: CSS keywords are case-insensitive, and the
|
|
1478
|
+
// capitalised form reads as copy to the user-facing string guard.
|
|
1479
|
+
const canvas = swatch('canvas');
|
|
1480
|
+
host.appendChild(root);
|
|
1481
|
+
return {
|
|
1482
|
+
read: () => ({
|
|
1483
|
+
ink: getComputedStyle(ink).color || 'CanvasText',
|
|
1484
|
+
canvas: getComputedStyle(canvas).color || 'canvas',
|
|
1485
|
+
}),
|
|
1486
|
+
remove: () => root.remove(),
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* @internal Line dash per step: solid, dashed, dotted, dash-dot. Same
|
|
1491
|
+
* values as the `stroke-dasharray` in the line layer's forced-colors CSS.
|
|
1492
|
+
*/
|
|
1493
|
+
const FORCED_LINE_DASHES = [[], [6, 3], [0.1, 4], [8, 3, 0.1, 3]];
|
|
1494
|
+
const stepMemo = new WeakMap();
|
|
1495
|
+
/**
|
|
1496
|
+
* @internal The forced-colors step of every geometry, `null` for the kinds
|
|
1497
|
+
* outside the cycle. Line, bar and scatter count, area, threshold and band
|
|
1498
|
+
* do not - the same rule as the SVG
|
|
1499
|
+
* `:nth-child(4n + k of .cngx-chart-series)` selectors. Memoised by the
|
|
1500
|
+
* array reference: the chart keeps the same geometries array while no
|
|
1501
|
+
* layer emits a new geometry, so repaints without data (resize, DPR or
|
|
1502
|
+
* palette flip) reuse the steps. A streaming chart gets a new array on
|
|
1503
|
+
* every data tick and recomputes one small array per frame.
|
|
1504
|
+
*/
|
|
1505
|
+
function forcedSeriesSteps(geometries) {
|
|
1506
|
+
const cached = stepMemo.get(geometries);
|
|
1507
|
+
if (cached) {
|
|
1508
|
+
return cached;
|
|
1509
|
+
}
|
|
1510
|
+
let series = 0;
|
|
1511
|
+
const steps = geometries.map((g) => {
|
|
1512
|
+
const counts = g.kind === 'line' || g.kind === 'bar' || g.kind === 'scatter';
|
|
1513
|
+
if (!counts) {
|
|
1514
|
+
return null;
|
|
1515
|
+
}
|
|
1516
|
+
const step = (series % 4);
|
|
1517
|
+
series++;
|
|
1518
|
+
return step;
|
|
1519
|
+
});
|
|
1520
|
+
stepMemo.set(geometries, steps);
|
|
1521
|
+
return steps;
|
|
1522
|
+
}
|
|
1523
|
+
const NO_HATCHES = { diagonal: null, horizontal: null };
|
|
1524
|
+
/**
|
|
1525
|
+
* @internal Build the hatch patterns the SVG chart draws as `<pattern>`
|
|
1526
|
+
* defs: a 4px tile with a 2px ink stripe on a Canvas gap (the gap keeps a
|
|
1527
|
+
* hatched mark readable where it overlaps another). The tile is drawn at
|
|
1528
|
+
* device-pixel size and scaled back through the pattern transform, so the
|
|
1529
|
+
* 0deg hatch maps one tile pixel to one device pixel and stays pure ink
|
|
1530
|
+
* and canvas on a high-DPR screen. The 45deg hatch is rotated and therefore
|
|
1531
|
+
* resampled; its stripe edges blend ink into canvas, as the SVG pattern's
|
|
1532
|
+
* do. Returns nulls when the host lacks `createPattern` or `DOMMatrix`; the
|
|
1533
|
+
* caller then fills with ink.
|
|
1534
|
+
*/
|
|
1535
|
+
function createForcedHatches(doc, target, colors, dpr) {
|
|
1536
|
+
if (typeof target.createPattern !== 'function' || typeof DOMMatrix !== 'function') {
|
|
1537
|
+
return NO_HATCHES;
|
|
1538
|
+
}
|
|
1539
|
+
const size = Math.max(1, Math.round(4 * dpr));
|
|
1540
|
+
const stripe = Math.max(1, Math.round(2 * dpr));
|
|
1541
|
+
const tile = doc.createElement('canvas');
|
|
1542
|
+
tile.width = size;
|
|
1543
|
+
tile.height = size;
|
|
1544
|
+
const t = tile.getContext('2d');
|
|
1545
|
+
if (!t) {
|
|
1546
|
+
return NO_HATCHES;
|
|
1547
|
+
}
|
|
1548
|
+
t.fillStyle = colors.canvas;
|
|
1549
|
+
t.fillRect(0, 0, size, size);
|
|
1550
|
+
t.fillStyle = colors.ink;
|
|
1551
|
+
t.fillRect(0, 0, size, stripe);
|
|
1552
|
+
const back = 4 / size;
|
|
1553
|
+
const diagonal = target.createPattern(tile, 'repeat');
|
|
1554
|
+
diagonal?.setTransform(new DOMMatrix().scale(back).rotate(45));
|
|
1555
|
+
const horizontal = target.createPattern(tile, 'repeat');
|
|
1556
|
+
horizontal?.setTransform(new DOMMatrix().scale(back));
|
|
1557
|
+
return { diagonal, horizontal };
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1195
1560
|
/**
|
|
1196
1561
|
* @internal Per-kind CSS custom-property fallback chain, resolved when a
|
|
1197
1562
|
* geometry emits `color: null`. Mirrors each layer atom's SVG cascade
|
|
@@ -1215,6 +1580,8 @@ const DEFAULT_AREA_OPACITY = 0.18;
|
|
|
1215
1580
|
const DEFAULT_BAND_OPACITY = 0.12;
|
|
1216
1581
|
/** @internal Fallback point-marker radius, matching the layers' CSS token defaults. */
|
|
1217
1582
|
const DEFAULT_POINT_RADIUS = 3;
|
|
1583
|
+
/** @internal Shared solid dash, so resetting after a dashed stroke allocates nothing. */
|
|
1584
|
+
const SOLID_DASH = [];
|
|
1218
1585
|
/**
|
|
1219
1586
|
* Canvas rendering backend. Mounts a `<canvas>` absolutely positioned
|
|
1220
1587
|
* over the chart's SVG frame and paints each {@link LayerGeometry} onto
|
|
@@ -1244,6 +1611,22 @@ const DEFAULT_POINT_RADIUS = 3;
|
|
|
1244
1611
|
* `overflow: visible` it now clips there too. Out-of-domain data is cut
|
|
1245
1612
|
* off on both paths.
|
|
1246
1613
|
*
|
|
1614
|
+
* Under forced colors the canvas follows the same contract as the SVG
|
|
1615
|
+
* layers, since the browser never forces canvas pixels: every mark paints
|
|
1616
|
+
* CanvasText, ignoring `[color]` and the colour tokens; areas and bands keep
|
|
1617
|
+
* their opacity; line, bar and scatter take the legend's four-step cycle by
|
|
1618
|
+
* series index (lines solid / dashed / dotted / dash-dot, bars and points
|
|
1619
|
+
* solid / 45deg hatch / hollow / 0deg hatch), with area, threshold and band
|
|
1620
|
+
* not counting. CanvasText and Canvas are resolved through a probe element
|
|
1621
|
+
* opted out of forcing and cached like the author colours. Chromium also
|
|
1622
|
+
* resolves the system keywords on a 2D context to the forced palette, but
|
|
1623
|
+
* other engines are unverified, so the backend paints the probed values.
|
|
1624
|
+
* The renderer controller watches `(forced-colors: active)` and
|
|
1625
|
+
* `(prefers-color-scheme: dark)` and invalidates the colour cache before
|
|
1626
|
+
* repainting on a flip, so a contrast-theme switch repaints at once. One
|
|
1627
|
+
* difference from SVG: a layer wrapped in an extra `<svg:g>` still counts
|
|
1628
|
+
* here, since the backend only sees the layer order.
|
|
1629
|
+
*
|
|
1247
1630
|
* @category common/chart/renderer
|
|
1248
1631
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/canvas-renderer.ts
|
|
1249
1632
|
* @since 0.1.0
|
|
@@ -1254,8 +1637,19 @@ function createCanvasRenderer(deps) {
|
|
|
1254
1637
|
let ctx2d = null;
|
|
1255
1638
|
let lastW = -1;
|
|
1256
1639
|
let lastH = -1;
|
|
1640
|
+
let lastGeometries = [];
|
|
1641
|
+
let dprCleanup = null;
|
|
1257
1642
|
const colorCache = new Map();
|
|
1258
1643
|
const numberCache = new Map();
|
|
1644
|
+
// Snapshot of deps.forcedColors, taken once per paint() so the per-mark
|
|
1645
|
+
// colour lookups do not re-read the signal.
|
|
1646
|
+
let forcedNow = false;
|
|
1647
|
+
// Forced system palette; cleared with colorCache so a flip re-probes it.
|
|
1648
|
+
let sysColors = null;
|
|
1649
|
+
let probe = null;
|
|
1650
|
+
// Hatch patterns for the forced cycle, per palette and DPR.
|
|
1651
|
+
let hatches = null;
|
|
1652
|
+
let hatchDpr = -1;
|
|
1259
1653
|
function readVar(name) {
|
|
1260
1654
|
return hostEl ? getComputedStyle(hostEl).getPropertyValue(name).trim() : '';
|
|
1261
1655
|
}
|
|
@@ -1275,7 +1669,53 @@ function createCanvasRenderer(deps) {
|
|
|
1275
1669
|
numberCache.set(name, value);
|
|
1276
1670
|
return value;
|
|
1277
1671
|
}
|
|
1672
|
+
/**
|
|
1673
|
+
* The forced system palette, probed once per palette and dropped by
|
|
1674
|
+
* `invalidateColorCache()`, so a forced-colors flip re-probes it.
|
|
1675
|
+
*/
|
|
1676
|
+
function systemColors() {
|
|
1677
|
+
sysColors ??= probe?.read() ?? { ink: 'CanvasText', canvas: 'canvas' };
|
|
1678
|
+
return sysColors;
|
|
1679
|
+
}
|
|
1680
|
+
function forcedHatches(c) {
|
|
1681
|
+
const dpr = globalThis.devicePixelRatio ?? 1;
|
|
1682
|
+
if (!hatches || hatchDpr !== dpr) {
|
|
1683
|
+
const doc = hostEl?.ownerDocument ?? document;
|
|
1684
|
+
hatches = createForcedHatches(doc, c, systemColors(), dpr);
|
|
1685
|
+
hatchDpr = dpr;
|
|
1686
|
+
}
|
|
1687
|
+
return hatches;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Set the fill of a bar / scatter mark at its forced step and return the
|
|
1691
|
+
* ink ring width (0 = no ring): solid ink; diagonal hatch with a 1px ring;
|
|
1692
|
+
* hollow Canvas with a 1.5px ring; horizontal hatch with a 1px ring. A
|
|
1693
|
+
* missing pattern falls back to an ink fill. Mirrors the bar / scatter
|
|
1694
|
+
* layers' forced-colors CSS.
|
|
1695
|
+
*/
|
|
1696
|
+
function applyForcedMark(c, step) {
|
|
1697
|
+
const sys = systemColors();
|
|
1698
|
+
switch (step) {
|
|
1699
|
+
case 1:
|
|
1700
|
+
c.fillStyle = forcedHatches(c).diagonal ?? sys.ink;
|
|
1701
|
+
return 1;
|
|
1702
|
+
case 2:
|
|
1703
|
+
c.fillStyle = sys.canvas;
|
|
1704
|
+
return 1.5;
|
|
1705
|
+
case 3:
|
|
1706
|
+
c.fillStyle = forcedHatches(c).horizontal ?? sys.ink;
|
|
1707
|
+
return 1;
|
|
1708
|
+
default:
|
|
1709
|
+
c.fillStyle = sys.ink;
|
|
1710
|
+
return 0;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1278
1713
|
function colorOf(color, kind) {
|
|
1714
|
+
// Forced colors: every mark paints CanvasText, ignoring the [color]
|
|
1715
|
+
// literal and the var chain (parity with the layers' !important rules).
|
|
1716
|
+
if (forcedNow) {
|
|
1717
|
+
return systemColors().ink;
|
|
1718
|
+
}
|
|
1279
1719
|
// An explicit literal color (e.g. [cngxLine] [color]="'#f00'") passes
|
|
1280
1720
|
// through untouched - no var resolution, no cache.
|
|
1281
1721
|
if (color !== null && !color.startsWith('--')) {
|
|
@@ -1350,6 +1790,29 @@ function createCanvasRenderer(deps) {
|
|
|
1350
1790
|
// Draw in logical pixels; the bitmap is scaled for the device.
|
|
1351
1791
|
ctx2d.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
1352
1792
|
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Repaint when the device-pixel ratio changes without any data change
|
|
1795
|
+
* (window dragged to another monitor, browser zoom). The paint path
|
|
1796
|
+
* re-reads the DPR via `sizeCanvas()`, but nothing triggers it on a
|
|
1797
|
+
* DPR-only change, so the bitmap stays at the old density and renders
|
|
1798
|
+
* blurry until the next data tick. A `resolution` media query fires
|
|
1799
|
+
* exactly on that edge; it matches only the current ratio, so it is
|
|
1800
|
+
* re-armed with the new ratio after every change.
|
|
1801
|
+
*/
|
|
1802
|
+
function watchDpr() {
|
|
1803
|
+
if (typeof matchMedia !== 'function') {
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1806
|
+
const mql = matchMedia(`(resolution: ${globalThis.devicePixelRatio ?? 1}dppx)`);
|
|
1807
|
+
const onChange = () => {
|
|
1808
|
+
dprCleanup?.();
|
|
1809
|
+
dprCleanup = null;
|
|
1810
|
+
paint(lastGeometries);
|
|
1811
|
+
watchDpr();
|
|
1812
|
+
};
|
|
1813
|
+
mql.addEventListener('change', onChange, { once: true });
|
|
1814
|
+
dprCleanup = () => mql.removeEventListener('change', onChange);
|
|
1815
|
+
}
|
|
1353
1816
|
function mount(host) {
|
|
1354
1817
|
hostEl = host;
|
|
1355
1818
|
const el = host.ownerDocument.createElement('canvas');
|
|
@@ -1361,31 +1824,44 @@ function createCanvasRenderer(deps) {
|
|
|
1361
1824
|
host.appendChild(el);
|
|
1362
1825
|
canvas = el;
|
|
1363
1826
|
ctx2d = el.getContext('2d');
|
|
1827
|
+
probe = createSystemColorProbe(host);
|
|
1364
1828
|
sizeCanvas();
|
|
1829
|
+
watchDpr();
|
|
1365
1830
|
// Teardown is owned by the renderer controller (it destroys on mode
|
|
1366
1831
|
// flip and on the chart's DestroyRef). Self-registering here would
|
|
1367
1832
|
// pile up one never-unregistered closure per svg<->canvas flip.
|
|
1368
1833
|
}
|
|
1369
1834
|
function paint(geometries) {
|
|
1835
|
+
lastGeometries = geometries;
|
|
1370
1836
|
const c = ctx2d;
|
|
1371
1837
|
if (!canvas || !c) {
|
|
1372
1838
|
return;
|
|
1373
1839
|
}
|
|
1374
1840
|
sizeCanvas();
|
|
1841
|
+
forcedNow = deps.forcedColors?.() ?? false;
|
|
1375
1842
|
const { width, height } = deps.ctx.dimensions();
|
|
1376
1843
|
c.clearRect(0, 0, width, height);
|
|
1377
|
-
|
|
1378
|
-
|
|
1844
|
+
const steps = forcedNow ? forcedSeriesSteps(geometries) : null;
|
|
1845
|
+
for (let i = 0; i < geometries.length; i++) {
|
|
1846
|
+
paintOne(c, geometries[i], steps?.[i] ?? null);
|
|
1379
1847
|
}
|
|
1380
1848
|
}
|
|
1381
|
-
function paintOne(c, g) {
|
|
1849
|
+
function paintOne(c, g, step) {
|
|
1382
1850
|
switch (g.kind) {
|
|
1383
1851
|
case 'line': {
|
|
1384
1852
|
c.strokeStyle = colorOf(g.color, 'line');
|
|
1385
1853
|
c.lineWidth = strokeWidthOf(g.strokeWidth);
|
|
1386
1854
|
c.lineJoin = 'round';
|
|
1387
1855
|
c.lineCap = 'round';
|
|
1856
|
+
// Forced colors: the legend's dash for this series step (round caps
|
|
1857
|
+
// turn the 0.1 dash into a dot, as in SVG).
|
|
1858
|
+
if (step !== null) {
|
|
1859
|
+
c.setLineDash(FORCED_LINE_DASHES[step]);
|
|
1860
|
+
}
|
|
1388
1861
|
c.stroke(new Path2D(g.d));
|
|
1862
|
+
if (step !== null) {
|
|
1863
|
+
c.setLineDash(SOLID_DASH);
|
|
1864
|
+
}
|
|
1389
1865
|
drawPointMarks(c, g.points, g.color, 'line', '--cngx-line-point-radius');
|
|
1390
1866
|
break;
|
|
1391
1867
|
}
|
|
@@ -1398,18 +1874,38 @@ function createCanvasRenderer(deps) {
|
|
|
1398
1874
|
break;
|
|
1399
1875
|
}
|
|
1400
1876
|
case 'bar': {
|
|
1877
|
+
const ring = step === null ? 0 : applyForcedMark(c, step);
|
|
1878
|
+
if (ring > 0) {
|
|
1879
|
+
c.strokeStyle = systemColors().ink;
|
|
1880
|
+
c.lineWidth = ring;
|
|
1881
|
+
}
|
|
1401
1882
|
for (const r of g.rects) {
|
|
1402
|
-
|
|
1883
|
+
if (step === null) {
|
|
1884
|
+
c.fillStyle = colorOf(r.color, 'bar');
|
|
1885
|
+
}
|
|
1403
1886
|
c.fillRect(r.x, r.y, r.w, r.h);
|
|
1887
|
+
if (ring > 0) {
|
|
1888
|
+
c.strokeRect(r.x, r.y, r.w, r.h);
|
|
1889
|
+
}
|
|
1404
1890
|
}
|
|
1405
1891
|
break;
|
|
1406
1892
|
}
|
|
1407
1893
|
case 'scatter': {
|
|
1894
|
+
const ring = step === null ? 0 : applyForcedMark(c, step);
|
|
1895
|
+
if (ring > 0) {
|
|
1896
|
+
c.strokeStyle = systemColors().ink;
|
|
1897
|
+
c.lineWidth = ring;
|
|
1898
|
+
}
|
|
1408
1899
|
for (const m of g.marks) {
|
|
1409
|
-
|
|
1900
|
+
if (step === null) {
|
|
1901
|
+
c.fillStyle = colorOf(m.color, 'scatter');
|
|
1902
|
+
}
|
|
1410
1903
|
c.beginPath();
|
|
1411
1904
|
c.arc(m.cx, m.cy, m.r, 0, Math.PI * 2);
|
|
1412
1905
|
c.fill();
|
|
1906
|
+
if (ring > 0) {
|
|
1907
|
+
c.stroke();
|
|
1908
|
+
}
|
|
1413
1909
|
}
|
|
1414
1910
|
break;
|
|
1415
1911
|
}
|
|
@@ -1436,16 +1932,25 @@ function createCanvasRenderer(deps) {
|
|
|
1436
1932
|
function invalidateColorCache() {
|
|
1437
1933
|
colorCache.clear();
|
|
1438
1934
|
numberCache.clear();
|
|
1935
|
+
sysColors = null;
|
|
1936
|
+
hatches = null;
|
|
1439
1937
|
}
|
|
1440
1938
|
function destroy() {
|
|
1939
|
+
dprCleanup?.();
|
|
1940
|
+
dprCleanup = null;
|
|
1941
|
+
lastGeometries = [];
|
|
1441
1942
|
canvas?.remove();
|
|
1442
1943
|
canvas = null;
|
|
1944
|
+
probe?.remove();
|
|
1945
|
+
probe = null;
|
|
1443
1946
|
ctx2d = null;
|
|
1444
1947
|
hostEl = null;
|
|
1445
1948
|
lastW = -1;
|
|
1446
1949
|
lastH = -1;
|
|
1447
1950
|
colorCache.clear();
|
|
1448
1951
|
numberCache.clear();
|
|
1952
|
+
sysColors = null;
|
|
1953
|
+
hatches = null;
|
|
1449
1954
|
}
|
|
1450
1955
|
return {
|
|
1451
1956
|
mode: 'canvas',
|
|
@@ -1729,8 +2234,13 @@ class CngxChart {
|
|
|
1729
2234
|
axes = contentChildren(CNGX_CHART_AXIS, { ...(ngDevMode ? { debugName: "axes" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1730
2235
|
thresholds = contentChildren(CngxThreshold, { ...(ngDevMode ? { debugName: "thresholds" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1731
2236
|
layers = contentChildren(CNGX_CHART_LAYER, { ...(ngDevMode ? { debugName: "layers" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1732
|
-
i18n =
|
|
2237
|
+
i18n = injectChartI18n();
|
|
1733
2238
|
dataTableId = nextUid('cngx-chart-data-table');
|
|
2239
|
+
hatchId = nextUid('cngx-chart-hatch');
|
|
2240
|
+
hatchFill = {
|
|
2241
|
+
diagonal: `url(#${this.hatchId}-diagonal)`,
|
|
2242
|
+
horizontal: `url(#${this.hatchId}-horizontal)`,
|
|
2243
|
+
};
|
|
1734
2244
|
loadingSlot = contentChild(CngxChartLoading, ...(ngDevMode ? [{ debugName: "loadingSlot" }] : /* istanbul ignore next */ []));
|
|
1735
2245
|
emptySlot = contentChild(CngxChartEmpty, ...(ngDevMode ? [{ debugName: "emptySlot" }] : /* istanbul ignore next */ []));
|
|
1736
2246
|
errorSlot = contentChild(CngxChartError, ...(ngDevMode ? [{ debugName: "errorSlot" }] : /* istanbul ignore next */ []));
|
|
@@ -1739,8 +2249,9 @@ class CngxChart {
|
|
|
1739
2249
|
overlaySlot = contentChild(CngxChartOverlay, ...(ngDevMode ? [{ debugName: "overlaySlot" }] : /* istanbul ignore next */ []));
|
|
1740
2250
|
// Only the first overlay renders (contentChild above). This parallel
|
|
1741
2251
|
// query exists solely to warn in dev when a consumer projects more
|
|
1742
|
-
// than one, since the extra templates drop silently otherwise.
|
|
1743
|
-
|
|
2252
|
+
// than one, since the extra templates drop silently otherwise. Descendants,
|
|
2253
|
+
// like the contentChild above, so a nested second overlay is counted too.
|
|
2254
|
+
overlaySlots = contentChildren(CngxChartOverlay, { ...(ngDevMode ? { debugName: "overlaySlots" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1744
2255
|
/** Resolved consumer-projected loading template (null when no slot bound). */
|
|
1745
2256
|
loadingTpl = computed(() => this.loadingSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "loadingTpl" }] : /* istanbul ignore next */ []));
|
|
1746
2257
|
/** Resolved consumer-projected empty template (null when no slot bound). */
|
|
@@ -1818,6 +2329,22 @@ class CngxChart {
|
|
|
1818
2329
|
}
|
|
1819
2330
|
return 'none';
|
|
1820
2331
|
}, ...(ngDevMode ? [{ debugName: "connectionView" }] : /* istanbul ignore next */ []));
|
|
2332
|
+
/**
|
|
2333
|
+
* Text of the default connection overlay (a `role="alert"` /
|
|
2334
|
+
* `role="status"` live region). Only the connection view is tracked;
|
|
2335
|
+
* the copy is read untracked, so a runtime copy or locale flip does not
|
|
2336
|
+
* rewrite a shown announcement - the next transition speaks the new one.
|
|
2337
|
+
*/
|
|
2338
|
+
connectionOverlayText = computed(() => {
|
|
2339
|
+
const view = this.connectionView();
|
|
2340
|
+
return untracked(() => {
|
|
2341
|
+
const i18n = this.i18n();
|
|
2342
|
+
if (view === 'error') {
|
|
2343
|
+
return i18n.connectionLost();
|
|
2344
|
+
}
|
|
2345
|
+
return view === 'reconnecting' ? i18n.connectionReconnecting() : '';
|
|
2346
|
+
});
|
|
2347
|
+
}, ...(ngDevMode ? [{ debugName: "connectionOverlayText" }] : /* istanbul ignore next */ []));
|
|
1821
2348
|
/**
|
|
1822
2349
|
* Context for the connection-slot templates - the connection-channel
|
|
1823
2350
|
* twin of {@link errorContext}, carrying the live connection error.
|
|
@@ -1826,6 +2353,26 @@ class CngxChart {
|
|
|
1826
2353
|
const err = this.connectionState()?.error?.() ?? null;
|
|
1827
2354
|
return { ...this.slotContext(), $implicit: err, error: err };
|
|
1828
2355
|
}, ...(ngDevMode ? [{ debugName: "connectionCtx" }] : /* istanbul ignore next */ []));
|
|
2356
|
+
/**
|
|
2357
|
+
* Current/previous pair for the connection channel's status,
|
|
2358
|
+
* unbound-safe via the `'idle'` fallback.
|
|
2359
|
+
*/
|
|
2360
|
+
connectionTransition = createTransitionTracker(() => this.connectionState()?.status() ?? 'idle');
|
|
2361
|
+
/**
|
|
2362
|
+
* Text for the always-in-DOM polite live region that voices the
|
|
2363
|
+
* recovery transition. The lost/reconnecting overlays announce
|
|
2364
|
+
* themselves through their `role="alert"` / `role="status"` - but
|
|
2365
|
+
* on recovery they simply vanish, which is a silent state change
|
|
2366
|
+
* (Pillar 2). This computed says {@link CngxChartI18n.connectionRestored}
|
|
2367
|
+
* exactly on the error/refreshing -> success edge and clears again
|
|
2368
|
+
* on the next connection transition. Pure derivation, no `effect()`.
|
|
2369
|
+
*/
|
|
2370
|
+
connectionRestoredAnnouncement = computed(() => {
|
|
2371
|
+
const current = this.connectionTransition.current();
|
|
2372
|
+
const previous = this.connectionTransition.previous();
|
|
2373
|
+
const restored = current === 'success' && (previous === 'error' || previous === 'refreshing');
|
|
2374
|
+
return restored ? untracked(() => this.i18n().connectionRestored()) : '';
|
|
2375
|
+
}, ...(ngDevMode ? [{ debugName: "connectionRestoredAnnouncement" }] : /* istanbul ignore next */ []));
|
|
1829
2376
|
constructor() {
|
|
1830
2377
|
// The controller owns the mount / destroy / paint reactive lifecycle;
|
|
1831
2378
|
// its effects and teardown are held by this injection context's
|
|
@@ -1838,7 +2385,7 @@ class CngxChart {
|
|
|
1838
2385
|
factory: this.rendererFactory,
|
|
1839
2386
|
destroyRef: this.destroyRef,
|
|
1840
2387
|
});
|
|
1841
|
-
if (
|
|
2388
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
1842
2389
|
afterNextRender(() => {
|
|
1843
2390
|
if (this.summaryAccessor() !== DEFAULT_SUMMARY_ACCESSOR) {
|
|
1844
2391
|
return;
|
|
@@ -1851,16 +2398,27 @@ class CngxChart {
|
|
|
1851
2398
|
if (Number.isFinite(projected)) {
|
|
1852
2399
|
return;
|
|
1853
2400
|
}
|
|
1854
|
-
|
|
2401
|
+
cngxDevWarn('CNGX1007', '[cngx-chart] data is non-numeric and no [summaryAccessor] is bound. ' +
|
|
1855
2402
|
'Auto-Summary and the SR data-table will silently fall back to NaN. ' +
|
|
1856
|
-
'Bind [summaryAccessor]=
|
|
2403
|
+
'Bind [summaryAccessor] to a stable component field (summaryAccessor = (d: Row) => d.value) ' +
|
|
2404
|
+
'or pass a numeric data array.');
|
|
1857
2405
|
});
|
|
1858
2406
|
afterNextRender(() => {
|
|
1859
2407
|
if (this.overlaySlots().length > 1) {
|
|
1860
|
-
|
|
2408
|
+
cngxDevWarn('CNGX1008', '[cngx-chart] more than one *cngxChartOverlay projected; only the first renders. ' +
|
|
1861
2409
|
'Compose multiple overlays inside a single overlay template.');
|
|
1862
2410
|
}
|
|
1863
2411
|
});
|
|
2412
|
+
afterNextRender(() => {
|
|
2413
|
+
const axes = this.axes();
|
|
2414
|
+
const horizontal = axes.filter((a) => isHorizontalPosition(a.position()));
|
|
2415
|
+
const vertical = axes.filter((a) => isVerticalPosition(a.position()));
|
|
2416
|
+
if (horizontal.length > 1 || vertical.length > 1) {
|
|
2417
|
+
cngxDevWarn('CNGX1009', '[cngx-chart] multiple axes share one orientation; only the first drives ' +
|
|
2418
|
+
'the scale, the rest render their line and ticks but their [domain] ' +
|
|
2419
|
+
'is silently ignored. Mount one X and one Y axis per chart.');
|
|
2420
|
+
}
|
|
2421
|
+
});
|
|
1864
2422
|
}
|
|
1865
2423
|
}
|
|
1866
2424
|
dataLength = computed(() => this.dataInput().length, ...(ngDevMode ? [{ debugName: "dataLength" }] : /* istanbul ignore next */ []));
|
|
@@ -2065,14 +2623,8 @@ class CngxChart {
|
|
|
2065
2623
|
* later.
|
|
2066
2624
|
*/
|
|
2067
2625
|
summary = computed(() => {
|
|
2068
|
-
const acc = this.summaryAccessor();
|
|
2069
|
-
const data = this.dataInput();
|
|
2070
|
-
const values = new Array(data.length);
|
|
2071
|
-
for (let i = 0; i < data.length; i++) {
|
|
2072
|
-
values[i] = acc(data[i], i);
|
|
2073
|
-
}
|
|
2074
2626
|
const thresholds = this.thresholds().map((t) => t.value());
|
|
2075
|
-
return computeChartSummary(
|
|
2627
|
+
return computeChartSummary(this.summaryValues(), thresholds);
|
|
2076
2628
|
}, { ...(ngDevMode ? { debugName: "summary" } : /* istanbul ignore next */ {}), equal: (a, b) => a.trend === b.trend &&
|
|
2077
2629
|
a.min === b.min &&
|
|
2078
2630
|
a.max === b.max &&
|
|
@@ -2117,7 +2669,7 @@ class CngxChart {
|
|
|
2117
2669
|
* Responsive mode is active when neither `[width]` nor `[height]` is
|
|
2118
2670
|
* bound. The host then fills its parent's width and derives height
|
|
2119
2671
|
* from the `--cngx-chart-aspect-ratio` CSS custom property (default
|
|
2120
|
-
* `
|
|
2672
|
+
* `5 / 2`). The resize observer feeds `dimensions()` which drives
|
|
2121
2673
|
* the SVG sizing + scale math, so axes and layer atoms re-flow
|
|
2122
2674
|
* reactively as the parent resizes.
|
|
2123
2675
|
*/
|
|
@@ -2149,21 +2701,26 @@ class CngxChart {
|
|
|
2149
2701
|
ariaLabelText = computed(() => {
|
|
2150
2702
|
const view = this.activeView();
|
|
2151
2703
|
if (view === 'skeleton') {
|
|
2152
|
-
return this.i18n.loading();
|
|
2704
|
+
return this.i18n().loading();
|
|
2153
2705
|
}
|
|
2154
2706
|
if (view === 'empty') {
|
|
2155
|
-
return this.i18n.empty();
|
|
2707
|
+
return this.i18n().empty();
|
|
2156
2708
|
}
|
|
2157
2709
|
if (view === 'error') {
|
|
2158
|
-
return this.i18n.error();
|
|
2710
|
+
return this.i18n().error();
|
|
2159
2711
|
}
|
|
2160
2712
|
const explicit = this.ariaLabel();
|
|
2161
2713
|
if (explicit !== null && explicit !== undefined && explicit !== '') {
|
|
2162
2714
|
return explicit;
|
|
2163
2715
|
}
|
|
2164
|
-
return this.i18n.summary(this.summary());
|
|
2716
|
+
return this.i18n().summary(this.summary());
|
|
2165
2717
|
}, ...(ngDevMode ? [{ debugName: "ariaLabelText" }] : /* istanbul ignore next */ []));
|
|
2166
|
-
/**
|
|
2718
|
+
/**
|
|
2719
|
+
* The single numeric projection of `data` through `summaryAccessor`.
|
|
2720
|
+
* Both {@link summary} and the data-table view derive from it, so the
|
|
2721
|
+
* projection runs once per data change and its `sameNumberArr` equal
|
|
2722
|
+
* stops the cascade when a refresh produces identical values.
|
|
2723
|
+
*/
|
|
2167
2724
|
summaryValues = computed(() => {
|
|
2168
2725
|
const acc = this.summaryAccessor();
|
|
2169
2726
|
const data = this.dataInput();
|
|
@@ -2188,7 +2745,7 @@ class CngxChart {
|
|
|
2188
2745
|
return this.dataInput().length > 1;
|
|
2189
2746
|
}, ...(ngDevMode ? [{ debugName: "tableActive" }] : /* istanbul ignore next */ []));
|
|
2190
2747
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2191
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxChart, isStandalone: true, selector: "cngx-chart", inputs: { dataInput: { classPropertyName: "dataInput", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, preserveAspectRatio: { classPropertyName: "preserveAspectRatio", publicName: "preserveAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, summaryAccessor: { classPropertyName: "summaryAccessor", publicName: "summaryAccessor", isSignal: true, isRequired: false, transformFunction: null }, accessibleTable: { classPropertyName: "accessibleTable", publicName: "accessibleTable", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, connectionState: { classPropertyName: "connectionState", publicName: "connectionState", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "ariaLabelText()", "attr.aria-describedby": "dataTableId", "attr.aria-busy": "busy() ? \"true\" : null", "class.cngx-chart--responsive": "isResponsive()", "class.cngx-chart--content-hidden": "contentHidden()", "style.width.px": "width() ?? null", "style.aspect-ratio": "explicitAspectRatio()", "style.--cngx-chart-plot-block-start": "plotVars().blockStart", "style.--cngx-chart-plot-block-end": "plotVars().blockEnd", "style.--cngx-chart-plot-inline-start": "plotVars().inlineStart", "style.--cngx-chart-plot-inline-end": "plotVars().inlineEnd" } }, providers: [{ provide: CNGX_CHART_CONTEXT, useExisting: CngxChart }], queries: [{ propertyName: "axes", predicate: CNGX_CHART_AXIS, descendants: true, isSignal: true }, { propertyName: "thresholds", predicate: CngxThreshold, descendants: true, isSignal: true }, { propertyName: "layers", predicate: CNGX_CHART_LAYER, descendants: true, isSignal: true }, { propertyName: "loadingSlot", first: true, predicate: CngxChartLoading, descendants: true, isSignal: true }, { propertyName: "emptySlot", first: true, predicate: CngxChartEmpty, descendants: true, isSignal: true }, { propertyName: "errorSlot", first: true, predicate: CngxChartError, descendants: true, isSignal: true }, { propertyName: "connectionErrorSlot", first: true, predicate: CngxChartConnectionError, descendants: true, isSignal: true }, { propertyName: "reconnectingSlot", first: true, predicate: CngxChartReconnecting, descendants: true, isSignal: true }, { propertyName: "overlaySlot", first: true, predicate: CngxChartOverlay, descendants: true, isSignal: true }, { propertyName: "overlaySlots", predicate: CngxChartOverlay, isSignal: true }], exportAs: ["cngxChart"], hostDirectives: [{ directive: i1.CngxResizeObserver }], ngImport: i0, template: `
|
|
2748
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxChart, isStandalone: true, selector: "cngx-chart", inputs: { dataInput: { classPropertyName: "dataInput", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, preserveAspectRatio: { classPropertyName: "preserveAspectRatio", publicName: "preserveAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, summaryAccessor: { classPropertyName: "summaryAccessor", publicName: "summaryAccessor", isSignal: true, isRequired: false, transformFunction: null }, accessibleTable: { classPropertyName: "accessibleTable", publicName: "accessibleTable", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, connectionState: { classPropertyName: "connectionState", publicName: "connectionState", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "ariaLabelText()", "attr.aria-describedby": "dataTableId", "attr.aria-busy": "busy() ? \"true\" : null", "class.cngx-chart--responsive": "isResponsive()", "class.cngx-chart--content-hidden": "contentHidden()", "style.width.px": "width() ?? null", "style.aspect-ratio": "explicitAspectRatio()", "style.--cngx-chart-plot-block-start": "plotVars().blockStart", "style.--cngx-chart-plot-block-end": "plotVars().blockEnd", "style.--cngx-chart-plot-inline-start": "plotVars().inlineStart", "style.--cngx-chart-plot-inline-end": "plotVars().inlineEnd", "style.--_cngx-chart-hatch-diagonal": "hatchFill.diagonal", "style.--_cngx-chart-hatch-horizontal": "hatchFill.horizontal" } }, providers: [{ provide: CNGX_CHART_CONTEXT, useExisting: CngxChart }], queries: [{ propertyName: "axes", predicate: CNGX_CHART_AXIS, descendants: true, isSignal: true }, { propertyName: "thresholds", predicate: CngxThreshold, descendants: true, isSignal: true }, { propertyName: "layers", predicate: CNGX_CHART_LAYER, descendants: true, isSignal: true }, { propertyName: "loadingSlot", first: true, predicate: CngxChartLoading, descendants: true, isSignal: true }, { propertyName: "emptySlot", first: true, predicate: CngxChartEmpty, descendants: true, isSignal: true }, { propertyName: "errorSlot", first: true, predicate: CngxChartError, descendants: true, isSignal: true }, { propertyName: "connectionErrorSlot", first: true, predicate: CngxChartConnectionError, descendants: true, isSignal: true }, { propertyName: "reconnectingSlot", first: true, predicate: CngxChartReconnecting, descendants: true, isSignal: true }, { propertyName: "overlaySlot", first: true, predicate: CngxChartOverlay, descendants: true, isSignal: true }, { propertyName: "overlaySlots", predicate: CngxChartOverlay, descendants: true, isSignal: true }], exportAs: ["cngxChart"], hostDirectives: [{ directive: i1.CngxResizeObserver }], ngImport: i0, template: `
|
|
2192
2749
|
@switch (activeView()) {
|
|
2193
2750
|
@case ('skeleton') {
|
|
2194
2751
|
@if (loadingTpl(); as tpl) {
|
|
@@ -2207,7 +2764,7 @@ class CngxChart {
|
|
|
2207
2764
|
<ng-container *ngTemplateOutlet="tpl; context: slotContext()" />
|
|
2208
2765
|
</div>
|
|
2209
2766
|
} @else {
|
|
2210
|
-
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n.empty() }}</div>
|
|
2767
|
+
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n().empty() }}</div>
|
|
2211
2768
|
}
|
|
2212
2769
|
}
|
|
2213
2770
|
@case ('error') {
|
|
@@ -2217,7 +2774,7 @@ class CngxChart {
|
|
|
2217
2774
|
</div>
|
|
2218
2775
|
} @else {
|
|
2219
2776
|
<div class="cngx-chart__fallback cngx-chart__fallback--error" [attr.aria-hidden]="true">
|
|
2220
|
-
{{ i18n.error() }}
|
|
2777
|
+
{{ i18n().error() }}
|
|
2221
2778
|
</div>
|
|
2222
2779
|
}
|
|
2223
2780
|
}
|
|
@@ -2225,6 +2782,22 @@ class CngxChart {
|
|
|
2225
2782
|
@default {
|
|
2226
2783
|
<svg [attr.viewBox]="viewBox()" [attr.preserveAspectRatio]="preserveAspectRatio()">
|
|
2227
2784
|
<svg:title>{{ ariaLabelText() }}</svg:title>
|
|
2785
|
+
<svg:defs>
|
|
2786
|
+
<svg:pattern
|
|
2787
|
+
[attr.id]="hatchId + '-diagonal'"
|
|
2788
|
+
width="4"
|
|
2789
|
+
height="4"
|
|
2790
|
+
patternUnits="userSpaceOnUse"
|
|
2791
|
+
patternTransform="rotate(45)"
|
|
2792
|
+
>
|
|
2793
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2794
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2795
|
+
</svg:pattern>
|
|
2796
|
+
<svg:pattern [attr.id]="hatchId + '-horizontal'" width="4" height="4" patternUnits="userSpaceOnUse">
|
|
2797
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2798
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2799
|
+
</svg:pattern>
|
|
2800
|
+
</svg:defs>
|
|
2228
2801
|
<ng-content />
|
|
2229
2802
|
</svg>
|
|
2230
2803
|
@if (overlayTpl(); as tpl) {
|
|
@@ -2247,7 +2820,7 @@ class CngxChart {
|
|
|
2247
2820
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--error"
|
|
2248
2821
|
role="alert"
|
|
2249
2822
|
>
|
|
2250
|
-
{{
|
|
2823
|
+
{{ connectionOverlayText() }}
|
|
2251
2824
|
</div>
|
|
2252
2825
|
}
|
|
2253
2826
|
} @else if (connectionView() === 'reconnecting') {
|
|
@@ -2263,16 +2836,19 @@ class CngxChart {
|
|
|
2263
2836
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--reconnecting"
|
|
2264
2837
|
role="status"
|
|
2265
2838
|
>
|
|
2266
|
-
{{
|
|
2839
|
+
{{ connectionOverlayText() }}
|
|
2267
2840
|
</div>
|
|
2268
2841
|
}
|
|
2269
2842
|
}
|
|
2843
|
+
<span role="status" aria-live="polite" aria-atomic="true" class="cngx-chart__sr-status">{{
|
|
2844
|
+
connectionRestoredAnnouncement()
|
|
2845
|
+
}}</span>
|
|
2270
2846
|
<cngx-chart-data-table
|
|
2271
2847
|
[id]="dataTableId"
|
|
2272
2848
|
[values]="summaryValues()"
|
|
2273
2849
|
[hidden]="!tableActive() || activeView() !== 'content'"
|
|
2274
2850
|
/>
|
|
2275
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
2851
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-chart .cngx-chart__hatch-ink{fill:CanvasText}cngx-chart .cngx-chart__hatch-gap{fill:Canvas}cngx-chart{display:inline-block;position:relative;max-width:100%}cngx-chart.cngx-chart--responsive{display:block;width:100%;aspect-ratio:var(--cngx-chart-aspect-ratio, 5 / 2)}cngx-chart>.cngx-chart__canvas{position:absolute;inset:0;width:100%;height:100%;z-index:var(--cngx-chart-canvas-z, 0)}cngx-chart.cngx-chart--content-hidden>.cngx-chart__canvas{display:none}cngx-chart>svg{display:block;width:100%;height:100%}cngx-chart>.cngx-chart__fallback-frame{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart>.cngx-chart__overlay-frame{position:absolute;inset-block-start:var(--cngx-chart-plot-block-start, 0px);inset-block-end:var(--cngx-chart-plot-block-end, 0px);inset-inline-start:var(--cngx-chart-plot-inline-start, 0px);inset-inline-end:var(--cngx-chart-plot-inline-end, 0px);z-index:var(--cngx-chart-overlay-z, 1);pointer-events:none}cngx-chart>.cngx-chart__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart .cngx-chart__spinner{width:var(--cngx-chart-spinner-size, 32px);height:var(--cngx-chart-spinner-size, 32px);border:var(--cngx-chart-spinner-thickness, 3px) solid var(--cngx-chart-spinner-track, rgb(0 0 0 / .08));border-top-color:var(--cngx-chart-spinner-color, var(--cngx-chart-primary, currentColor));border-radius:50%;animation:cngx-chart-spin .8s linear infinite}cngx-chart>.cngx-chart__fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:var(--cngx-chart-fallback-min-height, 48px);font-size:var(--cngx-chart-fallback-font-size, .875rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-chart-fallback-opacity, .7);padding:var(--cngx-chart-fallback-padding, 1rem);text-align:center;box-sizing:border-box}cngx-chart>.cngx-chart__fallback--error{color:var(--cngx-chart-danger, currentColor);opacity:1}cngx-chart>.cngx-chart__connection-overlay{position:absolute;top:calc(var(--cngx-chart-plot-block-start, 0px) + var(--cngx-chart-connection-inset, .5rem));inset-inline-end:calc(var(--cngx-chart-plot-inline-end, 0px) + var(--cngx-chart-connection-inset, .5rem));max-inline-size:calc(100% - var(--cngx-chart-plot-inline-start, 0px) - var(--cngx-chart-plot-inline-end, 0px) - 2 * var(--cngx-chart-connection-inset, .5rem));display:flex;align-items:center;gap:var(--cngx-chart-connection-gap, .375rem);padding:var(--cngx-chart-connection-padding, .25rem .625rem);border-radius:var(--cngx-chart-connection-radius, 999px);font-size:var(--cngx-chart-connection-font-size, .75rem);line-height:1.4;pointer-events:none;box-shadow:var(--cngx-chart-connection-shadow, 0 1px 3px rgb(0 0 0 / .12))}cngx-chart>.cngx-chart__connection-overlay--error{background:var(--cngx-chart-connection-error-bg, var(--cngx-chart-danger, #d32f2f));color:var(--cngx-chart-connection-error-color, #fff)}cngx-chart>.cngx-chart__connection-overlay--reconnecting{background:var(--cngx-chart-connection-reconnecting-bg, rgb(0 0 0 / .72));color:var(--cngx-chart-connection-reconnecting-color, #fff)}cngx-chart>.cngx-chart__sr-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@keyframes cngx-chart-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){cngx-chart .cngx-chart__spinner{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChartDataTable, selector: "cngx-chart-data-table", inputs: ["values", "hidden", "id"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2276
2852
|
}
|
|
2277
2853
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChart, decorators: [{
|
|
2278
2854
|
type: Component,
|
|
@@ -2291,6 +2867,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2291
2867
|
'[style.--cngx-chart-plot-block-end]': 'plotVars().blockEnd',
|
|
2292
2868
|
'[style.--cngx-chart-plot-inline-start]': 'plotVars().inlineStart',
|
|
2293
2869
|
'[style.--cngx-chart-plot-inline-end]': 'plotVars().inlineEnd',
|
|
2870
|
+
// Hatch fills the bar and scatter layers reference in forced colors.
|
|
2871
|
+
'[style.--_cngx-chart-hatch-diagonal]': 'hatchFill.diagonal',
|
|
2872
|
+
'[style.--_cngx-chart-hatch-horizontal]': 'hatchFill.horizontal',
|
|
2294
2873
|
}, hostDirectives: [CngxResizeObserver], providers: [{ provide: CNGX_CHART_CONTEXT, useExisting: CngxChart }], imports: [CngxChartDataTable, NgTemplateOutlet], template: `
|
|
2295
2874
|
@switch (activeView()) {
|
|
2296
2875
|
@case ('skeleton') {
|
|
@@ -2310,7 +2889,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2310
2889
|
<ng-container *ngTemplateOutlet="tpl; context: slotContext()" />
|
|
2311
2890
|
</div>
|
|
2312
2891
|
} @else {
|
|
2313
|
-
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n.empty() }}</div>
|
|
2892
|
+
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n().empty() }}</div>
|
|
2314
2893
|
}
|
|
2315
2894
|
}
|
|
2316
2895
|
@case ('error') {
|
|
@@ -2320,7 +2899,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2320
2899
|
</div>
|
|
2321
2900
|
} @else {
|
|
2322
2901
|
<div class="cngx-chart__fallback cngx-chart__fallback--error" [attr.aria-hidden]="true">
|
|
2323
|
-
{{ i18n.error() }}
|
|
2902
|
+
{{ i18n().error() }}
|
|
2324
2903
|
</div>
|
|
2325
2904
|
}
|
|
2326
2905
|
}
|
|
@@ -2328,6 +2907,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2328
2907
|
@default {
|
|
2329
2908
|
<svg [attr.viewBox]="viewBox()" [attr.preserveAspectRatio]="preserveAspectRatio()">
|
|
2330
2909
|
<svg:title>{{ ariaLabelText() }}</svg:title>
|
|
2910
|
+
<svg:defs>
|
|
2911
|
+
<svg:pattern
|
|
2912
|
+
[attr.id]="hatchId + '-diagonal'"
|
|
2913
|
+
width="4"
|
|
2914
|
+
height="4"
|
|
2915
|
+
patternUnits="userSpaceOnUse"
|
|
2916
|
+
patternTransform="rotate(45)"
|
|
2917
|
+
>
|
|
2918
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2919
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2920
|
+
</svg:pattern>
|
|
2921
|
+
<svg:pattern [attr.id]="hatchId + '-horizontal'" width="4" height="4" patternUnits="userSpaceOnUse">
|
|
2922
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2923
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2924
|
+
</svg:pattern>
|
|
2925
|
+
</svg:defs>
|
|
2331
2926
|
<ng-content />
|
|
2332
2927
|
</svg>
|
|
2333
2928
|
@if (overlayTpl(); as tpl) {
|
|
@@ -2350,7 +2945,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2350
2945
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--error"
|
|
2351
2946
|
role="alert"
|
|
2352
2947
|
>
|
|
2353
|
-
{{
|
|
2948
|
+
{{ connectionOverlayText() }}
|
|
2354
2949
|
</div>
|
|
2355
2950
|
}
|
|
2356
2951
|
} @else if (connectionView() === 'reconnecting') {
|
|
@@ -2366,17 +2961,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2366
2961
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--reconnecting"
|
|
2367
2962
|
role="status"
|
|
2368
2963
|
>
|
|
2369
|
-
{{
|
|
2964
|
+
{{ connectionOverlayText() }}
|
|
2370
2965
|
</div>
|
|
2371
2966
|
}
|
|
2372
2967
|
}
|
|
2968
|
+
<span role="status" aria-live="polite" aria-atomic="true" class="cngx-chart__sr-status">{{
|
|
2969
|
+
connectionRestoredAnnouncement()
|
|
2970
|
+
}}</span>
|
|
2373
2971
|
<cngx-chart-data-table
|
|
2374
2972
|
[id]="dataTableId"
|
|
2375
2973
|
[values]="summaryValues()"
|
|
2376
2974
|
[hidden]="!tableActive() || activeView() !== 'content'"
|
|
2377
2975
|
/>
|
|
2378
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
2379
|
-
}], ctorParameters: () => [], propDecorators: { dataInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], preserveAspectRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "preserveAspectRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], summaryAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "summaryAccessor", required: false }] }], accessibleTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibleTable", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], connectionState: [{ type: i0.Input, args: [{ isSignal: true, alias: "connectionState", required: false }] }], axes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_CHART_AXIS), { ...{ descendants: true }, isSignal: true }] }], thresholds: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxThreshold), { ...{ descendants: true }, isSignal: true }] }], layers: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_CHART_LAYER), { ...{ descendants: true }, isSignal: true }] }], loadingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartLoading), { isSignal: true }] }], emptySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartEmpty), { isSignal: true }] }], errorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartError), { isSignal: true }] }], connectionErrorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartConnectionError), { isSignal: true }] }], reconnectingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartReconnecting), { isSignal: true }] }], overlaySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartOverlay), { isSignal: true }] }], overlaySlots: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxChartOverlay), { isSignal: true }] }] } });
|
|
2976
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-chart .cngx-chart__hatch-ink{fill:CanvasText}cngx-chart .cngx-chart__hatch-gap{fill:Canvas}cngx-chart{display:inline-block;position:relative;max-width:100%}cngx-chart.cngx-chart--responsive{display:block;width:100%;aspect-ratio:var(--cngx-chart-aspect-ratio, 5 / 2)}cngx-chart>.cngx-chart__canvas{position:absolute;inset:0;width:100%;height:100%;z-index:var(--cngx-chart-canvas-z, 0)}cngx-chart.cngx-chart--content-hidden>.cngx-chart__canvas{display:none}cngx-chart>svg{display:block;width:100%;height:100%}cngx-chart>.cngx-chart__fallback-frame{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart>.cngx-chart__overlay-frame{position:absolute;inset-block-start:var(--cngx-chart-plot-block-start, 0px);inset-block-end:var(--cngx-chart-plot-block-end, 0px);inset-inline-start:var(--cngx-chart-plot-inline-start, 0px);inset-inline-end:var(--cngx-chart-plot-inline-end, 0px);z-index:var(--cngx-chart-overlay-z, 1);pointer-events:none}cngx-chart>.cngx-chart__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart .cngx-chart__spinner{width:var(--cngx-chart-spinner-size, 32px);height:var(--cngx-chart-spinner-size, 32px);border:var(--cngx-chart-spinner-thickness, 3px) solid var(--cngx-chart-spinner-track, rgb(0 0 0 / .08));border-top-color:var(--cngx-chart-spinner-color, var(--cngx-chart-primary, currentColor));border-radius:50%;animation:cngx-chart-spin .8s linear infinite}cngx-chart>.cngx-chart__fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:var(--cngx-chart-fallback-min-height, 48px);font-size:var(--cngx-chart-fallback-font-size, .875rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-chart-fallback-opacity, .7);padding:var(--cngx-chart-fallback-padding, 1rem);text-align:center;box-sizing:border-box}cngx-chart>.cngx-chart__fallback--error{color:var(--cngx-chart-danger, currentColor);opacity:1}cngx-chart>.cngx-chart__connection-overlay{position:absolute;top:calc(var(--cngx-chart-plot-block-start, 0px) + var(--cngx-chart-connection-inset, .5rem));inset-inline-end:calc(var(--cngx-chart-plot-inline-end, 0px) + var(--cngx-chart-connection-inset, .5rem));max-inline-size:calc(100% - var(--cngx-chart-plot-inline-start, 0px) - var(--cngx-chart-plot-inline-end, 0px) - 2 * var(--cngx-chart-connection-inset, .5rem));display:flex;align-items:center;gap:var(--cngx-chart-connection-gap, .375rem);padding:var(--cngx-chart-connection-padding, .25rem .625rem);border-radius:var(--cngx-chart-connection-radius, 999px);font-size:var(--cngx-chart-connection-font-size, .75rem);line-height:1.4;pointer-events:none;box-shadow:var(--cngx-chart-connection-shadow, 0 1px 3px rgb(0 0 0 / .12))}cngx-chart>.cngx-chart__connection-overlay--error{background:var(--cngx-chart-connection-error-bg, var(--cngx-chart-danger, #d32f2f));color:var(--cngx-chart-connection-error-color, #fff)}cngx-chart>.cngx-chart__connection-overlay--reconnecting{background:var(--cngx-chart-connection-reconnecting-bg, rgb(0 0 0 / .72));color:var(--cngx-chart-connection-reconnecting-color, #fff)}cngx-chart>.cngx-chart__sr-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@keyframes cngx-chart-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){cngx-chart .cngx-chart__spinner{animation:none}}\n"] }]
|
|
2977
|
+
}], ctorParameters: () => [], propDecorators: { dataInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], preserveAspectRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "preserveAspectRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], summaryAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "summaryAccessor", required: false }] }], accessibleTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibleTable", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], connectionState: [{ type: i0.Input, args: [{ isSignal: true, alias: "connectionState", required: false }] }], axes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_CHART_AXIS), { ...{ descendants: true }, isSignal: true }] }], thresholds: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxThreshold), { ...{ descendants: true }, isSignal: true }] }], layers: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_CHART_LAYER), { ...{ descendants: true }, isSignal: true }] }], loadingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartLoading), { isSignal: true }] }], emptySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartEmpty), { isSignal: true }] }], errorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartError), { isSignal: true }] }], connectionErrorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartConnectionError), { isSignal: true }] }], reconnectingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartReconnecting), { isSignal: true }] }], overlaySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartOverlay), { isSignal: true }] }], overlaySlots: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxChartOverlay), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
2380
2978
|
/** @internal */
|
|
2381
2979
|
function isHorizontalPosition(p) {
|
|
2382
2980
|
return p === 'top' || p === 'bottom';
|
|
@@ -2502,16 +3100,22 @@ function toMs$1(v) {
|
|
|
2502
3100
|
class CngxChartAnnouncer {
|
|
2503
3101
|
/** The chart instance whose `significantChange()` this announcer voices. */
|
|
2504
3102
|
chart = input.required({ ...(ngDevMode ? { debugName: "chart" } : /* istanbul ignore next */ {}), alias: 'cngxChartAnnouncer' });
|
|
2505
|
-
i18n =
|
|
2506
|
-
/**
|
|
3103
|
+
i18n = injectChartI18n();
|
|
3104
|
+
/**
|
|
3105
|
+
* Polite (informational) text for trend flips; empty otherwise. The copy
|
|
3106
|
+
* is read untracked: only the chart event re-derives a live region, so a
|
|
3107
|
+
* copy or locale flip never re-speaks a shown announcement.
|
|
3108
|
+
*/
|
|
2507
3109
|
politeAnnouncement = computed(() => {
|
|
2508
3110
|
const ev = this.chart().significantChange();
|
|
2509
|
-
return ev?.kind === 'trend-flip' ? this.i18n.trendChanged(ev.to) : '';
|
|
3111
|
+
return ev?.kind === 'trend-flip' ? untracked(() => this.i18n().trendChanged(ev.to)) : '';
|
|
2510
3112
|
}, ...(ngDevMode ? [{ debugName: "politeAnnouncement" }] : /* istanbul ignore next */ []));
|
|
2511
|
-
/** Assertive (interrupting) text for threshold crossings; empty otherwise. */
|
|
3113
|
+
/** Assertive (interrupting) text for threshold crossings; empty otherwise. Copy untracked, as above. */
|
|
2512
3114
|
assertiveAnnouncement = computed(() => {
|
|
2513
3115
|
const ev = this.chart().significantChange();
|
|
2514
|
-
return ev?.kind === 'threshold-cross'
|
|
3116
|
+
return ev?.kind === 'threshold-cross'
|
|
3117
|
+
? untracked(() => this.i18n().thresholdAlert(ev.threshold))
|
|
3118
|
+
: '';
|
|
2515
3119
|
}, ...(ngDevMode ? [{ debugName: "assertiveAnnouncement" }] : /* istanbul ignore next */ []));
|
|
2516
3120
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartAnnouncer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2517
3121
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxChartAnnouncer, isStandalone: true, selector: "cngx-chart-announcer", inputs: { chart: { classPropertyName: "chart", publicName: "cngxChartAnnouncer", isSignal: true, isRequired: true, transformFunction: null } }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
|
|
@@ -2655,7 +3259,20 @@ class CngxAxis {
|
|
|
2655
3259
|
* `[label]` for terseness.
|
|
2656
3260
|
*/
|
|
2657
3261
|
axisLabel = input(null, { ...(ngDevMode ? { debugName: "axisLabel" } : /* istanbul ignore next */ {}), alias: 'label' });
|
|
2658
|
-
ctx =
|
|
3262
|
+
ctx = injectChartContext('cngxAxis');
|
|
3263
|
+
locale = injectLocale();
|
|
3264
|
+
/**
|
|
3265
|
+
* The bound `[format]`, or the default tick formatter bound to the app
|
|
3266
|
+
* locale (`CNGX_LOCALE`), so a locale flip re-formats the default labels.
|
|
3267
|
+
*/
|
|
3268
|
+
resolvedFormat = computed(() => {
|
|
3269
|
+
const fmt = this.format();
|
|
3270
|
+
if (fmt !== defaultTickFormat) {
|
|
3271
|
+
return fmt;
|
|
3272
|
+
}
|
|
3273
|
+
const locale = this.locale();
|
|
3274
|
+
return (v) => defaultTickFormat(v, locale);
|
|
3275
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedFormat" }] : /* istanbul ignore next */ []));
|
|
2659
3276
|
/**
|
|
2660
3277
|
* Tick values to render. Resolution order:
|
|
2661
3278
|
* 1. `type='band'` and `[domain]` provided → one tick per domain
|
|
@@ -2785,7 +3402,7 @@ class CngxAxis {
|
|
|
2785
3402
|
* the label's width is exactly what overhangs the plot corner.
|
|
2786
3403
|
*/
|
|
2787
3404
|
longestTickLabel = computed(() => {
|
|
2788
|
-
const fmt = this.
|
|
3405
|
+
const fmt = this.resolvedFormat();
|
|
2789
3406
|
let longest = 0;
|
|
2790
3407
|
for (const v of this.tickValues()) {
|
|
2791
3408
|
const len = fmt(v).length;
|
|
@@ -2839,7 +3456,7 @@ class CngxAxis {
|
|
|
2839
3456
|
tickRenderings = computed(() => {
|
|
2840
3457
|
const pos = this.position();
|
|
2841
3458
|
const values = this.tickValues();
|
|
2842
|
-
const fmt = this.
|
|
3459
|
+
const fmt = this.resolvedFormat();
|
|
2843
3460
|
const plot = this.plot();
|
|
2844
3461
|
if (!plot) {
|
|
2845
3462
|
return [];
|
|
@@ -2929,7 +3546,7 @@ class CngxAxis {
|
|
|
2929
3546
|
}
|
|
2930
3547
|
}
|
|
2931
3548
|
}
|
|
2932
|
-
`, isInline: true, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3549
|
+
`, isInline: true, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}@media(forced-colors:active){.cngx-axis__line,.cngx-axis__tick-line,.cngx-axis__grid-line{stroke:CanvasText}.cngx-axis__grid-line{stroke-opacity:.35}.cngx-axis__tick-label,.cngx-axis__axis-label{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2933
3550
|
}
|
|
2934
3551
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAxis, decorators: [{
|
|
2935
3552
|
type: Component,
|
|
@@ -2991,7 +3608,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2991
3608
|
}
|
|
2992
3609
|
}
|
|
2993
3610
|
}
|
|
2994
|
-
`, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}\n"] }]
|
|
3611
|
+
`, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}@media(forced-colors:active){.cngx-axis__line,.cngx-axis__tick-line,.cngx-axis__grid-line{stroke:CanvasText}.cngx-axis__grid-line{stroke-opacity:.35}.cngx-axis__tick-label,.cngx-axis__axis-label{fill:CanvasText}}\n"] }]
|
|
2995
3612
|
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], domain: [{ type: i0.Input, args: [{ isSignal: true, alias: "domain", required: false }] }], tickCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "ticks", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showGrid: [{ type: i0.Input, args: [{ isSignal: true, alias: "grid", required: false }] }], axisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
|
|
2996
3613
|
/** @internal */
|
|
2997
3614
|
function spread(start, end, count) {
|
|
@@ -3117,27 +3734,60 @@ function buildTickRendering(pos, offset, text, key, plot) {
|
|
|
3117
3734
|
* Default tick label formatter. Strips floating-point arithmetic
|
|
3118
3735
|
* noise from non-integer numbers - `6.6000000000000005` becomes
|
|
3119
3736
|
* `'6.6'`, `2.2` stays `'2.2'`, `25` stays `'25'` - without rounding
|
|
3120
|
-
* away meaningful precision
|
|
3121
|
-
*
|
|
3737
|
+
* away meaningful precision, in the app locale's decimal separator.
|
|
3738
|
+
* Dates go through cached `Intl` formatters ({@link formatDateTick});
|
|
3739
|
+
* other types fall through to `String(v)`. Consumers needing a richer
|
|
3740
|
+
* format bind `[format]`. `CngxAxis` calls it with the `CNGX_LOCALE`
|
|
3741
|
+
* value; the `en-US` default only applies to a direct call.
|
|
3122
3742
|
*
|
|
3123
3743
|
* @internal
|
|
3124
3744
|
*/
|
|
3125
|
-
function defaultTickFormat(v) {
|
|
3745
|
+
function defaultTickFormat(v, locale = 'en-US') {
|
|
3126
3746
|
if (typeof v === 'number') {
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
return String(v);
|
|
3132
|
-
}
|
|
3133
|
-
// 12 significant digits is more than enough for any sensible
|
|
3134
|
-
// chart domain while collapsing the trailing 1e-15 noise
|
|
3135
|
-
// produced by accumulated float math.
|
|
3136
|
-
return Number(v.toPrecision(12)).toString();
|
|
3747
|
+
return formatChartNumber(v, locale);
|
|
3748
|
+
}
|
|
3749
|
+
if (v instanceof Date) {
|
|
3750
|
+
return formatDateTick(v, locale);
|
|
3137
3751
|
}
|
|
3138
3752
|
return String(v);
|
|
3139
3753
|
}
|
|
3140
3754
|
/** @internal */
|
|
3755
|
+
const DATE_TICK_OPTIONS = { month: 'short', day: 'numeric' };
|
|
3756
|
+
/** @internal */
|
|
3757
|
+
const TIME_TICK_OPTIONS = { hour: '2-digit', minute: '2-digit' };
|
|
3758
|
+
/** @internal */
|
|
3759
|
+
const TIME_SECONDS_TICK_OPTIONS = {
|
|
3760
|
+
hour: '2-digit',
|
|
3761
|
+
minute: '2-digit',
|
|
3762
|
+
second: '2-digit',
|
|
3763
|
+
};
|
|
3764
|
+
/**
|
|
3765
|
+
* Compact Date tick label. `String(Date)` produces a ~60-character
|
|
3766
|
+
* string whose length flows into {@link CngxAxis.reservation} and
|
|
3767
|
+
* collapses the plot to a sliver of gutter. Instead: a date at local
|
|
3768
|
+
* midnight labels as a short date (`Sep 4`), any other instant as a
|
|
3769
|
+
* time (`09:14`, with seconds only when the instant carries them) -
|
|
3770
|
+
* the resolution a generated time-axis tick actually has. Formatters
|
|
3771
|
+
* come from the bounded `dateTimeFormatterFor` cache (constructing one
|
|
3772
|
+
* is expensive; the labels feed the gutter arithmetic on every tick
|
|
3773
|
+
* recompute).
|
|
3774
|
+
*
|
|
3775
|
+
* @internal
|
|
3776
|
+
*/
|
|
3777
|
+
function formatDateTick(v, locale) {
|
|
3778
|
+
if (Number.isNaN(v.getTime())) {
|
|
3779
|
+
return '';
|
|
3780
|
+
}
|
|
3781
|
+
const midnight = v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.getMilliseconds() === 0;
|
|
3782
|
+
if (midnight) {
|
|
3783
|
+
return dateTimeFormatterFor(locale, DATE_TICK_OPTIONS).format(v);
|
|
3784
|
+
}
|
|
3785
|
+
if (v.getSeconds() === 0 && v.getMilliseconds() === 0) {
|
|
3786
|
+
return dateTimeFormatterFor(locale, TIME_TICK_OPTIONS).format(v);
|
|
3787
|
+
}
|
|
3788
|
+
return dateTimeFormatterFor(locale, TIME_SECONDS_TICK_OPTIONS).format(v);
|
|
3789
|
+
}
|
|
3790
|
+
/** @internal */
|
|
3141
3791
|
function buildAxisLabelGeometry(pos, plot) {
|
|
3142
3792
|
// Local to the axis group, so the offsets stay as they were and only
|
|
3143
3793
|
// the centring runs along the plot extent instead of the box.
|
|
@@ -3273,6 +3923,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3273
3923
|
* and column; `[align]` aligns along the main axis (`start`, `center`,
|
|
3274
3924
|
* `end`).
|
|
3275
3925
|
*
|
|
3926
|
+
* Under forced colors the swatches turn into a four-step pattern by
|
|
3927
|
+
* entry index (solid, 45deg hatch, hollow, 0deg hatch). The stacked-bar
|
|
3928
|
+
* segments and the chart series carry the same step by index: lines as
|
|
3929
|
+
* solid, dashed, dotted, dash-dot; bars and scatter points as the swatch
|
|
3930
|
+
* patterns. Series count line, bar and scatter layers in source order
|
|
3931
|
+
* (areas, thresholds, bands and axes do not count), so list the entries
|
|
3932
|
+
* in the order of those layers.
|
|
3933
|
+
*
|
|
3276
3934
|
* @category common/chart/legend
|
|
3277
3935
|
* @docsKind primary
|
|
3278
3936
|
* @wcag AA
|
|
@@ -3284,6 +3942,12 @@ class CngxChartLegend {
|
|
|
3284
3942
|
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
3285
3943
|
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
3286
3944
|
align = input('start', ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
3945
|
+
locale = injectLocale();
|
|
3946
|
+
/** @internal Each item's value as display text; numbers in the app locale. */
|
|
3947
|
+
displayValues = computed(() => {
|
|
3948
|
+
const locale = this.locale();
|
|
3949
|
+
return this.items().map(({ value }) => typeof value === 'number' ? formatChartNumber(value, locale) : String(value));
|
|
3950
|
+
}, { ...(ngDevMode ? { debugName: "displayValues" } : /* istanbul ignore next */ {}), equal: arrayEqual });
|
|
3287
3951
|
flexAlign = computed(() => {
|
|
3288
3952
|
switch (this.align()) {
|
|
3289
3953
|
case 'center':
|
|
@@ -3296,7 +3960,7 @@ class CngxChartLegend {
|
|
|
3296
3960
|
}, ...(ngDevMode ? [{ debugName: "flexAlign" }] : /* istanbul ignore next */ []));
|
|
3297
3961
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3298
3962
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxChartLegend, isStandalone: true, selector: "cngx-chart-legend", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "list" }, properties: { "class.cngx-chart-legend--vertical": "orientation() === \"vertical\"", "style.justify-content": "flexAlign()" }, classAttribute: "cngx-chart-legend" }, exportAs: ["cngxChartLegend"], ngImport: i0, template: `
|
|
3299
|
-
@for (item of items(); track $index) {
|
|
3963
|
+
@for (item of items(); track $index; let i = $index) {
|
|
3300
3964
|
<span class="cngx-chart-legend__item" role="listitem">
|
|
3301
3965
|
<span
|
|
3302
3966
|
class="cngx-chart-legend__swatch"
|
|
@@ -3305,11 +3969,11 @@ class CngxChartLegend {
|
|
|
3305
3969
|
></span>
|
|
3306
3970
|
<span class="cngx-chart-legend__label">{{ item.label }}</span>
|
|
3307
3971
|
@if (item.value != null) {
|
|
3308
|
-
<span class="cngx-chart-legend__value">{{
|
|
3972
|
+
<span class="cngx-chart-legend__value">{{ displayValues()[i] }}</span>
|
|
3309
3973
|
}
|
|
3310
3974
|
</span>
|
|
3311
3975
|
}
|
|
3312
|
-
`, isInline: true, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3976
|
+
`, isInline: true, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}@media(forced-colors:active){cngx-chart-legend .cngx-chart-legend__swatch{forced-color-adjust:none;background:CanvasText!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+2) .cngx-chart-legend__swatch{background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+3) .cngx-chart-legend__swatch{background:Canvas!important;box-shadow:inset 0 0 0 1px CanvasText}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+4) .cngx-chart-legend__swatch{background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3313
3977
|
}
|
|
3314
3978
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartLegend, decorators: [{
|
|
3315
3979
|
type: Component,
|
|
@@ -3319,7 +3983,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3319
3983
|
'[class.cngx-chart-legend--vertical]': 'orientation() === "vertical"',
|
|
3320
3984
|
'[style.justify-content]': 'flexAlign()',
|
|
3321
3985
|
}, template: `
|
|
3322
|
-
@for (item of items(); track $index) {
|
|
3986
|
+
@for (item of items(); track $index; let i = $index) {
|
|
3323
3987
|
<span class="cngx-chart-legend__item" role="listitem">
|
|
3324
3988
|
<span
|
|
3325
3989
|
class="cngx-chart-legend__swatch"
|
|
@@ -3328,11 +3992,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3328
3992
|
></span>
|
|
3329
3993
|
<span class="cngx-chart-legend__label">{{ item.label }}</span>
|
|
3330
3994
|
@if (item.value != null) {
|
|
3331
|
-
<span class="cngx-chart-legend__value">{{
|
|
3995
|
+
<span class="cngx-chart-legend__value">{{ displayValues()[i] }}</span>
|
|
3332
3996
|
}
|
|
3333
3997
|
</span>
|
|
3334
3998
|
}
|
|
3335
|
-
`, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"] }]
|
|
3999
|
+
`, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}@media(forced-colors:active){cngx-chart-legend .cngx-chart-legend__swatch{forced-color-adjust:none;background:CanvasText!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+2) .cngx-chart-legend__swatch{background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+3) .cngx-chart-legend__swatch{background:Canvas!important;box-shadow:inset 0 0 0 1px CanvasText}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+4) .cngx-chart-legend__swatch{background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"] }]
|
|
3336
4000
|
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }] } });
|
|
3337
4001
|
|
|
3338
4002
|
/**
|
|
@@ -3520,34 +4184,64 @@ function createPathBuilder(opts) {
|
|
|
3520
4184
|
let lastData = null;
|
|
3521
4185
|
let lastX = null;
|
|
3522
4186
|
let lastY = null;
|
|
4187
|
+
let lastSegments = [];
|
|
3523
4188
|
let lastResult = '';
|
|
3524
4189
|
let rebuilds = 0;
|
|
4190
|
+
const rebuild = (data, xScale, yScale) => {
|
|
4191
|
+
if (data === lastData && xScale === lastX && yScale === lastY) {
|
|
4192
|
+
return;
|
|
4193
|
+
}
|
|
4194
|
+
const runs = projectFiniteRuns(data, xAcc, yAcc, xScale, yScale);
|
|
4195
|
+
lastSegments = runs.map((run) => ({
|
|
4196
|
+
d: buildCurvePath(run, curve),
|
|
4197
|
+
firstX: run[0].x,
|
|
4198
|
+
lastX: run[run.length - 1].x,
|
|
4199
|
+
}));
|
|
4200
|
+
lastResult = lastSegments.map((s) => s.d).join(' ');
|
|
4201
|
+
lastData = data;
|
|
4202
|
+
lastX = xScale;
|
|
4203
|
+
lastY = yScale;
|
|
4204
|
+
rebuilds++;
|
|
4205
|
+
};
|
|
3525
4206
|
return {
|
|
3526
4207
|
build(data, xScale, yScale) {
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
lastX = xScale;
|
|
3534
|
-
lastY = yScale;
|
|
3535
|
-
lastResult = d;
|
|
3536
|
-
rebuilds++;
|
|
3537
|
-
return d;
|
|
4208
|
+
rebuild(data, xScale, yScale);
|
|
4209
|
+
return lastResult;
|
|
4210
|
+
},
|
|
4211
|
+
buildSegments(data, xScale, yScale) {
|
|
4212
|
+
rebuild(data, xScale, yScale);
|
|
4213
|
+
return lastSegments;
|
|
3538
4214
|
},
|
|
3539
4215
|
rebuildCount() {
|
|
3540
4216
|
return rebuilds;
|
|
3541
4217
|
},
|
|
3542
4218
|
};
|
|
3543
4219
|
}
|
|
3544
|
-
/**
|
|
3545
|
-
|
|
3546
|
-
|
|
4220
|
+
/**
|
|
4221
|
+
* Project every row and split the result at non-finite coordinates:
|
|
4222
|
+
* returns the runs of consecutive points whose `x` and `y` are both
|
|
4223
|
+
* finite. Non-finite rows appear in no run - they are the breaks.
|
|
4224
|
+
*
|
|
4225
|
+
* @internal
|
|
4226
|
+
*/
|
|
4227
|
+
function projectFiniteRuns(data, xAcc, yAcc, xScale, yScale) {
|
|
4228
|
+
const runs = [];
|
|
4229
|
+
let current = null;
|
|
3547
4230
|
for (let i = 0; i < data.length; i++) {
|
|
3548
|
-
|
|
4231
|
+
const x = xScale(xAcc(data[i], i));
|
|
4232
|
+
const y = yScale(yAcc(data[i], i));
|
|
4233
|
+
if (Number.isFinite(x) && Number.isFinite(y)) {
|
|
4234
|
+
if (current === null) {
|
|
4235
|
+
current = [];
|
|
4236
|
+
runs.push(current);
|
|
4237
|
+
}
|
|
4238
|
+
current.push({ x, y });
|
|
4239
|
+
}
|
|
4240
|
+
else {
|
|
4241
|
+
current = null;
|
|
4242
|
+
}
|
|
3549
4243
|
}
|
|
3550
|
-
return
|
|
4244
|
+
return runs;
|
|
3551
4245
|
}
|
|
3552
4246
|
|
|
3553
4247
|
/**
|
|
@@ -3599,7 +4293,7 @@ class CngxLine {
|
|
|
3599
4293
|
* `'always'` marks every datum; `'never'` suppresses markers.
|
|
3600
4294
|
*/
|
|
3601
4295
|
points = input('auto', ...(ngDevMode ? [{ debugName: "points" }] : /* istanbul ignore next */ []));
|
|
3602
|
-
ctx = injectChartContext('
|
|
4296
|
+
ctx = injectChartContext('cngxLine');
|
|
3603
4297
|
builder = computed(() => createPathBuilder({
|
|
3604
4298
|
y: this.accessor(),
|
|
3605
4299
|
x: this.xAccessor(),
|
|
@@ -3632,13 +4326,13 @@ class CngxLine {
|
|
|
3632
4326
|
return g.kind === 'line' ? (g.points ?? EMPTY_POINTS) : EMPTY_POINTS;
|
|
3633
4327
|
}, ...(ngDevMode ? [{ debugName: "pointMarks" }] : /* istanbul ignore next */ []));
|
|
3634
4328
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxLine, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3635
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxLine, isStandalone: true, selector: "[cngxLine]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], exportAs: ["cngxLine"], ngImport: i0, template: `
|
|
4329
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxLine, isStandalone: true, selector: "[cngxLine]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-chart-series" }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], exportAs: ["cngxLine"], ngImport: i0, template: `
|
|
3636
4330
|
@if (ctx.renderSvg()) {
|
|
3637
4331
|
<svg:path
|
|
3638
4332
|
class="cngx-line"
|
|
3639
4333
|
[attr.d]="d()"
|
|
3640
4334
|
[attr.fill]="'none'"
|
|
3641
|
-
[
|
|
4335
|
+
[style.stroke]="color()"
|
|
3642
4336
|
[attr.stroke-width]="strokeWidth()"
|
|
3643
4337
|
[attr.stroke-linejoin]="'round'"
|
|
3644
4338
|
[attr.stroke-linecap]="'round'"
|
|
@@ -3647,17 +4341,17 @@ class CngxLine {
|
|
|
3647
4341
|
<svg:circle class="cngx-line__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3648
4342
|
}
|
|
3649
4343
|
}
|
|
3650
|
-
`, isInline: true, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4344
|
+
`, isInline: true, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}@media(forced-colors:active){.cngx-line{stroke:CanvasText!important}.cngx-line__point{fill:CanvasText}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-line{stroke-dasharray:6 3}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-line{stroke-dasharray:.1 4}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-line{stroke-dasharray:8 3 .1 3}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3651
4345
|
}
|
|
3652
4346
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxLine, decorators: [{
|
|
3653
4347
|
type: Component,
|
|
3654
|
-
args: [{ selector: '[cngxLine]', exportAs: 'cngxLine', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], template: `
|
|
4348
|
+
args: [{ selector: '[cngxLine]', exportAs: 'cngxLine', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], host: { class: 'cngx-chart-series' }, template: `
|
|
3655
4349
|
@if (ctx.renderSvg()) {
|
|
3656
4350
|
<svg:path
|
|
3657
4351
|
class="cngx-line"
|
|
3658
4352
|
[attr.d]="d()"
|
|
3659
4353
|
[attr.fill]="'none'"
|
|
3660
|
-
[
|
|
4354
|
+
[style.stroke]="color()"
|
|
3661
4355
|
[attr.stroke-width]="strokeWidth()"
|
|
3662
4356
|
[attr.stroke-linejoin]="'round'"
|
|
3663
4357
|
[attr.stroke-linecap]="'round'"
|
|
@@ -3666,7 +4360,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3666
4360
|
<svg:circle class="cngx-line__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3667
4361
|
}
|
|
3668
4362
|
}
|
|
3669
|
-
`, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}\n"] }]
|
|
4363
|
+
`, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}@media(forced-colors:active){.cngx-line{stroke:CanvasText!important}.cngx-line__point{fill:CanvasText}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-line{stroke-dasharray:6 3}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-line{stroke-dasharray:.1 4}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-line{stroke-dasharray:8 3 .1 3}}\n"] }]
|
|
3670
4364
|
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], points: [{ type: i0.Input, args: [{ isSignal: true, alias: "points", required: false }] }] } });
|
|
3671
4365
|
|
|
3672
4366
|
/**
|
|
@@ -3702,6 +4396,7 @@ class CngxArea {
|
|
|
3702
4396
|
accessor = input((d) => Number(d), ...(ngDevMode ? [{ debugName: "accessor" }] : /* istanbul ignore next */ []));
|
|
3703
4397
|
xAccessor = input(undefined, ...(ngDevMode ? [{ debugName: "xAccessor" }] : /* istanbul ignore next */ []));
|
|
3704
4398
|
opacity = input(null, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
|
|
4399
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
3705
4400
|
curve = input('linear', ...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
3706
4401
|
baseline = input(0, ...(ngDevMode ? [{ debugName: "baseline" }] : /* istanbul ignore next */ []));
|
|
3707
4402
|
data = input(undefined, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -3712,7 +4407,7 @@ class CngxArea {
|
|
|
3712
4407
|
* `'always'` marks every datum; `'never'` suppresses markers.
|
|
3713
4408
|
*/
|
|
3714
4409
|
points = input('auto', ...(ngDevMode ? [{ debugName: "points" }] : /* istanbul ignore next */ []));
|
|
3715
|
-
ctx = injectChartContext('
|
|
4410
|
+
ctx = injectChartContext('cngxArea');
|
|
3716
4411
|
builder = computed(() => createPathBuilder({
|
|
3717
4412
|
y: this.accessor(),
|
|
3718
4413
|
x: this.xAccessor(),
|
|
@@ -3732,19 +4427,21 @@ class CngxArea {
|
|
|
3732
4427
|
}
|
|
3733
4428
|
const xScale = this.ctx.xScale();
|
|
3734
4429
|
const yScale = this.ctx.yScale();
|
|
3735
|
-
const upper = this.builder().build(data, xScale, yScale);
|
|
3736
4430
|
const baselineY = yScale(this.baseline());
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
return
|
|
4431
|
+
// Close every finite run to the baseline individually - a gap
|
|
4432
|
+
// (non-finite row) must stay unfilled, not be bridged by one
|
|
4433
|
+
// whole-path closure.
|
|
4434
|
+
return this.builder()
|
|
4435
|
+
.buildSegments(data, xScale, yScale)
|
|
4436
|
+
.map((seg) => `${seg.d} L ${seg.lastX} ${baselineY} L ${seg.firstX} ${baselineY} Z`)
|
|
4437
|
+
.join(' ');
|
|
3741
4438
|
}, { ...(ngDevMode ? { debugName: "d" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b });
|
|
3742
4439
|
geometry = computed(() => {
|
|
3743
4440
|
const op = this.opacity();
|
|
3744
4441
|
return {
|
|
3745
4442
|
kind: 'area',
|
|
3746
4443
|
d: this.d(),
|
|
3747
|
-
color:
|
|
4444
|
+
color: this.color(),
|
|
3748
4445
|
strokeWidth: null,
|
|
3749
4446
|
fill: null,
|
|
3750
4447
|
opacity: op == null ? null : Number(op),
|
|
@@ -3761,26 +4458,36 @@ class CngxArea {
|
|
|
3761
4458
|
return g.kind === 'area' ? (g.points ?? EMPTY_POINTS) : EMPTY_POINTS;
|
|
3762
4459
|
}, ...(ngDevMode ? [{ debugName: "pointMarks" }] : /* istanbul ignore next */ []));
|
|
3763
4460
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxArea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3764
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxArea, isStandalone: true, selector: "[cngxArea]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxArea }], exportAs: ["cngxArea"], ngImport: i0, template: `
|
|
4461
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxArea, isStandalone: true, selector: "[cngxArea]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxArea }], exportAs: ["cngxArea"], ngImport: i0, template: `
|
|
3765
4462
|
@if (ctx.renderSvg()) {
|
|
3766
|
-
<svg:path
|
|
4463
|
+
<svg:path
|
|
4464
|
+
class="cngx-area"
|
|
4465
|
+
[attr.d]="d()"
|
|
4466
|
+
[style.fill]="color()"
|
|
4467
|
+
[style.fill-opacity]="opacity()"
|
|
4468
|
+
/>
|
|
3767
4469
|
@for (p of pointMarks(); track $index) {
|
|
3768
4470
|
<svg:circle class="cngx-area__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3769
4471
|
}
|
|
3770
4472
|
}
|
|
3771
|
-
`, isInline: true, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4473
|
+
`, isInline: true, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}@media(forced-colors:active){.cngx-area{fill:CanvasText!important}.cngx-area__point{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3772
4474
|
}
|
|
3773
4475
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxArea, decorators: [{
|
|
3774
4476
|
type: Component,
|
|
3775
4477
|
args: [{ selector: '[cngxArea]', exportAs: 'cngxArea', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxArea }], template: `
|
|
3776
4478
|
@if (ctx.renderSvg()) {
|
|
3777
|
-
<svg:path
|
|
4479
|
+
<svg:path
|
|
4480
|
+
class="cngx-area"
|
|
4481
|
+
[attr.d]="d()"
|
|
4482
|
+
[style.fill]="color()"
|
|
4483
|
+
[style.fill-opacity]="opacity()"
|
|
4484
|
+
/>
|
|
3778
4485
|
@for (p of pointMarks(); track $index) {
|
|
3779
4486
|
<svg:circle class="cngx-area__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3780
4487
|
}
|
|
3781
4488
|
}
|
|
3782
|
-
`, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}\n"] }]
|
|
3783
|
-
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], points: [{ type: i0.Input, args: [{ isSignal: true, alias: "points", required: false }] }] } });
|
|
4489
|
+
`, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}@media(forced-colors:active){.cngx-area{fill:CanvasText!important}.cngx-area__point{fill:CanvasText}}\n"] }]
|
|
4490
|
+
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], points: [{ type: i0.Input, args: [{ isSignal: true, alias: "points", required: false }] }] } });
|
|
3784
4491
|
|
|
3785
4492
|
/** @internal */
|
|
3786
4493
|
const FALLBACK_BASELINE = 0;
|
|
@@ -3815,7 +4522,8 @@ class CngxBar {
|
|
|
3815
4522
|
gap = input(0.1, ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
3816
4523
|
baseline = input(FALLBACK_BASELINE, ...(ngDevMode ? [{ debugName: "baseline" }] : /* istanbul ignore next */ []));
|
|
3817
4524
|
data = input(undefined, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
3818
|
-
|
|
4525
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
4526
|
+
ctx = injectChartContext('cngxBar');
|
|
3819
4527
|
resolvedData = computed(() => {
|
|
3820
4528
|
const local = this.data();
|
|
3821
4529
|
if (local !== undefined) {
|
|
@@ -3863,10 +4571,16 @@ class CngxBar {
|
|
|
3863
4571
|
}, { ...(ngDevMode ? { debugName: "rects" } : /* istanbul ignore next */ {}), equal: rectsEqual });
|
|
3864
4572
|
geometry = computed(() => ({
|
|
3865
4573
|
kind: 'bar',
|
|
3866
|
-
rects: this.rects().map((r) => ({
|
|
4574
|
+
rects: this.rects().map((r) => ({
|
|
4575
|
+
x: r.x,
|
|
4576
|
+
y: r.y,
|
|
4577
|
+
w: r.width,
|
|
4578
|
+
h: r.height,
|
|
4579
|
+
color: this.color(),
|
|
4580
|
+
})),
|
|
3867
4581
|
}), { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: barGeomEqual });
|
|
3868
4582
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3869
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBar, isStandalone: true, selector: "[cngxBar]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], exportAs: ["cngxBar"], ngImport: i0, template: `
|
|
4583
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBar, isStandalone: true, selector: "[cngxBar]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-chart-series" }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], exportAs: ["cngxBar"], ngImport: i0, template: `
|
|
3870
4584
|
@if (ctx.renderSvg()) {
|
|
3871
4585
|
@for (rect of rects(); track rect.key) {
|
|
3872
4586
|
<svg:rect
|
|
@@ -3875,14 +4589,15 @@ class CngxBar {
|
|
|
3875
4589
|
[attr.y]="rect.y"
|
|
3876
4590
|
[attr.width]="rect.width"
|
|
3877
4591
|
[attr.height]="rect.height"
|
|
4592
|
+
[style.fill]="color()"
|
|
3878
4593
|
/>
|
|
3879
4594
|
}
|
|
3880
4595
|
}
|
|
3881
|
-
`, isInline: true, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4596
|
+
`, isInline: true, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}@media(forced-colors:active){.cngx-bar{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-bar{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3882
4597
|
}
|
|
3883
4598
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBar, decorators: [{
|
|
3884
4599
|
type: Component,
|
|
3885
|
-
args: [{ selector: '[cngxBar]', exportAs: 'cngxBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], template: `
|
|
4600
|
+
args: [{ selector: '[cngxBar]', exportAs: 'cngxBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], host: { class: 'cngx-chart-series' }, template: `
|
|
3886
4601
|
@if (ctx.renderSvg()) {
|
|
3887
4602
|
@for (rect of rects(); track rect.key) {
|
|
3888
4603
|
<svg:rect
|
|
@@ -3891,11 +4606,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3891
4606
|
[attr.y]="rect.y"
|
|
3892
4607
|
[attr.width]="rect.width"
|
|
3893
4608
|
[attr.height]="rect.height"
|
|
4609
|
+
[style.fill]="color()"
|
|
3894
4610
|
/>
|
|
3895
4611
|
}
|
|
3896
4612
|
}
|
|
3897
|
-
`, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}\n"] }]
|
|
3898
|
-
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
4613
|
+
`, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}@media(forced-colors:active){.cngx-bar{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-bar{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"] }]
|
|
4614
|
+
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
3899
4615
|
/** @internal */
|
|
3900
4616
|
function barGeomEqual(a, b) {
|
|
3901
4617
|
if (a === b) {
|
|
@@ -3970,7 +4686,8 @@ class CngxScatter {
|
|
|
3970
4686
|
y = input.required(...(ngDevMode ? [{ debugName: "y" }] : /* istanbul ignore next */ []));
|
|
3971
4687
|
radius = input(3, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
|
|
3972
4688
|
data = input(undefined, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
3973
|
-
|
|
4689
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
4690
|
+
ctx = injectChartContext('cngxScatter');
|
|
3974
4691
|
resolvedData = computed(() => {
|
|
3975
4692
|
const local = this.data();
|
|
3976
4693
|
if (local !== undefined) {
|
|
@@ -3998,28 +4715,40 @@ class CngxScatter {
|
|
|
3998
4715
|
const r = this.radius();
|
|
3999
4716
|
return {
|
|
4000
4717
|
kind: 'scatter',
|
|
4001
|
-
marks: this.circles().map((c) => ({ cx: c.cx, cy: c.cy, r, color:
|
|
4718
|
+
marks: this.circles().map((c) => ({ cx: c.cx, cy: c.cy, r, color: this.color() })),
|
|
4002
4719
|
};
|
|
4003
4720
|
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: scatterGeomEqual });
|
|
4004
4721
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScatter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4005
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxScatter, isStandalone: true, selector: "[cngxScatter]", inputs: { x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: true, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: true, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], exportAs: ["cngxScatter"], ngImport: i0, template: `
|
|
4722
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxScatter, isStandalone: true, selector: "[cngxScatter]", inputs: { x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: true, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: true, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-chart-series" }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], exportAs: ["cngxScatter"], ngImport: i0, template: `
|
|
4006
4723
|
@if (ctx.renderSvg()) {
|
|
4007
4724
|
@for (c of circles(); track c.key) {
|
|
4008
|
-
<svg:circle
|
|
4725
|
+
<svg:circle
|
|
4726
|
+
class="cngx-scatter"
|
|
4727
|
+
[attr.cx]="c.cx"
|
|
4728
|
+
[attr.cy]="c.cy"
|
|
4729
|
+
[attr.r]="radius()"
|
|
4730
|
+
[style.fill]="color()"
|
|
4731
|
+
/>
|
|
4009
4732
|
}
|
|
4010
4733
|
}
|
|
4011
|
-
`, isInline: true, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4734
|
+
`, isInline: true, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}@media(forced-colors:active){.cngx-scatter{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-scatter{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4012
4735
|
}
|
|
4013
4736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScatter, decorators: [{
|
|
4014
4737
|
type: Component,
|
|
4015
|
-
args: [{ selector: '[cngxScatter]', exportAs: 'cngxScatter', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], template: `
|
|
4738
|
+
args: [{ selector: '[cngxScatter]', exportAs: 'cngxScatter', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], host: { class: 'cngx-chart-series' }, template: `
|
|
4016
4739
|
@if (ctx.renderSvg()) {
|
|
4017
4740
|
@for (c of circles(); track c.key) {
|
|
4018
|
-
<svg:circle
|
|
4741
|
+
<svg:circle
|
|
4742
|
+
class="cngx-scatter"
|
|
4743
|
+
[attr.cx]="c.cx"
|
|
4744
|
+
[attr.cy]="c.cy"
|
|
4745
|
+
[attr.r]="radius()"
|
|
4746
|
+
[style.fill]="color()"
|
|
4747
|
+
/>
|
|
4019
4748
|
}
|
|
4020
4749
|
}
|
|
4021
|
-
`, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}\n"] }]
|
|
4022
|
-
}], propDecorators: { x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: true }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: true }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
4750
|
+
`, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}@media(forced-colors:active){.cngx-scatter{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-scatter{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"] }]
|
|
4751
|
+
}], propDecorators: { x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: true }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: true }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
4023
4752
|
/** @internal */
|
|
4024
4753
|
function scatterGeomEqual(a, b) {
|
|
4025
4754
|
if (a === b) {
|
|
@@ -4085,7 +4814,8 @@ class CngxBand {
|
|
|
4085
4814
|
to = input.required(...(ngDevMode ? [{ debugName: "to" }] : /* istanbul ignore next */ []));
|
|
4086
4815
|
label = input(null, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
4087
4816
|
opacity = input(null, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
|
|
4088
|
-
|
|
4817
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
4818
|
+
ctx = injectChartContext('cngxBand');
|
|
4089
4819
|
rect = computed(() => {
|
|
4090
4820
|
// The plot, not the box: the band spans the area the marks live
|
|
4091
4821
|
// in, so it stops at the axis gutter instead of painting over
|
|
@@ -4116,12 +4846,12 @@ class CngxBand {
|
|
|
4116
4846
|
y: r?.y ?? 0,
|
|
4117
4847
|
w: r?.width ?? 0,
|
|
4118
4848
|
h: r?.height ?? 0,
|
|
4119
|
-
color:
|
|
4849
|
+
color: this.color(),
|
|
4120
4850
|
opacity: op == null ? null : Number(op),
|
|
4121
4851
|
};
|
|
4122
4852
|
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: bandGeomEqual });
|
|
4123
4853
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBand, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4124
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBand, isStandalone: true, selector: "[cngxBand]", inputs: { from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBand }], exportAs: ["cngxBand"], ngImport: i0, template: `
|
|
4854
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBand, isStandalone: true, selector: "[cngxBand]", inputs: { from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBand }], exportAs: ["cngxBand"], ngImport: i0, template: `
|
|
4125
4855
|
@if (rect(); as r) {
|
|
4126
4856
|
@if (ctx.renderSvg()) {
|
|
4127
4857
|
<svg:rect
|
|
@@ -4130,7 +4860,8 @@ class CngxBand {
|
|
|
4130
4860
|
[attr.y]="r.y"
|
|
4131
4861
|
[attr.width]="r.width"
|
|
4132
4862
|
[attr.height]="r.height"
|
|
4133
|
-
[
|
|
4863
|
+
[style.fill]="color()"
|
|
4864
|
+
[style.fill-opacity]="opacity()"
|
|
4134
4865
|
/>
|
|
4135
4866
|
}
|
|
4136
4867
|
<!--
|
|
@@ -4150,7 +4881,7 @@ class CngxBand {
|
|
|
4150
4881
|
</svg:text>
|
|
4151
4882
|
}
|
|
4152
4883
|
}
|
|
4153
|
-
`, isInline: true, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4884
|
+
`, isInline: true, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}@media(forced-colors:active){.cngx-band__rect{fill:CanvasText!important}.cngx-band__label{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4154
4885
|
}
|
|
4155
4886
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBand, decorators: [{
|
|
4156
4887
|
type: Component,
|
|
@@ -4163,7 +4894,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4163
4894
|
[attr.y]="r.y"
|
|
4164
4895
|
[attr.width]="r.width"
|
|
4165
4896
|
[attr.height]="r.height"
|
|
4166
|
-
[
|
|
4897
|
+
[style.fill]="color()"
|
|
4898
|
+
[style.fill-opacity]="opacity()"
|
|
4167
4899
|
/>
|
|
4168
4900
|
}
|
|
4169
4901
|
<!--
|
|
@@ -4183,8 +4915,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4183
4915
|
</svg:text>
|
|
4184
4916
|
}
|
|
4185
4917
|
}
|
|
4186
|
-
`, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}\n"] }]
|
|
4187
|
-
}], propDecorators: { from: [{ type: i0.Input, args: [{ isSignal: true, alias: "from", required: true }] }], to: [{ type: i0.Input, args: [{ isSignal: true, alias: "to", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }] } });
|
|
4918
|
+
`, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}@media(forced-colors:active){.cngx-band__rect{fill:CanvasText!important}.cngx-band__label{fill:CanvasText}}\n"] }]
|
|
4919
|
+
}], propDecorators: { from: [{ type: i0.Input, args: [{ isSignal: true, alias: "from", required: true }] }], to: [{ type: i0.Input, args: [{ isSignal: true, alias: "to", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
4188
4920
|
/** @internal */
|
|
4189
4921
|
function bandGeomEqual(a, b) {
|
|
4190
4922
|
if (a === b) {
|
|
@@ -4217,7 +4949,7 @@ function bandGeomEqual(a, b) {
|
|
|
4217
4949
|
* @internal
|
|
4218
4950
|
*/
|
|
4219
4951
|
function injectPresetState(state) {
|
|
4220
|
-
const i18n =
|
|
4952
|
+
const i18n = injectChartI18n();
|
|
4221
4953
|
const activeView = computed(() => {
|
|
4222
4954
|
const s = state();
|
|
4223
4955
|
if (!s) {
|
|
@@ -4227,6 +4959,35 @@ function injectPresetState(state) {
|
|
|
4227
4959
|
}, ...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
|
|
4228
4960
|
return { i18n, activeView };
|
|
4229
4961
|
}
|
|
4962
|
+
/**
|
|
4963
|
+
* Dev-mode guard for the named-role presets (`role="meter"` /
|
|
4964
|
+
* `role="img"`): warns once after first render when the host ended up
|
|
4965
|
+
* with no accessible name - an unnamed meter reads to AT as a bare
|
|
4966
|
+
* number with no subject. Same shape as the `cngx-status` warning.
|
|
4967
|
+
* Call from the preset's constructor (needs the injection context for
|
|
4968
|
+
* `ElementRef` and `afterNextRender`) inside a dev-mode guard, so the
|
|
4969
|
+
* call and its hint strings strip from production builds.
|
|
4970
|
+
*
|
|
4971
|
+
* @internal
|
|
4972
|
+
*/
|
|
4973
|
+
function warnIfUnnamedPreset(selector, hint, hasName) {
|
|
4974
|
+
if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {
|
|
4975
|
+
return;
|
|
4976
|
+
}
|
|
4977
|
+
const el = inject(ElementRef).nativeElement;
|
|
4978
|
+
afterNextRender(() => {
|
|
4979
|
+
if (hasName()) {
|
|
4980
|
+
return;
|
|
4981
|
+
}
|
|
4982
|
+
// The inputs say unnamed - a consumer can still name the host
|
|
4983
|
+
// externally via a plain aria-labelledby attribute.
|
|
4984
|
+
if (el.getAttribute('aria-label') || el.getAttribute('aria-labelledby')) {
|
|
4985
|
+
return;
|
|
4986
|
+
}
|
|
4987
|
+
cngxDevWarn('CNGX1010', `[${selector}] role="${el.getAttribute('role') ?? 'meter'}" has no accessible name - ` +
|
|
4988
|
+
`AT announces the value with no subject. ${hint}`);
|
|
4989
|
+
});
|
|
4990
|
+
}
|
|
4230
4991
|
|
|
4231
4992
|
/**
|
|
4232
4993
|
* Inline sparkline - a tiny line chart for KPI cards and dashboard
|
|
@@ -4264,48 +5025,26 @@ class CngxSparkline {
|
|
|
4264
5025
|
preset = injectPresetState(() => this.state());
|
|
4265
5026
|
i18n = this.preset.i18n;
|
|
4266
5027
|
activeView = this.preset.activeView;
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
yDomain = computed(() => {
|
|
4272
|
-
const d = this.data();
|
|
4273
|
-
if (d.length === 0) {
|
|
4274
|
-
return [0, 1];
|
|
4275
|
-
}
|
|
4276
|
-
let min = d[0];
|
|
4277
|
-
let max = d[0];
|
|
4278
|
-
for (let i = 1; i < d.length; i++) {
|
|
4279
|
-
const v = d[i];
|
|
4280
|
-
if (v < min) {
|
|
4281
|
-
min = v;
|
|
4282
|
-
}
|
|
4283
|
-
if (v > max) {
|
|
4284
|
-
max = v;
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
if (min === max) {
|
|
4288
|
-
return [min - 1, max + 1];
|
|
4289
|
-
}
|
|
4290
|
-
return [min, max];
|
|
4291
|
-
}, ...(ngDevMode ? [{ debugName: "yDomain" }] : /* istanbul ignore next */ []));
|
|
5028
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5029
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5030
|
+
xDomain = computed(() => presetIndexDomain(this.data().length), { ...(ngDevMode ? { debugName: "xDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
5031
|
+
yDomain = computed(() => presetValueDomain(this.data()), { ...(ngDevMode ? { debugName: "yDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
4292
5032
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSparkline, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4293
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSparkline, isStandalone: true, selector: "cngx-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-sparkline" }, exportAs: ["cngxSparkline"], ngImport: i0, template: `
|
|
5033
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSparkline, isStandalone: true, selector: "cngx-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-sparkline" }, exportAs: ["cngxSparkline"], ngImport: i0, template: `
|
|
4294
5034
|
@switch (activeView()) {
|
|
4295
5035
|
@case ('skeleton') {
|
|
4296
5036
|
<span
|
|
4297
5037
|
class="cngx-preset-skeleton"
|
|
4298
5038
|
[style.width.px]="width()"
|
|
4299
5039
|
[style.height.px]="height()"
|
|
4300
|
-
|
|
4301
|
-
[attr.aria-label]="i18n.loading()"
|
|
5040
|
+
aria-hidden="true"
|
|
4302
5041
|
></span>
|
|
4303
5042
|
}
|
|
4304
5043
|
@case ('empty') {
|
|
4305
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5044
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4306
5045
|
}
|
|
4307
5046
|
@case ('error') {
|
|
4308
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5047
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4309
5048
|
}
|
|
4310
5049
|
@case ('none') {}
|
|
4311
5050
|
@default {
|
|
@@ -4315,18 +5054,8 @@ class CngxSparkline {
|
|
|
4315
5054
|
[height]="height()"
|
|
4316
5055
|
[aria-label]="ariaLabel()"
|
|
4317
5056
|
>
|
|
4318
|
-
<svg:g
|
|
4319
|
-
|
|
4320
|
-
position="bottom"
|
|
4321
|
-
type="linear"
|
|
4322
|
-
[domain]="xDomain()"
|
|
4323
|
-
></svg:g>
|
|
4324
|
-
<svg:g
|
|
4325
|
-
cngxAxisDomain
|
|
4326
|
-
position="left"
|
|
4327
|
-
type="linear"
|
|
4328
|
-
[domain]="yDomain()"
|
|
4329
|
-
></svg:g>
|
|
5057
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5058
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4330
5059
|
@if (showArea()) {
|
|
4331
5060
|
<svg:g cngxArea [baseline]="yDomain()[0]"></svg:g>
|
|
4332
5061
|
}
|
|
@@ -4334,26 +5063,28 @@ class CngxSparkline {
|
|
|
4334
5063
|
</cngx-chart>
|
|
4335
5064
|
}
|
|
4336
5065
|
}
|
|
4337
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5066
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state", "connectionState"], exportAs: ["cngxChart"] }, { kind: "directive", type: CngxAxisDomain, selector: "[cngxAxisDomain]", inputs: ["position", "type", "domain"], exportAs: ["cngxAxisDomain"] }, { kind: "component", type: CngxLine, selector: "[cngxLine]", inputs: ["accessor", "xAccessor", "color", "strokeWidth", "curve", "data", "points"], exportAs: ["cngxLine"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "color", "curve", "baseline", "data", "points"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4338
5067
|
}
|
|
4339
5068
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSparkline, decorators: [{
|
|
4340
5069
|
type: Component,
|
|
4341
|
-
args: [{ selector: 'cngx-sparkline', exportAs: 'cngxSparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxLine, CngxArea], host: {
|
|
5070
|
+
args: [{ selector: 'cngx-sparkline', exportAs: 'cngxSparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxLine, CngxArea], host: {
|
|
5071
|
+
class: 'cngx-sparkline',
|
|
5072
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5073
|
+
}, template: `
|
|
4342
5074
|
@switch (activeView()) {
|
|
4343
5075
|
@case ('skeleton') {
|
|
4344
5076
|
<span
|
|
4345
5077
|
class="cngx-preset-skeleton"
|
|
4346
5078
|
[style.width.px]="width()"
|
|
4347
5079
|
[style.height.px]="height()"
|
|
4348
|
-
|
|
4349
|
-
[attr.aria-label]="i18n.loading()"
|
|
5080
|
+
aria-hidden="true"
|
|
4350
5081
|
></span>
|
|
4351
5082
|
}
|
|
4352
5083
|
@case ('empty') {
|
|
4353
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5084
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4354
5085
|
}
|
|
4355
5086
|
@case ('error') {
|
|
4356
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5087
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4357
5088
|
}
|
|
4358
5089
|
@case ('none') {}
|
|
4359
5090
|
@default {
|
|
@@ -4363,18 +5094,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4363
5094
|
[height]="height()"
|
|
4364
5095
|
[aria-label]="ariaLabel()"
|
|
4365
5096
|
>
|
|
4366
|
-
<svg:g
|
|
4367
|
-
|
|
4368
|
-
position="bottom"
|
|
4369
|
-
type="linear"
|
|
4370
|
-
[domain]="xDomain()"
|
|
4371
|
-
></svg:g>
|
|
4372
|
-
<svg:g
|
|
4373
|
-
cngxAxisDomain
|
|
4374
|
-
position="left"
|
|
4375
|
-
type="linear"
|
|
4376
|
-
[domain]="yDomain()"
|
|
4377
|
-
></svg:g>
|
|
5097
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5098
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4378
5099
|
@if (showArea()) {
|
|
4379
5100
|
<svg:g cngxArea [baseline]="yDomain()[0]"></svg:g>
|
|
4380
5101
|
}
|
|
@@ -4382,7 +5103,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4382
5103
|
</cngx-chart>
|
|
4383
5104
|
}
|
|
4384
5105
|
}
|
|
4385
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5106
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"] }]
|
|
4386
5107
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], showArea: [{ type: i0.Input, args: [{ isSignal: true, alias: "showArea", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4387
5108
|
|
|
4388
5109
|
/**
|
|
@@ -4418,37 +5139,31 @@ class CngxMiniBar {
|
|
|
4418
5139
|
preset = injectPresetState(() => this.state());
|
|
4419
5140
|
i18n = this.preset.i18n;
|
|
4420
5141
|
activeView = this.preset.activeView;
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
if (ratio > 100) {
|
|
4433
|
-
return 100;
|
|
5142
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5143
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5144
|
+
/**
|
|
5145
|
+
* Meter value attributes render only in the content view: keeping
|
|
5146
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5147
|
+
* announce a stale reading for a value that is not on screen.
|
|
5148
|
+
*/
|
|
5149
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5150
|
+
constructor() {
|
|
5151
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
5152
|
+
warnIfUnnamedPreset('cngx-mini-bar', 'Bind [label] or [aria-label].', () => !!(this.ariaLabel() ?? this.label()));
|
|
4434
5153
|
}
|
|
4435
|
-
|
|
4436
|
-
|
|
5154
|
+
}
|
|
5155
|
+
percent = computed(() => clampedRatio(this.value(), this.min(), this.max()) * 100, ...(ngDevMode ? [{ debugName: "percent" }] : /* istanbul ignore next */ []));
|
|
4437
5156
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4438
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniBar, isStandalone: true, selector: "cngx-mini-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-label": "ariaLabel() ?? label()" }, classAttribute: "cngx-mini-bar" }, exportAs: ["cngxMiniBar"], ngImport: i0, template: `
|
|
5157
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniBar, isStandalone: true, selector: "cngx-mini-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? value() : null", "attr.aria-valuemin": "showsMeterValue() ? min() : null", "attr.aria-valuemax": "showsMeterValue() ? max() : null", "attr.aria-label": "ariaLabel() ?? label()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-mini-bar" }, exportAs: ["cngxMiniBar"], ngImport: i0, template: `
|
|
4439
5158
|
@switch (activeView()) {
|
|
4440
5159
|
@case ('skeleton') {
|
|
4441
|
-
<span
|
|
4442
|
-
class="cngx-preset-skeleton"
|
|
4443
|
-
[attr.aria-busy]="true"
|
|
4444
|
-
[attr.aria-label]="i18n.loading()"
|
|
4445
|
-
></span>
|
|
5160
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4446
5161
|
}
|
|
4447
5162
|
@case ('empty') {
|
|
4448
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5163
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4449
5164
|
}
|
|
4450
5165
|
@case ('error') {
|
|
4451
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5166
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4452
5167
|
}
|
|
4453
5168
|
@case ('none') {}
|
|
4454
5169
|
@default {
|
|
@@ -4460,31 +5175,28 @@ class CngxMiniBar {
|
|
|
4460
5175
|
</div>
|
|
4461
5176
|
}
|
|
4462
5177
|
}
|
|
4463
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5178
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__label{display:block;font-size:var(--cngx-mini-bar-label-font-size, .75rem);color:var(--cngx-mini-bar-label-color, inherit);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4464
5179
|
}
|
|
4465
5180
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniBar, decorators: [{
|
|
4466
5181
|
type: Component,
|
|
4467
5182
|
args: [{ selector: 'cngx-mini-bar', exportAs: 'cngxMiniBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4468
5183
|
role: 'meter',
|
|
4469
|
-
'[attr.aria-valuenow]': 'value()',
|
|
4470
|
-
'[attr.aria-valuemin]': 'min()',
|
|
4471
|
-
'[attr.aria-valuemax]': 'max()',
|
|
5184
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? value() : null',
|
|
5185
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? min() : null',
|
|
5186
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? max() : null',
|
|
4472
5187
|
'[attr.aria-label]': 'ariaLabel() ?? label()',
|
|
5188
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
4473
5189
|
class: 'cngx-mini-bar',
|
|
4474
5190
|
}, template: `
|
|
4475
5191
|
@switch (activeView()) {
|
|
4476
5192
|
@case ('skeleton') {
|
|
4477
|
-
<span
|
|
4478
|
-
class="cngx-preset-skeleton"
|
|
4479
|
-
[attr.aria-busy]="true"
|
|
4480
|
-
[attr.aria-label]="i18n.loading()"
|
|
4481
|
-
></span>
|
|
5193
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4482
5194
|
}
|
|
4483
5195
|
@case ('empty') {
|
|
4484
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5196
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4485
5197
|
}
|
|
4486
5198
|
@case ('error') {
|
|
4487
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5199
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4488
5200
|
}
|
|
4489
5201
|
@case ('none') {}
|
|
4490
5202
|
@default {
|
|
@@ -4496,8 +5208,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4496
5208
|
</div>
|
|
4497
5209
|
}
|
|
4498
5210
|
}
|
|
4499
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
4500
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5211
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__label{display:block;font-size:var(--cngx-mini-bar-label-font-size, .75rem);color:var(--cngx-mini-bar-label-color, inherit);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5212
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4501
5213
|
|
|
4502
5214
|
/**
|
|
4503
5215
|
* Mini deviation bar - a single-value indicator that diverges from a
|
|
@@ -4527,6 +5239,28 @@ class CngxDeviationBar {
|
|
|
4527
5239
|
preset = injectPresetState(() => this.state());
|
|
4528
5240
|
i18n = this.preset.i18n;
|
|
4529
5241
|
activeView = this.preset.activeView;
|
|
5242
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5243
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5244
|
+
/**
|
|
5245
|
+
* Meter value attributes render only in the content view: keeping
|
|
5246
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5247
|
+
* announce a stale reading for a value that is not on screen.
|
|
5248
|
+
*/
|
|
5249
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5250
|
+
constructor() {
|
|
5251
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
5252
|
+
warnIfUnnamedPreset('cngx-deviation-bar', 'Bind [aria-label].', () => !!this.ariaLabel());
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
/**
|
|
5256
|
+
* The meter's valid range is centred on the baseline, not on zero:
|
|
5257
|
+
* a deviation bar with `[baseline]="100" [magnitude]="50"` reads
|
|
5258
|
+
* values in `[50, 150]`. Anchoring min/max at `±magnitude` alone
|
|
5259
|
+
* puts any non-zero-baseline reading outside its own declared range,
|
|
5260
|
+
* which is invalid meter semantics.
|
|
5261
|
+
*/
|
|
5262
|
+
minValue = computed(() => this.baseline() - this.magnitude(), ...(ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []));
|
|
5263
|
+
maxValue = computed(() => this.baseline() + this.magnitude(), ...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
4530
5264
|
geometry = computed(() => {
|
|
4531
5265
|
const v = this.value();
|
|
4532
5266
|
const b = this.baseline();
|
|
@@ -4539,27 +5273,28 @@ class CngxDeviationBar {
|
|
|
4539
5273
|
return null;
|
|
4540
5274
|
}
|
|
4541
5275
|
const positive = delta > 0;
|
|
4542
|
-
const ratio =
|
|
5276
|
+
const ratio = clampedRatio(Math.abs(delta), 0, m) * 50;
|
|
4543
5277
|
if (positive) {
|
|
4544
5278
|
return { positive, left: 50, width: ratio };
|
|
4545
5279
|
}
|
|
4546
5280
|
return { positive, left: 50 - ratio, width: ratio };
|
|
4547
|
-
}, ...(ngDevMode ?
|
|
5281
|
+
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b ||
|
|
5282
|
+
(a !== null &&
|
|
5283
|
+
b !== null &&
|
|
5284
|
+
a.positive === b.positive &&
|
|
5285
|
+
a.left === b.left &&
|
|
5286
|
+
a.width === b.width) });
|
|
4548
5287
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDeviationBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4549
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDeviationBar, isStandalone: true, selector: "cngx-deviation-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, magnitude: { classPropertyName: "magnitude", publicName: "magnitude", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "
|
|
5288
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDeviationBar, isStandalone: true, selector: "cngx-deviation-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, magnitude: { classPropertyName: "magnitude", publicName: "magnitude", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? value() : null", "attr.aria-valuemin": "showsMeterValue() ? minValue() : null", "attr.aria-valuemax": "showsMeterValue() ? maxValue() : null", "attr.aria-label": "ariaLabel()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-deviation-bar" }, exportAs: ["cngxDeviationBar"], ngImport: i0, template: `
|
|
4550
5289
|
@switch (activeView()) {
|
|
4551
5290
|
@case ('skeleton') {
|
|
4552
|
-
<span
|
|
4553
|
-
class="cngx-preset-skeleton"
|
|
4554
|
-
[attr.aria-busy]="true"
|
|
4555
|
-
[attr.aria-label]="i18n.loading()"
|
|
4556
|
-
></span>
|
|
5291
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4557
5292
|
}
|
|
4558
5293
|
@case ('empty') {
|
|
4559
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5294
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4560
5295
|
}
|
|
4561
5296
|
@case ('error') {
|
|
4562
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5297
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4563
5298
|
}
|
|
4564
5299
|
@case ('none') {}
|
|
4565
5300
|
@default {
|
|
@@ -4577,31 +5312,28 @@ class CngxDeviationBar {
|
|
|
4577
5312
|
</div>
|
|
4578
5313
|
}
|
|
4579
5314
|
}
|
|
4580
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5315
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var( --cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)) );border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var( --cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor) );opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4581
5316
|
}
|
|
4582
5317
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDeviationBar, decorators: [{
|
|
4583
5318
|
type: Component,
|
|
4584
5319
|
args: [{ selector: 'cngx-deviation-bar', exportAs: 'cngxDeviationBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4585
5320
|
role: 'meter',
|
|
4586
|
-
'[attr.aria-valuenow]': 'value()',
|
|
4587
|
-
'[attr.aria-valuemin]': '
|
|
4588
|
-
'[attr.aria-valuemax]': '
|
|
5321
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? value() : null',
|
|
5322
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? minValue() : null',
|
|
5323
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? maxValue() : null',
|
|
4589
5324
|
'[attr.aria-label]': 'ariaLabel()',
|
|
5325
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
4590
5326
|
class: 'cngx-deviation-bar',
|
|
4591
5327
|
}, template: `
|
|
4592
5328
|
@switch (activeView()) {
|
|
4593
5329
|
@case ('skeleton') {
|
|
4594
|
-
<span
|
|
4595
|
-
class="cngx-preset-skeleton"
|
|
4596
|
-
[attr.aria-busy]="true"
|
|
4597
|
-
[attr.aria-label]="i18n.loading()"
|
|
4598
|
-
></span>
|
|
5330
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4599
5331
|
}
|
|
4600
5332
|
@case ('empty') {
|
|
4601
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5333
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4602
5334
|
}
|
|
4603
5335
|
@case ('error') {
|
|
4604
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5336
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4605
5337
|
}
|
|
4606
5338
|
@case ('none') {}
|
|
4607
5339
|
@default {
|
|
@@ -4619,8 +5351,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4619
5351
|
</div>
|
|
4620
5352
|
}
|
|
4621
5353
|
}
|
|
4622
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
4623
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], magnitude: [{ type: i0.Input, args: [{ isSignal: true, alias: "magnitude", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5354
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var( --cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)) );border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var( --cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor) );opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5355
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], magnitude: [{ type: i0.Input, args: [{ isSignal: true, alias: "magnitude", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4624
5356
|
|
|
4625
5357
|
/**
|
|
4626
5358
|
* Inline mini area - a tiny filled-area chart for KPI cards. Sibling
|
|
@@ -4648,48 +5380,26 @@ class CngxMiniArea {
|
|
|
4648
5380
|
preset = injectPresetState(() => this.state());
|
|
4649
5381
|
i18n = this.preset.i18n;
|
|
4650
5382
|
activeView = this.preset.activeView;
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
yDomain = computed(() => {
|
|
4656
|
-
const d = this.data();
|
|
4657
|
-
if (d.length === 0) {
|
|
4658
|
-
return [0, 1];
|
|
4659
|
-
}
|
|
4660
|
-
let min = d[0];
|
|
4661
|
-
let max = d[0];
|
|
4662
|
-
for (let i = 1; i < d.length; i++) {
|
|
4663
|
-
const v = d[i];
|
|
4664
|
-
if (v < min) {
|
|
4665
|
-
min = v;
|
|
4666
|
-
}
|
|
4667
|
-
if (v > max) {
|
|
4668
|
-
max = v;
|
|
4669
|
-
}
|
|
4670
|
-
}
|
|
4671
|
-
if (min === max) {
|
|
4672
|
-
return [min - 1, max + 1];
|
|
4673
|
-
}
|
|
4674
|
-
return [min, max];
|
|
4675
|
-
}, ...(ngDevMode ? [{ debugName: "yDomain" }] : /* istanbul ignore next */ []));
|
|
5383
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5384
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5385
|
+
xDomain = computed(() => presetIndexDomain(this.data().length), { ...(ngDevMode ? { debugName: "xDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
5386
|
+
yDomain = computed(() => presetValueDomain(this.data()), { ...(ngDevMode ? { debugName: "yDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
4676
5387
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniArea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4677
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniArea, isStandalone: true, selector: "cngx-mini-area", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-mini-area" }, exportAs: ["cngxMiniArea"], ngImport: i0, template: `
|
|
5388
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniArea, isStandalone: true, selector: "cngx-mini-area", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-mini-area" }, exportAs: ["cngxMiniArea"], ngImport: i0, template: `
|
|
4678
5389
|
@switch (activeView()) {
|
|
4679
5390
|
@case ('skeleton') {
|
|
4680
5391
|
<span
|
|
4681
5392
|
class="cngx-preset-skeleton"
|
|
4682
5393
|
[style.width.px]="width()"
|
|
4683
5394
|
[style.height.px]="height()"
|
|
4684
|
-
|
|
4685
|
-
[attr.aria-label]="i18n.loading()"
|
|
5395
|
+
aria-hidden="true"
|
|
4686
5396
|
></span>
|
|
4687
5397
|
}
|
|
4688
5398
|
@case ('empty') {
|
|
4689
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5399
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4690
5400
|
}
|
|
4691
5401
|
@case ('error') {
|
|
4692
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5402
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4693
5403
|
}
|
|
4694
5404
|
@case ('none') {}
|
|
4695
5405
|
@default {
|
|
@@ -4699,42 +5409,34 @@ class CngxMiniArea {
|
|
|
4699
5409
|
[height]="height()"
|
|
4700
5410
|
[aria-label]="ariaLabel()"
|
|
4701
5411
|
>
|
|
4702
|
-
<svg:g
|
|
4703
|
-
|
|
4704
|
-
position="bottom"
|
|
4705
|
-
type="linear"
|
|
4706
|
-
[domain]="xDomain()"
|
|
4707
|
-
></svg:g>
|
|
4708
|
-
<svg:g
|
|
4709
|
-
cngxAxisDomain
|
|
4710
|
-
position="left"
|
|
4711
|
-
type="linear"
|
|
4712
|
-
[domain]="yDomain()"
|
|
4713
|
-
></svg:g>
|
|
5412
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5413
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4714
5414
|
<svg:g cngxArea [opacity]="opacity()" [baseline]="yDomain()[0]"></svg:g>
|
|
4715
5415
|
</cngx-chart>
|
|
4716
5416
|
}
|
|
4717
5417
|
}
|
|
4718
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5418
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state", "connectionState"], exportAs: ["cngxChart"] }, { kind: "directive", type: CngxAxisDomain, selector: "[cngxAxisDomain]", inputs: ["position", "type", "domain"], exportAs: ["cngxAxisDomain"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "color", "curve", "baseline", "data", "points"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4719
5419
|
}
|
|
4720
5420
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniArea, decorators: [{
|
|
4721
5421
|
type: Component,
|
|
4722
|
-
args: [{ selector: 'cngx-mini-area', exportAs: 'cngxMiniArea', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxArea], host: {
|
|
5422
|
+
args: [{ selector: 'cngx-mini-area', exportAs: 'cngxMiniArea', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxArea], host: {
|
|
5423
|
+
class: 'cngx-mini-area',
|
|
5424
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5425
|
+
}, template: `
|
|
4723
5426
|
@switch (activeView()) {
|
|
4724
5427
|
@case ('skeleton') {
|
|
4725
5428
|
<span
|
|
4726
5429
|
class="cngx-preset-skeleton"
|
|
4727
5430
|
[style.width.px]="width()"
|
|
4728
5431
|
[style.height.px]="height()"
|
|
4729
|
-
|
|
4730
|
-
[attr.aria-label]="i18n.loading()"
|
|
5432
|
+
aria-hidden="true"
|
|
4731
5433
|
></span>
|
|
4732
5434
|
}
|
|
4733
5435
|
@case ('empty') {
|
|
4734
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5436
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4735
5437
|
}
|
|
4736
5438
|
@case ('error') {
|
|
4737
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5439
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4738
5440
|
}
|
|
4739
5441
|
@case ('none') {}
|
|
4740
5442
|
@default {
|
|
@@ -4744,23 +5446,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4744
5446
|
[height]="height()"
|
|
4745
5447
|
[aria-label]="ariaLabel()"
|
|
4746
5448
|
>
|
|
4747
|
-
<svg:g
|
|
4748
|
-
|
|
4749
|
-
position="bottom"
|
|
4750
|
-
type="linear"
|
|
4751
|
-
[domain]="xDomain()"
|
|
4752
|
-
></svg:g>
|
|
4753
|
-
<svg:g
|
|
4754
|
-
cngxAxisDomain
|
|
4755
|
-
position="left"
|
|
4756
|
-
type="linear"
|
|
4757
|
-
[domain]="yDomain()"
|
|
4758
|
-
></svg:g>
|
|
5449
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5450
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4759
5451
|
<svg:g cngxArea [opacity]="opacity()" [baseline]="yDomain()[0]"></svg:g>
|
|
4760
5452
|
</cngx-chart>
|
|
4761
5453
|
}
|
|
4762
5454
|
}
|
|
4763
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5455
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
4764
5456
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4765
5457
|
|
|
4766
5458
|
/** @internal */
|
|
@@ -4769,7 +5461,10 @@ const TWO_PI = Math.PI * 2;
|
|
|
4769
5461
|
* Circular donut gauge - a single-value bounded indicator. Renders a
|
|
4770
5462
|
* background ring + a foreground arc whose length is proportional to
|
|
4771
5463
|
* `value / max`. Host carries `role="meter"`; the optional `[label]`
|
|
4772
|
-
* input renders
|
|
5464
|
+
* input renders a visible label inside the ring's centre and doubles
|
|
5465
|
+
* as the host's accessible name when `[aria-label]` is unbound - the
|
|
5466
|
+
* same fallback `CngxMiniBar` uses. A bound `[aria-label]` always
|
|
5467
|
+
* wins.
|
|
4773
5468
|
*
|
|
4774
5469
|
* @category common/chart/presets
|
|
4775
5470
|
* @docsKind primary
|
|
@@ -4792,6 +5487,19 @@ class CngxDonut {
|
|
|
4792
5487
|
preset = injectPresetState(() => this.state());
|
|
4793
5488
|
i18n = this.preset.i18n;
|
|
4794
5489
|
activeView = this.preset.activeView;
|
|
5490
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5491
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5492
|
+
/**
|
|
5493
|
+
* Meter value attributes render only in the content view: keeping
|
|
5494
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5495
|
+
* announce a stale reading for a value that is not on screen.
|
|
5496
|
+
*/
|
|
5497
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5498
|
+
constructor() {
|
|
5499
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
5500
|
+
warnIfUnnamedPreset('cngx-donut', 'Bind [label] or [aria-label].', () => !!(this.ariaLabel() ?? this.label()));
|
|
5501
|
+
}
|
|
5502
|
+
}
|
|
4795
5503
|
center = computed(() => this.size() / 2, ...(ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []));
|
|
4796
5504
|
radius = computed(() => (this.size() - this.thickness()) / 2, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
|
|
4797
5505
|
circumference = computed(() => TWO_PI * this.radius(), ...(ngDevMode ? [{ debugName: "circumference" }] : /* istanbul ignore next */ []));
|
|
@@ -4801,30 +5509,24 @@ class CngxDonut {
|
|
|
4801
5509
|
}, ...(ngDevMode ? [{ debugName: "dasharray" }] : /* istanbul ignore next */ []));
|
|
4802
5510
|
dashoffset = computed(() => {
|
|
4803
5511
|
const c = this.circumference();
|
|
4804
|
-
|
|
4805
|
-
if (m <= 0) {
|
|
4806
|
-
return c;
|
|
4807
|
-
}
|
|
4808
|
-
const ratio = Math.min(Math.max(this.value() / m, 0), 1);
|
|
4809
|
-
return c * (1 - ratio);
|
|
5512
|
+
return c * (1 - clampedRatio(this.value(), 0, this.max()));
|
|
4810
5513
|
}, ...(ngDevMode ? [{ debugName: "dashoffset" }] : /* istanbul ignore next */ []));
|
|
4811
5514
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDonut, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4812
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDonut, isStandalone: true, selector: "cngx-donut", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "max()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-donut" }, exportAs: ["cngxDonut"], ngImport: i0, template: `
|
|
5515
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDonut, isStandalone: true, selector: "cngx-donut", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? value() : null", "attr.aria-valuemin": "showsMeterValue() ? 0 : null", "attr.aria-valuemax": "showsMeterValue() ? max() : null", "attr.aria-label": "ariaLabel() ?? label()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-donut" }, exportAs: ["cngxDonut"], ngImport: i0, template: `
|
|
4813
5516
|
@switch (activeView()) {
|
|
4814
5517
|
@case ('skeleton') {
|
|
4815
5518
|
<span
|
|
4816
5519
|
class="cngx-preset-skeleton cngx-donut__skeleton"
|
|
4817
5520
|
[style.width.px]="size()"
|
|
4818
5521
|
[style.height.px]="size()"
|
|
4819
|
-
|
|
4820
|
-
[attr.aria-label]="i18n.loading()"
|
|
5522
|
+
aria-hidden="true"
|
|
4821
5523
|
></span>
|
|
4822
5524
|
}
|
|
4823
5525
|
@case ('empty') {
|
|
4824
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5526
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4825
5527
|
}
|
|
4826
5528
|
@case ('error') {
|
|
4827
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5529
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4828
5530
|
}
|
|
4829
5531
|
@case ('none') {}
|
|
4830
5532
|
@default {
|
|
@@ -4860,16 +5562,17 @@ class CngxDonut {
|
|
|
4860
5562
|
}
|
|
4861
5563
|
}
|
|
4862
5564
|
}
|
|
4863
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5565
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4864
5566
|
}
|
|
4865
5567
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDonut, decorators: [{
|
|
4866
5568
|
type: Component,
|
|
4867
5569
|
args: [{ selector: 'cngx-donut', exportAs: 'cngxDonut', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4868
5570
|
role: 'meter',
|
|
4869
|
-
'[attr.aria-valuenow]': 'value()',
|
|
4870
|
-
'[attr.aria-valuemin]': '0',
|
|
4871
|
-
'[attr.aria-valuemax]': 'max()',
|
|
4872
|
-
'[attr.aria-label]': 'ariaLabel()',
|
|
5571
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? value() : null',
|
|
5572
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? 0 : null',
|
|
5573
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? max() : null',
|
|
5574
|
+
'[attr.aria-label]': 'ariaLabel() ?? label()',
|
|
5575
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
4873
5576
|
class: 'cngx-donut',
|
|
4874
5577
|
}, template: `
|
|
4875
5578
|
@switch (activeView()) {
|
|
@@ -4878,15 +5581,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4878
5581
|
class="cngx-preset-skeleton cngx-donut__skeleton"
|
|
4879
5582
|
[style.width.px]="size()"
|
|
4880
5583
|
[style.height.px]="size()"
|
|
4881
|
-
|
|
4882
|
-
[attr.aria-label]="i18n.loading()"
|
|
5584
|
+
aria-hidden="true"
|
|
4883
5585
|
></span>
|
|
4884
5586
|
}
|
|
4885
5587
|
@case ('empty') {
|
|
4886
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5588
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4887
5589
|
}
|
|
4888
5590
|
@case ('error') {
|
|
4889
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5591
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4890
5592
|
}
|
|
4891
5593
|
@case ('none') {}
|
|
4892
5594
|
@default {
|
|
@@ -4922,8 +5624,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4922
5624
|
}
|
|
4923
5625
|
}
|
|
4924
5626
|
}
|
|
4925
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
4926
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5627
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5628
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4927
5629
|
|
|
4928
5630
|
/**
|
|
4929
5631
|
* Bullet chart - Stephen Few's compact KPI visualisation. Three
|
|
@@ -4951,6 +5653,19 @@ class CngxBullet {
|
|
|
4951
5653
|
preset = injectPresetState(() => this.state());
|
|
4952
5654
|
i18n = this.preset.i18n;
|
|
4953
5655
|
activeView = this.preset.activeView;
|
|
5656
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5657
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5658
|
+
/**
|
|
5659
|
+
* Meter value attributes render only in the content view: keeping
|
|
5660
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5661
|
+
* announce a stale reading for a value that is not on screen.
|
|
5662
|
+
*/
|
|
5663
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5664
|
+
constructor() {
|
|
5665
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
5666
|
+
warnIfUnnamedPreset('cngx-bullet', 'Bind [aria-label].', () => !!this.ariaLabel());
|
|
5667
|
+
}
|
|
5668
|
+
}
|
|
4954
5669
|
maxValue = computed(() => {
|
|
4955
5670
|
const explicit = this.max();
|
|
4956
5671
|
if (explicit !== null && explicit > 0) {
|
|
@@ -4965,13 +5680,13 @@ class CngxBullet {
|
|
|
4965
5680
|
}
|
|
4966
5681
|
return m > 0 ? m : 1;
|
|
4967
5682
|
}, ...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
4968
|
-
actualPercent = computed(() =>
|
|
5683
|
+
actualPercent = computed(() => clampedRatio(this.actual(), 0, this.maxValue()) * 100, ...(ngDevMode ? [{ debugName: "actualPercent" }] : /* istanbul ignore next */ []));
|
|
4969
5684
|
targetPercent = computed(() => {
|
|
4970
5685
|
const t = this.target();
|
|
4971
5686
|
if (t === null) {
|
|
4972
5687
|
return 0;
|
|
4973
5688
|
}
|
|
4974
|
-
return
|
|
5689
|
+
return clampedRatio(t, 0, this.maxValue()) * 100;
|
|
4975
5690
|
}, ...(ngDevMode ? [{ debugName: "targetPercent" }] : /* istanbul ignore next */ []));
|
|
4976
5691
|
rangeRenderings = computed(() => {
|
|
4977
5692
|
const m = this.maxValue();
|
|
@@ -4980,27 +5695,23 @@ class CngxBullet {
|
|
|
4980
5695
|
const hi = Math.max(r.from, r.to);
|
|
4981
5696
|
return {
|
|
4982
5697
|
key: `${i}-${r.label ?? ''}`,
|
|
4983
|
-
left:
|
|
4984
|
-
width:
|
|
5698
|
+
left: clampedRatio(lo, 0, m) * 100,
|
|
5699
|
+
width: clampedRatio(hi - lo, 0, m) * 100,
|
|
4985
5700
|
color: r.color ?? null,
|
|
4986
5701
|
};
|
|
4987
5702
|
});
|
|
4988
|
-
}, ...(ngDevMode ?
|
|
5703
|
+
}, { ...(ngDevMode ? { debugName: "rangeRenderings" } : /* istanbul ignore next */ {}), equal: rangeRenderingsEqual });
|
|
4989
5704
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBullet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4990
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBullet, isStandalone: true, selector: "cngx-bullet", inputs: { actual: { classPropertyName: "actual", publicName: "actual", isSignal: true, isRequired: true, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "actual()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "maxValue()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-bullet" }, exportAs: ["cngxBullet"], ngImport: i0, template: `
|
|
5705
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBullet, isStandalone: true, selector: "cngx-bullet", inputs: { actual: { classPropertyName: "actual", publicName: "actual", isSignal: true, isRequired: true, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? actual() : null", "attr.aria-valuemin": "showsMeterValue() ? 0 : null", "attr.aria-valuemax": "showsMeterValue() ? maxValue() : null", "attr.aria-label": "ariaLabel()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-bullet" }, exportAs: ["cngxBullet"], ngImport: i0, template: `
|
|
4991
5706
|
@switch (activeView()) {
|
|
4992
5707
|
@case ('skeleton') {
|
|
4993
|
-
<span
|
|
4994
|
-
class="cngx-preset-skeleton"
|
|
4995
|
-
[attr.aria-busy]="true"
|
|
4996
|
-
[attr.aria-label]="i18n.loading()"
|
|
4997
|
-
></span>
|
|
5708
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4998
5709
|
}
|
|
4999
5710
|
@case ('empty') {
|
|
5000
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5711
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5001
5712
|
}
|
|
5002
5713
|
@case ('error') {
|
|
5003
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5714
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5004
5715
|
}
|
|
5005
5716
|
@case ('none') {}
|
|
5006
5717
|
@default {
|
|
@@ -5027,31 +5738,28 @@ class CngxBullet {
|
|
|
5027
5738
|
</div>
|
|
5028
5739
|
}
|
|
5029
5740
|
}
|
|
5030
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5741
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5031
5742
|
}
|
|
5032
5743
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBullet, decorators: [{
|
|
5033
5744
|
type: Component,
|
|
5034
5745
|
args: [{ selector: 'cngx-bullet', exportAs: 'cngxBullet', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
5035
5746
|
role: 'meter',
|
|
5036
|
-
'[attr.aria-valuenow]': 'actual()',
|
|
5037
|
-
'[attr.aria-valuemin]': '0',
|
|
5038
|
-
'[attr.aria-valuemax]': 'maxValue()',
|
|
5747
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? actual() : null',
|
|
5748
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? 0 : null',
|
|
5749
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? maxValue() : null',
|
|
5039
5750
|
'[attr.aria-label]': 'ariaLabel()',
|
|
5751
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5040
5752
|
class: 'cngx-bullet',
|
|
5041
5753
|
}, template: `
|
|
5042
5754
|
@switch (activeView()) {
|
|
5043
5755
|
@case ('skeleton') {
|
|
5044
|
-
<span
|
|
5045
|
-
class="cngx-preset-skeleton"
|
|
5046
|
-
[attr.aria-busy]="true"
|
|
5047
|
-
[attr.aria-label]="i18n.loading()"
|
|
5048
|
-
></span>
|
|
5756
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
5049
5757
|
}
|
|
5050
5758
|
@case ('empty') {
|
|
5051
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5759
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5052
5760
|
}
|
|
5053
5761
|
@case ('error') {
|
|
5054
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5762
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5055
5763
|
}
|
|
5056
5764
|
@case ('none') {}
|
|
5057
5765
|
@default {
|
|
@@ -5078,21 +5786,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5078
5786
|
</div>
|
|
5079
5787
|
}
|
|
5080
5788
|
}
|
|
5081
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5082
|
-
}], propDecorators: { actual: [{ type: i0.Input, args: [{ isSignal: true, alias: "actual", required: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], ranges: [{ type: i0.Input, args: [{ isSignal: true, alias: "ranges", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5789
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5790
|
+
}], ctorParameters: () => [], propDecorators: { actual: [{ type: i0.Input, args: [{ isSignal: true, alias: "actual", required: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], ranges: [{ type: i0.Input, args: [{ isSignal: true, alias: "ranges", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5083
5791
|
/** @internal */
|
|
5084
|
-
function
|
|
5085
|
-
if (
|
|
5086
|
-
return
|
|
5792
|
+
function rangeRenderingsEqual(a, b) {
|
|
5793
|
+
if (a === b) {
|
|
5794
|
+
return true;
|
|
5087
5795
|
}
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
return 0;
|
|
5796
|
+
if (a.length !== b.length) {
|
|
5797
|
+
return false;
|
|
5091
5798
|
}
|
|
5092
|
-
|
|
5093
|
-
|
|
5799
|
+
for (let i = 0; i < a.length; i++) {
|
|
5800
|
+
const x = a[i];
|
|
5801
|
+
const y = b[i];
|
|
5802
|
+
if (x.key !== y.key || x.left !== y.left || x.width !== y.width || x.color !== y.color) {
|
|
5803
|
+
return false;
|
|
5804
|
+
}
|
|
5094
5805
|
}
|
|
5095
|
-
return
|
|
5806
|
+
return true;
|
|
5096
5807
|
}
|
|
5097
5808
|
|
|
5098
5809
|
/**
|
|
@@ -5119,7 +5830,10 @@ class CngxStackedBar {
|
|
|
5119
5830
|
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
5120
5831
|
preset = injectPresetState(() => this.state());
|
|
5121
5832
|
i18n = this.preset.i18n;
|
|
5833
|
+
locale = injectLocale();
|
|
5122
5834
|
activeView = this.preset.activeView;
|
|
5835
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5836
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5123
5837
|
resolvedTotal = computed(() => {
|
|
5124
5838
|
const explicit = this.total();
|
|
5125
5839
|
if (explicit !== null && explicit > 0) {
|
|
@@ -5133,6 +5847,8 @@ class CngxStackedBar {
|
|
|
5133
5847
|
}, ...(ngDevMode ? [{ debugName: "resolvedTotal" }] : /* istanbul ignore next */ []));
|
|
5134
5848
|
segmentRenderings = computed(() => {
|
|
5135
5849
|
const total = this.resolvedTotal();
|
|
5850
|
+
const locale = this.locale();
|
|
5851
|
+
const segmentTitle = this.i18n().stackedBarSegmentTitle;
|
|
5136
5852
|
let runningLeft = 0;
|
|
5137
5853
|
return this.segments().map((s, i) => {
|
|
5138
5854
|
const width = (s.value / total) * 100;
|
|
@@ -5143,39 +5859,47 @@ class CngxStackedBar {
|
|
|
5143
5859
|
left,
|
|
5144
5860
|
width,
|
|
5145
5861
|
color: s.color ?? null,
|
|
5146
|
-
|
|
5147
|
-
value: s.value,
|
|
5862
|
+
title: segmentTitle(s.label, formatChartNumber(s.value, locale)),
|
|
5148
5863
|
};
|
|
5149
5864
|
});
|
|
5150
|
-
}, ...(ngDevMode ?
|
|
5865
|
+
}, { ...(ngDevMode ? { debugName: "segmentRenderings" } : /* istanbul ignore next */ {}), equal: segmentRenderingsEqual });
|
|
5151
5866
|
effectiveAriaLabel = computed(() => {
|
|
5867
|
+
// Mirror the meter presets' state gating: outside the content view
|
|
5868
|
+
// the segment summary would name data that is not on screen -
|
|
5869
|
+
// "Empty stacked bar" while aria-busy announces a load in flight.
|
|
5870
|
+
const view = this.activeView();
|
|
5871
|
+
if (view === 'skeleton') {
|
|
5872
|
+
return this.i18n().loading();
|
|
5873
|
+
}
|
|
5874
|
+
if (view === 'empty') {
|
|
5875
|
+
return this.i18n().empty();
|
|
5876
|
+
}
|
|
5877
|
+
if (view === 'error') {
|
|
5878
|
+
return this.i18n().error();
|
|
5879
|
+
}
|
|
5152
5880
|
const explicit = this.ariaLabel();
|
|
5153
5881
|
if (explicit !== null && explicit !== '') {
|
|
5154
5882
|
return explicit;
|
|
5155
5883
|
}
|
|
5156
5884
|
const segments = this.segments();
|
|
5885
|
+
// The resolved bundle fills the optional stacked-bar keys from the
|
|
5886
|
+
// locale defaults when a direct useValue token override omits them.
|
|
5157
5887
|
if (segments.length === 0) {
|
|
5158
|
-
return
|
|
5888
|
+
return this.i18n().stackedBarEmpty();
|
|
5159
5889
|
}
|
|
5160
|
-
|
|
5161
|
-
const parts = segments.map((s) => `${s.label}: ${s.value}`);
|
|
5162
|
-
return `Total ${total}. ${parts.join(', ')}.`;
|
|
5890
|
+
return this.i18n().stackedBarSummary(this.resolvedTotal(), segments);
|
|
5163
5891
|
}, ...(ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []));
|
|
5164
5892
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStackedBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5165
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStackedBar, isStandalone: true, selector: "cngx-stacked-bar", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "effectiveAriaLabel()" }, classAttribute: "cngx-stacked-bar" }, exportAs: ["cngxStackedBar"], ngImport: i0, template: `
|
|
5893
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStackedBar, isStandalone: true, selector: "cngx-stacked-bar", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "effectiveAriaLabel()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-stacked-bar" }, exportAs: ["cngxStackedBar"], ngImport: i0, template: `
|
|
5166
5894
|
@switch (activeView()) {
|
|
5167
5895
|
@case ('skeleton') {
|
|
5168
|
-
<span
|
|
5169
|
-
class="cngx-preset-skeleton"
|
|
5170
|
-
[attr.aria-busy]="true"
|
|
5171
|
-
[attr.aria-label]="i18n.loading()"
|
|
5172
|
-
></span>
|
|
5896
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
5173
5897
|
}
|
|
5174
5898
|
@case ('empty') {
|
|
5175
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5899
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5176
5900
|
}
|
|
5177
5901
|
@case ('error') {
|
|
5178
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5902
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5179
5903
|
}
|
|
5180
5904
|
@case ('none') {}
|
|
5181
5905
|
@default {
|
|
@@ -5186,35 +5910,32 @@ class CngxStackedBar {
|
|
|
5186
5910
|
[style.left.%]="s.left"
|
|
5187
5911
|
[style.width.%]="s.width"
|
|
5188
5912
|
[style.background]="s.color"
|
|
5189
|
-
[attr.title]="s.
|
|
5913
|
+
[attr.title]="s.title"
|
|
5190
5914
|
[attr.aria-hidden]="true"
|
|
5191
5915
|
></div>
|
|
5192
5916
|
}
|
|
5193
5917
|
</div>
|
|
5194
5918
|
}
|
|
5195
5919
|
}
|
|
5196
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5920
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5197
5921
|
}
|
|
5198
5922
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStackedBar, decorators: [{
|
|
5199
5923
|
type: Component,
|
|
5200
5924
|
args: [{ selector: 'cngx-stacked-bar', exportAs: 'cngxStackedBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
5201
5925
|
role: 'img',
|
|
5202
5926
|
'[attr.aria-label]': 'effectiveAriaLabel()',
|
|
5927
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5203
5928
|
class: 'cngx-stacked-bar',
|
|
5204
5929
|
}, template: `
|
|
5205
5930
|
@switch (activeView()) {
|
|
5206
5931
|
@case ('skeleton') {
|
|
5207
|
-
<span
|
|
5208
|
-
class="cngx-preset-skeleton"
|
|
5209
|
-
[attr.aria-busy]="true"
|
|
5210
|
-
[attr.aria-label]="i18n.loading()"
|
|
5211
|
-
></span>
|
|
5932
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
5212
5933
|
}
|
|
5213
5934
|
@case ('empty') {
|
|
5214
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5935
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5215
5936
|
}
|
|
5216
5937
|
@case ('error') {
|
|
5217
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5938
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5218
5939
|
}
|
|
5219
5940
|
@case ('none') {}
|
|
5220
5941
|
@default {
|
|
@@ -5225,15 +5946,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5225
5946
|
[style.left.%]="s.left"
|
|
5226
5947
|
[style.width.%]="s.width"
|
|
5227
5948
|
[style.background]="s.color"
|
|
5228
|
-
[attr.title]="s.
|
|
5949
|
+
[attr.title]="s.title"
|
|
5229
5950
|
[attr.aria-hidden]="true"
|
|
5230
5951
|
></div>
|
|
5231
5952
|
}
|
|
5232
5953
|
</div>
|
|
5233
5954
|
}
|
|
5234
5955
|
}
|
|
5235
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5956
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5236
5957
|
}], propDecorators: { segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: true }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5958
|
+
/** @internal */
|
|
5959
|
+
function segmentRenderingsEqual(a, b) {
|
|
5960
|
+
if (a === b) {
|
|
5961
|
+
return true;
|
|
5962
|
+
}
|
|
5963
|
+
if (a.length !== b.length) {
|
|
5964
|
+
return false;
|
|
5965
|
+
}
|
|
5966
|
+
for (let i = 0; i < a.length; i++) {
|
|
5967
|
+
const x = a[i];
|
|
5968
|
+
const y = b[i];
|
|
5969
|
+
if (x.key !== y.key ||
|
|
5970
|
+
x.left !== y.left ||
|
|
5971
|
+
x.width !== y.width ||
|
|
5972
|
+
x.color !== y.color ||
|
|
5973
|
+
x.title !== y.title) {
|
|
5974
|
+
return false;
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
return true;
|
|
5978
|
+
}
|
|
5237
5979
|
|
|
5238
5980
|
/**
|
|
5239
5981
|
* @module @cngx/common/chart
|
|
@@ -5248,5 +5990,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5248
5990
|
* Generated bundle index. Do not edit.
|
|
5249
5991
|
*/
|
|
5250
5992
|
|
|
5251
|
-
export { CHART_SMALL_BREAKPOINT_PX, CNGX_CHART_AXIS, CNGX_CHART_CONTEXT, CNGX_CHART_I18N, 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, provideChartI18n, provideChartRenderer, withChartRendererFactory, withChartRendererThreshold };
|
|
5993
|
+
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 };
|
|
5252
5994
|
//# sourceMappingURL=cngx-common-chart.mjs.map
|