@motion-proto/live-tokens
v0.1.1
Published
Design token editor with live CSS variable editing. Svelte 4 + Vite.
Maintainers
Readme
Live Tokens
A starter Svelte + Vite site with a full design-token system and an in-browser editor.
What you get
- Design-token admin panel at
/admin(dev-only). Edit colors, typography, spacing, radii, shadows, and motion, and see the whole site update live. - Live editor overlay pinned to the top-right of every page in dev. Opens the token editor in a side panel or floating window without leaving the page you're styling.
- Page Source button — jumps straight to the current page's Svelte file in VS Code (
vscode://link). - Component library at
/components: Button, Card, Dialog, Badge, Tabs, Tooltip, Toggle, and more. - Token persistence: each saved palette is a JSON file in
tokens/. The active palette syncs intosrc/styles/variables.csson save, so production builds ship pure CSS.
Quick start
npm install
npm run devOpen http://localhost:5173. The editor overlay sits in the top-right corner. Click Editor to expand it, or hit Fullscreen to jump to /admin.
Layout
src/pages/Landing.svelte— the welcome page (replace this with your site)src/pages/Admin.svelte— design-system editorsrc/pages/ShowcasePage.svelte— component showcasesrc/components/— the reusable componentssrc/showcase/— the editor UI (tabs, palette editors, curve editor, backup browser)src/lib/— the overlay, router glue, token persistence, and color helperssrc/styles/variables.css— the generated CSS variables (this is the source of truth at runtime)tokens/— persisted palette files;_active.jsonselects the palette loaded on dev,_production.jsonselects the palette synced to CSS
How the editor ships changes to prod
- Edit in
/admin→ the overlay writes to the active JSON file intokens/. - When you promote a palette to "production", its variables are written into
src/styles/variables.cssand backed up undersrc/styles/_backups/. npm run buildbundles that CSS file as-is. No token-editor code or JSON lookups in the prod bundle.
License
MIT. Originally extracted from RuneGoblin.
