@amedia/brick-mcp 0.1.2 → 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 +35 -35
- 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 +35 -35
- 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,331 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-player
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
selector: brick-player-v2
|
|
5
|
+
category: Media
|
|
6
|
+
tags: [video, audio, player, flowplayer, media, streaming, ads, autoplay]
|
|
7
|
+
use_cases: [video-playback, audio-playback, video-article, media-streaming, reels, front-page-videos]
|
|
8
|
+
related: [brick-button, brick-tokens, brick-teaser-player]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Player
|
|
12
|
+
|
|
13
|
+
A web component wrapper for Flowplayer that provides video and audio playback with advanced features including ad integration, analytics tracking, and responsive UI controls.
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Plays both video and audio files using Flowplayer library
|
|
18
|
+
- Integrated ad support with prebid and IMA3 (Google ads)
|
|
19
|
+
- ADP analytics integration for video tracking
|
|
20
|
+
- Autoplay with configurable behavior (true, false, or trueIfInteractive)
|
|
21
|
+
- Floating player mode when scrolling outside viewport
|
|
22
|
+
- Next video queueing for playlist functionality
|
|
23
|
+
- Custom UI flags for control customization
|
|
24
|
+
- Responsive aspect ratio control via CSS custom properties
|
|
25
|
+
- Server-side rendering support
|
|
26
|
+
|
|
27
|
+
## Props/Attributes
|
|
28
|
+
|
|
29
|
+
| Attribute | Type | Default | Required | Description |
|
|
30
|
+
| --------------------- | ------------------------------------------------- | ------------------------------------ | -------- | ---------------------------------------------------------------- |
|
|
31
|
+
| `mediaid` | string (UUID) | `3689c16b-4cb9-4a36-baf4-2c3aa7fcc811` | yes | Flowplayer media UUID (video or audio) |
|
|
32
|
+
| `playerid` | string (UUID) | - | no | Flowplayer configuration UUID from workspace/publication |
|
|
33
|
+
| `audio` | string | `"false"` | no | Toggles audio player UI when set to "true" |
|
|
34
|
+
| `autoplay` | `"true" \| "false" \| "trueIfInteractive"` | `"false"` | no | Automatically start playback |
|
|
35
|
+
| `muted` | string | `"false"` | no | Mute sound when set to "true" |
|
|
36
|
+
| `loop` | string | `"false"` | no | Loop video playback when set to "true" |
|
|
37
|
+
| `title` | string | - | no | Displayed video title (also used as tooltip) |
|
|
38
|
+
| `poster` | string (URL) | From player config | no | Poster image URL (empty string "" hides default) |
|
|
39
|
+
| `logo` | string (URL) | From player config | no | Logo URL (empty string "" hides default) |
|
|
40
|
+
| `aspectratio` | string | `"16:9"` | no | Force aspect ratio (e.g., "16:9", "1:1") |
|
|
41
|
+
| `adsdisabled` | string | `"false"` | no | Disable ads when set to "true" |
|
|
42
|
+
| `scrollenabled` | string | `"false"` | no | Float video on top when scrolled outside viewport |
|
|
43
|
+
| `playoutsideviewport` | string | `"false"` | no | Continue playback when scrolled outside viewport |
|
|
44
|
+
| `teasertitle` | string | `"false"` | no | Front page teaser title emphasis when set to "true" |
|
|
45
|
+
| `context` | `"article" \| "videoArticle" \| "frontPage" \| "reels"` | - | no | Page context for ADP analytics (productFeature) |
|
|
46
|
+
| `start` | string (number) | `"0"` | no | Start offset for media playback in seconds (supports decimals) |
|
|
47
|
+
| `startquality` | `"LOW" \| "MEDIUM" \| "HIGH"` | `"LOW"` | no | Initial playback quality |
|
|
48
|
+
| `ui` | string (comma-separated flags) | - | no | UI config flags (e.g., "NO_FULLSCREEN,USE_PLAY_3") |
|
|
49
|
+
| `nextvideo` | string (JSON) | - | no | Enqueue next video as JSON object with title and mediaid |
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
### Basic Video Player
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<brick-player-v2
|
|
57
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
58
|
+
>
|
|
59
|
+
</brick-player-v2>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Video with Player Configuration
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<brick-player-v2
|
|
66
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
67
|
+
playerid="your-flowplayer-config-uuid"
|
|
68
|
+
title="Breaking News Video"
|
|
69
|
+
>
|
|
70
|
+
</brick-player-v2>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Audio Player
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<brick-player-v2
|
|
77
|
+
mediaid="audio-uuid-here"
|
|
78
|
+
audio="true"
|
|
79
|
+
title="Podcast Episode 42"
|
|
80
|
+
>
|
|
81
|
+
</brick-player-v2>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Autoplay with Muted Sound
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<brick-player-v2
|
|
88
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
89
|
+
autoplay="true"
|
|
90
|
+
muted="true"
|
|
91
|
+
loop="true"
|
|
92
|
+
>
|
|
93
|
+
</brick-player-v2>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Floating Player on Scroll
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<brick-player-v2
|
|
100
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
101
|
+
scrollenabled="true"
|
|
102
|
+
playoutsideviewport="true"
|
|
103
|
+
>
|
|
104
|
+
</brick-player-v2>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Video with Next Video Queue
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<brick-player-v2
|
|
111
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
112
|
+
title="First Video"
|
|
113
|
+
nextvideo='{"title":"Second Video","mediaid":"150cc113-edfe-46ab-992f-f660c01c664f"}'
|
|
114
|
+
>
|
|
115
|
+
</brick-player-v2>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Custom Aspect Ratio and Quality
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<brick-player-v2
|
|
122
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
123
|
+
aspectratio="1:1"
|
|
124
|
+
startquality="HIGH"
|
|
125
|
+
>
|
|
126
|
+
</brick-player-v2>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Disable Ads
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<brick-player-v2
|
|
133
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
134
|
+
adsdisabled="true"
|
|
135
|
+
>
|
|
136
|
+
</brick-player-v2>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Programmatic Usage
|
|
140
|
+
|
|
141
|
+
### Control Playback
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
// Get player element
|
|
145
|
+
const player = document.querySelector('brick-player-v2');
|
|
146
|
+
|
|
147
|
+
// Play video
|
|
148
|
+
player.play();
|
|
149
|
+
|
|
150
|
+
// Pause video
|
|
151
|
+
player.pause();
|
|
152
|
+
|
|
153
|
+
// Replay from beginning
|
|
154
|
+
player.replay();
|
|
155
|
+
|
|
156
|
+
// Skip to end
|
|
157
|
+
player.skip();
|
|
158
|
+
|
|
159
|
+
// Mute/unmute
|
|
160
|
+
player.setMute(true);
|
|
161
|
+
player.setMute(false);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Listen to Events
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
// Listen for time remaining updates (fires every second during playback)
|
|
168
|
+
window.addEventListener('brick-player:timeleft', (e) => {
|
|
169
|
+
const { id, timeleft } = e.detail;
|
|
170
|
+
console.log(`${timeleft.next} seconds remaining`);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// Listen for playback state changes
|
|
174
|
+
window.addEventListener('brick-player:playingstate', (e) => {
|
|
175
|
+
const { id, state } = e.detail;
|
|
176
|
+
console.log(`Player state: ${state}`); // 'play' | 'pause' | 'seek' | 'end'
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Listen for next video events
|
|
180
|
+
window.addEventListener('brick-player:nextvideo', (e) => {
|
|
181
|
+
const { id, nextvideo } = e.detail;
|
|
182
|
+
console.log('Next video:', JSON.parse(nextvideo.next));
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Event Reference
|
|
187
|
+
|
|
188
|
+
### brick-player:timeleft
|
|
189
|
+
|
|
190
|
+
Fires every second during playback with remaining time.
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
{
|
|
194
|
+
type: 'brick-player:timeleft',
|
|
195
|
+
detail: {
|
|
196
|
+
id: string, // Player instance ID
|
|
197
|
+
timeleft: {
|
|
198
|
+
prev: number, // Previous seconds left
|
|
199
|
+
next: number, // Current seconds left
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### brick-player:playingstate
|
|
206
|
+
|
|
207
|
+
Fires when playback state changes.
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
{
|
|
211
|
+
type: 'brick-player:playingstate',
|
|
212
|
+
detail: {
|
|
213
|
+
id: string, // Player instance ID
|
|
214
|
+
state: 'play' | 'pause' | 'seek' | 'end'
|
|
215
|
+
},
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### brick-player:nextvideo
|
|
220
|
+
|
|
221
|
+
Fires when next video is consumed or changed.
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
{
|
|
225
|
+
type: 'brick-player:nextvideo',
|
|
226
|
+
detail: {
|
|
227
|
+
id: string, // Player instance ID
|
|
228
|
+
nextvideo: {
|
|
229
|
+
prev: string, // JSON string of previous next video
|
|
230
|
+
next: string, // JSON string of current next video
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Styling and CSS Properties
|
|
237
|
+
|
|
238
|
+
### Override Aspect Ratio
|
|
239
|
+
|
|
240
|
+
Force all videos to a specific aspect ratio regardless of original format:
|
|
241
|
+
|
|
242
|
+
```css
|
|
243
|
+
brick-player-v2 {
|
|
244
|
+
--brick-player-ar-container: 1/1; /* Force 1:1 aspect ratio */
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Or apply inline:
|
|
249
|
+
|
|
250
|
+
```html
|
|
251
|
+
<div style="--brick-player-ar-container: 16/9;">
|
|
252
|
+
<brick-player-v2 mediaid="..."></brick-player-v2>
|
|
253
|
+
</div>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Analytics Integration
|
|
257
|
+
|
|
258
|
+
The player integrates with ADP (Amedia Data Platform) for video analytics. Specify the page context:
|
|
259
|
+
|
|
260
|
+
```html
|
|
261
|
+
<brick-player-v2
|
|
262
|
+
mediaid="b4ff4781-d507-49fd-b615-0cc12cc89856"
|
|
263
|
+
context="article"
|
|
264
|
+
>
|
|
265
|
+
</brick-player-v2>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Valid context values: `article`, `videoArticle`, `frontPage`, `reels`
|
|
269
|
+
|
|
270
|
+
## Ads Configuration
|
|
271
|
+
|
|
272
|
+
### Disable Ads Completely
|
|
273
|
+
|
|
274
|
+
```html
|
|
275
|
+
<brick-player-v2 mediaid="..." adsdisabled="true"></brick-player-v2>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Testing Flowplayer Versions
|
|
279
|
+
|
|
280
|
+
Test different Flowplayer versions in production using query parameters:
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
?flowplayer_test=test # Load 3/canary version
|
|
284
|
+
?flowplayer_test=3/v3.0.7 # Load specific version
|
|
285
|
+
?flowplayer_test=4/v1.0.0 # Load major version 4
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Important Ads Notes
|
|
289
|
+
|
|
290
|
+
- Ads plugin and IMA3 are not loaded when `adsdisabled="true"`
|
|
291
|
+
- Ads are automatically disabled for audio players (`audio="true"`)
|
|
292
|
+
- Ad blocking detection is automatic
|
|
293
|
+
- Ads can be disabled via Flowplayer keywords set to `no_ads`
|
|
294
|
+
|
|
295
|
+
## Accessibility
|
|
296
|
+
|
|
297
|
+
- Keyboard navigation support via Flowplayer controls
|
|
298
|
+
- Play/pause with Space or Enter key
|
|
299
|
+
- Volume control with arrow keys
|
|
300
|
+
- Full-screen toggle with F key
|
|
301
|
+
- Title attribute provides video description for screen readers
|
|
302
|
+
|
|
303
|
+
## Technical Details
|
|
304
|
+
|
|
305
|
+
- **Custom Element**: `brick-player-v2`
|
|
306
|
+
- **Base Library**: Flowplayer 3.34.1
|
|
307
|
+
- **Dependencies**:
|
|
308
|
+
- @flowplayer/player (video player engine)
|
|
309
|
+
- @amedia/adplogger-sdk (analytics)
|
|
310
|
+
- @amedia/brick-button (UI controls)
|
|
311
|
+
- @amedia/brick-tokens (design tokens)
|
|
312
|
+
- lit-html (rendering)
|
|
313
|
+
- **Renders as**: Custom shadow DOM web component
|
|
314
|
+
- **Attribute Observation**: All attributes are reactive after initialization
|
|
315
|
+
|
|
316
|
+
## Important Notes
|
|
317
|
+
|
|
318
|
+
- The component uses Flowplayer library for video/audio playback
|
|
319
|
+
- Media IDs are UUIDs from Flowplayer workspace/publication
|
|
320
|
+
- Player IDs reference pre-configured players in Flowplayer UI
|
|
321
|
+
- Attributes are parsed into typed properties on initialization
|
|
322
|
+
- Changes to attributes after initialization are reactive
|
|
323
|
+
- Audio players do not load ads plugin (ads are disabled automatically)
|
|
324
|
+
- The `nextvideo` attribute accepts JSON string format
|
|
325
|
+
- Events bubble as regular DOM events (can be listened on window or element)
|
|
326
|
+
- ADP analytics integration requires valid context value for proper tracking
|
|
327
|
+
- Known issue: ADP logger may fail if ads plugin not loaded and user has ad blocker
|
|
328
|
+
|
|
329
|
+
## Version
|
|
330
|
+
|
|
331
|
+
Current version: 2.0.0
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-published
|
|
3
|
+
version: 4.0.7
|
|
4
|
+
selector: brick-published-v4
|
|
5
|
+
category: Data Display
|
|
6
|
+
tags: [date, time, datetime, published, modified, timestamp, metadata, semantic]
|
|
7
|
+
use_cases: [article-metadata, blog-posts, news-articles, content-timestamp, seo]
|
|
8
|
+
related: [brick-byline, brick-card, brick-teaser]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Published
|
|
12
|
+
|
|
13
|
+
A semantic HTML component for displaying published or modified dates with proper datetime markup and Schema.org metadata support.
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Displays formatted publication or modification dates
|
|
18
|
+
- Semantic `<time>` element with proper datetime attribute
|
|
19
|
+
- Schema.org itemprop support for SEO (datePublished/dateModified)
|
|
20
|
+
- Customizable label prefix (e.g., "Published:", "Updated:")
|
|
21
|
+
- ISO 8601 datetime format support
|
|
22
|
+
- Lightweight, dependency-minimal component
|
|
23
|
+
- Server-side rendering support
|
|
24
|
+
|
|
25
|
+
## Props/Attributes
|
|
26
|
+
|
|
27
|
+
| Attribute | Type | Default | Required | Description |
|
|
28
|
+
| ------------------- | ------ | ------- | -------- | --------------------------------------------------------------------- |
|
|
29
|
+
| `data-display-date` | string | - | yes | The formatted date string to display (e.g., "22.04.25 12:10") |
|
|
30
|
+
| `data-datetime` | string | - | yes | ISO 8601 formatted datetime for `<time>` element datetime attribute |
|
|
31
|
+
| `data-label` | string | - | no | Label prefix displayed before the date (e.g., "Published: ") |
|
|
32
|
+
| `data-itemprop` | string | - | no | Schema.org itemprop value: "datePublished" or "dateModified" |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Basic Published Date
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<brick-published-v4
|
|
40
|
+
data-display-date="22.04.25 12:10"
|
|
41
|
+
data-datetime="2025-04-22T12:10:00.000+0200"
|
|
42
|
+
>
|
|
43
|
+
</brick-published-v4>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Published Date with Label
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<brick-published-v4
|
|
50
|
+
data-display-date="22.04.25 12:10"
|
|
51
|
+
data-datetime="2025-04-22T12:10:00.000+0200"
|
|
52
|
+
data-label="Publisert: "
|
|
53
|
+
data-itemprop="datePublished"
|
|
54
|
+
>
|
|
55
|
+
</brick-published-v4>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Modified Date
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<brick-published-v4
|
|
62
|
+
data-display-date="22.04.22 12:01"
|
|
63
|
+
data-datetime="2022-04-22T12:00:01.000+0200"
|
|
64
|
+
data-label="Oppdatert: "
|
|
65
|
+
data-itemprop="dateModified"
|
|
66
|
+
>
|
|
67
|
+
</brick-published-v4>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Article Metadata
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<article>
|
|
74
|
+
<h1>Breaking News Article</h1>
|
|
75
|
+
<brick-published-v4
|
|
76
|
+
data-display-date="08.01.26 14:30"
|
|
77
|
+
data-datetime="2026-01-08T14:30:00.000+0100"
|
|
78
|
+
data-label="Published: "
|
|
79
|
+
data-itemprop="datePublished"
|
|
80
|
+
>
|
|
81
|
+
</brick-published-v4>
|
|
82
|
+
</article>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Different Date Formats
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<!-- Norwegian format -->
|
|
89
|
+
<brick-published-v4
|
|
90
|
+
data-display-date="8. januar 2026"
|
|
91
|
+
data-datetime="2026-01-08T14:30:00.000+0100"
|
|
92
|
+
data-label="Publisert "
|
|
93
|
+
data-itemprop="datePublished"
|
|
94
|
+
>
|
|
95
|
+
</brick-published-v4>
|
|
96
|
+
|
|
97
|
+
<!-- Short format -->
|
|
98
|
+
<brick-published-v4
|
|
99
|
+
data-display-date="08.01.26"
|
|
100
|
+
data-datetime="2026-01-08T14:30:00.000+0100"
|
|
101
|
+
>
|
|
102
|
+
</brick-published-v4>
|
|
103
|
+
|
|
104
|
+
<!-- Time ago format -->
|
|
105
|
+
<brick-published-v4
|
|
106
|
+
data-display-date="2 timer siden"
|
|
107
|
+
data-datetime="2026-01-08T12:30:00.000+0100"
|
|
108
|
+
data-label="Oppdatert "
|
|
109
|
+
>
|
|
110
|
+
</brick-published-v4>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Server-Side Rendering
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
import { renderBrickPublished } from '@amedia/brick-published/template';
|
|
117
|
+
|
|
118
|
+
const html = renderBrickPublished({
|
|
119
|
+
dataDisplayDate: '22.04.25 12:10',
|
|
120
|
+
dataDatetime: '2025-04-22T12:10:00.000+0200',
|
|
121
|
+
dataLabel: 'Publisert: ',
|
|
122
|
+
dataItemprop: 'datePublished',
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Accessibility
|
|
127
|
+
|
|
128
|
+
- Uses semantic `<time>` element for proper date/time markup
|
|
129
|
+
- Machine-readable datetime attribute for assistive technologies
|
|
130
|
+
- Human-readable display format for all users
|
|
131
|
+
- Proper text contrast for readability
|
|
132
|
+
|
|
133
|
+
## SEO and Schema.org
|
|
134
|
+
|
|
135
|
+
The component supports Schema.org metadata through the `data-itemprop` attribute:
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<!-- For published date -->
|
|
139
|
+
<brick-published-v4
|
|
140
|
+
data-itemprop="datePublished"
|
|
141
|
+
...
|
|
142
|
+
>
|
|
143
|
+
</brick-published-v4>
|
|
144
|
+
|
|
145
|
+
<!-- For modified date -->
|
|
146
|
+
<brick-published-v4
|
|
147
|
+
data-itemprop="dateModified"
|
|
148
|
+
...
|
|
149
|
+
>
|
|
150
|
+
</brick-published-v4>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This helps search engines understand when content was published or last modified, which can affect search result displays and ranking.
|
|
154
|
+
|
|
155
|
+
## Common Patterns
|
|
156
|
+
|
|
157
|
+
### Article Header with Multiple Dates
|
|
158
|
+
|
|
159
|
+
```html
|
|
160
|
+
<header>
|
|
161
|
+
<h1>Article Title</h1>
|
|
162
|
+
<brick-published-v4
|
|
163
|
+
data-display-date="08.01.26 10:00"
|
|
164
|
+
data-datetime="2026-01-08T10:00:00.000+0100"
|
|
165
|
+
data-label="Publisert: "
|
|
166
|
+
data-itemprop="datePublished"
|
|
167
|
+
>
|
|
168
|
+
</brick-published-v4>
|
|
169
|
+
<brick-published-v4
|
|
170
|
+
data-display-date="08.01.26 14:30"
|
|
171
|
+
data-datetime="2026-01-08T14:30:00.000+0100"
|
|
172
|
+
data-label="Oppdatert: "
|
|
173
|
+
data-itemprop="dateModified"
|
|
174
|
+
>
|
|
175
|
+
</brick-published-v4>
|
|
176
|
+
</header>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### With Byline Component
|
|
180
|
+
|
|
181
|
+
```html
|
|
182
|
+
<div class="article-meta">
|
|
183
|
+
<brick-byline-v3
|
|
184
|
+
data-author-name="John Doe"
|
|
185
|
+
data-author-link="/authors/john-doe"
|
|
186
|
+
>
|
|
187
|
+
</brick-byline-v3>
|
|
188
|
+
<brick-published-v4
|
|
189
|
+
data-display-date="08.01.26 14:30"
|
|
190
|
+
data-datetime="2026-01-08T14:30:00.000+0100"
|
|
191
|
+
data-label="Publisert: "
|
|
192
|
+
data-itemprop="datePublished"
|
|
193
|
+
>
|
|
194
|
+
</brick-published-v4>
|
|
195
|
+
</div>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Technical Details
|
|
199
|
+
|
|
200
|
+
- **Custom Element**: `brick-published-v4`
|
|
201
|
+
- **Base Class**: BrickElement
|
|
202
|
+
- **Dependencies**:
|
|
203
|
+
- @amedia/brick-template (base class)
|
|
204
|
+
- @amedia/brick-tokens (design tokens)
|
|
205
|
+
- **Renders as**: `<time>` element with optional label
|
|
206
|
+
- **SSR Compatible**: Yes, with template function
|
|
207
|
+
|
|
208
|
+
## Important Notes
|
|
209
|
+
|
|
210
|
+
- The `data-datetime` attribute should always be in ISO 8601 format for proper semantic markup
|
|
211
|
+
- The `data-display-date` can be formatted however you prefer for display purposes
|
|
212
|
+
- The component does not format dates automatically - you must provide pre-formatted strings
|
|
213
|
+
- For SEO benefits, use `data-itemprop="datePublished"` on the first published date
|
|
214
|
+
- Use `data-itemprop="dateModified"` when showing update timestamps
|
|
215
|
+
- The component is purely presentational - it does not calculate relative time or format dates
|
|
216
|
+
|
|
217
|
+
## Version
|
|
218
|
+
|
|
219
|
+
Current version: 4.0.7
|