@cere/cere-design-system 0.0.11 → 0.0.15
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/{.agent/rules/AGENTS.md → .specify/memory/architecture.md} +1 -3
- package/.specify/memory/component-architecture.md +73 -0
- package/{.agent/rules/COMPONENTS.md → .specify/memory/components-reference.md} +3 -1
- 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 +149 -4
- package/dist/index.d.mts +442 -1
- package/dist/index.d.ts +442 -1
- package/dist/index.js +1325 -497
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1261 -433
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/.agent/README.md +0 -154
- package/.agent/rules/guidelines.md +0 -111
|
@@ -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,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
|
+
```
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Cere Design System - Component Reference
|
|
2
|
+
|
|
1
3
|
You are a senior UI developer with expertise in React, TypeScript, Material-UI, and the Cere Design System.
|
|
2
4
|
When building applications using this design system, follow these guidelines and use the components documented below.
|
|
3
5
|
|
|
@@ -1348,4 +1350,4 @@ All icons are React components that accept standard SVG props (width, height, co
|
|
|
1348
1350
|
</Grid>
|
|
1349
1351
|
</Grid>
|
|
1350
1352
|
</Container>
|
|
1351
|
-
```
|
|
1353
|
+
```
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Cere Design System Constitution
|
|
2
|
+
|
|
3
|
+
This constitution defines the immutable principles and standards that govern the development of the Cere Design System (@cere/cere-design-system). All components, features, and changes must comply with these articles.
|
|
4
|
+
|
|
5
|
+
## Article I: Material UI Foundation
|
|
6
|
+
|
|
7
|
+
**All components MUST extend Material UI components using `styled()` or `sx` prop patterns.**
|
|
8
|
+
|
|
9
|
+
### Requirements
|
|
10
|
+
- Components must be built on top of Material UI base components
|
|
11
|
+
- Use MUI's `styled()` API from `@mui/material/styles` or the `sx` prop for styling
|
|
12
|
+
- Components must support MUI's theming system and be compatible with `ThemeProvider`
|
|
13
|
+
- Follow MUI's component API conventions (props, variants, sizes, event handlers)
|
|
14
|
+
- Maintain backward compatibility with existing component APIs unless a major version bump is warranted
|
|
15
|
+
|
|
16
|
+
### Rationale
|
|
17
|
+
Material UI provides a battle-tested foundation with accessibility, theming, and responsive design built-in. Extending MUI ensures consistency and reduces maintenance burden.
|
|
18
|
+
|
|
19
|
+
## Article II: Component Modularity
|
|
20
|
+
|
|
21
|
+
**Each component must be self-contained, independently exportable, and follow the established file structure.**
|
|
22
|
+
|
|
23
|
+
### Requirements
|
|
24
|
+
- Each component must reside in its appropriate category folder under `src/components/`:
|
|
25
|
+
- `buttons/`, `inputs/`, `navigation/`, `layout/`, `feedback/`, `charts/`, `third-party/`, `utilities/`
|
|
26
|
+
- Components must export both the component itself and its TypeScript type interfaces
|
|
27
|
+
- All public exports must be registered in `src/index.ts` (both component and type exports)
|
|
28
|
+
- Components must not have tight coupling; prefer composition patterns and prop-based configuration
|
|
29
|
+
- Each component must be independently importable: `import { Button } from '@cere/cere-design-system'`
|
|
30
|
+
|
|
31
|
+
### File Structure
|
|
32
|
+
```
|
|
33
|
+
src/components/[category]/
|
|
34
|
+
├── [ComponentName].tsx # Component implementation
|
|
35
|
+
├── [ComponentName].stories.tsx # Storybook documentation
|
|
36
|
+
└── __tests__/
|
|
37
|
+
└── [ComponentName].test.tsx # Jest tests
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Article III: Testing Standards (NON-NEGOTIABLE)
|
|
41
|
+
|
|
42
|
+
**Every component MUST have comprehensive test coverage before being merged.**
|
|
43
|
+
|
|
44
|
+
### Requirements
|
|
45
|
+
1. **Jest Unit Tests** (in `__tests__/` subdirectory):
|
|
46
|
+
- Target: 80%+ code coverage
|
|
47
|
+
- Test rendering, user interactions, prop variants, callbacks, disabled/error states
|
|
48
|
+
- Use React Testing Library idioms (prefer `getByRole`, `getByLabelText`, user-event)
|
|
49
|
+
- Tests must wrap components with `ThemeProvider` using the design system theme
|
|
50
|
+
|
|
51
|
+
2. **Storybook Stories** (with all variants/states documented):
|
|
52
|
+
- Create stories for all visual variants, sizes, and states
|
|
53
|
+
- Include interaction tests using `play` functions from `@storybook/test`
|
|
54
|
+
- Document props with JSDoc comments that appear in Storybook
|
|
55
|
+
|
|
56
|
+
3. **Accessibility Tests**:
|
|
57
|
+
- Storybook integration with axe-playwright automatically checks accessibility
|
|
58
|
+
- Run via `npm run test:storybook`
|
|
59
|
+
- All interactive components must pass WCAG AA standards
|
|
60
|
+
|
|
61
|
+
### Test Pattern
|
|
62
|
+
```typescript
|
|
63
|
+
import { render, screen } from '@testing-library/react';
|
|
64
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
65
|
+
import { theme } from '@/theme';
|
|
66
|
+
|
|
67
|
+
const renderWithTheme = (component: React.ReactElement) => {
|
|
68
|
+
return render(
|
|
69
|
+
<ThemeProvider theme={theme}>
|
|
70
|
+
{component}
|
|
71
|
+
</ThemeProvider>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Article IV: Type Safety
|
|
77
|
+
|
|
78
|
+
**All components must be written in TypeScript with explicit, strict type definitions.**
|
|
79
|
+
|
|
80
|
+
### Requirements
|
|
81
|
+
- All components must be written in TypeScript (`.tsx` files)
|
|
82
|
+
- Export all prop interfaces with `Props` suffix (e.g., `ButtonProps`, `TextFieldProps`)
|
|
83
|
+
- Use strict TypeScript configuration; avoid `any` types
|
|
84
|
+
- Provide comprehensive JSDoc comments for all public APIs and prop interfaces
|
|
85
|
+
- Type exports must be separate from component exports in `src/index.ts`:
|
|
86
|
+
```typescript
|
|
87
|
+
export { Button } from './components/buttons/Button';
|
|
88
|
+
export type { ButtonProps } from './components/buttons/Button';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Type Definition Pattern
|
|
92
|
+
```typescript
|
|
93
|
+
import type { ButtonProps as MuiButtonProps } from '@mui/material/Button';
|
|
94
|
+
|
|
95
|
+
export interface ButtonProps extends Omit<MuiButtonProps, 'variant'> {
|
|
96
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
97
|
+
// Custom props with JSDoc
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Article V: Build System Integrity
|
|
102
|
+
|
|
103
|
+
**The package build system must produce optimized, tree-shakeable outputs with proper peer dependencies.**
|
|
104
|
+
|
|
105
|
+
### Requirements
|
|
106
|
+
- Package builds via `tsup` producing:
|
|
107
|
+
- CommonJS format (`dist/index.js`)
|
|
108
|
+
- ESM format (`dist/index.mjs`)
|
|
109
|
+
- TypeScript declarations (`dist/index.d.ts`)
|
|
110
|
+
- All React, MUI, Monaco, and ReactFlow packages must be peer dependencies (not bundled)
|
|
111
|
+
- No new dependencies without evaluating if they should be peer dependencies
|
|
112
|
+
- Entry point is `src/index.ts` - all public APIs must export through this single file
|
|
113
|
+
- Build must complete without errors: `npm run build`
|
|
114
|
+
- Type checking must pass: `npm run type-check`
|
|
115
|
+
- Linting must pass: `npm run lint`
|
|
116
|
+
|
|
117
|
+
### Peer Dependencies
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"peerDependencies": {
|
|
121
|
+
"react": "^18.0.0",
|
|
122
|
+
"react-dom": "^18.0.0",
|
|
123
|
+
"@mui/material": "^5.0.0",
|
|
124
|
+
"@emotion/react": "^11.0.0",
|
|
125
|
+
"@emotion/styled": "^11.0.0"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Article VI: Documentation Requirements
|
|
131
|
+
|
|
132
|
+
**Every component must have comprehensive, up-to-date documentation.**
|
|
133
|
+
|
|
134
|
+
### Requirements
|
|
135
|
+
1. **Storybook Documentation**:
|
|
136
|
+
- Every component must have a `.stories.tsx` file
|
|
137
|
+
- Stories must demonstrate all variants, sizes, and states
|
|
138
|
+
- Include interactive examples and code snippets
|
|
139
|
+
|
|
140
|
+
2. **Component Reference**:
|
|
141
|
+
- Keep `.specify/memory/components-reference.md` synchronized with all component changes
|
|
142
|
+
- Document all props, usage examples, and best practices
|
|
143
|
+
- Update after every component addition or API change
|
|
144
|
+
|
|
145
|
+
3. **Type Documentation**:
|
|
146
|
+
- Add JSDoc comments to all exported interfaces and components
|
|
147
|
+
- Document prop purposes, default values, and constraints
|
|
148
|
+
|
|
149
|
+
4. **Versioning**:
|
|
150
|
+
- Breaking changes require version updates following semver (MAJOR.MINOR.PATCH)
|
|
151
|
+
- Maintain a changelog documenting all changes
|
|
152
|
+
|
|
153
|
+
## Article VII: Design Consistency
|
|
154
|
+
|
|
155
|
+
**All components must follow the design tokens defined in the theme.**
|
|
156
|
+
|
|
157
|
+
### Design Tokens (Defined in `src/theme/index.ts`)
|
|
158
|
+
- **Primary color**: `#1976d2` (blue)
|
|
159
|
+
- **Border radius**:
|
|
160
|
+
- Inputs/buttons: `12px`
|
|
161
|
+
- Cards/chips: `16px`
|
|
162
|
+
- **Typography**: Inter font family
|
|
163
|
+
- **Component variants**: primary, secondary, tertiary (where applicable)
|
|
164
|
+
- **Spacing**: Use theme's spacing system (`theme.spacing(n)` where n is a multiple of 8px)
|
|
165
|
+
|
|
166
|
+
### Requirements
|
|
167
|
+
- Components must reference theme tokens, not hardcoded values
|
|
168
|
+
- Use `useTheme()` hook or `colors` import for accessing theme values
|
|
169
|
+
- Maintain visual consistency across the design system
|
|
170
|
+
- Responsive design using MUI Grid system or custom responsive hooks
|
|
171
|
+
|
|
172
|
+
### Theme Usage Pattern
|
|
173
|
+
```typescript
|
|
174
|
+
import { useTheme } from '@mui/material/styles';
|
|
175
|
+
import { colors } from '@cere/cere-design-system';
|
|
176
|
+
|
|
177
|
+
const theme = useTheme();
|
|
178
|
+
// Use: theme.palette.primary.main
|
|
179
|
+
// Use: colors.primary.main
|
|
180
|
+
// Use: theme.spacing(2) // 16px
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Article VIII: Accessibility First
|
|
184
|
+
|
|
185
|
+
**All interactive components must be fully accessible to keyboard and assistive technology users.**
|
|
186
|
+
|
|
187
|
+
### Requirements
|
|
188
|
+
- All interactive components must be keyboard navigable (Tab, Enter, Space, Arrow keys)
|
|
189
|
+
- Provide proper ARIA labels, roles, and live regions
|
|
190
|
+
- Ensure color contrast meets WCAG AA standards (4.5:1 for normal text, 3:1 for large text)
|
|
191
|
+
- Support screen readers and assistive technologies
|
|
192
|
+
- Test with Storybook's axe-playwright integration
|
|
193
|
+
- Focus management for dialogs, drawers, and modals
|
|
194
|
+
|
|
195
|
+
### Accessibility Checklist
|
|
196
|
+
- [ ] Keyboard navigation works correctly
|
|
197
|
+
- [ ] ARIA attributes are present and accurate
|
|
198
|
+
- [ ] Color contrast passes WCAG AA
|
|
199
|
+
- [ ] Screen reader announces changes appropriately
|
|
200
|
+
- [ ] Focus indicators are visible
|
|
201
|
+
- [ ] No keyboard traps
|
|
202
|
+
|
|
203
|
+
## Article IX: Third-Party Integration
|
|
204
|
+
|
|
205
|
+
**Third-party component wrappers must provide typed interfaces and maintain clear boundaries.**
|
|
206
|
+
|
|
207
|
+
### Requirements
|
|
208
|
+
For wrappers around third-party libraries (e.g., FlowEditor wrapping ReactFlow, CodeEditor wrapping Monaco):
|
|
209
|
+
|
|
210
|
+
1. **Type Safety**:
|
|
211
|
+
- Provide typed interfaces aligned with the underlying library
|
|
212
|
+
- Re-export commonly used types from the third-party library
|
|
213
|
+
- Make wrapper-specific props clearly distinct from pass-through props
|
|
214
|
+
|
|
215
|
+
2. **Theme Integration**:
|
|
216
|
+
- Include theme integration where applicable
|
|
217
|
+
- Respect design system colors, typography, and spacing
|
|
218
|
+
|
|
219
|
+
3. **Documentation**:
|
|
220
|
+
- Maintain clear documentation of wrapper-specific vs. pass-through props
|
|
221
|
+
- Document which third-party features are exposed vs. hidden
|
|
222
|
+
- Provide migration guides if wrapper APIs change
|
|
223
|
+
|
|
224
|
+
4. **Peer Dependencies**:
|
|
225
|
+
- Third-party libraries must be peer dependencies
|
|
226
|
+
- Document minimum required versions
|
|
227
|
+
|
|
228
|
+
### Example: FlowEditor
|
|
229
|
+
```typescript
|
|
230
|
+
import type { Node, Edge, ReactFlowInstance } from 'reactflow';
|
|
231
|
+
|
|
232
|
+
export interface FlowEditorProps {
|
|
233
|
+
nodes: Node[]; // From reactflow
|
|
234
|
+
edges: Edge[]; // From reactflow
|
|
235
|
+
height?: string; // Wrapper-specific
|
|
236
|
+
showBackground?: boolean; // Wrapper-specific
|
|
237
|
+
// ... other props
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Re-export common types
|
|
241
|
+
export type { Node, Edge, NodeTypes, EdgeTypes, ReactFlowInstance } from 'reactflow';
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Development Workflow
|
|
245
|
+
|
|
246
|
+
### Component Development Process
|
|
247
|
+
1. **Specification**: Create a feature spec using `/speckit.specify`
|
|
248
|
+
2. **Planning**: Generate implementation plan using `/speckit.plan`
|
|
249
|
+
3. **Task Breakdown**: Create task checklist using `/speckit.tasks`
|
|
250
|
+
4. **Implementation**: Follow the tasks, adhering to all articles above
|
|
251
|
+
5. **Validation**: Run all checks before PR:
|
|
252
|
+
```bash
|
|
253
|
+
npm run type-check && npm run lint && npm run test && npm run build && npm run test:storybook
|
|
254
|
+
```
|
|
255
|
+
6. **Review**: Code review must verify constitutional compliance
|
|
256
|
+
7. **Documentation**: Update `components-reference.md` before merging
|
|
257
|
+
|
|
258
|
+
### Quality Gates
|
|
259
|
+
All PRs must pass:
|
|
260
|
+
- ✅ TypeScript compilation
|
|
261
|
+
- ✅ ESLint checks
|
|
262
|
+
- ✅ Jest tests (80%+ coverage)
|
|
263
|
+
- ✅ Build succeeds
|
|
264
|
+
- ✅ Storybook accessibility tests
|
|
265
|
+
- ✅ Component reference updated
|
|
266
|
+
- ✅ Constitutional compliance verified
|
|
267
|
+
|
|
268
|
+
## Governance
|
|
269
|
+
|
|
270
|
+
### Constitutional Supremacy
|
|
271
|
+
- This constitution supersedes all other development practices and guidelines
|
|
272
|
+
- When in conflict, the constitution takes precedence
|
|
273
|
+
- All code reviews must verify compliance with these articles
|
|
274
|
+
|
|
275
|
+
### Amendments
|
|
276
|
+
- Constitutional amendments require:
|
|
277
|
+
1. Documented rationale for the change
|
|
278
|
+
2. Team approval/consensus
|
|
279
|
+
3. Migration plan for existing components if needed
|
|
280
|
+
4. Version update in this document
|
|
281
|
+
|
|
282
|
+
### Non-Negotiable Articles
|
|
283
|
+
- **Article III (Testing Standards)**: Cannot be waived or reduced
|
|
284
|
+
- **Article VIII (Accessibility First)**: Cannot be compromised
|
|
285
|
+
|
|
286
|
+
### Guidance Documents
|
|
287
|
+
For detailed development patterns and examples, consult:
|
|
288
|
+
- `.specify/memory/architecture.md` - Component architecture patterns
|
|
289
|
+
- `.specify/memory/design-tokens.md` - Complete design token reference
|
|
290
|
+
- `.specify/memory/workflow.md` - Step-by-step development workflow
|
|
291
|
+
- `.specify/memory/components-reference.md` - Complete component API documentation
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
**Version**: 1.0.0 | **Ratified**: 2026-02-03 | **Last Amended**: 2026-02-03
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Cere Design System - Design Tokens
|
|
2
|
+
|
|
3
|
+
## Color Palette
|
|
4
|
+
|
|
5
|
+
### Primary Colors
|
|
6
|
+
- Primary Main: `#1976d2` (blue)
|
|
7
|
+
- Primary Light: `#42a5f5`
|
|
8
|
+
- Primary Dark: `#1565c0`
|
|
9
|
+
- Primary Contrast Text: `#ffffff`
|
|
10
|
+
|
|
11
|
+
### Secondary Colors
|
|
12
|
+
- Secondary Main: `#dc004e`
|
|
13
|
+
- Secondary Light: `#f50057`
|
|
14
|
+
- Secondary Dark: `#9a0036`
|
|
15
|
+
- Secondary Contrast Text: `#ffffff`
|
|
16
|
+
|
|
17
|
+
### Tertiary Colors
|
|
18
|
+
- Tertiary Main: `#ff9800` (orange/amber)
|
|
19
|
+
|
|
20
|
+
### Semantic Colors
|
|
21
|
+
- Error: `#f44336`
|
|
22
|
+
- Warning: `#ff9800`
|
|
23
|
+
- Info: `#2196f3`
|
|
24
|
+
- Success: `#4caf50`
|
|
25
|
+
|
|
26
|
+
### Grey Scale
|
|
27
|
+
- Grey 50: `#fafafa`
|
|
28
|
+
- Grey 100: `#f5f5f5`
|
|
29
|
+
- Grey 200: `#eeeeee`
|
|
30
|
+
- Grey 300: `#e0e0e0`
|
|
31
|
+
- Grey 400: `#bdbdbd`
|
|
32
|
+
- Grey 500: `#9e9e9e`
|
|
33
|
+
- Grey 600: `#757575`
|
|
34
|
+
- Grey 700: `#616161`
|
|
35
|
+
- Grey 800: `#424242`
|
|
36
|
+
- Grey 900: `#212121`
|
|
37
|
+
|
|
38
|
+
### Background
|
|
39
|
+
- Default: `#fafafa`
|
|
40
|
+
- Paper: `#ffffff`
|
|
41
|
+
- Selected: `rgba(25, 118, 210, 0.08)`
|
|
42
|
+
|
|
43
|
+
### Text
|
|
44
|
+
- Primary: `rgba(0, 0, 0, 0.87)`
|
|
45
|
+
- Secondary: `rgba(0, 0, 0, 0.6)`
|
|
46
|
+
- Disabled: `rgba(0, 0, 0, 0.38)`
|
|
47
|
+
|
|
48
|
+
## Typography
|
|
49
|
+
|
|
50
|
+
### Font Family
|
|
51
|
+
- Primary: `'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif`
|
|
52
|
+
|
|
53
|
+
### Font Weights
|
|
54
|
+
- Light: 300
|
|
55
|
+
- Regular: 400
|
|
56
|
+
- Medium: 500
|
|
57
|
+
- Semi-Bold: 600
|
|
58
|
+
- Bold: 700
|
|
59
|
+
|
|
60
|
+
### Type Scale
|
|
61
|
+
- h1: 2.5rem (40px), weight: 700
|
|
62
|
+
- h2: 2rem (32px), weight: 700
|
|
63
|
+
- h3: 1.75rem (28px), weight: 600
|
|
64
|
+
- h4: 1.5rem (24px), weight: 600
|
|
65
|
+
- h5: 1.25rem (20px), weight: 600
|
|
66
|
+
- h6: 1rem (16px), weight: 600
|
|
67
|
+
- subtitle1: 1rem (16px), weight: 500
|
|
68
|
+
- subtitle2: 0.875rem (14px), weight: 500
|
|
69
|
+
- body1: 1rem (16px), weight: 400
|
|
70
|
+
- body2: 0.875rem (14px), weight: 400
|
|
71
|
+
- caption: 0.75rem (12px), weight: 400
|
|
72
|
+
- button: 0.875rem (14px), weight: 500, uppercase
|
|
73
|
+
- overline: 0.625rem (10px), weight: 400, uppercase
|
|
74
|
+
|
|
75
|
+
## Spacing System
|
|
76
|
+
Based on 8px scale:
|
|
77
|
+
- 0: 0px
|
|
78
|
+
- 1: 8px
|
|
79
|
+
- 2: 16px
|
|
80
|
+
- 3: 24px
|
|
81
|
+
- 4: 32px
|
|
82
|
+
- 5: 40px
|
|
83
|
+
- 6: 48px
|
|
84
|
+
- 7: 56px
|
|
85
|
+
- 8: 64px
|
|
86
|
+
- 9: 72px
|
|
87
|
+
- 10: 80px
|
|
88
|
+
|
|
89
|
+
## Border Radius
|
|
90
|
+
- Small (inputs, buttons): 12px
|
|
91
|
+
- Medium (cards, chips): 16px
|
|
92
|
+
- Large: 24px
|
|
93
|
+
- Circle: 50%
|
|
94
|
+
|
|
95
|
+
## Elevation (Shadows)
|
|
96
|
+
Follows Material Design elevation levels:
|
|
97
|
+
- Level 0: none
|
|
98
|
+
- Level 1: `0px 2px 4px rgba(0,0,0,0.1)`
|
|
99
|
+
- Level 2: `0px 4px 8px rgba(0,0,0,0.1)`
|
|
100
|
+
- Level 3: `0px 6px 12px rgba(0,0,0,0.1)`
|
|
101
|
+
- Level 24: Maximum elevation
|
|
102
|
+
|
|
103
|
+
## Breakpoints
|
|
104
|
+
- xs: 0px (mobile)
|
|
105
|
+
- sm: 600px (tablet)
|
|
106
|
+
- md: 960px (desktop)
|
|
107
|
+
- lg: 1280px (large desktop)
|
|
108
|
+
- xl: 1920px (extra large)
|
|
109
|
+
|
|
110
|
+
## Custom Breakpoint Hooks
|
|
111
|
+
- `useIsMobile()`: < 768px
|
|
112
|
+
- `useIsTablet()`: 768px - 1024px
|
|
113
|
+
- `useIsDesktop()`: > 1024px
|
|
114
|
+
|
|
115
|
+
## Transitions
|
|
116
|
+
- Duration: 300ms (standard)
|
|
117
|
+
- Easing: cubic-bezier(0.4, 0, 0.2, 1)
|
|
118
|
+
|
|
119
|
+
## Z-Index Scale
|
|
120
|
+
- Drawer: 1200
|
|
121
|
+
- AppBar: 1100
|
|
122
|
+
- Modal: 1300
|
|
123
|
+
- Snackbar: 1400
|
|
124
|
+
- Tooltip: 1500
|
|
125
|
+
|
|
126
|
+
## Implementation
|
|
127
|
+
All tokens are defined in `src/theme/index.ts` using MUI's `createTheme()`.
|
|
128
|
+
Components should reference theme tokens, not hardcoded values.
|
|
129
|
+
|
|
130
|
+
Example:
|
|
131
|
+
```typescript
|
|
132
|
+
import { useTheme } from '@mui/material';
|
|
133
|
+
import { colors } from '@cere/cere-design-system';
|
|
134
|
+
|
|
135
|
+
const theme = useTheme();
|
|
136
|
+
// Use: theme.palette.primary.main
|
|
137
|
+
// Use: colors.primary.main
|
|
138
|
+
// Use: theme.spacing(2) // 16px
|
|
139
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Using Cere Design System in Your Application's Spec Kit
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This guide shows how to reference and use the Cere Design System (@cere/cere-design-system) in your application's Spec-Driven Development workflow.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
```bash
|
|
8
|
+
npm install @cere/cere-design-system
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Referencing in Your Application's Specs
|
|
12
|
+
|
|
13
|
+
### Method 1: Direct Reference in Constitution
|
|
14
|
+
In your application's `.specify/memory/constitution.md`, add an article requiring the design system:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
# Application Constitution
|
|
18
|
+
|
|
19
|
+
## Article: UI Component Standards
|
|
20
|
+
|
|
21
|
+
### Design System Requirement
|
|
22
|
+
All UI components MUST use the Cere Design System (@cere/cere-design-system).
|
|
23
|
+
|
|
24
|
+
### Component Reference
|
|
25
|
+
Available components and their APIs are documented at:
|
|
26
|
+
`node_modules/@cere/cere-design-system/.specify/memory/components-reference.md`
|
|
27
|
+
|
|
28
|
+
All developers and AI agents MUST consult this reference before implementing UI features.
|
|
29
|
+
|
|
30
|
+
### Usage Requirements
|
|
31
|
+
1. Always wrap application with ThemeProvider:
|
|
32
|
+
```tsx
|
|
33
|
+
import { ThemeProvider, theme } from '@cere/cere-design-system';
|
|
34
|
+
|
|
35
|
+
<ThemeProvider theme={theme}>
|
|
36
|
+
<App />
|
|
37
|
+
</ThemeProvider>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. Import components from the package:
|
|
41
|
+
```tsx
|
|
42
|
+
import { Button, TextField, Card } from '@cere/cere-design-system';
|
|
43
|
+
import type { ButtonProps } from '@cere/cere-design-system';
|
|
44
|
+
```
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Method 2: Create Design System Memory Reference
|
|
48
|
+
Create `.specify/memory/design-system.md` in your application:
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# Cere Design System Reference
|
|
52
|
+
|
|
53
|
+
This application uses @cere/cere-design-system
|
|
54
|
+
|
|
55
|
+
## Quick Reference
|
|
56
|
+
See complete component reference:
|
|
57
|
+
`node_modules/@cere/cere-design-system/.specify/memory/components-reference.md`
|
|
58
|
+
|
|
59
|
+
## Example Usage
|
|
60
|
+
```tsx
|
|
61
|
+
import { Card, TextField, LoadingButton, Alert } from '@cere/cere-design-system';
|
|
62
|
+
|
|
63
|
+
<Card>
|
|
64
|
+
<CardContent>
|
|
65
|
+
<Stack spacing={2}>
|
|
66
|
+
<TextField label="Email" />
|
|
67
|
+
<LoadingButton variant="primary">Submit</LoadingButton>
|
|
68
|
+
</Stack>
|
|
69
|
+
</CardContent>
|
|
70
|
+
</Card>
|
|
71
|
+
```
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## AI Agent Instructions
|
|
75
|
+
|
|
76
|
+
When AI agents work on specs that use the Cere Design System:
|
|
77
|
+
|
|
78
|
+
### 1. Always Reference Component Documentation
|
|
79
|
+
Before suggesting code, agents should reference:
|
|
80
|
+
`node_modules/@cere/cere-design-system/.specify/memory/components-reference.md`
|
|
81
|
+
|
|
82
|
+
### 2. Follow Design System Patterns
|
|
83
|
+
- Use ThemeProvider wrapper
|
|
84
|
+
- Import components from package root
|
|
85
|
+
- Use design system colors/theme tokens
|
|
86
|
+
|
|
87
|
+
### 3. Type Safety
|
|
88
|
+
Always import TypeScript types:
|
|
89
|
+
```tsx
|
|
90
|
+
import type { ButtonProps, TextFieldProps } from '@cere/cere-design-system';
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Best Practices Summary
|
|
94
|
+
|
|
95
|
+
1. ✅ **Always reference** `components-reference.md` before using components
|
|
96
|
+
2. ✅ **Import types** for TypeScript safety
|
|
97
|
+
3. ✅ **Use ThemeProvider** at application root
|
|
98
|
+
4. ✅ **Follow design system patterns** for consistency
|
|
99
|
+
5. ✅ **Include design system requirements** in feature specs
|