@amedia/brick-mcp 0.0.1-LLM-DOCS → 0.0.1-NEW-PATH-1
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 +241 -98
- package/dist/data/components/brick-actions.json +6 -0
- package/dist/data/components/brick-alt-teaser.json +10 -0
- package/dist/data/components/brick-avatar.json +11 -0
- package/dist/data/components/brick-button.json +12 -0
- package/dist/data/components/brick-card.json +10 -0
- package/dist/data/components/brick-carousel.json +11 -0
- package/dist/data/components/brick-classnames.json +10 -0
- package/dist/data/components/brick-countdown.json +7 -0
- package/dist/data/components/brick-dialog.json +11 -0
- package/dist/data/components/brick-fonts.json +10 -0
- package/dist/data/components/brick-helloworld.json +7 -0
- package/dist/data/components/brick-icon.json +10 -0
- package/dist/data/components/brick-icons.json +11 -0
- package/dist/data/components/brick-illustrations.json +7 -0
- package/dist/data/components/brick-image.json +10 -0
- package/dist/data/components/brick-input.json +12 -0
- package/{data → dist/data}/components/brick-mcp.json +1 -1
- package/dist/data/components/brick-nifs.json +7 -0
- package/{data → dist/data}/components/brick-pill.json +1 -1
- package/{data → dist/data}/components/brick-player.json +1 -1
- package/dist/data/components/brick-published.json +7 -0
- package/{data → dist/data}/components/brick-share.json +1 -1
- package/{data → dist/data}/components/brick-stepper.json +1 -1
- package/{data → dist/data}/components/brick-tab.json +1 -1
- package/{data → dist/data}/components/brick-tabs.json +1 -1
- package/{data → dist/data}/components/brick-tag.json +1 -1
- package/{data → dist/data}/components/brick-teaser-player.json +1 -1
- package/{data → dist/data}/components/brick-teaser-reels.json +1 -1
- package/{data → dist/data}/components/brick-teaser.json +1 -1
- package/{data → dist/data}/components/brick-textarea.json +1 -1
- package/{data → dist/data}/components/brick-toast.json +1 -1
- package/{data → dist/data}/components/brick-toggle.json +1 -1
- package/{data → dist/data}/components/brick-tokens.json +1 -1
- package/{data → dist/data}/components/brick-tooltip.json +1 -1
- package/{data → dist/data}/components-metadata.json +29 -29
- package/dist/data/components.json +321 -0
- package/dist/http.js +311 -0
- package/dist/http.js.map +7 -0
- package/dist/index.js +52 -81
- package/dist/index.js.map +4 -4
- package/package.json +3 -6
- package/scripts/generate-data.js +37 -40
- package/data/components/brick-actions.md +0 -59
- package/data/components/brick-alt-teaser.md +0 -253
- package/data/components/brick-avatar.md +0 -265
- package/data/components/brick-button.md +0 -364
- package/data/components/brick-card.md +0 -329
- package/data/components/brick-carousel.md +0 -330
- package/data/components/brick-classnames.md +0 -150
- package/data/components/brick-countdown.md +0 -179
- package/data/components/brick-dialog.md +0 -418
- package/data/components/brick-fonts.md +0 -335
- package/data/components/brick-helloworld.md +0 -202
- package/data/components/brick-icon.md +0 -271
- package/data/components/brick-icons.md +0 -430
- package/data/components/brick-illustrations.md +0 -552
- package/data/components/brick-image.md +0 -335
- package/data/components/brick-input.md +0 -521
- package/data/components/brick-nifs.md +0 -163
- package/data/components/brick-published.json +0 -7
- package/data/tokens-documentation.json +0 -7
- /package/{data → dist/data}/components/brick-template.json +0 -0
- /package/{data → dist/data}/components/brick-themes.json +0 -0
- /package/{data → dist/data}/tokens.json +0 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@amedia/brick-mcp",
|
|
3
3
|
"homepage": "https://github.com/amedia/brick.git",
|
|
4
4
|
"author": "Amedia",
|
|
5
|
-
"version": "0.0.1-
|
|
5
|
+
"version": "0.0.1-NEW-PATH-1",
|
|
6
6
|
"description": "This is a MCP server for Brick",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"type": "module",
|
|
@@ -13,12 +13,10 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"scripts"
|
|
17
|
-
"data"
|
|
16
|
+
"scripts"
|
|
18
17
|
],
|
|
19
18
|
"scripts": {
|
|
20
19
|
"build": "node build.js",
|
|
21
|
-
"generate-data": "node scripts/generate-data.js",
|
|
22
20
|
"lint": "kragl lint",
|
|
23
21
|
"lint:fix": "kragl lint --fix",
|
|
24
22
|
"test:typescript": "tsc --noEmit",
|
|
@@ -36,8 +34,7 @@
|
|
|
36
34
|
"@fastify/cors": "11.1.0",
|
|
37
35
|
"@modelcontextprotocol/sdk": "1.21.0",
|
|
38
36
|
"fastify": "5.6.1",
|
|
39
|
-
"zod": "3.25.76"
|
|
40
|
-
"zod-to-json-schema": "3.24.6"
|
|
37
|
+
"zod": "3.25.76"
|
|
41
38
|
},
|
|
42
39
|
"devDependencies": {
|
|
43
40
|
"@amedia/kragl": "5.1.1",
|
package/scripts/generate-data.js
CHANGED
|
@@ -11,7 +11,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
11
11
|
const __dirname = dirname(__filename);
|
|
12
12
|
|
|
13
13
|
const BRICK_ROOT = join(__dirname, '..', '..', '..');
|
|
14
|
-
const DATA_DIR = join(__dirname, '..', 'data');
|
|
14
|
+
const DATA_DIR = join(__dirname, '..', 'src', 'data');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Extract component selector from package name
|
|
@@ -77,6 +77,10 @@ async function generateComponentMetadata() {
|
|
|
77
77
|
const entries = await readdir(packagesDir, { withFileTypes: true });
|
|
78
78
|
|
|
79
79
|
const metadataList = [];
|
|
80
|
+
const componentsDir = join(DATA_DIR, 'components');
|
|
81
|
+
|
|
82
|
+
// Create components directory
|
|
83
|
+
await mkdir(componentsDir, { recursive: true });
|
|
80
84
|
|
|
81
85
|
for (const entry of entries) {
|
|
82
86
|
if (entry.isDirectory() && entry.name.startsWith('brick-')) {
|
|
@@ -96,6 +100,25 @@ async function generateComponentMetadata() {
|
|
|
96
100
|
const category = categorizeComponent(componentName);
|
|
97
101
|
const tags = extractTags(componentName, category);
|
|
98
102
|
|
|
103
|
+
// Read llm.txt if it exists
|
|
104
|
+
let llmContent;
|
|
105
|
+
try {
|
|
106
|
+
llmContent = await readFile(join(packagePath, 'llm.txt'), 'utf-8');
|
|
107
|
+
} catch {
|
|
108
|
+
llmContent = undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Read MDX documentation if it exists
|
|
112
|
+
let mdxContent;
|
|
113
|
+
try {
|
|
114
|
+
mdxContent = await readFile(
|
|
115
|
+
join(packagePath, 'stories', `${componentName}.mdx`),
|
|
116
|
+
'utf-8'
|
|
117
|
+
);
|
|
118
|
+
} catch {
|
|
119
|
+
mdxContent = undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
99
122
|
// Lightweight metadata (for list operations)
|
|
100
123
|
const metadata = {
|
|
101
124
|
name: componentName,
|
|
@@ -106,6 +129,19 @@ async function generateComponentMetadata() {
|
|
|
106
129
|
tags: tags.length > 0 ? tags : undefined,
|
|
107
130
|
};
|
|
108
131
|
|
|
132
|
+
// Full component data (for get operations)
|
|
133
|
+
const fullComponent = {
|
|
134
|
+
...metadata,
|
|
135
|
+
llm: llmContent,
|
|
136
|
+
mdx: mdxContent,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Write individual component file
|
|
140
|
+
await writeFile(
|
|
141
|
+
join(componentsDir, `${componentName}.json`),
|
|
142
|
+
JSON.stringify(fullComponent, null, 2)
|
|
143
|
+
);
|
|
144
|
+
|
|
109
145
|
metadataList.push(metadata);
|
|
110
146
|
} catch (error) {
|
|
111
147
|
console.error(`Error processing ${entry.name}:`, error.message);
|
|
@@ -151,44 +187,6 @@ function extractTokens(obj, prefix = '', category, theme, tokens = []) {
|
|
|
151
187
|
return tokens;
|
|
152
188
|
}
|
|
153
189
|
|
|
154
|
-
/**
|
|
155
|
-
* Generate design tokens documentation
|
|
156
|
-
*/
|
|
157
|
-
async function generateTokensDocumentation() {
|
|
158
|
-
console.log('Generating tokens documentation...');
|
|
159
|
-
|
|
160
|
-
const storiesPath = join(BRICK_ROOT, 'stories');
|
|
161
|
-
const documentationFiles = [
|
|
162
|
-
'brickTokensAnOverview.mdx',
|
|
163
|
-
'brickTokensFormats.mdx',
|
|
164
|
-
'brickTokensNaming.mdx',
|
|
165
|
-
'brickTokensThemes.mdx',
|
|
166
|
-
'brickTokensUsage.mdx',
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
const documentation = {};
|
|
170
|
-
|
|
171
|
-
for (const file of documentationFiles) {
|
|
172
|
-
const filePath = join(storiesPath, file);
|
|
173
|
-
try {
|
|
174
|
-
const content = await readFile(filePath, 'utf-8');
|
|
175
|
-
const docKey = file.replace('brickTokens', '').replace('.mdx', '');
|
|
176
|
-
const key = docKey.charAt(0).toLowerCase() + docKey.slice(1);
|
|
177
|
-
documentation[key] = content;
|
|
178
|
-
} catch (error) {
|
|
179
|
-
console.error(`Error reading documentation ${file}:`, error.message);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
await mkdir(DATA_DIR, { recursive: true });
|
|
184
|
-
await writeFile(
|
|
185
|
-
join(DATA_DIR, 'tokens-documentation.json'),
|
|
186
|
-
JSON.stringify(documentation, null, 2)
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
console.log(`✅ Generated tokens documentation`);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
190
|
/**
|
|
193
191
|
* Generate design tokens
|
|
194
192
|
*/
|
|
@@ -237,7 +235,6 @@ async function main() {
|
|
|
237
235
|
try {
|
|
238
236
|
await generateComponentMetadata();
|
|
239
237
|
await generateDesignTokens();
|
|
240
|
-
await generateTokensDocumentation();
|
|
241
238
|
console.log('✅ Data generation complete');
|
|
242
239
|
} catch (error) {
|
|
243
240
|
console.error('Error generating data:', error);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: brick-actions
|
|
3
|
-
version: 0.1.5
|
|
4
|
-
category: Tooling
|
|
5
|
-
tags: [github-actions, automation, eik, publishing, ci-cd]
|
|
6
|
-
use_cases: [ci-cd, automated-publishing, eik-deployment]
|
|
7
|
-
related: []
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Brick Actions
|
|
11
|
-
|
|
12
|
-
Custom JavaScript GitHub Actions used to automate packaging and publishing to Eik when packages are published to NPM.
|
|
13
|
-
|
|
14
|
-
## Key Capabilities
|
|
15
|
-
|
|
16
|
-
- Automatically publishes packages to Eik CDN after NPM publication
|
|
17
|
-
- Filters packages based on Eik configuration in package.json
|
|
18
|
-
- Integrates with Changesets workflow for version management
|
|
19
|
-
- Validates required secrets/tokens before execution
|
|
20
|
-
|
|
21
|
-
## Technical Details
|
|
22
|
-
|
|
23
|
-
- **Type**: GitHub Action (JavaScript)
|
|
24
|
-
- **Main**: dist/index.js
|
|
25
|
-
- **Build Tool**: @vercel/ncc
|
|
26
|
-
- **Dependencies**: @actions/core, @actions/exec, @actions/github, @eik/cli, @manypkg/get-packages
|
|
27
|
-
|
|
28
|
-
## How It Works
|
|
29
|
-
|
|
30
|
-
1. Triggered when Changesets publishes packages to NPM
|
|
31
|
-
2. Receives `publishedPackages` as input
|
|
32
|
-
3. Filters packages that have `eik` configuration in package.json
|
|
33
|
-
4. Runs `eik package` command with proper credentials
|
|
34
|
-
5. Publishes to Eik CDN at https://assets.acdn.no
|
|
35
|
-
|
|
36
|
-
## Development
|
|
37
|
-
|
|
38
|
-
### Building
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm run build-index
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
This uses @vercel/ncc to compile code and modules into a single distribution file.
|
|
45
|
-
|
|
46
|
-
### Testing
|
|
47
|
-
|
|
48
|
-
Can be tested locally using [Act](https://github.com/nektos/act) with environment variables via dotenv.
|
|
49
|
-
|
|
50
|
-
## Important Notes
|
|
51
|
-
|
|
52
|
-
- Not a Brick web component - this is tooling for CI/CD
|
|
53
|
-
- Changesets handles versioning and CHANGELOG updates
|
|
54
|
-
- Does not commit `.eik/integrity.json` files
|
|
55
|
-
- Requires proper Eik credentials in GitHub secrets
|
|
56
|
-
|
|
57
|
-
## Version
|
|
58
|
-
|
|
59
|
-
Current version: 0.1.5
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: brick-alt-teaser
|
|
3
|
-
version: 8.0.65
|
|
4
|
-
selector: brick-alt-teaser-v8
|
|
5
|
-
category: Media
|
|
6
|
-
tags: [teaser, article, news, card, content-preview, media, alt-theme]
|
|
7
|
-
use_cases: [news-listing, content-cards, article-preview, editorial-content, opinion-pieces, video-teasers, photo-galleries, reviews, featured-content]
|
|
8
|
-
related: [brick-image, brick-player, brick-pill, brick-icon]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Brick Alt Teaser
|
|
12
|
-
|
|
13
|
-
A flexible article teaser component designed for the Alt theme, supporting multiple content types including standard articles, features, opinions, videos, galleries, and reviews.
|
|
14
|
-
|
|
15
|
-
## Key Capabilities
|
|
16
|
-
|
|
17
|
-
- Multiple layout variants: standard article, feature, opinion, video, gallery, and review
|
|
18
|
-
- Responsive image handling with srcset and custom aspect ratios
|
|
19
|
-
- Video playback integration via brick-player
|
|
20
|
-
- Photo gallery support with image count indicator
|
|
21
|
-
- Review ratings displayed as dice icons
|
|
22
|
-
- Opinion pieces with author bylines and profile images
|
|
23
|
-
- Countdown timer support for time-sensitive content
|
|
24
|
-
- Analytics integration with ADP (Amedia Data Platform)
|
|
25
|
-
- Customizable background colors for visual categorization
|
|
26
|
-
- Accessibility features including ARIA labels and screen reader support
|
|
27
|
-
|
|
28
|
-
## Props/Attributes
|
|
29
|
-
|
|
30
|
-
| Attribute | Type | Default | Required | Description |
|
|
31
|
-
|-----------|------|---------|----------|-------------|
|
|
32
|
-
| `title` | string | '' | yes | Main headline of the article |
|
|
33
|
-
| `link` | string | '' | yes | URL to the full article |
|
|
34
|
-
| `publication` | string | '' | no | Publication domain (e.g., "www.tb.no") |
|
|
35
|
-
| `name` | string | '' | no | Publication name (e.g., "Tønsbergs Blad") |
|
|
36
|
-
| `articleId` | string | '' | no | Unique article identifier for tracking |
|
|
37
|
-
| `published` | string | '' | no | Publication date/time (supports ISO 8601 or human-readable format) |
|
|
38
|
-
| `readEstimate` | string | '' | no | Estimated reading time (e.g., "Lesetid 4 min") |
|
|
39
|
-
| `image` | string | '' | no | Primary image URL |
|
|
40
|
-
| `srcset` | string | '' | no | Responsive image srcset for different screen sizes |
|
|
41
|
-
| `imagesizes` | string | '' | no | Image sizes attribute for responsive images |
|
|
42
|
-
| `imageRatio` | string | '' | no | Custom aspect ratio (e.g., "16/9", "4/3", "1.33") |
|
|
43
|
-
| `aoi` | number | - | no | Area of interest width for image cropping |
|
|
44
|
-
| `altText` | string | '' | no | Alternative text for images |
|
|
45
|
-
| `tags` | string | '' | no | Comma-separated content tags |
|
|
46
|
-
| `pretitle` | string | '' | no | Text displayed above the main title (for features) |
|
|
47
|
-
| `feature` | boolean | false | no | Enables feature layout variant |
|
|
48
|
-
| `opinion` | boolean | false | no | Enables opinion layout variant |
|
|
49
|
-
| `review` | number | - | no | Review rating (1-6, displayed as dice icons) |
|
|
50
|
-
| `gallery` | string | '' | no | Comma-separated list of gallery image URLs |
|
|
51
|
-
| `isVideo` | boolean | false | no | Enables video teaser mode |
|
|
52
|
-
| `videoId` | string | '' | no | Video identifier for brick-player |
|
|
53
|
-
| `playerId` | string | '' | no | Flowplayer player ID |
|
|
54
|
-
| `authorName` | string | '' | no | Author name(s) for opinion pieces (comma-separated for multiple) |
|
|
55
|
-
| `authorRole` | string | '' | no | Author role/title for opinion pieces |
|
|
56
|
-
| `authorImage` | string | '' | no | Author profile image URL |
|
|
57
|
-
| `backgroundColor` | string | '#d3d9de' | no | Background color for the teaser card |
|
|
58
|
-
| `countdown` | string | '' | no | ISO 8601 date for countdown timer |
|
|
59
|
-
| `menuOnClickEventName` | string | '' | no | Custom event name dispatched when menu is clicked |
|
|
60
|
-
| `publicationOnHoverEventName` | string | '' | no | Custom event name dispatched on publication logo hover |
|
|
61
|
-
| `siteId` | string | '' | no | Site identifier for analytics |
|
|
62
|
-
| `small` | boolean | false | no | Enables compact layout variant |
|
|
63
|
-
|
|
64
|
-
## Examples
|
|
65
|
-
|
|
66
|
-
### Basic Article Teaser
|
|
67
|
-
|
|
68
|
-
```html
|
|
69
|
-
<brick-alt-teaser-v8
|
|
70
|
-
title="Harvard: Fem av de beste treningsøvelsene du noensinne kan gjøre"
|
|
71
|
-
link="https://example.com/article/123"
|
|
72
|
-
publication="www.tb.no"
|
|
73
|
-
name="Tønsbergs Blad"
|
|
74
|
-
published="i dag 13:37"
|
|
75
|
-
readEstimate="Lesetid 4 min"
|
|
76
|
-
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
77
|
-
srcset="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg 880w, https://g.acdn.no/api/reflex/v1/image/resize/1280/example.jpg 1280w"
|
|
78
|
-
articleId="5-95-91371"
|
|
79
|
-
tags="Utvikling"
|
|
80
|
-
backgroundColor="#D3D9DE"
|
|
81
|
-
>
|
|
82
|
-
</brick-alt-teaser-v8>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Feature Teaser
|
|
86
|
-
|
|
87
|
-
```html
|
|
88
|
-
<brick-alt-teaser-v8
|
|
89
|
-
feature="true"
|
|
90
|
-
pretitle="Stikktittel for feature"
|
|
91
|
-
title="Tittel for feature teaser"
|
|
92
|
-
publication="www.akersposten.no"
|
|
93
|
-
name="Akersposten"
|
|
94
|
-
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
95
|
-
altText="Beskrivende alt-tekst"
|
|
96
|
-
link="https://example.com/feature/456"
|
|
97
|
-
backgroundColor="#DEDCD3"
|
|
98
|
-
>
|
|
99
|
-
</brick-alt-teaser-v8>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Video Teaser
|
|
103
|
-
|
|
104
|
-
```html
|
|
105
|
-
<brick-alt-teaser-v8
|
|
106
|
-
title="Tittel for video teaser"
|
|
107
|
-
isVideo="true"
|
|
108
|
-
videoId="ea507f6b-ca59-4ae6-a5fa-942fd02b458a"
|
|
109
|
-
playerId="3689c16b-4cb9-4a36-baf4-2c3aa7fcc811"
|
|
110
|
-
publication="www.tb.no"
|
|
111
|
-
name="Tønsbergs Blad"
|
|
112
|
-
published="i dag 13:37"
|
|
113
|
-
readEstimate="Spilletid 13:37 min"
|
|
114
|
-
link="https://example.com/video/789"
|
|
115
|
-
backgroundColor="#D3DED6"
|
|
116
|
-
>
|
|
117
|
-
</brick-alt-teaser-v8>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Opinion Teaser
|
|
121
|
-
|
|
122
|
-
```html
|
|
123
|
-
<brick-alt-teaser-v8
|
|
124
|
-
opinion="true"
|
|
125
|
-
title="Mening om viktig samfunnsspørsmål"
|
|
126
|
-
authorName="Hege Breen Bakken"
|
|
127
|
-
authorRole="Politisk redaktør i Drammens Tidende"
|
|
128
|
-
authorImage="https://image.journalisten.no/357695.jpg"
|
|
129
|
-
publication="www.dt.no"
|
|
130
|
-
name="Drammens Tidende"
|
|
131
|
-
published="i dag 13:37"
|
|
132
|
-
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
133
|
-
link="https://example.com/opinion/101"
|
|
134
|
-
>
|
|
135
|
-
</brick-alt-teaser-v8>
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Gallery Teaser
|
|
139
|
-
|
|
140
|
-
```html
|
|
141
|
-
<brick-alt-teaser-v8
|
|
142
|
-
title="Bildegalleri fra årets arrangement"
|
|
143
|
-
gallery="https://example.com/img1.jpg, https://example.com/img2.jpg, https://example.com/img3.jpg"
|
|
144
|
-
image="https://example.com/img1.jpg"
|
|
145
|
-
readEstimate="3 bilder"
|
|
146
|
-
publication="www.tb.no"
|
|
147
|
-
name="Tønsbergs Blad"
|
|
148
|
-
published="i dag 13:37"
|
|
149
|
-
link="https://example.com/gallery/202"
|
|
150
|
-
altText="Bilder fra arrangementet"
|
|
151
|
-
>
|
|
152
|
-
</brick-alt-teaser-v8>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Review Teaser
|
|
156
|
-
|
|
157
|
-
```html
|
|
158
|
-
<brick-alt-teaser-v8
|
|
159
|
-
title="Anmeldelse: Årets beste film"
|
|
160
|
-
review="5"
|
|
161
|
-
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
162
|
-
publication="www.tb.no"
|
|
163
|
-
name="Tønsbergs Blad"
|
|
164
|
-
published="i dag 13:37"
|
|
165
|
-
readEstimate="Lesetid 6 min"
|
|
166
|
-
link="https://example.com/review/303"
|
|
167
|
-
altText="Filmplakat"
|
|
168
|
-
>
|
|
169
|
-
</brick-alt-teaser-v8>
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Programmatic Usage
|
|
173
|
-
|
|
174
|
-
```javascript
|
|
175
|
-
import { BrickAltTeaser } from '@amedia/brick-alt-teaser';
|
|
176
|
-
|
|
177
|
-
// The component auto-registers as brick-alt-teaser-v8
|
|
178
|
-
// You can also manually define it:
|
|
179
|
-
if (!customElements.get('brick-alt-teaser-v8')) {
|
|
180
|
-
customElements.define('brick-alt-teaser-v8', BrickAltTeaser);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Create and append programmatically
|
|
184
|
-
const teaser = document.createElement('brick-alt-teaser-v8');
|
|
185
|
-
teaser.setAttribute('title', 'My Article Title');
|
|
186
|
-
teaser.setAttribute('link', 'https://example.com/article');
|
|
187
|
-
teaser.setAttribute('image', 'https://example.com/image.jpg');
|
|
188
|
-
document.querySelector('#container').appendChild(teaser);
|
|
189
|
-
|
|
190
|
-
// Listen to custom events
|
|
191
|
-
teaser.addEventListener('my-menu-event', (event) => {
|
|
192
|
-
console.log('Menu clicked');
|
|
193
|
-
});
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Accessibility
|
|
197
|
-
|
|
198
|
-
- **ARIA Labels**: Each teaser includes a comprehensive screen reader label combining title, publication, and date
|
|
199
|
-
- **Keyboard Navigation**: Single tab stop per teaser (title link only) to avoid redundant navigation
|
|
200
|
-
- **Focus Indicators**: Clear 2px outline on all focusable elements
|
|
201
|
-
- **Semantic HTML**: Uses `<article>` with Schema.org NewsArticle markup
|
|
202
|
-
- **Alt Text Support**: Images can include descriptive alternative text via `altText` attribute
|
|
203
|
-
- **Skip Decorative Images**: Image links are `aria-hidden` to prevent duplicate announcements
|
|
204
|
-
- **Menu Button**: Options menu includes proper `aria-expanded` state management
|
|
205
|
-
|
|
206
|
-
## Analytics Integration
|
|
207
|
-
|
|
208
|
-
The component includes built-in ADP (Amedia Data Platform) tracking:
|
|
209
|
-
|
|
210
|
-
- **Teaser Clicks**: Automatically tagged with `data-adp-clickLabel="teaser"` and `data-adp-clickValue="read-article"`
|
|
211
|
-
- **Menu Interactions**: Menu button tagged with `data-adp-clickvalue="open-menu"`
|
|
212
|
-
- **Publication Tracking**: Publication logo includes hover tracking
|
|
213
|
-
- **Custom Events**: Dispatches custom events via `menuOnClickEventName` and `publicationOnHoverEventName`
|
|
214
|
-
- **Article Metadata**: Includes Schema.org itemprops for structured data tracking
|
|
215
|
-
|
|
216
|
-
## Layout Variants
|
|
217
|
-
|
|
218
|
-
The component automatically selects layout based on attributes:
|
|
219
|
-
|
|
220
|
-
- **Opinion Layout**: Triggered by `opinion="true"` - Image above title with author byline
|
|
221
|
-
- **Video/Gallery Layout**: Triggered by `isVideo="true"` or `gallery` attribute - Media at top
|
|
222
|
-
- **Feature Layout**: Triggered by `feature="true"` - Enhanced styling with optional pretitle
|
|
223
|
-
- **Standard Layout**: Default layout with image below title
|
|
224
|
-
- **Small Layout**: Triggered by `small="true"` - Compact horizontal layout
|
|
225
|
-
|
|
226
|
-
## Technical Details
|
|
227
|
-
|
|
228
|
-
- **Custom Element**: `brick-alt-teaser-v8`
|
|
229
|
-
- **Base Class**: HTMLElement (vanilla web component)
|
|
230
|
-
- **Dependencies**:
|
|
231
|
-
- `@amedia/brick-tokens` - Design tokens and styling
|
|
232
|
-
- `@amedia/brick-image` - Image rendering
|
|
233
|
-
- `@amedia/brick-player` - Video playback
|
|
234
|
-
- `@amedia/brick-pill` - Tag/pill components
|
|
235
|
-
- `@amedia/brick-icon` - Icon rendering
|
|
236
|
-
- **Renders as**: `<article>` with nested semantic HTML
|
|
237
|
-
- **Styling**: CSS-in-JS via Stitches with design tokens
|
|
238
|
-
- **Schema.org**: Implements NewsArticle microdata
|
|
239
|
-
|
|
240
|
-
## Important Notes
|
|
241
|
-
|
|
242
|
-
- **Alt Team Component**: Built and maintained by the Alt theme team. Consult with them before using in other contexts.
|
|
243
|
-
- **Image Srcset**: As of v8.0.0, image srcset must be provided externally with correct sizes and encoding - it is no longer auto-generated
|
|
244
|
-
- **Date Formats**: The `published` attribute accepts both human-readable strings ("i dag 13:37") and ISO 8601 timestamps
|
|
245
|
-
- **Multiple Authors**: Opinion pieces support multiple comma-separated authors, which will display with ellipsis overflow
|
|
246
|
-
- **Background Colors**: Common background colors follow design token patterns for subject categorization (default, nature, sport, health, culture, economy)
|
|
247
|
-
- **Review Ratings**: Review attribute accepts values 1-6, displayed as dice icons
|
|
248
|
-
- **Video Player**: Requires valid Flowplayer player ID and video ID for video teasers
|
|
249
|
-
- **Countdown**: Countdown attribute expects ISO 8601 date format for time-sensitive content
|
|
250
|
-
|
|
251
|
-
## Version
|
|
252
|
-
|
|
253
|
-
Current version: 8.0.65
|