@smartsoft001/claude-plugins 2.121.0 → 2.123.0

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.
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: angular-components-modal
3
+ description: Modal component API with InjectionToken pattern for custom implementations.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Modal Component
8
+
9
+ The `<smart-modal>` component provides a dialog overlay with title, description, an arbitrary projected body, and a list of action buttons. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `ModalBaseComponent` defines the shared API — two-way `open` (`ModelSignal<boolean>`), optional `title` and `description`, `actions` (`InputSignal<IModalAction[]>`), optional `IModalOptions`, `cssClass` (alias `class`), `actionClick` and `closed` outputs, and `invokeAction(actionId)` / `close()` methods. `ModalStandardComponent` is a barebones placeholder concrete implementation. `ModalComponent` is the public wrapper that renders `ModalStandardComponent` by default and accepts a custom replacement via `MODAL_STANDARD_COMPONENT_TOKEN`.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Developer wants to use or customize the modal/dialog component
14
+ - Developer asks about `<smart-modal>`, `ModalComponent`, `ModalStandardComponent`, or `ModalBaseComponent`
15
+
16
+ ## Components
17
+
18
+ ### ModalComponent (`<smart-modal>`)
19
+
20
+ Main wrapper component. Renders `ModalStandardComponent` by default. When `MODAL_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
21
+
22
+ ### ModalStandardComponent (`<smart-modal-standard>`)
23
+
24
+ Barebones placeholder concrete implementation. Renders a native `<dialog [open] role="dialog" aria-modal="true">` containing an optional `<h2 id="smart-modal-title">`, an optional `<p>` description, an `<ng-content>` slot for arbitrary body content, an optional dismiss `<button>` (when `options.withDismiss` is `true`), and a `<footer>` with one `<button data-variant>` per action. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
25
+
26
+ ### ModalBaseComponent (abstract)
27
+
28
+ Abstract base directive for extending custom modal implementations. Exposes `open` as a two-way `ModelSignal<boolean>`, `title` / `description` as optional `InputSignal<string | undefined>`, `actions` as `InputSignal<IModalAction[]>` (default `[]`), `options` as `InputSignal<IModalOptions | undefined>`, `cssClass` as `InputSignal<string>` (with alias `class`), `actionClick` and `closed` outputs, plus `invokeAction(actionId)` (emits `actionClick`) and `close()` (sets `open` to `false` and emits `closed`).
29
+
30
+ ## API
31
+
32
+ ### Inputs
33
+
34
+ | Input | Type | Default | Description |
35
+ | ------------- | ----------------------------------------- | ------- | -------------------------------------------- |
36
+ | `open` | `ModelSignal<boolean>` | `false` | Visibility state (two-way bindable) |
37
+ | `title` | `InputSignal<string \| undefined>` | - | Dialog heading (also sets `aria-labelledby`) |
38
+ | `description` | `InputSignal<string \| undefined>` | - | Optional secondary description text |
39
+ | `actions` | `InputSignal<IModalAction[]>` | `[]` | Action buttons rendered in the footer |
40
+ | `options` | `InputSignal<IModalOptions \| undefined>` | - | Optional configuration |
41
+ | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
42
+
43
+ ### Outputs
44
+
45
+ | Output | Payload | Description |
46
+ | ------------- | ---------------------- | ----------------------------------------- |
47
+ | `actionClick` | `{ actionId: string }` | Fired when a footer action is clicked |
48
+ | `closed` | `void` | Fired when the dialog is dismissed/closed |
49
+
50
+ ### IModalAction
51
+
52
+ ```typescript
53
+ interface IModalAction {
54
+ id: string;
55
+ label: string;
56
+ variant?: 'primary' | 'secondary' | 'danger';
57
+ }
58
+ ```
59
+
60
+ ### IModalOptions
61
+
62
+ ```typescript
63
+ interface IModalOptions {
64
+ variant?: 'centered' | 'wide' | 'alert' | 'left-aligned-buttons';
65
+ withDismiss?: boolean;
66
+ footerStyle?: 'default' | 'gray';
67
+ ariaLabel?: string;
68
+ }
69
+ ```
70
+
71
+ The default `ModalStandardComponent` consumes `withDismiss` (renders a dismiss `×` button) and `ariaLabel` (used as `aria-label` when `title` is not provided). The `variant` and `footerStyle` selectors are reserved for custom implementations registered through `MODAL_STANDARD_COMPONENT_TOKEN`.
72
+
73
+ ## MODAL_STANDARD_COMPONENT_TOKEN
74
+
75
+ ```typescript
76
+ import { MODAL_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
77
+ ```
78
+
79
+ InjectionToken that allows replacing the default `ModalStandardComponent` with a custom implementation. Provide a `Type<ModalBaseComponent>` to override.
80
+
81
+ ```typescript
82
+ providers: [
83
+ {
84
+ provide: MODAL_STANDARD_COMPONENT_TOKEN,
85
+ useValue: MyCustomModalComponent,
86
+ },
87
+ ];
88
+ ```
89
+
90
+ ## Content projection
91
+
92
+ `ModalStandardComponent` accepts arbitrary body content via `<ng-content>` and the wrapper forwards its own `<ng-content>` into the standard. **However, `NgComponentOutlet` does not propagate projected content** — when a custom component is registered via the token, the wrapper renders the custom component as a sibling and the consumer's `<ng-content>` is dropped. Custom implementations should rely on inputs (`title`, `description`, structured `data` extension) or expose their own template inputs rather than `<ng-content>`.
93
+
94
+ ## Extending the Base Class
95
+
96
+ ```typescript
97
+ import {
98
+ ChangeDetectionStrategy,
99
+ Component,
100
+ input,
101
+ ViewEncapsulation,
102
+ } from '@angular/core';
103
+
104
+ import { ModalBaseComponent } from '@smartsoft001/angular';
105
+
106
+ @Component({
107
+ selector: 'my-custom-modal',
108
+ template: `
109
+ <dialog
110
+ [open]="open()"
111
+ role="dialog"
112
+ aria-modal="true"
113
+ [class]="cssClass()"
114
+ >
115
+ @if (title()) {
116
+ <h2>{{ title() }}</h2>
117
+ }
118
+ @if (description()) {
119
+ <p>{{ description() }}</p>
120
+ }
121
+ <footer>
122
+ @for (action of actions(); track action.id) {
123
+ <button (click)="invokeAction(action.id)">{{ action.label }}</button>
124
+ }
125
+ </footer>
126
+ </dialog>
127
+ `,
128
+ encapsulation: ViewEncapsulation.None,
129
+ changeDetection: ChangeDetectionStrategy.OnPush,
130
+ })
131
+ export class MyCustomModalComponent extends ModalBaseComponent {
132
+ // NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
133
+ override cssClass = input<string>('');
134
+ }
135
+ ```
136
+
137
+ When extending the base directly, remember to:
138
+
139
+ - declare `cssClass = input<string>('')` explicitly (no `class` alias) when the component is used via `NgComponentOutlet` through `MODAL_STANDARD_COMPONENT_TOKEN`,
140
+ - call `invokeAction(id)` to emit `actionClick`, and `close()` to emit `closed` and set `open.set(false)`,
141
+ - implement `Escape` key handling and backdrop click yourself if you want native UX — the base does not bind any keyboard or backdrop listeners.
142
+
143
+ ## Usage Examples
144
+
145
+ ```html
146
+ <!-- Basic with title + actions -->
147
+ <smart-modal
148
+ [(open)]="confirmOpen"
149
+ title="Deactivate account"
150
+ description="This action cannot be undone."
151
+ [actions]="[
152
+ { id: 'cancel', label: 'Cancel', variant: 'secondary' },
153
+ { id: 'confirm', label: 'Deactivate', variant: 'danger' },
154
+ ]"
155
+ (actionClick)="onAction($event)"
156
+ />
157
+
158
+ <!-- With dismiss button + projected body -->
159
+ <smart-modal [(open)]="open" [options]="{ withDismiss: true }">
160
+ <form>
161
+ <!-- custom body -->
162
+ </form>
163
+ </smart-modal>
164
+
165
+ <!-- With external class -->
166
+ <smart-modal [(open)]="open" class="smart:p-4" />
167
+ ```
168
+
169
+ ## File Locations
170
+
171
+ - Wrapper: `packages/shared/angular/src/lib/components/modal/modal.component.ts`
172
+ - Standard: `packages/shared/angular/src/lib/components/modal/standard/standard.component.ts`
173
+ - Base class: `packages/shared/angular/src/lib/components/modal/base/base.component.ts`
174
+ - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`MODAL_STANDARD_COMPONENT_TOKEN`)
175
+ - Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IModalAction`, `IModalOptions`)
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: angular-components-notification
3
+ description: Notification component API with InjectionToken pattern for custom implementations.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Notification Component
8
+
9
+ The `<smart-notification>` component displays a transient or persistent message — title, optional description, optional icon/avatar, optional dismiss control, and zero or more action buttons. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `NotificationBaseComponent` defines the shared API — `title` (required), `description`, `iconName`, `avatarUrl`, `actions`, `dismissible`, `options`, `cssClass` (alias `class`), plus `dismissed` and `actionClick` outputs and the `dismiss()` / `invokeAction()` helper methods. `NotificationStandardComponent` is a barebones placeholder concrete implementation. `NotificationComponent` is the public wrapper that renders `NotificationStandardComponent` by default and accepts a custom replacement via `NOTIFICATION_STANDARD_COMPONENT_TOKEN`.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Developer wants to use or customize the notification component
14
+ - Developer asks about `<smart-notification>`, `NotificationComponent`, `NotificationStandardComponent`, or `NotificationBaseComponent`
15
+
16
+ ## Components
17
+
18
+ ### NotificationComponent (`<smart-notification>`)
19
+
20
+ Main wrapper component. Renders `NotificationStandardComponent` by default. When `NOTIFICATION_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
21
+
22
+ ### NotificationStandardComponent (`<smart-notification-standard>`)
23
+
24
+ Barebones placeholder concrete implementation. Renders a `<div role="status">` with `aria-live` (defaulting to `polite`, overridable via `options.ariaLive`), an `<h3>` for the title, an optional `<p>` for the description, an optional close button when `dismissible` is `true`, and one `<button>` per action with a `data-variant` attribute. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
25
+
26
+ ### NotificationBaseComponent (abstract)
27
+
28
+ Abstract base directive for extending custom notification implementations. Exposes the inputs/outputs listed below and provides `dismiss()` (emits `dismissed`) and `invokeAction(actionId)` (emits `actionClick` with `{ actionId }`) helper methods.
29
+
30
+ ## API
31
+
32
+ ### Inputs
33
+
34
+ | Input | Type | Default | Description |
35
+ | ------------- | ------------------------------------------------ | ------- | ------------------------------------------- |
36
+ | `title` | `InputSignal<string>` (required) | - | Headline text |
37
+ | `description` | `InputSignal<string \| undefined>` | - | Optional supporting text |
38
+ | `iconName` | `InputSignal<string \| undefined>` | - | Optional leading icon name |
39
+ | `avatarUrl` | `InputSignal<string \| undefined>` | - | Optional avatar image URL |
40
+ | `actions` | `InputSignal<INotificationAction[]>` | `[]` | Action buttons to render |
41
+ | `dismissible` | `InputSignal<boolean>` | `false` | When `true`, renders a close button |
42
+ | `options` | `InputSignal<INotificationOptions \| undefined>` | - | Optional configuration (variant, ariaLive) |
43
+ | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
44
+
45
+ ### Outputs
46
+
47
+ | Output | Payload | Description |
48
+ | ------------- | ---------------------- | ---------------------------------------- |
49
+ | `dismissed` | `void` | Emitted when the user dismisses |
50
+ | `actionClick` | `{ actionId: string }` | Emitted when an action button is clicked |
51
+
52
+ ### INotificationAction
53
+
54
+ ```typescript
55
+ interface INotificationAction {
56
+ id: string;
57
+ label: string;
58
+ variant?: 'primary' | 'secondary';
59
+ }
60
+ ```
61
+
62
+ `id` is echoed back in the `actionClick` payload so the host can route handling. `variant` controls the placeholder's `data-variant` attribute and is intended as a styling hook for custom implementations.
63
+
64
+ ### INotificationOptions
65
+
66
+ ```typescript
67
+ type SmartNotificationVariant =
68
+ | 'simple'
69
+ | 'condensed'
70
+ | 'with-actions-below'
71
+ | 'with-avatar'
72
+ | 'with-split-buttons'
73
+ | 'with-buttons-below';
74
+
75
+ interface INotificationOptions {
76
+ variant?: SmartNotificationVariant;
77
+ ariaLive?: 'polite' | 'assertive';
78
+ }
79
+ ```
80
+
81
+ The standard component only consumes `ariaLive` (placeholder behavior — applied directly as the `aria-live` attribute on the `role="status"` container; defaults to `'polite'`). The `variant` property is reserved for custom implementations registered through `NOTIFICATION_STANDARD_COMPONENT_TOKEN` and is ignored by `NotificationStandardComponent`.
82
+
83
+ ## NOTIFICATION_STANDARD_COMPONENT_TOKEN
84
+
85
+ ```typescript
86
+ import { NOTIFICATION_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
87
+ ```
88
+
89
+ InjectionToken that allows replacing the default `NotificationStandardComponent` with a custom implementation. Provide a `Type<NotificationBaseComponent>` to override.
90
+
91
+ ```typescript
92
+ // In your app module or component providers:
93
+ providers: [
94
+ {
95
+ provide: NOTIFICATION_STANDARD_COMPONENT_TOKEN,
96
+ useValue: MyCustomNotificationComponent,
97
+ },
98
+ ];
99
+ ```
100
+
101
+ ## Extending the Base Class
102
+
103
+ ```typescript
104
+ import {
105
+ ChangeDetectionStrategy,
106
+ Component,
107
+ computed,
108
+ input,
109
+ ViewEncapsulation,
110
+ } from '@angular/core';
111
+
112
+ import { NotificationBaseComponent } from '@smartsoft001/angular';
113
+
114
+ @Component({
115
+ selector: 'my-custom-notification',
116
+ template: `
117
+ <section
118
+ role="status"
119
+ [attr.aria-live]="options()?.ariaLive ?? 'polite'"
120
+ [class]="containerClasses()"
121
+ >
122
+ @if (avatarUrl()) {
123
+ <img [src]="avatarUrl()" alt="" />
124
+ }
125
+ <div>
126
+ <h3>{{ title() }}</h3>
127
+ @if (description()) {
128
+ <p>{{ description() }}</p>
129
+ }
130
+ @for (action of actions(); track action.id) {
131
+ <button
132
+ type="button"
133
+ [attr.data-variant]="action.variant ?? 'primary'"
134
+ (click)="invokeAction(action.id)"
135
+ >
136
+ {{ action.label }}
137
+ </button>
138
+ }
139
+ </div>
140
+ @if (dismissible()) {
141
+ <button type="button" aria-label="Close" (click)="dismiss()">
142
+ &times;
143
+ </button>
144
+ }
145
+ </section>
146
+ `,
147
+ encapsulation: ViewEncapsulation.None,
148
+ changeDetection: ChangeDetectionStrategy.OnPush,
149
+ })
150
+ export class MyCustomNotificationComponent extends NotificationBaseComponent {
151
+ // NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
152
+ override cssClass = input<string>('');
153
+
154
+ containerClasses = computed(() => {
155
+ const classes = ['my-notification-container'];
156
+ const extra = this.cssClass();
157
+ if (extra) classes.push(extra);
158
+ return classes.join(' ');
159
+ });
160
+ }
161
+ ```
162
+
163
+ When extending the base directly, remember to:
164
+
165
+ - declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `NOTIFICATION_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
166
+ - call `this.dismiss()` from your close handler — it already emits the `dismissed` output,
167
+ - call `this.invokeAction(action.id)` from each action button — it already emits the `actionClick` output with `{ actionId }`.
168
+
169
+ ## Accessibility
170
+
171
+ - The container uses `role="status"` so assistive technologies announce it as a live region.
172
+ - `aria-live` defaults to `'polite'` (announced after the user finishes their current task) and can be raised to `'assertive'` via `options.ariaLive` for time-critical messages.
173
+ - The dismiss button carries `aria-label="Close"` since its visible content is the `×` glyph.
174
+ - Custom implementations should preserve `role="status"` and `aria-live` to keep this contract.
175
+
176
+ ## Usage Examples
177
+
178
+ ```html
179
+ <!-- Basic -->
180
+ <smart-notification title="Saved" />
181
+
182
+ <!-- With description -->
183
+ <smart-notification title="Saved" description="Your changes are live." />
184
+
185
+ <!-- Dismissible -->
186
+ <smart-notification
187
+ title="Heads up"
188
+ [dismissible]="true"
189
+ (dismissed)="onDismissed()"
190
+ />
191
+
192
+ <!-- With actions -->
193
+ <smart-notification
194
+ title="Update available"
195
+ description="Reload to apply the latest version."
196
+ [actions]="[
197
+ { id: 'reload', label: 'Reload', variant: 'primary' },
198
+ { id: 'later', label: 'Later', variant: 'secondary' },
199
+ ]"
200
+ (actionClick)="onAction($event)"
201
+ />
202
+
203
+ <!-- Assertive announcement -->
204
+ <smart-notification
205
+ title="Connection lost"
206
+ [options]="{ ariaLive: 'assertive' }"
207
+ />
208
+
209
+ <!-- With external class -->
210
+ <smart-notification title="Saved" class="smart:my-2" />
211
+ ```
212
+
213
+ ## File Locations
214
+
215
+ - Wrapper: `packages/shared/angular/src/lib/components/notification/notification.component.ts`
216
+ - Standard: `packages/shared/angular/src/lib/components/notification/standard/standard.component.ts`
217
+ - Base class: `packages/shared/angular/src/lib/components/notification/base/base.component.ts`
218
+ - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`NOTIFICATION_STANDARD_COMPONENT_TOKEN`)
219
+ - Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`INotificationAction`, `INotificationOptions`, `SmartNotificationVariant`)