gui: a field's long explanation shows on asking, in the editor and Routing groups (yujezhang on X)
yujezhang on X (11-10): "现在界面好多描述都太繁琐了 ... 界面只保留完成
操作必需的信息". The longest always-visible lines left were in a
provider's editor (100 to 666 characters a field) and Routing groups'
settings (69 to 318). They now work like Settings' rows since 11-02:
with a mouse, the explanation rests out of sight and the row's hover
(450ms) or keyboard focus shows it in the shared .set-hint card. A touch
screen keeps every line. No layout moves, no new page, no info icon
(the owner chose hover on the row for Settings).
Removed or moved:
- Routing's empty caption ("Every request an agent sends to magpie
shows up here, routed for real.") is gone from the empty state: the
mode line above it says the same. The key stays, the panel uses it.
- A provider editor field's explanation (.fld > .hint.expl): Headers,
Certificate, Compaction, the routing and rate-limit fields and the
rest: in the card. A line with a link or control in it, a warning and
an error stay in sight.
- Two fields keep one short line in sight for what turning them on
costs: Certificate ("Turn it on only on a network you trust.") and
Compaction ("A conversation compacted this way continues only on
this provider and account."). New keys in zh, zh-TW, ja and de.
- The editor's own settings rows (.prov-prefs: warm-up, check-in,
resets) hide their lines as Settings' do; a result line (.say) stays.
- Routing groups: Found, Names and the three defaults' small lines: in
the card. The no-names line stays.
- settingshints.js listens on document, so the editor (in #modal) and
Routing get the card; the card grows from its row in 150ms, strong
ease-out, a fade alone under reduced motion.
A line held out of sight is position: absolute in its field's box
(.fld and .hint-row > .txt are position: relative): placed against the
page, deep in the editor's scroll, it grew the page a scrollbar and
made the editor 10px narrower, and account-weight's de 390 in WebKit
ran an account line 3px past its row. Its sr-only -1px margin is
dropped, so it no longer sits 1px left of its row (warm-at-times,
warm-now and checkin-now-account check every .sub is inside its row).
Tests:
- New editor-hints.test.cjs (chromium + webkit, en/zh/zh-TW/ja/de,
1100 and 420): at rest the explanation is out of sight and still
described; Certificate's lead is in sight on one line; a hover shows
the card with the text, inside the window, not over the name, nothing
moving, taking no pointer; leaving hides it; Tab onto a field shows
it; every out-of-sight line is placed in its own field; Routing
groups' lines the same. 42/42 with account-weight on the Linux box.
- Broken by hand: the hide rule replaced and ROWS without the editor
and groups: 0/20 red. The position: relative rule removed: 20/20 red
(the placement check), then restored.
- vertex-editor: a hint resting out of sight isn't "cut".
group-found-off: rows carry hint-row.
- 271 GUI files (every editor/edit= test, hints, visibility, prov-prefs,
rt-gset/rt-cap, i18n-keys, old-webkit) in both engines on the WSL box
(magpie-desktop), mine against a copy of 5d9e29814: 5589 pass / 241
fail mine, 5528 / 262 base. Every file red in mine is red on base too
except group-morph, provider-image-files and restart-app (one subtest
each at concurrency 8); alone those three pass 114/114.
- settings-hints ja/de 420 and settings-lines-wrap de 440 fail the same
on base (#5872).
Not tried: the whole 1343-file GUI suite (mote's suite.lock queue was
hours long); a touch screen; the real Linux app (WebKitGTK); macOS
Playwright.
This commit is contained in:
@@ -3972,22 +3972,40 @@ input.words.compact-num { flex: none; width: 76px; font-variant-numeric: tabular
|
||||
sends, who the allow list lets in), a line with a button or link in
|
||||
it. A touch screen, with no hover, keeps them all. */
|
||||
@media (hover: hover) {
|
||||
#view-settings:not(.set-searching) .row.pref > .who > .sub:not(.err, .bad, .say, .proxy-check, .lib-way, .image-gen-hidden, .sync-sign-in, .no-names, .pv-hits, .feat-why, .vision-not-marked, .video-gen-how, .font-note, .acts, [role="status"], #proxySub):not(#otelSessionsRow *, #allowList *, .disabled-model *) {
|
||||
--hint: 1; position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
|
||||
:is(#view-settings:not(.set-searching), .editor.roomy .prov-prefs) .row.pref > .who > .sub:not(.err, .bad, .say, .proxy-check, .lib-way, .image-gen-hidden, .sync-sign-in, .no-names, .pv-hits, .feat-why, .vision-not-marked, .video-gen-how, .font-note, .acts, [role="status"], #proxySub):not(#otelSessionsRow *, #allowList *, .disabled-model *) {
|
||||
--hint: 1; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
|
||||
}
|
||||
/* a row left with its name alone is as tall as any other: its control
|
||||
(a switch, a field, a shortcut) no longer sets it apart */
|
||||
#view-settings .row.pref:not(.feat-set) { box-sizing: content-box; min-height: 27px; } /* 51 with its padding, a line above it outside */
|
||||
/* the same in a provider's editor, field by field (yujezhang on X,
|
||||
11-10: "界面只保留完成操作必需的信息"), and on Routing groups'
|
||||
settings: the line that explains a field rests out of sight. A
|
||||
field's lead, the short line of what turning it on costs, stays in
|
||||
its place; so do a warning and a line with a link or control in it */
|
||||
.editor.roomy .fld > .hint.expl:not(.acts, .warn, .err),
|
||||
.hint-row > .txt > .expl {
|
||||
--hint: 1; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
|
||||
}
|
||||
.editor.roomy .fld > .hint.lead { display: block; }
|
||||
/* the line held out of sight stays in its field's box: placed against
|
||||
the page, deep in the editor's scroll it would grow the page a scrollbar */
|
||||
.editor.roomy .fld, .hint-row > .txt { position: relative; }
|
||||
/* Check in now's result comes under its name and the row grows down,
|
||||
its button held where it was pressed */
|
||||
:is(#view-settings, .prov-prefs) .ci-now-row { align-items: flex-start; }
|
||||
}
|
||||
.set-hint { position: fixed; z-index: 60; max-width: min(380px, calc(100vw - 32px)); padding: 8px 11px; border-radius: 9px; background: var(--pop-bg); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); font-size: 12px; line-height: 1.45; color: var(--fg-2); overflow-wrap: anywhere; pointer-events: none; opacity: 0; transform: translateY(-2px); transition: opacity .14s ease, transform .14s ease; }
|
||||
/* a field's lead says again, in short, what its hint says: in sight only
|
||||
where the hint isn't (above, with a mouse) */
|
||||
.fld > .hint.lead { display: none; }
|
||||
/* the card comes from its row, a little smaller, on the strong ease-out
|
||||
(UI motion rules: a tooltip 125-200ms, never from nothing) */
|
||||
.set-hint { position: fixed; z-index: 60; max-width: min(380px, calc(100vw - 32px)); padding: 8px 11px; border-radius: 9px; background: var(--pop-bg); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); font-size: 12px; line-height: 1.45; color: var(--fg-2); overflow-wrap: anywhere; pointer-events: none; opacity: 0; transform: translateY(-2px) scale(.96); transition: opacity .15s ease, transform .15s cubic-bezier(.23, 1, .32, 1); }
|
||||
.set-hint.on { opacity: 1; transform: none; }
|
||||
.set-hint > p { margin: 0; }
|
||||
.set-hint > p + p { margin-top: 4px; }
|
||||
@media (prefers-reduced-motion: reduce) { .set-hint { transition: none; transform: none; } }
|
||||
:root[data-motion="reduce"] .set-hint { transition: none; transform: none; }
|
||||
@media (prefers-reduced-motion: reduce) { .set-hint { transition: opacity .15s ease; transform: none; } }
|
||||
:root[data-motion="reduce"] .set-hint { transition: opacity .15s ease; transform: none; }
|
||||
.prefs .val.rule-add { flex: 1 1 100%; max-width: none; margin-left: 0; gap: 6px; }
|
||||
input.words.rule-kind { flex: none; width: 110px; }
|
||||
input.words.gateway-port { flex: none; width: 110px; font-variant-numeric: tabular-nums; }input.words.rule-match { flex: 1 1 auto; width: auto; min-width: 0; }
|
||||
|
||||
+22
-13
@@ -7590,9 +7590,14 @@ function partnerTile(pr) {
|
||||
}
|
||||
|
||||
let fieldIDs = 0;
|
||||
function field(label, control, hint) {
|
||||
// A hint explains the field: where a pointer can rest (a mouse), app.css
|
||||
// keeps it out of sight and settingshints.js shows it in a card on
|
||||
// resting over the field, or on a key reaching it, as Settings does
|
||||
// (yujezhang on X, 11-10: "界面只保留完成操作必需的信息"). lead is the
|
||||
// one short line that stays in sight there: what turning it on costs.
|
||||
function field(label, control, hint, lead) {
|
||||
const l = el("label", control.classList?.contains("accts") ? "by-list" : "", label); // on a list's first row
|
||||
const wrap = el("div");
|
||||
const wrap = el("div", hint ? "fld" : "");
|
||||
wrap.append(control);
|
||||
const inputSelector = "input, select, textarea";
|
||||
const inputs = control.matches(inputSelector) ? [control] : [...control.querySelectorAll(inputSelector)];
|
||||
@@ -7604,9 +7609,13 @@ function field(label, control, hint) {
|
||||
l.htmlFor = inputs[0].id;
|
||||
}
|
||||
if (hint) {
|
||||
const help = el("div", "hint", hint);
|
||||
help.id = "field-help-" + ++fieldIDs;
|
||||
wrap.append(help);
|
||||
const lines = [lead && el("div", "hint lead", lead), el("div", "hint expl", hint)].filter(Boolean);
|
||||
for (const help of lines) {
|
||||
help.id = "field-help-" + ++fieldIDs;
|
||||
wrap.append(help);
|
||||
}
|
||||
// a screen reader reads the hint, not the lead it repeats
|
||||
const help = lines[lines.length - 1];
|
||||
for (const input of inputs) input.setAttribute("aria-describedby", [input.getAttribute("aria-describedby"), help.id].filter(Boolean).join(" "));
|
||||
}
|
||||
return [l, wrap];
|
||||
@@ -9888,7 +9897,7 @@ function drawEditor(p, presetID) {
|
||||
const [ctk, ccb] = tick(t("Don't check its certificate"), !!draft.insecureTLS);
|
||||
ctk.classList.add("insecure-tls");
|
||||
ccb.onchange = () => { draft.insecureTLS = ccb.checked; };
|
||||
const row = field(t("Certificate"), ctk, t("For your own server with a self-signed certificate or one from your company's CA. magpie then can't tell it from another machine answering at its address: turn it on only on a network you trust."));
|
||||
const row = field(t("Certificate"), ctk, t("For your own server with a self-signed certificate or one from your company's CA. magpie then can't tell it from another machine answering at its address: turn it on only on a network you trust."), t("Turn it on only on a network you trust."));
|
||||
const [htk, hcb] = tick(t("HTTP/1.1 only"), !!draft.http1);
|
||||
hcb.onchange = () => { draft.http1 = hcb.checked; };
|
||||
const hrow = field(t("HTTP version"), htk);
|
||||
@@ -10472,7 +10481,7 @@ function nativeCompactionField(show) {
|
||||
const [ntk, ncb] = tick(t("Codex compacts on this provider"), !!draft.nativeCompaction);
|
||||
ntk.classList.add("native-compaction");
|
||||
ncb.onchange = () => { draft.nativeCompaction = ncb.checked; };
|
||||
const row = field(t("Compaction"), ntk, t("Codex's compaction is asked of this provider as Codex sent it, and the summary it seals goes back to Codex unchanged. Off, magpie writes the summary. A conversation compacted this way continues only on this provider and account: another is refused with an error, never sent without the context."));
|
||||
const row = field(t("Compaction"), ntk, t("Codex's compaction is asked of this provider as Codex sent it, and the summary it seals goes back to Codex unchanged. Off, magpie writes the summary. A conversation compacted this way continues only on this provider and account: another is refused with an error, never sent without the context."), t("A conversation compacted this way continues only on this provider and account."));
|
||||
const refresh = () => { for (const e of row) e.style.display = show() ? "" : "none"; };
|
||||
refresh();
|
||||
return [row, refresh];
|
||||
@@ -12275,7 +12284,7 @@ function renderRouting(p) {
|
||||
u.title = t("Made when the provider is saved; Cancel drops it");
|
||||
return u;
|
||||
};
|
||||
const rHint = el("div", "hint"), rUnsaved = unsaved();
|
||||
const rHint = el("div", "hint expl"), rUnsaved = unsaved();
|
||||
const drawRouting = () => {
|
||||
const cur = routingsOf(p).find(([id]) => id === routingNow()) || ROUTINGS[0];
|
||||
rHint.textContent = (ROUTINGS.includes(cur) ? t(cur[2]) : cur[2]) + own(cur[0]);
|
||||
@@ -12288,9 +12297,9 @@ function renderRouting(p) {
|
||||
const rPick = routingSegs(routingsOf(p).map(([id, name, , js]) => [id, ROUTINGS.some((r) => r[0] === id) ? t(name) : name, , js]), routingNow(), (routing) => { draft.routing = routing; drawRouting(); });
|
||||
const rRow = el("div", "route-pick");
|
||||
rRow.append(rPick, rUnsaved);
|
||||
const rWrap = el("div");
|
||||
const rWrap = el("div", "fld");
|
||||
rWrap.append(rRow, rHint);
|
||||
const kHint = el("div", "hint"), kUnsaved = unsaved();
|
||||
const kHint = el("div", "hint expl"), kUnsaved = unsaved();
|
||||
const drawSink = () => {
|
||||
kHint.textContent = t(SINKS[sinkNow() ? 1 : 0][2]);
|
||||
kUnsaved.hidden = sinkNow() === !!p.sink;
|
||||
@@ -12299,9 +12308,9 @@ function renderRouting(p) {
|
||||
kPick.classList.add("sink-pick");
|
||||
const kRow = el("div", "route-pick");
|
||||
kRow.append(kPick, kUnsaved);
|
||||
const kWrap = el("div", "sink-wrap"), kLabel = el("label", "", t("Rate limited"));
|
||||
const kWrap = el("div", "sink-wrap fld"), kLabel = el("label", "", t("Rate limited"));
|
||||
kWrap.append(kRow, kHint);
|
||||
const sHint = el("div", "hint"), sUnsaved = unsaved();
|
||||
const sHint = el("div", "hint expl"), sUnsaved = unsaved();
|
||||
const drawStays = () => {
|
||||
const cur = STAYS.find(([id]) => id === affinityNow()) || STAYS[0];
|
||||
sHint.textContent = t(cur[2]);
|
||||
@@ -12310,7 +12319,7 @@ function renderRouting(p) {
|
||||
const sPick = segs(STAYS.map(([id, name]) => [id, t(name)]), affinityNow(), (affinity) => { draft.affinity = affinity; drawStays(); });
|
||||
const sRow = el("div", "route-pick");
|
||||
sRow.append(sPick, sUnsaved);
|
||||
const sWrap = el("div");
|
||||
const sWrap = el("div", "fld");
|
||||
sWrap.append(sRow, sHint);
|
||||
drawRouting();
|
||||
drawSink();
|
||||
|
||||
@@ -4283,6 +4283,8 @@ const I18N = {
|
||||
"HTTP version": "HTTP 版本",
|
||||
"Codex compacts on this provider": "Codex 在此服务商上原生压缩",
|
||||
"Codex's compaction is asked of this provider as Codex sent it, and the summary it seals goes back to Codex unchanged. Off, magpie writes the summary. A conversation compacted this way continues only on this provider and account: another is refused with an error, never sent without the context.": "Codex 的压缩请求原样交给此服务商,它加密的摘要原样还给 Codex。关闭时由 magpie 写摘要。这样压缩过的对话只能在此服务商和账号上继续:换到别处会报错说明,绝不丢掉上下文发出。",
|
||||
"Turn it on only on a network you trust.": "只在你信任的网络中开启。",
|
||||
"A conversation compacted this way continues only on this provider and account.": "这样压缩过的对话只能在此服务商和账号上继续。",
|
||||
"For a model running on this computer or your local network: secrets, personal data and your masked words go to it as written. Leave it off for a local relay or proxy that passes requests on to a vendor.": "给运行在这台电脑或局域网里的模型:密钥、个人信息和你设的脱敏词按原样发给它。如果它是本地的中转或代理、会把请求转给供应商,请保持关闭。",
|
||||
"{host} isn't on this computer or your local network: turned on, requests go to it unmasked.": "{host} 不在这台电脑或局域网里:打开后,请求会不脱敏地发给它。",
|
||||
"User-Agent": "User-Agent",
|
||||
@@ -9148,6 +9150,8 @@ const I18N = {
|
||||
"HTTP version": "HTTP 版本",
|
||||
"Codex compacts on this provider": "Codex 在此服務商上原生壓縮",
|
||||
"Codex's compaction is asked of this provider as Codex sent it, and the summary it seals goes back to Codex unchanged. Off, magpie writes the summary. A conversation compacted this way continues only on this provider and account: another is refused with an error, never sent without the context.": "Codex 的壓縮請求原樣交給此服務商,它加密的摘要原樣還給 Codex。關閉時由 magpie 寫摘要。這樣壓縮過的對話只能在此服務商和帳號上繼續:換到別處會報錯說明,絕不丟掉上下文送出。",
|
||||
"Turn it on only on a network you trust.": "只在你信任的網路中開啟。",
|
||||
"A conversation compacted this way continues only on this provider and account.": "這樣壓縮過的對話只能在此服務商和帳號上繼續。",
|
||||
"For a model running on this computer or your local network: secrets, personal data and your masked words go to it as written. Leave it off for a local relay or proxy that passes requests on to a vendor.": "給執行在這臺電腦或區域網裡的模型:金鑰、個人資訊和你設的脫敏詞按原樣發給它。如果它是本地的中轉或代理、會把請求轉給供應商,請保持關閉。",
|
||||
"{host} isn't on this computer or your local network: turned on, requests go to it unmasked.": "{host} 不在這臺電腦或區域網裡:開啟後,請求會不脫敏地發給它。",
|
||||
"User-Agent": "User-Agent",
|
||||
@@ -14029,6 +14033,8 @@ const I18N = {
|
||||
"HTTP version": "HTTP バージョン",
|
||||
"Codex compacts on this provider": "Codex のコンパクションをこのプロバイダーで行う",
|
||||
"Codex's compaction is asked of this provider as Codex sent it, and the summary it seals goes back to Codex unchanged. Off, magpie writes the summary. A conversation compacted this way continues only on this provider and account: another is refused with an error, never sent without the context.": "Codex のコンパクション要求をそのままこのプロバイダーに送り、暗号化された要約をそのまま Codex に返します。オフのときは magpie が要約を書きます。こうしてコンパクションした会話は、このプロバイダーとアカウントでのみ続けられます。他へはエラーで断り、コンテキストを落として送ることはしません。",
|
||||
"Turn it on only on a network you trust.": "信頼できるネットワークでのみオンにしてください。",
|
||||
"A conversation compacted this way continues only on this provider and account.": "こうしてコンパクションした会話は、このプロバイダーとアカウントでのみ続けられます。",
|
||||
"For a model running on this computer or your local network: secrets, personal data and your masked words go to it as written. Leave it off for a local relay or proxy that passes requests on to a vendor.": "このコンピューターかローカルネットワークで動くモデル用:シークレット、個人情報、マスクする語はそのまま送られます。リクエストをベンダーに転送するローカルのリレーやプロキシではオフのままにしてください。",
|
||||
"{host} isn't on this computer or your local network: turned on, requests go to it unmasked.": "{host} はこのコンピューターにもローカルネットワークにもありません:オンにすると、リクエストはマスクされずに送られます。",
|
||||
"User-Agent": "User-Agent",
|
||||
@@ -18925,6 +18931,8 @@ const I18N = {
|
||||
"HTTP version": "HTTP-Version",
|
||||
"Codex compacts on this provider": "Codex kompaktiert bei diesem Anbieter",
|
||||
"Codex's compaction is asked of this provider as Codex sent it, and the summary it seals goes back to Codex unchanged. Off, magpie writes the summary. A conversation compacted this way continues only on this provider and account: another is refused with an error, never sent without the context.": "Codex’ Kompaktierung geht so an diesen Anbieter, wie Codex sie sendet, und die versiegelte Zusammenfassung kommt unverändert zu Codex zurück. Aus: magpie schreibt die Zusammenfassung. Ein so kompaktiertes Gespräch geht nur bei diesem Anbieter und Konto weiter: ein anderer wird mit einem Fehler abgelehnt, nie ohne den Kontext angefragt.",
|
||||
"Turn it on only on a network you trust.": "Nur in einem Netzwerk einschalten, dem Sie vertrauen.",
|
||||
"A conversation compacted this way continues only on this provider and account.": "Ein so kompaktiertes Gespräch geht nur bei diesem Anbieter und Konto weiter.",
|
||||
"For a model running on this computer or your local network: secrets, personal data and your masked words go to it as written. Leave it off for a local relay or proxy that passes requests on to a vendor.": "Für ein Modell auf diesem Computer oder in Ihrem lokalen Netzwerk: Geheimnisse, persönliche Daten und Ihre maskierten Wörter gehen unverändert an es. Lassen Sie es aus für ein lokales Relay oder einen Proxy, der Anfragen an einen Anbieter weiterreicht.",
|
||||
"{host} isn't on this computer or your local network: turned on, requests go to it unmasked.": "{host} ist weder auf diesem Computer noch in Ihrem lokalen Netzwerk: Eingeschaltet gehen Anfragen unmaskiert an ihn.",
|
||||
"User-Agent": "User-Agent",
|
||||
|
||||
@@ -5628,7 +5628,10 @@ function routingPage(part) {
|
||||
hubText();
|
||||
win = null; laid = []; gapOf = new Map();
|
||||
list.replaceChildren(el("li", "idle", t(purpose.length || day ? "No requests match these filters." : "No request yet")));
|
||||
say(t("Every request an agent sends to magpie shows up here, routed for real."));
|
||||
// the mode line above already says what plays here; a caption saying
|
||||
// it again was one more line to read (yujezhang on X, 11-10)
|
||||
capQ = [];
|
||||
cap.textContent = "";
|
||||
log.hidden = true;
|
||||
renderHist(); // none live, but the days the history keeps are still there to look at
|
||||
layout();
|
||||
@@ -5830,15 +5833,17 @@ function routingPage(part) {
|
||||
});
|
||||
// whether magpie finds groups on its own, by the list it fills (蓝猫 on
|
||||
// Discord: they could only be removed one at a time)
|
||||
const gFound = el("div", "rt-gfound");
|
||||
const gFound = el("div", "rt-gfound hint-row");
|
||||
// how the agents' lists name every group, one setting for them all (and
|
||||
// for the providers' models), so it sits over the groups rather than in
|
||||
// one group's editor (PAMI on Discord)
|
||||
const gNames = el("div", "rt-gnames");
|
||||
const gNames = el("div", "rt-gnames hint-row");
|
||||
// what every group does that sets none of its own when one is rate
|
||||
// limited, slow to start, or every member is busy (jiezhengj on Discord:
|
||||
// set once rather than in each group); a group's editor sets its own
|
||||
const gDefs = [el("div", "rt-gdef rt-gdef-sink"), el("div", "rt-gdef rt-gdef-first"), el("div", "rt-gdef rt-gdef-patience")];
|
||||
// (each a .hint-row: its line that explains it rests out of sight, shown
|
||||
// in the hover card, settingshints.js)
|
||||
const gDefs = [el("div", "rt-gdef rt-gdef-sink hint-row"), el("div", "rt-gdef rt-gdef-first hint-row"), el("div", "rt-gdef rt-gdef-patience hint-row")];
|
||||
// the groups go with the routing groups built-in plugin; the pools stay
|
||||
for (const n of [gHead, gFound, gNames, ...gDefs, gList]) n.dataset.feature = "groups";
|
||||
// and off (the Essentials preset leaves it off), where they were
|
||||
@@ -6771,7 +6776,7 @@ function routingPage(part) {
|
||||
s.append(el("i"));
|
||||
s.onclick = (e) => { e.stopPropagation(); setFound(!on, s); };
|
||||
const txt = el("div", "txt");
|
||||
txt.append(el("b", "", t("Find groups on their own")), el("small", "", on
|
||||
txt.append(el("b", "", t("Find groups on their own")), el("small", "expl", on
|
||||
? t("A model two or more of your providers serve becomes a group of them (auto/…). Switch it off to list and serve only the groups you made or changed.")
|
||||
: t("Off: only the groups you made or changed are listed and served. An agent set to a found group is moved to its model from one provider, and a request still naming one goes there too.")));
|
||||
if (on) txt.append(skipPick());
|
||||
@@ -6813,7 +6818,7 @@ function routingPage(part) {
|
||||
}
|
||||
function drawNames() {
|
||||
const txt = el("div", "txt");
|
||||
txt.append(el("b", "", t("Names in agents’ lists")), el("small", "", t("Whether “· routing group” follows a group’s name in the agents’ lists: one setting for every group, and for the provider after each model’s name, as on Settings.")));
|
||||
txt.append(el("b", "", t("Names in agents’ lists")), el("small", "expl", t("Whether “· routing group” follows a group’s name in the agents’ lists: one setting for every group, and for the provider after each model’s name, as on Settings.")));
|
||||
// an agent the setting can't reach is named, not left to seem broken
|
||||
txt.append(noNamesLine("small", ""));
|
||||
// an open editor says what its group will be called: drawn again with it
|
||||
@@ -6826,7 +6831,7 @@ function routingPage(part) {
|
||||
const def = groupDefaults();
|
||||
const row = (box, label, hint, opts, cur, key) => {
|
||||
const txt = el("div", "txt");
|
||||
txt.append(el("b", "", t(label)), el("small", "", hint));
|
||||
txt.append(el("b", "", t(label)), el("small", "expl", hint));
|
||||
// a value set elsewhere (magpie settings set) that no option names
|
||||
if (!opts.some(([v]) => v === cur)) opts = [...opts, [cur, key === "firstToken" ? firstWord(cur) : patienceWord(cur)]];
|
||||
const pick = segs(opts.map(([v, n]) => [v, t(n)]), cur, (v) => setDefaults({ ...def, [key]: v }));
|
||||
|
||||
@@ -1,25 +1,34 @@
|
||||
// Settings' explanations, shown on asking (the owner, 11-02: "让整个设计
|
||||
// 页面看起来很简洁,很有呼吸感"). app.css keeps a row's lines that explain
|
||||
// it out of sight (--hint: 1 on each); the pointer resting on the row, or a
|
||||
// key reaching it, shows them here in a card under the row's name, over
|
||||
// the page, so no row moves. The card takes no pointer: a click goes to
|
||||
// what is under it. It goes when the pointer or focus leaves the row, the
|
||||
// page scrolls, a key is pressed or the row is drawn again. Imported by
|
||||
// app.js when the pointer or focus first comes to Settings, not at start.
|
||||
const view = document.getElementById("view-settings");
|
||||
// The lines that explain a setting, shown on asking (the owner, 11-02:
|
||||
// "让整个设计页面看起来很简洁,很有呼吸感"; yujezhang on X, 11-10: "界面只
|
||||
// 保留完成操作必需的信息"). app.css keeps a row's lines that explain it out
|
||||
// of sight (--hint: 1 on each); the pointer resting on the row, or a key
|
||||
// reaching it, shows them here in a card under the row's name, over the
|
||||
// page, so no row moves. The rows: Settings', a provider editor's fields
|
||||
// and the Settings rows it holds, and any .hint-row (Routing groups'
|
||||
// settings). The card takes no pointer: a click goes to what is under it.
|
||||
// It goes when the pointer or focus leaves the row, the page scrolls, a key
|
||||
// is pressed or the row is drawn again. Imported by app.js at start.
|
||||
const ROWS = "#view-settings .row.pref, .editor.roomy .row.pref, .editor.roomy .fld, .hint-row";
|
||||
const LINES = ":scope > .who > .sub, :scope > .hint, :scope > .txt > .expl";
|
||||
const card = el("div", "set-hint");
|
||||
card.setAttribute("aria-hidden", "true"); // a screen reader reads the lines in the row
|
||||
document.body.append(card);
|
||||
let row = null, wait = 0;
|
||||
|
||||
const acts = () => {
|
||||
for (const s of view.querySelectorAll(".row.pref > .who > .sub")) s.classList.toggle("acts", !!s.querySelector("a, button, input, select, code, .searcher-failed"));
|
||||
// a line holding a link or a control is one to use, so it stays in sight
|
||||
const acts = (root) => {
|
||||
for (const s of root.querySelectorAll(".row.pref > .who > .sub, .fld > .hint.expl")) s.classList.toggle("acts", !!s.querySelector("a, button, input, select, code, .searcher-failed"));
|
||||
};
|
||||
// before the page is painted again: no frame shows such a line hidden
|
||||
new MutationObserver(acts).observe(view, { childList: true, subtree: true });
|
||||
acts();
|
||||
// (Settings and the editor's dialog; Routing groups' lines hold none, and
|
||||
// its page is drawn again as each request plays)
|
||||
for (const root of [document.getElementById("view-settings"), document.getElementById("modal")]) {
|
||||
if (!root) continue;
|
||||
new MutationObserver(() => acts(root)).observe(root, { childList: true, subtree: true });
|
||||
acts(root);
|
||||
}
|
||||
|
||||
const hints = (r) => [...r.querySelectorAll(":scope > .who > .sub")]
|
||||
const hints = (r) => [...r.querySelectorAll(LINES)]
|
||||
.filter((s) => !s.hidden && getComputedStyle(s).getPropertyValue("--hint").trim() === "1" && s.textContent.trim());
|
||||
|
||||
function hide() {
|
||||
@@ -29,17 +38,18 @@ function hide() {
|
||||
card.hidden = true;
|
||||
}
|
||||
function show(r) {
|
||||
const subs = r.isConnected && !view.hidden ? hints(r) : [];
|
||||
const subs = r.isConnected && !r.closest("[hidden]") ? hints(r) : [];
|
||||
if (!subs.length) return hide();
|
||||
card.replaceChildren(...subs.map((s) => el("p", "", s.textContent.trim())));
|
||||
card.hidden = false;
|
||||
const who = r.querySelector(":scope > .who").getBoundingClientRect(), box = r.getBoundingClientRect();
|
||||
const who = (r.querySelector(":scope > .who, :scope > .txt") || r).getBoundingClientRect(), box = r.getBoundingClientRect();
|
||||
const w = card.offsetWidth, h = card.offsetHeight;
|
||||
const left = Math.max(16, Math.min(who.left, innerWidth - 16 - w));
|
||||
// under the row, or over it where the window ends first
|
||||
const top = box.bottom + 4 + h <= innerHeight - 8 ? box.bottom + 4 : Math.max(8, box.top - 4 - h);
|
||||
card.style.left = left + "px";
|
||||
card.style.top = top + "px";
|
||||
card.style.transformOrigin = (top < box.top ? "bottom " : "top ") + Math.round(Math.min(Math.max(who.left - left, 0), w)) + "px";
|
||||
requestAnimationFrame(() => row === r && card.classList.add("on"));
|
||||
}
|
||||
function point(r, now) {
|
||||
@@ -50,26 +60,34 @@ function point(r, now) {
|
||||
// a pointer passing over rows on its way shows nothing; resting does
|
||||
wait = setTimeout(() => show(r), now ? 0 : 450);
|
||||
}
|
||||
const rowOf = (n) => n instanceof Element ? n.closest("#view-settings .row.pref") : null;
|
||||
view.addEventListener("pointerover", (e) => e.pointerType !== "touch" && point(rowOf(e.target)));
|
||||
view.addEventListener("pointerleave", () => hide());
|
||||
view.addEventListener("pointerdown", () => hide(), true);
|
||||
view.addEventListener("focusin", (e) => {
|
||||
// rowOf: the row a node is in; an editor field's name, beside it in the
|
||||
// grid, is the field's too
|
||||
function rowOf(n) {
|
||||
if (!(n instanceof Element)) return null;
|
||||
const l = n.closest(".editor.roomy label");
|
||||
if (l?.nextElementSibling?.matches(".fld")) return l.nextElementSibling;
|
||||
return n.closest(ROWS);
|
||||
}
|
||||
document.addEventListener("pointerover", (e) => e.pointerType !== "touch" && point(rowOf(e.target)));
|
||||
// the pointer gone from the window
|
||||
document.addEventListener("pointerout", (e) => !e.relatedTarget && hide());
|
||||
document.addEventListener("pointerdown", () => hide(), true);
|
||||
document.addEventListener("focusin", (e) => {
|
||||
let key = true;
|
||||
try { key = e.target.matches(":focus-visible"); } catch {} // Safari before 15.4
|
||||
if (key) point(rowOf(e.target), true);
|
||||
});
|
||||
view.addEventListener("focusout", (e) => {
|
||||
document.addEventListener("focusout", (e) => {
|
||||
if (!rowOf(e.relatedTarget) || rowOf(e.relatedTarget) !== row) hide();
|
||||
});
|
||||
// a scroll takes the pointer's card away; focus's follows its row, which
|
||||
// a key moving focus scrolls into sight
|
||||
view.addEventListener("scroll", () => row?.contains(document.activeElement) ? show(row) : hide(), { passive: true, capture: true });
|
||||
document.addEventListener("scroll", () => row?.contains(document.activeElement) ? show(row) : hide(), { passive: true, capture: true });
|
||||
addEventListener("keydown", (e) => !/^(Tab|Shift|Alt|Meta|Control)$/.test(e.key) && hide(), true);
|
||||
addEventListener("resize", hide);
|
||||
hide();
|
||||
// the pointer already on a row, or focus, as the import came
|
||||
{
|
||||
const on = view.querySelector(".row.pref:hover") || rowOf(document.activeElement);
|
||||
const on = [...document.querySelectorAll(ROWS)].findLast?.((r) => r.matches(":hover")) || rowOf(document.activeElement);
|
||||
if (on) point(on);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// yujezhang on X (11-10): "界面只保留完成操作必需的信息", longer
|
||||
// explanations shown on asking. A provider's editor and Routing groups'
|
||||
// settings do as Settings has since 11-02 (settings-hints.test.cjs). With a
|
||||
// mouse, in both engines, at 1100px and 420px, in every language:
|
||||
// - at rest a field's explanation (Headers') is out of sight but still in
|
||||
// the page, read by a screen reader as the field's description;
|
||||
// - the pointer resting on the field's name shows it whole in a card, and
|
||||
// no field moves; the pointer leaving takes the card away;
|
||||
// - a key reaching a field's control shows its card;
|
||||
// - Certificate keeps its risk in sight, in one short line;
|
||||
// - Routing groups' settings rows are their names and controls, each
|
||||
// explanation shown in the card on resting over its row.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
const { test } = require("node:test");
|
||||
const { chromium, webkit } = require("playwright");
|
||||
|
||||
const assets = path.resolve(__dirname, "../assets");
|
||||
const vllm = {
|
||||
id: "vllm", name: "LAN vLLM", icon: "generic", chat: "https://192.168.1.20:8443/v1", responses: "", anthropic: "", catalog: "",
|
||||
models: [{ id: "qwen3-32b", name: "qwen3-32b", on: true }], agents: [], fallback: [], headers: {},
|
||||
key: { set: false, masked: "" }, keyList: [], balanceToken: { takes: false, set: false }, proxy: "", searches: false,
|
||||
takesInsecureTLS: true, insecureTLS: false,
|
||||
};
|
||||
const models = [
|
||||
{ id: "a/m", name: "m", providerName: "A", icon: "generic" },
|
||||
{ id: "b/m", name: "m", providerName: "B", icon: "generic" },
|
||||
];
|
||||
|
||||
function serve(lang) {
|
||||
const state = { agents: [{ id: "codex", name: "Codex", path: "/test/codex", fields: [] }], profiles: [], settings: { lang, theme: "light" } };
|
||||
return async (r) => {
|
||||
const url = new URL(r.request().url());
|
||||
const json = (data) => r.fulfill({ json: data });
|
||||
if (url.pathname === "/boot.js") return r.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
|
||||
if (url.pathname === "/wails/runtime.js") return r.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
|
||||
if (url.pathname === "/api/state") return json(state);
|
||||
if (url.pathname === "/api/plugins") return json({ plugins: [] });
|
||||
if (url.pathname === "/api/providers") return json({ providers: [vllm], presets: [], excluded: [], gateway: { running: true, window: true, url: "http://127.0.0.1:3999" } });
|
||||
if (url.pathname === "/api/gateway/trace") {
|
||||
if (url.searchParams.get("wait")) return new Promise(() => {}); // nothing more comes
|
||||
return json({ mine: true, now: new Date().toISOString(), seq: 1, totals: { requests: 0, rerouted: 0, errors: 0 }, routes: [] });
|
||||
}
|
||||
if (url.pathname === "/api/gateway/history") return json({ cut: false, days: [], routes: [] });
|
||||
if (url.pathname === "/api/groups") return json({
|
||||
models, pools: [], deciders: [], found: true, defaults: { sink: false, firstToken: 0, patience: 0 },
|
||||
groups: [{ id: "sol", name: "Sol", members: models.map((m) => m.id), routing: "order", ready: true, memberInfo: models.map((m) => ({ id: m.id, ready: true })) }],
|
||||
});
|
||||
if (url.pathname.startsWith("/api/")) return json({});
|
||||
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
|
||||
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
|
||||
const body = await fs.readFile(file).catch(() => null);
|
||||
await (body ? r.fulfill({ body, contentType }) : r.fulfill({ status: 404, body: "" }));
|
||||
};
|
||||
}
|
||||
|
||||
const inSight = (e) => { const b = e.getBoundingClientRect(); return b.height > 4 && b.width > 4; };
|
||||
const fields = () => [...document.querySelectorAll(".editor.roomy > *, .editor.roomy .more .inner > *")].map((e) => { const b = e.getBoundingClientRect(); return [Math.round(b.top), Math.round(b.height)].join(","); });
|
||||
const strings = [
|
||||
"Headers", "Certificate", "Turn it on only on a network you trust.",
|
||||
"For your own server with a self-signed certificate or one from your company's CA. magpie then can't tell it from another machine answering at its address: turn it on only on a network you trust.",
|
||||
"Find groups on their own", "Every member busy",
|
||||
];
|
||||
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) for (const width of [1100, 420]) {
|
||||
const open = async (t, at) => {
|
||||
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL || "chromium" }));
|
||||
let page;
|
||||
t.after(async () => {
|
||||
if (process.env.ARTIFACT_DIR && page) {
|
||||
await fs.mkdir(process.env.ARTIFACT_DIR, { recursive: true });
|
||||
await page.screenshot({ path: path.join(process.env.ARTIFACT_DIR, `${engine}-${lang}-${width}-editor-hints.png`), fullPage: true });
|
||||
}
|
||||
await browser.close();
|
||||
});
|
||||
page = await (await browser.newContext({ viewport: { width, height: 800 }, reducedMotion: "reduce" })).newPage();
|
||||
page.setDefaultTimeout(8000);
|
||||
page.setDefaultNavigationTimeout(60000);
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.route("**/*", serve(lang));
|
||||
await page.goto("http://magpie.test/?view=" + at);
|
||||
const w = await page.evaluate(([lang, ks]) => Object.fromEntries(ks.map((k) => [k, (I18N[lang] || {})[k] || k])), [lang, strings]);
|
||||
if (lang !== "en") {
|
||||
const missing = await page.evaluate(([lang, ks]) => ks.filter((k) => !(I18N[lang] || {})[k]), [lang, strings.slice(0, 4)]);
|
||||
assert.deepEqual(missing, [], `every string has its ${lang}`);
|
||||
}
|
||||
return { page, errors, w };
|
||||
};
|
||||
|
||||
test(`${engine} ${lang} ${width}: a provider editor's explanations show on asking`, async (t) => {
|
||||
const { page, errors, w } = await open(t, "providers");
|
||||
await page.locator(".row.provider", { hasText: "LAN vLLM" }).click();
|
||||
await page.locator(".editor.roomy .bar").waitFor();
|
||||
const ed = page.locator(".editor.roomy");
|
||||
// Headers and Certificate are under Advanced
|
||||
const adv = ed.locator("details.more.advanced");
|
||||
if (!(await adv.evaluate((e) => e.open))) await adv.locator(":scope > summary").click();
|
||||
const name = ed.locator("label", { hasText: new RegExp("^" + w.Headers.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "$") });
|
||||
const fld = name.locator("xpath=following-sibling::div[1]");
|
||||
const hint = fld.locator(":scope > .hint.expl");
|
||||
await hint.waitFor({ state: "attached" });
|
||||
const text = (await hint.textContent()).trim();
|
||||
assert.ok(text.length > 40, "Headers has its explanation");
|
||||
|
||||
// at rest: out of sight, still in the page and the field's description
|
||||
assert.equal(await hint.evaluate(inSight), false, "Headers' explanation shows at rest");
|
||||
// and placed in its field's box: against the page, deep in the
|
||||
// editor's scroll, it grew the page a scrollbar and the editor
|
||||
// 10px narrower (account-weight's de 390, in WebKit)
|
||||
assert.deepEqual(await ed.evaluate((ed) => [...ed.querySelectorAll(".fld > .hint.expl")].filter((h) => h.getClientRects().length && getComputedStyle(h).position === "absolute" && h.offsetParent !== h.parentElement).map((h) => h.id)), [], "explanations placed outside their field");
|
||||
const id = await hint.getAttribute("id");
|
||||
assert.ok(await fld.locator(`[aria-describedby~="${id}"]`).count() > 0 || await page.locator(`[aria-describedby~="${id}"]`).count() > 0, "nothing is described by the explanation");
|
||||
|
||||
// Certificate: the risk in one short line in sight, the rest on asking
|
||||
const cert = ed.locator("label", { hasText: new RegExp("^" + w.Certificate + "$") }).locator("xpath=following-sibling::div[1]");
|
||||
const lead = cert.locator(":scope > .hint.lead");
|
||||
await cert.scrollIntoViewIfNeeded();
|
||||
assert.equal(await lead.evaluate(inSight), true, "Certificate's risk is out of sight");
|
||||
assert.equal((await lead.textContent()).trim(), w["Turn it on only on a network you trust."]);
|
||||
const lb = await lead.boundingBox();
|
||||
assert.ok(lb.height < 40, `the risk's line runs long: ${lb.height}`);
|
||||
assert.equal(await cert.locator(":scope > .hint.expl").evaluate(inSight), false);
|
||||
|
||||
// the pointer resting on the field's name: the card, whole, and
|
||||
// nothing moves
|
||||
await name.scrollIntoViewIfNeeded();
|
||||
await page.mouse.move(1, 1);
|
||||
const before = await page.evaluate(fields);
|
||||
await name.hover();
|
||||
const card = page.locator(".set-hint.on");
|
||||
await card.waitFor();
|
||||
assert.equal((await card.textContent()).includes(text), true, "the card doesn't say the field's line");
|
||||
const cb = await card.boundingBox(), nb = await name.boundingBox();
|
||||
assert.ok(cb.x >= 15 && cb.x + cb.width <= width - 15, `the card runs out of the window: ${JSON.stringify(cb)}`);
|
||||
assert.ok(cb.y >= nb.y + nb.height - 1 || cb.y + cb.height <= nb.y + 1, "the card covers the field's name");
|
||||
assert.deepEqual(await page.evaluate(fields), before, "a field moved when the card showed");
|
||||
assert.equal(await card.evaluate((e) => getComputedStyle(e).pointerEvents), "none");
|
||||
// the pointer gone: the card goes
|
||||
await page.mouse.move(1, 1);
|
||||
await page.locator(".set-hint").waitFor({ state: "hidden" });
|
||||
|
||||
// a key reaching Certificate's box shows its card
|
||||
const box = cert.locator("input").first();
|
||||
await box.focus();
|
||||
await page.keyboard.press("Shift+Tab");
|
||||
await page.keyboard.press("Tab");
|
||||
assert.equal(await cert.evaluate((r) => r.contains(document.activeElement)), true, "Tab didn't come back to Certificate's box");
|
||||
await card.waitFor();
|
||||
assert.equal((await card.textContent()).includes(w[strings[3]]), true, "focus showed another field's card");
|
||||
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "the page scrolls sideways");
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test(`${engine} ${lang} ${width}: Routing groups' settings are their names, explained on asking`, async (t) => {
|
||||
const { page, errors, w } = await open(t, "groups");
|
||||
const found = page.locator(".rt-gset > .rt-gfound");
|
||||
await found.waitFor();
|
||||
const busy = page.locator(".rt-gset > .rt-gdef-patience");
|
||||
for (const [row, label] of [[found, w["Find groups on their own"]], [busy, w["Every member busy"]]]) {
|
||||
assert.equal((await row.locator(".txt > b").textContent()).trim(), label);
|
||||
const line = row.locator(".txt > small.expl");
|
||||
const text = (await line.textContent()).trim();
|
||||
assert.ok(text.length > 20);
|
||||
assert.equal(await line.evaluate(inSight), false, `${label}'s explanation shows at rest`);
|
||||
assert.equal(await line.evaluate((h) => h.offsetParent === h.parentElement), true, `${label}'s explanation is placed outside its row`);
|
||||
await row.scrollIntoViewIfNeeded();
|
||||
await page.mouse.move(1, 1);
|
||||
await page.locator(".set-hint").waitFor({ state: "hidden" });
|
||||
await row.locator(".txt > b").hover();
|
||||
const card = page.locator(".set-hint.on");
|
||||
await card.waitFor();
|
||||
assert.equal((await card.textContent()).includes(text), true, `${label}'s card doesn't say its line`);
|
||||
const cb = await card.boundingBox();
|
||||
assert.ok(cb.x >= 15 && cb.x + cb.width <= width - 15, `the card runs out of the window: ${JSON.stringify(cb)}`);
|
||||
}
|
||||
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "the page scrolls sideways");
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
return [...s.children].map((c) => c.className).filter((c) => c !== "rt-goff");
|
||||
});
|
||||
assert.deepEqual(order.slice(0, 4), ["row-head", "list rt-groups", "row-head rt-gset-head", "list rt-gset"]);
|
||||
assert.deepEqual(await page.evaluate(() => [...document.querySelector(".rt-gset").children].map((c) => c.className)), ["rt-gfound", "rt-gnames", "rt-gdef rt-gdef-sink", "rt-gdef rt-gdef-first", "rt-gdef rt-gdef-patience"]);
|
||||
assert.deepEqual(await page.evaluate(() => [...document.querySelector(".rt-gset").children].map((c) => c.className)), ["rt-gfound hint-row", "rt-gnames hint-row", "rt-gdef rt-gdef-sink hint-row", "rt-gdef rt-gdef-first hint-row", "rt-gdef rt-gdef-patience hint-row"]);
|
||||
const border = await sw.evaluate((e) => { const c = getComputedStyle(e); return c.borderLeftWidth !== c.borderRightWidth || c.borderLeftColor !== c.borderRightColor; });
|
||||
assert.equal(border, false, "no left-border accent");
|
||||
|
||||
|
||||
@@ -357,7 +357,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
const ir = inside(i, cls), lr = inside(l, cls + "'s label");
|
||||
inside(h, cls + "'s hint");
|
||||
if (l.scrollWidth > l.clientWidth || l.scrollHeight > l.clientHeight) out.push(`${cls}'s label cut: ${l.textContent}`);
|
||||
if (h.scrollWidth > h.clientWidth) out.push(`${cls}'s hint cut`);
|
||||
// a hint resting out of sight (--hint: 1) is read in its hover card, not cut
|
||||
if (getComputedStyle(h).getPropertyValue("--hint").trim() !== "1" && h.scrollWidth > h.clientWidth) out.push(`${cls}'s hint cut`);
|
||||
if (lr.right > ir.left && lr.bottom > ir.top && lr.top < ir.bottom) out.push(`${cls}'s label over its box`);
|
||||
if (ir.width < 140) out.push(`${cls} ${ir.width}px wide`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user