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
Calendar: no sliver on a held press; reminders and new events laid out beside events
Yashwanth Kamireddif10ef39b4ef1
diff --git a/.uiverify/calendar-model.test.mjs b/.uiverify/calendar-model.test.mjsindex 23b5a0f..9ca6e52 100644--- a/.uiverify/calendar-model.test.mjs+++ b/.uiverify/calendar-model.test.mjs@@ -1,7 +1,7 @@// The arithmetic Calendar's views are drawn from, checked directly.import { test } from "node:test";import assert from "node:assert/strict";-import { placeDay, weekSpans, monthDays, daysOf, snap, clock } from "../src/screens/calendar/model.ts";+import { placeDay, placeDayWith, weekSpans, monthDays, daysOf, snap, clock } from "../src/screens/calendar/model.ts";const at = (y, m, d, h = 0, min = 0) => Math.floor(new Date(y, m, d, h, min).getTime() / 1000);const ev = (guid, startsAt, endsAt, allDay = false) =>@@ -55,6 +55,16 @@ test("overlapping meetings sit side by side; a later one gets the width back", (assert.equal(by.a.top, 540);});+test("a reminder due during a meeting takes a column beside it", () => {+ const day = new Date(2026, 8, 29);+ const { events, marks } = placeDayWith([ev("m", at(2026, 8, 29, 19), at(2026, 8, 29, 20))], day,+ [{ id: "r", top: 19 * 60, length: 22.5 }, { id: "late", top: 21 * 60, length: 22.5 }]);+ assert.deepEqual([events[0].column, events[0].columns], [0, 2]);+ const by = Object.fromEntries(marks.map((m) => [m.id, m]));+ assert.deepEqual([by.r.column, by.r.columns], [1, 2]);+ assert.deepEqual([by.late.column, by.late.columns], [0, 1]);+});+test("a five-minute call is still a quarter hour tall", () => {const [p] = placeDay([ev("x", at(2026, 8, 29, 9), at(2026, 8, 29, 9, 5))], new Date(2026, 8, 29));assert.equal(p.length, 15);diff --git a/.uiverify/calendar.mjs b/.uiverify/calendar.mjsindex 8438cf8..adb7650 100644--- a/.uiverify/calendar.mjs+++ b/.uiverify/calendar.mjs@@ -1,5 +1,6 @@// Calendar's Day and Week grids, checked in a real browser.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: 900 } });@@ -20,7 +21,7 @@ await ctx.addInitScript(() => {if (cmd === "calendar_events") return [{ guid: "e", calendarGuid: "c", title: "New Event", location: null,startsAt: at(19), endsAt: at(19, 15), allDay: false, timezone: null, url: null, notes: null, etag: null }];if (cmd === "reminders_due_between") return [r("a", "Pick up the parcel", at(8)), r("b", "Water the plants", at(8)),- { ...r("d", "Done already", at(16)), completedAt: at(16) }];+ { ...r("d", "Done already", at(16)), completedAt: at(16) }, r("s", "Study", at(19))];if (cmd === "calendar_sync") return { calendars: 1, events: 0 };if (cmd === "event_save") { (window.__saved ??= []).push(args.draft); return "E-new"; }if (cmd === "sync_all" || cmd === "sync_status") return { services: [], asOf: 1, tookMs: 0 };@@ -39,12 +40,23 @@ await page.waitForTimeout(300);let failures = 0;const ok = (pass, yes, no) => { console.log(pass ? `PASS ${yes}` : `FAIL ${no}`); if (!pass) failures++; };-const boxes = await page.locator(".cx-reminder").evaluateAll((els) =>- els.map((e) => { const r = e.getBoundingClientRect(); return [r.top, r.bottom]; }));+const boxes = await page.locator(".cx-reminder").evaluateAll((els) => els+ .filter((e) => /parcel|plants/.test(e.textContent))+ .map((e) => { const r = e.getBoundingClientRect(); return [r.top, r.bottom]; }));const apart = boxes.length === 2 && (boxes[0][1] <= boxes[1][0] || boxes[1][1] <= boxes[0][0]);ok(apart, "two reminders due at the same time are stacked, not drawn over each other",`the reminders at 8 overlap: ${JSON.stringify(boxes)}`);+// A reminder due during an event sits beside it, as in Calendar, not over its title.+const over = await page.evaluate(() => {+ const blocks = [...document.querySelectorAll(".cx-block:not(.is-draft)")].map((b) => b.getBoundingClientRect());+ return [...document.querySelectorAll(".cx-reminder")].filter((e) => {+ const r = e.getBoundingClientRect();+ return blocks.some((b) => r.left < b.right - 1 && r.right > b.left + 1 && r.top < b.bottom - 1 && r.bottom > b.top + 1);+ }).map((e) => e.textContent);+});+ok(over.length === 0, "a reminder due during an event is set beside it, not over it", `drawn over an event: ${JSON.stringify(over)}`);+const covered = await page.evaluate(() => {const now = document.querySelector(".cx-now-label")?.getBoundingClientRect();if (!now) return ["no now label"];@@ -79,8 +91,12 @@ const title = (await page.locator(".cx-title").innerText()).replace(/\s+/g, " ")ok(/Sep/.test(title) && /Oct/.test(title), `a week across two months is named for both [${title}]`,`the week of Sep 27 – Oct 3 is titled "${title}"`);-// Making an event, the way Calendar makes one.+// Making an event, the way Calendar makes one. The grid is scrolled to a known hour first:+// where it opens depends on the clock and the window, and a press that lands outside the+// grid proves nothing.{+ await page.evaluate(() => { document.querySelector(".cx-scroll").scrollTop = 12 * 48; });+ await page.waitForTimeout(100);const col = await page.locator(".cx-column").nth(3).boundingBox();const hour = (h) => col.y + h * 48;await page.mouse.click(col.x + 30, hour(14));@@ -88,6 +104,17 @@ ok(/Sep/.test(title) && /Oct/.test(title), `a week across two months is named fook((await page.locator(".cx-popover").count()) === 0, "a single click on empty time makes nothing","a single click on empty time opened a new event");+ // Held still, a press is not yet a drag: Calendar draws nothing until the pointer moves.+ await page.mouse.move(col.x + 30, hour(12));+ await page.mouse.down();+ await page.waitForTimeout(700);+ const held = await page.locator(".cx-block.is-draft").count();+ await page.mouse.up();+ await page.waitForTimeout(200);+ const after = await page.locator(".cx-block.is-draft, .cx-popover").count();+ ok(held === 0 && after === 0, "holding a press on empty time draws nothing",+ `a held press drew ${held} draft(s), ${after} left after release`);+await page.mouse.move(col.x + 30, hour(14));await page.mouse.down();await page.mouse.move(col.x + 30, hour(15.5), { steps: 6 });@@ -112,6 +139,8 @@ ok(/Sep/.test(title) && /Oct/.test(title), `a week across two months is named fo// A press whose release never arrives — what the app's WebKitGTK did — must not leave a// half-made event on the grid growing with every move of the mouse.{+ await page.evaluate(() => { document.querySelector(".cx-scroll").scrollTop = 12 * 48; });+ await page.waitForTimeout(100);const col = await page.locator(".cx-column").nth(2).boundingBox();// A real press; the release is swallowed before the app can hear it.await page.evaluate(() => {@@ -189,5 +218,66 @@ ok(/Sep/.test(title) && /Oct/.test(title), `a week across two months is named foawait tall.close();}+// A small window: the title is shortened, never cut, and a month cell with room for a line+// shows an event in it rather than only "N more".+{+ // The shared fixture — a real week's worth of events and reminders, with an all-day bar.+ const full = await b.newContext({ viewport: { width: 800, height: 600 } });+ await full.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null,+ calendarFixture: true, notesFixture: true, contactsFixture: true, driveFixture: true, remindersFixture: true });+ const small = await full.newPage();+ await small.setViewportSize({ width: 800, height: 600 });+ // A Wednesday whose week crosses into the next month, so Week's title is its longest.+ await small.clock.setFixedTime(new Date(2026, 8, 30, 18, 0));+ await small.goto("http://localhost:4173", { waitUntil: "networkidle" });+ await small.locator(".nav-item", { hasText: "Calendar" }).click();+ for (const view of ["Week", "Month"]) {+ await small.getByRole("button", { name: view, exact: true }).click();+ await small.waitForTimeout(400);+ const narrow = await small.evaluate(() => {+ const t = document.querySelector(".cx-title");+ const views = document.querySelector(".cx-tools").getBoundingClientRect();+ const tr = t.getBoundingClientRect();+ // A cell that shows only "N more" though no all-day bar crosses it gave its room away.+ const bars = [...document.querySelectorAll(".cx-bar-event")].map((b) => b.getBoundingClientRect());+ const starved = [...document.querySelectorAll(".cx-day")].filter((d) => {+ if (!d.querySelector(".cx-more") || d.querySelector(".cx-item")) return false;+ const r = d.getBoundingClientRect();+ return !bars.some((b) => b.left < r.right - 1 && b.right > r.left + 1 && b.top < r.bottom && b.bottom > r.top);+ });+ return {+ cut: t.scrollWidth > t.clientWidth + 1,+ oneRow: Math.abs((tr.top + tr.bottom) / 2 - (views.top + views.bottom) / 2) < 8,+ text: t.innerText.trim(),+ starved: starved.length,+ };+ });+ ok(!narrow.cut, `${view}: a narrow calendar's title is whole [${narrow.text}]`, `${view}: the title is cut: ${JSON.stringify(narrow)}`);+ ok(narrow.oneRow, `${view}: its toolbar stays one row`, `${view}: the toolbar broke onto two rows`);+ if (view === "Month")+ ok(narrow.starved === 0, "a month cell with room shows an event, not only \"N more\"",+ `${narrow.starved} cell(s) show only "N more"`);+ }++ // "+" at six: the new event, 7 to 8, crosses the 7:30 Dentist — it takes a column beside it,+ // and its popover opens by it, never over the toolbar.+ await small.getByRole("button", { name: "Week", exact: true }).click();+ await small.waitForTimeout(300);+ await small.getByRole("button", { name: "New event" }).click();+ await small.waitForTimeout(300);+ const placed = await small.evaluate(() => {+ const hit = (a, b) => a.left < b.right - 1 && a.right > b.left + 1 && a.top < b.bottom - 1 && a.bottom > b.top + 1;+ const draft = document.querySelector(".cx-block.is-draft")?.getBoundingClientRect();+ const pop = document.querySelector(".cx-popover")?.getBoundingClientRect();+ const bar = document.querySelector(".cx-bar").getBoundingClientRect();+ const others = [...document.querySelectorAll(".cx-block:not(.is-draft)")].map((b) => b.getBoundingClientRect());+ return { draft: Boolean(draft), over: draft ? others.filter((o) => hit(draft, o)).length : -1, onBar: pop ? hit(pop, bar) : null };+ });+ ok(placed.draft && placed.over === 0, "a new event is set beside the event it overlaps", `the new event: ${JSON.stringify(placed)}`);+ ok(placed.onBar === false, "its popover opens clear of the toolbar", `the popover: ${JSON.stringify(placed)}`);+ await small.keyboard.press("Escape");+ await full.close();+}+await b.close();process.exitCode = failures === 0 ? 0 : 1;diff --git a/.uiverify/engine.mjs b/.uiverify/engine.mjsindex 24917c4..f316a00 100644--- a/.uiverify/engine.mjs+++ b/.uiverify/engine.mjs@@ -1,11 +1,38 @@// Which browser engine a suite drives. Quince draws in WebKitGTK, so WebKit is the one that// matters; Chromium stays the default only because it needs nothing extra to run.//-// ENGINE=webkit node .uiverify/calendar.mjs+// ENGINE=webkit node .uiverify/calendar.mjs WebKit's WPE port, off-screen+// ENGINE=gtk node .uiverify/calendar.mjs WebKit's GTK port — Quince's own — in a real+// window on this display//// Playwright's WebKit build wants a few libraries this machine's distribution names// differently; .uiverify/webkit-libs.sh fetches them into a private folder, no root needed.import { chromium, webkit } from "playwright";-export const engineName = process.env.ENGINE === "webkit" ? "webkit" : "chromium";-export const engine = engineName === "webkit" ? webkit : chromium;+export const engineName = ["webkit", "gtk"].includes(process.env.ENGINE) ? process.env.ENGINE : "chromium";+const base = engineName === "chromium" ? chromium : webkit;+/**+ * In the GTK port the window is a real one on this desktop, and a tiling window manager sizes+ * it — Playwright's attempt to resize it is refused ("Failed to resize window"). So a GTK run+ * takes whatever size it is given: contexts get no fixed viewport and pages ignore requests to+ * change it. The suites that matter here measure from the elements themselves.+ */+export const engine = {+ launch: async (options = {}) => {+ const browser = await base.launch({ ...options, ...(engineName === "gtk" ? { headless: false } : {}) });+ if (engineName !== "gtk") return browser;+ const newContext = browser.newContext.bind(browser);+ browser.newContext = async (opts = {}) => {+ const ctx = await newContext({ ...opts, viewport: null });+ const newPage = ctx.newPage.bind(ctx);+ ctx.newPage = async () => {+ const page = await newPage();+ page.setViewportSize = async () => {};+ return page;+ };+ return ctx;+ };+ browser.newPage = async (opts = {}) => (await browser.newContext(opts)).newPage();+ return browser;+ },+};diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex f4b7ad3..5e43646 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -17,7 +17,7 @@ import {hourLabel,midnight,monthDays,- placeDay,+ placeDayWith,sameDay,seconds,snap,@@ -307,17 +307,27 @@ export function CalendarView() {at);};- const pointAt = (el: Element | null): Anchor => {- const r = el?.getBoundingClientRect();- return r ? { x: r.right, y: r.top } : { x: window.innerWidth / 2, y: 120 };- };/** "New event": the next whole hour on the selected day, for an hour — Apple's default. */const newEvent = (e: React.MouseEvent) => {const at = new Date(selected);at.setHours(now.getHours() + 1, 0, 0, 0);- newAt(seconds(at), seconds(at) + 3600, false, pointAt(e.currentTarget));+ const button = e.currentTarget.getBoundingClientRect();+ // Under the button, never over the toolbar; in Day and Week it moves beside the new event+ // once that is drawn.+ newAt(seconds(at), seconds(at) + 3600, false, { x: button.right, y: button.bottom + 32 });+ setFollowDraft(true);};+ const [followDraft, setFollowDraft] = useState(false);+ useLayoutEffect(() => {+ if (!followDraft) return;+ setFollowDraft(false);+ const block = document.querySelector(".cx-block.is-draft");+ if (!block) return;+ block.scrollIntoView({ block: "nearest" });+ const r = block.getBoundingClientRect();+ setAnchor({ x: r.right, y: r.top, left: r.left });+ }, [followDraft]);const shift = (by: number) =>setSelected((d) => {@@ -342,26 +352,30 @@ export function CalendarView() {return () => window.removeEventListener("keydown", onKey);});+ /** The title, and the shorter one a narrow calendar shows in its place ("Sep 2026"). */const title = useMemo(() => {- if (view === "year") return { strong: String(selected.getFullYear()), rest: "" };+ const short = (d: Date) => d.toLocaleDateString(undefined, { month: "short" });+ if (view === "year") {+ const year = String(selected.getFullYear());+ return { strong: year, rest: "", brief: year };+ }if (view === "day")return {strong: selected.toLocaleDateString(undefined, { day: "numeric", month: "long" }),rest: `${selected.getFullYear()}`,+ brief: selected.toLocaleDateString(undefined, { day: "numeric", month: "short" }),};// A week across two months is named for both, as Calendar does: "Sep – Oct 2026".if (view === "week" && week[0].getMonth() !== week[6].getMonth()) {- const short = (d: Date) => d.toLocaleDateString(undefined, { month: "short" });const sameYear = week[0].getFullYear() === week[6].getFullYear();- return {- strong: `${short(week[0])}${sameYear ? "" : ` ${week[0].getFullYear()}`} – ${short(week[6])}`,- rest: String(week[6].getFullYear()),- };+ const strong = `${short(week[0])}${sameYear ? "" : ` ${week[0].getFullYear()}`} – ${short(week[6])}`;+ return { strong, rest: String(week[6].getFullYear()), brief: `${strong} ${week[6].getFullYear()}` };}const base = view === "week" ? week[6] : selected;return {strong: base.toLocaleDateString(undefined, { month: "long" }),rest: String(base.getFullYear()),+ brief: `${short(base)} ${base.getFullYear()}`,};}, [view, selected, week]);@@ -420,8 +434,13 @@ export function CalendarView() {<section className="cx-main"><header className="cx-bar">- <h1 className="cx-title">- <strong>{title.strong}</strong> {title.rest}+ <h1 className="cx-title" aria-label={`${title.strong} ${title.rest}`.trim()}>+ <span className="cx-title-full" aria-hidden="true">+ <strong>{title.strong}</strong> {title.rest}+ </span>+ <strong className="cx-title-brief" aria-hidden="true">+ {title.brief}+ </strong></h1><div className="segmented" role="group" aria-label="View">{VIEWS.map((v) => (@@ -688,13 +707,14 @@ function MonthView({<div className="cal-grid" role="grid" aria-label="Month" ref={grid}>{weeks.map((row) => {const spans = weekSpans(events, row[0]);- const lanes = Math.max(0, ...spans.map((s) => s.lane + 1));return (<div className="cx-week" role="row" key={dayKey(row[0])}>{row.map((day, i) => {const list = items(day);- const lanesHere = spans.filter((s) => s.from <= i && s.to >= i).length;- const room = Math.max(0, rows - Math.max(lanes, lanesHere));+ // Only the lanes of the bars that cross this day are kept clear in it: a bar+ // at the end of the week had left the days before it room for nothing.+ const lanesHere = Math.max(0, ...spans.filter((s) => s.from <= i && s.to >= i).map((s) => s.lane + 1));+ const room = Math.max(0, rows - lanesHere);// What fits, and when it does not, one line fewer so "N more" has a line too.const visible = list.length > room ? list.slice(0, Math.max(0, room - 1)) : list;const more = list.length - visible.length;@@ -725,7 +745,7 @@ function MonthView({? day.toLocaleDateString(undefined, { month: "short", day: "numeric" }): day.getDate()}</span>- <ul className="cx-items" style={{ marginTop: `${lanes * LANE}px` }}>+ <ul className="cx-items" style={{ marginTop: `${lanesHere * LANE}px` }}>{visible.map((item) =>item.kind === "event" ? (<li key={item.event.guid}>@@ -927,7 +947,13 @@ function TimeGrid({window.addEventListener("pointercancel", drop);window.addEventListener("blur", drop);window.addEventListener("keydown", key);+ // A native drag, if one starts anyway, takes the pointer until it ends: the drag here+ // ends with it rather than waiting for a release that will not come.+ window.addEventListener("dragstart", drop);+ window.addEventListener("dragend", drop);return () => {+ window.removeEventListener("dragstart", drop);+ window.removeEventListener("dragend", drop);window.removeEventListener("pointermove", move);window.removeEventListener("pointerup", up);window.removeEventListener("mouseup", up);@@ -947,6 +973,32 @@ function TimeGrid({setDragNow({ kind: "create", day: days[at.column], column: at.column, from, to: from + 15 });};+ // Each day's events and timed reminders, laid out together so neither is drawn over the other.+ const layouts = days.map((d) => {+ const due = stackReminders(reminders.filter((r) => r.dueAt !== null && sameDay(dateOf(r.dueAt), d)));+ const marks = due.map(({ reminder, top }) => ({+ id: reminder.guid,+ top: (top / HOUR) * 60,+ length: (REMINDER_LINE / HOUR) * 60,+ }));+ // The event being named takes its own column too, beside what it overlaps, not over it.+ if (pending && sameDay(dateOf(pending.startsAt), d)) {+ const from = dateOf(pending.startsAt);+ marks.push({+ id: PENDING,+ top: from.getHours() * 60 + from.getMinutes(),+ length: Math.max((pending.endsAt - pending.startsAt) / 60, 15),+ });+ }+ const laid = placeDayWith(events, d, marks);+ return {+ events: laid.events,+ marks: laid.marks.filter((m) => m.id !== PENDING),+ pending: laid.marks.find((m) => m.id === PENDING) ?? null,+ reminders: new Map(due.map((x) => [x.reminder.guid, x.reminder])),+ };+ });+const nowMinutes = today.getHours() * 60 + today.getMinutes();const todayColumn = days.findIndex((d) => sameDay(d, today));@@ -1015,6 +1067,11 @@ function TimeGrid({ref={columnsEl}style={{ "--cols": days.length } as React.CSSProperties}onPointerDown={onColumnDown}+ // A press on the grid starts making an event, never a text selection or a native+ // drag: in WebKitGTK either would take the pointer and the events that end the+ // drag with it.+ onMouseDown={(e) => e.preventDefault()}+ onDragStart={(e) => e.preventDefault()}onDoubleClick={(e) => {if ((e.target as HTMLElement).closest(".cx-block")) return;const at = where(e.clientX, e.clientY);@@ -1026,7 +1083,7 @@ function TimeGrid({>{days.map((d, column) => (<div className={`cx-column${d.getDay() === 0 || d.getDay() === 6 ? " is-weekend" : ""}`} key={dayKey(d)}>- {placeDay(events, d).map((p) => {+ {layouts[column].events.map((p) => {const moving = drag?.kind === "move" && drag.event.guid === p.event.guid ? drag : null;const c = calendars.get(p.event.calendarGuid);return (@@ -1065,30 +1122,40 @@ function TimeGrid({</button>);})}- {stackReminders(reminders.filter((r) => r.dueAt !== null && sameDay(dateOf(r.dueAt), d)))- .map(({ reminder: r, top }) => (+ {layouts[column].marks.map((m) => {+ const r = layouts[column].reminders.get(m.id)!;+ return (<spankey={r.guid}className={`cx-reminder${r.completedAt ? " is-done" : ""}`}- style={{ top: `${top}px` }}+ style={{+ top: `${(m.top / 60) * HOUR}px`,+ left: `calc(${(m.column / m.columns) * 100}% + 4px)`,+ maxWidth: `calc(${100 / m.columns}% - 8px)`,+ }}><span className="cx-ring" aria-hidden="true" />{r.title}</span>- ))}- {pending && !drag && sameDay(dateOf(pending.startsAt), d) && (+ );+ })}+ {pending && !drag && layouts[column].pending && (<spanclassName="cx-block is-draft"style={{- top: `${((dateOf(pending.startsAt).getHours() * 60 + dateOf(pending.startsAt).getMinutes()) / 60) * HOUR}px`,- height: `${Math.max(((pending.endsAt - pending.startsAt) / 3600) * HOUR - 2, 20)}px`,+ top: `${(layouts[column].pending!.top / 60) * HOUR}px`,+ height: `${Math.max((layouts[column].pending!.length / 60) * HOUR - 2, 20)}px`,+ left: `${(layouts[column].pending!.column / layouts[column].pending!.columns) * 100}%`,+ width: `calc(${100 / layouts[column].pending!.columns}% - 3px)`,}}><span className="cx-block-title">{pending.title.trim() || "New Event"}</span><span className="cx-block-time">{clock(pending.startsAt)}</span></span>)}- {drag?.kind === "create" && drag.column === column && (+ {/* Drawn once the drag is one, never for a press held still: a+ quarter-hour sliver that release then discards reads as a bug. */}+ {drag?.kind === "create" && drag.column === column && drag.to - drag.from > 15 && (<spanclassName="cx-block is-draft"style={{ top: `${(drag.from / 60) * HOUR}px`, height: `${((drag.to - drag.from) / 60) * HOUR}px` }}@@ -1120,8 +1187,11 @@ function TimeGrid({* Where each reminder sits on a day's hour grid. Two due at the same time — a morning routine* set for eight — stack one under the other instead of being drawn over each other.*/+const REMINDER_LINE = 18;+/** The layout's name for the event being named, which has no guid yet. */+const PENDING = "\u0000pending";export function stackReminders(list: Reminder[]): { reminder: Reminder; top: number }[] {- const LINE = 18;+ const LINE = REMINDER_LINE;const sorted = [...list].sort((a, b) => (a.dueAt ?? 0) - (b.dueAt ?? 0) || a.title.localeCompare(b.title));let lastBottom = -Infinity;return sorted.map((reminder) => {@@ -1264,7 +1334,10 @@ function EventPopover({const { width, height } = el.getBoundingClientRect();const gap = 12;let left = at.x + gap;- if (left + width > window.innerWidth - 8) left = Math.max(8, (at.left ?? at.x) - width - gap);+ if (left + width > window.innerWidth - 8) left = (at.left ?? at.x) - width - gap;+ // Neither side free — a block as wide as Day's column — so over its far end, clear of+ // its title, which begins at the other.+ if (left < 8) left = Math.max(8, window.innerWidth - width - 8);const top = Math.min(Math.max(8, at.y - 24), window.innerHeight - height - 8);setPos({ left, top });}, [at]);diff --git a/src/screens/calendar/model.ts b/src/screens/calendar/model.tsindex 3b45775..2888eb0 100644--- a/src/screens/calendar/model.ts+++ b/src/screens/calendar/model.ts@@ -107,6 +107,10 @@ export type Placed = {columns: number;};+/** Something else on the hour grid that takes room there — a reminder due at a time. */+export type Mark = { id: string; top: number; length: number };+export type PlacedMark = Mark & { column: number; columns: number };+/*** The timed events of one day, placed and set side by side where they overlap.*@@ -115,37 +119,62 @@ export type Placed = {* up. A block is never shorter than a quarter hour, or a five-minute call would be unreadable.*/export function placeDay(events: CalendarEvent[], day: Date): Placed[] {+ return placeDayWith(events, day, []).events;+}++/**+ * The same, with the day's reminders laid out among the events rather than over them: a+ * reminder due during a meeting sits in a column beside it, as it does in Calendar, and the+ * meeting's title stays readable.+ */+export function placeDayWith(+ events: CalendarEvent[],+ day: Date,+ marks: Mark[],+): { events: Placed[]; marks: PlacedMark[] } {const start = seconds(midnight(day));const end = seconds(addDays(day, 1));- const timed = events- .filter((e) => !spansDays(e) && e.endsAt > start && e.startsAt < end)- .map((event) => {- const from = Math.max(event.startsAt, start);- const to = Math.min(Math.max(event.endsAt, event.startsAt), end);- const top = (from - start) / 60;- return { event, top, length: Math.max((to - from) / 60, 15) };- })- .sort((a, b) => a.top - b.top || b.length - a.length);+ type Item = { top: number; length: number; column: number; columns: number } & (+ | { kind: "event"; event: CalendarEvent }+ | { kind: "mark"; mark: Mark }+ );+ const items: Item[] = [+ ...events+ .filter((e) => !spansDays(e) && e.endsAt > start && e.startsAt < end)+ .map((event): Item => {+ const from = Math.max(event.startsAt, start);+ const to = Math.min(Math.max(event.endsAt, event.startsAt), end);+ return { kind: "event", event, top: (from - start) / 60, length: Math.max((to - from) / 60, 15), column: 0, columns: 1 };+ }),+ ...marks.map((mark): Item => ({ kind: "mark", mark, top: mark.top, length: mark.length, column: 0, columns: 1 })),+ ].sort((a, b) => a.top - b.top || b.length - a.length);- const out: Placed[] = [];- let cluster: Placed[] = [];+ let cluster: Item[] = [];let clusterEnd = -1;const close = () => {const columns = Math.max(1, ...cluster.map((p) => p.column + 1));for (const p of cluster) p.columns = columns;- out.push(...cluster);cluster = [];};- for (const item of timed) {+ for (const item of items) {if (item.top >= clusterEnd && cluster.length) close();const busy = cluster.filter((p) => p.top + p.length > item.top).map((p) => p.column);let column = 0;while (busy.includes(column)) column++;- cluster.push({ ...item, column, columns: 1 });+ item.column = column;+ cluster.push(item);clusterEnd = Math.max(clusterEnd, item.top + item.length);}if (cluster.length) close();- return out;++ const placed: Placed[] = [];+ const placedMarks: PlacedMark[] = [];+ for (const p of items) {+ const { top, length, column, columns } = p;+ if (p.kind === "event") placed.push({ event: p.event, top, length, column, columns });+ else placedMarks.push({ ...p.mark, top, length, column, columns });+ }+ return { events: placed, marks: placedMarks };}/** Snap a number of minutes to the nearest quarter hour, as dragging in Calendar does. */diff --git a/src/styles/calendar.css b/src/styles/calendar.cssindex a983e26..3fae7cf 100644--- a/src/styles/calendar.css+++ b/src/styles/calendar.css@@ -1,6 +1,14 @@/* Calendar, laid out the way macOS Calendar is. Scoped under `.cx`. */-.content:has(.cx) { display: flex; flex-direction: column; overflow: hidden; padding-top: 18px; }+.content:has(.cx) {+ display: flex;+ flex-direction: column;+ overflow: hidden;+ padding-top: 18px;+ /* The calendar lays itself out by the room it has, not the window's: the app's own sidebar+ takes a share of the window, so a window-sized rule came in far too late. */+ container: cx-page / inline-size;+}.cx {flex: 1;@@ -119,14 +127,17 @@.cx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }/* Title, then the scopes, then stepping — wrapping onto a second line in a narrow windowrather than running into each other. */+/* One row, as Calendar's toolbar is: the title gives way first, and only a very narrow+ calendar lets the controls drop beneath it. */.cx-bar {display: flex;- flex-wrap: wrap;+ flex-wrap: nowrap;align-items: center;gap: 10px 16px;padding: 0 18px 12px;}-.cx-title {+/* Under `.cx` so it outranks the app's `.content h1`, which had set it at 28px. */+.cx .cx-title {flex: 1 1 auto;min-width: 0;margin: 0;@@ -138,7 +149,9 @@text-overflow: ellipsis;}.cx-title strong { font-weight: 700; }-.cx-tools { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }+.cx-title-brief { display: none; }+.cx-bar > .segmented { flex: none; }+.cx-tools { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }.cx-step { display: inline-flex; align-items: center; gap: 2px; }.cx-icon {@@ -367,6 +380,9 @@.cx-columns {position: relative;+ -webkit-user-select: none;+ user-select: none;+ -webkit-user-drag: none;flex: 1;display: grid;grid-template-columns: repeat(var(--cols), minmax(0, 1fr));@@ -476,12 +492,21 @@.cx-year-month { margin: 0 0 6px; color: var(--text); font-size: var(--t-15); font-weight: 700; }.cx-year-month.is-current { color: var(--sys-red); }-@media (max-width: 1100px) { .cal-year { grid-template-columns: repeat(3, minmax(0, 1fr)); } }-@media (max-width: 820px) {+@container cx-page (max-width: 900px) { .cal-year { grid-template-columns: repeat(3, minmax(0, 1fr)); } }+@container cx-page (max-width: 760px) {.cx { grid-template-columns: 1fr; }.cx-side { display: none; }.cal-year { grid-template-columns: repeat(2, minmax(0, 1fr)); }- .cx-bar { grid-template-columns: 1fr; justify-items: start; }+ .cx .cx-title { font-size: 18px; }+ .cx-title-full { display: none; }+ .cx-title-brief { display: inline; }+ .cx-bar { gap: 10px 12px; padding-inline: 12px; }+ .cx-bar .segment { padding-inline: 7px; }+ .cx-tools { gap: 6px; }+}+@container cx-page (max-width: 470px) {+ .cx-bar { flex-wrap: wrap; }+ .cx .cx-title { flex-basis: 100%; }}/* ---- the event popover --------------------------------------------------------------- */@@ -527,8 +552,27 @@font-size: var(--t-13);color-scheme: light dark;}-.cx-pop-row input[type="checkbox"] { justify-self: start; width: 16px; height: 16px; accent-color: var(--sys-blue); }-.cx-pop-notes { padding: 0; font-size: var(--t-13); resize: vertical; }+/* Drawn, not left to the engine: WebKitGTK paints its own toolkit's white box here. */+.cx-pop-row input[type="checkbox"] {+ justify-self: start;+ width: 14px;+ height: 14px;+ margin: 0;+ border: 1px solid var(--field-edge);+ border-radius: 4px;+ background: var(--field) center / 10px no-repeat;+ appearance: none;+ -webkit-appearance: none;+ transition: background-color 120ms var(--ease);+}+.cx-pop-row input[type="checkbox"]:checked {+ border-color: var(--sys-blue);+ background-color: var(--sys-blue);+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2 4.1 7.3 8 2.8' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+}+.cx-pop-row input[type="checkbox"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--sys-blue) 45%, transparent); outline-offset: 1px; }+/* Notes grow with what is written, as in Calendar; no grip in the corner. */+.cx-pop-notes { min-height: 2.6em; max-height: 9em; padding: 0; font-size: var(--t-13); resize: none; field-sizing: content; }.cx-pop-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.cx-pop-actions > span { display: flex; gap: 6px; }.cx-pop-delete { padding: 4px 6px; border: 0; background: none; color: var(--sys-red); font: inherit; font-size: var(--t-13); cursor: default; }diff --git a/src/styles/tokens.css b/src/styles/tokens.cssindex 8fac781..1f5ecc0 100644--- a/src/styles/tokens.css+++ b/src/styles/tokens.css@@ -95,6 +95,18 @@ body {font-synthesis-weight: none;}+/* Scrollbars as macOS draws them: a thin rounded thumb on no track, not the toolkit's wide+ gutter — WebKitGTK otherwise paints GTK's own, a chunky bar beside every list. */+::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }+::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }+::-webkit-scrollbar-thumb {+ border: 3px solid transparent;+ border-radius: 5px;+ background: color-mix(in srgb, var(--text) 24%, transparent) padding-box;+}+::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 40%, transparent); }+::-webkit-scrollbar-button { display: none; }+@media (prefers-reduced-motion: reduce) {*, *::before, *::after {animation-duration: 0.01ms !important;