@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.1
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 +22 -48
- package/action-button/README.md +9 -11
- package/empty-state/README.md +11 -26
- package/feedback/README.md +3 -3
- package/fesm2022/cngx-ui-action-button.mjs +30 -26
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +26 -21
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +498 -261
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +32 -5
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +119 -297
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +455 -120
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-material.mjs +14 -3
- package/fesm2022/cngx-ui-material.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +22 -3
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +107 -28
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +61 -20
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +14 -5
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +659 -163
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +306 -55
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -1
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/layout/README.md +9 -44
- package/mat-stepper/README.md +37 -17
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +357 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +7 -6
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +213 -5
- package/tabs/README.md +22 -4
- package/theming/system-tokens.css +29 -0
- package/types/cngx-ui-action-button.d.ts +28 -13
- package/types/cngx-ui-empty-state.d.ts +21 -9
- package/types/cngx-ui-feedback.d.ts +437 -121
- package/types/cngx-ui-layout.d.ts +38 -8
- package/types/cngx-ui-mat-stepper.d.ts +100 -134
- package/types/cngx-ui-mat-tabs.d.ts +291 -84
- package/types/cngx-ui-material.d.ts +12 -1
- package/types/cngx-ui-overlay.d.ts +25 -4
- package/types/cngx-ui-sidenav.d.ts +106 -12
- package/types/cngx-ui-skeleton.d.ts +62 -8
- package/types/cngx-ui-speak.d.ts +10 -2
- package/types/cngx-ui-stepper.d.ts +390 -57
- package/types/cngx-ui-tabs.d.ts +182 -18
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
package/README.md
CHANGED
|
@@ -1,35 +1,9 @@
|
|
|
1
1
|
# @cngx/ui
|
|
2
2
|
|
|
3
3
|
Finished, styled Angular components that compose headless directives from
|
|
4
|
-
`@cngx/common` with opinionated rendering. These are the "organism" layer
|
|
4
|
+
`@cngx/common` with opinionated rendering. These are the "organism" layer -
|
|
5
5
|
ready to drop into an application without additional template work.
|
|
6
6
|
|
|
7
|
-
## Theming
|
|
8
|
-
|
|
9
|
-
Every component supports two theming paths:
|
|
10
|
-
|
|
11
|
-
1. **CSS Custom Properties** — override `--cngx-*` variables on any parent
|
|
12
|
-
element. Works without Angular Material.
|
|
13
|
-
|
|
14
|
-
2. **Material Theme SCSS** — each component ships a `*-theme.scss` file with
|
|
15
|
-
`base()`, `color($theme)`, `density($theme)`, and `theme($theme)` mixins
|
|
16
|
-
that map Material design tokens to the CSS custom properties.
|
|
17
|
-
|
|
18
|
-
```scss
|
|
19
|
-
@use '@angular/material' as mat;
|
|
20
|
-
@use '@cngx/ui/speak/speak-button-theme' as speak;
|
|
21
|
-
|
|
22
|
-
$theme: mat.define-theme((...));
|
|
23
|
-
|
|
24
|
-
html {
|
|
25
|
-
@include mat.all-component-themes($theme);
|
|
26
|
-
@include speak.theme($theme);
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
M3 themes use `var(--mat-sys-*)` tokens. M2 themes derive from the palette.
|
|
31
|
-
Density scales sizes from default (0) to compact (-4).
|
|
32
|
-
|
|
33
7
|
## Components
|
|
34
8
|
|
|
35
9
|
### CngxMatPaginator
|
|
@@ -71,7 +45,7 @@ Ready-made speaker button that connects to `CngxSpeak` (headless,
|
|
|
71
45
|
| `--cngx-speak-btn-active-color` | `--cngx-accent` / `#f5a623` | Icon color while speaking or on hover |
|
|
72
46
|
| `--cngx-speak-btn-transition` | `0.15s` | Color transition duration |
|
|
73
47
|
|
|
74
|
-
**Material theme:** `@use '@cngx/
|
|
48
|
+
**Material theme:** `@use '@cngx/themes/material/speak-button-theme'`
|
|
75
49
|
|
|
76
50
|
### CngxSkeletonContainer
|
|
77
51
|
|
|
@@ -187,17 +161,17 @@ switching, mini/rail mode, resize handle, and keyboard shortcut toggle.
|
|
|
187
161
|
|
|
188
162
|
| Input | Type | Default | Description |
|
|
189
163
|
|-|-|-|-|
|
|
190
|
-
| `ariaLabel` | `string` |
|
|
164
|
+
| `ariaLabel` | `string` | - | Accessible label for the complementary landmark |
|
|
191
165
|
| `position` | `'start' \| 'end'` | `'start'` | Logical position (flips in RTL) |
|
|
192
166
|
| `mode` | `SidenavMode` | `'over'` | Interaction mode |
|
|
193
|
-
| `responsive` | `string` |
|
|
167
|
+
| `responsive` | `string` | - | CSS media query; matches = `'side'`, else falls back to `mode` |
|
|
194
168
|
| `width` | `string` (model) | `'280px'` | Panel width, two-way `[(width)]` for resize |
|
|
195
169
|
| `miniWidth` | `string` | `'56px'` | Collapsed rail width in mini mode |
|
|
196
170
|
| `expandOnHover` | `boolean` | `true` | Expand mini rail on mouse hover |
|
|
197
171
|
| `resizable` | `boolean` | `false` | Show drag handle for user resize |
|
|
198
172
|
| `minWidth` | `string` | `'120px'` | Min width constraint during resize |
|
|
199
173
|
| `maxWidth` | `string` | `'600px'` | Max width constraint during resize |
|
|
200
|
-
| `shortcut` | `string` |
|
|
174
|
+
| `shortcut` | `string` | - | Keyboard shortcut, e.g. `'mod+b'` (`mod` = Cmd on Mac, Ctrl elsewhere) |
|
|
201
175
|
|
|
202
176
|
**CngxSidenav signals:** `opened` (model), `expanded` (mini hover state), `effectiveMode`, `effectiveWidth`, `resizing`, `isOverlay`
|
|
203
177
|
**Methods:** `open()`, `close()`, `toggle()`, `expand()`, `collapse()`
|
|
@@ -251,25 +225,25 @@ via the CSS `grid-template-rows: 0fr/1fr` trick (no `@angular/animations` needed
|
|
|
251
225
|
</div>
|
|
252
226
|
```
|
|
253
227
|
|
|
254
|
-
**Material theme:** `@use '@cngx/
|
|
228
|
+
**Material theme:** `@use '@cngx/themes/material/sidenav-theme'` - includes nav-link theme automatically
|
|
255
229
|
|
|
256
|
-
### CngxToaster
|
|
230
|
+
### CngxToaster - Toast API (`@cngx/ui/feedback`)
|
|
257
231
|
|
|
258
|
-
Programmatic toast service. Not `providedIn: 'root'`
|
|
232
|
+
Programmatic toast service. Not `providedIn: 'root'` - provide via
|
|
259
233
|
`provideFeedback(withToasts())` or `provideToasts()`.
|
|
260
234
|
|
|
261
235
|
#### ToastConfig
|
|
262
236
|
|
|
263
237
|
```typescript
|
|
264
238
|
this.toaster.show({
|
|
265
|
-
message: 'Saved', // Required
|
|
266
|
-
title: 'Save successful', // Optional
|
|
267
|
-
description: 'Profile updated.', // Optional
|
|
239
|
+
message: 'Saved', // Required - sole text when title not set
|
|
240
|
+
title: 'Save successful', // Optional - bold primary text
|
|
241
|
+
description: 'Profile updated.', // Optional - secondary text below title
|
|
268
242
|
severity: 'success', // 'info' | 'success' | 'warning' | 'error'
|
|
269
243
|
duration: 5000, // ms or 'persistent'
|
|
270
244
|
action: { label: 'Undo', handler: () => this.undo() },
|
|
271
245
|
dismissible: true, // default: true
|
|
272
|
-
content: MyCustomToastBody, // Optional
|
|
246
|
+
content: MyCustomToastBody, // Optional - component as toast body
|
|
273
247
|
contentInputs: { error: err }, // Inputs for the content component
|
|
274
248
|
});
|
|
275
249
|
```
|
|
@@ -281,11 +255,11 @@ this.toaster.show({
|
|
|
281
255
|
- `content` only: custom component fills the body
|
|
282
256
|
|
|
283
257
|
**A11y:** Avoid focusable elements (`<a>`, `<button>`) inside `content` components
|
|
284
|
-
|
|
258
|
+
- they are unreachable inside a `role="status"` live region.
|
|
285
259
|
|
|
286
260
|
**Dedup:** Toasts with same `message + severity + title` within `dedupWindow` (default
|
|
287
261
|
1000ms) are merged (count incremented). `description` is intentionally excluded from
|
|
288
|
-
dedup
|
|
262
|
+
dedup - same event with different context detail is still the same event.
|
|
289
263
|
|
|
290
264
|
#### Toast CSS Custom Properties
|
|
291
265
|
|
|
@@ -299,7 +273,7 @@ dedup — same event with different context detail is still the same event.
|
|
|
299
273
|
| `--cngx-toast-description-line-height` | `1.4` | Description line height |
|
|
300
274
|
| `--cngx-toast-description-max-lines` | `3` | Line-clamp for description |
|
|
301
275
|
|
|
302
|
-
### CngxAlert
|
|
276
|
+
### CngxAlert - Inline Alert Atom (`@cngx/ui/feedback`)
|
|
303
277
|
|
|
304
278
|
Inline alert with enter/exit animations, state-driven visibility, auto-dismiss
|
|
305
279
|
with pause-on-hover/focus (WCAG 2.2.1), optional auto-collapse, and action buttons.
|
|
@@ -373,10 +347,10 @@ Exit: `ease-in 150ms`. Icon pulse on enter (one-shot, 300ms).
|
|
|
373
347
|
| `--cngx-alert-{severity}-border` | per severity | Border color |
|
|
374
348
|
| `--cngx-alert-{severity}-icon` | per severity | Icon color |
|
|
375
349
|
|
|
376
|
-
### CngxAlertStack + CngxAlerter
|
|
350
|
+
### CngxAlertStack + CngxAlerter - Scoped Alert System (`@cngx/ui/feedback`)
|
|
377
351
|
|
|
378
352
|
Scoped inline alert stacking with programmatic service. Each `CngxAlertStack` provides
|
|
379
|
-
its own `CngxAlerter` via `viewProviders`
|
|
353
|
+
its own `CngxAlerter` via `viewProviders` - nested stacks (e.g. in dialogs) are fully
|
|
380
354
|
isolated.
|
|
381
355
|
|
|
382
356
|
```html
|
|
@@ -426,7 +400,7 @@ For root-level injection (outside a stack), add `withAlerts()` to `provideFeedba
|
|
|
426
400
|
**ARIA:** `role="log"` + `aria-live="polite"` on container. `aria-expanded` + `aria-controls`
|
|
427
401
|
on overflow button.
|
|
428
402
|
|
|
429
|
-
#### CngxAlertOn
|
|
403
|
+
#### CngxAlertOn - State Bridge
|
|
430
404
|
|
|
431
405
|
```html
|
|
432
406
|
<button [cngxAsyncClick]="save"
|
|
@@ -440,7 +414,7 @@ on overflow button.
|
|
|
440
414
|
**Inputs:** `cngxAlertOn` (required `CngxAsyncState`), `alertSuccess`, `alertError`,
|
|
441
415
|
`alertErrorDetail` (boolean), `alertScope`.
|
|
442
416
|
|
|
443
|
-
### CngxBanner + CngxBannerOutlet
|
|
417
|
+
### CngxBanner + CngxBannerOutlet - Global Banner System (`@cngx/ui/feedback`)
|
|
444
418
|
|
|
445
419
|
System-level banners for session timeout, maintenance, offline status. Sticky top,
|
|
446
420
|
always persistent (no auto-dismiss), dedup by required `id`.
|
|
@@ -503,7 +477,7 @@ disables during execution. Success: banner dismissed. Error: banner stays open.
|
|
|
503
477
|
**Layout:** `position: sticky; top: 0; z-index: 900` (below Material dialogs at 1000).
|
|
504
478
|
`:empty` hides the outlet completely (`display: none`).
|
|
505
479
|
|
|
506
|
-
#### CngxBannerTrigger
|
|
480
|
+
#### CngxBannerTrigger - Declarative Banner
|
|
507
481
|
|
|
508
482
|
```html
|
|
509
483
|
<cngx-banner-trigger
|
|
@@ -519,7 +493,7 @@ Dismissed on component destroy.
|
|
|
519
493
|
**Inputs:** `when` (required), `message` (required), `id` (required), `severity`,
|
|
520
494
|
`dismissible`, `actionLabel`, `actionHandler`.
|
|
521
495
|
|
|
522
|
-
#### CngxBannerOn
|
|
496
|
+
#### CngxBannerOn - State Bridge
|
|
523
497
|
|
|
524
498
|
```html
|
|
525
499
|
<div [cngxBannerOn]="connectionState"
|
|
@@ -547,4 +521,4 @@ Shows banner on `error` transition, auto-dismisses on `success`/`idle`.
|
|
|
547
521
|
| `--cngx-banner-{severity}-border` | per severity | Border |
|
|
548
522
|
| `--cngx-banner-{severity}-icon` | per severity | Icon color |
|
|
549
523
|
|
|
550
|
-
**Material theme:** Included in `@use '@cngx/
|
|
524
|
+
**Material theme:** Included in `@use '@cngx/themes/material/feedback-theme'` - `theme($theme)` covers alert, alert-stack, banner, toast, loading, and progress.
|
package/action-button/README.md
CHANGED
|
@@ -26,26 +26,24 @@ export class ExampleComponent {
|
|
|
26
26
|
|
|
27
27
|
## Overview
|
|
28
28
|
|
|
29
|
-
`CngxActionButton` is a molecule wrapping the `CngxAsyncClick` directive with built-in state communication, template slots, and optional toast integration. It uses `display: contents`
|
|
29
|
+
`CngxActionButton` is a molecule wrapping the `CngxAsyncClick` directive with built-in state communication, template slots, and optional toast integration. It uses `display: contents` - the host produces no DOM box; the inner `<button>` carries the directive directly.
|
|
30
30
|
|
|
31
31
|
The component supports three visual feedback pathways:
|
|
32
32
|
|
|
33
|
-
1. **Fallback labels**
|
|
34
|
-
2. **Template slots**
|
|
35
|
-
3. **Automatic state prop**
|
|
33
|
+
1. **Fallback labels** - `pendingLabel`, `succeededLabel`, `failedLabel` strings
|
|
34
|
+
2. **Template slots** - `cngxPending`, `cngxSucceeded`, `cngxFailed` directives
|
|
35
|
+
3. **Automatic state prop** - bind `btn.state` to any state consumer
|
|
36
36
|
|
|
37
37
|
A screen-reader-only `aria-live` region announces state transitions without visual noise.
|
|
38
38
|
|
|
39
39
|
## Accessibility
|
|
40
40
|
|
|
41
|
-
`
|
|
42
|
-
|
|
43
|
-
- **ARIA roles:** The inner `<button>` carries all ARIA attributes from `CngxAsyncClick` — `aria-busy` when pending, no explicit role (semantic `<button>`).
|
|
41
|
+
- **ARIA roles:** The inner `<button>` carries all ARIA attributes from `CngxAsyncClick` - `aria-busy` when pending, no explicit role (semantic `<button>`).
|
|
44
42
|
- **Keyboard interaction:**
|
|
45
|
-
- `Enter` / `Space`
|
|
46
|
-
- `Escape`
|
|
43
|
+
- `Enter` / `Space` - Activate the action
|
|
44
|
+
- `Escape` - No special behavior (standard button)
|
|
47
45
|
- **Screen reader:** `aria-live="polite"` region announces state transitions: "Action succeeded", "Action failed", and the optional custom announcements via `succeededAnnouncement` / `failedAnnouncement`.
|
|
48
|
-
- **Focus management:** Focus remains on the button throughout the lifecycle
|
|
46
|
+
- **Focus management:** Focus remains on the button throughout the lifecycle - no focus trap or restoration.
|
|
49
47
|
|
|
50
48
|
## Composition
|
|
51
49
|
|
|
@@ -85,7 +83,7 @@ To apply Material Design 3 theme colors, include the theme SCSS in your global s
|
|
|
85
83
|
|
|
86
84
|
```scss
|
|
87
85
|
@use '@angular/material' as mat;
|
|
88
|
-
@use '@cngx/
|
|
86
|
+
@use '@cngx/themes/material/action-button-theme' as action-btn;
|
|
89
87
|
|
|
90
88
|
$theme: mat.define-theme((...));
|
|
91
89
|
|
package/empty-state/README.md
CHANGED
|
@@ -35,17 +35,15 @@ export class ExampleComponent {
|
|
|
35
35
|
|
|
36
36
|
`CngxEmptyState` is an atom component that displays when a collection is empty, providing context about why and what the user can do next. It communicates three distinct UX scenarios:
|
|
37
37
|
|
|
38
|
-
1. **First-use**
|
|
39
|
-
2. **No-results**
|
|
40
|
-
3. **Cleared**
|
|
38
|
+
1. **First-use** - Onboarding, show what's possible
|
|
39
|
+
2. **No-results** - Recovery, offer filter reset or search change
|
|
40
|
+
3. **Cleared** - Confirmation, everything is done
|
|
41
41
|
|
|
42
42
|
The component supports icon projection via the `[cngxEmptyStateIcon]` slot (no Material dependency) and action buttons via `[cngxEmptyStateAction]`. Integrates with `CngxAsyncState` for automatic visibility control.
|
|
43
43
|
|
|
44
44
|
## Accessibility
|
|
45
45
|
|
|
46
|
-
`
|
|
47
|
-
|
|
48
|
-
- **ARIA roles:** Host is `role="status"` with `aria-live="polite"` — announces empty state changes.
|
|
46
|
+
- **ARIA roles:** Host is `role="status"` with `aria-live="polite"` - announces empty state changes.
|
|
49
47
|
- **Labeling:** Title has `id` bound to `aria-labelledby`; description has `id` bound to `aria-describedby` (when present).
|
|
50
48
|
- **Hidden state:** When bound to async state with data, uses `[attr.hidden]` to remove from the accessibility tree.
|
|
51
49
|
- **Screen reader:** Icon is `aria-hidden="true"` (decorative); title and description carry the meaning.
|
|
@@ -54,23 +52,10 @@ The component supports icon projection via the `[cngxEmptyStateIcon]` slot (no M
|
|
|
54
52
|
|
|
55
53
|
`CngxEmptyState` composes:
|
|
56
54
|
|
|
57
|
-
- **Async state integration**
|
|
58
|
-
- **Content projection**
|
|
59
|
-
- **Auto-ID generation**
|
|
60
|
-
|
|
61
|
-
## Styling
|
|
62
|
-
|
|
63
|
-
All colors and spacing use CSS Custom Properties with sensible defaults:
|
|
55
|
+
- **Async state integration** - Reads `CngxAsyncState<T>` and auto-hides when data is not empty
|
|
56
|
+
- **Content projection** - Four named slots for icon, illustration, actions, and secondary content
|
|
57
|
+
- **Auto-ID generation** - Generates unique IDs for title/description ARIA references
|
|
64
58
|
|
|
65
|
-
```scss
|
|
66
|
-
// Override in your component or global styles
|
|
67
|
-
:host {
|
|
68
|
-
--cngx-empty-state-padding: 60px 20px;
|
|
69
|
-
--cngx-empty-state-gap: 24px;
|
|
70
|
-
--cngx-empty-state-icon-size: 80px;
|
|
71
|
-
--cngx-empty-state-title-font-size: 20px;
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
59
|
|
|
75
60
|
## Material Theme
|
|
76
61
|
|
|
@@ -78,7 +63,7 @@ Include the theme SCSS in your global stylesheet:
|
|
|
78
63
|
|
|
79
64
|
```scss
|
|
80
65
|
@use '@angular/material' as mat;
|
|
81
|
-
@use '@cngx/
|
|
66
|
+
@use '@cngx/themes/material/empty-state-theme' as empty-state;
|
|
82
67
|
|
|
83
68
|
$theme: mat.define-theme((...));
|
|
84
69
|
|
|
@@ -97,7 +82,7 @@ The theme mixin provides:
|
|
|
97
82
|
|
|
98
83
|
## See Also
|
|
99
84
|
|
|
100
|
-
- [CngxAsyncState](../../core/utils/)
|
|
101
|
-
- [
|
|
102
|
-
- Demo: `
|
|
85
|
+
- [CngxAsyncState](../../core/utils/) - Async state contract
|
|
86
|
+
- [API on compodocx](https://cngxjs.github.io/cngx/)
|
|
87
|
+
- Demo: `examples/stories/ui/empty-state-demo/`
|
|
103
88
|
- Tests: `projects/ui/empty-state/empty-state.component.spec.ts`
|
package/feedback/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @cngx/ui/feedback
|
|
2
2
|
|
|
3
|
-
The communication surfaces of cngx
|
|
3
|
+
The communication surfaces of cngx - toasts, banners, alerts, loading indicators, and the async-container molecule. The bridge between an async state and the user's eyes.
|
|
4
4
|
|
|
5
5
|
## When you reach for it
|
|
6
6
|
|
|
7
7
|
You have a piece of async state (loading a list, saving a form, retrying a request) and want the user to see what is happening without you wiring four signals into four templates:
|
|
8
8
|
|
|
9
|
-
- **Loading indicators**
|
|
9
|
+
- **Loading indicators** - spinner, bar, dots, text - whenever a region is busy.
|
|
10
10
|
- **An async-aware container** that swaps between skeleton, content, empty, and error views with a single binding.
|
|
11
11
|
- **Toasts** for ephemeral success and error notifications.
|
|
12
12
|
- **Banners** for persistent top-of-page errors that should clear themselves on the next success.
|
|
@@ -25,7 +25,7 @@ Two patterns make the whole feedback layer feel cohesive:
|
|
|
25
25
|
|
|
26
26
|
## Bootstrap requirement
|
|
27
27
|
|
|
28
|
-
Toast, banner, and alerter services are **not** `providedIn: 'root'`. Provide them via `provideFeedback(...)` in your application bootstrap, and render the outlets once at the application root. This is intentional
|
|
28
|
+
Toast, banner, and alerter services are **not** `providedIn: 'root'`. Provide them via `provideFeedback(...)` in your application bootstrap, and render the outlets once at the application root. This is intentional - feedback presentation is application-level, not library-level, and forcing the consumer to opt in keeps a tree-shake-friendly footprint when only a subset of surfaces is in use.
|
|
29
29
|
|
|
30
30
|
## See also
|
|
31
31
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, input, viewChild, computed, signal, contentChild, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
-
import { CngxAsyncClick, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
|
|
4
|
+
import { CngxAsyncClick, reflectAsyncDisplayStatus, CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';
|
|
5
5
|
import { buildAsyncStateView, createTransitionTracker } from '@cngx/core/utils';
|
|
6
6
|
import { CngxToaster, CngxToastOn } from '@cngx/ui/feedback';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Action button
|
|
9
|
+
* Action button organism with built-in status communication.
|
|
10
10
|
*
|
|
11
11
|
* Coordinates between the `CngxAsyncClick` atom (mechanism, ARIA, lifecycle)
|
|
12
12
|
* and the consumer (intent, styling, labels). Provides template projection
|
|
13
13
|
* for pending/succeeded/failed states and an `aria-live` region for screen
|
|
14
14
|
* reader announcements.
|
|
15
15
|
*
|
|
16
|
-
* Uses `display: contents`
|
|
16
|
+
* Uses `display: contents` - the host produces no DOM box. The inner `<button>`
|
|
17
17
|
* carries the `[cngxAsyncClick]` directive directly.
|
|
18
18
|
*
|
|
19
19
|
* For full control, use `[cngxAsyncClick]` directly on any element instead.
|
|
@@ -37,7 +37,7 @@ import { CngxToaster, CngxToastOn } from '@cngx/ui/feedback';
|
|
|
37
37
|
* Save Draft
|
|
38
38
|
* <ng-template cngxPending><mat-spinner diameter="18" /> Saving...</ng-template>
|
|
39
39
|
* <ng-template cngxSucceeded>Saved!</ng-template>
|
|
40
|
-
* <ng-template cngxFailed let-err>{{ err }}
|
|
40
|
+
* <ng-template cngxFailed let-err>{{ err }} - retry?</ng-template>
|
|
41
41
|
* </cngx-action-button>
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
@@ -47,6 +47,16 @@ import { CngxToaster, CngxToastOn } from '@cngx/ui/feedback';
|
|
|
47
47
|
* Save
|
|
48
48
|
* </cngx-action-button>
|
|
49
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @category ui/action-button
|
|
52
|
+
* @docsKind primary
|
|
53
|
+
* @wcag AA
|
|
54
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/action-button/action-button.ts
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
* @relatedTo CngxAsyncClick, CngxPending, CngxSucceeded, CngxFailed, CngxToaster
|
|
57
|
+
* <example-url>http://localhost:4200/#/ui/action-button/async-button/random-outcome</example-url>
|
|
58
|
+
* <example-url>http://localhost:4200/#/ui/action-button/async-button/string-labels</example-url>
|
|
59
|
+
* <example-url>http://localhost:4200/#/ui/action-button/async-button/template-slots</example-url>
|
|
50
60
|
*/
|
|
51
61
|
class CngxActionButton {
|
|
52
62
|
toaster = inject(CngxToaster, { optional: true });
|
|
@@ -59,7 +69,7 @@ class CngxActionButton {
|
|
|
59
69
|
enabled = input(true, ...(ngDevMode ? [{ debugName: "enabled" }] : /* istanbul ignore next */ []));
|
|
60
70
|
/** Button type attribute. Defaults to `'button'` to prevent accidental form submits. */
|
|
61
71
|
type = input('button', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
62
|
-
/** Visual variant
|
|
72
|
+
/** Visual variant - sets CSS class `cngx-action-button--{variant}`. */
|
|
63
73
|
variant = input('primary', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
64
74
|
/** SR announcement on success. Falls back to `succeededLabel`, then `'Action succeeded'`. */
|
|
65
75
|
succeededAnnouncement = input(undefined, ...(ngDevMode ? [{ debugName: "succeededAnnouncement" }] : /* istanbul ignore next */ []));
|
|
@@ -90,35 +100,26 @@ class CngxActionButton {
|
|
|
90
100
|
toastErrorDetail = input(false, ...(ngDevMode ? [{ debugName: "toastErrorDetail" }] : /* istanbul ignore next */ []));
|
|
91
101
|
/** Duration for success toasts in ms. */
|
|
92
102
|
toastSuccessDuration = input(3000, ...(ngDevMode ? [{ debugName: "toastSuccessDuration" }] : /* istanbul ignore next */ []));
|
|
93
|
-
/** Duration for error toasts
|
|
103
|
+
/** Duration for error toasts - `'persistent'` means manual dismiss only. */
|
|
94
104
|
toastErrorDuration = input('persistent', ...(ngDevMode ? [{ debugName: "toastErrorDuration" }] : /* istanbul ignore next */ []));
|
|
95
|
-
/** @internal
|
|
105
|
+
/** @internal - inner CngxAsyncClick directive instance. Non-required to allow safe pre-view-init reads. */
|
|
96
106
|
asyncClick = viewChild(CngxAsyncClick, ...(ngDevMode ? [{ debugName: "asyncClick" }] : /* istanbul ignore next */ []));
|
|
97
107
|
/**
|
|
98
|
-
* @internal
|
|
99
|
-
*
|
|
108
|
+
* @internal - effective status: reflects external `[externalState]` if
|
|
109
|
+
* bound (through the shared `CngxAsyncStatus` reflection - one home for
|
|
110
|
+
* the state→display-bucket mapping), otherwise reads the inner
|
|
111
|
+
* `CngxAsyncClick` directive.
|
|
100
112
|
*/
|
|
101
113
|
effectiveStatus = computed(() => {
|
|
102
114
|
const ext = this.externalState();
|
|
103
115
|
if (ext) {
|
|
104
|
-
|
|
105
|
-
if (status === 'pending') {
|
|
106
|
-
return 'pending';
|
|
107
|
-
}
|
|
108
|
-
if (status === 'success') {
|
|
109
|
-
return 'success';
|
|
110
|
-
}
|
|
111
|
-
if (status === 'error') {
|
|
112
|
-
return 'error';
|
|
113
|
-
}
|
|
114
|
-
return 'idle';
|
|
116
|
+
return reflectAsyncDisplayStatus(ext);
|
|
115
117
|
}
|
|
116
|
-
//
|
|
117
|
-
// Guard protects consumers reading `state` before view init.
|
|
118
|
+
// Guard against pre-view-init reads of `state` from consumers.
|
|
118
119
|
const click = this.asyncClick();
|
|
119
120
|
return click ? click.status() : 'idle';
|
|
120
121
|
}, ...(ngDevMode ? [{ debugName: "effectiveStatus" }] : /* istanbul ignore next */ []));
|
|
121
|
-
/** @internal
|
|
122
|
+
/** @internal - effective error value from external state or inner directive. */
|
|
122
123
|
effectiveError = computed(() => {
|
|
123
124
|
const ext = this.externalState();
|
|
124
125
|
if (ext) {
|
|
@@ -149,7 +150,7 @@ class CngxActionButton {
|
|
|
149
150
|
/** @internal */
|
|
150
151
|
failedTpl = contentChild(CngxFailed, ...(ngDevMode ? [{ debugName: "failedTpl" }] : /* istanbul ignore next */ []));
|
|
151
152
|
constructor() {
|
|
152
|
-
// Double-toast guard
|
|
153
|
+
// Double-toast guard, consumer placed [cngxToastOn] on the same element.
|
|
153
154
|
if (typeof ngDevMode !== 'undefined' &&
|
|
154
155
|
ngDevMode &&
|
|
155
156
|
this.externalToastOn &&
|
|
@@ -165,6 +166,9 @@ class CngxActionButton {
|
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
168
|
if (status === 'success') {
|
|
169
|
+
// Producer write for the buildAsyncStateView `lastUpdated` slot (no other
|
|
170
|
+
// source feeds it) - state production, not derived-state sync. This is the
|
|
171
|
+
// sanctioned signal-write-in-effect class, same as the async-state-view pattern.
|
|
168
172
|
this.lastUpdatedState.set(new Date());
|
|
169
173
|
const msg = this.toastSuccess();
|
|
170
174
|
if (msg && this.toaster) {
|
|
@@ -247,7 +251,7 @@ class CngxActionButton {
|
|
|
247
251
|
<span aria-live="polite" aria-atomic="true" class="cngx-action-button__sr-only">{{
|
|
248
252
|
btn.announcement()
|
|
249
253
|
}}</span>
|
|
250
|
-
`, isInline: true, styles: [".cngx-action-button__sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CngxAsyncClick, selector: "[cngxAsyncClick]", inputs: ["cngxAsyncClick", "feedbackDuration", "enabled", "succeededAnnouncement", "failedAnnouncement"], exportAs: ["cngxAsyncClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
254
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-action-btn-transition{syntax: \"*\"; inherits: false; initial-value: .2s ease;}@property --cngx-action-btn-radius{syntax: \"<length>\"; inherits: false; initial-value: 6px;}@property --cngx-action-btn-padding{syntax: \"*\"; inherits: false; initial-value: 8px 16px;}@property --cngx-action-btn-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.87 0 0);}@property --cngx-action-btn-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-action-btn-pending-opacity{syntax: \"<number>\"; inherits: false; initial-value: .7;}@property --cngx-action-btn-succeeded-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.95 .04 145);}@property --cngx-action-btn-succeeded-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .15 145);}@property --cngx-action-btn-succeeded-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.5 .15 145);}@property --cngx-action-btn-failed-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.95 .025 25);}@property --cngx-action-btn-failed-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .15 25);}@property --cngx-action-btn-failed-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25);}@property --cngx-action-btn-ghost-hover-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0 / .04);}@property --cngx-action-btn-primary-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.55 .15 250);}@property --cngx-action-btn-primary-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-action-btn-secondary-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-action-btn-secondary-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 250);}@property --cngx-action-btn-secondary-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.55 .005 290);}@property --cngx-action-btn-ghost-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.34 .005 290);}}@layer cngx.components{.cngx-action-button{cursor:pointer;border:1px solid var(--cngx-action-btn-border, var(--cngx-color-border, oklch(.87 0 0)));border-radius:var(--cngx-action-btn-radius, 6px);padding:var(--cngx-action-btn-padding, 8px 16px);font:inherit;background:var(--cngx-action-btn-bg, transparent);color:inherit;transition:background-color var(--cngx-action-btn-transition, .2s ease),color var(--cngx-action-btn-transition, .2s ease),border-color var(--cngx-action-btn-transition, .2s ease),opacity var(--cngx-action-btn-transition, .2s ease)}.cngx-action-button--primary{background:var(--cngx-action-btn-primary-bg, var(--cngx-color-primary, oklch(.55 .15 250)));color:var(--cngx-action-btn-primary-color, oklch(1 0 0));border-color:var( --cngx-action-btn-primary-bg, var(--cngx-color-primary, oklch(.55 .15 250)) )}.cngx-action-button--secondary{background:var(--cngx-action-btn-secondary-bg, transparent);color:var(--cngx-action-btn-secondary-color, var(--cngx-color-primary, oklch(.55 .15 250)));border-color:var( --cngx-action-btn-secondary-border, var(--cngx-color-border, oklch(.55 .005 290)) )}.cngx-action-button--ghost{background:transparent;color:var(--cngx-action-btn-ghost-color, var(--cngx-color-text, oklch(.34 .005 290)));border-color:transparent}.cngx-action-button--ghost:hover{background:var(--cngx-action-btn-ghost-hover-bg, oklch(0 0 0 / .04))}.cngx-action-button__sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CngxAsyncClick, selector: "[cngxAsyncClick]", inputs: ["cngxAsyncClick", "feedbackDuration", "enabled", "succeededAnnouncement", "failedAnnouncement"], exportAs: ["cngxAsyncClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
251
255
|
}
|
|
252
256
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxActionButton, decorators: [{
|
|
253
257
|
type: Component,
|
|
@@ -304,7 +308,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
304
308
|
<span aria-live="polite" aria-atomic="true" class="cngx-action-button__sr-only">{{
|
|
305
309
|
btn.announcement()
|
|
306
310
|
}}</span>
|
|
307
|
-
`, styles: [".cngx-action-button__sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"] }]
|
|
311
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-action-btn-transition{syntax: \"*\"; inherits: false; initial-value: .2s ease;}@property --cngx-action-btn-radius{syntax: \"<length>\"; inherits: false; initial-value: 6px;}@property --cngx-action-btn-padding{syntax: \"*\"; inherits: false; initial-value: 8px 16px;}@property --cngx-action-btn-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.87 0 0);}@property --cngx-action-btn-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-action-btn-pending-opacity{syntax: \"<number>\"; inherits: false; initial-value: .7;}@property --cngx-action-btn-succeeded-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.95 .04 145);}@property --cngx-action-btn-succeeded-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .15 145);}@property --cngx-action-btn-succeeded-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.5 .15 145);}@property --cngx-action-btn-failed-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.95 .025 25);}@property --cngx-action-btn-failed-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .15 25);}@property --cngx-action-btn-failed-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25);}@property --cngx-action-btn-ghost-hover-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0 / .04);}@property --cngx-action-btn-primary-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.55 .15 250);}@property --cngx-action-btn-primary-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-action-btn-secondary-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-action-btn-secondary-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 250);}@property --cngx-action-btn-secondary-border{syntax: \"<color>\"; inherits: false; initial-value: oklch(.55 .005 290);}@property --cngx-action-btn-ghost-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.34 .005 290);}}@layer cngx.components{.cngx-action-button{cursor:pointer;border:1px solid var(--cngx-action-btn-border, var(--cngx-color-border, oklch(.87 0 0)));border-radius:var(--cngx-action-btn-radius, 6px);padding:var(--cngx-action-btn-padding, 8px 16px);font:inherit;background:var(--cngx-action-btn-bg, transparent);color:inherit;transition:background-color var(--cngx-action-btn-transition, .2s ease),color var(--cngx-action-btn-transition, .2s ease),border-color var(--cngx-action-btn-transition, .2s ease),opacity var(--cngx-action-btn-transition, .2s ease)}.cngx-action-button--primary{background:var(--cngx-action-btn-primary-bg, var(--cngx-color-primary, oklch(.55 .15 250)));color:var(--cngx-action-btn-primary-color, oklch(1 0 0));border-color:var( --cngx-action-btn-primary-bg, var(--cngx-color-primary, oklch(.55 .15 250)) )}.cngx-action-button--secondary{background:var(--cngx-action-btn-secondary-bg, transparent);color:var(--cngx-action-btn-secondary-color, var(--cngx-color-primary, oklch(.55 .15 250)));border-color:var( --cngx-action-btn-secondary-border, var(--cngx-color-border, oklch(.55 .005 290)) )}.cngx-action-button--ghost{background:transparent;color:var(--cngx-action-btn-ghost-color, var(--cngx-color-text, oklch(.34 .005 290)));border-color:transparent}.cngx-action-button--ghost:hover{background:var(--cngx-action-btn-ghost-hover-bg, oklch(0 0 0 / .04))}.cngx-action-button__sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}\n"] }]
|
|
308
312
|
}], ctorParameters: () => [], propDecorators: { action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: true }] }], feedbackDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "feedbackDuration", required: false }] }], enabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "enabled", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], succeededAnnouncement: [{ type: i0.Input, args: [{ isSignal: true, alias: "succeededAnnouncement", required: false }] }], failedAnnouncement: [{ type: i0.Input, args: [{ isSignal: true, alias: "failedAnnouncement", required: false }] }], pendingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "pendingLabel", required: false }] }], succeededLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "succeededLabel", required: false }] }], failedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "failedLabel", required: false }] }], externalState: [{ type: i0.Input, args: [{ isSignal: true, alias: "externalState", required: false }] }], toastSuccess: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastSuccess", required: false }] }], toastError: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastError", required: false }] }], toastErrorDetail: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastErrorDetail", required: false }] }], toastSuccessDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastSuccessDuration", required: false }] }], toastErrorDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastErrorDuration", required: false }] }], asyncClick: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CngxAsyncClick), { isSignal: true }] }], pendingTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxPending), { isSignal: true }] }], succeededTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxSucceeded), { isSignal: true }] }], failedTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxFailed), { isSignal: true }] }] } });
|
|
309
313
|
|
|
310
314
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-ui-action-button.mjs","sources":["../../../projects/ui/action-button/action-button.ts","../../../projects/ui/action-button/public-api.ts","../../../projects/ui/action-button/cngx-ui-action-button.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n effect,\n inject,\n input,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n CngxAsyncClick,\n CngxFailed,\n CngxPending,\n CngxSucceeded,\n type AsyncAction,\n} from '@cngx/common/interactive';\nimport {\n buildAsyncStateView,\n createTransitionTracker,\n type CngxAsyncState,\n} from '@cngx/core/utils';\nimport { CngxToastOn, CngxToaster } from '@cngx/ui/feedback';\n\n/** Visual variant for the action button — maps to a CSS class. */\nexport type ActionButtonVariant = 'primary' | 'secondary' | 'ghost';\n\n/**\n * Action button molecule with built-in status communication.\n *\n * Coordinates between the `CngxAsyncClick` atom (mechanism, ARIA, lifecycle)\n * and the consumer (intent, styling, labels). Provides template projection\n * for pending/succeeded/failed states and an `aria-live` region for screen\n * reader announcements.\n *\n * Uses `display: contents` — the host produces no DOM box. The inner `<button>`\n * carries the `[cngxAsyncClick]` directive directly.\n *\n * For full control, use `[cngxAsyncClick]` directly on any element instead.\n *\n * ### Minimal (covers 80% of cases)\n * ```html\n * <cngx-action-button [action]=\"save\">Save</cngx-action-button>\n * ```\n *\n * ### With string labels\n * ```html\n * <cngx-action-button [action]=\"save\"\n * pendingLabel=\"Saving...\" succeededLabel=\"Saved!\" failedLabel=\"Failed\">\n * Save\n * </cngx-action-button>\n * ```\n *\n * ### With template slots\n * ```html\n * <cngx-action-button [action]=\"save\">\n * Save Draft\n * <ng-template cngxPending><mat-spinner diameter=\"18\" /> Saving...</ng-template>\n * <ng-template cngxSucceeded>Saved!</ng-template>\n * <ng-template cngxFailed let-err>{{ err }} — retry?</ng-template>\n * </cngx-action-button>\n * ```\n *\n * ### With toast feedback\n * ```html\n * <cngx-action-button [action]=\"save\" toastSuccess=\"Saved\" toastError=\"Save failed\">\n * Save\n * </cngx-action-button>\n * ```\n */\n@Component({\n selector: 'cngx-action-button',\n standalone: true,\n imports: [NgTemplateOutlet, CngxAsyncClick],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n exportAs: 'cngxActionButton',\n host: {\n style: 'display: contents',\n },\n template: `\n <ng-template #idle><ng-content /></ng-template>\n\n <button\n [type]=\"type()\"\n [cngxAsyncClick]=\"action()\"\n #btn=\"cngxAsyncClick\"\n [feedbackDuration]=\"feedbackDuration()\"\n [enabled]=\"enabled()\"\n [succeededAnnouncement]=\"succeededAnnouncement() ?? succeededLabel() ?? 'Action succeeded'\"\n [failedAnnouncement]=\"failedAnnouncement() ?? failedLabel() ?? 'Action failed'\"\n [class]=\"'cngx-action-button cngx-action-button--' + variant()\"\n >\n @switch (effectiveStatus()) {\n @case ('pending') {\n @if (pendingTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl.templateRef\" />\n } @else if (pendingLabel()) {\n {{ pendingLabel() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n @case ('success') {\n @if (succeededTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl.templateRef\" />\n } @else if (succeededLabel()) {\n {{ succeededLabel() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n @case ('error') {\n @if (failedTpl(); as tpl) {\n <ng-container\n *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: effectiveError() }\"\n />\n } @else if (failedLabel()) {\n {{ failedLabel() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n @default {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n </button>\n <span aria-live=\"polite\" aria-atomic=\"true\" class=\"cngx-action-button__sr-only\">{{\n btn.announcement()\n }}</span>\n `,\n styles: `\n .cngx-action-button__sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n `,\n})\nexport class CngxActionButton {\n private readonly toaster = inject(CngxToaster, { optional: true });\n private readonly externalToastOn = inject(CngxToastOn, { self: true, optional: true });\n\n /** The async action to execute on click. */\n readonly action = input.required<AsyncAction>();\n\n /** Duration in ms to show success/error feedback. Passed through to `cngxAsyncClick`. */\n readonly feedbackDuration = input<number>(2000);\n\n /** When `false`, clicks are ignored. Passed through to `cngxAsyncClick`. */\n readonly enabled = input<boolean>(true);\n\n /** Button type attribute. Defaults to `'button'` to prevent accidental form submits. */\n readonly type = input<'button' | 'submit' | 'reset'>('button');\n\n /** Visual variant — sets CSS class `cngx-action-button--{variant}`. */\n readonly variant = input<ActionButtonVariant>('primary');\n\n /** SR announcement on success. Falls back to `succeededLabel`, then `'Action succeeded'`. */\n readonly succeededAnnouncement = input<string | undefined>(undefined);\n\n /** SR announcement on failure. Falls back to `failedLabel`, then `'Action failed'`. */\n readonly failedAnnouncement = input<string | undefined>(undefined);\n\n /** Fallback text while pending (when no `cngxPending` template is projected). */\n readonly pendingLabel = input<string | undefined>(undefined);\n\n /** Fallback text after success (when no `cngxSucceeded` template is projected). */\n readonly succeededLabel = input<string | undefined>(undefined);\n\n /** Fallback text after failure (when no `cngxFailed` template is projected). */\n readonly failedLabel = input<string | undefined>(undefined);\n\n /**\n * Bind an external async state to derive visual status from.\n * When set, the button's status display follows `externalState.status()`.\n */\n readonly externalState = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /**\n * Toast message on success. Requires `CngxToaster` (via `provideFeedback(withToasts())`\n * or `provideToasts()`). Silently ignored when toaster is not provided.\n *\n * `toastSuccessDuration` should be >= `feedbackDuration` to avoid rapid re-fire\n * on repeated clicks that floods the SR announcement queue.\n */\n readonly toastSuccess = input<string | undefined>(undefined);\n\n /** Toast message on error. */\n readonly toastError = input<string | undefined>(undefined);\n\n /** Include the error detail message in the error toast body. */\n readonly toastErrorDetail = input<boolean>(false);\n\n /** Duration for success toasts in ms. */\n readonly toastSuccessDuration = input<number>(3000);\n\n /** Duration for error toasts — `'persistent'` means manual dismiss only. */\n readonly toastErrorDuration = input<number | 'persistent'>('persistent');\n\n /** @internal — inner CngxAsyncClick directive instance. Non-required to allow safe pre-view-init reads. */\n private readonly asyncClick = viewChild(CngxAsyncClick);\n\n /**\n * @internal — effective status: reads from external `[externalState]` if bound,\n * otherwise from the inner `CngxAsyncClick` directive.\n */\n protected readonly effectiveStatus = computed(() => {\n const ext = this.externalState();\n if (ext) {\n const status = ext.status();\n if (status === 'pending') {\n return 'pending' as const;\n }\n if (status === 'success') {\n return 'success' as const;\n }\n if (status === 'error') {\n return 'error' as const;\n }\n return 'idle' as const;\n }\n // viewChild is guaranteed resolved when the template reads this computed.\n // Guard protects consumers reading `state` before view init.\n const click = this.asyncClick();\n return click ? click.status() : ('idle' as const);\n });\n\n /** @internal — effective error value from external state or inner directive. */\n protected readonly effectiveError = computed(() => {\n const ext = this.externalState();\n if (ext) {\n return ext.error();\n }\n const click = this.asyncClick();\n return click ? click.error() : undefined;\n });\n\n private readonly lastUpdatedState = signal<Date | undefined>(undefined);\n\n /**\n * Full `CngxAsyncState` view of this button's effective lifecycle.\n *\n * Reflects the external state when `[externalState]` is bound,\n * otherwise the inner `CngxAsyncClick` directive's state.\n *\n * Bind to any state consumer: `<cngx-alert [state]=\"btn.state\" />`.\n */\n readonly state: CngxAsyncState<unknown> = buildAsyncStateView<unknown>({\n status: this.effectiveStatus,\n data: computed(() => undefined),\n error: this.effectiveError,\n lastUpdated: this.lastUpdatedState.asReadonly(),\n });\n\n /** @internal */\n protected readonly pendingTpl = contentChild(CngxPending);\n /** @internal */\n protected readonly succeededTpl = contentChild(CngxSucceeded);\n /** @internal */\n protected readonly failedTpl = contentChild(CngxFailed);\n\n constructor() {\n // Double-toast guard: warn once if consumer also placed [cngxToastOn] on this element\n if (\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n this.externalToastOn &&\n (this.toastSuccess() || this.toastError())\n ) {\n console.warn(\n 'CngxActionButton: [toastSuccess]/[toastError] inputs and [cngxToastOn] ' +\n 'on the same element will fire duplicate toasts. Use one or the other.',\n );\n }\n\n const tracker = createTransitionTracker(() => this.effectiveStatus());\n\n effect(() => {\n const status = tracker.current();\n const previous = tracker.previous();\n\n if (status === previous) {\n return;\n }\n\n if (status === 'success') {\n this.lastUpdatedState.set(new Date());\n const msg = this.toastSuccess();\n if (msg && this.toaster) {\n this.toaster.show({\n message: msg,\n severity: 'success',\n duration: this.toastSuccessDuration(),\n });\n }\n }\n\n if (status === 'error') {\n const msg = this.toastError();\n if (msg && this.toaster) {\n const err = this.effectiveError();\n const detail =\n this.toastErrorDetail() && err != null\n ? err instanceof Error\n ? err.message\n : typeof err === 'string'\n ? err\n : undefined\n : undefined;\n this.toaster.show({\n message: detail ? `${msg}: ${detail}` : msg,\n severity: 'error',\n duration: this.toastErrorDuration(),\n });\n }\n }\n });\n }\n}\n","/**\n * @module @cngx/ui/action-button\n */\n\nexport { CngxActionButton, type ActionButtonVariant } from './action-button';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;MA6EU,gBAAgB,CAAA;IACV,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE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EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,cAAc,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAuDT,WAAW,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAET,aAAa,2FAEhB,UAAU,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC9QxD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-ui-action-button.mjs","sources":["../../../projects/ui/action-button/action-button.ts","../../../projects/ui/action-button/public-api.ts","../../../projects/ui/action-button/cngx-ui-action-button.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n effect,\n inject,\n input,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n CngxAsyncClick,\n CngxFailed,\n CngxPending,\n CngxSucceeded,\n reflectAsyncDisplayStatus,\n type AsyncAction,\n} from '@cngx/common/interactive';\nimport {\n buildAsyncStateView,\n createTransitionTracker,\n type CngxAsyncState,\n} from '@cngx/core/utils';\nimport { CngxToastOn, CngxToaster } from '@cngx/ui/feedback';\n\n/**\n * Visual variant for the action button - maps to a CSS class.\n *\n * @category ui/action-button\n */\nexport type ActionButtonVariant = 'primary' | 'secondary' | 'ghost';\n\n/**\n * Action button organism with built-in status communication.\n *\n * Coordinates between the `CngxAsyncClick` atom (mechanism, ARIA, lifecycle)\n * and the consumer (intent, styling, labels). Provides template projection\n * for pending/succeeded/failed states and an `aria-live` region for screen\n * reader announcements.\n *\n * Uses `display: contents` - the host produces no DOM box. The inner `<button>`\n * carries the `[cngxAsyncClick]` directive directly.\n *\n * For full control, use `[cngxAsyncClick]` directly on any element instead.\n *\n * ### Minimal (covers 80% of cases)\n * ```html\n * <cngx-action-button [action]=\"save\">Save</cngx-action-button>\n * ```\n *\n * ### With string labels\n * ```html\n * <cngx-action-button [action]=\"save\"\n * pendingLabel=\"Saving...\" succeededLabel=\"Saved!\" failedLabel=\"Failed\">\n * Save\n * </cngx-action-button>\n * ```\n *\n * ### With template slots\n * ```html\n * <cngx-action-button [action]=\"save\">\n * Save Draft\n * <ng-template cngxPending><mat-spinner diameter=\"18\" /> Saving...</ng-template>\n * <ng-template cngxSucceeded>Saved!</ng-template>\n * <ng-template cngxFailed let-err>{{ err }} - retry?</ng-template>\n * </cngx-action-button>\n * ```\n *\n * ### With toast feedback\n * ```html\n * <cngx-action-button [action]=\"save\" toastSuccess=\"Saved\" toastError=\"Save failed\">\n * Save\n * </cngx-action-button>\n * ```\n *\n * @category ui/action-button\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/action-button/action-button.ts\n * @since 0.1.0\n * @relatedTo CngxAsyncClick, CngxPending, CngxSucceeded, CngxFailed, CngxToaster\n * <example-url>http://localhost:4200/#/ui/action-button/async-button/random-outcome</example-url>\n * <example-url>http://localhost:4200/#/ui/action-button/async-button/string-labels</example-url>\n * <example-url>http://localhost:4200/#/ui/action-button/async-button/template-slots</example-url>\n */\n@Component({\n selector: 'cngx-action-button',\n standalone: true,\n imports: [NgTemplateOutlet, CngxAsyncClick],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n exportAs: 'cngxActionButton',\n host: {\n style: 'display: contents',\n },\n template: `\n <ng-template #idle><ng-content /></ng-template>\n\n <button\n [type]=\"type()\"\n [cngxAsyncClick]=\"action()\"\n #btn=\"cngxAsyncClick\"\n [feedbackDuration]=\"feedbackDuration()\"\n [enabled]=\"enabled()\"\n [succeededAnnouncement]=\"succeededAnnouncement() ?? succeededLabel() ?? 'Action succeeded'\"\n [failedAnnouncement]=\"failedAnnouncement() ?? failedLabel() ?? 'Action failed'\"\n [class]=\"'cngx-action-button cngx-action-button--' + variant()\"\n >\n @switch (effectiveStatus()) {\n @case ('pending') {\n @if (pendingTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl.templateRef\" />\n } @else if (pendingLabel()) {\n {{ pendingLabel() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n @case ('success') {\n @if (succeededTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl.templateRef\" />\n } @else if (succeededLabel()) {\n {{ succeededLabel() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n @case ('error') {\n @if (failedTpl(); as tpl) {\n <ng-container\n *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: effectiveError() }\"\n />\n } @else if (failedLabel()) {\n {{ failedLabel() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n @default {\n <ng-container *ngTemplateOutlet=\"idle\" />\n }\n }\n </button>\n <span aria-live=\"polite\" aria-atomic=\"true\" class=\"cngx-action-button__sr-only\">{{\n btn.announcement()\n }}</span>\n `,\n styleUrls: ['./action-button.css'],\n})\nexport class CngxActionButton {\n private readonly toaster = inject(CngxToaster, { optional: true });\n private readonly externalToastOn = inject(CngxToastOn, { self: true, optional: true });\n\n /** The async action to execute on click. */\n readonly action = input.required<AsyncAction>();\n\n /** Duration in ms to show success/error feedback. Passed through to `cngxAsyncClick`. */\n readonly feedbackDuration = input<number>(2000);\n\n /** When `false`, clicks are ignored. Passed through to `cngxAsyncClick`. */\n readonly enabled = input<boolean>(true);\n\n /** Button type attribute. Defaults to `'button'` to prevent accidental form submits. */\n readonly type = input<'button' | 'submit' | 'reset'>('button');\n\n /** Visual variant - sets CSS class `cngx-action-button--{variant}`. */\n readonly variant = input<ActionButtonVariant>('primary');\n\n /** SR announcement on success. Falls back to `succeededLabel`, then `'Action succeeded'`. */\n readonly succeededAnnouncement = input<string | undefined>(undefined);\n\n /** SR announcement on failure. Falls back to `failedLabel`, then `'Action failed'`. */\n readonly failedAnnouncement = input<string | undefined>(undefined);\n\n /** Fallback text while pending (when no `cngxPending` template is projected). */\n readonly pendingLabel = input<string | undefined>(undefined);\n\n /** Fallback text after success (when no `cngxSucceeded` template is projected). */\n readonly succeededLabel = input<string | undefined>(undefined);\n\n /** Fallback text after failure (when no `cngxFailed` template is projected). */\n readonly failedLabel = input<string | undefined>(undefined);\n\n /**\n * Bind an external async state to derive visual status from.\n * When set, the button's status display follows `externalState.status()`.\n */\n readonly externalState = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /**\n * Toast message on success. Requires `CngxToaster` (via `provideFeedback(withToasts())`\n * or `provideToasts()`). Silently ignored when toaster is not provided.\n *\n * `toastSuccessDuration` should be >= `feedbackDuration` to avoid rapid re-fire\n * on repeated clicks that floods the SR announcement queue.\n */\n readonly toastSuccess = input<string | undefined>(undefined);\n\n /** Toast message on error. */\n readonly toastError = input<string | undefined>(undefined);\n\n /** Include the error detail message in the error toast body. */\n readonly toastErrorDetail = input<boolean>(false);\n\n /** Duration for success toasts in ms. */\n readonly toastSuccessDuration = input<number>(3000);\n\n /** Duration for error toasts - `'persistent'` means manual dismiss only. */\n readonly toastErrorDuration = input<number | 'persistent'>('persistent');\n\n /** @internal - inner CngxAsyncClick directive instance. Non-required to allow safe pre-view-init reads. */\n private readonly asyncClick = viewChild(CngxAsyncClick);\n\n /**\n * @internal - effective status: reflects external `[externalState]` if\n * bound (through the shared `CngxAsyncStatus` reflection - one home for\n * the state→display-bucket mapping), otherwise reads the inner\n * `CngxAsyncClick` directive.\n */\n protected readonly effectiveStatus = computed(() => {\n const ext = this.externalState();\n if (ext) {\n return reflectAsyncDisplayStatus(ext);\n }\n // Guard against pre-view-init reads of `state` from consumers.\n const click = this.asyncClick();\n return click ? click.status() : ('idle' as const);\n });\n\n /** @internal - effective error value from external state or inner directive. */\n protected readonly effectiveError = computed(() => {\n const ext = this.externalState();\n if (ext) {\n return ext.error();\n }\n const click = this.asyncClick();\n return click ? click.error() : undefined;\n });\n\n private readonly lastUpdatedState = signal<Date | undefined>(undefined);\n\n /**\n * Full `CngxAsyncState` view of this button's effective lifecycle.\n *\n * Reflects the external state when `[externalState]` is bound,\n * otherwise the inner `CngxAsyncClick` directive's state.\n *\n * Bind to any state consumer: `<cngx-alert [state]=\"btn.state\" />`.\n */\n readonly state: CngxAsyncState<unknown> = buildAsyncStateView<unknown>({\n status: this.effectiveStatus,\n data: computed(() => undefined),\n error: this.effectiveError,\n lastUpdated: this.lastUpdatedState.asReadonly(),\n });\n\n /** @internal */\n protected readonly pendingTpl = contentChild(CngxPending);\n /** @internal */\n protected readonly succeededTpl = contentChild(CngxSucceeded);\n /** @internal */\n protected readonly failedTpl = contentChild(CngxFailed);\n\n constructor() {\n // Double-toast guard, consumer placed [cngxToastOn] on the same element.\n if (\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n this.externalToastOn &&\n (this.toastSuccess() || this.toastError())\n ) {\n console.warn(\n 'CngxActionButton: [toastSuccess]/[toastError] inputs and [cngxToastOn] ' +\n 'on the same element will fire duplicate toasts. Use one or the other.',\n );\n }\n\n const tracker = createTransitionTracker(() => this.effectiveStatus());\n\n effect(() => {\n const status = tracker.current();\n const previous = tracker.previous();\n\n if (status === previous) {\n return;\n }\n\n if (status === 'success') {\n // Producer write for the buildAsyncStateView `lastUpdated` slot (no other\n // source feeds it) - state production, not derived-state sync. This is the\n // sanctioned signal-write-in-effect class, same as the async-state-view pattern.\n this.lastUpdatedState.set(new Date());\n const msg = this.toastSuccess();\n if (msg && this.toaster) {\n this.toaster.show({\n message: msg,\n severity: 'success',\n duration: this.toastSuccessDuration(),\n });\n }\n }\n\n if (status === 'error') {\n const msg = this.toastError();\n if (msg && this.toaster) {\n const err = this.effectiveError();\n const detail =\n this.toastErrorDetail() && err != null\n ? err instanceof Error\n ? err.message\n : typeof err === 'string'\n ? err\n : undefined\n : undefined;\n this.toaster.show({\n message: detail ? `${msg}: ${detail}` : msg,\n severity: 'error',\n duration: this.toastErrorDuration(),\n });\n }\n }\n });\n }\n}\n","/**\n * @module @cngx/ui/action-button\n */\n\nexport { CngxActionButton, type ActionButtonVariant } from './action-button';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDG;MAiEU,gBAAgB,CAAA;IACV,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACjD,IAAA,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;AAG7E,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAe;;AAGtC,IAAA,gBAAgB,GAAG,KAAK,CAAS,IAAI,uFAAC;;AAGtC,IAAA,OAAO,GAAG,KAAK,CAAU,IAAI,8EAAC;;AAG9B,IAAA,IAAI,GAAG,KAAK,CAAgC,QAAQ,2EAAC;;AAGrD,IAAA,OAAO,GAAG,KAAK,CAAsB,SAAS,8EAAC;;AAG/C,IAAA,qBAAqB,GAAG,KAAK,CAAqB,SAAS,4FAAC;;AAG5D,IAAA,kBAAkB,GAAG,KAAK,CAAqB,SAAS,yFAAC;;AAGzD,IAAA,YAAY,GAAG,KAAK,CAAqB,SAAS,mFAAC;;AAGnD,IAAA,cAAc,GAAG,KAAK,CAAqB,SAAS,qFAAC;;AAGrD,IAAA,WAAW,GAAG,KAAK,CAAqB,SAAS,kFAAC;AAE3D;;;AAGG;AACM,IAAA,aAAa,GAAG,KAAK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