5.4 KiB
STYLE-001 MVP Implementation - CHANGELOG
Date: 2026-01-12
Phase: STYLE-001-MVP (Minimal Viable Product)
Status: ✅ Complete - Ready for Testing
📦 What Was Implemented
This MVP provides the foundation for the Style Tokens system. It includes:
- Default Tokens - 10 essential design tokens
- Storage System - Tokens saved in project metadata
- CSS Injection - Tokens automatically injected into preview
- Real-time Updates - Changes reflected immediately
What's NOT in this MVP
- ❌ UI Panel to edit tokens
- ❌ Token Picker component
- ❌ Import/Export functionality
- ❌ All token categories (only essentials)
These will come in future phases.
🗂️ Files Created
Editor Side (Token Management)
packages/noodl-editor/src/editor/src/models/StyleTokens/
├── DefaultTokens.ts ✅ NEW - 10 default tokens
├── StyleTokensModel.ts ✅ NEW - Token management model
└── index.ts ✅ NEW - Exports
Purpose: Manage tokens in the editor, save to project metadata.
Viewer Side (CSS Injection)
packages/noodl-viewer-react/src/
├── style-tokens-injector.ts ✅ NEW - Injects CSS into preview
└── viewer.jsx ✅ MODIFIED - Initialize injector
Purpose: Load tokens from project and inject as CSS custom properties.
🎨 Default Tokens Included
| Token | Value | Category | Usage |
|---|---|---|---|
--primary |
#3b82f6 (Blue) |
color | Primary buttons, links |
--background |
#ffffff (White) |
color | Page background |
--foreground |
#0f172a (Near black) |
color | Text color |
--border |
#e2e8f0 (Light gray) |
color | Borders |
--space-sm |
8px |
spacing | Small padding/margins |
--space-md |
16px |
spacing | Medium padding/margins |
--space-lg |
24px |
spacing | Large padding/margins |
--radius-md |
8px |
border | Border radius |
--shadow-sm |
0 1px 2px ... |
shadow | Small shadow |
--shadow-md |
0 4px 6px ... |
shadow | Medium shadow |
🔧 Technical Implementation
1. Data Flow
ProjectModel
↓ (stores metadata)
StyleTokensModel.ts
↓ (loads/saves tokens)
StyleTokensInjector.ts
↓ (generates CSS)
<style> in DOM
↓ (CSS variables available)
Visual Elements
2. Storage Format
Tokens are stored in project metadata:
{
"styleTokens": {
"--primary": "#3b82f6",
"--background": "#ffffff",
"--foreground": "#0f172a"
// ... more tokens
}
}
3. CSS Injection
Tokens are injected as CSS custom properties:
:root {
--primary: #3b82f6;
--background: #ffffff;
--foreground: #0f172a;
--border: #e2e8f0;
--space-sm: 8px;
--space-md: 16px;
--space-lg: 24px;
--radius-md: 8px;
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
✅ How to Test
See TESTING-GUIDE.md for detailed testing instructions.
Quick Test
- Start the editor:
npm run dev - Create a new project
- Add a visual node (e.g., Group, Text)
- In the styles, use a token:
background: var(--primary) padding: var(--space-md) border-radius: var(--radius-md) - Preview should show: Blue background, 16px padding, 8px rounded corners
🔄 Integration Points
For Future Development
STYLE-002 (Element Configs) will need:
- Access to
StyleTokensModelto read available tokens - Token references in variant definitions
STYLE-003 (Presets) will need:
StyleTokensModel.setToken()to apply preset values- Bulk token updates
STYLE-004 (Property Panel) will need:
- Token picker UI component
- Visual preview of token values
🐛 Known Limitations
-
No UI to edit tokens - Must be done via browser DevTools console for now:
// In browser console: window.ProjectModel.instance.setMetaData('styleTokens', { '--primary': '#ff0000', // Red instead of blue '--space-md': '20px' // 20px instead of 16px }); -
Limited token set - Only 10 tokens for MVP. More categories coming in STYLE-001 full version.
-
No validation - Token values are not validated. Invalid CSS will fail silently.
📊 Metrics
- Files Created: 4
- Files Modified: 1
- Lines of Code: ~400
- Default Tokens: 10
- Time to Implement: ~4-6 hours
- Test Coverage: Manual testing required
🎯 Success Criteria
- Tokens are defined with sensible defaults
- Tokens are stored in project metadata
- Tokens are injected as CSS variables
- Tokens can be used in element styles
- Changes persist across editor restarts
- TypeScript types are properly defined
- No eslint errors in new code
🚀 Next Steps
- Test the MVP - Follow TESTING-GUIDE.md
- Gather feedback - Does it work as expected?
- Plan STYLE-001 Full - UI panel, more tokens, token picker
- Continue to STYLE-002 - Element configs and variants
Created: 2026-01-12
Last Updated: 2026-01-12