routing: Accounts & keys in columns keeps each provider's rows under its own name
The owner's screenshot (这里的布局直接崩坏了): below 1150px the accounts list flows in columns, and a provider's accounts ran on into the next column with no heading over them, while the line meant to part two providers stood over a column's top. Each provider's heading and rows are now one box (.rt-pgrp) that doesn't break; one with more than 12 rows may, but its heading stays with its first row. The parting line is between two boxes and is dropped in columns, where the column gap parts them. Run (mote): at7a2946caf, the 19 Routing accounts GUI files, 369/370; the red is chromium zh many-keys (#5543). Rebased on60cb1bd9e, the routing account/columns/keys-fold/many-keys/provider-off files, 106/106. routing-context-fold's WebKit red is the same at the base (#5586). Broken by hand: on the old code routing-accounts-narrow's strays check (each row's left edge under its own heading) is red 10/10. Not tried: the real macOS app. Playwright's and WKWebView's snapshots don't paint multicolumn rows past the first column, old code or new, so the check is by geometry, not pixels.
This commit is contained in:
@@ -4636,6 +4636,7 @@ function routingPage(part) {
|
||||
actsFold = { rs: [...rs], by };
|
||||
return by;
|
||||
}
|
||||
const provBoxes = new Map(); // a provider → its box in the accounts' list (renderActs)
|
||||
function renderActs(rs) {
|
||||
// a rest lifted by hand since the request that found it (#1869): the
|
||||
// kept requests still say it, until the next one asks it again. By the
|
||||
@@ -4860,7 +4861,28 @@ function routingPage(part) {
|
||||
setText(actUsage, t("View usage"));
|
||||
unhide(actUsage, !list.length);
|
||||
unhide(actFoot, actMore.hidden && actUsage.hidden);
|
||||
patch(acts, actsAll ? out : out.filter((b) => !hide.has(b)));
|
||||
// each provider's blocks in one box of its own: in columns, a
|
||||
// provider's accounts ran on into the next column under no heading,
|
||||
// and the line between providers stood over a column's top (the
|
||||
// owner, 11-07: "布局直接崩坏了"). Kept per provider, so a redraw
|
||||
// with nothing new moves nothing
|
||||
const runs = [];
|
||||
for (const b of actsAll ? out : out.filter((b) => !hide.has(b))) {
|
||||
const p = meta.get(b).prov, last = runs.at(-1);
|
||||
if (last && last.p === p) last.bs.push(b); else runs.push({ p, bs: [b] });
|
||||
}
|
||||
const boxes = runs.map(({ p, bs }) => {
|
||||
let g = provBoxes.get(p);
|
||||
if (!g) provBoxes.set(p, (g = el("div", "rt-pgrp")));
|
||||
// its heading's block opened into it: each row no deeper than before
|
||||
patch(g, bs.flatMap((b) => (b.classList.contains("rt-lead") ? [...b.children] : [b])));
|
||||
// hundreds of keys opened (#3164) in one unbroken box would be one
|
||||
// column as long as all of them: a long one breaks between its rows
|
||||
const long = bs.reduce((x, b) => x + meta.get(b).n, 0) > 12;
|
||||
if (g.classList.contains("long") !== long) g.classList.toggle("long", long);
|
||||
return g;
|
||||
});
|
||||
patch(acts, boxes);
|
||||
}
|
||||
|
||||
// signInAgain signs the account of seat w in again, in its provider's
|
||||
|
||||
@@ -463,6 +463,9 @@ button.rt-session { cursor: pointer; }
|
||||
line (danzi002 on Discord), two of them still on a phone */
|
||||
:where(.rt-more:not(.min1150)) .rt-acts, .rt-cols.solo .rt-acts { columns: min(240px, 40vw); column-gap: 0; }
|
||||
:where(.rt-more:not(.min1150)) .rt-acts > *, .rt-cols.solo .rt-acts > * { break-inside: avoid; }
|
||||
:where(.rt-more:not(.min1150)) .rt-pgrp.long, .rt-cols.solo .rt-pgrp.long { break-inside: auto; }
|
||||
:where(.rt-more:not(.min1150)) .rt-pgrp.long > *, .rt-cols.solo .rt-pgrp.long > * { break-inside: avoid; }
|
||||
:where(.rt-more:not(.min1150)) .rt-pgrp.long > .rt-prov, .rt-cols.solo .rt-pgrp.long > .rt-prov { break-after: avoid; }
|
||||
.rt-cols.solo { grid-template-columns: minmax(0, 1fr); }
|
||||
.rt-reqs.none { display: block; background: none; border-color: transparent; }
|
||||
.rt-reqs.none .empty-state { padding: 14px 12px 18px; font-size: 12px; line-height: 1.6; }
|
||||
@@ -470,7 +473,11 @@ button.rt-session { cursor: pointer; }
|
||||
.rt-prov { display: flex; align-items: center; gap: 7px; padding: 8px 12px 4px; font-size: 12px; }
|
||||
.rt-prov .ic, .rt-prov .ic img, .rt-prov .ic svg { width: 14px; height: 14px; }
|
||||
.rt-prov > span:last-child { margin-left: auto; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
|
||||
.rt-acts > :not(:first-child) > .rt-prov:first-child { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
|
||||
/* a provider's heading and rows, one box (.rt-pgrp); one to a line, a
|
||||
line between providers; in columns a gap instead, a line standing over
|
||||
a column's top */
|
||||
.rt-pgrp + .rt-pgrp { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 2px; }
|
||||
:where(.rt-more:not(.min1150)) .rt-pgrp + .rt-pgrp, .rt-cols.solo .rt-pgrp + .rt-pgrp { border-top: 0; margin-top: 0; padding-top: 6px; }
|
||||
/* a routing named where it can be changed: a way to where it is set */
|
||||
.rt-go { cursor: pointer; }
|
||||
.rt-go::after { content: " ›"; }
|
||||
|
||||
@@ -77,7 +77,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
return { top: Math.round(b.top), left: b.left, right: b.right, text: e.textContent };
|
||||
}));
|
||||
const settle = () => page.evaluate(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => setTimeout(r, 100)))));
|
||||
for (const width of [700, 560, 420]) {
|
||||
for (const width of [1100, 700, 560, 420]) {
|
||||
await page.setViewportSize({ width, height: 1200 });
|
||||
await settle();
|
||||
const reqs = await page.locator(".rt-reqs").boundingBox(), acts = await page.locator(".rt-acts").boundingBox();
|
||||
@@ -95,6 +95,16 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
// the providers in two columns or more, not a heading to a line
|
||||
const cols = new Set(heads.map((h) => Math.round(h.left)));
|
||||
assert(cols.size >= 2, `${width}px: the providers in columns: ${[...cols]}`);
|
||||
// a provider's accounts all in its heading's column, none run on
|
||||
// into the next under no heading, and no line between providers
|
||||
// over a column's top (the owner, 11-07: "布局直接崩坏了")
|
||||
const strays = await page.locator(".rt-acts .rt-act").evaluateAll((es) => es.filter((e) => {
|
||||
const h = e.closest(".rt-acts > *")?.querySelector(".rt-prov");
|
||||
return !h || Math.abs(h.getBoundingClientRect().left - e.getBoundingClientRect().left) > 1;
|
||||
}).map((e) => e.textContent));
|
||||
assert.deepEqual(strays, [], `${width}px: accounts away from their heading`);
|
||||
const lines = await page.locator(".rt-acts > *").evaluateAll((es) => es.filter((e) => parseFloat(getComputedStyle(e).borderTopWidth) > 0).length);
|
||||
assert.equal(lines, 0, `${width}px: no line over a provider in columns`);
|
||||
const items = await page.locator(".rt-acts > *").evaluateAll((es) => es.reduce((x, e) => x + e.getBoundingClientRect().height, 0));
|
||||
assert(acts.height < items * 0.7, `${width}px: the list shorter than its items one under the other: ${acts.height} vs ${items}`);
|
||||
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false, `${width}px: no horizontal overflow`);
|
||||
|
||||
Reference in New Issue
Block a user