@amedia/brick-mcp 0.0.0-vCLR-20260313124546
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 +297 -0
- package/data/components/brick-actions.md +59 -0
- package/data/components/brick-alt-teaser.md +264 -0
- package/data/components/brick-avatar.md +299 -0
- package/data/components/brick-button.md +373 -0
- package/data/components/brick-card.md +359 -0
- package/data/components/brick-carousel.md +355 -0
- package/data/components/brick-classnames.md +147 -0
- package/data/components/brick-countdown.md +191 -0
- package/data/components/brick-dialog.md +458 -0
- package/data/components/brick-fonts.md +389 -0
- package/data/components/brick-helloworld.md +228 -0
- package/data/components/brick-icon.md +274 -0
- package/data/components/brick-icons.md +570 -0
- package/data/components/brick-illustrations.md +604 -0
- package/data/components/brick-image.md +361 -0
- package/data/components/brick-input.md +600 -0
- package/data/components/brick-mcp.md +259 -0
- package/data/components/brick-nifs.md +164 -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 +197 -0
- package/data/components/brick-tooltip.md +249 -0
- package/data/components-metadata.json +327 -0
- package/data/tokens-documentation.json +6 -0
- package/data/tokens.json +5008 -0
- package/dist/data/components/brick-actions.md +59 -0
- package/dist/data/components/brick-alt-teaser.md +264 -0
- package/dist/data/components/brick-avatar.md +299 -0
- package/dist/data/components/brick-button.md +373 -0
- package/dist/data/components/brick-card.md +359 -0
- package/dist/data/components/brick-carousel.md +355 -0
- package/dist/data/components/brick-classnames.md +147 -0
- package/dist/data/components/brick-countdown.md +191 -0
- package/dist/data/components/brick-dialog.md +458 -0
- package/dist/data/components/brick-fonts.md +389 -0
- package/dist/data/components/brick-helloworld.md +228 -0
- package/dist/data/components/brick-icon.md +274 -0
- package/dist/data/components/brick-icons.md +570 -0
- package/dist/data/components/brick-illustrations.md +604 -0
- package/dist/data/components/brick-image.md +361 -0
- package/dist/data/components/brick-input.md +600 -0
- package/dist/data/components/brick-mcp.md +259 -0
- package/dist/data/components/brick-nifs.md +164 -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 +197 -0
- package/dist/data/components/brick-tooltip.md +249 -0
- package/dist/data/components-metadata.json +327 -0
- package/dist/data/tokens-documentation.json +6 -0
- package/dist/data/tokens.json +5008 -0
- package/dist/http.js +318 -0
- package/dist/http.js.map +7 -0
- package/dist/index.js +268 -0
- package/dist/index.js.map +7 -0
- package/package.json +86 -0
- package/scripts/generate-data.js +242 -0
package/README.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Brick MCP Server
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Brick MCP Server is a Model Context Protocol (MCP) server that provides AI assistants (like Claude Code or Copilot) with direct access to the Brick design system. It enables accurate, context-aware assistance when developers implement Brick components by exposing component documentation, design tokens, and usage examples through standardized MCP tools.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Follow the Amedia CLI guide available [here](https://amedia.slite.com/app/docs/6GMS-ASZ1r2rWM)
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The Brick MCP server can be run in two modes:
|
|
14
|
+
|
|
15
|
+
### Stdio Mode (for Claude Code)
|
|
16
|
+
|
|
17
|
+
The recommended way to use the MCP server with Claude Code is via npx:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Add to Claude Code
|
|
21
|
+
claude mcp add --transport stdio Brick -- npx -y @amedia/brick-mcp@latest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### HTTP Mode (for local development)
|
|
25
|
+
|
|
26
|
+
To run the MCP server as an HTTP service:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Fetch data folder
|
|
30
|
+
npm run build
|
|
31
|
+
# Development with watch mode
|
|
32
|
+
npm run dev:http
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The HTTP server exposes:
|
|
36
|
+
|
|
37
|
+
- `http://localhost:3000/health` - Health check endpoint
|
|
38
|
+
- `http://localhost:3000/sse` - SSE endpoint for MCP protocol communication
|
|
39
|
+
- `http://localhost:3000/message` - Message endpoint for client-to-server communication
|
|
40
|
+
|
|
41
|
+
To add to Claude run
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
claude mcp add Brick-http --transport sse --scope user -- http://0.0.0.0:3000/sse
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Environment Variables
|
|
48
|
+
|
|
49
|
+
- `PORT` - Server port (default: 3000)
|
|
50
|
+
- `HOST` - Server host (default: 0.0.0.0)
|
|
51
|
+
|
|
52
|
+
### What the MCP Server Provides
|
|
53
|
+
|
|
54
|
+
Once configured, you can ask Claude about Brick components, design tokens, and implementation patterns. The MCP server provides three main tools:
|
|
55
|
+
|
|
56
|
+
1. **`list-components`**: Discover all available Brick components with filtering by name, category, or tags
|
|
57
|
+
2. **`get-component-docs`**: Retrieve detailed documentation including MDX content, llm.txt summaries, examples, and Storybook links
|
|
58
|
+
3. **`get-design-tokens`**: Access design tokens filtered by category (colors, spacing, typography, shadows, borders) or theme, with available themes list and comprehensive documentation about the token system
|
|
59
|
+
|
|
60
|
+
## Goals
|
|
61
|
+
|
|
62
|
+
1. **Easy Discovery**: Enable AI to quickly list and search available Brick components
|
|
63
|
+
2. **Accurate Implementation**: Provide detailed component documentation including props, events, and accessibility guidelines
|
|
64
|
+
3. **Design Consistency**: Make design tokens easily accessible for consistent styling
|
|
65
|
+
4. **Best Practices**: Include usage examples and patterns from Storybook
|
|
66
|
+
5. **Developer Experience**: Reduce friction when implementing Brick components through AI-assisted development
|
|
67
|
+
|
|
68
|
+
## MCP Tools (Actions)
|
|
69
|
+
|
|
70
|
+
The MCP server exposes three tools that AI assistants can call to fetch information about the Brick design system. All data is pre-generated during the build process and bundled as JSON files, making the server fast and suitable for use as a standalone npm package.
|
|
71
|
+
|
|
72
|
+
### 1. `list-components`
|
|
73
|
+
|
|
74
|
+
List all available Brick components with optional filtering.
|
|
75
|
+
|
|
76
|
+
**Input**:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
{
|
|
80
|
+
filter?: string; // Filter by name, category, or tag
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Output**:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
{
|
|
88
|
+
components: Array<{
|
|
89
|
+
name: string; // e.g., "brick-button"
|
|
90
|
+
version: string; // e.g., "9.0.0"
|
|
91
|
+
selector: string; // e.g., "brick-button-v9"
|
|
92
|
+
description?: string;
|
|
93
|
+
category?: string; // Auto-categorized: Forms, Navigation, Layout, Feedback, Display, Utilities
|
|
94
|
+
tags?: string[]; // Auto-generated tags
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Example**: `{ "filter": "button" }` returns all button-related components.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 2. `get-component-docs`
|
|
104
|
+
|
|
105
|
+
Retrieve detailed documentation for one or more components.
|
|
106
|
+
|
|
107
|
+
**Input**:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
{
|
|
111
|
+
components: string[]; // e.g., ["brick-button", "brick-modal"]
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Output**:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
{
|
|
119
|
+
docs: Array<{
|
|
120
|
+
name: string;
|
|
121
|
+
version: string;
|
|
122
|
+
selector: string;
|
|
123
|
+
description?: string; // From llm.txt or MDX content
|
|
124
|
+
examples: {
|
|
125
|
+
webComponent?: string; // Extracted from MDX or auto-generated
|
|
126
|
+
storybook?: string; // Link to Chromatic Storybook
|
|
127
|
+
};
|
|
128
|
+
cdnPath?: string; // Eik CDN URL for the component
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Data Sources**:
|
|
134
|
+
|
|
135
|
+
- `llm.txt`: AI-friendly component summaries (if available)
|
|
136
|
+
- `.mdx` files: Full documentation from Storybook
|
|
137
|
+
- `package.json`: Version and description
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### 3. `get-design-tokens`
|
|
142
|
+
|
|
143
|
+
Access design tokens from brick-tokens with filtering options.
|
|
144
|
+
|
|
145
|
+
**Input**:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
{
|
|
149
|
+
category?: 'colors' | 'spacing' | 'typography' | 'shadows' | 'borders';
|
|
150
|
+
theme?: string; // e.g., "bergen", "alfa", "bt"
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Output**:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
{
|
|
158
|
+
tokens: Array<{
|
|
159
|
+
name: string; // e.g., "color-primary"
|
|
160
|
+
value: string; // e.g., "#0066CC"
|
|
161
|
+
type: string; // Token type from Design Tokens spec
|
|
162
|
+
description?: string;
|
|
163
|
+
category?: string;
|
|
164
|
+
theme?: string;
|
|
165
|
+
}>;
|
|
166
|
+
themes: string[]; // Available theme names (e.g., ["alfa", "bergen", "bt"])
|
|
167
|
+
documentation: {
|
|
168
|
+
anOverview?: string; // Overview of the design token system
|
|
169
|
+
formats?: string; // Information about token formats
|
|
170
|
+
naming?: string; // Token naming conventions
|
|
171
|
+
themes?: string; // Theme documentation
|
|
172
|
+
usage?: string; // Usage guidelines
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Data Sources**:
|
|
178
|
+
|
|
179
|
+
- Pre-built tokens from `brick-tokens/publications/publication/*.json`
|
|
180
|
+
- Documentation from `tokens-documentation.json`
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Usage Example
|
|
185
|
+
|
|
186
|
+
Once configured, Claude Code can use the MCP tools to answer questions about Brick:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
User: "I need to add a button to my app using Brick"
|
|
190
|
+
|
|
191
|
+
Claude: [Calls list-components with filter: "button"]
|
|
192
|
+
[Calls get-component-docs with components: ["brick-button"]]
|
|
193
|
+
|
|
194
|
+
"I can help you add a Brick button. Here's the brick-button-v9 component:
|
|
195
|
+
|
|
196
|
+
<brick-button-v9>Click me</brick-button-v9>
|
|
197
|
+
|
|
198
|
+
You can load it from the Eik CDN:
|
|
199
|
+
https://assets.acdn.no/pkg/@amedia/brick-button/9.0.0/brick-button.js
|
|
200
|
+
|
|
201
|
+
For detailed examples and variants, check the Storybook documentation:
|
|
202
|
+
https://master--60060c41f82e040021133482.chromatic.com/?path=/docs/bricks-brick-button
|
|
203
|
+
|
|
204
|
+
Would you like me to implement this in your file?"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Maintaining Component Documentation
|
|
210
|
+
|
|
211
|
+
The MCP server includes prompts to help maintain component documentation as components evolve.
|
|
212
|
+
|
|
213
|
+
### Updating Component Docs
|
|
214
|
+
|
|
215
|
+
Use [prompts/update-component-docs.md](prompts/update-component-docs.md) to check if component documentation needs updating based on version changes.
|
|
216
|
+
|
|
217
|
+
**When to use:**
|
|
218
|
+
|
|
219
|
+
- After component versions have been updated
|
|
220
|
+
- To audit which components have outdated documentation
|
|
221
|
+
- Before publishing a new version of the MCP server
|
|
222
|
+
|
|
223
|
+
**What it does:**
|
|
224
|
+
|
|
225
|
+
1. Compares versions in `data/components/*.md` frontmatter against `packages/*/package.json`
|
|
226
|
+
2. Identifies components with major or minor version changes (patch changes are skipped)
|
|
227
|
+
3. Generates updated documentation for components that need it
|
|
228
|
+
4. Provides a summary of what was updated
|
|
229
|
+
|
|
230
|
+
**Example usage with Claude Code:**
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
User: "Check if any component docs need updating using prompts/update-component-docs.md"
|
|
234
|
+
|
|
235
|
+
Claude: [Reads the prompt file and follows the instructions]
|
|
236
|
+
[Checks all components in data/components/]
|
|
237
|
+
[Identifies version mismatches]
|
|
238
|
+
[Updates documentation for components with major/minor changes]
|
|
239
|
+
|
|
240
|
+
## Documentation Update Summary
|
|
241
|
+
|
|
242
|
+
### Components Checked: 45
|
|
243
|
+
|
|
244
|
+
### Updates Required:
|
|
245
|
+
- brick-modal: 3.2.1 → 4.0.0 (major change)
|
|
246
|
+
- brick-image: 6.0.5 → 6.1.0 (minor change)
|
|
247
|
+
|
|
248
|
+
### Up to Date: 42 components
|
|
249
|
+
|
|
250
|
+
### Skipped (patch changes only):
|
|
251
|
+
- brick-button: 9.0.2 → 9.0.5
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The prompt references [prompts/generate-llm-docs.md](prompts/generate-llm-docs.md) for the documentation generation process.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
### Adding New Tools
|
|
259
|
+
|
|
260
|
+
To add a new MCP tool:
|
|
261
|
+
|
|
262
|
+
1. Create a new file in `src/tools/yourTool.ts`
|
|
263
|
+
2. Implement the tool function with input/output types using Zod
|
|
264
|
+
3. Register the tool in `src/server.ts` using `server.registerTool()`
|
|
265
|
+
4. Update this README with tool documentation
|
|
266
|
+
|
|
267
|
+
### Publishing
|
|
268
|
+
|
|
269
|
+
The package is configured to publish to npm:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# From the Brick root
|
|
273
|
+
# 1. Make your changes and create a changeset
|
|
274
|
+
npx changeset
|
|
275
|
+
# 2. Create a PR - merging will trigger a "Version Packages" PR
|
|
276
|
+
# 3. Merge the "Version Packages" PR to publish to npm
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
For snapshot releases (testing pre-release versions):
|
|
280
|
+
|
|
281
|
+
1. Create a changeset and then run the [snapshot GitHub action](https://github.com/amedia/brick/actions/workflows/snapshotRelease.yml) for your branch and this package.
|
|
282
|
+
|
|
283
|
+
After publishing, the package can be used via:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
npx @amedia/brick-mcp # Run the latest version
|
|
287
|
+
npm install @amedia/brick-mcp # Install in your project
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## References
|
|
293
|
+
|
|
294
|
+
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
295
|
+
- [MCP Specification](https://spec.modelcontextprotocol.io/)
|
|
296
|
+
- [Brick Design System](https://www.brick.api.no)
|
|
297
|
+
- [Chromatic Storybook](https://master--60060c41f82e040021133482.chromatic.com/)
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
|
@@ -0,0 +1,264 @@
|
|
|
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:
|
|
8
|
+
[
|
|
9
|
+
news-listing,
|
|
10
|
+
content-cards,
|
|
11
|
+
article-preview,
|
|
12
|
+
editorial-content,
|
|
13
|
+
opinion-pieces,
|
|
14
|
+
video-teasers,
|
|
15
|
+
photo-galleries,
|
|
16
|
+
reviews,
|
|
17
|
+
featured-content,
|
|
18
|
+
]
|
|
19
|
+
related: [brick-image, brick-player, brick-pill, brick-icon]
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Brick Alt Teaser
|
|
23
|
+
|
|
24
|
+
A flexible article teaser component designed for the Alt theme, supporting multiple content types including standard articles, features, opinions, videos, galleries, and reviews.
|
|
25
|
+
|
|
26
|
+
## Key Capabilities
|
|
27
|
+
|
|
28
|
+
- Multiple layout variants: standard article, feature, opinion, video, gallery, and review
|
|
29
|
+
- Responsive image handling with srcset and custom aspect ratios
|
|
30
|
+
- Video playback integration via brick-player
|
|
31
|
+
- Photo gallery support with image count indicator
|
|
32
|
+
- Review ratings displayed as dice icons
|
|
33
|
+
- Opinion pieces with author bylines and profile images
|
|
34
|
+
- Countdown timer support for time-sensitive content
|
|
35
|
+
- Analytics integration with ADP (Amedia Data Platform)
|
|
36
|
+
- Customizable background colors for visual categorization
|
|
37
|
+
- Accessibility features including ARIA labels and screen reader support
|
|
38
|
+
|
|
39
|
+
## Props/Attributes
|
|
40
|
+
|
|
41
|
+
| Attribute | Type | Default | Required | Description |
|
|
42
|
+
| ----------------------------- | ------- | --------- | -------- | ------------------------------------------------------------------ |
|
|
43
|
+
| `title` | string | '' | yes | Main headline of the article |
|
|
44
|
+
| `link` | string | '' | yes | URL to the full article |
|
|
45
|
+
| `publication` | string | '' | no | Publication domain (e.g., "www.tb.no") |
|
|
46
|
+
| `name` | string | '' | no | Publication name (e.g., "Tønsbergs Blad") |
|
|
47
|
+
| `articleId` | string | '' | no | Unique article identifier for tracking |
|
|
48
|
+
| `published` | string | '' | no | Publication date/time (supports ISO 8601 or human-readable format) |
|
|
49
|
+
| `readEstimate` | string | '' | no | Estimated reading time (e.g., "Lesetid 4 min") |
|
|
50
|
+
| `image` | string | '' | no | Primary image URL |
|
|
51
|
+
| `srcset` | string | '' | no | Responsive image srcset for different screen sizes |
|
|
52
|
+
| `imagesizes` | string | '' | no | Image sizes attribute for responsive images |
|
|
53
|
+
| `imageRatio` | string | '' | no | Custom aspect ratio (e.g., "16/9", "4/3", "1.33") |
|
|
54
|
+
| `aoi` | number | - | no | Area of interest width for image cropping |
|
|
55
|
+
| `altText` | string | '' | no | Alternative text for images |
|
|
56
|
+
| `tags` | string | '' | no | Comma-separated content tags |
|
|
57
|
+
| `pretitle` | string | '' | no | Text displayed above the main title (for features) |
|
|
58
|
+
| `feature` | boolean | false | no | Enables feature layout variant |
|
|
59
|
+
| `opinion` | boolean | false | no | Enables opinion layout variant |
|
|
60
|
+
| `review` | number | - | no | Review rating (1-6, displayed as dice icons) |
|
|
61
|
+
| `gallery` | string | '' | no | Comma-separated list of gallery image URLs |
|
|
62
|
+
| `isVideo` | boolean | false | no | Enables video teaser mode |
|
|
63
|
+
| `videoId` | string | '' | no | Video identifier for brick-player |
|
|
64
|
+
| `playerId` | string | '' | no | Flowplayer player ID |
|
|
65
|
+
| `authorName` | string | '' | no | Author name(s) for opinion pieces (comma-separated for multiple) |
|
|
66
|
+
| `authorRole` | string | '' | no | Author role/title for opinion pieces |
|
|
67
|
+
| `authorImage` | string | '' | no | Author profile image URL |
|
|
68
|
+
| `backgroundColor` | string | '#d3d9de' | no | Background color for the teaser card |
|
|
69
|
+
| `countdown` | string | '' | no | ISO 8601 date for countdown timer |
|
|
70
|
+
| `menuOnClickEventName` | string | '' | no | Custom event name dispatched when menu is clicked |
|
|
71
|
+
| `publicationOnHoverEventName` | string | '' | no | Custom event name dispatched on publication logo hover |
|
|
72
|
+
| `siteId` | string | '' | no | Site identifier for analytics |
|
|
73
|
+
| `small` | boolean | false | no | Enables compact layout variant |
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
### Basic Article Teaser
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<brick-alt-teaser-v8
|
|
81
|
+
title="Harvard: Fem av de beste treningsøvelsene du noensinne kan gjøre"
|
|
82
|
+
link="https://example.com/article/123"
|
|
83
|
+
publication="www.tb.no"
|
|
84
|
+
name="Tønsbergs Blad"
|
|
85
|
+
published="i dag 13:37"
|
|
86
|
+
readEstimate="Lesetid 4 min"
|
|
87
|
+
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
88
|
+
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"
|
|
89
|
+
articleId="5-95-91371"
|
|
90
|
+
tags="Utvikling"
|
|
91
|
+
backgroundColor="#D3D9DE"
|
|
92
|
+
>
|
|
93
|
+
</brick-alt-teaser-v8>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Feature Teaser
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<brick-alt-teaser-v8
|
|
100
|
+
feature="true"
|
|
101
|
+
pretitle="Stikktittel for feature"
|
|
102
|
+
title="Tittel for feature teaser"
|
|
103
|
+
publication="www.akersposten.no"
|
|
104
|
+
name="Akersposten"
|
|
105
|
+
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
106
|
+
altText="Beskrivende alt-tekst"
|
|
107
|
+
link="https://example.com/feature/456"
|
|
108
|
+
backgroundColor="#DEDCD3"
|
|
109
|
+
>
|
|
110
|
+
</brick-alt-teaser-v8>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Video Teaser
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<brick-alt-teaser-v8
|
|
117
|
+
title="Tittel for video teaser"
|
|
118
|
+
isVideo="true"
|
|
119
|
+
videoId="ea507f6b-ca59-4ae6-a5fa-942fd02b458a"
|
|
120
|
+
playerId="3689c16b-4cb9-4a36-baf4-2c3aa7fcc811"
|
|
121
|
+
publication="www.tb.no"
|
|
122
|
+
name="Tønsbergs Blad"
|
|
123
|
+
published="i dag 13:37"
|
|
124
|
+
readEstimate="Spilletid 13:37 min"
|
|
125
|
+
link="https://example.com/video/789"
|
|
126
|
+
backgroundColor="#D3DED6"
|
|
127
|
+
>
|
|
128
|
+
</brick-alt-teaser-v8>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Opinion Teaser
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<brick-alt-teaser-v8
|
|
135
|
+
opinion="true"
|
|
136
|
+
title="Mening om viktig samfunnsspørsmål"
|
|
137
|
+
authorName="Hege Breen Bakken"
|
|
138
|
+
authorRole="Politisk redaktør i Drammens Tidende"
|
|
139
|
+
authorImage="https://image.journalisten.no/357695.jpg"
|
|
140
|
+
publication="www.dt.no"
|
|
141
|
+
name="Drammens Tidende"
|
|
142
|
+
published="i dag 13:37"
|
|
143
|
+
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
144
|
+
link="https://example.com/opinion/101"
|
|
145
|
+
>
|
|
146
|
+
</brick-alt-teaser-v8>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Gallery Teaser
|
|
150
|
+
|
|
151
|
+
```html
|
|
152
|
+
<brick-alt-teaser-v8
|
|
153
|
+
title="Bildegalleri fra årets arrangement"
|
|
154
|
+
gallery="https://example.com/img1.jpg, https://example.com/img2.jpg, https://example.com/img3.jpg"
|
|
155
|
+
image="https://example.com/img1.jpg"
|
|
156
|
+
readEstimate="3 bilder"
|
|
157
|
+
publication="www.tb.no"
|
|
158
|
+
name="Tønsbergs Blad"
|
|
159
|
+
published="i dag 13:37"
|
|
160
|
+
link="https://example.com/gallery/202"
|
|
161
|
+
altText="Bilder fra arrangementet"
|
|
162
|
+
>
|
|
163
|
+
</brick-alt-teaser-v8>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Review Teaser
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<brick-alt-teaser-v8
|
|
170
|
+
title="Anmeldelse: Årets beste film"
|
|
171
|
+
review="5"
|
|
172
|
+
image="https://g.acdn.no/api/reflex/v1/image/resize/480/example.jpg"
|
|
173
|
+
publication="www.tb.no"
|
|
174
|
+
name="Tønsbergs Blad"
|
|
175
|
+
published="i dag 13:37"
|
|
176
|
+
readEstimate="Lesetid 6 min"
|
|
177
|
+
link="https://example.com/review/303"
|
|
178
|
+
altText="Filmplakat"
|
|
179
|
+
>
|
|
180
|
+
</brick-alt-teaser-v8>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Programmatic Usage
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
import { BrickAltTeaser } from '@amedia/brick-alt-teaser';
|
|
187
|
+
|
|
188
|
+
// The component auto-registers as brick-alt-teaser-v8
|
|
189
|
+
// You can also manually define it:
|
|
190
|
+
if (!customElements.get('brick-alt-teaser-v8')) {
|
|
191
|
+
customElements.define('brick-alt-teaser-v8', BrickAltTeaser);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Create and append programmatically
|
|
195
|
+
const teaser = document.createElement('brick-alt-teaser-v8');
|
|
196
|
+
teaser.setAttribute('title', 'My Article Title');
|
|
197
|
+
teaser.setAttribute('link', 'https://example.com/article');
|
|
198
|
+
teaser.setAttribute('image', 'https://example.com/image.jpg');
|
|
199
|
+
document.querySelector('#container').appendChild(teaser);
|
|
200
|
+
|
|
201
|
+
// Listen to custom events
|
|
202
|
+
teaser.addEventListener('my-menu-event', (event) => {
|
|
203
|
+
console.log('Menu clicked');
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Accessibility
|
|
208
|
+
|
|
209
|
+
- **ARIA Labels**: Each teaser includes a comprehensive screen reader label combining title, publication, and date
|
|
210
|
+
- **Keyboard Navigation**: Single tab stop per teaser (title link only) to avoid redundant navigation
|
|
211
|
+
- **Focus Indicators**: Clear 2px outline on all focusable elements
|
|
212
|
+
- **Semantic HTML**: Uses `<article>` with Schema.org NewsArticle markup
|
|
213
|
+
- **Alt Text Support**: Images can include descriptive alternative text via `altText` attribute
|
|
214
|
+
- **Skip Decorative Images**: Image links are `aria-hidden` to prevent duplicate announcements
|
|
215
|
+
- **Menu Button**: Options menu includes proper `aria-expanded` state management
|
|
216
|
+
|
|
217
|
+
## Analytics Integration
|
|
218
|
+
|
|
219
|
+
The component includes built-in ADP (Amedia Data Platform) tracking:
|
|
220
|
+
|
|
221
|
+
- **Teaser Clicks**: Automatically tagged with `data-adp-clickLabel="teaser"` and `data-adp-clickValue="read-article"`
|
|
222
|
+
- **Menu Interactions**: Menu button tagged with `data-adp-clickvalue="open-menu"`
|
|
223
|
+
- **Publication Tracking**: Publication logo includes hover tracking
|
|
224
|
+
- **Custom Events**: Dispatches custom events via `menuOnClickEventName` and `publicationOnHoverEventName`
|
|
225
|
+
- **Article Metadata**: Includes Schema.org itemprops for structured data tracking
|
|
226
|
+
|
|
227
|
+
## Layout Variants
|
|
228
|
+
|
|
229
|
+
The component automatically selects layout based on attributes:
|
|
230
|
+
|
|
231
|
+
- **Opinion Layout**: Triggered by `opinion="true"` - Image above title with author byline
|
|
232
|
+
- **Video/Gallery Layout**: Triggered by `isVideo="true"` or `gallery` attribute - Media at top
|
|
233
|
+
- **Feature Layout**: Triggered by `feature="true"` - Enhanced styling with optional pretitle
|
|
234
|
+
- **Standard Layout**: Default layout with image below title
|
|
235
|
+
- **Small Layout**: Triggered by `small="true"` - Compact horizontal layout
|
|
236
|
+
|
|
237
|
+
## Technical Details
|
|
238
|
+
|
|
239
|
+
- **Custom Element**: `brick-alt-teaser-v8`
|
|
240
|
+
- **Base Class**: HTMLElement (vanilla web component)
|
|
241
|
+
- **Dependencies**:
|
|
242
|
+
- `@amedia/brick-tokens` - Design tokens and styling
|
|
243
|
+
- `@amedia/brick-image` - Image rendering
|
|
244
|
+
- `@amedia/brick-player` - Video playback
|
|
245
|
+
- `@amedia/brick-pill` - Tag/pill components
|
|
246
|
+
- `@amedia/brick-icon` - Icon rendering
|
|
247
|
+
- **Renders as**: `<article>` with nested semantic HTML
|
|
248
|
+
- **Styling**: CSS-in-JS via Stitches with design tokens
|
|
249
|
+
- **Schema.org**: Implements NewsArticle microdata
|
|
250
|
+
|
|
251
|
+
## Important Notes
|
|
252
|
+
|
|
253
|
+
- **Alt Team Component**: Built and maintained by the Alt theme team. Consult with them before using in other contexts.
|
|
254
|
+
- **Image Srcset**: As of v8.0.0, image srcset must be provided externally with correct sizes and encoding - it is no longer auto-generated
|
|
255
|
+
- **Date Formats**: The `published` attribute accepts both human-readable strings ("i dag 13:37") and ISO 8601 timestamps
|
|
256
|
+
- **Multiple Authors**: Opinion pieces support multiple comma-separated authors, which will display with ellipsis overflow
|
|
257
|
+
- **Background Colors**: Common background colors follow design token patterns for subject categorization (default, nature, sport, health, culture, economy)
|
|
258
|
+
- **Review Ratings**: Review attribute accepts values 1-6, displayed as dice icons
|
|
259
|
+
- **Video Player**: Requires valid Flowplayer player ID and video ID for video teasers
|
|
260
|
+
- **Countdown**: Countdown attribute expects ISO 8601 date format for time-sensitive content
|
|
261
|
+
|
|
262
|
+
## Version
|
|
263
|
+
|
|
264
|
+
Current version: 8.0.65
|