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
Menus, popovers and sheets drawn at the top of the page, so nothing traps them — Drive's grid menu was the window's width; menus open instantly as on macOS, popovers fade without moving, ending the open flicker; white icons on Drive's selection; a round ⋯ on grid tiles; Notes text uses the whole pane; Apple's Notes folder has no menu; reminder date with a Time switch
Yashwanth Kamireddiafa73160045f
diff --git a/.uiverify/drive-sort.mjs b/.uiverify/drive-sort.mjsindex f7a4501..feb90a2 100644--- a/.uiverify/drive-sort.mjs+++ b/.uiverify/drive-sort.mjs@@ -58,6 +58,17 @@ const tops = async () => page.evaluate(() => [...document.querySelectorAll(".driok(new Set((await tops()).slice(0, 3)).size === 1, "Grid sets items side by side");ok((await page.locator(".drive-row", { hasText: "Semester Plan" }).locator("img.drive-thumb").count()) === 1,"a file Apple has a picture of shows it, as icloud.com's grid does");+// In Grid, a tile's menu is a menu — not the window's width — and Get Info sits mid-window.+await page.locator(".drive-row", { hasText: "Semester Plan" }).click({ button: "right" });+await page.waitForTimeout(150);+const menuBox = await page.locator(".row-menu").boundingBox();+ok(menuBox && menuBox.width < 320, `a tile's menu is menu-sized [${Math.round(menuBox?.width ?? 0)}px]`);+await page.getByRole("menuitem", { name: "Get Info" }).click();+await page.waitForTimeout(250);+const sheet = await page.locator(".info-sheet").boundingBox();+const mid = sheet ? Math.abs(sheet.x + sheet.width / 2 - 600) : 999;+ok(mid < 30, `Get Info opens in the middle of the window [${Math.round(mid)}px off]`);+await page.keyboard.press("Escape");await page.reload({ waitUntil: "networkidle" });await openScreen(page, "iCloud Drive");await page.waitForTimeout(400);diff --git a/src/components/Portal.tsx b/src/components/Portal.tsxnew file mode 100644index 0000000..8bdeef1--- /dev/null+++ b/src/components/Portal.tsx@@ -0,0 +1,11 @@+import { createPortal } from "react-dom";++/**+ * Menus, popovers and sheets are drawn at the top of the page, over everything, as a+ * window server draws them. Inside a screen, any ancestor with a transform, filter or+ * backdrop blur becomes what `position: fixed` is fixed to: a menu opened from Drive's grid+ * came out the width of the screen, and File Info sat in a corner instead of the middle.+ */+export function Portal({ children }: { children: React.ReactNode }) {+ return createPortal(children, document.body);+}diff --git a/src/components/RowMenu.tsx b/src/components/RowMenu.tsxindex d5343d6..1647fde 100644--- a/src/components/RowMenu.tsx+++ b/src/components/RowMenu.tsx@@ -1,3 +1,4 @@+import { Portal } from "./Portal";import { useEffect, useLayoutEffect, useRef, useState } from "react";export type MenuEntry = { label: string; run: () => void; danger?: boolean } | null;@@ -41,6 +42,7 @@ export function RowMenu({ at, entries, onClose }: {const pick = (i: number) => { onClose(); items[i]?.run(); };let n = -1;return (+ <Portal><divref={box}className="row-menu"@@ -72,6 +74,7 @@ export function RowMenu({ at, entries, onClose }: {);})}</div>+ </Portal>);}diff --git a/src/lib/ipc.ts b/src/lib/ipc.tsindex 8704b98..d1faf2c 100644--- a/src/lib/ipc.ts+++ b/src/lib/ipc.ts@@ -292,6 +292,8 @@ export type ReminderEdit = {title?: string;notes?: string | null;dueAt?: number | null;+ /** With `dueAt`: a day, not a time. */+ allDay?: boolean;flagged?: boolean;completed?: boolean;/** Apple's scale: 0 none, 1 high, 5 medium, 9 low. */@@ -319,6 +321,8 @@ export type Reminder = {recurInterval: number | null;/** The section of its list this sits in, if any. */sectionGuid?: string | null;+ /** Due on a day rather than at a time. */+ allDay?: boolean;etag: string | null;};diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex be88532..6cb65f2 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -1,5 +1,6 @@import { useCallback, useEffect, useRef, useState } from "react";import { Notice } from "../components/Notice";+import { Portal } from "../components/Portal";import { open as openFileDialog } from "@tauri-apps/plugin-dialog";import { getCurrentWebview } from "@tauri-apps/api/webview";import {@@ -193,6 +194,7 @@ function InfoSheet({ item, where, thumb, onClose }: { item: DriveItem; where: st["Modified", when(item.modifiedAt ?? item.createdAt)],];return (+ <Portal><div className="modal-veil" onClick={onClose}><div className="modal-sheet info-sheet" role="dialog" aria-label="File Info" onClick={(e) => e.stopPropagation()}><header className="info-head">@@ -210,6 +212,7 @@ function InfoSheet({ item, where, thumb, onClose }: { item: DriveItem; where: st</dl></div></div>+ </Portal>);}@@ -1014,6 +1017,7 @@ function MoveDialog({}, []);return (+ <Portal><div className="modal-veil" onClick={onCancel}><divclassName="modal-sheet move-sheet"@@ -1079,5 +1083,6 @@ function MoveDialog({</div></div></div>+ </Portal>);}diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsxindex 8b0c1dd..dd598c1 100644--- a/src/screens/NotesView.tsx+++ b/src/screens/NotesView.tsx@@ -529,7 +529,8 @@ export function NotesView() {className={`notes-folder-row${folderMenu?.folder.guid === f.guid ? " is-menu" : ""}`}onContextMenu={(e) => {e.preventDefault();- openMenu(e.clientX, e.clientY, false);+ // Apple's own "Notes" folder has no menu: it cannot be renamed or deleted.+ if (own) openMenu(e.clientX, e.clientY, false);}}><buttondiff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsxindex 50258ae..4c8a22d 100644--- a/src/screens/RemindersView.tsx+++ b/src/screens/RemindersView.tsx@@ -1,5 +1,6 @@import { Fragment, useCallback, useEffect, useMemo, useState } from "react";import { Notice } from "../components/Notice";+import { Portal } from "../components/Portal";import { ChevronLeft } from "lucide-react";import {api,@@ -66,10 +67,16 @@ function daysApart(from: Date, to: Date): number {* "9:30 PM" and not "Tomorrow 9:30 PM". Saying it twice is the sort of thing that makes a* screen read as almost-right.*/-function dueLabel(seconds: number, dated = false): { text: string; overdue: boolean } {+function dueLabel(seconds: number, dated = false, allDay = false): { text: string; overdue: boolean } {const due = new Date(seconds * 1000);const now = new Date();const days = daysApart(now, due);+ // A day has no time to show, and is overdue only once the day itself has passed.+ if (allDay) {+ if (dated || days === 0) return { text: dated ? "" : "Today", overdue: false };+ if (days === 1) return { text: "Tomorrow", overdue: false };+ return { text: due.toLocaleDateString(undefined, { day: "numeric", month: "short" }), overdue: days < 0 };+ }const time = due.toLocaleTimeString(undefined, {hour: "numeric",minute: "2-digit",@@ -146,13 +153,22 @@ function repeatWord(r: Reminder): string | null {return ["Daily", "Weekly", "Monthly", "Yearly"][r.recurFrequency] ?? "Repeats";}-/** `YYYY-MM-DDTHH:mm` for a datetime-local input, in local time. */-function toInputValue(seconds: number | null): string {- if (seconds === null) return "";- const d = new Date(seconds * 1000);- const pad = (n: number) => String(n).padStart(2, "0");- return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;-}+/**+ * An all-day date as Apple keeps it is that day's midnight in UTC. Shown and grouped here at+ * the same day's local midnight — read as a moment, the 17th's UTC midnight is the evening of+ * the 16th west of Greenwich, and a day reminder would drift into the day before.+ */+const dayToLocal = (utc: number) => {+ const d = new Date(utc * 1000);+ return Math.floor(new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()).getTime() / 1000);+};+const dayToUtc = (value: string) => {+ const [y, m, d] = value.split("-").map(Number);+ return Math.floor(Date.UTC(y, m - 1, d) / 1000);+};+const asShown = (r: Reminder): Reminder =>+ r.allDay && r.dueAt !== null ? { ...r, dueAt: dayToLocal(r.dueAt) } : r;+type Selection ={ type: "smart"; kind: SmartList } | { type: "list"; guid: string };@@ -251,7 +267,7 @@ export function RemindersView() {: selection.type === "smart"? await api.remindersSmart(selection.kind, endOfToday()): await api.remindersIn(selection.guid, showDone);- const fresh = Array.isArray(found) ? found : [];+ const fresh = (Array.isArray(found) ? found : []).map(asShown);setItems(fresh);return fresh;}, [selection, showDone, query, searching]);@@ -361,12 +377,16 @@ export function RemindersView() {patch(r.guid, { title: title.trim() }),): Promise.resolve();- const setDue = (r: Reminder, value: string) =>- write(r, () =>- api.reminderEdit(r.guid, r.listGuid, {- dueAt: value ? Math.floor(new Date(value).getTime() / 1000) : null,- }),+ /** A date, and whether it has a time — the phone's Date and Time switches. */+ const setDue = (r: Reminder, day: string, time: string | null) => {+ const allDay = Boolean(day) && time === null;+ const dueAt = !day ? null : allDay ? dayToUtc(day) : Math.floor(new Date(`${day}T${time}`).getTime() / 1000);+ return write(+ r,+ () => api.reminderEdit(r.guid, r.listGuid, { dueAt, allDay }),+ patch(r.guid, { dueAt: allDay && dueAt !== null ? dayToLocal(dueAt) : dueAt, allDay }),);+ };const setNotes = (r: Reminder, notes: string) =>write(r, () =>api.reminderEdit(r.guid, r.listGuid, { notes: notes.trim() || null }),@@ -1010,7 +1030,7 @@ export function RemindersView() {<ul className="rx-rows">{section.rows.map(({ reminder, depth }) => {const due =- reminder.dueAt === null ? null : dueLabel(reminder.dueAt, section.dated);+ reminder.dueAt === null ? null : dueLabel(reminder.dueAt, section.dated, reminder.allDay);const isOpen = openGuid === reminder.guid;const repeat = repeatLabel(reminder);const justMoved = moved?.guid === reminder.guid ? moved.text : null;@@ -1094,14 +1114,7 @@ export function RemindersView() {{isOpen && (<div className="rx-detail">- <label className="rx-field">- <span>Date</span>- <input- type="datetime-local"- defaultValue={toInputValue(reminder.dueAt)}- onBlur={(e) => void setDue(reminder, e.target.value)}- />- </label>+<DueField reminder={reminder} onChange={(day, time) => void setDue(reminder, day, time)} /><div className="rx-field"><span>Repeat</span><Picker@@ -1277,6 +1290,7 @@ function ListInfo({ list, onClose, onDone }: {}, [onClose]);const done = () => onDone(title.trim(), colour !== current ? colour : null);return (+ <Portal><div className="modal-veil" onClick={onClose}><div className="modal-sheet rx-info" role="dialog" aria-label={`\u201c${list.title}\u201d Info`} onClick={(e) => e.stopPropagation()}><h2>“{list.title}” Info</h2>@@ -1311,5 +1325,50 @@ function ListInfo({ list, onClose, onDone }: {</div></div></div>+ </Portal>+ );+}++/**+ * The phone's date controls: a date, and a Time switch. Off, the reminder is due on the+ * day — all day, no alert; on, at the time chosen. Each change is saved when it is made.+ */+function DueField({ reminder, onChange }: { reminder: Reminder; onChange: (day: string, time: string | null) => void }) {+ const at = reminder.dueAt === null ? null : new Date(reminder.dueAt * 1000);+ const pad = (n: number) => String(n).padStart(2, "0");+ const day = at ? `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())}` : "";+ const time = at && !reminder.allDay ? `${pad(at.getHours())}:${pad(at.getMinutes())}` : null;+ return (+ <div className="rx-field rx-due">+ <span>Date</span>+ <input+ type="date"+ aria-label={`Date for ${reminder.title}`}+ defaultValue={day}+ key={`d${reminder.dueAt}`}+ // A new date keeps the time already set; a first date is a day, as on the phone.+ onBlur={(e) => e.target.value !== day && onChange(e.target.value, e.target.value ? time : null)}+ />+ <label className="rx-due-switch">+ <input+ type="checkbox"+ role="switch"+ aria-label={`Time for ${reminder.title}`}+ checked={time !== null}+ disabled={!day}+ onChange={(e) => onChange(day, e.target.checked ? "09:00" : null)}+ />+ <span>Time</span>+ </label>+ {time !== null && (+ <input+ type="time"+ aria-label={`Time of day for ${reminder.title}`}+ defaultValue={time}+ key={`t${reminder.dueAt}`}+ onBlur={(e) => e.target.value && e.target.value !== time && onChange(day, e.target.value)}+ />+ )}+ </div>);}diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex 184fcc8..5f9bd69 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -1,4 +1,5 @@import { Notice } from "../../components/Notice";+import { Portal } from "../../components/Portal";import { Search } from "lucide-react";import { createContext, Fragment, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";import {@@ -1599,6 +1600,7 @@ function EventPopover({? sameDay ? day(start) : `${day(start)} – ${day(end)}`: sameDay ? `${day(start)}, ${time(start)} – ${time(end)}` : `${day(start)}, ${time(start)} – ${day(end)}, ${time(end)}`;return (+ <Portal><formref={box}className="cx-popover is-info"@@ -1616,10 +1618,12 @@ function EventPopover({)}{draft.notes && <p className="cx-info-notes">{draft.notes}</p>}</form>+ </Portal>);}return (+ <Portal><formref={box}className="cx-popover"@@ -1738,6 +1742,7 @@ function EventPopover({</span></div></form>+ </Portal>);}diff --git a/src/styles/app.css b/src/styles/app.cssindex afe9924..d8ea8a8 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -977,8 +977,13 @@}.drive-rows.is-grid .drive-meta { display: none; }.drive-rows.is-grid .drive-row-actions {- position: absolute; top: 4px; right: 4px; padding: 2px; border-radius: 8px;- background: var(--sheet, var(--bg));+ position: absolute; top: 6px; right: 6px; padding: 0; background: none;+}+/* In Grid the ⋯ is a small round button at the tile's corner, never a bar across its face. */+.drive-rows.is-grid .drive-action {+ width: 22px; height: 22px; padding: 0; border-radius: 50%;+ background: color-mix(in srgb, var(--sheet, var(--bg)) 88%, transparent);+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);}/* A row is the clickable hit area plus a strip of actions that only earn their space on@@ -1282,10 +1287,8 @@background: var(--sheet);border-radius: var(--r-plateau);box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);- /* Opacity and a 3px drop only, from its top edge, on the compositor. */- transform-origin: top center;- will-change: opacity, transform;- animation: picker-in 120ms cubic-bezier(0.2, 0.9, 0.3, 1) both;+ /* No opening animation, as a macOS menu has none: it is simply there. Animating it in+ made WebKitGTK build a compositing layer on the first frame, and the menu flashed. */}@keyframes picker-in {@@ -1454,11 +1457,11 @@background: var(--sheet);border-radius: var(--r-window);box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);- animation: modal-sheet-in 220ms var(--ease-spring) both;+ animation: modal-sheet-in 160ms ease-out both;}@keyframes modal-sheet-in {- from { opacity: 0; transform: translateY(10px) scale(0.97); }+ from { opacity: 0; transform: scale(0.98); }to { opacity: 1; transform: none; }}@@ -1743,7 +1746,6 @@display: flex; flex-direction: column; outline: none;background: var(--sheet); border-radius: 10px;box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);- animation: picker-in 120ms cubic-bezier(0.2, 0.9, 0.3, 1) both;}.row-menu-item {display: block; width: 100%; padding: 5px 10px; border: 0; border-radius: 6px;@@ -1770,3 +1772,6 @@.info-mark.has-thumb { background: none; width: auto; height: auto; }.info-mark.has-thumb > * { transform: none; }.info-mark.has-thumb img { max-width: 160px; max-height: 140px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }+/* On the selection's blue an icon turns white, as Finder's do; a blue folder on blue vanished. */+.drive-rows:not(.is-grid) .drive-row.is-selected .drive-badge > svg { filter: brightness(0) invert(1); }+.drive-row.is-selected .drive-more { color: #fff; }diff --git a/src/styles/calendar.css b/src/styles/calendar.cssindex 468b431..36c8938 100644--- a/src/styles/calendar.css+++ b/src/styles/calendar.css@@ -602,10 +602,10 @@box-shadow: var(--shadow-sheet);/* Opacity and a small lift only, on the compositor: scaling from the corner read as ajump toward the click, and re-ran on every re-anchor. */- animation: cx-pop 140ms cubic-bezier(0.2, 0.9, 0.3, 1) both;- will-change: opacity, transform;+ /* A short fade and nothing else — no movement, no layer hint — as a macOS popover. */+ animation: cx-pop 110ms ease-out both;}-@keyframes cx-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }+@keyframes cx-pop { from { opacity: 0; } to { opacity: 1; } }@media (prefers-reduced-motion: reduce) { .cx-popover { animation: none; } }.cx-popover.is-info { gap: 4px; width: 280px; padding: 14px 16px; }.cx-info-title { margin: 0 0 2px; font-size: var(--t-17); font-weight: 700; line-height: 1.25; }diff --git a/src/styles/notes.css b/src/styles/notes.cssindex 9963171..c896a68 100644--- a/src/styles/notes.css+++ b/src/styles/notes.css@@ -193,8 +193,9 @@padding: 0 18px 24px 0;}.note-editor textarea {+ /* The whole pane, as Notes uses it. Held to 76ch, the text sat in a narrow column with its+ scrollbar stranded mid-window and the right half of the screen empty. */width: 100%;- max-width: 76ch;padding: 0;border: 0;background: none;diff --git a/src/styles/reminders.css b/src/styles/reminders.cssindex 2b7fa50..5306903 100644--- a/src/styles/reminders.css+++ b/src/styles/reminders.css@@ -545,3 +545,7 @@.rx-info-swatch:hover { transform: scale(1.08); }.rx-info-swatch.is-on { box-shadow: 0 0 0 2px var(--sheet, var(--bg)), 0 0 0 4px var(--text-3); }.rx-info-actions { display: flex; justify-content: space-between; width: 100%; margin-top: 4px; }++/* Date, then the Time switch, then the time once it is on — the phone's order. */+.rx-due { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }+.rx-due-switch { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-13); color: var(--text-2); }