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