@smartsoft001/claude-plugins 2.118.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,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-navbar
|
|
3
|
+
description: Navbar component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Navbar Component
|
|
8
|
+
|
|
9
|
+
The `<smart-navbar>` component renders a top navigation bar with a logo, primary nav items, optional secondary row, search, action, notification and user-menu slots, plus a mobile menu toggle. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `NavbarBaseComponent` defines the shared API — `options` (`INavbarOptions`), `cssClass` (alias `class`), `mobileMenuOpen` (two-way `ModelSignal<boolean>`), and the `itemClick` output. `NavbarStandardComponent` is a barebones placeholder using native `<nav>`, `<a>`, `<button>`, `<ul>` and `<li>` elements. `NavbarComponent` is the public wrapper that renders `NavbarStandardComponent` by default and accepts a custom replacement via `NAVBAR_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the navbar component
|
|
14
|
+
- Developer asks about `<smart-navbar>`, `NavbarComponent`, `NavbarStandardComponent`, or `NavbarBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### NavbarComponent (`<smart-navbar>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper. Delegates to `NavbarStandardComponent` by default. When `NAVBAR_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Re-emits `itemClick` and forwards two-way `mobileMenuOpen`.
|
|
21
|
+
|
|
22
|
+
### NavbarStandardComponent (`<smart-navbar-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="navbar">` containing a mobile menu toggle button, optional logo (`logoTpl` or `<img>` from `logoUrl`/`logoAlt`, wrapped in `<a>` when `logoHref` provided), a primary `<ul>` of items (each rendered as `<a class="item-link">` when `href` is provided, otherwise `<button class="item-button">` emitting `itemClick`; gets `current` class when `item.current === true`), and template-ref slots `searchTpl` / `actionTpl` / `notificationTpl` / `userMenuTpl`. Optionally renders a `<nav class="navbar-secondary">` row when `options.secondaryItems` is non-empty, and a `.mobile-menu` panel when `mobileMenuOpen()` is `true`.
|
|
25
|
+
|
|
26
|
+
### NavbarBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive. Exposes:
|
|
29
|
+
|
|
30
|
+
- `options: InputSignal<INavbarOptions | undefined>`
|
|
31
|
+
- `cssClass: InputSignal<string>` (alias `class`)
|
|
32
|
+
- `mobileMenuOpen: ModelSignal<boolean>` (default `false`)
|
|
33
|
+
- `itemClick: OutputEmitterRef<INavbarItemClick>`
|
|
34
|
+
|
|
35
|
+
`INavbarItemClick = { itemId: string }`.
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Inputs
|
|
40
|
+
|
|
41
|
+
| Input | Type | Default | Description |
|
|
42
|
+
| ---------------- | ------------------------------------------ | ------- | ------------------------------------------- |
|
|
43
|
+
| `options` | `InputSignal<INavbarOptions \| undefined>` | - | Navbar configuration |
|
|
44
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
45
|
+
| `mobileMenuOpen` | `ModelSignal<boolean>` | `false` | Two-way bindable mobile menu open state |
|
|
46
|
+
|
|
47
|
+
### Outputs
|
|
48
|
+
|
|
49
|
+
| Output | Type | Description |
|
|
50
|
+
| ----------- | ------------------------------------ | ---------------------------------------------- |
|
|
51
|
+
| `itemClick` | `OutputEmitterRef<INavbarItemClick>` | Emitted when a button-type nav item is clicked |
|
|
52
|
+
|
|
53
|
+
### INavbarOptions
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
type SmartNavbarLayout =
|
|
57
|
+
| 'simple'
|
|
58
|
+
| 'simple-with-menu-on-left'
|
|
59
|
+
| 'with-quick-action'
|
|
60
|
+
| 'with-search'
|
|
61
|
+
| 'with-centered-search'
|
|
62
|
+
| 'with-secondary-links'
|
|
63
|
+
| 'with-column-layout';
|
|
64
|
+
|
|
65
|
+
interface INavbarOptions {
|
|
66
|
+
layout?: SmartNavbarLayout;
|
|
67
|
+
dark?: boolean;
|
|
68
|
+
menuButtonOnLeft?: boolean;
|
|
69
|
+
logoTpl?: TemplateRef<unknown>;
|
|
70
|
+
logoUrl?: string;
|
|
71
|
+
logoAlt?: string;
|
|
72
|
+
logoHref?: string;
|
|
73
|
+
items?: INavbarItem[];
|
|
74
|
+
secondaryItems?: INavbarItem[];
|
|
75
|
+
searchTpl?: TemplateRef<unknown>;
|
|
76
|
+
actionTpl?: TemplateRef<unknown>;
|
|
77
|
+
notificationTpl?: TemplateRef<unknown>;
|
|
78
|
+
userMenuTpl?: TemplateRef<unknown>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface INavbarItem {
|
|
82
|
+
id: string;
|
|
83
|
+
label?: string;
|
|
84
|
+
href?: string;
|
|
85
|
+
current?: boolean;
|
|
86
|
+
iconTpl?: TemplateRef<unknown>;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## NAVBAR_STANDARD_COMPONENT_TOKEN
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { NAVBAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
94
|
+
|
|
95
|
+
providers: [
|
|
96
|
+
{
|
|
97
|
+
provide: NAVBAR_STANDARD_COMPONENT_TOKEN,
|
|
98
|
+
useValue: MyCustomNavbarComponent,
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Extending the Base Class
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import {
|
|
107
|
+
ChangeDetectionStrategy,
|
|
108
|
+
Component,
|
|
109
|
+
input,
|
|
110
|
+
ViewEncapsulation,
|
|
111
|
+
} from '@angular/core';
|
|
112
|
+
|
|
113
|
+
import { NavbarBaseComponent } from '@smartsoft001/angular';
|
|
114
|
+
|
|
115
|
+
@Component({
|
|
116
|
+
selector: 'my-custom-navbar',
|
|
117
|
+
template: `
|
|
118
|
+
<nav>
|
|
119
|
+
@for (item of options()?.items ?? []; track item.id) {
|
|
120
|
+
@if (item.href) {
|
|
121
|
+
<a [href]="item.href">{{ item.label }}</a>
|
|
122
|
+
} @else {
|
|
123
|
+
<button (click)="itemClick.emit({ itemId: item.id })">
|
|
124
|
+
{{ item.label }}
|
|
125
|
+
</button>
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
</nav>
|
|
129
|
+
`,
|
|
130
|
+
encapsulation: ViewEncapsulation.None,
|
|
131
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
132
|
+
})
|
|
133
|
+
export class MyCustomNavbarComponent extends NavbarBaseComponent {
|
|
134
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
135
|
+
override cssClass = input<string>('');
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Usage Examples
|
|
140
|
+
|
|
141
|
+
```html
|
|
142
|
+
<!-- Simple navbar -->
|
|
143
|
+
<smart-navbar
|
|
144
|
+
[options]="{
|
|
145
|
+
logoUrl: '/logo.svg',
|
|
146
|
+
logoAlt: 'Acme',
|
|
147
|
+
logoHref: '/',
|
|
148
|
+
items: [
|
|
149
|
+
{ id: 'dashboard', label: 'Dashboard', href: '/', current: true },
|
|
150
|
+
{ id: 'team', label: 'Team', href: '/team' },
|
|
151
|
+
{ id: 'projects', label: 'Projects', href: '/projects' },
|
|
152
|
+
],
|
|
153
|
+
}"
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
<!-- With search and user menu slots -->
|
|
157
|
+
<ng-template #search>
|
|
158
|
+
<input type="search" placeholder="Search" />
|
|
159
|
+
</ng-template>
|
|
160
|
+
<ng-template #userMenu>
|
|
161
|
+
<button class="user-avatar">…</button>
|
|
162
|
+
</ng-template>
|
|
163
|
+
|
|
164
|
+
<smart-navbar
|
|
165
|
+
[options]="{
|
|
166
|
+
layout: 'with-search',
|
|
167
|
+
items: items,
|
|
168
|
+
searchTpl: search,
|
|
169
|
+
userMenuTpl: userMenu,
|
|
170
|
+
}"
|
|
171
|
+
(itemClick)="onItem($event)"
|
|
172
|
+
/>
|
|
173
|
+
|
|
174
|
+
<!-- Dark with secondary links and two-way mobile menu -->
|
|
175
|
+
<smart-navbar
|
|
176
|
+
[(mobileMenuOpen)]="open"
|
|
177
|
+
[options]="{
|
|
178
|
+
dark: true,
|
|
179
|
+
layout: 'with-secondary-links',
|
|
180
|
+
items: primary,
|
|
181
|
+
secondaryItems: secondary,
|
|
182
|
+
}"
|
|
183
|
+
/>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## File Locations
|
|
187
|
+
|
|
188
|
+
- Wrapper: `packages/shared/angular/src/lib/components/navbar/navbar.component.ts`
|
|
189
|
+
- Standard: `packages/shared/angular/src/lib/components/navbar/standard/standard.component.ts`
|
|
190
|
+
- Base class: `packages/shared/angular/src/lib/components/navbar/base/base.component.ts`
|
|
191
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`NAVBAR_STANDARD_COMPONENT_TOKEN`)
|
|
192
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`INavbarOptions`, `INavbarItem`, `SmartNavbarLayout`)
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-page
|
|
3
|
+
description: Page component API with map-based variant dispatch and TemplateRef slots.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Page Component
|
|
8
|
+
|
|
9
|
+
The `<smart-page>` component provides a flexible page-header/layout wrapper with a map-based variant dispatch mechanism. It renders a default `PageStandardComponent` which can be extended with additional variants via `PAGE_VARIANT_COMPONENTS_TOKEN`. Projection is driven by `TemplateRef` slots declared on `IPageOptions`, plus a default `<ng-content>` fallback for the body.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the page component
|
|
14
|
+
- Developer asks about `<smart-page>` or `PageComponent`
|
|
15
|
+
- Developer needs to add named slots (breadcrumbs, meta, avatar, etc.) to a page layout
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### PageComponent (`<smart-page>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper component. Always renders via `NgComponentOutlet`. Looks up the target variant component from a merged map of `baseMap` + the optional `PAGE_VARIANT_COMPONENTS_TOKEN` map, keyed by `options.variant` (default `'standard'`). Falls back to `PageStandardComponent` when the variant is unknown. Captures `<ng-content>` into a `TemplateRef` and passes it to the target component as `options.bodyTpl` unless the caller provided an explicit `bodyTpl`.
|
|
22
|
+
|
|
23
|
+
### PageStandardComponent (`<smart-page-standard>`)
|
|
24
|
+
|
|
25
|
+
Default concrete implementation and the value for `baseMap['standard']`. Renders a Tailwind-styled header with title, optional back button, optional search input, `endButtons` via `<smart-button>`, and a body section driven by `options.bodyTpl`.
|
|
26
|
+
|
|
27
|
+
### PageBaseComponent (abstract)
|
|
28
|
+
|
|
29
|
+
Abstract base directive for extending custom page variants. Exposes `options`, `cssClass`, `back()`, `isMobile`, and a `contentTpl` view child for variants that need to re-project the main content.
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### Inputs
|
|
34
|
+
|
|
35
|
+
| Input | Type | Default | Description |
|
|
36
|
+
| --------- | --------------------------------- | ------- | ------------------------------------------- |
|
|
37
|
+
| `options` | `InputSignal<IPageOptions\|null>` | - | Page configuration (see `IPageOptions`) |
|
|
38
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
39
|
+
|
|
40
|
+
### SmartPageVariant
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
export type SmartPageVariant = 'standard' | (string & {});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Variant identifier used to select a concrete page component from the merged variant map. The intersection with `(string & {})` keeps `'standard'` as a suggested literal while allowing arbitrary custom keys.
|
|
47
|
+
|
|
48
|
+
### IPageOptions
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
interface IPageOptions {
|
|
52
|
+
title: string;
|
|
53
|
+
hideHeader?: boolean;
|
|
54
|
+
hideMenuButton?: boolean;
|
|
55
|
+
showBackButton?: boolean;
|
|
56
|
+
endButtons?: Array<IIconButtonOptions>;
|
|
57
|
+
search?: { text: Signal<string>; set: (txt: string) => void };
|
|
58
|
+
variant?: SmartPageVariant;
|
|
59
|
+
bodyTpl?: TemplateRef<unknown>;
|
|
60
|
+
breadcrumbsTpl?: TemplateRef<unknown>;
|
|
61
|
+
metaTpl?: TemplateRef<unknown>;
|
|
62
|
+
avatarTpl?: TemplateRef<unknown>;
|
|
63
|
+
bannerTpl?: TemplateRef<unknown>;
|
|
64
|
+
filtersTpl?: TemplateRef<unknown>;
|
|
65
|
+
logoTpl?: TemplateRef<unknown>;
|
|
66
|
+
statsTpl?: TemplateRef<unknown>;
|
|
67
|
+
subtitleTpl?: TemplateRef<unknown>;
|
|
68
|
+
navTpl?: TemplateRef<unknown>;
|
|
69
|
+
sidebarTpl?: TemplateRef<unknown>;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
| Field | Type | Description |
|
|
74
|
+
| ---------------- | ------------------------------------ | --------------------------------------------------------------------------- |
|
|
75
|
+
| `title` | `string` | Required. Page title (translated). |
|
|
76
|
+
| `hideHeader` | `boolean` | Hide the entire header block. |
|
|
77
|
+
| `hideMenuButton` | `boolean` | Reserved for layouts with a menu button. |
|
|
78
|
+
| `showBackButton` | `boolean` | Render a back arrow that calls `Location.back()`. |
|
|
79
|
+
| `endButtons` | `Array<IIconButtonOptions>` | Action buttons rendered via `<smart-button>`. |
|
|
80
|
+
| `search` | `{ text: Signal<string>; set: ... }` | Inline search input. |
|
|
81
|
+
| `variant` | `SmartPageVariant` | Selects which variant component to render. Defaults to `'standard'`. |
|
|
82
|
+
| `bodyTpl` | `TemplateRef<unknown>` | Explicit body template. Falls back to projected `<ng-content>` when absent. |
|
|
83
|
+
| `breadcrumbsTpl` | `TemplateRef<unknown>` | Breadcrumbs slot. |
|
|
84
|
+
| `metaTpl` | `TemplateRef<unknown>` | Meta slot (status, timestamps, etc.). |
|
|
85
|
+
| `avatarTpl` | `TemplateRef<unknown>` | Avatar slot. |
|
|
86
|
+
| `bannerTpl` | `TemplateRef<unknown>` | Banner slot. |
|
|
87
|
+
| `filtersTpl` | `TemplateRef<unknown>` | Filters slot. |
|
|
88
|
+
| `logoTpl` | `TemplateRef<unknown>` | Logo slot. |
|
|
89
|
+
| `statsTpl` | `TemplateRef<unknown>` | Stats slot. |
|
|
90
|
+
| `subtitleTpl` | `TemplateRef<unknown>` | Subtitle slot. |
|
|
91
|
+
| `navTpl` | `TemplateRef<unknown>` | Navigation slot. |
|
|
92
|
+
| `sidebarTpl` | `TemplateRef<unknown>` | Sidebar slot. |
|
|
93
|
+
|
|
94
|
+
### IIconButtonOptions (relevant fields)
|
|
95
|
+
|
|
96
|
+
| Field | Type | Description |
|
|
97
|
+
| ----------- | --------------------- | --------------------------------- |
|
|
98
|
+
| `icon` | `string` | Icon name (tracked by the `@for`) |
|
|
99
|
+
| `text` | `string` | Button label (translated) |
|
|
100
|
+
| `number` | `number` | Optional badge counter |
|
|
101
|
+
| `handler` | `() => void` | Click handler |
|
|
102
|
+
| `disabled$` | `Observable<boolean>` | Optional disabled stream |
|
|
103
|
+
|
|
104
|
+
### PAGE_VARIANT_COMPONENTS_TOKEN
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { PAGE_VARIANT_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
InjectionToken of type `Partial<Record<SmartPageVariant, Type<PageBaseComponent>>>`. Provide a map to register additional variants. The map is merged on top of `baseMap` (which contains the default `{ standard: PageStandardComponent }`), so you can both add new variants and override `'standard'`.
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// In your app providers:
|
|
114
|
+
providers: [
|
|
115
|
+
{
|
|
116
|
+
provide: PAGE_VARIANT_COMPONENTS_TOKEN,
|
|
117
|
+
useValue: {
|
|
118
|
+
'product-detail': MyProductDetailPageComponent,
|
|
119
|
+
analytics: MyAnalyticsPageComponent,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Extending the Base Class
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { Component, ViewEncapsulation, input } from '@angular/core';
|
|
129
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
130
|
+
import { PageBaseComponent } from '@smartsoft001/angular';
|
|
131
|
+
|
|
132
|
+
@Component({
|
|
133
|
+
selector: 'my-custom-page',
|
|
134
|
+
template: `
|
|
135
|
+
<header>
|
|
136
|
+
<h1>{{ options()?.title }}</h1>
|
|
137
|
+
@if (options()?.breadcrumbsTpl; as tpl) {
|
|
138
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
139
|
+
}
|
|
140
|
+
</header>
|
|
141
|
+
<section>
|
|
142
|
+
@if (options()?.bodyTpl; as tpl) {
|
|
143
|
+
<ng-container [ngTemplateOutlet]="tpl" />
|
|
144
|
+
}
|
|
145
|
+
</section>
|
|
146
|
+
`,
|
|
147
|
+
imports: [NgTemplateOutlet],
|
|
148
|
+
encapsulation: ViewEncapsulation.None,
|
|
149
|
+
})
|
|
150
|
+
export class MyCustomPageComponent extends PageBaseComponent {
|
|
151
|
+
// NgComponentOutlet passes 'cssClass' (not aliased 'class') so declare it explicitly
|
|
152
|
+
override cssClass = input<string>('');
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Usage Examples
|
|
157
|
+
|
|
158
|
+
### Simple: body via `<ng-content>`
|
|
159
|
+
|
|
160
|
+
```html
|
|
161
|
+
<smart-page [options]="{ title: 'Dashboard' }">
|
|
162
|
+
<p>Dashboard content</p>
|
|
163
|
+
</smart-page>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### With back button
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<smart-page [options]="{ title: 'User details', showBackButton: true }">
|
|
170
|
+
<p>User details body</p>
|
|
171
|
+
</smart-page>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### With search + end buttons
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<smart-page
|
|
178
|
+
[options]="{
|
|
179
|
+
title: 'Users',
|
|
180
|
+
search: { text: searchText, set: onSearch },
|
|
181
|
+
endButtons: [{ icon: 'add', text: 'Add user', handler: onAdd }]
|
|
182
|
+
}"
|
|
183
|
+
>
|
|
184
|
+
<users-list />
|
|
185
|
+
</smart-page>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Advanced: variant + named slots
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<ng-template #breadcrumbs>
|
|
192
|
+
<nav>Home / Users / Alice</nav>
|
|
193
|
+
</ng-template>
|
|
194
|
+
<ng-template #body>
|
|
195
|
+
<user-detail [user]="user()" />
|
|
196
|
+
</ng-template>
|
|
197
|
+
|
|
198
|
+
<smart-page
|
|
199
|
+
[options]="{
|
|
200
|
+
title: 'Alice',
|
|
201
|
+
variant: 'product-detail',
|
|
202
|
+
breadcrumbsTpl: breadcrumbs,
|
|
203
|
+
bodyTpl: body,
|
|
204
|
+
}"
|
|
205
|
+
/>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Hidden header
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<smart-page [options]="{ title: 'Internal', hideHeader: true }">
|
|
212
|
+
<p>Body only</p>
|
|
213
|
+
</smart-page>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### External class
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<smart-page class="smart:mt-4" [options]="opts">
|
|
220
|
+
<p>Body</p>
|
|
221
|
+
</smart-page>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## File Locations
|
|
225
|
+
|
|
226
|
+
- Wrapper: `packages/shared/angular/src/lib/components/page/page.component.ts`
|
|
227
|
+
- Standard: `packages/shared/angular/src/lib/components/page/standard/standard.component.ts`
|
|
228
|
+
- Base class: `packages/shared/angular/src/lib/components/page/base/base.component.ts`
|
|
229
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`PAGE_VARIANT_COMPONENTS_TOKEN`)
|
|
230
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IPageOptions`, `SmartPageVariant`, `IIconButtonOptions`)
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-page-heading
|
|
3
|
+
description: Page heading component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Page Heading Component
|
|
8
|
+
|
|
9
|
+
The `<smart-page-heading>` component provides a composable page heading region with optional slots for breadcrumbs, banner image, avatar, logo, title, subtitle, meta, stats, actions, and filters. It is **independent of `<smart-page>`** and can be used standalone or inside any layout. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `PageHeadingBaseComponent` defines the shared API — optional `IPageHeadingOptions` and `cssClass` (alias `class`). `PageHeadingStandardComponent` is a barebones placeholder concrete implementation. `PageHeadingComponent` is the public wrapper that renders `PageHeadingStandardComponent` by default and accepts a custom replacement via `PAGE_HEADING_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the page heading component
|
|
14
|
+
- Developer asks about `<smart-page-heading>`, `PageHeadingComponent`, `PageHeadingStandardComponent`, or `PageHeadingBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### PageHeadingComponent (`<smart-page-heading>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `PageHeadingStandardComponent` by default. When `PAGE_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### PageHeadingStandardComponent (`<smart-page-heading-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Always renders a wrapper `<div>` and a `<header>`. Renders any of the optional slots (`breadcrumbsTpl`, `bannerTpl`, `avatarTpl`, `logoTpl`, `metaTpl`, `statsTpl`, `actionsTpl`, `filtersTpl`) only when provided. Renders `<h1>` with `options.title` and `<p class="subtitle">` with `options.subtitle` only when those strings are non-empty. The external `cssClass` is applied to the wrapper. 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
|
+
### PageHeadingBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom page-heading implementations. Exposes `options` as an `InputSignal<IPageHeadingOptions | 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<IPageHeadingOptions \| undefined>` | - | Optional configuration (title, subtitle, slot templates) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### IPageHeadingOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface IPageHeadingOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
subtitle?: string;
|
|
45
|
+
breadcrumbsTpl?: TemplateRef<unknown>;
|
|
46
|
+
metaTpl?: TemplateRef<unknown>;
|
|
47
|
+
avatarTpl?: TemplateRef<unknown>;
|
|
48
|
+
bannerTpl?: TemplateRef<unknown>;
|
|
49
|
+
actionsTpl?: TemplateRef<unknown>;
|
|
50
|
+
statsTpl?: TemplateRef<unknown>;
|
|
51
|
+
logoTpl?: TemplateRef<unknown>;
|
|
52
|
+
filtersTpl?: TemplateRef<unknown>;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
All properties are optional. The default `PageHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
57
|
+
|
|
58
|
+
## PAGE_HEADING_STANDARD_COMPONENT_TOKEN
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { PAGE_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
InjectionToken that allows replacing the default `PageHeadingStandardComponent` with a custom implementation. Provide a `Type<PageHeadingBaseComponent>` to override.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
providers: [
|
|
68
|
+
{
|
|
69
|
+
provide: PAGE_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
70
|
+
useValue: MyCustomPageHeadingComponent,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Extending the Base Class
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import {
|
|
79
|
+
ChangeDetectionStrategy,
|
|
80
|
+
Component,
|
|
81
|
+
computed,
|
|
82
|
+
input,
|
|
83
|
+
ViewEncapsulation,
|
|
84
|
+
} from '@angular/core';
|
|
85
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
86
|
+
|
|
87
|
+
import { PageHeadingBaseComponent } from '@smartsoft001/angular';
|
|
88
|
+
|
|
89
|
+
@Component({
|
|
90
|
+
selector: 'my-custom-page-heading',
|
|
91
|
+
template: `
|
|
92
|
+
<div [class]="containerClasses()">
|
|
93
|
+
@if (options()?.breadcrumbsTpl) {
|
|
94
|
+
<nav>
|
|
95
|
+
<ng-container [ngTemplateOutlet]="options()!.breadcrumbsTpl!" />
|
|
96
|
+
</nav>
|
|
97
|
+
}
|
|
98
|
+
<header>
|
|
99
|
+
@if (options()?.title) {
|
|
100
|
+
<h1>{{ options()!.title }}</h1>
|
|
101
|
+
}
|
|
102
|
+
@if (options()?.actionsTpl) {
|
|
103
|
+
<div class="actions">
|
|
104
|
+
<ng-container [ngTemplateOutlet]="options()!.actionsTpl!" />
|
|
105
|
+
</div>
|
|
106
|
+
}
|
|
107
|
+
</header>
|
|
108
|
+
</div>
|
|
109
|
+
`,
|
|
110
|
+
imports: [NgTemplateOutlet],
|
|
111
|
+
encapsulation: ViewEncapsulation.None,
|
|
112
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
113
|
+
})
|
|
114
|
+
export class MyCustomPageHeadingComponent extends PageHeadingBaseComponent {
|
|
115
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
116
|
+
override cssClass = input<string>('');
|
|
117
|
+
|
|
118
|
+
containerClasses = computed(() => {
|
|
119
|
+
const classes = ['my-page-heading'];
|
|
120
|
+
const extra = this.cssClass();
|
|
121
|
+
if (extra) classes.push(extra);
|
|
122
|
+
return classes.join(' ');
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Usage Examples
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<!-- Title only -->
|
|
131
|
+
<smart-page-heading [options]="{ title: 'Back End Developer' }" />
|
|
132
|
+
|
|
133
|
+
<!-- With actions -->
|
|
134
|
+
<ng-template #actions>
|
|
135
|
+
<button>Edit</button>
|
|
136
|
+
<button>Publish</button>
|
|
137
|
+
</ng-template>
|
|
138
|
+
|
|
139
|
+
<smart-page-heading
|
|
140
|
+
[options]="{ title: 'Back End Developer', actionsTpl: actions }"
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<!-- With breadcrumbs and meta -->
|
|
144
|
+
<ng-template #crumbs>
|
|
145
|
+
<a routerLink="/jobs">Jobs</a> / <span>Back End Developer</span>
|
|
146
|
+
</ng-template>
|
|
147
|
+
|
|
148
|
+
<ng-template #meta> <span>Full-time</span> · <span>Remote</span> </ng-template>
|
|
149
|
+
|
|
150
|
+
<smart-page-heading
|
|
151
|
+
[options]="{
|
|
152
|
+
title: 'Back End Developer',
|
|
153
|
+
breadcrumbsTpl: crumbs,
|
|
154
|
+
metaTpl: meta,
|
|
155
|
+
}"
|
|
156
|
+
/>
|
|
157
|
+
|
|
158
|
+
<!-- With banner image and avatar -->
|
|
159
|
+
<ng-template #banner>
|
|
160
|
+
<img src="banner.jpg" alt="" />
|
|
161
|
+
</ng-template>
|
|
162
|
+
|
|
163
|
+
<ng-template #avatar>
|
|
164
|
+
<img src="avatar.jpg" alt="" />
|
|
165
|
+
</ng-template>
|
|
166
|
+
|
|
167
|
+
<smart-page-heading
|
|
168
|
+
[options]="{
|
|
169
|
+
title: 'Ricardo Cooper',
|
|
170
|
+
subtitle: 'Engineering',
|
|
171
|
+
bannerTpl: banner,
|
|
172
|
+
avatarTpl: avatar,
|
|
173
|
+
}"
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## File Locations
|
|
178
|
+
|
|
179
|
+
- Wrapper: `packages/shared/angular/src/lib/components/page-heading/page-heading.component.ts`
|
|
180
|
+
- Standard: `packages/shared/angular/src/lib/components/page-heading/standard/standard.component.ts`
|
|
181
|
+
- Base class: `packages/shared/angular/src/lib/components/page-heading/base/base.component.ts`
|
|
182
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`PAGE_HEADING_STANDARD_COMPONENT_TOKEN`)
|
|
183
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IPageHeadingOptions`)
|