Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Notes titles and snippets written plain, as Apple stores them (gzipped ones showed garbled on icloud.com — 18 repaired); real submenus (Add to List ▸), pop-up menus drawn over everything with the choice on the button, menus focus once shown, Escape in a pop-up closes only it, a choice in a popover's menu keeps the popover; Drive Recents
Yashwanth Kamireddifa9f67db195d
diff --git a/.uiverify/contacts-lists.mjs b/.uiverify/contacts-lists.mjsindex 5a9367f..a884cfb 100644--- a/.uiverify/contacts-lists.mjs+++ b/.uiverify/contacts-lists.mjs@@ -34,7 +34,8 @@ check(JSON.stringify(await people()) === JSON.stringify(["Amma"]), "a list shows// Add by the right-click menu, a step into its lists.await row("All Contacts").locator(".notes-folder").click();await page.locator(".contact-row", { hasText: "Zoya Ahuja" }).click({ button: "right" });-await page.getByRole("menuitem", { name: "Add to List…" }).click();+// "Add to List" opens its lists beside it, as a Mac submenu does.+await page.getByRole("menuitem", { name: "Add to List" }).hover();await page.getByRole("menuitem", { name: "Family" }).click();await page.waitForTimeout(quick);check((await count("Family")) === 2, "added by menu, the count moves at once");diff --git a/.uiverify/drive-recents.mjs b/.uiverify/drive-recents.mjsnew file mode 100644index 0000000..c11e528--- /dev/null+++ b/.uiverify/drive-recents.mjs@@ -0,0 +1,39 @@+// Recents: the files opened lately, under Today, Yesterday and on back, as icloud.com and+// Finder group them; a double-click saves one — even one in a folder never opened here.+import { engine } from "./engine.mjs";+import { SERVICES, installStub } from "./stub.mjs";+const b = await engine.launch();+const ctx = await b.newContext({ viewport: { width: 1280, height: 800 } });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, driveFixture: true });+await ctx.addInitScript(() => {+ const t = setInterval(() => {+ const i = window.__TAURI_INTERNALS__;+ if (!i || i.__r) return;+ i.__r = true;+ const inner = i.invoke;+ i.invoke = async (cmd, args) => {+ if (cmd === "drive_download") { (window.__downloads ??= []).push(args); return `/home/test/Downloads/${args.item?.name ?? "x"}.pdf`; }+ return inner(cmd, args);+ };+ clearInterval(t);+ }, 0);+});+const page = await ctx.newPage();+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });+await page.locator(".nav-item", { hasText: "iCloud Drive" }).click();+await page.waitForTimeout(300);+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };+await page.getByRole("button", { name: "Recents" }).click();+await page.waitForTimeout(300);+const headings = await page.locator(".drive-group").allInnerTexts();+ok(JSON.stringify(headings.slice(0, 2)) === JSON.stringify(["Today", "Yesterday"]) && headings.length === 3, `grouped by when they were opened ${JSON.stringify(headings)}`);+await page.locator("button.drive-row-hit", { hasText: "Invoice" }).dblclick();+await page.waitForTimeout(200);+const sent = await page.evaluate(() => window.__downloads?.at(-1));+ok(sent?.drivewsid === "FILE::r1" && sent?.item?.name === "Invoice-0001", "a double-click saves it, with the file's details sent along");+ok(/Saved to/.test(await page.locator(".drive-saved").innerText()), "and says where");+await page.locator(".crumb", { hasText: "iCloud Drive" }).click();+ok((await page.locator(".drive-group").count()) === 0, "the breadcrumb goes back to iCloud Drive");+await b.close();+process.exitCode = failures ? 1 : 0;diff --git a/.uiverify/menus.mjs b/.uiverify/menus.mjsnew file mode 100644index 0000000..520b6a9--- /dev/null+++ b/.uiverify/menus.mjs@@ -0,0 +1,116 @@+// Every kind of menu, where menus went wrong: near the window's edges, inside a popover, in a+// small window. Each must open whole and on screen, in one draw (no flicker), take the keys,+// and go on Escape or a click elsewhere; a pop-up's menu lies over its button with the+// current choice on it; a submenu opens beside its line and flips left when the right is full.+import { engine } from "./engine.mjs";+import { SERVICES, installStub, openScreen } from "./stub.mjs";+const b = await engine.launch();+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };+const all = { notesFixture: true, calendarFixture: true, contactsFixture: true, driveFixture: true, remindersFixture: true };++/** Watch menus being added: one insertion per opening is drawn once. */+const watch = (page) => page.evaluate(() => {+ window.__menus = 0;+ window.__mw?.disconnect();+ window.__mw = new MutationObserver((m) => {+ for (const r of m) for (const n of r.addedNodes) if (n.nodeType === 1 && (n.matches?.(".row-menu, .picker-menu") || n.querySelector?.(".row-menu, .picker-menu"))) window.__menus++;+ });+ window.__mw.observe(document.body, { childList: true, subtree: true });+});+/** The menu wholly in the window, and on top where it is drawn. */+const onScreen = (page, sel) => page.evaluate((sel) => {+ const els = [...document.querySelectorAll(sel)];+ if (!els.length) return { ok: false, why: "no menu" };+ for (const el of els) {+ const r = el.getBoundingClientRect();+ if (r.left < 0 || r.top < 0 || r.right > innerWidth || r.bottom > innerHeight) return { ok: false, why: `off screen ${JSON.stringify([r.left, r.top, r.right, r.bottom])} in ${innerWidth}x${innerHeight}` };+ const hit = document.elementFromPoint(r.left + r.width / 2, r.top + Math.min(14, r.height / 2));+ if (!el.contains(hit)) return { ok: false, why: `covered by ${hit?.className}` };+ }+ return { ok: true };+}, sel);++for (const size of [{ width: 1280, height: 800 }, { width: 760, height: 520 }]) {+ const label = `${size.width}x${size.height}`;+ const ctx = await b.newContext({ viewport: size });+ await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, ...all });+ const page = await ctx.newPage();+ await page.goto("http://localhost:4173", { waitUntil: "networkidle" });++ // A right-click menu in the bottom-right corner, and its submenu with no room on the right.+ await openScreen(page, "Contacts");+ await page.waitForTimeout(300);+ await watch(page);+ await page.locator(".contact-row").first().click({ button: "right", position: { x: 5, y: 5 } });+ await page.mouse.click(0, 0); // gone on a click elsewhere+ ok((await page.locator(".row-menu").count()) === 0, `${label} a click elsewhere closes a menu`);+ const row = page.locator(".contact-row").first();+ const box = await row.boundingBox();+ await page.mouse.click(size.width - 6, size.height - 6, { button: "right" }).catch(() => {});+ await row.dispatchEvent("contextmenu", { clientX: size.width - 6, clientY: size.height - 6, bubbles: true });+ await page.waitForTimeout(100);+ let where = await onScreen(page, ".row-menu");+ ok(where.ok, `${label} a right-click menu at the corner stays on screen ${where.why ?? ""}`);+ await page.getByRole("menuitem", { name: "Add to List" }).hover();+ await page.waitForTimeout(100);+ where = await onScreen(page, ".row-menu");+ ok(where.ok && (await page.locator(".row-menu").count()) === 2, `${label} its submenu opens beside it, on screen ${where.why ?? ""}`);+ const [parent, child] = await page.locator(".row-menu").evaluateAll((els) => els.map((e) => e.getBoundingClientRect().toJSON()));+ ok(child && (child.left >= parent.right - 4 || child.right <= parent.left + 4), `${label} beside, not over, its line`);+ await page.keyboard.press("Escape");+ ok((await page.locator(".row-menu").count()) === 1, `${label} Escape closes the submenu first`);+ await page.keyboard.press("Escape");+ ok((await page.locator(".row-menu").count()) === 0, `${label} and then the menu`);+ // Keyboard: Down, Right into the submenu, Enter chooses — and everything closes.+ await row.click({ button: "right" });+ await page.waitForTimeout(80);+ await page.keyboard.press("ArrowDown");+ await page.keyboard.press("ArrowRight");+ await page.waitForTimeout(80);+ ok((await page.locator(".row-menu").count()) === 2 && (await page.locator(".row-menu").nth(1).locator(".is-active").count()) === 1, `${label} → opens the submenu with its first line ready`);+ await page.keyboard.press("Enter");+ await page.waitForTimeout(80);+ ok((await page.locator(".row-menu").count()) === 0, `${label} choosing in a submenu closes every level`);++ // A pop-up inside the event popover, at the bottom of the window.+ await openScreen(page, "Calendar");+ await page.keyboard.press("Control+2");+ await page.waitForTimeout(300);+ await page.keyboard.press("Control+n");+ await page.waitForTimeout(300);+ await watch(page);+ const picker = page.locator(".cx-popover .picker-button").last();+ const pb = await picker.boundingBox();+ await picker.click();+ await page.waitForTimeout(100);+ where = await onScreen(page, ".picker-menu");+ ok(where.ok, `${label} a pop-up's menu inside a popover is whole and on screen ${where.why ?? ""}`);+ const chosen = await page.locator(".picker-menu [aria-selected=true]").boundingBox();+ ok(chosen && Math.abs(chosen.y + chosen.height / 2 - (pb.y + pb.height / 2)) < 14 || where.ok && (await page.evaluate(() => document.querySelector(".picker-menu").getBoundingClientRect().bottom >= innerHeight - 9)),+ `${label} its current choice lies over the button (or the menu is held at the window's edge)`);+ ok((await page.evaluate(() => window.__menus)) === 1, `${label} drawn once, no flicker`);+ await page.keyboard.press("Escape");+ ok((await page.locator(".picker-menu").count()) === 0, `${label} Escape closes a pop-up's menu`);+ ok(await page.evaluate(() => document.activeElement?.classList.contains("picker-button")), `${label} and focus goes back to its button`);+ // By keyboard alone: ↓ opens it, ↓ moves, Return takes the choice.+ const before = await picker.innerText();+ await page.keyboard.press("ArrowDown");+ await page.waitForTimeout(60);+ await page.keyboard.press("ArrowDown");+ await page.keyboard.press("Enter");+ await page.waitForTimeout(60);+ ok((await picker.innerText()) !== before && (await page.locator(".picker-menu").count()) === 0, `${label} the keyboard alone changes a pop-up [${before.trim()} → ${(await picker.innerText()).trim()}]`);+ // Chosen with the mouse, the popover it is in stays open with the choice made — the menu+ // is drawn outside the popover, and a press there must not read as a press elsewhere.+ const was = await picker.innerText();+ await picker.click();+ await page.waitForTimeout(80);+ await page.locator(".picker-menu [role=option]:not([aria-selected=true])").first().click();+ await page.waitForTimeout(80);+ ok((await page.locator(".cx-popover").count()) === 1 && (await picker.innerText()) !== was, `${label} a choice made with the mouse keeps the popover open`);+ await page.keyboard.press("Escape");+ await ctx.close();+}+await b.close();+process.exitCode = failures ? 1 : 0;diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjsindex 8f0a1f2..28d974f 100644--- a/.uiverify/stub.mjs+++ b/.uiverify/stub.mjs@@ -272,6 +272,13 @@ export function installStub({ screen, services, twoFactor, calendarFixture, notecase "drive_duplicate": (window.__dups ??= []).push(args.drivewsid); return null;case "storage_info": return { usedBytes: 182196857, totalBytes: 5368709120 };case "drive_children": return !driveFixture ? [] : driveItems;+ case "drive_recents": {+ if (!driveFixture) return [];+ const now = Math.floor(Date.now() / 1000);+ const f = (id, name, ext, opened) => ({ drivewsid: `FILE::r${id}`, parentId: "FOLDER::x", name, extension: ext, kind: "FILE",+ size: 34145, childCount: null, createdAt: now - 9e6, modifiedAt: now - 9e6, etag: "e", openedAt: opened });+ return [f(1, "Invoice-0001", "pdf", now - 600), f(2, "Boarding pass", "pdf", now - 86400 - 3600), f(3, "Lease", "pdf", now - 40 * 86400)];+ }case "drive_trash": return !driveFixture ? [] : (window.__trash ??= [{ drivewsid: "FILE::t1", parentId: null, name: "Old notes", extension: "pdf", kind: "FILE",size: 177000, childCount: null, createdAt: 1786000000, modifiedAt: 1786000000, etag: "t1",diff --git a/check.sh b/check.shindex b271c52..1e6ed20 100755--- a/check.sh+++ b/check.sh@@ -65,8 +65,11 @@ step "contacts order" node .uiverify/contacts-order.mjsstep "contacts lists" node .uiverify/contacts-lists.mjsstep "drive keys" node .uiverify/drive-keys.mjsstep "drive drag" node .uiverify/drive-drag.mjs+step "drive recents" node .uiverify/drive-recents.mjsstep "reminder colours" node .uiverify/calendar-reminder-colour.mjsstep "calendar dblclick" node .uiverify/calendar-dblclick.mjs+step "menus" node .uiverify/menus.mjs+step "webkit: menus" env ENGINE=webkit node .uiverify/menus.mjsstep "contacts vcard" node .uiverify/contacts-vcard.mjsstep "contacts select" node .uiverify/contacts-select.mjsstep "calendar alerts" node .uiverify/calendar-alerts.mjsdiff --git a/crates/quince-icloud/src/ckdocument.rs b/crates/quince-icloud/src/ckdocument.rsindex 084104f..8d2206d 100644--- a/crates/quince-icloud/src/ckdocument.rs+++ b/crates/quince-icloud/src/ckdocument.rs@@ -195,14 +195,15 @@ pub fn text_to_base64(text: &str) -> String {B64.encode(gzip(&document_bytes(text)))}-/// Encode text the way Apple stores a note's title and snippet: gzipped UTF-8, with no-/// document wrapper around it.+/// Encode text the way Apple stores a note's title and snippet: plain UTF-8, base64 — no+/// compression and no document wrapper.///-/// The decoder already falls back to this shape on the way in; writing the wrapped form-/// here instead would put protobuf framing into the title a phone displays.+/// Measured on a real account: every title and snippet a phone or icloud.com wrote is plain;+/// every one this app wrote gzipped showed on icloud.com as the gzip's bytes — "▒▒▒KNU(…" —+/// in the note list. Writing the wrapped form would put protobuf framing there instead.#[must_use]pub fn bare_text_to_base64(text: &str) -> String {- B64.encode(gzip(text.as_bytes()))+ B64.encode(text.as_bytes())}/// A length-delimited protobuf field: `(tag << 3) | 2`, then the length, then the payload.diff --git a/probe/examples/notes_title_encoding.rs b/probe/examples/notes_title_encoding.rsnew file mode 100644index 0000000..5d42f3b--- /dev/null+++ b/probe/examples/notes_title_encoding.rs@@ -0,0 +1,71 @@+//! Read-only: how each note's TitleEncrypted is encoded — plain UTF-8 or gzip — and what it+//! says, beside the text's first line. Shows which notes icloud.com would show garbled.+use anyhow::{anyhow, Result};+use base64::Engine;+#[tokio::main]+async fn main() -> Result<()> {+ let dir = std::path::PathBuf::from(std::env::var("HOME")?).join(".local/share/quince-probe");+ let mut client = quince_auth::Client::new(&dir)?;+ if !client.resume().await? {+ return Err(anyhow!("no session"));+ }+ let root = client+ .session()+ .service_url("ckdatabasews")+ .ok_or_else(|| anyhow!("no ck"))?;+ let (http, p) = (client.http().clone(), client.service_params());+ let zc = quince_icloud::cloudkit::ZoneClient::new(&http, &root, "com.apple.notes", p.clone());+ let walk = zc.all_records("Notes", None).await?;+ for r in walk.records.iter().filter(|r| r["recordType"] == "Note") {+ let f = &r["fields"];+ let raw = |k: &str| {+ f[k]["value"]+ .as_str()+ .and_then(|v| {+ base64::engine::general_purpose::STANDARD+ .decode(v.trim())+ .ok()+ })+ .unwrap_or_default()+ };+ let t = raw("TitleEncrypted");+ let s = raw("SnippetEncrypted");+ let kind = |b: &[u8]| {+ if b.starts_with(&[0x1f, 0x8b]) {+ "GZIP"+ } else if std::str::from_utf8(b).is_ok() {+ "plain"+ } else {+ "bytes"+ }+ };+ let first = f["TextDataEncrypted"]["value"]+ .as_str()+ .and_then(quince_icloud::ckdocument::text_from_base64)+ .unwrap_or_default();+ println!(+ "{} title={} snippet={} folder={} | {:?} | first line {:?}",+ r["recordName"]+ .as_str()+ .unwrap_or("")+ .chars()+ .take(12)+ .collect::<String>(),+ kind(&t),+ kind(&s),+ f["Folder"]["value"]["recordName"].as_str().unwrap_or("-"),+ String::from_utf8_lossy(&t)+ .chars()+ .take(30)+ .collect::<String>(),+ first+ .lines()+ .next()+ .unwrap_or("")+ .chars()+ .take(30)+ .collect::<String>()+ );+ }+ Ok(())+}diff --git a/probe/examples/notes_title_repair.rs b/probe/examples/notes_title_repair.rsnew file mode 100644index 0000000..8967557--- /dev/null+++ b/probe/examples/notes_title_repair.rs@@ -0,0 +1,66 @@+//! Live: put back, as plain text, every note title and snippet this app wrote gzipped —+//! which icloud.com showed as the gzip's bytes. Only those two fields are written, each to+//! exactly the text it already holds; the note itself is not touched. `--apply` to write.+use anyhow::{anyhow, Result};+use base64::Engine;+#[tokio::main]+async fn main() -> Result<()> {+ let apply = std::env::args().any(|a| a == "--apply");+ let dir = std::path::PathBuf::from(std::env::var("HOME")?).join(".local/share/quince-probe");+ let mut client = quince_auth::Client::new(&dir)?;+ if !client.resume().await? {+ return Err(anyhow!("no session"));+ }+ let root = client+ .session()+ .service_url("ckdatabasews")+ .ok_or_else(|| anyhow!("no ck"))?;+ let (http, p) = (client.http().clone(), client.service_params());+ let zc = quince_icloud::cloudkit::ZoneClient::new(&http, &root, "com.apple.notes", p.clone());+ let walk = zc.all_records("Notes", None).await?;+ let b64 = base64::engine::general_purpose::STANDARD;+ let mut n = 0;+ for r in walk.records.iter().filter(|r| r["recordType"] == "Note") {+ let f = &r["fields"];+ let mut changes = serde_json::Map::new();+ for key in ["TitleEncrypted", "SnippetEncrypted"] {+ let Some(raw) = f[key]["value"]+ .as_str()+ .and_then(|v| b64.decode(v.trim()).ok())+ else {+ continue;+ };+ if !raw.starts_with(&[0x1f, 0x8b]) {+ continue;+ }+ let mut text = String::new();+ std::io::Read::read_to_string(&mut flate2::read::GzDecoder::new(&raw[..]), &mut text)?;+ changes.insert(key.into(), serde_json::json!({ "type": "ENCRYPTED_BYTES", "value": quince_icloud::ckdocument::bare_text_to_base64(&text) }));+ }+ if changes.is_empty() {+ continue;+ }+ let name = r["recordName"].as_str().unwrap_or("");+ println!("{name}: {:?}", changes.keys().collect::<Vec<_>>());+ if apply {+ zc.update_record(+ "Notes",+ name,+ "Note",+ r["recordChangeTag"].as_str(),+ serde_json::Value::Object(changes),+ )+ .await?;+ }+ n += 1;+ }+ println!(+ "{n} note(s) {}",+ if apply {+ "repaired"+ } else {+ "to repair (dry run)"+ }+ );+ Ok(())+}diff --git a/src/components/Picker.tsx b/src/components/Picker.tsxindex 94beb48..023a507 100644--- a/src/components/Picker.tsx+++ b/src/components/Picker.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";+import { Portal } from "./Portal";export type PickerOption = { value: string; label: string };@@ -39,15 +40,40 @@ export function Picker({const current = options.find((o) => o.value === value);- // Where there is room: below, as usual, or above when the menu would run off the bottom of- // the window — near the foot of a popover it did, and its choices could not be reached.+ /**+ * Where the menu sits, as a Mac pop-up button places it: over the button, the current+ * choice lying exactly on it, so the eye does not have to move — and then kept inside the+ * window, scrolling if it is taller than the window.+ *+ * Drawn in a layer of its own over everything (a portal), never inside the control's own+ * box. Inside a popover, a scrolling list or a clipped pane the menu was cut off, flipped+ * after being drawn, or sat at the wrong place under a transformed ancestor — the menu+ * problems that kept coming back. Placed before it is painted, so it never jumps.+ */const menu = useRef<HTMLUListElement | null>(null);- const [up, setUp] = useState(false);+ const [place, setPlace] = useState<{ left: number; top: number; width: number; maxHeight: number } | null>(null);useLayoutEffect(() => {- if (!open || !menu.current || !button.current) return;+ if (!open || !menu.current || !button.current) {+ setPlace(null);+ return;+ }const b = button.current.getBoundingClientRect();- const h = menu.current.getBoundingClientRect().height;- setUp(b.bottom + 4 + h > window.innerHeight - 8 && b.top - 4 - h > 8);+ const list = menu.current;+ const chosen = items.current[Math.max(0, options.findIndex((o) => o.value === value))];+ const pad = 8;+ const maxHeight = window.innerHeight - pad * 2;+ const height = Math.min(list.scrollHeight, maxHeight);+ const width = Math.max(b.width, list.scrollWidth);+ // The chosen row's label over the button's label.+ const rowTop = chosen ? chosen.offsetTop : 0;+ let top = b.top - rowTop + (b.height - (chosen?.offsetHeight ?? b.height)) / 2;+ top = Math.max(pad, Math.min(top, window.innerHeight - pad - height));+ const left = Math.max(pad, Math.min(b.left - 4, window.innerWidth - pad - width));+ setPlace({ left, top, width, maxHeight });+ // Taller than the window: scrolled so the chosen row is in view.+ if (chosen && list.scrollHeight > maxHeight) list.scrollTop = Math.max(0, rowTop - (b.top - top));+ // On opening only: what is chosen does not move the menu while it is open.+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [open]);const close = useCallback(@@ -78,26 +104,44 @@ export function Picker({// Focus follows the keyboard, not the pointer. Moving focus on every hover made the// browser re-scroll and repaint the menu under the mouse, which read as flicker.const byKeyboard = useRef(true);+ // Only once the menu is placed and showing: it is drawn hidden while it is measured, and+ // a hidden element cannot take focus — the first key went nowhere.+ const shown = open && place !== null;useEffect(() => {- if (open && byKeyboard.current) items.current[active]?.focus({ preventScroll: false });- }, [open, active]);+ if (shown && byKeyboard.current) items.current[active]?.focus({ preventScroll: true });+ }, [shown, active]);useEffect(() => {- if (open) {+ if (shown) {byKeyboard.current = true;items.current[active]?.focus({ preventScroll: true });}// Only on opening.// eslint-disable-next-line react-hooks/exhaustive-deps- }, [open]);+ }, [shown]);// Clicking anywhere else dismisses the menu, which is what every menu does.useEffect(() => {if (!open) return undefined;const onDown = (e: MouseEvent) => {- if (!root.current?.contains(e.target as Node)) setOpen(false);+ const t = e.target as Node;+ if (!root.current?.contains(t) && !menu.current?.contains(t)) setOpen(false);};+ // A menu fixed over a page that scrolls or resizes would be left floating somewhere+ // else; as on the Mac, it goes. Its own scrolling is not that.+ const onMove = (e: Event) => {+ if (!menu.current?.contains(e.target as Node)) setOpen(false);+ };+ const onLeave = () => setOpen(false);document.addEventListener("mousedown", onDown);- return () => document.removeEventListener("mousedown", onDown);+ document.addEventListener("scroll", onMove, true);+ window.addEventListener("resize", onLeave);+ window.addEventListener("blur", onLeave);+ return () => {+ document.removeEventListener("mousedown", onDown);+ document.removeEventListener("scroll", onMove, true);+ window.removeEventListener("resize", onLeave);+ window.removeEventListener("blur", onLeave);+ };}, [open]);const onListKey = (e: React.KeyboardEvent) => {@@ -115,6 +159,8 @@ export function Picker({choose(active);} else if (e.key === "Escape" || e.key === "Tab") {e.preventDefault();+ // Escape closes the menu and nothing more — not the popover or sheet it is in.+ if (e.key === "Escape") e.stopPropagation();close(true);}};@@ -144,7 +190,19 @@ export function Picker({</button>{open && (- <ul ref={menu} className={`picker-menu${up ? " is-up" : ""}`} role="listbox" id={listId} aria-label={label}>+ <Portal>+ <ul+ ref={menu}+ className="picker-menu"+ role="listbox"+ id={listId}+ aria-label={label}+ style={+ place+ ? { left: place.left, top: place.top, minWidth: place.width, maxHeight: place.maxHeight }+ : { left: 0, top: 0, visibility: "hidden" }+ }+ >{options.map((option, index) => (<likey={option.value}@@ -169,6 +227,7 @@ export function Picker({</li>))}</ul>+ </Portal>)}</div>);diff --git a/src/components/Portal.tsx b/src/components/Portal.tsxindex 8bdeef1..9e2228a 100644--- a/src/components/Portal.tsx+++ b/src/components/Portal.tsx@@ -9,3 +9,12 @@ import { createPortal } from "react-dom";export function Portal({ children }: { children: React.ReactNode }) {return createPortal(children, document.body);}++/**+ * Whether a press landed in a menu drawn in this top layer. A popover or sheet closes on a+ * press outside itself, but a menu it opened is drawn out here, not inside it: choosing+ * from that menu read as a press elsewhere and closed the popover with the choice.+ */+export function inMenu(target: EventTarget | null): boolean {+ return Boolean((target as HTMLElement | null)?.closest?.(".picker-menu, .row-menu"));+}diff --git a/src/components/RowMenu.tsx b/src/components/RowMenu.tsxindex b1f31f1..aeda59c 100644--- a/src/components/RowMenu.tsx+++ b/src/components/RowMenu.tsx@@ -1,36 +1,29 @@import { Portal } from "./Portal";import { useEffect, useLayoutEffect, useRef, useState } from "react";-/** `keep` leaves the menu open — for an entry that leads on to a second step of choices. */-export type MenuEntry = { label: string; run: () => void; danger?: boolean; keep?: boolean } | null;+/**+ * One line of a menu, or `null` for a separator. An entry with `submenu` leads on to a menu+ * of its own, opened beside it as macOS opens one; `keep` leaves the menu open after `run`.+ */+export type MenuEntry =+ | { label: string; run?: () => void; danger?: boolean; keep?: boolean; submenu?: MenuEntry[] }+ | null;++type Anchor = { x: number; y: number; alignRight: boolean };/*** A menu as macOS draws one: under the ⋯ that opened it or at the pointer for a right-click,- * kept on screen, arrows to move, Return to choose, Escape or a click elsewhere to leave.+ * kept on screen; arrows to move, Return to choose, Escape or a click elsewhere to leave.+ * A line with a submenu shows ▸ and opens it beside itself on hover, Return or →, to the+ * right where there is room and the left where there is not; ← or Escape closes it again.+ * Choosing anything, at any depth, closes every level.*/-export function RowMenu({ at, entries, onClose }: {- at: { x: number; y: number; alignRight: boolean };- entries: MenuEntry[];- onClose: () => void;-}) {- const box = useRef<HTMLDivElement | null>(null);- const [pos, setPos] = useState({ left: at.x, top: at.y });- const items = entries.filter((e): e is NonNullable<MenuEntry> => e !== null);- const [active, setActive] = useState(0);- useLayoutEffect(() => {- const el = box.current;- if (!el) return;- const { width, height } = el.getBoundingClientRect();- let left = at.alignRight ? at.x - width : at.x;- let top = at.y;- left = Math.max(8, Math.min(left, window.innerWidth - width - 8));- if (top + height > window.innerHeight - 8) top = Math.max(8, at.y - height - (at.alignRight ? 36 : 0));- setPos({ left, top });- setActive(0);- el.focus();- }, [at]);+export function RowMenu({ at, entries, onClose }: { at: Anchor; entries: MenuEntry[]; onClose: () => void }) {useEffect(() => {- const down = (e: MouseEvent) => { if (!box.current?.contains(e.target as Node)) onClose(); };+ // Any press outside every level of this menu dismisses it.+ const down = (e: MouseEvent) => {+ if (!(e.target as HTMLElement | null)?.closest?.(".row-menu")) onClose();+ };const away = () => onClose();document.addEventListener("mousedown", down);window.addEventListener("blur", away);@@ -41,46 +34,154 @@ export function RowMenu({ at, entries, onClose }: {window.removeEventListener("resize", away);};}, [onClose]);- const pick = (i: number) => {- const item = items[i];- if (!item?.keep) onClose();- item?.run();- };- let n = -1;return (<Portal>- <div- ref={box}- className="row-menu"- role="menu"- tabIndex={-1}- style={{ left: pos.left, top: pos.top }}- onKeyDown={(e) => {- if (e.key === "Escape") { e.preventDefault(); onClose(); }- else if (e.key === "ArrowDown") { e.preventDefault(); setActive((a) => (a + 1) % items.length); }- else if (e.key === "ArrowUp") { e.preventDefault(); setActive((a) => (a - 1 + items.length) % items.length); }- else if (e.key === "Enter" || e.key === " ") { e.preventDefault(); pick(active); }- }}- >- {entries.map((entry, i) => {- if (!entry) return <div key={`sep${i}`} className="row-menu-sep" role="separator" />;- n += 1;- const index = n;- return (- <button- key={entry.label}- role="menuitem"- tabIndex={-1}- className={`row-menu-item${entry.danger ? " is-danger" : ""}${index === active ? " is-active" : ""}`}- onMouseEnter={() => setActive(index)}- onClick={() => pick(index)}- >- {entry.label}- </button>- );- })}- </div>+ <Panel entries={entries} anchor={{ kind: "point", ...at }} onDone={onClose} onBack={onClose} focusFirst={false} /></Portal>);}+type PanelAnchor =+ | ({ kind: "point" } & Anchor)+ /** Beside a parent menu's line: its rectangle. */+ | { kind: "beside"; rect: DOMRect };++function Panel({+ entries,+ anchor,+ onDone,+ onBack,+ focusFirst,+}: {+ entries: MenuEntry[];+ anchor: PanelAnchor;+ /** Something was chosen: every level closes. */+ onDone: () => void;+ /** This level closes, back to the one that opened it. */+ onBack: () => void;+ /** Opened by the keyboard: the first line is highlighted, as on the Mac. */+ focusFirst: boolean;+}) {+ const box = useRef<HTMLDivElement | null>(null);+ const lines = useRef<(HTMLButtonElement | null)[]>([]);+ const items = entries.filter((e): e is NonNullable<MenuEntry> => e !== null);+ const [pos, setPos] = useState<{ left: number; top: number } | null>(null);+ // Nothing highlighted until the pointer or a key says so, as a Mac menu opens.+ const [active, setActive] = useState(focusFirst ? 0 : -1);+ const [sub, setSub] = useState<{ index: number; byKeyboard: boolean } | null>(null);++ useLayoutEffect(() => {+ const el = box.current;+ if (!el) return;+ const { width, height } = el.getBoundingClientRect();+ const pad = 8;+ let left: number;+ let top: number;+ if (anchor.kind === "point") {+ left = anchor.alignRight ? anchor.x - width : anchor.x;+ top = anchor.y;+ if (top + height > window.innerHeight - pad) top = anchor.y - height - (anchor.alignRight ? 36 : 0);+ } else {+ // Beside the line, its first item level with it; to the left when the right is full.+ const r = anchor.rect;+ left = r.right + 2 + width <= window.innerWidth - pad ? r.right + 2 : r.left - 2 - width;+ top = r.top - 5;+ }+ left = Math.max(pad, Math.min(left, window.innerWidth - width - pad));+ top = Math.max(pad, Math.min(top, window.innerHeight - height - pad));+ setPos({ left, top });+ // Placed once, where it opened.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);+ // Focus once it is placed: drawn hidden while it is measured, and a hidden element cannot+ // take focus — the keys went to whatever had it before.+ const placed = pos !== null;+ useLayoutEffect(() => {+ if (placed) box.current?.focus({ preventScroll: true });+ }, [placed]);++ const choose = (i: number, byKeyboard: boolean) => {+ const item = items[i];+ if (!item) return;+ if (item.submenu) {+ setSub({ index: i, byKeyboard });+ return;+ }+ if (!item.keep) onDone();+ item.run?.();+ };++ let n = -1;+ const open = sub ? items[sub.index] : null;+ return (+ <>+ <div+ ref={box}+ className="row-menu"+ role="menu"+ tabIndex={-1}+ style={pos ? { left: pos.left, top: pos.top } : { left: 0, top: 0, visibility: "hidden" }}+ onKeyDown={(e) => {+ // Keys belong to the deepest open level.+ if (sub) return;+ const move = (by: number) => {+ e.preventDefault();+ setActive((a) => (a < 0 ? (by > 0 ? 0 : items.length - 1) : (a + by + items.length) % items.length));+ };+ if (e.key === "Escape" || e.key === "ArrowLeft") {+ e.preventDefault();+ e.stopPropagation();+ onBack();+ } else if (e.key === "ArrowDown") move(1);+ else if (e.key === "ArrowUp") move(-1);+ else if ((e.key === "Enter" || e.key === " " || e.key === "ArrowRight") && active >= 0) {+ e.preventDefault();+ if (e.key === "ArrowRight" && !items[active]?.submenu) return;+ choose(active, true);+ }+ }}+ >+ {entries.map((entry, i) => {+ if (!entry) return <div key={`sep${i}`} className="row-menu-sep" role="separator" />;+ n += 1;+ const index = n;+ return (+ <button+ key={`${entry.label}-${index}`}+ ref={(el) => {+ lines.current[index] = el;+ }}+ role="menuitem"+ tabIndex={-1}+ aria-haspopup={entry.submenu ? "menu" : undefined}+ aria-expanded={entry.submenu ? sub?.index === index : undefined}+ className={`row-menu-item${entry.danger ? " is-danger" : ""}${index === active ? " is-active" : ""}${entry.submenu ? " has-submenu" : ""}`}+ onMouseEnter={() => {+ setActive(index);+ // Hovering a line with a submenu opens it; any other line closes one.+ setSub(entry.submenu ? { index, byKeyboard: false } : null);+ }}+ onClick={() => choose(index, false)}+ >+ <span className="row-menu-label">{entry.label}</span>+ {entry.submenu && <span className="row-menu-chevron" aria-hidden="true">›</span>}+ </button>+ );+ })}+ </div>+ {open?.submenu && sub && lines.current[sub.index] && (+ <Panel+ key={sub.index}+ entries={open.submenu}+ anchor={{ kind: "beside", rect: lines.current[sub.index]!.getBoundingClientRect() }}+ onDone={onDone}+ onBack={() => {+ setSub(null);+ box.current?.focus({ preventScroll: true });+ }}+ focusFirst={sub.byKeyboard}+ />+ )}+ </>+ );+}diff --git a/src/screens/ContactsView.tsx b/src/screens/ContactsView.tsxindex 21d5746..2adb53c 100644--- a/src/screens/ContactsView.tsx+++ b/src/screens/ContactsView.tsx@@ -299,7 +299,8 @@ export function ContactsView() {];}return [- { label: "Add to List\u2026", keep: true, run: () => setContactMenu((m) => (m ? { ...m, lists: true } : m)) },+ // A submenu of the lists, beside the line, as Contacts on the Mac has it.+ { label: "Add to List", submenu: contactEntries(c, true) },...(openList ? [{ label: `Remove from \u201c${openList.name}\u201d`, run: () => removeFromList(openList, [c.guid]) }] : []),null,{ label: "Edit Contact", run: () => { setOpenGuid(c.guid); setDraft({ ...c }); } },diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex 7145b6f..e6dedad 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -12,6 +12,7 @@ import {DRIVE_ROOT,UPLOAD,type DriveItem,+ type RecentItem,type TrashItem,type UploadEvent,} from "../lib/ipc";@@ -20,7 +21,8 @@ import { UploadTray } from "../components/UploadTray";import { listen } from "@tauri-apps/api/event";import { Picker } from "../components/Picker";import { RowMenu } from "../components/RowMenu";-import { dateText } from "../lib/when";+import { dateText, timeText } from "../lib/when";+import { Clock } from "lucide-react";/** iCloud Drive's own four orders, as its "by Name" menu offers them. */const SORTS = [@@ -166,6 +168,140 @@ function DriveTrash({ onClose }: { onClose: () => void }) {);}+/**+ * Recents, as icloud.com and Finder have it: the files opened most recently, under Today,+ * Yesterday, Previous 7 Days, Previous 30 Days and then each month. Read from Apple each+ * time it is opened, since what was opened on the phone a minute ago belongs here too.+ */+function DriveRecents({ onClose }: { onClose: () => void }) {+ const [rows, setRows] = useState<RecentItem[] | null>(null);+ const [error, setError] = useState<string | null>(null);+ const [savedTo, setSavedTo] = useState<string | null>(null);+ const [busy, setBusy] = useState<string | null>(null);+ const [selected, setSelected] = useState<string | null>(null);+ const [menu, setMenu] = useState<{ item: RecentItem; x: number; y: number; alignRight: boolean } | null>(null);+ useEffect(() => {+ api.driveRecents().then(+ (found) => setRows(Array.isArray(found) ? found : []),+ (e) => {+ setError(messageOf(e));+ setRows([]);+ },+ );+ }, []);+ useEffect(() => {+ if (!savedTo) return undefined;+ const timer = window.setTimeout(() => setSavedTo(null), 4000);+ return () => window.clearTimeout(timer);+ }, [savedTo]);+ const download = async (item: RecentItem) => {+ setBusy(item.drivewsid);+ setError(null);+ try {+ setSavedTo(await api.driveDownload(item.drivewsid, item));+ } catch (e) {+ setError(messageOf(e));+ } finally {+ setBusy(null);+ }+ };+ const groups = groupRecents(rows ?? []);+ return (+ <div className="drive drive-recents">+ <header className="cal-bar">+ <nav className="crumbs" aria-label="Folder path">+ <button className="crumb" onClick={onClose}>iCloud Drive</button>+ <span className="crumb-sep" aria-hidden="true">›</span>+ <button className="crumb" aria-current>Recents</button>+ </nav>+ </header>+ {error && <Notice message={error} onDismiss={() => setError(null)} />}+ {savedTo && <p className="drive-saved" role="status">Saved to {savedTo}</p>}+ {rows === null && <p className="cal-empty">Loading…</p>}+ {rows && rows.length === 0 && !error && (+ <p className="cal-empty">Files which you’ve opened recently will appear here.</p>+ )}+ {groups.map((g) => (+ <section key={g.heading} aria-label={g.heading}>+ <h2 className="drive-group">{g.heading}</h2>+ <ul className="drive-rows">+ {g.items.map((item) => (+ <li key={item.drivewsid}>+ <div+ className={`drive-row${selected === item.drivewsid ? " is-selected" : ""}${busy === item.drivewsid ? " is-busy" : ""}`}+ onContextMenu={(e) => {+ e.preventDefault();+ setSelected(item.drivewsid);+ setMenu({ item, x: e.clientX, y: e.clientY, alignRight: false });+ }}+ >+ <button+ className="drive-row-hit"+ aria-pressed={selected === item.drivewsid}+ onClick={() => setSelected(item.drivewsid)}+ onDoubleClick={() => void download(item)}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.preventDefault();+ void download(item);+ }+ }}+ >+ <span className="drive-badge" aria-hidden="true">+ {busy === item.drivewsid ? <span className="drive-spinner" /> : <FileGlyph kind={item.kind} extension={item.extension} />}+ </span>+ <span className="drive-name">{driveName(item)}</span>+ <span className="drive-meta drive-kind">{kindName(item)}</span>+ <span className="drive-meta">{fileSize(item.size)}</span>+ <span className="drive-meta">{openedText(item.openedAt)}</span>+ </button>+ </div>+ </li>+ ))}+ </ul>+ </section>+ ))}+ {menu && (+ <RowMenu+ at={menu}+ onClose={() => setMenu(null)}+ entries={[{ label: "Download a Copy", run: () => void download(menu.item) }]}+ />+ )}+ </div>+ );+}++/** Recents' headings, newest first: Today, Yesterday, Previous 7 and 30 Days, then months. */+export function groupRecents(rows: RecentItem[], now = new Date()): { heading: string; items: RecentItem[] }[] {+ const midnight = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();+ const today = midnight(now);+ const out: { heading: string; items: RecentItem[] }[] = [];+ for (const item of rows) {+ const when = new Date((item.openedAt ?? 0) * 1000);+ const ago = Math.round((today - midnight(when)) / 864e5);+ const heading =+ ago <= 0 ? "Today"+ : ago === 1 ? "Yesterday"+ : ago <= 7 ? "Previous 7 Days"+ : ago <= 30 ? "Previous 30 Days"+ : dateText(when, when.getFullYear() === now.getFullYear() ? { month: "long" } : { month: "long", year: "numeric" });+ const last = out[out.length - 1];+ if (last?.heading === heading) last.items.push(item);+ else out.push({ heading, items: [item] });+ }+ return out;+}++const openedText = (s: number | null) => {+ if (s === null) return "";+ const d = new Date(s * 1000);+ const today = new Date();+ return d.toDateString() === today.toDateString()+ ? timeText(d, { hour: "numeric", minute: "2-digit" })+ : dateText(d, { day: "numeric", month: "short", year: "numeric" });+};+/** What a file's kind is called, as icloud.com's File Info names it. */const KINDS: Record<string, string> = {pdf: "PDF document", png: "PNG image", jpg: "JPEG image", jpeg: "JPEG image", heic: "HEIC image",@@ -260,6 +396,7 @@ export function DriveView() {const [trail, setTrail] = useState<Crumb[]>([{ id: DRIVE_ROOT, name: "iCloud Drive" }]);const [items, setItems] = useState<DriveItem[]>([]);const [inTrash, setInTrash] = useState(false);+ const [inRecents, setInRecents] = useState(false);/** Apple's own pictures of this folder's files, where it has them; the rest keep icons. */const [thumbs, setThumbs] = useState<Record<string, string>>({});/** What is free, as icloud.com says it under a folder's name: "5.18 GB available". */@@ -692,6 +829,7 @@ export function DriveView() {}, [newFolderName, here.id, refresh, items]);if (inTrash) return <DriveTrash onClose={() => setInTrash(false)} />;+ if (inRecents) return <DriveRecents onClose={() => setInRecents(false)} />;return (<div className={`drive${dropping ? " is-dropping" : ""}`}>@@ -739,6 +877,10 @@ export function DriveView() {</p>)}<div className="cal-actions">+ <button className="quiet with-glyph" title="Recents" onClick={() => setInRecents(true)}>+ <Clock size={15} strokeWidth={1.6} aria-hidden="true" />+ Recents+ </button><button className="quiet with-glyph" title="Recently Deleted" onClick={() => setInTrash(true)}><ActionGlyph name="delete" />Recently Deleteddiff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex 4c24fa6..f701715 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -1,5 +1,5 @@import { Notice } from "../../components/Notice";-import { Portal } from "../../components/Portal";+import { inMenu, Portal } from "../../components/Portal";import { TimeField } from "../../components/TimeField";import { Search } from "lucide-react";import { createContext, Fragment, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";@@ -1762,7 +1762,7 @@ function EventPopover({}};const onDown = (e: MouseEvent) => {- if (!box.current || box.current.contains(e.target as Node)) return;+ if (!box.current || box.current.contains(e.target as Node) || inMenu(e.target)) return;// A press on the event this is open for is not a press elsewhere: it keeps it open.if (draft.guid && (e.target as HTMLElement).closest?.(`[data-event="${CSS.escape(draft.guid)}"]`)) return;onClose();diff --git a/src/screens/notes/FormatPanel.tsx b/src/screens/notes/FormatPanel.tsxindex 4bcbb5a..b754d71 100644--- a/src/screens/notes/FormatPanel.tsx+++ b/src/screens/notes/FormatPanel.tsx@@ -1,6 +1,6 @@import { useEffect, useLayoutEffect, useRef, useState } from "react";import { Check } from "lucide-react";-import { Portal } from "../../components/Portal";+import { inMenu, Portal } from "../../components/Portal";import type { EditorStatus } from "./NoteEditor";import { STYLE } from "./rich";@@ -54,7 +54,7 @@ export function FormatPanel({useEffect(() => {const down = (e: MouseEvent) => {const t = e.target as HTMLElement;- if (!box.current?.contains(t) && !t.closest(".notes-aa")) onClose();+ if (!box.current?.contains(t) && !t.closest(".notes-aa") && !inMenu(t)) onClose();};const key = (e: KeyboardEvent) => e.key === "Escape" && onClose();document.addEventListener("mousedown", down);diff --git a/src/styles/app.css b/src/styles/app.cssindex a540933..70a13ce 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -1311,19 +1311,16 @@}.picker-menu {- position: absolute;- z-index: 40;- top: calc(100% + 4px);- left: 0;- min-width: 100%;- max-height: 260px;+ position: fixed;+ z-index: 80;overflow-y: auto;margin: 0;- padding: 4px;+ padding: 5px;list-style: none;background: var(--sheet);- border-radius: var(--r-plateau);+ border-radius: 12px;box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);+ color: var(--text);/* No opening animation, as a macOS menu has none: it is simply there. Animating it inmade WebKitGTK build a compositing layer on the first frame, and the menu flashed. */}@@ -1334,19 +1331,22 @@}@media (prefers-reduced-motion: reduce) { .picker-menu { animation: none; } }+/* Rows as macOS 27 draws a menu's: 24px, the highlight rounded to 8. */.picker-menu li {display: flex;align-items: center;gap: 6px;- padding: 4px 8px 4px 4px;- border-radius: 5px;+ min-height: 24px;+ padding: 0 12px 0 4px;+ border-radius: 8px;font-size: var(--t-13);white-space: nowrap;cursor: pointer;outline: none;}-.picker-menu li.is-active { background: var(--accent); color: var(--on-accent); }+/* A menu's highlight is the system's, whichever app it is in — as every Mac menu's is. */+.picker-menu li.is-active { background: var(--sys-blue); color: #fff; }.picker-menu li.is-active .picker-check { color: #fff; }.picker-check {@@ -1778,18 +1778,23 @@/* Row menus: macOS's own shape — a rounded sheet, items the width of it, a hairline betweengroups, the highlight in the accent, Delete in red. */+/* Menus as macOS 27 draws them: 12px corners, 24px lines with an 8px highlight in the+ system blue, ▸ beside a line that leads on to a submenu. */.row-menu {position: fixed; z-index: 60; min-width: 200px; padding: 5px;display: flex; flex-direction: column; outline: none;- background: var(--sheet); border-radius: 10px;+ background: var(--sheet); border-radius: 12px;box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);}.row-menu-item {- display: block; width: 100%; padding: 5px 10px; border: 0; border-radius: 6px;- background: none; box-shadow: none; color: var(--text); font: inherit; font-size: var(--t-13);- text-align: left; cursor: default;+ display: flex; align-items: center; gap: 12px; width: 100%; min-height: 24px; padding: 0 12px;+ border: 0; border-radius: 8px; background: none; box-shadow: none; color: var(--text);+ font: inherit; font-size: var(--t-13); text-align: left; cursor: default; white-space: nowrap;}+.row-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }+.row-menu-chevron { flex: none; margin-right: -4px; font-size: 15px; line-height: 1; color: var(--text-2); }.row-menu-item.is-active { background: var(--sys-blue, #0a84ff); color: #fff; }+.row-menu-item.is-active .row-menu-chevron { color: #fff; }.row-menu-item.is-danger { color: var(--sys-red, #ff453a); }.row-menu-item.is-danger.is-active { background: var(--sys-red, #ff453a); color: #fff; }.row-menu-sep { height: 1px; margin: 4px 8px; background: var(--separator); }@@ -1851,9 +1856,13 @@.drive > .cal-bar .with-glyph:not(.primary) { font-size: 0; gap: 0; padding-inline: 8px; }.drive > .cal-bar .with-glyph:not(.primary) svg { font-size: initial; }}-.picker-menu.is-up { top: auto; bottom: calc(100% + 4px); }+.drive-meta.is-soon { color: var(--sys-red, #ff453a); }/* A folder or a folder up the path with something held over it, as Finder lights one. */.drive-row.is-drop { background: color-mix(in srgb, var(--sys-blue, #0a84ff) 16%, transparent); box-shadow: inset 0 0 0 2px var(--sys-blue, #0a84ff); }.crumb.is-drop { background: color-mix(in srgb, var(--sys-blue, #0a84ff) 16%, transparent); border-radius: 5px; }++/* Recents' date headings, as Finder's and icloud.com's group them. */+.drive-group { margin: 14px 0 4px; padding: 0 10px; color: var(--text); font-size: var(--t-13); font-weight: 700; }+.drive-recents section:first-of-type .drive-group { margin-top: 4px; }