From 96c92a5b22dc033ddc37fa833b7c0bd57bcf102e Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Sat, 5 Dec 2026 19:15:06 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=BA=95=E8=89=B2=E6=96=B9=E5=9D=97=E3=80=81?= =?UTF-8?q?=E7=84=A6=E7=82=B9=E6=A1=86=E5=8F=AA=E5=9C=A8=E9=94=AE=E7=9B=98?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=B6=E6=98=BE=E7=A4=BA=E3=80=81=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=8F=90=E7=A4=BA=E5=8E=BB=E6=8E=89=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs ModAVD/ModAVD#462 --- changelog.d/issue-462-card-marks.change.md | 2 + internal/ui/web/app.css | 58 +++++++++++----------- internal/ui/web/js/app.js | 6 +++ internal/ui/web/js/cards.js | 14 +++--- scripts/test_create_cancel.mjs | 28 ++++++----- 5 files changed, 60 insertions(+), 48 deletions(-) create mode 100644 changelog.d/issue-462-card-marks.change.md diff --git a/changelog.d/issue-462-card-marks.change.md b/changelog.d/issue-462-card-marks.change.md new file mode 100644 index 00000000..1cb92af9 --- /dev/null +++ b/changelog.d/issue-462-card-marks.change.md @@ -0,0 +1,2 @@ +实例卡片标记去掉底色方块、图标更大;鼠标操作不再出现焦点框;名称悬停提示不再写编号 +Instance card marks lose the box and grow larger, the focus ring shows only for keyboard use, and the name tooltip no longer shows the index. diff --git a/internal/ui/web/app.css b/internal/ui/web/app.css index 7d90419a..1c8ee6aa 100644 --- a/internal/ui/web/app.css +++ b/internal/ui/web/app.css @@ -234,7 +234,8 @@ h1, h2, h3, p { margin: 0; } button, input, select, textarea { font: inherit; color: inherit; } button { -webkit-tap-highlight-color: transparent; } :focus { outline: none; } -:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } +/* the focus ring only for keyboard use (html.kbd, set in app.js): WebView2 focuses a dialog's first control on open and gives\n the focus back to the opener on close, which a mouse user saw as an error frame. :where keeps the specificity of the old\n global rule, so the rules below that turn it off still win. */ +:where(html.kbd) :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } ::selection { background: var(--accent-tint-2); } .num { font-variant-numeric: tabular-nums; } .muted { color: var(--text-3); } @@ -332,7 +333,7 @@ button { -webkit-tap-highlight-color: transparent; } /* the 开机失败 / 新建失败 label of a card: it opens 问题反馈 at the task */ .pill-link { cursor: pointer; } .pill-link:hover { box-shadow: inset 0 0 0 1px var(--td); } -.pill-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } +html.kbd .pill-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } .bar { position: relative; height: 4px; border-radius: 2px; background: var(--bar-track); overflow: hidden; } @@ -393,7 +394,7 @@ button { -webkit-tap-highlight-color: transparent; } } .seg label:hover span { color: var(--text); } .seg input:checked + span { background: var(--seg-on); color: var(--text); box-shadow: var(--shadow-seg); } -.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; } +html.kbd .seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; } .checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; } .checkbox input { @@ -403,7 +404,7 @@ button { -webkit-tap-highlight-color: transparent; } } .checkbox input:checked { background: var(--accent-text) var(--tick) center / 14px no-repeat; border-color: var(--accent-text); } .checkbox.danger input:checked { background-color: var(--danger); background-image: var(--tick-w); border-color: var(--danger); } -.checkbox input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } +html.kbd .checkbox input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } /* ---- header ----------------------------------------------------------------------------------------------- */ @@ -422,7 +423,7 @@ button { -webkit-tap-highlight-color: transparent; } .brand-link { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: default; } .brand-link:not(:disabled) { cursor: pointer; border-radius: 7px; } .brand-link:not(:disabled):hover .brand-name { text-decoration: underline; } -.brand-link:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 3px; } +html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 3px; } .brand-name { font-size: 15px; font-weight: 600; letter-spacing: .01em; } .brand-ver { padding: 2px 8px; border-radius: 6px; background: var(--ver-bg); @@ -615,39 +616,40 @@ button { -webkit-tap-highlight-color: transparent; } .grid:not(.is-list) .card-meta .act-more { width: 18px; height: 18px; border-radius: 5px; } /* Marks after the instance name in the card's title line: one rule for all of them, kept in cards.js next to where they are built (the same text is there). - Every mark is a single-glyph block: 18px square, with exactly one capital letter (10px cap height, 4px above and 4px - below at 1x) or one 12px icon (3px around it) in it. No words and no second letter; what a mark means goes in its + Every mark is a single glyph with no background box and no outline: a 20px box with exactly one capital letter (15px, + 600, 11px cap height, 4.5px above and 4.5px below at 1x) or one 16px icon (2px around it) in it. The colour is --text-2 + (--tf for the adb tag and for a proxy mark in tone-warn / tone-err), a hover makes it brighter. No words and no second letter; what a mark means goes in its title and aria-label. Today: cat head = 按应用走代理, G = Google Play 商店, K = KernelSU, monitor with a slash = 无头 (headless). Always-there marks come first, marks that follow the run state come last, so one appearing never pushes the others. In the card view they are at the right end of the title line. The card view does not write 运行中 or 已关机 (the screen and the power button say it): the status label shows only for the states in between and the failed ones, and for the other two it is for screen readers only (.pill-quiet). - The card view is the title and one config line: a new state is another single-glyph block or a hover text, not a word + The card view is the title and one config line: a new state is another single glyph or a hover text, not a word and not a line. The cat head is the only mark that is a button (it opens the proxy dialog) and the only one that - can have a state colour (--tb / --tf from .tone-*), and only when something is wrong (tone-warn, tone-err): while the + can have a state colour (--tf from .tone-*; the icon only, never a background), and only when something is wrong (tone-warn, tone-err): while the proxy works it looks like the others; the others are static. */ .pmark, .smark, .kmark, .hmark { display: inline-flex; align-items: center; justify-content: center; flex: none; - width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; - background: var(--sunken); color: var(--text-2); + width: 20px; height: 20px; padding: 0; border: 0; border-radius: 0; + background: none; color: var(--text-2); } .pmark { cursor: pointer; } -.pmark.tone-warn, .pmark.tone-err { background: var(--tb); color: var(--tf); } -.pmark:hover { box-shadow: inset 0 0 0 1px var(--td, var(--text-3)); } -.pmark:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; } -.pmark .ic, .hmark .ic { width: 12px; height: 12px; } -.smark, .kmark { font-size: 13px; font-weight: 600; line-height: 1; } +.pmark.tone-warn, .pmark.tone-err { color: var(--tf); } +.pmark:hover { color: var(--text-1); } +html.kbd .pmark:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; } +.pmark .ic, .hmark .ic { width: 16px; height: 16px; } +.smark, .kmark { font-size: 15px; font-weight: 600; line-height: 1; } /* A letter is centred on its capitals, not on its line box: the font leaves more room above the capitals than below the - baseline, so a flex-centred G sat 1.5px low. font-size-adjust fixes the capital height at 10px whatever the font - (a 14px size scaled to cap-height 10/14), text-box trims the line to cap height and baseline, and the 4px padding - leaves 4px below. The two marks become blocks because text-box does not reach the anonymous box inside a flex + baseline, so a flex-centred G sat low. font-size-adjust fixes the capital height at 11px whatever the font + (a 15px size scaled to cap-height 11/15), text-box trims the line to cap height and baseline, and the 4.5px padding + leaves 4.5px below. The two marks become blocks because text-box does not reach the anonymous box inside a flex container. A browser without either property keeps the flex centring above. */ @supports (text-box: trim-both cap alphabetic) and (font-size-adjust: cap-height 0.7) { .smark, .kmark { display: block; text-align: center; - font-size: 14px; font-size-adjust: cap-height 0.7143; - padding-top: 4px; + font-size: 15px; font-size-adjust: cap-height 0.7333; + padding-top: 4.5px; text-box: trim-both cap alphabetic; } } @@ -655,13 +657,13 @@ button { -webkit-tap-highlight-color: transparent; } .grid:not(.is-list) .card-sub { display: none; } .adb-tag { - display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; padding: 0; - border: 0; border-radius: 5px; - background: var(--tb); color: var(--tf); + display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; padding: 0; + border: 0; border-radius: 0; + background: none; color: var(--tf); cursor: pointer; } -.adb-tag .ic { width: 12px; height: 12px; } -.adb-tag:hover { box-shadow: inset 0 0 0 1px var(--td); } +.adb-tag .ic { width: 16px; height: 16px; } +.adb-tag:hover { color: var(--td, var(--tf)); opacity: .8; } .adb { display: none; } .adb-addr { color: var(--text-2); white-space: nowrap; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; } @@ -804,7 +806,7 @@ dialog > .toasts .toast.out { animation-name: toast-out-left; } } .menu-item > .ic { color: var(--text-3); } .menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; } -.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); } +html.kbd .menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); } .menu-item[aria-disabled="true"] { color: var(--text-3); opacity: .55; cursor: default; } .menu-item[aria-disabled="true"]:hover { background: transparent; } .menu-item.danger, .menu-item.danger > .ic { color: var(--err); } @@ -1006,7 +1008,7 @@ fieldset.keymap-profiles { border: 0; padding: 0; margin: 0 0 16px; min-width: 0 .group::before { content: ""; margin-bottom: -1px; } .group + .group { margin-top: 8px; } .row { padding: 10px 12px; border-top: 1px solid var(--line); } -.group .row:focus-visible, .fold-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); } +html.kbd .group .row:focus-visible, html.kbd .fold-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); } .row-title { min-width: 0; color: var(--text); font-size: 14px; overflow-wrap: anywhere; } /* what a row found and what to do: all of it (an item that did not pass says what to do, and that is the point of the row); a passed item, folded away in 其余 N 项已通过, keeps to three lines */ diff --git a/internal/ui/web/js/app.js b/internal/ui/web/js/app.js index 559fb116..e17c071a 100644 --- a/internal/ui/web/js/app.js +++ b/internal/ui/web/js/app.js @@ -76,6 +76,12 @@ if (!themeParam) { // before the locale is read // ---- wiring +// the focus ring is for the keyboard only (html.kbd): WebView2 focuses a dialog's first control on open and gives the focus +// back on close, which looked like an error frame to a mouse user. Tab, the arrows, Enter, Space and Escape turn it on, a pointer turns it off. +const NAV_KEYS = new Set(['Tab', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown', 'Enter', ' ', 'Escape']); +addEventListener('keydown', (e) => { if (NAV_KEYS.has(e.key)) document.documentElement.classList.add('kbd'); }, true); +addEventListener('pointerdown', () => document.documentElement.classList.remove('kbd'), true); + initUI(); initGrid($('grid')); // ---- 卡片 / 列表 (?view= for screenshots, not remembered) diff --git a/internal/ui/web/js/cards.js b/internal/ui/web/js/cards.js index 7d9d6b29..35e2c0b9 100644 --- a/internal/ui/web/js/cards.js +++ b/internal/ui/web/js/cards.js @@ -152,9 +152,10 @@ function makeCard(i) { h('div', { class: 'prog' }, h('div', { class: 'prog-row' }, h('span', { class: 'spin' }), c.progMsg), c.progBar), c.peek); c.title = h('h2', { class: 'card-title', id: `card-t-${i}` }); - // The marks after the instance name are single-glyph blocks. The rule (the styles are in app.css, with the same text): - // - A mark is an 18px square with exactly one capital letter (10px cap height, 4px above and 4px below at 1x) or one - // 12px icon in it. No words, no second letter; what it means goes in its title and aria-label. + // The marks after the instance name are single glyphs, with no box behind them. The rule (the styles are in app.css, with the same text): + // - A mark is a 20px box with no background and no outline, with exactly one capital letter (15px, weight 600, 11px cap + // height, 4.5px above and 4.5px below at 1x) or one 16px icon in it. Colour is --text-2 (--tf for the adb tag and a + // proxy mark in tone-warn / tone-err), a hover makes it brighter. No words, no second letter; what it means goes in its title and aria-label. // - Today: cat head = 按应用走代理, G = Google Play 商店, K = KernelSU, // monitor with a slash = 无头 (headless). // - Order: marks that are always there come first; marks that come and go with the run state come last, so one @@ -166,13 +167,13 @@ function makeCard(i) { // The status label shows only for the states in between and the failed ones (开机中, 关机中, 新建中, // 开机失败, 新建失败); for the other two it stays in the DOM for screen readers only (.pill-quiet). The list view // always shows it (it has a status column). 诊断模式 is on the name's hover text in the card view. - // - The card view is the title and one config line. A new state is another single-glyph block or a hover text, not a + // - The card view is the title and one config line. A new state is another single glyph or a hover text, not a // word and not a line; the label showing or not never changes the card's height. // - There is no box under the card: nothing is added below the config line, so no state makes a card taller than // another. The reason of a failure (开机失败, 新建失败) is the status label's hover text, and clicking the label // opens 问题反馈 at that task; software rendering and a data disk that is nearly full are lines on the name's hover // text, the first start's setup (about 1–2 minutes) is a line on the screen's hover text. - // - The cat head (pmark) is a single-glyph block too: an icon-only button that opens the 按应用走代理 dialog. It is + // - The cat head (pmark) is a single glyph too: an icon-only button that opens the 按应用走代理 dialog. It is // the only mark that is clickable and the only one that can carry a state colour, and only when something is wrong: // it looks like the other marks while the proxy works (tone ok) or has nothing to report yet (tone info), and takes // tone-warn / tone-err when the guest says part of it does not work. @@ -240,7 +241,6 @@ function updateCard(c, inst) { const name = label(inst); c.el.dataset.status = v.key; setText(c.title, name); - const id = [t('编号 {index}', { index: inst.index }), inst.name].filter(Boolean).join(' · '); // diagnostics mode: the list view writes it under the name; the card view has no such line and, while running, no // status label either, so it is a line on the name's hover text (and in the status name screen readers read) const diag = inst.diagnostics ? t('诊断模式') : ''; @@ -250,7 +250,7 @@ function updateCard(c, inst) { const ds = inst.data_space; const warnings = [inst.software_renderer && t('软件渲染:显卡驱动不可用,游戏会卡'), ds && ds.message && (ds.advice ? ds.message + comma() + ds.advice : ds.message)]; - c.title.title = [id, ownTitle(inst) && name, diag, ...warnings].filter(Boolean).join('\n'); + c.title.title = [ownTitle(inst) && name, diag, ...warnings].filter(Boolean).join('\n'); const headless = inst.running && inst.window === false && v.key !== 'creating'; c.hmark.hidden = !headless; c.sub.hidden = !diag; diff --git a/scripts/test_create_cancel.mjs b/scripts/test_create_cancel.mjs index 158d64bf..dc7db181 100644 --- a/scripts/test_create_cancel.mjs +++ b/scripts/test_create_cancel.mjs @@ -558,25 +558,25 @@ test('clearing the boss key saves an empty one; a taken key on open is marked; n test('cards show diagnostics mode on the list line under the name, on the name\'s hover text and in the status name', async () => { const h = await settingsHarness(); const plain = h.makeCard({ ...h.inst, diagnostics: false }); - assert.equal(plain.title.title, '编号 3 · mas_3'); + assert.equal(plain.title.title, ''); assert.equal(plain.sub.textContent, ''); assert.equal(plain.sub.hidden, true); assert.ok(!plain.pill.getAttribute('title')); assert.ok(!plain.pill.getAttribute('aria-label')); h.patchCard(plain, { ...h.inst, title: 'Arknights Daily Main Account', diagnostics: false }); - assert.equal(plain.title.title, '编号 3 · mas_3\nArknights Daily Main Account'); + assert.equal(plain.title.title, 'Arknights Daily Main Account'); // the card view has no status label for running and shut down, so diagnostics mode is a line on the name's hover text h.patchCard(plain, { ...h.inst, title: 'Arknights Daily Main Account' }); - assert.equal(plain.title.title, '编号 3 · mas_3\nArknights Daily Main Account\n诊断模式'); + assert.equal(plain.title.title, 'Arknights Daily Main Account\n诊断模式'); for (const status of ['online', 'offline']) { const inst = { ...h.inst, status, running: status === 'online' }; h.patchCard(plain, inst); - assert.equal(plain.title.title, '编号 3 · mas_3\n诊断模式'); + assert.equal(plain.title.title, '诊断模式'); assert.equal(plain.sub.textContent, '诊断模式'); assert.equal(plain.pill.getAttribute('title'), '诊断模式'); assert.equal(plain.pill.getAttribute('aria-label'), `${plain.pillText.textContent} · 诊断模式`); h.patchCard(plain, { ...inst, diagnostics: undefined }); - assert.equal(plain.title.title, '编号 3 · mas_3'); + assert.equal(plain.title.title, ''); assert.equal(plain.sub.hidden, true); assert.ok(!plain.pill.getAttribute('title')); assert.ok(!plain.pill.getAttribute('aria-label')); @@ -760,15 +760,15 @@ test('no state puts a box under the card', async () => { test('software rendering and a nearly full disk are lines on the name hover text', async () => { const h = await settingsHarness({ diagnostics: false }); const name = inst => h.makeCard(inst).title.title; - assert.equal(name({ ...h.inst }), '编号 3 · mas_3'); - assert.equal(name({ ...h.inst, software_renderer: true }), '编号 3 · mas_3\n软件渲染:显卡驱动不可用,游戏会卡'); - assert.equal(name({ ...h.inst, data_space: lowDisk }), '编号 3 · mas_3\n数据盘只剩 1.8 GB(共 47.0 GB),改成自动扩盘:modavd set 3 --data-gb auto'); + assert.equal(name({ ...h.inst }), ''); + assert.equal(name({ ...h.inst, software_renderer: true }), '软件渲染:显卡驱动不可用,游戏会卡'); + assert.equal(name({ ...h.inst, data_space: lowDisk }), '数据盘只剩 1.8 GB(共 47.0 GB),改成自动扩盘:modavd set 3 --data-gb auto'); // a data_space without a message (the disk is fine) adds nothing; one without advice is the message alone - assert.equal(name({ ...h.inst, data_space: { state: '', message: '', advice: '' } }), '编号 3 · mas_3'); - assert.equal(name({ ...h.inst, data_space: { state: 'host_low', message: '宿主盘只剩 12.0 GB', advice: '' } }), '编号 3 · mas_3\n宿主盘只剩 12.0 GB'); + assert.equal(name({ ...h.inst, data_space: { state: '', message: '', advice: '' } }), ''); + assert.equal(name({ ...h.inst, data_space: { state: 'host_low', message: '宿主盘只剩 12.0 GB', advice: '' } }), '宿主盘只剩 12.0 GB'); // one line each, after the diagnostics line assert.equal(name({ ...h.inst, title: '星铁', diagnostics: true, software_renderer: true, data_space: lowDisk }), - '编号 3 · mas_3\n星铁\n诊断模式\n软件渲染:显卡驱动不可用,游戏会卡\n数据盘只剩 1.8 GB(共 47.0 GB),改成自动扩盘:modavd set 3 --data-gb auto'); + '星铁\n诊断模式\n软件渲染:显卡驱动不可用,游戏会卡\n数据盘只剩 1.8 GB(共 47.0 GB),改成自动扩盘:modavd set 3 --data-gb auto'); const c = h.makeCard({ ...h.inst, software_renderer: true, data_space: lowDisk }); assert.equal(c.pill.getAttribute('aria-label'), null, 'the status name for screen readers does not carry them'); }); @@ -882,8 +882,10 @@ test('the stylesheet hides the quiet status label for the card view only and kee assert.doesNotMatch(css, /pill-quiet[^{]*\{[^}]*display: none/); assert.match(rule('.grid:not(.is-list) .card-head'), /min-height: 23px/); assert.match(rule('.grid:not(.is-list) .card-tline .card-title'), /flex: 1/); - assert.doesNotMatch(rule('.pmark'), /var\(--tb\)/, 'plain by default'); - assert.match(rule('.pmark.tone-warn, .pmark.tone-err'), /background: var\(--tb\); color: var\(--tf\)/); + assert.doesNotMatch(rule('.pmark, .smark, .kmark, .hmark'), /var\(--(tb|sunken)\)/, 'no box behind a mark'); + assert.doesNotMatch(rule('.pmark.tone-warn, .pmark.tone-err'), /background/, 'the state colour is the icon only'); + assert.doesNotMatch(rule('.adb-tag'), /var\(--tb\)/); + assert.match(rule('.pmark.tone-warn, .pmark.tone-err'), /color: var\(--tf\)/); // no box under the card in either view: no styles for it, and the list row is one grid row assert.doesNotMatch(css, /\.notes\b|\.note \{|\.note-main|\.note-text|\.note-adv|\.note-links|\.is-list \.note\b/); assert.match(rule('.is-list .card'), /grid-template-areas: "pill title cfg adb power view more";/); From 795af8d25aeec7b147cf55363d1896ad3d580ac6 Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Sat, 5 Dec 2026 19:22:06 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=A2=A8=E8=BF=B9=E5=AF=B9=E9=BD=90=E5=B9=B6=E6=94=BE=E5=A4=A7?= =?UTF-8?q?=E3=80=81ADB=20=E6=A0=87=E8=AE=B0=E6=94=B9=E6=88=90=E5=AD=97?= =?UTF-8?q?=E6=AF=8D=20A=E3=80=81=E6=A0=87=E9=A2=98=E6=94=BE=E5=A4=A7=202p?= =?UTF-8?q?x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs ModAVD/ModAVD#462 --- changelog.d/issue-462-card-marks.change.md | 4 +-- internal/ui/web/app.css | 38 ++++++++++++++-------- internal/ui/web/js/cards.js | 10 +++--- internal/ui/web/js/dom.js | 1 - scripts/test_create_cancel.mjs | 14 ++++---- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/changelog.d/issue-462-card-marks.change.md b/changelog.d/issue-462-card-marks.change.md index 1cb92af9..19185766 100644 --- a/changelog.d/issue-462-card-marks.change.md +++ b/changelog.d/issue-462-card-marks.change.md @@ -1,2 +1,2 @@ -实例卡片标记去掉底色方块、图标更大;鼠标操作不再出现焦点框;名称悬停提示不再写编号 -Instance card marks lose the box and grow larger, the focus ring shows only for keyboard use, and the name tooltip no longer shows the index. +实例卡片标记去底色、字母和图标对齐变大,标题放大;鼠标操作不再出现焦点框;名称提示不再写编号 +Instance card marks lose the box, letters and icons line up and grow, titles are larger, the focus ring shows only for keyboard use, and the tooltip drops the index. diff --git a/internal/ui/web/app.css b/internal/ui/web/app.css index 1c8ee6aa..b6474a10 100644 --- a/internal/ui/web/app.css +++ b/internal/ui/web/app.css @@ -593,7 +593,7 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol .card-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 4px 0; flex: 1; } .card-head { display: flex; align-items: flex-start; gap: 12px; } .card-titles { flex: 1; min-width: 0; } -.card-title { font-size: 15px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.card-title { font-size: 17px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .card-sub, .card-cfg { color: var(--text-3); font-size: 12px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; } .card-meta { display: flex; align-items: center; gap: 8px; margin-top: -4px; } .card-cfg { flex: 1; min-width: 0; } @@ -616,11 +616,11 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol .grid:not(.is-list) .card-meta .act-more { width: 18px; height: 18px; border-radius: 5px; } /* Marks after the instance name in the card's title line: one rule for all of them, kept in cards.js next to where they are built (the same text is there). - Every mark is a single glyph with no background box and no outline: a 20px box with exactly one capital letter (15px, - 600, 11px cap height, 4.5px above and 4.5px below at 1x) or one 16px icon (2px around it) in it. The colour is --text-2 + Every mark is a single glyph with no background box and no outline: a 22px box with exactly one capital letter (17px, + 600, 12.47px cap height, 4.77px above and below at 1x) or one icon (the ink of every mark is 12.47px, the capital height of 17px type, centred in the box) in it. The colour is --text-2 (--tf for the adb tag and for a proxy mark in tone-warn / tone-err), a hover makes it brighter. No words and no second letter; what a mark means goes in its title and aria-label. Today: cat head = 按应用走代理, G = Google Play 商店, - K = KernelSU, monitor with a slash = 无头 (headless). + K = KernelSU, monitor with a slash = 无头 (headless), A = copy the ADB address. Always-there marks come first, marks that follow the run state come last, so one appearing never pushes the others. In the card view they are at the right end of the title line. The card view does not write 运行中 or 已关机 (the screen and the power button say it): the status label shows only for the states in between and the failed ones, and @@ -631,25 +631,28 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol proxy works it looks like the others; the others are static. */ .pmark, .smark, .kmark, .hmark { display: inline-flex; align-items: center; justify-content: center; flex: none; - width: 20px; height: 20px; padding: 0; border: 0; border-radius: 0; + width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text-2); } .pmark { cursor: pointer; } .pmark.tone-warn, .pmark.tone-err { color: var(--tf); } .pmark:hover { color: var(--text-1); } html.kbd .pmark:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; } -.pmark .ic, .hmark .ic { width: 16px; height: 16px; } -.smark, .kmark { font-size: 15px; font-weight: 600; line-height: 1; } +/* every mark is 12.47px of ink (the capital height of the 17px letters), y 4.77–17.23 of the 22px box: the monitor drawing is 12.5px tall at + 16px, so it stays 16px; the cat head is 11.04px tall at 16px, so it is drawn at 18.07px (the same centre). */ +.pmark .ic { width: 18.07px; height: 18.07px; } +.hmark .ic { width: 16px; height: 16px; } +.smark, .kmark { font-size: 17px; font-weight: 600; line-height: 1; } /* A letter is centred on its capitals, not on its line box: the font leaves more room above the capitals than below the baseline, so a flex-centred G sat low. font-size-adjust fixes the capital height at 11px whatever the font - (a 15px size scaled to cap-height 11/15), text-box trims the line to cap height and baseline, and the 4.5px padding - leaves 4.5px below. The two marks become blocks because text-box does not reach the anonymous box inside a flex + (a 17px size scaled to cap-height 12.47/17), text-box trims the line to cap height and baseline, and the 4.77px padding + leaves 4.77px below. The two letters become blocks (the A of the ADB tag is the same, in its own rule below) because text-box does not reach the anonymous box inside a flex container. A browser without either property keeps the flex centring above. */ @supports (text-box: trim-both cap alphabetic) and (font-size-adjust: cap-height 0.7) { .smark, .kmark { display: block; text-align: center; - font-size: 15px; font-size-adjust: cap-height 0.7333; - padding-top: 4.5px; + font-size: 17px; font-size-adjust: cap-height 0.7333; + padding-top: 4.77px; text-box: trim-both cap alphabetic; } } @@ -657,12 +660,19 @@ html.kbd .pmark:focus-visible { outline: 2px solid var(--focus); outline-offset: .grid:not(.is-list) .card-sub { display: none; } .adb-tag { - display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; padding: 0; + display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0; - background: none; color: var(--tf); + background: none; color: var(--tf); font-family: inherit; cursor: pointer; + font-size: 17px; font-weight: 600; line-height: 1; +} +@supports (text-box: trim-both cap alphabetic) and (font-size-adjust: cap-height 0.7) { + .adb-tag { + display: block; text-align: center; + font-size-adjust: cap-height 0.7333; + text-box: trim-both cap alphabetic; /* a button centres its 12.47px of cap height itself: 4.77px above and below, so no padding-top here */ + } } -.adb-tag .ic { width: 16px; height: 16px; } .adb-tag:hover { color: var(--td, var(--tf)); opacity: .8; } .adb { display: none; } .adb-addr { color: var(--text-2); white-space: nowrap; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; } diff --git a/internal/ui/web/js/cards.js b/internal/ui/web/js/cards.js index 35e2c0b9..8242ee2a 100644 --- a/internal/ui/web/js/cards.js +++ b/internal/ui/web/js/cards.js @@ -153,9 +153,11 @@ function makeCard(i) { c.peek); c.title = h('h2', { class: 'card-title', id: `card-t-${i}` }); // The marks after the instance name are single glyphs, with no box behind them. The rule (the styles are in app.css, with the same text): - // - A mark is a 20px box with no background and no outline, with exactly one capital letter (15px, weight 600, 11px cap - // height, 4.5px above and 4.5px below at 1x) or one 16px icon in it. Colour is --text-2 (--tf for the adb tag and a - // proxy mark in tone-warn / tone-err), a hover makes it brighter. No words, no second letter; what it means goes in its title and aria-label. + // - A mark is a 22px box with no background and no outline, with exactly one capital letter (17px, weight 600, 12.47px + // cap height, 4.77px above and below at 1x) or one icon in it. The ink of every mark is 12.47px, centred in the box (y 4.77–17.23); + // the cat head is drawn at 18.07px and the monitor at 16px for that, the ADB tag is the letter A like G and K. Colour is + // --text-2 (--tf for the adb tag, which is a button too, and a proxy mark in tone-warn / tone-err), a hover makes it + // brighter. No words, no second letter; what it means goes in its title and aria-label. // - Today: cat head = 按应用走代理, G = Google Play 商店, K = KernelSU, // monitor with a slash = 无头 (headless). // - Order: marks that are always there come first; marks that come and go with the run state come last, so one @@ -201,7 +203,7 @@ function makeCard(i) { c.pill = h('span', { class: 'pill', onclick: showFailure, onkeydown: (e) => { if (c.failure && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); showFailure(); } } }, c.pillText); const copyAdb = () => A.copy(c.inst.adb_address); - c.adbTag = btn('adb-tag tone-idle', icon('robot'), copyAdb); + c.adbTag = btn('adb-tag tone-idle', 'A', copyAdb); c.adb = h('span', { class: 'adb-addr' }); c.copy = ibtn('copy', t('复制 adb 地址'), copyAdb); c.adbList = h('div', { class: 'adb' }, c.adb, c.copy); diff --git a/internal/ui/web/js/dom.js b/internal/ui/web/js/dom.js index 54b79e84..17e76b9c 100644 --- a/internal/ui/web/js/dom.js +++ b/internal/ui/web/js/dom.js @@ -93,7 +93,6 @@ const I = { refresh: '', window: '', monitorOff: '', - robot: '', eye: '', eyeOff: '', download: '', diff --git a/scripts/test_create_cancel.mjs b/scripts/test_create_cancel.mjs index dc7db181..55a8b715 100644 --- a/scripts/test_create_cancel.mjs +++ b/scripts/test_create_cancel.mjs @@ -619,13 +619,12 @@ test('cards mark a headless instance in the title line, after the G and KernelSU assert.equal(c.hmark.hidden, true, 'a create in progress runs headless but is not marked'); }); -// ModAVD/ModAVD#435: the card's ADB address is a small robot mark after the title (the full address on hover and +// ModAVD/ModAVD#435: the card's ADB address is a small letter A mark after the title (the full address on hover and // for screen readers), hidden without a port; the config line keeps its full wording on hover and for screen readers. -test('cards show the ADB robot mark and the short config line', async () => { +test('cards show the ADB letter mark and the short config line', async () => { const h = await settingsHarness(); const c = h.makeCard({ ...h.inst, adb_address: '127.0.0.1:20011' }); - assert.equal(c.adbTag.textContent, ''); - assert.equal(c.adbTag.childNodes.length, 1); + assert.equal(c.adbTag.textContent, 'A'); assert.equal(c.adbTag.hidden, false); assert.equal(c.adbTag.getAttribute('title'), '127.0.0.1:20011'); assert.equal(c.adbTag.getAttribute('aria-label'), '复制 ADB 地址 127.0.0.1:20011'); @@ -841,8 +840,8 @@ test('a failed boot or create: the reason is the status label hover text, and th assert.deepEqual(h.activity, [['j13', null]]); h.patchCard(cf, { ...created, creation_error: '', creation_log: '' }); assert.equal(cf.pill.getAttribute('title'), '新建失败:初始化没做完\n点「重试初始化」再做一次,或在「更多」里删除这台实例'); - // no 调小内存 link (it is on the task in 问题反馈), no dismiss button, no 详情 link: the visible text buttons are the retry and 画面 controls - const buttons = descendants(cf.el).filter(x => x.tagName === 'BUTTON').map(x => x.textContent.trim()).filter(Boolean); + // no 调小内存 link (it is on the task in 问题反馈), no dismiss button, no 详情 link: the visible text buttons are the retry and 画面 controls (not the A mark) + const buttons = descendants(cf.el).filter(x => x.tagName === 'BUTTON' && x !== cf.adbTag).map(x => x.textContent.trim()).filter(Boolean); assert.deepEqual(buttons, ['重试初始化', '画面']); assert.doesNotMatch(cf.el.textContent, /调小内存|不再显示|详情/); h.state.jobs.clear(); @@ -885,6 +884,7 @@ test('the stylesheet hides the quiet status label for the card view only and kee assert.doesNotMatch(rule('.pmark, .smark, .kmark, .hmark'), /var\(--(tb|sunken)\)/, 'no box behind a mark'); assert.doesNotMatch(rule('.pmark.tone-warn, .pmark.tone-err'), /background/, 'the state colour is the icon only'); assert.doesNotMatch(rule('.adb-tag'), /var\(--tb\)/); + assert.match(rule('.hmark .ic'), /width: 16px; height: 16px/, 'the monitor drawing is 12.5px of ink at 16px, the cap height of the 17px letters'); assert.match(rule('.pmark.tone-warn, .pmark.tone-err'), /color: var\(--tf\)/); // no box under the card in either view: no styles for it, and the list row is one grid row assert.doesNotMatch(css, /\.notes\b|\.note \{|\.note-main|\.note-text|\.note-adv|\.note-links|\.is-list \.note\b/); @@ -892,6 +892,8 @@ test('the stylesheet hides the quiet status label for the card view only and kee assert.match(rule('.grid:not(.is-list) .card-actions'), /display: none/); assert.match(rule('.grid:not(.is-list) .card-body'), /gap: 4px/); assert.match(rule('.adb-tag'), /display: inline-grid/); + assert.match(rule('.card-title'), /font-size: 17px/); + assert.match(rule('.smark, .kmark'), /font-size: 17px/); assert.match(rule('.pill-link'), /cursor: pointer/); }); From 5ed11e64175c963fd6a060afbc94b79b1650b21e Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Sat, 5 Dec 2026 19:26:58 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=94=B9=E6=88=90=2018px=20=E7=BB=86=E6=A1=86=E6=97=A0?= =?UTF-8?q?=E5=BA=95=E8=89=B2=E3=80=81=E5=A2=A8=E8=BF=B9=2010px=20?= =?UTF-8?q?=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs ModAVD/ModAVD#462 --- changelog.d/issue-462-card-marks.change.md | 4 +- internal/ui/web/app.css | 46 +++++++++++----------- internal/ui/web/js/cards.js | 10 ++--- scripts/test_create_cancel.mjs | 9 +++-- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/changelog.d/issue-462-card-marks.change.md b/changelog.d/issue-462-card-marks.change.md index 19185766..d78e9a9c 100644 --- a/changelog.d/issue-462-card-marks.change.md +++ b/changelog.d/issue-462-card-marks.change.md @@ -1,2 +1,2 @@ -实例卡片标记去底色、字母和图标对齐变大,标题放大;鼠标操作不再出现焦点框;名称提示不再写编号 -Instance card marks lose the box, letters and icons line up and grow, titles are larger, the focus ring shows only for keyboard use, and the tooltip drops the index. +实例卡片标记改成细框、无底色,ADB 改成字母 A;鼠标操作不再出现焦点框;名称提示不再写编号 +Instance card marks get a thin frame and no fill, ADB becomes the letter A, the focus ring shows only for keyboard use, and the tooltip drops the index. diff --git a/internal/ui/web/app.css b/internal/ui/web/app.css index b6474a10..f29c1256 100644 --- a/internal/ui/web/app.css +++ b/internal/ui/web/app.css @@ -593,7 +593,7 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol .card-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 4px 0; flex: 1; } .card-head { display: flex; align-items: flex-start; gap: 12px; } .card-titles { flex: 1; min-width: 0; } -.card-title { font-size: 17px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.card-title { font-size: 15px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .card-sub, .card-cfg { color: var(--text-3); font-size: 12px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; } .card-meta { display: flex; align-items: center; gap: 8px; margin-top: -4px; } .card-cfg { flex: 1; min-width: 0; } @@ -616,9 +616,9 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol .grid:not(.is-list) .card-meta .act-more { width: 18px; height: 18px; border-radius: 5px; } /* Marks after the instance name in the card's title line: one rule for all of them, kept in cards.js next to where they are built (the same text is there). - Every mark is a single glyph with no background box and no outline: a 22px box with exactly one capital letter (17px, - 600, 12.47px cap height, 4.77px above and below at 1x) or one icon (the ink of every mark is 12.47px, the capital height of 17px type, centred in the box) in it. The colour is --text-2 - (--tf for the adb tag and for a proxy mark in tone-warn / tone-err), a hover makes it brighter. No words and no second letter; what a mark means goes in its + Every mark is a single glyph in an 18px cell with a 1px --line-2 frame (inset box-shadow, radius 5px) and no background colour: exactly one capital + letter (14px, 600, 10px cap height, 4px above and below at 1x) or one icon in it, whose ink is 10px too (y 4–14). The colour is --text-2 + (--tf for the adb tag and for a proxy mark in tone-warn / tone-err). The two marks that are buttons (cat head, A) darken their frame to --text-3 on hover. No words and no second letter; what a mark means goes in its title and aria-label. Today: cat head = 按应用走代理, G = Google Play 商店, K = KernelSU, monitor with a slash = 无头 (headless), A = copy the ADB address. Always-there marks come first, marks that follow the run state come last, so one appearing never pushes the others. @@ -631,28 +631,28 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol proxy works it looks like the others; the others are static. */ .pmark, .smark, .kmark, .hmark { display: inline-flex; align-items: center; justify-content: center; flex: none; - width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0; - background: none; color: var(--text-2); + width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; + background: none; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-2); } .pmark { cursor: pointer; } .pmark.tone-warn, .pmark.tone-err { color: var(--tf); } -.pmark:hover { color: var(--text-1); } +.pmark:hover { box-shadow: inset 0 0 0 1px var(--text-3); } /* the two marks that are buttons: the frame darkens on hover */ html.kbd .pmark:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; } -/* every mark is 12.47px of ink (the capital height of the 17px letters), y 4.77–17.23 of the 22px box: the monitor drawing is 12.5px tall at - 16px, so it stays 16px; the cat head is 11.04px tall at 16px, so it is drawn at 18.07px (the same centre). */ -.pmark .ic { width: 18.07px; height: 18.07px; } -.hmark .ic { width: 16px; height: 16px; } -.smark, .kmark { font-size: 17px; font-weight: 600; line-height: 1; } +/* every mark is 10px of ink (the capital height of the 14px letters), y 4–14 of the 18px box: the monitor drawing is 12.5px tall at 16px, + so it is drawn at 12.83px; the cat head is 11.04px tall at 16px, so it is drawn at 14.5px (the same centre). */ +.pmark .ic { width: 14.5px; height: 14.5px; } +.hmark .ic { width: 12.83px; height: 12.83px; } +.smark, .kmark { font-size: 14px; font-weight: 600; line-height: 1; } /* A letter is centred on its capitals, not on its line box: the font leaves more room above the capitals than below the - baseline, so a flex-centred G sat low. font-size-adjust fixes the capital height at 11px whatever the font - (a 17px size scaled to cap-height 12.47/17), text-box trims the line to cap height and baseline, and the 4.77px padding - leaves 4.77px below. The two letters become blocks (the A of the ADB tag is the same, in its own rule below) because text-box does not reach the anonymous box inside a flex + baseline, so a flex-centred G sat low. font-size-adjust fixes the capital height at 10px whatever the font + (a 14px size scaled to cap-height 10/14), text-box trims the line to cap height and baseline, and the 4px padding + leaves 4px below. The two letters become blocks (the A of the ADB tag is the same, in its own rule below) because text-box does not reach the anonymous box inside a flex container. A browser without either property keeps the flex centring above. */ @supports (text-box: trim-both cap alphabetic) and (font-size-adjust: cap-height 0.7) { .smark, .kmark { display: block; text-align: center; - font-size: 17px; font-size-adjust: cap-height 0.7333; - padding-top: 4.77px; + font-size: 14px; font-size-adjust: cap-height 0.7143; + padding-top: 4px; text-box: trim-both cap alphabetic; } } @@ -660,20 +660,20 @@ html.kbd .pmark:focus-visible { outline: 2px solid var(--focus); outline-offset: .grid:not(.is-list) .card-sub { display: none; } .adb-tag { - display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; padding: 0; - border: 0; border-radius: 0; + display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; padding: 0; + border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-2); background: none; color: var(--tf); font-family: inherit; cursor: pointer; - font-size: 17px; font-weight: 600; line-height: 1; + font-size: 14px; font-weight: 600; line-height: 1; } @supports (text-box: trim-both cap alphabetic) and (font-size-adjust: cap-height 0.7) { .adb-tag { display: block; text-align: center; - font-size-adjust: cap-height 0.7333; - text-box: trim-both cap alphabetic; /* a button centres its 12.47px of cap height itself: 4.77px above and below, so no padding-top here */ + font-size-adjust: cap-height 0.7143; + text-box: trim-both cap alphabetic; /* a button centres its 10px of cap height itself: 4px above and below, so no padding-top here */ } } -.adb-tag:hover { color: var(--td, var(--tf)); opacity: .8; } +.adb-tag:hover { box-shadow: inset 0 0 0 1px var(--text-3); } .adb { display: none; } .adb-addr { color: var(--text-2); white-space: nowrap; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; } diff --git a/internal/ui/web/js/cards.js b/internal/ui/web/js/cards.js index 8242ee2a..922866bb 100644 --- a/internal/ui/web/js/cards.js +++ b/internal/ui/web/js/cards.js @@ -153,11 +153,11 @@ function makeCard(i) { c.peek); c.title = h('h2', { class: 'card-title', id: `card-t-${i}` }); // The marks after the instance name are single glyphs, with no box behind them. The rule (the styles are in app.css, with the same text): - // - A mark is a 22px box with no background and no outline, with exactly one capital letter (17px, weight 600, 12.47px - // cap height, 4.77px above and below at 1x) or one icon in it. The ink of every mark is 12.47px, centred in the box (y 4.77–17.23); - // the cat head is drawn at 18.07px and the monitor at 16px for that, the ADB tag is the letter A like G and K. Colour is - // --text-2 (--tf for the adb tag, which is a button too, and a proxy mark in tone-warn / tone-err), a hover makes it - // brighter. No words, no second letter; what it means goes in its title and aria-label. + // - A mark is an 18px cell with a 1px --line-2 frame (inset box-shadow, radius 5px) and no background colour, with exactly one capital + // letter (14px, weight 600, 10px cap height, 4px above and below at 1x) or one icon in it. The ink of every mark is 10px, y 4–14; + // the cat head is drawn at 14.5px and the monitor at 12.83px for that, the ADB tag is the letter A like G and K. Colour is + // --text-2 (--tf for the adb tag, which is a button too, and a proxy mark in tone-warn / tone-err; the icon only, never a background). + // The two buttons (cat head, A) darken the frame to --text-3 on hover. No words, no second letter; what it means goes in its title and aria-label. // - Today: cat head = 按应用走代理, G = Google Play 商店, K = KernelSU, // monitor with a slash = 无头 (headless). // - Order: marks that are always there come first; marks that come and go with the run state come last, so one diff --git a/scripts/test_create_cancel.mjs b/scripts/test_create_cancel.mjs index 55a8b715..e273dbe6 100644 --- a/scripts/test_create_cancel.mjs +++ b/scripts/test_create_cancel.mjs @@ -881,10 +881,10 @@ test('the stylesheet hides the quiet status label for the card view only and kee assert.doesNotMatch(css, /pill-quiet[^{]*\{[^}]*display: none/); assert.match(rule('.grid:not(.is-list) .card-head'), /min-height: 23px/); assert.match(rule('.grid:not(.is-list) .card-tline .card-title'), /flex: 1/); - assert.doesNotMatch(rule('.pmark, .smark, .kmark, .hmark'), /var\(--(tb|sunken)\)/, 'no box behind a mark'); + assert.doesNotMatch(rule('.pmark, .smark, .kmark, .hmark'), /var\(--(tb|sunken)\)/, 'no background colour behind a mark'); assert.doesNotMatch(rule('.pmark.tone-warn, .pmark.tone-err'), /background/, 'the state colour is the icon only'); assert.doesNotMatch(rule('.adb-tag'), /var\(--tb\)/); - assert.match(rule('.hmark .ic'), /width: 16px; height: 16px/, 'the monitor drawing is 12.5px of ink at 16px, the cap height of the 17px letters'); + assert.match(rule('.hmark .ic'), /width: 12\.83px; height: 12\.83px/, 'the monitor drawing is 12.5px of ink at 16px: 10px at 12.83px, the cap height of the 14px letters'); assert.match(rule('.pmark.tone-warn, .pmark.tone-err'), /color: var\(--tf\)/); // no box under the card in either view: no styles for it, and the list row is one grid row assert.doesNotMatch(css, /\.notes\b|\.note \{|\.note-main|\.note-text|\.note-adv|\.note-links|\.is-list \.note\b/); @@ -892,8 +892,9 @@ test('the stylesheet hides the quiet status label for the card view only and kee assert.match(rule('.grid:not(.is-list) .card-actions'), /display: none/); assert.match(rule('.grid:not(.is-list) .card-body'), /gap: 4px/); assert.match(rule('.adb-tag'), /display: inline-grid/); - assert.match(rule('.card-title'), /font-size: 17px/); - assert.match(rule('.smark, .kmark'), /font-size: 17px/); + assert.match(rule('.card-title'), /font-size: 15px/); + assert.match(rule('.smark, .kmark'), /font-size: 14px/); + assert.match(rule('.pmark, .smark, .kmark, .hmark'), /box-shadow: inset 0 0 0 1px var\(--line-2\)/, 'a thin frame, no background colour'); assert.match(rule('.pill-link'), /cursor: pointer/); }); From 45fbcb5d36b1624f80e5a7c0a60043e91ae0f12f Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Sat, 5 Dec 2026 19:29:56 +0100 Subject: [PATCH 4/5] =?UTF-8?q?changelog=EF=BC=9A=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E8=A1=8C=E5=8E=8B=E5=88=B0=20120=20=E5=AD=97=E7=AC=A6=E4=BB=A5?= =?UTF-8?q?=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs ModAVD/ModAVD#462 --- changelog.d/issue-462-card-marks.change.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/issue-462-card-marks.change.md b/changelog.d/issue-462-card-marks.change.md index d78e9a9c..df74744c 100644 --- a/changelog.d/issue-462-card-marks.change.md +++ b/changelog.d/issue-462-card-marks.change.md @@ -1,2 +1,2 @@ 实例卡片标记改成细框、无底色,ADB 改成字母 A;鼠标操作不再出现焦点框;名称提示不再写编号 -Instance card marks get a thin frame and no fill, ADB becomes the letter A, the focus ring shows only for keyboard use, and the tooltip drops the index. +Card marks get thin frames, ADB is the letter A, focus rings are keyboard-only, and the name tooltip drops the index. From 693632908f740c5930e68d2b985237f6e3426ecb Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Sat, 5 Dec 2026 19:41:11 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8D=A1=E7=89=87=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=8A=B6=E6=80=81=E6=A0=87=E7=AD=BE=EF=BC=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=85=A5=E5=8F=A3=E6=8C=AA=E5=88=B0=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 卡片视图任何状态都不显示状态标签(读屏照旧读状态名)。开机失败、新建失败时画面区写失败, 悬停是原因和建议,点画面区打开问题反馈;开机失败的重新开机放进更多菜单。列表视图不变。 Refs ModAVD/ModAVD#463 --- changelog.d/issue-463-card-pill.change.md | 2 + internal/ui/API.md | 2 +- internal/ui/web/app.css | 14 +-- internal/ui/web/js/cards.js | 57 +++++---- scripts/test_create_cancel.mjs | 144 +++++++++++++--------- 5 files changed, 125 insertions(+), 94 deletions(-) create mode 100644 changelog.d/issue-463-card-pill.change.md diff --git a/changelog.d/issue-463-card-pill.change.md b/changelog.d/issue-463-card-pill.change.md new file mode 100644 index 00000000..5a10dff3 --- /dev/null +++ b/changelog.d/issue-463-card-pill.change.md @@ -0,0 +1,2 @@ +卡片视图不再显示开机中等状态标签,开机失败时点画面区查看原因 +Cards no longer show a status label; for a failed boot, click the screen for the reason diff --git a/internal/ui/API.md b/internal/ui/API.md index 97d315f6..69dbd72f 100644 --- a/internal/ui/API.md +++ b/internal/ui/API.md @@ -124,7 +124,7 @@ GET `/api/keymap/vendor-sources?vendor=ldplayer` 列出安装,带 `sourceInsta - `progress.step`:开机用 emu 的 `launch` / `boot` / `tune` / `ime` / `first_boot` / `vulkan_fix` / `done`;关机(含等被取消的开机停下)是 `stop`,安装是 `install`,这两种做完是 `done`;整理磁盘进行中是 `disk_compact`、做完是 `done`;复制实例是 `copy`(`done` / `total` 按复制的字节折成千分比)(进行中没有百分比,`total` 为 0,页面显示不定长进度条;做完 `done` = `total` = 1000);装执行桥的每一轮是 `bridge`;商店的装、卸进行中是 `playstore-install` / `playstore-uninstall`(没有百分比)、做完是 `done`;导入时核对文件是 `verifying`、解压镜像是 `extracting`(`done` / `total` 是字节);新建是 `create`、其中几次开机的上述各步(开机做完是 `setup`)、`create_stop`、`done`,几次开机合成一条不回退的进度。`total` 一律 1000。 - 安装任务的 `result.apk` 是用户上传的文件名,不是服务端的临时路径(临时文件任务结束就删了)。 - `progress` 在没有进度时为 `null`;`result` 是 `StartResult` / `StopResult` / `InstallResult` / `DiskCompactResult` / `InstanceInfo`(新建)/ `PlayStoreResult` / `PlayStoreImportResult` / `GLES32Result`,没完成时为 `null`;`error` 失败时是错误对象,否则 `null`。 -- 页面怎么提示失败:卡片下面不放失败提示框。有任务失败(`state` 为 `failed`,什么种类都算;`canceled` 不算),或有实例是 `create_failed` 而管理器里没有它的新建任务(比如命令行建的),而这一条还没在「问题反馈」里看过时,顶栏的「问题反馈」入口和不能开机时的「组件」一样变红、一明一暗地闪,悬停和读屏说是哪几条。点开直接定位到最新的那条(在「最近任务和消息」里,带原因、建议,内存不够的带「调小内存」);没有任务的 `create_failed` 实例按任务的样子列在最上面。卡片上「开机失败」「新建失败」的状态标签悬停是原因和建议,点它(或按 Enter、空格)同样打开「问题反馈」定位到那条任务;没有任务的新建失败定位到最上面那台实例的那一行。抽屉里列出来就算看过,入口变回原样;看过的记在页面的 `localStorage`(`modavd.feedback.seen:<根目录>`,最近 100 条),刷新不会再闪。软件渲染、磁盘空间这类一直在的状态不算。失败时右下角的提示照旧。 +- 页面怎么提示失败:卡片下面不放失败提示框。有任务失败(`state` 为 `failed`,什么种类都算;`canceled` 不算),或有实例是 `create_failed` 而管理器里没有它的新建任务(比如命令行建的),而这一条还没在「问题反馈」里看过时,顶栏的「问题反馈」入口和不能开机时的「组件」一样变红、一明一暗地闪,悬停和读屏说是哪几条。点开直接定位到最新的那条(在「最近任务和消息」里,带原因、建议,内存不够的带「调小内存」);没有任务的 `create_failed` 实例按任务的样子列在最上面。卡片视图不显示状态标签(读屏照旧读得到状态名);「开机失败」「新建失败」时画面区写着失败,悬停是原因和建议,点画面区(或按 Enter、空格)打开「问题反馈」定位到那条任务(开机失败的重新开机在「更多」里;列表视图的状态标签照旧);没有任务的新建失败定位到最上面那台实例的那一行。抽屉里列出来就算看过,入口变回原样;看过的记在页面的 `localStorage`(`modavd.feedback.seen:<根目录>`,最近 100 条),刷新不会再闪。软件渲染、磁盘空间这类一直在的状态不算。失败时右下角的提示照旧。 `DiskCompactResult` 保留非负的 `freed_bytes`。`before_on_disk_bytes` 和 `after_on_disk_bytes` 是整理前后宿主实际占用,新增的 `on_disk_delta_bytes` 等于后者减前者,正值表示占用增大。`skipped=true` 表示检查通过、预计收益不足,未重写原盘;此时前后占用相等、变化和释放量均为零。结果还包含 `reclaim_threshold_bytes` 和可省略的 `estimated_reclaimable_bytes`,详见 [整理预算与结果契约](../emu/COMPACT.md)。 - 同一实例同时只能有一个任务在跑;第二个回 409 `busy`。**例外**:开机任务进行中可以发关机(和 emu 一致:开机中照样能关)。 diff --git a/internal/ui/web/app.css b/internal/ui/web/app.css index f29c1256..a248c394 100644 --- a/internal/ui/web/app.css +++ b/internal/ui/web/app.css @@ -240,8 +240,8 @@ button { -webkit-tap-highlight-color: transparent; } .num { font-variant-numeric: tabular-nums; } .muted { color: var(--text-3); } .spacer { flex: 1; } -/* .pill-quiet: the card view's status label for 运行中 and 已关机, kept for screen readers (the list view shows it) */ -.sr-only, .grid:not(.is-list) .pill-quiet { +/* the card view's status label (.pill) is for screen readers only, in every state: the screen says it (the list view shows it) */ +.sr-only, .grid:not(.is-list) .pill { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } @@ -603,9 +603,8 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol /* the title and, when 按应用走代理 is on, its mark (a button: it opens the dialog) */ .card-tline { display: flex; align-items: center; gap: 6px; min-width: 0; } .card-tline .card-title { min-width: 0; } -/* Card view: the name takes the rest of the title line, so the marks sit at its right end, where the status label is - (left of the label when it shows: the gap to it is the head's 8px). The head keeps the label's height (22px + the - label's 1px margin) whether or not the label is in the flow, so the card is the same height in every state. The list +/* Card view: the name takes the rest of the title line, so the marks sit at its right end. The status label is out of the + flow in every state; the head keeps a fixed height (23px), so the card is the same height in every state. The list view's title is a grid cell: its marks follow the name. */ .grid:not(.is-list) .card-head { gap: 8px; min-height: 23px; } .grid:not(.is-list) .card-tline .card-title { flex: 1; } @@ -622,9 +621,8 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol title and aria-label. Today: cat head = 按应用走代理, G = Google Play 商店, K = KernelSU, monitor with a slash = 无头 (headless), A = copy the ADB address. Always-there marks come first, marks that follow the run state come last, so one appearing never pushes the others. - In the card view they are at the right end of the title line. The card view does not write 运行中 or 已关机 (the - screen and the power button say it): the status label shows only for the states in between and the failed ones, and - for the other two it is for screen readers only (.pill-quiet). + In the card view they are at the right end of the title line. The card view shows no status label in any state (the + screen says it: the picture, 未开机, the progress, 开机失败 / 新建失败); the label is for screen readers only (.sr-only). The card view is the title and one config line: a new state is another single glyph or a hover text, not a word and not a line. The cat head is the only mark that is a button (it opens the proxy dialog) and the only one that can have a state colour (--tf from .tone-*; the icon only, never a background), and only when something is wrong (tone-warn, tone-err): while the diff --git a/internal/ui/web/js/cards.js b/internal/ui/web/js/cards.js index 922866bb..bc2cc1a0 100644 --- a/internal/ui/web/js/cards.js +++ b/internal/ui/web/js/cards.js @@ -135,8 +135,12 @@ function makeCard(i) { // no live region here: a boot reports every 2.5 s; the toast at the end says how it went // decoration only: the screen itself is the button (a nested button would open the viewer twice) c.peek = h('span', { class: 'peek', 'aria-hidden': 'true' }, icon('screen')); + // 开机失败 and 新建失败: to the task in 问题反馈, landed on the way a click on the glowing 问题反馈 lands on a failure + const showFailure = () => { if (c.failure) panels.openActivity(c.failure.job, c.failure.inst); }; const activateScreen = () => { if (!c.inst) return; + // 开机失败 and 新建失败: the screen is the way to 问题反馈 at that task (开机 and 重试初始化 are in 更多) + if (c.failure) return showFailure(); if (c.inst.status === 'online') return openViewer(i); const mode = c.primary.dataset.mode; if (mode === 'blocked') panels.openComponents(); @@ -163,17 +167,16 @@ function makeCard(i) { // - Order: marks that are always there come first; marks that come and go with the run state come last, so one // appearing never pushes the others. // - In the card view the marks sit at the right end of the title line (the name takes the rest of the width), where - // the status label is; when the label is shown the marks are right next to it, on its left. The list view keeps - // them after the name. - // - The card view does not write 运行中 or 已关机: the screen (or the 未开机 placeholder) already says it. - // The status label shows only for the states in between and the failed ones (开机中, 关机中, 新建中, - // 开机失败, 新建失败); for the other two it stays in the DOM for screen readers only (.pill-quiet). The list view - // always shows it (it has a status column). 诊断模式 is on the name's hover text in the card view. + // the status label is in the list view. The list view keeps them after the name. + // - The card view shows no status label in any state (ModAVD/ModAVD#463): the screen already says it (the live picture, + // the 未开机 placeholder, the boot or shutdown progress, 开机失败 / 新建失败). The label stays in the DOM for screen + // readers only (.sr-only in the card view); the list view always shows it (it has a status column). + // 诊断模式 is on the name's hover text in the card view. // - The card view is the title and one config line. A new state is another single glyph or a hover text, not a // word and not a line; the label showing or not never changes the card's height. // - There is no box under the card: nothing is added below the config line, so no state makes a card taller than - // another. The reason of a failure (开机失败, 新建失败) is the status label's hover text, and clicking the label - // opens 问题反馈 at that task; software rendering and a data disk that is nearly full are lines on the name's hover + // another. The reason of a failure (开机失败, 新建失败) is the screen's hover text, and clicking the screen + // (Enter, Space) opens 问题反馈 at that task (the list view's label does the same); software rendering and a data disk that is nearly full are lines on the name's hover // text, the first start's setup (about 1–2 minutes) is a line on the screen's hover text. // - The cat head (pmark) is a single glyph too: an icon-only button that opens the 按应用走代理 dialog. It is // the only mark that is clickable and the only one that can carry a state colour, and only when something is wrong: @@ -197,11 +200,9 @@ function makeCard(i) { c.cfg = h('span', { 'aria-hidden': 'true' }); c.cfgFull = h('span', { class: 'sr-only' }); c.pillText = h('span'); - // 开机失败 and 新建失败: the label is the way to the reason (its hover text) and to the task in 问题反馈 (click, Enter, - // Space), landed on the way a click on the glowing 问题反馈 lands on a failure - const showFailure = () => { if (c.failure) panels.openActivity(c.failure.job, c.failure.inst); }; - c.pill = h('span', { class: 'pill', onclick: showFailure, - onkeydown: (e) => { if (c.failure && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); showFailure(); } } }, c.pillText); + // the list view's label is the same way in (the card view's is for screen readers only, with no click) + c.pill = h('span', { class: 'pill', onclick: () => { if (getView() === 'list') showFailure(); }, + onkeydown: (e) => { if (getView() === 'list' && c.failure && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); showFailure(); } } }, c.pillText); const copyAdb = () => A.copy(c.inst.adb_address); c.adbTag = btn('adb-tag tone-idle', 'A', copyAdb); c.adb = h('span', { class: 'adb-addr' }); @@ -268,15 +269,18 @@ function updateCard(c, inst) { if (cp != null) pt = t('新建中 {pct}%', { pct: Math.floor(cp) }); if (v.key === 'error') pt = FAIL[v.failed.kind]; setText(c.pillText, pt); - // the card view leaves 运行中 and 已关机 out (screen and power button say it); the label stays for screen readers - // 开机失败 and 新建失败: the hover text is the reason and the advice, the label opens 问题反馈 at the task + // The card view shows no label (it is sr-only there, with its text for screen readers); the failure's reason is the + // screen's hover text and the screen opens 问题反馈 at the task. The list view's label keeps both. const failure = failureOf(inst, v); c.failure = failure; - attr(c.pill, 'class', 'pill tone-' + tone + (v.key === 'online' || v.key === 'offline' ? ' pill-quiet' : '') + (failure ? ' pill-link' : '')); - attr(c.pill, 'title', [failure && (failure.advice ? failure.text + '\n' + failure.advice : failure.text), diag].filter(Boolean).join('\n') || null); - attr(c.pill, 'role', failure ? 'button' : diag ? 'img' : null); - attr(c.pill, 'tabindex', failure ? '0' : null); - attr(c.pill, 'aria-label', diag || failure ? [pt, diag, failure && t('查看详情')].filter(Boolean).join(' · ') : null); + const listed = getView() === 'list'; + const failTip = failure && (failure.advice ? failure.text + '\n' + failure.advice : failure.text); + const linked = !!failure && listed; + attr(c.pill, 'class', 'pill tone-' + tone + (linked ? ' pill-link' : '')); + attr(c.pill, 'title', listed ? [failTip, diag].filter(Boolean).join('\n') || null : null); + attr(c.pill, 'role', linked ? 'button' : diag ? 'img' : null); + attr(c.pill, 'tabindex', linked ? '0' : null); + attr(c.pill, 'aria-label', diag || linked ? [pt, diag, linked && t('查看详情')].filter(Boolean).join(' · ') : null); const address = inst.adb_address || null; c.adbTag.hidden = c.adbList.hidden = !address; @@ -313,7 +317,7 @@ function updateCard(c, inst) { c.el.classList.toggle('is-busy', busy); c.screen.classList.toggle('has-shot', live && v.key !== 'stopping' && !!c.url); c.screen.classList.toggle('busy', busy); - setText(c.phText, v.key === 'error' ? t('上次开机没有成功') : v.key === 'createfail' ? t('新建时的初始化没做完') : live ? t('正在取画面…') : t('未开机')); + setText(c.phText, v.key === 'error' ? t('开机失败') : v.key === 'createfail' ? t('新建失败') : live ? t('正在取画面…') : t('未开机')); if (busy) { const p = v.job && v.job.progress; const msg = (p && stripInst(p.message)) || (store ? store[1] : v.key === 'stopping' ? t('正在关机…') : v.key === 'creating' ? t('正在新建:后台开机做初始化…') : v.kind === 'import-game' ? t('正在导入游戏…') : v.kind === 'install' ? t('正在安装 APK…') @@ -349,16 +353,17 @@ function updateCard(c, inst) { attr(b, 'aria-busy', mode[0] === 'busy'); attr(b, 'aria-disabled', mode[0] === 'busy' || mode[0] === 'blocked'); } - const screenInteractive = live || mode[0] === 'start' || mode[0] === 'blocked' || mode[0] === 'resume'; + const screenInteractive = live || !!failure || mode[0] === 'start' || mode[0] === 'blocked' || mode[0] === 'resume'; attr(c.screen, 'tabindex', screenInteractive ? '0' : null); attr(c.screen, 'aria-disabled', screenInteractive ? null : 'true'); - attr(c.screen, 'aria-label', live ? t('打开「{name}」的画面', { name }) : mode[0] === 'blocked' ? t('打开组件') : mode[0] === 'start' ? t('开机') : mode[0] === 'resume' ? t('重试初始化') : null); + // a failed boot or create: the screen opens 问题反馈 at the task (the status for screen readers goes with it) + attr(c.screen, 'aria-label', failure ? [pt, t('查看详情')].join(' · ') : live ? t('打开「{name}」的画面', { name }) : mode[0] === 'blocked' ? t('打开组件') : mode[0] === 'start' ? t('开机') : mode[0] === 'resume' ? t('重试初始化') : null); // the card view hides the power button: what its hover text says (why a start is not possible, the first start's setup) is the screen's - c.screen.title = mode[0] === 'start' || mode[0] === 'blocked' ? [mode[0] === 'blocked' && BLOCKED, first && FIRST_START].filter(Boolean).join('\n') || null : null; + c.screen.title = failure ? failTip : mode[0] === 'start' || mode[0] === 'blocked' ? [mode[0] === 'blocked' && BLOCKED, first && FIRST_START].filter(Boolean).join('\n') || null : null; if (live && v.key !== 'stopping' && !c.url) tick(); } -// What the 开机失败 / 新建失败 label says and opens: the reason and the advice (its hover text), and where 问题反馈 +// What the 开机失败 / 新建失败 screen says and opens: the reason and the advice (its hover text), and where 问题反馈 // lands in 最近任务和消息: job, the task's row; inst, for a 新建失败 with no 新建 / 重试初始化 task of this manager // behind it (created from the command line), the instance's own row on top of the list. Nothing else is shown on the // card about it. @@ -392,6 +397,8 @@ function menuItems(c) { v.key === 'starting' && { label: t('关机'), icon: 'power', run: () => A.stop(i) }, // the card view has no power button (the list view does): the screen starts, and shutting down is here view !== 'list' && v.key === 'online' && { label: t('关机'), icon: 'power', run: () => A.stop(i) }, + // the screen of a failed boot opens 问题反馈, so the retry is here + view !== 'list' && v.key === 'error' && { label: t('开机'), icon: 'power', run: () => (rootBlocked() ? panels.openComponents() : A.start(i)) }, view !== 'list' && v.key === 'createfail' && { label: t('重试初始化'), icon: 'refresh', run: () => A.resumeCreate(i) }, // create's setup: our own create job is cancelled, one of another process (CLI, AUTO-MAS) is ended by a normal // stop with explicit cancellation; either way it shuts down normally and reads create_failed (resumable) diff --git a/scripts/test_create_cancel.mjs b/scripts/test_create_cancel.mjs index e273dbe6..8806cb17 100644 --- a/scripts/test_create_cancel.mjs +++ b/scripts/test_create_cancel.mjs @@ -573,7 +573,7 @@ test('cards show diagnostics mode on the list line under the name, on the name\' h.patchCard(plain, inst); assert.equal(plain.title.title, '诊断模式'); assert.equal(plain.sub.textContent, '诊断模式'); - assert.equal(plain.pill.getAttribute('title'), '诊断模式'); + assert.ok(!plain.pill.getAttribute('title'), 'the card view label has no hover text'); assert.equal(plain.pill.getAttribute('aria-label'), `${plain.pillText.textContent} · 诊断模式`); h.patchCard(plain, { ...inst, diagnostics: undefined }); assert.equal(plain.title.title, ''); @@ -693,40 +693,51 @@ test('the proxy mark is a cat-head button without words; only a problem gives it assert.equal(c.pmark.hidden, true); }); -// The card view writes neither 运行中 nor 已关机 (the screen and the power button say it); the label stays in the DOM for -// screen readers (.pill-quiet is the sr-only styling, only in the card view), and every other state shows it. -test('the status label is only for screen readers while running or shut down', async () => { +// ModAVD/ModAVD#463: the card view shows no status label in any state (the screen says it); the label stays in the DOM +// for screen readers (the sr-only styling is in the stylesheet, only in the card view) and takes no click, focus or +// hover text there. The list view keeps it as it was. +test('the card view has no visible status label in any state; the list view keeps it', async () => { const h = await settingsHarness({ diagnostics: false }); const c = h.makeCard({ ...h.inst, status: 'online', running: true }); - const quiet = cls => cls.split(' ').includes('pill-quiet'); - assert.equal(c.pillText.textContent, '运行中'); - assert.ok(quiet(c.pill.className), c.pill.className); - h.patchCard(c, { ...h.inst, status: 'offline', running: false }); - assert.equal(c.pillText.textContent, '已关机'); - assert.ok(quiet(c.pill.className), c.pill.className); - // the states in between, the failed ones and a create in progress show it - const failed = { id: 'j9', index: 3, kind: 'start', state: 'failed', created_at: '2026-12-02T10:00:00Z', finished_at: '2026-12-02T10:00:02Z' }; - for (const [inst, text, jobs] of [ + const failed = { id: 'j9', index: 3, kind: 'start', state: 'failed', created_at: '2026-12-02T10:00:00Z', finished_at: '2026-12-02T10:00:02Z', + error: { message: '原因', advice: '建议' } }; + const states = [ + [{ ...h.inst, status: 'online', running: true }, '运行中', []], + [{ ...h.inst, status: 'offline', running: false }, '已关机', []], [{ ...h.inst, status: 'starting', running: true, busy: 'starting' }, '开机中', []], [{ ...h.inst, status: 'online', running: true, busy: 'stopping' }, '关机中', []], [{ ...h.inst, status: 'creating', running: true }, '新建中', []], [{ ...h.inst, status: 'create_failed', running: false }, '新建失败', []], [{ ...h.inst, status: 'offline', running: false }, '开机失败', [failed]], - ]) { + ]; + for (const [inst, text, jobs] of states) { h.state.jobs.clear(); for (const j of jobs) h.state.jobs.set(j.id, j); h.patchCard(c, inst); - assert.equal(c.pillText.textContent, text); - assert.ok(!quiet(c.pill.className), `${text}: ${c.pill.className}`); - assert.match(c.pill.className, /^pill tone-/); + assert.equal(c.pillText.textContent, text, 'the state name stays in the DOM for screen readers'); + assert.match(c.pill.className, /^pill tone-\w+$/, `${text}: nothing but the tone in the card view`); + assert.equal(c.pill.getAttribute('title'), null, text); + assert.equal(c.pill.getAttribute('role'), null, text); + assert.equal(c.pill.getAttribute('tabindex'), null, `${text}: the invisible label is not a tab stop`); + h.activity.length = 0; + c.pill.dispatch('click'); + for (const fn of c.pill.events.get('keydown') || []) fn({ key: 'Enter', preventDefault() {} }); + assert.deepEqual(h.activity, [], `${text}: the card view's label opens nothing`); } + // the list view still shows the label, and a failed one is the link it was + h.setView('list'); + h.patchCard(c, states.at(-1)[0]); + assert.match(c.pill.className, /\bpill-link\b/); + assert.equal(c.pill.getAttribute('tabindex'), '0'); + assert.equal(c.pill.getAttribute('title'), '开机失败:原因\n建议'); + c.pill.dispatch('click'); + assert.deepEqual(h.activity, [['j9', null]]); + h.setView('card'); h.state.jobs.clear(); - // back to running: quiet again, and the name for screen readers still has the state + // 诊断模式 stays in the status name for screen readers h.patchCard(c, { ...h.inst, status: 'online', running: true, diagnostics: true }); - assert.ok(quiet(c.pill.className)); assert.equal(c.pill.getAttribute('aria-label'), '运行中 · 诊断模式'); }); - // ModAVD/ModAVD#377: nothing is under the config line, in any state: no box for a failure, a first start, software // rendering or a nearly full disk, so no state makes a card taller. What the boxes said is in hover texts. const failedStart = { id: 'j9', index: 3, kind: 'start', state: 'failed', created_at: '2026-12-02T10:00:00Z', finished_at: '2026-12-02T10:00:02Z', @@ -772,63 +783,66 @@ test('software rendering and a nearly full disk are lines on the name hover text assert.equal(c.pill.getAttribute('aria-label'), null, 'the status name for screen readers does not carry them'); }); -test('a failed boot or create: the reason is the status label hover text, and the label opens 问题反馈 at the task', async () => { +test('a failed boot or create: the reason is the screen hover text, and the screen opens 问题反馈 at the task', async () => { const h = await settingsHarness({ diagnostics: false }); - const quiet = cls => cls.split(' ').includes('pill-quiet'); h.state.jobs.clear(); h.state.jobs.set(failedStart.id, failedStart); const c = h.makeCard({ ...h.inst, status: 'offline', running: false }); - assert.equal(c.pillText.textContent, '开机失败'); - assert.equal(c.pill.getAttribute('title'), '开机失败:电脑内存不足,模拟器分不到实例的内存\n请关闭部分程序、调小实例内存'); - assert.equal(c.pill.getAttribute('aria-label'), '开机失败 · 查看详情'); - assert.equal(c.pill.getAttribute('role'), 'button'); - assert.equal(c.pill.getAttribute('tabindex'), '0'); - assert.match(c.pill.className, /\bpill-link\b/); assert.equal(c.el.dataset.status, 'error'); - assert.equal(c.phText.textContent, '上次开机没有成功'); - // click, Enter and Space open 问题反馈 at the failed job; other keys do nothing - c.pill.dispatch('click'); - for (const key of ['Enter', ' ', 'a']) for (const fn of c.pill.events.get('keydown')) fn({ key, preventDefault() {} }); + assert.equal(c.phText.textContent, '开机失败', 'the screen says it'); + assert.equal(c.screen.title, '开机失败:电脑内存不足,模拟器分不到实例的内存\n请关闭部分程序、调小实例内存'); + assert.equal(c.screen.getAttribute('aria-label'), '开机失败 · 查看详情'); + assert.equal(c.screen.getAttribute('role'), 'button'); + assert.equal(c.screen.getAttribute('tabindex'), '0'); + assert.equal(c.screen.getAttribute('aria-disabled'), null); + // the label is not the way in any more (no title, no button role, no tab stop); screen readers still read its text + assert.equal(c.pillText.textContent, '开机失败'); + assert.equal(c.pill.getAttribute('title'), null); + assert.equal(c.pill.getAttribute('tabindex'), null); + // click, Enter and Space on the screen open 问题反馈 at the failed job (not a start); other keys do nothing + const started = h.started; + c.screen.dispatch('click'); + for (const key of ['Enter', ' ', 'a']) for (const fn of c.screen.events.get('keydown')) fn({ key, preventDefault() {} }); assert.deepEqual(h.activity, [['j9', null], ['j9', null], ['j9', null]]); - // with the diagnostics line the title and the name carry it too + if (started) assert.deepEqual(started, []); + // with the diagnostics line: it is on the name's hover text, not the screen's h.patchCard(c, { ...h.inst, status: 'offline', running: false, diagnostics: true }); - assert.equal(c.pill.getAttribute('title'), '开机失败:电脑内存不足,模拟器分不到实例的内存\n请关闭部分程序、调小实例内存\n诊断模式'); - assert.equal(c.pill.getAttribute('aria-label'), '开机失败 · 诊断模式 · 查看详情'); + assert.equal(c.title.title, '诊断模式'); + assert.equal(c.screen.title, '开机失败:电脑内存不足,模拟器分不到实例的内存\n请关闭部分程序、调小实例内存'); // nothing on the card closes it: it stays through updates, until a newer job (the next boot) starts h.patchCard(c, { ...h.inst, status: 'offline', running: false }); - assert.equal(c.pillText.textContent, '开机失败'); + assert.equal(c.phText.textContent, '开机失败'); assert.equal(h.state.dismissed, undefined, 'there is no way to dismiss it any more'); h.state.jobs.set('j10', { id: 'j10', index: 3, kind: 'start', state: 'running', created_at: '2026-12-02T10:05:00Z' }); h.patchCard(c, { ...h.inst, status: 'starting', running: true, busy: 'starting' }); assert.equal(c.pillText.textContent, '开机中'); - assert.equal(c.pill.getAttribute('title'), null); - assert.equal(c.pill.getAttribute('role'), null); - assert.equal(c.pill.getAttribute('tabindex'), null); - assert.doesNotMatch(c.pill.className, /pill-link/); + assert.equal(c.screen.title, null); + assert.equal(c.screen.getAttribute('aria-label'), null); h.activity.length = 0; - c.pill.dispatch('click'); - assert.deepEqual(h.activity, [], 'a label that is not a failure opens nothing'); - // a failed job of another kind is not a card state: the label stays quiet and opens nothing + c.screen.dispatch('click'); + assert.deepEqual(h.activity, [], 'a screen that is not a failure opens no 问题反馈'); + // a failed job of another kind is not a card state: the screen is the plain 开机 one and opens nothing h.state.jobs.clear(); h.state.jobs.set('j11', { ...failedStart, id: 'j11', kind: 'install' }); h.patchCard(c, { ...h.inst, status: 'offline', running: false }); assert.equal(c.pillText.textContent, '已关机'); - assert.ok(quiet(c.pill.className)); - c.pill.dispatch('click'); + assert.equal(c.screen.getAttribute('aria-label'), '开机'); + c.screen.dispatch('click'); assert.deepEqual(h.activity, []); - // 新建失败: the reason and the advice (with the log) on hover; its create job when there is one, else the instance's own row + // 新建失败: the reason and the advice (with the log) on the screen's hover; its create job when there is one, else the instance's own row h.state.jobs.clear(); const created = { ...h.inst, status: 'create_failed', running: false, initialized: false, creation_error: '后台开机做初始化时模拟器退出了', creation_log: 'logs\\mas_3.log' }; const cf = h.makeCard(created); assert.equal(cf.pillText.textContent, '新建失败'); - assert.equal(cf.pill.getAttribute('title'), '新建失败:后台开机做初始化时模拟器退出了\n点「重试初始化」再做一次,或在「更多」里删除这台实例;日志 logs\\mas_3.log'); - assert.equal(cf.pill.getAttribute('aria-label'), '新建失败 · 查看详情'); - cf.pill.dispatch('click'); + assert.equal(cf.phText.textContent, '新建失败'); + assert.equal(cf.screen.title, '新建失败:后台开机做初始化时模拟器退出了\n点「重试初始化」再做一次,或在「更多」里删除这台实例;日志 logs\\mas_3.log'); + assert.equal(cf.screen.getAttribute('aria-label'), '新建失败 · 查看详情'); + cf.screen.dispatch('click'); assert.deepEqual(h.activity, [[null, 3]]); h.state.jobs.set('j12', { ...failedStart, id: 'j12', kind: 'create' }); h.patchCard(cf, created); - cf.pill.dispatch('click'); + cf.screen.dispatch('click'); assert.deepEqual(h.activity, [[null, 3], ['j12', null]]); // the newest 新建 / 重试初始化 task, failed or canceled, is the row (问题反馈 lists the instance as that task); a newer // task of another kind does not take its place @@ -836,17 +850,16 @@ test('a failed boot or create: the reason is the status label hover text, and th h.state.jobs.set('j14', { ...failedStart, id: 'j14', kind: 'disk-compact', state: 'done', created_at: '2026-12-02T10:02:00Z' }); h.patchCard(cf, created); h.activity.length = 0; - cf.pill.dispatch('click'); + cf.screen.dispatch('click'); assert.deepEqual(h.activity, [['j13', null]]); h.patchCard(cf, { ...created, creation_error: '', creation_log: '' }); - assert.equal(cf.pill.getAttribute('title'), '新建失败:初始化没做完\n点「重试初始化」再做一次,或在「更多」里删除这台实例'); + assert.equal(cf.screen.title, '新建失败:初始化没做完\n点「重试初始化」再做一次,或在「更多」里删除这台实例'); // no 调小内存 link (it is on the task in 问题反馈), no dismiss button, no 详情 link: the visible text buttons are the retry and 画面 controls (not the A mark) const buttons = descendants(cf.el).filter(x => x.tagName === 'BUTTON' && x !== cf.adbTag).map(x => x.textContent.trim()).filter(Boolean); assert.deepEqual(buttons, ['重试初始化', '画面']); assert.doesNotMatch(cf.el.textContent, /调小内存|不再显示|详情/); h.state.jobs.clear(); }); - test('the first start of a new instance is a line on the 开机 button hover text', async () => { const h = await settingsHarness({ diagnostics: false, running: false }); const line = '首次开机会做初始化,约 1⁠–⁠2 分钟'; @@ -868,17 +881,18 @@ test('the first start of a new instance is a line on the 开机 button hover tex // The styling the tests above rely on, read from the stylesheet: quiet is the sr-only way (not display: none, which // would take it from screen readers) and only in the card view; the card head keeps the label's height; the proxy mark // is plain unless it carries tone-warn or tone-err; the name takes the width so the marks are at the right end. -test('the stylesheet hides the quiet status label for the card view only and keeps the card height', async () => { +test('the stylesheet hides the status label in the card view only and keeps the card height', async () => { const css = await readFile(new URL('../internal/ui/web/app.css', import.meta.url), 'utf8'); const rule = sel => { const i = css.indexOf(sel + ' {'); assert.ok(i >= 0, sel); return css.slice(i, css.indexOf('}', i)); }; - const srOnly = rule('.sr-only, .grid:not(.is-list) .pill-quiet'); + const srOnly = rule('.sr-only, .grid:not(.is-list) .pill'); assert.match(srOnly, /position: absolute; width: 1px; height: 1px/); assert.match(srOnly, /clip: rect\(0 0 0 0\)/); - assert.doesNotMatch(css, /pill-quiet[^{]*\{[^}]*display: none/); + assert.doesNotMatch(css, /\.grid:not\(\.is-list\) \.pill[^{]*\{[^}]*display: none/); + assert.doesNotMatch(css, /pill-quiet/); assert.match(rule('.grid:not(.is-list) .card-head'), /min-height: 23px/); assert.match(rule('.grid:not(.is-list) .card-tline .card-title'), /flex: 1/); assert.doesNotMatch(rule('.pmark, .smark, .kmark, .hmark'), /var\(--(tb|sunken)\)/, 'no background colour behind a mark'); @@ -932,14 +946,16 @@ test('card screen: one button, decoration inside, and every hidden power action assert.equal((c.peek.events.get('click') || []).length, 0); c.screen.dispatch('click'); assert.deepEqual(opened, [3], 'one click, one viewer'); - // a failed create: the screen retries the setup + // a failed create: the screen opens 问题反馈 (ModAVD/ModAVD#463); the retry is in 更多 const f = h.makeCard({ ...h.inst, status: 'create_failed', running: false, initialized: false }); assert.equal(f.primary.dataset.mode, 'resume'); assert.equal(f.screen.getAttribute('tabindex'), '0'); - assert.equal(f.screen.getAttribute('aria-label'), '重试初始化'); + assert.equal(f.screen.getAttribute('aria-label'), '新建失败 · 查看详情'); f.screen.dispatch('click'); - assert.deepEqual(resumed, [3]); + assert.deepEqual(resumed, []); + assert.deepEqual(h.activity, [[null, 3]]); assert.deepEqual(started, []); + h.activity.length = 0; // a stopped one starts, with the first start's line as the screen's hover text const s = h.makeCard({ ...h.inst, status: 'offline', running: false, initialized: false }); assert.equal(s.screen.title, '首次开机会做初始化,约 1⁠–⁠2 分钟'); @@ -949,14 +965,22 @@ test('card screen: one button, decoration inside, and every hidden power action assert.equal(s.screen.title, null); h.patchCard(s, { ...h.inst, status: 'online', running: true, initialized: false }); assert.equal(s.screen.title, null); - // the menu: 关机 for a running instance and 重试初始化 for a failed create in the card view, neither in the list view + // the menu: 关机 for a running instance, 重试初始化 for a failed create and 开机 for a failed boot in the card view, none in the list view const labels = inst => h.cards.menuItems({ i: 3, inst }).filter(Boolean).map(x => x.label); const on = { index: 3, status: 'online', running: true }, bad = { index: 3, status: 'create_failed', running: false }; assert.ok(labels(on).includes('关机')); assert.ok(labels(bad).includes('重试初始化')); + h.state.jobs.set(failedStart.id, failedStart); + const failedBoot = { index: 3, status: 'offline', running: false }; + assert.ok(labels(failedBoot).includes('开机'), 'a failed boot is retried from 更多'); + h.state.jobs.clear(); + assert.ok(!labels(failedBoot).includes('开机'), 'a plain shut down instance starts from the screen'); + h.state.jobs.set(failedStart.id, failedStart); h.setView('list'); assert.ok(!labels(on).includes('关机'), 'the list view has the power button'); assert.ok(!labels(bad).includes('重试初始化')); + assert.ok(!labels(failedBoot).includes('开机')); + h.state.jobs.clear(); h.setView('card'); assert.ok(labels(on).includes('关机')); });