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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/card/README.md +2 -1
  2. package/chart/README.md +85 -0
  3. package/command/README.md +157 -0
  4. package/data/README.md +33 -1
  5. package/dialog/README.md +23 -1
  6. package/fesm2022/cngx-common-a11y.mjs +356 -180
  7. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  8. package/fesm2022/cngx-common-audio.mjs +84 -42
  9. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  10. package/fesm2022/cngx-common-card.mjs +311 -53
  11. package/fesm2022/cngx-common-card.mjs.map +1 -1
  12. package/fesm2022/cngx-common-chart.mjs +4360 -1625
  13. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  14. package/fesm2022/cngx-common-command.mjs +171 -0
  15. package/fesm2022/cngx-common-command.mjs.map +1 -0
  16. package/fesm2022/cngx-common-data.mjs +1556 -616
  17. package/fesm2022/cngx-common-data.mjs.map +1 -1
  18. package/fesm2022/cngx-common-dialog.mjs +518 -112
  19. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  20. package/fesm2022/cngx-common-display.mjs +468 -87
  21. package/fesm2022/cngx-common-display.mjs.map +1 -1
  22. package/fesm2022/cngx-common-interactive.mjs +2725 -1303
  23. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  24. package/fesm2022/cngx-common-layout.mjs +943 -164
  25. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  26. package/fesm2022/cngx-common-popover.mjs +769 -103
  27. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  28. package/fesm2022/cngx-common-stepper.mjs +816 -348
  29. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  30. package/fesm2022/cngx-common-tabs.mjs +2330 -1554
  31. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-common-timeline.mjs +1170 -0
  33. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  34. package/fesm2022/cngx-common.mjs +2 -2
  35. package/fesm2022/cngx-common.mjs.map +1 -1
  36. package/interactive/README.md +15 -4
  37. package/layout/README.md +21 -1
  38. package/package.json +11 -1
  39. package/popover/README.md +18 -2
  40. package/stepper/README.md +7 -5
  41. package/theming/components/cngx-accordion.css +4 -1
  42. package/theming/components/cngx-backdrop.css +12 -0
  43. package/theming/components/cngx-badge.css +22 -0
  44. package/theming/components/cngx-bottom-sheet.css +14 -2
  45. package/theming/components/cngx-breadcrumb.css +8 -0
  46. package/theming/components/cngx-button-toggle.css +73 -5
  47. package/theming/components/cngx-data-grid.css +234 -1
  48. package/theming/components/cngx-dialog.css +25 -0
  49. package/theming/components/cngx-divider.css +12 -0
  50. package/theming/components/cngx-listbox.css +48 -12
  51. package/theming/components/cngx-menu.css +91 -15
  52. package/theming/components/cngx-popover.css +24 -0
  53. package/theming/components/cngx-recycler-placeholder.css +196 -0
  54. package/theming/components/cngx-ripple.css +2 -2
  55. package/theming/components/cngx-slider.css +32 -1
  56. package/theming/components/cngx-tooltip.css +23 -0
  57. package/timeline/README.md +155 -0
  58. package/types/cngx-common-a11y.d.ts +101 -31
  59. package/types/cngx-common-audio.d.ts +32 -32
  60. package/types/cngx-common-card.d.ts +211 -20
  61. package/types/cngx-common-chart.d.ts +1605 -169
  62. package/types/cngx-common-command.d.ts +190 -0
  63. package/types/cngx-common-data.d.ts +842 -163
  64. package/types/cngx-common-dialog.d.ts +372 -28
  65. package/types/cngx-common-display.d.ts +432 -148
  66. package/types/cngx-common-interactive.d.ts +1553 -370
  67. package/types/cngx-common-layout.d.ts +613 -27
  68. package/types/cngx-common-popover.d.ts +376 -36
  69. package/types/cngx-common-stepper.d.ts +414 -114
  70. package/types/cngx-common-tabs.d.ts +597 -72
  71. package/types/cngx-common-timeline.d.ts +1125 -0
  72. package/types/cngx-common.d.ts +1 -1
@@ -0,0 +1,1170 @@
1
+ import * as i0 from '@angular/core';
2
+ import { linkedSignal, InjectionToken, input, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, makeEnvironmentProviders, SkipSelf, Optional, inject, Directive, ElementRef, contentChild, isDevMode, afterNextRender, TemplateRef } from '@angular/core';
3
+ import { memoize, coerceBooleanProperty, dateTimeFormatterFor, createNestedOverrideMerge, coerceSignal } from '@cngx/core/utils';
4
+ import { NgTemplateOutlet } from '@angular/common';
5
+ import { formatMessage, createNestedLanguageSection } from '@cngx/core/i18n';
6
+
7
+ function pad2(value) {
8
+ return value < 10 ? `0${value}` : `${value}`;
9
+ }
10
+ function groupByDay(date) {
11
+ const year = date.getFullYear();
12
+ const month = date.getMonth();
13
+ const day = date.getDate();
14
+ return {
15
+ key: `${year}-${pad2(month + 1)}-${pad2(day)}`,
16
+ start: new Date(year, month, day),
17
+ };
18
+ }
19
+ const ISO_FIRST_DAY = 1;
20
+ /**
21
+ * First day of the week for a locale, `1` (Monday) to `7` (Sunday); ISO
22
+ * Monday without week info.
23
+ */
24
+ const firstDayOfWeek = memoize((locale) => {
25
+ let intlLocale;
26
+ try {
27
+ intlLocale = new Intl.Locale(locale);
28
+ }
29
+ catch {
30
+ return ISO_FIRST_DAY;
31
+ }
32
+ return (intlLocale.getWeekInfo?.() ?? intlLocale.weekInfo)?.firstDay ?? ISO_FIRST_DAY;
33
+ }, { cacheLimit: 32 });
34
+ function groupByWeek(date, firstDay) {
35
+ // `firstDay` counts Monday as 1 and Sunday as 7; `getDay()` counts Sunday as 0.
36
+ const offset = (date.getDay() - (firstDay % 7) + 7) % 7;
37
+ const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - offset);
38
+ return {
39
+ key: `W${start.getFullYear()}-${pad2(start.getMonth() + 1)}-${pad2(start.getDate())}`,
40
+ start,
41
+ };
42
+ }
43
+ function groupByMonth(date) {
44
+ const year = date.getFullYear();
45
+ const month = date.getMonth();
46
+ return { key: `${year}-${pad2(month + 1)}`, start: new Date(year, month, 1) };
47
+ }
48
+ function groupByNone(date) {
49
+ return { key: 'all', start: date };
50
+ }
51
+ function resolveGrouper(mode, firstDay) {
52
+ if (typeof mode === 'function') {
53
+ return mode;
54
+ }
55
+ switch (mode) {
56
+ case 'week':
57
+ return (date) => groupByWeek(date, firstDay);
58
+ case 'month':
59
+ return groupByMonth;
60
+ case 'none':
61
+ return groupByNone;
62
+ default:
63
+ return groupByDay;
64
+ }
65
+ }
66
+ function toDate(value) {
67
+ return value instanceof Date ? value : new Date(value);
68
+ }
69
+ function sameItems(previous, next) {
70
+ return previous.length === next.length && previous.every((item, i) => item === next[i]);
71
+ }
72
+ function groupsEqual(a, b) {
73
+ return a.length === b.length && a.every((group, index) => group === b[index]);
74
+ }
75
+ /**
76
+ * Derives grouped, sorted timeline bands from a flat item list.
77
+ *
78
+ * Pure derivation: bands come out of one `linkedSignal` over the `items`
79
+ * accessor. Nothing is synced, nothing is written back, and the presenter
80
+ * never mutates its input array. The previous bands are read through the
81
+ * `computation` callback rather than a closure cache, so the result depends
82
+ * on the inputs and the prior value alone - never on how many times it ran.
83
+ *
84
+ * Three properties make it usable as the organism's only data path:
85
+ *
86
+ * - **Defensive sort.** Consumer data does not have to arrive sorted. The
87
+ * presenter sorts by the accessor date on every run using a stable sort,
88
+ * so items sharing a timestamp keep their input order in both
89
+ * directions.
90
+ * - **Local-calendar bucketing.** `day` / `week` / `month` read local date
91
+ * fields rather than dividing the epoch, which is what keeps 23-hour and
92
+ * 25-hour DST days intact. Consumers who want UTC (or any other rule)
93
+ * pass a {@link TimelineGroupingFn}.
94
+ * - **Append-stability.** Groups whose items are *the same objects* hand
95
+ * back the same band reference, and the signal carries a structural
96
+ * `equal`. Reuse is deliberately keyed on reference identity rather than
97
+ * on an id: a refetch returns new objects at the same ids, and reusing
98
+ * there would pin the band to a stale payload. Appending therefore leaves
99
+ * every other band's
100
+ * `@for` block untouched instead of re-rendering the whole timeline.
101
+ *
102
+ * Reach for the DI token {@link CNGX_TIMELINE_GROUPING_FACTORY} rather
103
+ * than this function directly when the caller is a component - that is
104
+ * what makes the bucketing swappable per app or per component.
105
+ *
106
+ * ```ts
107
+ * const grouping = createTimelineGrouping({
108
+ * items: this.events,
109
+ * dateAccessor: (event) => event.occurredAt,
110
+ * groupBy: this.groupBy,
111
+ * });
112
+ * ```
113
+ *
114
+ * @category common/timeline
115
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/grouping.ts
116
+ * @since 0.1.0
117
+ */
118
+ function createTimelineGrouping(options) {
119
+ const { items, dateAccessor, groupBy, direction, locale } = options;
120
+ // Dev-only diagnostic; once per grouping instance so a recompute over the
121
+ // same bad data does not spam the console.
122
+ let warnedInvalidDate = false;
123
+ // `linkedSignal` rather than `computed`: append-stability needs the
124
+ // previous bands to hand their references back, and this is the sanctioned
125
+ // way to read them. A closure cache mutated inside a `computed` would make
126
+ // the computation impure - its output would depend on how many times it had
127
+ // run, not only on its inputs.
128
+ const groups = linkedSignal({ ...(ngDevMode ? { debugName: "groups" } : /* istanbul ignore next */ {}), source: () => {
129
+ const source = items();
130
+ const firstDay = locale ? firstDayOfWeek(locale()) : ISO_FIRST_DAY;
131
+ const grouper = resolveGrouper(groupBy?.() ?? 'day', firstDay);
132
+ const sign = (direction?.() ?? 'desc') === 'asc' ? 1 : -1;
133
+ const dated = source.map((item) => ({ item, date: toDate(dateAccessor(item)) }));
134
+ // An unparsable value does not throw - NaN dates all bucket under one
135
+ // band whose header renders "Invalid Date". Surface the mistake in dev
136
+ // instead of leaving that header as the only clue.
137
+ if (typeof ngDevMode !== 'undefined' &&
138
+ ngDevMode &&
139
+ !warnedInvalidDate &&
140
+ dated.some((entry) => Number.isNaN(entry.date.getTime()))) {
141
+ warnedInvalidDate = true;
142
+ console.warn('createTimelineGrouping: dateAccessor produced an invalid date for at least one ' +
143
+ 'item. Those items cluster into a single band whose header renders ' +
144
+ '"Invalid Date" - check the accessor and the raw values it reads.');
145
+ }
146
+ dated.sort((a, b) => sign * (a.date.getTime() - b.date.getTime()));
147
+ // Map preserves insertion order, so buckets come out already sorted.
148
+ const buckets = new Map();
149
+ for (const entry of dated) {
150
+ const { key, start } = grouper(entry.date, entry.item);
151
+ const bucket = buckets.get(key);
152
+ if (bucket) {
153
+ bucket.items.push(entry.item);
154
+ }
155
+ else {
156
+ buckets.set(key, { start, items: [entry.item] });
157
+ }
158
+ }
159
+ return Array.from(buckets, ([key, bucket]) => ({
160
+ key,
161
+ start: bucket.start,
162
+ items: bucket.items,
163
+ }));
164
+ },
165
+ computation: (fresh, previous) => {
166
+ const previousByKey = new Map((previous?.value ?? []).map((group) => [group.key, group]));
167
+ return fresh.map((group) => {
168
+ const prior = previousByKey.get(group.key);
169
+ // Reference identity only. Matching ids are NOT enough: a refetch
170
+ // returns fresh objects at the same ids with changed content, and
171
+ // handing back the prior band there would render the old payload
172
+ // forever. Reference equality is the only signal that says "these
173
+ // are literally the same items", which is what reuse requires.
174
+ const reusable = prior?.start.getTime() === group.start.getTime() &&
175
+ sameItems(prior.items, group.items);
176
+ return reusable ? prior : group;
177
+ });
178
+ },
179
+ equal: groupsEqual });
180
+ return { groups };
181
+ }
182
+ /**
183
+ * Resolves the presenter `<cngx-timeline>` builds its bands with.
184
+ * Defaults to {@link createTimelineGrouping}.
185
+ *
186
+ * Override app-wide via
187
+ * `providers: [{ provide: CNGX_TIMELINE_GROUPING_FACTORY, useValue: myFactory }]`
188
+ * to change bucketing everywhere (fiscal calendars, "today / earlier"
189
+ * relative bands, server-supplied grouping), or per component via
190
+ * `viewProviders` for a one-off. An override wraps rather than replaces
191
+ * in most cases - call `createTimelineGrouping` inside your factory and
192
+ * post-process its `groups`.
193
+ *
194
+ * Same shape as `CNGX_SELECTION_CONTROLLER_FACTORY`: the internals of a
195
+ * component are swappable without forking the component.
196
+ *
197
+ * @category common/timeline
198
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/grouping.ts
199
+ * @relatedTo createTimelineGrouping
200
+ * @since 0.1.0
201
+ */
202
+ const CNGX_TIMELINE_GROUPING_FACTORY = new InjectionToken('CngxTimelineGroupingFactory', {
203
+ providedIn: 'root',
204
+ factory: () => createTimelineGrouping,
205
+ });
206
+
207
+ /**
208
+ * The dot on the timeline rail - a status-coloured slot host for whatever
209
+ * the consumer projects into it (nothing, a glyph, an icon, an avatar).
210
+ *
211
+ * Purely decorative and marked `aria-hidden`: the status it paints is
212
+ * already carried semantically by the owning `CngxTimelineItem`, and
213
+ * announcing it twice is worse than not announcing it here at all. That
214
+ * also means colour is never this atom's only signal - the item's ARIA is.
215
+ *
216
+ * Usable standalone. It ships its own token SET rules, so a marker
217
+ * dropped into a hand-rolled layout renders at the right size and tracks
218
+ * `[data-density]` with no timeline organism above it.
219
+ *
220
+ * ### Bare dot
221
+ * ```html
222
+ * <cngx-timeline-marker status="done" />
223
+ * ```
224
+ *
225
+ * ### With a projected glyph
226
+ * ```html
227
+ * <cngx-timeline-marker status="rejected">!</cngx-timeline-marker>
228
+ * ```
229
+ *
230
+ * ### Pending
231
+ * ```html
232
+ * <cngx-timeline-marker status="active" busy />
233
+ * ```
234
+ *
235
+ * @category common/timeline
236
+ * @wcag AA
237
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/marker.component.ts
238
+ * @relatedTo CngxTimelineConnector
239
+ * @since 0.1.0
240
+ */
241
+ class CngxTimelineMarker {
242
+ /**
243
+ * Where the event sits in the history. Drives the dot colour and, for
244
+ * `upcoming`, its hollow fill. Left unset the marker paints in the
245
+ * neutral rail colour.
246
+ */
247
+ status = input(undefined, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
248
+ /**
249
+ * Whether the marker pulses to signal work in flight - typically bound
250
+ * from an item's own `[state]` being `pending`.
251
+ *
252
+ * The pulse is a `box-shadow` animation rather than a `transform` or a
253
+ * size change: the marker sits in a grid track the rail is aligned to,
254
+ * so anything that altered its box would drag the rail with it every
255
+ * frame. Suppressed under `prefers-reduced-motion`.
256
+ */
257
+ busy = input(false, { ...(ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
258
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineMarker, deps: [], target: i0.ɵɵFactoryTarget.Component });
259
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxTimelineMarker, isStandalone: true, selector: "cngx-timeline-marker", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "attr.data-status": "status()", "class.cngx-timeline-marker--busy": "busy()" }, classAttribute: "cngx-timeline-marker" }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-timeline-rail-inset{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-timeline-marker-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}@property --cngx-timeline-marker-glyph-size{syntax: \"<percentage>\"; inherits: true; initial-value: 60%;}@property --cngx-timeline-item-inline-size{syntax: \"<length>\"; inherits: true; initial-value: 192px;}@property --cngx-timeline-connector-width{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-timeline-marker-ring-width{syntax: \"<length>\"; inherits: true; initial-value: 3px;}@property --cngx-timeline-connector-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-timeline-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-marker-fg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-meta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-timeline-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-timeline-muted-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-done-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-timeline-active-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-timeline-upcoming-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-rejected-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .18 25);}@property --cngx-timeline-pulse-duration{syntax: \"<time>\"; inherits: true; initial-value: 1.6s;}}:root{--cngx-timeline-connector-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-timeline-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-timeline-text-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-timeline-muted-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-done-color: var(--cngx-color-success, oklch(.6 .15 145));--cngx-timeline-active-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-timeline-upcoming-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-rejected-color: var(--cngx-color-danger, oklch(.6 .18 25))}\n", "@layer cngx.components{@scope(.cngx-timeline-marker){:scope{display:inline-flex;align-items:center;justify-content:center;flex:none;inline-size:var(--cngx-timeline-marker-size, 12px);block-size:var(--cngx-timeline-marker-size, 12px);border-radius:50%;overflow:hidden;background:var(--cngx-timeline-connector-color, oklch(.88 .005 250));box-shadow:0 0 0 var(--cngx-timeline-connector-width, 2px) var(--cngx-timeline-surface, oklch(1 0 0));color:var(--cngx-timeline-marker-fg, oklch(1 0 0));font-size:.625em;line-height:1}:scope>img,:scope>picture{inline-size:100%;block-size:100%;object-fit:cover;border-radius:inherit}:scope>svg{inline-size:var(--cngx-timeline-marker-glyph-size, 60%);block-size:var(--cngx-timeline-marker-glyph-size, 60%)}:scope[data-status=done]{background:var(--cngx-timeline-done-color, oklch(.6 .15 145))}:scope[data-status=active]{background:var(--cngx-timeline-active-color, oklch(.66 .19 50))}:scope[data-status=rejected]{background:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}:scope[data-status=upcoming]{background:var(--cngx-timeline-surface, oklch(1 0 0));border:var(--cngx-timeline-connector-width, 2px) dashed var(--cngx-timeline-upcoming-color, oklch(.5 .01 250));color:var(--cngx-timeline-upcoming-color, oklch(.5 .01 250))}}}@layer cngx.components{@scope(.cngx-timeline-marker--busy){:scope{animation:cngx-timeline-marker-pulse var(--cngx-timeline-pulse-duration, 1.6s) ease-in-out infinite}}}@keyframes cngx-timeline-marker-pulse{0%,to{box-shadow:0 0 0 var(--cngx-timeline-connector-width, 2px) var(--cngx-timeline-surface, oklch(1 0 0)),0 0 0 var(--cngx-timeline-connector-width, 2px) transparent}50%{box-shadow:0 0 0 var(--cngx-timeline-connector-width, 2px) var(--cngx-timeline-surface, oklch(1 0 0)),0 0 0 calc(var(--cngx-timeline-connector-width, 2px) + var(--cngx-timeline-marker-ring-width, 3px)) color-mix(in oklch,currentColor 35%,transparent)}}@media(prefers-reduced-motion:reduce){.cngx-timeline-marker--busy{animation:none}}@media(forced-colors:active){.cngx-timeline-marker:not([data-status=upcoming]){box-sizing:border-box;border:var(--cngx-timeline-connector-width, 2px) solid CanvasText}.cngx-timeline-marker[data-status=done]:empty{background:CanvasText}.cngx-timeline-marker[data-status=active]:empty{background:Highlight;border-color:Highlight}.cngx-timeline-marker[data-status=rejected]:empty{border:3px double CanvasText}.cngx-timeline-marker[data-status=upcoming]:empty{box-sizing:border-box;border:var(--cngx-timeline-connector-width, 2px) dashed CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
260
+ }
261
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineMarker, decorators: [{
262
+ type: Component,
263
+ args: [{ selector: 'cngx-timeline-marker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
264
+ class: 'cngx-timeline-marker',
265
+ 'aria-hidden': 'true',
266
+ '[attr.data-status]': 'status()',
267
+ '[class.cngx-timeline-marker--busy]': 'busy()',
268
+ }, template: `<ng-content />`, styles: ["@layer cngx.tokens{@property --cngx-timeline-rail-inset{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-timeline-marker-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}@property --cngx-timeline-marker-glyph-size{syntax: \"<percentage>\"; inherits: true; initial-value: 60%;}@property --cngx-timeline-item-inline-size{syntax: \"<length>\"; inherits: true; initial-value: 192px;}@property --cngx-timeline-connector-width{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-timeline-marker-ring-width{syntax: \"<length>\"; inherits: true; initial-value: 3px;}@property --cngx-timeline-connector-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-timeline-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-marker-fg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-meta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-timeline-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-timeline-muted-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-done-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-timeline-active-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-timeline-upcoming-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-rejected-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .18 25);}@property --cngx-timeline-pulse-duration{syntax: \"<time>\"; inherits: true; initial-value: 1.6s;}}:root{--cngx-timeline-connector-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-timeline-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-timeline-text-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-timeline-muted-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-done-color: var(--cngx-color-success, oklch(.6 .15 145));--cngx-timeline-active-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-timeline-upcoming-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-rejected-color: var(--cngx-color-danger, oklch(.6 .18 25))}\n", "@layer cngx.components{@scope(.cngx-timeline-marker){:scope{display:inline-flex;align-items:center;justify-content:center;flex:none;inline-size:var(--cngx-timeline-marker-size, 12px);block-size:var(--cngx-timeline-marker-size, 12px);border-radius:50%;overflow:hidden;background:var(--cngx-timeline-connector-color, oklch(.88 .005 250));box-shadow:0 0 0 var(--cngx-timeline-connector-width, 2px) var(--cngx-timeline-surface, oklch(1 0 0));color:var(--cngx-timeline-marker-fg, oklch(1 0 0));font-size:.625em;line-height:1}:scope>img,:scope>picture{inline-size:100%;block-size:100%;object-fit:cover;border-radius:inherit}:scope>svg{inline-size:var(--cngx-timeline-marker-glyph-size, 60%);block-size:var(--cngx-timeline-marker-glyph-size, 60%)}:scope[data-status=done]{background:var(--cngx-timeline-done-color, oklch(.6 .15 145))}:scope[data-status=active]{background:var(--cngx-timeline-active-color, oklch(.66 .19 50))}:scope[data-status=rejected]{background:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}:scope[data-status=upcoming]{background:var(--cngx-timeline-surface, oklch(1 0 0));border:var(--cngx-timeline-connector-width, 2px) dashed var(--cngx-timeline-upcoming-color, oklch(.5 .01 250));color:var(--cngx-timeline-upcoming-color, oklch(.5 .01 250))}}}@layer cngx.components{@scope(.cngx-timeline-marker--busy){:scope{animation:cngx-timeline-marker-pulse var(--cngx-timeline-pulse-duration, 1.6s) ease-in-out infinite}}}@keyframes cngx-timeline-marker-pulse{0%,to{box-shadow:0 0 0 var(--cngx-timeline-connector-width, 2px) var(--cngx-timeline-surface, oklch(1 0 0)),0 0 0 var(--cngx-timeline-connector-width, 2px) transparent}50%{box-shadow:0 0 0 var(--cngx-timeline-connector-width, 2px) var(--cngx-timeline-surface, oklch(1 0 0)),0 0 0 calc(var(--cngx-timeline-connector-width, 2px) + var(--cngx-timeline-marker-ring-width, 3px)) color-mix(in oklch,currentColor 35%,transparent)}}@media(prefers-reduced-motion:reduce){.cngx-timeline-marker--busy{animation:none}}@media(forced-colors:active){.cngx-timeline-marker:not([data-status=upcoming]){box-sizing:border-box;border:var(--cngx-timeline-connector-width, 2px) solid CanvasText}.cngx-timeline-marker[data-status=done]:empty{background:CanvasText}.cngx-timeline-marker[data-status=active]:empty{background:Highlight;border-color:Highlight}.cngx-timeline-marker[data-status=rejected]:empty{border:3px double CanvasText}.cngx-timeline-marker[data-status=upcoming]:empty{box-sizing:border-box;border:var(--cngx-timeline-connector-width, 2px) dashed CanvasText}}\n"] }]
269
+ }], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }] } });
270
+
271
+ /**
272
+ * The rail segment between two markers.
273
+ *
274
+ * Decorative and `aria-hidden`: it repeats a sequence the DOM order
275
+ * already carries, so announcing it would only add noise. It is
276
+ * status-capable all the same, because the *visual* run of a history is
277
+ * where a rejected step or a not-yet-reached tail reads fastest - a
278
+ * dashed segment for `upcoming` and a danger-toned one for `rejected`,
279
+ * so the distinction survives without colour.
280
+ *
281
+ * Drawn with `border-inline-start` and clipped with block-direction
282
+ * margins - logical properties throughout, so the rail lands on the
283
+ * correct side under `dir="rtl"` with no override.
284
+ *
285
+ * ### Between two items
286
+ * ```html
287
+ * <cngx-timeline-connector status="done" />
288
+ * ```
289
+ *
290
+ * ### Last item in the run
291
+ * ```html
292
+ * <cngx-timeline-connector position="last" />
293
+ * ```
294
+ *
295
+ * @category common/timeline
296
+ * @wcag AA
297
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/connector.component.ts
298
+ * @relatedTo CngxTimelineMarker
299
+ * @since 0.1.0
300
+ */
301
+ class CngxTimelineConnector {
302
+ /**
303
+ * Status of the segment. `upcoming` renders dashed, `rejected` in the
304
+ * danger tone, `done` and `active` solid in their own tones. Left unset
305
+ * the rail paints in the neutral border colour.
306
+ */
307
+ status = input(undefined, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
308
+ /**
309
+ * Position in the run. `'first'` clips the head back to the marker
310
+ * centre, `'last'` clips the tail, `'only'` hides the segment
311
+ * entirely. Defaults to `'middle'` - a full-height segment.
312
+ */
313
+ position = input('middle', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
314
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineConnector, deps: [], target: i0.ɵɵFactoryTarget.Component });
315
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxTimelineConnector, isStandalone: true, selector: "cngx-timeline-connector", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "attr.data-status": "status()", "attr.data-position": "position()" }, classAttribute: "cngx-timeline-connector" }, ngImport: i0, template: '', isInline: true, styles: ["@layer cngx.tokens{@property --cngx-timeline-rail-inset{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-timeline-marker-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}@property --cngx-timeline-marker-glyph-size{syntax: \"<percentage>\"; inherits: true; initial-value: 60%;}@property --cngx-timeline-item-inline-size{syntax: \"<length>\"; inherits: true; initial-value: 192px;}@property --cngx-timeline-connector-width{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-timeline-marker-ring-width{syntax: \"<length>\"; inherits: true; initial-value: 3px;}@property --cngx-timeline-connector-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-timeline-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-marker-fg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-meta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-timeline-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-timeline-muted-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-done-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-timeline-active-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-timeline-upcoming-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-rejected-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .18 25);}@property --cngx-timeline-pulse-duration{syntax: \"<time>\"; inherits: true; initial-value: 1.6s;}}:root{--cngx-timeline-connector-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-timeline-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-timeline-text-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-timeline-muted-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-done-color: var(--cngx-color-success, oklch(.6 .15 145));--cngx-timeline-active-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-timeline-upcoming-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-rejected-color: var(--cngx-color-danger, oklch(.6 .18 25))}\n", "@layer cngx.components{@scope(.cngx-timeline-connector){:scope{display:block;inline-size:0;block-size:100%;justify-self:center;border-inline-start:var(--cngx-timeline-connector-width, 2px) solid var(--cngx-timeline-connector-color, oklch(.88 .005 250))}:scope[data-position=first]{margin-block-start:var(--cngx-timeline-rail-inset, 6px)}:scope[data-position=last]{margin-block-end:var(--cngx-timeline-rail-inset, 6px)}:scope[data-position=only]{display:none}:scope[data-status=done]{border-inline-start-color:var(--cngx-timeline-done-color, oklch(.6 .15 145))}:scope[data-status=active]{border-inline-start-color:var(--cngx-timeline-active-color, oklch(.66 .19 50))}:scope[data-status=rejected]{border-inline-start-color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}:scope[data-status=upcoming]{border-inline-start-style:dashed;border-inline-start-color:var(--cngx-timeline-upcoming-color, oklch(.5 .01 250))}}}@layer cngx.components{@scope(.cngx-timeline-connector){:scope:is([data-orientation=horizontal] *){inline-size:100%;block-size:0;justify-self:stretch;align-self:center;border-inline-start:none;border-block-start:var(--cngx-timeline-connector-width, 2px) solid var(--cngx-timeline-connector-color, oklch(.88 .005 250))}:scope[data-position=first]:is([data-orientation=horizontal] *){margin-block-start:0;margin-inline-start:var(--cngx-timeline-rail-inset, 6px)}:scope[data-position=last]:is([data-orientation=horizontal] *){margin-block-end:0;margin-inline-end:var(--cngx-timeline-rail-inset, 6px)}:scope[data-status=done]:is([data-orientation=horizontal] *){border-block-start-color:var(--cngx-timeline-done-color, oklch(.6 .15 145))}:scope[data-status=active]:is([data-orientation=horizontal] *){border-block-start-color:var(--cngx-timeline-active-color, oklch(.66 .19 50))}:scope[data-status=rejected]:is([data-orientation=horizontal] *){border-block-start-color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}:scope[data-status=upcoming]:is([data-orientation=horizontal] *){border-block-start-style:dashed;border-block-start-color:var(--cngx-timeline-upcoming-color, oklch(.5 .01 250))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
316
+ }
317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineConnector, decorators: [{
318
+ type: Component,
319
+ args: [{ selector: 'cngx-timeline-connector', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
320
+ class: 'cngx-timeline-connector',
321
+ 'aria-hidden': 'true',
322
+ '[attr.data-status]': 'status()',
323
+ '[attr.data-position]': 'position()',
324
+ }, template: '', styles: ["@layer cngx.tokens{@property --cngx-timeline-rail-inset{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-timeline-marker-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}@property --cngx-timeline-marker-glyph-size{syntax: \"<percentage>\"; inherits: true; initial-value: 60%;}@property --cngx-timeline-item-inline-size{syntax: \"<length>\"; inherits: true; initial-value: 192px;}@property --cngx-timeline-connector-width{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-timeline-marker-ring-width{syntax: \"<length>\"; inherits: true; initial-value: 3px;}@property --cngx-timeline-connector-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-timeline-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-marker-fg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-meta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-timeline-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-timeline-muted-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-done-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-timeline-active-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-timeline-upcoming-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-rejected-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .18 25);}@property --cngx-timeline-pulse-duration{syntax: \"<time>\"; inherits: true; initial-value: 1.6s;}}:root{--cngx-timeline-connector-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-timeline-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-timeline-text-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-timeline-muted-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-done-color: var(--cngx-color-success, oklch(.6 .15 145));--cngx-timeline-active-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-timeline-upcoming-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-rejected-color: var(--cngx-color-danger, oklch(.6 .18 25))}\n", "@layer cngx.components{@scope(.cngx-timeline-connector){:scope{display:block;inline-size:0;block-size:100%;justify-self:center;border-inline-start:var(--cngx-timeline-connector-width, 2px) solid var(--cngx-timeline-connector-color, oklch(.88 .005 250))}:scope[data-position=first]{margin-block-start:var(--cngx-timeline-rail-inset, 6px)}:scope[data-position=last]{margin-block-end:var(--cngx-timeline-rail-inset, 6px)}:scope[data-position=only]{display:none}:scope[data-status=done]{border-inline-start-color:var(--cngx-timeline-done-color, oklch(.6 .15 145))}:scope[data-status=active]{border-inline-start-color:var(--cngx-timeline-active-color, oklch(.66 .19 50))}:scope[data-status=rejected]{border-inline-start-color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}:scope[data-status=upcoming]{border-inline-start-style:dashed;border-inline-start-color:var(--cngx-timeline-upcoming-color, oklch(.5 .01 250))}}}@layer cngx.components{@scope(.cngx-timeline-connector){:scope:is([data-orientation=horizontal] *){inline-size:100%;block-size:0;justify-self:stretch;align-self:center;border-inline-start:none;border-block-start:var(--cngx-timeline-connector-width, 2px) solid var(--cngx-timeline-connector-color, oklch(.88 .005 250))}:scope[data-position=first]:is([data-orientation=horizontal] *){margin-block-start:0;margin-inline-start:var(--cngx-timeline-rail-inset, 6px)}:scope[data-position=last]:is([data-orientation=horizontal] *){margin-block-end:0;margin-inline-end:var(--cngx-timeline-rail-inset, 6px)}:scope[data-status=done]:is([data-orientation=horizontal] *){border-block-start-color:var(--cngx-timeline-done-color, oklch(.6 .15 145))}:scope[data-status=active]:is([data-orientation=horizontal] *){border-block-start-color:var(--cngx-timeline-active-color, oklch(.66 .19 50))}:scope[data-status=rejected]:is([data-orientation=horizontal] *){border-block-start-color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}:scope[data-status=upcoming]:is([data-orientation=horizontal] *){border-block-start-style:dashed;border-block-start-color:var(--cngx-timeline-upcoming-color, oklch(.5 .01 250))}}}\n"] }]
325
+ }], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }] } });
326
+
327
+ /**
328
+ * DI token for {@link CngxTimelineMarkerHost}. Provided by `<cngx-timeline>`;
329
+ * injected optionally by `CngxTimelineItem`, which falls back to its own
330
+ * `[cngxTimelineMarkerContent]` projection when no timeline is above it.
331
+ *
332
+ * A token rather than an injected parent class: the row must stay usable
333
+ * standalone, and a concrete parent type would make the two mutually
334
+ * dependent and block the decompose schematic.
335
+ *
336
+ * @category common/timeline
337
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/marker-host.token.ts
338
+ * @relatedTo CngxTimelineMarkerTpl, CngxTimelineItem
339
+ * @since 0.1.0
340
+ */
341
+ const CNGX_TIMELINE_MARKER_HOST = new InjectionToken('CngxTimelineMarkerHost');
342
+
343
+ /**
344
+ * The English timeline section: the single source of the timeline's English
345
+ * copy. `CNGX_TIMELINE_CONFIG` defaults its `labels` to it.
346
+ *
347
+ * @category common/timeline
348
+ * @since 0.1.0
349
+ * @relatedTo CNGX_TIMELINE_CONFIG
350
+ */
351
+ const CNGX_TIMELINE_LANGUAGE_EN = {
352
+ timelineRegion: 'Timeline',
353
+ retry: 'Retry',
354
+ errorFallback: 'Could not load the timeline.',
355
+ emptyFallback: 'No events yet',
356
+ loading: 'Loading timeline',
357
+ refreshing: 'Updating…',
358
+ itemBusy: 'Updating',
359
+ itemErrorFallback: 'Could not load this event.',
360
+ status: {
361
+ done: 'Completed',
362
+ active: 'In progress',
363
+ upcoming: 'Upcoming',
364
+ rejected: 'Rejected',
365
+ },
366
+ groupHeader: '{date}',
367
+ };
368
+
369
+ const DATE_FORMAT = {};
370
+ /** @internal Turns a timeline section into the config labels. */
371
+ function timelineLabelsFrom(section) {
372
+ return {
373
+ timelineRegion: section.timelineRegion,
374
+ retry: section.retry,
375
+ errorFallback: section.errorFallback,
376
+ emptyFallback: section.emptyFallback,
377
+ loading: section.loading,
378
+ refreshing: section.refreshing,
379
+ itemBusy: section.itemBusy,
380
+ itemErrorFallback: section.itemErrorFallback,
381
+ status: section.status,
382
+ groupLabel: (group, locale) => formatMessage(section.groupHeader, { date: dateTimeFormatterFor(locale, DATE_FORMAT).format(group.start) }, locale),
383
+ };
384
+ }
385
+ const LABELS_BY_SECTION = new WeakMap();
386
+ /**
387
+ * @internal The labels of one section object, built once: an equal section
388
+ * yields the identical labels, so readers compare by reference. The locale
389
+ * reaches `groupLabel` as its argument, so the labels do not depend on it.
390
+ */
391
+ function labelsOf(section) {
392
+ let labels = LABELS_BY_SECTION.get(section);
393
+ if (!labels) {
394
+ labels = timelineLabelsFrom(section);
395
+ LABELS_BY_SECTION.set(section, labels);
396
+ }
397
+ return labels;
398
+ }
399
+ const TIMELINE_CONFIG_DEFAULTS = {
400
+ labels: timelineLabelsFrom(CNGX_TIMELINE_LANGUAGE_EN),
401
+ templates: {},
402
+ };
403
+ /** @internal The timeline section of the active pack over the English section. */
404
+ const injectTimelineSection = createNestedLanguageSection('timeline', CNGX_TIMELINE_LANGUAGE_EN, 'status');
405
+ /**
406
+ * @internal The defaults with `labels` read from the timeline section of the
407
+ * active language pack. Runs in an injection context.
408
+ */
409
+ function timelineConfigDefaultsFromPack() {
410
+ const section = injectTimelineSection();
411
+ return { ...TIMELINE_CONFIG_DEFAULTS, labels: computed(() => labelsOf(section())) };
412
+ }
413
+ /**
414
+ * DI token for the resolved timeline config. \
415
+ * `providedIn: 'root'` with the library defaults, `labels` read from the
416
+ * timeline section of the active language pack; override via
417
+ * {@link provideTimelineConfig} (root) or {@link provideTimelineConfigAt}
418
+ * (component scope).
419
+ *
420
+ * @category common/timeline
421
+ * @wcag AA
422
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/timeline-config.ts
423
+ * @relatedTo provideTimelineConfig
424
+ * @relatedTo withTimelineLabels
425
+ * @since 0.1.0
426
+ */
427
+ const CNGX_TIMELINE_CONFIG = new InjectionToken('CngxTimelineConfig', {
428
+ providedIn: 'root',
429
+ factory: timelineConfigDefaultsFromPack,
430
+ });
431
+ /**
432
+ * @internal Shared empty bundle for a config without `labels`. One identity,
433
+ * so every `coerceSignal` over it resolves to the same cached source.
434
+ */
435
+ const TIMELINE_NO_LABELS = {};
436
+ /**
437
+ * Merge label overrides into the cascade. Keys left out keep the language
438
+ * pack's copy, or the English library default, so a consumer translates
439
+ * what they need and nothing more. Pass a `Signal` to switch the language at runtime.
440
+ *
441
+ * ```ts
442
+ * provideTimelineConfig(
443
+ * withTimelineLabels({
444
+ * retry: 'Erneut versuchen',
445
+ * emptyFallback: 'Noch keine Ereignisse.',
446
+ * groupLabel: (group, locale) => group.start.toLocaleDateString(locale, { dateStyle: 'medium' }),
447
+ * }),
448
+ * )
449
+ * ```
450
+ *
451
+ * @category common/timeline
452
+ */
453
+ function withTimelineLabels(labels) {
454
+ return (config) => ({
455
+ ...config,
456
+ // One level deeper than the rest: `status` is a map, and a shallow
457
+ // spread would let a consumer who renames one status silently
458
+ // silence the other three.
459
+ labels: createNestedOverrideMerge(config.labels ?? TIMELINE_NO_LABELS, labels, 'status'),
460
+ });
461
+ }
462
+ /**
463
+ * Merge app-wide slot template defaults into the cascade. Keys left out
464
+ * keep whatever an earlier feature set, and a per-instance slot directive
465
+ * still wins over anything set here.
466
+ *
467
+ * One bag rather than a `with*Template` builder per slot, matching how the
468
+ * select family carries its own slot defaults - the timeline has eight
469
+ * slots and near-identical builders would only add surface.
470
+ *
471
+ * ```ts
472
+ * readonly emptyTpl = viewChild.required<TemplateRef<CngxTimelineEmptyContext>>('emptyTpl', {
473
+ * read: TemplateRef,
474
+ * });
475
+ *
476
+ * providers: [provideTimelineConfig(withTimelineTemplates({ empty: this.emptyTpl() }))]
477
+ * ```
478
+ *
479
+ * @category common/timeline
480
+ */
481
+ function withTimelineTemplates(templates) {
482
+ return (config) => ({ ...config, templates: { ...config.templates, ...templates } });
483
+ }
484
+ function applyFeatures(base, features) {
485
+ return features.reduce((config, feature) => feature(config), base);
486
+ }
487
+ /**
488
+ * Root-level provider. Apply once in `bootstrapApplication` /
489
+ * `appConfig.providers`.
490
+ *
491
+ * @category common/timeline
492
+ */
493
+ function provideTimelineConfig(...features) {
494
+ return makeEnvironmentProviders([
495
+ {
496
+ provide: CNGX_TIMELINE_CONFIG,
497
+ useFactory: () => applyFeatures(timelineConfigDefaultsFromPack(), features),
498
+ },
499
+ ]);
500
+ }
501
+ /**
502
+ * Component-scoped override. Returns `Provider[]` rather than
503
+ * {@link EnvironmentProviders} because `viewProviders` rejects opaque
504
+ * environment providers.
505
+ *
506
+ * Features merge onto the parent config - an enclosing scope, or the root
507
+ * provider, or the library defaults when neither is present - so a region
508
+ * can re-phrase one label without resetting every other one the app set.
509
+ *
510
+ * ```ts
511
+ * @Component({
512
+ * viewProviders: [...provideTimelineConfigAt(withTimelineLabels({ retry: 'Again' }))],
513
+ * })
514
+ * ```
515
+ *
516
+ * @category common/timeline
517
+ */
518
+ function provideTimelineConfigAt(...features) {
519
+ return [
520
+ {
521
+ provide: CNGX_TIMELINE_CONFIG,
522
+ useFactory: (parent) => applyFeatures(parent ?? timelineConfigDefaultsFromPack(), features),
523
+ deps: [[new SkipSelf(), new Optional(), CNGX_TIMELINE_CONFIG]],
524
+ },
525
+ ];
526
+ }
527
+ /**
528
+ * Read the resolved timeline config. Runs in an injection context.
529
+ *
530
+ * @category common/timeline
531
+ */
532
+ function injectTimelineConfig() {
533
+ return inject(CNGX_TIMELINE_CONFIG);
534
+ }
535
+
536
+ /**
537
+ * Marks the element that holds an item's timestamp, so the item can place
538
+ * it in the raster the active mode calls for - above the body in
539
+ * `narrative`, trailing it in `activity`.
540
+ *
541
+ * Pair it with `<cngx-time>` from `@cngx/common/display` for relative
542
+ * formatting; the timeline neither formats nor ticks.
543
+ *
544
+ * @category common/timeline
545
+ */
546
+ class CngxTimelineTime {
547
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineTime, deps: [], target: i0.ɵɵFactoryTarget.Directive });
548
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineTime, isStandalone: true, selector: "[cngxTimelineTime]", host: { classAttribute: "cngx-timeline-item__time" }, ngImport: i0 });
549
+ }
550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineTime, decorators: [{
551
+ type: Directive,
552
+ args: [{
553
+ selector: '[cngxTimelineTime]',
554
+ standalone: true,
555
+ host: { class: 'cngx-timeline-item__time' },
556
+ }]
557
+ }] });
558
+ /**
559
+ * Marks content that belongs on the far side of the rail from the row's
560
+ * body - the year label opposite a card, the timestamp across a centred
561
+ * rail.
562
+ *
563
+ * Per-row content, so it is a projection slot rather than a timeline-wide
564
+ * template: the row template already owns it, and the config cascade is
565
+ * for surfaces the whole timeline shares.
566
+ *
567
+ * The extra grid track only exists for rows that actually project into it
568
+ * (`:has(> [cngxTimelineOpposite])`), so markup that predates this slot
569
+ * keeps its raster to the pixel. Placement follows the row: opposite content
570
+ * sits across the rail from the body under `start`, `end` and `alternate`
571
+ * alike.
572
+ *
573
+ * ```html
574
+ * <cngx-timeline-item status="done">
575
+ * <span cngxTimelineOpposite>2019</span>
576
+ * <p>Founded</p>
577
+ * </cngx-timeline-item>
578
+ * ```
579
+ *
580
+ * **Keep the content non-interactive.** The slot projects ahead of the body,
581
+ * so it is read first in every layout. For a year or a short label that is
582
+ * the right reading order whichever side the rail is on. A link or a button
583
+ * would take focus before the row it belongs to, and no placement of the
584
+ * grid can fix that, because the paint follows `[data-row-side]` while the
585
+ * DOM order does not.
586
+ *
587
+ * @category common/timeline
588
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/timeline-item.component.ts
589
+ * @relatedTo CngxTimelineItem, CngxTimelineTime
590
+ * @since 0.1.0
591
+ */
592
+ class CngxTimelineOpposite {
593
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineOpposite, deps: [], target: i0.ɵɵFactoryTarget.Directive });
594
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineOpposite, isStandalone: true, selector: "[cngxTimelineOpposite]", host: { classAttribute: "cngx-timeline-item__opposite" }, ngImport: i0 });
595
+ }
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineOpposite, decorators: [{
597
+ type: Directive,
598
+ args: [{
599
+ selector: '[cngxTimelineOpposite]',
600
+ standalone: true,
601
+ host: { class: 'cngx-timeline-item__opposite' },
602
+ }]
603
+ }] });
604
+ /**
605
+ * Marks content to render inside this row's marker dot - a glyph, an icon,
606
+ * an avatar.
607
+ *
608
+ * The per-row counterpart to the timeline-wide `*cngxTimelineMarkerTpl`, and
609
+ * the only route when the row stands on its own. It also *wins* over that
610
+ * template when both are present: most-local-wins, the same direction as
611
+ * every other slot in the family, so one row can carry a different glyph
612
+ * without the timeline's default being torn out for the rest.
613
+ *
614
+ * Whatever renders here is inside an `aria-hidden` element - decoration only.
615
+ *
616
+ * @category common/timeline
617
+ */
618
+ class CngxTimelineMarkerContent {
619
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineMarkerContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
620
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineMarkerContent, isStandalone: true, selector: "[cngxTimelineMarkerContent]", ngImport: i0 });
621
+ }
622
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineMarkerContent, decorators: [{
623
+ type: Directive,
624
+ args: [{
625
+ selector: '[cngxTimelineMarkerContent]',
626
+ standalone: true,
627
+ }]
628
+ }] });
629
+ /**
630
+ * Marks the element that holds an item's body. Optional - anything
631
+ * projected without a slot directive lands in the body too. Reach for it
632
+ * when the item also projects a timestamp and the source order would
633
+ * otherwise be ambiguous.
634
+ *
635
+ * @category common/timeline
636
+ */
637
+ class CngxTimelineContent {
638
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
639
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineContent, isStandalone: true, selector: "[cngxTimelineContent]", host: { classAttribute: "cngx-timeline-item__content" }, ngImport: i0 });
640
+ }
641
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineContent, decorators: [{
642
+ type: Directive,
643
+ args: [{
644
+ selector: '[cngxTimelineContent]',
645
+ standalone: true,
646
+ host: { class: 'cngx-timeline-item__content' },
647
+ }]
648
+ }] });
649
+ /**
650
+ * @internal Enough of the tabbable surface to catch the mistake this warns
651
+ * about. Not a general focus-order utility - `[tabindex]` matches a negative
652
+ * value too, which is deliberately over-eager for a dev-only check.
653
+ */
654
+ const FOCUSABLE = 'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]';
655
+ /**
656
+ * One event on the timeline: a marker, the rail segment below it, an
657
+ * optional timestamp, and the projected body.
658
+ *
659
+ * A terminal composable unit, not a fragment of the organism. It ships
660
+ * its own token SET rules and defaults to the `narrative` raster, so
661
+ * dropping one into a hand-rolled layout renders a complete, density-
662
+ * correct item with no `<cngx-timeline>` above it. Inside the organism it
663
+ * inherits `[data-mode]` and re-rasters itself.
664
+ *
665
+ * **Two independent state channels.** `status` is where the event sits in
666
+ * a history (`done` / `active` / `upcoming` / `rejected`) - editorial, set
667
+ * by the consumer. `state` is whether *this row's own* data is currently
668
+ * loading or failed. They compose: a `done` item whose `state` errored
669
+ * paints as rejected and announces the failure, without losing the
670
+ * editorial status once the retry succeeds.
671
+ *
672
+ * **What it announces.** The marker and rail are `aria-hidden`, so colour is
673
+ * never the only channel - the status reaches assistive tech through a
674
+ * screen-reader-only line fed from `CNGX_TIMELINE_CONFIG.labels.status`, and
675
+ * a failed row through a visible inline error. Both are read as the row's own
676
+ * content, in DOM order, rather than through `aria-describedby`: the host is
677
+ * a plain element with no role, so a description pointed at its own
678
+ * descendants would resolve nowhere and duplicate the text for anyone
679
+ * browsing it. Neither element is rendered while it has nothing to say.
680
+ *
681
+ * ### Standalone
682
+ * ```html
683
+ * <cngx-timeline-item status="done">
684
+ * <cngx-time cngxTimelineTime [date]="event.at" />
685
+ * <p>Deployment finished</p>
686
+ * </cngx-timeline-item>
687
+ * ```
688
+ *
689
+ * ### With its own async state
690
+ * ```html
691
+ * <cngx-timeline-item [state]="rowState" position="last">
692
+ * <p>{{ rowState.data()?.summary }}</p>
693
+ * </cngx-timeline-item>
694
+ * ```
695
+ *
696
+ * @category common/timeline
697
+ * @docsKind primary
698
+ * @wcag AA
699
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/timeline-item.component.ts
700
+ * @relatedTo CngxTimelineMarker, CngxTimelineConnector, CNGX_TIMELINE_CONFIG
701
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/standalone-atoms</example-url>
702
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/custom-date-header-and-marker</example-url>
703
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/marker-precedence</example-url>
704
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/media-markers</example-url>
705
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/placement-end</example-url>
706
+ * @since 0.1.0
707
+ */
708
+ class CngxTimelineItem {
709
+ labels = coerceSignal(injectTimelineConfig().labels ?? TIMELINE_NO_LABELS);
710
+ host = inject(ElementRef);
711
+ /**
712
+ * Where the event sits in the history. Drives the marker and rail
713
+ * colours and the screen-reader status line. Purely editorial - it
714
+ * carries no flow logic, because a timeline is a record and a guided
715
+ * process is a stepper.
716
+ */
717
+ status = input(undefined, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
718
+ /**
719
+ * This row's own async state, for a body that loads, mutates or fails
720
+ * independently of the list around it.
721
+ *
722
+ * Optional by construction and tolerant of a bare `state` attribute
723
+ * (the empty string coerces to `undefined`), so the item never forces a
724
+ * binding a consumer may not have.
725
+ */
726
+ state = input(undefined, { ...(ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {}), transform: (value) => (typeof value === 'string' ? undefined : value) });
727
+ /**
728
+ * Position in the run, forwarded to the rail. `'last'` and `'only'`
729
+ * stop the rail at this item so the timeline does not trail off into
730
+ * empty space. The organism sets it; standalone items default to
731
+ * `'middle'`.
732
+ */
733
+ position = input('middle', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
734
+ /**
735
+ * The event this row stands for. Only ever read as the `$implicit` of an
736
+ * app-wide `*cngxTimelineMarkerTpl`, so bind it when the app sets one and
737
+ * that template needs the payload; leave it off otherwise.
738
+ */
739
+ item = input(undefined, ...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
740
+ /**
741
+ * @internal The timeline-wide marker template, when a `<cngx-timeline>` is
742
+ * above this row. Absent standalone.
743
+ */
744
+ hostMarkerTpl = inject(CNGX_TIMELINE_MARKER_HOST, { optional: true })?.markerTpl ?? (() => null);
745
+ /** @internal Set when this row projects its own marker content. */
746
+ ownMarker = contentChild(CngxTimelineMarkerContent, ...(ngDevMode ? [{ debugName: "ownMarker" }] : /* istanbul ignore next */ []));
747
+ /**
748
+ * @internal The timeline-wide template is the *default*, so a row that
749
+ * projects its own marker content overrides it - most-local-wins, the
750
+ * same direction as every other slot in the family. Resolving to `null`
751
+ * rather than branching on `<ng-content>` keeps the projection static:
752
+ * content lands in the DOM once and renders whatever it was given.
753
+ */
754
+ markerTpl = computed(() => (this.ownMarker() ? null : this.hostMarkerTpl()), ...(ngDevMode ? [{ debugName: "markerTpl" }] : /* istanbul ignore next */ []));
755
+ /** @internal Work in flight on this row's own state. */
756
+ busy = computed(() => {
757
+ const status = this.state()?.status();
758
+ return status === 'loading' || status === 'pending';
759
+ }, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
760
+ /** @internal This row's own state failed. */
761
+ failed = computed(() => this.state()?.status() === 'error', ...(ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []));
762
+ /** @internal `aria-busy` reflects the row's own work, not the list's. */
763
+ ariaBusy = computed(() => (this.busy() ? 'true' : null), ...(ngDevMode ? [{ debugName: "ariaBusy" }] : /* istanbul ignore next */ []));
764
+ /**
765
+ * @internal A failed row paints as rejected regardless of its editorial
766
+ * status - a failure is the more urgent fact, and `status` is left
767
+ * untouched so the row returns to its own colour once a retry lands.
768
+ */
769
+ markerStatus = computed(() => this.failed() ? 'rejected' : this.status(), ...(ngDevMode ? [{ debugName: "markerStatus" }] : /* istanbul ignore next */ []));
770
+ /**
771
+ * @internal Busy outranks everything: a row still loading has nothing
772
+ * settled to report. Otherwise this reads `markerStatus`, not `status`,
773
+ * so the announcement can never contradict the paint - a failed row
774
+ * announces the `rejected` it shows, not the editorial status it kept.
775
+ */
776
+ statusText = computed(() => {
777
+ const labels = this.labels();
778
+ if (this.busy()) {
779
+ return labels.itemBusy ?? '';
780
+ }
781
+ const status = this.markerStatus();
782
+ return status ? (labels.status?.[status] ?? '') : '';
783
+ }, ...(ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []));
784
+ /** @internal Visible inline error, blank unless this row failed. */
785
+ errorText = computed(() => this.failed() ? (this.labels().itemErrorFallback ?? '') : '', ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
786
+ constructor() {
787
+ if (isDevMode()) {
788
+ // afterNextRender, not an effect: this is a one-shot authoring check
789
+ // on projected content, and the reactive graph has no business
790
+ // carrying it. Runs once per row, after its content exists.
791
+ afterNextRender(() => {
792
+ const opposite = this.host.nativeElement.querySelector(':scope > [cngxTimelineOpposite]');
793
+ if (opposite?.querySelector(FOCUSABLE)) {
794
+ console.warn('[cngx-timeline-item] focusable content inside [cngxTimelineOpposite]. ' +
795
+ 'The slot projects ahead of the row body, so under placement="end" or ' +
796
+ '"alternate" it takes focus before the row it belongs to while painting ' +
797
+ 'on the far side of the rail. Keep opposite content non-interactive and ' +
798
+ 'put controls in the body.', this.host.nativeElement);
799
+ }
800
+ });
801
+ }
802
+ }
803
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
804
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTimelineItem, isStandalone: true, selector: "cngx-timeline-item", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-status": "status()", "attr.data-failed": "failed() ? \"\" : null", "attr.aria-busy": "ariaBusy()" }, classAttribute: "cngx-timeline-item" }, queries: [{ propertyName: "ownMarker", first: true, predicate: CngxTimelineMarkerContent, descendants: true, isSignal: true }], ngImport: i0, template: `
805
+ <cngx-timeline-marker [status]="markerStatus()" [busy]="busy()">
806
+ @if (markerTpl(); as tpl) {
807
+ <ng-container
808
+ *ngTemplateOutlet="tpl; context: { $implicit: item(), status: markerStatus() }"
809
+ />
810
+ } @else {
811
+ <ng-content select="[cngxTimelineMarkerContent]" />
812
+ }
813
+ </cngx-timeline-marker>
814
+ <cngx-timeline-connector [status]="markerStatus()" [position]="position()" />
815
+ <ng-content select="[cngxTimelineOpposite]" />
816
+ <ng-content select="[cngxTimelineTime]" />
817
+ <div class="cngx-timeline-item__body">
818
+ <ng-content select="[cngxTimelineContent]" />
819
+ <ng-content />
820
+ @if (errorText(); as text) {
821
+ <p class="cngx-timeline-item__error">{{ text }}</p>
822
+ }
823
+ </div>
824
+ @if (statusText(); as text) {
825
+ <span class="cngx-timeline-item__sr">{{ text }}</span>
826
+ }
827
+ `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-timeline-rail-inset{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-timeline-marker-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}@property --cngx-timeline-marker-glyph-size{syntax: \"<percentage>\"; inherits: true; initial-value: 60%;}@property --cngx-timeline-item-inline-size{syntax: \"<length>\"; inherits: true; initial-value: 192px;}@property --cngx-timeline-connector-width{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-timeline-marker-ring-width{syntax: \"<length>\"; inherits: true; initial-value: 3px;}@property --cngx-timeline-connector-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-timeline-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-marker-fg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-meta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-timeline-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-timeline-muted-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-done-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-timeline-active-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-timeline-upcoming-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-rejected-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .18 25);}@property --cngx-timeline-pulse-duration{syntax: \"<time>\"; inherits: true; initial-value: 1.6s;}}:root{--cngx-timeline-connector-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-timeline-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-timeline-text-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-timeline-muted-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-done-color: var(--cngx-color-success, oklch(.6 .15 145));--cngx-timeline-active-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-timeline-upcoming-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-rejected-color: var(--cngx-color-danger, oklch(.6 .18 25))}\n", "@layer cngx.tokens{@property --cngx-timeline-gap{syntax: \"<length>\"; inherits: true; initial-value: 8px;}@property --cngx-timeline-row-gap{syntax: \"<length>\"; inherits: true; initial-value: 4px;}@property --cngx-timeline-content-padding{syntax: \"<length>\"; inherits: true; initial-value: 4px;}}@layer cngx.components{@scope(.cngx-timeline-item){:scope{--cngx-timeline-gap: var(--cngx-space-sm, 8px);--cngx-timeline-row-gap: var(--cngx-space-xs, 4px);--cngx-timeline-content-padding: var(--cngx-space-xs, 4px);--cngx-timeline-rail-inset: calc(var(--cngx-timeline-marker-size, 12px) / 2);display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);grid-template-areas:\"marker time\" \"rail body\";column-gap:var(--cngx-timeline-gap, 8px);row-gap:var(--cngx-timeline-row-gap, 4px);color:var(--cngx-timeline-text-color, oklch(.2 .01 250))}.cngx-timeline-marker{grid-area:marker}.cngx-timeline-connector{grid-area:rail}.cngx-timeline-item__time{grid-area:time;color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem);line-height:1.4}.cngx-timeline-item__opposite{grid-area:opposite;align-self:start;color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem);line-height:1.4;text-align:end}.cngx-timeline-item__body{grid-area:body;padding:var(--cngx-timeline-content-padding, 4px);padding-block-end:var(--cngx-timeline-row-gap, 4px);min-inline-size:0}.cngx-timeline-item__error{margin:0;color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25));font-size:var(--cngx-timeline-meta-size, .8125rem);line-height:1.4}.cngx-timeline-item__sr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:scope[data-failed] .cngx-timeline-item__time{color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}}[data-mode=activity] .cngx-timeline-item:not([data-orientation=horizontal] *){grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:\"marker body time\" \"rail body time\"}[data-mode=activity] .cngx-timeline-item .cngx-timeline-item__time{align-self:start;text-align:end;white-space:nowrap}[data-row-side=end] .cngx-timeline-item:not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:minmax(0,1fr) auto;grid-template-areas:\"time marker\" \"body rail\"}[data-row-side=end] .cngx-timeline-item:is([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:\"time body marker\" \"time body rail\"}[data-row-side=end] .cngx-timeline-item:not([data-mode=activity] *) .cngx-timeline-item__time{text-align:end}[data-row-side=end] .cngx-timeline-item:is([data-mode=activity] *) .cngx-timeline-item__time{text-align:start}[data-row-side=end] .cngx-timeline-item .cngx-timeline-item__opposite{text-align:start}.cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"opposite marker body\" \"time rail body\"}[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"body marker opposite\" \"body rail time\"}@container cngx-timeline (max-inline-size: 30rem){.cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *),[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:auto minmax(0,1fr);grid-template-areas:\"marker time\" \"rail body\"}.cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]),[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto auto minmax(0,1fr);grid-template-areas:\"opposite marker body\" \"time rail body\"}[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *) .cngx-timeline-item__time{text-align:start}[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *) .cngx-timeline-item__opposite{text-align:end}}.cngx-timeline-item:not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto auto minmax(0,1fr);grid-template-areas:\"opposite marker time\" \"opposite rail body\"}.cngx-timeline-item:is([data-mode=activity] *):not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto auto minmax(0,1fr) auto;grid-template-areas:\"opposite marker body time\" \"opposite rail body time\"}[data-row-side=end] .cngx-timeline-item:not([data-mode=activity] *):not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:\"time marker opposite\" \"body rail opposite\"}[data-row-side=end] .cngx-timeline-item:is([data-mode=activity] *):not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto minmax(0,1fr) auto auto;grid-template-areas:\"time body marker opposite\" \"time body rail opposite\"}[data-rail=continuous] .cngx-timeline-item .cngx-timeline-connector:not([data-position=last]):not([data-position=only]):not([data-orientation=horizontal] *){block-size:calc(100% + var(--cngx-timeline-item-gap, 16px))}[data-rail=continuous] .cngx-timeline-item .cngx-timeline-connector:not([data-position=last]):not([data-position=only]):is([data-orientation=horizontal] *){inline-size:calc(100% + var(--cngx-timeline-item-gap, 16px))}.cngx-timeline-item:is([data-orientation=horizontal] *){flex:none;inline-size:var(--cngx-timeline-item-inline-size, 12rem);grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:\"marker rail\" \"time time\" \"body body\"}.cngx-timeline-item:is([data-orientation=horizontal] *) .cngx-timeline-item__time{text-align:start;white-space:normal}.cngx-timeline-item:is([data-orientation=horizontal] *) .cngx-timeline-item__opposite{text-align:start}[data-row-side=end] .cngx-timeline-item:is([data-orientation=horizontal] *){grid-template-rows:minmax(0,1fr) auto auto;grid-template-areas:\"body body\" \"time time\" \"marker rail\"}.cngx-timeline-item:is([data-orientation=horizontal] *):is([data-placement=alternate] *){grid-template-rows:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"opposite time\" \"marker rail\" \"body body\"}[data-row-side=end] .cngx-timeline-item:is([data-orientation=horizontal] *):is([data-placement=alternate] *){grid-template-rows:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"body body\" \"marker rail\" \"opposite time\"}.cngx-timeline-item:is([data-orientation=horizontal] *):not([data-placement=alternate] *):has(>[cngxTimelineOpposite]){grid-template-rows:auto auto auto minmax(0,1fr);grid-template-areas:\"opposite opposite\" \"marker rail\" \"time time\" \"body body\"}[data-row-side=end] .cngx-timeline-item:is([data-orientation=horizontal] *):not([data-placement=alternate] *):has(>[cngxTimelineOpposite]){grid-template-rows:minmax(0,1fr) auto auto auto;grid-template-areas:\"body body\" \"time time\" \"marker rail\" \"opposite opposite\"}}\n"], dependencies: [{ kind: "component", type: CngxTimelineMarker, selector: "cngx-timeline-marker", inputs: ["status", "busy"] }, { kind: "component", type: CngxTimelineConnector, selector: "cngx-timeline-connector", inputs: ["status", "position"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
828
+ }
829
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineItem, decorators: [{
830
+ type: Component,
831
+ args: [{ selector: 'cngx-timeline-item', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxTimelineMarker, CngxTimelineConnector, NgTemplateOutlet], host: {
832
+ class: 'cngx-timeline-item',
833
+ '[attr.data-status]': 'status()',
834
+ '[attr.data-failed]': 'failed() ? "" : null',
835
+ '[attr.aria-busy]': 'ariaBusy()',
836
+ }, template: `
837
+ <cngx-timeline-marker [status]="markerStatus()" [busy]="busy()">
838
+ @if (markerTpl(); as tpl) {
839
+ <ng-container
840
+ *ngTemplateOutlet="tpl; context: { $implicit: item(), status: markerStatus() }"
841
+ />
842
+ } @else {
843
+ <ng-content select="[cngxTimelineMarkerContent]" />
844
+ }
845
+ </cngx-timeline-marker>
846
+ <cngx-timeline-connector [status]="markerStatus()" [position]="position()" />
847
+ <ng-content select="[cngxTimelineOpposite]" />
848
+ <ng-content select="[cngxTimelineTime]" />
849
+ <div class="cngx-timeline-item__body">
850
+ <ng-content select="[cngxTimelineContent]" />
851
+ <ng-content />
852
+ @if (errorText(); as text) {
853
+ <p class="cngx-timeline-item__error">{{ text }}</p>
854
+ }
855
+ </div>
856
+ @if (statusText(); as text) {
857
+ <span class="cngx-timeline-item__sr">{{ text }}</span>
858
+ }
859
+ `, styles: ["@layer cngx.tokens{@property --cngx-timeline-rail-inset{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-timeline-marker-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}@property --cngx-timeline-marker-glyph-size{syntax: \"<percentage>\"; inherits: true; initial-value: 60%;}@property --cngx-timeline-item-inline-size{syntax: \"<length>\"; inherits: true; initial-value: 192px;}@property --cngx-timeline-connector-width{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-timeline-marker-ring-width{syntax: \"<length>\"; inherits: true; initial-value: 3px;}@property --cngx-timeline-connector-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-timeline-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-marker-fg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-timeline-meta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-timeline-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-timeline-muted-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-done-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .15 145);}@property --cngx-timeline-active-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-timeline-upcoming-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-timeline-rejected-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .18 25);}@property --cngx-timeline-pulse-duration{syntax: \"<time>\"; inherits: true; initial-value: 1.6s;}}:root{--cngx-timeline-connector-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-timeline-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-timeline-text-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-timeline-muted-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-done-color: var(--cngx-color-success, oklch(.6 .15 145));--cngx-timeline-active-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-timeline-upcoming-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-timeline-rejected-color: var(--cngx-color-danger, oklch(.6 .18 25))}\n", "@layer cngx.tokens{@property --cngx-timeline-gap{syntax: \"<length>\"; inherits: true; initial-value: 8px;}@property --cngx-timeline-row-gap{syntax: \"<length>\"; inherits: true; initial-value: 4px;}@property --cngx-timeline-content-padding{syntax: \"<length>\"; inherits: true; initial-value: 4px;}}@layer cngx.components{@scope(.cngx-timeline-item){:scope{--cngx-timeline-gap: var(--cngx-space-sm, 8px);--cngx-timeline-row-gap: var(--cngx-space-xs, 4px);--cngx-timeline-content-padding: var(--cngx-space-xs, 4px);--cngx-timeline-rail-inset: calc(var(--cngx-timeline-marker-size, 12px) / 2);display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);grid-template-areas:\"marker time\" \"rail body\";column-gap:var(--cngx-timeline-gap, 8px);row-gap:var(--cngx-timeline-row-gap, 4px);color:var(--cngx-timeline-text-color, oklch(.2 .01 250))}.cngx-timeline-marker{grid-area:marker}.cngx-timeline-connector{grid-area:rail}.cngx-timeline-item__time{grid-area:time;color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem);line-height:1.4}.cngx-timeline-item__opposite{grid-area:opposite;align-self:start;color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem);line-height:1.4;text-align:end}.cngx-timeline-item__body{grid-area:body;padding:var(--cngx-timeline-content-padding, 4px);padding-block-end:var(--cngx-timeline-row-gap, 4px);min-inline-size:0}.cngx-timeline-item__error{margin:0;color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25));font-size:var(--cngx-timeline-meta-size, .8125rem);line-height:1.4}.cngx-timeline-item__sr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:scope[data-failed] .cngx-timeline-item__time{color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}}[data-mode=activity] .cngx-timeline-item:not([data-orientation=horizontal] *){grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:\"marker body time\" \"rail body time\"}[data-mode=activity] .cngx-timeline-item .cngx-timeline-item__time{align-self:start;text-align:end;white-space:nowrap}[data-row-side=end] .cngx-timeline-item:not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:minmax(0,1fr) auto;grid-template-areas:\"time marker\" \"body rail\"}[data-row-side=end] .cngx-timeline-item:is([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:\"time body marker\" \"time body rail\"}[data-row-side=end] .cngx-timeline-item:not([data-mode=activity] *) .cngx-timeline-item__time{text-align:end}[data-row-side=end] .cngx-timeline-item:is([data-mode=activity] *) .cngx-timeline-item__time{text-align:start}[data-row-side=end] .cngx-timeline-item .cngx-timeline-item__opposite{text-align:start}.cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"opposite marker body\" \"time rail body\"}[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"body marker opposite\" \"body rail time\"}@container cngx-timeline (max-inline-size: 30rem){.cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *),[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *){grid-template-columns:auto minmax(0,1fr);grid-template-areas:\"marker time\" \"rail body\"}.cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]),[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto auto minmax(0,1fr);grid-template-areas:\"opposite marker body\" \"time rail body\"}[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *) .cngx-timeline-item__time{text-align:start}[data-row-side=end] .cngx-timeline-item:is([data-placement=alternate] *):not([data-mode=activity] *) .cngx-timeline-item__opposite{text-align:end}}.cngx-timeline-item:not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto auto minmax(0,1fr);grid-template-areas:\"opposite marker time\" \"opposite rail body\"}.cngx-timeline-item:is([data-mode=activity] *):not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto auto minmax(0,1fr) auto;grid-template-areas:\"opposite marker body time\" \"opposite rail body time\"}[data-row-side=end] .cngx-timeline-item:not([data-mode=activity] *):not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:\"time marker opposite\" \"body rail opposite\"}[data-row-side=end] .cngx-timeline-item:is([data-mode=activity] *):not([data-placement=alternate] *):not([data-orientation=horizontal] *):has(>[cngxTimelineOpposite]){grid-template-columns:auto minmax(0,1fr) auto auto;grid-template-areas:\"time body marker opposite\" \"time body rail opposite\"}[data-rail=continuous] .cngx-timeline-item .cngx-timeline-connector:not([data-position=last]):not([data-position=only]):not([data-orientation=horizontal] *){block-size:calc(100% + var(--cngx-timeline-item-gap, 16px))}[data-rail=continuous] .cngx-timeline-item .cngx-timeline-connector:not([data-position=last]):not([data-position=only]):is([data-orientation=horizontal] *){inline-size:calc(100% + var(--cngx-timeline-item-gap, 16px))}.cngx-timeline-item:is([data-orientation=horizontal] *){flex:none;inline-size:var(--cngx-timeline-item-inline-size, 12rem);grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:\"marker rail\" \"time time\" \"body body\"}.cngx-timeline-item:is([data-orientation=horizontal] *) .cngx-timeline-item__time{text-align:start;white-space:normal}.cngx-timeline-item:is([data-orientation=horizontal] *) .cngx-timeline-item__opposite{text-align:start}[data-row-side=end] .cngx-timeline-item:is([data-orientation=horizontal] *){grid-template-rows:minmax(0,1fr) auto auto;grid-template-areas:\"body body\" \"time time\" \"marker rail\"}.cngx-timeline-item:is([data-orientation=horizontal] *):is([data-placement=alternate] *){grid-template-rows:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"opposite time\" \"marker rail\" \"body body\"}[data-row-side=end] .cngx-timeline-item:is([data-orientation=horizontal] *):is([data-placement=alternate] *){grid-template-rows:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"body body\" \"marker rail\" \"opposite time\"}.cngx-timeline-item:is([data-orientation=horizontal] *):not([data-placement=alternate] *):has(>[cngxTimelineOpposite]){grid-template-rows:auto auto auto minmax(0,1fr);grid-template-areas:\"opposite opposite\" \"marker rail\" \"time time\" \"body body\"}[data-row-side=end] .cngx-timeline-item:is([data-orientation=horizontal] *):not([data-placement=alternate] *):has(>[cngxTimelineOpposite]){grid-template-rows:minmax(0,1fr) auto auto auto;grid-template-areas:\"body body\" \"time time\" \"marker rail\" \"opposite opposite\"}}\n"] }]
860
+ }], ctorParameters: () => [], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: false }] }], ownMarker: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineMarkerContent), { isSignal: true }] }] } });
861
+
862
+ /**
863
+ * The row template. The one slot with no built-in fallback: only the
864
+ * consumer knows what an event of theirs looks like.
865
+ *
866
+ * Bind the same array the timeline gets and the `let-` variables come out
867
+ * typed - `[cngxTimelineItem]` exists to pin `T`, nothing more:
868
+ *
869
+ * ```html
870
+ * <cngx-timeline [items]="events()" [dateAccessor]="at">
871
+ * <ng-template [cngxTimelineItem]="events()" let-event let-last="last">
872
+ * <cngx-timeline-item [position]="last ? 'last' : 'middle'">
873
+ * <cngx-time cngxTimelineTime [date]="event.at" />
874
+ * <p>{{ event.summary }}</p>
875
+ * </cngx-timeline-item>
876
+ * </ng-template>
877
+ * </cngx-timeline>
878
+ * ```
879
+ *
880
+ * Named `CngxTimelineItemTpl` so it does not collide with the
881
+ * `CngxTimelineItem` component; the selector stays `cngxTimelineItem`,
882
+ * which is what consumers write.
883
+ *
884
+ * @category common/timeline
885
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
886
+ * @relatedTo CngxTimelineItem, CngxTimelineDateHeader
887
+ * @since 0.1.0
888
+ */
889
+ class CngxTimelineItemTpl {
890
+ /**
891
+ * Type carrier, never read at runtime. Angular cannot infer a structural
892
+ * directive's context generic from a sibling input on the host component,
893
+ * so `T` has to be pinned on the directive itself; binding the same array
894
+ * the timeline renders does that, and `ngTemplateContextGuard` below then
895
+ * types every `let-` variable. This is `NgForOf`'s `ngForOf` mechanism,
896
+ * not a cngx invention.
897
+ *
898
+ * Optional, and tolerant of the bare `cngxTimelineItem` attribute every
899
+ * v1 consumer writes: an unbound attribute binds the empty string, which
900
+ * `strictTemplates` would otherwise reject against an array type. The
901
+ * empty string coerces to `undefined` and `T` falls back to `unknown` -
902
+ * the Bridge-Input shape the library uses wherever an attribute doubles
903
+ * as an opt-in.
904
+ *
905
+ * Nothing enforces that the array bound here is the array bound to
906
+ * `[items]`; a mismatch only mistypes the `let-` variables, which the
907
+ * template type-checker then rejects at the use site.
908
+ */
909
+ cngxTimelineItem = input(undefined, { ...(ngDevMode ? { debugName: "cngxTimelineItem" } : /* istanbul ignore next */ {}), transform: (value) => (typeof value === 'string' ? undefined : value) });
910
+ templateRef = inject(TemplateRef);
911
+ static ngTemplateContextGuard(_dir, ctx) {
912
+ return true;
913
+ }
914
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineItemTpl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
915
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTimelineItemTpl, isStandalone: true, selector: "ng-template[cngxTimelineItem]", inputs: { cngxTimelineItem: { classPropertyName: "cngxTimelineItem", publicName: "cngxTimelineItem", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxTimelineItem"], ngImport: i0 });
916
+ }
917
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineItemTpl, decorators: [{
918
+ type: Directive,
919
+ args: [{
920
+ selector: 'ng-template[cngxTimelineItem]',
921
+ standalone: true,
922
+ exportAs: 'cngxTimelineItem',
923
+ }]
924
+ }], propDecorators: { cngxTimelineItem: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxTimelineItem", required: false }] }] } });
925
+ /**
926
+ * The per-group header. Falls back to
927
+ * `CNGX_TIMELINE_CONFIG.labels.groupLabel`, which formats the group's
928
+ * start date in the app locale.
929
+ *
930
+ * The element this renders into is what the group's `aria-labelledby`
931
+ * points at, so a header that renders nothing leaves the group unnamed.
932
+ *
933
+ * ```html
934
+ * <ng-template [cngxTimelineDateHeader]="events()" let-group>
935
+ * <h3>{{ format(group.start) }} ({{ group.items.length }})</h3>
936
+ * </ng-template>
937
+ * ```
938
+ *
939
+ * @category common/timeline
940
+ * @wcag AA
941
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
942
+ * @relatedTo CngxTimelineItemTpl
943
+ * @since 0.1.0
944
+ */
945
+ class CngxTimelineDateHeader {
946
+ /**
947
+ * Type carrier for the group's item type, never read at runtime. Bind the
948
+ * same array the timeline gets and `let-group` types as
949
+ * `TimelineGroup<T>`. See {@link CngxTimelineItemTpl.cngxTimelineItem}.
950
+ */
951
+ cngxTimelineDateHeader = input(undefined, { ...(ngDevMode ? { debugName: "cngxTimelineDateHeader" } : /* istanbul ignore next */ {}), transform: (value) => (typeof value === 'string' ? undefined : value) });
952
+ templateRef = inject(TemplateRef);
953
+ static ngTemplateContextGuard(_dir, ctx) {
954
+ return true;
955
+ }
956
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineDateHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
957
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTimelineDateHeader, isStandalone: true, selector: "ng-template[cngxTimelineDateHeader]", inputs: { cngxTimelineDateHeader: { classPropertyName: "cngxTimelineDateHeader", publicName: "cngxTimelineDateHeader", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxTimelineDateHeader"], ngImport: i0 });
958
+ }
959
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineDateHeader, decorators: [{
960
+ type: Directive,
961
+ args: [{
962
+ selector: 'ng-template[cngxTimelineDateHeader]',
963
+ standalone: true,
964
+ exportAs: 'cngxTimelineDateHeader',
965
+ }]
966
+ }], propDecorators: { cngxTimelineDateHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxTimelineDateHeader", required: false }] }] } });
967
+ /**
968
+ * What goes inside the marker dot - an icon, an avatar, a type glyph.
969
+ * Falls back to a bare coloured dot.
970
+ *
971
+ * Applies to every row. A single row overrides it by projecting its own
972
+ * `[cngxTimelineMarkerContent]`, which wins over this template.
973
+ *
974
+ * Whatever renders here is inside an `aria-hidden` element, so it must
975
+ * not be the only carrier of anything: the status reaches assistive tech
976
+ * through `CNGX_TIMELINE_CONFIG.labels.status`.
977
+ *
978
+ * Keeps `Tpl` in class *and* selector to stay clear of
979
+ * `CngxTimelineMarker`, the component it renders into.
980
+ *
981
+ * @category common/timeline
982
+ * @wcag AA
983
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
984
+ * @relatedTo CngxTimelineMarker
985
+ * @since 0.1.0
986
+ */
987
+ class CngxTimelineMarkerTpl {
988
+ /**
989
+ * Type carrier for the item type, never read at runtime. Bind the same
990
+ * array the timeline gets and `let-event` types as `T`. See
991
+ * {@link CngxTimelineItemTpl.cngxTimelineItem}.
992
+ */
993
+ cngxTimelineMarkerTpl = input(undefined, { ...(ngDevMode ? { debugName: "cngxTimelineMarkerTpl" } : /* istanbul ignore next */ {}), transform: (value) => (typeof value === 'string' ? undefined : value) });
994
+ templateRef = inject(TemplateRef);
995
+ static ngTemplateContextGuard(_dir, ctx) {
996
+ return true;
997
+ }
998
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineMarkerTpl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
999
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTimelineMarkerTpl, isStandalone: true, selector: "ng-template[cngxTimelineMarkerTpl]", inputs: { cngxTimelineMarkerTpl: { classPropertyName: "cngxTimelineMarkerTpl", publicName: "cngxTimelineMarkerTpl", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxTimelineMarkerTpl"], ngImport: i0 });
1000
+ }
1001
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineMarkerTpl, decorators: [{
1002
+ type: Directive,
1003
+ args: [{
1004
+ selector: 'ng-template[cngxTimelineMarkerTpl]',
1005
+ standalone: true,
1006
+ exportAs: 'cngxTimelineMarkerTpl',
1007
+ }]
1008
+ }], propDecorators: { cngxTimelineMarkerTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxTimelineMarkerTpl", required: false }] }] } });
1009
+ /**
1010
+ * The empty surface. Falls back to
1011
+ * `CNGX_TIMELINE_CONFIG.labels.emptyFallback`.
1012
+ *
1013
+ * ```html
1014
+ * <ng-template cngxTimelineEmpty let-reason>
1015
+ * @if (reason === 'no-results') { <p>No events match this filter.</p> }
1016
+ * @else { <p>Nothing has happened yet.</p> }
1017
+ * </ng-template>
1018
+ * ```
1019
+ *
1020
+ * @category common/timeline
1021
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
1022
+ * @relatedTo CngxTimelineError
1023
+ * @since 0.1.0
1024
+ */
1025
+ class CngxTimelineEmpty {
1026
+ templateRef = inject(TemplateRef);
1027
+ static ngTemplateContextGuard(_dir, ctx) {
1028
+ return true;
1029
+ }
1030
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineEmpty, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1031
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineEmpty, isStandalone: true, selector: "ng-template[cngxTimelineEmpty]", exportAs: ["cngxTimelineEmpty"], ngImport: i0 });
1032
+ }
1033
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineEmpty, decorators: [{
1034
+ type: Directive,
1035
+ args: [{
1036
+ selector: 'ng-template[cngxTimelineEmpty]',
1037
+ standalone: true,
1038
+ exportAs: 'cngxTimelineEmpty',
1039
+ }]
1040
+ }] });
1041
+ /**
1042
+ * The whole error surface, replacing message and retry control together.
1043
+ * Reach for `*cngxTimelineRetryButton` instead when only the button needs
1044
+ * restyling. Falls back to
1045
+ * `CNGX_TIMELINE_CONFIG.labels.errorFallback` plus a plain retry button.
1046
+ *
1047
+ * @category common/timeline
1048
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
1049
+ * @relatedTo CngxTimelineRetryButton, CngxTimelineEmpty
1050
+ * @since 0.1.0
1051
+ */
1052
+ class CngxTimelineError {
1053
+ templateRef = inject(TemplateRef);
1054
+ static ngTemplateContextGuard(_dir, ctx) {
1055
+ return true;
1056
+ }
1057
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineError, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1058
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineError, isStandalone: true, selector: "ng-template[cngxTimelineError]", exportAs: ["cngxTimelineError"], ngImport: i0 });
1059
+ }
1060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineError, decorators: [{
1061
+ type: Directive,
1062
+ args: [{
1063
+ selector: 'ng-template[cngxTimelineError]',
1064
+ standalone: true,
1065
+ exportAs: 'cngxTimelineError',
1066
+ }]
1067
+ }] });
1068
+ /**
1069
+ * Just the retry control inside the default error surface, for apps that
1070
+ * want their own button component without rewriting the error copy.
1071
+ *
1072
+ * Whatever renders here has to be operable: the library ships no button
1073
+ * component, so a consumer template is responsible for its own `type`,
1074
+ * accessible name and click wiring.
1075
+ *
1076
+ * ```html
1077
+ * <ng-template cngxTimelineRetryButton let-retry>
1078
+ * <button type="button" (click)="retry()">Try again</button>
1079
+ * </ng-template>
1080
+ * ```
1081
+ *
1082
+ * @category common/timeline
1083
+ * @wcag AA
1084
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
1085
+ * @relatedTo CngxTimelineError
1086
+ * @since 0.1.0
1087
+ */
1088
+ class CngxTimelineRetryButton {
1089
+ templateRef = inject(TemplateRef);
1090
+ static ngTemplateContextGuard(_dir, ctx) {
1091
+ return true;
1092
+ }
1093
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineRetryButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1094
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineRetryButton, isStandalone: true, selector: "ng-template[cngxTimelineRetryButton]", exportAs: ["cngxTimelineRetryButton"], ngImport: i0 });
1095
+ }
1096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineRetryButton, decorators: [{
1097
+ type: Directive,
1098
+ args: [{
1099
+ selector: 'ng-template[cngxTimelineRetryButton]',
1100
+ standalone: true,
1101
+ exportAs: 'cngxTimelineRetryButton',
1102
+ }]
1103
+ }] });
1104
+ /**
1105
+ * The tail appended below the list while a background refresh runs, with
1106
+ * the already-loaded items still on screen. Falls back to
1107
+ * `CNGX_TIMELINE_CONFIG.labels.refreshing`.
1108
+ *
1109
+ * Contextless on purpose - a refresh has nothing to say beyond the fact
1110
+ * that it is happening.
1111
+ *
1112
+ * @category common/timeline
1113
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
1114
+ * @relatedTo CngxTimelineError
1115
+ * @since 0.1.0
1116
+ */
1117
+ class CngxTimelineLoadingTail {
1118
+ templateRef = inject(TemplateRef);
1119
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineLoadingTail, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1120
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineLoadingTail, isStandalone: true, selector: "ng-template[cngxTimelineLoadingTail]", exportAs: ["cngxTimelineLoadingTail"], ngImport: i0 });
1121
+ }
1122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineLoadingTail, decorators: [{
1123
+ type: Directive,
1124
+ args: [{
1125
+ selector: 'ng-template[cngxTimelineLoadingTail]',
1126
+ standalone: true,
1127
+ exportAs: 'cngxTimelineLoadingTail',
1128
+ }]
1129
+ }] });
1130
+ /**
1131
+ * One placeholder row in the first-load body, replacing the built-in
1132
+ * marker-rail-and-two-bars shape. Rendered `[skeletonRowCount]` times.
1133
+ *
1134
+ * Contextless, and deliberately so: a placeholder stands in for a row whose
1135
+ * data has not arrived, so there is nothing to hand it. Bind this when the
1136
+ * real rows are taller or busier than the default shape and the swap to
1137
+ * content would otherwise reflow the page.
1138
+ *
1139
+ * Whatever renders here sits inside an `aria-hidden` wrapper - the load is
1140
+ * announced through the timeline's live region, not through the placeholder.
1141
+ *
1142
+ * @category common/timeline
1143
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/timeline/template-slots.ts
1144
+ * @relatedTo CngxTimelineLoadingTail
1145
+ * @since 0.1.0
1146
+ */
1147
+ class CngxTimelineSkeleton {
1148
+ templateRef = inject(TemplateRef);
1149
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineSkeleton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1150
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxTimelineSkeleton, isStandalone: true, selector: "ng-template[cngxTimelineSkeleton]", exportAs: ["cngxTimelineSkeleton"], ngImport: i0 });
1151
+ }
1152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimelineSkeleton, decorators: [{
1153
+ type: Directive,
1154
+ args: [{
1155
+ selector: 'ng-template[cngxTimelineSkeleton]',
1156
+ standalone: true,
1157
+ exportAs: 'cngxTimelineSkeleton',
1158
+ }]
1159
+ }] });
1160
+
1161
+ /**
1162
+ * @module @cngx/common/timeline
1163
+ */
1164
+
1165
+ /**
1166
+ * Generated bundle index. Do not edit.
1167
+ */
1168
+
1169
+ 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 };
1170
+ //# sourceMappingURL=cngx-common-timeline.mjs.map