@smartsoft001/claude-plugins 2.153.0 → 2.155.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/claude-plugins",
3
- "version": "2.153.0",
3
+ "version": "2.155.0",
4
4
  "description": "Installs the smart@smartsoft Claude Code plugin into a project: the agents, skills and hooks this workspace develops with.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "smart",
3
3
  "description": "Smartsoft integration - safety validation, audit logging, and auto-formatting hooks",
4
- "version": "2.152.0"
4
+ "version": "2.153.0"
5
5
  }
@@ -39,6 +39,7 @@ These render a default standard implementation and accept a custom implementatio
39
39
  | Component | Skill | Selector | Token |
40
40
  | ------------------- | ---------------------------------------- | ----------------------------- | ---------------------------------------------- |
41
41
  | Action Panel | `angular-components-action-panel` | `<smart-action-panel>` | `ACTION_PANEL_STANDARD_COMPONENT_TOKEN` |
42
+ | Alert | `angular-components-alert` | `<smart-alert>` | `ALERT_STANDARD_COMPONENT_TOKEN` |
42
43
  | Avatar | `angular-components-avatar` | `<smart-avatar>` | `AVATAR_STANDARD_COMPONENT_TOKEN` |
43
44
  | Badge | `angular-components-badge` | `<smart-badge>` | `BADGE_STANDARD_COMPONENT_TOKEN` |
44
45
  | Breadcrumbs | `angular-components-breadcrumbs` | `<smart-breadcrumbs>` | `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` |
@@ -99,7 +100,7 @@ These provide abstract base classes (`@Directive()`) that can be extended to cre
99
100
  When a developer asks about a component:
100
101
 
101
102
  1. **Wants to use `<smart-date-edit>`, `<smart-date-range>`, `<smart-detail>`, or `<smart-input>`** → delegate to the corresponding skill for usage API
102
- 2. **Wants to use `<smart-action-panel>`, `<smart-avatar>`, `<smart-badge>`, `<smart-breadcrumbs>`, `<smart-button-group>`, `<smart-calendar>`, `<smart-card-heading>`, `<smart-command-palette>`, `<smart-container>`, `<smart-description-list>`, `<smart-details>`, `<smart-divider>`, `<smart-drawer>`, `<smart-dropdown>`, `<smart-empty-state>`, `<smart-feed>`, `<smart-form>`, `<smart-grid-list>`, `<smart-info>`, `<smart-list>`, `<smart-list-container>`, `<smart-media-object>`, `<smart-modal>`, `<smart-multi-column-layout>`, `<smart-navbar>`, `<smart-notification>`, `<smart-page-heading>`, `<smart-password-strength>`, `<smart-progress-bars>`, `<smart-searchbar>`, `<smart-section-heading>`, `<smart-select-menu>`, `<smart-sidebar-layout>`, `<smart-sidebar-navigation>`, `<smart-sign-in-form>`, `<smart-stacked-layout>`, `<smart-stacked-list>`, `<smart-stats>`, `<smart-table>`, `<smart-tabs>`, `<smart-textarea>`, `<smart-toggle>`, or `<smart-vertical-navigation>`** → delegate to the skill to explain usage, token override pattern, and how to extend the base class with a custom implementation
103
+ 2. **Wants to use `<smart-action-panel>`, `<smart-alert>` (or `AlertService`), `<smart-avatar>`, `<smart-badge>`, `<smart-breadcrumbs>`, `<smart-button-group>`, `<smart-calendar>`, `<smart-card-heading>`, `<smart-command-palette>`, `<smart-container>`, `<smart-description-list>`, `<smart-details>`, `<smart-divider>`, `<smart-drawer>`, `<smart-dropdown>`, `<smart-empty-state>`, `<smart-feed>`, `<smart-form>`, `<smart-grid-list>`, `<smart-info>`, `<smart-list>`, `<smart-list-container>`, `<smart-media-object>`, `<smart-modal>`, `<smart-multi-column-layout>`, `<smart-navbar>`, `<smart-notification>`, `<smart-page-heading>`, `<smart-password-strength>`, `<smart-progress-bars>`, `<smart-searchbar>`, `<smart-section-heading>`, `<smart-select-menu>`, `<smart-sidebar-layout>`, `<smart-sidebar-navigation>`, `<smart-sign-in-form>`, `<smart-stacked-layout>`, `<smart-stacked-list>`, `<smart-stats>`, `<smart-table>`, `<smart-tabs>`, `<smart-textarea>`, `<smart-toggle>`, or `<smart-vertical-navigation>`** → delegate to the skill to explain usage, token override pattern, and how to extend the base class with a custom implementation
103
104
  3. **Wants to use `<smart-button>`, `<smart-card>`, `<smart-accordion>`, `<smart-page>`, or `<smart-paging>`** → delegate to the skill to explain how to extend the base class and create a custom implementation
104
105
  4. **Wants to create a custom component** → delegate to the base-only skill for extension patterns and API
105
106
 
@@ -111,6 +112,7 @@ Always delegate to the per-component skill for detailed API, usage examples, and
111
112
  - **Date Range** → use skill `angular-components-date-range`
112
113
  - **Accordion** (base only) → use skill `angular-components-accordion`
113
114
  - **Action Panel** (with extension token) → use skill `angular-components-action-panel`
115
+ - **Alert** (with extension token; also `AlertService.show()`) → use skill `angular-components-alert`
114
116
  - **Avatar** (with extension token) → use skill `angular-components-avatar`
115
117
  - **Badge** (with extension token) → use skill `angular-components-badge`
116
118
  - **Breadcrumbs** (with extension token) → use skill `angular-components-breadcrumbs`
@@ -191,6 +193,11 @@ import {
191
193
  import {
192
194
  ActionPanelBaseComponent,
193
195
  ACTION_PANEL_STANDARD_COMPONENT_TOKEN,
196
+ AlertBaseComponent,
197
+ ALERT_STANDARD_COMPONENT_TOKEN,
198
+ AlertService,
199
+ IAlertOptions,
200
+ IAlertButton,
194
201
  AvatarBaseComponent,
195
202
  AVATAR_STANDARD_COMPONENT_TOKEN,
196
203
  BadgeBaseComponent,
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: angular-components-alert
3
+ description: Alert (confirm dialog) component API with InjectionToken pattern, and the AlertService that opens it from code.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Alert Component
8
+
9
+ The `<smart-alert>` component is a small confirm dialog: a header, an optional sub-header and message, and a row of buttons. It is what `AlertService.show()` renders, so every "are you sure?" in the library (for example the remove action of `<smart-list>`) goes through it. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `AlertBaseComponent` defines the shared API — a required `options` input (`IAlertOptions`), `cssClass` (alias `class`), a `dismissed` output carrying the chosen button (or `null`), and the `invoke(button)` / `cancel()` methods. `AlertStandardComponent` is the styled default. `AlertComponent` is the public wrapper that renders `AlertStandardComponent` by default and accepts a custom replacement via `ALERT_STANDARD_COMPONENT_TOKEN`.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Developer wants a confirmation dialog, or asks why `AlertService.show()` renders what it renders
14
+ - Developer asks about `<smart-alert>`, `AlertComponent`, `AlertStandardComponent`, `AlertBaseComponent`, `AlertService` or `IAlertOptions`
15
+
16
+ ## Components
17
+
18
+ ### AlertComponent (`<smart-alert>`)
19
+
20
+ Main wrapper component. Renders `AlertStandardComponent` by default. When `ALERT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Use it inline when the alert is part of a template; use `AlertService` when it has to be opened from code.
21
+
22
+ ### AlertStandardComponent (`<smart-alert-standard>`)
23
+
24
+ Styled default implementation. Renders a full-screen backdrop (`smart:fixed smart:inset-0`, translucent gray, darker in dark mode) with a centered panel that carries `role="alertdialog"`, `aria-modal="true"`, `aria-labelledby` pointing at the header and `aria-describedby` pointing at the message. Inside: an `<h2>` header, an optional `<h3>` sub-header, an optional `<p>` message and one `<button data-role>` per entry of `options.buttons`, right-aligned. Buttons are styled by role — `cancel` is the secondary white/gray button, `destructive` is red, everything else is the blue primary — and each button's `cssClass` is appended. All classes are `smart:`-prefixed Tailwind with explicit `smart:dark:` variants.
25
+
26
+ Keyboard and focus: the first button receives focus when the dialog mounts, `Tab` and `Shift+Tab` cycle inside the dialog, `Escape` (anywhere in the document) cancels. A click on the backdrop cancels unless `options.backdropDismiss` is `false`.
27
+
28
+ ### AlertBaseComponent (abstract)
29
+
30
+ Abstract base directive for custom alert implementations. Exposes `options` as `InputSignal<IAlertOptions>` (required), `cssClass` as `InputSignal<string>` (alias `class`), the `dismissed` output, and the computed `buttons()` and `cancelButton()` (the first button whose role is `cancel`, or `null`). Behaviour lives in the base so a custom template only has to bind it:
31
+
32
+ | Member | What it does |
33
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | `invoke(button)` | Runs `button.handler` when present, then emits `dismissed` with the button. A handler that returns `false` keeps the dialog open (Ionic semantics). A `cancel` button needs no handler. |
35
+ | `cancel()` | Emits `dismissed` with `cancelButton()` or `null`. Runs no handler. |
36
+ | `onEscape()` | Calls `cancel()`; the standard binds it to `document:keydown.escape`. |
37
+ | `onBackdropClick(event)` | Calls `cancel()` when the click landed on the backdrop itself and `options.backdropDismiss` is not `false`. |
38
+ | `trapFocus(event, container)` | Keeps `Tab` / `Shift+Tab` cycling among the enabled buttons of `container`. |
39
+ | `buttonClasses(button)` | The role-based Tailwind classes plus the button's own `cssClass`. |
40
+ | `headerId`, `messageId` | Unique ids per instance, for `aria-labelledby` / `aria-describedby`. |
41
+
42
+ ## AlertService
43
+
44
+ `AlertService` (provided by `SharedServicesModule`) opens the dialog without any host element in a template. `show(options)` creates the component through Angular's `createComponent` with the service's `EnvironmentInjector`, attaches the view to `ApplicationRef`, appends the host element to `document.body` and returns a promise. The promise resolves with the chosen `IAlertButton` — after that button's `handler` has run — or with `null` when the alert was cancelled and no `cancel` button exists. On resolution the component is destroyed, its element removed and focus returned to the element that was focused before `show()`.
45
+
46
+ The service reads `ALERT_STANDARD_COMPONENT_TOKEN` from its own injector, so a replacement registered at the application root (or in the same module that provides `AlertService`) is used by every `show()` call; a token provided deeper in a component tree only affects `<smart-alert>` instances in that tree.
47
+
48
+ | Method | Signature | Notes |
49
+ | --------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
50
+ | `show(options)` | `(options: IAlertOptions) => Promise<IAlertButton \| null>` | Resolves after the button handler ran; `await` it to sequence work after the decision. |
51
+
52
+ ## API
53
+
54
+ ### Inputs
55
+
56
+ | Input | Type | Default | Description |
57
+ | --------- | ---------------------------- | ------- | ------------------------------------------- |
58
+ | `options` | `InputSignal<IAlertOptions>` | - | Header, sub-header, message and buttons |
59
+ | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
60
+
61
+ ### Outputs
62
+
63
+ | Output | Payload | Description |
64
+ | ----------- | ---------------------- | ------------------------------------------------------------------------ |
65
+ | `dismissed` | `IAlertButton \| null` | Fired once, with the chosen button, or `null` when cancelled without one |
66
+
67
+ ### IAlertOptions
68
+
69
+ | Property | Type | Default | Description |
70
+ | ----------------- | ---------------- | ------- | -------------------------------------------------------- |
71
+ | `header` | `string` | - | Dialog heading (also the accessible name) |
72
+ | `subHeader` | `string` | - | Secondary heading under the header |
73
+ | `message` | `string` | - | Body text (also the accessible description) |
74
+ | `backdropDismiss` | `boolean` | `true` | Whether a click on the backdrop cancels the alert |
75
+ | `buttons` | `IAlertButton[]` | `[]` | Buttons rendered in order, the last one visually primary |
76
+
77
+ ### IAlertButton
78
+
79
+ | Property | Type | Default | Description |
80
+ | ---------- | ----------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------- |
81
+ | `text` | `string` | - | Visible label |
82
+ | `role` | `'cancel' \| 'destructive' \| string` | - | `cancel` closes without a handler and is the Escape target; `destructive` is red |
83
+ | `cssClass` | `string \| string[]` | - | Extra classes appended to the button |
84
+ | `handler` | `(value?: unknown) => boolean \| void \| Record<string, unknown>` | - | Runs before the dialog closes; return `false` to keep it open |
85
+
86
+ ## ALERT_STANDARD_COMPONENT_TOKEN
87
+
88
+ ```typescript
89
+ import { ALERT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
90
+ ```
91
+
92
+ InjectionToken that allows replacing the default `AlertStandardComponent` with a custom implementation. Provide a `Type<AlertBaseComponent>` to override. Register it at the application root so that both `<smart-alert>` and `AlertService.show()` pick it up.
93
+
94
+ ```typescript
95
+ providers: [
96
+ {
97
+ provide: ALERT_STANDARD_COMPONENT_TOKEN,
98
+ useValue: MyCustomAlertComponent,
99
+ },
100
+ ];
101
+ ```
102
+
103
+ ## Extending the Base Class
104
+
105
+ ```typescript
106
+ import {
107
+ ChangeDetectionStrategy,
108
+ Component,
109
+ input,
110
+ ViewEncapsulation,
111
+ } from '@angular/core';
112
+
113
+ import { AlertBaseComponent } from '@smartsoft001/angular';
114
+
115
+ @Component({
116
+ selector: 'my-custom-alert',
117
+ template: `
118
+ <div role="presentation" (click)="onBackdropClick($event)">
119
+ <div
120
+ role="alertdialog"
121
+ aria-modal="true"
122
+ tabindex="-1"
123
+ [attr.aria-labelledby]="headerId"
124
+ [class]="cssClass()"
125
+ (keydown)="trapFocus($event, panel)"
126
+ #panel
127
+ >
128
+ <h2 [id]="headerId">{{ options().header }}</h2>
129
+ @if (options().message) {
130
+ <p>{{ options().message }}</p>
131
+ }
132
+ @for (button of buttons(); track $index) {
133
+ <button type="button" (click)="invoke(button)">
134
+ {{ button.text }}
135
+ </button>
136
+ }
137
+ </div>
138
+ </div>
139
+ `,
140
+ encapsulation: ViewEncapsulation.None,
141
+ changeDetection: ChangeDetectionStrategy.OnPush,
142
+ host: { '(document:keydown.escape)': 'onEscape()' },
143
+ })
144
+ export class MyCustomAlertComponent extends AlertBaseComponent {
145
+ // NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
146
+ override cssClass = input<string>('');
147
+ }
148
+ ```
149
+
150
+ When extending the base directly, remember to:
151
+
152
+ - declare `cssClass = input<string>('')` explicitly (no `class` alias) — the wrapper and `AlertService` create the component by type, so inputs arrive by canonical name,
153
+ - call `invoke(button)` from every button so handlers run and `dismissed` fires; `AlertService.show()` resolves on that output and nothing else,
154
+ - bind `onEscape()` to the document `keydown.escape` and `trapFocus()` to the panel yourself — the base holds the logic but binds no listeners,
155
+ - move focus into the dialog after it mounts (the standard focuses its first button in `ngAfterViewInit`).
156
+
157
+ ## Usage Examples
158
+
159
+ ```typescript
160
+ // From code: the promise resolves after the chosen button's handler ran.
161
+ const button = await this.alertService.show({
162
+ header: 'Delete this record?',
163
+ message: 'This cannot be undone.',
164
+ backdropDismiss: false,
165
+ buttons: [
166
+ { text: 'Cancel', role: 'cancel' },
167
+ {
168
+ text: 'Delete',
169
+ role: 'destructive',
170
+ handler: () => this.facade.delete(id),
171
+ },
172
+ ],
173
+ });
174
+ ```
175
+
176
+ ```html
177
+ <!-- Inline, when the alert is part of a template -->
178
+ <smart-alert [options]="options" (dismissed)="onDismissed($event)" />
179
+ ```
180
+
181
+ ## File Locations
182
+
183
+ - Wrapper: `packages/shared/angular/src/lib/components/alert/alert.component.ts`
184
+ - Standard: `packages/shared/angular/src/lib/components/alert/standard/standard.component.ts`
185
+ - Base class: `packages/shared/angular/src/lib/components/alert/base/base.component.ts`
186
+ - Service: `packages/shared/angular/src/lib/services/alert/alert.service.ts`
187
+ - Stories: `packages/shared/angular/src/lib/components/alert/alert.component.stories.ts`
188
+ - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`ALERT_STANDARD_COMPONENT_TOKEN`)
189
+ - Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IAlertOptions`, `IAlertButton`)