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
Make Notes readable at the width the window actually is
Yashwanth Kamireddi79c6a2946506
diff --git a/.uiverify/a11y.mjs b/.uiverify/a11y.mjsindex 29151cf..1140033 100644--- a/.uiverify/a11y.mjs+++ b/.uiverify/a11y.mjs@@ -3,11 +3,12 @@import { chromium } from "playwright";import AxeBuilder from "@axe-core/playwright";-const SERVICES = ["account","archivews","calendar","ckdatabasews","cksharews","contacts",- "contactsweb","developerapi","docws","drivews","findme","geows","iwmb","iworkexportws",- "iworkthumbnailws","keyvalue","mail","mcc","mccgateway","mpp","notes","photos",- "photosupload","premiummailsettings","push","reminders","settings","sharedlibrary",- "sharedstreams","ubiquity","uploadimagews"];+const SERVICES = ["account","archivews","calendar","ckdatabasews","ckdeviceservice",+ "cksharews","contacts","contactsweb","developerapi","docws","drivews",+ "findme","geows","iwmb","iworkexportws","iworkthumbnailws","keyvalue",+ "mail","mcc","mccgateway","mpp","notes","photos","photosupload",+ "premiummailsettings","push","reminders","settings","sharedlibrary",+ "sharedstreams","ubiquity","uploadimagews"];function installStub({ screen, services, twoFactor }) {window.__TAURI_INTERNALS__ = {diff --git a/.uiverify/keyboard.mjs b/.uiverify/keyboard.mjsindex 6bb253a..ed3bb16 100644--- a/.uiverify/keyboard.mjs+++ b/.uiverify/keyboard.mjs@@ -2,8 +2,12 @@// screen-reader user actually experiences.import { chromium } from "playwright";-const SERVICES = ["calendar","contacts","reminders","notes","photos","drivews","mail",- "findme","sharedlibrary","sharedstreams","account","push","mpp","geows"];+const SERVICES = ["account","archivews","calendar","ckdatabasews","ckdeviceservice",+ "cksharews","contacts","contactsweb","developerapi","docws","drivews",+ "findme","geows","iwmb","iworkexportws","iworkthumbnailws","keyvalue",+ "mail","mcc","mccgateway","mpp","notes","photos","photosupload",+ "premiummailsettings","push","reminders","settings","sharedlibrary",+ "sharedstreams","ubiquity","uploadimagews"];function installStub({ screen, services, twoFactor }) {window.__TAURI_INTERNALS__ = {diff --git a/.uiverify/shots.mjs b/.uiverify/shots.mjsindex ce061d6..b43b833 100644--- a/.uiverify/shots.mjs+++ b/.uiverify/shots.mjs@@ -8,14 +8,18 @@ import path from "node:path";const dir = path.dirname(fileURLToPath(import.meta.url));const BASE = process.env.BASE ?? "http://localhost:4173";-const SERVICES = ["account","calendar","ckdatabasews","contacts","drivews","findme",- "mail","reminders","settings","streams","uploadimagews"];+const SERVICES = ["account","archivews","calendar","ckdatabasews","ckdeviceservice",+ "cksharews","contacts","contactsweb","developerapi","docws","drivews",+ "findme","geows","iwmb","iworkexportws","iworkthumbnailws","keyvalue",+ "mail","mcc","mccgateway","mpp","notes","photos","photosupload",+ "premiummailsettings","push","reminders","settings","sharedlibrary",+ "sharedstreams","ubiquity","uploadimagews"];/* addInitScript SERIALIZES this function — closures do not cross into the page, so everyvalue it needs must arrive through the single argument. *//* Fixture events, so the agenda's rendering is verified without inventing rows in anyone'sreal library. Times are unix seconds relative to now. */-function installStub({ screen, services, twoFactor, calendarFixture }) {+function installStub({ screen, services, twoFactor, calendarFixture, notesFixture }) {const HOUR = 3600, DAY = 86400;const base = Math.floor(Date.now() / 1000 / DAY) * DAY + 9 * HOUR;const events = !calendarFixture ? [] : [@@ -40,6 +44,25 @@ function installStub({ screen, services, twoFactor, calendarFixture }) {{ guid: "r3", listGuid: "daily", title: "Plan tomorrow", notes: null,dueAt: base + 13 * HOUR, completedAt: base + 13 * HOUR, priority: 0, etag: null },];+ const noteFolders = [+ { guid: "f1", title: "Notes", sortOrder: 0 },+ { guid: "f2", title: "Recently Deleted", sortOrder: 1 },+ ];+ const noteList = !notesFixture ? [] : [+ { guid: "n1", folderGuid: "f1", title: "Curtains",+ snippet: "Bathroom accessories like mirror holder…",+ body: "Curtains\nBathroom accessories like mirror holder, soap holder, shampoo, clothes hanger\nFan\nwall clock\nBed\nDining table\nTea filter\nKnife\nWashing Machine cover",+ locked: false, pinned: false, createdAt: null, modifiedAt: 1788500000, etag: null },+ { guid: "n2", folderGuid: "f1", title: "🔴 UNIT 1: SOFTWARE TESTING METHODOLOGIES",+ snippet: "📌 SECTION A: 2-MARK HIGH-YIELD…",+ body: "🔴 UNIT 1: SOFTWARE TESTING METHODOLOGIES\n\n📌 SECTION A: 2-MARK HIGH-YIELD QUESTIONS\n\nSoftware testing is the process of evaluating a system to find whether it satisfies the specified requirements, and to detect the differences between expected and actual results.",+ locked: false, pinned: true, createdAt: null, modifiedAt: 1787900000, etag: null },+ { guid: "n3", folderGuid: "f1",+ title: "These sources outline the fundamental principles and methodologies",+ snippet: "of **Software Testing Methodologies…",+ body: "These sources outline the fundamental principles and methodologies of **Software Testing Methodologies (CSEN3311)**, emphasizing its evolution from simple debugging to a structured, process-oriented discipline. The material details the **Software Testing Life Cycle (STLC)**, covering essential phases from initial planning and test design to execution and post-implementation review.",+ locked: false, pinned: false, createdAt: null, modifiedAt: 1787800000, etag: null },+ ];const calendars = [{ guid: "work", title: "Work", colour: "#cc73e1", ctag: null, sortOrder: 0, enabled: true },{ guid: "home", title: "Home", colour: "#0088ff", ctag: null, sortOrder: 1, enabled: true },@@ -67,8 +90,8 @@ function installStub({ screen, services, twoFactor, calendarFixture }) {case "reminder_create": return null;case "reminder_delete": return null;case "reminder_set_done": return null;- case "note_folders": return [];- case "notes_in": return [];+ case "note_folders": return !notesFixture ? [] : noteFolders;+ case "notes_in": return !notesFixture ? [] : noteList;case "notes_last_synced": return Math.floor(Date.now() / 1000);case "notes_sync": return [0, 0];case "auth_two_factor_options": return twoFactor;@@ -109,18 +132,33 @@ const shots = [act: async (p) => { await p.waitForSelector(".cal-grid"); } },{ name: "08-calendar-dark", screen: "library", theme: "dark", calendarFixture: true,act: async (p) => { await p.waitForSelector(".cal-grid"); } },+ // The window is often half a screen, where four columns do not fit.+ { name: "09-notes-narrow", screen: "library", theme: "dark", notesFixture: true,+ viewport: { width: 958, height: 1038 },+ act: async (p) => {+ await p.click('.nav-item:has-text("Notes")');+ await p.waitForSelector(".note-rows .note-row");+ await p.click('.note-row:has-text("These sources")');+ } },+ { name: "10-notes-wide", screen: "library", theme: "dark", notesFixture: true,+ viewport: { width: 1600, height: 1000 },+ act: async (p) => {+ await p.click('.nav-item:has-text("Notes")');+ await p.waitForSelector(".note-rows .note-row");+ await p.click('.note-row:has-text("These sources")');+ } },{ name: "04-library", screen: "library", theme: "light" },{ name: "05-library-dark", screen: "library", theme: "dark" },];const browser = await chromium.launch();-for (const { name, screen, theme, act, twoFactor = PUSHED, calendarFixture = false } of shots) {+for (const { name, screen, theme, act, twoFactor = PUSHED, calendarFixture = false, notesFixture = false, viewport } of shots) {const ctx = await browser.newContext({- viewport: { width: 1040, height: 720 },+ viewport: viewport ?? { width: 1040, height: 720 },deviceScaleFactor: 2,colorScheme: theme,});- await ctx.addInitScript(installStub, { screen, services: SERVICES, twoFactor, calendarFixture });+ await ctx.addInitScript(installStub, { screen, services: SERVICES, twoFactor, calendarFixture, notesFixture });const page = await ctx.newPage();const errors = [];page.on("console", (m) => m.type() === "error" && errors.push(m.text()));diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsxindex ae037be..e7b61fb 100644--- a/src/screens/NotesView.tsx+++ b/src/screens/NotesView.tsx@@ -25,6 +25,14 @@ function relative(seconds: number | null): string {return `${Math.floor(ago / 86_400)} d ago`;}+/** True when the body already opens with the title, which is Apple's usual case. */+function bodyRepeatsTitle(note: Note): boolean {+ const body = note.body?.trimStart();+ if (!body) return false;+ const title = note.title.trim();+ return title.length > 0 && body.startsWith(title);+}+export function NotesView() {const [folders, setFolders] = useState<NoteFolder[]>([]);const [folder, setFolder] = useState<string>(ALL);@@ -121,15 +129,34 @@ export function NotesView() {<header className="cal-bar"><div className="cal-nav"><h1>{folder === ALL ? "All Notes" : folders.find((f) => f.guid === folder)?.title}</h1>+ <span className="badge">+ {notes.length} {notes.length === 1 ? "note" : "notes"}+ </span></div><div className="cal-actions">- <span className="badge">Updated {relative(lastSynced)}</span>+ <span className="badge">{relative(lastSynced)}</span><button className="quiet" onClick={refresh} disabled={syncing}>{syncing ? "Refreshing…" : "Refresh"}</button></div></header>+ {/* Shown only when the folder column has folded away. */}+ <div className="notes-folder-picker">+ <select+ value={folder}+ onChange={(e) => setFolder(e.target.value)}+ aria-label="Folder"+ >+ <option value={ALL}>All Notes</option>+ {folders.map((f) => (+ <option key={f.guid} value={f.guid}>+ {f.title}+ </option>+ ))}+ </select>+ </div>+{error && <p className="error" role="alert">{error}</p>}<ul className="note-rows">@@ -169,7 +196,9 @@ export function NotesView() {</p>) : (<>- <h2>{open.title}</h2>+ {/* Apple derives a note's title from its first line, so the body already+ contains it. Rendering both shows the same sentence twice. */}+ {!bodyRepeatsTitle(open) && <h2>{open.title}</h2>}<p className="note-when">{when(open.modifiedAt)}</p><pre className="note-text">{open.body ?? ""}</pre></>diff --git a/src/styles/app.css b/src/styles/app.cssindex 0a075de..7e054df 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -651,29 +651,47 @@min-height: 0;}-.notes-folders { overflow-y: auto; border-right: 1px solid var(--separator); padding-right: 4px; }+.notes-folders {+ overflow-y: auto;+ border-right: 1px solid var(--separator);+ padding: 0 10px 0 0;+}.notes-list {display: flex;flex-direction: column;min-height: 0;border-right: 1px solid var(--separator);- padding-right: 12px;+ padding: 0 14px;+ /* Without this the header's actions overflow a 250px column and land on top of the note+ body — a grid column does not shrink below its content unless told to. */+ min-width: 0;}+/* The list column is narrow, so its header stacks instead of spreading across one row. */+.notes-list .cal-bar {+ flex-direction: column;+ align-items: flex-start;+ gap: 4px;+ margin-bottom: 10px;+}++.notes-list .cal-bar h1 { font-size: var(--t-17); min-width: 0; }+.notes-list .cal-actions { gap: 10px; }+.note-rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }.note-row {display: flex;flex-direction: column;- gap: 2px;+ gap: 3px;width: 100%;border: 0;background: none;color: var(--text);font: inherit;text-align: left;- padding: 8px 9px;+ padding: 9px 10px;border-radius: var(--r-field);cursor: pointer;}@@ -692,22 +710,90 @@.pin { color: var(--gold); font-size: 9px; margin-right: 5px; vertical-align: 2px; }-.note-row-meta { display: flex; gap: 8px; font-size: var(--t-11); color: var(--text-2); min-width: 0; }-.note-row-when { flex: none; }+/* Date and preview share a line beneath the title, which is how a note reads at a glance. */+.note-row-meta {+ display: flex;+ gap: 7px;+ font-size: var(--t-11);+ color: var(--text-2);+ min-width: 0;+ line-height: 1.4;+}++.note-row-when { flex: none; color: var(--text-3); }.note-row-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.note-body { overflow-y: auto; min-height: 0; padding-right: 6px; }-.note-body h2 { margin: 0 0 2px; font-size: var(--t-22); font-weight: 600; letter-spacing: -0.02em; }-.note-when { margin: 0 0 14px; color: var(--text-3); font-size: var(--t-11); }+.note-body {+ overflow-y: auto;+ min-height: 0;+ padding: 4px 32px 40px;+}++.note-body > * { max-width: 66ch; }++.note-body h2 {+ margin: 0 0 3px;+ font-size: var(--t-22);+ font-weight: 600;+ letter-spacing: -0.021em;+ line-height: 1.25;+ /* A note with no real title borrows its first line, which can be a whole paragraph.+ Two lines is enough to identify it. */+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+}++.note-when {+ margin: 0 0 20px;+ color: var(--text-3);+ font-size: var(--t-11);+}.note-text {margin: 0;+ /* A note is prose, not code: inherit the interface face rather than a monospace default,+ and give it a measure and leading meant for reading. */font: inherit;- font-size: var(--t-13);- line-height: 1.55;+ font-size: var(--t-15);+ line-height: 1.6;white-space: pre-wrap;- word-break: break-word;- max-width: 78ch;+ overflow-wrap: anywhere;+ max-width: 68ch;}++/* Apple gives Notes three columns; our service sidebar already takes one, so these have to+ earn their width. Folders are few and short, the list carries two lines per row, and the+ body gets everything left over. */+.notes { grid-template-columns: 132px minmax(240px, 292px) minmax(0, 1fr); gap: 0; }++/* Hidden while the folder column is visible; the media query below reveals it. Declared+ first so equal specificity resolves in the query's favour. */+.notes-folder-picker { display: none; }++/* Four columns do not fit a half-screen window: at 958px the body was reduced to about+ 200px, wrapping every few words. Below this width the folder column folds away and its+ choice moves into the list, which is what Apple does when space runs out. */+@media (max-width: 1180px) {+ .notes { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }+ .notes-folders { display: none; }+ .notes-folder-picker { display: block; }+}++.notes-folder-picker select {+ width: 100%;+ font: inherit;+ font-size: var(--t-13);+ color: var(--text);+ background: var(--field);+ border: 1px solid var(--field-edge);+ border-radius: var(--r-field);+ padding: 4px 7px;+ margin-bottom: 8px;+}++.notes-folder-picker select:focus-visible { outline: 3px solid var(--gold-ring); outline-offset: 1px; }+.content:has(.notes) { display: flex; flex-direction: column; overflow: hidden; }