Files
launcher/web/style.css
SpriteandClaude Sonnet 5.5 637129aa4e Add the web runtime (DOM patcher, events, host bridge) and a browser e2e
web/ is the js-target MoonBit program: it renders app.view into the DOM with a
keyed patcher, turns pointer/touch/key events into app input, runs effects
against window.Android or demo stand-ins, and exposes window.launcher.* for the
Android shell. tests/e2e.cjs ports the legacy Playwright flows and passes
against the build; scripts/build-web.sh assembles dist/web.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 01:02:08 +00:00

262 lines
17 KiB
CSS

/* ultra launcher: shadcn-neutral tokens and the few components the views use (from legacy/web/ui.css), then the home screen layout. */
: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);
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; }
.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); }
@keyframes ui-fade { from { opacity: 0; } }
.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); }
/* Home screen layout; the components come from ui.css. The page is transparent so the
system wallpaper shows through the WebView. MainActivity sets --inset-top and
--inset-bottom to the status and navigation bar (and keyboard) heights. */
:root {
--top: var(--inset-top, env(safe-area-inset-top, 0px));
--bottom: var(--inset-bottom, env(safe-area-inset-bottom, 0px));
--shadow-text: 0 1px 4px rgb(0 0 0 / .6);
}
html, body { background: transparent; }
html.demo { background: linear-gradient(160deg, #1e293b, #4c1d95 55%, #0f172a) fixed; }
body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: transparent;
user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
overscroll-behavior: none; }
#app { max-width: 560px; margin: 0 auto; }
/* ---- home */
.home { min-height: 100vh; box-sizing: border-box;
padding: calc(var(--top) + 1rem) 16px calc(var(--bottom) + 1.5rem); }
.panel { display: flex; gap: .5rem; margin: 0 auto 1rem; padding: .4rem; max-width: 22rem;
border-radius: 1.25rem; background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .16);
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.panel-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: .6rem;
min-height: 2.5rem; padding: .4rem 1rem; border: 0; border-radius: .9rem;
background: rgb(255 255 255 / .1); color: #fff; font: inherit; font-weight: 500;
cursor: pointer; text-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.panel-btn:hover, .panel-btn:active { background: rgb(255 255 255 / .22); }
.windows-glyph { position: relative; width: 1.1rem; height: 1.1rem; }
.windows-glyph::before, .windows-glyph::after { content: ""; position: absolute; border: 2px solid currentColor;
border-radius: .25rem; box-sizing: border-box; }
.windows-glyph::before { inset: 0 .3rem .3rem 0; opacity: .6; }
.windows-glyph::after { inset: .3rem 0 0 .3rem; background: rgb(255 255 255 / .15); }
.slots, .apps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem .5rem;
grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* The home grid is placed explicitly by the model (app/view.mbt sets its columns, rows and
every slot's cell inline); the gaps and the 64px row height must match grid/grid.mbt. */
.slots { gap: 8px; }
@media (min-width: 480px) { .apps { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem;
padding: .35rem .15rem; border-radius: calc(var(--radius) + 4px); cursor: pointer; }
.tile:active { background: rgb(255 255 255 / .12); }
.icon { width: 3.25rem; height: 3.25rem; object-fit: contain; pointer-events: none;
filter: drop-shadow(0 2px 4px rgb(0 0 0 / .3)); }
.icon.missing { border-radius: 999px; background: rgb(255 255 255 / .18); object-position: -999px 0; }
.name { max-width: 100%; font-size: .75rem; line-height: 1.2; text-align: center;
text-shadow: var(--shadow-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slots .tile { gap: .25rem; padding: .2rem .1rem; }
.slots .icon { width: 2.5rem; height: 2.5rem; }
.slots .name { font-size: .68rem; }
/* A widget takes whole rows. On a phone the native widget view covers the slot;
the label only shows while the slot is not live (or in a desktop browser). */
.widget-slot { display: grid; place-items: center; box-sizing: border-box;
border-radius: 1.25rem; background: rgb(255 255 255 / .1);
border: 1px dashed rgb(255 255 255 / .3); }
.widget-label { font-size: .875rem; opacity: .75; text-shadow: var(--shadow-text);
max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* The native view can be narrower than the slot, so the label would peek out at its sides. */
.widget-slot[data-wid] .widget-label { visibility: hidden; }
/* A live widget sits bare on the wallpaper; the frame only comes back while it is picked
up or resized (or while its native view is away, e.g. another widget is being resized). */
.widget-slot[data-wid]:not(.lifted):not(.resizing) { background: none; border-color: transparent; }
/* A widget being resized: handles sit just outside its right and bottom edges, where the
native widget view doesn't cover them; the bottom one sits in the gap below the row. */
.widget-slot { position: relative; }
.widget-slot.resizing { z-index: 2; outline: 2px solid rgb(255 255 255 / .85);
outline-offset: 3px; transition: none; }
.resize-handle { position: absolute; z-index: 2; touch-action: none; cursor: nwse-resize; }
.resize-handle::after { content: ""; position: absolute; border-radius: 999px; background: #fff;
box-shadow: 0 1px 6px rgb(0 0 0 / .45); }
.resize-handle[data-edge="r"] { top: 0; bottom: 0; right: -16px; width: 16px; cursor: ew-resize; }
.resize-handle[data-edge="r"]::after { top: 50%; left: 6px; width: 6px; height: 2.5rem; transform: translateY(-50%); }
.resize-handle[data-edge="b"] { left: 0; right: 0; bottom: -1rem; height: 1rem; cursor: ns-resize; }
.resize-handle[data-edge="b"]::after { left: 50%; top: 5px; width: 2.5rem; height: 6px; transform: translateX(-50%); }
.resize-handle[data-edge="rb"] { right: -16px; bottom: -1rem; width: 2.75rem; height: 1rem; }
.resize-handle[data-edge="rb"]::after { right: 4px; top: 1px; width: 14px; height: 14px; border-radius: 4px; }
.resize-bar { position: fixed; left: 50%; bottom: calc(var(--bottom) + 1rem); z-index: 15; transform: translateX(-50%);
display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem .4rem 1rem; border-radius: 999px;
background: rgb(0 0 0 / .8); color: #fff; font-size: .875rem; white-space: nowrap;
animation: ui-fade .15s; }
.resize-bar { max-width: calc(100vw - 1rem); }
.resize-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.resize-bar .btn { flex: none; }
.resize-bar .btn.ghost { color: #fff; }
.resize-bar .btn.ghost:hover { background: rgb(255 255 255 / .12); color: #fff; }
/* A slot picked up by a long press, while it is dragged (index.html moves it). */
.slots > li { transition: transform .15s ease-out; }
.slots > .lifted { z-index: 1; transform: scale(1.12); background: rgb(255 255 255 / .16);
box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.slots.dragging > li:not(.lifted) { opacity: .8; }
.slots.dragging .tile:active { background: none; }
.hint, .empty { text-align: center; opacity: .85; text-shadow: var(--shadow-text); }
.hint { margin-top: 30vh; padding: 0 2rem; font-size: .9rem; line-height: 1.5; }
/* The search pill under the panel: a tap opens the drawer. */
.search-pill { display: flex; align-items: center; gap: .75rem; width: 100%; max-width: 22rem; height: 2.75rem;
margin: -.25rem auto 1rem; padding: 0 1.1rem; border-radius: 999px; cursor: pointer;
background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .15);
color: rgb(255 255 255 / .6); font-size: 1rem; text-align: left; }
.search-pill:active { background: rgb(255 255 255 / .18); }
.magnifier { position: relative; flex: none; width: 1rem; height: 1rem; }
.magnifier::before { content: ""; position: absolute; inset: 0 .3rem .3rem 0; border: 2px solid rgb(255 255 255 / .75);
border-radius: 999px; }
.magnifier::after { content: ""; position: absolute; right: 0; bottom: .05rem; width: .45rem; height: 2px;
background: rgb(255 255 255 / .75); border-radius: 1px; transform: rotate(45deg); }
button { cursor: pointer; }
/* ---- drawer: slides down over the home screen */
.drawer { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
padding: calc(var(--top) + 1rem) 16px 0; background: rgb(10 10 14 / .72);
backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
animation: drop .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes drop { from { transform: translateY(-100%); } to { transform: none; } }
.drawer-head { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.drawer-head .input { flex: 1; height: 2.75rem; border-radius: 999px; padding: 0 1.25rem; font-size: 1rem;
background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .15); color: #fff; }
.drawer-head .input::placeholder { color: rgb(255 255 255 / .6); }
.drawer-head .input::-webkit-search-cancel-button { filter: invert(1); }
.drawer-head .btn.ghost { color: #fff; }
.drawer-head .btn.ghost:hover { background: rgb(255 255 255 / .12); color: #fff; }
.drawer-note { margin: 0 0 1rem; font-size: .875rem; opacity: .8; text-align: center; }
.drawer .apps { flex: 1; overflow-y: auto; align-content: start;
padding-bottom: calc(var(--bottom) + 1.5rem); overscroll-behavior: contain; }
.drawer .empty { flex: 1; }
.picking .tile::after { content: ""; position: absolute; top: .1rem; right: .6rem; width: 1.25rem; height: 1.25rem;
border-radius: 999px; border: 2px solid #fff; box-sizing: border-box;
background: rgb(0 0 0 / .35); }
.picking .tile.on::after { content: "✓"; display: grid; place-items: center; font-size: .75rem; font-weight: 700;
background: #fff; color: #111; }
/* ---- sheets (long-press menus, widget picker) */
.sheet-overlay { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .45); animation: ui-fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 560px; margin: 0 auto;
max-height: 70vh; overflow-y: auto; box-sizing: border-box;
padding: .75rem 1rem calc(var(--bottom) + 1rem); border-radius: 1.25rem 1.25rem 0 0;
background: var(--popover); color: var(--popover-foreground);
animation: rise .2s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ""; display: block; width: 2.25rem; height: .3rem; margin: 0 auto .75rem;
border-radius: 999px; background: var(--border); }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.sheet-title { margin: 0 .5rem .5rem; font-size: 1rem; font-weight: 600; }
.sheet-item { display: block; width: 100%; padding: .85rem .5rem; border: 0; border-radius: var(--radius);
background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sheet-item:hover, .sheet-item:active { background: var(--accent); }
.sheet .empty { text-shadow: none; color: var(--muted-foreground); }
.widget-list { list-style: none; margin: 0; padding: 0; display: grid; }
.widget-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius);
cursor: pointer; }
.widget-list li:hover, .widget-list li:active { background: var(--accent); }
.widget-list .icon { width: 2.5rem; height: 2.5rem; filter: none; }
.widget-name { display: grid; }
.widget-name small { color: var(--muted-foreground); font-size: .8rem; }
.widget-search { width: 100%; margin-bottom: .5rem; }
.notice, #toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 2rem); z-index: 30;
transform: translateX(-50%); padding: .5rem 1rem; border-radius: 999px;
background: rgb(0 0 0 / .8); color: #fff; font-size: .875rem; white-space: nowrap;
pointer-events: none; animation: ui-fade .15s; }
#toast { opacity: 0; transition: opacity .2s; animation: none; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .drawer, .sheet { animation: none; } }