@lifeonlars/prime-yggdrasil 0.2.4 โ 0.2.6
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 +19 -3
- package/docs/AI-AGENT-GUIDE.md +40 -0
- package/package.json +1 -6
package/README.md
CHANGED
|
@@ -158,13 +158,29 @@ npm run build
|
|
|
158
158
|
|
|
159
159
|
### Scripts
|
|
160
160
|
```bash
|
|
161
|
-
npm run
|
|
162
|
-
npm run build # Build library
|
|
163
|
-
npm run
|
|
161
|
+
npm run storybook # Start Storybook development server
|
|
162
|
+
npm run build # Build library package
|
|
163
|
+
npm run build-storybook # Build static Storybook for deployment
|
|
164
|
+
npm run test:contrast # Test color contrast (APCA)
|
|
164
165
|
npm run test:themes # Validate theme structure
|
|
166
|
+
npm run lint # Lint TypeScript/JavaScript
|
|
165
167
|
npm run lint:css # Lint CSS files
|
|
168
|
+
npm run chromatic # Run visual regression tests
|
|
166
169
|
```
|
|
167
170
|
|
|
171
|
+
### Testing
|
|
172
|
+
|
|
173
|
+
**Storybook Built-in Testing:**
|
|
174
|
+
- **Play functions** - Interactive tests run automatically when viewing stories
|
|
175
|
+
- **Accessibility tests** - `@storybook/addon-a11y` checks components for a11y violations
|
|
176
|
+
- **Visual regression** - Chromatic integration for catching visual changes
|
|
177
|
+
|
|
178
|
+
**CI/CD Pipeline:**
|
|
179
|
+
- GitHub Actions runs on every push/PR
|
|
180
|
+
- Validates linting, builds, and accessibility
|
|
181
|
+
- Chromatic visual regression testing (on push to main/master)
|
|
182
|
+
- See [`.github/workflows/ci.yml`](.github/workflows/ci.yml) for details
|
|
183
|
+
|
|
168
184
|
## ๐ Project Stats
|
|
169
185
|
|
|
170
186
|
- **Semantic Tokens**: 727 color replacements (96% coverage)
|
package/docs/AI-AGENT-GUIDE.md
CHANGED
|
@@ -542,6 +542,46 @@ Need: Date picker
|
|
|
542
542
|
2. Copy: Basic example code
|
|
543
543
|
3. Adapt: Add semantic token styling if needed
|
|
544
544
|
4. Test: In both light and dark modes
|
|
545
|
+
5. Verify: Check Storybook for play function tests and a11y violations
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
## ๐งช Testing Your Implementation
|
|
549
|
+
|
|
550
|
+
When implementing components with Yggdrasil:
|
|
551
|
+
|
|
552
|
+
**1. Visual Testing (Automatic)**
|
|
553
|
+
- View your story in Storybook
|
|
554
|
+
- Check both light and dark modes (use theme toggle)
|
|
555
|
+
- Watch for automatic accessibility violations in the a11y panel
|
|
556
|
+
|
|
557
|
+
**2. Interactive Testing (Play Functions)**
|
|
558
|
+
- Stories with play functions test automatically when viewed
|
|
559
|
+
- Check the Interactions panel for test results
|
|
560
|
+
- See `Button.stories.tsx` for examples of play functions
|
|
561
|
+
|
|
562
|
+
**3. Accessibility (Built-in)**
|
|
563
|
+
- `@storybook/addon-a11y` checks for violations automatically
|
|
564
|
+
- Review the Accessibility panel for any issues
|
|
565
|
+
- Violations are color-coded by severity
|
|
566
|
+
|
|
567
|
+
**4. Visual Regression (Chromatic)**
|
|
568
|
+
- Run `npm run chromatic` to catch visual changes
|
|
569
|
+
- CI automatically runs Chromatic on push to main/master
|
|
570
|
+
- Review changes in Chromatic dashboard before approving
|
|
571
|
+
|
|
572
|
+
**Example Play Function:**
|
|
573
|
+
```tsx
|
|
574
|
+
import { expect, within } from 'storybook/test';
|
|
575
|
+
|
|
576
|
+
export const Primary: Story = {
|
|
577
|
+
args: { label: 'Click Me' },
|
|
578
|
+
play: async ({ canvasElement }) => {
|
|
579
|
+
const canvas = within(canvasElement);
|
|
580
|
+
const button = canvas.getByRole('button');
|
|
581
|
+
await expect(button).toBeInTheDocument();
|
|
582
|
+
await expect(button).toHaveTextContent('Click Me');
|
|
583
|
+
},
|
|
584
|
+
};
|
|
545
585
|
```
|
|
546
586
|
|
|
547
587
|
## ๐๏ธ Creating Local Blocks (Project-Specific)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifeonlars/prime-yggdrasil",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI-agent-friendly PrimeReact design system for component-driven development with semantic tokens and dark mode support",
|
|
6
6
|
"keywords": [
|
|
@@ -59,9 +59,6 @@
|
|
|
59
59
|
"test:contrast:watch": "vitest tests/contrast.test.ts",
|
|
60
60
|
"test:themes": "node scripts/validate-themes.js",
|
|
61
61
|
"audit:foundation": "node scripts/audit-foundation-usage.js",
|
|
62
|
-
"test:components": "playwright test",
|
|
63
|
-
"test:components:ui": "playwright test --ui",
|
|
64
|
-
"test:components:headed": "playwright test --headed",
|
|
65
62
|
"storybook": "storybook dev -p 6006",
|
|
66
63
|
"build-storybook": "storybook build",
|
|
67
64
|
"chromatic": "npx chromatic --project-token=chpt_f57d218f413ed30"
|
|
@@ -79,7 +76,6 @@
|
|
|
79
76
|
"@storybook/addon-a11y": "^10.1.11",
|
|
80
77
|
"@storybook/addon-docs": "^10.1.11",
|
|
81
78
|
"@storybook/addon-onboarding": "^10.1.11",
|
|
82
|
-
"@storybook/addon-vitest": "^10.1.11",
|
|
83
79
|
"@storybook/react-vite": "^10.1.11",
|
|
84
80
|
"@testing-library/jest-dom": "^6.9.1",
|
|
85
81
|
"@testing-library/react": "^16.3.1",
|
|
@@ -100,7 +96,6 @@
|
|
|
100
96
|
"eslint-plugin-storybook": "^10.1.11",
|
|
101
97
|
"globals": "^16.5.0",
|
|
102
98
|
"jsdom": "^27.4.0",
|
|
103
|
-
"playwright": "^1.57.0",
|
|
104
99
|
"primeflex": "^4.0.0",
|
|
105
100
|
"primeicons": "^7.0.0",
|
|
106
101
|
"primereact": "^10.9.7",
|