Rewrite the launcher in MoonBit (old code moves to legacy/) (#1)
Launcher / test (push) Successful in 1m20s
Launcher / apk (push) Successful in 37s

This commit was merged in pull request #1.
This commit is contained in:
nandi committed 2026-11-23 01:57:10 +00:00
1 parent 7d2bf5996f
commit 2fa7bd745b
150 files changed
+8319 -462

No files matched your search

+117 -9
View File
@@ -1,3 +1,99 @@
/* 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. */
@@ -32,14 +128,10 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
.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 denser than the drawer: an extra column, smaller tiles. Its rows are
all one height, so a widget spans whole rows of app tiles, and apps fill the cells
beside a widget rather than leaving holes (dense packing). Keep the row height and
row gap in sync with widget_rows in app.py. */
.slots { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 4rem; row-gap: .5rem;
grid-auto-flow: row dense; }
@media (min-width: 480px) { .apps { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.slots { grid-template-columns: repeat(6, 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); }
@@ -54,7 +146,7 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
/* 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 { grid-column: 1 / -1; display: grid; place-items: center; box-sizing: border-box;
.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);
@@ -83,6 +175,9 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
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; }
@@ -96,6 +191,19 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
.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);