* feat(desktop): cloud-first thin shell, local atoms, signed config, and complete Sentry observability * feat(desktop): add in-app update banner, release notes preview, and mandatory update gate * fix(ci): resolve backend typecheck, dock short-host floor, ci-scope, and source privacy scan * fix(desktop): address all P1 and P2 security/robustness review findings on PR #1001 * fix(local-atoms): accept TOML array-of-tables headers in merged structure check --------- Co-authored-by: heggria <bshengtao@gmail.com>
4.3 KiB
Desktop & Responsive Layout Contract
This document defines the architectural layout invariants shared by OpenMotion Studio and the Electron desktop shell (desktop/). The automated guard scripts/check-layout.ts enforces these rules during npm run check and CI.
1. Single source of truth for desktop safe-area geometry
Default safe-area CSS custom properties are declared once in packages/design-system/base.css:
--om-desktop-inset-left: left clearance inside.om-app-headerfor OS-overlaid controls (macOS traffic lights;0pxon web, fullscreen, Windows, and Linux).--om-desktop-inset-right: right clearance inside.om-app-headerfor OS-overlaid controls (WindowstitleBarOverlay;0pxon web, fullscreen, macOS, and Linux).- No double inset on Linux: When
customWindowControls: true, Studio renders.om-desktop-window-controlsin-flow inside.om-app-header, soinsetRightMUST remain0.
- No double inset on Linux: When
--om-desktop-titlebar-height: effective header height (46pxat 100% zoom; scaled up when zoomed out so OS DIP controls never spill below the header).--om-desktop-safe-top: vertical top clearance (0pxon web, fullscreen, or native frame;titleBarHeightwhenever OS overlay controls or custom frameless window controls occupy the top strip).--om-workspace-top: live offset from viewport top to.motion-workspace(tracks.om-app-headerplus any stacked banners such as promo or auth-recovery notices).
Both studio/src/utils/platformHost.ts and the shell-injected fallback CSS in desktop/src/platform.ts keep these variables synchronized on navigation, fullscreen transitions, and page zoom changes (Cmd/Ctrl +, -, 0, or pinch zoom).
2. Flex-column application shell (no fixed row counts)
.om-application MUST use display: flex; flex-direction: column (never grid-template-rows with a hardcoded row count).
.om-app-headerstays fixed-height (flex: 0 0 var(--om-desktop-titlebar-height, 46px)).- Any optional top banner (
BlackFridayTopBanner,AuthRecoveryNotice, future status bars) stacks automatically (flex: 0 0 auto). - In desktop windowed mode (
[data-desktop="true"][data-desktop-fullscreen="false"]),.om-app-headeris pinned atorder: 0, banners stack below it atorder: 1, and.motion-workspacefills the remaining space (flex: 1 1 0; min-height: 0; order: 2).
3. Fixed viewport overlays and dialogs
Every position: fixed surface anchored to the top or vertical center of the viewport MUST respect --om-desktop-safe-top (or --om-workspace-top) and use dvh instead of raw vh:
- Full-viewport overlays & side drawers (e.g.,
.om-gallery-surface,.om-media-detail-surface,.om-design-tpl-detail-popup,.om-game-project,.om-gen-lightbox,.motion-sidebar-drawer):inset: var(--om-desktop-safe-top, 0px) 0 0 0; height: calc(100dvh - var(--om-desktop-safe-top, 0px)); - Centered modals & dialogs (e.g.,
.om-settings-dialog,.om-design-dialog-popup,.om-scenario-preview-dialog):top: calc(50% + var(--om-desktop-safe-top, 0px) / 2); max-height: calc(100dvh - var(--om-desktop-safe-top, 0px) - 32px); - Workspace-scoped drawers (e.g.,
.om-scenario-pool--drawer): anchor attop: var(--om-workspace-top, var(--motion-topbar)).
4. Narrow & short window baseline (480 × 480)
The desktop main window enforces minWidth: 480, minHeight: 480:
- Never target a container element directly inside its own
@containerquery (e.g.,.om-app-headermust use@mediafor self-styles and@containeronly for descendants). - Scrolling surfaces with decorative wide elements (such as fanned showcase cards) must clip horizontal overflow (
overflow-x: hidden). - Self-contained local pages (
desktop/src/retry.html) must usemargin: autoinside amin-height: 100dvhflex column rather thanheight: 100%; justify-content: center, so tall error content scrolls cleanly without clipping the top. - Multi-display window restoration (desktop/src/window-state.ts) must match the saved coordinates against the target display's
workAreabefore clamping dimensions, so windows restored on a larger secondary monitor are not shrunk to a smaller primary laptop display.