@smartsoft001/claude-plugins 2.120.0 → 2.122.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 +1 -1
- package/plugins/smart/.claude-plugin/plugin.json +1 -1
- package/plugins/smart/agents/angular-components/AGENT.md +49 -1
- package/plugins/smart/skills/angular-components-avatar/SKILL.md +218 -0
- package/plugins/smart/skills/angular-components-badge/SKILL.md +176 -0
- package/plugins/smart/skills/angular-components-button-group/SKILL.md +158 -0
- package/plugins/smart/skills/angular-components-command-palette/SKILL.md +209 -0
- package/plugins/smart/skills/angular-components-container/SKILL.md +115 -0
- package/plugins/smart/skills/angular-components-divider/SKILL.md +131 -0
- package/plugins/smart/skills/angular-components-drawer/SKILL.md +194 -0
- package/plugins/smart/skills/angular-components-dropdown/SKILL.md +170 -0
- package/plugins/smart/skills/angular-components-list-container/SKILL.md +157 -0
- package/plugins/smart/skills/angular-components-media-object/SKILL.md +139 -0
- package/plugins/smart/skills/angular-components-modal/SKILL.md +175 -0
- package/plugins/smart/skills/angular-components-notification/SKILL.md +219 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-button-group
|
|
3
|
+
description: ButtonGroup component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ButtonGroup Component
|
|
8
|
+
|
|
9
|
+
The `<smart-button-group>` component renders a horizontal group of related buttons that share a single-selection state. It uses the InjectionToken pattern: a default `ButtonGroupStandardComponent` is rendered, which can be replaced via `BUTTON_GROUP_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the button group component
|
|
14
|
+
- Developer asks about `<smart-button-group>` or `ButtonGroupComponent`
|
|
15
|
+
- Developer needs a segmented control / pill-group / toggle-group of buttons with a shared selection
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### ButtonGroupComponent (`<smart-button-group>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper component. Renders `ButtonGroupStandardComponent` by default. When `BUTTON_GROUP_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
22
|
+
|
|
23
|
+
### ButtonGroupStandardComponent (`<smart-button-group-standard>`)
|
|
24
|
+
|
|
25
|
+
Default concrete implementation. Renders a `<div role="group">` containing one `<button>` per item, with optional label and count spans.
|
|
26
|
+
|
|
27
|
+
### ButtonGroupBaseComponent (abstract)
|
|
28
|
+
|
|
29
|
+
Abstract base directive (`@Directive()`) for extending custom button-group implementations. Exposes `select(id: string)` which sets `selected` and emits `buttonClick`.
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### Inputs / Models / Outputs
|
|
34
|
+
|
|
35
|
+
| Name | Kind | Type | Default | Description |
|
|
36
|
+
| ------------- | ------ | ---------------------------------- | ----------- | ------------------------------------------------- |
|
|
37
|
+
| `buttons` | input | `IButtonGroupButton[]` | `[]` | Array of button definitions |
|
|
38
|
+
| `options` | input | `IButtonGroupOptions \| undefined` | `undefined` | Group-wide options (variant, etc.) |
|
|
39
|
+
| `selected` | model | `string \| undefined` | `undefined` | Two-way bound id of the currently selected button |
|
|
40
|
+
| `class` | input | `string` | `''` | External CSS classes (alias for `cssClass`) |
|
|
41
|
+
| `buttonClick` | output | `{ buttonId: string }` | - | Emitted when a button is clicked |
|
|
42
|
+
|
|
43
|
+
### IButtonGroupButton
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
interface IButtonGroupButton {
|
|
47
|
+
id: string;
|
|
48
|
+
label?: string;
|
|
49
|
+
icon?: string;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
count?: number;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### IButtonGroupOptions
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
type SmartButtonGroupVariant =
|
|
59
|
+
| 'basic'
|
|
60
|
+
| 'icon-only'
|
|
61
|
+
| 'with-stat'
|
|
62
|
+
| 'with-dropdown'
|
|
63
|
+
| 'with-checkbox-select';
|
|
64
|
+
|
|
65
|
+
interface IButtonGroupOptions {
|
|
66
|
+
variant?: SmartButtonGroupVariant;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### BUTTON_GROUP_STANDARD_COMPONENT_TOKEN
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { BUTTON_GROUP_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
InjectionToken that allows replacing the default `ButtonGroupStandardComponent` with a custom implementation. Provide a `Type<ButtonGroupBaseComponent>` to override.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// In your app module or component providers:
|
|
80
|
+
providers: [
|
|
81
|
+
{
|
|
82
|
+
provide: BUTTON_GROUP_STANDARD_COMPONENT_TOKEN,
|
|
83
|
+
useValue: MyCustomButtonGroupComponent,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Extending the Base Class
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
ChangeDetectionStrategy,
|
|
93
|
+
Component,
|
|
94
|
+
ViewEncapsulation,
|
|
95
|
+
} from '@angular/core';
|
|
96
|
+
import { ButtonGroupBaseComponent } from '@smartsoft001/angular';
|
|
97
|
+
|
|
98
|
+
@Component({
|
|
99
|
+
selector: 'my-custom-button-group',
|
|
100
|
+
template: `
|
|
101
|
+
<div role="group" [class]="cssClass()">
|
|
102
|
+
@for (btn of buttons(); track btn.id) {
|
|
103
|
+
<button
|
|
104
|
+
type="button"
|
|
105
|
+
[disabled]="btn.disabled"
|
|
106
|
+
[attr.aria-pressed]="selected() === btn.id"
|
|
107
|
+
(click)="select(btn.id)"
|
|
108
|
+
>
|
|
109
|
+
{{ btn.label }}
|
|
110
|
+
</button>
|
|
111
|
+
}
|
|
112
|
+
</div>
|
|
113
|
+
`,
|
|
114
|
+
encapsulation: ViewEncapsulation.None,
|
|
115
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
116
|
+
})
|
|
117
|
+
export class MyCustomButtonGroupComponent extends ButtonGroupBaseComponent {}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The base class provides `select(id: string)` which sets `selected` and emits `buttonClick`. Subclasses normally just supply the template.
|
|
121
|
+
|
|
122
|
+
## Usage Examples
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<!-- Basic group -->
|
|
126
|
+
<smart-button-group
|
|
127
|
+
[buttons]="[
|
|
128
|
+
{ id: 'all', label: 'All' },
|
|
129
|
+
{ id: 'active', label: 'Active', count: 12 },
|
|
130
|
+
{ id: 'archived', label: 'Archived', disabled: true }
|
|
131
|
+
]"
|
|
132
|
+
[(selected)]="filter"
|
|
133
|
+
(buttonClick)="onFilterChange($event)"
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
<!-- With options variant -->
|
|
137
|
+
<smart-button-group
|
|
138
|
+
[buttons]="buttons"
|
|
139
|
+
[options]="{ variant: 'icon-only' }"
|
|
140
|
+
[(selected)]="current"
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<!-- With external class -->
|
|
144
|
+
<smart-button-group
|
|
145
|
+
class="smart:mt-4"
|
|
146
|
+
[buttons]="buttons"
|
|
147
|
+
[(selected)]="current"
|
|
148
|
+
/>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## File Locations
|
|
152
|
+
|
|
153
|
+
- Wrapper: `packages/shared/angular/src/lib/components/button-group/button-group.component.ts`
|
|
154
|
+
- Standard: `packages/shared/angular/src/lib/components/button-group/standard/standard.component.ts`
|
|
155
|
+
- Standard template: `packages/shared/angular/src/lib/components/button-group/standard/standard.component.html`
|
|
156
|
+
- Base class: `packages/shared/angular/src/lib/components/button-group/base/base.component.ts`
|
|
157
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`BUTTON_GROUP_STANDARD_COMPONENT_TOKEN`)
|
|
158
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IButtonGroupButton`, `IButtonGroupOptions`, `SmartButtonGroupVariant`)
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-command-palette
|
|
3
|
+
description: Command Palette component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Command Palette Component
|
|
8
|
+
|
|
9
|
+
The `<smart-command-palette>` component provides a Cmd+K-style overlay that filters a list of commands by a search query. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `CommandPaletteBaseComponent` defines the shared API — `commands` (`InputSignal<ICommand[]>`), two-way `open` (`ModelSignal<boolean>`) and `query` (`ModelSignal<string>`), optional `ICommandPaletteOptions`, `cssClass` (alias `class`), a `filteredCommands` computed signal that performs case-insensitive substring matching on `command.label`, plus `selectCommand(id)` and `close()` behaviors. `CommandPaletteStandardComponent` is a barebones placeholder concrete implementation. `CommandPaletteComponent` is the public wrapper that renders `CommandPaletteStandardComponent` by default and accepts a custom replacement via `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the command palette component
|
|
14
|
+
- Developer asks about `<smart-command-palette>`, `CommandPaletteComponent`, `CommandPaletteStandardComponent`, or `CommandPaletteBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### CommandPaletteComponent (`<smart-command-palette>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `CommandPaletteStandardComponent` by default. When `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### CommandPaletteStandardComponent (`<smart-command-palette-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a native `<dialog [open]>` containing an `<input type="search">` bound to `query` and a `<ul role="listbox">` with one `<li role="option">` per filtered command. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token. Keyboard handling for `Escape` (close) and the `Cmd+K` global shortcut (open) is intentionally deferred to custom implementations.
|
|
25
|
+
|
|
26
|
+
### CommandPaletteBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom command palette implementations. Exposes `commands` as an `InputSignal<ICommand[]>` (default `[]`), `open` and `query` as two-way `ModelSignal`s (defaults `false` / `''`), `options` as an `InputSignal<ICommandPaletteOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), a `filteredCommands` computed (case-insensitive `label` substring), a `selectCommand(commandId)` method that emits the `runCommand` output and sets `open` to `false`, and a `close()` method that sets `open` to `false`.
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| ---------- | -------------------------------------------------- | ------- | ------------------------------------------- |
|
|
36
|
+
| `commands` | `InputSignal<ICommand[]>` | `[]` | List of commands available in the palette |
|
|
37
|
+
| `open` | `ModelSignal<boolean>` | `false` | Visibility state (two-way bindable) |
|
|
38
|
+
| `query` | `ModelSignal<string>` | `''` | Search query (two-way bindable) |
|
|
39
|
+
| `options` | `InputSignal<ICommandPaletteOptions \| undefined>` | - | Optional configuration |
|
|
40
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
41
|
+
|
|
42
|
+
### Outputs
|
|
43
|
+
|
|
44
|
+
| Output | Payload | Description |
|
|
45
|
+
| ------------ | ----------------------- | ----------------------------------- |
|
|
46
|
+
| `runCommand` | `{ commandId: string }` | Fired when a user selects a command |
|
|
47
|
+
|
|
48
|
+
### ICommand
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
interface ICommand {
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
54
|
+
icon?: string;
|
|
55
|
+
group?: string;
|
|
56
|
+
href?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
imageUrl?: string;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### ICommandPaletteOptions
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
interface ICommandPaletteOptions {
|
|
66
|
+
variant?:
|
|
67
|
+
| 'simple'
|
|
68
|
+
| 'with-padding'
|
|
69
|
+
| 'with-preview'
|
|
70
|
+
| 'with-images'
|
|
71
|
+
| 'with-icons'
|
|
72
|
+
| 'semi-transparent'
|
|
73
|
+
| 'with-groups'
|
|
74
|
+
| 'with-footer';
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
emptyText?: string;
|
|
77
|
+
ariaLabel?: string;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The standard component only consumes `placeholder`, `emptyText`, and `ariaLabel`. The `variant` selector is reserved for custom implementations registered through `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`.
|
|
82
|
+
|
|
83
|
+
## COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
InjectionToken that allows replacing the default `CommandPaletteStandardComponent` with a custom implementation. Provide a `Type<CommandPaletteBaseComponent>` to override.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
// In your app providers:
|
|
93
|
+
providers: [
|
|
94
|
+
{
|
|
95
|
+
provide: COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN,
|
|
96
|
+
useValue: MyCustomCommandPaletteComponent,
|
|
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 { CommandPaletteBaseComponent } from '@smartsoft001/angular';
|
|
113
|
+
|
|
114
|
+
@Component({
|
|
115
|
+
selector: 'my-custom-command-palette',
|
|
116
|
+
template: `
|
|
117
|
+
<dialog [open]="open()" [class]="containerClasses()" (close)="close()">
|
|
118
|
+
<input
|
|
119
|
+
type="search"
|
|
120
|
+
[value]="query()"
|
|
121
|
+
[attr.placeholder]="options()?.placeholder ?? null"
|
|
122
|
+
(input)="onQueryChange($event)"
|
|
123
|
+
/>
|
|
124
|
+
<ul role="listbox">
|
|
125
|
+
@for (command of filteredCommands(); track command.id) {
|
|
126
|
+
<li role="option" (click)="selectCommand(command.id)">
|
|
127
|
+
{{ command.label }}
|
|
128
|
+
</li>
|
|
129
|
+
}
|
|
130
|
+
</ul>
|
|
131
|
+
</dialog>
|
|
132
|
+
`,
|
|
133
|
+
encapsulation: ViewEncapsulation.None,
|
|
134
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
135
|
+
})
|
|
136
|
+
export class MyCustomCommandPaletteComponent extends CommandPaletteBaseComponent {
|
|
137
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
138
|
+
override cssClass = input<string>('');
|
|
139
|
+
|
|
140
|
+
containerClasses = computed(() => {
|
|
141
|
+
const classes = ['my-command-palette'];
|
|
142
|
+
const extra = this.cssClass();
|
|
143
|
+
if (extra) classes.push(extra);
|
|
144
|
+
return classes.join(' ');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
onQueryChange(event: Event): void {
|
|
148
|
+
const target = event.target as HTMLInputElement;
|
|
149
|
+
this.query.set(target.value);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
When extending the base directly, remember to:
|
|
155
|
+
|
|
156
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
157
|
+
- call `selectCommand(id)` rather than emitting `runCommand` manually — it already sets `open.set(false)` for you,
|
|
158
|
+
- handle the `Escape` key and the global `Cmd+K` shortcut at the implementation level if you want native Cmd+K UX (the base does not bind any keyboard listeners).
|
|
159
|
+
|
|
160
|
+
## Usage Examples
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<!-- Basic -->
|
|
164
|
+
<smart-command-palette
|
|
165
|
+
[commands]="commands"
|
|
166
|
+
[(open)]="open"
|
|
167
|
+
[(query)]="query"
|
|
168
|
+
(runCommand)="onRunCommand($event)"
|
|
169
|
+
/>
|
|
170
|
+
|
|
171
|
+
<!-- With options -->
|
|
172
|
+
<smart-command-palette
|
|
173
|
+
[commands]="commands"
|
|
174
|
+
[(open)]="open"
|
|
175
|
+
[options]="{ placeholder: 'Search commands…', emptyText: 'No results' }"
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
<!-- With external class -->
|
|
179
|
+
<smart-command-palette
|
|
180
|
+
[commands]="commands"
|
|
181
|
+
[(open)]="open"
|
|
182
|
+
class="smart:m-4"
|
|
183
|
+
/>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { signal } from '@angular/core';
|
|
188
|
+
|
|
189
|
+
import { ICommand } from '@smartsoft001/angular';
|
|
190
|
+
|
|
191
|
+
const open = signal(false);
|
|
192
|
+
const query = signal('');
|
|
193
|
+
const commands = signal<ICommand[]>([
|
|
194
|
+
{ id: 'new-file', label: 'New file' },
|
|
195
|
+
{ id: 'open-settings', label: 'Open settings' },
|
|
196
|
+
]);
|
|
197
|
+
|
|
198
|
+
function onRunCommand({ commandId }: { commandId: string }): void {
|
|
199
|
+
// …
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## File Locations
|
|
204
|
+
|
|
205
|
+
- Wrapper: `packages/shared/angular/src/lib/components/command-palette/command-palette.component.ts`
|
|
206
|
+
- Standard: `packages/shared/angular/src/lib/components/command-palette/standard/standard.component.ts`
|
|
207
|
+
- Base class: `packages/shared/angular/src/lib/components/command-palette/base/base.component.ts`
|
|
208
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`COMMAND_PALETTE_STANDARD_COMPONENT_TOKEN`)
|
|
209
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ICommand`, `ICommandPaletteOptions`)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-container
|
|
3
|
+
description: Container layout component API, DI token, and base class for @smartsoft001/angular
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Container Component
|
|
8
|
+
|
|
9
|
+
Layout primitive that constrains/wraps page content. The `<smart-container>` wrapper renders `ContainerStandardComponent` by default (a neutral `<div>` that exposes `data-mode` / `data-padding` attributes for downstream styling). Consumers can replace the standard with a custom variant via `CONTAINER_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants a layout container that wraps page content → use `<smart-container>`
|
|
14
|
+
- Developer needs constrained/full-width modes or controlled padding → set `[options]`
|
|
15
|
+
- Developer wants a custom visual variant → extend `ContainerBaseComponent` and provide via `CONTAINER_STANDARD_COMPONENT_TOKEN`
|
|
16
|
+
|
|
17
|
+
## Public API
|
|
18
|
+
|
|
19
|
+
### Wrapper: `smart-container`
|
|
20
|
+
|
|
21
|
+
| Input | Type | Default | Description |
|
|
22
|
+
| --------- | ------------------- | ----------- | -------------------------- |
|
|
23
|
+
| `options` | `IContainerOptions` | `undefined` | Layout configuration |
|
|
24
|
+
| `class` | `string` | `''` | Extra CSS class on wrapper |
|
|
25
|
+
|
|
26
|
+
### IContainerOptions
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
interface IContainerOptions {
|
|
30
|
+
mode?: 'full-width' | 'constrained' | 'container';
|
|
31
|
+
padding?: 'none' | 'mobile' | 'always';
|
|
32
|
+
narrow?: boolean;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Content Projection
|
|
37
|
+
|
|
38
|
+
| Selector | Description |
|
|
39
|
+
| -------- | ---------------------------------------- |
|
|
40
|
+
| default | Body content rendered inside the wrapper |
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<!-- Basic -->
|
|
46
|
+
<smart-container>
|
|
47
|
+
<p>Content</p>
|
|
48
|
+
</smart-container>
|
|
49
|
+
|
|
50
|
+
<!-- Constrained mode with mobile-only padding -->
|
|
51
|
+
<smart-container [options]="{ mode: 'constrained', padding: 'mobile' }">
|
|
52
|
+
<p>Content</p>
|
|
53
|
+
</smart-container>
|
|
54
|
+
|
|
55
|
+
<!-- Narrow variant with extra class -->
|
|
56
|
+
<smart-container
|
|
57
|
+
[options]="{ mode: 'constrained', narrow: true }"
|
|
58
|
+
class="my-section"
|
|
59
|
+
>
|
|
60
|
+
<p>Content</p>
|
|
61
|
+
</smart-container>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Architecture
|
|
65
|
+
|
|
66
|
+
Three-layer pattern mirroring `<smart-toggle>`:
|
|
67
|
+
|
|
68
|
+
1. **`ContainerBaseComponent`** (`@Directive()`) — shared signals/inputs (`options`, `cssClass` via `class` alias) and the `smartType = 'container'` discriminator. No outputs, no methods.
|
|
69
|
+
2. **`ContainerStandardComponent`** (selector: `smart-container-standard`) — default concrete implementation extending the base. Renders a single `<div>` with `[class]`, `[attr.data-mode]`, `[attr.data-padding]`, and `<ng-content />`.
|
|
70
|
+
3. **`ContainerComponent`** (selector: `smart-container`) — wrapper. Uses `inject(CONTAINER_STANDARD_COMPONENT_TOKEN, { optional: true })` + `*ngComponentOutlet` to render the injected component, falling back to `<smart-container-standard>` with `<ng-content />` inside it so default-mode projection works.
|
|
71
|
+
|
|
72
|
+
## Overriding with Custom Implementation
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { Component } from '@angular/core';
|
|
76
|
+
import {
|
|
77
|
+
ContainerBaseComponent,
|
|
78
|
+
CONTAINER_STANDARD_COMPONENT_TOKEN,
|
|
79
|
+
} from '@smartsoft001/angular';
|
|
80
|
+
|
|
81
|
+
@Component({
|
|
82
|
+
selector: 'smart-container-my-variant',
|
|
83
|
+
template: `<section [class]="cssClass()">
|
|
84
|
+
<!-- NOTE: ng-content does NOT work here when injected via the token -->
|
|
85
|
+
</section>`,
|
|
86
|
+
})
|
|
87
|
+
export class ContainerMyVariantComponent extends ContainerBaseComponent {}
|
|
88
|
+
|
|
89
|
+
// In app bootstrap:
|
|
90
|
+
providers: [
|
|
91
|
+
{
|
|
92
|
+
provide: CONTAINER_STANDARD_COMPONENT_TOKEN,
|
|
93
|
+
useValue: ContainerMyVariantComponent,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Content Projection Limitation (IMPORTANT)
|
|
99
|
+
|
|
100
|
+
The wrapper uses `*ngComponentOutlet` to render any token-provided implementation. **`NgComponentOutlet` does not forward content projection** — children placed between `<smart-container>...</smart-container>` are dropped when an injected component is active.
|
|
101
|
+
|
|
102
|
+
Consequences for custom implementations:
|
|
103
|
+
|
|
104
|
+
- The default `ContainerStandardComponent` works fine because the wrapper places `<ng-content />` directly inside `<smart-container-standard>` in the default branch.
|
|
105
|
+
- A custom component provided via `CONTAINER_STANDARD_COMPONENT_TOKEN` **must not rely on `<ng-content />`**. Instead, drive the rendered content through inputs (e.g. `options`, additional input signals on the custom subclass, or a `TemplateRef` input).
|
|
106
|
+
- If you genuinely need projected children with a custom variant, expose a `bodyTpl: input<TemplateRef>()` style input and render it with `<ng-container *ngTemplateOutlet="bodyTpl()" />`.
|
|
107
|
+
|
|
108
|
+
## File Locations
|
|
109
|
+
|
|
110
|
+
- Wrapper: `packages/shared/angular/src/lib/components/container/container.component.ts`
|
|
111
|
+
- Default: `packages/shared/angular/src/lib/components/container/standard/standard.component.{ts,html}`
|
|
112
|
+
- Base: `packages/shared/angular/src/lib/components/container/base/base.component.ts`
|
|
113
|
+
- Tests: `packages/shared/angular/src/lib/components/container/{container,standard/standard,base/base}.component.spec.ts`
|
|
114
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CONTAINER_STANDARD_COMPONENT_TOKEN`)
|
|
115
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IContainerOptions`)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-divider
|
|
3
|
+
description: Divider component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Divider Component
|
|
8
|
+
|
|
9
|
+
The `<smart-divider>` component provides a flexible divider/separator wrapper with an InjectionToken-based extension mechanism. It renders a default `DividerStandardComponent` which can be replaced via `DIVIDER_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the divider component
|
|
14
|
+
- Developer asks about `<smart-divider>` or `DividerComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### DividerComponent (`<smart-divider>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `DividerStandardComponent` by default. When `DIVIDER_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### DividerStandardComponent (`<smart-divider-standard>`)
|
|
23
|
+
|
|
24
|
+
Default concrete implementation. Renders a `<div role="separator">` host with optional title, label, action button, or a plain `<hr />` when none of these are provided.
|
|
25
|
+
|
|
26
|
+
### DividerBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom divider implementations.
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| ------------- | ------------------------------ | ----------- | ------------------------------------------- |
|
|
36
|
+
| `label` | `InputSignal<string>` | `undefined` | Inline divider label |
|
|
37
|
+
| `iconName` | `InputSignal<string>` | `undefined` | Icon name for icon-variant dividers |
|
|
38
|
+
| `title` | `InputSignal<string>` | `undefined` | Title text rendered as `<h3>` |
|
|
39
|
+
| `actionLabel` | `InputSignal<string>` | `undefined` | Action button text |
|
|
40
|
+
| `options` | `InputSignal<IDividerOptions>` | `undefined` | Divider configuration |
|
|
41
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
42
|
+
|
|
43
|
+
### Outputs
|
|
44
|
+
|
|
45
|
+
| Output | Type | Description |
|
|
46
|
+
| ------------- | --------------------- | ----------------------------------------- |
|
|
47
|
+
| `actionClick` | `OutputEmitter<void>` | Emitted when the action button is clicked |
|
|
48
|
+
|
|
49
|
+
### IDividerOptions
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
interface IDividerOptions {
|
|
53
|
+
variant?: SmartDividerVariant; // 'with-label' | 'with-icon' | 'with-title' | 'with-button' | 'with-toolbar'
|
|
54
|
+
position?: 'left' | 'center' | 'right';
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### DIVIDER_STANDARD_COMPONENT_TOKEN
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { DIVIDER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
InjectionToken that allows replacing the default `DividerStandardComponent` with a custom implementation. Provide a `Type<DividerBaseComponent>` to override.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// In your app module or component providers:
|
|
68
|
+
providers: [
|
|
69
|
+
{
|
|
70
|
+
provide: DIVIDER_STANDARD_COMPONENT_TOKEN,
|
|
71
|
+
useValue: MyCustomDividerComponent,
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Extending the Base Class
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import {
|
|
80
|
+
ChangeDetectionStrategy,
|
|
81
|
+
Component,
|
|
82
|
+
ViewEncapsulation,
|
|
83
|
+
} from '@angular/core';
|
|
84
|
+
import { DividerBaseComponent } from '@smartsoft001/angular';
|
|
85
|
+
|
|
86
|
+
@Component({
|
|
87
|
+
selector: 'my-custom-divider',
|
|
88
|
+
template: `
|
|
89
|
+
<div role="separator" [class]="cssClass()">
|
|
90
|
+
@if (title()) {
|
|
91
|
+
<h3>{{ title() }}</h3>
|
|
92
|
+
}
|
|
93
|
+
@if (actionLabel()) {
|
|
94
|
+
<button type="button" (click)="actionClick.emit()">
|
|
95
|
+
{{ actionLabel() }}
|
|
96
|
+
</button>
|
|
97
|
+
}
|
|
98
|
+
</div>
|
|
99
|
+
`,
|
|
100
|
+
encapsulation: ViewEncapsulation.None,
|
|
101
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
102
|
+
})
|
|
103
|
+
export class MyCustomDividerComponent extends DividerBaseComponent {}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Usage Examples
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<!-- Plain horizontal rule -->
|
|
110
|
+
<smart-divider />
|
|
111
|
+
|
|
112
|
+
<!-- With label -->
|
|
113
|
+
<smart-divider label="Continue with" />
|
|
114
|
+
|
|
115
|
+
<!-- With title and position -->
|
|
116
|
+
<smart-divider title="Section" [options]="{ position: 'left' }" />
|
|
117
|
+
|
|
118
|
+
<!-- With action button -->
|
|
119
|
+
<smart-divider actionLabel="Add item" (actionClick)="onAdd()" />
|
|
120
|
+
|
|
121
|
+
<!-- With external class -->
|
|
122
|
+
<smart-divider class="smart:my-4" label="Or" />
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## File Locations
|
|
126
|
+
|
|
127
|
+
- Wrapper: `packages/shared/angular/src/lib/components/divider/divider.component.ts`
|
|
128
|
+
- Standard: `packages/shared/angular/src/lib/components/divider/standard/standard.component.ts`
|
|
129
|
+
- Base class: `packages/shared/angular/src/lib/components/divider/base/base.component.ts`
|
|
130
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DIVIDER_STANDARD_COMPONENT_TOKEN`)
|
|
131
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDividerOptions`, `SmartDividerVariant`)
|