diff --git a/frame.lock b/frame.lock index 815e76a..0fc9c49 100644 --- a/frame.lock +++ b/frame.lock @@ -115,15 +115,15 @@ }, { "path": "frame/frame.mjs", - "sha256": "208994058dcc6c70a91d590c345cb4956eda3532096f298f0a21f809f11672c1" + "sha256": "6f01e54838e3593be14ad473467424faf83dfc4c543ea0f9d86655c549cc1b0b" }, { "path": "frame/panels.css", - "sha256": "9b6bcd85303139ddaac9b2cbde7b7d3ef61d34da336874774073124b2560d8ce" + "sha256": "81fbc8fb7b2b010dc55b6d4f8101f7e64fa095edb071b5bb0c699d02a3b26faf" }, { "path": "frame/panels.mjs", - "sha256": "f2db1617f0a6d14e4447c54bafc7aeb45c7cb152b0f5a0b27b5615f8ce8d7b92" + "sha256": "ea95d0d07417a475023f550f0b74efa3d652c922f0baec6263f1320c3a8b97ab" }, { "path": "frame/publish.mjs", @@ -171,7 +171,7 @@ }, { "path": "identity/test.mjs", - "sha256": "21cb6924014c80f378abf5d07720a203c7e62aa99ffd38e05f6d8376153317f9" + "sha256": "250d5f329fb73cc756f3fc16f7adf7951199dbd0d3737b1629d53e82c2111d40" }, { "path": "lighthouserc.json", diff --git a/frame/frame.mjs b/frame/frame.mjs index 211002f..09178e9 100644 --- a/frame/frame.mjs +++ b/frame/frame.mjs @@ -187,7 +187,7 @@ const markup = (e) => ` - +
@@ -865,7 +865,7 @@ class PrismFrame extends Element { } const paint = () => { const saved = accountChannel.session; - const label = "Prism id"; + const label = "Prism ID"; button.classList.toggle("signed-in", Boolean(saved)); button.setAttribute("aria-label", label); button.title = label; diff --git a/frame/panels.css b/frame/panels.css index 98005af..a596c64 100644 --- a/frame/panels.css +++ b/frame/panels.css @@ -410,24 +410,7 @@ * the golden ratio (1.618): the width is 1.618 x 16rem, the padding 1.618rem, * the title 1.618 x the body text, the gaps 0.618, 1 and 1.618rem, and the * backdrop dims by 0.382. Outside, Escape or the close button dismisses it. */ -.account-panel { - position: fixed; - inset: 0; - width: min(25.888rem, 100vw - 2rem); - height: fit-content; - max-height: calc(100dvh - 2rem); - margin: auto; - padding: 1.618rem; - overflow: auto; - border: var(--border-width) solid var(--border); - border-radius: calc(var(--radius) * 1.618); - background: var(--popover); - color: var(--popover-foreground); - box-shadow: var(--shadow-overlay); - font-size: var(--text-14); - line-height: 1.5; - transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), overlay var(--duration) allow-discrete, display var(--duration) allow-discrete; -} +.account-panel { position: fixed; inset: 0; width: min(25.888rem, 100vw - 2rem); height: fit-content; max-height: calc(100dvh - 2rem); margin: auto; padding: 1.618rem; overflow: auto; border: var(--border-width) solid var(--border); border-radius: calc(var(--radius) * 1.618); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-overlay); font-size: var(--text-14); line-height: 1.5; transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), overlay var(--duration) allow-discrete, display var(--duration) allow-discrete; } .account-panel:not(:popover-open) { opacity: 0; transform: scale(0.98); } @starting-style { .account-panel:popover-open { opacity: 0; transform: scale(0.98); } @@ -439,35 +422,40 @@ } :host([dark]) .account-panel { box-shadow: none; border-color: var(--border-strong); } .account-panel p, .account-panel h2 { margin: 0; } -.account-close { - position: absolute; - top: 1rem; - right: 1rem; - display: grid; - place-items: center; - width: 2rem; - height: 2rem; - min-height: 0; - padding: 0; - border: var(--border-width) solid var(--border); - border-radius: var(--radius-control); - background: none; - color: var(--muted-foreground); - cursor: pointer; -} +.account-close { position: absolute; top: 1rem; right: 1rem; display: grid; place-items: center; width: 2rem; height: 2rem; min-height: 0; padding: 0; border: 0; border-radius: var(--radius-control); background: none; color: var(--muted-foreground); cursor: pointer; } .account-close:hover { background: var(--accent); color: var(--foreground); } .account-close svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; } -.account-title { padding-right: 2.618rem; font-family: var(--font-display); font-weight: 600; font-size: 1.618rem; line-height: 1.236; letter-spacing: var(--tracking-display); } -.account-sub { margin: 0.618rem 0 1.618rem !important; color: var(--muted-foreground); font-size: 1rem; } +.account-title { padding-right: 2.618rem; font-family: var(--font-display); font-weight: 600; font-size: 1.382rem; line-height: 1.236; letter-spacing: var(--tracking-display); } +.account-sub { margin: 0.382rem 0 1rem !important; color: var(--muted-foreground); font-size: var(--text-14); } .account-in { display: grid; gap: 0.382rem; } .account-id { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: 0.618rem !important; padding: 0.618rem 1rem; border: var(--border-width) solid var(--border); border-radius: var(--radius-control); background: var(--background); } .account-id code { font-family: var(--font-mono); color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .account-qr { display: block; width: min(100%, 14rem); aspect-ratio: 1; margin: 0 auto 0.618rem; background: #fff; border-radius: var(--radius-control); } .account-qr path { fill: #000; } .account-panel .text { padding: 0; border: 0; background: none; color: var(--foreground); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 0.2em; cursor: pointer; } -.account-panel .row { justify-content: flex-start; width: 100%; min-height: 2.618rem; padding: 0 1rem; border: 0; border-radius: var(--radius-control); background: none; color: var(--foreground); font-size: 1rem; text-align: start; cursor: pointer; } +/* The id itself, then the one thing worth doing now, then every choice grouped by why you would make it: + * each row says what it does, and in a muted line, why. Icons are outlines at the text colour. */ +.account-panel .glyph { flex: none; width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; } +.account-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border: var(--border-width) solid var(--border); border-radius: calc(var(--radius) * 1.236); background: var(--background); } +.account-panel .account-avatar { width: 2.5rem; height: 2.5rem; padding: 0.5rem; border-radius: 50%; background: var(--accent); stroke-width: 1.5; } +.account-who { display: grid; flex: 1; min-width: 0; gap: 0.125rem; } +.account-who code { font-family: var(--font-mono); font-size: var(--text-14); color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.account-panel small { display: flex; align-items: center; gap: 0.25rem; color: var(--muted-foreground); font-size: 0.75rem; line-height: 1.4; } +.account-who small .glyph { width: 0.75rem; height: 0.75rem; } +.account-icon { display: grid; place-items: center; width: 2rem; height: 2rem; min-height: 0; padding: 0; border: 0; border-radius: var(--radius-control); background: none; color: var(--muted-foreground); cursor: pointer; } +.account-icon:hover { background: var(--accent); color: var(--foreground); } +.account-kit { display: flex; gap: 0.75rem; margin-top: 0.382rem; padding: 0.875rem; border: var(--border-width) solid var(--border-strong); border-radius: calc(var(--radius) * 1.236); } +.account-kit > span { display: grid; gap: 0.25rem; flex: 1; } +.account-kit small { display: block; margin-bottom: 0.5rem; } +.account-kit .primary { min-height: 2.25rem; font-size: var(--text-14); } +.account-group { margin: 1rem 0 0.125rem !important; padding: 0 0.625rem; color: var(--muted-foreground); font-size: 0.75rem; font-weight: 500; } +.account-panel .row { display: flex; align-items: center; justify-content: flex-start; gap: 0.75rem; width: 100%; min-height: 2.618rem; padding: 0.5rem 0.625rem; border: 0; border-radius: var(--radius-control); background: none; color: var(--foreground); font: inherit; text-align: start; cursor: pointer; transition: background var(--duration) var(--ease); } +.account-panel .row > span { display: grid; flex: 1; min-width: 0; } +.account-panel .row b { font-weight: 500; } +.account-panel .row > .glyph:first-child { color: var(--muted-foreground); } +.account-panel .row .chevron { width: 1rem; height: 1rem; color: var(--muted-foreground); opacity: 0.618; } .account-panel .row:hover { background: var(--accent); } -.account-panel .row:focus-visible, .account-panel .text:focus-visible, .account-close:focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--ring-offset); } +.account-panel .row:focus-visible, .account-panel .text:focus-visible, .account-close:focus-visible, .account-icon:focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--ring-offset); } .account-panel .primary { width: 100%; min-height: 2.618rem; font-size: 1rem; } .account-panel .account-in > p { margin-bottom: 0.618rem; color: var(--muted-foreground); } .account-panel .account-in > p b { color: var(--foreground); font-weight: 600; } diff --git a/frame/panels.mjs b/frame/panels.mjs index 5197171..18ebfa5 100644 --- a/frame/panels.mjs +++ b/frame/panels.mjs @@ -571,44 +571,53 @@ const short = (id) => `${id.slice(0, 15)}…${id.slice(-4)}`; const sentence = (text) => (text ? text[0].toUpperCase() + text.slice(1) + (/[.!?]$/.test(text) ? "" : ".") : text); const KIND_LABEL = { browser: "Browser", native: "App", mobile: "Phone", embedded: "Device", recovery: "Recovery kit" }; +// Lucide's outline icons, drawn at the text colour, so the panel reads as the kit does everywhere else. +const glyph = (d, cls = "") => ``; +const [USER, LOCK, COPY, SHIELD, CHEVRON, CHECK, BACK] = ['', '', '', '', '', '', '']; +const [LAPTOP, PLUS, LOGIN, USERS, BUOY, HEART, KEY] = ['', '', '', '', '', '', '']; +// One choice: what it does, and in a line, why you would want it. +const row = (id, icon, what, why, hidden = false) => ``; + const ACCOUNT_PANEL = ` - + - + `; const TITLES = { - held: ["Prism id", "Every Prism app knows you by it. There is nothing to sign in to."], - kit: ["Prism id", "Save your recovery kit: if you lose every device, it brings your id back. Anyone holding it can take your id, so keep it offline."], - offer: ["Add a device or app", ""], - join: ["Use your Prism id here", ""], - recover: ["Use a recovery kit", ""], - devices: ["Devices", "Removing one stops it signing the next time it syncs."], - guard: ["Add a guardian", "Your new kit then needs them too: a lost or copied kit alone cannot bring your id back."], + held: ["Prism ID", "Every Prism app knows you by this ID. There is no password to remember and no account to make."], + kit: ["Prism ID", "Every Prism app knows you by this ID. There is no password to remember and no account to make."], + offer: ["Add a device", ""], + join: ["Use an ID you already have", ""], + recover: ["Recover with a kit", ""], + devices: ["Your devices", "A device you remove can no longer act as you once it syncs."], + guard: ["Add a guardian", "Your new kit then needs them too, so a lost or copied kit alone cannot bring your ID back."], guardian: ["Be someone's guardian", ""], help: ["Help someone recover", ""], }; @@ -675,13 +684,13 @@ export function accounts(frame, core) { $("title").textContent = title; $("sub").textContent = sub; $("sub").hidden = !sub; - $("kit-save").hidden = !kit; + $("kit").hidden = !kit; for (const name of ["link", "devices", "guardian"]) $(name).hidden = !held; // A kit of one paper share can gain a guardian; one that has one cannot change it without them. $("guard").hidden = !held || guarded; $("help").hidden = !held || !guarding.length; $("back").hidden = view === "held"; - $("id").textContent = held ? short(held.prism) : "Making your Prism id"; + $("id").textContent = held ? short(held.prism) : "Making your Prism ID"; $("id").title = held?.prism ?? ""; } const show = (next) => { @@ -889,7 +898,7 @@ export function accounts(frame, core) { await forgetKit(); await session(Prism); show("held"); - say("This app uses your Prism id"); + say("This app uses your Prism ID"); }), ); @@ -941,7 +950,7 @@ export function accounts(frame, core) { accountChannel.session = null; await session(Prism); show("held"); - say("Prism id recovered"); + say("Prism ID recovered"); }), ); @@ -1100,14 +1109,13 @@ export function accounts(frame, core) { endLink(); show("held"); }); + // An icon button confirms with a check and says so; a word button says it in place. const copy = async (button, text) => { - try { - await navigator.clipboard.writeText(text); - button.textContent = "Copied"; - } catch { - button.textContent = "Select it"; - } - setTimeout(() => (button.textContent = "Copy"), 1600); + const was = button.innerHTML; + const done = await navigator.clipboard.writeText(text).then(() => "Copied", () => "Select it"); + if (button.classList.contains("account-icon")) (button.innerHTML = glyph(CHECK)), say(done); + else button.textContent = done; + setTimeout(() => (button.innerHTML = was), 1600); }; $("copy").addEventListener("click", () => copy($("copy"), held?.prism ?? "")); diff --git a/identity/test.mjs b/identity/test.mjs index a1df100..74df6f6 100644 --- a/identity/test.mjs +++ b/identity/test.mjs @@ -173,7 +173,7 @@ describe("the flow in Chromium", () => { test("the icon sits after full screen, and nothing asks to sign in", async () => { const order = await first.locator("prism-frame").evaluate((frame) => [...frame.shadowRoot.querySelector(".end").querySelectorAll("button")].map((b) => b.id)); assert.deepEqual(order.slice(-2), ["fullscreen", "account"]); - assert.equal(await first.locator("#account").getAttribute("aria-label"), "Prism id"); + assert.equal(await first.locator("#account").getAttribute("aria-label"), "Prism ID"); assert.equal(await first.locator("#account-panel").evaluate((panel) => panel.matches(":popover-open")), false); assert.equal(await account(first), null); }); @@ -187,7 +187,7 @@ describe("the flow in Chromium", () => { assert.equal(await first.locator("#account-panel").evaluate((panel) => panel.matches(":popover-open")), false); firstId = (await account(first)).id; await first.locator("#account").click(); - assert.equal(await first.locator("#account-title").textContent(), "Prism id"); + assert.equal(await first.locator("#account-title").textContent(), "Prism ID"); assert.equal(await first.getByText(/sign in/i).count(), 0); assert.equal(relay.requests, asked); const [download] = await Promise.all([first.waitForEvent("download"), first.locator("#account-kit-save").click()]);