diff --git a/Cargo.lock b/Cargo.lock index 206b5e2..7d9cfd5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4892,6 +4892,7 @@ dependencies = [ "qrcode", "raw-window-handle", "rfd", + "rusqlite", "rustls", "serde", "serde_json", @@ -7124,7 +7125,6 @@ dependencies = [ "servo-config", "servo-constellation", "servo-constellation-traits", - "servo-default-resources", "servo-devtools", "servo-devtools-traits", "servo-embedder-traits", @@ -7414,15 +7414,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "servo-default-resources" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a9b9f4014b5632cbe1e0289de744ee63c33dce9dd142c23cd964904aa8214f" -dependencies = [ - "servo-embedder-traits", -] - [[package]] name = "servo-deny-public-fields" version = "0.7.0" diff --git a/docs/UI-BRIEF.md b/docs/UI-BRIEF.md new file mode 100644 index 0000000..4ab4ac8 --- /dev/null +++ b/docs/UI-BRIEF.md @@ -0,0 +1,74 @@ +# UI brief for the redesign session + +Written 2026-11-11 from the user's instructions and their screen recording +(`~/Videos/Recordings/recording_20261111_06-11-33.mp4`, 72 s, the original Python Nacre's new tab page). Frames from +it are in `docs/ui-reference/`. The current egui UI is a plain stand-in; it exists so every feature can be used and +tested. **The redesign starts only after the framework works** (the user's rule), in a new session. + +Use the `app-taste` skill for all of it. + +## What the user asked for + +- Redo the whole UI/UX "just like Google Material You, give it all you want": + - Tonal-spot colour schemes generated from a seed colour, with the seed taken from the current website + (theme-color / favicon), from the system accent, from a palette, or from a custom colour. User themes. + - Nice animations everywhere (spring motion; the Motion setting scales or disables it). + - Material 3 Expressive details: wiggly (wavy) lines and progress bars, scalloped "cookie" shapes, pill buttons, + segmented buttons with a check mark on the selected segment, large rounded cards. +- The new tab page must look and behave like the one in the video: "animative, reactive and everything". +- Then the settings pages and everything else, in the same system. +- Build the new UI around the features that exist; don't drop features to fit a design. + +## The new tab page in the video (the target) + +Layout, top to bottom, centred in the page card: +1. Greeting: "Good morning, Jacob Ward" (medium weight, on-surface colour). +2. Clock: very large thin digits in the accent tint, seconds shown, small "AM" baseline-aligned to the right; + the date ("Wednesday, November 11") under it. +3. Shortcuts row: round icons with labels and a dashed "Add shortcut" circle. +4. A row of two cards: + - Now playing: artwork inside a scalloped cookie shape with a dotted ring around it (the ring is the visualizer; + the cookie spins while playing), title "Nothing playing / Play something in a tab", a seek line with times, + shuffle / previous / play / next / repeat, and a "No media" chip that names the source tab. + - Weather: moon/sun glyph, big temperature, "Clear · feels like 35°", high/low, rain chance, humidity, wind, + and the place name. +5. Search field: pill shaped, search glyph, "Search DuckDuckGo or type a URL", a round accent button at the right. +6. A row of three cards: Notes ("Jot something down…"), Reading list, Top sites. + +Background, behind everything, animated and reacting to the cursor: +- None, Shapes (outlined and filled rounded shapes drifting), Blobs (large soft circles), Constellation (dots joined + by thin lines), Waves (several sine lines that bend near the cursor), Dot grid (a grid of dots that swells in a + circle around the cursor). +- Amount: Few / Some / Lots. Speed: Slow / Normal / Fast. "React to the cursor" switch. +- Image or GIF: Upload / Change / Remove, with Dim and Blur sliders; the animated layer draws over the image. + +Customize panel: slides in from the right as a rounded panel over the page (the page stays visible and live while +settings change), with sections BACKGROUND, IMAGE OR GIF, ELEMENTS (each element has up/down arrows and a switch: +Greeting, Clock, Shortcuts, Now playing, Weather, Search, Notes, Reading list, Top sites) and DETAILS (24-hour clock, +Show seconds, Your name, Weather place with a city suggestion list, Units Auto / °C / °F). + +Chrome seen in the video (for the toolbar redesign): one rounded window card, a pill tab with a close button, round +"+" button, toolbar icons (back, forward, reload, home, incognito mask), a pill address field with a star, then +password key, history, downloads, QR/apps grid, developer tools, shield, and a three-dot menu. The bookmarks bar shows +a hint when empty. The page sits in a floating rounded card with a margin. + +## What already exists to build on + +- `src/theme.rs`: `Palette` (accent, surfaces, text, outline...), seed selection (website / system / palette / + custom), dark/light, roundness, animation time. Replace its simple HSL maths with real Material tonal palettes + (HCT) when redesigning; keep the `Palette` roles so the rest of the UI keeps working. +- `src/ui/pages/newtab.rs`: every element and every background from the video already works in plain form + (clock, greeting, search, shortcuts, now playing, weather via Open-Meteo, notes, reading list, recent/top sites; + shapes, blobs, particles, waves, dots; image with dim and blur). Settings live in `Settings::ntp`. + Missing against the video: the Constellation background (the setting calls it "particles": add the lines), the + Customize panel over the page (today it's a settings sub-page), top sites as its own card, shuffle/repeat buttons. +- `src/ui/widgets.rs`: switch, segmented control, rows, cards. These are the pieces to restyle first. +- `src/media.rs`: visualizer levels (cava or simulated) ready for the dotted ring. +- Website colours: `META_JS` in `src/inject.rs` reports `theme-color` and the page background; `Tab::theme_color` + feeds `theme::seed`. + +## Open questions for the user at the start of the UI session + +- Keep egui for the redesigned UI, or draw the chrome with something else? (egui can do all of the above with custom + painting; text shaping and blur are its weak spots.) +- Fonts: the video uses a geometric sans (looks like Google Sans / Outfit) with thin clock digits. diff --git a/docs/ui-reference/newtab-blobs-customize.jpg b/docs/ui-reference/newtab-blobs-customize.jpg new file mode 100644 index 0000000..f66dfd9 Binary files /dev/null and b/docs/ui-reference/newtab-blobs-customize.jpg differ diff --git a/docs/ui-reference/newtab-dotgrid.jpg b/docs/ui-reference/newtab-dotgrid.jpg new file mode 100644 index 0000000..c1b612f Binary files /dev/null and b/docs/ui-reference/newtab-dotgrid.jpg differ diff --git a/docs/ui-reference/newtab-image-elements.jpg b/docs/ui-reference/newtab-image-elements.jpg new file mode 100644 index 0000000..75e9bd6 Binary files /dev/null and b/docs/ui-reference/newtab-image-elements.jpg differ diff --git a/docs/ui-reference/newtab-video-sheet-1.jpg b/docs/ui-reference/newtab-video-sheet-1.jpg new file mode 100644 index 0000000..3d81ccc Binary files /dev/null and b/docs/ui-reference/newtab-video-sheet-1.jpg differ diff --git a/docs/ui-reference/newtab-video-sheet-2.jpg b/docs/ui-reference/newtab-video-sheet-2.jpg new file mode 100644 index 0000000..00e64a1 Binary files /dev/null and b/docs/ui-reference/newtab-video-sheet-2.jpg differ diff --git a/docs/ui-reference/newtab-waves.jpg b/docs/ui-reference/newtab-waves.jpg new file mode 100644 index 0000000..6ac9da6 Binary files /dev/null and b/docs/ui-reference/newtab-waves.jpg differ diff --git a/src/app.rs b/src/app.rs index 10eaeb6..ad1973a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -188,6 +188,7 @@ pub struct App { pub instance: Option, /// Windows that commands asked for; opened when the event loop is at hand. pub window_requests: Vec, + pub selftest: Option, /// Commands waiting for a window to exist. pub pending_commands: Vec, /// Picture-in-picture windows to close after their tab went away. @@ -310,6 +311,7 @@ impl App { crashed_last_time, instance: None, window_requests: Vec::new(), + selftest: crate::selftest::SelfTest::from_env(), pending_commands: Vec::new(), window_closes: Vec::new(), } @@ -1079,6 +1081,9 @@ impl App { self.update_vpn_route(); self.poll_gamepads(); self.update_media_now(); + if self.selftest.is_some() { + self.selftest_step(); + } if now.duration_since(self.last_tick) >= Duration::from_millis(900) { self.last_tick = now; let before = self.shared.toasts.borrow().len(); diff --git a/src/main.rs b/src/main.rs index 778dd02..6aca98d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ mod paths; mod pdf; mod perf; mod resources; +mod selftest; mod spell; mod store; mod tabs; diff --git a/src/selftest.rs b/src/selftest.rs new file mode 100644 index 0000000..c44e416 --- /dev/null +++ b/src/selftest.rs @@ -0,0 +1,308 @@ +//! Scripted runs for testing: `NACRE_SCRIPT=` makes Nacre run the commands in the file, one +//! per line, and save screenshots and status files next to it. Lines starting with `#` are notes. +//! +//! wait let the browser run +//! waitload [seconds] wait until the current tab finished loading (default limit 30 s) +//! open load in the current tab newtab open in a new tab +//! page show an internal page +//! shot save the window as .png +//! status save tabs, downloads, VPN, ad blocker and so on as .json +//! set change a setting, e.g. `set /privacy/https_only true` +//! flyout main, downloads, shield, vpn, media, siteinfo, profiles, apps, qr, none +//! do a shortcut action by its settings key, e.g. `do new_tab` +//! cmd [arg] back, forward, reload, bookmark, install_app, pip, exitpip, free_memory, +//! update_lists, check_updates, close_tab, select , zoom , +//! find , download , navigate , mute, pin +//! js