@cngx/common 0.1.0-rc.6 → 0.1.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/card/README.md +2 -1
- package/chart/README.md +85 -0
- package/command/README.md +157 -0
- package/data/README.md +33 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +356 -180
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +84 -42
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +311 -53
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +4360 -1625
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +171 -0
- package/fesm2022/cngx-common-command.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +1556 -616
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +518 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +468 -87
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2725 -1303
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +943 -164
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +769 -103
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +816 -348
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +2330 -1554
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +1170 -0
- package/fesm2022/cngx-common-timeline.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +11 -1
- package/popover/README.md +18 -2
- package/stepper/README.md +7 -5
- package/theming/components/cngx-accordion.css +4 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-badge.css +22 -0
- package/theming/components/cngx-bottom-sheet.css +14 -2
- package/theming/components/cngx-breadcrumb.css +8 -0
- package/theming/components/cngx-button-toggle.css +73 -5
- package/theming/components/cngx-data-grid.css +234 -1
- package/theming/components/cngx-dialog.css +25 -0
- package/theming/components/cngx-divider.css +12 -0
- package/theming/components/cngx-listbox.css +48 -12
- package/theming/components/cngx-menu.css +91 -15
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +2 -2
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +23 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +101 -31
- package/types/cngx-common-audio.d.ts +32 -32
- package/types/cngx-common-card.d.ts +211 -20
- package/types/cngx-common-chart.d.ts +1605 -169
- package/types/cngx-common-command.d.ts +190 -0
- package/types/cngx-common-data.d.ts +842 -163
- package/types/cngx-common-dialog.d.ts +372 -28
- package/types/cngx-common-display.d.ts +432 -148
- package/types/cngx-common-interactive.d.ts +1553 -370
- package/types/cngx-common-layout.d.ts +613 -27
- package/types/cngx-common-popover.d.ts +376 -36
- package/types/cngx-common-stepper.d.ts +414 -114
- package/types/cngx-common-tabs.d.ts +597 -72
- package/types/cngx-common-timeline.d.ts +1125 -0
- package/types/cngx-common.d.ts +1 -1
|
@@ -0,0 +1,1125 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, TemplateRef, EnvironmentProviders, Provider } from '@angular/core';
|
|
3
|
+
import * as _cngx_common_timeline from '@cngx/common/timeline';
|
|
4
|
+
import { CngxAsyncState } from '@cngx/core/utils';
|
|
5
|
+
import { EmptyReason } from '@cngx/common/card';
|
|
6
|
+
import { CngxMessage } from '@cngx/core/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* One rendered band of a timeline - a calendar bucket plus the items that
|
|
10
|
+
* fall into it, already sorted.
|
|
11
|
+
*
|
|
12
|
+
* The group carries no label: formatting a date is a locale concern that
|
|
13
|
+
* belongs to the `*cngxTimelineDateHeader` slot (or the config's
|
|
14
|
+
* `groupLabel` fallback), not to the presenter. `key` is stable and
|
|
15
|
+
* collision-free across the built-in groupers, so it doubles as the
|
|
16
|
+
* `@for` track expression and as the `aria-labelledby` id seed.
|
|
17
|
+
*
|
|
18
|
+
* @category common/timeline
|
|
19
|
+
*/
|
|
20
|
+
interface TimelineGroup<T> {
|
|
21
|
+
/** Stable bucket identity, e.g. `2026-07-27` for `day`. */
|
|
22
|
+
readonly key: string;
|
|
23
|
+
/**
|
|
24
|
+
* Local start-of-bucket instant - midnight for `day`, the Monday for
|
|
25
|
+
* `week`, the first of the month for `month`. For `'none'` it is the
|
|
26
|
+
* date of the first item in sort order.
|
|
27
|
+
*/
|
|
28
|
+
readonly start: Date;
|
|
29
|
+
/** Items in this bucket, in the resolved sort direction. */
|
|
30
|
+
readonly items: readonly T[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What a {@link TimelineGroupingFn} returns for a single item: the bucket
|
|
34
|
+
* it belongs to, and the instant that bucket starts at.
|
|
35
|
+
*
|
|
36
|
+
* @category common/timeline
|
|
37
|
+
*/
|
|
38
|
+
interface TimelineGroupKey {
|
|
39
|
+
readonly key: string;
|
|
40
|
+
readonly start: Date;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Escape hatch for consumer-defined bucketing - UTC days, fiscal quarters,
|
|
44
|
+
* sprint windows, "today / this week / earlier". Receives the coerced date
|
|
45
|
+
* and the item it came from, so a grouper may key off payload fields
|
|
46
|
+
* (tenant, channel) as well as time.
|
|
47
|
+
*
|
|
48
|
+
* Called once per item per recomputation; keep it pure and cheap.
|
|
49
|
+
*
|
|
50
|
+
* @category common/timeline
|
|
51
|
+
*/
|
|
52
|
+
type TimelineGroupingFn<T> = (date: Date, item: T) => TimelineGroupKey;
|
|
53
|
+
/**
|
|
54
|
+
* Built-in bucketing modes plus the {@link TimelineGroupingFn} escape
|
|
55
|
+
* hatch. The three calendar modes read **local** date fields, so they stay
|
|
56
|
+
* correct across DST transitions where a day is 23 or 25 hours long -
|
|
57
|
+
* epoch division would silently split or merge those days.
|
|
58
|
+
*
|
|
59
|
+
* `'none'` collapses everything into one synthetic group, which is how the
|
|
60
|
+
* organism renders an ungrouped `role="list"` without a second code path.
|
|
61
|
+
*
|
|
62
|
+
* @category common/timeline
|
|
63
|
+
*/
|
|
64
|
+
type TimelineGroupBy<T> = 'day' | 'week' | 'month' | 'none' | TimelineGroupingFn<T>;
|
|
65
|
+
/**
|
|
66
|
+
* Sort direction for the whole timeline. `'desc'` (default) is
|
|
67
|
+
* newest-first, the activity-feed convention; `'asc'` is oldest-first,
|
|
68
|
+
* which reads better for narrative histories.
|
|
69
|
+
*
|
|
70
|
+
* @category common/timeline
|
|
71
|
+
*/
|
|
72
|
+
type TimelineDirection = 'asc' | 'desc';
|
|
73
|
+
/**
|
|
74
|
+
* Pulls the timestamp out of a consumer item. Anything the `Date`
|
|
75
|
+
* constructor accepts works, so ISO strings straight off an API response
|
|
76
|
+
* need no pre-mapping.
|
|
77
|
+
*
|
|
78
|
+
* @category common/timeline
|
|
79
|
+
*/
|
|
80
|
+
type TimelineDateAccessor<T> = (item: T) => Date | string | number;
|
|
81
|
+
/**
|
|
82
|
+
* Inputs to {@link createTimelineGrouping}. Every reactive knob is a
|
|
83
|
+
* zero-arg accessor, so a `Signal` (or an `input()`) can be passed
|
|
84
|
+
* directly and a constant is just `() => 'day'`.
|
|
85
|
+
*
|
|
86
|
+
* @category common/timeline
|
|
87
|
+
*/
|
|
88
|
+
interface TimelineGroupingOptions<T> {
|
|
89
|
+
/** Source list. Read inside the `groups` computation, so it is tracked. */
|
|
90
|
+
readonly items: () => readonly T[];
|
|
91
|
+
/**
|
|
92
|
+
* Timestamp accessor. Not a signal itself, but it is called inside the
|
|
93
|
+
* `groups` computation, so a caller that closes over one - as the organism
|
|
94
|
+
* does over its `[dateAccessor]` input - has those reads tracked like any
|
|
95
|
+
* other and re-groups when the accessor is rebound.
|
|
96
|
+
*/
|
|
97
|
+
readonly dateAccessor: TimelineDateAccessor<T>;
|
|
98
|
+
/** Bucketing mode. Defaults to `'day'`. */
|
|
99
|
+
readonly groupBy?: () => TimelineGroupBy<T>;
|
|
100
|
+
/** Sort direction. Defaults to `'desc'`. */
|
|
101
|
+
readonly direction?: () => TimelineDirection;
|
|
102
|
+
/**
|
|
103
|
+
* BCP 47 locale whose first day of the week starts a `'week'` bucket
|
|
104
|
+
* (`Intl.Locale` week info: Sunday in `en-US`, Monday in `de`). Unset, or
|
|
105
|
+
* where the runtime has no week info, weeks start on Monday (ISO 8601).
|
|
106
|
+
*/
|
|
107
|
+
readonly locale?: () => string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* What {@link createTimelineGrouping} hands back. An object rather than a
|
|
111
|
+
* bare `Signal` because the v2 live cursor extends this surface - callers
|
|
112
|
+
* written against v1 keep compiling.
|
|
113
|
+
*
|
|
114
|
+
* @category common/timeline
|
|
115
|
+
*/
|
|
116
|
+
interface TimelineGrouping<T> {
|
|
117
|
+
readonly groups: Signal<readonly TimelineGroup<T>[]>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Derives grouped, sorted timeline bands from a flat item list.
|
|
121
|
+
*
|
|
122
|
+
* Pure derivation: bands come out of one `linkedSignal` over the `items`
|
|
123
|
+
* accessor. Nothing is synced, nothing is written back, and the presenter
|
|
124
|
+
* never mutates its input array. The previous bands are read through the
|
|
125
|
+
* `computation` callback rather than a closure cache, so the result depends
|
|
126
|
+
* on the inputs and the prior value alone - never on how many times it ran.
|
|
127
|
+
*
|
|
128
|
+
* Three properties make it usable as the organism's only data path:
|
|
129
|
+
*
|
|
130
|
+
* - **Defensive sort.** Consumer data does not have to arrive sorted. The
|
|
131
|
+
* presenter sorts by the accessor date on every run using a stable sort,
|
|
132
|
+
* so items sharing a timestamp keep their input order in both
|
|
133
|
+
* directions.
|
|
134
|
+
* - **Local-calendar bucketing.** `day` / `week` / `month` read local date
|
|
135
|
+
* fields rather than dividing the epoch, which is what keeps 23-hour and
|
|
136
|
+
* 25-hour DST days intact. Consumers who want UTC (or any other rule)
|
|
137
|
+
* pass a {@link TimelineGroupingFn}.
|
|
138
|
+
* - **Append-stability.** Groups whose items are *the same objects* hand
|
|
139
|
+
* back the same band reference, and the signal carries a structural
|
|
140
|
+
* `equal`. Reuse is deliberately keyed on reference identity rather than
|
|
141
|
+
* on an id: a refetch returns new objects at the same ids, and reusing
|
|
142
|
+
* there would pin the band to a stale payload. Appending therefore leaves
|
|
143
|
+
* every other band's
|
|
144
|
+
* `@for` block untouched instead of re-rendering the whole timeline.
|
|
145
|
+
*
|
|
146
|
+
* Reach for the DI token {@link CNGX_TIMELINE_GROUPING_FACTORY} rather
|
|
147
|
+
* than this function directly when the caller is a component - that is
|
|
148
|
+
* what makes the bucketing swappable per app or per component.
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* const grouping = createTimelineGrouping({
|
|
152
|
+
* items: this.events,
|
|
153
|
+
* dateAccessor: (event) => event.occurredAt,
|
|
154
|
+
* groupBy: this.groupBy,
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @category common/timeline
|
|
159
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/grouping.ts
|
|
160
|
+
* @since 0.1.0
|
|
161
|
+
*/
|
|
162
|
+
declare function createTimelineGrouping<T>(options: TimelineGroupingOptions<T>): TimelineGrouping<T>;
|
|
163
|
+
/**
|
|
164
|
+
* Signature of {@link createTimelineGrouping}, carried as a named type so
|
|
165
|
+
* a DI override matches it exactly.
|
|
166
|
+
*
|
|
167
|
+
* @category common/timeline
|
|
168
|
+
*/
|
|
169
|
+
type CngxTimelineGroupingFactory = <T>(options: TimelineGroupingOptions<T>) => TimelineGrouping<T>;
|
|
170
|
+
/**
|
|
171
|
+
* Resolves the presenter `<cngx-timeline>` builds its bands with.
|
|
172
|
+
* Defaults to {@link createTimelineGrouping}.
|
|
173
|
+
*
|
|
174
|
+
* Override app-wide via
|
|
175
|
+
* `providers: [{ provide: CNGX_TIMELINE_GROUPING_FACTORY, useValue: myFactory }]`
|
|
176
|
+
* to change bucketing everywhere (fiscal calendars, "today / earlier"
|
|
177
|
+
* relative bands, server-supplied grouping), or per component via
|
|
178
|
+
* `viewProviders` for a one-off. An override wraps rather than replaces
|
|
179
|
+
* in most cases - call `createTimelineGrouping` inside your factory and
|
|
180
|
+
* post-process its `groups`.
|
|
181
|
+
*
|
|
182
|
+
* Same shape as `CNGX_SELECTION_CONTROLLER_FACTORY`: the internals of a
|
|
183
|
+
* component are swappable without forking the component.
|
|
184
|
+
*
|
|
185
|
+
* @category common/timeline
|
|
186
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/grouping.ts
|
|
187
|
+
* @relatedTo createTimelineGrouping
|
|
188
|
+
* @since 0.1.0
|
|
189
|
+
*/
|
|
190
|
+
declare const CNGX_TIMELINE_GROUPING_FACTORY: InjectionToken<CngxTimelineGroupingFactory>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Process vocabulary shared by the timeline marker, the connector and
|
|
194
|
+
* `CngxTimelineItem`.
|
|
195
|
+
*
|
|
196
|
+
* Deliberately narrow: it describes where an event sits in a history, not
|
|
197
|
+
* what the user may do about it. A timeline that needed `disabled`,
|
|
198
|
+
* `editable` or `current` would be a stepper, and steppers live in
|
|
199
|
+
* `@cngx/common/stepper` with their own flow logic.
|
|
200
|
+
*
|
|
201
|
+
* @category common/timeline
|
|
202
|
+
*/
|
|
203
|
+
type TimelineStatus = 'done' | 'active' | 'upcoming' | 'rejected';
|
|
204
|
+
/**
|
|
205
|
+
* The dot on the timeline rail - a status-coloured slot host for whatever
|
|
206
|
+
* the consumer projects into it (nothing, a glyph, an icon, an avatar).
|
|
207
|
+
*
|
|
208
|
+
* Purely decorative and marked `aria-hidden`: the status it paints is
|
|
209
|
+
* already carried semantically by the owning `CngxTimelineItem`, and
|
|
210
|
+
* announcing it twice is worse than not announcing it here at all. That
|
|
211
|
+
* also means colour is never this atom's only signal - the item's ARIA is.
|
|
212
|
+
*
|
|
213
|
+
* Usable standalone. It ships its own token SET rules, so a marker
|
|
214
|
+
* dropped into a hand-rolled layout renders at the right size and tracks
|
|
215
|
+
* `[data-density]` with no timeline organism above it.
|
|
216
|
+
*
|
|
217
|
+
* ### Bare dot
|
|
218
|
+
* ```html
|
|
219
|
+
* <cngx-timeline-marker status="done" />
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* ### With a projected glyph
|
|
223
|
+
* ```html
|
|
224
|
+
* <cngx-timeline-marker status="rejected">!</cngx-timeline-marker>
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* ### Pending
|
|
228
|
+
* ```html
|
|
229
|
+
* <cngx-timeline-marker status="active" busy />
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* @category common/timeline
|
|
233
|
+
* @wcag AA
|
|
234
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/marker.component.ts
|
|
235
|
+
* @relatedTo CngxTimelineConnector
|
|
236
|
+
* @since 0.1.0
|
|
237
|
+
*/
|
|
238
|
+
declare class CngxTimelineMarker {
|
|
239
|
+
/**
|
|
240
|
+
* Where the event sits in the history. Drives the dot colour and, for
|
|
241
|
+
* `upcoming`, its hollow fill. Left unset the marker paints in the
|
|
242
|
+
* neutral rail colour.
|
|
243
|
+
*/
|
|
244
|
+
readonly status: i0.InputSignal<TimelineStatus | undefined>;
|
|
245
|
+
/**
|
|
246
|
+
* Whether the marker pulses to signal work in flight - typically bound
|
|
247
|
+
* from an item's own `[state]` being `pending`.
|
|
248
|
+
*
|
|
249
|
+
* The pulse is a `box-shadow` animation rather than a `transform` or a
|
|
250
|
+
* size change: the marker sits in a grid track the rail is aligned to,
|
|
251
|
+
* so anything that altered its box would drag the rail with it every
|
|
252
|
+
* frame. Suppressed under `prefers-reduced-motion`.
|
|
253
|
+
*/
|
|
254
|
+
readonly busy: i0.InputSignalWithTransform<boolean, unknown>;
|
|
255
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineMarker, never>;
|
|
256
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CngxTimelineMarker, "cngx-timeline-marker", never, { "status": { "alias": "status"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Where a connector segment sits in its run, which decides which ends get
|
|
261
|
+
* clipped back to the adjacent marker's centre.
|
|
262
|
+
*
|
|
263
|
+
* `'only'` renders nothing at all - a single-item timeline has no rail to
|
|
264
|
+
* draw.
|
|
265
|
+
*
|
|
266
|
+
* @category common/timeline
|
|
267
|
+
*/
|
|
268
|
+
type TimelineConnectorPosition = 'middle' | 'first' | 'last' | 'only';
|
|
269
|
+
/**
|
|
270
|
+
* The rail segment between two markers.
|
|
271
|
+
*
|
|
272
|
+
* Decorative and `aria-hidden`: it repeats a sequence the DOM order
|
|
273
|
+
* already carries, so announcing it would only add noise. It is
|
|
274
|
+
* status-capable all the same, because the *visual* run of a history is
|
|
275
|
+
* where a rejected step or a not-yet-reached tail reads fastest - a
|
|
276
|
+
* dashed segment for `upcoming` and a danger-toned one for `rejected`,
|
|
277
|
+
* so the distinction survives without colour.
|
|
278
|
+
*
|
|
279
|
+
* Drawn with `border-inline-start` and clipped with block-direction
|
|
280
|
+
* margins - logical properties throughout, so the rail lands on the
|
|
281
|
+
* correct side under `dir="rtl"` with no override.
|
|
282
|
+
*
|
|
283
|
+
* ### Between two items
|
|
284
|
+
* ```html
|
|
285
|
+
* <cngx-timeline-connector status="done" />
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* ### Last item in the run
|
|
289
|
+
* ```html
|
|
290
|
+
* <cngx-timeline-connector position="last" />
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @category common/timeline
|
|
294
|
+
* @wcag AA
|
|
295
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/connector.component.ts
|
|
296
|
+
* @relatedTo CngxTimelineMarker
|
|
297
|
+
* @since 0.1.0
|
|
298
|
+
*/
|
|
299
|
+
declare class CngxTimelineConnector {
|
|
300
|
+
/**
|
|
301
|
+
* Status of the segment. `upcoming` renders dashed, `rejected` in the
|
|
302
|
+
* danger tone, `done` and `active` solid in their own tones. Left unset
|
|
303
|
+
* the rail paints in the neutral border colour.
|
|
304
|
+
*/
|
|
305
|
+
readonly status: i0.InputSignal<TimelineStatus | undefined>;
|
|
306
|
+
/**
|
|
307
|
+
* Position in the run. `'first'` clips the head back to the marker
|
|
308
|
+
* centre, `'last'` clips the tail, `'only'` hides the segment
|
|
309
|
+
* entirely. Defaults to `'middle'` - a full-height segment.
|
|
310
|
+
*/
|
|
311
|
+
readonly position: i0.InputSignal<TimelineConnectorPosition>;
|
|
312
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineConnector, never>;
|
|
313
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CngxTimelineConnector, "cngx-timeline-connector", never, { "status": { "alias": "status"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Marks the element that holds an item's timestamp, so the item can place
|
|
318
|
+
* it in the raster the active mode calls for - above the body in
|
|
319
|
+
* `narrative`, trailing it in `activity`.
|
|
320
|
+
*
|
|
321
|
+
* Pair it with `<cngx-time>` from `@cngx/common/display` for relative
|
|
322
|
+
* formatting; the timeline neither formats nor ticks.
|
|
323
|
+
*
|
|
324
|
+
* @category common/timeline
|
|
325
|
+
*/
|
|
326
|
+
declare class CngxTimelineTime {
|
|
327
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineTime, never>;
|
|
328
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineTime, "[cngxTimelineTime]", never, {}, {}, never, never, true, never>;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Marks content that belongs on the far side of the rail from the row's
|
|
332
|
+
* body - the year label opposite a card, the timestamp across a centred
|
|
333
|
+
* rail.
|
|
334
|
+
*
|
|
335
|
+
* Per-row content, so it is a projection slot rather than a timeline-wide
|
|
336
|
+
* template: the row template already owns it, and the config cascade is
|
|
337
|
+
* for surfaces the whole timeline shares.
|
|
338
|
+
*
|
|
339
|
+
* The extra grid track only exists for rows that actually project into it
|
|
340
|
+
* (`:has(> [cngxTimelineOpposite])`), so markup that predates this slot
|
|
341
|
+
* keeps its raster to the pixel. Placement follows the row: opposite content
|
|
342
|
+
* sits across the rail from the body under `start`, `end` and `alternate`
|
|
343
|
+
* alike.
|
|
344
|
+
*
|
|
345
|
+
* ```html
|
|
346
|
+
* <cngx-timeline-item status="done">
|
|
347
|
+
* <span cngxTimelineOpposite>2019</span>
|
|
348
|
+
* <p>Founded</p>
|
|
349
|
+
* </cngx-timeline-item>
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* **Keep the content non-interactive.** The slot projects ahead of the body,
|
|
353
|
+
* so it is read first in every layout. For a year or a short label that is
|
|
354
|
+
* the right reading order whichever side the rail is on. A link or a button
|
|
355
|
+
* would take focus before the row it belongs to, and no placement of the
|
|
356
|
+
* grid can fix that, because the paint follows `[data-row-side]` while the
|
|
357
|
+
* DOM order does not.
|
|
358
|
+
*
|
|
359
|
+
* @category common/timeline
|
|
360
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/timeline-item.component.ts
|
|
361
|
+
* @relatedTo CngxTimelineItem, CngxTimelineTime
|
|
362
|
+
* @since 0.1.0
|
|
363
|
+
*/
|
|
364
|
+
declare class CngxTimelineOpposite {
|
|
365
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineOpposite, never>;
|
|
366
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineOpposite, "[cngxTimelineOpposite]", never, {}, {}, never, never, true, never>;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Marks content to render inside this row's marker dot - a glyph, an icon,
|
|
370
|
+
* an avatar.
|
|
371
|
+
*
|
|
372
|
+
* The per-row counterpart to the timeline-wide `*cngxTimelineMarkerTpl`, and
|
|
373
|
+
* the only route when the row stands on its own. It also *wins* over that
|
|
374
|
+
* template when both are present: most-local-wins, the same direction as
|
|
375
|
+
* every other slot in the family, so one row can carry a different glyph
|
|
376
|
+
* without the timeline's default being torn out for the rest.
|
|
377
|
+
*
|
|
378
|
+
* Whatever renders here is inside an `aria-hidden` element - decoration only.
|
|
379
|
+
*
|
|
380
|
+
* @category common/timeline
|
|
381
|
+
*/
|
|
382
|
+
declare class CngxTimelineMarkerContent {
|
|
383
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineMarkerContent, never>;
|
|
384
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineMarkerContent, "[cngxTimelineMarkerContent]", never, {}, {}, never, never, true, never>;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Marks the element that holds an item's body. Optional - anything
|
|
388
|
+
* projected without a slot directive lands in the body too. Reach for it
|
|
389
|
+
* when the item also projects a timestamp and the source order would
|
|
390
|
+
* otherwise be ambiguous.
|
|
391
|
+
*
|
|
392
|
+
* @category common/timeline
|
|
393
|
+
*/
|
|
394
|
+
declare class CngxTimelineContent {
|
|
395
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineContent, never>;
|
|
396
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineContent, "[cngxTimelineContent]", never, {}, {}, never, never, true, never>;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* One event on the timeline: a marker, the rail segment below it, an
|
|
400
|
+
* optional timestamp, and the projected body.
|
|
401
|
+
*
|
|
402
|
+
* A terminal composable unit, not a fragment of the organism. It ships
|
|
403
|
+
* its own token SET rules and defaults to the `narrative` raster, so
|
|
404
|
+
* dropping one into a hand-rolled layout renders a complete, density-
|
|
405
|
+
* correct item with no `<cngx-timeline>` above it. Inside the organism it
|
|
406
|
+
* inherits `[data-mode]` and re-rasters itself.
|
|
407
|
+
*
|
|
408
|
+
* **Two independent state channels.** `status` is where the event sits in
|
|
409
|
+
* a history (`done` / `active` / `upcoming` / `rejected`) - editorial, set
|
|
410
|
+
* by the consumer. `state` is whether *this row's own* data is currently
|
|
411
|
+
* loading or failed. They compose: a `done` item whose `state` errored
|
|
412
|
+
* paints as rejected and announces the failure, without losing the
|
|
413
|
+
* editorial status once the retry succeeds.
|
|
414
|
+
*
|
|
415
|
+
* **What it announces.** The marker and rail are `aria-hidden`, so colour is
|
|
416
|
+
* never the only channel - the status reaches assistive tech through a
|
|
417
|
+
* screen-reader-only line fed from `CNGX_TIMELINE_CONFIG.labels.status`, and
|
|
418
|
+
* a failed row through a visible inline error. Both are read as the row's own
|
|
419
|
+
* content, in DOM order, rather than through `aria-describedby`: the host is
|
|
420
|
+
* a plain element with no role, so a description pointed at its own
|
|
421
|
+
* descendants would resolve nowhere and duplicate the text for anyone
|
|
422
|
+
* browsing it. Neither element is rendered while it has nothing to say.
|
|
423
|
+
*
|
|
424
|
+
* ### Standalone
|
|
425
|
+
* ```html
|
|
426
|
+
* <cngx-timeline-item status="done">
|
|
427
|
+
* <cngx-time cngxTimelineTime [date]="event.at" />
|
|
428
|
+
* <p>Deployment finished</p>
|
|
429
|
+
* </cngx-timeline-item>
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
* ### With its own async state
|
|
433
|
+
* ```html
|
|
434
|
+
* <cngx-timeline-item [state]="rowState" position="last">
|
|
435
|
+
* <p>{{ rowState.data()?.summary }}</p>
|
|
436
|
+
* </cngx-timeline-item>
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* @category common/timeline
|
|
440
|
+
* @docsKind primary
|
|
441
|
+
* @wcag AA
|
|
442
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/timeline-item.component.ts
|
|
443
|
+
* @relatedTo CngxTimelineMarker, CngxTimelineConnector, CNGX_TIMELINE_CONFIG
|
|
444
|
+
* <example-url>http://localhost:4200/#/ui/timeline/basics/standalone-atoms</example-url>
|
|
445
|
+
* <example-url>http://localhost:4200/#/ui/timeline/basics/custom-date-header-and-marker</example-url>
|
|
446
|
+
* <example-url>http://localhost:4200/#/ui/timeline/basics/marker-precedence</example-url>
|
|
447
|
+
* <example-url>http://localhost:4200/#/ui/timeline/layout/media-markers</example-url>
|
|
448
|
+
* <example-url>http://localhost:4200/#/ui/timeline/layout/placement-end</example-url>
|
|
449
|
+
* @since 0.1.0
|
|
450
|
+
*/
|
|
451
|
+
declare class CngxTimelineItem {
|
|
452
|
+
private readonly labels;
|
|
453
|
+
private readonly host;
|
|
454
|
+
/**
|
|
455
|
+
* Where the event sits in the history. Drives the marker and rail
|
|
456
|
+
* colours and the screen-reader status line. Purely editorial - it
|
|
457
|
+
* carries no flow logic, because a timeline is a record and a guided
|
|
458
|
+
* process is a stepper.
|
|
459
|
+
*/
|
|
460
|
+
readonly status: i0.InputSignal<TimelineStatus | undefined>;
|
|
461
|
+
/**
|
|
462
|
+
* This row's own async state, for a body that loads, mutates or fails
|
|
463
|
+
* independently of the list around it.
|
|
464
|
+
*
|
|
465
|
+
* Optional by construction and tolerant of a bare `state` attribute
|
|
466
|
+
* (the empty string coerces to `undefined`), so the item never forces a
|
|
467
|
+
* binding a consumer may not have.
|
|
468
|
+
*/
|
|
469
|
+
readonly state: i0.InputSignalWithTransform<CngxAsyncState<unknown> | undefined, "" | CngxAsyncState<unknown> | undefined>;
|
|
470
|
+
/**
|
|
471
|
+
* Position in the run, forwarded to the rail. `'last'` and `'only'`
|
|
472
|
+
* stop the rail at this item so the timeline does not trail off into
|
|
473
|
+
* empty space. The organism sets it; standalone items default to
|
|
474
|
+
* `'middle'`.
|
|
475
|
+
*/
|
|
476
|
+
readonly position: i0.InputSignal<TimelineConnectorPosition>;
|
|
477
|
+
/**
|
|
478
|
+
* The event this row stands for. Only ever read as the `$implicit` of an
|
|
479
|
+
* app-wide `*cngxTimelineMarkerTpl`, so bind it when the app sets one and
|
|
480
|
+
* that template needs the payload; leave it off otherwise.
|
|
481
|
+
*/
|
|
482
|
+
readonly item: i0.InputSignal<unknown>;
|
|
483
|
+
/**
|
|
484
|
+
* @internal The timeline-wide marker template, when a `<cngx-timeline>` is
|
|
485
|
+
* above this row. Absent standalone.
|
|
486
|
+
*/
|
|
487
|
+
private readonly hostMarkerTpl;
|
|
488
|
+
/** @internal Set when this row projects its own marker content. */
|
|
489
|
+
private readonly ownMarker;
|
|
490
|
+
/**
|
|
491
|
+
* @internal The timeline-wide template is the *default*, so a row that
|
|
492
|
+
* projects its own marker content overrides it - most-local-wins, the
|
|
493
|
+
* same direction as every other slot in the family. Resolving to `null`
|
|
494
|
+
* rather than branching on `<ng-content>` keeps the projection static:
|
|
495
|
+
* content lands in the DOM once and renders whatever it was given.
|
|
496
|
+
*/
|
|
497
|
+
protected readonly markerTpl: i0.Signal<i0.TemplateRef<_cngx_common_timeline.CngxTimelineMarkerContext<unknown>> | null>;
|
|
498
|
+
/** @internal Work in flight on this row's own state. */
|
|
499
|
+
protected readonly busy: i0.Signal<boolean>;
|
|
500
|
+
/** @internal This row's own state failed. */
|
|
501
|
+
protected readonly failed: i0.Signal<boolean>;
|
|
502
|
+
/** @internal `aria-busy` reflects the row's own work, not the list's. */
|
|
503
|
+
protected readonly ariaBusy: i0.Signal<"true" | null>;
|
|
504
|
+
/**
|
|
505
|
+
* @internal A failed row paints as rejected regardless of its editorial
|
|
506
|
+
* status - a failure is the more urgent fact, and `status` is left
|
|
507
|
+
* untouched so the row returns to its own colour once a retry lands.
|
|
508
|
+
*/
|
|
509
|
+
protected readonly markerStatus: i0.Signal<TimelineStatus | undefined>;
|
|
510
|
+
/**
|
|
511
|
+
* @internal Busy outranks everything: a row still loading has nothing
|
|
512
|
+
* settled to report. Otherwise this reads `markerStatus`, not `status`,
|
|
513
|
+
* so the announcement can never contradict the paint - a failed row
|
|
514
|
+
* announces the `rejected` it shows, not the editorial status it kept.
|
|
515
|
+
*/
|
|
516
|
+
protected readonly statusText: i0.Signal<string>;
|
|
517
|
+
/** @internal Visible inline error, blank unless this row failed. */
|
|
518
|
+
protected readonly errorText: i0.Signal<string>;
|
|
519
|
+
constructor();
|
|
520
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineItem, never>;
|
|
521
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CngxTimelineItem, "cngx-timeline-item", never, { "status": { "alias": "status"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "item": { "alias": "item"; "required": false; "isSignal": true; }; }, {}, ["ownMarker"], ["[cngxTimelineMarkerContent]", "[cngxTimelineOpposite]", "[cngxTimelineTime]", "[cngxTimelineContent]", "*"], true, never>;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Context for `*cngxTimelineItem` - the item itself plus where it sits.
|
|
526
|
+
*
|
|
527
|
+
* `first` and `last` are positions **within the group**, not within the
|
|
528
|
+
* whole timeline, because that is what a consumer needs to decide whether
|
|
529
|
+
* to draw a trailing rail.
|
|
530
|
+
*
|
|
531
|
+
* @category common/timeline
|
|
532
|
+
*/
|
|
533
|
+
interface CngxTimelineItemContext<T> {
|
|
534
|
+
readonly $implicit: T;
|
|
535
|
+
/** Index within the group. */
|
|
536
|
+
readonly index: number;
|
|
537
|
+
/** First item of its group. */
|
|
538
|
+
readonly first: boolean;
|
|
539
|
+
/** Last item of its group. */
|
|
540
|
+
readonly last: boolean;
|
|
541
|
+
/** The group this item was bucketed into. */
|
|
542
|
+
readonly group: TimelineGroup<T>;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* The row template. The one slot with no built-in fallback: only the
|
|
546
|
+
* consumer knows what an event of theirs looks like.
|
|
547
|
+
*
|
|
548
|
+
* Bind the same array the timeline gets and the `let-` variables come out
|
|
549
|
+
* typed - `[cngxTimelineItem]` exists to pin `T`, nothing more:
|
|
550
|
+
*
|
|
551
|
+
* ```html
|
|
552
|
+
* <cngx-timeline [items]="events()" [dateAccessor]="at">
|
|
553
|
+
* <ng-template [cngxTimelineItem]="events()" let-event let-last="last">
|
|
554
|
+
* <cngx-timeline-item [position]="last ? 'last' : 'middle'">
|
|
555
|
+
* <cngx-time cngxTimelineTime [date]="event.at" />
|
|
556
|
+
* <p>{{ event.summary }}</p>
|
|
557
|
+
* </cngx-timeline-item>
|
|
558
|
+
* </ng-template>
|
|
559
|
+
* </cngx-timeline>
|
|
560
|
+
* ```
|
|
561
|
+
*
|
|
562
|
+
* Named `CngxTimelineItemTpl` so it does not collide with the
|
|
563
|
+
* `CngxTimelineItem` component; the selector stays `cngxTimelineItem`,
|
|
564
|
+
* which is what consumers write.
|
|
565
|
+
*
|
|
566
|
+
* @category common/timeline
|
|
567
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
568
|
+
* @relatedTo CngxTimelineItem, CngxTimelineDateHeader
|
|
569
|
+
* @since 0.1.0
|
|
570
|
+
*/
|
|
571
|
+
declare class CngxTimelineItemTpl<T = unknown> {
|
|
572
|
+
/**
|
|
573
|
+
* Type carrier, never read at runtime. Angular cannot infer a structural
|
|
574
|
+
* directive's context generic from a sibling input on the host component,
|
|
575
|
+
* so `T` has to be pinned on the directive itself; binding the same array
|
|
576
|
+
* the timeline renders does that, and `ngTemplateContextGuard` below then
|
|
577
|
+
* types every `let-` variable. This is `NgForOf`'s `ngForOf` mechanism,
|
|
578
|
+
* not a cngx invention.
|
|
579
|
+
*
|
|
580
|
+
* Optional, and tolerant of the bare `cngxTimelineItem` attribute every
|
|
581
|
+
* v1 consumer writes: an unbound attribute binds the empty string, which
|
|
582
|
+
* `strictTemplates` would otherwise reject against an array type. The
|
|
583
|
+
* empty string coerces to `undefined` and `T` falls back to `unknown` -
|
|
584
|
+
* the Bridge-Input shape the library uses wherever an attribute doubles
|
|
585
|
+
* as an opt-in.
|
|
586
|
+
*
|
|
587
|
+
* Nothing enforces that the array bound here is the array bound to
|
|
588
|
+
* `[items]`; a mismatch only mistypes the `let-` variables, which the
|
|
589
|
+
* template type-checker then rejects at the use site.
|
|
590
|
+
*/
|
|
591
|
+
readonly cngxTimelineItem: i0.InputSignalWithTransform<readonly T[] | undefined, "" | readonly T[] | undefined>;
|
|
592
|
+
readonly templateRef: TemplateRef<CngxTimelineItemContext<T>>;
|
|
593
|
+
static ngTemplateContextGuard<T>(_dir: CngxTimelineItemTpl<T>, ctx: unknown): ctx is CngxTimelineItemContext<T>;
|
|
594
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineItemTpl<any>, never>;
|
|
595
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineItemTpl<any>, "ng-template[cngxTimelineItem]", ["cngxTimelineItem"], { "cngxTimelineItem": { "alias": "cngxTimelineItem"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Context for `*cngxTimelineDateHeader` - the whole group, so a header can
|
|
599
|
+
* show its item count alongside the date.
|
|
600
|
+
*
|
|
601
|
+
* @category common/timeline
|
|
602
|
+
*/
|
|
603
|
+
interface CngxTimelineDateHeaderContext<T> {
|
|
604
|
+
readonly $implicit: TimelineGroup<T>;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* The per-group header. Falls back to
|
|
608
|
+
* `CNGX_TIMELINE_CONFIG.labels.groupLabel`, which formats the group's
|
|
609
|
+
* start date in the app locale.
|
|
610
|
+
*
|
|
611
|
+
* The element this renders into is what the group's `aria-labelledby`
|
|
612
|
+
* points at, so a header that renders nothing leaves the group unnamed.
|
|
613
|
+
*
|
|
614
|
+
* ```html
|
|
615
|
+
* <ng-template [cngxTimelineDateHeader]="events()" let-group>
|
|
616
|
+
* <h3>{{ format(group.start) }} ({{ group.items.length }})</h3>
|
|
617
|
+
* </ng-template>
|
|
618
|
+
* ```
|
|
619
|
+
*
|
|
620
|
+
* @category common/timeline
|
|
621
|
+
* @wcag AA
|
|
622
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
623
|
+
* @relatedTo CngxTimelineItemTpl
|
|
624
|
+
* @since 0.1.0
|
|
625
|
+
*/
|
|
626
|
+
declare class CngxTimelineDateHeader<T = unknown> {
|
|
627
|
+
/**
|
|
628
|
+
* Type carrier for the group's item type, never read at runtime. Bind the
|
|
629
|
+
* same array the timeline gets and `let-group` types as
|
|
630
|
+
* `TimelineGroup<T>`. See {@link CngxTimelineItemTpl.cngxTimelineItem}.
|
|
631
|
+
*/
|
|
632
|
+
readonly cngxTimelineDateHeader: i0.InputSignalWithTransform<readonly T[] | undefined, "" | readonly T[] | undefined>;
|
|
633
|
+
readonly templateRef: TemplateRef<CngxTimelineDateHeaderContext<T>>;
|
|
634
|
+
static ngTemplateContextGuard<T>(_dir: CngxTimelineDateHeader<T>, ctx: unknown): ctx is CngxTimelineDateHeaderContext<T>;
|
|
635
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineDateHeader<any>, never>;
|
|
636
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineDateHeader<any>, "ng-template[cngxTimelineDateHeader]", ["cngxTimelineDateHeader"], { "cngxTimelineDateHeader": { "alias": "cngxTimelineDateHeader"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Context for `*cngxTimelineMarkerTpl` - the item and the status the
|
|
640
|
+
* organism resolved for it.
|
|
641
|
+
*
|
|
642
|
+
* @category common/timeline
|
|
643
|
+
*/
|
|
644
|
+
interface CngxTimelineMarkerContext<T> {
|
|
645
|
+
readonly $implicit: T;
|
|
646
|
+
readonly status: TimelineStatus | undefined;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* What goes inside the marker dot - an icon, an avatar, a type glyph.
|
|
650
|
+
* Falls back to a bare coloured dot.
|
|
651
|
+
*
|
|
652
|
+
* Applies to every row. A single row overrides it by projecting its own
|
|
653
|
+
* `[cngxTimelineMarkerContent]`, which wins over this template.
|
|
654
|
+
*
|
|
655
|
+
* Whatever renders here is inside an `aria-hidden` element, so it must
|
|
656
|
+
* not be the only carrier of anything: the status reaches assistive tech
|
|
657
|
+
* through `CNGX_TIMELINE_CONFIG.labels.status`.
|
|
658
|
+
*
|
|
659
|
+
* Keeps `Tpl` in class *and* selector to stay clear of
|
|
660
|
+
* `CngxTimelineMarker`, the component it renders into.
|
|
661
|
+
*
|
|
662
|
+
* @category common/timeline
|
|
663
|
+
* @wcag AA
|
|
664
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
665
|
+
* @relatedTo CngxTimelineMarker
|
|
666
|
+
* @since 0.1.0
|
|
667
|
+
*/
|
|
668
|
+
declare class CngxTimelineMarkerTpl<T = unknown> {
|
|
669
|
+
/**
|
|
670
|
+
* Type carrier for the item type, never read at runtime. Bind the same
|
|
671
|
+
* array the timeline gets and `let-event` types as `T`. See
|
|
672
|
+
* {@link CngxTimelineItemTpl.cngxTimelineItem}.
|
|
673
|
+
*/
|
|
674
|
+
readonly cngxTimelineMarkerTpl: i0.InputSignalWithTransform<readonly T[] | undefined, "" | readonly T[] | undefined>;
|
|
675
|
+
readonly templateRef: TemplateRef<CngxTimelineMarkerContext<T>>;
|
|
676
|
+
static ngTemplateContextGuard<T>(_dir: CngxTimelineMarkerTpl<T>, ctx: unknown): ctx is CngxTimelineMarkerContext<T>;
|
|
677
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineMarkerTpl<any>, never>;
|
|
678
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineMarkerTpl<any>, "ng-template[cngxTimelineMarkerTpl]", ["cngxTimelineMarkerTpl"], { "cngxTimelineMarkerTpl": { "alias": "cngxTimelineMarkerTpl"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Context for `*cngxTimelineEmpty` - why the timeline is empty.
|
|
682
|
+
*
|
|
683
|
+
* The distinction is the point: "nothing has happened yet" and "your
|
|
684
|
+
* filter matched nothing" call for different copy and different actions.
|
|
685
|
+
* Vocabulary shared with `CngxCardGrid` so an app writes one empty-state
|
|
686
|
+
* component and reuses it.
|
|
687
|
+
*
|
|
688
|
+
* @category common/timeline
|
|
689
|
+
*/
|
|
690
|
+
interface CngxTimelineEmptyContext {
|
|
691
|
+
readonly $implicit: EmptyReason;
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* The empty surface. Falls back to
|
|
695
|
+
* `CNGX_TIMELINE_CONFIG.labels.emptyFallback`.
|
|
696
|
+
*
|
|
697
|
+
* ```html
|
|
698
|
+
* <ng-template cngxTimelineEmpty let-reason>
|
|
699
|
+
* @if (reason === 'no-results') { <p>No events match this filter.</p> }
|
|
700
|
+
* @else { <p>Nothing has happened yet.</p> }
|
|
701
|
+
* </ng-template>
|
|
702
|
+
* ```
|
|
703
|
+
*
|
|
704
|
+
* @category common/timeline
|
|
705
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
706
|
+
* @relatedTo CngxTimelineError
|
|
707
|
+
* @since 0.1.0
|
|
708
|
+
*/
|
|
709
|
+
declare class CngxTimelineEmpty {
|
|
710
|
+
readonly templateRef: TemplateRef<CngxTimelineEmptyContext>;
|
|
711
|
+
static ngTemplateContextGuard(_dir: CngxTimelineEmpty, ctx: unknown): ctx is CngxTimelineEmptyContext;
|
|
712
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineEmpty, never>;
|
|
713
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineEmpty, "ng-template[cngxTimelineEmpty]", ["cngxTimelineEmpty"], {}, {}, never, never, true, never>;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Context for `*cngxTimelineError` - the raw error plus the retry the
|
|
717
|
+
* organism owns.
|
|
718
|
+
*
|
|
719
|
+
* @category common/timeline
|
|
720
|
+
*/
|
|
721
|
+
interface CngxTimelineErrorContext {
|
|
722
|
+
readonly $implicit: unknown;
|
|
723
|
+
/** Re-drives the consumer's source; emits the organism's `retry` output. */
|
|
724
|
+
readonly retry: () => void;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* The whole error surface, replacing message and retry control together.
|
|
728
|
+
* Reach for `*cngxTimelineRetryButton` instead when only the button needs
|
|
729
|
+
* restyling. Falls back to
|
|
730
|
+
* `CNGX_TIMELINE_CONFIG.labels.errorFallback` plus a plain retry button.
|
|
731
|
+
*
|
|
732
|
+
* @category common/timeline
|
|
733
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
734
|
+
* @relatedTo CngxTimelineRetryButton, CngxTimelineEmpty
|
|
735
|
+
* @since 0.1.0
|
|
736
|
+
*/
|
|
737
|
+
declare class CngxTimelineError {
|
|
738
|
+
readonly templateRef: TemplateRef<CngxTimelineErrorContext>;
|
|
739
|
+
static ngTemplateContextGuard(_dir: CngxTimelineError, ctx: unknown): ctx is CngxTimelineErrorContext;
|
|
740
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineError, never>;
|
|
741
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineError, "ng-template[cngxTimelineError]", ["cngxTimelineError"], {}, {}, never, never, true, never>;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Context for `*cngxTimelineRetryButton` - the retry callback.
|
|
745
|
+
*
|
|
746
|
+
* @category common/timeline
|
|
747
|
+
*/
|
|
748
|
+
interface CngxTimelineRetryButtonContext {
|
|
749
|
+
readonly $implicit: () => void;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Just the retry control inside the default error surface, for apps that
|
|
753
|
+
* want their own button component without rewriting the error copy.
|
|
754
|
+
*
|
|
755
|
+
* Whatever renders here has to be operable: the library ships no button
|
|
756
|
+
* component, so a consumer template is responsible for its own `type`,
|
|
757
|
+
* accessible name and click wiring.
|
|
758
|
+
*
|
|
759
|
+
* ```html
|
|
760
|
+
* <ng-template cngxTimelineRetryButton let-retry>
|
|
761
|
+
* <button type="button" (click)="retry()">Try again</button>
|
|
762
|
+
* </ng-template>
|
|
763
|
+
* ```
|
|
764
|
+
*
|
|
765
|
+
* @category common/timeline
|
|
766
|
+
* @wcag AA
|
|
767
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
768
|
+
* @relatedTo CngxTimelineError
|
|
769
|
+
* @since 0.1.0
|
|
770
|
+
*/
|
|
771
|
+
declare class CngxTimelineRetryButton {
|
|
772
|
+
readonly templateRef: TemplateRef<CngxTimelineRetryButtonContext>;
|
|
773
|
+
static ngTemplateContextGuard(_dir: CngxTimelineRetryButton, ctx: unknown): ctx is CngxTimelineRetryButtonContext;
|
|
774
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineRetryButton, never>;
|
|
775
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineRetryButton, "ng-template[cngxTimelineRetryButton]", ["cngxTimelineRetryButton"], {}, {}, never, never, true, never>;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* The tail appended below the list while a background refresh runs, with
|
|
779
|
+
* the already-loaded items still on screen. Falls back to
|
|
780
|
+
* `CNGX_TIMELINE_CONFIG.labels.refreshing`.
|
|
781
|
+
*
|
|
782
|
+
* Contextless on purpose - a refresh has nothing to say beyond the fact
|
|
783
|
+
* that it is happening.
|
|
784
|
+
*
|
|
785
|
+
* @category common/timeline
|
|
786
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
787
|
+
* @relatedTo CngxTimelineError
|
|
788
|
+
* @since 0.1.0
|
|
789
|
+
*/
|
|
790
|
+
declare class CngxTimelineLoadingTail {
|
|
791
|
+
readonly templateRef: TemplateRef<void>;
|
|
792
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineLoadingTail, never>;
|
|
793
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineLoadingTail, "ng-template[cngxTimelineLoadingTail]", ["cngxTimelineLoadingTail"], {}, {}, never, never, true, never>;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* One placeholder row in the first-load body, replacing the built-in
|
|
797
|
+
* marker-rail-and-two-bars shape. Rendered `[skeletonRowCount]` times.
|
|
798
|
+
*
|
|
799
|
+
* Contextless, and deliberately so: a placeholder stands in for a row whose
|
|
800
|
+
* data has not arrived, so there is nothing to hand it. Bind this when the
|
|
801
|
+
* real rows are taller or busier than the default shape and the swap to
|
|
802
|
+
* content would otherwise reflow the page.
|
|
803
|
+
*
|
|
804
|
+
* Whatever renders here sits inside an `aria-hidden` wrapper - the load is
|
|
805
|
+
* announced through the timeline's live region, not through the placeholder.
|
|
806
|
+
*
|
|
807
|
+
* @category common/timeline
|
|
808
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
|
|
809
|
+
* @relatedTo CngxTimelineLoadingTail
|
|
810
|
+
* @since 0.1.0
|
|
811
|
+
*/
|
|
812
|
+
declare class CngxTimelineSkeleton {
|
|
813
|
+
readonly templateRef: TemplateRef<void>;
|
|
814
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineSkeleton, never>;
|
|
815
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineSkeleton, "ng-template[cngxTimelineSkeleton]", ["cngxTimelineSkeleton"], {}, {}, never, never, true, never>;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* The contract a timeline exposes to the rows beneath it, so an app-wide
|
|
820
|
+
* marker template can reach a dot the organism does not itself render.
|
|
821
|
+
*
|
|
822
|
+
* `<cngx-timeline>` is data-driven in v1: the consumer owns the whole row
|
|
823
|
+
* template and writes `<cngx-timeline-item>` themselves, which means the
|
|
824
|
+
* organism has no handle on the marker inside it. Passing the resolved
|
|
825
|
+
* template through DI is what closes that gap without the row having to
|
|
826
|
+
* thread it down by hand.
|
|
827
|
+
*
|
|
828
|
+
* @category common/timeline
|
|
829
|
+
*/
|
|
830
|
+
interface CngxTimelineMarkerHost {
|
|
831
|
+
/** Resolved `*cngxTimelineMarkerTpl`, already through the config cascade. */
|
|
832
|
+
readonly markerTpl: Signal<TemplateRef<CngxTimelineMarkerContext<unknown>> | null>;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* DI token for {@link CngxTimelineMarkerHost}. Provided by `<cngx-timeline>`;
|
|
836
|
+
* injected optionally by `CngxTimelineItem`, which falls back to its own
|
|
837
|
+
* `[cngxTimelineMarkerContent]` projection when no timeline is above it.
|
|
838
|
+
*
|
|
839
|
+
* A token rather than an injected parent class: the row must stay usable
|
|
840
|
+
* standalone, and a concrete parent type would make the two mutually
|
|
841
|
+
* dependent and block the decompose schematic.
|
|
842
|
+
*
|
|
843
|
+
* @category common/timeline
|
|
844
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/marker-host.token.ts
|
|
845
|
+
* @relatedTo CngxTimelineMarkerTpl, CngxTimelineItem
|
|
846
|
+
* @since 0.1.0
|
|
847
|
+
*/
|
|
848
|
+
declare const CNGX_TIMELINE_MARKER_HOST: InjectionToken<CngxTimelineMarkerHost>;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Every user-visible string the timeline can render without a consumer
|
|
852
|
+
* slot, plus the group-header formatter.
|
|
853
|
+
*
|
|
854
|
+
* Library defaults are English. Localise by passing
|
|
855
|
+
* {@link withTimelineLabels} to {@link provideTimelineConfig} once at
|
|
856
|
+
* bootstrap - the timeline itself hardcodes nothing, so a missing
|
|
857
|
+
* translation shows up as English text rather than as a blank surface.
|
|
858
|
+
*
|
|
859
|
+
* Each of these is a *fallback*: the matching template slot
|
|
860
|
+
* (`*cngxTimelineError`, `*cngxTimelineEmpty`, ...) wins whenever it is
|
|
861
|
+
* present.
|
|
862
|
+
*
|
|
863
|
+
* @category common/timeline
|
|
864
|
+
*/
|
|
865
|
+
interface CngxTimelineLabels {
|
|
866
|
+
/**
|
|
867
|
+
* Accessible name for the timeline list itself, read when focus or a
|
|
868
|
+
* screen-reader cursor enters the region. Default `'Timeline'`. A
|
|
869
|
+
* per-instance `[aria-label]` / `[aria-labelledby]` wins.
|
|
870
|
+
*/
|
|
871
|
+
readonly timelineRegion?: string;
|
|
872
|
+
/**
|
|
873
|
+
* Label on the built-in retry control rendered in the error surface.
|
|
874
|
+
* Default `'Retry'`. Superseded by `*cngxTimelineRetryButton`.
|
|
875
|
+
*/
|
|
876
|
+
readonly retry?: string;
|
|
877
|
+
/**
|
|
878
|
+
* Body text for the error surface when no `*cngxTimelineError` slot is
|
|
879
|
+
* bound. Default `'Could not load the timeline.'`
|
|
880
|
+
*/
|
|
881
|
+
readonly errorFallback?: string;
|
|
882
|
+
/**
|
|
883
|
+
* Body text for the empty surface when no `*cngxTimelineEmpty` slot is
|
|
884
|
+
* bound. Default `'No events yet'`
|
|
885
|
+
*/
|
|
886
|
+
readonly emptyFallback?: string;
|
|
887
|
+
/**
|
|
888
|
+
* Accessible name for the loading body, so the skeleton is announced
|
|
889
|
+
* as something other than silence. Default `'Loading timeline'`.
|
|
890
|
+
*/
|
|
891
|
+
readonly loading?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Text for the refreshing tail appended below the list while a
|
|
894
|
+
* background reload is in flight. Default `'Updating…'`. Superseded by
|
|
895
|
+
* `*cngxTimelineLoadingTail`.
|
|
896
|
+
*/
|
|
897
|
+
readonly refreshing?: string;
|
|
898
|
+
/**
|
|
899
|
+
* Screen-reader text for a single item whose own `[state]` is pending.
|
|
900
|
+
* Paired with `aria-busy` on that item. Default `'Updating'`.
|
|
901
|
+
*/
|
|
902
|
+
readonly itemBusy?: string;
|
|
903
|
+
/**
|
|
904
|
+
* Inline error text for a single item whose own `[state]` failed, used
|
|
905
|
+
* when the consumer renders no per-item error content. Default
|
|
906
|
+
* `'Could not load this event.'`
|
|
907
|
+
*/
|
|
908
|
+
readonly itemErrorFallback?: string;
|
|
909
|
+
/**
|
|
910
|
+
* Screen-reader wording for each process status. The marker paints the
|
|
911
|
+
* status visually and the dot is `aria-hidden`, so this map is the only
|
|
912
|
+
* channel that carries it to assistive tech - leaving a key blank
|
|
913
|
+
* silences that status rather than merely restyling it.
|
|
914
|
+
*
|
|
915
|
+
* Defaults: `Completed` / `In progress` / `Upcoming` / `Rejected`.
|
|
916
|
+
* Partial - {@link withTimelineLabels} merges it key by key, so
|
|
917
|
+
* renaming one status leaves the other three at their defaults.
|
|
918
|
+
*/
|
|
919
|
+
readonly status?: Readonly<Partial<Record<TimelineStatus, string>>>;
|
|
920
|
+
/**
|
|
921
|
+
* Formats a group's header when no `*cngxTimelineDateHeader` slot is
|
|
922
|
+
* bound. Receives the whole group so a consumer can fold the item
|
|
923
|
+
* count into the header. The second argument is the app locale
|
|
924
|
+
* (`CNGX_LOCALE`, falling back to the nearest `LOCALE_ID`), read live,
|
|
925
|
+
* so a formatter that uses it follows a locale switch. Defaults to the
|
|
926
|
+
* group's start date as a numeric date in that locale, placed by the
|
|
927
|
+
* `groupHeader` message of the timeline language section.
|
|
928
|
+
*/
|
|
929
|
+
readonly groupLabel?: (group: TimelineGroup<unknown>, locale: string) => string;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* App-wide template defaults for the timeline's slot regions - the middle
|
|
933
|
+
* tier of the family-standard 3-stage cascade
|
|
934
|
+
* (per-instance directive > this field > built-in markup).
|
|
935
|
+
*
|
|
936
|
+
* Set them with {@link withTimelineTemplates}. Keys are typed against
|
|
937
|
+
* `unknown` items because the config is app-wide while the slots are
|
|
938
|
+
* generic; a `TemplateRef` for a concrete item type assigns in fine.
|
|
939
|
+
*
|
|
940
|
+
* @category common/timeline
|
|
941
|
+
*/
|
|
942
|
+
interface CngxTimelineTemplates {
|
|
943
|
+
/** Default row template (`*cngxTimelineItem`). */
|
|
944
|
+
readonly item?: TemplateRef<CngxTimelineItemContext<unknown>>;
|
|
945
|
+
/** Default per-group date header (`*cngxTimelineDateHeader`). */
|
|
946
|
+
readonly dateHeader?: TemplateRef<CngxTimelineDateHeaderContext<unknown>>;
|
|
947
|
+
/** Default marker content (`*cngxTimelineMarkerTpl`). */
|
|
948
|
+
readonly marker?: TemplateRef<CngxTimelineMarkerContext<unknown>>;
|
|
949
|
+
/** Default empty surface (`*cngxTimelineEmpty`). */
|
|
950
|
+
readonly empty?: TemplateRef<CngxTimelineEmptyContext>;
|
|
951
|
+
/** Default error surface (`*cngxTimelineError`). */
|
|
952
|
+
readonly error?: TemplateRef<CngxTimelineErrorContext>;
|
|
953
|
+
/** Default retry control (`*cngxTimelineRetryButton`). */
|
|
954
|
+
readonly retryButton?: TemplateRef<CngxTimelineRetryButtonContext>;
|
|
955
|
+
/** Default refreshing tail (`*cngxTimelineLoadingTail`). */
|
|
956
|
+
readonly loadingTail?: TemplateRef<void>;
|
|
957
|
+
/** Default placeholder row for the first-load body (`*cngxTimelineSkeleton`). */
|
|
958
|
+
readonly skeleton?: TemplateRef<void>;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Timeline config surface. Resolution priority: \
|
|
962
|
+
* per-instance Input → `provideTimelineConfigAt` (viewProviders) →
|
|
963
|
+
* `provideTimelineConfig` (root) → library default.
|
|
964
|
+
*
|
|
965
|
+
* Deliberately small: the timeline has no behavioural switches to
|
|
966
|
+
* configure, so this carries text and templates only. Bucketing is
|
|
967
|
+
* swapped through {@link CNGX_TIMELINE_GROUPING_FACTORY} instead, and
|
|
968
|
+
* everything visual through the slot directives.
|
|
969
|
+
*
|
|
970
|
+
* @category common/timeline
|
|
971
|
+
*/
|
|
972
|
+
interface CngxTimelineConfig {
|
|
973
|
+
/**
|
|
974
|
+
* A plain bundle or a `Signal` of one; once {@link withTimelineLabels} ran
|
|
975
|
+
* it holds a `Signal`, so the copy follows a runtime language switch. Read
|
|
976
|
+
* it through `coerceSignal` from `@cngx/core/utils`.
|
|
977
|
+
*/
|
|
978
|
+
readonly labels?: CngxTimelineLabels | Signal<CngxTimelineLabels>;
|
|
979
|
+
readonly templates?: CngxTimelineTemplates;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* DI token for the resolved timeline config. \
|
|
983
|
+
* `providedIn: 'root'` with the library defaults, `labels` read from the
|
|
984
|
+
* timeline section of the active language pack; override via
|
|
985
|
+
* {@link provideTimelineConfig} (root) or {@link provideTimelineConfigAt}
|
|
986
|
+
* (component scope).
|
|
987
|
+
*
|
|
988
|
+
* @category common/timeline
|
|
989
|
+
* @wcag AA
|
|
990
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/timeline-config.ts
|
|
991
|
+
* @relatedTo provideTimelineConfig
|
|
992
|
+
* @relatedTo withTimelineLabels
|
|
993
|
+
* @since 0.1.0
|
|
994
|
+
*/
|
|
995
|
+
declare const CNGX_TIMELINE_CONFIG: InjectionToken<CngxTimelineConfig>;
|
|
996
|
+
/**
|
|
997
|
+
* Signature of every `with*` timeline config builder - a pure
|
|
998
|
+
* config-to-config mutator, folded left over the library defaults.
|
|
999
|
+
*
|
|
1000
|
+
* @category common/timeline
|
|
1001
|
+
*/
|
|
1002
|
+
type CngxTimelineConfigFeature = (config: CngxTimelineConfig) => CngxTimelineConfig;
|
|
1003
|
+
/**
|
|
1004
|
+
* Merge label overrides into the cascade. Keys left out keep the language
|
|
1005
|
+
* pack's copy, or the English library default, so a consumer translates
|
|
1006
|
+
* what they need and nothing more. Pass a `Signal` to switch the language at runtime.
|
|
1007
|
+
*
|
|
1008
|
+
* ```ts
|
|
1009
|
+
* provideTimelineConfig(
|
|
1010
|
+
* withTimelineLabels({
|
|
1011
|
+
* retry: 'Erneut versuchen',
|
|
1012
|
+
* emptyFallback: 'Noch keine Ereignisse.',
|
|
1013
|
+
* groupLabel: (group, locale) => group.start.toLocaleDateString(locale, { dateStyle: 'medium' }),
|
|
1014
|
+
* }),
|
|
1015
|
+
* )
|
|
1016
|
+
* ```
|
|
1017
|
+
*
|
|
1018
|
+
* @category common/timeline
|
|
1019
|
+
*/
|
|
1020
|
+
declare function withTimelineLabels(labels: CngxTimelineLabels | Signal<CngxTimelineLabels>): CngxTimelineConfigFeature;
|
|
1021
|
+
/**
|
|
1022
|
+
* Merge app-wide slot template defaults into the cascade. Keys left out
|
|
1023
|
+
* keep whatever an earlier feature set, and a per-instance slot directive
|
|
1024
|
+
* still wins over anything set here.
|
|
1025
|
+
*
|
|
1026
|
+
* One bag rather than a `with*Template` builder per slot, matching how the
|
|
1027
|
+
* select family carries its own slot defaults - the timeline has eight
|
|
1028
|
+
* slots and near-identical builders would only add surface.
|
|
1029
|
+
*
|
|
1030
|
+
* ```ts
|
|
1031
|
+
* readonly emptyTpl = viewChild.required<TemplateRef<CngxTimelineEmptyContext>>('emptyTpl', {
|
|
1032
|
+
* read: TemplateRef,
|
|
1033
|
+
* });
|
|
1034
|
+
*
|
|
1035
|
+
* providers: [provideTimelineConfig(withTimelineTemplates({ empty: this.emptyTpl() }))]
|
|
1036
|
+
* ```
|
|
1037
|
+
*
|
|
1038
|
+
* @category common/timeline
|
|
1039
|
+
*/
|
|
1040
|
+
declare function withTimelineTemplates(templates: CngxTimelineTemplates): CngxTimelineConfigFeature;
|
|
1041
|
+
/**
|
|
1042
|
+
* Root-level provider. Apply once in `bootstrapApplication` /
|
|
1043
|
+
* `appConfig.providers`.
|
|
1044
|
+
*
|
|
1045
|
+
* @category common/timeline
|
|
1046
|
+
*/
|
|
1047
|
+
declare function provideTimelineConfig(...features: readonly CngxTimelineConfigFeature[]): EnvironmentProviders;
|
|
1048
|
+
/**
|
|
1049
|
+
* Component-scoped override. Returns `Provider[]` rather than
|
|
1050
|
+
* {@link EnvironmentProviders} because `viewProviders` rejects opaque
|
|
1051
|
+
* environment providers.
|
|
1052
|
+
*
|
|
1053
|
+
* Features merge onto the parent config - an enclosing scope, or the root
|
|
1054
|
+
* provider, or the library defaults when neither is present - so a region
|
|
1055
|
+
* can re-phrase one label without resetting every other one the app set.
|
|
1056
|
+
*
|
|
1057
|
+
* ```ts
|
|
1058
|
+
* @Component({
|
|
1059
|
+
* viewProviders: [...provideTimelineConfigAt(withTimelineLabels({ retry: 'Again' }))],
|
|
1060
|
+
* })
|
|
1061
|
+
* ```
|
|
1062
|
+
*
|
|
1063
|
+
* @category common/timeline
|
|
1064
|
+
*/
|
|
1065
|
+
declare function provideTimelineConfigAt(...features: readonly CngxTimelineConfigFeature[]): Provider[];
|
|
1066
|
+
/**
|
|
1067
|
+
* Read the resolved timeline config. Runs in an injection context.
|
|
1068
|
+
*
|
|
1069
|
+
* @category common/timeline
|
|
1070
|
+
*/
|
|
1071
|
+
declare function injectTimelineConfig(): CngxTimelineConfig;
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* The timeline section of a {@link CngxLanguagePack}: every string the
|
|
1075
|
+
* timeline renders without a consumer slot. It feeds the `labels` of
|
|
1076
|
+
* `CNGX_TIMELINE_CONFIG`.
|
|
1077
|
+
*
|
|
1078
|
+
* @category common/timeline
|
|
1079
|
+
* @since 0.1.0
|
|
1080
|
+
* @relatedTo CNGX_TIMELINE_CONFIG, withTimelineLabels
|
|
1081
|
+
*/
|
|
1082
|
+
interface CngxTimelineLanguageSection {
|
|
1083
|
+
/** Accessible name of the timeline list. */
|
|
1084
|
+
readonly timelineRegion: string;
|
|
1085
|
+
/** Label of the built-in retry control. */
|
|
1086
|
+
readonly retry: string;
|
|
1087
|
+
/** Body of the error surface. */
|
|
1088
|
+
readonly errorFallback: string;
|
|
1089
|
+
/** Body of the empty surface. */
|
|
1090
|
+
readonly emptyFallback: string;
|
|
1091
|
+
/** Accessible name of the loading body. */
|
|
1092
|
+
readonly loading: string;
|
|
1093
|
+
/** Refreshing tail below the list. */
|
|
1094
|
+
readonly refreshing: string;
|
|
1095
|
+
/** Screen-reader text of a pending item. */
|
|
1096
|
+
readonly itemBusy: string;
|
|
1097
|
+
/** Inline error text of a failed item. */
|
|
1098
|
+
readonly itemErrorFallback: string;
|
|
1099
|
+
/** Screen-reader wording per process status. */
|
|
1100
|
+
readonly status: {
|
|
1101
|
+
readonly done: string;
|
|
1102
|
+
readonly active: string;
|
|
1103
|
+
readonly upcoming: string;
|
|
1104
|
+
readonly rejected: string;
|
|
1105
|
+
};
|
|
1106
|
+
/** `{date}`: a group header, `{date}` being the group's start date in the app locale. */
|
|
1107
|
+
readonly groupHeader: CngxMessage;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* The English timeline section: the single source of the timeline's English
|
|
1111
|
+
* copy. `CNGX_TIMELINE_CONFIG` defaults its `labels` to it.
|
|
1112
|
+
*
|
|
1113
|
+
* @category common/timeline
|
|
1114
|
+
* @since 0.1.0
|
|
1115
|
+
* @relatedTo CNGX_TIMELINE_CONFIG
|
|
1116
|
+
*/
|
|
1117
|
+
declare const CNGX_TIMELINE_LANGUAGE_EN: CngxTimelineLanguageSection;
|
|
1118
|
+
declare module '@cngx/core/i18n' {
|
|
1119
|
+
interface CngxLanguagePack {
|
|
1120
|
+
readonly timeline: CngxTimelineLanguageSection;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
export { CNGX_TIMELINE_CONFIG, CNGX_TIMELINE_GROUPING_FACTORY, CNGX_TIMELINE_LANGUAGE_EN, CNGX_TIMELINE_MARKER_HOST, CngxTimelineConnector, CngxTimelineContent, CngxTimelineDateHeader, CngxTimelineEmpty, CngxTimelineError, CngxTimelineItem, CngxTimelineItemTpl, CngxTimelineLoadingTail, CngxTimelineMarker, CngxTimelineMarkerContent, CngxTimelineMarkerTpl, CngxTimelineOpposite, CngxTimelineRetryButton, CngxTimelineSkeleton, CngxTimelineTime, createTimelineGrouping, injectTimelineConfig, provideTimelineConfig, provideTimelineConfigAt, withTimelineLabels, withTimelineTemplates };
|
|
1125
|
+
export type { CngxTimelineConfig, CngxTimelineConfigFeature, CngxTimelineDateHeaderContext, CngxTimelineEmptyContext, CngxTimelineErrorContext, CngxTimelineGroupingFactory, CngxTimelineItemContext, CngxTimelineLabels, CngxTimelineLanguageSection, CngxTimelineMarkerContext, CngxTimelineMarkerHost, CngxTimelineRetryButtonContext, CngxTimelineTemplates, TimelineConnectorPosition, TimelineDateAccessor, TimelineDirection, TimelineGroup, TimelineGroupBy, TimelineGroupKey, TimelineGrouping, TimelineGroupingFn, TimelineGroupingOptions, TimelineStatus };
|