@cere/cere-design-system 0.0.9 → 0.0.13
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/.specify/memory/agent-factory.md +44 -0
- package/.specify/memory/architecture.md +143 -0
- package/.specify/memory/component-architecture.md +73 -0
- package/.specify/memory/components-reference.md +1353 -0
- package/.specify/memory/constitution.md +295 -0
- package/.specify/memory/design-tokens.md +139 -0
- package/.specify/memory/package-usage-guide.md +99 -0
- package/.specify/memory/toolkits.md +57 -0
- package/.specify/memory/workflow.md +87 -0
- package/README.md +197 -3
- package/dist/HumanSans-Black-C4YJONK7.otf +0 -0
- package/dist/HumanSans-Bold-4EAJ3L3T.otf +0 -0
- package/dist/HumanSans-BoldOblique-4D325T4F.otf +0 -0
- package/dist/HumanSans-ExtraLight-VL7DEKQ4.otf +0 -0
- package/dist/HumanSans-ExtraLightOblique-VK2JTUXF.otf +0 -0
- package/dist/HumanSans-Light-YV7AFKRB.otf +0 -0
- package/dist/HumanSans-LightOblique-VIXV7QA6.otf +0 -0
- package/dist/HumanSans-Medium-UULJ3PIR.otf +0 -0
- package/dist/HumanSans-MediumOblique-M7FHDZRS.otf +0 -0
- package/dist/HumanSans-Regular-QMFEP3F6.otf +0 -0
- package/dist/HumanSans-RegularOblique-YPKQJAAM.otf +0 -0
- package/dist/index.css +79 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +242 -94
- package/dist/index.d.ts +242 -94
- package/dist/index.js +3158 -553
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3020 -456
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -4
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Multi-Agent Factory Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Allow different AI coding agents (Warp, Claude Code, Cursor, Copilot, etc.) to work with this design system using standardized interfaces while leveraging agent-specific capabilities.
|
|
5
|
+
|
|
6
|
+
## Agent Capabilities Matrix
|
|
7
|
+
|
|
8
|
+
| Agent | Strengths | Best For |
|
|
9
|
+
|-------|-----------|----------|
|
|
10
|
+
| Warp Agent Mode | Shell integration, file operations | Build automation, testing workflows |
|
|
11
|
+
| Claude Code | Long context, complex reasoning | Architecture, refactoring, documentation |
|
|
12
|
+
| GitHub Copilot | Code completion, patterns | Rapid prototyping, boilerplate |
|
|
13
|
+
| Cursor | IDE integration, inline edits | Component implementation, quick fixes |
|
|
14
|
+
|
|
15
|
+
## Agent Configuration Files
|
|
16
|
+
Spec Kit supports multiple agents through dedicated command files:
|
|
17
|
+
- `.claude/` - Claude-specific commands
|
|
18
|
+
- `.github/copilot-instructions.md` - Copilot context
|
|
19
|
+
- `.cursor/rules` - Cursor IDE rules
|
|
20
|
+
- `.warp/` - Warp agent configuration
|
|
21
|
+
|
|
22
|
+
All agents should reference:
|
|
23
|
+
- `.specify/memory/constitution.md` - Core principles
|
|
24
|
+
- `.specify/memory/toolkits.md` - Available toolkits
|
|
25
|
+
- `.specify/templates/` - Spec templates
|
|
26
|
+
|
|
27
|
+
## Pluggable Toolkit Loading
|
|
28
|
+
Each spec can declare required toolkits in frontmatter:
|
|
29
|
+
```yaml
|
|
30
|
+
---
|
|
31
|
+
toolkits:
|
|
32
|
+
- mui-component-generator
|
|
33
|
+
- storybook-docs
|
|
34
|
+
agent_hints:
|
|
35
|
+
preferred: claude
|
|
36
|
+
complexity: high
|
|
37
|
+
---
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Agents read this metadata and activate appropriate specialized knowledge.
|
|
41
|
+
|
|
42
|
+
## Implementation
|
|
43
|
+
No code changes required - this is a documentation and organizational pattern.
|
|
44
|
+
Agents interpret these files as context when working on specs.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# architecture.md
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This is a React-based design system library built with Material UI and TypeScript. It's distributed as an npm package (@cere/cere-design-system) containing 40+ reusable UI components organized into categories: buttons, inputs, navigation, layout, and feedback components. The library also includes third-party integrations for ReactFlow (FlowEditor) and Monaco Editor (CodeEditor).
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
### Component Structure
|
|
10
|
+
- All components are in `src/components/` organized by category:
|
|
11
|
+
- `buttons/` - Button, IconButton, LoadingButton, ButtonGroup
|
|
12
|
+
- `inputs/` - TextField, SearchField, Dropdown, Switch, Checkbox, Radio, ToggleButton
|
|
13
|
+
- `navigation/` - Sidebar, Tab, Menu, Pagination, Selector, Stepper
|
|
14
|
+
- `layout/` - Dialog, Drawer, Card, List, Avatar, Table, Grid, AppBar, Paper, etc.
|
|
15
|
+
- `feedback/` - Badge, Chip, Tooltip, Progress, Alert, EmptyState, Loading
|
|
16
|
+
- `third-party/` - FlowEditor (ReactFlow wrapper), CodeEditor (Monaco wrapper)
|
|
17
|
+
|
|
18
|
+
### Component Pattern
|
|
19
|
+
Each component follows this structure:
|
|
20
|
+
- Main component file (e.g., `Button.tsx`) exports component and TypeScript types
|
|
21
|
+
- Storybook story file (e.g., `Button.stories.tsx`) for documentation/testing
|
|
22
|
+
- Jest test file in `__tests__/` subdirectory (e.g., `__tests__/Button.test.tsx`)
|
|
23
|
+
- Components use styled MUI components, not custom CSS files
|
|
24
|
+
|
|
25
|
+
### Theme System
|
|
26
|
+
- Theme defined in `src/theme/index.ts` using Material UI's `createTheme()`
|
|
27
|
+
- Primary color: #1976d2 (blue, not purple as README mentions)
|
|
28
|
+
- Export both `theme` and `colors` objects from theme file
|
|
29
|
+
- Components extend MUI components with custom styled variants (primary, secondary, tertiary)
|
|
30
|
+
- Border radius: 12px for inputs/buttons, 16px for cards/chips
|
|
31
|
+
- Typography: Inter font family, specific font weights/sizes for each variant
|
|
32
|
+
|
|
33
|
+
### Build System
|
|
34
|
+
- Uses `tsup` for bundling (see `tsup.config.ts`)
|
|
35
|
+
- Outputs CommonJS (`dist/index.js`), ESM (`dist/index.mjs`), and TypeScript declarations (`dist/index.d.ts`)
|
|
36
|
+
- All React, MUI, Monaco, and ReactFlow packages are marked as external dependencies (peer dependencies)
|
|
37
|
+
- Entry point: `src/index.ts` - ALL exports must be added here
|
|
38
|
+
|
|
39
|
+
## Development Commands
|
|
40
|
+
|
|
41
|
+
### Build & Development
|
|
42
|
+
```bash
|
|
43
|
+
# Build the library (produces dist/ folder)
|
|
44
|
+
npm run build
|
|
45
|
+
|
|
46
|
+
# Build in watch mode
|
|
47
|
+
npm run dev
|
|
48
|
+
|
|
49
|
+
# Run Storybook for component development
|
|
50
|
+
npm run storybook
|
|
51
|
+
|
|
52
|
+
# Build Storybook for deployment
|
|
53
|
+
npm run build-storybook
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Testing
|
|
57
|
+
```bash
|
|
58
|
+
# Run Jest unit tests
|
|
59
|
+
npm test
|
|
60
|
+
|
|
61
|
+
# Run tests in watch mode
|
|
62
|
+
npm run test:watch
|
|
63
|
+
|
|
64
|
+
# Generate coverage report
|
|
65
|
+
npm run test:coverage
|
|
66
|
+
|
|
67
|
+
# Run tests in CI mode
|
|
68
|
+
npm run test:ci
|
|
69
|
+
|
|
70
|
+
# Run Storybook interaction tests (includes a11y checks)
|
|
71
|
+
npm run test:storybook
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Code Quality
|
|
75
|
+
```bash
|
|
76
|
+
# Run ESLint
|
|
77
|
+
npm run lint
|
|
78
|
+
|
|
79
|
+
# Fix ESLint issues automatically
|
|
80
|
+
npm run lint:fix
|
|
81
|
+
|
|
82
|
+
# TypeScript type checking
|
|
83
|
+
npm run type-check
|
|
84
|
+
|
|
85
|
+
# Type checking for CI
|
|
86
|
+
npm run check-types:ci
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Testing Requirements
|
|
90
|
+
|
|
91
|
+
### Test Structure
|
|
92
|
+
- Unit tests: Use Jest + React Testing Library in `__tests__/` subdirectories
|
|
93
|
+
- Interaction tests: Use Storybook's `play` function in `.stories.tsx` files
|
|
94
|
+
- All components must wrap with `<ThemeProvider theme={theme}>` in tests
|
|
95
|
+
- Standard test helper pattern:
|
|
96
|
+
```tsx
|
|
97
|
+
const renderWithTheme = (component: React.ReactElement) => {
|
|
98
|
+
return render(<ThemeProvider theme={theme}>{component}</ThemeProvider>);
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Test Coverage
|
|
103
|
+
- Target: 80%+ coverage for component logic
|
|
104
|
+
- Test files should cover: rendering, user interactions, prop variants, callbacks, disabled/error states
|
|
105
|
+
- Storybook Test Runner automatically runs accessibility (a11y) checks using axe-playwright
|
|
106
|
+
|
|
107
|
+
## Adding New Components
|
|
108
|
+
|
|
109
|
+
When adding new components:
|
|
110
|
+
1. Create component file in appropriate category folder in `src/components/`
|
|
111
|
+
2. Export component and TypeScript types (props interface)
|
|
112
|
+
3. Add exports to `src/index.ts` (both component and type exports)
|
|
113
|
+
4. Create Storybook story with examples of all variants/states
|
|
114
|
+
5. Write Jest unit tests in `__tests__/` subdirectory
|
|
115
|
+
6. Follow existing component patterns:
|
|
116
|
+
- Use MUI components as base, extend with `styled()`
|
|
117
|
+
- Support custom variants (primary, secondary, tertiary) where applicable
|
|
118
|
+
- Include proper TypeScript types and JSDoc comments
|
|
119
|
+
- Handle theme integration using `useTheme()` hook or `colors` import
|
|
120
|
+
|
|
121
|
+
## Third-Party Components
|
|
122
|
+
|
|
123
|
+
### FlowEditor (ReactFlow)
|
|
124
|
+
- Wrapper around ReactFlow with theme integration
|
|
125
|
+
- ReactFlow CSS imported in Storybook's preview.tsx
|
|
126
|
+
- Custom props: height, showBackground, showControls, showMinimap
|
|
127
|
+
- Re-exports commonly used ReactFlow types (Node, Edge, NodeTypes, etc.)
|
|
128
|
+
|
|
129
|
+
### CodeEditor (Monaco)
|
|
130
|
+
- Wrapper around Monaco Editor
|
|
131
|
+
- Supports fullscreen mode, validation, type definitions injection
|
|
132
|
+
- TypeScript configuration in `configureTypeScript()` function
|
|
133
|
+
- Monaco loads from node_modules automatically (no loader configuration needed)
|
|
134
|
+
- Supports multiple languages: typescript, javascript, json, yaml, python, etc.
|
|
135
|
+
|
|
136
|
+
## Important Notes
|
|
137
|
+
|
|
138
|
+
- This package uses peer dependencies - consumers must install React, MUI, ReactFlow, and Monaco themselves
|
|
139
|
+
- Do NOT add new dependencies without considering if they should be peer dependencies
|
|
140
|
+
- The package name is `@cere/cere-design-system`
|
|
141
|
+
- When updating MUI components, ensure backward compatibility or update version appropriately
|
|
142
|
+
- ESLint ignores: dist/, config files, and .stories files
|
|
143
|
+
- Jest ignores: stories, test files, index.ts, and .d.ts files for coverage
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Component Architecture Patterns
|
|
2
|
+
|
|
3
|
+
## File Structure Convention
|
|
4
|
+
```
|
|
5
|
+
src/
|
|
6
|
+
├── components/
|
|
7
|
+
│ ├── buttons/
|
|
8
|
+
│ │ ├── Button.tsx
|
|
9
|
+
│ │ ├── Button.stories.tsx
|
|
10
|
+
│ │ └── __tests__/
|
|
11
|
+
│ │ └── Button.test.tsx
|
|
12
|
+
│ ├── inputs/
|
|
13
|
+
│ ├── navigation/
|
|
14
|
+
│ ├── layout/
|
|
15
|
+
│ ├── feedback/
|
|
16
|
+
│ ├── charts/
|
|
17
|
+
│ ├── third-party/
|
|
18
|
+
│ └── utilities/
|
|
19
|
+
├── theme/
|
|
20
|
+
│ └── index.ts (theme definition)
|
|
21
|
+
├── hooks/
|
|
22
|
+
│ └── useResponsive.ts
|
|
23
|
+
└── index.ts (public API)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Component Template Pattern
|
|
27
|
+
```typescript
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
29
|
+
import MuiButton from '@mui/material/Button';
|
|
30
|
+
import type { ButtonProps as MuiButtonProps } from '@mui/material/Button';
|
|
31
|
+
|
|
32
|
+
export interface ButtonProps extends Omit<MuiButtonProps, 'variant'> {
|
|
33
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const StyledButton = styled(MuiButton)<ButtonProps>(({ theme, variant }) => ({
|
|
37
|
+
borderRadius: theme.spacing(1.5),
|
|
38
|
+
...(variant === 'primary' && {
|
|
39
|
+
// Primary styles
|
|
40
|
+
}),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export const Button: React.FC<ButtonProps> = ({ variant = 'primary', ...props }) => {
|
|
44
|
+
return <StyledButton variant={variant} {...props} />;
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Export Pattern
|
|
49
|
+
All components must be exported from `src/index.ts`:
|
|
50
|
+
```typescript
|
|
51
|
+
export { Button } from './components/buttons/Button';
|
|
52
|
+
export type { ButtonProps } from './components/buttons/Button';
|
|
53
|
+
export { theme, colors } from './theme';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Testing Pattern
|
|
57
|
+
```typescript
|
|
58
|
+
import { render, screen } from '@testing-library/react';
|
|
59
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
60
|
+
import { theme } from '@/theme';
|
|
61
|
+
import { Button } from '../Button';
|
|
62
|
+
|
|
63
|
+
const renderWithTheme = (component: React.ReactElement) => {
|
|
64
|
+
return render(<ThemeProvider theme={theme}>{component}</ThemeProvider>);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
describe('Button', () => {
|
|
68
|
+
it('renders primary variant', () => {
|
|
69
|
+
renderWithTheme(<Button variant="primary">Test</Button>);
|
|
70
|
+
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
```
|