GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode-mobile/scripts/gen-ui-tokens.mjs at main · drpr/opencode-mobile Expand file tree/ Copy pathgen-ui-tokens.mjsMore file actions 28 lines (27 loc) · 1.7 KB / Copy pathgen-ui-tokens.mjsFile metadata and controls28 lines (27 loc) · 1.7 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 import { readFile, writeFile } from 'node:fs/promises'; const root = new URL('../', import.meta.url); const tokens = JSON.parse(await readFile(new URL('shared/ui/theme/ui-tokens.json', root), 'utf8')); const lines = ['/* Generated by npm run gen:ui-tokens. Edit ui-tokens.json. */', '@theme {']; for (const [name, value] of Object.entries(tokens.shape)) lines.push(` --radius-${name}: ${value}px;`); for (const [name, value] of Object.entries(tokens.controls)) lines.push(` --spacing-${name}: ${value}px;`); for (const [name, value] of Object.entries(tokens.spacing)) lines.push(` --spacing-${name}: ${value}px;`); for (const [name, value] of Object.entries(tokens.typography)) { lines.push(` --text-${name}: ${value.fontSize}px;`, ` --text-${name}--line-height: ${value.lineHeight}px;`); } lines.push('}', '@layer theme {', ' :root {'); for (const scheme of ['light', 'dark']) { lines.push(` @variant ${scheme} {`); for (const [alias, role] of Object.entries(tokens.aliases)) lines.push(` --color-${alias}: ${({ ...tokens.colors[scheme], ...tokens.presets.green[scheme] })[role]};`); lines.push(' }'); } for (const platform of ['ios', 'android', 'web']) { lines.push(` @variant ${platform} {`); for (const [role, value] of Object.entries(tokens.fonts[platform] ?? tokens.fonts.default)) lines.push(` --font-${role}: ${value};`); lines.push(' }'); } lines.push(' }', '}'); const output = `${lines.join('\n')}\n`; const destination = new URL('shared/ui/theme/ui-tokens.generated.css', root); if (process.argv.includes('--check')) { if (await readFile(destination, 'utf8') !== output) throw new Error('UI tokens are stale. Run npm run gen:ui-tokens.'); } else await writeFile(destination, output); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |