plugins: Install is a thin ring round body-coloured text, with its arrow
The owner picked option C of four: "一个个大安装像一个个补丁". Install, Move and a list's Sign in are a 1px ring (--ring-act, the text colour at 15%) round body-coloured text, with a download arrow before Install; hover fills it grey; Update is the same ring in green; the detail page's main action keeps its accent fill. Browsers without color-mix() (Safari before 16.2) get --line for the ring, which old-webkit's check asked for. plugin-update-button and plugin-market assert the ring and the fill of the new look. Run record: the Discover commit's (same push).
This commit is contained in:
@@ -166,24 +166,25 @@ button.pm-chip:disabled { cursor: default; opacity: .6; }
|
||||
.pm-chip.soft { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
|
||||
|
||||
/* a plugin's one button */
|
||||
:root { --ring-act: color-mix(in srgb, var(--fg) 15%, transparent); }
|
||||
@supports not (color: color-mix(in srgb, red 50%, blue)) { :root { --ring-act: var(--line); } }
|
||||
.pm-act {
|
||||
flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
|
||||
height: 26px; min-width: 64px; padding: 0 12px; border-radius: 13px;
|
||||
font-size: 12px; font-weight: 600; white-space: nowrap;
|
||||
background: var(--pill); color: var(--fg-2); transition: background .14s var(--ease), color .14s var(--ease), filter .14s;
|
||||
background: var(--pill); color: var(--fg-2); transition: background .14s ease, color .14s ease, filter .14s ease;
|
||||
}
|
||||
.pm-act:hover:not(:disabled) { background: var(--pill-hover); color: var(--fg); }
|
||||
.pm-act.get { background: var(--accent-soft); color: var(--accent); }
|
||||
.pm-act.get:hover:not(:disabled) { background: var(--accent); color: var(--accent-fg); }
|
||||
/* an update out: Install's size, green for its own (#1587) */
|
||||
.pm-act.pm-up { background: var(--green-soft); color: var(--green); }
|
||||
.pm-act.pm-up:hover:not(:disabled) { background: var(--green); color: var(--card); }
|
||||
/* Sign in, in a list of cards or rows, is Install's tinted capsule: one
|
||||
style for a row's action, so no card shouts over its neighbours (HIG's
|
||||
one filled button is a sheet's own); a plugin's page fills it */
|
||||
.pm-act.go { background: var(--accent-soft); color: var(--accent); }
|
||||
.pm-act.go:hover:not(:disabled), .pm-dact .pm-act.go { background: var(--accent); color: var(--accent-fg); }
|
||||
.pm-dact .pm-act.go:hover:not(:disabled) { filter: brightness(1.08); }
|
||||
/* Install, Move and a list's Sign in: a thin ring round body-coloured
|
||||
text, grey under the pointer, so a grid of them reads as quiet as a
|
||||
list's (the owner: 一个个大安装像一个个补丁); a plugin's page fills its one */
|
||||
.pm-act.get, .pm-act.go, .pm-act.pm-up { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--ring-act); }
|
||||
.pm-act.get:hover:not(:disabled), .pm-act.go:hover:not(:disabled), .pm-act.pm-up:hover:not(:disabled) { background: var(--pill); }
|
||||
.pm-act .dl { flex: none; margin-left: -1px; }
|
||||
/* an update out: Install's ring, its word green (#1587) */
|
||||
.pm-act.pm-up, .pm-act.pm-up:hover:not(:disabled) { color: var(--green); }
|
||||
.pm-dact .pm-act.go { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
|
||||
.pm-dact .pm-act.go:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
|
||||
.pm-act.done { background: none; color: var(--green); padding: 0 8px; min-width: 0; }
|
||||
.pm-act.done:hover:not(:disabled) { background: var(--green-soft); color: var(--green); }
|
||||
.pm-act.busy { color: var(--muted); font-weight: 500; }
|
||||
|
||||
@@ -473,6 +473,14 @@
|
||||
}
|
||||
|
||||
// the one button a plugin shows: what to do with it next
|
||||
// Install's arrow into a tray, drawn in the word's colour
|
||||
const dlGlyph = () => {
|
||||
const ns = "http://www.w3.org/2000/svg", g = document.createElementNS(ns, "svg"), p = document.createElementNS(ns, "path");
|
||||
for (const [k, v] of Object.entries({ class: "dl", width: 11, height: 11, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": 1.9, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" })) g.setAttribute(k, v);
|
||||
p.setAttribute("d", "M8 2.5v8M4.5 7.5 8 11l3.5-3.5M3 13.5h10");
|
||||
g.append(p);
|
||||
return g;
|
||||
};
|
||||
function actionFor(pkg, nm, listed) {
|
||||
const b = el("button", "pm-act");
|
||||
const e = entryOf(pkg);
|
||||
@@ -503,7 +511,7 @@
|
||||
const c = movableOf(pkg)[0];
|
||||
if (c) return moveButton(b, c);
|
||||
b.classList.add("get");
|
||||
b.textContent = t("Install");
|
||||
b.append(dlGlyph(), t("Install"));
|
||||
b.disabled = busy.size > 0;
|
||||
b.onclick = (ev) => { ev.stopPropagation(); install(pkg, nm); };
|
||||
return b;
|
||||
|
||||
@@ -192,14 +192,16 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
await dlg.locator(".pm-act.go", { hasText: w.signIn }).waitFor();
|
||||
assert.deepEqual(asked.find(([k]) => k === "add")[1], { spec: "opencode-copilot-auth" });
|
||||
// the page's one action is filled; on the card behind it, Sign in is
|
||||
// Install's tinted capsule, so no card in the grid shouts over the
|
||||
// rest (the Kiko03O1 reply on X: ui 设计能不能好看点)
|
||||
// Install's thin ring, so no card in the grid shouts over the rest
|
||||
// (the Kiko03O1 reply on X: ui 设计能不能好看点; the owner: 一个个大
|
||||
// 安装像一个个补丁)
|
||||
const fill = (loc) => loc.evaluate((b) => getComputedStyle(b).backgroundColor);
|
||||
const tone = (v) => page.evaluate((v) => { const d = document.createElement("div"); d.style.background = `var(${v})`; document.body.append(d); const c = getComputedStyle(d).backgroundColor; d.remove(); return c; }, v);
|
||||
assert.equal(await fill(dlg.locator(".pm-act.go")), await tone("--accent"));
|
||||
const cardGo = copilot.locator(".pm-act.go", { hasText: w.signIn });
|
||||
await cardGo.waitFor();
|
||||
assert.equal(await fill(cardGo), await tone("--accent-soft"));
|
||||
assert.equal(await fill(cardGo), "rgba(0, 0, 0, 0)");
|
||||
assert.notEqual(await cardGo.evaluate((b) => getComputedStyle(b).boxShadow), "none", "the card's Sign in has its ring");
|
||||
await dlg.locator(".pm-act.go").click();
|
||||
await page.locator("#view-providers").waitFor({ state: "visible" });
|
||||
await page.waitForFunction(() => document.querySelector("#modal").hidden);
|
||||
|
||||
@@ -51,7 +51,7 @@ const L = {
|
||||
const look = (b) => b.evaluate((e) => {
|
||||
// offset sizes, as laid out: a list's entrance scale is not the button's size
|
||||
const s = getComputedStyle(e);
|
||||
return { h: e.offsetHeight, w: e.offsetWidth, minW: s.minWidth, pad: s.paddingLeft + " " + s.paddingRight, font: s.fontSize + " " + s.fontWeight, radius: s.borderRadius, margin: s.margin, bg: s.backgroundColor, color: s.color };
|
||||
return { h: e.offsetHeight, w: e.offsetWidth, minW: s.minWidth, pad: s.paddingLeft + " " + s.paddingRight, font: s.fontSize + " " + s.fontWeight, radius: s.borderRadius, margin: s.margin, bg: s.backgroundColor, ring: s.boxShadow, color: s.color };
|
||||
});
|
||||
|
||||
function sameSize(got, want, what) {
|
||||
@@ -62,7 +62,9 @@ function sameSize(got, want, what) {
|
||||
assert.equal(got.radius, want.radius, what + ": corners");
|
||||
assert.equal(got.margin, want.margin, what + ": margins (the title bar's .update pill isn't its look)");
|
||||
assert.ok(got.w >= parseFloat(want.minW), what + ": at least Install's width");
|
||||
assert.notEqual(got.bg, want.bg, what + ": a colour of its own, not Install's");
|
||||
// Install's ring, its word green: told apart by its colour alone
|
||||
assert.equal(got.bg, want.bg, what + ": Install's fill");
|
||||
assert.equal(got.ring, want.ring, what + ": Install's ring");
|
||||
assert.notEqual(got.color, want.color, what + ": its text a colour of its own");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user