@atelier-ui/create-workspace 0.3.1 → 0.3.3
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/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/src/generators/preset/files/claude/agents/component-review.no-figma.md +42 -0
- package/src/generators/preset/files/claude/commands/verify.no-figma.md +27 -0
- package/src/generators/preset/files/claude/skills/atelier-component/SKILL.md +7 -7
- package/src/generators/preset/files/claude/skills/atelier-component/SKILL.no-figma.md +63 -0
- package/src/generators/preset/files/storybook/angular/main.ts.template +8 -0
- package/src/generators/preset/files/storybook/angular/preview.ts.template +17 -0
- package/src/generators/preset/files/storybook/react/atl-button.stories.tsx +1 -1
- package/src/generators/preset/files/storybook/react/main.ts.template +8 -0
- package/src/generators/preset/files/storybook/react/preview.tsx +18 -1
- package/src/generators/preset/files/storybook/vue/atl-button.stories.ts.template +1 -1
- package/src/generators/preset/files/storybook/vue/main.ts.template +8 -0
- package/src/generators/preset/files/storybook/vue/preview.ts.template +18 -1
- package/src/generators/preset/files/testing/angular/test-setup.ts.template +6 -0
- package/src/generators/preset/files/testing/react/atl-button.spec.tsx +17 -18
- package/src/generators/preset/files/testing/react/test-setup-stories.ts.template +17 -0
- package/src/generators/preset/files/testing/react/vitest.unit.config.ts.template +1 -1
- package/src/generators/preset/files/testing/vue/atl-button.spec.ts.template +17 -21
- package/src/generators/preset/files/testing/vue/test-setup-stories.ts.template +17 -0
- package/src/generators/preset/files/testing/vue/vitest.unit.config.ts.template +1 -1
- package/src/generators/preset/files/tools/scripts/preflight.mjs +40 -0
- package/src/generators/preset/preset.js +613 -153
- package/src/generators/preset/preset.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
|
+
## 0.3.3 (2026-09-13)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **create-workspace:** no Figma, no contract — the switch is real now ([e9aa3f22](https://github.com/DominikPieper/atelier-ui/commit/e9aa3f22))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Claude Opus 5 (1M context)
|
|
10
|
+
- Dominik Pieper @DominikPieper
|
|
11
|
+
|
|
12
|
+
## 0.3.2 (2026-09-13)
|
|
13
|
+
|
|
14
|
+
### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- **storybook:** a theme control that is honest about what it does not test ([80840f05](https://github.com/DominikPieper/atelier-ui/commit/80840f05))
|
|
17
|
+
|
|
18
|
+
### ❤️ Thank You
|
|
19
|
+
|
|
20
|
+
- Claude Opus 5 (1M context)
|
|
21
|
+
- Dominik Pieper @DominikPieper
|
|
22
|
+
|
|
1
23
|
## 0.3.1 (2026-09-13)
|
|
2
24
|
|
|
3
25
|
### 🚀 Features
|
|
4
26
|
|
|
27
|
+
- **storybook:** stories run as tests in Vitest too, where the renderer allows it ([e3fecf5c](https://github.com/DominikPieper/atelier-ui/commit/e3fecf5c))
|
|
28
|
+
- **create-workspace:** the generated workspace is strict ([1cbe4517](https://github.com/DominikPieper/atelier-ui/commit/1cbe4517))
|
|
5
29
|
- **create-workspace:** the workspace is driven by npm, not by Nx knowledge ([e0824459](https://github.com/DominikPieper/atelier-ui/commit/e0824459))
|
|
6
30
|
|
|
31
|
+
### 🩹 Fixes
|
|
32
|
+
|
|
33
|
+
- **storybook:** the story-test setup imports its hooks instead of assuming globals ([09421473](https://github.com/DominikPieper/atelier-ui/commit/09421473))
|
|
34
|
+
|
|
7
35
|
### ❤️ Thank You
|
|
8
36
|
|
|
9
37
|
- Claude Opus 5 (1M context)
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: component-review
|
|
3
|
+
description: Reviews ONE existing component in this workspace against its Storybook stories and its accessibility posture — reports findings, never edits anything. Use for "review <component>", "check <component>'s story coverage", or an accessibility pass on one component before a PR. Do NOT use for general code review, cross-file refactors, or a change that also touches other components — read the diff directly for those instead.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are **component-review**. Given one component name (e.g. `AtlButton`), audit it against the two sources of truth this workspace has (this workspace was scaffolded without Figma, `--no-figma` — there is no contract file to check against; ADR-0144), and report what's missing or inconsistent. You never edit a file — a finding you can't fix by editing is exactly what this agent exists to surface.
|
|
9
|
+
|
|
10
|
+
## Finding the component
|
|
11
|
+
|
|
12
|
+
This is a single-framework scaffold — there is exactly one app, under
|
|
13
|
+
`workshop-*/src`. Inside it, the component's own source and its
|
|
14
|
+
`*.stories.*` file — the real props, variants, defaults, and `play` functions
|
|
15
|
+
live there.
|
|
16
|
+
|
|
17
|
+
Glob for both before reading anything else; do not assume a path.
|
|
18
|
+
|
|
19
|
+
## Review checklist
|
|
20
|
+
|
|
21
|
+
1. **Story coverage.** Read the stories file. Is there one story per variant
|
|
22
|
+
value and one per boolean state? A variant value with no story rendering
|
|
23
|
+
it is a finding.
|
|
24
|
+
2. **Accessibility posture.** Read the component source for ARIA attributes,
|
|
25
|
+
roles, and keyboard handling appropriate to its type (button, dialog,
|
|
26
|
+
listbox, …). Check the stories for a `play` function exercising keyboard
|
|
27
|
+
interaction, and for any `parameters.a11y` override — an override that
|
|
28
|
+
_disables_ a rule is itself a finding worth surfacing, not something to
|
|
29
|
+
accept silently because it's already there.
|
|
30
|
+
3. **Corroborate, read-only.** You may run `npm run check:unit` and
|
|
31
|
+
`nx lint <project>` to check your reading against the gates — read their
|
|
32
|
+
output, never edit in response to it. A clean gate proves the component
|
|
33
|
+
behaves as unit-tested and lints clean; it does not excuse skipping the
|
|
34
|
+
reading above, since missing story coverage or a disabled a11y rule can be
|
|
35
|
+
gate-clean and still wrong.
|
|
36
|
+
|
|
37
|
+
## Report shape
|
|
38
|
+
|
|
39
|
+
One finding per line, prefixed with a rough severity — `BLOCKING`,
|
|
40
|
+
`WORTH FIXING`, or `NIT` — naming the exact file (and line, where that helps).
|
|
41
|
+
End with a one-line verdict: ready to ship, or not yet and why. Do not edit
|
|
42
|
+
any file; that is the caller's job once they've read your findings.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run this workspace's four verification gates and report each one's exit code.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Run these four checks, in order, and report each one's exit code — never a
|
|
6
|
+
single pass/fail summary. A gate's result is its exit code: run it as
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
<command> > /tmp/verify-<name>.log 2>&1; echo $?
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
and read the log file afterwards. Never pipe a gate into `head` or `grep` to
|
|
13
|
+
read it — the pipe's own exit status is always `0`, which silently turns a
|
|
14
|
+
failing gate into a passing one.
|
|
15
|
+
|
|
16
|
+
1. `npm run check:format` — Prettier
|
|
17
|
+
2. `npm run check:stylelint` — the ported CSS-discipline rules
|
|
18
|
+
3. `npm run check:unit` — jsdom unit tests (components, composables, helpers)
|
|
19
|
+
4. `npm run check:stories` — every story, rendered in Chromium, axe-checked
|
|
20
|
+
|
|
21
|
+
This workspace was scaffolded without Figma (`--no-figma`) — there is no
|
|
22
|
+
`check:contracts` here (ADR-0144: a contract is the set of deliberate Figma ↔
|
|
23
|
+
code mismatches, and with no Figma there is nothing for one to disagree with).
|
|
24
|
+
|
|
25
|
+
Report a short table: check name → exit code → pass/fail. For any non-zero
|
|
26
|
+
exit code, show only the relevant lines from that check's log (not the whole
|
|
27
|
+
log) and stop there — do not attempt a fix unless asked to.
|
|
@@ -12,13 +12,13 @@ reach one, rather than pretending the step happened.
|
|
|
12
12
|
|
|
13
13
|
## What this workspace can check, and what it cannot
|
|
14
14
|
|
|
15
|
-
| Can | How
|
|
16
|
-
| ----------------------------------------------------------------------- |
|
|
17
|
-
| That a contract matches its Figma master's shape | `npm run check:contracts` against `tools/figma/snapshot.json`
|
|
18
|
-
| That every variant value and Boolean state has a story | the same check's `[COVERAGE]` findings
|
|
19
|
-
| That a component, composable, service, or helper behaves as unit-tested | `npm run check:unit` (jsdom, `@testing-library/*`)
|
|
20
|
-
| That every story renders, behaves, and passes axe | `npm run check:stories` (Chromium, headless)
|
|
21
|
-
| That CSS uses tokens rather than literals | `npm run check:stylelint`
|
|
15
|
+
| Can | How |
|
|
16
|
+
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| That a contract matches its Figma master's shape | `npm run check:contracts` against `tools/figma/snapshot.json` |
|
|
18
|
+
| That every variant value and Boolean state has a story | the same check's `[COVERAGE]` findings |
|
|
19
|
+
| That a component, composable, service, or helper behaves as unit-tested | `npm run check:unit` (jsdom, `@testing-library/*`) — for React/Vue, composing the component's own stories (`composeStories`) is preferred over restating their claims by hand; see `<app>/src/atl-button.spec.*` |
|
|
20
|
+
| That every story renders, behaves, and passes axe | `npm run check:stories` (Chromium, headless) |
|
|
21
|
+
| That CSS uses tokens rather than literals | `npm run check:stylelint` |
|
|
22
22
|
|
|
23
23
|
It cannot check design parity against the live Figma file unless the `figma-console` MCP is
|
|
24
24
|
wired in `.mcp.json` and the Desktop Bridge plugin is running. If it is not, the loop ends at
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: atelier-component
|
|
3
|
+
description: Build, change or review one component in this Atelier workshop workspace, running the component → stories → checks loop against the surfaces this workspace actually has (`<app>/src/atl-button.stories.*` as the pattern to copy, `npm run check:unit`, `npm run check:stories`). Use whenever the ask is to implement, add, port, restyle or review a component here, or when `check:unit` or `check:stories` report findings that need explaining. Do NOT use for Storybook configuration, for editing `.storybook/*`, or for work that is not about a single component.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# One component, in this workspace
|
|
7
|
+
|
|
8
|
+
This is a generated Atelier workshop workspace: one app (`workshop-<framework>`), one
|
|
9
|
+
framework, and a local Storybook on port 6006 — scaffolded without Figma (`--no-figma`),
|
|
10
|
+
so there is no contract loop here. ADR-0144: a contract is the set of deliberate Figma ↔
|
|
11
|
+
code mismatches, and with no Figma there is nothing for one to disagree with. The loop
|
|
12
|
+
below is the part of the Atelier monorepo's own loop that does not depend on Figma — say
|
|
13
|
+
so plainly if asked for design parity against a live file, rather than pretending this
|
|
14
|
+
workspace can check that.
|
|
15
|
+
|
|
16
|
+
## What this workspace can check, and what it cannot
|
|
17
|
+
|
|
18
|
+
| Can | How |
|
|
19
|
+
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| That a component, composable, service, or helper behaves as unit-tested | `npm run check:unit` (jsdom, `@testing-library/*`) — for React/Vue, composing the component's own stories (`composeStories`) is preferred over restating their claims by hand; see `<app>/src/atl-button.spec.*` |
|
|
21
|
+
| That every story renders, behaves, and passes axe | `npm run check:stories` (Chromium, headless) |
|
|
22
|
+
| That CSS uses tokens rather than literals | `npm run check:stylelint` |
|
|
23
|
+
|
|
24
|
+
This workspace has no Figma connection at all: no `figma-console` MCP entry in
|
|
25
|
+
`.mcp.json`, no contract file, no Figma snapshot, and no way to check design parity
|
|
26
|
+
against a live Figma file from here. If someone asks for that, say a Figma-enabled
|
|
27
|
+
workspace is a separate scaffold (`--figma`), not something this one can do.
|
|
28
|
+
|
|
29
|
+
## The loop
|
|
30
|
+
|
|
31
|
+
1. **Get the shape from the actual requirement, not from a guess.** Write down the
|
|
32
|
+
variant axes, the Boolean properties, and the interaction states before writing any
|
|
33
|
+
code — from a written spec, a screenshot, or a verbal description, whatever you were
|
|
34
|
+
handed. If you were only handed a vague description, say the states have not been
|
|
35
|
+
specified yet and ask for them.
|
|
36
|
+
2. **Write the component.** Tokens only — every colour, space and radius is a `--ui-*`
|
|
37
|
+
custom property. A raw hex or a hardcoded `2.5rem` is a stylelint error here, not a
|
|
38
|
+
style opinion.
|
|
39
|
+
3. **Write the stories, because the stories are the claims.** One story per variant value
|
|
40
|
+
and per Boolean state, `args`-based; one `play` per behaviour you are asserting, with a
|
|
41
|
+
real assertion. Copy the shape from `<app>/src/atl-button.stories.*`, which ships with
|
|
42
|
+
this workspace for exactly that purpose.
|
|
43
|
+
4. **Run the checks.** `npm run check:unit`, then `npm run check:stories`. Read the exit
|
|
44
|
+
code, not the last line of output.
|
|
45
|
+
|
|
46
|
+
## Never invent a prop
|
|
47
|
+
|
|
48
|
+
Before using any prop of a component from `@atelier-ui/<framework>`: call `docs-list` once to
|
|
49
|
+
get valid ids, then `docs-show` for the component. The answer comes back shaped for this
|
|
50
|
+
framework — two-way bindings and split Inputs/Outputs for Angular, `v-model` and typed slots
|
|
51
|
+
for Vue, JSX and `children` for React. If a prop is not in the docs, it does not exist; say so
|
|
52
|
+
rather than guessing from another library's naming.
|
|
53
|
+
|
|
54
|
+
For a component whose source lives in this workspace, its own types are the API.
|
|
55
|
+
|
|
56
|
+
## Definition of done
|
|
57
|
+
|
|
58
|
+
`npm run check:format`, `npm run check:stylelint`, `npm run check:unit` and
|
|
59
|
+
`npm run check:stories` each exit 0 — checked as exit codes, one at a time. Never pipe a
|
|
60
|
+
check into `head` or `grep` to read it: the pipe's status is 0 whatever the check did,
|
|
61
|
+
and that turns a red run into a green report.
|
|
62
|
+
|
|
63
|
+
Then say which of the four loop steps you actually ran, and which you could not.
|
|
@@ -15,6 +15,7 @@ const config: StorybookConfig = {
|
|
|
15
15
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
16
16
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
17
17
|
getAbsolutePath('@storybook/addon-docs'),
|
|
18
|
+
getAbsolutePath('@storybook/addon-themes'),
|
|
18
19
|
],
|
|
19
20
|
framework: {
|
|
20
21
|
name: getAbsolutePath('@storybook/angular-vite'),
|
|
@@ -29,6 +30,13 @@ const config: StorybookConfig = {
|
|
|
29
30
|
// explicit here so `components.json` carries real prop tables, not just
|
|
30
31
|
// id/name.
|
|
31
32
|
experimentalDocgenServer: true,
|
|
33
|
+
// `review-create` (wire name for the addon-mcp `review.create` method)
|
|
34
|
+
// registers for the deprecated `storybook ai` CLI proxy channel by default
|
|
35
|
+
// (unset ≠ false), but a direct MCP client — exactly what
|
|
36
|
+
// `claude mcp add --transport http storybook-local http://localhost:<port>/mcp`
|
|
37
|
+
// configures — only gets the tool when `experimentalReview` is explicitly
|
|
38
|
+
// `true` (verified against the installed 10.6.0 `storybook` dist).
|
|
39
|
+
experimentalReview: true,
|
|
32
40
|
},
|
|
33
41
|
};
|
|
34
42
|
|
|
@@ -3,6 +3,8 @@ import type { Preview } from '@storybook/angular-vite';
|
|
|
3
3
|
// Side-effect import: Vite injects tokens.css globally into the page
|
|
4
4
|
import '../src/styles/tokens.css';
|
|
5
5
|
|
|
6
|
+
import { withThemeByDataAttribute } from '@storybook/addon-themes';
|
|
7
|
+
|
|
6
8
|
const preview: Preview = {
|
|
7
9
|
parameters: {
|
|
8
10
|
a11y: {
|
|
@@ -25,6 +27,21 @@ const preview: Preview = {
|
|
|
25
27
|
},
|
|
26
28
|
},
|
|
27
29
|
},
|
|
30
|
+
|
|
31
|
+
decorators: [
|
|
32
|
+
// tokens.css keys dark mode off `[data-theme='dark']` / `[data-theme='light']`
|
|
33
|
+
// on the root element (with a `prefers-color-scheme` media-query fallback),
|
|
34
|
+
// so the data-attribute strategy is the one that matches — a class-name
|
|
35
|
+
// strategy would not touch the selector tokens.css actually uses.
|
|
36
|
+
withThemeByDataAttribute({
|
|
37
|
+
themes: { light: 'light', dark: 'dark' },
|
|
38
|
+
defaultTheme: 'light',
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
initialGlobals: {
|
|
43
|
+
theme: 'light',
|
|
44
|
+
},
|
|
28
45
|
};
|
|
29
46
|
|
|
30
47
|
export default preview;
|
|
@@ -15,6 +15,7 @@ const config: StorybookConfig = {
|
|
|
15
15
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
16
16
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
17
17
|
getAbsolutePath('@storybook/addon-docs'),
|
|
18
|
+
getAbsolutePath('@storybook/addon-themes'),
|
|
18
19
|
],
|
|
19
20
|
framework: {
|
|
20
21
|
name: getAbsolutePath('@storybook/react-vite'),
|
|
@@ -27,6 +28,13 @@ const config: StorybookConfig = {
|
|
|
27
28
|
// (react-docgen), unlike Angular and Vue — no experimentalDocgenServer
|
|
28
29
|
// flag needed here.
|
|
29
30
|
componentsManifest: true,
|
|
31
|
+
// `review-create` (wire name for the addon-mcp `review.create` method)
|
|
32
|
+
// registers for the deprecated `storybook ai` CLI proxy channel by default
|
|
33
|
+
// (unset ≠ false), but a direct MCP client — exactly what
|
|
34
|
+
// `claude mcp add --transport http storybook-local http://localhost:<port>/mcp`
|
|
35
|
+
// configures — only gets the tool when `experimentalReview` is explicitly
|
|
36
|
+
// `true` (verified against the installed 10.6.0 `storybook` dist).
|
|
37
|
+
experimentalReview: true,
|
|
30
38
|
},
|
|
31
39
|
};
|
|
32
40
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/react';
|
|
1
|
+
import type { Preview } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
3
|
import '../src/styles/tokens.css';
|
|
4
4
|
|
|
5
|
+
import { withThemeByDataAttribute } from '@storybook/addon-themes';
|
|
6
|
+
|
|
5
7
|
const preview: Preview = {
|
|
6
8
|
parameters: {
|
|
7
9
|
a11y: {
|
|
@@ -24,6 +26,21 @@ const preview: Preview = {
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
|
|
30
|
+
decorators: [
|
|
31
|
+
// tokens.css keys dark mode off `[data-theme='dark']` / `[data-theme='light']`
|
|
32
|
+
// on the root element (with a `prefers-color-scheme` media-query fallback),
|
|
33
|
+
// so the data-attribute strategy is the one that matches — a class-name
|
|
34
|
+
// strategy would not touch the selector tokens.css actually uses.
|
|
35
|
+
withThemeByDataAttribute({
|
|
36
|
+
themes: { light: 'light', dark: 'dark' },
|
|
37
|
+
defaultTheme: 'light',
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
initialGlobals: {
|
|
42
|
+
theme: 'light',
|
|
43
|
+
},
|
|
27
44
|
};
|
|
28
45
|
|
|
29
46
|
export default preview;
|
|
@@ -15,6 +15,7 @@ const config: StorybookConfig = {
|
|
|
15
15
|
getAbsolutePath('@storybook/addon-vitest'),
|
|
16
16
|
getAbsolutePath('@storybook/addon-a11y'),
|
|
17
17
|
getAbsolutePath('@storybook/addon-docs'),
|
|
18
|
+
getAbsolutePath('@storybook/addon-themes'),
|
|
18
19
|
],
|
|
19
20
|
framework: {
|
|
20
21
|
name: getAbsolutePath('@storybook/vue3-vite'),
|
|
@@ -28,6 +29,13 @@ const config: StorybookConfig = {
|
|
|
28
29
|
// Vue's docgen server is opt-in under `@storybook/vue3-vite` until
|
|
29
30
|
// Storybook 11 — without this flag components.json has no props.
|
|
30
31
|
experimentalDocgenServer: true,
|
|
32
|
+
// `review-create` (wire name for the addon-mcp `review.create` method)
|
|
33
|
+
// registers for the deprecated `storybook ai` CLI proxy channel by default
|
|
34
|
+
// (unset ≠ false), but a direct MCP client — exactly what
|
|
35
|
+
// `claude mcp add --transport http storybook-local http://localhost:<port>/mcp`
|
|
36
|
+
// configures — only gets the tool when `experimentalReview` is explicitly
|
|
37
|
+
// `true` (verified against the installed 10.6.0 `storybook` dist).
|
|
38
|
+
experimentalReview: true,
|
|
31
39
|
},
|
|
32
40
|
};
|
|
33
41
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/vue3';
|
|
1
|
+
import type { Preview } from '@storybook/vue3-vite';
|
|
2
2
|
|
|
3
3
|
import '../src/styles/tokens.css';
|
|
4
4
|
|
|
5
|
+
import { withThemeByDataAttribute } from '@storybook/addon-themes';
|
|
6
|
+
|
|
5
7
|
const preview: Preview = {
|
|
6
8
|
parameters: {
|
|
7
9
|
a11y: {
|
|
@@ -24,6 +26,21 @@ const preview: Preview = {
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
|
|
30
|
+
decorators: [
|
|
31
|
+
// tokens.css keys dark mode off `[data-theme='dark']` / `[data-theme='light']`
|
|
32
|
+
// on the root element (with a `prefers-color-scheme` media-query fallback),
|
|
33
|
+
// so the data-attribute strategy is the one that matches — a class-name
|
|
34
|
+
// strategy would not touch the selector tokens.css actually uses.
|
|
35
|
+
withThemeByDataAttribute({
|
|
36
|
+
themes: { light: 'light', dark: 'dark' },
|
|
37
|
+
defaultTheme: 'light',
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
initialGlobals: {
|
|
42
|
+
theme: 'light',
|
|
43
|
+
},
|
|
27
44
|
};
|
|
28
45
|
|
|
29
46
|
export default preview;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// No test-setup-stories.ts sibling here (unlike react/vue): verified against
|
|
2
|
+
// the installed @storybook/angular@10.6.0 dist (and its -vite counterpart)
|
|
3
|
+
// that neither exports composeStories/composeStory, only
|
|
4
|
+
// setProjectAnnotations — tracked upstream as storybookjs/storybook#28897.
|
|
5
|
+
// Wiring setProjectAnnotations alone would register project-level config
|
|
6
|
+
// that nothing in this workspace could yet consume. See ADR-0141.
|
|
1
7
|
import '@angular/compiler';
|
|
2
8
|
import '@analogjs/vitest-angular/setup-snapshots';
|
|
3
9
|
import '@testing-library/jest-dom/vitest';
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { screen } from '@testing-library/react';
|
|
2
|
+
import { composeStories } from '@storybook/react';
|
|
3
|
+
import * as stories from './atl-button.stories';
|
|
3
4
|
|
|
4
|
-
// A working pattern to copy:
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
5
|
+
// A working pattern to copy: this composes atl-button.stories.tsx's own
|
|
6
|
+
// exports instead of restating their claims by hand (ADR-0121: the stories
|
|
7
|
+
// are the claims; ADR-0141: composing them here, in Vitest/jsdom, not just
|
|
8
|
+
// in Chromium via check:stories). Primary's own `play` (see that file) does
|
|
9
|
+
// the click + assertion; composeStories(...).Primary.run() renders the
|
|
10
|
+
// story exactly like Storybook does — decorators, parameters and globals
|
|
11
|
+
// included, via src/test-setup-stories.ts's setProjectAnnotations call —
|
|
12
|
+
// then executes that play. A story composed WITHOUT that setup would
|
|
13
|
+
// silently test a different component than the one Storybook renders.
|
|
14
|
+
const { Primary } = composeStories(stories);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
expect(onClick).toHaveBeenCalledOnce();
|
|
16
|
+
describe('AtlButton', () => {
|
|
17
|
+
it('renders with its accessible name and fires its click handler when clicked', async () => {
|
|
18
|
+
await Primary.run();
|
|
19
|
+
expect(screen.getByRole('button', { name: 'Button' })).toBeInTheDocument();
|
|
21
20
|
});
|
|
22
21
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { beforeAll } from 'vitest';
|
|
2
|
+
import { setProjectAnnotations } from '@storybook/react';
|
|
3
|
+
import * as previewAnnotations from '../.storybook/preview';
|
|
4
|
+
|
|
5
|
+
// Portable stories (composeStories, used by atl-button.spec.tsx and any
|
|
6
|
+
// other jsdom test that imports a *.stories.tsx file) need the SAME
|
|
7
|
+
// decorators, parameters and globals the real Storybook applies via
|
|
8
|
+
// .storybook/preview — otherwise a composed story silently tests a
|
|
9
|
+
// different component than the one Storybook renders. setProjectAnnotations
|
|
10
|
+
// registers that config once; its returned `beforeAll` (addon-level setup,
|
|
11
|
+
// not just decorators) has to run through Vitest's own beforeAll — this is
|
|
12
|
+
// Storybook's documented Vitest portable-stories setup, not a local
|
|
13
|
+
// invention:
|
|
14
|
+
// https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest
|
|
15
|
+
const annotations = setProjectAnnotations([previewAnnotations]);
|
|
16
|
+
|
|
17
|
+
beforeAll(annotations.beforeAll);
|
|
@@ -16,7 +16,7 @@ export default defineConfig({
|
|
|
16
16
|
globals: true,
|
|
17
17
|
environment: 'jsdom',
|
|
18
18
|
include: ['src/**/*.spec.*'],
|
|
19
|
-
setupFiles: ['src/test-setup.ts'],
|
|
19
|
+
setupFiles: ['src/test-setup.ts', 'src/test-setup-stories.ts'],
|
|
20
20
|
server: {
|
|
21
21
|
deps: {
|
|
22
22
|
// @atelier-ui/react's built entry ships one `import './x.css'` per
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { screen } from '@testing-library/vue';
|
|
2
|
+
import { composeStories } from '@storybook/vue3';
|
|
3
|
+
import * as stories from './atl-button.stories';
|
|
3
4
|
|
|
4
|
-
// A working pattern to copy:
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
5
|
+
// A working pattern to copy: this composes atl-button.stories.ts's own
|
|
6
|
+
// exports instead of restating their claims by hand (ADR-0121: the stories
|
|
7
|
+
// are the claims; ADR-0141: composing them here, in Vitest/jsdom, not just
|
|
8
|
+
// in Chromium via check:stories). Primary's own `play` (see that file) does
|
|
9
|
+
// the click + assertion; composeStories(...).Primary.run() renders the
|
|
10
|
+
// story exactly like Storybook does — decorators, parameters and globals
|
|
11
|
+
// included, via src/test-setup-stories.ts's setProjectAnnotations call —
|
|
12
|
+
// then executes that play. A story composed WITHOUT that setup would
|
|
13
|
+
// silently test a different component than the one Storybook renders.
|
|
14
|
+
const { Primary } = composeStories(stories);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
attrs: { onClick },
|
|
21
|
-
});
|
|
22
|
-
await fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
|
|
23
|
-
expect(onClick).toHaveBeenCalledOnce();
|
|
16
|
+
describe('AtlButton', () => {
|
|
17
|
+
it('renders with its accessible name and fires its click handler when clicked', async () => {
|
|
18
|
+
await Primary.run();
|
|
19
|
+
expect(screen.getByRole('button', { name: 'Button' })).toBeInTheDocument();
|
|
24
20
|
});
|
|
25
21
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { beforeAll } from 'vitest';
|
|
2
|
+
import { setProjectAnnotations } from '@storybook/vue3';
|
|
3
|
+
import * as previewAnnotations from '../.storybook/preview';
|
|
4
|
+
|
|
5
|
+
// Portable stories (composeStories, used by atl-button.spec.ts and any
|
|
6
|
+
// other jsdom test that imports a *.stories.ts file) need the SAME
|
|
7
|
+
// decorators, parameters and globals the real Storybook applies via
|
|
8
|
+
// .storybook/preview — otherwise a composed story silently tests a
|
|
9
|
+
// different component than the one Storybook renders. setProjectAnnotations
|
|
10
|
+
// registers that config once; its returned `beforeAll` (addon-level setup,
|
|
11
|
+
// not just decorators) has to run through Vitest's own beforeAll — this is
|
|
12
|
+
// Storybook's documented Vitest portable-stories setup, not a local
|
|
13
|
+
// invention:
|
|
14
|
+
// https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest
|
|
15
|
+
const annotations = setProjectAnnotations([previewAnnotations]);
|
|
16
|
+
|
|
17
|
+
beforeAll(annotations.beforeAll);
|
|
@@ -17,7 +17,7 @@ export default defineConfig({
|
|
|
17
17
|
globals: true,
|
|
18
18
|
environment: 'jsdom',
|
|
19
19
|
include: ['src/**/*.spec.*'],
|
|
20
|
-
setupFiles: ['src/test-setup.ts'],
|
|
20
|
+
setupFiles: ['src/test-setup.ts', 'src/test-setup-stories.ts'],
|
|
21
21
|
server: {
|
|
22
22
|
deps: {
|
|
23
23
|
// @atelier-ui/vue's built entry (index.mjs) carries an unconditional
|
|
@@ -229,6 +229,33 @@ function loadMcpEndpoints() {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Whether Figma is part of THIS workspace at all — read off the same
|
|
234
|
+
* `.mcp.json` `figma-console` entry `create-workspace`'s preset.ts
|
|
235
|
+
* (`options.figmaMcp`, the `--figma`/`--no-figma` CLI flag) writes or omits.
|
|
236
|
+
* Reusing that exact entry as the signal — rather than a second marker file
|
|
237
|
+
* of its own — means it cannot drift from the flag that actually turned
|
|
238
|
+
* Figma on: preflight has no access to the generator's own options (it runs
|
|
239
|
+
* long after scaffolding, as a plain `npm run preflight`), so it has to infer
|
|
240
|
+
* the answer from something the generator left behind, and this is the one
|
|
241
|
+
* thing that is true if and only if `--figma` was passed. In a scaffolded
|
|
242
|
+
* workspace the entry exists exactly when `--figma` was — never
|
|
243
|
+
* independently written or removed by anything else (ADR-0144). In the
|
|
244
|
+
* atelier monorepo clone, this repo's own root `.mcp.json` commits the entry
|
|
245
|
+
* unconditionally (this repo always uses Figma), so the same test is
|
|
246
|
+
* correct, unconfigured, in both trees this file ships into.
|
|
247
|
+
*/
|
|
248
|
+
function hasFigmaConsoleMcp() {
|
|
249
|
+
const mcpPath = resolve(ROOT, '.mcp.json');
|
|
250
|
+
if (!existsSync(mcpPath)) return false;
|
|
251
|
+
try {
|
|
252
|
+
const config = JSON.parse(readFileSync(mcpPath, 'utf8'));
|
|
253
|
+
return Boolean(config.mcpServers?.['figma-console']);
|
|
254
|
+
} catch {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
232
259
|
/**
|
|
233
260
|
* Reads the exact `figma-console-mcp@<version>` pin off the `figma-console`
|
|
234
261
|
* server's `args` in `.mcp.json` — the same file `loadMcpEndpoints()` reads,
|
|
@@ -423,6 +450,19 @@ function checkClaudeTrust() {
|
|
|
423
450
|
}
|
|
424
451
|
|
|
425
452
|
async function checkFigmaSetup() {
|
|
453
|
+
// Figma is genuinely optional per workspace (ADR-0144, `--figma`/
|
|
454
|
+
// `--no-figma`) — a workspace that never opted in should not see Desktop
|
|
455
|
+
// Bridge / token warnings for a tool it doesn't use. See
|
|
456
|
+
// hasFigmaConsoleMcp()'s own comment for why this exact entry is the
|
|
457
|
+
// signal.
|
|
458
|
+
if (!hasFigmaConsoleMcp()) {
|
|
459
|
+
ok(
|
|
460
|
+
'Figma',
|
|
461
|
+
'not configured for this workspace (no `figma-console` entry in .mcp.json) — skipping Desktop Bridge checks',
|
|
462
|
+
);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
426
466
|
// 1. Desktop Bridge plugin manifest — the primary channel.
|
|
427
467
|
const manifestPath = join(
|
|
428
468
|
homedir(),
|