Initial commit: VoIdeaAI - voice-first AI idea assistant
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/* VoIdeaAI Design Tokens — auto-generated */
|
||||
/* Source: docs/design-system/tokens.json */
|
||||
:root {
|
||||
--colors-background: #FFFFFF;
|
||||
--spacing-xs: 0.25rem;
|
||||
--spacing-sm: 0.5rem;
|
||||
--spacing-md: 1rem;
|
||||
--spacing-lg: 1.5rem;
|
||||
--border_radius-sm: 0.25rem;
|
||||
--border_radius-md: 0.5rem;
|
||||
--border_radius-lg: 0.75rem;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--colors-background: #0F172A;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
"""Design tokens CSS generator for VoIdeaAI.
|
||||
|
||||
Reads docs/design-system/tokens.json and generates:
|
||||
- app/design-tokens/css/tokens.css
|
||||
"""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
TOKENS_PATH = Path(__file__).parent.parent.parent / "docs" / "design-system" / "tokens.json"
|
||||
OUTPUT_PATH = Path(__file__).parent / "css" / "tokens.css"
|
||||
|
||||
|
||||
def load_tokens() -> dict:
|
||||
if not TOKENS_PATH.exists():
|
||||
return {}
|
||||
return json.loads(TOKENS_PATH.read_text(encoding="utf-8-sig"))
|
||||
|
||||
|
||||
def generate_css(tokens: dict) -> str:
|
||||
lines = [
|
||||
"/* VoIdeaAI Design Tokens — auto-generated */",
|
||||
"/* Source: docs/design-system/tokens.json */",
|
||||
":root {",
|
||||
]
|
||||
|
||||
for category, values in tokens.items():
|
||||
if not isinstance(values, dict):
|
||||
continue
|
||||
for key, value in values.items():
|
||||
if key == "$schema":
|
||||
continue
|
||||
if isinstance(value, dict):
|
||||
for mode, val in value.items():
|
||||
if mode == "light":
|
||||
lines.append(f" --{category}-{key}: {val};")
|
||||
elif isinstance(value, (str, int, float)):
|
||||
lines.append(f" --{category}-{key}: {value};")
|
||||
|
||||
lines.append("}")
|
||||
lines.append("")
|
||||
lines.append(".dark {")
|
||||
for category, values in tokens.items():
|
||||
if not isinstance(values, dict):
|
||||
continue
|
||||
for key, value in values.items():
|
||||
if key == "$schema":
|
||||
continue
|
||||
if isinstance(value, dict):
|
||||
for mode, val in value.items():
|
||||
if mode == "dark":
|
||||
lines.append(f" --{category}-{key}: {val};")
|
||||
lines.append("}")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def main():
|
||||
tokens = load_tokens()
|
||||
if not tokens:
|
||||
print("tokens.json not found, skipping")
|
||||
return
|
||||
|
||||
OUTPUT_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
css = generate_css(tokens)
|
||||
OUTPUT_PATH.write_text(css, encoding="utf-8")
|
||||
print(f"Generated {OUTPUT_PATH} ({len(css)} bytes)")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user