@smartsoft001/claude-plugins 2.119.0 → 2.120.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 +212 -11
- package/plugins/smart/skills/angular-components-accordion/SKILL.md +86 -0
- package/plugins/smart/skills/angular-components-action-panel/SKILL.md +195 -0
- package/plugins/smart/skills/angular-components-breadcrumbs/SKILL.md +152 -0
- package/plugins/smart/skills/angular-components-button/SKILL.md +81 -54
- package/plugins/smart/skills/angular-components-calendar/SKILL.md +222 -0
- package/plugins/smart/skills/angular-components-card/SKILL.md +112 -0
- package/plugins/smart/skills/angular-components-card-heading/SKILL.md +156 -0
- package/plugins/smart/skills/angular-components-date-edit/SKILL.md +107 -0
- package/plugins/smart/skills/angular-components-date-range/SKILL.md +149 -0
- package/plugins/smart/skills/angular-components-description-list/SKILL.md +205 -0
- package/plugins/smart/skills/angular-components-detail/SKILL.md +146 -0
- package/plugins/smart/skills/angular-components-details/SKILL.md +123 -0
- package/plugins/smart/skills/angular-components-empty-state/SKILL.md +198 -0
- package/plugins/smart/skills/angular-components-feed/SKILL.md +199 -0
- package/plugins/smart/skills/angular-components-form/SKILL.md +160 -0
- package/plugins/smart/skills/angular-components-grid-list/SKILL.md +215 -0
- package/plugins/smart/skills/angular-components-info/SKILL.md +160 -0
- package/plugins/smart/skills/angular-components-input/SKILL.md +196 -0
- package/plugins/smart/skills/angular-components-list/SKILL.md +265 -0
- package/plugins/smart/skills/angular-components-multi-column-layout/SKILL.md +174 -0
- package/plugins/smart/skills/angular-components-navbar/SKILL.md +192 -0
- package/plugins/smart/skills/angular-components-page/SKILL.md +230 -0
- package/plugins/smart/skills/angular-components-page-heading/SKILL.md +183 -0
- package/plugins/smart/skills/angular-components-paging/SKILL.md +132 -0
- package/plugins/smart/skills/angular-components-password-strength/SKILL.md +172 -0
- package/plugins/smart/skills/angular-components-progress-bars/SKILL.md +187 -0
- package/plugins/smart/skills/angular-components-searchbar/SKILL.md +167 -0
- package/plugins/smart/skills/angular-components-section-heading/SKILL.md +177 -0
- package/plugins/smart/skills/angular-components-select-menu/SKILL.md +211 -0
- package/plugins/smart/skills/angular-components-sidebar-layout/SKILL.md +176 -0
- package/plugins/smart/skills/angular-components-sidebar-navigation/SKILL.md +225 -0
- package/plugins/smart/skills/angular-components-sign-in-form/SKILL.md +202 -0
- package/plugins/smart/skills/angular-components-stacked-layout/SKILL.md +169 -0
- package/plugins/smart/skills/angular-components-stacked-list/SKILL.md +213 -0
- package/plugins/smart/skills/angular-components-stats/SKILL.md +213 -0
- package/plugins/smart/skills/angular-components-table/SKILL.md +216 -0
- package/plugins/smart/skills/angular-components-tabs/SKILL.md +181 -0
- package/plugins/smart/skills/angular-components-textarea/SKILL.md +168 -0
- package/plugins/smart/skills/angular-components-toggle/SKILL.md +155 -0
- package/plugins/smart/skills/angular-components-vertical-navigation/SKILL.md +158 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-detail
|
|
3
|
+
description: Detail field component with InjectionToken pattern for per-field substitution.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Detail Component
|
|
8
|
+
|
|
9
|
+
The `<smart-detail>` component renders a single model field value by delegating to a sub-component chosen by `FieldType`. It selects a sub-component based on the `FieldType` from an internal `baseMap` and an optional `extendMap` injected via `DETAIL_FIELD_COMPONENTS_TOKEN`. It renders the label (via `ModelLabelPipe`), the value (`NgComponentOutlet` on the selected sub-component), or a skeleton when `item()` returns undefined.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the detail field component
|
|
14
|
+
- Developer asks about `<smart-detail>` or `DetailComponent`
|
|
15
|
+
- Developer wants to extend `DetailBaseComponent` for a custom sub-component
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### DetailComponent (`<smart-detail>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper component. Selects a sub-component from `baseMap` (or `extendMap` override) based on `options().options.type` and renders it via `NgComponentOutlet`. Shows a skeleton placeholder while `item()` is undefined.
|
|
22
|
+
|
|
23
|
+
### DetailBaseComponent (abstract)
|
|
24
|
+
|
|
25
|
+
Abstract base directive for all detail sub-components. Provides:
|
|
26
|
+
|
|
27
|
+
- `options: InputSignal<IDetailOptions<T>>` — field configuration
|
|
28
|
+
- `cssClass: InputSignal<string>` (alias `class`) — external CSS classes
|
|
29
|
+
- `afterSetOptionsHandler()` — hook invoked via effect on options change
|
|
30
|
+
- Effect that calls `ChangeDetectorRef.detectChanges()` when options change
|
|
31
|
+
|
|
32
|
+
### Default Sub-Components
|
|
33
|
+
|
|
34
|
+
| FieldType | Sub-component | Selector | Description |
|
|
35
|
+
| --------------- | ------------------------------ | ------------------------------ | --------------------------------------------------------------------- |
|
|
36
|
+
| `text` | `DetailTextComponent` | `smart-detail-text` | Text via `ListCellPipe` + `TrustHtmlPipe`, fallback for unknown types |
|
|
37
|
+
| `email` | `DetailEmailComponent` | `smart-detail-email` | Link `mailto:` |
|
|
38
|
+
| `enum` | `DetailEnumComponent` | `smart-detail-enum` | Single value or array with `translate` |
|
|
39
|
+
| `flag` | `DetailFlagComponent` | `smart-detail-flag` | Inline SVG ✓ / ✗ |
|
|
40
|
+
| `color` | `DetailColorComponent` | `smart-detail-color` | Rectangle with `background-color` |
|
|
41
|
+
| `address` | `DetailAddressComponent` | `smart-detail-address` | `IAddress` (street, number, zip, city) |
|
|
42
|
+
| `object` | `DetailObjectComponent` | `smart-detail-object` | Nested model via `DETAILS_COMPONENT_TOKEN` |
|
|
43
|
+
| `array` | `DetailArrayComponent` | `smart-detail-array` | Array of nested models |
|
|
44
|
+
| `dateRange` | `DetailDateRangeComponent` | `smart-detail-date-range` | `start – end` |
|
|
45
|
+
| `phoneNumberPl` | `DetailPhoneNumberPlComponent` | `smart-detail-phone-number-pl` | Link `tel:48...` as badge |
|
|
46
|
+
| `image` | `DetailImageComponent` | `smart-detail-image` | `<img>` via `FileService.getUrl(item[key].id)` |
|
|
47
|
+
| `logo` | `DetailLogoComponent` | `smart-detail-logo` | `<img>` with `item[key]` as URL |
|
|
48
|
+
| `video` | `DetailVideoComponent` | `smart-detail-video` | `<video controls>` via `FileService` |
|
|
49
|
+
| `attachment` | `DetailAttachmentComponent` | `smart-detail-attachment` | Native `<button>` Tailwind — download via `FileService` |
|
|
50
|
+
| `pdf` | `DetailPdfComponent` | `smart-detail-pdf` | Native `<button>` Tailwind — show via `FileService` |
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
### DetailComponent Inputs
|
|
55
|
+
|
|
56
|
+
| Input | Type | Default | Description |
|
|
57
|
+
| --------- | --------------------------------------------- | -------- | -------------------------------------- |
|
|
58
|
+
| `options` | `InputSignal<IDetailOptions<T> \| undefined>` | required | Field configuration |
|
|
59
|
+
| `type` | `InputSignal<any>` | required | Model class (used by `ModelLabelPipe`) |
|
|
60
|
+
|
|
61
|
+
### IDetailOptions
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
interface IDetailOptions<T> {
|
|
65
|
+
key: string;
|
|
66
|
+
item?: Signal<T>;
|
|
67
|
+
options: IFieldOptions;
|
|
68
|
+
cellPipe?: ICellPipe<T>;
|
|
69
|
+
loading?: Signal<boolean>;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**IFieldOptions** (relevant properties): `type?: FieldType`, `info?: string`.
|
|
74
|
+
|
|
75
|
+
### DETAIL_FIELD_COMPONENTS_TOKEN
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { DETAIL_FIELD_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
79
|
+
import { FieldType } from '@smartsoft001/models';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`InjectionToken<Partial<Record<FieldTypeDef, Type<DetailBaseComponent<any>>>>>` — allows substituting a sub-component for any field type.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
providers: [
|
|
86
|
+
{
|
|
87
|
+
provide: DETAIL_FIELD_COMPONENTS_TOKEN,
|
|
88
|
+
useValue: {
|
|
89
|
+
[FieldType.text]: MyCustomTextComponent,
|
|
90
|
+
[FieldType.image]: MyCustomImageComponent,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Maps are merged (`{ ...baseMap, ...extendMap }`), so only selected types need to be overridden.
|
|
97
|
+
|
|
98
|
+
## Extending the Base Class
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Component, computed } from '@angular/core';
|
|
102
|
+
import { DetailBaseComponent } from '@smartsoft001/angular';
|
|
103
|
+
|
|
104
|
+
@Component({
|
|
105
|
+
selector: 'my-detail-text',
|
|
106
|
+
template: `
|
|
107
|
+
@let item = options()?.item?.();
|
|
108
|
+
@let key = options()?.key;
|
|
109
|
+
@if (item && key) {
|
|
110
|
+
<p [class]="classes()">{{ item[key] }}</p>
|
|
111
|
+
}
|
|
112
|
+
`,
|
|
113
|
+
standalone: true,
|
|
114
|
+
})
|
|
115
|
+
export class MyDetailTextComponent extends DetailBaseComponent<any> {
|
|
116
|
+
classes = computed(() => ['my-prefix-text', this.cssClass()].join(' '));
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Usage Examples
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<!-- Direct usage -->
|
|
124
|
+
<smart-detail [options]="fieldOptions" [type]="ModelClass"></smart-detail>
|
|
125
|
+
|
|
126
|
+
<!-- With custom class -->
|
|
127
|
+
<smart-detail
|
|
128
|
+
[options]="fieldOptions"
|
|
129
|
+
[type]="ModelClass"
|
|
130
|
+
class="smart:mt-4"
|
|
131
|
+
></smart-detail>
|
|
132
|
+
|
|
133
|
+
<!-- Loading skeleton (when item() returns undefined) -->
|
|
134
|
+
<smart-detail
|
|
135
|
+
[options]="{ ...fieldOptions, item: signal(undefined) }"
|
|
136
|
+
[type]="ModelClass"
|
|
137
|
+
></smart-detail>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## File Locations
|
|
141
|
+
|
|
142
|
+
- Wrapper: `packages/shared/angular/src/lib/components/detail/detail.component.ts`
|
|
143
|
+
- Base: `packages/shared/angular/src/lib/components/detail/base/base.component.ts`
|
|
144
|
+
- Sub-components: `packages/shared/angular/src/lib/components/detail/<name>/<name>.component.ts`
|
|
145
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DETAIL_FIELD_COMPONENTS_TOKEN`)
|
|
146
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDetailOptions`)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-details
|
|
3
|
+
description: Details component API with InjectionToken pattern for custom implementations. Renders a list of model fields via <smart-detail>.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Details Component
|
|
8
|
+
|
|
9
|
+
The `<smart-details>` component renders a list of model fields decorated with `@Field({ details: true })`. It is a wrapper that delegates to `DetailsStandardComponent` by default and can be replaced via `DETAILS_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to render a read-only summary of an entity using model decorators
|
|
14
|
+
- Developer asks about `<smart-details>` or `DetailsComponent`
|
|
15
|
+
- Developer wants to provide a custom layout for the standard details rendering
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### DetailsComponent (`<smart-details>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper. Renders `DetailsStandardComponent` by default. When `DETAILS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passing `options` and `class` as inputs.
|
|
22
|
+
|
|
23
|
+
### DetailsStandardComponent (`<smart-details-standard>`)
|
|
24
|
+
|
|
25
|
+
Default concrete implementation. Generic Tailwind-styled `<dl>` placeholder that iterates over `fields` and renders each via `<smart-detail>`.
|
|
26
|
+
|
|
27
|
+
### DetailsBaseComponent (abstract)
|
|
28
|
+
|
|
29
|
+
Abstract base directive. Computes `fields` from model decorators (with permission and specification filters), exposes the typed `item` signal, and tracks `cellPipe`/`componentFactories`. Extend it to build custom details implementations.
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### Inputs
|
|
34
|
+
|
|
35
|
+
| Input | Type | Default | Description |
|
|
36
|
+
| --------- | ---------------------------------------- | ----------- | ------------------------------------- |
|
|
37
|
+
| `options` | `InputSignal<IDetailsOptions<T>>` | `undefined` | Details configuration |
|
|
38
|
+
| `class` | `InputSignal<string>` (alias `cssClass`) | `''` | External CSS classes on the container |
|
|
39
|
+
|
|
40
|
+
### IDetailsOptions
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
interface IDetailsOptions<T> {
|
|
44
|
+
type: any; // Model class (decorated with @Model)
|
|
45
|
+
item: Signal<T | undefined>;
|
|
46
|
+
loading?: Signal<boolean>;
|
|
47
|
+
cellPipe?: ICellPipe<T>;
|
|
48
|
+
componentFactories?: IDetailsComponentFactories<T>;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### DETAILS_STANDARD_COMPONENT_TOKEN
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { DETAILS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
InjectionToken that allows replacing the default `DetailsStandardComponent` with a custom implementation. Provide a `Type<DetailsBaseComponent<T>>`.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
providers: [
|
|
62
|
+
{
|
|
63
|
+
provide: DETAILS_STANDARD_COMPONENT_TOKEN,
|
|
64
|
+
useValue: MyCustomDetailsComponent,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Extending the Base Class
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
73
|
+
import { DetailsBaseComponent } from '@smartsoft001/angular';
|
|
74
|
+
|
|
75
|
+
@Component({
|
|
76
|
+
selector: 'my-custom-details',
|
|
77
|
+
template: `
|
|
78
|
+
<dl [class]="cssClass()">
|
|
79
|
+
@for (field of fields; track field.key) {
|
|
80
|
+
<div class="my-row">
|
|
81
|
+
<dt>{{ field.key }}</dt>
|
|
82
|
+
<dd>{{ item?.()?.[field.key] }}</dd>
|
|
83
|
+
</div>
|
|
84
|
+
}
|
|
85
|
+
</dl>
|
|
86
|
+
`,
|
|
87
|
+
encapsulation: ViewEncapsulation.None,
|
|
88
|
+
})
|
|
89
|
+
export class MyCustomDetailsComponent extends DetailsBaseComponent<any> {}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Usage Examples
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<!-- Default details -->
|
|
96
|
+
<smart-details
|
|
97
|
+
[options]="{ type: UserModel, item: userSignal }"
|
|
98
|
+
></smart-details>
|
|
99
|
+
|
|
100
|
+
<!-- With external CSS class -->
|
|
101
|
+
<smart-details
|
|
102
|
+
class="smart:bg-yellow-50 smart:p-4"
|
|
103
|
+
[options]="{ type: UserModel, item: userSignal }"
|
|
104
|
+
></smart-details>
|
|
105
|
+
|
|
106
|
+
<!-- With loading skeleton -->
|
|
107
|
+
<smart-details
|
|
108
|
+
[options]="{ type: UserModel, item: userSignal, loading: loadingSignal }"
|
|
109
|
+
></smart-details>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Field Rendering
|
|
113
|
+
|
|
114
|
+
Each field is rendered via `<smart-detail>`. The actual rendering of a single field by `FieldType` (text, email, address, image, attachment, …) is dispatched inside `<smart-detail>` itself. See the `angular-components-detail` skill for per-field details.
|
|
115
|
+
|
|
116
|
+
## File Locations
|
|
117
|
+
|
|
118
|
+
- Wrapper: `packages/shared/angular/src/lib/components/details/details.component.ts`
|
|
119
|
+
- Standard: `packages/shared/angular/src/lib/components/details/standard/standard.component.ts`
|
|
120
|
+
- Base class: `packages/shared/angular/src/lib/components/details/base/base.component.ts`
|
|
121
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DETAILS_STANDARD_COMPONENT_TOKEN`)
|
|
122
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDetailsOptions`)
|
|
123
|
+
- Stories: `packages/shared/angular/src/lib/components/details/details.component.stories.ts`
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-empty-state
|
|
3
|
+
description: Empty State component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Empty State Component
|
|
8
|
+
|
|
9
|
+
The `<smart-empty-state>` component renders an empty-state placeholder with an optional centered icon, title, description, primary actions and a list of starting-points / templates / recommendations. It is typically shown when a list, page or section has no content yet (e.g. _No projects_, _Create your first project_, _Add team members_). It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `EmptyStateBaseComponent` defines the shared API — `options` (`IEmptyStateOptions`), `cssClass` (alias `class`), and the `actionClick` / `itemClick` outputs. `EmptyStateStandardComponent` is a barebones placeholder using native `<h3>`, `<p>`, `<a>`, `<button>`, `<ul>` and `<li>` elements. `EmptyStateComponent` is the public wrapper that renders `EmptyStateStandardComponent` by default and accepts a custom replacement via `EMPTY_STATE_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the empty state component
|
|
14
|
+
- Developer asks about `<smart-empty-state>`, `EmptyStateComponent`, `EmptyStateStandardComponent`, or `EmptyStateBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### EmptyStateComponent (`<smart-empty-state>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `EmptyStateStandardComponent` by default. When `EMPTY_STATE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `actionClick` and `itemClick`.
|
|
21
|
+
|
|
22
|
+
### EmptyStateStandardComponent (`<smart-empty-state-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<div class="empty-state">` containing optional `iconTpl` (rendered via `NgTemplateOutlet`), `<h3 class="title">{{ options.title }}</h3>`, `<p class="description">{{ options.description }}</p>`, an optional `formTpl` slot, an optional row of action buttons or anchors (`<button class="action variant-{variant}">` or `<a>` when `action.href` provided), an optional list of items (`<a class="item-link">` when `item.href` provided, otherwise `<button class="item-button">`) with title / description / meta / icon / image, and an optional footer link.
|
|
25
|
+
|
|
26
|
+
### EmptyStateBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive. Exposes:
|
|
29
|
+
|
|
30
|
+
- `options: InputSignal<IEmptyStateOptions | undefined>`
|
|
31
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
32
|
+
- `actionClick: OutputEmitterRef<IEmptyStateActionClick>`
|
|
33
|
+
- `itemClick: OutputEmitterRef<IEmptyStateItemClick>`
|
|
34
|
+
|
|
35
|
+
`IEmptyStateActionClick = { actionId: string }`
|
|
36
|
+
`IEmptyStateItemClick = { itemId: string }`
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### Inputs
|
|
41
|
+
|
|
42
|
+
| Input | Type | Default | Description |
|
|
43
|
+
| --------- | ---------------------------------------------- | ------- | ------------------------------------------- |
|
|
44
|
+
| `options` | `InputSignal<IEmptyStateOptions \| undefined>` | - | Empty state configuration |
|
|
45
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
46
|
+
|
|
47
|
+
### Outputs
|
|
48
|
+
|
|
49
|
+
| Output | Type | Description |
|
|
50
|
+
| ------------- | ------------------------------------------ | ---------------------------------------------- |
|
|
51
|
+
| `actionClick` | `OutputEmitterRef<IEmptyStateActionClick>` | Emitted when a button-type action is clicked |
|
|
52
|
+
| `itemClick` | `OutputEmitterRef<IEmptyStateItemClick>` | Emitted when an item without `href` is clicked |
|
|
53
|
+
|
|
54
|
+
### IEmptyStateOptions
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
type SmartEmptyStateLayout =
|
|
58
|
+
| 'simple'
|
|
59
|
+
| 'dashed-border'
|
|
60
|
+
| 'starting-points'
|
|
61
|
+
| 'with-recommendations'
|
|
62
|
+
| 'with-templates'
|
|
63
|
+
| 'with-recommendations-grid';
|
|
64
|
+
|
|
65
|
+
interface IEmptyStateOptions {
|
|
66
|
+
title?: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
layout?: SmartEmptyStateLayout;
|
|
69
|
+
iconTpl?: TemplateRef<unknown>;
|
|
70
|
+
actions?: IEmptyStateAction[];
|
|
71
|
+
items?: IEmptyStateItem[];
|
|
72
|
+
itemsTitle?: string;
|
|
73
|
+
formTpl?: TemplateRef<unknown>;
|
|
74
|
+
footerLinkLabel?: string;
|
|
75
|
+
footerLinkHref?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface IEmptyStateAction {
|
|
79
|
+
id: string;
|
|
80
|
+
label?: string;
|
|
81
|
+
href?: string;
|
|
82
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'link';
|
|
83
|
+
iconTpl?: TemplateRef<unknown>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface IEmptyStateItem {
|
|
87
|
+
id: string;
|
|
88
|
+
title?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
href?: string;
|
|
91
|
+
iconTpl?: TemplateRef<unknown>;
|
|
92
|
+
imageUrl?: string;
|
|
93
|
+
imageAlt?: string;
|
|
94
|
+
meta?: string;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## EMPTY_STATE_STANDARD_COMPONENT_TOKEN
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { EMPTY_STATE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
102
|
+
|
|
103
|
+
providers: [
|
|
104
|
+
{
|
|
105
|
+
provide: EMPTY_STATE_STANDARD_COMPONENT_TOKEN,
|
|
106
|
+
useValue: MyCustomEmptyStateComponent,
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Extending the Base Class
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import {
|
|
115
|
+
ChangeDetectionStrategy,
|
|
116
|
+
Component,
|
|
117
|
+
input,
|
|
118
|
+
ViewEncapsulation,
|
|
119
|
+
} from '@angular/core';
|
|
120
|
+
|
|
121
|
+
import { EmptyStateBaseComponent } from '@smartsoft001/angular';
|
|
122
|
+
|
|
123
|
+
@Component({
|
|
124
|
+
selector: 'my-custom-empty-state',
|
|
125
|
+
template: `
|
|
126
|
+
<div class="text-center">
|
|
127
|
+
@if (options()?.title) {
|
|
128
|
+
<h3>{{ options()!.title }}</h3>
|
|
129
|
+
}
|
|
130
|
+
@if (options()?.description) {
|
|
131
|
+
<p>{{ options()!.description }}</p>
|
|
132
|
+
}
|
|
133
|
+
@for (action of options()?.actions ?? []; track action.id) {
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
(click)="actionClick.emit({ actionId: action.id })"
|
|
137
|
+
>
|
|
138
|
+
{{ action.label }}
|
|
139
|
+
</button>
|
|
140
|
+
}
|
|
141
|
+
</div>
|
|
142
|
+
`,
|
|
143
|
+
encapsulation: ViewEncapsulation.None,
|
|
144
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
145
|
+
})
|
|
146
|
+
export class MyCustomEmptyStateComponent extends EmptyStateBaseComponent {
|
|
147
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
148
|
+
override cssClass = input<string>('');
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Usage Examples
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<!-- Simple "No projects" empty state -->
|
|
156
|
+
<smart-empty-state
|
|
157
|
+
[options]="{
|
|
158
|
+
title: 'No projects',
|
|
159
|
+
description: 'Get started by creating a new project.',
|
|
160
|
+
actions: [{ id: 'create', label: 'New Project', variant: 'primary' }],
|
|
161
|
+
}"
|
|
162
|
+
(actionClick)="onAction($event)"
|
|
163
|
+
/>
|
|
164
|
+
|
|
165
|
+
<!-- With starting-points list -->
|
|
166
|
+
<smart-empty-state
|
|
167
|
+
[options]="{
|
|
168
|
+
title: 'Projects',
|
|
169
|
+
description: 'Get started by selecting a template.',
|
|
170
|
+
items: [
|
|
171
|
+
{ id: 'list', title: 'Create a List', description: 'A simple list', href: '/lists/new' },
|
|
172
|
+
{ id: 'calendar', title: 'Create a Calendar', description: 'Track deadlines', href: '/calendars/new' },
|
|
173
|
+
],
|
|
174
|
+
footerLinkLabel: 'Or start from an empty project',
|
|
175
|
+
footerLinkHref: '/projects/new',
|
|
176
|
+
}"
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
<!-- With template list emitting itemClick -->
|
|
180
|
+
<smart-empty-state
|
|
181
|
+
[options]="{
|
|
182
|
+
title: 'Create your first project',
|
|
183
|
+
items: [
|
|
184
|
+
{ id: 'marketing', title: 'Marketing Campaign', description: 'Memes' },
|
|
185
|
+
{ id: 'engineering', title: 'Engineering Project', description: 'Code' },
|
|
186
|
+
],
|
|
187
|
+
}"
|
|
188
|
+
(itemClick)="onTemplate($event)"
|
|
189
|
+
/>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## File Locations
|
|
193
|
+
|
|
194
|
+
- Wrapper: `packages/shared/angular/src/lib/components/empty-state/empty-state.component.ts`
|
|
195
|
+
- Standard: `packages/shared/angular/src/lib/components/empty-state/standard/standard.component.ts`
|
|
196
|
+
- Base class: `packages/shared/angular/src/lib/components/empty-state/base/base.component.ts`
|
|
197
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`EMPTY_STATE_STANDARD_COMPONENT_TOKEN`)
|
|
198
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IEmptyStateOptions`, `IEmptyStateAction`, `IEmptyStateItem`, `SmartEmptyStateLayout`)
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-feed
|
|
3
|
+
description: Feed (timeline/activity) component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Feed Component
|
|
8
|
+
|
|
9
|
+
The `<smart-feed>` component renders a vertical timeline of activity events with optional title, description, per-event icon/avatar, link, timestamp, description, nested comments, an empty state, an optional comment-submit slot, and a bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `FeedBaseComponent` defines the shared API — optional `IFeedOptions` and `cssClass` (alias `class`). `FeedStandardComponent` is a barebones placeholder concrete implementation. `FeedComponent` is the public wrapper that renders `FeedStandardComponent` by default and accepts a custom replacement via `FEED_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the feed/timeline component
|
|
14
|
+
- Developer asks about `<smart-feed>`, `FeedComponent`, `FeedStandardComponent`, or `FeedBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### FeedComponent (`<smart-feed>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `FeedStandardComponent` by default. When `FEED_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### FeedStandardComponent (`<smart-feed-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">`, optional `<p class="description">`, and a `<ol role="list">` with one `<li class="event">` per event. Each event renders the icon/avatar (icon template wins over avatar URL), an optional `<time class="timestamp">`, the title (rendered as `<a class="title">` if `href` is provided, otherwise `<span class="title">`), an optional description, and a nested `<ul class="comments">` with one `<li class="comment">` per comment (avatar, author name, optional timestamp, content). When events list is empty, the optional `emptyTpl` is rendered inside `<div class="empty">`. An optional `commentSubmitTpl` renders inside `<div class="comment-submit">`. A bottom `footerTpl` renders inside `<div class="footer">`. The external `cssClass` is applied to the root wrapper. It does not include any visual styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
|
+
|
|
26
|
+
### FeedBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom feed implementations. Exposes `options` as an `InputSignal<IFeedOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| --------- | ---------------------------------------- | ------- | ------------------------------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<IFeedOptions \| undefined>` | - | Optional configuration (title, description, events, slots, variant) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### IFeedOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface IFeedOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
events?: IFeedEvent[];
|
|
46
|
+
variant?: 'simple' | 'with-comments' | 'multiple-types';
|
|
47
|
+
commentSubmitTpl?: TemplateRef<unknown>;
|
|
48
|
+
emptyTpl?: TemplateRef<unknown>;
|
|
49
|
+
footerTpl?: TemplateRef<unknown>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface IFeedEvent {
|
|
53
|
+
id?: string;
|
|
54
|
+
title: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
timestamp?: string;
|
|
57
|
+
iconTpl?: TemplateRef<unknown>;
|
|
58
|
+
avatarUrl?: string;
|
|
59
|
+
href?: string;
|
|
60
|
+
type?: string;
|
|
61
|
+
comments?: IFeedComment[];
|
|
62
|
+
ariaLabel?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface IFeedComment {
|
|
66
|
+
id?: string;
|
|
67
|
+
authorName: string;
|
|
68
|
+
authorAvatarUrl?: string;
|
|
69
|
+
content: string;
|
|
70
|
+
timestamp?: string;
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
All properties are optional except `IFeedEvent.title` and `IFeedComment.{authorName, content}`. The default `FeedStandardComponent` consumes every property; a section is rendered only when its template/string is provided. Within an event, `iconTpl` takes precedence over `avatarUrl` when both are set. `variant` is a hint for custom implementations registered via the token.
|
|
75
|
+
|
|
76
|
+
## FEED_STANDARD_COMPONENT_TOKEN
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { FEED_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
InjectionToken that allows replacing the default `FeedStandardComponent` with a custom implementation. Provide a `Type<FeedBaseComponent>` to override.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
providers: [
|
|
86
|
+
{ provide: FEED_STANDARD_COMPONENT_TOKEN, useValue: MyCustomFeedComponent },
|
|
87
|
+
];
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Extending the Base Class
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import {
|
|
94
|
+
ChangeDetectionStrategy,
|
|
95
|
+
Component,
|
|
96
|
+
computed,
|
|
97
|
+
input,
|
|
98
|
+
ViewEncapsulation,
|
|
99
|
+
} from '@angular/core';
|
|
100
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
101
|
+
|
|
102
|
+
import { FeedBaseComponent } from '@smartsoft001/angular';
|
|
103
|
+
|
|
104
|
+
@Component({
|
|
105
|
+
selector: 'my-custom-feed',
|
|
106
|
+
template: `
|
|
107
|
+
<div [class]="containerClasses()">
|
|
108
|
+
@if (options()?.title) {
|
|
109
|
+
<h3>{{ options()!.title }}</h3>
|
|
110
|
+
}
|
|
111
|
+
<ol>
|
|
112
|
+
@for (e of options()?.events ?? []; track e.id ?? $index) {
|
|
113
|
+
<li>
|
|
114
|
+
@if (e.timestamp) {
|
|
115
|
+
<time>{{ e.timestamp }}</time>
|
|
116
|
+
}
|
|
117
|
+
<span>{{ e.title }}</span>
|
|
118
|
+
</li>
|
|
119
|
+
}
|
|
120
|
+
</ol>
|
|
121
|
+
</div>
|
|
122
|
+
`,
|
|
123
|
+
imports: [NgTemplateOutlet],
|
|
124
|
+
encapsulation: ViewEncapsulation.None,
|
|
125
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
126
|
+
})
|
|
127
|
+
export class MyCustomFeedComponent extends FeedBaseComponent {
|
|
128
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
129
|
+
override cssClass = input<string>('');
|
|
130
|
+
|
|
131
|
+
containerClasses = computed(() => {
|
|
132
|
+
const classes = ['my-feed'];
|
|
133
|
+
const extra = this.cssClass();
|
|
134
|
+
if (extra) classes.push(extra);
|
|
135
|
+
return classes.join(' ');
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Usage Examples
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<!-- Simple timeline with icons -->
|
|
144
|
+
<ng-template #applyIcon>
|
|
145
|
+
<svg class="apply-icon"></svg>
|
|
146
|
+
</ng-template>
|
|
147
|
+
|
|
148
|
+
<smart-feed
|
|
149
|
+
[options]="{
|
|
150
|
+
title: 'Application activity',
|
|
151
|
+
events: [
|
|
152
|
+
{ title: 'Applied to Front End Developer', timestamp: 'Sep 20', iconTpl: applyIcon },
|
|
153
|
+
{ title: 'Advanced to phone screening', timestamp: 'Sep 22' },
|
|
154
|
+
{ title: 'Completed phone screening', timestamp: 'Sep 28' },
|
|
155
|
+
],
|
|
156
|
+
}"
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
<!-- With comments -->
|
|
160
|
+
<smart-feed
|
|
161
|
+
[options]="{
|
|
162
|
+
events: [
|
|
163
|
+
{
|
|
164
|
+
title: 'Discussion',
|
|
165
|
+
timestamp: '3d ago',
|
|
166
|
+
comments: [
|
|
167
|
+
{ authorName: 'Lindsay', content: 'Looks good to me' },
|
|
168
|
+
{ authorName: 'Tom', authorAvatarUrl: '/img/tom.jpg', content: 'Approved', timestamp: '1d ago' },
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
}"
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<!-- With comment-submit slot and footer -->
|
|
176
|
+
<ng-template #commentForm>
|
|
177
|
+
<form>
|
|
178
|
+
<textarea placeholder="Add your comment..."></textarea
|
|
179
|
+
><button type="submit">Comment</button>
|
|
180
|
+
</form>
|
|
181
|
+
</ng-template>
|
|
182
|
+
<ng-template #footer><a href="#">Load more →</a></ng-template>
|
|
183
|
+
|
|
184
|
+
<smart-feed
|
|
185
|
+
[options]="{
|
|
186
|
+
events: [{ title: 'Created invoice', timestamp: '7d ago' }],
|
|
187
|
+
commentSubmitTpl: commentForm,
|
|
188
|
+
footerTpl: footer,
|
|
189
|
+
}"
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## File Locations
|
|
194
|
+
|
|
195
|
+
- Wrapper: `packages/shared/angular/src/lib/components/feed/feed.component.ts`
|
|
196
|
+
- Standard: `packages/shared/angular/src/lib/components/feed/standard/standard.component.ts`
|
|
197
|
+
- Base class: `packages/shared/angular/src/lib/components/feed/base/base.component.ts`
|
|
198
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`FEED_STANDARD_COMPONENT_TOKEN`)
|
|
199
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IFeedOptions`, `IFeedEvent`, `IFeedComment`, `SmartFeedVariant`)
|