@atelier-ui/create-workspace 0.2.42 → 0.2.44

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +50 -4
  2. package/package.json +1 -1
  3. package/src/generators/preset/files/claude/agents/component-review.md +53 -0
  4. package/src/generators/preset/files/claude/commands/verify.md +24 -0
  5. package/src/generators/preset/files/claude/hooks/format-edited.sh +77 -0
  6. package/src/generators/preset/files/claude/skills/atelier-component/SKILL.md +84 -0
  7. package/src/generators/preset/files/contracts/README.md +29 -0
  8. package/src/generators/preset/files/contracts/button.contract.ts.template +20 -0
  9. package/src/generators/preset/files/contracts/types.ts.template +55 -0
  10. package/src/generators/preset/files/figma/snapshot.json +164 -0
  11. package/src/generators/preset/files/storybook/angular/atl-button.stories.ts.template +85 -0
  12. package/src/generators/preset/files/storybook/angular/main.ts.template +39 -0
  13. package/src/generators/preset/files/storybook/angular/preview.ts.template +30 -0
  14. package/src/generators/preset/files/storybook/angular/tsconfig.json +16 -0
  15. package/src/generators/preset/files/storybook/angular/vitest.config.ts.template +40 -0
  16. package/src/generators/preset/files/storybook/angular/vitest.setup.ts.template +14 -0
  17. package/src/generators/preset/files/storybook/react/atl-button.stories.tsx +86 -0
  18. package/src/generators/preset/files/storybook/react/main.ts.template +37 -0
  19. package/src/generators/preset/files/storybook/react/preview.tsx +29 -0
  20. package/src/generators/preset/files/storybook/react/vitest.config.ts.template +32 -0
  21. package/src/generators/preset/files/storybook/react/vitest.setup.ts.template +8 -0
  22. package/src/generators/preset/files/storybook/vue/atl-button.stories.ts.template +89 -0
  23. package/src/generators/preset/files/storybook/vue/main.ts.template +38 -0
  24. package/src/generators/preset/files/storybook/vue/preview.ts.template +29 -0
  25. package/src/generators/preset/files/storybook/vue/vitest.config.ts.template +32 -0
  26. package/src/generators/preset/files/storybook/vue/vitest.setup.ts.template +9 -0
  27. package/src/generators/preset/files/styles/tokens.css +59 -43
  28. package/src/generators/preset/files/testing/angular/atl-button.spec.ts.template +27 -0
  29. package/src/generators/preset/files/testing/angular/test-setup.ts.template +6 -0
  30. package/src/generators/preset/files/testing/angular/vitest.unit.config.ts.template +36 -0
  31. package/src/generators/preset/files/testing/react/atl-button.spec.tsx +22 -0
  32. package/src/generators/preset/files/testing/react/test-setup.ts.template +1 -0
  33. package/src/generators/preset/files/testing/react/vitest.unit.config.ts.template +21 -0
  34. package/src/generators/preset/files/testing/vue/atl-button.spec.ts.template +25 -0
  35. package/src/generators/preset/files/testing/vue/test-setup.ts.template +1 -0
  36. package/src/generators/preset/files/testing/vue/vitest.unit.config.ts.template +50 -0
  37. package/src/generators/preset/files/tools/scripts/check-contracts.mjs +1644 -0
  38. package/src/generators/preset/files/tools/scripts/figma-snapshot-contracts.mjs +370 -0
  39. package/src/generators/preset/files/tools/scripts/lib/docgen.mjs +573 -0
  40. package/src/generators/preset/files/tools/scripts/lib/ts-eval.js +126 -0
  41. package/src/generators/preset/files/tools/scripts/preflight.mjs +163 -31
  42. package/src/generators/preset/files/tools/stylelint-rules/index.js +21 -0
  43. package/src/generators/preset/files/tools/stylelint-rules/no-primitive-token.js +362 -0
  44. package/src/generators/preset/files/tools/stylelint-rules/no-raw-color-literal.js +154 -0
  45. package/src/generators/preset/files/tools/stylelint-rules/no-token-bypass.js +497 -0
  46. package/src/generators/preset/files/tools/stylelint-rules/no-undeclared-token.js +122 -0
  47. package/src/generators/preset/files/tools/stylelint-rules/utils.js +71 -0
  48. package/src/generators/preset/preset.d.ts +1 -0
  49. package/src/generators/preset/preset.js +1463 -110
  50. package/src/generators/preset/preset.js.map +1 -1
  51. package/src/generators/preset/schema.d.ts +3 -1
  52. package/src/generators/preset/schema.json +23 -3
@@ -22,10 +22,12 @@
22
22
 
23
23
  :root {
24
24
  /* Typography */
25
- --ui-font-family: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system,
25
+ --ui-font-family:
26
+ 'Instrument Sans', ui-sans-serif, system-ui, -apple-system,
26
27
  BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
27
28
  --ui-font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
28
- --ui-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco,
29
+ --ui-font-mono:
30
+ 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco,
29
31
  'Courier New', monospace;
30
32
  /* Below the smallest readable size, for text inside a box too small to hold it:
31
33
  the initials in a 24px avatar and the count in its overflow badge. Named rather
@@ -74,9 +76,15 @@
74
76
  * padding, not one line among many). See ADR-0052.
75
77
  */
76
78
  --ui-row-inset: 0.25rem;
77
- --ui-row-height-sm: calc(var(--ui-control-height-sm) + 2 * var(--ui-row-inset));
78
- --ui-row-height-md: calc(var(--ui-control-height-md) + 2 * var(--ui-row-inset));
79
- --ui-row-height-lg: calc(var(--ui-control-height-lg) + 2 * var(--ui-row-inset));
79
+ --ui-row-height-sm: calc(
80
+ var(--ui-control-height-sm) + 2 * var(--ui-row-inset)
81
+ );
82
+ --ui-row-height-md: calc(
83
+ var(--ui-control-height-md) + 2 * var(--ui-row-inset)
84
+ );
85
+ --ui-row-height-lg: calc(
86
+ var(--ui-control-height-lg) + 2 * var(--ui-row-inset)
87
+ );
80
88
 
81
89
  --ui-control-height-sm: 2rem;
82
90
  --ui-control-height-md: 2.5rem;
@@ -104,8 +112,8 @@
104
112
  * role with --ui-letter-spacing-tight and an uppercased label role with
105
113
  * --ui-letter-spacing-uppercase yourself.
106
114
  */
107
- --ui-type-display: italic var(--ui-font-weight-normal) var(--ui-font-size-3xl) /
108
- var(--ui-line-height-tight) var(--ui-font-display);
115
+ --ui-type-display: italic var(--ui-font-weight-normal)
116
+ var(--ui-font-size-3xl) / var(--ui-line-height-tight) var(--ui-font-display);
109
117
  --ui-type-headline: var(--ui-font-weight-bold) var(--ui-font-size-2xl) /
110
118
  var(--ui-line-height-tight) var(--ui-font-family);
111
119
  --ui-type-title: var(--ui-font-weight-semibold) var(--ui-font-size-lg) /
@@ -292,9 +300,9 @@
292
300
  --ui-color-overlay: rgba(0, 0, 0, 0.5);
293
301
 
294
302
  /* Borders — split decorative from functional per WCAG 1.4.11 */
295
- --ui-color-border: #e2e8f0; /* decorative */
303
+ --ui-color-border: #e2e8f0; /* decorative */
296
304
  --ui-color-border-hover: #cbd5e1;
297
- --ui-color-border-strong: #64748b; /* functional ≥3:1 */
305
+ --ui-color-border-strong: #64748b; /* functional ≥3:1 */
298
306
 
299
307
  /* Text */
300
308
  --ui-color-text: #0f172a;
@@ -316,10 +324,10 @@
316
324
  --ui-opacity-disabled: 0.5;
317
325
 
318
326
  /* Border radius — bumped for modern feel */
319
- --ui-radius-sm: 0.5rem; /* was 0.375rem */
327
+ --ui-radius-sm: 0.5rem; /* was 0.375rem */
320
328
  --ui-radius-md: 0.625rem; /* was 0.5rem */
321
329
  --ui-radius-lg: 0.875rem; /* was 0.75rem */
322
- --ui-radius-xl: 1.25rem; /* was 1rem */
330
+ --ui-radius-xl: 1.25rem; /* was 1rem */
323
331
  --ui-radius-full: 9999px;
324
332
 
325
333
  /* ── Border widths ──────────────────────────────────────────────────────────
@@ -348,13 +356,15 @@
348
356
 
349
357
  /* Shadows — slate-tinted dual-layer (ambient + key light) */
350
358
  --ui-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
351
- --ui-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08),
352
- 0 1px 2px -1px rgba(15, 23, 42, 0.06);
353
- --ui-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08),
354
- 0 2px 4px -2px rgba(15, 23, 42, 0.05);
355
- --ui-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08),
359
+ --ui-shadow-sm:
360
+ 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
361
+ --ui-shadow-md:
362
+ 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
363
+ --ui-shadow-lg:
364
+ 0 10px 15px -3px rgba(15, 23, 42, 0.08),
356
365
  0 4px 6px -4px rgba(15, 23, 42, 0.04);
357
- --ui-shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10),
366
+ --ui-shadow-xl:
367
+ 0 20px 25px -5px rgba(15, 23, 42, 0.1),
358
368
  0 8px 10px -6px rgba(15, 23, 42, 0.04);
359
369
 
360
370
  /* Motion */
@@ -375,10 +385,10 @@
375
385
  * both of which are mode-dependent, so the ring follows the mode for free.
376
386
  * The danger variant exists so an invalid control does not have to restate
377
387
  * the formula (it did, in atl-input.css, until 2026-08-26). */
378
- --ui-focus-ring: 0 0 0 2px var(--ui-color-surface),
379
- 0 0 0 4px var(--ui-color-primary);
380
- --ui-focus-ring-danger: 0 0 0 2px var(--ui-color-surface),
381
- 0 0 0 4px var(--ui-color-danger);
388
+ --ui-focus-ring:
389
+ 0 0 0 2px var(--ui-color-surface), 0 0 0 4px var(--ui-color-primary);
390
+ --ui-focus-ring-danger:
391
+ 0 0 0 2px var(--ui-color-surface), 0 0 0 4px var(--ui-color-danger);
382
392
 
383
393
  /* Form controls */
384
394
  --ui-color-input-bg: var(--ui-color-surface-sunken);
@@ -450,18 +460,18 @@
450
460
  --ui-color-placeholder: #94a3b8;
451
461
 
452
462
  --ui-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
453
- --ui-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4),
454
- 0 1px 2px -1px rgba(0, 0, 0, 0.3);
455
- --ui-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45),
456
- 0 2px 4px -2px rgba(0, 0, 0, 0.3);
457
- --ui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5),
458
- 0 4px 6px -4px rgba(0, 0, 0, 0.25);
459
- --ui-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5),
460
- 0 8px 10px -6px rgba(0, 0, 0, 0.25);
463
+ --ui-shadow-sm:
464
+ 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
465
+ --ui-shadow-md:
466
+ 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
467
+ --ui-shadow-lg:
468
+ 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.25);
469
+ --ui-shadow-xl:
470
+ 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
461
471
  }
462
472
  }
463
473
 
464
- [data-theme="dark"] {
474
+ [data-theme='dark'] {
465
475
  --ui-color-primary: var(--ui-color-teal-300);
466
476
  --ui-color-primary-hover: var(--ui-color-teal-200);
467
477
  --ui-color-primary-active: var(--ui-color-teal-100);
@@ -510,18 +520,18 @@
510
520
  --ui-color-placeholder: #94a3b8;
511
521
 
512
522
  --ui-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
513
- --ui-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4),
514
- 0 1px 2px -1px rgba(0, 0, 0, 0.3);
515
- --ui-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45),
516
- 0 2px 4px -2px rgba(0, 0, 0, 0.3);
517
- --ui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5),
518
- 0 4px 6px -4px rgba(0, 0, 0, 0.25);
519
- --ui-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5),
520
- 0 8px 10px -6px rgba(0, 0, 0, 0.25);
523
+ --ui-shadow-sm:
524
+ 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
525
+ --ui-shadow-md:
526
+ 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
527
+ --ui-shadow-lg:
528
+ 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.25);
529
+ --ui-shadow-xl:
530
+ 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
521
531
  }
522
532
 
523
533
  /* Explicit light theme — declared last so it wins over prefers-color-scheme: dark */
524
- [data-theme="light"] {
534
+ [data-theme='light'] {
525
535
  --ui-color-primary: var(--ui-color-teal-700);
526
536
  --ui-color-primary-hover: var(--ui-color-teal-800);
527
537
  --ui-color-primary-active: var(--ui-color-teal-900);
@@ -570,10 +580,16 @@
570
580
  --ui-color-placeholder: #64748b;
571
581
 
572
582
  --ui-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
573
- --ui-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
574
- --ui-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
575
- --ui-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
576
- --ui-shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
583
+ --ui-shadow-sm:
584
+ 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
585
+ --ui-shadow-md:
586
+ 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
587
+ --ui-shadow-lg:
588
+ 0 10px 15px -3px rgba(15, 23, 42, 0.08),
589
+ 0 4px 6px -4px rgba(15, 23, 42, 0.04);
590
+ --ui-shadow-xl:
591
+ 0 20px 25px -5px rgba(15, 23, 42, 0.1),
592
+ 0 8px 10px -6px rgba(15, 23, 42, 0.04);
577
593
  }
578
594
 
579
595
  @media (prefers-reduced-motion: reduce) {
@@ -0,0 +1,27 @@
1
+ import { fireEvent, render, screen } from '@testing-library/angular';
2
+ import { AtlButton } from '@atelier-ui/angular';
3
+
4
+ // A working pattern to copy: same purpose as atl-button.stories.ts, but for
5
+ // a plain jsdom unit test (`npx nx test workshop-angular`) rather than a
6
+ // browser-rendered story — the loop for anything that is not itself a
7
+ // story: a service, a directive, a form-validation rule.
8
+ describe('AtlButton', () => {
9
+ it('renders with its accessible name', async () => {
10
+ await render('<atl-button>Click me</atl-button>', {
11
+ imports: [AtlButton],
12
+ });
13
+ expect(
14
+ screen.getByRole('button', { name: 'Click me' }),
15
+ ).toBeInTheDocument();
16
+ });
17
+
18
+ it('emits a click event when clicked', async () => {
19
+ const onClick = vi.fn();
20
+ await render('<atl-button (click)="onClick()">Click me</atl-button>', {
21
+ imports: [AtlButton],
22
+ componentProperties: { onClick },
23
+ });
24
+ await fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
25
+ expect(onClick).toHaveBeenCalledOnce();
26
+ });
27
+ });
@@ -0,0 +1,6 @@
1
+ import '@angular/compiler';
2
+ import '@analogjs/vitest-angular/setup-snapshots';
3
+ import '@testing-library/jest-dom/vitest';
4
+ import { setupTestBed } from '@analogjs/vitest-angular/setup-testbed';
5
+
6
+ setupTestBed();
@@ -0,0 +1,36 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import angular from '@analogjs/vite-plugin-angular';
3
+
4
+ // A second Vitest config, deliberately separate from `vitest.config.ts` one
5
+ // directory up (the browser-mode Storybook test config) and deliberately
6
+ // named something OTHER than `vitest.config.*` / `vite.config.*` /
7
+ // `vitest.workspace.*` — see that file's own comment, and this monorepo's
8
+ // ADR-0112, for why: the Storybook test-run tool's own config-discovery walk
9
+ // only ever considers a file whose BASENAME is one of those three; content
10
+ // is checked only once a candidate with a matching name is found. This file
11
+ // isn't a candidate at all, by name, so it is only ever invoked explicitly —
12
+ // via the `test` target in project.json (`vitest run --config
13
+ // vitest.unit.config.ts`).
14
+ //
15
+ // Runs in jsdom, not a real browser: a service, a directive, or a
16
+ // form-validation rule needs a fast feedback loop, not Playwright +
17
+ // Chromium. Same `@analogjs/vite-plugin-angular` plugin as vitest.config.ts,
18
+ // and for the same reason documented there — it links
19
+ // `@atelier-ui/angular`'s partially-Ivy-compiled npm package, not just this
20
+ // app's own components.
21
+ export default defineConfig({
22
+ plugins: [angular()],
23
+ test: {
24
+ name: 'workshop-angular',
25
+ globals: true,
26
+ environment: 'jsdom',
27
+ include: ['src/**/*.spec.*'],
28
+ setupFiles: ['src/test-setup.ts'],
29
+ // Vitest defaults to 5000ms. libs/angular/vite.config.mts (this
30
+ // monorepo's own equivalent) measured an Angular Testing Library
31
+ // render() at 220-1270ms with the machine to itself, and higher under
32
+ // contention — 20s means a timeout here is a real hang, not a busy
33
+ // laptop.
34
+ testTimeout: 20_000,
35
+ },
36
+ });
@@ -0,0 +1,22 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { AtlButton } from '@atelier-ui/react';
3
+
4
+ // A working pattern to copy: same purpose as atl-button.stories.tsx, but for
5
+ // a plain jsdom unit test (`npx nx test workshop-react`) rather than a
6
+ // browser-rendered story — the loop for anything that is not itself a
7
+ // story: a hook, a helper, a piece of app logic.
8
+ describe('AtlButton', () => {
9
+ it('renders with its accessible name', () => {
10
+ render(<AtlButton>Click me</AtlButton>);
11
+ expect(
12
+ screen.getByRole('button', { name: 'Click me' }),
13
+ ).toBeInTheDocument();
14
+ });
15
+
16
+ it('fires its click handler when clicked', () => {
17
+ const onClick = vi.fn();
18
+ render(<AtlButton onClick={onClick}>Click me</AtlButton>);
19
+ fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
20
+ expect(onClick).toHaveBeenCalledOnce();
21
+ });
22
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ // A second Vitest config, named something other than vitest.config.ts /
5
+ // vite.config.ts on purpose — see the Angular version of this file, or
6
+ // vitest.config.ts one directory up, for why (ADR-0112: the Storybook
7
+ // test-run tool's own config-discovery walk keys on a file's BASENAME, and
8
+ // this one deliberately isn't a candidate).
9
+ //
10
+ // Runs in jsdom, not a real browser: a hook, a helper, or a piece of app
11
+ // logic needs a fast feedback loop, not Playwright + Chromium.
12
+ export default defineConfig({
13
+ plugins: [react()],
14
+ test: {
15
+ name: 'workshop-react',
16
+ globals: true,
17
+ environment: 'jsdom',
18
+ include: ['src/**/*.spec.*'],
19
+ setupFiles: ['src/test-setup.ts'],
20
+ },
21
+ });
@@ -0,0 +1,25 @@
1
+ import { fireEvent, render, screen } from '@testing-library/vue';
2
+ import { AtlButton } from '@atelier-ui/vue';
3
+
4
+ // A working pattern to copy: same purpose as atl-button.stories.ts, but for
5
+ // a plain jsdom unit test (`npx nx test workshop-vue`) rather than a
6
+ // browser-rendered story — the loop for anything that is not itself a
7
+ // story: a composable, a helper, a form-validation rule.
8
+ describe('AtlButton', () => {
9
+ it('renders with its accessible name', () => {
10
+ render(AtlButton, { slots: { default: 'Click me' } });
11
+ expect(
12
+ screen.getByRole('button', { name: 'Click me' }),
13
+ ).toBeInTheDocument();
14
+ });
15
+
16
+ it('emits a click event when clicked', async () => {
17
+ const onClick = vi.fn();
18
+ render(AtlButton, {
19
+ slots: { default: 'Click me' },
20
+ attrs: { onClick },
21
+ });
22
+ await fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
23
+ expect(onClick).toHaveBeenCalledOnce();
24
+ });
25
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,50 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import vue from '@vitejs/plugin-vue';
3
+
4
+ // A second Vitest config, named something other than vitest.config.ts /
5
+ // vite.config.ts on purpose — see the Angular version of this file, or
6
+ // vitest.config.ts one directory up, for why (ADR-0112: the Storybook
7
+ // test-run tool's own config-discovery walk keys on a file's BASENAME, and
8
+ // this one deliberately isn't a candidate).
9
+ //
10
+ // Runs in jsdom, not a real browser: a composable, a helper, or a
11
+ // form-validation rule needs a fast feedback loop, not Playwright +
12
+ // Chromium.
13
+ export default defineConfig({
14
+ plugins: [vue()],
15
+ test: {
16
+ name: 'workshop-vue',
17
+ globals: true,
18
+ environment: 'jsdom',
19
+ include: ['src/**/*.spec.*'],
20
+ setupFiles: ['src/test-setup.ts'],
21
+ server: {
22
+ deps: {
23
+ // @atelier-ui/vue's built entry (index.mjs) carries an unconditional
24
+ // `import "./index.css"` banner — vite build's lib mode extracts all
25
+ // component <style> blocks into one index.css but emits no import for
26
+ // it, so the library's own vite.config.mts injects one via a rollup
27
+ // banner. That is correct for a browser or another Vite build, both
28
+ // of which have a CSS loader. Vitest's default dependency handling
29
+ // does not: because @atelier-ui/vue is unambiguous, self-consistent
30
+ // ESM (an .mjs main, an `exports` map pointing at it, no conflicting
31
+ // "type" field), Vitest hands it to Node's own module loader instead
32
+ // of running it through Vite's transform pipeline — and Node's
33
+ // loader has no idea what to do with a bare `.css` specifier
34
+ // ("Unknown file extension \".css\""), unlike Vite's, which is what
35
+ // resolves component-level CSS imports for every OTHER package here.
36
+ // `inline` forces this one package back through Vite's own pipeline,
37
+ // where the `.css` import is handled like any other test asset.
38
+ // (Confirmed by direct repro: @atelier-ui/react's built entry has the
39
+ // identical per-component `import './x.css'` pattern and does NOT
40
+ // need this — its package.json inconsistently declares
41
+ // `"type": "commonjs"` while shipping raw ESM syntax, which trips
42
+ // Vitest's own dual-package guard and forces it through the same
43
+ // inlined path automatically. That is not a design guarantee: if
44
+ // @atelier-ui/react's build is ever made internally consistent, it
45
+ // will need this exact same `inline` entry.)
46
+ inline: ['@atelier-ui/vue'],
47
+ },
48
+ },
49
+ },
50
+ });