@amedia/brick-mcp 0.1.3 → 0.1.4
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/README.md +50 -1
- package/data/components/brick-mcp.md +259 -0
- package/data/components/brick-pill.md +362 -0
- package/data/components/brick-player.md +331 -0
- package/data/components/brick-published.md +219 -0
- package/data/components/brick-share.md +335 -0
- package/data/components/brick-stepper.md +319 -0
- package/data/components/brick-tab.md +241 -0
- package/data/components/brick-tabs.md +420 -0
- package/data/components/brick-tag.md +335 -0
- package/data/components/brick-teaser-player.md +248 -0
- package/data/components/brick-teaser-reels.md +190 -0
- package/data/components/brick-teaser.md +262 -0
- package/data/components/brick-template.md +226 -0
- package/data/components/brick-textarea.md +191 -0
- package/data/components/brick-themes.md +104 -0
- package/data/components/brick-toast.md +271 -0
- package/data/components/brick-toggle.md +268 -0
- package/data/components/brick-tokens.md +287 -0
- package/data/components/brick-tooltip.md +249 -0
- package/data/components-metadata.json +34 -34
- package/data/tokens.json +0 -7
- package/dist/data/components/brick-mcp.md +259 -0
- package/dist/data/components/brick-pill.md +362 -0
- package/dist/data/components/brick-player.md +331 -0
- package/dist/data/components/brick-published.md +219 -0
- package/dist/data/components/brick-share.md +335 -0
- package/dist/data/components/brick-stepper.md +319 -0
- package/dist/data/components/brick-tab.md +241 -0
- package/dist/data/components/brick-tabs.md +420 -0
- package/dist/data/components/brick-tag.md +335 -0
- package/dist/data/components/brick-teaser-player.md +248 -0
- package/dist/data/components/brick-teaser-reels.md +190 -0
- package/dist/data/components/brick-teaser.md +262 -0
- package/dist/data/components/brick-template.md +226 -0
- package/dist/data/components/brick-textarea.md +191 -0
- package/dist/data/components/brick-themes.md +104 -0
- package/dist/data/components/brick-toast.md +271 -0
- package/dist/data/components/brick-toggle.md +268 -0
- package/dist/data/components/brick-tokens.md +287 -0
- package/dist/data/components/brick-tooltip.md +249 -0
- package/dist/data/components-metadata.json +34 -34
- package/dist/data/tokens.json +0 -7
- package/package.json +37 -37
- package/data/components/brick-mcp.json +0 -6
- package/data/components/brick-pill.json +0 -6
- package/data/components/brick-player.json +0 -7
- package/data/components/brick-published.json +0 -7
- package/data/components/brick-share.json +0 -7
- package/data/components/brick-stepper.json +0 -7
- package/data/components/brick-tab.json +0 -7
- package/data/components/brick-tabs.json +0 -9
- package/data/components/brick-tag.json +0 -7
- package/data/components/brick-teaser-player.json +0 -9
- package/data/components/brick-teaser-reels.json +0 -9
- package/data/components/brick-teaser.json +0 -9
- package/data/components/brick-template.json +0 -9
- package/data/components/brick-textarea.json +0 -7
- package/data/components/brick-themes.json +0 -6
- package/data/components/brick-toast.json +0 -9
- package/data/components/brick-toggle.json +0 -7
- package/data/components/brick-tokens.json +0 -8
- package/data/components/brick-tooltip.json +0 -7
- package/dist/data/components/brick-mcp.json +0 -6
- package/dist/data/components/brick-pill.json +0 -6
- package/dist/data/components/brick-player.json +0 -7
- package/dist/data/components/brick-published.json +0 -7
- package/dist/data/components/brick-share.json +0 -7
- package/dist/data/components/brick-stepper.json +0 -7
- package/dist/data/components/brick-tab.json +0 -7
- package/dist/data/components/brick-tabs.json +0 -9
- package/dist/data/components/brick-tag.json +0 -7
- package/dist/data/components/brick-teaser-player.json +0 -9
- package/dist/data/components/brick-teaser-reels.json +0 -9
- package/dist/data/components/brick-teaser.json +0 -9
- package/dist/data/components/brick-template.json +0 -9
- package/dist/data/components/brick-textarea.json +0 -7
- package/dist/data/components/brick-themes.json +0 -6
- package/dist/data/components/brick-toast.json +0 -9
- package/dist/data/components/brick-toggle.json +0 -7
- package/dist/data/components/brick-tokens.json +0 -8
- package/dist/data/components/brick-tooltip.json +0 -7
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-teaser-reels
|
|
3
|
+
version: 0.4.5
|
|
4
|
+
selector: brick-teaser-reels-v0
|
|
5
|
+
category: Media
|
|
6
|
+
tags: [reels, video, teaser, stories, vertical-video, short-form]
|
|
7
|
+
use_cases: [vertical-videos, stories, reels, short-form-content, social-media-style]
|
|
8
|
+
related: [brick-image, brick-button, brick-tokens, brick-teaser-player]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Teaser Reels
|
|
12
|
+
|
|
13
|
+
A vertical video teaser component optimized for reels/stories-style content with poster image, video preview, and customizable aspect ratios.
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Vertical video format optimized for reels/stories
|
|
18
|
+
- Poster image display with brick-image
|
|
19
|
+
- Video source support
|
|
20
|
+
- Customizable aspect ratios
|
|
21
|
+
- Duration display
|
|
22
|
+
- Click-to-play functionality
|
|
23
|
+
- Event type tracking
|
|
24
|
+
- Responsive design
|
|
25
|
+
- Server-side rendering support
|
|
26
|
+
|
|
27
|
+
## Props/Attributes
|
|
28
|
+
|
|
29
|
+
| Attribute | Type | Default | Required | Description |
|
|
30
|
+
| ------------------- | ------ | ------- | -------- | -------------------------------------------------- |
|
|
31
|
+
| `data-title` | string | - | yes | Reel title |
|
|
32
|
+
| `data-url` | string | - | yes | Link URL for the reel |
|
|
33
|
+
| `data-image-src` | string | - | yes | Poster image URL |
|
|
34
|
+
| `data-video-src` | string | - | no | Video source URL for preview |
|
|
35
|
+
| `data-aspect-ratio` | string | `9:16` | no | Video aspect ratio (typically vertical for reels) |
|
|
36
|
+
| `data-duration` | string | - | no | Video duration in seconds |
|
|
37
|
+
| `data-event-type` | string | - | no | Event type for tracking/analytics |
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Basic Reel Teaser
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<brick-teaser-reels-v0
|
|
45
|
+
data-title="Breaking News Reel"
|
|
46
|
+
data-url="/reels/breaking-news"
|
|
47
|
+
data-image-src="https://example.com/poster.jpg"
|
|
48
|
+
data-aspect-ratio="9:16"
|
|
49
|
+
>
|
|
50
|
+
</brick-teaser-reels-v0>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### With Video Preview
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<brick-teaser-reels-v0
|
|
57
|
+
data-title="Sports Highlight"
|
|
58
|
+
data-url="/reels/sports-highlight"
|
|
59
|
+
data-image-src="https://example.com/sports-poster.jpg"
|
|
60
|
+
data-video-src="https://example.com/preview.mp4"
|
|
61
|
+
data-duration="30"
|
|
62
|
+
data-aspect-ratio="9:16"
|
|
63
|
+
>
|
|
64
|
+
</brick-teaser-reels-v0>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With Duration Display
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<brick-teaser-reels-v0
|
|
71
|
+
data-title="Quick Update"
|
|
72
|
+
data-url="/reels/quick-update"
|
|
73
|
+
data-image-src="https://example.com/update-poster.jpg"
|
|
74
|
+
data-duration="15"
|
|
75
|
+
data-aspect-ratio="9:16"
|
|
76
|
+
>
|
|
77
|
+
</brick-teaser-reels-v0>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### With Event Tracking
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<brick-teaser-reels-v0
|
|
84
|
+
data-title="Trending Topic"
|
|
85
|
+
data-url="/reels/trending"
|
|
86
|
+
data-image-src="https://example.com/trending-poster.jpg"
|
|
87
|
+
data-event-type="reel-click"
|
|
88
|
+
data-aspect-ratio="9:16"
|
|
89
|
+
>
|
|
90
|
+
</brick-teaser-reels-v0>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Server-Side Rendering
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
import { renderBrickTeaserPlayer } from '@amedia/brick-teaser-reels/template';
|
|
97
|
+
|
|
98
|
+
const html = renderBrickTeaserPlayer({
|
|
99
|
+
dataTitle: 'My Reel',
|
|
100
|
+
dataUrl: '/reels/my-reel',
|
|
101
|
+
dataImageSrc: 'https://example.com/poster.jpg',
|
|
102
|
+
dataVideoSrc: 'https://example.com/preview.mp4',
|
|
103
|
+
dataAspectRatio: '9:16',
|
|
104
|
+
dataDuration: '30',
|
|
105
|
+
dataEventType: 'reel-view',
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Common Patterns
|
|
110
|
+
|
|
111
|
+
### Reels Feed
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<div class="reels-feed">
|
|
115
|
+
<brick-teaser-reels-v0
|
|
116
|
+
data-title="Reel 1"
|
|
117
|
+
data-url="/reels/1"
|
|
118
|
+
data-image-src="https://example.com/reel1.jpg"
|
|
119
|
+
data-duration="15"
|
|
120
|
+
></brick-teaser-reels-v0>
|
|
121
|
+
|
|
122
|
+
<brick-teaser-reels-v0
|
|
123
|
+
data-title="Reel 2"
|
|
124
|
+
data-url="/reels/2"
|
|
125
|
+
data-image-src="https://example.com/reel2.jpg"
|
|
126
|
+
data-duration="20"
|
|
127
|
+
></brick-teaser-reels-v0>
|
|
128
|
+
|
|
129
|
+
<brick-teaser-reels-v0
|
|
130
|
+
data-title="Reel 3"
|
|
131
|
+
data-url="/reels/3"
|
|
132
|
+
data-image-src="https://example.com/reel3.jpg"
|
|
133
|
+
data-duration="25"
|
|
134
|
+
></brick-teaser-reels-v0>
|
|
135
|
+
</div>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Stories-Style Navigation
|
|
139
|
+
|
|
140
|
+
```html
|
|
141
|
+
<nav class="stories-container">
|
|
142
|
+
<brick-teaser-reels-v0
|
|
143
|
+
data-title="Story 1"
|
|
144
|
+
data-url="/stories/1"
|
|
145
|
+
data-image-src="https://example.com/story1.jpg"
|
|
146
|
+
data-aspect-ratio="9:16"
|
|
147
|
+
></brick-teaser-reels-v0>
|
|
148
|
+
|
|
149
|
+
<brick-teaser-reels-v0
|
|
150
|
+
data-title="Story 2"
|
|
151
|
+
data-url="/stories/2"
|
|
152
|
+
data-image-src="https://example.com/story2.jpg"
|
|
153
|
+
data-aspect-ratio="9:16"
|
|
154
|
+
></brick-teaser-reels-v0>
|
|
155
|
+
</nav>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Accessibility
|
|
159
|
+
|
|
160
|
+
- Semantic link elements for navigation
|
|
161
|
+
- Alt text for poster images
|
|
162
|
+
- Keyboard accessible
|
|
163
|
+
- Focus visible states
|
|
164
|
+
- ARIA labels for video duration
|
|
165
|
+
|
|
166
|
+
## Technical Details
|
|
167
|
+
|
|
168
|
+
- **Custom Element**: `brick-teaser-reels-v0`
|
|
169
|
+
- **Base Class**: BrickElement
|
|
170
|
+
- **Dependencies**:
|
|
171
|
+
- @amedia/brick-image (poster display)
|
|
172
|
+
- @amedia/brick-button (interaction)
|
|
173
|
+
- @amedia/brick-template (base class)
|
|
174
|
+
- @amedia/brick-tokens (design tokens)
|
|
175
|
+
- **Renders as**: Link wrapper with image and video preview
|
|
176
|
+
- **SSR Compatible**: Yes, with template function
|
|
177
|
+
|
|
178
|
+
## Important Notes
|
|
179
|
+
|
|
180
|
+
- Optimized for vertical (9:16) aspect ratio typical of reels/stories
|
|
181
|
+
- Poster image is required for initial display
|
|
182
|
+
- Video source is optional and used for preview/hover effects
|
|
183
|
+
- Duration is displayed as seconds
|
|
184
|
+
- The component is versioned as v0, indicating potential breaking changes
|
|
185
|
+
- Event type can be used for analytics tracking
|
|
186
|
+
- Integrates with brick-image for responsive poster display
|
|
187
|
+
|
|
188
|
+
## Version
|
|
189
|
+
|
|
190
|
+
Current version: 0.4.5
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-teaser
|
|
3
|
+
version: 21.2.1
|
|
4
|
+
selector: brick-teaser-v21
|
|
5
|
+
category: Data Display
|
|
6
|
+
tags: [teaser, card, article, content, preview, link, image, metadata]
|
|
7
|
+
use_cases: [article-listings, content-grids, news-feeds, content-previews, homepage, front-page]
|
|
8
|
+
related: [brick-image, brick-avatar, brick-countdown, brick-icon, brick-pill, brick-player, brick-button]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Teaser
|
|
12
|
+
|
|
13
|
+
A comprehensive content teaser/card component for displaying article previews with image, title, metadata, and various content types (story, feature, video, gallery, etc.).
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Multiple teaser types (story, feature, video, gallery, opinion, review, commercial, etc.)
|
|
18
|
+
- Responsive image display with brick-image
|
|
19
|
+
- Avatar support for authors/publications
|
|
20
|
+
- Countdown timer integration
|
|
21
|
+
- Premium content indicators (pill badges)
|
|
22
|
+
- Video player integration
|
|
23
|
+
- Breaking news styling
|
|
24
|
+
- Commercial/sponsored content support
|
|
25
|
+
- Analytics (ADP) integration
|
|
26
|
+
- Rich metadata display (author, date, publication)
|
|
27
|
+
- Multiple layout variations
|
|
28
|
+
- Accessibility-first design
|
|
29
|
+
- Server-side rendering support
|
|
30
|
+
- Custom elements manifest for tooling
|
|
31
|
+
|
|
32
|
+
## Teaser Types
|
|
33
|
+
|
|
34
|
+
The component supports multiple content types:
|
|
35
|
+
|
|
36
|
+
- **story**: Standard article teaser
|
|
37
|
+
- **feature**: Featured content
|
|
38
|
+
- **video**: Video content with player
|
|
39
|
+
- **gallery**: Photo gallery
|
|
40
|
+
- **opinion**: Opinion pieces
|
|
41
|
+
- **review**: Review articles
|
|
42
|
+
- **commercial**: Sponsored/commercial content
|
|
43
|
+
- **sport**: Sports content
|
|
44
|
+
- **alt**: Alternative layouts
|
|
45
|
+
- **untold**: Special content type
|
|
46
|
+
|
|
47
|
+
## Key Features
|
|
48
|
+
|
|
49
|
+
### Image Display
|
|
50
|
+
- Responsive images via brick-image
|
|
51
|
+
- Multiple aspect ratios support
|
|
52
|
+
- Lazy loading
|
|
53
|
+
- Poster images for video content
|
|
54
|
+
|
|
55
|
+
### Metadata
|
|
56
|
+
- Author information with avatars
|
|
57
|
+
- Publication branding
|
|
58
|
+
- Publish/update timestamps
|
|
59
|
+
- Premium indicators
|
|
60
|
+
- Breaking news badges
|
|
61
|
+
- Content category pills
|
|
62
|
+
|
|
63
|
+
### Interactive Elements
|
|
64
|
+
- Clickable teaser links
|
|
65
|
+
- Video player integration
|
|
66
|
+
- Countdown timers for live events
|
|
67
|
+
- Action buttons
|
|
68
|
+
|
|
69
|
+
### Analytics
|
|
70
|
+
- ADP tracking integration
|
|
71
|
+
- Content model tagging
|
|
72
|
+
- Teaser click tracking
|
|
73
|
+
- Custom event types
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
### Basic Article Teaser
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<brick-teaser-v21
|
|
81
|
+
data-type="story"
|
|
82
|
+
data-title="Breaking News Story"
|
|
83
|
+
data-url="/article/breaking-news"
|
|
84
|
+
data-image-src="https://example.com/image.jpg"
|
|
85
|
+
data-lead-text="This is the article lead text providing a brief summary..."
|
|
86
|
+
>
|
|
87
|
+
</brick-teaser-v21>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Video Teaser
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<brick-teaser-v21
|
|
94
|
+
data-type="video"
|
|
95
|
+
data-title="Watch: Amazing Video"
|
|
96
|
+
data-url="/video/amazing"
|
|
97
|
+
data-image-src="https://example.com/video-poster.jpg"
|
|
98
|
+
data-media-id="video-uuid-here"
|
|
99
|
+
data-duration="180"
|
|
100
|
+
>
|
|
101
|
+
</brick-teaser-v21>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Premium Content
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<brick-teaser-v21
|
|
108
|
+
data-type="story"
|
|
109
|
+
data-title="Premium Article"
|
|
110
|
+
data-url="/article/premium"
|
|
111
|
+
data-image-src="https://example.com/premium.jpg"
|
|
112
|
+
data-is-premium="true"
|
|
113
|
+
data-pill-version="premium"
|
|
114
|
+
>
|
|
115
|
+
</brick-teaser-v21>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### With Author Information
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<brick-teaser-v21
|
|
122
|
+
data-type="opinion"
|
|
123
|
+
data-title="Opinion: Important Topic"
|
|
124
|
+
data-url="/opinion/important-topic"
|
|
125
|
+
data-image-src="https://example.com/opinion.jpg"
|
|
126
|
+
data-author-name="John Doe"
|
|
127
|
+
data-author-avatar-url="https://example.com/author.jpg"
|
|
128
|
+
data-published-date="2026-01-08T12:00:00Z"
|
|
129
|
+
>
|
|
130
|
+
</brick-teaser-v21>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Gallery Teaser
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<brick-teaser-v21
|
|
137
|
+
data-type="gallery"
|
|
138
|
+
data-title="Photo Gallery: Event Coverage"
|
|
139
|
+
data-url="/gallery/event"
|
|
140
|
+
data-image-src="https://example.com/gallery-cover.jpg"
|
|
141
|
+
data-gallery-count="25"
|
|
142
|
+
>
|
|
143
|
+
</brick-teaser-v21>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Breaking News
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<brick-teaser-v21
|
|
150
|
+
data-type="story"
|
|
151
|
+
data-title="Breaking: Major Development"
|
|
152
|
+
data-url="/breaking/major-development"
|
|
153
|
+
data-image-src="https://example.com/breaking.jpg"
|
|
154
|
+
data-is-breaking="true"
|
|
155
|
+
data-breaking-skin="breaking"
|
|
156
|
+
>
|
|
157
|
+
</brick-teaser-v21>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Commercial/Sponsored
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<brick-teaser-v21
|
|
164
|
+
data-type="commercial"
|
|
165
|
+
data-title="Sponsored: Product Review"
|
|
166
|
+
data-url="/commercial/product-review"
|
|
167
|
+
data-image-src="https://example.com/commercial.jpg"
|
|
168
|
+
data-commercial-category="shopping"
|
|
169
|
+
>
|
|
170
|
+
</brick-teaser-v21>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Server-Side Rendering
|
|
174
|
+
|
|
175
|
+
```javascript
|
|
176
|
+
import { renderTeaser } from '@amedia/brick-teaser/template';
|
|
177
|
+
|
|
178
|
+
const html = renderTeaser({
|
|
179
|
+
teaserData: {
|
|
180
|
+
type: 'story',
|
|
181
|
+
title: 'Article Title',
|
|
182
|
+
url: '/article/slug',
|
|
183
|
+
image: {
|
|
184
|
+
src: 'https://example.com/image.jpg',
|
|
185
|
+
alt: 'Image description',
|
|
186
|
+
},
|
|
187
|
+
leadText: 'Article summary...',
|
|
188
|
+
author: {
|
|
189
|
+
name: 'Author Name',
|
|
190
|
+
avatarUrl: 'https://example.com/avatar.jpg',
|
|
191
|
+
},
|
|
192
|
+
publishedDate: '2026-01-08T12:00:00Z',
|
|
193
|
+
isPremium: false,
|
|
194
|
+
},
|
|
195
|
+
renderOptions: {
|
|
196
|
+
removeLogScope: false,
|
|
197
|
+
aoiBeta: false,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Analytics Integration
|
|
203
|
+
|
|
204
|
+
The component integrates with ADP (Amedia Data Platform):
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<brick-teaser-v21
|
|
208
|
+
data-type="story"
|
|
209
|
+
data-title="Tracked Article"
|
|
210
|
+
data-url="/article/tracked"
|
|
211
|
+
data-adp-type="teaser"
|
|
212
|
+
data-content-model="free"
|
|
213
|
+
data-identifier="5-8-123456"
|
|
214
|
+
>
|
|
215
|
+
</brick-teaser-v21>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Accessibility
|
|
219
|
+
|
|
220
|
+
- Semantic HTML with proper heading hierarchy
|
|
221
|
+
- ARIA labels for all interactive elements
|
|
222
|
+
- Alt text for images
|
|
223
|
+
- Keyboard navigation support
|
|
224
|
+
- Screen reader announcements
|
|
225
|
+
- Focus visible states
|
|
226
|
+
- Proper link semantics
|
|
227
|
+
|
|
228
|
+
## Technical Details
|
|
229
|
+
|
|
230
|
+
- **Custom Element**: `brick-teaser-v21`
|
|
231
|
+
- **Base Class**: BrickElement
|
|
232
|
+
- **Dependencies**:
|
|
233
|
+
- @amedia/brick-image (image display)
|
|
234
|
+
- @amedia/brick-avatar (author avatars)
|
|
235
|
+
- @amedia/brick-countdown (live event timers)
|
|
236
|
+
- @amedia/brick-icon (icons)
|
|
237
|
+
- @amedia/brick-pill (badges/indicators)
|
|
238
|
+
- @amedia/brick-player (video playback)
|
|
239
|
+
- @amedia/brick-button (actions)
|
|
240
|
+
- @amedia/brick-template (base class)
|
|
241
|
+
- @amedia/brick-tokens (design tokens)
|
|
242
|
+
- @amedia/brick-themes (theming)
|
|
243
|
+
- **Renders as**: Article/link wrapper with rich metadata
|
|
244
|
+
- **SSR Compatible**: Yes, with template function
|
|
245
|
+
- **Custom Elements Manifest**: Included for IDE/tooling support
|
|
246
|
+
|
|
247
|
+
## Important Notes
|
|
248
|
+
|
|
249
|
+
- Version 21.2.1 is the current stable version (mature component)
|
|
250
|
+
- Supports complex teaser configurations with many optional features
|
|
251
|
+
- Integrates deeply with Amedia's content management system (ACP)
|
|
252
|
+
- The component is highly configurable for different content types
|
|
253
|
+
- Breaking news, premium, and commercial content have special styling
|
|
254
|
+
- Video teasers can integrate brick-player for inline playback
|
|
255
|
+
- Gallery teasers show image count
|
|
256
|
+
- Countdown timers for live events
|
|
257
|
+
- The component generates custom-elements.json for IDE autocomplete
|
|
258
|
+
- Used extensively across Amedia publications for content display
|
|
259
|
+
|
|
260
|
+
## Version
|
|
261
|
+
|
|
262
|
+
Current version: 21.2.1
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-template
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
selector: N/A
|
|
5
|
+
category: Utilities
|
|
6
|
+
tags: [template, base-class, web-components, internal, foundation, boilerplate]
|
|
7
|
+
use_cases: [component-development, web-component-creation, brick-component-foundation]
|
|
8
|
+
related: [brick-tokens]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Template
|
|
12
|
+
|
|
13
|
+
An internal foundational package that provides the base class and utilities for building Brick web components, handling common boilerplate and web component lifecycle management.
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Base `BrickElement` class for all Brick components
|
|
18
|
+
- `defineCustomElement` decorator for component registration
|
|
19
|
+
- Handles web component lifecycle (connectedCallback, disconnectedCallback, etc.)
|
|
20
|
+
- Attribute observation and reactivity
|
|
21
|
+
- Property-to-attribute synchronization
|
|
22
|
+
- Shadow DOM management
|
|
23
|
+
- Framework-agnostic web component standard implementation
|
|
24
|
+
- TypeScript support with type definitions
|
|
25
|
+
|
|
26
|
+
## Core Exports
|
|
27
|
+
|
|
28
|
+
### BrickElement Class
|
|
29
|
+
|
|
30
|
+
The base class that all Brick components extend from. Provides:
|
|
31
|
+
|
|
32
|
+
- Automatic custom element registration
|
|
33
|
+
- Lifecycle hooks
|
|
34
|
+
- Attribute observation
|
|
35
|
+
- Property management
|
|
36
|
+
- Shadow DOM handling
|
|
37
|
+
|
|
38
|
+
### defineCustomElement Decorator
|
|
39
|
+
|
|
40
|
+
A TypeScript decorator for declaring custom elements with automatic registration.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Basic Component
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { BrickElement, defineCustomElement } from '@amedia/brick-template';
|
|
48
|
+
import { css } from '@amedia/brick-tokens';
|
|
49
|
+
|
|
50
|
+
const titleClass = css({
|
|
51
|
+
color: '$supportiveBlackText',
|
|
52
|
+
backgroundColor: '$supportiveBlackBg'
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
@defineCustomElement({
|
|
56
|
+
selector: 'brick-is-awesome',
|
|
57
|
+
})
|
|
58
|
+
class BrickIsAwesome extends BrickElement {
|
|
59
|
+
get HTML() {
|
|
60
|
+
return `<h1 class="${titleClass}">Brick is Awesome!</h1>`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Component with Properties
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { BrickElement, defineCustomElement } from '@amedia/brick-template';
|
|
69
|
+
|
|
70
|
+
@defineCustomElement({
|
|
71
|
+
selector: 'brick-example',
|
|
72
|
+
})
|
|
73
|
+
class BrickExample extends BrickElement {
|
|
74
|
+
// Define observed attributes
|
|
75
|
+
static get observedAttributes() {
|
|
76
|
+
return ['data-label', 'data-value'];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Getters for properties
|
|
80
|
+
get dataLabel() {
|
|
81
|
+
return this.getAttribute('data-label') || '';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
set dataLabel(value: string) {
|
|
85
|
+
this.setAttribute('data-label', value);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get dataValue() {
|
|
89
|
+
return this.getAttribute('data-value') || '';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set dataValue(value: string) {
|
|
93
|
+
this.setAttribute('data-value', value);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Render method
|
|
97
|
+
get HTML() {
|
|
98
|
+
return `
|
|
99
|
+
<div>
|
|
100
|
+
<span>${this.dataLabel}</span>
|
|
101
|
+
<span>${this.dataValue}</span>
|
|
102
|
+
</div>
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Component with Lifecycle Hooks
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { BrickElement, defineCustomElement } from '@amedia/brick-template';
|
|
112
|
+
|
|
113
|
+
@defineCustomElement({
|
|
114
|
+
selector: 'brick-lifecycle',
|
|
115
|
+
})
|
|
116
|
+
class BrickLifecycle extends BrickElement {
|
|
117
|
+
connectedCallback() {
|
|
118
|
+
super.connectedCallback();
|
|
119
|
+
console.log('Component connected to DOM');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
disconnectedCallback() {
|
|
123
|
+
super.disconnectedCallback();
|
|
124
|
+
console.log('Component removed from DOM');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string) {
|
|
128
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
129
|
+
console.log(`Attribute ${name} changed from ${oldValue} to ${newValue}`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get HTML() {
|
|
133
|
+
return `<div>Lifecycle Component</div>`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Usage in Brick Components
|
|
139
|
+
|
|
140
|
+
All Brick components use brick-template as their foundation:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { BrickElement, defineCustomElement } from '@amedia/brick-template';
|
|
144
|
+
import { css } from '@amedia/brick-tokens';
|
|
145
|
+
|
|
146
|
+
@defineCustomElement({
|
|
147
|
+
selector: 'brick-button-v9',
|
|
148
|
+
})
|
|
149
|
+
export class BrickButton extends BrickElement {
|
|
150
|
+
static get observedAttributes() {
|
|
151
|
+
return ['data-label', 'data-version', 'data-size'];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
get HTML() {
|
|
155
|
+
return `<button>${this.dataLabel}</button>`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## BrickElement API
|
|
161
|
+
|
|
162
|
+
### Properties
|
|
163
|
+
|
|
164
|
+
- `shadowRoot`: Access to the component's shadow DOM
|
|
165
|
+
- `observedAttributes`: Static property defining which attributes to watch
|
|
166
|
+
|
|
167
|
+
### Lifecycle Methods
|
|
168
|
+
|
|
169
|
+
- `connectedCallback()`: Called when element is inserted into DOM
|
|
170
|
+
- `disconnectedCallback()`: Called when element is removed from DOM
|
|
171
|
+
- `attributeChangedCallback(name, oldValue, newValue)`: Called when observed attribute changes
|
|
172
|
+
- `adoptedCallback()`: Called when element is moved to a new document
|
|
173
|
+
|
|
174
|
+
### Template Method
|
|
175
|
+
|
|
176
|
+
- `get HTML()`: Override this getter to define your component's template
|
|
177
|
+
|
|
178
|
+
## Framework Compatibility
|
|
179
|
+
|
|
180
|
+
Brick-template creates standard web components that work with:
|
|
181
|
+
|
|
182
|
+
- Vanilla JavaScript
|
|
183
|
+
- Svelte
|
|
184
|
+
- React
|
|
185
|
+
- Vue
|
|
186
|
+
- Angular
|
|
187
|
+
- Any framework that supports web components
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
// Vanilla JS
|
|
191
|
+
import '@amedia/brick-button';
|
|
192
|
+
const button = document.createElement('brick-button-v9');
|
|
193
|
+
button.dataLabel = 'Click me';
|
|
194
|
+
|
|
195
|
+
// Svelte
|
|
196
|
+
import '@amedia/brick-button';
|
|
197
|
+
<brick-button-v9 data-label="Click me" />
|
|
198
|
+
|
|
199
|
+
// React
|
|
200
|
+
import '@amedia/brick-button';
|
|
201
|
+
<brick-button-v9 data-label="Click me" />
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Technical Details
|
|
205
|
+
|
|
206
|
+
- **Package Type**: Internal utility/foundation package
|
|
207
|
+
- **Output**: BrickElement class and defineCustomElement decorator
|
|
208
|
+
- **Standard**: Web Components standard (Custom Elements v1)
|
|
209
|
+
- **TypeScript**: Full TypeScript support with type definitions
|
|
210
|
+
- **Shadow DOM**: Automatic shadow DOM creation and management
|
|
211
|
+
- **Dependencies**: None (standalone foundation)
|
|
212
|
+
|
|
213
|
+
## Important Notes
|
|
214
|
+
|
|
215
|
+
- This is an internal package used by all Brick components
|
|
216
|
+
- Not meant to be used directly in applications
|
|
217
|
+
- Provides the foundation for the Brick component architecture
|
|
218
|
+
- All Brick components extend BrickElement
|
|
219
|
+
- Handles common web component boilerplate automatically
|
|
220
|
+
- Version 2.0.0 is the current stable version
|
|
221
|
+
- Components must override the `HTML` getter to define their template
|
|
222
|
+
- The `@defineCustomElement` decorator automatically registers the custom element
|
|
223
|
+
|
|
224
|
+
## Version
|
|
225
|
+
|
|
226
|
+
Current version: 2.0.0
|