git mv of everything (web/ android/ qt/ wasi/ android-wasm/ tests/ ci/ pixi.toml README) so history follows; legacy/ keeps its own .gitignore and a new root .gitignore starts for the MoonBit project. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
225 lines
13 KiB
CSS
225 lines
13 KiB
CSS
/* ultra/ui.css: shadcn/ui's look as plain CSS, for the helpers in ui.py.
|
|
*
|
|
* The tokens are shadcn's "neutral" theme (https://ui.shadcn.com/docs/theming)
|
|
* and the component rules follow its Tailwind classes. Override any token on
|
|
* :root to retheme. Dark mode follows the OS, or force it with class="dark"
|
|
* (or "light") on any element; this needs CSS light-dark() (2024+ browsers).
|
|
* `build` copies this file next to app.wasm.
|
|
*/
|
|
/* Each token is light-dark(light, dark), so it follows color-scheme. */
|
|
:root {
|
|
color-scheme: light dark;
|
|
--radius: .625rem;
|
|
--background: light-dark(oklch(1 0 0), oklch(.145 0 0));
|
|
--foreground: light-dark(oklch(.145 0 0), oklch(.985 0 0));
|
|
--card: light-dark(oklch(1 0 0), oklch(.205 0 0));
|
|
--card-foreground: var(--foreground);
|
|
--popover: var(--card);
|
|
--popover-foreground: var(--foreground);
|
|
--primary: light-dark(oklch(.205 0 0), oklch(.922 0 0));
|
|
--primary-foreground: light-dark(oklch(.985 0 0), oklch(.205 0 0));
|
|
--secondary: light-dark(oklch(.97 0 0), oklch(.269 0 0));
|
|
--secondary-foreground: light-dark(oklch(.205 0 0), oklch(.985 0 0));
|
|
--muted: var(--secondary);
|
|
--muted-foreground: light-dark(oklch(.556 0 0), oklch(.708 0 0));
|
|
--accent: var(--secondary);
|
|
--accent-foreground: var(--secondary-foreground);
|
|
--destructive: light-dark(oklch(.577 .245 27.325), oklch(.704 .191 22.216));
|
|
--border: light-dark(oklch(.922 0 0), oklch(1 0 0 / 10%));
|
|
--input: light-dark(oklch(.922 0 0), oklch(1 0 0 / 15%));
|
|
--input-bg: light-dark(transparent, oklch(1 0 0 / 4.5%));
|
|
--ring: light-dark(oklch(.708 0 0), oklch(.556 0 0));
|
|
--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
|
|
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
|
|
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
|
|
--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
}
|
|
.light { color-scheme: light; }
|
|
.dark { color-scheme: dark; }
|
|
|
|
/* ---------------------------------------------------------------- base */
|
|
*, ::before, ::after { box-sizing: border-box; }
|
|
body {
|
|
margin: 0; background: var(--background); color: var(--foreground);
|
|
font: 14px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased;
|
|
}
|
|
.light, .dark { background: var(--background); color: var(--foreground); }
|
|
button, input { font: inherit; color: inherit; margin: 0; }
|
|
button { border: 0; background: none; padding: 0; }
|
|
:focus-visible { outline: none; }
|
|
.muted { color: var(--muted-foreground); }
|
|
.mono { font-family: var(--font-mono); }
|
|
.stack { display: grid; gap: 1rem; }
|
|
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
|
|
.grow { flex: 1; }
|
|
|
|
/* ---------------------------------------------------------------- button */
|
|
.btn {
|
|
display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
|
|
height: 2.25rem; padding: .5rem 1rem; border-radius: calc(var(--radius) - 2px);
|
|
font-size: .875rem; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
border: 1px solid transparent; cursor: pointer; user-select: none;
|
|
background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-xs);
|
|
transition: background-color .15s, color .15s, box-shadow .15s, opacity .15s;
|
|
}
|
|
.btn:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
|
|
.btn:disabled { opacity: .5; pointer-events: none; }
|
|
.btn:focus-visible, .input:focus-visible, .checkbox:focus-visible, .switch:focus-visible,
|
|
.tab:focus-visible, .toggle:focus-visible {
|
|
border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
|
|
}
|
|
.btn.secondary { background: var(--secondary); color: var(--secondary-foreground); }
|
|
.btn.secondary:hover { background: color-mix(in oklab, var(--secondary) 80%, transparent); }
|
|
.btn.outline {
|
|
background: light-dark(var(--background), var(--input-bg)); color: var(--foreground);
|
|
border-color: light-dark(var(--border), var(--input));
|
|
}
|
|
.btn.outline:hover, .btn.ghost:hover { background: var(--accent); color: var(--accent-foreground); }
|
|
.btn.ghost { background: transparent; color: var(--foreground); box-shadow: none; }
|
|
.btn.destructive { background: light-dark(var(--destructive), color-mix(in oklab, var(--destructive) 60%, transparent)); color: #fff; }
|
|
.btn.destructive:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent); }
|
|
.btn.link { background: none; color: var(--primary); box-shadow: none; text-underline-offset: 4px; }
|
|
.btn.link:hover { text-decoration: underline; }
|
|
.btn.sm { height: 2rem; padding: 0 .75rem; gap: .375rem; }
|
|
.btn.lg { height: 2.5rem; padding: 0 1.5rem; }
|
|
.btn.icon { width: 2.25rem; padding: 0; }
|
|
.btn.icon.sm { width: 2rem; }
|
|
|
|
/* ---------------------------------------------------------------- card */
|
|
.card {
|
|
display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem 0;
|
|
background: var(--card); color: var(--card-foreground);
|
|
border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm);
|
|
}
|
|
.card-header { display: grid; gap: .375rem; padding: 0 1.5rem; }
|
|
.card-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1; }
|
|
.card-description { margin: 0; font-size: .875rem; color: var(--muted-foreground); }
|
|
.card-content { padding: 0 1.5rem; }
|
|
.card-footer { display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem; }
|
|
|
|
/* ---------------------------------------------------------------- input, label */
|
|
.input {
|
|
display: flex; width: 100%; min-width: 0; height: 2.25rem; padding: .25rem .75rem;
|
|
border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
|
|
background: var(--input-bg); box-shadow: var(--shadow-xs); font-size: .875rem;
|
|
transition: box-shadow .15s, border-color .15s;
|
|
}
|
|
.input::placeholder { color: var(--muted-foreground); }
|
|
.label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 500; line-height: 1; user-select: none; }
|
|
.field { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
|
|
|
|
/* ---------------------------------------------------------------- badge */
|
|
.badge {
|
|
display: inline-flex; align-items: center; justify-content: center; gap: .25rem; width: fit-content;
|
|
padding: .125rem .5rem; border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
|
|
font-size: .75rem; font-weight: 500; white-space: nowrap;
|
|
background: var(--primary); color: var(--primary-foreground);
|
|
}
|
|
.badge.secondary { background: var(--secondary); color: var(--secondary-foreground); }
|
|
.badge.destructive { background: light-dark(var(--destructive), color-mix(in oklab, var(--destructive) 60%, transparent)); color: #fff; }
|
|
.badge.outline { background: none; color: var(--foreground); border-color: var(--border); }
|
|
|
|
/* ---------------------------------------------------------------- checkbox, switch */
|
|
.checkbox {
|
|
position: relative; flex: none; width: 1rem; height: 1rem; padding: 0; cursor: pointer;
|
|
border: 1px solid var(--input); border-radius: 4px; background: var(--input-bg); box-shadow: var(--shadow-xs);
|
|
transition: box-shadow .15s;
|
|
}
|
|
.checkbox[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
|
|
.checkbox[aria-checked="true"]::after {
|
|
content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px;
|
|
border: solid var(--primary-foreground); border-width: 0 2px 2px 0; transform: rotate(45deg);
|
|
}
|
|
.switch {
|
|
display: inline-flex; flex: none; align-items: center; width: 2rem; height: 1.15rem; padding: 0;
|
|
border: 1px solid transparent; border-radius: 999px; background: var(--input); cursor: pointer;
|
|
box-shadow: var(--shadow-xs); transition: background-color .15s;
|
|
}
|
|
.switch::after {
|
|
content: ""; width: 1rem; height: 1rem; border-radius: 999px; background: var(--background);
|
|
transition: transform .15s;
|
|
}
|
|
.switch:not([aria-checked="true"])::after { background: light-dark(var(--background), var(--foreground)); }
|
|
.switch[aria-checked="true"] { background: var(--primary); }
|
|
.switch[aria-checked="true"]::after { transform: translateX(calc(100% - 2px)); }
|
|
|
|
/* ---------------------------------------------------------------- tabs, toggle group */
|
|
.tabs-list {
|
|
display: inline-flex; align-items: center; height: 2.25rem; width: fit-content; padding: 3px;
|
|
border-radius: var(--radius); background: var(--muted); color: var(--muted-foreground);
|
|
}
|
|
.tab {
|
|
display: inline-flex; flex: 1; align-items: center; justify-content: center; height: 100%;
|
|
padding: .25rem .5rem; border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
|
|
background: none; font-size: .875rem; font-weight: 500; white-space: nowrap; cursor: pointer;
|
|
color: light-dark(var(--foreground), var(--muted-foreground)); transition: color .15s, box-shadow .15s;
|
|
}
|
|
.tab[aria-selected="true"] {
|
|
background: light-dark(var(--background), var(--input-bg)); border-color: light-dark(transparent, var(--input));
|
|
color: var(--foreground); box-shadow: var(--shadow-sm);
|
|
}
|
|
.toggle-group { display: inline-flex; width: fit-content; border-radius: calc(var(--radius) - 2px); box-shadow: var(--shadow-xs); }
|
|
.toggle {
|
|
display: inline-flex; align-items: center; justify-content: center; height: 2.25rem; min-width: 2.25rem;
|
|
padding: 0 .75rem; border: 1px solid var(--input); background: none; font-size: .875rem; font-weight: 500;
|
|
cursor: pointer; transition: background-color .15s;
|
|
}
|
|
.toggle:hover { background: var(--muted); color: var(--muted-foreground); }
|
|
.toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-foreground); }
|
|
.toggle-group .toggle { border-radius: 0; }
|
|
.toggle-group .toggle + .toggle { border-left: 0; }
|
|
.toggle-group .toggle:first-child { border-radius: calc(var(--radius) - 2px) 0 0 calc(var(--radius) - 2px); }
|
|
.toggle-group .toggle:last-child { border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0; }
|
|
|
|
/* ---------------------------------------------------------------- dialog */
|
|
.dialog-overlay { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .5); animation: ui-fade .15s; }
|
|
.dialog {
|
|
position: fixed; z-index: 50; top: 50%; left: 50%; transform: translate(-50%, -50%);
|
|
display: grid; gap: 1rem; width: calc(100% - 2rem); max-width: 32rem; padding: 1.5rem;
|
|
border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
|
|
background: var(--background); color: var(--foreground); animation: ui-zoom .15s;
|
|
}
|
|
.dialog-header { display: grid; gap: .5rem; }
|
|
.dialog-title { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1; }
|
|
.dialog-description { margin: 0; font-size: .875rem; color: var(--muted-foreground); }
|
|
.dialog-footer { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: .5rem; }
|
|
.dialog-close {
|
|
position: absolute; top: 1rem; right: 1rem; width: 1.25rem; height: 1.25rem; padding: 0;
|
|
border-radius: 4px; background: none; font-size: 1.125rem; line-height: 1; opacity: .7; cursor: pointer;
|
|
}
|
|
.dialog-close:hover { opacity: 1; }
|
|
@keyframes ui-fade { from { opacity: 0; } }
|
|
@keyframes ui-zoom { from { opacity: 0; transform: translate(-50%, -50%) scale(.95); } }
|
|
|
|
/* ---------------------------------------------------------------- alert, separator, progress, kbd */
|
|
.alert {
|
|
display: grid; gap: .125rem; width: 100%; padding: .75rem 1rem; font-size: .875rem;
|
|
border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--card-foreground);
|
|
}
|
|
.alert-title { font-weight: 500; }
|
|
.alert-description { color: var(--muted-foreground); }
|
|
.alert.destructive { color: var(--destructive); }
|
|
.alert.destructive .alert-description { color: color-mix(in oklab, var(--destructive) 90%, transparent); }
|
|
.separator { flex: none; height: 1px; width: 100%; margin: 0; border: 0; background: var(--border); }
|
|
.progress {
|
|
display: block; width: 100%; height: .5rem; overflow: hidden; border: 0; border-radius: 999px;
|
|
appearance: none; background: color-mix(in oklab, var(--primary) 20%, transparent);
|
|
}
|
|
.progress::-webkit-progress-bar { background: transparent; }
|
|
.progress::-webkit-progress-value { background: var(--primary); transition: width .2s; }
|
|
.progress::-moz-progress-bar { background: var(--primary); }
|
|
.kbd {
|
|
display: inline-flex; align-items: center; justify-content: center; height: 1.25rem; min-width: 1.25rem;
|
|
padding: 0 .25rem; border-radius: 4px; background: var(--muted); color: var(--muted-foreground);
|
|
font: 500 .75rem var(--font-sans);
|
|
}
|
|
|
|
/* ---------------------------------------------------------------- table */
|
|
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
|
|
.table th { height: 2.5rem; padding: 0 .5rem; text-align: left; font-weight: 500; white-space: nowrap; }
|
|
.table td { padding: .5rem; }
|
|
.table tr { border-bottom: 1px solid var(--border); }
|
|
.table tbody tr:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); }
|
|
.table tr[aria-selected="true"] { background: var(--muted); }
|