@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,479 @@
1
+ import * as _cngx_common_data from '@cngx/common/data';
2
+ import { AsyncView } from '@cngx/common/data';
3
+ import * as _cngx_ui_timeline from '@cngx/ui/timeline';
4
+ import * as _cngx_common_timeline from '@cngx/common/timeline';
5
+ import { CngxTimelineMarkerHost, TimelineDateAccessor, TimelineGroupBy, TimelineDirection, TimelineGroup, CngxTimelineItemContext, CngxTimelineConfig, CngxTimelineDateHeaderContext, CngxTimelineMarkerContext, CngxTimelineEmptyContext, CngxTimelineErrorContext, CngxTimelineRetryButtonContext, CngxTimelineTemplates } from '@cngx/common/timeline';
6
+ import * as _angular_core from '@angular/core';
7
+ import { Signal, InjectionToken, TemplateRef } from '@angular/core';
8
+ import { EmptyReason } from '@cngx/common/card';
9
+ import { CngxAsyncState } from '@cngx/core/utils';
10
+
11
+ /**
12
+ * Raster the timeline lays its rows out on.
13
+ *
14
+ * `narrative` (default) stacks the timestamp above the body and gives each
15
+ * event room to breathe - a history someone reads. `activity` trails the
16
+ * timestamp after the body on one line - a feed someone scans. Purely
17
+ * visual: same DOM, same ARIA, same slots, only the `[data-mode]` host
18
+ * attribute changes.
19
+ *
20
+ * @category ui/timeline
21
+ */
22
+ type CngxTimelineMode = 'narrative' | 'activity';
23
+ /**
24
+ * Visual skin, applied through `[data-skin]`. Thematic only - structure,
25
+ * ARIA and slots are identical across all three.
26
+ *
27
+ * `line` (default) is the bare rail. `card` lifts each event body onto its
28
+ * own surface. `bands` tints alternating groups so long timelines stay
29
+ * scannable.
30
+ *
31
+ * @category ui/timeline
32
+ */
33
+ type CngxTimelineSkin = 'line' | 'card' | 'bands';
34
+ /**
35
+ * Which side of the rail each row's body sits on.
36
+ *
37
+ * `start` (default) is v1: rail leading, body trailing. `end` mirrors every
38
+ * row. `alternate` centres the rail and flips the body side by row, which is
39
+ * the classic infographic layout - pair it with `[cngxTimelineOpposite]` so
40
+ * the empty side carries a year or a label.
41
+ *
42
+ * Purely visual. DOM order stays chronological under every value, the ARIA
43
+ * chain is identical, and alternation comes from the loop index rather than
44
+ * from `:nth-child`, so a filtered list alternates correctly.
45
+ *
46
+ * `alternate` is not supported with `mode="activity"`: alternating a
47
+ * scan-feed defeats the scan. Those rows render `start` and dev mode warns.
48
+ *
49
+ * @category ui/timeline
50
+ */
51
+ type CngxTimelinePlacement = 'start' | 'end' | 'alternate';
52
+ /**
53
+ * Whether the rail breaks between rows or reads as one line.
54
+ *
55
+ * `segmented` (default) is v1: one segment per row, separated by the item
56
+ * gap. `continuous` stretches each segment across that gap so a band reads
57
+ * as an unbroken line.
58
+ *
59
+ * Continuity is built per segment rather than from one line behind the run,
60
+ * so a `rejected` stretch stays red and an `upcoming` tail stays dashed.
61
+ * It applies within a band; the gap between groups stays open, because a
62
+ * band is a semantic boundary rather than a rendering accident.
63
+ *
64
+ * @category ui/timeline
65
+ */
66
+ type CngxTimelineRail = 'segmented' | 'continuous';
67
+ /**
68
+ * Which axis the run reads along.
69
+ *
70
+ * `vertical` (default) stacks rows down the page. `horizontal` lays them out
71
+ * along the inline axis behind a scroll container, with the rail as a
72
+ * horizontal axis and the content stacked away from it.
73
+ *
74
+ * Orientation composes with `placement` rather than replacing it: under
75
+ * `horizontal`, `[placement]` selects which side of the *axis* a row's body
76
+ * sits on, so `alternate` puts cards above and below in turn.
77
+ *
78
+ * Named `orientation` rather than `direction` because `[direction]` is
79
+ * already the sort order on this component.
80
+ *
81
+ * @category ui/timeline
82
+ */
83
+ type CngxTimelineOrientation = 'vertical' | 'horizontal';
84
+ /**
85
+ * Grouped, themed, RTL-safe timeline over a flat list of events.
86
+ *
87
+ * Data in, rows out: bind `[items]` and a `[dateAccessor]`, project one
88
+ * `*cngxTimelineItem` template, and the organism buckets, sorts and renders
89
+ * the rest. Bucketing is not its own code - it resolves
90
+ * {@link CNGX_TIMELINE_GROUPING_FACTORY} and derives everything from one
91
+ * `computed()`, so an app can swap in fiscal quarters or server-supplied
92
+ * grouping without forking the component.
93
+ *
94
+ * **ARIA.** One chain in two configurations, both derived rather than set:
95
+ * grouped is `group` -> `list` -> `listitem`, one list per band named by its
96
+ * date header, so a screen reader counts items per band rather than across
97
+ * the whole history. The header sits beside that list, never inside it - a
98
+ * list may own nothing but `listitem`, and the header is a consumer slot.
99
+ * `groupBy="none"` moves `list` up to the container and collapses the chain
100
+ * to `list` -> `listitem`.
101
+ *
102
+ * **Not keyboard-navigable, deliberately.** v1 items are content, not
103
+ * widgets - links and buttons *inside* a row are natively tabbable in DOM
104
+ * order, which is the right behaviour for a read-only history. Roving
105
+ * tabindex becomes mandatory the moment a row is selectable, and that is a
106
+ * v2 concern.
107
+ *
108
+ * ```html
109
+ * <cngx-timeline [items]="events()" [dateAccessor]="at" groupBy="day">
110
+ * <ng-template [cngxTimelineItem]="events()" let-event let-last="last">
111
+ * <cngx-timeline-item [position]="last ? 'last' : 'middle'">
112
+ * <cngx-time cngxTimelineTime [date]="event.at" />
113
+ * <p>{{ event.summary }}</p>
114
+ * </cngx-timeline-item>
115
+ * </ng-template>
116
+ * </cngx-timeline>
117
+ * ```
118
+ *
119
+ * @category ui/timeline
120
+ * @docsKind primary
121
+ * @wcag AA
122
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/timeline/timeline.component.ts
123
+ * @relatedTo CngxTimelineItem, CngxTimelineItemTpl, CNGX_TIMELINE_GROUPING_FACTORY, CNGX_TIMELINE_CONFIG
124
+ * @slot cngxTimelineItem Renders one event row; gets the event plus first/last/index flags.
125
+ * @slot cngxTimelineMarkerTpl Replaces a row's marker; takes precedence over a projected marker element.
126
+ * @slot cngxTimelineDateHeader Replaces a band's date caption; gets the band date.
127
+ * @slot cngxTimelineSkeleton Replaces the placeholder rows drawn during the first load.
128
+ * @slot cngxTimelineEmpty Rendered when no event resolves; gets the reason from [emptyReason].
129
+ * @slot cngxTimelineError Rendered when the load fails; gets the error and a retry callback.
130
+ * @slot cngxTimelineRetryButton Replaces the retry control on the error surface.
131
+ * @slot cngxTimelineLoadingTail Rendered below the rows while more history streams in.
132
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/flat-array</example-url>
133
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/group-by-week</example-url>
134
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/direction</example-url>
135
+ * <example-url>http://localhost:4200/#/ui/timeline/basics/ungrouped</example-url>
136
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/horizontal</example-url>
137
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/alternating-infographic</example-url>
138
+ * <example-url>http://localhost:4200/#/ui/timeline/layout/opposite-time</example-url>
139
+ * <example-url>http://localhost:4200/#/ui/timeline/integration/data-source</example-url>
140
+ * <example-url>http://localhost:4200/#/ui/timeline/integration/scroll-spy-nav</example-url>
141
+ * <example-url>http://localhost:4200/#/ui/timeline/async/error-retry</example-url>
142
+ * <example-url>http://localhost:4200/#/ui/timeline/async/refreshing-tail</example-url>
143
+ * <example-url>http://localhost:4200/#/ui/timeline/skins/activity-vs-narrative</example-url>
144
+ * @since 0.1.0
145
+ */
146
+ declare class CngxTimeline<T = unknown> implements CngxTimelineMarkerHost {
147
+ private readonly config;
148
+ private readonly groupingFactory;
149
+ private readonly uid;
150
+ /**
151
+ * The flat event list. Order is irrelevant - the presenter sorts.
152
+ *
153
+ * A bound `[state]` supplies the rows instead as soon as it *has* data;
154
+ * until then these are still used, so binding both is a legitimate way to
155
+ * render a seed list while the first load runs. Note that the body still
156
+ * follows the state, so an `idle` state renders nothing whatever `[items]`
157
+ * holds.
158
+ */
159
+ readonly items: _angular_core.InputSignal<readonly T[]>;
160
+ /**
161
+ * The list's async state. Wins over `[items]`, and drives the whole body:
162
+ * skeleton on first load, error surface with a retry, empty surface, and a
163
+ * refreshing tail over content that stays on screen.
164
+ *
165
+ * Also republished through `CNGX_STATEFUL`, so a transition bridge inside
166
+ * the timeline needs no binding of its own.
167
+ */
168
+ readonly state: _angular_core.InputSignalWithTransform<CngxAsyncState<readonly T[]> | undefined, "" | CngxAsyncState<readonly T[]> | undefined>;
169
+ /**
170
+ * Why the timeline is empty, forwarded to `*cngxTimelineEmpty`. The
171
+ * organism cannot infer this - only the consumer knows whether a filter
172
+ * cleared the list or nothing has happened yet.
173
+ */
174
+ readonly emptyReason: _angular_core.InputSignal<EmptyReason>;
175
+ /**
176
+ * How many placeholder rows the loading body draws. Match it to the usual
177
+ * length so the skeleton reserves roughly the space the content will take.
178
+ */
179
+ readonly skeletonRowCount: _angular_core.InputSignal<number>;
180
+ /** Fires when the consumer asks to retry a failed load. */
181
+ readonly retry: _angular_core.OutputEmitterRef<void>;
182
+ /**
183
+ * Pulls the timestamp out of an event. Anything the `Date` constructor
184
+ * accepts, so ISO strings off an API response need no pre-mapping.
185
+ */
186
+ readonly dateAccessor: _angular_core.InputSignal<TimelineDateAccessor<T>>;
187
+ /**
188
+ * Stable event identity, used as the `@for` track expression so a row
189
+ * keeps its DOM across a refetch instead of being torn down and rebuilt.
190
+ *
191
+ * It deliberately does *not* drive band reuse: a refetch returns new
192
+ * objects at the same ids, and reusing a band on an id match would pin it
193
+ * to the old payload.
194
+ */
195
+ readonly idAccessor: _angular_core.InputSignal<((item: T) => unknown) | undefined>;
196
+ /**
197
+ * Bucketing. `'day'` (default), `'week'`, `'month'`, `'none'` for a flat
198
+ * ungrouped list, or a custom function for anything else.
199
+ */
200
+ readonly groupBy: _angular_core.InputSignal<TimelineGroupBy<T>>;
201
+ /** `'desc'` (default) is newest-first; `'asc'` reads oldest-first. */
202
+ readonly direction: _angular_core.InputSignal<TimelineDirection>;
203
+ /** Row raster. See {@link CngxTimelineMode}. */
204
+ readonly mode: _angular_core.InputSignal<CngxTimelineMode>;
205
+ /** Visual skin. See {@link CngxTimelineSkin}. */
206
+ readonly skin: _angular_core.InputSignal<CngxTimelineSkin>;
207
+ /** Which side of the rail rows sit on. See {@link CngxTimelinePlacement}. */
208
+ readonly placement: _angular_core.InputSignal<CngxTimelinePlacement>;
209
+ /** Whether the rail breaks between rows. See {@link CngxTimelineRail}. */
210
+ readonly rail: _angular_core.InputSignal<CngxTimelineRail>;
211
+ /** Which axis the run reads along. See {@link CngxTimelineOrientation}. */
212
+ readonly orientation: _angular_core.InputSignal<CngxTimelineOrientation>;
213
+ /** Accessible name for the list. Falls back to the config's `timelineRegion`. */
214
+ readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
215
+ /** Names the list from existing markup instead. Wins over `aria-label`. */
216
+ readonly ariaLabelledBy: _angular_core.InputSignal<string | undefined>;
217
+ private readonly itemSlot;
218
+ private readonly dateHeaderSlot;
219
+ private readonly markerSlot;
220
+ private readonly emptySlot;
221
+ private readonly errorSlot;
222
+ private readonly retryButtonSlot;
223
+ private readonly loadingTailSlot;
224
+ private readonly skeletonSlot;
225
+ /** @internal The list the presenter groups: bound state first, then `[items]`. */
226
+ private readonly resolvedItems;
227
+ private readonly grouping;
228
+ /** The derived bands, in sort order. */
229
+ readonly groups: Signal<readonly TimelineGroup<T>[]>;
230
+ /** @internal Eight slots, one cascade rule, resolved in one place. */
231
+ private readonly slots;
232
+ protected readonly itemTpl: Signal<_angular_core.TemplateRef<CngxTimelineItemContext<T>> | null>;
233
+ protected readonly dateHeaderTpl: Signal<_angular_core.TemplateRef<_cngx_common_timeline.CngxTimelineDateHeaderContext<T>> | null>;
234
+ /** Public: this is the `CNGX_TIMELINE_MARKER_HOST` contract the rows read. */
235
+ readonly markerTpl: Signal<_angular_core.TemplateRef<_cngx_common_timeline.CngxTimelineMarkerContext<T>> | null>;
236
+ protected readonly emptyTpl: Signal<_angular_core.TemplateRef<_cngx_common_timeline.CngxTimelineEmptyContext> | null>;
237
+ protected readonly errorTpl: Signal<_angular_core.TemplateRef<_cngx_common_timeline.CngxTimelineErrorContext> | null>;
238
+ protected readonly retryButtonTpl: Signal<_angular_core.TemplateRef<_cngx_common_timeline.CngxTimelineRetryButtonContext> | null>;
239
+ protected readonly loadingTailTpl: Signal<_angular_core.TemplateRef<void> | null>;
240
+ protected readonly skeletonTpl: Signal<_angular_core.TemplateRef<void> | null>;
241
+ /**
242
+ * Forwarding façade over the bound `[state]`, published through
243
+ * `CNGX_STATEFUL`. Every member delegates, so swapping the bound state (or
244
+ * binding none at all) never leaves a bridge holding a stale object.
245
+ */
246
+ readonly asyncState: CngxAsyncState<readonly T[]>;
247
+ /** @internal Fallback copy for every surface with no slot bound. */
248
+ protected readonly labels: _cngx_ui_timeline.CngxTimelineFallbackCopy;
249
+ /** @internal The body switch, the busy flag and the live-region text. */
250
+ private readonly view;
251
+ protected readonly activeView: Signal<_cngx_common_data.AsyncView>;
252
+ protected readonly showsContent: Signal<boolean>;
253
+ protected readonly refreshing: Signal<boolean>;
254
+ protected readonly ariaBusy: Signal<"true" | null>;
255
+ protected readonly announcement: Signal<string>;
256
+ /** @internal Passed into the error and retry-button slot contexts. */
257
+ protected readonly emitRetry: () => void;
258
+ /**
259
+ * @internal `groupBy: 'none'` still produces one synthetic band from the
260
+ * presenter, so the ungrouped configuration is a rendering decision here
261
+ * rather than a second data path.
262
+ */
263
+ protected readonly ungrouped: Signal<boolean>;
264
+ /** @internal Grouped is `group -> list -> listitem`: one list per band. */
265
+ protected readonly containerRole: Signal<"list" | "group">;
266
+ /** @internal Generic when grouped so the header may sit beside the rows. */
267
+ protected readonly wrapperRole: Signal<"presentation" | null>;
268
+ /** @internal The rows are the list, so it owns only `listitem` children. */
269
+ protected readonly rowsRole: Signal<"list" | "presentation">;
270
+ /** @internal Config fallback only applies when nothing was named explicitly. */
271
+ protected readonly listLabel: Signal<string | null>;
272
+ /** @internal A group is named by its own header element, keyed on position. */
273
+ protected groupLabelId(index: number): string;
274
+ /** @internal Row context. `first` / `last` are positions within the group. */
275
+ protected itemContext(item: T, index: number, group: TimelineGroup<T>): CngxTimelineItemContext<T>;
276
+ /**
277
+ * @internal Which side this row's body sits on. Derived from the loop
278
+ * index, never from `:nth-child`: a filtered or refetched list has to
279
+ * alternate by its own position in the rendered run, and CSS structural
280
+ * parity would count DOM children instead. The row stylesheet reads the
281
+ * resulting `[data-row-side]` off an ancestor, exactly like `[data-mode]`.
282
+ *
283
+ * The built-in skeleton placeholder calls this with the index its own
284
+ * container hands it, so the loading rows land on the same sides the
285
+ * content will - which is what keeps the swap from reflowing.
286
+ */
287
+ protected rowSide(index: number): 'start' | 'end';
288
+ /** @internal Track by consumer identity when given, else by reference. */
289
+ protected trackItem: (index: number, item: T) => unknown;
290
+ constructor();
291
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTimeline<any>, never>;
292
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTimeline<any>, "cngx-timeline", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "emptyReason": { "alias": "emptyReason"; "required": false; "isSignal": true; }; "skeletonRowCount": { "alias": "skeletonRowCount"; "required": false; "isSignal": true; }; "dateAccessor": { "alias": "dateAccessor"; "required": true; "isSignal": true; }; "idAccessor": { "alias": "idAccessor"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "rail": { "alias": "rail"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; }, { "retry": "retry"; }, ["itemSlot", "dateHeaderSlot", "markerSlot", "emptySlot", "errorSlot", "retryButtonSlot", "loadingTailSlot", "skeletonSlot"], never, true, never>;
293
+ }
294
+
295
+ /**
296
+ * The fallback copy the timeline renders when a consumer bound no slot for
297
+ * a surface, resolved once from the config cascade.
298
+ *
299
+ * @category ui/timeline
300
+ */
301
+ interface CngxTimelineFallbackCopy {
302
+ readonly retry: string;
303
+ readonly errorFallback: string;
304
+ readonly emptyFallback: string;
305
+ readonly loading: string;
306
+ readonly refreshing: string;
307
+ readonly groupLabel: (group: TimelineGroup<unknown>) => string;
308
+ }
309
+ /**
310
+ * Flattens the config's optional label bag into the exact set the template
311
+ * reads, so the template names what it wants rather than indexing a keyed
312
+ * accessor, and the optional-chaining lives in one place instead of at every
313
+ * use site.
314
+ *
315
+ * `groupLabel` keeps the band's key as its own last resort: a consumer who
316
+ * clears the formatter should still get a legible header rather than an
317
+ * empty one that leaves the group unnamed.
318
+ *
319
+ * @category ui/timeline
320
+ * @since 0.1.0
321
+ */
322
+ declare function createTimelineFallbackCopy(config: CngxTimelineConfig): CngxTimelineFallbackCopy;
323
+
324
+ /**
325
+ * Everything the template needs to decide what the body shows.
326
+ *
327
+ * @category ui/timeline
328
+ */
329
+ interface CngxTimelineView {
330
+ readonly activeView: Signal<AsyncView>;
331
+ readonly showsContent: Signal<boolean>;
332
+ readonly refreshing: Signal<boolean>;
333
+ readonly ariaBusy: Signal<'true' | null>;
334
+ readonly announcement: Signal<string>;
335
+ }
336
+ /**
337
+ * Derives the whole body switch from one bound state. No second state
338
+ * machine, no boolean fallback inputs - every branch is a `computed()` over
339
+ * `resolveAsyncView`, the same lookup table the rest of cngx switches on.
340
+ *
341
+ * Two cases the lookup table does not cover on its own:
342
+ *
343
+ * - **No state bound.** The timeline is then a plain list over `[items]`,
344
+ * but an empty one still has to reach the empty surface; otherwise
345
+ * `*cngxTimelineEmpty` would be unreachable on the synchronous path.
346
+ * - **The announcement.** Only `loading` and `refreshing` have anything to
347
+ * say, and the string is empty otherwise so the live region stays in the
348
+ * DOM while staying silent.
349
+ * - **Busy with an empty screen.** The lookup table resolves a non-first-load
350
+ * `loading` or `pending` to `content`; with no rows that renders nothing at
351
+ * all, so it is treated as a load instead. `refreshing` keeps its tail.
352
+ *
353
+ * Swap the whole mapping through {@link CNGX_TIMELINE_VIEW_FACTORY} rather
354
+ * than forking the organism - treating `pending` as content, or holding the
355
+ * skeleton through a refresh, is a per-app decision.
356
+ *
357
+ * @category ui/timeline
358
+ * @relatedTo CNGX_TIMELINE_VIEW_FACTORY
359
+ * @since 0.1.0
360
+ */
361
+ declare function createTimelineView(state: () => CngxAsyncState<unknown> | undefined, isEmpty: () => boolean, labels: CngxTimelineFallbackCopy): CngxTimelineView;
362
+ /**
363
+ * The shape {@link CNGX_TIMELINE_VIEW_FACTORY} hands out.
364
+ *
365
+ * @category ui/timeline
366
+ */
367
+ type CngxTimelineViewFactory = (state: () => CngxAsyncState<unknown> | undefined, isEmpty: () => boolean, labels: CngxTimelineFallbackCopy) => CngxTimelineView;
368
+ /**
369
+ * Swap point for the body-view mapping. Override it to reshape when the
370
+ * timeline shows a skeleton, content, the empty surface or the error
371
+ * surface - enterprise-wide or per component - without forking the organism.
372
+ *
373
+ * The mapping is genuinely per-app: whether a `pending` refetch keeps its
374
+ * rows on screen, whether a background failure surfaces inline or is
375
+ * swallowed until the next settle, and whether an empty result after a
376
+ * filter reads as empty at all are product decisions, not library ones.
377
+ *
378
+ * ```ts
379
+ * providers: [
380
+ * {
381
+ * provide: CNGX_TIMELINE_VIEW_FACTORY,
382
+ * useValue: ((state, isEmpty, labels) => {
383
+ * const base = createTimelineView(state, isEmpty, labels);
384
+ * // Hold the rows through every refetch, never fall back to placeholders.
385
+ * return { ...base, activeView: computed(() => (base.activeView() === 'skeleton' && state()?.hasData() ? 'content' : base.activeView())) };
386
+ * }) satisfies CngxTimelineViewFactory,
387
+ * },
388
+ * ]
389
+ * ```
390
+ *
391
+ * @category ui/timeline
392
+ * @relatedTo createTimelineView
393
+ * @since 0.1.0
394
+ */
395
+ declare const CNGX_TIMELINE_VIEW_FACTORY: InjectionToken<CngxTimelineViewFactory>;
396
+
397
+ /**
398
+ * Anything a cngx slot directive exposes: its own `TemplateRef`. Structural
399
+ * rather than a base class, so a consumer's own slot directive satisfies it
400
+ * by shape alone.
401
+ *
402
+ * @category ui/timeline
403
+ */
404
+ interface CngxTimelineSlotSource<C> {
405
+ readonly templateRef: TemplateRef<C>;
406
+ }
407
+ /**
408
+ * The family-standard three-stage template cascade, as one named concept:
409
+ *
410
+ * ```text
411
+ * instance contentChild -> CNGX_*_CONFIG.templates.<key> -> null
412
+ * ```
413
+ *
414
+ * The `contentChild()` query itself has to stay a direct field initialiser
415
+ * on the component (AOT rejects it from a helper, NG8110), but resolving the
416
+ * three tiers does not - and writing that resolution out once per slot turns
417
+ * a single rule into eight places it can drift.
418
+ *
419
+ * `configured` is a thunk rather than a value so the config tier is read at
420
+ * resolution time, inside the `computed()`.
421
+ *
422
+ * Exported because an ejected skin resolves the same three tiers and would
423
+ * otherwise have to restate the rule.
424
+ *
425
+ * @category ui/timeline
426
+ * @relatedTo createTimelineSlots
427
+ * @since 0.1.0
428
+ */
429
+ declare function createTimelineSlotBinding<C>(instance: Signal<CngxTimelineSlotSource<C> | undefined>, configured: () => TemplateRef<C> | undefined): Signal<TemplateRef<C> | null>;
430
+ /**
431
+ * The eight `contentChild()` queries a timeline runs, handed over as one bag
432
+ * because AOT requires them to be declared on the component itself.
433
+ *
434
+ * @category ui/timeline
435
+ */
436
+ interface CngxTimelineSlotQueries<T> {
437
+ readonly item: Signal<CngxTimelineSlotSource<CngxTimelineItemContext<T>> | undefined>;
438
+ readonly dateHeader: Signal<CngxTimelineSlotSource<CngxTimelineDateHeaderContext<T>> | undefined>;
439
+ readonly marker: Signal<CngxTimelineSlotSource<CngxTimelineMarkerContext<T>> | undefined>;
440
+ readonly empty: Signal<CngxTimelineSlotSource<CngxTimelineEmptyContext> | undefined>;
441
+ readonly error: Signal<CngxTimelineSlotSource<CngxTimelineErrorContext> | undefined>;
442
+ readonly retryButton: Signal<CngxTimelineSlotSource<CngxTimelineRetryButtonContext> | undefined>;
443
+ readonly loadingTail: Signal<CngxTimelineSlotSource<void> | undefined>;
444
+ readonly skeleton: Signal<CngxTimelineSlotSource<void> | undefined>;
445
+ }
446
+ /**
447
+ * The same eight, resolved. Every member is already through the cascade, so
448
+ * the template reads one signal per region and never restates the rule.
449
+ *
450
+ * @category ui/timeline
451
+ */
452
+ interface CngxTimelineSlots<T> {
453
+ readonly item: Signal<TemplateRef<CngxTimelineItemContext<T>> | null>;
454
+ readonly dateHeader: Signal<TemplateRef<CngxTimelineDateHeaderContext<T>> | null>;
455
+ readonly marker: Signal<TemplateRef<CngxTimelineMarkerContext<T>> | null>;
456
+ readonly empty: Signal<TemplateRef<CngxTimelineEmptyContext> | null>;
457
+ readonly error: Signal<TemplateRef<CngxTimelineErrorContext> | null>;
458
+ readonly retryButton: Signal<TemplateRef<CngxTimelineRetryButtonContext> | null>;
459
+ readonly loadingTail: Signal<TemplateRef<void> | null>;
460
+ readonly skeleton: Signal<TemplateRef<void> | null>;
461
+ }
462
+ /**
463
+ * Runs {@link createTimelineSlotBinding} over the whole slot set at once, so
464
+ * the organism holds one field instead of eight near-identical ones and each
465
+ * region has exactly one call site.
466
+ *
467
+ * The casts live here rather than at eight use sites: `CngxTimelineTemplates`
468
+ * is typed against `unknown` items because the config is app-wide while the
469
+ * slots are generic. `TemplateRef` is method-bivariant, so a consumer's
470
+ * concrete template still assigns in.
471
+ *
472
+ * @category ui/timeline
473
+ * @relatedTo createTimelineSlotBinding
474
+ * @since 0.1.0
475
+ */
476
+ declare function createTimelineSlots<T>(queries: CngxTimelineSlotQueries<T>, templates: () => CngxTimelineTemplates | undefined): CngxTimelineSlots<T>;
477
+
478
+ export { CNGX_TIMELINE_VIEW_FACTORY, CngxTimeline, createTimelineFallbackCopy, createTimelineSlotBinding, createTimelineSlots, createTimelineView };
479
+ export type { CngxTimelineFallbackCopy, CngxTimelineMode, CngxTimelineSkin, CngxTimelineSlotQueries, CngxTimelineSlotSource, CngxTimelineSlots, CngxTimelineView, CngxTimelineViewFactory };