mirror of
https://github.com/Neonity2020/web-os.git
synced 2026-12-02 02:29:19 +08:00
新增 css/mobile.css 与 OS.isMobile(),覆盖窄屏及横屏矮屏;全屏窗口、抽屉侧栏、长按菜单、触控游戏按钮;顺手修复启动时自动开访达抢焦点;同步资源内容指纹
280 lines
11 KiB
CSS
280 lines
11 KiB
CSS
/* ============================================================
|
||
WebOS · 移动端适配
|
||
------------------------------------------------------------
|
||
本文件最后加载,只覆盖布局,不改业务逻辑。
|
||
≤900px:平板做轻量收敛(程序坞可横向滚动)。
|
||
主断点(JS 的 OS.isMobile 用同一条):≤760px 窄屏,
|
||
或高度 ≤500px 且宽度 ≤900px(横屏手机)—— 切换为移动端形态:
|
||
主屏图标网格 + 全屏应用窗口 + 常驻可滚动 Dock
|
||
+ 抽屉式侧栏 + 更大的触摸目标。
|
||
============================================================ */
|
||
|
||
/* ---------------- 平板 / 中等宽度 ---------------- */
|
||
@media (max-width: 900px) {
|
||
.dock {
|
||
max-width: calc(100vw - 16px);
|
||
overflow-x: auto; overflow-y: hidden;
|
||
scrollbar-width: none; -webkit-overflow-scrolling: touch;
|
||
}
|
||
.dock::-webkit-scrollbar { display: none; }
|
||
}
|
||
|
||
@media (max-width: 760px), (max-height: 500px) and (max-width: 900px) {
|
||
:root {
|
||
--m-menu-h: 42px;
|
||
--m-dock-h: 68px;
|
||
--m-safe-t: env(safe-area-inset-top, 0px);
|
||
--m-safe-b: env(safe-area-inset-bottom, 0px);
|
||
--m-win-h: calc(100vh - var(--m-menu-h) - var(--m-dock-h) - var(--m-safe-t) - var(--m-safe-b));
|
||
}
|
||
@supports (height: 100dvh) {
|
||
:root { --m-win-h: calc(100dvh - var(--m-menu-h) - var(--m-dock-h) - var(--m-safe-t) - var(--m-safe-b)); }
|
||
}
|
||
|
||
html, body { -webkit-touch-callout: none; overscroll-behavior: none; }
|
||
|
||
/* ---------------- 菜单栏:只留系统/应用菜单与常用状态 ---------------- */
|
||
.menubar {
|
||
height: calc(var(--m-menu-h) + var(--m-safe-t));
|
||
padding: var(--m-safe-t) 8px 0 6px;
|
||
font-size: 12px;
|
||
}
|
||
.menubar .mb-item { min-height: 34px; padding: 0 9px; }
|
||
.menubar .mb-item[data-menu]:not(.apple):not([data-menu="app"]) { display: none; }
|
||
.menubar .mb-item.apple { padding: 0 10px; }
|
||
.menubar .mb-item.apple svg { width: 16px; height: 18px; }
|
||
.mb-status { min-width: 34px; padding: 0 8px; }
|
||
.mb-status[data-status="battery"],
|
||
.mb-status[data-status="bluetooth"],
|
||
.mb-status[data-status="wifi"] { display: none; }
|
||
.mb-clock { padding: 0 6px; font-size: 12px; }
|
||
.dropdown {
|
||
min-width: 200px; max-width: calc(100vw - 16px);
|
||
max-height: 70vh; overflow-y: auto;
|
||
}
|
||
.dd-item { height: 38px; font-size: 13.5px; }
|
||
|
||
/* ---------------- 程序坞:常驻、可横向滑动 ---------------- */
|
||
.dock-wrap {
|
||
height: calc(var(--m-dock-h) + var(--m-safe-b));
|
||
padding: 0 8px calc(6px + var(--m-safe-b));
|
||
}
|
||
.dock-wrap.autohide { transform: none !important; }
|
||
.dock-hotzone { display: none; }
|
||
.dock {
|
||
max-width: 100%;
|
||
padding: 7px 8px;
|
||
gap: 3px;
|
||
border-radius: 17px;
|
||
touch-action: pan-x;
|
||
}
|
||
.dock-item { width: 42px !important; height: 42px !important; }
|
||
.dock-item .dock-icon { border-radius: 24%; }
|
||
.dock-sep { margin: 5px 3px; }
|
||
.dock-tooltip { display: none; }
|
||
.dock-dot { bottom: -4px; }
|
||
|
||
/* ---------------- 桌面:主屏图标网格 ---------------- */
|
||
.desktop-icons {
|
||
top: calc(var(--m-menu-h) + var(--m-safe-t) + 14px);
|
||
left: 0; right: 0;
|
||
bottom: calc(var(--m-dock-h) + var(--m-safe-b) + 8px);
|
||
width: auto;
|
||
display: grid;
|
||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||
gap: 18px 6px;
|
||
align-content: start;
|
||
padding: 0 12px 16px;
|
||
overflow-y: auto;
|
||
scrollbar-width: none;
|
||
}
|
||
.desktop-icons::-webkit-scrollbar { display: none; }
|
||
.desktop-icon { width: 100%; height: auto; min-height: 78px; gap: 6px; padding: 8px 2px 6px; }
|
||
.desktop-icon .di-img { width: 50px; height: 50px; }
|
||
.desktop-icon .di-label { max-width: 100%; font-size: 11px; }
|
||
.desktop-widgets { display: none; }
|
||
|
||
/* ---------------- 窗口:全屏化,不再拖拽缩放 ---------------- */
|
||
.windows-layer .window {
|
||
left: 0 !important;
|
||
top: calc(var(--m-menu-h) + var(--m-safe-t)) !important;
|
||
width: 100vw !important;
|
||
height: var(--m-win-h) !important;
|
||
min-width: 0 !important; min-height: 0 !important;
|
||
border-radius: 0 !important;
|
||
border-left: 0; border-right: 0;
|
||
box-shadow: none;
|
||
transition: box-shadow .2s, opacity .2s, transform .26s var(--ease);
|
||
}
|
||
.window.maximized { border-radius: 0 !important; }
|
||
.titlebar { height: 46px; padding: 0 10px; gap: 8px; touch-action: none; }
|
||
.traffic { gap: 9px; }
|
||
.traffic button { width: 17px; height: 17px; }
|
||
.traffic .t-min, .traffic .t-zoom { display: none; }
|
||
.win-title { font-size: 13px; }
|
||
.titlebar-tools { gap: 4px; }
|
||
.titlebar-tools .tb-btn { width: 34px; height: 32px; }
|
||
.titlebar-tools .tb-btn svg { width: 17px; height: 17px; }
|
||
.rz { display: none !important; }
|
||
.mission-bar { display: none !important; }
|
||
|
||
/* 侧栏改为抽屉:所有使用 .sidebar 的应用统一生效 */
|
||
.window .sidebar {
|
||
position: absolute; left: 0; top: 0; bottom: 0;
|
||
width: min(74vw, 260px) !important;
|
||
z-index: 30;
|
||
transform: translateX(-102%);
|
||
transition: transform .24s var(--ease);
|
||
background: var(--win-solid);
|
||
box-shadow: 14px 0 36px rgba(0, 0, 0, .42);
|
||
border-right: 1px solid var(--win-border);
|
||
overflow-y: auto;
|
||
padding: 12px 10px;
|
||
}
|
||
.window.sidebar-open .sidebar { transform: none; }
|
||
.window.sidebar-open .win-body::after {
|
||
content: ""; position: absolute; inset: 0; z-index: 29;
|
||
background: rgba(0, 0, 0, .42);
|
||
}
|
||
.window .side-item { height: 38px; font-size: 13px; }
|
||
.m-sidebar-toggle { font-size: 15px; line-height: 1; }
|
||
|
||
/* 通用工具栏与内容区 */
|
||
.toolbar {
|
||
height: 46px; padding: 0 8px; gap: 5px;
|
||
overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
|
||
}
|
||
.toolbar::-webkit-scrollbar { display: none; }
|
||
.toolbar > * { flex: none; }
|
||
.toolbar .grow { display: none; }
|
||
.toolbar [data-act="newfolder"], .toolbar [data-act="info"] { display: none; }
|
||
.tb-icon { width: 34px; height: 34px; }
|
||
.tb-icon svg { width: 17px; height: 17px; }
|
||
.segmented button { min-width: 34px; height: 28px; }
|
||
.search-field { min-width: 92px; max-width: 132px; }
|
||
.statusbar { padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||
.pane-head { padding: 14px 16px 8px; }
|
||
.content-pane { min-width: 0; }
|
||
|
||
/* 访达 / 文件列表 */
|
||
.finder-path { padding: 7px 10px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
|
||
.finder-path::-webkit-scrollbar { display: none; }
|
||
.file-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 14px 6px; padding: 12px 10px; }
|
||
.file-list .fl-head span:not(:first-child),
|
||
.file-list .fl-row .fl-cell { display: none; }
|
||
.file-list .fl-head, .file-list .fl-row { grid-template-columns: 1fr; }
|
||
|
||
/* 各应用的窄屏收敛 */
|
||
.notes-list { width: 120px !important; flex: none; }
|
||
.ne-title { padding: 6px 14px 8px; font-size: 18px; }
|
||
.ne-body { padding: 0 14px 20px; }
|
||
.cal-side { display: none; }
|
||
.cal-toolbar { height: 46px; padding: 0 10px; gap: 8px; }
|
||
.cal-toolbar h2 { min-width: 0; font-size: 16px; }
|
||
.cal-grid7 { padding: 0 6px 8px; }
|
||
.cal-cell .cc-event { display: none; }
|
||
.settings-content { padding: 16px; }
|
||
.appearance-options { gap: 8px; }
|
||
.wall-grid { grid-template-columns: repeat(2, 1fr); }
|
||
.photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); padding: 10px; }
|
||
.music-main { padding: 14px; }
|
||
.mp-now { width: auto; }
|
||
.mp-extra, .mp-wave { display: none; }
|
||
.web-content { padding: 20px 16px 32px; }
|
||
.text-view { padding: 18px 16px; }
|
||
.terminal .term-out { padding: 12px; font-size: 11px; }
|
||
.modal-card { width: min(360px, 90%); }
|
||
.lightbox .lb-img { width: 88%; }
|
||
|
||
/* 科学计算器:10 列改 5 列 × 10 行,按键更大更好按 */
|
||
.sc-display { padding: 8px 12px 10px; }
|
||
.sc-value { font-size: 32px !important; }
|
||
.sc-keys {
|
||
grid-template-columns: repeat(5, 1fr) !important;
|
||
grid-template-rows: repeat(10, 1fr) !important;
|
||
gap: 5px !important; padding: 8px !important;
|
||
overflow-y: auto;
|
||
}
|
||
.sc-keys button { min-height: 0; font-size: 12px !important; }
|
||
.sc-keys button.num { font-size: 18px !important; }
|
||
.sc-keys button.op { font-size: 20px !important; }
|
||
.sc-keys button.fn { font-size: 13px !important; }
|
||
.sc-keys button.zero { grid-column: span 2; }
|
||
|
||
/* 凤凰战机:HUD 收紧、说明单列、按钮加大 */
|
||
.px-hud { height: 46px; padding: 0 10px; gap: 6px; }
|
||
.px-hud-cell { min-width: 0; }
|
||
.px-score { font-size: 16px; }
|
||
.px-wave { font-size: 10px; }
|
||
.px-power i { width: 10px; }
|
||
.px-lives { gap: 2px; }
|
||
.px-life { width: 9px; height: 12px; }
|
||
.px-bombs { font-size: 10px; }
|
||
.px-foot { display: none; }
|
||
.px-overlay { padding: 12px; }
|
||
.px-panel, .px-panel.ranks { max-width: 100%; }
|
||
.px-emblem { width: 58px; height: 58px; }
|
||
.px-emblem.small { width: 46px; height: 46px; }
|
||
.px-title { font-size: 30px; }
|
||
.px-title.small { font-size: 22px; }
|
||
.px-desc { margin-top: 10px; font-size: 11px; line-height: 1.65; }
|
||
.px-keys { grid-template-columns: 1fr; gap: 6px; margin-top: 14px; }
|
||
.px-krow { padding: 8px 9px; font-size: 10.5px; }
|
||
.px-btn { min-width: 150px; height: 42px; }
|
||
.px-btns .px-btn { margin-top: 14px; }
|
||
.px-rank-list { max-height: 38vh; }
|
||
.px-final { font-size: 38px; }
|
||
|
||
/* ---------------- 浮层 ---------------- */
|
||
.spotlight-overlay { padding-top: calc(var(--m-menu-h) + var(--m-safe-t) + 24px); }
|
||
.spotlight-box { width: calc(100vw - 24px); }
|
||
.spot-input-row { padding: 12px 14px; gap: 10px; }
|
||
#spot-input { font-size: 18px; }
|
||
.spot-results { max-height: 52vh; }
|
||
.spot-footer { display: none; }
|
||
|
||
.launchpad {
|
||
padding: calc(var(--m-menu-h) + var(--m-safe-t) + 18px) 12px
|
||
calc(var(--m-dock-h) + var(--m-safe-b) + 16px);
|
||
overflow-y: auto;
|
||
}
|
||
.launchpad-search { width: min(280px, 86vw); height: 36px; }
|
||
.launchpad-grid {
|
||
margin-top: 24px; width: 100%; max-width: 460px;
|
||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||
gap: 20px 8px;
|
||
}
|
||
.lp-item .lp-icon { width: 56px; height: 56px; }
|
||
.lp-item span { font-size: 11px; }
|
||
.launchpad-dots { bottom: calc(var(--m-dock-h) + var(--m-safe-b) + 4px); }
|
||
.launchpad-folder { display: none; }
|
||
|
||
.notification-center {
|
||
width: 100vw;
|
||
padding: calc(var(--m-menu-h) + var(--m-safe-t) + 12px) 12px
|
||
calc(var(--m-dock-h) + var(--m-safe-b) + 12px);
|
||
}
|
||
|
||
.toast-stack {
|
||
top: auto;
|
||
bottom: calc(var(--m-dock-h) + var(--m-safe-b) + 8px);
|
||
left: 8px; right: 8px;
|
||
}
|
||
.toast { width: auto; }
|
||
.context-menu { min-width: 190px; max-width: calc(100vw - 16px); }
|
||
|
||
.lockscreen { padding-top: 12vh; }
|
||
.lockscreen .lk-time { font-size: 58px; }
|
||
.lockscreen .lk-date { font-size: 15px; }
|
||
.lockscreen .lk-avatar { margin-top: 12vh; }
|
||
}
|
||
|
||
/* 横屏矮屏:窗口高度过小时进一步压缩竖向占用 */
|
||
@media (max-height: 500px) and (max-width: 900px) {
|
||
:root { --m-menu-h: 34px; --m-dock-h: 54px; }
|
||
.titlebar { height: 38px; }
|
||
.dock-item { width: 36px !important; height: 36px !important; }
|
||
.px-hud { height: 38px; }
|
||
.px-emblem, .px-emblem.small { display: none; }
|
||
}
|