Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

refactor(macos): centralize shared chrome geometry and typography

Abdurrahman Fakhrul2a998b96b7f5
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 6b058935..c4bb7b75 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -41,6 +41,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Changed**
+- `macos` centralize shared chrome geometry and typography
- `security` keep authority fixes within architecture line limits
**Tests**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 3a833bfb..3d688bd5 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,7 @@
+## 2026-10-08: Remove duplicate macOS chrome values from components
+
+The user's SSOT/DRY follow-up exposed a real duplicate: menu width lived separately in placement metrics and CSS, and the macOS row height estimate had a separate h-6 class. One macOS geometry definition now feeds placement plus menu-bar/context/submenu widths and context row heights, retaining the 44px coarse-pointer floor. The macOS stylesheet owns common chrome font size, semantic weights and titlebar heights; JSX no longer repeats those reference values. Palette/material remain scoped to the skin and existing menu/window components still own behavior. A rendered submenu regression changes supplied geometry and proves that both panel and rows follow it; browser checks cover dropdown/context/widget widths, typography, themes, keyboard, bounds, touch and the Windows round trip. No global primitive, app action, dependency or gate budget changed. Overall Figma migration progress remains unquantified until the remaining component inventory and acceptance scope are mapped; four completed incremental packages do not establish full-view fidelity.
+
## 2026-10-08: Align shared macOS window title and control edges
The open Figma composed window Title uses SF Pro Bold 13px with a 15px line height; MSO rendered Semibold with 19.5px leading. Close and Minimize properties confirm the existing 14px colors/geometry and a 0.5px inner black stroke at 45%, rather than MSO's 35%. The shared macOS window title now uses the reference weight/leading and its control CSS uses the matching edge. All macOS app windows consume that one branch; Windows retains its separate caption and mobile/dashboard use WindowContent directly. Focus gray, hover/focus symbols, 24px targets, close guards, window/store actions and theme colors remain intact. Browser checks measure actual title typography in both themes and the rendered control edge alongside existing maximize, restore, drag, resize, minimize, keyboard and shell-switch journeys. No app-specific title override, configuration or dependency was added.
diff --git a/frontend/slices/appshell/components/menu-bar-menus.tsx b/frontend/slices/appshell/components/menu-bar-menus.tsx
index a4622650..a7da86c6 100644
--- a/frontend/slices/appshell/components/menu-bar-menus.tsx
+++ b/frontend/slices/appshell/components/menu-bar-menus.tsx
@@ -1,6 +1,7 @@
"use client";
/* Menu-bar dropdown menus + shared <Menu> trigger (split from menu-bar.tsx). */
import { Fragment } from "react";
+import { MACOS_MENU } from "../design/macos/metrics";
import {
DropdownMenu,
DropdownMenuContent,
@@ -188,7 +189,7 @@ export function Menu(props: { label: string; bold?: boolean; children: React.Rea
>
{props.label}
</DropdownMenuTrigger>
- <DropdownMenuContent data-shell-id="macos" align="start" sideOffset={5} className="macos-menu rounded-xl">
+ <DropdownMenuContent data-shell-id="macos" align="start" sideOffset={5} className="macos-menu rounded-xl" style={{ width: MACOS_MENU.width }}>
{props.children}
</DropdownMenuContent>
</DropdownMenu>
diff --git a/frontend/slices/appshell/components/menu-bar.tsx b/frontend/slices/appshell/components/menu-bar.tsx
index 797bf0bc..5847fde1 100644
--- a/frontend/slices/appshell/components/menu-bar.tsx
+++ b/frontend/slices/appshell/components/menu-bar.tsx
@@ -35,7 +35,7 @@ export function MenuBar() {
return (
<header
- className="macos-menubar absolute inset-x-0 top-0 z-[900] flex items-center gap-1 px-2.5 text-[13px] font-medium font-[family-name:var(--shell-font)]"
+ className="macos-menubar absolute inset-x-0 top-0 z-[900] flex items-center gap-1 px-2.5 font-[family-name:var(--shell-font)]"
style={{ height: TOPBAR }}
>
<div className="flex min-w-0 items-center overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
diff --git a/frontend/slices/appshell/components/shells/context-menu-parts.test.ts b/frontend/slices/appshell/components/shells/context-menu-parts.test.ts
index c1be9b3c..d4473cd4 100644
--- a/frontend/slices/appshell/components/shells/context-menu-parts.test.ts
+++ b/frontend/slices/appshell/components/shells/context-menu-parts.test.ts
@@ -2,9 +2,11 @@
browser; here we cover the PURE metrics + the a11y invariants the submenu
depends on (source-level, like window-preview.test.tsx). */
import { readFileSync } from "node:fs";
+import { createElement, createRef } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
import { resolve } from "node:path";
import { describe, expect, it } from "vitest";
-import { SUBMENU_ID, menuMetrics } from "./context-menu-parts";
+import { SUBMENU_ID, SubPanel, menuMetrics } from "./context-menu-parts";
const src = readFileSync(resolve(__dirname, "context-menu-parts.tsx"), "utf8");
@@ -32,6 +34,17 @@ describe("menuMetrics", () => {
});
});
+it("renders changed menu geometry without separate CSS dimensions", () => {
+ const m = { ...menuMetrics("macos"), width: 320, rowH: 36 };
+ const html = renderToStaticMarkup(createElement(SubPanel, {
+ item: { type: "submenu", label: "Sizing", items: [{ label: "Example", onClick: () => {} }] },
+ m, onClose: () => {}, pos: { x: 8, y: 8 }, panelRef: createRef<HTMLDivElement>(),
+ onEnter: () => {}, onLeave: () => {},
+ }));
+ expect(html).toContain("width:320px");
+ expect(html).toContain("height:36px");
+});
+
describe("submenu a11y invariants", () => {
it("announces the parent row as a menu opener", () => {
expect(src).toMatch(/aria-haspopup="menu"/);
diff --git a/frontend/slices/appshell/components/shells/context-menu-parts.tsx b/frontend/slices/appshell/components/shells/context-menu-parts.tsx
index 80fc22a1..4e463884 100644
--- a/frontend/slices/appshell/components/shells/context-menu-parts.tsx
+++ b/frontend/slices/appshell/components/shells/context-menu-parts.tsx
@@ -3,6 +3,7 @@
the submenu panel (context-menu.tsx owns position, state and keyboard). Split
out so both files stay small; nothing here holds state. */
import { cn } from "@/lib/utils";
+import { MACOS_MENU } from "../../design/macos/metrics";
import { Check, ChevronRight, type LucideIcon } from "lucide-react";
import type { ReactNode, RefObject } from "react";
import type { MenuItem } from "../../lib/context-menu";
@@ -32,13 +33,13 @@ export function menuMetrics(shell: string) {
return {
isWin,
isMac,
- width: isMac ? 244 : 220,
+ width: isMac ? MACOS_MENU.width : 220,
chrome: isMac ? "macos-menu" : "",
isTouch,
/** No hover on a coarse pointer → submenus open on TAP instead. */
tap: isTouch || coarse,
- rowH: isTouch || coarse ? 44 : isWin ? 34 : isMac ? 24 : 30,
- item: isWin ? "h-[34px] rounded-[4px]" : isTouch ? "min-h-11 rounded-lg py-2.5 text-[15px]" : isMac ? "h-6 rounded-lg py-0" : "rounded-md py-1",
+ rowH: isTouch || coarse ? 44 : isWin ? 34 : isMac ? MACOS_MENU.rowHeight : 30,
+ item: isWin ? "h-[34px] rounded-[4px]" : isTouch ? "min-h-11 rounded-lg py-2.5 text-[15px]" : isMac ? "rounded-lg py-0" : "rounded-md py-1",
motion: isWin ? "fade-in-0 slide-in-from-top-2 duration-150" : "fade-in zoom-in-95 duration-100",
radius: isWin ? "rounded-lg" : isTouch ? "rounded-2xl" : "rounded-xl",
iconSize: isTouch ? "size-[18px]" : "size-4",
@@ -98,7 +99,7 @@ export function SubPanel({ item, m, onClose, pos, panelRef, onEnter, onLeave }:
onMouseEnter={onEnter}
onMouseLeave={onLeave}
className={cn(PANEL, "z-[1202]", m.radius, m.chrome, m.motion)}
- style={{ left: pos.x, top: pos.y }}
+ style={{ left: pos.x, top: pos.y, width: m.isMac ? m.width : undefined }}
>
<MenuRows items={item.items} m={m} onClose={onClose} />
</div>
@@ -107,6 +108,7 @@ export function SubPanel({ item, m, onClose, pos, panelRef, onEnter, onLeave }:
export function MenuRows({ items, m, onClose, sub }: { items: MenuItem[]; m: MenuMetrics; onClose: () => void; sub?: SubControl }) {
const text = m.isMac ? undefined : "text-foreground/90";
+ const style = m.isMac ? { height: m.rowH } : undefined;
return (
<>
{items.map((it, i) => {
@@ -125,6 +127,7 @@ export function MenuRows({ items, m, onClose, sub }: { items: MenuItem[]; m: Men
disabled={it.disabled || !sub}
onClick={(e) => sub?.onOpen(i, e.currentTarget.getBoundingClientRect(), { toggle: true })}
onMouseEnter={(e) => !m.tap && sub?.onOpen(i, e.currentTarget.getBoundingClientRect())}
+ style={style}
className={cn(ROW, text, m.item, m.tap && "min-h-11", sub?.open === i && "bg-accent")}
>
<RowBody m={m} icon={it.icon} label={it.label} trailing={<ChevronRight className="size-4 shrink-0 opacity-60" />} />
@@ -139,6 +142,7 @@ export function MenuRows({ items, m, onClose, sub }: { items: MenuItem[]; m: Men
disabled={it.disabled}
onClick={() => { it.onClick(); onClose(); }}
onMouseEnter={() => !m.tap && sub?.onLeave()}
+ style={style}
className={cn(ROW, it.danger ? "text-destructive-text" : text, m.item, m.tap && "min-h-11")}
>
<RowBody
diff --git a/frontend/slices/appshell/components/shells/context-menu.tsx b/frontend/slices/appshell/components/shells/context-menu.tsx
index 29a2d6c7..d4a1dd76 100644
--- a/frontend/slices/appshell/components/shells/context-menu.tsx
+++ b/frontend/slices/appshell/components/shells/context-menu.tsx
@@ -202,7 +202,7 @@ export function ContextMenu({ pos, items, onClose }: { pos: Pos; items: MenuItem
data-shell-id={m.isMac ? "macos" : undefined}
onMouseLeave={leaveSub}
className={cn(PANEL, "z-[1201]", m.radius, m.chrome, m.motion)}
- style={{ left: x, top: y }}
+ style={{ left: x, top: y, width: m.isMac ? m.width : undefined }}
>
<MenuRows items={items} m={m} onClose={onClose} sub={{ open: sub?.i ?? null, onOpen: openSub, onLeave: leaveSub }} />
</div>
diff --git a/frontend/slices/appshell/components/shells/macos/macos-shell.css b/frontend/slices/appshell/components/shells/macos/macos-shell.css
index efdd1b33..b8aaa7c2 100644
--- a/frontend/slices/appshell/components/shells/macos/macos-shell.css
+++ b/frontend/slices/appshell/components/shells/macos/macos-shell.css
@@ -20,6 +20,7 @@
--mac-window-shadow: 0 0 1px rgba(0, 0, 0, .8), 0 18px 54px rgba(0, 0, 0, .55);
--mac-inactive-shadow: 0 0 1px rgba(0, 0, 0, .8), 0 7px 21px rgba(0, 0, 0, .35);
}
+.macos-menubar, .macos-menu, .macos-titlebar { font-size: 13px; font-weight: 500; }
.macos-menubar {
color: #fff;
/* Keep white status text legible even over a user-supplied white wallpaper. */
@@ -37,7 +38,6 @@
.macos-menu:focus-visible { border-radius: 12px; }
.macos-menu {
border-radius: 12px;
- width: 244px;
max-width: calc(100vw - 16px);
padding: 5px;
color: #1a1a1a;
@@ -47,8 +47,6 @@
box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .15), 0 8px 48px rgba(0, 0, 0, .25);
-webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
backdrop-filter: blur(var(--blur)) saturate(180%);
- font-size: 13px;
- font-weight: 500;
}
.macos-menu [role^="menuitem"] {
padding: 3px 7px;
@@ -77,6 +75,8 @@
box-shadow: var(--mac-inactive-shadow);
}
.macos-titlebar {
+ height: 52px;
+ font-weight: 700;
background: var(--mac-window);
border-bottom: .5px solid var(--mac-divider);
color: var(--mac-title);
diff --git a/frontend/slices/appshell/components/window.tsx b/frontend/slices/appshell/components/window.tsx
index 1966f0a3..6013f4c1 100644
--- a/frontend/slices/appshell/components/window.tsx
+++ b/frontend/slices/appshell/components/window.tsx
@@ -127,7 +127,7 @@ export const Window = memo(function Window({ id, variant = "macos" }: { id: WinI
</div>
) : (
<div
- className="macos-titlebar flex h-[52px] shrink-0 cursor-grab items-center gap-3 pl-3 pr-[18px] font-[family-name:var(--shell-font)] active:cursor-grabbing"
+ className="macos-titlebar flex shrink-0 cursor-grab items-center gap-3 pl-3 pr-[18px] font-[family-name:var(--shell-font)] active:cursor-grabbing"
onPointerDown={onBarDown}
onDoubleClick={() => toggleMaximize(id)}
onContextMenu={ctx.open}
@@ -138,7 +138,7 @@ export const Window = memo(function Window({ id, variant = "macos" }: { id: WinI
onMinimize={beginMinimize}
onMaximize={() => toggleMaximize(id)}
/>
- <div className="macos-window-title pointer-events-none flex-1 truncate text-[13px] font-bold">
+ <div className="macos-window-title pointer-events-none flex-1 truncate">
{title}
</div>
</div>
diff --git a/frontend/slices/appshell/design/macos/design.md b/frontend/slices/appshell/design/macos/design.md
index 12895f96..be3bfd9c 100644
--- a/frontend/slices/appshell/design/macos/design.md
+++ b/frontend/slices/appshell/design/macos/design.md
@@ -13,6 +13,7 @@ Source: [macOS 27 Examples](https://www.figma.com/design/f3ivRnEohVvr87qszwuQiw/
- Browser inspection of the composed window Title `4376:55456` confirms SF Pro Bold 13px with a 15px line height. The shared macOS title uses that weight/rhythm. Close and Minimize properties confirm 14px circles and a 0.5px inner black stroke at 45%; existing colors and 24px hit areas remain authoritative. Windows keeps its separate caption branch.
- Existing Radix controls, shell store, app registry and docking interactions remain authoritative.
- The Examples page has no dock specimen. Preserve existing artwork; reserve the full hover-growth pool so controls stay reachable.
+- SSOT: `metrics.ts` owns numeric menu width/row height for position estimates, context/submenu rows and menu-bar dropdowns. CSS owns the shared chrome font size, semantic weights, titlebar heights, palette and materials; components carry layout/action classes and inherit those values. Equal numbers for unrelated roles are not automatically one token.
- macOS CSS loads with its lazy shell component. No global palette replacement or extra design dependency.
- Do not import PR103's unrelated iOS/chat modifications or unconditional Force Quit styling.
diff --git a/frontend/slices/appshell/design/macos/metrics.ts b/frontend/slices/appshell/design/macos/metrics.ts
new file mode 100644
index 00000000..fdccfb70
--- /dev/null
+++ b/frontend/slices/appshell/design/macos/metrics.ts
@@ -0,0 +1,2 @@
+// Placement and rendered panels consume the same macOS menu geometry.
+export const MACOS_MENU = { width: 244, rowHeight: 24 } as const;
diff --git a/scripts/e2e/macos-menu-evidence.mjs b/scripts/e2e/macos-menu-evidence.mjs
index d678e49d..aaad3129 100644
--- a/scripts/e2e/macos-menu-evidence.mjs
+++ b/scripts/e2e/macos-menu-evidence.mjs
@@ -3,6 +3,7 @@ import AxeBuilder from "@axe-core/playwright";
async function menuChrome(menu) {
await expect(menu).toHaveAttribute("data-shell-id", "macos");
+ expect((await menu.boundingBox()).width).toBe(244);
const material = await menu.evaluate(el => {
const style = getComputedStyle(el);
return { mode: document.documentElement.dataset.theme, filter: style.backdropFilter, edge: style.borderColor, shadow: style.boxShadow };