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.

Notes: text colours from the phone, empty table cells editable, tables copy as their cells; sidebar folds in one step

Yashwanth Kamireddi84b53efafd26
diff --git a/.uiverify/notes-table.mjs b/.uiverify/notes-table.mjs
index 58c2657..742bc60 100644
--- a/.uiverify/notes-table.mjs
+++ b/.uiverify/notes-table.mjs
@@ -1,6 +1,6 @@
// A table in a note, drawn as its grid and edited in place: a typed cell takes typing as its
// own (the note's text is untouched), saves when left, and goes back with the reason if Apple
-// refuses; a cell never typed in says it cannot be changed here yet.
+// refuses; an empty cell takes typing like any other.
import { engine } from "./engine.mjs";
import { SERVICES, installStub, openScreen } from "./stub.mjs";
const b = await engine.launch();
@@ -39,6 +39,32 @@ await page.keyboard.type("0");
await page.keyboard.press("Enter");
await page.waitForTimeout(500);
ok((await qty.textContent()) === "2" && /refused/.test((await qty.getAttribute("title")) ?? ""), "a change Apple refuses goes back, and says why");
-ok((await page.locator(".nf-cell-empty").count()) === 2, "a cell never typed in is shown but not offered for editing");
+const coloured = await page.locator(".note-rich .nf-em-4").evaluateAll((e) => e.map((x) => [x.textContent, getComputedStyle(x).color]));
+ok(coloured.length === 1 && coloured[0][0] === "end" && !/rgb\(29, 29, 31\)|rgb\(0, 0, 0\)/.test(coloured[0][1]), `text coloured on a phone shows in its colour ${JSON.stringify(coloured)}`);
+// Copying the note puts the table's cells out, never a placeholder word.
+const copied = await page.evaluate(() => {
+ const ed = document.querySelector(".note-rich");
+ ed.focus();
+ const range = document.createRange();
+ range.selectNodeContents(ed);
+ getSelection().removeAllRanges();
+ getSelection().addRange(range);
+ return new Promise((done) => setTimeout(() => {
+ const data = new DataTransfer();
+ ed.dispatchEvent(new ClipboardEvent("copy", { clipboardData: data, bubbles: true, cancelable: true }));
+ done({ text: data.getData("text/plain"), html: data.getData("text/html") });
+ }, 50));
+});
+ok(!/Attachment/.test(copied.text + copied.html) && /Item\tQty/.test(copied.text) && /<td>Milk \(oat\)<\/td>/.test(copied.html), `copying a table copies its cells ${JSON.stringify(copied).slice(0, 300)}`);
+// An empty cell takes typing too: tables made on a phone hold an empty text for every cell.
+const empty = page.locator(".nf-table tr").nth(2).locator(".nf-cell-edit").first();
+ok((await page.locator(".nf-cell-empty").count()) === 0 && (await empty.count()) === 1, "an empty cell is offered for editing");
+await page.evaluate(() => { window.__cellFail = false; window.__cellWrites = []; });
+await empty.click();
+await page.keyboard.type("Bread");
+await page.keyboard.press("Enter");
+await page.waitForTimeout(400);
+const w2 = await page.evaluate(() => window.__cellWrites);
+ok((await empty.textContent()) === "Bread" && w2?.length === 1 && w2[0].row === 2 && w2[0].column === 0 && w2[0].text === "Bread", `typing in an empty cell saves it ${JSON.stringify(w2)}`);
await b.close();
process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/settings.mjs b/.uiverify/settings.mjs
index 01d4a46..0d75777 100644
--- a/.uiverify/settings.mjs
+++ b/.uiverify/settings.mjs
@@ -63,7 +63,8 @@ await page.evaluate(() => {
});
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");
+// Not slid either: a screen of text moved frame by frame shimmered in WebKitGTK.
+ok(!(await page.evaluate(() => window.__slid)), "folding moves the content once, without sliding a screen of text");
// A diagnostic report is written for the person to read and send, and says where.
await page.locator(".sidebar-account").click();
await page.waitForSelector(".settings");
diff --git a/.uiverify/sidebar-fold.mjs b/.uiverify/sidebar-fold.mjs
index f048b4f..7673387 100644
--- a/.uiverify/sidebar-fold.mjs
+++ b/.uiverify/sidebar-fold.mjs
@@ -1,6 +1,6 @@
-// Folding the sidebar and opening it again: the content travels one way from where it was
-// to where it goes, every frame — never drawn at the destination first and then thrown
-// back, which was the whole window glitching.
+// Folding the sidebar and opening it again is one step: the sidebar is at its old width or
+// its new one, never in between, and the content jumps once. On WebKitGTK every frame in
+// between redrew the sidebar's rows and showed the content under it: the flicker he saw.
import { engine } from "./engine.mjs";
import { SERVICES, installStub, openScreen } from "./stub.mjs";
const b = await engine.launch();
@@ -15,7 +15,9 @@ for (const name of ["Fold Sidebar to Icons", "Show Sidebar Names"]) {
await page.evaluate(() => {
window.__xs = [];
const h1 = document.querySelector(".cx-title");
- const tick = () => { window.__xs.push(Math.round(h1.getBoundingClientRect().left)); if (window.__xs.length < 30) requestAnimationFrame(tick); };
+ const side = document.querySelector(".sidebar");
+ window.__ws = [];
+ const tick = () => { window.__xs.push(Math.round(h1.getBoundingClientRect().left)); window.__ws.push(Math.round(side.getBoundingClientRect().width)); if (window.__xs.length < 30) requestAnimationFrame(tick); };
requestAnimationFrame(tick);
});
await page.getByRole("button", { name }).click();
@@ -25,6 +27,11 @@ for (const name of ["Fold Sidebar to Icons", "Show Sidebar Names"]) {
const back = xs.slice(1).filter((x, i) => Math.sign(x - xs[i]) === -dir && Math.abs(x - xs[i]) > 2).length;
console.log(`${back ? "FAIL" : "PASS"} ${name}: the content moves one way [${xs.join(" ")}]`);
if (back) failures++;
+ const ws = await page.evaluate(() => window.__ws);
+ const widths = new Set(ws).size, places = new Set(xs).size;
+ const step = widths <= 2 && places <= 2;
+ console.log(`${step ? "PASS" : "FAIL"} ${name}: one step, no frames in between widths [${[...new Set(ws)].join(" ")}]`);
+ if (!step) failures++;
}
await b.close();
process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index 1569b66..c1dad47 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -218,7 +218,8 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
if (args.guid === "nT") {
// "Groceries", a table on its own line, then a last line: the table's run names it.
const plain = (length) => ({ length, style: null, indent: 0, checked: null, bold: false, italic: false, underline: false, strike: false, link: null });
- return [plain(10), { ...plain(1), attachment: "T1" }, plain(4)];
+ // "end" coloured mint on a phone (field 14).
+ return [plain(10), { ...plain(1), attachment: "T1" }, plain(1), { ...plain(3), emphasis: 4 }];
}
// Curtains, set as a phone sets one: a title, then a dashed list and a ticked item.
if (args.guid !== "n1") return [];
diff --git a/crates/quince-icloud/src/ckdocument.rs b/crates/quince-icloud/src/ckdocument.rs
index 957ebf7..0bfbec6 100644
--- a/crates/quince-icloud/src/ckdocument.rs
+++ b/crates/quince-icloud/src/ckdocument.rs
@@ -1026,6 +1026,11 @@ pub fn set_runs(original: &[u8], runs: &[Run]) -> Option<Vec<u8>> {
} else {
without_field(&piece, 7)?
};
+ // The text's colour as the screen has it, so a save never drops one.
+ piece = match inline.emphasis {
+ Some(e) => set_varint_field(&piece, 14, e)?,
+ None => without_field(&piece, 14)?,
+ };
piece = without_field(&piece, 9)?;
if let Some(link) = inline.link.as_deref().filter(|l| !l.is_empty()) {
piece.extend(length_delimited(9, link.as_bytes()));
@@ -1696,6 +1701,10 @@ pub struct Run {
/// Read only: an attachment's place is kept from Apple's own run, never written from this.
#[serde(skip_serializing_if = "Option::is_none")]
pub attachment: Option<String>,
+ /// Notes' text colour (iOS 18 and later), field 14: 1 purple, 2 pink, 3 orange, 4 mint,
+ /// 5 blue. Measured on a note coloured on a phone.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub emphasis: Option<u64>,
}
/// Every run of a note document, in order. Empty for anything that is not one.
@@ -1740,6 +1749,7 @@ fn parse_run(bytes: &[u8]) -> Option<Run> {
let info = reader.take(n)?;
run.attachment = bytes_field(info, 1).and_then(|id| String::from_utf8(id).ok());
}
+ (14, WIRE_VARINT) => run.emphasis = Some(reader.varint()?).filter(|&e| e > 0),
_ => reader.skip(wire)?,
}
}
@@ -2749,6 +2759,24 @@ mod run_tests {
);
}
+ /// Text coloured on a phone (field 14) is read, kept through a save that leaves it, and
+ /// taken off only where the editor took it off.
+ #[test]
+ fn text_colour_is_read_kept_and_removed() {
+ let mut mint = Vec::new();
+ varint(14 << 3, &mut mint);
+ varint(4, &mut mint);
+ let doc = doc_with("Hello world", &[(5, mint), (6, Vec::new())]);
+ let read = runs_from_base64(&B64.encode(&doc));
+ assert_eq!(read[0].emphasis, Some(4));
+ assert_eq!(read[1].emphasis, None);
+ let kept = runs_from_base64(&B64.encode(set_runs(&doc, &read).unwrap()));
+ assert_eq!(kept[0].emphasis, Some(4), "a save dropped the colour");
+ let plain = vec![body(11)];
+ let cleared = runs_from_base64(&B64.encode(set_runs(&doc, &plain).unwrap()));
+ assert!(cleared.iter().all(|r| r.emphasis.is_none()));
+ }
+
/// A style is the line's: one set on half a line covers all of it, from its newline.
#[test]
fn a_paragraph_style_covers_its_whole_line() {
diff --git a/crates/quince-icloud/src/notes.rs b/crates/quince-icloud/src/notes.rs
index 068f856..7485842 100644
--- a/crates/quince-icloud/src/notes.rs
+++ b/crates/quince-icloud/src/notes.rs
@@ -82,6 +82,7 @@ fn note_from_record(record: &Value) -> Option<Note> {
// The stored title where there is one; otherwise the phone's rule applied to the text,
// and "New Note" — Apple's word, not ours — only when there is no text at all.
title: title
+ .map(|t| words_only(&t))
.filter(|t| !t.trim().is_empty())
.or_else(|| {
body.as_deref()
@@ -89,7 +90,10 @@ fn note_from_record(record: &Value) -> Option<Note> {
.filter(|t| !t.is_empty())
})
.unwrap_or_else(|| "New Note".into()),
- snippet: field::document_text(record, "SnippetEncrypted"),
+ // Apple's own snippet of a note full of attachments is a row of their marks.
+ snippet: field::document_text(record, "SnippetEncrypted")
+ .map(|t| words_only(&t))
+ .filter(|t| !t.is_empty()),
body,
runs: record
.pointer("/fields/TextDataEncrypted/value")
@@ -462,13 +466,24 @@ pub fn title_and_snippet(body: &str) -> (String, String) {
// (`━━━━`) was sent with that rule as its title, and the phone showed none.
let mut lines = body
.lines()
- .map(str::trim)
+ .map(words_only)
.filter(|l| l.chars().any(char::is_alphanumeric));
- let title = lines.next().unwrap_or_default().to_string();
- let snippet = lines.next().unwrap_or_default().to_string();
+ let title = lines.next().unwrap_or_default();
+ let snippet = lines.next().unwrap_or_default();
(title, snippet)
}
+/// A line of a note as words: without the marks Apple puts in the text where an attachment
+/// sits (U+FFFC) or a line breaks inside a paragraph (U+2028). A table placed after a note's
+/// first words made the title "frfge", drawn as a box in every list.
+#[must_use]
+pub fn words_only(line: &str) -> String {
+ line.replace(['\u{FFFC}', '\u{2028}'], " ")
+ .split_whitespace()
+ .collect::<Vec<_>>()
+ .join(" ")
+}
+
/// Save a new body onto an existing note.
///
/// The document is rewritten in place against whatever Apple currently holds, not against
@@ -1190,6 +1205,18 @@ pub async fn delete_cloudkit(
mod tests {
use super::*;
+ /// A table on a note's first line, or a note of nothing but attachments: the title and
+ /// snippet are its words, never the marks where the attachments sit.
+ #[test]
+ fn titles_and_snippets_are_words_not_attachment_marks() {
+ assert_eq!(
+ title_and_snippet("frfge\u{FFFC}\nHello"),
+ ("frfge".into(), "Hello".into())
+ );
+ assert_eq!(words_only("\u{FFFC}\u{FFFC}\u{FFFC}"), "");
+ assert_eq!(words_only("one\u{2028}two"), "one two");
+ }
+
#[test]
fn a_title_is_the_first_line_with_words_on_it() {
let pasted = "━━━━━━━━━━━━━━━━\n\n𝗨𝗡𝗜𝗧 𝟭: 𝗜𝗡𝗧𝗥𝗢\n• ──\nQuantum states";
diff --git a/probe/examples/table_cell_offline.rs b/probe/examples/table_cell_offline.rs
index 663e8a7..2622568 100644
--- a/probe/examples/table_cell_offline.rs
+++ b/probe/examples/table_cell_offline.rs
@@ -26,6 +26,25 @@ async fn main() -> Result<()> {
let Some(cells) = quince_icloud::table::cells_from_base64(v) else {
continue;
};
+ // An empty cell too: one a phone made holds an empty text object and can take text.
+ if let Some((r, c)) = cells
+ .iter()
+ .enumerate()
+ .find_map(|(r, row)| row.iter().position(String::is_empty).map(|c| (r, c)))
+ {
+ let back = quince_icloud::table::with_cell_in_base64(v, r, c, "Quince empty test")
+ .as_deref()
+ .and_then(quince_icloud::table::cells_from_base64);
+ println!(
+ " empty cell ({r},{c}) of {}: {}",
+ a["recordName"],
+ match &back {
+ Some(b) if b[r][c] == "Quince empty test" => "takes text, exact",
+ Some(_) => "WRONG read-back",
+ None => "refused (no object)",
+ }
+ );
+ }
let typed = cells
.iter()
.enumerate()
diff --git a/src/screens/Library.tsx b/src/screens/Library.tsx
index 6cb6d6e..ed102c2 100644
--- a/src/screens/Library.tsx
+++ b/src/screens/Library.tsx
@@ -85,12 +85,10 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
slideFrom.current = null;
const el = content.current;
if (from === null || !el || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
- const by = from - contentLeft();
- 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",
- });
+ // The content takes its new place at once; only the sidebar's own width moves. Sliding
+ // the whole content — a screen of text — made WebKitGTK redraw its text each frame, and
+ // it shimmered and flickered on his machine; moving its padding laid it out every frame.
+ void from;
}, [rail]);
const toggleRail = () => {
slideFrom.current = contentLeft();
diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsx
index 0af73e2..3438551 100644
--- a/src/screens/NotesView.tsx
+++ b/src/screens/NotesView.tsx
@@ -36,6 +36,11 @@ const TRASH_FOLDER = "TrashFolder-CloudKit";
/** Apple's own "Notes" folder: it can be neither renamed nor deleted. */
const DEFAULT_FOLDER = "DefaultFolder-CloudKit";
+/** A note's title or snippet as words: without the marks where attachments sit (U+FFFC) or
+ * a line breaks (U+2028), which drew as boxes. The backend strips them too; this covers
+ * what was stored before it did. */
+const wordsOnly = (text: string) => text.replace(/[\uFFFC\u2028]/g, " ").replace(/\s+/g, " ").trim();
+
export function NotesView() {
const [folders, setFolders] = useState<NoteFolder[]>([]);
const [folderMenu, setFolderMenu] = useState<{ folder: NoteFolder; x: number; y: number; alignRight: boolean } | null>(null);
@@ -762,11 +767,11 @@ export function NotesView() {
aria-current={openGuid === note.guid}
onClick={() => void selectNote(note.guid)}
>
- <span className="note-row-title">{note.title}</span>
+ <span className="note-row-title">{wordsOnly(note.title) || "New Note"}</span>
<span className="note-row-meta">
<span className="note-row-when">{listDate(note.modifiedAt)}</span>
<span className="note-row-snippet">
- {note.locked ? "Locked" : note.snippet?.slice(0, 80) || "No additional text"}
+ {note.locked ? "Locked" : wordsOnly(note.snippet ?? "").slice(0, 80) || "No additional text"}
</span>
</span>
</button>
diff --git a/src/screens/notes/Formatted.tsx b/src/screens/notes/Formatted.tsx
index 90fb813..5540e26 100644
--- a/src/screens/notes/Formatted.tsx
+++ b/src/screens/notes/Formatted.tsx
@@ -18,6 +18,8 @@ export type Run = {
underline: boolean;
strike: boolean;
link: string | null;
+ /** Text colour set on a phone: 1 purple, 2 pink, 3 orange, 4 mint, 5 blue. */
+ emphasis?: number | null;
/** The attachment this run's character stands for — a table, a picture — by id. */
attachment?: string | null;
};
@@ -106,6 +108,7 @@ function Inline({ span }: { span: Span }) {
if (run.italic) node = <em>{node}</em>;
if (run.underline) node = <u>{node}</u>;
if (run.strike) node = <s>{node}</s>;
+ if (run.emphasis) node = <span className={`nf-em-${run.emphasis}`}>{node}</span>;
if (run.link) {
node = (
<a href={run.link} target="_blank" rel="noreferrer" onClick={(e) => e.stopPropagation()}>
diff --git a/src/screens/notes/NoteEditor.tsx b/src/screens/notes/NoteEditor.tsx
index f32fcf1..89a494e 100644
--- a/src/screens/notes/NoteEditor.tsx
+++ b/src/screens/notes/NoteEditor.tsx
@@ -7,17 +7,18 @@ import { keymap } from "prosemirror-keymap";
import { baseKeymap, splitBlockAs, toggleMark, chainCommands } from "prosemirror-commands";
import type { Node as PMNode } from "prosemirror-model";
import type { Run } from "./Formatted";
-import { fromDoc, LIST_STYLES, schema, STYLE, toDoc } from "./rich";
+import { fromDoc, LIST_STYLES, schema, STYLE, tableCells, toDoc } from "./rich";
import { api, noteMediaSrc, type NoteAttachment } from "../../lib/ipc";
/**
* An attachment in the note: a table drawn as the grid it is, with the cells Apple holds;
* anything else — a picture, a sketch — as a labelled placeholder that keeps its place.
*
- * A table's cells are edited where they stand. Each cell already typed in is a plain-text
- * field of its own — keys typed there are the cell's, never the note's — saved to Apple when
- * it is left or Return is pressed, drawn at once, and put back with the reason if Apple
- * refuses. A cell never typed in has nothing in Apple's table yet to change, and says so.
+ * A table's cells are edited where they stand. Each cell is a plain-text field of its own —
+ * keys typed there are the cell's, never the note's — saved to Apple when it is left or
+ * Return is pressed, drawn at once, and put back with the reason if Apple refuses. An empty
+ * cell is editable too: a table made on a phone or on icloud.com already holds an empty text
+ * object for every cell (measured on every table in his account).
*/
/** What each attachment is, asked once a session: a note re-drawn does not ask again. */
const described = new Map<string, Promise<NoteAttachment | null>>();
@@ -108,6 +109,7 @@ function attachmentView(node: PMNode) {
const id = node.attrs.id as string | null;
const draw = (cells: string[][]) => {
+ if (id) tableCells.set(id, cells.map((row) => [...row]));
const table = document.createElement("table");
table.className = "nf-table";
cells.forEach((row, r) => {
@@ -115,10 +117,9 @@ function attachmentView(node: PMNode) {
row.forEach((cell, c) => {
const td = tr.insertCell();
const was = cell.trimEnd();
- if (!id || was === "") {
+ if (!id) {
td.textContent = was;
td.className = "nf-cell-empty";
- td.title = "Type in this cell on an Apple device first — Quince can change cells that have text";
return;
}
const field = document.createElement("div");
@@ -133,12 +134,15 @@ function attachmentView(node: PMNode) {
const before = saved;
saved = now;
field.classList.add("is-saving");
+ const copy = tableCells.get(id);
+ if (copy?.[r]) copy[r][c] = now;
api.noteTableSetCell(id, r, c, now).then(
() => field.classList.remove("is-saving"),
(e) => {
// Refused: back as Apple has it, and why.
saved = before;
field.textContent = before;
+ if (copy?.[r]) copy[r][c] = before;
field.classList.remove("is-saving");
field.title = String(e);
field.classList.add("is-refused");
diff --git a/src/screens/notes/rich.ts b/src/screens/notes/rich.ts
index 45322a3..fa81cd7 100644
--- a/src/screens/notes/rich.ts
+++ b/src/screens/notes/rich.ts
@@ -11,7 +11,7 @@
* paragraph (U+2028, Shift-Return) travel as nodes of their own, so they cannot be typed
* over by accident or lost.
*/
-import { Schema, type Node as PMNode, type Mark } from "prosemirror-model";
+import { Schema, type DOMOutputSpec, type Node as PMNode, type Mark } from "prosemirror-model";
import type { Run } from "./Formatted";
/** Apple's paragraph styles. */
@@ -29,6 +29,9 @@ export const STYLE = {
export const LIST_STYLES: readonly number[] = [STYLE.bulleted, STYLE.dashed, STYLE.numbered, STYLE.checklist];
const ATTACHMENT = "";
+
+/** Each table's cells by attachment id, as last drawn: what copying the table puts out. */
+export const tableCells = new Map<string, string[][]>();
const LINE_BREAK = "
";
export const schema = new Schema({
@@ -61,7 +64,17 @@ export const schema = new Schema({
atom: true,
selectable: true,
attrs: { id: { default: null as string | null } },
- toDOM: () => ["span", { class: "nf-attachment", contenteditable: "false", title: "Attachment — open it on an Apple device" }, "Attachment"],
+ // Copied, a table is its cells — as a table, and as tab-separated lines for plain text —
+ // never a placeholder word; anything else copies as nothing.
+ leafText: (node) => {
+ const cells = tableCells.get(node.attrs.id as string);
+ return cells ? cells.map((r) => r.map((c) => c.trimEnd()).join("\t")).join("\n") : "";
+ },
+ toDOM: (node): DOMOutputSpec => {
+ const cells = tableCells.get(node.attrs.id as string);
+ if (!cells) return ["span", { class: "nf-attachment" }];
+ return ["table", ["tbody", ...cells.map((r): DOMOutputSpec => ["tr", ...r.map((c): DOMOutputSpec => ["td", c.trimEnd()])])]];
+ },
},
/** Shift-Return: a new line in the same paragraph. */
line_break: {
@@ -77,6 +90,12 @@ export const schema = new Schema({
italic: { parseDOM: [{ tag: "em" }, { tag: "i" }], toDOM: () => ["em", 0] },
underline: { parseDOM: [{ tag: "u" }], toDOM: () => ["u", 0] },
strike: { parseDOM: [{ tag: "s" }, { tag: "del" }], toDOM: () => ["s", 0] },
+ /** Text colour set on a phone: 1 purple, 2 pink, 3 orange, 4 mint, 5 blue. */
+ emphasis: {
+ attrs: { color: {} },
+ parseDOM: [{ tag: "span[data-emphasis]", getAttrs: (d) => ({ color: Number((d as HTMLElement).dataset.emphasis) }) }],
+ toDOM: (m) => ["span", { class: `nf-em-${m.attrs.color}`, "data-emphasis": String(m.attrs.color) }, 0],
+ },
link: {
attrs: { href: {} },
inclusive: false,
@@ -109,6 +128,7 @@ function marksOf(run: Run): Mark[] {
if (run.italic) m.push(schema.marks.italic.create());
if (run.underline) m.push(schema.marks.underline.create());
if (run.strike) m.push(schema.marks.strike.create());
+ if (run.emphasis) m.push(schema.marks.emphasis.create({ color: run.emphasis }));
if (run.link) m.push(schema.marks.link.create({ href: run.link }));
return m;
}
@@ -162,7 +182,7 @@ export function toDoc(text: string, runs: Run[] | null): PMNode {
const same = (a: Run, b: Run) =>
a.style === b.style && a.indent === b.indent && a.checked === b.checked && a.bold === b.bold &&
a.italic === b.italic && a.underline === b.underline && a.strike === b.strike && a.link === b.link &&
- (a.attachment ?? null) === (b.attachment ?? null);
+ (a.attachment ?? null) === (b.attachment ?? null) && (a.emphasis ?? null) === (b.emphasis ?? null);
/** A document as Apple's text and runs. */
export function fromDoc(doc: PMNode): { text: string; runs: Run[] } {
@@ -186,8 +206,10 @@ export function fromDoc(doc: PMNode): { text: string; runs: Run[] } {
if (child.type === schema.nodes.attachment) return push(ATTACHMENT, { ...base, attachment: child.attrs.id ?? null });
if (child.type === schema.nodes.line_break) return push(LINE_BREAK, base);
const has = (name: string) => child.marks.some((m) => m.type.name === name);
+ const emphasis = child.marks.find((m) => m.type.name === "emphasis")?.attrs.color as number | undefined;
push(child.text ?? "", {
...base,
+ ...(emphasis ? { emphasis } : {}),
bold: has("bold"),
italic: has("italic"),
underline: has("underline"),
diff --git a/src/styles/app.css b/src/styles/app.css
index 6192ae6..269daa9 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -263,7 +263,9 @@
top: 8px;
bottom: 8px;
width: 196px;
- transition: width var(--spring-quick-d) var(--spring-quick);
+ /* Folding is a single step, with no animation. While the sidebar's width moved, every frame
+ laid out its rows again, and the content beside it, already in its new place, showed
+ through and then hid behind it. WebKitGTK drew that as a flicker of text on his machine. */
/* Its own width changing lays out only itself. */
contain: layout paint;
overflow: hidden;
@@ -450,7 +452,7 @@
: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; }
+.nav-name { overflow: hidden; text-overflow: ellipsis; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; min-height: 28px; }
.sidebar-head h2 { margin: 0 8px; }
.sidebar-fold {
@@ -463,8 +465,6 @@
@media (min-width: 901px) {
.is-rail .sidebar { width: 60px; }
.is-rail .sidebar-head { flex-direction: column; }
- /* Gone at once when folding — fading while the width closed squeezed the names into a
- smear — and back only once the sidebar has opened (the delay on .nav-name above). */
.is-rail .sidebar-head h2, .is-rail .nav-name { opacity: 0; width: 0; margin: 0; transition: none; }
.is-rail .nav-item { justify-content: center; gap: 0; padding-inline: 0; }
.is-rail .sidebar-foot { display: none; }
@@ -1523,8 +1523,8 @@
border-radius: var(--r-window);
background: var(--glass-thick);
box-shadow: var(--glass-float);
- /* A sheet arrives on the smooth spring, growing the last few percent into place. */
- animation: modal-sheet-in 360ms var(--spring-smooth) both;
+ /* Simply there, as the menus and popovers are: grown in on a spring, the sheet glitched
+ as it came in on WebKitGTK. The window dims behind it. */
}
@keyframes modal-sheet-in {
diff --git a/src/styles/calendar.css b/src/styles/calendar.css
index ac146a2..c37e395 100644
--- a/src/styles/calendar.css
+++ b/src/styles/calendar.css
@@ -605,7 +605,8 @@
/* Opacity and a small lift only, on the compositor: scaling from the corner read as a
jump toward the click, and re-ran on every re-anchor. */
/* A short fade and nothing else — no movement, no layer hint — as a macOS popover. */
- animation: cx-pop 110ms ease-out both;
+ /* No opening animation, as a menu has none: a fade over a large shadowed layer is what
+ WebKitGTK drew with a glitch. It is simply there. */
}
@keyframes cx-pop { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cx-popover { animation: none; } }
diff --git a/src/styles/notes.css b/src/styles/notes.css
index 765bca7..915a3e7 100644
--- a/src/styles/notes.css
+++ b/src/styles/notes.css
@@ -411,7 +411,13 @@ textarea.note-title::placeholder { color: var(--text-3); }
.nf-cell-edit:focus { box-shadow: 0 0 0 2px var(--accent-ring); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.nf-cell-edit.is-saving { opacity: 0.7; }
.nf-cell-edit.is-refused { box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 55%, transparent); }
-.nf-cell-empty { color: var(--text-3); }
+.nf-cell-empty { color: var(--text-3); height: 1.4em; }
+/* Text coloured on a phone, in the colour it has there. */
+.nf-em-1 { color: var(--note-c1); }
+.nf-em-2 { color: var(--note-c2); }
+.nf-em-3 { color: var(--note-c3); }
+.nf-em-4 { color: var(--note-c4); }
+.nf-em-5 { color: var(--note-c5); }
/* What a note holds besides text, drawn where it sits (NoteEditor's drawMedia): a picture at
its own proportions, a document or film as its rendering with its name, anything else a
chip. Each opens in the app this computer uses for it. */
diff --git a/src/styles/tokens.css b/src/styles/tokens.css
index 0c8cae9..994d2e6 100644
--- a/src/styles/tokens.css
+++ b/src/styles/tokens.css
@@ -35,6 +35,8 @@
--field-edge: rgba(0, 0, 0, 0.17);
--field-edge-hover: rgba(0, 0, 0, 0.28);
--danger: #c1121f;
+ /* Notes' text colours (iOS 18): purple, pink, orange, mint, blue — Apple's system hues. */
+ --note-c1: #af52de; --note-c2: #ff2d55; --note-c3: #ff9500; --note-c4: #00c7be; --note-c5: #007aff;
--shadow-sheet: 0 14px 44px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.09);
--shadow-field: inset 0 1px 1px rgba(0, 0, 0, 0.04);
@@ -132,6 +134,7 @@
--field-edge: rgba(255, 255, 255, 0.16);
--field-edge-hover: rgba(255, 255, 255, 0.28);
--danger: #ff6b6b;
+ --note-c1: #bf5af2; --note-c2: #ff375f; --note-c3: #ff9f0a; --note-c4: #63e6e2; --note-c5: #0a84ff;
--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);
@@ -156,6 +159,7 @@
--field-edge: rgba(255, 255, 255, 0.16);
--field-edge-hover: rgba(255, 255, 255, 0.28);
--danger: #ff6b6b;
+ --note-c1: #bf5af2; --note-c2: #ff375f; --note-c3: #ff9f0a; --note-c4: #63e6e2; --note-c5: #0a84ff;
--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);