@cngx/ui 0.1.0-rc.5 → 0.1.0-rc.7

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 (79) hide show
  1. package/README.md +112 -0
  2. package/a11y/README.md +81 -0
  3. package/context-menu/README.md +98 -0
  4. package/data-grid-accordion/README.md +27 -0
  5. package/feedback/README.md +2 -0
  6. package/fesm2022/cngx-ui-a11y.mjs +320 -0
  7. package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
  8. package/fesm2022/cngx-ui-accordion.mjs +19 -8
  9. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  10. package/fesm2022/cngx-ui-action-button.mjs +5 -2
  11. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  12. package/fesm2022/cngx-ui-breadcrumb.mjs +11 -6
  13. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  14. package/fesm2022/cngx-ui-chart-panel.mjs +429 -0
  15. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
  16. package/fesm2022/cngx-ui-collection.mjs +15 -6
  17. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-command-palette.mjs +1005 -0
  19. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-context-menu.mjs +742 -0
  21. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
  22. package/fesm2022/cngx-ui-data-grid-accordion.mjs +90 -20
  23. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  24. package/fesm2022/cngx-ui-feedback.mjs +97 -106
  25. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  26. package/fesm2022/cngx-ui-layout.mjs +18 -9
  27. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  28. package/fesm2022/cngx-ui-mat-accordion.mjs +9 -9
  29. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  30. package/fesm2022/cngx-ui-mat-tabs.mjs +64 -70
  31. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-ui-paginator.mjs +18 -8
  33. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  34. package/fesm2022/cngx-ui-sidenav.mjs +2 -2
  35. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  36. package/fesm2022/cngx-ui-skeleton.mjs +20 -7
  37. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  38. package/fesm2022/cngx-ui-speak.mjs +2 -2
  39. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  40. package/fesm2022/cngx-ui-stat-card.mjs +618 -0
  41. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
  42. package/fesm2022/cngx-ui-stepper.mjs +38 -19
  43. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  44. package/fesm2022/cngx-ui-tabs.mjs +36 -19
  45. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  46. package/fesm2022/cngx-ui-timeline.mjs +495 -0
  47. package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
  48. package/fesm2022/cngx-ui-toc.mjs +704 -0
  49. package/fesm2022/cngx-ui-toc.mjs.map +1 -0
  50. package/fesm2022/cngx-ui.mjs +2 -2
  51. package/fesm2022/cngx-ui.mjs.map +1 -1
  52. package/mat-accordion/README.md +1 -1
  53. package/mat-tabs/styles/mat-tabs.css +20 -17
  54. package/package.json +32 -1
  55. package/skeleton/README.md +2 -0
  56. package/stepper/README.md +2 -2
  57. package/timeline/README.md +350 -0
  58. package/toc/README.md +183 -0
  59. package/types/cngx-ui-a11y.d.ts +303 -0
  60. package/types/cngx-ui-accordion.d.ts +9 -4
  61. package/types/cngx-ui-action-button.d.ts +3 -0
  62. package/types/cngx-ui-breadcrumb.d.ts +5 -0
  63. package/types/cngx-ui-chart-panel.d.ts +278 -0
  64. package/types/cngx-ui-collection.d.ts +12 -3
  65. package/types/cngx-ui-command-palette.d.ts +451 -0
  66. package/types/cngx-ui-context-menu.d.ts +467 -0
  67. package/types/cngx-ui-data-grid-accordion.d.ts +72 -15
  68. package/types/cngx-ui-feedback.d.ts +71 -18
  69. package/types/cngx-ui-layout.d.ts +8 -3
  70. package/types/cngx-ui-mat-accordion.d.ts +3 -3
  71. package/types/cngx-ui-mat-tabs.d.ts +11 -9
  72. package/types/cngx-ui-paginator.d.ts +13 -3
  73. package/types/cngx-ui-skeleton.d.ts +13 -1
  74. package/types/cngx-ui-stat-card.d.ts +327 -0
  75. package/types/cngx-ui-stepper.d.ts +18 -4
  76. package/types/cngx-ui-tabs.d.ts +20 -4
  77. package/types/cngx-ui-timeline.d.ts +479 -0
  78. package/types/cngx-ui-toc.d.ts +514 -0
  79. package/types/cngx-ui.d.ts +1 -1
@@ -0,0 +1,495 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { computed, InjectionToken, inject, input, output, contentChild, isDevMode, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { resolveAsyncView, createForwardedAsyncState } from '@cngx/common/data';
5
+ import { injectTimelineConfig, CNGX_TIMELINE_GROUPING_FACTORY, CngxTimelineItemTpl, CngxTimelineDateHeader, CngxTimelineMarkerTpl, CngxTimelineEmpty, CngxTimelineError, CngxTimelineRetryButton, CngxTimelineLoadingTail, CngxTimelineSkeleton, CNGX_TIMELINE_MARKER_HOST } from '@cngx/common/timeline';
6
+ import { nextUid, CNGX_STATEFUL } from '@cngx/core/utils';
7
+ import { CngxSkeletonContainer, CngxSkeletonPlaceholder } from '@cngx/ui/skeleton';
8
+
9
+ /**
10
+ * The family-standard three-stage template cascade, as one named concept:
11
+ *
12
+ * ```text
13
+ * instance contentChild -> CNGX_*_CONFIG.templates.<key> -> null
14
+ * ```
15
+ *
16
+ * The `contentChild()` query itself has to stay a direct field initialiser
17
+ * on the component (AOT rejects it from a helper, NG8110), but resolving the
18
+ * three tiers does not - and writing that resolution out once per slot turns
19
+ * a single rule into eight places it can drift.
20
+ *
21
+ * `configured` is a thunk rather than a value so the config tier is read at
22
+ * resolution time, inside the `computed()`.
23
+ *
24
+ * Exported because an ejected skin resolves the same three tiers and would
25
+ * otherwise have to restate the rule.
26
+ *
27
+ * @category ui/timeline
28
+ * @relatedTo createTimelineSlots
29
+ * @since 0.1.0
30
+ */
31
+ function createTimelineSlotBinding(instance, configured) {
32
+ return computed(() => instance()?.templateRef ?? configured() ?? null);
33
+ }
34
+ /**
35
+ * Runs {@link createTimelineSlotBinding} over the whole slot set at once, so
36
+ * the organism holds one field instead of eight near-identical ones and each
37
+ * region has exactly one call site.
38
+ *
39
+ * The casts live here rather than at eight use sites: `CngxTimelineTemplates`
40
+ * is typed against `unknown` items because the config is app-wide while the
41
+ * slots are generic. `TemplateRef` is method-bivariant, so a consumer's
42
+ * concrete template still assigns in.
43
+ *
44
+ * @category ui/timeline
45
+ * @relatedTo createTimelineSlotBinding
46
+ * @since 0.1.0
47
+ */
48
+ function createTimelineSlots(queries, templates) {
49
+ const pick = (key) => templates()?.[key];
50
+ return {
51
+ item: createTimelineSlotBinding(queries.item, () => pick('item')),
52
+ dateHeader: createTimelineSlotBinding(queries.dateHeader, () => pick('dateHeader')),
53
+ marker: createTimelineSlotBinding(queries.marker, () => pick('marker')),
54
+ empty: createTimelineSlotBinding(queries.empty, () => pick('empty')),
55
+ error: createTimelineSlotBinding(queries.error, () => pick('error')),
56
+ retryButton: createTimelineSlotBinding(queries.retryButton, () => pick('retryButton')),
57
+ loadingTail: createTimelineSlotBinding(queries.loadingTail, () => pick('loadingTail')),
58
+ skeleton: createTimelineSlotBinding(queries.skeleton, () => pick('skeleton')),
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Flattens the config's optional label bag into the exact set the template
64
+ * reads, so the template names what it wants rather than indexing a keyed
65
+ * accessor, and the optional-chaining lives in one place instead of at every
66
+ * use site.
67
+ *
68
+ * `groupLabel` keeps the band's key as its own last resort: a consumer who
69
+ * clears the formatter should still get a legible header rather than an
70
+ * empty one that leaves the group unnamed.
71
+ *
72
+ * @category ui/timeline
73
+ * @since 0.1.0
74
+ */
75
+ function createTimelineFallbackCopy(config) {
76
+ const labels = config.labels;
77
+ return {
78
+ retry: labels?.retry ?? '',
79
+ errorFallback: labels?.errorFallback ?? '',
80
+ emptyFallback: labels?.emptyFallback ?? '',
81
+ loading: labels?.loading ?? '',
82
+ refreshing: labels?.refreshing ?? '',
83
+ groupLabel: (group) => labels?.groupLabel?.(group) ?? group.key,
84
+ };
85
+ }
86
+
87
+ /**
88
+ * Derives the whole body switch from one bound state. No second state
89
+ * machine, no boolean fallback inputs - every branch is a `computed()` over
90
+ * `resolveAsyncView`, the same lookup table the rest of cngx switches on.
91
+ *
92
+ * Two cases the lookup table does not cover on its own:
93
+ *
94
+ * - **No state bound.** The timeline is then a plain list over `[items]`,
95
+ * but an empty one still has to reach the empty surface; otherwise
96
+ * `*cngxTimelineEmpty` would be unreachable on the synchronous path.
97
+ * - **The announcement.** Only `loading` and `refreshing` have anything to
98
+ * say, and the string is empty otherwise so the live region stays in the
99
+ * DOM while staying silent.
100
+ * - **Busy with an empty screen.** The lookup table resolves a non-first-load
101
+ * `loading` or `pending` to `content`; with no rows that renders nothing at
102
+ * all, so it is treated as a load instead. `refreshing` keeps its tail.
103
+ *
104
+ * Swap the whole mapping through {@link CNGX_TIMELINE_VIEW_FACTORY} rather
105
+ * than forking the organism - treating `pending` as content, or holding the
106
+ * skeleton through a refresh, is a per-app decision.
107
+ *
108
+ * @category ui/timeline
109
+ * @relatedTo CNGX_TIMELINE_VIEW_FACTORY
110
+ * @since 0.1.0
111
+ */
112
+ function createTimelineView(state, isEmpty, labels) {
113
+ const activeView = computed(() => {
114
+ const empty = isEmpty();
115
+ const bound = state();
116
+ if (!bound) {
117
+ return empty ? 'empty' : 'content';
118
+ }
119
+ const view = resolveAsyncView(bound.status(), bound.isFirstLoad(), empty);
120
+ // `loading` and `pending` that are not a first load resolve to `content`,
121
+ // and with nothing to render that is a blank, silent region: no rows, no
122
+ // tail, nothing announced. Work in flight with an empty screen is a load.
123
+ // `refreshing` is deliberately excluded - it already renders its tail and
124
+ // announces itself, so it is communicated, just sparse.
125
+ const silentlyBusy = empty && bound.isBusy() && !bound.isRefreshing();
126
+ return view === 'content' && silentlyBusy ? 'skeleton' : view;
127
+ }, ...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
128
+ const showsContent = computed(() => activeView() === 'content' || activeView() === 'content+error', ...(ngDevMode ? [{ debugName: "showsContent" }] : /* istanbul ignore next */ []));
129
+ const refreshing = computed(() => showsContent() && (state()?.isRefreshing() ?? false), ...(ngDevMode ? [{ debugName: "refreshing" }] : /* istanbul ignore next */ []));
130
+ return {
131
+ activeView,
132
+ showsContent,
133
+ refreshing,
134
+ ariaBusy: computed(() => (state()?.isBusy() ? 'true' : null)),
135
+ announcement: computed(() => {
136
+ const view = activeView();
137
+ if (view === 'skeleton') {
138
+ return labels.loading;
139
+ }
140
+ // The built-in error surface carries its own role="alert", but a bound
141
+ // *cngxTimelineError replaces that markup wholesale. Announcing here
142
+ // means the failure reaches AT whether or not the slot is bound.
143
+ if (view === 'error' || view === 'content+error') {
144
+ return labels.errorFallback;
145
+ }
146
+ return refreshing() ? labels.refreshing : '';
147
+ }),
148
+ };
149
+ }
150
+ /**
151
+ * Swap point for the body-view mapping. Override it to reshape when the
152
+ * timeline shows a skeleton, content, the empty surface or the error
153
+ * surface - enterprise-wide or per component - without forking the organism.
154
+ *
155
+ * The mapping is genuinely per-app: whether a `pending` refetch keeps its
156
+ * rows on screen, whether a background failure surfaces inline or is
157
+ * swallowed until the next settle, and whether an empty result after a
158
+ * filter reads as empty at all are product decisions, not library ones.
159
+ *
160
+ * ```ts
161
+ * providers: [
162
+ * {
163
+ * provide: CNGX_TIMELINE_VIEW_FACTORY,
164
+ * useValue: ((state, isEmpty, labels) => {
165
+ * const base = createTimelineView(state, isEmpty, labels);
166
+ * // Hold the rows through every refetch, never fall back to placeholders.
167
+ * return { ...base, activeView: computed(() => (base.activeView() === 'skeleton' && state()?.hasData() ? 'content' : base.activeView())) };
168
+ * }) satisfies CngxTimelineViewFactory,
169
+ * },
170
+ * ]
171
+ * ```
172
+ *
173
+ * @category ui/timeline
174
+ * @relatedTo createTimelineView
175
+ * @since 0.1.0
176
+ */
177
+ const CNGX_TIMELINE_VIEW_FACTORY = new InjectionToken('CNGX_TIMELINE_VIEW_FACTORY', { providedIn: 'root', factory: () => createTimelineView });
178
+
179
+ /**
180
+ * Grouped, themed, RTL-safe timeline over a flat list of events.
181
+ *
182
+ * Data in, rows out: bind `[items]` and a `[dateAccessor]`, project one
183
+ * `*cngxTimelineItem` template, and the organism buckets, sorts and renders
184
+ * the rest. Bucketing is not its own code - it resolves
185
+ * {@link CNGX_TIMELINE_GROUPING_FACTORY} and derives everything from one
186
+ * `computed()`, so an app can swap in fiscal quarters or server-supplied
187
+ * grouping without forking the component.
188
+ *
189
+ * **ARIA.** One chain in two configurations, both derived rather than set:
190
+ * grouped is `group` -> `list` -> `listitem`, one list per band named by its
191
+ * date header, so a screen reader counts items per band rather than across
192
+ * the whole history. The header sits beside that list, never inside it - a
193
+ * list may own nothing but `listitem`, and the header is a consumer slot.
194
+ * `groupBy="none"` moves `list` up to the container and collapses the chain
195
+ * to `list` -> `listitem`.
196
+ *
197
+ * **Not keyboard-navigable, deliberately.** v1 items are content, not
198
+ * widgets - links and buttons *inside* a row are natively tabbable in DOM
199
+ * order, which is the right behaviour for a read-only history. Roving
200
+ * tabindex becomes mandatory the moment a row is selectable, and that is a
201
+ * v2 concern.
202
+ *
203
+ * ```html
204
+ * <cngx-timeline [items]="events()" [dateAccessor]="at" groupBy="day">
205
+ * <ng-template [cngxTimelineItem]="events()" let-event let-last="last">
206
+ * <cngx-timeline-item [position]="last ? 'last' : 'middle'">
207
+ * <cngx-time cngxTimelineTime [date]="event.at" />
208
+ * <p>{{ event.summary }}</p>
209
+ * </cngx-timeline-item>
210
+ * </ng-template>
211
+ * </cngx-timeline>
212
+ * ```
213
+ *
214
+ * @category ui/timeline
215
+ * @docsKind primary
216
+ * @wcag AA
217
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/timeline/timeline.component.ts
218
+ * @relatedTo CngxTimelineItem, CngxTimelineItemTpl, CNGX_TIMELINE_GROUPING_FACTORY, CNGX_TIMELINE_CONFIG
219
+ * @slot cngxTimelineItem Renders one event row; gets the event plus first/last/index flags.
220
+ * @slot cngxTimelineMarkerTpl Replaces a row's marker; takes precedence over a projected marker element.
221
+ * @slot cngxTimelineDateHeader Replaces a band's date caption; gets the band date.
222
+ * @slot cngxTimelineSkeleton Replaces the placeholder rows drawn during the first load.
223
+ * @slot cngxTimelineEmpty Rendered when no event resolves; gets the reason from [emptyReason].
224
+ * @slot cngxTimelineError Rendered when the load fails; gets the error and a retry callback.
225
+ * @slot cngxTimelineRetryButton Replaces the retry control on the error surface.
226
+ * @slot cngxTimelineLoadingTail Rendered below the rows while more history streams in.
227
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/flat-array</example-url>
228
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/group-by-week</example-url>
229
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/direction</example-url>
230
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/ungrouped</example-url>
231
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/horizontal</example-url>
232
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/alternating-infographic</example-url>
233
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/opposite-time</example-url>
234
+ * <example-url>http://localhost:4200/#/ui/timeline/integration/data-source</example-url>
235
+ * <example-url>http://localhost:4200/#/ui/timeline/integration/scroll-spy-nav</example-url>
236
+ * <example-url>http://localhost:4200/#/ui/timeline/async/error-retry</example-url>
237
+ * <example-url>http://localhost:4200/#/ui/timeline/async/refreshing-tail</example-url>
238
+ * <example-url>http://localhost:4200/#/ui/timeline/skins/activity-vs-narrative</example-url>
239
+ * @since 0.1.0
240
+ */
241
+ class CngxTimeline {
242
+ config = injectTimelineConfig();
243
+ groupingFactory = inject(CNGX_TIMELINE_GROUPING_FACTORY);
244
+ uid = nextUid('cngx-timeline');
245
+ /**
246
+ * The flat event list. Order is irrelevant - the presenter sorts.
247
+ *
248
+ * A bound `[state]` supplies the rows instead as soon as it *has* data;
249
+ * until then these are still used, so binding both is a legitimate way to
250
+ * render a seed list while the first load runs. Note that the body still
251
+ * follows the state, so an `idle` state renders nothing whatever `[items]`
252
+ * holds.
253
+ */
254
+ items = input([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
255
+ /**
256
+ * The list's async state. Wins over `[items]`, and drives the whole body:
257
+ * skeleton on first load, error surface with a retry, empty surface, and a
258
+ * refreshing tail over content that stays on screen.
259
+ *
260
+ * Also republished through `CNGX_STATEFUL`, so a transition bridge inside
261
+ * the timeline needs no binding of its own.
262
+ */
263
+ state = input(undefined, { ...(ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {}), transform: (value) => (typeof value === 'string' ? undefined : value) });
264
+ /**
265
+ * Why the timeline is empty, forwarded to `*cngxTimelineEmpty`. The
266
+ * organism cannot infer this - only the consumer knows whether a filter
267
+ * cleared the list or nothing has happened yet.
268
+ */
269
+ emptyReason = input('first-use', ...(ngDevMode ? [{ debugName: "emptyReason" }] : /* istanbul ignore next */ []));
270
+ /**
271
+ * How many placeholder rows the loading body draws. Match it to the usual
272
+ * length so the skeleton reserves roughly the space the content will take.
273
+ */
274
+ skeletonRowCount = input(3, ...(ngDevMode ? [{ debugName: "skeletonRowCount" }] : /* istanbul ignore next */ []));
275
+ /** Fires when the consumer asks to retry a failed load. */
276
+ retry = output();
277
+ /**
278
+ * Pulls the timestamp out of an event. Anything the `Date` constructor
279
+ * accepts, so ISO strings off an API response need no pre-mapping.
280
+ */
281
+ dateAccessor = input.required(...(ngDevMode ? [{ debugName: "dateAccessor" }] : /* istanbul ignore next */ []));
282
+ /**
283
+ * Stable event identity, used as the `@for` track expression so a row
284
+ * keeps its DOM across a refetch instead of being torn down and rebuilt.
285
+ *
286
+ * It deliberately does *not* drive band reuse: a refetch returns new
287
+ * objects at the same ids, and reusing a band on an id match would pin it
288
+ * to the old payload.
289
+ */
290
+ idAccessor = input(undefined, ...(ngDevMode ? [{ debugName: "idAccessor" }] : /* istanbul ignore next */ []));
291
+ /**
292
+ * Bucketing. `'day'` (default), `'week'`, `'month'`, `'none'` for a flat
293
+ * ungrouped list, or a custom function for anything else.
294
+ */
295
+ groupBy = input('day', ...(ngDevMode ? [{ debugName: "groupBy" }] : /* istanbul ignore next */ []));
296
+ /** `'desc'` (default) is newest-first; `'asc'` reads oldest-first. */
297
+ direction = input('desc', ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
298
+ /** Row raster. See {@link CngxTimelineMode}. */
299
+ mode = input('narrative', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
300
+ /** Visual skin. See {@link CngxTimelineSkin}. */
301
+ skin = input('line', ...(ngDevMode ? [{ debugName: "skin" }] : /* istanbul ignore next */ []));
302
+ /** Which side of the rail rows sit on. See {@link CngxTimelinePlacement}. */
303
+ placement = input('start', ...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
304
+ /** Whether the rail breaks between rows. See {@link CngxTimelineRail}. */
305
+ rail = input('segmented', ...(ngDevMode ? [{ debugName: "rail" }] : /* istanbul ignore next */ []));
306
+ /** Which axis the run reads along. See {@link CngxTimelineOrientation}. */
307
+ orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
308
+ /** Accessible name for the list. Falls back to the config's `timelineRegion`. */
309
+ ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
310
+ /** Names the list from existing markup instead. Wins over `aria-label`. */
311
+ ariaLabelledBy = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
312
+ // Direct field initialisers, not a registry factory: AOT (NG8110) rejects
313
+ // contentChild from a helper.
314
+ itemSlot = contentChild(CngxTimelineItemTpl, ...(ngDevMode ? [{ debugName: "itemSlot" }] : /* istanbul ignore next */ []));
315
+ dateHeaderSlot = contentChild(CngxTimelineDateHeader, ...(ngDevMode ? [{ debugName: "dateHeaderSlot" }] : /* istanbul ignore next */ []));
316
+ markerSlot = contentChild(CngxTimelineMarkerTpl, ...(ngDevMode ? [{ debugName: "markerSlot" }] : /* istanbul ignore next */ []));
317
+ emptySlot = contentChild(CngxTimelineEmpty, ...(ngDevMode ? [{ debugName: "emptySlot" }] : /* istanbul ignore next */ []));
318
+ errorSlot = contentChild(CngxTimelineError, ...(ngDevMode ? [{ debugName: "errorSlot" }] : /* istanbul ignore next */ []));
319
+ retryButtonSlot = contentChild(CngxTimelineRetryButton, ...(ngDevMode ? [{ debugName: "retryButtonSlot" }] : /* istanbul ignore next */ []));
320
+ loadingTailSlot = contentChild(CngxTimelineLoadingTail, ...(ngDevMode ? [{ debugName: "loadingTailSlot" }] : /* istanbul ignore next */ []));
321
+ skeletonSlot = contentChild(CngxTimelineSkeleton, ...(ngDevMode ? [{ debugName: "skeletonSlot" }] : /* istanbul ignore next */ []));
322
+ /** @internal The list the presenter groups: bound state first, then `[items]`. */
323
+ resolvedItems = computed(() => this.state()?.data() ?? this.items(), ...(ngDevMode ? [{ debugName: "resolvedItems" }] : /* istanbul ignore next */ []));
324
+ grouping = this.groupingFactory({
325
+ items: this.resolvedItems,
326
+ dateAccessor: (item) => this.dateAccessor()(item),
327
+ groupBy: this.groupBy,
328
+ direction: this.direction,
329
+ });
330
+ /** The derived bands, in sort order. */
331
+ groups = this.grouping.groups;
332
+ /** @internal Eight slots, one cascade rule, resolved in one place. */
333
+ slots = createTimelineSlots({
334
+ item: this.itemSlot,
335
+ dateHeader: this.dateHeaderSlot,
336
+ marker: this.markerSlot,
337
+ empty: this.emptySlot,
338
+ error: this.errorSlot,
339
+ retryButton: this.retryButtonSlot,
340
+ loadingTail: this.loadingTailSlot,
341
+ skeleton: this.skeletonSlot,
342
+ }, () => this.config.templates);
343
+ itemTpl = this.slots.item;
344
+ dateHeaderTpl = this.slots.dateHeader;
345
+ /** Public: this is the `CNGX_TIMELINE_MARKER_HOST` contract the rows read. */
346
+ markerTpl = this.slots.marker;
347
+ emptyTpl = this.slots.empty;
348
+ errorTpl = this.slots.error;
349
+ retryButtonTpl = this.slots.retryButton;
350
+ loadingTailTpl = this.slots.loadingTail;
351
+ skeletonTpl = this.slots.skeleton;
352
+ /**
353
+ * Forwarding façade over the bound `[state]`, published through
354
+ * `CNGX_STATEFUL`. Every member delegates, so swapping the bound state (or
355
+ * binding none at all) never leaves a bridge holding a stale object.
356
+ */
357
+ asyncState = createForwardedAsyncState(this.state);
358
+ /** @internal Fallback copy for every surface with no slot bound. */
359
+ labels = createTimelineFallbackCopy(this.config);
360
+ /** @internal The body switch, the busy flag and the live-region text. */
361
+ view = inject(CNGX_TIMELINE_VIEW_FACTORY)(this.state, () => this.groups().length === 0, this.labels);
362
+ activeView = this.view.activeView;
363
+ showsContent = this.view.showsContent;
364
+ refreshing = this.view.refreshing;
365
+ ariaBusy = this.view.ariaBusy;
366
+ announcement = this.view.announcement;
367
+ /** @internal Passed into the error and retry-button slot contexts. */
368
+ emitRetry = () => this.retry.emit();
369
+ /**
370
+ * @internal `groupBy: 'none'` still produces one synthetic band from the
371
+ * presenter, so the ungrouped configuration is a rendering decision here
372
+ * rather than a second data path.
373
+ */
374
+ ungrouped = computed(() => this.groupBy() === 'none', ...(ngDevMode ? [{ debugName: "ungrouped" }] : /* istanbul ignore next */ []));
375
+ /** @internal Grouped is `group -> list -> listitem`: one list per band. */
376
+ containerRole = computed(() => (this.ungrouped() ? 'list' : 'group'), ...(ngDevMode ? [{ debugName: "containerRole" }] : /* istanbul ignore next */ []));
377
+ /** @internal Generic when grouped so the header may sit beside the rows. */
378
+ wrapperRole = computed(() => (this.ungrouped() ? 'presentation' : null), ...(ngDevMode ? [{ debugName: "wrapperRole" }] : /* istanbul ignore next */ []));
379
+ /** @internal The rows are the list, so it owns only `listitem` children. */
380
+ rowsRole = computed(() => (this.ungrouped() ? 'presentation' : 'list'), ...(ngDevMode ? [{ debugName: "rowsRole" }] : /* istanbul ignore next */ []));
381
+ /** @internal Config fallback only applies when nothing was named explicitly. */
382
+ listLabel = computed(() => this.ariaLabelledBy() ? null : (this.ariaLabel() ?? this.config.labels?.timelineRegion ?? null), ...(ngDevMode ? [{ debugName: "listLabel" }] : /* istanbul ignore next */ []));
383
+ /** @internal A group is named by its own header element, keyed on position. */
384
+ groupLabelId(index) {
385
+ return `${this.uid}-group-${index}`;
386
+ }
387
+ /** @internal Row context. `first` / `last` are positions within the group. */
388
+ itemContext(item, index, group) {
389
+ return {
390
+ $implicit: item,
391
+ index,
392
+ first: index === 0,
393
+ last: index === group.items.length - 1,
394
+ group,
395
+ };
396
+ }
397
+ /**
398
+ * @internal Which side this row's body sits on. Derived from the loop
399
+ * index, never from `:nth-child`: a filtered or refetched list has to
400
+ * alternate by its own position in the rendered run, and CSS structural
401
+ * parity would count DOM children instead. The row stylesheet reads the
402
+ * resulting `[data-row-side]` off an ancestor, exactly like `[data-mode]`.
403
+ *
404
+ * The built-in skeleton placeholder calls this with the index its own
405
+ * container hands it, so the loading rows land on the same sides the
406
+ * content will - which is what keeps the swap from reflowing.
407
+ */
408
+ rowSide(index) {
409
+ const placement = this.placement();
410
+ if (placement !== 'alternate') {
411
+ return placement;
412
+ }
413
+ // Alternating a scan-feed defeats the scan; the warning below says so.
414
+ if (this.mode() === 'activity') {
415
+ return 'start';
416
+ }
417
+ return index % 2 === 0 ? 'start' : 'end';
418
+ }
419
+ /** @internal Track by consumer identity when given, else by reference. */
420
+ trackItem = (index, item) => this.idAccessor()?.(item) ?? item;
421
+ constructor() {
422
+ if (isDevMode()) {
423
+ // afterNextRender, not an effect: this is a one-shot authoring check,
424
+ // and a dead node in the reactive graph is worse than a missed
425
+ // re-check after a runtime mode swap nobody does.
426
+ afterNextRender(() => {
427
+ if (this.mode() === 'activity' && this.placement() === 'alternate') {
428
+ console.warn('[cngx-timeline] placement="alternate" is ignored in mode="activity" - ' +
429
+ 'alternating a scan-feed defeats the scan, so every row renders at the ' +
430
+ 'start side. Use mode="narrative" to alternate.');
431
+ }
432
+ });
433
+ }
434
+ }
435
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimeline, deps: [], target: i0.ɵɵFactoryTarget.Component });
436
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTimeline, isStandalone: true, selector: "cngx-timeline", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, emptyReason: { classPropertyName: "emptyReason", publicName: "emptyReason", isSignal: true, isRequired: false, transformFunction: null }, skeletonRowCount: { classPropertyName: "skeletonRowCount", publicName: "skeletonRowCount", isSignal: true, isRequired: false, transformFunction: null }, dateAccessor: { classPropertyName: "dateAccessor", publicName: "dateAccessor", isSignal: true, isRequired: true, transformFunction: null }, idAccessor: { classPropertyName: "idAccessor", publicName: "idAccessor", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, skin: { classPropertyName: "skin", publicName: "skin", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, rail: { classPropertyName: "rail", publicName: "rail", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retry: "retry" }, host: { properties: { "attr.data-mode": "mode()", "attr.data-skin": "skin()", "attr.data-placement": "placement()", "attr.data-rail": "rail()", "attr.data-orientation": "orientation()", "attr.data-ungrouped": "ungrouped() ? \"\" : null", "attr.aria-label": "null", "attr.aria-labelledby": "null" }, classAttribute: "cngx-timeline" }, providers: [
437
+ // The rows render their own markers, so an app-wide marker template can
438
+ // only reach them through a contract. A token, never the class itself:
439
+ // a row has to stay usable with no timeline above it.
440
+ { provide: CNGX_TIMELINE_MARKER_HOST, useExisting: CngxTimeline },
441
+ {
442
+ // Re-exposes whatever is bound to [state] so CngxToastOn / CngxAlertOn /
443
+ // CngxBannerOn attach with no wiring at all. It cannot be `useExisting`
444
+ // like the select family's: there the state is a concrete field, here it
445
+ // arrives through an Input that can change or be absent, so the façade
446
+ // below forwards each signal instead of capturing one object.
447
+ provide: CNGX_STATEFUL,
448
+ useFactory: () => ({
449
+ state: inject(CngxTimeline).asyncState,
450
+ }),
451
+ },
452
+ ], queries: [{ propertyName: "itemSlot", first: true, predicate: CngxTimelineItemTpl, descendants: true, isSignal: true }, { propertyName: "dateHeaderSlot", first: true, predicate: CngxTimelineDateHeader, descendants: true, isSignal: true }, { propertyName: "markerSlot", first: true, predicate: CngxTimelineMarkerTpl, descendants: true, isSignal: true }, { propertyName: "emptySlot", first: true, predicate: CngxTimelineEmpty, descendants: true, isSignal: true }, { propertyName: "errorSlot", first: true, predicate: CngxTimelineError, descendants: true, isSignal: true }, { propertyName: "retryButtonSlot", first: true, predicate: CngxTimelineRetryButton, descendants: true, isSignal: true }, { propertyName: "loadingTailSlot", first: true, predicate: CngxTimelineLoadingTail, descendants: true, isSignal: true }, { propertyName: "skeletonSlot", first: true, predicate: CngxTimelineSkeleton, descendants: true, isSignal: true }], ngImport: i0, template: "@switch (activeView()) {\n @case ('skeleton') {\n <!-- The container owns show-delay and min-dwell, so a fast load never\n flashes and the timeline holds no latency logic. The placeholder\n reuses the item raster, so the swap to content cannot reflow. -->\n <!-- The class carries no rule on purpose: `<cngx-skeleton>` hosts itself\n with `display: contents` and has no box to style. It is the hook that\n makes the loading branch addressable from outside - tests and\n consumer overrides have nothing else to select on. -->\n <!-- [loading], not [state]: the container derives first-load from a bound\n state and would refuse to draw on a refetch that has nothing on\n screen, which is exactly the branch this case exists for. Reaching\n this branch at all IS the decision that a placeholder belongs here -\n activeView() already made it - so the flag is true by construction\n and the container is left owning only show-delay and min-dwell. -->\n <cngx-skeleton class=\"cngx-timeline__skeleton\" [loading]=\"true\" [count]=\"skeletonRowCount()\">\n <!-- let-index: the container has passed index/count/first/last into\n this template all along, the timeline just never read it. The\n built-in placeholder needs the per-row index to land on the same\n sides the content will, so the swap does not reflow under\n placement=\"end\" / \"alternate\". A consumer-supplied\n *cngxTimelineSkeleton is still outletted without context, which is\n unchanged and tracked. -->\n <ng-template cngxSkeletonPlaceholder let-index=\"index\">\n <!-- aria-hidden on the wrapper, not on the branches: whatever a\n consumer supplies is decoration too, and the load is announced\n through the live region at the bottom of this template. -->\n <div aria-hidden=\"true\">\n @if (skeletonTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\" />\n } @else {\n <!-- Own classes, not the row's. `CngxTimelineItem` is never\n imported here, so on a cold first load its Track-A stylesheet\n is not in the document yet and borrowed classes would render\n unstyled - on the one path the skeleton exists to cover. -->\n <div class=\"cngx-timeline__skeleton-row\" [attr.data-row-side]=\"rowSide(index)\">\n <span class=\"cngx-timeline__skeleton-marker\"></span>\n <span class=\"cngx-timeline__skeleton-rail\"></span>\n <div class=\"cngx-timeline__skeleton-body\">\n <span class=\"cngx-timeline__skeleton-line\"></span>\n <span\n class=\"cngx-timeline__skeleton-line cngx-timeline__skeleton-line--short\"\n ></span>\n </div>\n </div>\n }\n </div>\n </ng-template>\n </cngx-skeleton>\n }\n\n @case ('empty') {\n <div class=\"cngx-timeline__empty\">\n @if (emptyTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: emptyReason() }\" />\n } @else {\n {{ labels.emptyFallback }}\n }\n </div>\n }\n\n @case ('error') {\n <ng-container *ngTemplateOutlet=\"errorSurface\" />\n }\n}\n\n@if (showsContent() && groups().length) {\n <!-- aria-busy belongs on the element that owns the content, not on the\n role-less host, where AT would never read it. -->\n <div\n class=\"cngx-timeline__list\"\n [attr.role]=\"containerRole()\"\n [attr.aria-busy]=\"ariaBusy()\"\n [attr.aria-label]=\"listLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n >\n @for (group of groups(); track group.key) {\n <!-- Three elements per band, not two, and the middle one is why: a\n list may own nothing but listitems, so the header cannot sit\n inside it. The header is a consumer slot and the documented\n example is an <h3> - a real role, which axe rejects as a child of\n role=\"list\". So the band wrapper stays generic, the header sits\n beside the rows, and only the rows carry the list role. The rows\n element is what the header names, and what v2 wraps in a\n <details role=\"group\">.\n\n Ungrouped drops both wrappers to presentation rather than to no\n role at all: a generic div between the list and its rows still\n owns them and breaks listitem's required context - display:\n contents fixes the box tree, not this.\n\n The label id is keyed on $index, not on group.key: a custom\n TimelineGroupingFn is free to return \"today / this week / earlier\",\n and whitespace in an id makes this reference resolve to nothing,\n leaving the band unnamed. -->\n <div class=\"cngx-timeline__group\" [attr.role]=\"wrapperRole()\">\n @if (!ungrouped()) {\n <div class=\"cngx-timeline__date-header\" [id]=\"groupLabelId($index)\">\n @if (dateHeaderTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: group }\" />\n } @else {\n {{ labels.groupLabel(group) }}\n }\n </div>\n }\n\n <div\n class=\"cngx-timeline__rows\"\n [attr.role]=\"rowsRole()\"\n [attr.aria-labelledby]=\"ungrouped() ? null : groupLabelId($index)\"\n >\n @for (item of group.items; track trackItem($index, item)) {\n <!-- The side comes from the loop index, not from :nth-child: a\n filtered list has to alternate by its position in the run\n that is actually rendered, and the row stylesheet reads the\n attribute off an ancestor exactly like [data-mode]. -->\n <div class=\"cngx-timeline__item\" role=\"listitem\" [attr.data-row-side]=\"rowSide($index)\">\n @if (itemTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: itemContext(item, $index, group)\" />\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n}\n\n<!-- A refresh keeps the loaded rows on screen, so this tail is the only visible\n sign anything is happening. Outside the list, so it never reads as an\n event of its own. Decorative: the announcement is the live region below,\n which stays in the DOM whether or not there is anything to say. -->\n@if (refreshing()) {\n <div class=\"cngx-timeline__tail\" aria-hidden=\"true\">\n @if (loadingTailTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\" />\n } @else {\n {{ labels.refreshing }}\n }\n </div>\n}\n\n@if (activeView() === 'content+error') {\n <ng-container *ngTemplateOutlet=\"errorSurface\" />\n}\n\n<!-- Always in the DOM, content reactive - a region created together with its\n message is announced inconsistently or not at all. Empty whenever the\n timeline has nothing to report. -->\n<span aria-live=\"polite\" aria-atomic=\"true\" class=\"cngx-timeline__sr-only\">\n {{ announcement() }}\n</span>\n\n<ng-template #errorSurface>\n <div class=\"cngx-timeline__error\">\n @if (errorTpl(); as tpl) {\n <ng-container\n *ngTemplateOutlet=\"tpl; context: { $implicit: state()?.error(), retry: emitRetry }\"\n />\n } @else {\n <!-- The alert is the message alone. Wrapping the retry control in it\n too would re-announce the button on every mutation of the region. -->\n <p class=\"cngx-timeline__error-message\" role=\"alert\">{{ labels.errorFallback }}</p>\n @if (retryButtonTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: emitRetry }\" />\n } @else {\n <button class=\"cngx-timeline__retry\" type=\"button\" (click)=\"emitRetry()\">\n {{ labels.retry }}\n </button>\n }\n }\n </div>\n</ng-template>\n", styles: ["@layer cngx.tokens{@property --cngx-timeline-item-gap{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-timeline-group-gap{syntax: \"<length>\"; inherits: true; initial-value: 24px;}@property --cngx-timeline-surface-padding{syntax: \"<length>\"; inherits: true; initial-value: 4px;}@property --cngx-timeline-skeleton-line-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}}@layer cngx.components{@scope(.cngx-timeline){:scope{--cngx-timeline-item-gap: var(--cngx-space-md, 16px);--cngx-timeline-group-gap: var(--cngx-space-lg, 24px);--cngx-timeline-surface-padding: var(--cngx-space-xs, 4px);--cngx-timeline-gap: var(--cngx-space-sm, 8px);--cngx-timeline-row-gap: var(--cngx-space-xs, 4px);display:block;container-type:inline-size;container-name:cngx-timeline;color:var(--cngx-timeline-text-color, oklch(.2 .01 250))}.cngx-timeline__list{display:flex;flex-direction:column;gap:var(--cngx-timeline-group-gap, 24px)}.cngx-timeline__group,.cngx-timeline__rows{display:flex;flex-direction:column;gap:var(--cngx-timeline-item-gap, 16px)}.cngx-timeline__date-header{color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem);font-weight:600;line-height:1.4}.cngx-timeline__item{display:block}:scope[data-ungrouped] .cngx-timeline__group,:scope[data-ungrouped] .cngx-timeline__rows{display:contents}:scope[data-ungrouped] .cngx-timeline__list{gap:var(--cngx-timeline-item-gap, 16px)}.cngx-timeline__empty,.cngx-timeline__error,.cngx-timeline__tail{padding:var(--cngx-timeline-surface-padding, 4px)}.cngx-timeline__empty,.cngx-timeline__tail{color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem)}.cngx-timeline__sr-only{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.cngx-timeline__error-message{margin:0 0 var(--cngx-timeline-item-gap, 16px);color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}.cngx-timeline__skeleton-row{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);grid-template-areas:\"marker line\" \"rail body\";column-gap:var(--cngx-timeline-gap, 8px);row-gap:var(--cngx-timeline-row-gap, 4px)}.cngx-timeline__skeleton-row+.cngx-timeline__skeleton-row{margin-block-start:var(--cngx-timeline-item-gap, 16px)}.cngx-timeline__skeleton-row[data-row-side=end]{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:\"line marker\" \"body rail\"}:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"opposite marker line\" \"opposite rail body\"}:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row[data-row-side=end]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"line marker opposite\" \"body rail opposite\"}:scope[data-orientation=horizontal]{overflow-x:auto}:scope[data-orientation=horizontal] .cngx-timeline__list{flex-direction:row;align-items:start}:scope[data-orientation=horizontal] .cngx-timeline__group{flex:none}:scope[data-orientation=horizontal] .cngx-timeline__rows{flex-direction:row;align-items:stretch}:scope[data-orientation=horizontal] .cngx-timeline__skeleton{display:flex;flex-direction:row;gap:var(--cngx-timeline-item-gap, 16px)}:scope[data-orientation=horizontal] .cngx-timeline__skeleton-row{grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:\"marker rail\" \"line line\" \"body body\";inline-size:12rem}:scope[data-orientation=horizontal] .cngx-timeline__skeleton-row+.cngx-timeline__skeleton-row{margin-block-start:0}:scope[data-orientation=horizontal] .cngx-timeline__skeleton-rail{inline-size:100%;block-size:var(--cngx-timeline-connector-width, 2px);align-self:center;justify-self:stretch}@container cngx-timeline (max-inline-size: 32rem){:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row,:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row[data-row-side=end]{grid-template-columns:auto minmax(0,1fr);grid-template-areas:\"marker line\" \"rail body\"}}.cngx-timeline__skeleton-marker,.cngx-timeline__skeleton-rail{background:color-mix(in oklch,currentColor 14%,transparent)}.cngx-timeline__skeleton-marker{grid-area:marker;inline-size:var(--cngx-timeline-marker-size, 12px);block-size:var(--cngx-timeline-marker-size, 12px);border-radius:50%}.cngx-timeline__skeleton-rail{grid-area:rail;inline-size:var(--cngx-timeline-connector-width, 2px);block-size:100%;justify-self:center}.cngx-timeline__skeleton-body{grid-area:body;padding:var(--cngx-timeline-surface-padding, 4px);min-inline-size:0}.cngx-timeline__skeleton-line{display:block;block-size:var(--cngx-timeline-skeleton-line-size, 12px);border-radius:var(--cngx-radius-sm, 4px);background:color-mix(in oklch,currentColor 14%,transparent)}.cngx-timeline__skeleton-line+.cngx-timeline__skeleton-line{margin-block-start:var(--cngx-timeline-row-gap, 4px)}.cngx-timeline__skeleton-line--short{inline-size:60%}}.cngx-timeline[data-skin=card] .cngx-timeline-item__body{background:var(--cngx-timeline-surface, oklch(1 0 0));border:var(--cngx-timeline-connector-width, 2px) solid var(--cngx-timeline-connector-color, oklch(.88 .005 250));border-radius:var(--cngx-radius-md, 8px);padding:var(--cngx-timeline-content-padding, 4px)}.cngx-timeline[data-skin=bands] .cngx-timeline__group:nth-of-type(2n){background:color-mix(in oklch,currentColor 4%,transparent);border-radius:var(--cngx-radius-md, 8px);padding:var(--cngx-timeline-surface-padding, 4px)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CngxSkeletonContainer, selector: "cngx-skeleton", inputs: ["loading", "state", "shimmer", "count", "showDelay", "minDwell"], exportAs: ["cngxSkeletonContainer"] }, { kind: "directive", type: CngxSkeletonPlaceholder, selector: "ng-template[cngxSkeletonPlaceholder]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
453
+ }
454
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTimeline, decorators: [{
455
+ type: Component,
456
+ args: [{ selector: 'cngx-timeline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [NgTemplateOutlet, CngxSkeletonContainer, CngxSkeletonPlaceholder], providers: [
457
+ // The rows render their own markers, so an app-wide marker template can
458
+ // only reach them through a contract. A token, never the class itself:
459
+ // a row has to stay usable with no timeline above it.
460
+ { provide: CNGX_TIMELINE_MARKER_HOST, useExisting: CngxTimeline },
461
+ {
462
+ // Re-exposes whatever is bound to [state] so CngxToastOn / CngxAlertOn /
463
+ // CngxBannerOn attach with no wiring at all. It cannot be `useExisting`
464
+ // like the select family's: there the state is a concrete field, here it
465
+ // arrives through an Input that can change or be absent, so the façade
466
+ // below forwards each signal instead of capturing one object.
467
+ provide: CNGX_STATEFUL,
468
+ useFactory: () => ({
469
+ state: inject(CngxTimeline).asyncState,
470
+ }),
471
+ },
472
+ ], host: {
473
+ class: 'cngx-timeline',
474
+ '[attr.data-mode]': 'mode()',
475
+ '[attr.data-skin]': 'skin()',
476
+ '[attr.data-placement]': 'placement()',
477
+ '[attr.data-rail]': 'rail()',
478
+ '[attr.data-orientation]': 'orientation()',
479
+ '[attr.data-ungrouped]': 'ungrouped() ? "" : null',
480
+ // Aliased inputs leave the raw attribute behind, naming the role-less host.
481
+ '[attr.aria-label]': 'null',
482
+ '[attr.aria-labelledby]': 'null',
483
+ }, template: "@switch (activeView()) {\n @case ('skeleton') {\n <!-- The container owns show-delay and min-dwell, so a fast load never\n flashes and the timeline holds no latency logic. The placeholder\n reuses the item raster, so the swap to content cannot reflow. -->\n <!-- The class carries no rule on purpose: `<cngx-skeleton>` hosts itself\n with `display: contents` and has no box to style. It is the hook that\n makes the loading branch addressable from outside - tests and\n consumer overrides have nothing else to select on. -->\n <!-- [loading], not [state]: the container derives first-load from a bound\n state and would refuse to draw on a refetch that has nothing on\n screen, which is exactly the branch this case exists for. Reaching\n this branch at all IS the decision that a placeholder belongs here -\n activeView() already made it - so the flag is true by construction\n and the container is left owning only show-delay and min-dwell. -->\n <cngx-skeleton class=\"cngx-timeline__skeleton\" [loading]=\"true\" [count]=\"skeletonRowCount()\">\n <!-- let-index: the container has passed index/count/first/last into\n this template all along, the timeline just never read it. The\n built-in placeholder needs the per-row index to land on the same\n sides the content will, so the swap does not reflow under\n placement=\"end\" / \"alternate\". A consumer-supplied\n *cngxTimelineSkeleton is still outletted without context, which is\n unchanged and tracked. -->\n <ng-template cngxSkeletonPlaceholder let-index=\"index\">\n <!-- aria-hidden on the wrapper, not on the branches: whatever a\n consumer supplies is decoration too, and the load is announced\n through the live region at the bottom of this template. -->\n <div aria-hidden=\"true\">\n @if (skeletonTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\" />\n } @else {\n <!-- Own classes, not the row's. `CngxTimelineItem` is never\n imported here, so on a cold first load its Track-A stylesheet\n is not in the document yet and borrowed classes would render\n unstyled - on the one path the skeleton exists to cover. -->\n <div class=\"cngx-timeline__skeleton-row\" [attr.data-row-side]=\"rowSide(index)\">\n <span class=\"cngx-timeline__skeleton-marker\"></span>\n <span class=\"cngx-timeline__skeleton-rail\"></span>\n <div class=\"cngx-timeline__skeleton-body\">\n <span class=\"cngx-timeline__skeleton-line\"></span>\n <span\n class=\"cngx-timeline__skeleton-line cngx-timeline__skeleton-line--short\"\n ></span>\n </div>\n </div>\n }\n </div>\n </ng-template>\n </cngx-skeleton>\n }\n\n @case ('empty') {\n <div class=\"cngx-timeline__empty\">\n @if (emptyTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: emptyReason() }\" />\n } @else {\n {{ labels.emptyFallback }}\n }\n </div>\n }\n\n @case ('error') {\n <ng-container *ngTemplateOutlet=\"errorSurface\" />\n }\n}\n\n@if (showsContent() && groups().length) {\n <!-- aria-busy belongs on the element that owns the content, not on the\n role-less host, where AT would never read it. -->\n <div\n class=\"cngx-timeline__list\"\n [attr.role]=\"containerRole()\"\n [attr.aria-busy]=\"ariaBusy()\"\n [attr.aria-label]=\"listLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledBy()\"\n >\n @for (group of groups(); track group.key) {\n <!-- Three elements per band, not two, and the middle one is why: a\n list may own nothing but listitems, so the header cannot sit\n inside it. The header is a consumer slot and the documented\n example is an <h3> - a real role, which axe rejects as a child of\n role=\"list\". So the band wrapper stays generic, the header sits\n beside the rows, and only the rows carry the list role. The rows\n element is what the header names, and what v2 wraps in a\n <details role=\"group\">.\n\n Ungrouped drops both wrappers to presentation rather than to no\n role at all: a generic div between the list and its rows still\n owns them and breaks listitem's required context - display:\n contents fixes the box tree, not this.\n\n The label id is keyed on $index, not on group.key: a custom\n TimelineGroupingFn is free to return \"today / this week / earlier\",\n and whitespace in an id makes this reference resolve to nothing,\n leaving the band unnamed. -->\n <div class=\"cngx-timeline__group\" [attr.role]=\"wrapperRole()\">\n @if (!ungrouped()) {\n <div class=\"cngx-timeline__date-header\" [id]=\"groupLabelId($index)\">\n @if (dateHeaderTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: group }\" />\n } @else {\n {{ labels.groupLabel(group) }}\n }\n </div>\n }\n\n <div\n class=\"cngx-timeline__rows\"\n [attr.role]=\"rowsRole()\"\n [attr.aria-labelledby]=\"ungrouped() ? null : groupLabelId($index)\"\n >\n @for (item of group.items; track trackItem($index, item)) {\n <!-- The side comes from the loop index, not from :nth-child: a\n filtered list has to alternate by its position in the run\n that is actually rendered, and the row stylesheet reads the\n attribute off an ancestor exactly like [data-mode]. -->\n <div class=\"cngx-timeline__item\" role=\"listitem\" [attr.data-row-side]=\"rowSide($index)\">\n @if (itemTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: itemContext(item, $index, group)\" />\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n}\n\n<!-- A refresh keeps the loaded rows on screen, so this tail is the only visible\n sign anything is happening. Outside the list, so it never reads as an\n event of its own. Decorative: the announcement is the live region below,\n which stays in the DOM whether or not there is anything to say. -->\n@if (refreshing()) {\n <div class=\"cngx-timeline__tail\" aria-hidden=\"true\">\n @if (loadingTailTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\" />\n } @else {\n {{ labels.refreshing }}\n }\n </div>\n}\n\n@if (activeView() === 'content+error') {\n <ng-container *ngTemplateOutlet=\"errorSurface\" />\n}\n\n<!-- Always in the DOM, content reactive - a region created together with its\n message is announced inconsistently or not at all. Empty whenever the\n timeline has nothing to report. -->\n<span aria-live=\"polite\" aria-atomic=\"true\" class=\"cngx-timeline__sr-only\">\n {{ announcement() }}\n</span>\n\n<ng-template #errorSurface>\n <div class=\"cngx-timeline__error\">\n @if (errorTpl(); as tpl) {\n <ng-container\n *ngTemplateOutlet=\"tpl; context: { $implicit: state()?.error(), retry: emitRetry }\"\n />\n } @else {\n <!-- The alert is the message alone. Wrapping the retry control in it\n too would re-announce the button on every mutation of the region. -->\n <p class=\"cngx-timeline__error-message\" role=\"alert\">{{ labels.errorFallback }}</p>\n @if (retryButtonTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: emitRetry }\" />\n } @else {\n <button class=\"cngx-timeline__retry\" type=\"button\" (click)=\"emitRetry()\">\n {{ labels.retry }}\n </button>\n }\n }\n </div>\n</ng-template>\n", styles: ["@layer cngx.tokens{@property --cngx-timeline-item-gap{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-timeline-group-gap{syntax: \"<length>\"; inherits: true; initial-value: 24px;}@property --cngx-timeline-surface-padding{syntax: \"<length>\"; inherits: true; initial-value: 4px;}@property --cngx-timeline-skeleton-line-size{syntax: \"<length>\"; inherits: true; initial-value: 12px;}}@layer cngx.components{@scope(.cngx-timeline){:scope{--cngx-timeline-item-gap: var(--cngx-space-md, 16px);--cngx-timeline-group-gap: var(--cngx-space-lg, 24px);--cngx-timeline-surface-padding: var(--cngx-space-xs, 4px);--cngx-timeline-gap: var(--cngx-space-sm, 8px);--cngx-timeline-row-gap: var(--cngx-space-xs, 4px);display:block;container-type:inline-size;container-name:cngx-timeline;color:var(--cngx-timeline-text-color, oklch(.2 .01 250))}.cngx-timeline__list{display:flex;flex-direction:column;gap:var(--cngx-timeline-group-gap, 24px)}.cngx-timeline__group,.cngx-timeline__rows{display:flex;flex-direction:column;gap:var(--cngx-timeline-item-gap, 16px)}.cngx-timeline__date-header{color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem);font-weight:600;line-height:1.4}.cngx-timeline__item{display:block}:scope[data-ungrouped] .cngx-timeline__group,:scope[data-ungrouped] .cngx-timeline__rows{display:contents}:scope[data-ungrouped] .cngx-timeline__list{gap:var(--cngx-timeline-item-gap, 16px)}.cngx-timeline__empty,.cngx-timeline__error,.cngx-timeline__tail{padding:var(--cngx-timeline-surface-padding, 4px)}.cngx-timeline__empty,.cngx-timeline__tail{color:var(--cngx-timeline-muted-color, oklch(.5 .01 250));font-size:var(--cngx-timeline-meta-size, .8125rem)}.cngx-timeline__sr-only{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.cngx-timeline__error-message{margin:0 0 var(--cngx-timeline-item-gap, 16px);color:var(--cngx-timeline-rejected-color, oklch(.6 .18 25))}.cngx-timeline__skeleton-row{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);grid-template-areas:\"marker line\" \"rail body\";column-gap:var(--cngx-timeline-gap, 8px);row-gap:var(--cngx-timeline-row-gap, 4px)}.cngx-timeline__skeleton-row+.cngx-timeline__skeleton-row{margin-block-start:var(--cngx-timeline-item-gap, 16px)}.cngx-timeline__skeleton-row[data-row-side=end]{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:\"line marker\" \"body rail\"}:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"opposite marker line\" \"opposite rail body\"}:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row[data-row-side=end]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:\"line marker opposite\" \"body rail opposite\"}:scope[data-orientation=horizontal]{overflow-x:auto}:scope[data-orientation=horizontal] .cngx-timeline__list{flex-direction:row;align-items:start}:scope[data-orientation=horizontal] .cngx-timeline__group{flex:none}:scope[data-orientation=horizontal] .cngx-timeline__rows{flex-direction:row;align-items:stretch}:scope[data-orientation=horizontal] .cngx-timeline__skeleton{display:flex;flex-direction:row;gap:var(--cngx-timeline-item-gap, 16px)}:scope[data-orientation=horizontal] .cngx-timeline__skeleton-row{grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:\"marker rail\" \"line line\" \"body body\";inline-size:12rem}:scope[data-orientation=horizontal] .cngx-timeline__skeleton-row+.cngx-timeline__skeleton-row{margin-block-start:0}:scope[data-orientation=horizontal] .cngx-timeline__skeleton-rail{inline-size:100%;block-size:var(--cngx-timeline-connector-width, 2px);align-self:center;justify-self:stretch}@container cngx-timeline (max-inline-size: 32rem){:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row,:scope[data-placement=alternate]:not([data-mode=activity]) .cngx-timeline__skeleton-row[data-row-side=end]{grid-template-columns:auto minmax(0,1fr);grid-template-areas:\"marker line\" \"rail body\"}}.cngx-timeline__skeleton-marker,.cngx-timeline__skeleton-rail{background:color-mix(in oklch,currentColor 14%,transparent)}.cngx-timeline__skeleton-marker{grid-area:marker;inline-size:var(--cngx-timeline-marker-size, 12px);block-size:var(--cngx-timeline-marker-size, 12px);border-radius:50%}.cngx-timeline__skeleton-rail{grid-area:rail;inline-size:var(--cngx-timeline-connector-width, 2px);block-size:100%;justify-self:center}.cngx-timeline__skeleton-body{grid-area:body;padding:var(--cngx-timeline-surface-padding, 4px);min-inline-size:0}.cngx-timeline__skeleton-line{display:block;block-size:var(--cngx-timeline-skeleton-line-size, 12px);border-radius:var(--cngx-radius-sm, 4px);background:color-mix(in oklch,currentColor 14%,transparent)}.cngx-timeline__skeleton-line+.cngx-timeline__skeleton-line{margin-block-start:var(--cngx-timeline-row-gap, 4px)}.cngx-timeline__skeleton-line--short{inline-size:60%}}.cngx-timeline[data-skin=card] .cngx-timeline-item__body{background:var(--cngx-timeline-surface, oklch(1 0 0));border:var(--cngx-timeline-connector-width, 2px) solid var(--cngx-timeline-connector-color, oklch(.88 .005 250));border-radius:var(--cngx-radius-md, 8px);padding:var(--cngx-timeline-content-padding, 4px)}.cngx-timeline[data-skin=bands] .cngx-timeline__group:nth-of-type(2n){background:color-mix(in oklch,currentColor 4%,transparent);border-radius:var(--cngx-radius-md, 8px);padding:var(--cngx-timeline-surface-padding, 4px)}}\n"] }]
484
+ }], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], emptyReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyReason", required: false }] }], skeletonRowCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "skeletonRowCount", required: false }] }], retry: [{ type: i0.Output, args: ["retry"] }], dateAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateAccessor", required: true }] }], idAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "idAccessor", required: false }] }], groupBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupBy", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], skin: [{ type: i0.Input, args: [{ isSignal: true, alias: "skin", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], rail: [{ type: i0.Input, args: [{ isSignal: true, alias: "rail", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], itemSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineItemTpl), { isSignal: true }] }], dateHeaderSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineDateHeader), { isSignal: true }] }], markerSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineMarkerTpl), { isSignal: true }] }], emptySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineEmpty), { isSignal: true }] }], errorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineError), { isSignal: true }] }], retryButtonSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineRetryButton), { isSignal: true }] }], loadingTailSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineLoadingTail), { isSignal: true }] }], skeletonSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTimelineSkeleton), { isSignal: true }] }] } });
485
+
486
+ /**
487
+ * @module @cngx/ui/timeline
488
+ */
489
+
490
+ /**
491
+ * Generated bundle index. Do not edit.
492
+ */
493
+
494
+ export { CNGX_TIMELINE_VIEW_FACTORY, CngxTimeline, createTimelineFallbackCopy, createTimelineSlotBinding, createTimelineSlots, createTimelineView };
495
+ //# sourceMappingURL=cngx-ui-timeline.mjs.map