Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Settings, the account in the sidebar, legible menus, a calendar that steps cleanly

Yashwanth Kamireddiafd6979503dd
diff --git a/.uiverify/calendar-daystep.mjs b/.uiverify/calendar-daystep.mjs
new file mode 100644
index 0000000..a24fef2
--- /dev/null
+++ b/.uiverify/calendar-daystep.mjs
@@ -0,0 +1,33 @@
+// Stepping through days in Day view: the day's list changes in one draw, never empty in
+// between, and the days around are already read — no read per step.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const b = await engine.launch();
+const ctx = await b.newContext({ viewport: { width: 1280, height: 800 } });
+await ctx.addInitScript((n) => { window.__manyEvents = n; }, 400);
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, calendarFixture: true });
+const page = await ctx.newPage();
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Calendar");
+await page.getByRole("button", { name: "Day", exact: true }).click();
+await page.waitForSelector(".cx-pane");
+await page.waitForTimeout(600);
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+const reads = await page.evaluate(() => window.__eventReads);
+await page.evaluate(() => {
+ window.__blank = 0;
+ window.__watch = true;
+ const tick = () => { if (document.querySelector(".cx-pane-empty")) window.__blank++; if (window.__watch) requestAnimationFrame(tick); };
+ requestAnimationFrame(tick);
+});
+for (let i = 0; i < 6; i++) {
+ await page.getByRole("button", { name: "Next", exact: true }).click();
+ await page.waitForTimeout(120);
+}
+const blank = await page.evaluate(() => { window.__watch = false; return window.__blank; });
+const after = await page.evaluate(() => window.__eventReads);
+ok(blank === 0, `the day's list never draws empty between days that have something [${blank} empty frames]`);
+ok(after === reads, `stepping a day inside the months read asks for nothing again [${after - reads} reads]`);
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/settings.mjs b/.uiverify/settings.mjs
new file mode 100644
index 0000000..f12a44a
--- /dev/null
+++ b/.uiverify/settings.mjs
@@ -0,0 +1,68 @@
+// Settings: opened from the account at the foot of the sidebar; every switch is the
+// backend's and moves at once, going back with the reason if it could not be kept; the
+// appearance chosen applies at once and survives a restart; the sidebar's selection is
+// neutral, and folding it slides the content rather than laying it out frame by frame.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub } from "./stub.mjs";
+const b = await engine.launch();
+const ctx = await b.newContext({ viewport: { width: 1180, height: 820 } });
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, remindersFixture: true });
+const page = await ctx.newPage();
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await page.waitForTimeout(400);
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+
+const card = page.locator(".sidebar-account");
+ok((await card.innerText()).includes("Asha Rao"), "the sidebar names who is signed in");
+await card.click();
+await page.waitForSelector(".settings");
+ok(await page.getByRole("heading", { name: "Settings" }).isVisible(), "the account opens Settings");
+ok((await card.getAttribute("aria-current")) === "true", "and is the current item while Settings is open");
+
+const sw = page.getByRole("switch", { name: "Calendar alerts" });
+await page.waitForFunction(() => !document.querySelector('[role=switch]')?.disabled);
+await sw.click();
+ok((await sw.getAttribute("aria-checked")) === "false", "a switch moves the moment it is pressed");
+ok((await page.evaluate(() => window.__settings?.eventAlerts)) === false, "and the backend is told");
+await page.evaluate(() => { window.__settingsFail = true; });
+await sw.click();
+await page.waitForTimeout(100);
+ok((await sw.getAttribute("aria-checked")) === "false" && (await page.locator(".settings-error").isVisible()), "a setting that could not be kept goes back, and says why");
+await page.evaluate(() => { window.__settingsFail = false; });
+
+await page.getByRole("button", { name: "Dark", exact: true }).click();
+ok((await page.evaluate(() => document.documentElement.dataset.theme)) === "dark", "Dark applies at once");
+const bg = await page.evaluate(() => getComputedStyle(document.body).backgroundColor);
+ok(bg !== "rgb(245, 245, 247)", `the window turns dark whatever the system says [${bg}]`);
+await page.reload({ waitUntil: "networkidle" });
+ok((await page.evaluate(() => document.documentElement.dataset.theme)) === "dark", "and is still chosen after a restart");
+await page.getByRole("button", { name: "Automatic", exact: true }).click();
+ok((await page.evaluate(() => document.documentElement.dataset.theme)) === undefined, "Automatic follows the system again");
+
+// The selected app is a neutral highlight: three apps used to select in the same blue.
+await page.locator(".nav-item", { hasText: "Reminders" }).click();
+await page.waitForTimeout(200);
+const sel = await page.evaluate(() => {
+ const el = document.querySelector('.nav-item[aria-current="true"]');
+ return { color: getComputedStyle(el).color, text: getComputedStyle(document.body).color };
+});
+ok(sel.color === sel.text, `the current app is not drawn in an accent [${sel.color}]`);
+
+// Folding: the content's padding is never animated; the content slides instead.
+const padTransition = await page.evaluate(() => {
+ const cs = getComputedStyle(document.querySelector(".content"));
+ return `${cs.transitionProperty} ${cs.transitionDuration}`;
+});
+ok(/^(all|none) 0s$/.test(padTransition) || !/padding/.test(padTransition) && !/all/.test(padTransition), `the content's layout is not animated [${padTransition}]`);
+await page.evaluate(() => {
+ window.__slid = false;
+ const el = document.querySelector(".content");
+ const orig = el.animate.bind(el);
+ el.animate = (...a) => { window.__slid = true; return orig(...a); };
+});
+await page.getByRole("button", { name: "Fold Sidebar to Icons" }).click();
+await page.waitForTimeout(400);
+ok(await page.evaluate(() => window.__slid), "folding slides the content on the compositor");
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index f15e97b..0f26edc 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -140,7 +140,18 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
case "auth_sign_in": return screen === "code" ? "needs_two_factor" : "complete";
case "auth_submit_code": return null;
case "account_services": return services;
- case "calendar_events": return events;
+ case "calendar_events": {
+ window.__eventReads = (window.__eventReads ?? 0) + 1;
+ // A heavy account, for measuring: `window.__manyEvents = n` adds n events spread over
+ // the year around today, several a day.
+ const n = window.__manyEvents ?? 0;
+ if (!n) return events;
+ const extra = (window.__extra ??= Array.from({ length: n }, (_, i) => ({
+ guid: `many${i}`, calendarGuid: i % 2 ? "work" : "home", title: `Event ${i}`, location: null,
+ startsAt: base + Math.floor((i - n / 2) / 8) * DAY + (8 + (i % 8)) * HOUR, endsAt: base + Math.floor((i - n / 2) / 8) * DAY + (9 + (i % 8)) * HOUR,
+ allDay: false, timezone: "Asia/Kolkata", url: null, notes: null, etag: null })));
+ return events.concat(extra);
+ }
case "calendar_search": {
const words = String(args?.query ?? "").toLowerCase().split(/\s+/).filter(Boolean);
return events.filter((e) => words.every((w) => `${e.title} ${e.location ?? ""}`.toLowerCase().includes(w)))
@@ -274,6 +285,12 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
case "drive_thumbnails": return driveFixture ? { "FILE::d": "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='60'><rect width='80' height='60' fill='%23eee'/></svg>" } : {};
case "drive_duplicate": (window.__dups ??= []).push(args.drivewsid); return null;
case "storage_info": return { usedBytes: 182196857, totalBytes: 5368709120 };
+ case "account_info": return { name: "Asha Rao", email: "[email protected]" };
+ case "settings_get": return { reminderAlerts: true, eventAlerts: true, ...(window.__settings ?? {}) };
+ case "settings_set":
+ if (window.__settingsFail) throw "Couldn't save that setting.";
+ (window.__settings ??= {})[args.key] = args.on;
+ return null;
case "drive_children": return !driveFixture ? [] : driveItems;
case "drive_recents": {
if (!driveFixture) return [];
diff --git a/check.sh b/check.sh
index aa095ca..b935352 100755
--- a/check.sh
+++ b/check.sh
@@ -67,6 +67,8 @@ step "drive keys" node .uiverify/drive-keys.mjs
step "drive drag" node .uiverify/drive-drag.mjs
step "drive recents" node .uiverify/drive-recents.mjs
step "drive gone folder" node .uiverify/drive-gone.mjs
+step "settings" node .uiverify/settings.mjs
+step "calendar day steps" node .uiverify/calendar-daystep.mjs
step "reminder colours" node .uiverify/calendar-reminder-colour.mjs
step "calendar dblclick" node .uiverify/calendar-dblclick.mjs
step "menus" node .uiverify/menus.mjs
diff --git a/crates/quince-auth/src/lib.rs b/crates/quince-auth/src/lib.rs
index 40c8e9a..b946031 100644
--- a/crates/quince-auth/src/lib.rs
+++ b/crates/quince-auth/src/lib.rs
@@ -943,6 +943,25 @@ impl Client {
if let Some(d) = data.pointer("/dsInfo/dsid").and_then(|v| v.as_str()) {
self.session.dsid = Some(d.to_string());
}
+ let text = |path: &str| {
+ data.pointer(path)
+ .and_then(|v| v.as_str())
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ .map(str::to_string)
+ };
+ if let Some(name) = text("/dsInfo/fullName").or_else(|| {
+ let first = text("/dsInfo/firstName")?;
+ Some(match text("/dsInfo/lastName") {
+ Some(last) => format!("{first} {last}"),
+ None => first,
+ })
+ }) {
+ self.session.account_name = Some(name);
+ }
+ if let Some(email) = text("/dsInfo/primaryEmail").or_else(|| text("/dsInfo/appleId")) {
+ self.session.account_email = Some(email);
+ }
}
/// Query parameters every iCloud service endpoint expects alongside the session cookies.
diff --git a/crates/quince-auth/src/session.rs b/crates/quince-auth/src/session.rs
index 03edd3a..47b40fe 100644
--- a/crates/quince-auth/src/session.rs
+++ b/crates/quince-auth/src/session.rs
@@ -59,6 +59,13 @@ pub struct Session {
#[serde(default)]
pub password: Option<String>,
+ /// The account's name and address as Apple gives them at sign-in (`dsInfo`), for the
+ /// account shown in the sidebar and Settings.
+ #[serde(default)]
+ pub account_name: Option<String>,
+ #[serde(default)]
+ pub account_email: Option<String>,
+
/// Failed sign-ins in a row. Drives the local backoff.
#[serde(default)]
pub consecutive_failures: u32,
diff --git a/probe/examples/account_name.rs b/probe/examples/account_name.rs
new file mode 100644
index 0000000..d5f1815
--- /dev/null
+++ b/probe/examples/account_name.rs
@@ -0,0 +1,27 @@
+//! Read-only: whether the account's name and address come back from sign-in (printed
+//! masked — enough to see they are there, not the address itself).
+use anyhow::{anyhow, Result};
+#[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 s = client.session();
+ let mask = |v: &Option<String>| {
+ v.as_deref().map(|t| {
+ format!(
+ "{}… ({} chars)",
+ t.chars().take(2).collect::<String>(),
+ t.chars().count()
+ )
+ })
+ };
+ println!(
+ "name: {:?}\nemail: {:?}",
+ mask(&s.account_name),
+ mask(&s.account_email)
+ );
+ Ok(())
+}
diff --git a/src-tauri/src/alerts.rs b/src-tauri/src/alerts.rs
index 5166fe0..46a7b81 100644
--- a/src-tauri/src/alerts.rs
+++ b/src-tauri/src/alerts.rs
@@ -84,17 +84,28 @@ pub fn take_due(library: &mut quince_core::Library, now: i64) -> (Vec<DueAlarm>,
}
/// Start the task. It runs for the life of the process, window open or not.
+/// Settings' switches for each kind of alert. An alert due while its switch is off is let
+/// go, not saved for later: turned back on, it does not ring for what has passed.
+pub const REMINDER_ALERTS: &str = "settings.alerts.reminders";
+pub const EVENT_ALERTS: &str = "settings.alerts.events";
+
+/// Whether a kind of alert may ring. On unless Settings turned it off.
+pub fn allowed(library: &quince_core::Library, key: &str) -> bool {
+ library.state(key).ok().flatten().as_deref() != Some("off")
+}
+
pub fn spawn(app: AppHandle) {
watch_for_resume();
tauri::async_runtime::spawn(async move {
loop {
let at = now();
- let (ring, next) = {
+ let (ring, next, on) = {
let data = app.state::<Data>();
let mut library = data.0.lock().await;
- take_due(&mut library, at)
+ let (ring, next) = take_due(&mut library, at);
+ (ring, next, allowed(&library, REMINDER_ALERTS))
};
- for due in ring {
+ for due in ring.into_iter().filter(|_| on) {
show(app.clone(), due);
}
let wait = next.map_or(LONGEST_SLEEP, |t| {
@@ -273,6 +284,7 @@ pub fn spawn_events(app: AppHandle) {
let mut library = data.0.lock().await;
!library.alarm_already_fired(&key, fires_at).unwrap_or(true)
&& library.mark_alarm_fired(&key, fires_at, at).is_ok()
+ && allowed(&library, EVENT_ALERTS)
};
if ring {
show_event(app.clone(), e.clone(), *minutes);
@@ -334,6 +346,21 @@ fn show_event(app: AppHandle, event: quince_core::calendar::Event, minutes: i64)
#[cfg(test)]
mod tests {
+
+ #[test]
+ fn an_alert_rings_unless_settings_turned_it_off() {
+ let mut library = quince_core::Library::in_memory().unwrap();
+ assert!(allowed(&library, EVENT_ALERTS), "on until turned off");
+ library.set_state(EVENT_ALERTS, "off").unwrap();
+ assert!(!allowed(&library, EVENT_ALERTS));
+ assert!(
+ allowed(&library, REMINDER_ALERTS),
+ "one switch does not turn off the other"
+ );
+ library.set_state(EVENT_ALERTS, "on").unwrap();
+ assert!(allowed(&library, EVENT_ALERTS));
+ }
+
use super::*;
use quince_core::alarms::{Alarm, AlarmTrigger};
use quince_core::reminders::{Reminder, ReminderList};
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index ea67793..13ad86f 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -304,6 +304,55 @@ async fn auth_sign_out(auth: State<'_, Auth>) -> UiResult<()> {
}
/// Services Apple advertises for this account, for the sidebar.
+/// Who is signed in, as Apple names them: for the account in the sidebar and in Settings.
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+struct AccountInfo {
+ name: Option<String>,
+ email: Option<String>,
+}
+
+#[tauri::command]
+async fn account_info(auth: State<'_, Auth>) -> UiResult<AccountInfo> {
+ let client = auth.client.lock().await;
+ let s = client.session();
+ Ok(AccountInfo {
+ name: s.account_name.clone(),
+ email: s.account_email.clone().or_else(|| s.apple_id.clone()),
+ })
+}
+
+/// Settings' switches, as the backend obeys them.
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+struct Settings {
+ reminder_alerts: bool,
+ event_alerts: bool,
+}
+
+#[tauri::command]
+async fn settings_get(data: State<'_, Data>) -> UiResult<Settings> {
+ let library = data.0.lock().await;
+ Ok(Settings {
+ reminder_alerts: alerts::allowed(&library, alerts::REMINDER_ALERTS),
+ event_alerts: alerts::allowed(&library, alerts::EVENT_ALERTS),
+ })
+}
+
+/// Turn a kind of alert on or off. Only the switches Settings shows can be set.
+#[tauri::command]
+async fn settings_set(key: String, on: bool, data: State<'_, Data>) -> UiResult<()> {
+ let state = match key.as_str() {
+ "reminderAlerts" => alerts::REMINDER_ALERTS,
+ "eventAlerts" => alerts::EVENT_ALERTS,
+ _ => return Err(format!("There is no setting called {key}.")),
+ };
+ let mut library = data.0.lock().await;
+ library
+ .set_state(state, if on { "on" } else { "off" })
+ .map_err(|e| e.to_string())
+}
+
#[tauri::command]
async fn account_services(auth: State<'_, Auth>) -> UiResult<Vec<String>> {
let client = auth.client.lock().await;
@@ -2885,6 +2934,9 @@ fn main() {
auth_submit_sms_code,
auth_sign_out,
account_services,
+ account_info,
+ settings_get,
+ settings_set,
sync_all,
sync_status,
calendar_sync,
diff --git a/src-tauri/src/push.rs b/src-tauri/src/push.rs
index b6de8b9..3e278aa 100644
--- a/src-tauri/src/push.rs
+++ b/src-tauri/src/push.rs
@@ -61,12 +61,7 @@ async fn watch_contacts(
.get_webview_window("main")
.and_then(|w| w.is_visible().ok())
.unwrap_or(false);
- tokio::time::sleep(if visible {
- LOOK
- } else {
- LOOK_HIDDEN
- })
- .await;
+ tokio::time::sleep(if visible { LOOK } else { LOOK_HIDDEN }).await;
let session = {
let guard = client.lock().await;
let s = guard.session();
@@ -135,12 +130,7 @@ async fn watch_calendar(
.get_webview_window("main")
.and_then(|w| w.is_visible().ok())
.unwrap_or(false);
- tokio::time::sleep(if visible {
- LOOK
- } else {
- LOOK_HIDDEN
- })
- .await;
+ tokio::time::sleep(if visible { LOOK } else { LOOK_HIDDEN }).await;
let session = {
let guard = client.lock().await;
let s = guard.session();
diff --git a/src/components/Account.tsx b/src/components/Account.tsx
new file mode 100644
index 0000000..bb1e814
--- /dev/null
+++ b/src/components/Account.tsx
@@ -0,0 +1,38 @@
+import { useEffect, useState } from "react";
+import { api } from "../lib/ipc";
+import { freshness, useSync } from "../lib/sync";
+
+/** "Asha Rao" → "AR"; an address → its first letter. */
+export function initialsOf(name: string): string {
+ const words = name.split(/[\s@._-]+/).filter(Boolean);
+ if (words.length === 0) return "";
+ if (name.includes("@") || words.length === 1) return words[0][0]!.toUpperCase();
+ return (words[0][0]! + words[words.length - 1][0]!).toUpperCase();
+}
+
+/**
+ * The account at the foot of the sidebar — who is signed in and how fresh their iCloud is —
+ * and the way into Settings, as System Settings puts the account at the head of its list.
+ */
+export function AccountCard({ current, onOpen }: { current: boolean; onOpen: () => void }) {
+ const [account, setAccount] = useState<{ name: string | null; email: string | null } | null>(null);
+ const { report, syncing, error } = useSync();
+ useEffect(() => {
+ api.accountInfo().then(setAccount, () => {});
+ }, []);
+ const failed = error || report?.services.some((s) => s.outcome === "failed");
+ const status = syncing ? "Syncing…" : failed ? "Some things didn't update" : freshness(report?.asOf ?? null);
+ const name = account?.name ?? account?.email ?? "Settings";
+ return (
+ <button className="sidebar-account" aria-current={current} onClick={onOpen} title="Settings">
+ <span className="account-avatar" aria-hidden="true">{initialsOf(name)}</span>
+ <span className="sidebar-account-text">
+ <span className="sidebar-account-name">{name}</span>
+ <span className={`sidebar-account-status${failed ? " is-trouble" : ""}`}>
+ <span className={`sync-dot ${failed ? "trouble" : syncing ? "working" : "clean"}`} aria-hidden="true" />
+ {status}
+ </span>
+ </span>
+ </button>
+ );
+}
diff --git a/src/lib/ipc.ts b/src/lib/ipc.ts
index 6e47f74..46b58af 100644
--- a/src/lib/ipc.ts
+++ b/src/lib/ipc.ts
@@ -209,6 +209,11 @@ export const api = {
driveThumbnails: (folderId: string) => invoke<Record<string, string>>("drive_thumbnails", { folderId }),
driveDuplicate: (drivewsid: string) => invoke<void>("drive_duplicate", { drivewsid }),
storageInfo: () => invoke<{ usedBytes: number; totalBytes: number }>("storage_info"),
+ /** Who is signed in, as Apple names them. */
+ accountInfo: () => invoke<{ name: string | null; email: string | null }>("account_info"),
+ /** Settings' switches, as the backend obeys them. */
+ settingsGet: () => invoke<{ reminderAlerts: boolean; eventAlerts: boolean }>("settings_get"),
+ settingsSet: (key: "reminderAlerts" | "eventAlerts", on: boolean) => invoke<void>("settings_set", { key, on }),
drivePutBack: (item: DriveItem) => invoke<void>("drive_put_back", { item }),
driveDeleteForever: (item: DriveItem) => invoke<void>("drive_delete_forever", { item }),
driveMove: (drivewsid: string, destinationId: string) =>
diff --git a/src/lib/theme.ts b/src/lib/theme.ts
new file mode 100644
index 0000000..e155178
--- /dev/null
+++ b/src/lib/theme.ts
@@ -0,0 +1,29 @@
+/**
+ * The window's appearance: the system's, or one chosen in Settings. Remembered on this
+ * computer; applied before the first paint so the window never opens in the wrong one.
+ */
+export type Theme = "auto" | "light" | "dark";
+const KEY = "quince.theme";
+
+export function storedTheme(): Theme {
+ try {
+ const t = window.localStorage.getItem(KEY);
+ return t === "light" || t === "dark" ? t : "auto";
+ } catch {
+ return "auto";
+ }
+}
+
+export function applyTheme(theme: Theme) {
+ if (theme === "auto") delete document.documentElement.dataset.theme;
+ else document.documentElement.dataset.theme = theme;
+}
+
+export function setTheme(theme: Theme) {
+ try {
+ window.localStorage.setItem(KEY, theme);
+ } catch {
+ // Applies for now; the system's appearance on the next launch.
+ }
+ applyTheme(theme);
+}
diff --git a/src/main.tsx b/src/main.tsx
index 30140c9..bf52638 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -6,6 +6,10 @@ import "./styles/app.css";
import "./styles/reminders.css";
import "./styles/calendar.css";
import "./styles/notes.css";
+import { applyTheme, storedTheme } from "./lib/theme";
+
+// Before the first paint, so the window opens in the appearance chosen.
+applyTheme(storedTheme());
/*
* Every link goes the one way out: as a navigation, which the window refuses and hands to
diff --git a/src/screens/Library.tsx b/src/screens/Library.tsx
index 39dd7d1..fb988eb 100644
--- a/src/screens/Library.tsx
+++ b/src/screens/Library.tsx
@@ -3,7 +3,7 @@ import { listen } from "@tauri-apps/api/event";
import { PanelLeft } from "lucide-react";
import { api, messageOf, OPEN_REMINDER } from "../lib/ipc";
import { SyncProvider } from "../lib/sync";
-import { SyncStatus } from "../components/SyncStatus";
+import { AccountCard } from "../components/Account";
/*
* Each app is its own chunk, so the window opens on the code for the app it shows, not all
@@ -16,12 +16,14 @@ const loaders = {
notes: () => import("./NotesView").then((m) => ({ default: m.NotesView })),
contacts: () => import("./ContactsView").then((m) => ({ default: m.ContactsView })),
drivews: () => import("./DriveView").then((m) => ({ default: m.DriveView })),
+ settings: () => import("./SettingsView").then((m) => ({ default: m.SettingsView })),
};
const CalendarView = lazy(loaders.calendar);
const RemindersView = lazy(loaders.reminders);
const NotesView = lazy(loaders.notes);
const ContactsView = lazy(loaders.contacts);
const DriveView = lazy(loaders.drivews);
+const SettingsView = lazy(loaders.settings);
import { ScreenBoundary } from "../components/ScreenBoundary";
import { AppIcon } from "../components/AppIcon";
@@ -60,7 +62,32 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
return false;
}
});
- const toggleRail = () =>
+ const content = useRef<HTMLElement | null>(null);
+ /**
+ * Folding the sidebar moves the content without laying it out on every frame. Animating
+ * the content's padding made the whole screen — a calendar grid, a long list — lay itself
+ * out sixty times a second, and that was the stutter. Instead it takes its new width at
+ * once and slides from where it was, which the compositor does alone.
+ */
+ const slideContent = (from: number) => {
+ const el = content.current;
+ if (!el || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
+ requestAnimationFrame(() => {
+ const to = el.getBoundingClientRect().left + parseFloat(getComputedStyle(el).paddingLeft);
+ const by = from - to;
+ if (Math.abs(by) < 1) return;
+ el.animate([{ transform: `translateX(${by}px)` }, { transform: "none" }], {
+ duration: 300,
+ easing: getComputedStyle(document.documentElement).getPropertyValue("--spring-quick").trim() || "ease-out",
+ });
+ });
+ };
+ const toggleRail = () => {
+ const el = content.current;
+ if (el) slideContent(el.getBoundingClientRect().left + parseFloat(getComputedStyle(el).paddingLeft));
+ setRailState();
+ };
+ const setRailState = () =>
setRail((was) => {
try {
window.localStorage.setItem(RAIL_KEY, was ? "0" : "1");
@@ -82,7 +109,7 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
} catch {
// Without storage it opens on the first screen, which is fine.
}
- setSelected(last && offered.includes(last) ? last : (offered[0] ?? null));
+ setSelected(last && (offered.includes(last) || last === "settings") ? last : (offered[0] ?? null));
setReady(true);
})
.catch((e) => setError(messageOf(e)));
@@ -209,15 +236,18 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
)}
<div className="sidebar-foot">
- <SyncStatus />
- <button className="quiet sidebar-signout" onClick={onSignOut}>
- Sign out
- </button>
+ <AccountCard current={selected === "settings"} onOpen={() => choose("settings")} />
</div>
</nav>
- <main className="content">
- {selected && SCREENS.some((s) => s.key === selected) ? (
+ <main className="content" ref={content}>
+ {selected === "settings" ? (
+ <ScreenBoundary key="settings" name="Settings">
+ <Suspense fallback={null}>
+ <SettingsView onSignOut={onSignOut} />
+ </Suspense>
+ </ScreenBoundary>
+ ) : selected && SCREENS.some((s) => s.key === selected) ? (
// Keyed by screen, so moving to another screen also clears a failed one.
<ScreenBoundary key={selected} name={SCREENS.find((s) => s.key === selected)?.name ?? "This screen"}>
<Suspense fallback={null}>
diff --git a/src/screens/SettingsView.tsx b/src/screens/SettingsView.tsx
new file mode 100644
index 0000000..c3744fc
--- /dev/null
+++ b/src/screens/SettingsView.tsx
@@ -0,0 +1,177 @@
+import { useEffect, useState } from "react";
+import { getVersion } from "@tauri-apps/api/app";
+import { api, messageOf } from "../lib/ipc";
+import { freshness, useSync } from "../lib/sync";
+import { setTheme, storedTheme, type Theme } from "../lib/theme";
+import { AppIcon } from "../components/AppIcon";
+import { initialsOf } from "../components/Account";
+
+/** The app each service's freshness belongs to, for its icon. */
+const ICON: Record<string, string> = {
+ calendar: "calendar",
+ reminders: "reminders",
+ notes: "notes",
+ contacts: "contacts",
+};
+
+function size(bytes: number): string {
+ const gb = bytes / 1024 ** 3;
+ if (gb >= 1) return `${gb >= 10 ? gb.toFixed(0) : gb.toFixed(1)} GB`;
+ return `${Math.max(1, Math.round(bytes / 1024 ** 2))} MB`;
+}
+
+/**
+ * Settings, as macOS System Settings lays it out: the account at the head, then grouped
+ * sections of rows, a label on the left and its control on the right. Only what really
+ * changes something is here — every switch is one the backend obeys, every figure is read
+ * from Apple or from this computer's library.
+ */
+export function SettingsView({ onSignOut }: { onSignOut: () => void }) {
+ const [account, setAccount] = useState<{ name: string | null; email: string | null } | null>(null);
+ const [storage, setStorage] = useState<{ usedBytes: number; totalBytes: number } | null>(null);
+ const [alerts, setAlerts] = useState<{ reminderAlerts: boolean; eventAlerts: boolean } | null>(null);
+ const [theme, chooseTheme] = useState<Theme>(storedTheme);
+ const [version, setVersion] = useState<string | null>(null);
+ const [error, setError] = useState<string | null>(null);
+ const [confirming, setConfirming] = useState(false);
+ const { report, syncing, refresh } = useSync();
+
+ useEffect(() => {
+ api.accountInfo().then(setAccount, () => setAccount({ name: null, email: null }));
+ api.storageInfo().then(setStorage, () => {});
+ api.settingsGet().then(setAlerts, (e) => setError(messageOf(e)));
+ getVersion().then(setVersion, () => {});
+ }, []);
+
+ // A switch moves the moment it is pressed, and goes back with the reason if it could not
+ // be kept.
+ const toggle = (key: "reminderAlerts" | "eventAlerts") => {
+ if (!alerts) return;
+ const on = !alerts[key];
+ setAlerts({ ...alerts, [key]: on });
+ api.settingsSet(key, on).catch((e) => {
+ setAlerts((now) => (now ? { ...now, [key]: !on } : now));
+ setError(messageOf(e));
+ });
+ };
+
+ const used = storage && storage.totalBytes > 0 ? Math.min(1, storage.usedBytes / storage.totalBytes) : 0;
+
+ return (
+ <div className="settings">
+ <h1 className="settings-title">Settings</h1>
+ {error && <p className="settings-error" role="alert">{error}</p>}
+
+ <section className="settings-group settings-account" aria-label="Account">
+ <span className="account-avatar is-large" aria-hidden="true">{initialsOf(account?.name ?? account?.email ?? "")}</span>
+ <div className="settings-account-text">
+ <strong>{account?.name ?? "Your Apple Account"}</strong>
+ <span>{account?.email ?? ""}</span>
+ </div>
+ {confirming ? (
+ <span className="settings-confirm">
+ <button className="quiet" onClick={() => setConfirming(false)}>Cancel</button>
+ <button className="quiet danger" onClick={onSignOut}>Sign Out</button>
+ </span>
+ ) : (
+ <button className="quiet" onClick={() => setConfirming(true)}>Sign Out…</button>
+ )}
+ </section>
+ {confirming && (
+ <p className="settings-note">
+ Signing out removes your iCloud data and sign-in from this computer. Nothing is deleted from iCloud.
+ </p>
+ )}
+
+ <h2 className="settings-heading">iCloud Storage</h2>
+ <section className="settings-group">
+ <div className="settings-row is-stacked">
+ <div className="settings-row-line">
+ <span>{storage ? `${size(storage.usedBytes)} of ${size(storage.totalBytes)} used` : "Reading storage…"}</span>
+ {storage && <span className="settings-value">{size(Math.max(0, storage.totalBytes - storage.usedBytes))} available</span>}
+ </div>
+ <div className="storage-bar" role="meter" aria-label="iCloud storage used" aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(used * 100)}>
+ <span style={{ width: `${used * 100}%` }} />
+ </div>
+ </div>
+ </section>
+
+ <h2 className="settings-heading">Sync</h2>
+ <section className="settings-group">
+ {(report?.services ?? []).filter((s) => s.outcome !== "unavailable").map((s) => (
+ <div className="settings-row" key={s.service}>
+ <AppIcon app={ICON[s.service] ?? s.service} />
+ <span className="settings-label">{s.label}</span>
+ <span className={`settings-value${s.outcome === "failed" ? " is-trouble" : ""}`}>
+ {s.outcome === "failed" ? (s.detail ?? "Didn't update") : freshness(s.lastSyncedAt ?? null)}
+ </span>
+ </div>
+ ))}
+ <div className="settings-row">
+ <span className="settings-label settings-hint">Changes made on your other devices arrive here within seconds.</span>
+ <button className="quiet" onClick={() => void refresh()} disabled={syncing}>
+ {syncing ? "Syncing…" : "Sync Now"}
+ </button>
+ </div>
+ </section>
+
+ <h2 className="settings-heading">Appearance</h2>
+ <section className="settings-group">
+ <div className="settings-row">
+ <span className="settings-label">Appearance</span>
+ <div className="segmented" role="group" aria-label="Appearance">
+ {(["auto", "light", "dark"] as const).map((t) => (
+ <button
+ key={t}
+ className="segment"
+ aria-pressed={theme === t}
+ onClick={() => {
+ chooseTheme(t);
+ setTheme(t);
+ }}
+ >
+ {t === "auto" ? "Automatic" : t === "light" ? "Light" : "Dark"}
+ </button>
+ ))}
+ </div>
+ </div>
+ </section>
+
+ <h2 className="settings-heading">Notifications</h2>
+ <section className="settings-group">
+ {([
+ ["reminderAlerts", "Reminder alerts", "reminders"],
+ ["eventAlerts", "Calendar alerts", "calendar"],
+ ] as const).map(([key, label, icon]) => (
+ <div className="settings-row" key={key}>
+ <AppIcon app={icon} />
+ <span className="settings-label">{label}</span>
+ <button
+ className="switch"
+ role="switch"
+ aria-checked={alerts?.[key] ?? false}
+ aria-label={label}
+ disabled={!alerts}
+ onClick={() => toggle(key)}
+ >
+ <span className="switch-knob" />
+ </button>
+ </div>
+ ))}
+ </section>
+
+ <h2 className="settings-heading">About</h2>
+ <section className="settings-group">
+ <div className="settings-row">
+ <span className="settings-label">Version</span>
+ <span className="settings-value">{version ?? "—"}</span>
+ </div>
+ <div className="settings-row">
+ <span className="settings-label settings-hint">
+ Your iCloud is kept on this computer and talks only to Apple. Quince has no servers.
+ </span>
+ </div>
+ </section>
+ </div>
+ );
+}
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index 85afd31..3278298 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -290,10 +290,17 @@ export function CalendarView() {
}, [selected]);
const month = useMemo(() => monthDays(selected), [selected]);
- // Each view asks for exactly what it shows.
- const range = useMemo(() => {
- if (view === "day") return { from: seconds(selected), to: seconds(addDays(selected, 1)) };
- if (view === "week") return { from: seconds(week[0]), to: seconds(addDays(week[6], 1)) };
+ // What each view reads from the library. Day and Week read the month around them and a
+ // month either side: asked for one day at a time, stepping to the next day showed the last
+ // day's data — none of it on the new day — until the read came back, and the day's list
+ // flickered empty and full. Read from this computer, three months cost nothing, and moving
+ // through them waits on nothing.
+ const rawRange = useMemo(() => {
+ if (view === "day" || view === "week")
+ return {
+ from: seconds(addDays(month[0] < week[0] ? month[0] : week[0], -35)),
+ to: seconds(addDays(month[41] > week[6] ? month[41] : week[6], 36)),
+ };
if (view === "year")
return {
from: seconds(new Date(selected.getFullYear(), 0, 1)),
@@ -301,6 +308,10 @@ export function CalendarView() {
};
return { from: seconds(month[0]), to: seconds(addDays(month[41], 1)) };
}, [view, selected, week, month]);
+ // The same bounds are the same read: stepping a day inside them asks for nothing again.
+ const rangeKey = `${rawRange.from}-${rawRange.to}`;
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ const range = useMemo(() => rawRange, [rangeKey]);
const read = useCallback(async () => {
const [found, cals, reminders, lists] = await Promise.all([
diff --git a/src/styles/app.css b/src/styles/app.css
index ca66afc..b5bffbf 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -264,6 +264,8 @@
bottom: 8px;
width: 196px;
transition: width var(--spring-quick-d) var(--spring-quick);
+ /* Its own width changing lays out only itself. */
+ contain: layout paint;
overflow: hidden;
background: var(--glass);
-webkit-backdrop-filter: var(--glass-blur);
@@ -313,6 +315,10 @@
background: rgba(255, 255, 255, 0.07);
}
}
+/* The same, when Settings chooses Dark whatever the system says. */
+:root[data-theme="dark"] .sync-row:hover:not(:disabled) {
+ background: rgba(255, 255, 255, 0.07);
+ }
.sync-dot {
flex: none;
@@ -411,7 +417,6 @@
cursor: pointer;
}
-.nav-item:active { transform: scale(0.98); }
.nav-item > svg { border-radius: 5.4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.2); }
/* The icon tiles: white in light mode; Apple's graphite in dark, as icloud.com draws them. */
.app-icon .ai-tile-top { stop-color: #ffffff; }
@@ -424,16 +429,26 @@
.app-icon.ai-contacts .ai-tile-top { stop-color: #d8d8dc; }
.app-icon.ai-contacts .ai-tile-bottom { stop-color: #b8b8be; }
@media (prefers-color-scheme: dark) {
- .app-icon .ai-tile-top { stop-color: #3a3a3e; }
- .app-icon .ai-tile-bottom { stop-color: #1c1c1f; }
- .app-icon .ai-edge { stroke: rgba(255, 255, 255, 0.14); }
- .app-icon .ai-rule { fill: #5a5a60; }
- .app-icon .ai-ink { fill: #f2f2f7; }
- .app-icon .ai-card { fill: #636366; }
- .app-icon .ai-person { fill: #e5e5ea; }
- .app-icon.ai-contacts .ai-tile-top { stop-color: #3a3a3e; }
- .app-icon.ai-contacts .ai-tile-bottom { stop-color: #1c1c1f; }
-}
+ :root:not([data-theme="light"]) .app-icon .ai-tile-top { stop-color: #3a3a3e; }
+ :root:not([data-theme="light"]) .app-icon .ai-tile-bottom { stop-color: #1c1c1f; }
+ :root:not([data-theme="light"]) .app-icon .ai-edge { stroke: rgba(255, 255, 255, 0.14); }
+ :root:not([data-theme="light"]) .app-icon .ai-rule { fill: #5a5a60; }
+ :root:not([data-theme="light"]) .app-icon .ai-ink { fill: #f2f2f7; }
+ :root:not([data-theme="light"]) .app-icon .ai-card { fill: #636366; }
+ :root:not([data-theme="light"]) .app-icon .ai-person { fill: #e5e5ea; }
+ :root:not([data-theme="light"]) .app-icon.ai-contacts .ai-tile-top { stop-color: #3a3a3e; }
+ :root:not([data-theme="light"]) .app-icon.ai-contacts .ai-tile-bottom { stop-color: #1c1c1f; }
+}
+/* The same, when Settings chooses Dark whatever the system says. */
+:root[data-theme="dark"] .app-icon .ai-tile-top { stop-color: #3a3a3e; }
+:root[data-theme="dark"] .app-icon .ai-tile-bottom { stop-color: #1c1c1f; }
+:root[data-theme="dark"] .app-icon .ai-edge { stroke: rgba(255, 255, 255, 0.14); }
+:root[data-theme="dark"] .app-icon .ai-rule { fill: #5a5a60; }
+:root[data-theme="dark"] .app-icon .ai-ink { fill: #f2f2f7; }
+:root[data-theme="dark"] .app-icon .ai-card { fill: #636366; }
+:root[data-theme="dark"] .app-icon .ai-person { fill: #e5e5ea; }
+:root[data-theme="dark"] .app-icon.ai-contacts .ai-tile-top { stop-color: #3a3a3e; }
+:root[data-theme="dark"] .app-icon.ai-contacts .ai-tile-bottom { stop-color: #1c1c1f; }
.nav-name { overflow: hidden; text-overflow: ellipsis; transition: opacity 120ms ease 140ms; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; min-height: 28px; }
.sidebar-head h2 { margin: 0 8px; }
@@ -456,7 +471,10 @@
@media (max-width: 900px) { .sidebar-fold { display: none; } }
@media (prefers-reduced-motion: reduce) { .content, .sidebar, .nav-item { transition: none; } }
.nav-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
-.nav-item[aria-current="true"] { background: var(--accent-tint); color: var(--accent-strong); font-weight: 550; }
+/* The current app: a neutral highlight, as a Tahoe sidebar draws one, the label unchanged in
+ colour. Tinting it with the app's accent made three apps — Reminders, Drive, Contacts —
+ select in the same blue; the icon is what tells them apart. */
+.nav-item[aria-current="true"] { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); font-weight: 590; }
.nav-item:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: -1px; }
.nav-toggle {
@@ -495,7 +513,9 @@
height: 100%;
overflow-y: auto;
padding: 28px 34px 28px var(--side, 236px);
- transition: padding-left var(--spring-quick-d) var(--spring-quick);
+ /* No transition: folding the sidebar slides the content on the compositor instead
+ (Library's slideContent) — a padding animated here re-laid out the whole screen on
+ every frame. */
}
.library { --side: 236px; }
.library.is-rail { --side: 84px; }
@@ -1327,8 +1347,6 @@
list-style: none;
border-radius: 12px;
background: var(--glass-thick);
- -webkit-backdrop-filter: var(--glass-blur);
- backdrop-filter: var(--glass-blur);
box-shadow: var(--glass-float);
color: var(--text);
/* No opening animation, as a macOS menu has none: it is simply there. Animating it in
@@ -1643,8 +1661,6 @@
padding: 5px;
border-radius: 12px;
background: var(--glass-thick);
- -webkit-backdrop-filter: var(--glass-blur);
- backdrop-filter: var(--glass-blur);
box-shadow: var(--glass-float);
}
.upload-menu button {
@@ -1800,8 +1816,6 @@
display: flex; flex-direction: column; outline: none;
border-radius: 12px;
background: var(--glass-thick);
- -webkit-backdrop-filter: var(--glass-blur);
- backdrop-filter: var(--glass-blur);
box-shadow: var(--glass-float);
}
.row-menu-item {
@@ -1917,3 +1931,82 @@
.note-bar-actions .notes-icon { border-radius: var(--r-pill); }
.note-bar-actions .picker-button { background: none; }
.note-bar-actions .picker-button:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 8%, transparent); }
+
+
+/* ── The account, at the foot of the sidebar ──────────────────────────────────────────── */
+.sidebar-account {
+ display: flex; align-items: center; gap: 9px; width: 100%; min-height: 44px;
+ padding: 6px 8px; border: 0; border-radius: var(--r-field); background: none;
+ color: var(--text); font: inherit; text-align: left; cursor: pointer;
+}
+.sidebar-account:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
+.sidebar-account[aria-current="true"] { background: color-mix(in srgb, var(--text) 10%, transparent); }
+.sidebar-account:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: -1px; }
+.sidebar-account-text { display: flex; flex-direction: column; min-width: 0; }
+.sidebar-account-name { font-size: var(--t-13); font-weight: 590; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.sidebar-account-status { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: var(--t-11); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.sidebar-account-status.is-trouble { color: var(--danger); }
+/* Apple's monogram: initials on a soft grey gradient disc. */
+.account-avatar {
+ flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
+ background: linear-gradient(180deg, #a5a5ab, #85858b); color: #fff;
+ font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
+ box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.35);
+}
+.account-avatar.is-large { width: 56px; height: 56px; font-size: 21px; }
+@media (min-width: 901px) {
+ .is-rail .sidebar-foot { display: flex; }
+ .is-rail .sidebar-account { justify-content: center; padding-inline: 0; }
+ .is-rail .sidebar-account-text { display: none; }
+}
+
+/* ── Settings, as System Settings lays it out ─────────────────────────────────────────── */
+.settings { max-width: 640px; margin: 0 auto; padding-bottom: 40px; }
+.settings-title { margin: 4px 0 18px; font-size: var(--t-28); font-weight: 700; letter-spacing: -0.02em; }
+.settings-heading { margin: 22px 12px 6px; font-size: var(--t-13); font-weight: 600; color: var(--text-2); }
+.settings-group {
+ border-radius: 12px;
+ background: color-mix(in srgb, var(--text) 4%, transparent);
+ box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--text) 8%, transparent);
+ overflow: hidden;
+}
+.settings-row {
+ display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 14px;
+ font-size: var(--t-13);
+}
+/* Separators inset past the icon, as Apple draws them between rows of a group. */
+.settings-row + .settings-row { box-shadow: inset 0 0.5px 0 color-mix(in srgb, var(--text) 10%, transparent); }
+.settings-row.is-stacked { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 14px; }
+.settings-row-line { display: flex; justify-content: space-between; gap: 10px; }
+.settings-label { flex: 1; min-width: 0; }
+.settings-hint { color: var(--text-2); font-size: var(--t-11); line-height: 1.4; }
+.settings-value { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; }
+.settings-value.is-trouble { color: var(--danger); max-width: 60%; }
+.settings-error { margin: 0 0 12px; color: var(--danger); }
+.settings-note { margin: 8px 12px 0; color: var(--text-2); font-size: var(--t-11); }
+.settings-account { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
+.settings-account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
+.settings-account-text strong { font-size: var(--t-17); font-weight: 600; }
+.settings-account-text span { color: var(--text-2); font-size: var(--t-13); overflow: hidden; text-overflow: ellipsis; }
+.settings-confirm { display: flex; gap: 6px; }
+.settings .segmented { padding: 2px; border-radius: var(--r-pill); }
+.settings .segment { border-radius: var(--r-pill); padding: 3px 12px; font-size: var(--t-13); }
+.storage-bar { height: 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
+.storage-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
+
+/* The switch, as macOS 27 draws it (Toggle: track 38×22 at this size, knob inset 2): green
+ when on, the knob sliding on the snappy spring. */
+.switch {
+ position: relative; flex: none; width: 38px; height: 22px; padding: 0; border: 0;
+ border-radius: var(--r-pill); background: color-mix(in srgb, var(--text) 16%, transparent);
+ cursor: pointer; transition: background-color 180ms ease;
+}
+.switch[aria-checked="true"] { background: #34c759; }
+.switch-knob {
+ position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
+ background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
+ transition: translate var(--spring-snappy-d) var(--spring-snappy);
+}
+.switch[aria-checked="true"] .switch-knob { translate: 16px 0; }
+.switch:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
+.switch:disabled { opacity: 0.5; }
diff --git a/src/styles/calendar.css b/src/styles/calendar.css
index 9fead19..c5de999 100644
--- a/src/styles/calendar.css
+++ b/src/styles/calendar.css
@@ -757,14 +757,18 @@
/* In the dark the calendar's colour is lifted toward white instead. */
@media (prefers-color-scheme: dark) {
- .cx-block, .cx-bar-event { color: color-mix(in srgb, var(--cal) 45%, #fff); }
+ :root:not([data-theme="light"]) .cx-block, :root:not([data-theme="light"]) .cx-bar-event { color: color-mix(in srgb, var(--cal) 45%, #fff); }
}
+/* The same, when Settings chooses Dark whatever the system says. */
+:root[data-theme="dark"] .cx-block, :root[data-theme="dark"] .cx-bar-event { color: color-mix(in srgb, var(--cal) 45%, #fff); }
/* Reminders' words take their list's colour, deepened to read in light and lifted in dark. */
.cx-reminder, .cx-item.is-reminder .cx-item-title, .cx-pane-reminder .cx-pane-title { color: color-mix(in srgb, var(--cal, var(--text)) 62%, #000); }
@media (prefers-color-scheme: dark) {
- .cx-reminder, .cx-item.is-reminder .cx-item-title, .cx-pane-reminder .cx-pane-title { color: color-mix(in srgb, var(--cal, var(--text)) 50%, #fff); }
+ :root:not([data-theme="light"]) .cx-reminder, :root:not([data-theme="light"]) .cx-item.is-reminder .cx-item-title, :root:not([data-theme="light"]) .cx-pane-reminder .cx-pane-title { color: color-mix(in srgb, var(--cal, var(--text)) 50%, #fff); }
}
+/* The same, when Settings chooses Dark whatever the system says. */
+:root[data-theme="dark"] .cx-reminder, :root[data-theme="dark"] .cx-item.is-reminder .cx-item-title, :root[data-theme="dark"] .cx-pane-reminder .cx-pane-title { color: color-mix(in srgb, var(--cal, var(--text)) 50%, #fff); }
.cx-reminder.is-done, .cx-item.is-reminder.is-done .cx-item-title { color: var(--text-3); }
/* ── The toolbar in Liquid Glass ────────────────────────────────────────────────────────
diff --git a/src/styles/notes.css b/src/styles/notes.css
index b8644a0..501c3c2 100644
--- a/src/styles/notes.css
+++ b/src/styles/notes.css
@@ -373,8 +373,6 @@ textarea.note-title::placeholder { color: var(--text-3); }
padding: 10px 8px 8px;
border-radius: 12px;
background: var(--glass-thick);
- -webkit-backdrop-filter: var(--glass-blur);
- backdrop-filter: var(--glass-blur);
box-shadow: var(--glass-float);
color: var(--text);
}
diff --git a/src/styles/reminders.css b/src/styles/reminders.css
index 36a5710..597c66a 100644
--- a/src/styles/reminders.css
+++ b/src/styles/reminders.css
@@ -14,13 +14,20 @@
}
@media (prefers-color-scheme: dark) {
- :root {
+ :root:not([data-theme="light"]) {
--sys-blue: #0091ff;
--sys-red: #ff4245;
--sys-gray: #98989d;
--sys-orange: #ff9230;
}
}
+/* The same, when Settings chooses Dark whatever the system says. */
+:root[data-theme="dark"] {
+ --sys-blue: #0091ff;
+ --sys-red: #ff4245;
+ --sys-gray: #98989d;
+ --sys-orange: #ff9230;
+ }
.content:has(.rx) { display: flex; flex-direction: column; overflow: hidden; }
diff --git a/src/styles/tokens.css b/src/styles/tokens.css
index 99a415e..0c8cae9 100644
--- a/src/styles/tokens.css
+++ b/src/styles/tokens.css
@@ -59,13 +59,19 @@
top, where the light catches it. The rim is what makes it read as a material and not
as a translucent rectangle. */
--glass: rgba(255, 255, 255, 0.58);
- --glass-thick: rgba(250, 250, 252, 0.78);
+ /* Menus, popovers and sheets: frosted nearly to opaque. Over text, anything thinner reads
+ the words beneath — and WebKitGTK, Quince's engine on Linux, does not always run the
+ blur that would hide them (measured on his machine: sharp text through a menu). */
+ --glass-thick: rgba(248, 248, 250, 0.96);
--glass-blur: blur(30px) saturate(190%);
--glass-specular: inset 0 0.5px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 0.5px rgba(255, 255, 255, 0.45);
--glass-edge: rgba(0, 0, 0, 0.08);
/* Floating glass casts a soft, wide shadow — it sits above the window, not on it. */
--glass-lift: 0 8px 30px rgba(0, 0, 0, 0.13), 0 1px 3px rgba(0, 0, 0, 0.08);
- /* A menu, popover or sheet: thick glass, rim, edge and lift — the whole recipe. */
+ /* A menu, popover or sheet: thick glass, rim, edge and lift — the whole recipe. Menus
+ take it without the live blur: a blurred layer is a compositing layer, and WebKitGTK
+ building one on a menu's first frame is the flash that made menus open without
+ animation in the first place. */
--glass-float: var(--glass-specular), 0 0 0 0.5px var(--glass-edge), var(--glass-lift);
/* Motion. Apple's interface moves on springs, not curves: these are SwiftUI's own,
@@ -112,10 +118,10 @@
:root[data-app="calendar"] { --accent: #ff383c; --accent-strong: #d70015; --accent-deep: #d70015; }
@media (prefers-color-scheme: dark) {
- :root { --accent: #0091ff; --accent-strong: #0091ff; --accent-deep: #0068d6; }
- :root[data-app="notes"] { --accent: #ffd600; --accent-strong: #ffd600; --accent-deep: #8a6800; --on-accent: #1d1d1f; --on-accent-2: rgba(0, 0, 0, 0.62); }
- :root[data-app="calendar"] { --accent: #ff4245; --accent-strong: #ff4245; --accent-deep: #d70015; }
- :root {
+ :root:not([data-theme="light"]) { --accent: #0091ff; --accent-strong: #0091ff; --accent-deep: #0068d6; }
+ :root:not([data-theme="light"])[data-app="notes"] { --accent: #ffd600; --accent-strong: #ffd600; --accent-deep: #8a6800; --on-accent: #1d1d1f; --on-accent-2: rgba(0, 0, 0, 0.62); }
+ :root:not([data-theme="light"])[data-app="calendar"] { --accent: #ff4245; --accent-strong: #ff4245; --accent-deep: #d70015; }
+ :root:not([data-theme="light"]) {
--bg: #1c1c1e;
--sheet: #2c2c2e;
--text: #f5f5f7;
@@ -129,12 +135,40 @@
--shadow-sheet: 0 18px 50px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
--shadow-field: inset 0 1px 1px rgba(0, 0, 0, 0.25);
--glass: rgba(40, 40, 44, 0.56);
- --glass-thick: rgba(36, 36, 40, 0.8);
+ --glass-thick: rgba(38, 38, 42, 0.96);
--glass-specular: inset 0 0.5px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 0.5px rgba(255, 255, 255, 0.1);
--glass-edge: rgba(0, 0, 0, 0.5);
--glass-lift: 0 10px 36px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.35);
}
}
+/* The same, when Settings chooses Dark whatever the system says. */
+:root[data-theme="dark"] { --accent: #0091ff; --accent-strong: #0091ff; --accent-deep: #0068d6; }
+:root[data-theme="dark"][data-app="notes"] { --accent: #ffd600; --accent-strong: #ffd600; --accent-deep: #8a6800; --on-accent: #1d1d1f; --on-accent-2: rgba(0, 0, 0, 0.62); }
+:root[data-theme="dark"][data-app="calendar"] { --accent: #ff4245; --accent-strong: #ff4245; --accent-deep: #d70015; }
+:root[data-theme="dark"] {
+ --bg: #1c1c1e;
+ --sheet: #2c2c2e;
+ --text: #f5f5f7;
+ --text-2: #a1a1a6;
+ --text-3: #8e8e93;
+ --separator: rgba(255, 255, 255, 0.13);
+ --field: #1c1c1e;
+ --field-edge: rgba(255, 255, 255, 0.16);
+ --field-edge-hover: rgba(255, 255, 255, 0.28);
+ --danger: #ff6b6b;
+ --shadow-sheet: 0 18px 50px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
+ --shadow-field: inset 0 1px 1px rgba(0, 0, 0, 0.25);
+ --glass: rgba(40, 40, 44, 0.56);
+ --glass-thick: rgba(38, 38, 42, 0.96);
+ --glass-specular: inset 0 0.5px 0 rgba(255, 255, 255, 0.2), inset 0 0 0 0.5px rgba(255, 255, 255, 0.1);
+ --glass-edge: rgba(0, 0, 0, 0.5);
+ --glass-lift: 0 10px 36px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.35);
+ }
+
+/* Settings can choose the appearance rather than follow the system; the engine's own
+ controls — date fields, scrollbars — follow it too. */
+:root[data-theme="light"] { color-scheme: light; }
+:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
@@ -166,7 +200,7 @@ body {
/* Where the engine has no backdrop blur, glass would be a see-through panel over text.
Opaque instead, as Reduce Transparency draws it. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- :root { --glass: var(--bg); --glass-thick: var(--sheet); }
+ :root:root:root { --glass: var(--bg); --glass-thick: var(--sheet); }
}
/* A control gives under a press and springs back, as Apple's do — buttons, icons, pop-up
@@ -199,11 +233,12 @@ body {
Increase Contrast. Matching that is the difference between using the design language
and merely copying its look. */
@media (prefers-reduced-transparency: reduce) {
- :root { --glass: var(--bg); --glass-thick: var(--sheet); --glass-blur: none; --glass-specular: none; }
+ /* Outranks the dark set, which is chosen by a theme as well as by the system. */
+ :root:root:root { --glass: var(--bg); --glass-thick: var(--sheet); --glass-blur: none; --glass-specular: none; }
}
@media (prefers-contrast: more) {
- :root {
+ :root:root:root {
--glass: var(--bg);
--glass-thick: var(--sheet);
--glass-blur: none;