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
Photos: Download Options, as icloud.com's
Yashwanth Kamireddi1e59791eaa0f
diff --git a/.uiverify/photos-download.mjs b/.uiverify/photos-download.mjsnew file mode 100644index 0000000..665617b--- /dev/null+++ b/.uiverify/photos-download.mjs@@ -0,0 +1,46 @@+// Download Options, as icloud.com's: from a photo's menu (in the grid, or right-clicked in the+// viewer), the photos and how many, then Unmodified Originals, Highest Resolution, Most+// Compatible — each downloads at once; a selection downloads every photo in it; Escape closes the+// sheet and nothing else.+import { engine } from "./engine.mjs";+import { SERVICES, installStub, openScreen } from "./stub.mjs";+const b = await engine.launch();+const ctx = await b.newContext({ viewport: { width: 1280, height: 800 } });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null });+const page = await ctx.newPage();+page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); process.exitCode = 1; });+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });+await openScreen(page, "Photos");+await page.waitForTimeout(400);+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };+const last = () => page.evaluate(() => window.__downloads?.at(-1));++await page.locator(".px-tile").nth(1).click({ button: "right" });+await page.locator(".row-menu").getByText("More Download Options…").click();+const sheet = page.getByRole("dialog", { name: "Download Options" });+ok((await sheet.count()) === 1 && /1 Item/.test(await sheet.innerText()) && /Unmodified Originals[\s\S]*Including Edits[\s\S]*Highest Resolution[\s\S]*Most Compatible/.test(await sheet.innerText()),+ "the sheet offers what icloud.com's does");+await page.getByRole("button", { name: "Download Most Compatible" }).click();+await page.waitForTimeout(200);+ok(JSON.stringify(await last()) === JSON.stringify({ id: "p2", want: "mostCompatible" }) && (await sheet.count()) === 0, "a row downloads that kind, and the sheet goes");++await page.locator(".px-tile").nth(0).click();+await page.locator(".px-tile").nth(3).click({ modifiers: ["Control"] });+await page.locator(".px-tile").nth(3).click({ button: "right" });+const before = await page.evaluate(() => window.__downloads.length);+await page.locator(".row-menu").getByText("Download 2 Items").click();+await page.waitForTimeout(300);+ok((await page.evaluate(() => window.__downloads.length)) - before === 2, "a selection downloads every photo in it");++await page.keyboard.press("Escape");+await page.locator(".px-tile").nth(2).dblclick();+await page.waitForTimeout(600);+await page.locator(".px-stage").click({ button: "right", position: { x: 300, y: 300 } });+ok((await page.locator(".row-menu").getByText("More Download Options…").count()) === 1, "right-clicking the open photo gives its menu");+await page.locator(".row-menu").getByText("More Download Options…").click();+await page.keyboard.press("Escape");+await page.waitForTimeout(200);+ok((await sheet.count()) === 0 && (await page.locator(".px-viewer").count()) === 1, "Escape closes the sheet, and the photo stays open");+await b.close();+process.exitCode = failures ? 1 : (process.exitCode ?? 0);diff --git a/check.sh b/check.shindex 6cf8466..c203a1c 100755--- a/check.sh+++ b/check.sh@@ -68,6 +68,7 @@ step "star ratings" node .uiverify/photos-rating.mjsstep "viewer, real sizes" node .uiverify/photos-viewer-real.mjsstep "filmstrip" node .uiverify/photos-strip.mjsstep "place & keywords" node .uiverify/photos-info.mjs+step "download options" node .uiverify/photos-download.mjsstep "notes delete" node .uiverify/notes-delete.mjsstep "empty today" node .uiverify/reminders-empty.mjsstep "calendar keys" node .uiverify/calendar-keys.mjs@@ -119,6 +120,7 @@ step "webkit: ratings" env ENGINE=webkit node .uiverify/photos-rating.mjsstep "webkit: viewer sizes" env ENGINE=webkit node .uiverify/photos-viewer-real.mjsstep "webkit: filmstrip" env ENGINE=webkit node .uiverify/photos-strip.mjsstep "webkit: place & keywords" env ENGINE=webkit node .uiverify/photos-info.mjs+step "webkit: downloads" env ENGINE=webkit node .uiverify/photos-download.mjsstep "webkit: delete" env ENGINE=webkit node .uiverify/notes-delete.mjsstep "webkit: row hover" env ENGINE=webkit node .uiverify/row-hover.mjsstep "webkit: fold" env ENGINE=webkit node .uiverify/sidebar-fold.mjsdiff --git a/crates/quince-icloud/src/photos.rs b/crates/quince-icloud/src/photos.rsindex 14c1823..332eeee 100644--- a/crates/quince-icloud/src/photos.rs+++ b/crates/quince-icloud/src/photos.rs@@ -643,6 +643,110 @@ pub async fn remove_from_album(Ok(())}+/// Which file a download takes, as icloud.com's Download Options offer them.+#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize)]+#[serde(rename_all = "camelCase")]+pub enum Want {+ /// The original, as captured or imported.+ Originals,+ /// The best there is, edits included: HEIC and HEVC allowed.+ HighestQuality,+ /// JPEG, PNG, GIF, MOV or MP4 where there is one.+ MostCompatible,+}++const PHOTO_SLOTS: [&str; 5] = ["JPEGThumb", "JPEGMed", "JPEGLarge", "JPEGFull", "Original"];+const VIDEO_SLOTS: [&str; 4] = ["VidSmall", "VidMed", "VidFull", "Original"];++/// One rendition of a record: its file type (a UTI, lower case) and where to fetch it. The+/// original is on the master only. Any rendition not the original that says QuickTime is an MP4,+/// as icloud.com treats it (main.js `fileDataForSlot`).+fn rendition(slot: &str, record: &Value) -> Option<(String, String)> {+ let master = field::record_type(record).as_deref() == Some("CPLMaster");+ let (kind, url) = if slot == "Original" {+ if !master {+ return None;+ }+ (+ field::string(record, "resOriginalFileType"),+ record.pointer("/fields/resOriginalRes/value/downloadURL"),+ )+ } else {+ (+ field::string(record, &format!("res{slot}FileType")),+ record.pointer(&format!("/fields/res{slot}Res/value/downloadURL")),+ )+ };+ let mut kind = kind?.to_lowercase();+ if slot != "Original" && kind == "com.apple.quicktime-movie" {+ kind = "public.mpeg-4".into();+ }+ Some((kind, url?.as_str()?.to_string()))+}++/// The file a download takes, as icloud.com picks it (ui.main.js `getDownloadURLInfo`): the+/// largest rendition of an allowed type, from the asset first — where an edit's renditions are —+/// then the master; for originals, the master's original whatever its type. Answers the URL with+/// `${f}` filled, and the file's name: the original's, with the chosen type's extension.+#[must_use]+pub fn download_choice(+ asset: &Value,+ master: &Value,+ want: Want,+ video: bool,+) -> Option<(String, String)> {+ let mut allowed = vec![+ "public.jpeg",+ "public.png",+ "com.compuserve.gif",+ "com.apple.quicktime-movie",+ "public.mpeg-4",+ ];+ if want != Want::MostCompatible {+ allowed.extend(["public.heic", "com.apple.m4v-video"]);+ }+ let slots: &[&str] = if video { &VIDEO_SLOTS } else { &PHOTO_SLOTS };+ let pick = |record: &Value| {+ slots.iter().rev().find_map(|slot| {+ let (kind, url) = rendition(slot, record)?;+ ((*slot == "Original" && want == Want::Originals)+ || kind == "com.adobe.pdf"+ || allowed.contains(&kind.as_str()))+ .then_some((kind, url))+ })+ };+ let from_master = pick(master);+ let (kind, url) = if want == Want::Originals {+ from_master.or_else(|| pick(asset))?+ } else {+ pick(asset).or(from_master)?+ };+ let ext = match kind.as_str() {+ "public.jpeg" => "JPG",+ "public.png" => "PNG",+ "com.compuserve.gif" => "GIF",+ "public.heic" => "HEIC",+ "com.apple.quicktime-movie" => "MOV",+ "public.mpeg-4" => "MP4",+ "com.apple.m4v-video" => "M4V",+ "com.adobe.pdf" => "PDF",+ other => other.rsplit('.').next().unwrap_or("bin"),+ };+ let full = decoded(master, "filenameEnc").unwrap_or_else(|| "Photo".into());+ let base = full.rsplit_once('.').map_or(full.as_str(), |(b, _)| b);+ let name = format!("{base}.{ext}");+ let encoded: String = name+ .bytes()+ .map(|b| match b {+ b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => {+ (b as char).to_string()+ }+ _ => format!("%{b:02X}"),+ })+ .collect();+ Some((url.replace("${f}", &encoded), name))+}+/// The flags a photo carries that this app sets.#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize)]#[serde(rename_all = "camelCase")]@@ -872,4 +976,49 @@ mod tests {"no place is no place");}++ /// Download Options pick as icloud.com does: an original as it is; Most Compatible turns+ /// a HEIC original into the full-size JPEG; an edit (renditions on the asset) wins for+ /// Highest Quality, never for originals.+ #[test]+ fn downloads_pick_the_file_icloud_picks() {+ let master = json!({"recordType": "CPLMaster", "fields": {+ "filenameEnc": {"value": base64::engine::general_purpose::STANDARD.encode("IMG_0001.HEIC")},+ "resOriginalFileType": {"value": "public.heic"},+ "resOriginalRes": {"value": {"downloadURL": "https://o/${f}"}},+ "resJPEGFullFileType": {"value": "public.jpeg"},+ "resJPEGFullRes": {"value": {"downloadURL": "https://full/${f}"}},+ }});+ let plain = json!({"recordType": "CPLAsset", "fields": {}});+ let edited = json!({"recordType": "CPLAsset", "fields": {+ "resJPEGFullFileType": {"value": "public.jpeg"},+ "resJPEGFullRes": {"value": {"downloadURL": "https://edit/${f}"}},+ }});+ assert_eq!(+ download_choice(&plain, &master, Want::Originals, false).unwrap(),+ ("https://o/IMG_0001.HEIC".into(), "IMG_0001.HEIC".into())+ );+ assert_eq!(+ download_choice(&plain, &master, Want::MostCompatible, false).unwrap(),+ ("https://full/IMG_0001.JPG".into(), "IMG_0001.JPG".into())+ );+ assert_eq!(+ download_choice(&plain, &master, Want::HighestQuality, false)+ .unwrap()+ .1,+ "IMG_0001.HEIC"+ );+ assert_eq!(+ download_choice(&edited, &master, Want::HighestQuality, false)+ .unwrap()+ .0,+ "https://edit/IMG_0001.JPG"+ );+ assert_eq!(+ download_choice(&edited, &master, Want::Originals, false)+ .unwrap()+ .0,+ "https://o/IMG_0001.HEIC"+ );+ }}diff --git a/probe/examples/photos_download_choice.rs b/probe/examples/photos_download_choice.rsnew file mode 100644index 0000000..1d4244b--- /dev/null+++ b/probe/examples/photos_download_choice.rs@@ -0,0 +1,58 @@+//! Live, read-only: for each of icloud.com's Download Options, the file Quince picks for a photo+//! and a video, downloaded to a folder named on the command line and checked by its first bytes.+use anyhow::{anyhow, Result};+use quince_icloud::photos::{download_choice, Want, CONTAINER, ZONE};++#[tokio::main]+async fn main() -> Result<()> {+ let mut args = std::env::args().skip(1);+ let out = std::path::PathBuf::from(args.next().ok_or_else(|| anyhow!("out dir"))?);+ let dir = std::path::PathBuf::from(std::env::var("HOME")?).join(".local/share/quince-probe");+ let mut client = quince_auth::Client::new(&dir)?;+ if !client.resume().await? {+ return Err(anyhow!("no session"));+ }+ let ck = client+ .session()+ .service_url("ckdatabasews")+ .ok_or_else(|| anyhow!("no ck"))?;+ let http = client.http().clone();+ let zc =+ quince_icloud::cloudkit::ZoneClient::new(&http, &ck, CONTAINER, client.service_params());+ for id in args {+ let asset = zc+ .lookup_record(ZONE, &id)+ .await?+ .ok_or_else(|| anyhow!("gone"))?;+ let m = asset+ .pointer("/fields/masterRef/value/recordName")+ .and_then(|v| v.as_str())+ .ok_or_else(|| anyhow!("no master"))?;+ let master = zc+ .lookup_record(ZONE, m)+ .await?+ .ok_or_else(|| anyhow!("no master"))?;+ let video = master+ .pointer("/fields/itemType/value")+ .and_then(|v| v.as_str())+ .is_some_and(|t| t.contains("movie") || t.contains("mpeg-4"));+ for want in [Want::Originals, Want::HighestQuality, Want::MostCompatible] {+ let (url, name) =+ download_choice(&asset, &master, want, video).ok_or_else(|| anyhow!("no file"))?;+ let bytes = http+ .get(&url)+ .send()+ .await?+ .error_for_status()?+ .bytes()+ .await?;+ std::fs::write(out.join(&name), &bytes)?;+ println!(+ "{want:?}: {name} {} bytes, starts {:02x?}",+ bytes.len(),+ &bytes[..8.min(bytes.len())]+ );+ }+ }+ Ok(())+}diff --git a/src-tauri/src/photos.rs b/src-tauri/src/photos.rsindex c01ac2c..beaa63d 100644--- a/src-tauri/src/photos.rs+++ b/src-tauri/src/photos.rs@@ -717,9 +717,22 @@ pub async fn photos_counts(app: AppHandle, data: State<'_, Data>) -> UiResult<Ve.map_err(|e| e.to_string())}-/// A photo's original saved to Downloads under its own name; answers where.+/// A photo saved to Downloads, as icloud.com's Download Options choose the file: the original+/// as captured, the highest quality (edits included), or the most compatible (JPEG or MP4). Both+/// records are read fresh — their links expire — and the file is streamed to a part file, named+/// only once whole: a large video never sits in memory, and a broken download leaves no half file+/// under the photo's name. Answers where it went.#[tauri::command]-pub async fn photo_download(id: String, app: AppHandle, data: State<'_, Data>) -> UiResult<String> {+pub async fn photo_download(+ id: String,+ want: Option<quince_icloud::photos::Want>,+ app: AppHandle,+ auth: State<'_, Auth>,+ data: State<'_, Data>,+) -> UiResult<String> {+ use futures_util::StreamExt;+ use tokio::io::AsyncWriteExt;+ let want = want.unwrap_or(quince_icloud::photos::Want::Originals);let photo = data.0.lock()@@ -727,17 +740,67 @@ pub async fn photo_download(id: String, app: AppHandle, data: State<'_, Data>) -.photo(&id).map_err(|e| e.to_string())?.ok_or("That photo is no longer in the library.")?;- let bytes = picture(&app, &id, Size::Original).await?;+ let (http, root, params) = crate::cloudkit_context(&auth).await?;+ let zc = quince_icloud::cloudkit::ZoneClient::new(+ &http,+ &root,+ quince_icloud::photos::CONTAINER,+ params,+ );+ let asset = zc+ .lookup_record(quince_icloud::photos::ZONE, &id)+ .await+ .map_err(|e| e.to_string())?+ .ok_or("That photo is no longer in iCloud.")?;+ let master = zc+ .lookup_record(quince_icloud::photos::ZONE, &photo.master)+ .await+ .map_err(|e| e.to_string())?+ .ok_or("That photo's file is no longer in iCloud.")?;+ let video = photo.kind == quince_core::photos::Kind::Video;+ let (url, name) = quince_icloud::photos::download_choice(&asset, &master, want, video)+ .ok_or("iCloud has no file of that kind for this photo.")?;let dir = app.path().download_dir().map_err(|_| "There is no Downloads folder to save to.")?;- let name = photo- .filename- .filter(|n| !n.contains('/') && !n.starts_with('.'))- .unwrap_or_else(|| format!("Photo {}", &id[..id.len().min(8)]));+ let name = if name.contains('/') || name.starts_with('.') {+ format!("Photo {}", &id[..id.len().min(8)])+ } else {+ name+ };let path = crate::free_path(&dir, &name);- tokio::fs::write(&path, bytes)+ let part = path.with_extension(format!(+ "{}.part",+ path.extension()+ .map(|e| e.to_string_lossy().into_owned())+ .unwrap_or_default()+ ));+ let response = http+ .get(&url)+ .send()+ .await+ .and_then(reqwest::Response::error_for_status)+ .map_err(|e| format!("iCloud did not send the file: {e}"))?;+ let mut out = tokio::fs::File::create(&part)+ .await+ .map_err(|e| e.to_string())?;+ let mut body = response.bytes_stream();+ let written: Result<(), String> = async {+ while let Some(chunk) = body.next().await {+ out.write_all(&chunk.map_err(|e| format!("The download broke off: {e}"))?)+ .await+ .map_err(|e| e.to_string())?;+ }+ out.flush().await.map_err(|e| e.to_string())+ }+ .await;+ if let Err(e) = written {+ tokio::fs::remove_file(&part).await.ok();+ return Err(e);+ }+ drop(out);+ tokio::fs::rename(&part, &path).await.map_err(|e| e.to_string())?;Ok(path.display().to_string())diff --git a/src/lib/ipc.ts b/src/lib/ipc.tsindex f008ce0..6b5da3e 100644--- a/src/lib/ipc.ts+++ b/src/lib/ipc.ts@@ -99,7 +99,10 @@ export const api = {photoSetFlag: (id: string, flag: "favorite" | "deleted" | "hidden" | "expunged", on: boolean) =>invoke<Photo>("photo_set_flag", { id, flag, on }),/** The original saved to Downloads; answers where. */- photoDownload: (id: string) => invoke<string>("photo_download", { id }),+ /** As icloud.com's Download Options: the original (the default), the highest quality, or+ * the most compatible. Answers where it was saved. */+ photoDownload: (id: string, want?: "originals" | "highestQuality" | "mostCompatible") =>+ invoke<string>("photo_download", { id, want: want ?? null }),/** Title and caption together, as Info saves them. */photoSetText: (id: string, title: string, caption: string) => invoke<Photo>("photo_set_text", { id, title, caption }),photoSetRating: (id: string, rating: number) => invoke<Photo>("photo_set_rating", { id, rating }),diff --git a/src/screens/PhotosView.tsx b/src/screens/PhotosView.tsxindex 5a405bc..3c6398d 100644--- a/src/screens/PhotosView.tsx+++ b/src/screens/PhotosView.tsx@@ -23,6 +23,7 @@ import { Notice } from "../components/Notice";import { UploadPanel } from "./photos/UploadPanel";import { RowMenu, type MenuEntry } from "../components/RowMenu";import { Slideshow } from "./photos/Slideshow";+import { DownloadOptions, type Want } from "./photos/DownloadOptions";/** The sidebar, in Photos' order, each with the symbol Photos gives it. */const VIEWS: { key: PhotoView; label: string; Icon: LucideIcon }[] = [@@ -975,6 +976,9 @@ export function PhotosView() {: [{ label: anyPlain ? "Favorite" : "Unfavorite", run: () => void changeAll(group, "favorite", anyPlain) },null,+ { label: `Download ${n} Items`, run: () => void downloadAs(group, "originals") },+ { label: "More Download Options…", run: () => setOptions(group) },+ null,{ label: "Start Slideshow", run: () => startShow(p) },{ label: "Add to Album", submenu: albumEntries(group.map((x) => x.id)) },null,@@ -998,6 +1002,7 @@ export function PhotosView() {: [{ label: p.favorite ? "Unfavorite" : "Favorite", run: () => void change(p, "favorite", !p.favorite) },{ label: "Download", run: () => void download(p) },+ { label: "More Download Options…", run: () => setOptions([p]) },{ label: "Start Slideshow", run: () => startShow(p) },null,{ label: "Add to Album", submenu: albumEntries([p.id]) },@@ -1207,6 +1212,19 @@ export function PhotosView() {}};+ /** Download Options open for these photos. */+ const [options, setOptions] = useState<Photo[] | null>(null);+ const downloadAs = async (list: Photo[], want: Want) => {+ setOptions(null);+ let last = "";+ try {+ for (const p of list) last = await api.photoDownload(p.id, want);+ setSaved(list.length === 1 ? `Saved to ${last}` : `${list.length} saved to Downloads`);+ } catch (e) {+ setError(messageOf(e));+ }+ };+// Uploads report as they go; a finished one never goes back, as events can pass each other.// The library itself is redrawn by the sync each landed photo starts.useEffect(() => {@@ -1741,7 +1759,15 @@ export function PhotosView() {</button></div></header>- <div className="px-stage" ref={stage}>+ <div+ className="px-stage"+ ref={stage}+ onContextMenu={(e) => {+ // The photo's own menu on the photo itself, as on a Mac.+ e.preventDefault();+ photoMenu(shown, { x: e.clientX, y: e.clientY, alignRight: false });+ }}+ >{shown.kind === "video" ? (// A still of the video, and Play opens it in this computer's own player: the// window's engine plays nothing without codec plugins many systems lack.@@ -1930,6 +1956,7 @@ export function PhotosView() {)}{menu && <RowMenu at={menu.at} entries={menu.entries} onClose={() => setMenu(null)} />}{show && <Slideshow photos={show.list} start={show.start} onClose={() => setShow(null)} />}+ {options && <DownloadOptions photos={options} onPick={(w) => void downloadAs(options, w)} onClose={() => setOptions(null)} />}<UploadPanel uploads={[...uploads.values()]} onDismiss={dismissUploads} cancel={api.photosUploadCancel} /></div>);diff --git a/src/screens/photos/DownloadOptions.tsx b/src/screens/photos/DownloadOptions.tsxnew file mode 100644index 0000000..3a53934--- /dev/null+++ b/src/screens/photos/DownloadOptions.tsx@@ -0,0 +1,55 @@+/**+ * Download Options, as icloud.com's: the photos (one, or how many), then Unmodified Originals —+ * as captured or imported — and, including edits, Highest Resolution or Most Compatible. Each+ * row downloads at once; Escape or × closes.+ */+import { useEffect } from "react";+import { Download, X } from "lucide-react";+import { pictureSrc, type Photo } from "../../lib/ipc";++export type Want = "originals" | "highestQuality" | "mostCompatible";++export function DownloadOptions({ photos, onPick, onClose }: { photos: Photo[]; onPick: (want: Want) => void; onClose: () => void }) {+ useEffect(() => {+ const key = (e: KeyboardEvent) => {+ if (e.key !== "Escape") return;+ e.preventDefault();+ e.stopPropagation();+ onClose();+ };+ window.addEventListener("keydown", key, true);+ return () => window.removeEventListener("keydown", key, true);+ }, [onClose]);+ const n = photos.length;+ const row = (want: Want, title: string, words: string) => (+ <div className="px-dl-row">+ <span>+ <strong>{title}</strong>+ <small>{words}</small>+ </span>+ <button className="px-dl-go" aria-label={`Download ${title}`} title="Download" onClick={() => onPick(want)}>+ <Download size={16} strokeWidth={2} aria-hidden="true" />+ </button>+ </div>+ );+ return (+ <div className="px-sheet-scrim" role="presentation" onMouseDown={(e) => e.target === e.currentTarget && onClose()}>+ <div className="px-sheet" role="dialog" aria-modal="true" aria-label="Download Options">+ <button className="px-sheet-x" aria-label="Close" onClick={onClose}>+ <X size={16} strokeWidth={2.2} aria-hidden="true" />+ </button>+ <h2>Download Options</h2>+ <div className="px-dl-pics" aria-hidden="true">+ {photos.slice(0, 3).map((p) => (+ <img key={p.id} src={pictureSrc(p.id, "thumb")} alt="" />+ ))}+ </div>+ <p className="px-dl-count">{n === 1 ? "1 Item" : `${n} Items`}</p>+ {row("originals", "Unmodified Originals", "Originals as captured or imported")}+ <p className="px-dl-head">Including Edits</p>+ {row("highestQuality", "Highest Resolution", "Typically includes HEIC or H.265 files")}+ {row("mostCompatible", "Most Compatible", "JPEG or MP4/H.264 when possible")}+ </div>+ </div>+ );+}diff --git a/src/styles/photos.css b/src/styles/photos.cssindex d47b951..21e641f 100644--- a/src/styles/photos.css+++ b/src/styles/photos.css@@ -739,3 +739,67 @@outline: none;}.px-keyword-field:focus { box-shadow: 0 0 0 2px var(--accent-ring); }++/* ---- a sheet over Photos — Download Options — as icloud.com's: centred, solid, the rest dimmed */+.px-sheet-scrim {+ position: fixed;+ inset: 0;+ z-index: 90;+ display: grid;+ place-items: center;+ background: rgba(0, 0, 0, 0.42);+ animation: px-fade 160ms ease-out both;+}+.px-sheet {+ position: relative;+ width: min(380px, calc(100vw - 32px));+ padding: 22px 24px 18px;+ border-radius: 16px;+ background: var(--sheet);+ box-shadow: var(--glass-float);+ color: var(--text);+ animation: px-rise 260ms var(--spring-smooth) both;+}+@keyframes px-fade { from { opacity: 0; } }+@keyframes px-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }+@media (prefers-reduced-motion: reduce) { .px-sheet-scrim, .px-sheet { animation: none; } }+.px-sheet h2 { margin: 6px 0 12px; text-align: center; font-size: var(--t-15, 15px); font-weight: 700; }+.px-sheet-x {+ position: absolute;+ top: 12px;+ left: 12px;+ display: grid;+ place-items: center;+ width: 26px;+ height: 26px;+ padding: 0;+ border: 0;+ border-radius: 50%;+ background: transparent;+ color: var(--text);+ cursor: default;+}+.px-sheet-x:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }+.px-dl-pics { display: flex; justify-content: center; gap: 4px; }+.px-dl-pics img { width: 58px; height: 58px; border-radius: 8px; object-fit: cover; background: color-mix(in srgb, var(--text) 8%, transparent); }+.px-dl-count { margin: 6px 0 14px; text-align: center; font-size: var(--t-13); font-weight: 600; }+.px-dl-head { margin: 12px 0 2px; padding-top: 12px; border-top: 1px solid var(--separator); font-size: var(--t-13); font-weight: 700; }+.px-dl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }+.px-dl-row span { display: flex; flex-direction: column; }+.px-dl-row strong { font-size: var(--t-13); font-weight: 600; }+.px-dl-row small { color: var(--text-2); font-size: var(--t-12, 12px); }+.px-dl-go {+ display: grid;+ place-items: center;+ width: 34px;+ height: 34px;+ padding: 0;+ border: 0;+ border-radius: 9px;+ background: color-mix(in srgb, var(--text) 9%, transparent);+ color: var(--accent);+ cursor: default;+ transition: transform 140ms var(--spring-quick);+}+.px-dl-go:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }+.px-dl-go:active { transform: scale(0.92); }