@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,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-drawer
|
|
3
|
+
description: Drawer component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Drawer Component
|
|
8
|
+
|
|
9
|
+
The `<smart-drawer>` component provides a side panel overlay (left/right) with optional header, close button, and backdrop. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `DrawerBaseComponent` defines the shared API — `open` (two-way `ModelSignal<boolean>`), `title`, optional `IDrawerOptions`, `cssClass` (alias `class`), a `closed` output, and a `close()` method that sets `open` to `false` and emits `closed`. `DrawerStandardComponent` is a barebones placeholder concrete implementation. `DrawerComponent` is the public wrapper that renders `DrawerStandardComponent` by default and accepts a custom replacement via `DRAWER_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the drawer component
|
|
14
|
+
- Developer asks about `<smart-drawer>`, `DrawerComponent`, `DrawerStandardComponent`, or `DrawerBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### DrawerComponent (`<smart-drawer>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `DrawerStandardComponent` by default. When `DRAWER_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### DrawerStandardComponent (`<smart-drawer-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. When `open()` is `true`, renders an optional overlay `<div class="drawer-overlay">` (when `options.withOverlay`) and an `<aside role="dialog" aria-modal="true">` with a `data-position` attribute (`left` or `right`, default `right`). When a `title` is provided, the aside includes a `<header>` with an `<h2 id="smart-drawer-title">` and a close `<button aria-label="Close">`. Projected content is rendered via `<ng-content />`. 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
|
+
### DrawerBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom drawer implementations. Exposes `open` as a two-way `ModelSignal<boolean>` (default `false`), `title` as an `InputSignal<string | undefined>`, `options` as an `InputSignal<IDrawerOptions | undefined>`, `cssClass` as an `InputSignal<string>` (with alias `class`), a `closed` output, and a `close()` method that 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` | Whether the drawer is open (two-way bindable) |
|
|
37
|
+
| `title` | `InputSignal<string \| undefined>` | - | Optional drawer title (renders header when set) |
|
|
38
|
+
| `options` | `InputSignal<IDrawerOptions \| undefined>` | - | Optional configuration |
|
|
39
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
40
|
+
|
|
41
|
+
### Outputs
|
|
42
|
+
|
|
43
|
+
| Output | Type | Description |
|
|
44
|
+
| -------- | -------------- | ---------------------------------------------------------- |
|
|
45
|
+
| `closed` | `output<void>` | Emitted when the drawer is closed (programmatic or button) |
|
|
46
|
+
|
|
47
|
+
### IDrawerOptions
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
interface IDrawerOptions {
|
|
51
|
+
position?: 'left' | 'right';
|
|
52
|
+
wide?: boolean;
|
|
53
|
+
withOverlay?: boolean;
|
|
54
|
+
brandedHeader?: boolean;
|
|
55
|
+
stickyFooter?: boolean;
|
|
56
|
+
variant?: SmartDrawerVariant;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type SmartDrawerVariant =
|
|
60
|
+
| 'empty'
|
|
61
|
+
| 'create-form'
|
|
62
|
+
| 'user-profile'
|
|
63
|
+
| 'contact-list'
|
|
64
|
+
| 'file-details';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The standard component only consumes `position` (mapped to the `data-position` attribute on the aside, default `'right'`) and `withOverlay` (toggles the backdrop overlay). The remaining properties — `wide`, `brandedHeader`, `stickyFooter`, and `variant` — are reserved for custom implementations registered through `DRAWER_STANDARD_COMPONENT_TOKEN` and are ignored by `DrawerStandardComponent`.
|
|
68
|
+
|
|
69
|
+
## DRAWER_STANDARD_COMPONENT_TOKEN
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { DRAWER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
InjectionToken that allows replacing the default `DrawerStandardComponent` with a custom implementation. Provide a `Type<DrawerBaseComponent>` to override.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// In your app module or component providers:
|
|
79
|
+
providers: [
|
|
80
|
+
{
|
|
81
|
+
provide: DRAWER_STANDARD_COMPONENT_TOKEN,
|
|
82
|
+
useValue: MyCustomDrawerComponent,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Extending the Base Class
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import {
|
|
91
|
+
ChangeDetectionStrategy,
|
|
92
|
+
Component,
|
|
93
|
+
computed,
|
|
94
|
+
input,
|
|
95
|
+
ViewEncapsulation,
|
|
96
|
+
} from '@angular/core';
|
|
97
|
+
|
|
98
|
+
import { DrawerBaseComponent } from '@smartsoft001/angular';
|
|
99
|
+
|
|
100
|
+
@Component({
|
|
101
|
+
selector: 'my-custom-drawer',
|
|
102
|
+
template: `
|
|
103
|
+
@if (open()) {
|
|
104
|
+
@if (options()?.withOverlay) {
|
|
105
|
+
<div class="my-drawer-overlay" (click)="close()"></div>
|
|
106
|
+
}
|
|
107
|
+
<aside
|
|
108
|
+
role="dialog"
|
|
109
|
+
aria-modal="true"
|
|
110
|
+
[class]="containerClasses()"
|
|
111
|
+
[attr.data-position]="options()?.position ?? 'right'"
|
|
112
|
+
>
|
|
113
|
+
@if (title()) {
|
|
114
|
+
<header [class.branded]="options()?.brandedHeader">
|
|
115
|
+
<h2>{{ title() }}</h2>
|
|
116
|
+
<button type="button" aria-label="Close" (click)="close()">
|
|
117
|
+
×
|
|
118
|
+
</button>
|
|
119
|
+
</header>
|
|
120
|
+
}
|
|
121
|
+
<!-- Custom implementations should expose data inputs instead of ng-content -->
|
|
122
|
+
</aside>
|
|
123
|
+
}
|
|
124
|
+
`,
|
|
125
|
+
encapsulation: ViewEncapsulation.None,
|
|
126
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
127
|
+
})
|
|
128
|
+
export class MyCustomDrawerComponent extends DrawerBaseComponent {
|
|
129
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
130
|
+
override cssClass = input<string>('');
|
|
131
|
+
|
|
132
|
+
containerClasses = computed(() => {
|
|
133
|
+
const classes = ['my-drawer'];
|
|
134
|
+
if (this.options()?.wide) classes.push('my-drawer--wide');
|
|
135
|
+
const extra = this.cssClass();
|
|
136
|
+
if (extra) classes.push(extra);
|
|
137
|
+
return classes.join(' ');
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
When extending the base directly, remember to:
|
|
143
|
+
|
|
144
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `DRAWER_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
145
|
+
- call `this.close()` from your close affordances — it sets `open` to `false` and emits `closed` for you.
|
|
146
|
+
|
|
147
|
+
### Content Projection Limitation
|
|
148
|
+
|
|
149
|
+
`DrawerStandardComponent` uses `<ng-content />` to project arbitrary children, but **`NgComponentOutlet` does not propagate projected content** to dynamically rendered components. When supplying a custom implementation via `DRAWER_STANDARD_COMPONENT_TOKEN`, do **not** rely on `<ng-content />`. Instead, expose data inputs (e.g. additional `input()` properties) on your subclass and render them inside the component template. Consumers then pass structured data to `<smart-drawer>` rather than projected DOM nodes.
|
|
150
|
+
|
|
151
|
+
## Accessibility
|
|
152
|
+
|
|
153
|
+
- The aside is rendered with `role="dialog"` and `aria-modal="true"` so assistive technologies treat it as a modal dialog.
|
|
154
|
+
- When a `title` is provided, the aside is labelled via `aria-labelledby="smart-drawer-title"` (matching the `<h2 id="smart-drawer-title">` inside the header). Without a title, no label is set — supply one through `class`-scoped styling or wrap the drawer in a labelled landmark if needed.
|
|
155
|
+
- The header close button has `aria-label="Close"`.
|
|
156
|
+
- Positioning is exposed declaratively via the `data-position="left|right"` attribute on the aside, allowing CSS to style left- vs right-anchored drawers without runtime branching. Default is `right`.
|
|
157
|
+
- The overlay (when `options.withOverlay` is `true`) closes the drawer on click.
|
|
158
|
+
|
|
159
|
+
## Usage Examples
|
|
160
|
+
|
|
161
|
+
```html
|
|
162
|
+
<!-- Basic -->
|
|
163
|
+
<smart-drawer [(open)]="isOpen">
|
|
164
|
+
<p>Drawer content</p>
|
|
165
|
+
</smart-drawer>
|
|
166
|
+
|
|
167
|
+
<!-- With title and close button -->
|
|
168
|
+
<smart-drawer [(open)]="isOpen" title="Settings">
|
|
169
|
+
<p>Drawer content</p>
|
|
170
|
+
</smart-drawer>
|
|
171
|
+
|
|
172
|
+
<!-- Left-positioned with overlay -->
|
|
173
|
+
<smart-drawer
|
|
174
|
+
[(open)]="isOpen"
|
|
175
|
+
title="Menu"
|
|
176
|
+
[options]="{ position: 'left', withOverlay: true }"
|
|
177
|
+
>
|
|
178
|
+
<nav>...</nav>
|
|
179
|
+
</smart-drawer>
|
|
180
|
+
|
|
181
|
+
<!-- Listening for close -->
|
|
182
|
+
<smart-drawer [(open)]="isOpen" (closed)="onDrawerClosed()"> ... </smart-drawer>
|
|
183
|
+
|
|
184
|
+
<!-- With external class -->
|
|
185
|
+
<smart-drawer [(open)]="isOpen" class="smart:max-w-md">...</smart-drawer>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## File Locations
|
|
189
|
+
|
|
190
|
+
- Wrapper: `packages/shared/angular/src/lib/components/drawer/drawer.component.ts`
|
|
191
|
+
- Standard: `packages/shared/angular/src/lib/components/drawer/standard/standard.component.ts`
|
|
192
|
+
- Base class: `packages/shared/angular/src/lib/components/drawer/base/base.component.ts`
|
|
193
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DRAWER_STANDARD_COMPONENT_TOKEN`)
|
|
194
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDrawerOptions`, `SmartDrawerVariant`)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-dropdown
|
|
3
|
+
description: Dropdown component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Dropdown Component
|
|
8
|
+
|
|
9
|
+
The `<smart-dropdown>` component provides a flexible dropdown menu wrapper with an InjectionToken-based extension mechanism. It renders a default `DropdownStandardComponent` which can be replaced via `DROPDOWN_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the dropdown component
|
|
14
|
+
- Developer asks about `<smart-dropdown>` or `DropdownComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### DropdownComponent (`<smart-dropdown>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `DropdownStandardComponent` by default. When `DROPDOWN_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### DropdownStandardComponent (`<smart-dropdown-standard>`)
|
|
23
|
+
|
|
24
|
+
Default concrete implementation. Renders a trigger button and a menu list using modern Angular control flow.
|
|
25
|
+
|
|
26
|
+
### DropdownBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom dropdown implementations.
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| -------------- | ------------------------------- | ----------- | --------------------------------------------- |
|
|
36
|
+
| `items` | `InputSignal<IDropdownItem[]>` | `[]` | Menu items |
|
|
37
|
+
| `triggerLabel` | `InputSignal<string>` | `undefined` | Default text rendered inside the trigger |
|
|
38
|
+
| `open` | `ModelSignal<boolean>` | `false` | Two-way bindable open/closed state |
|
|
39
|
+
| `options` | `InputSignal<IDropdownOptions>` | `undefined` | Dropdown configuration (variant, headerLabel) |
|
|
40
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
41
|
+
|
|
42
|
+
### Outputs
|
|
43
|
+
|
|
44
|
+
| Output | Type | Description |
|
|
45
|
+
| -------------- | -------------------- | ----------------------------------------------- |
|
|
46
|
+
| `selectedItem` | `{ itemId: string }` | Emits when a menu item is selected; closes menu |
|
|
47
|
+
|
|
48
|
+
### IDropdownItem
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
interface IDropdownItem {
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
54
|
+
icon?: string;
|
|
55
|
+
href?: string;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
divider?: boolean;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### IDropdownOptions
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
type SmartDropdownVariant =
|
|
65
|
+
| 'simple'
|
|
66
|
+
| 'with-dividers'
|
|
67
|
+
| 'with-icons'
|
|
68
|
+
| 'minimal'
|
|
69
|
+
| 'with-header';
|
|
70
|
+
|
|
71
|
+
interface IDropdownOptions {
|
|
72
|
+
variant?: SmartDropdownVariant;
|
|
73
|
+
headerLabel?: string;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### DROPDOWN_STANDARD_COMPONENT_TOKEN
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { DROPDOWN_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
InjectionToken that allows replacing the default `DropdownStandardComponent` with a custom implementation. Provide a `Type<DropdownBaseComponent>` to override.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// In your app module or component providers:
|
|
87
|
+
providers: [
|
|
88
|
+
{
|
|
89
|
+
provide: DROPDOWN_STANDARD_COMPONENT_TOKEN,
|
|
90
|
+
useValue: MyCustomDropdownComponent,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Extending the Base Class
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
99
|
+
import { DropdownBaseComponent } from '@smartsoft001/angular';
|
|
100
|
+
|
|
101
|
+
@Component({
|
|
102
|
+
selector: 'my-custom-dropdown',
|
|
103
|
+
template: `
|
|
104
|
+
<div [class]="cssClass()">
|
|
105
|
+
<button (click)="toggle()">{{ triggerLabel() }}</button>
|
|
106
|
+
@if (open()) {
|
|
107
|
+
<ul>
|
|
108
|
+
@for (item of items(); track item.id) {
|
|
109
|
+
<li>
|
|
110
|
+
<button (click)="selectItem(item.id)">{{ item.label }}</button>
|
|
111
|
+
</li>
|
|
112
|
+
}
|
|
113
|
+
</ul>
|
|
114
|
+
}
|
|
115
|
+
</div>
|
|
116
|
+
`,
|
|
117
|
+
encapsulation: ViewEncapsulation.None,
|
|
118
|
+
})
|
|
119
|
+
export class MyCustomDropdownComponent extends DropdownBaseComponent {}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Usage Examples
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<!-- Default dropdown with simple items -->
|
|
126
|
+
<smart-dropdown
|
|
127
|
+
triggerLabel="Open menu"
|
|
128
|
+
[items]="[
|
|
129
|
+
{ id: 'edit', label: 'Edit' },
|
|
130
|
+
{ id: 'delete', label: 'Delete' }
|
|
131
|
+
]"
|
|
132
|
+
(selectedItem)="onSelected($event)"
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
<!-- With two-way bound open state -->
|
|
136
|
+
<smart-dropdown triggerLabel="Actions" [items]="actions" [(open)]="menuOpen" />
|
|
137
|
+
|
|
138
|
+
<!-- With header variant -->
|
|
139
|
+
<smart-dropdown
|
|
140
|
+
triggerLabel="Account"
|
|
141
|
+
[items]="accountItems"
|
|
142
|
+
[options]="{ variant: 'with-header', headerLabel: 'Signed in as Jane' }"
|
|
143
|
+
/>
|
|
144
|
+
|
|
145
|
+
<!-- With dividers and disabled items -->
|
|
146
|
+
<smart-dropdown
|
|
147
|
+
triggerLabel="More"
|
|
148
|
+
[items]="[
|
|
149
|
+
{ id: 'a', label: 'Action A' },
|
|
150
|
+
{ id: 'sep', label: '', divider: true },
|
|
151
|
+
{ id: 'b', label: 'Action B', disabled: true }
|
|
152
|
+
]"
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<!-- With custom trigger content via ng-content -->
|
|
156
|
+
<smart-dropdown [items]="items">
|
|
157
|
+
<span class="icon-menu"></span> Menu
|
|
158
|
+
</smart-dropdown>
|
|
159
|
+
|
|
160
|
+
<!-- With external class -->
|
|
161
|
+
<smart-dropdown class="smart:mt-4" [items]="items" triggerLabel="Open" />
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## File Locations
|
|
165
|
+
|
|
166
|
+
- Wrapper: `packages/shared/angular/src/lib/components/dropdown/dropdown.component.ts`
|
|
167
|
+
- Standard: `packages/shared/angular/src/lib/components/dropdown/standard/standard.component.ts`
|
|
168
|
+
- Base class: `packages/shared/angular/src/lib/components/dropdown/base/base.component.ts`
|
|
169
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DROPDOWN_STANDARD_COMPONENT_TOKEN`)
|
|
170
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDropdownItem`, `IDropdownOptions`, `SmartDropdownVariant`)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-list-container
|
|
3
|
+
description: ListContainer layout component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ListContainer Component
|
|
8
|
+
|
|
9
|
+
The `<smart-list-container>` component is a presentational layout wrapper that groups list items with a semantic `role="list"`. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `ListContainerBaseComponent` defines the shared API — optional `IListContainerOptions` and `cssClass` (alias `class`). `ListContainerStandardComponent` is a barebones placeholder concrete implementation that projects content via `<ng-content />` inside a `role="list"` div with an optional `data-variant` attribute. `ListContainerComponent` is the public wrapper that renders `ListContainerStandardComponent` by default and accepts a custom replacement via `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the list container layout component
|
|
14
|
+
- Developer asks about `<smart-list-container>`, `ListContainerComponent`, `ListContainerStandardComponent`, or `ListContainerBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### ListContainerComponent (`<smart-list-container>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `ListContainerStandardComponent` by default. When `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Supports content projection through `<ng-content />` in the default branch, so children placed inside `<smart-list-container>` are rendered inside the standard list container.
|
|
21
|
+
|
|
22
|
+
### ListContainerStandardComponent (`<smart-list-container-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a `<div role="list">` that:
|
|
25
|
+
|
|
26
|
+
- exposes the variant value via `data-variant` (omitted when `options` is not provided),
|
|
27
|
+
- applies the external `cssClass` directly on the host div,
|
|
28
|
+
- projects all children via `<ng-content />`.
|
|
29
|
+
|
|
30
|
+
It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
31
|
+
|
|
32
|
+
### ListContainerBaseComponent (abstract)
|
|
33
|
+
|
|
34
|
+
Abstract base directive for extending custom list container implementations. Exposes `options` as an `InputSignal<IListContainerOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`). Has no outputs or methods.
|
|
35
|
+
|
|
36
|
+
## API
|
|
37
|
+
|
|
38
|
+
### Inputs
|
|
39
|
+
|
|
40
|
+
| Input | Type | Default | Description |
|
|
41
|
+
| --------- | ------------------------------------------------- | ------- | --------------------------------------------------- |
|
|
42
|
+
| `options` | `InputSignal<IListContainerOptions \| undefined>` | - | Optional configuration (variant, fullWidthOnMobile) |
|
|
43
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
44
|
+
|
|
45
|
+
### IListContainerOptions
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
interface IListContainerOptions {
|
|
49
|
+
variant?: SmartListContainerVariant;
|
|
50
|
+
fullWidthOnMobile?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type SmartListContainerVariant =
|
|
54
|
+
| 'simple'
|
|
55
|
+
| 'card'
|
|
56
|
+
| 'separate-cards'
|
|
57
|
+
| 'flat-card-dividers';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The standard component only consumes `variant` (placeholder behavior — applied as the `data-variant` attribute on the list root). The `fullWidthOnMobile` flag is reserved for custom implementations registered through `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN` and is ignored by `ListContainerStandardComponent`.
|
|
61
|
+
|
|
62
|
+
## LIST_CONTAINER_STANDARD_COMPONENT_TOKEN
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { LIST_CONTAINER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
InjectionToken that allows replacing the default `ListContainerStandardComponent` with a custom implementation. Provide a `Type<ListContainerBaseComponent>` to override.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// In your app module or component providers:
|
|
72
|
+
providers: [
|
|
73
|
+
{
|
|
74
|
+
provide: LIST_CONTAINER_STANDARD_COMPONENT_TOKEN,
|
|
75
|
+
useValue: MyCustomListContainerComponent,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Extending the Base Class
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import {
|
|
84
|
+
ChangeDetectionStrategy,
|
|
85
|
+
Component,
|
|
86
|
+
computed,
|
|
87
|
+
input,
|
|
88
|
+
ViewEncapsulation,
|
|
89
|
+
} from '@angular/core';
|
|
90
|
+
|
|
91
|
+
import { ListContainerBaseComponent } from '@smartsoft001/angular';
|
|
92
|
+
|
|
93
|
+
@Component({
|
|
94
|
+
selector: 'my-custom-list-container',
|
|
95
|
+
template: `
|
|
96
|
+
<div role="list" [class]="containerClasses()">
|
|
97
|
+
<ng-content />
|
|
98
|
+
</div>
|
|
99
|
+
`,
|
|
100
|
+
encapsulation: ViewEncapsulation.None,
|
|
101
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
102
|
+
})
|
|
103
|
+
export class MyCustomListContainerComponent extends ListContainerBaseComponent {
|
|
104
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
105
|
+
override cssClass = input<string>('');
|
|
106
|
+
|
|
107
|
+
containerClasses = computed(() => {
|
|
108
|
+
const classes = ['my-list-container'];
|
|
109
|
+
const variant = this.options()?.variant;
|
|
110
|
+
if (variant) classes.push(`my-list-container--${variant}`);
|
|
111
|
+
if (this.options()?.fullWidthOnMobile) {
|
|
112
|
+
classes.push('my-list-container--full-width-mobile');
|
|
113
|
+
}
|
|
114
|
+
const extra = this.cssClass();
|
|
115
|
+
if (extra) classes.push(extra);
|
|
116
|
+
return classes.join(' ');
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
When extending the base directly, remember to:
|
|
122
|
+
|
|
123
|
+
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
124
|
+
- include `<ng-content />` in your template so consumers can project list items.
|
|
125
|
+
|
|
126
|
+
## Usage Examples
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<!-- Basic -->
|
|
130
|
+
<smart-list-container>
|
|
131
|
+
<smart-list-item />
|
|
132
|
+
<smart-list-item />
|
|
133
|
+
</smart-list-container>
|
|
134
|
+
|
|
135
|
+
<!-- With variant -->
|
|
136
|
+
<smart-list-container [options]="{ variant: 'separate-cards' }">
|
|
137
|
+
<smart-list-item />
|
|
138
|
+
</smart-list-container>
|
|
139
|
+
|
|
140
|
+
<!-- Full width on mobile (consumed by custom implementations) -->
|
|
141
|
+
<smart-list-container [options]="{ variant: 'card', fullWidthOnMobile: true }">
|
|
142
|
+
<smart-list-item />
|
|
143
|
+
</smart-list-container>
|
|
144
|
+
|
|
145
|
+
<!-- With external class -->
|
|
146
|
+
<smart-list-container class="smart:my-2">
|
|
147
|
+
<smart-list-item />
|
|
148
|
+
</smart-list-container>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## File Locations
|
|
152
|
+
|
|
153
|
+
- Wrapper: `packages/shared/angular/src/lib/components/list-container/list-container.component.ts`
|
|
154
|
+
- Standard: `packages/shared/angular/src/lib/components/list-container/standard/standard.component.ts`
|
|
155
|
+
- Base class: `packages/shared/angular/src/lib/components/list-container/base/base.component.ts`
|
|
156
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`LIST_CONTAINER_STANDARD_COMPONENT_TOKEN`)
|
|
157
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IListContainerOptions`)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-media-object
|
|
3
|
+
description: MediaObject layout component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MediaObject Component
|
|
8
|
+
|
|
9
|
+
The `<smart-media-object>` component provides a flexible media-object layout wrapper with an InjectionToken-based extension mechanism. It pairs an image with adjacent body content (the classic media object pattern) and renders a default `MediaObjectStandardComponent` which can be replaced via `MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the media-object layout
|
|
14
|
+
- Developer asks about `<smart-media-object>` or `MediaObjectComponent`
|
|
15
|
+
- Developer needs an image-and-body layout (avatars next to text, thumbnails next to descriptions, etc.)
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### MediaObjectComponent (`<smart-media-object>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper component. Renders `MediaObjectStandardComponent` by default. When `MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Projects body content into the standard via `<ng-content />`.
|
|
22
|
+
|
|
23
|
+
### MediaObjectStandardComponent (`<smart-media-object-standard>`)
|
|
24
|
+
|
|
25
|
+
Default concrete implementation. Renders an `<img>` and a `.smart-media-object-body` slot inside a wrapper `<div>`. The wrapper exposes `data-position` and `data-alignment` attributes derived from `options` for CSS styling.
|
|
26
|
+
|
|
27
|
+
### MediaObjectBaseComponent (abstract)
|
|
28
|
+
|
|
29
|
+
Abstract base directive for extending custom media-object implementations. Declares `mediaUrl` (required), `mediaAlt` (required), `options`, and `cssClass`.
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### Inputs
|
|
34
|
+
|
|
35
|
+
| Input | Type | Default | Description |
|
|
36
|
+
| ---------- | ----------------------------------------------- | ----------- | ------------------------------------------- |
|
|
37
|
+
| `mediaUrl` | `InputSignal<string>` | required | Image URL |
|
|
38
|
+
| `mediaAlt` | `InputSignal<string>` | required | Image alt text |
|
|
39
|
+
| `options` | `InputSignal<IMediaObjectOptions \| undefined>` | `undefined` | Layout configuration |
|
|
40
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
41
|
+
|
|
42
|
+
### Content Projection
|
|
43
|
+
|
|
44
|
+
The wrapper projects body content via `<ng-content />` into the `.smart-media-object-body` slot of the standard component.
|
|
45
|
+
|
|
46
|
+
### IMediaObjectOptions
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
interface IMediaObjectOptions {
|
|
50
|
+
alignment?: 'top' | 'center' | 'bottom' | 'stretched';
|
|
51
|
+
position?: 'left' | 'right';
|
|
52
|
+
responsive?: boolean;
|
|
53
|
+
nested?: boolean;
|
|
54
|
+
wide?: boolean;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The standard renders:
|
|
59
|
+
|
|
60
|
+
- `data-position` attribute: defaults to `'left'` when not provided
|
|
61
|
+
- `data-alignment` attribute: only set when `options.alignment` is provided
|
|
62
|
+
|
|
63
|
+
### MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
InjectionToken that allows replacing the default `MediaObjectStandardComponent` with a custom implementation. Provide a `Type<MediaObjectBaseComponent>` to override.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// In your app module or component providers:
|
|
73
|
+
providers: [
|
|
74
|
+
{
|
|
75
|
+
provide: MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN,
|
|
76
|
+
useValue: MyCustomMediaObjectComponent,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Extending the Base Class
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
85
|
+
import { MediaObjectBaseComponent } from '@smartsoft001/angular';
|
|
86
|
+
|
|
87
|
+
@Component({
|
|
88
|
+
selector: 'my-custom-media-object',
|
|
89
|
+
template: `
|
|
90
|
+
<article [class]="cssClass()">
|
|
91
|
+
<img [src]="mediaUrl()" [alt]="mediaAlt()" />
|
|
92
|
+
<div class="body"><ng-content /></div>
|
|
93
|
+
</article>
|
|
94
|
+
`,
|
|
95
|
+
encapsulation: ViewEncapsulation.None,
|
|
96
|
+
})
|
|
97
|
+
export class MyCustomMediaObjectComponent extends MediaObjectBaseComponent {}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Usage Examples
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<!-- Default media-object -->
|
|
104
|
+
<smart-media-object
|
|
105
|
+
mediaUrl="https://example.com/avatar.png"
|
|
106
|
+
mediaAlt="User avatar"
|
|
107
|
+
>
|
|
108
|
+
<h3>Jane Doe</h3>
|
|
109
|
+
<p>Software engineer.</p>
|
|
110
|
+
</smart-media-object>
|
|
111
|
+
|
|
112
|
+
<!-- With position and alignment -->
|
|
113
|
+
<smart-media-object
|
|
114
|
+
mediaUrl="https://example.com/thumb.jpg"
|
|
115
|
+
mediaAlt="Article thumbnail"
|
|
116
|
+
[options]="{ position: 'right', alignment: 'center' }"
|
|
117
|
+
>
|
|
118
|
+
<h3>Article title</h3>
|
|
119
|
+
<p>Excerpt of the article body.</p>
|
|
120
|
+
</smart-media-object>
|
|
121
|
+
|
|
122
|
+
<!-- With external class -->
|
|
123
|
+
<smart-media-object
|
|
124
|
+
class="smart:mt-4"
|
|
125
|
+
mediaUrl="https://example.com/icon.png"
|
|
126
|
+
mediaAlt="Feature icon"
|
|
127
|
+
>
|
|
128
|
+
<p>Feature description.</p>
|
|
129
|
+
</smart-media-object>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## File Locations
|
|
133
|
+
|
|
134
|
+
- Wrapper: `packages/shared/angular/src/lib/components/media-object/media-object.component.ts`
|
|
135
|
+
- Standard: `packages/shared/angular/src/lib/components/media-object/standard/standard.component.ts`
|
|
136
|
+
- Standard template: `packages/shared/angular/src/lib/components/media-object/standard/standard.component.html`
|
|
137
|
+
- Base class: `packages/shared/angular/src/lib/components/media-object/base/base.component.ts`
|
|
138
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`MEDIA_OBJECT_STANDARD_COMPONENT_TOKEN`)
|
|
139
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IMediaObjectOptions`)
|