@cngx/common 0.1.0-rc.7 → 0.1.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/card/README.md +2 -1
- package/data/README.md +10 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +125 -111
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +47 -5
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +300 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1176 -453
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +37 -10
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1318 -469
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +151 -14
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +340 -73
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1744 -952
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +841 -114
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +350 -60
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +727 -317
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1601 -1243
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +137 -53
- 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 +21 -1
- package/package.json +3 -3
- package/popover/README.md +18 -2
- package/stepper/README.md +6 -4
- 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.css +24 -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 +42 -18
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +343 -47
- package/types/cngx-common-command.d.ts +31 -8
- package/types/cngx-common-data.d.ts +581 -68
- package/types/cngx-common-dialog.d.ts +158 -3
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +859 -210
- package/types/cngx-common-layout.d.ts +567 -28
- package/types/cngx-common-popover.d.ts +262 -39
- package/types/cngx-common-stepper.d.ts +366 -116
- package/types/cngx-common-tabs.d.ts +214 -50
- package/types/cngx-common-timeline.d.ts +82 -16
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Theming bridge for the `CngxRecyclerPlaceholder` directive. The directive
|
|
4
|
+
* sets the `cngx-recycler-placeholder` class on the offset spacer(s) of a
|
|
5
|
+
* virtualized surface and writes `--cngx-recycler-placeholder-row-height` from
|
|
6
|
+
* the recycler's `rowSizeHint`. Importing this file fills the exposed offset
|
|
7
|
+
* region with soft, row-aligned ghost rows during a fast fling or teleport
|
|
8
|
+
* jump. The layer lives on the spacers only - never behind rendered rows - so a
|
|
9
|
+
* populated list never shows it.
|
|
10
|
+
*
|
|
11
|
+
* **Look**
|
|
12
|
+
*
|
|
13
|
+
* Not a hard skeleton bar. Each row period paints one low-alpha band with
|
|
14
|
+
* feathered top/bottom edges (a gradient fade into the gap), inset horizontally
|
|
15
|
+
* so it reads as a content line rather than a full-width block. The alpha fill
|
|
16
|
+
* sits on any surface without a solid color of its own, so it stays subtle in
|
|
17
|
+
* both themes.
|
|
18
|
+
*
|
|
19
|
+
* **Rhythm**
|
|
20
|
+
*
|
|
21
|
+
* The period is `--cngx-recycler-placeholder-row-height`; because the offset is
|
|
22
|
+
* a whole multiple of the row height, the bands line up with the real rows just
|
|
23
|
+
* beyond the gap. `--cngx-recycler-placeholder-band-height` is the solid core
|
|
24
|
+
* within each period; the remainder feathers into the gap.
|
|
25
|
+
*
|
|
26
|
+
* **Shimmer**
|
|
27
|
+
*
|
|
28
|
+
* `.cngx-recycler-placeholder--shimmer` sweeps a faint highlight across the
|
|
29
|
+
* bands and animates its `background-position`. The directive toggles the class
|
|
30
|
+
* from a `(prefers-reduced-motion: reduce)` signal, so reduced motion simply
|
|
31
|
+
* drops the class. Only the background moves.
|
|
32
|
+
*
|
|
33
|
+
* **Dark mode**
|
|
34
|
+
*
|
|
35
|
+
* The fill and shimmer are white-alpha in dark mode so they read on a dark
|
|
36
|
+
* surface. Unlayered, direct selectors so they beat the layered defaults.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
@layer cngx.tokens {
|
|
40
|
+
/**
|
|
41
|
+
* Repeat period of the ghost rows (px). Set inline by the directive from the
|
|
42
|
+
* recycler's `rowSizeHint`; the initial applies when no row height resolves.
|
|
43
|
+
* `inherits: true` so an ancestor mapping reaches the spacer that hosts it.
|
|
44
|
+
* @group Layout
|
|
45
|
+
*/
|
|
46
|
+
@property --cngx-recycler-placeholder-row-height {
|
|
47
|
+
syntax: '<length>';
|
|
48
|
+
inherits: true;
|
|
49
|
+
initial-value: 48px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Solid core height of the band within each row period; the remainder
|
|
54
|
+
* feathers into the gap between bands.
|
|
55
|
+
* @group Layout
|
|
56
|
+
*/
|
|
57
|
+
@property --cngx-recycler-placeholder-band-height {
|
|
58
|
+
syntax: '<length>';
|
|
59
|
+
inherits: true;
|
|
60
|
+
initial-value: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Horizontal inset of each band from the layer edges, so bands read as
|
|
65
|
+
* content lines rather than full-width blocks.
|
|
66
|
+
* @group Layout
|
|
67
|
+
*/
|
|
68
|
+
@property --cngx-recycler-placeholder-inset {
|
|
69
|
+
syntax: '<length>';
|
|
70
|
+
inherits: true;
|
|
71
|
+
initial-value: 12px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Corner softness of each band. Applied as the feather radius of the gradient
|
|
76
|
+
* edges via the band/gap split; kept as a token for tunability.
|
|
77
|
+
* @group Surface
|
|
78
|
+
*/
|
|
79
|
+
@property --cngx-recycler-placeholder-radius {
|
|
80
|
+
syntax: '<length>';
|
|
81
|
+
inherits: true;
|
|
82
|
+
initial-value: 6px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Fill of the ghost bands. A low-alpha ink so the layer sits softly on any
|
|
87
|
+
* surface without a solid color of its own.
|
|
88
|
+
* @group Surface
|
|
89
|
+
*/
|
|
90
|
+
@property --cngx-recycler-placeholder-color {
|
|
91
|
+
syntax: '<color>';
|
|
92
|
+
inherits: true;
|
|
93
|
+
initial-value: oklch(0.55 0.02 260 / 0.1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Highlight swept across the bands in shimmer mode.
|
|
98
|
+
* @group Motion
|
|
99
|
+
*/
|
|
100
|
+
@property --cngx-recycler-placeholder-shimmer-color {
|
|
101
|
+
syntax: '<color>';
|
|
102
|
+
inherits: true;
|
|
103
|
+
initial-value: oklch(1 0 0 / 0.35);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Duration of one shimmer sweep.
|
|
108
|
+
* @group Motion
|
|
109
|
+
*/
|
|
110
|
+
@property --cngx-recycler-placeholder-shimmer-duration {
|
|
111
|
+
syntax: '*';
|
|
112
|
+
inherits: true;
|
|
113
|
+
initial-value: 1.6s;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@layer cngx.components {
|
|
118
|
+
/* One feathered band per row period. The band core is centered in the period
|
|
119
|
+
* and fades to transparent across the surrounding gap, so edges read soft.
|
|
120
|
+
* repeat-y + a sub-100% background width insets the bands horizontally. */
|
|
121
|
+
.cngx-recycler-placeholder {
|
|
122
|
+
--_cngx-rp-feather: calc(
|
|
123
|
+
(
|
|
124
|
+
var(--cngx-recycler-placeholder-row-height, 48px) -
|
|
125
|
+
var(--cngx-recycler-placeholder-band-height, 20px)
|
|
126
|
+
) / 2
|
|
127
|
+
);
|
|
128
|
+
background-image: repeating-linear-gradient(
|
|
129
|
+
to bottom,
|
|
130
|
+
transparent 0,
|
|
131
|
+
var(--cngx-recycler-placeholder-color, oklch(0.55 0.02 260 / 0.1)) var(--_cngx-rp-feather),
|
|
132
|
+
var(--cngx-recycler-placeholder-color, oklch(0.55 0.02 260 / 0.1))
|
|
133
|
+
calc(var(--_cngx-rp-feather) + var(--cngx-recycler-placeholder-band-height, 20px)),
|
|
134
|
+
transparent var(--cngx-recycler-placeholder-row-height, 48px)
|
|
135
|
+
);
|
|
136
|
+
background-repeat: repeat-y;
|
|
137
|
+
background-size: calc(100% - 2 * var(--cngx-recycler-placeholder-inset, 12px)) 100%;
|
|
138
|
+
background-position: center top;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Shimmer: a faint highlight band (first layer) swept over the static ghost
|
|
142
|
+
* rows (second layer). Only the background moves. */
|
|
143
|
+
.cngx-recycler-placeholder--shimmer {
|
|
144
|
+
background-image:
|
|
145
|
+
linear-gradient(
|
|
146
|
+
90deg,
|
|
147
|
+
transparent 0,
|
|
148
|
+
var(--cngx-recycler-placeholder-shimmer-color, oklch(1 0 0 / 0.35)) 50%,
|
|
149
|
+
transparent 100%
|
|
150
|
+
),
|
|
151
|
+
repeating-linear-gradient(
|
|
152
|
+
to bottom,
|
|
153
|
+
transparent 0,
|
|
154
|
+
var(--cngx-recycler-placeholder-color, oklch(0.55 0.02 260 / 0.1)) var(--_cngx-rp-feather),
|
|
155
|
+
var(--cngx-recycler-placeholder-color, oklch(0.55 0.02 260 / 0.1))
|
|
156
|
+
calc(var(--_cngx-rp-feather) + var(--cngx-recycler-placeholder-band-height, 20px)),
|
|
157
|
+
transparent var(--cngx-recycler-placeholder-row-height, 48px)
|
|
158
|
+
);
|
|
159
|
+
background-repeat: no-repeat, repeat-y;
|
|
160
|
+
background-size:
|
|
161
|
+
200% 100%,
|
|
162
|
+
calc(100% - 2 * var(--cngx-recycler-placeholder-inset, 12px)) 100%;
|
|
163
|
+
background-position:
|
|
164
|
+
-100% 0,
|
|
165
|
+
center top;
|
|
166
|
+
animation: cngx-recycler-placeholder-shimmer
|
|
167
|
+
var(--cngx-recycler-placeholder-shimmer-duration, 1.6s) ease-in-out infinite;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@keyframes cngx-recycler-placeholder-shimmer {
|
|
172
|
+
from {
|
|
173
|
+
background-position:
|
|
174
|
+
-100% 0,
|
|
175
|
+
center top;
|
|
176
|
+
}
|
|
177
|
+
to {
|
|
178
|
+
background-position:
|
|
179
|
+
200% 0,
|
|
180
|
+
center top;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Dark mode: white-alpha fill + shimmer so the layer reads on a dark surface.
|
|
185
|
+
* Unlayered, direct selectors so they beat the layered defaults. */
|
|
186
|
+
@media (prefers-color-scheme: dark) {
|
|
187
|
+
:root:not([data-color-scheme='light']):not(.light) .cngx-recycler-placeholder {
|
|
188
|
+
--cngx-recycler-placeholder-color: oklch(1 0 0 / 0.09);
|
|
189
|
+
--cngx-recycler-placeholder-shimmer-color: oklch(1 0 0 / 0.16);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
[data-color-scheme='dark'] .cngx-recycler-placeholder,
|
|
193
|
+
.dark .cngx-recycler-placeholder {
|
|
194
|
+
--cngx-recycler-placeholder-color: oklch(1 0 0 / 0.09);
|
|
195
|
+
--cngx-recycler-placeholder-shimmer-color: oklch(1 0 0 / 0.16);
|
|
196
|
+
}
|
|
@@ -103,9 +103,13 @@
|
|
|
103
103
|
cursor: pointer;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/* Disabled by colour, never opacity (the field recipe). */
|
|
106
107
|
:is([cngxSliderTrack], [cngxRangeSliderTrack])[aria-disabled='true'] {
|
|
107
|
-
opacity: 0.5;
|
|
108
108
|
cursor: not-allowed;
|
|
109
|
+
--cngx-slider-fill-color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
|
|
110
|
+
--cngx-slider-thumb-border-color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
|
|
111
|
+
--cngx-slider-track-color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 12%, transparent);
|
|
112
|
+
color: color-mix(in oklab, var(--cngx-color-text, oklch(0.2 0.01 250)) 38%, transparent);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
:is([cngxSliderTrack], [cngxRangeSliderTrack]) .cngx-slider__track {
|
|
@@ -235,3 +239,30 @@
|
|
|
235
239
|
translate: -50% 50%;
|
|
236
240
|
}
|
|
237
241
|
}
|
|
242
|
+
|
|
243
|
+
/* forced-colors (WHCM): track and fill are painted only with background (the
|
|
244
|
+
* range band is a gradient), which the forced palette flattens to Canvas - the
|
|
245
|
+
* value and range vanish and only the thumb rings remain. Opt the track and
|
|
246
|
+
* fill out of forcing and feed the existing colour tokens system keywords, so
|
|
247
|
+
* every orientation keeps its own geometry: CanvasText track, Highlight value.
|
|
248
|
+
* A disabled slider reads GrayText on a Canvas track with a GrayText edge, so
|
|
249
|
+
* the value stays visible. Unlayered, after the base rules. */
|
|
250
|
+
@media (forced-colors: active) {
|
|
251
|
+
:is([cngxSliderTrack], [cngxRangeSliderTrack]) {
|
|
252
|
+
--cngx-slider-track-color: CanvasText;
|
|
253
|
+
--cngx-slider-fill-color: Highlight;
|
|
254
|
+
}
|
|
255
|
+
:is([cngxSliderTrack], [cngxRangeSliderTrack]) :is(.cngx-slider__track, .cngx-slider__fill) {
|
|
256
|
+
forced-color-adjust: none;
|
|
257
|
+
}
|
|
258
|
+
:is([cngxSliderTrack], [cngxRangeSliderTrack])[aria-disabled='true'] {
|
|
259
|
+
--cngx-slider-track-color: Canvas;
|
|
260
|
+
--cngx-slider-fill-color: GrayText;
|
|
261
|
+
--cngx-slider-thumb-border-color: GrayText;
|
|
262
|
+
color: GrayText;
|
|
263
|
+
}
|
|
264
|
+
:is([cngxSliderTrack], [cngxRangeSliderTrack])[aria-disabled='true'] .cngx-slider__track {
|
|
265
|
+
outline: 1px solid GrayText;
|
|
266
|
+
outline-offset: -1px;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
@@ -161,7 +161,11 @@
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* Duration of the open / close transition.
|
|
164
|
+
*
|
|
165
|
+
* Derives from the `--cngx-duration-fast` rung of the motion scale; a
|
|
166
|
+
* `--cngx-duration-*` brand override re-times it library-wide.
|
|
164
167
|
* @group Motion
|
|
168
|
+
* @relatedTo provideMotion, CngxMotionScope, injectMotion
|
|
165
169
|
*/
|
|
166
170
|
@property --cngx-tooltip-transition-duration {
|
|
167
171
|
syntax: '<time>';
|
|
@@ -169,6 +173,14 @@
|
|
|
169
173
|
initial-value: 150ms;
|
|
170
174
|
}
|
|
171
175
|
|
|
176
|
+
/* Derive from the motion scale. The registered initial-value wins over the
|
|
177
|
+
* read-site var() fallback, so the token must be SET from the scale for a
|
|
178
|
+
* --cngx-duration-* brand override to reach the transition. Host SET (read
|
|
179
|
+
* is on :scope); layer cngx.tokens keeps the Material bridge winning. */
|
|
180
|
+
:where(.cngx-tooltip) {
|
|
181
|
+
--cngx-tooltip-transition-duration: var(--cngx-duration-fast);
|
|
182
|
+
}
|
|
183
|
+
|
|
172
184
|
/**
|
|
173
185
|
* Easing curve of the open / close transition.
|
|
174
186
|
* @group Motion
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# @cngx/common/timeline
|
|
2
|
+
|
|
3
|
+
Headless timeline core. This entry ships everything `<cngx-timeline>` composes but does not own: the grouping presenter, the row atoms (item, marker, connector), the projection and template slot directives, the marker-host DI contract, and the label/template config cascade. Reach for it directly when a row should render standalone without the organism, when an app-wide override (bucketing, marker template, labels) has to be provided, or when an ejected skin needs the brain without the styled component. For the styled, async-state-driven feed, use [`@cngx/ui/timeline`](../../ui/timeline/) - that README covers grouping modes, layout, skins and the body switch.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import {
|
|
9
|
+
CngxTimelineItem,
|
|
10
|
+
CngxTimelineTime,
|
|
11
|
+
createTimelineGrouping,
|
|
12
|
+
provideTimelineConfig,
|
|
13
|
+
} from '@cngx/common/timeline';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
A row is a terminal composable unit, not a fragment of the organism. It ships its own token SET rules, so it renders complete and density-correct with no `<cngx-timeline>` above it:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Component } from '@angular/core';
|
|
22
|
+
import { CngxTimelineItem, CngxTimelineTime } from '@cngx/common/timeline';
|
|
23
|
+
import { CngxTime } from '@cngx/common/display';
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'app-example',
|
|
27
|
+
template: `
|
|
28
|
+
<cngx-timeline-item status="done" position="last">
|
|
29
|
+
<cngx-time cngxTimelineTime [date]="deployedAt" />
|
|
30
|
+
<p>Deployment finished</p>
|
|
31
|
+
</cngx-timeline-item>
|
|
32
|
+
`,
|
|
33
|
+
imports: [CngxTimelineItem, CngxTimelineTime, CngxTime],
|
|
34
|
+
})
|
|
35
|
+
export class ExampleComponent {
|
|
36
|
+
protected readonly deployedAt = new Date();
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Grouping presenter
|
|
41
|
+
|
|
42
|
+
`createTimelineGrouping` derives sorted date bands from a flat list. Pure derivation over one `linkedSignal`; nothing is synced, the input array is never mutated.
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
const grouping = createTimelineGrouping({
|
|
46
|
+
items: this.events, // () => readonly T[]
|
|
47
|
+
dateAccessor: (event) => event.occurredAt, // Date | string | number
|
|
48
|
+
groupBy: () => 'day', // 'day' | 'week' | 'month' | 'none' | TimelineGroupingFn<T>
|
|
49
|
+
direction: () => 'desc', // 'asc' | 'desc'
|
|
50
|
+
});
|
|
51
|
+
grouping.groups(); // Signal<readonly TimelineGroup<T>[]>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Every reactive knob is a zero-arg accessor, so a `Signal` or `input()` passes directly. Three properties make it the organism's only data path:
|
|
55
|
+
|
|
56
|
+
- **Defensive stable sort.** Input order is irrelevant; items sharing a timestamp keep their input order in both directions.
|
|
57
|
+
- **Local-calendar bucketing.** `day` / `week` / `month` read local date fields, so 23- and 25-hour DST days group as one day. Weeks start Monday. UTC or fiscal rules go through a `TimelineGroupingFn<T>` returning `{ key, start }`.
|
|
58
|
+
- **Append-stability.** Bands whose items are the same object references hand back the same band reference, keyed on identity rather than id - a refetch returns new objects and must not pin a band to a stale payload.
|
|
59
|
+
|
|
60
|
+
A `TimelineGroup<T>` carries `key` (stable, doubles as `@for` track and `aria-labelledby` seed), `start` (local bucket start) and `items`. It carries no label; formatting is a locale concern owned by the header slot or `labels.groupLabel`.
|
|
61
|
+
|
|
62
|
+
`CNGX_TIMELINE_GROUPING_FACTORY` resolves the presenter the organism builds bands with (type `CngxTimelineGroupingFactory`, defaults to `createTimelineGrouping`). Override at root for app-wide bucketing rules, or in `viewProviders` for one component. Wrap rather than replace: call `createTimelineGrouping` inside the override and post-process its `groups`.
|
|
63
|
+
|
|
64
|
+
## Row atoms
|
|
65
|
+
|
|
66
|
+
### CngxTimelineItem
|
|
67
|
+
|
|
68
|
+
One event: marker, rail segment, optional timestamp, projected body. Two independent state channels that compose - `status` is editorial (where the event sits in the history), `state` is whether this row's own data is in flight or failed. A failed row paints `rejected` and announces the failure without discarding the editorial status it returns to after a retry.
|
|
69
|
+
|
|
70
|
+
|Input|Type|Default|Description|
|
|
71
|
+
|-|-|-|-|
|
|
72
|
+
|`status`|`TimelineStatus \| undefined`|`undefined`|`'done' \| 'active' \| 'upcoming' \| 'rejected'`. Drives marker/rail colour and the SR status line|
|
|
73
|
+
|`state`|`CngxAsyncState<unknown> \| undefined`|`undefined`|This row's own async state; sets `aria-busy`, repaints as rejected on error|
|
|
74
|
+
|`position`|`TimelineConnectorPosition`|`'middle'`|Forwarded to the rail; `'last'` / `'only'` stop it|
|
|
75
|
+
|`item`|`unknown`|`undefined`|Payload handed to an app-wide `*cngxTimelineMarkerTpl` as `$implicit`|
|
|
76
|
+
|
|
77
|
+
The `TimelineStatus` vocabulary is deliberately narrow: it describes a history, not what the user may do. A timeline needing `disabled` or `current` is a stepper - see `@cngx/common/stepper`.
|
|
78
|
+
|
|
79
|
+
### CngxTimelineMarker and CngxTimelineConnector
|
|
80
|
+
|
|
81
|
+
Both usable standalone, both decorative and `aria-hidden` - the owning item carries the semantics.
|
|
82
|
+
|
|
83
|
+
|Component|Inputs|Notes|
|
|
84
|
+
|-|-|-|
|
|
85
|
+
|`<cngx-timeline-marker>`|`status`, `busy`|Status-coloured dot; projects a glyph, icon or avatar. `busy` pulses via `box-shadow` (no box change, suppressed under reduced motion)|
|
|
86
|
+
|`<cngx-timeline-connector>`|`status`, `position`|Rail segment. `upcoming` dashed, `rejected` danger-toned; `position: 'first' \| 'middle' \| 'last' \| 'only'` clips the ends, `'only'` renders nothing. Logical properties throughout, so RTL needs no override|
|
|
87
|
+
|
|
88
|
+
### Projection slots on the row
|
|
89
|
+
|
|
90
|
+
|Directive|Placement|
|
|
91
|
+
|-|-|
|
|
92
|
+
|`[cngxTimelineTime]`|Timestamp; positioned by the active mode raster. Pair with `<cngx-time>` from `@cngx/common/display`|
|
|
93
|
+
|`[cngxTimelineOpposite]`|Far side of the rail from the body. Keep it non-interactive - it projects ahead of the body, and dev mode warns on focusable content|
|
|
94
|
+
|`[cngxTimelineMarkerContent]`|Inside the marker dot; wins over the timeline-wide `*cngxTimelineMarkerTpl` (most-local-wins)|
|
|
95
|
+
|`[cngxTimelineContent]`|Explicit body marker; unslotted content lands in the body anyway|
|
|
96
|
+
|
|
97
|
+
## Template slots
|
|
98
|
+
|
|
99
|
+
Eight structural directives, consumed by the organism through the three-stage cascade: per-instance directive, then `CngxTimelineConfig.templates`, then built-in markup.
|
|
100
|
+
|
|
101
|
+
|Directive|Context|Config key|
|
|
102
|
+
|-|-|-|
|
|
103
|
+
|`CngxTimelineItemTpl` (`*cngxTimelineItem`)|`$implicit: T`, `index`, `first`, `last`, `group` (per group, not per timeline)|`item`|
|
|
104
|
+
|`CngxTimelineDateHeader`|`$implicit: TimelineGroup<T>`|`dateHeader`|
|
|
105
|
+
|`CngxTimelineMarkerTpl`|`$implicit: T`, `status`|`marker`|
|
|
106
|
+
|`CngxTimelineEmpty`|`$implicit: EmptyReason`|`empty`|
|
|
107
|
+
|`CngxTimelineError`|`$implicit: unknown`, `retry`|`error`|
|
|
108
|
+
|`CngxTimelineRetryButton`|`$implicit: () => void`|`retryButton`|
|
|
109
|
+
|`CngxTimelineLoadingTail`|none|`loadingTail`|
|
|
110
|
+
|`CngxTimelineSkeleton`|none|`skeleton`|
|
|
111
|
+
|
|
112
|
+
The three generic slots carry a type-pinning input: bind the same array the timeline renders (`[cngxTimelineItem]="events()"`) and the `let-` variables come out typed. The binding is never read at runtime - it is the `ngForOf` mechanism, and leaving it off falls back to `unknown`. The class is `CngxTimelineItemTpl` so it does not collide with the `CngxTimelineItem` component; the selector consumers write stays `cngxTimelineItem`.
|
|
113
|
+
|
|
114
|
+
## Marker host token
|
|
115
|
+
|
|
116
|
+
`CNGX_TIMELINE_MARKER_HOST` is how a row reaches the timeline-wide marker template. The organism is data-driven - the consumer writes `<cngx-timeline-item>` inside the row template themselves, so the organism has no handle on the marker. It provides `CngxTimelineMarkerHost` (`markerTpl: Signal<TemplateRef<...> | null>`, already resolved through the config cascade); the row injects it optionally and falls back to its own `[cngxTimelineMarkerContent]` projection. A token rather than a parent class keeps the row usable standalone.
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
Labels and app-wide slot templates, nothing behavioural. Resolution: per-instance input, then `provideTimelineConfigAt`, then `provideTimelineConfig`, then library defaults.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
provideTimelineConfig(
|
|
124
|
+
withTimelineLabels({
|
|
125
|
+
retry: 'Erneut versuchen',
|
|
126
|
+
emptyFallback: 'Noch keine Ereignisse.',
|
|
127
|
+
groupLabel: (group, locale) => group.start.toLocaleDateString(locale, { dateStyle: 'medium' }),
|
|
128
|
+
}),
|
|
129
|
+
withTimelineTemplates({ empty: myEmptyTemplate }),
|
|
130
|
+
);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- Defaults are English; a missing translation shows English text, never a blank surface. `labels.status` merges key by key, so renaming one status keeps the other three.
|
|
134
|
+
- `provideTimelineConfigAt(...)` returns `Provider[]` for `viewProviders` and merges onto the enclosing config, so a region re-phrases one label without resetting the rest.
|
|
135
|
+
- `injectTimelineConfig()` reads the resolved config in an injection context; `CNGX_TIMELINE_CONFIG` is the raw token.
|
|
136
|
+
- `CngxTimelineLabels` covers `timelineRegion`, `retry`, `errorFallback`, `emptyFallback`, `loading`, `refreshing`, `itemBusy`, `itemErrorFallback`, the `status` map and `groupLabel`. `groupLabel` receives the app locale as its second argument and re-runs when `CNGX_LOCALE` switches.
|
|
137
|
+
|
|
138
|
+
## Accessibility
|
|
139
|
+
|
|
140
|
+
What the headless layer contributes, before any organism ARIA:
|
|
141
|
+
|
|
142
|
+
- Marker and connector are `aria-hidden`. Colour is never the only channel: the status reaches assistive tech through a screen-reader-only line on the item, fed from `labels.status`, rendered only while it has something to say.
|
|
143
|
+
- `aria-busy` on the item is a `computed()` over the row's own `state`, not the list's.
|
|
144
|
+
- A failed row paints `rejected`, announces it (the announcement always matches the paint), and renders a visible inline error from `labels.itemErrorFallback`. Both read as row content in DOM order - the host has no role, so `aria-describedby` would resolve nowhere.
|
|
145
|
+
- Dev mode warns once per row when `[cngxTimelineOpposite]` contains focusable content: the slot projects ahead of the body, so a control there takes focus before the row it belongs to.
|
|
146
|
+
- Every string a surface can render without a consumer slot is localisable through `withTimelineLabels`.
|
|
147
|
+
|
|
148
|
+
## See Also
|
|
149
|
+
|
|
150
|
+
- [`@cngx/ui/timeline`](../../ui/timeline/) - the styled organism: grouping inputs, layout, skins, async body, Material bridge
|
|
151
|
+
- [`@cngx/common/stepper`](../stepper/) - guided process; timeline is history
|
|
152
|
+
- [`CngxTime`](../display/) - relative timestamp formatting for `[cngxTimelineTime]`
|
|
153
|
+
- [`CngxAsyncState`](../../core/) - the per-row `[state]` contract
|
|
154
|
+
- [API on compodocx](https://cngxjs.github.io/cngx/)
|
|
155
|
+
- Tests: `projects/common/timeline/*.spec.ts`
|
|
@@ -33,7 +33,6 @@ import { OnDestroy, ElementRef, InjectionToken, Signal } from '@angular/core';
|
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
35
|
* @category common/a11y
|
|
36
|
-
* @docsKind primary
|
|
37
36
|
* @wcag AA
|
|
38
37
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts
|
|
39
38
|
* @since 0.1.0
|
|
@@ -80,7 +79,6 @@ declare class CngxAriaExpanded {
|
|
|
80
79
|
* ```
|
|
81
80
|
*
|
|
82
81
|
* @category common/a11y
|
|
83
|
-
* @docsKind primary
|
|
84
82
|
* @wcag AA
|
|
85
83
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-region.directive.ts
|
|
86
84
|
* @since 0.1.0
|
|
@@ -104,7 +102,13 @@ declare class CngxLiveRegion {
|
|
|
104
102
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxLiveRegion, "[cngxLiveRegion]", ["cngxLiveRegion"], { "politeness": { "alias": "politeness"; "required": false; "isSignal": true; }; "atomic": { "alias": "atomic"; "required": false; "isSignal": true; }; "relevant": { "alias": "relevant"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Politeness channel for {@link CngxLiveAnnouncer.announce}: `'polite'` queues
|
|
107
|
+
* after the current utterance, `'assertive'` interrupts it immediately.
|
|
108
|
+
*
|
|
109
|
+
* @category common/a11y
|
|
110
|
+
*/
|
|
111
|
+
type AriaLivePoliteness = 'polite' | 'assertive';
|
|
108
112
|
/**
|
|
109
113
|
* Imperative, reusable polite/assertive live-region announcer.
|
|
110
114
|
*
|
|
@@ -132,7 +136,6 @@ type Politeness = 'polite' | 'assertive';
|
|
|
132
136
|
* ```
|
|
133
137
|
*
|
|
134
138
|
* @category common/a11y
|
|
135
|
-
* @docsKind primary
|
|
136
139
|
* @wcag AA
|
|
137
140
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-announcer.ts
|
|
138
141
|
* @since 0.1.0
|
|
@@ -152,7 +155,7 @@ declare class CngxLiveAnnouncer implements OnDestroy {
|
|
|
152
155
|
* utterance; `'assertive'` interrupts immediately. Each politeness owns its
|
|
153
156
|
* own region, so the two never overwrite each other.
|
|
154
157
|
*/
|
|
155
|
-
announce(message: string, politeness?:
|
|
158
|
+
announce(message: string, politeness?: AriaLivePoliteness): void;
|
|
156
159
|
ngOnDestroy(): void;
|
|
157
160
|
private ensureRegion;
|
|
158
161
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLiveAnnouncer, never>;
|
|
@@ -187,7 +190,6 @@ declare class CngxLiveAnnouncer implements OnDestroy {
|
|
|
187
190
|
* ```
|
|
188
191
|
*
|
|
189
192
|
* @category common/a11y
|
|
190
|
-
* @docsKind primary
|
|
191
193
|
* @wcag AA
|
|
192
194
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/autofocus.directive.ts
|
|
193
195
|
* @since 0.1.0
|
|
@@ -238,7 +240,9 @@ declare const CNGX_FOCUSABLE_SELECTOR = "a[href], button:not(:disabled), input:n
|
|
|
238
240
|
* `document.activeElement` at initialization time and restores it when the
|
|
239
241
|
* host element is destroyed.
|
|
240
242
|
*
|
|
241
|
-
* Fallback chain: stored element → provided fallback → nearest focusable ancestor
|
|
243
|
+
* Fallback chain: stored element → provided fallback → nearest focusable ancestor.
|
|
244
|
+
* When none resolves, focus is left where the browser put it - `<body>` is
|
|
245
|
+
* deliberately never a restore target.
|
|
242
246
|
*
|
|
243
247
|
* ### Panel that restores focus on close
|
|
244
248
|
* ```html
|
|
@@ -259,7 +263,6 @@ declare const CNGX_FOCUSABLE_SELECTOR = "a[href], button:not(:disabled), input:n
|
|
|
259
263
|
* ```
|
|
260
264
|
*
|
|
261
265
|
* @category common/a11y
|
|
262
|
-
* @docsKind primary
|
|
263
266
|
* @wcag AA
|
|
264
267
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts
|
|
265
268
|
* @since 0.1.0
|
|
@@ -311,6 +314,11 @@ declare class CngxFocusRestore {
|
|
|
311
314
|
* The CDK's imperative `create()` / `destroy()` / `enabled` setter lifecycle
|
|
312
315
|
* is handled internally via `effect()` and `DestroyRef`.
|
|
313
316
|
*
|
|
317
|
+
* **Nesting:** traps do not coordinate with each other. When traps nest
|
|
318
|
+
* (dialog over drawer), enable only the innermost one and drive each
|
|
319
|
+
* `enabled` from your layering state - two simultaneously enabled traps
|
|
320
|
+
* fight over Tab. `CngxDialogStack` already does this for stacked dialogs.
|
|
321
|
+
*
|
|
314
322
|
* ### Modal dialog
|
|
315
323
|
* ```html
|
|
316
324
|
* <div cngxFocusTrap [enabled]="isOpen()" [autoFocus]="true"
|
|
@@ -343,7 +351,10 @@ declare class CngxFocusTrap {
|
|
|
343
351
|
readonly enabled: _angular_core.InputSignal<boolean>;
|
|
344
352
|
/** Whether to auto-focus the first tabbable element when the trap activates. */
|
|
345
353
|
readonly autoFocus: _angular_core.InputSignal<boolean>;
|
|
346
|
-
/**
|
|
354
|
+
/**
|
|
355
|
+
* Readable alias of `enabled` for `exportAs` consumers
|
|
356
|
+
* (`trap.isActive()` reads better than re-binding the input).
|
|
357
|
+
*/
|
|
347
358
|
readonly isActive: _angular_core.Signal<boolean>;
|
|
348
359
|
private readonly trap;
|
|
349
360
|
constructor();
|
|
@@ -369,7 +380,6 @@ declare class CngxFocusTrap {
|
|
|
369
380
|
* ```
|
|
370
381
|
*
|
|
371
382
|
* @category common/a11y
|
|
372
|
-
* @docsKind primary
|
|
373
383
|
* @wcag AA
|
|
374
384
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-visible.directive.ts
|
|
375
385
|
* @since 0.1.0
|
|
@@ -378,11 +388,16 @@ declare class CngxFocusTrap {
|
|
|
378
388
|
* <example-url>http://localhost:4200/#/common/a11y/focus-visible/keyboard-vs-pointer</example-url>
|
|
379
389
|
*/
|
|
380
390
|
declare class CngxFocusVisible {
|
|
391
|
+
private readonly doc;
|
|
381
392
|
private readonly focusVisibleState;
|
|
382
393
|
/** `true` when focus was initiated via keyboard (not pointer). */
|
|
383
394
|
readonly focusVisible: _angular_core.Signal<boolean>;
|
|
384
|
-
|
|
385
|
-
|
|
395
|
+
private pointerActive;
|
|
396
|
+
private pointerClearTimer;
|
|
397
|
+
private readonly schedulePointerClear;
|
|
398
|
+
constructor();
|
|
399
|
+
/** @internal Arms the pointer flag for the imminent focusin. */
|
|
400
|
+
protected handlePointerDown(): void;
|
|
386
401
|
/** @internal Sets focus-visible state; clears pointer flag. */
|
|
387
402
|
protected handleFocus(): void;
|
|
388
403
|
/** @internal Clears focus-visible state on blur. */
|
|
@@ -407,7 +422,6 @@ declare class CngxFocusVisible {
|
|
|
407
422
|
* ```
|
|
408
423
|
*
|
|
409
424
|
* @category common/a11y
|
|
410
|
-
* @docsKind primary
|
|
411
425
|
* @wcag AA
|
|
412
426
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts
|
|
413
427
|
* @since 0.1.0
|
|
@@ -558,7 +572,8 @@ declare class CngxRovingTabindex {
|
|
|
558
572
|
private focusVirtualItem;
|
|
559
573
|
/**
|
|
560
574
|
* Finds the next index in virtual mode. No disabled-item skipping - can't check
|
|
561
|
-
* disabled state of items not in the DOM
|
|
575
|
+
* disabled state of items not in the DOM (the resolver treats every index as
|
|
576
|
+
* enabled when no `isDisabledAt` is supplied).
|
|
562
577
|
*/
|
|
563
578
|
private findNextVirtual;
|
|
564
579
|
private enabledItems;
|
|
@@ -712,7 +727,17 @@ declare class CngxActiveDescendant {
|
|
|
712
727
|
readonly activated: _angular_core.OutputEmitterRef<unknown>;
|
|
713
728
|
/** Emitted whenever the highlighted item changes. */
|
|
714
729
|
readonly highlighted: _angular_core.OutputEmitterRef<ActiveDescendantItem | null>;
|
|
730
|
+
/**
|
|
731
|
+
* Emitted when a typeahead query finds no match in the rendered window.
|
|
732
|
+
* Carries the resolved query term (lowercased; a repeated single letter
|
|
733
|
+
* collapses to that letter per the APG cycle rule). The rendered window
|
|
734
|
+
* is AD's whole search space - hosts whose real item space is larger
|
|
735
|
+
* (collapsed tree branches, virtualized rows outside the window) listen
|
|
736
|
+
* here to resolve the miss themselves.
|
|
737
|
+
*/
|
|
738
|
+
readonly typeaheadMissed: _angular_core.OutputEmitterRef<string>;
|
|
715
739
|
private readonly hostEl;
|
|
740
|
+
private readonly locale;
|
|
716
741
|
private readonly registered;
|
|
717
742
|
/** Document writing direction - flips the horizontal-arrow steps under `rtl` (APG). */
|
|
718
743
|
private readonly direction;
|
|
@@ -788,7 +813,7 @@ declare class CngxActiveDescendant {
|
|
|
788
813
|
* First/last navigable absolute index. Spans the full virtual range - End
|
|
789
814
|
* targets `totalCount - 1` even when that item is not rendered (it surfaces
|
|
790
815
|
* as `pendingHighlight`); unrendered items count as enabled because their
|
|
791
|
-
* disabled state is unknowable.
|
|
816
|
+
* disabled state is unknowable (`isDisabledAt` resolves them to `false`).
|
|
792
817
|
*/
|
|
793
818
|
private findBoundary;
|
|
794
819
|
private totalCount;
|
|
@@ -800,7 +825,7 @@ declare class CngxActiveDescendant {
|
|
|
800
825
|
private isRendered;
|
|
801
826
|
private scrollActiveIntoView;
|
|
802
827
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxActiveDescendant, never>;
|
|
803
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxActiveDescendant, "[cngxActiveDescendant]", ["cngxActiveDescendant"], { "items": { "alias": "items"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "typeahead": { "alias": "typeahead"; "required": false; "isSignal": true; }; "typeaheadDebounce": { "alias": "typeaheadDebounce"; "required": false; "isSignal": true; }; "autoHighlightFirst": { "alias": "autoHighlightFirst"; "required": false; "isSignal": true; }; "skipDisabled": { "alias": "skipDisabled"; "required": false; "isSignal": true; }; "virtualCount": { "alias": "virtualCount"; "required": false; "isSignal": true; }; "windowStart": { "alias": "windowStart"; "required": false; "isSignal": true; }; }, { "activated": "activated"; "highlighted": "highlighted"; }, ["registered"], never, true, never>;
|
|
828
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxActiveDescendant, "[cngxActiveDescendant]", ["cngxActiveDescendant"], { "items": { "alias": "items"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "typeahead": { "alias": "typeahead"; "required": false; "isSignal": true; }; "typeaheadDebounce": { "alias": "typeaheadDebounce"; "required": false; "isSignal": true; }; "autoHighlightFirst": { "alias": "autoHighlightFirst"; "required": false; "isSignal": true; }; "skipDisabled": { "alias": "skipDisabled"; "required": false; "isSignal": true; }; "virtualCount": { "alias": "virtualCount"; "required": false; "isSignal": true; }; "windowStart": { "alias": "windowStart"; "required": false; "isSignal": true; }; }, { "activated": "activated"; "highlighted": "highlighted"; "typeaheadMissed": "typeaheadMissed"; }, ["registered"], never, true, never>;
|
|
804
829
|
}
|
|
805
830
|
|
|
806
831
|
/**
|
|
@@ -829,7 +854,6 @@ declare class CngxActiveDescendant {
|
|
|
829
854
|
* ```
|
|
830
855
|
*
|
|
831
856
|
* @category common/a11y
|
|
832
|
-
* @docsKind primary
|
|
833
857
|
* @wcag AA
|
|
834
858
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/motion/reduced-motion.directive.ts
|
|
835
859
|
* @since 0.1.0
|
|
@@ -845,4 +869,4 @@ declare class CngxReducedMotion {
|
|
|
845
869
|
}
|
|
846
870
|
|
|
847
871
|
export { CNGX_AD_ITEM, CNGX_FOCUSABLE_SELECTOR, CngxActiveDescendant, CngxAriaExpanded, CngxAutofocus, CngxFocusRestore, CngxFocusTrap, CngxFocusVisible, CngxLiveAnnouncer, CngxLiveRegion, CngxReducedMotion, CngxRovingItem, CngxRovingTabindex };
|
|
848
|
-
export type { ActiveDescendantItem, CngxAdItemHandle };
|
|
872
|
+
export type { ActiveDescendantItem, AriaLivePoliteness, CngxAdItemHandle };
|