diff --git a/CLAUDE.md b/CLAUDE.md index 576ef07..859d012 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -83,6 +83,7 @@ Never modify: `PROMPT.md` (the user's brief), the reference app checkout (`/home | `busctl --user call org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings ReadOne ss org.freedesktop.appearance accent-color` | inspect portal values | now | | `fc-list` | check bundled/system fonts | now | | `cargo run -p tunal -- --screenshot [--dark] [--size WxH]` (software renderer, offscreen, default 960x640; env `TUNAL_SEED=#rrggbb`, `TUNAL_REDUCED_MOTION=1`) | single-PNG visual check; full state matrix in phase 12 | S003 | +| `cargo run -p tunal -- --gallery --screenshot [--dark] --size 1200x1000` (`--gallery` alone opens it in a window) | every control in rest/hover/pressed/focused/disabled; press squeeze not drawn by the software renderer | S004 | Don't assume a tool exists: check first. When your plan creates a tool, add its row here. diff --git a/Plans/02 App skeleton/S004-base-controls.md b/Plans/02 App skeleton/S004-base-controls.md index d745c0b..2a2e0a1 100644 --- a/Plans/02 App skeleton/S004-base-controls.md +++ b/Plans/02 App skeleton/S004-base-controls.md @@ -10,13 +10,13 @@ Own controls on the token globals: every control has hover tint, press squeeze, CLAUDE.md §2 Motion rules, §3; `app-taste` and `animate` skills; crates/tunal/ui/theme.slint, motion.slint. ## Steps -- [ ] `StateLayer`: hover/press/focus tint and press squeeze shared by all controls; force-state properties for screenshots. -- [ ] `Button` (filled, tonal, outlined, text, with optional icon) and `IconButton` (standard, toggle) with tooltip text. -- [ ] `Chip` (filter with animated check, assist) and `Switch` (thumb slides, track tints). -- [ ] `ListRow` (leading icon, title, supporting text, trailing slot, animated selection indicator) and `Tab` (label, icon, close button; active indicator owned by a `TabBar` so it slides). -- [ ] `TextField`: std `LineEdit` styled through tokens (label, error, clear button). -- [ ] Gallery: `tunal --gallery --screenshot ` renders every control in rest, hover, pressed, focused, disabled. -- [ ] PROGRESS entry, INDEX line, commit `S004: …` +- [x] `StateLayer`: hover/press/focus tint and press squeeze shared by all controls; force-state properties for screenshots. +- [x] `Button` (filled, tonal, outlined, text, with optional icon) and `IconButton` (standard, toggle) with tooltip text. +- [x] `Chip` (filter with animated check, assist) and `Switch` (thumb slides, track tints). +- [x] `ListRow` (leading icon, title, supporting text, trailing slot, animated selection indicator) and `Tab` (label, icon, close button; active indicator owned by a `TabBar` so it slides). +- [x] `TextField`: std `LineEdit` styled through tokens (label, error, clear button). +- [x] Gallery: `tunal --gallery --screenshot ` renders every control in rest, hover, pressed, focused, disabled. +- [x] PROGRESS entry, INDEX line, commit `S004: …` ## End criteria - `cargo build --workspace`, `cargo clippy --workspace --all-targets -- -D warnings` and `cargo fmt --check` pass. diff --git a/Plans/INDEX.md b/Plans/INDEX.md index e84eac0..5a14517 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -12,7 +12,7 @@ Tracker: https://claude.ai/artifact/4X8YCk3cQjUGyuyCqGuU7v - [x] [S002 — Portal theme and Material schemes](02%20App%20skeleton/S002-theme-portal.md) · Opus high - [x] [S003 — Window, Theme and Motion globals, screenshot command](02%20App%20skeleton/S003-window-tokens.md) · Opus high -- [ ] [S004 — Base animated controls](02%20App%20skeleton/S004-base-controls.md) · Opus high +- [x] [S004 — Base animated controls](02%20App%20skeleton/S004-base-controls.md) · Opus high - [ ] [S005 — Menus, dialogs and toasts](02%20App%20skeleton/S005-menus-dialogs.md) · Opus high ## 03 File browsing diff --git a/crates/tunal/src/main.rs b/crates/tunal/src/main.rs index fcb3df4..2a49f35 100644 --- a/crates/tunal/src/main.rs +++ b/crates/tunal/src/main.rs @@ -3,19 +3,17 @@ mod theme_bridge; use std::process::ExitCode; -use slint::ComponentHandle; - slint::include_modules!(); -const USAGE: &str = "usage: tunal [--screenshot [--dark] [--size WxH]]"; +const USAGE: &str = "usage: tunal [--gallery] [--screenshot [--dark] [--size WxH]]"; fn main() -> ExitCode { - let args: Vec = std::env::args().skip(1).collect(); - let result = if args.is_empty() { - run().map_err(|e| e.to_string()) - } else { - parse_screenshot(&args).and_then(screenshot::run) - }; + let result = parse(std::env::args().skip(1)).and_then(|args| match args.screenshot { + None if args.gallery => Gallery::new().and_then(run).map_err(|e| e.to_string()), + None => MainWindow::new().and_then(run).map_err(|e| e.to_string()), + Some(options) if args.gallery => screenshot::run(options, Gallery::new), + Some(options) => screenshot::run(options, MainWindow::new), + }); match result { Ok(()) => ExitCode::SUCCESS, Err(message) => { @@ -25,22 +23,30 @@ fn main() -> ExitCode { } } -fn run() -> Result<(), slint::PlatformError> { - let ui = MainWindow::new()?; +fn run(ui: impl theme_bridge::Themed) -> Result<(), slint::PlatformError> { theme_bridge::start(&ui, theme_bridge::Overrides::from_env()); ui.run() } -fn parse_screenshot(args: &[String]) -> Result { +struct Args { + gallery: bool, + screenshot: Option, +} + +fn parse(mut args: impl Iterator) -> Result { + let mut gallery = false; let mut options = screenshot::Options { path: String::new(), dark: false, size: (960, 640), + reduced_motion: false, }; - let mut args = args.iter(); + let mut screenshot_flags = false; while let Some(arg) = args.next() { + screenshot_flags |= arg != "--gallery"; match arg.as_str() { - "--screenshot" => options.path = args.next().ok_or(USAGE)?.clone(), + "--gallery" => gallery = true, + "--screenshot" => options.path = args.next().ok_or(USAGE)?, "--dark" => options.dark = true, "--size" => { let size = args.next().ok_or(USAGE)?; @@ -51,8 +57,18 @@ fn parse_screenshot(args: &[String]) -> Result { _ => return Err(USAGE.into()), } } + if !screenshot_flags { + return Ok(Args { + gallery, + screenshot: None, + }); + } if options.path.is_empty() { return Err(USAGE.into()); } - Ok(options) + options.reduced_motion = gallery; + Ok(Args { + gallery, + screenshot: Some(options), + }) } diff --git a/crates/tunal/src/screenshot.rs b/crates/tunal/src/screenshot.rs index 653f8a5..f185fad 100644 --- a/crates/tunal/src/screenshot.rs +++ b/crates/tunal/src/screenshot.rs @@ -3,7 +3,7 @@ use std::{fs::File, io::BufWriter, path::Path, rc::Rc}; use slint::{ - ComponentHandle, PhysicalSize, + PhysicalSize, platform::{ Platform, PlatformError, WindowAdapter, software_renderer::{MinimalSoftwareWindow, PremultipliedRgbaColor, RepaintBufferType}, @@ -11,10 +11,7 @@ use slint::{ }; use tunal_theme::ColorScheme; -use crate::{ - MainWindow, - theme_bridge::{self, Overrides}, -}; +use crate::theme_bridge::{self, Overrides, Themed}; struct Offscreen(Rc); @@ -28,21 +25,29 @@ pub struct Options { pub path: String, pub dark: bool, pub size: (u32, u32), + /// Draw every state change at once (the gallery forces its states at creation). + pub reduced_motion: bool, } -pub fn run(options: Options) -> Result<(), String> { +/// Renders the window `new` creates; `new` runs after the offscreen platform is set. +pub fn run( + options: Options, + new: impl FnOnce() -> Result, +) -> Result<(), String> { let window = MinimalSoftwareWindow::new(RepaintBufferType::NewBuffer); slint::platform::set_platform(Box::new(Offscreen(window.clone()))) .map_err(|e| e.to_string())?; - let ui = MainWindow::new().map_err(|e| e.to_string())?; + let ui = new().map_err(|e| e.to_string())?; let scheme = if options.dark { ColorScheme::Dark } else { ColorScheme::Light }; + let env = Overrides::from_env(); let overrides = Overrides { scheme: Some(scheme), - ..Overrides::from_env() + reduced_motion: options.reduced_motion || env.reduced_motion, + ..env }; theme_bridge::apply(&ui, &tunal_theme::read(), overrides); diff --git a/crates/tunal/src/theme_bridge.rs b/crates/tunal/src/theme_bridge.rs index e06e21b..d10fc1d 100644 --- a/crates/tunal/src/theme_bridge.rs +++ b/crates/tunal/src/theme_bridge.rs @@ -3,7 +3,7 @@ use slint::{Color, ComponentHandle}; use tunal_theme::{Appearance, ColorScheme, Palette, Palettes}; -use crate::{MainWindow, MotionPrefs, Theme}; +use crate::{Gallery, MainWindow, MotionPrefs, Theme}; /// Overrides for agents and screenshots: `TUNAL_SEED=#rrggbb`, `TUNAL_SCHEME=light|dark`, /// `TUNAL_REDUCED_MOTION=1`. Unset or invalid values leave the portal value in place. @@ -42,8 +42,29 @@ impl Overrides { } } +/// A window with the `Theme` and `MotionPrefs` globals. +pub trait Themed: ComponentHandle + 'static { + fn theme(&self) -> Theme<'_>; + fn motion_prefs(&self) -> MotionPrefs<'_>; +} + +macro_rules! themed { + ($($window:ty),*) => { + $(impl Themed for $window { + fn theme(&self) -> Theme<'_> { + self.global::() + } + fn motion_prefs(&self) -> MotionPrefs<'_> { + self.global::() + } + })* + }; +} + +themed!(MainWindow, Gallery); + /// Reads the portal, applies it, and keeps the UI in step with later changes. -pub fn start(ui: &MainWindow, overrides: Overrides) { +pub fn start(ui: &impl Themed, overrides: Overrides) { apply(ui, &tunal_theme::read(), overrides); let weak = ui.as_weak(); tunal_theme::watch(move |appearance| { @@ -52,7 +73,7 @@ pub fn start(ui: &MainWindow, overrides: Overrides) { }); } -pub fn apply(ui: &MainWindow, appearance: &Appearance, overrides: Overrides) { +pub fn apply(ui: &impl Themed, appearance: &Appearance, overrides: Overrides) { let seed = overrides.seed.unwrap_or_else(|| appearance.seed()); let scheme = overrides.scheme.unwrap_or(appearance.scheme); let palettes = Palettes::from_seed(seed); @@ -60,11 +81,11 @@ pub fn apply(ui: &MainWindow, appearance: &Appearance, overrides: Overrides) { ColorScheme::Light => palettes.light, ColorScheme::Dark => palettes.dark, }; - let theme = ui.global::(); + let theme = ui.theme(); theme.set_dark(scheme == ColorScheme::Dark); set_colors(&theme, &palette); let reduced = overrides.reduced_motion || appearance.animations == Some(false); - ui.global::().set_reduced(reduced); + ui.motion_prefs().set_reduced(reduced); } macro_rules! colors { diff --git a/crates/tunal/ui/app.slint b/crates/tunal/ui/app.slint index 9f560e1..f4df2d8 100644 --- a/crates/tunal/ui/app.slint +++ b/crates/tunal/ui/app.slint @@ -4,6 +4,7 @@ import { Motion, MotionPrefs } from "motion.slint"; import { Icon, Icons } from "components/icon.slint"; export { Theme, MotionPrefs } +export { Gallery } from "gallery.slint"; // Placeholder shell (sidebar + content) until the views land. export component MainWindow inherits Window { diff --git a/crates/tunal/ui/components/button.slint b/crates/tunal/ui/components/button.slint new file mode 100644 index 0000000..a573e01 --- /dev/null +++ b/crates/tunal/ui/components/button.slint @@ -0,0 +1,67 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { Icon } from "icon.slint"; +import { StateLayer } from "state-layer.slint"; + +// Emphasis, from the main action of a screen (filled) down to the least (text). +export enum ButtonKind { filled, tonal, outlined, text } + +// A labelled button with an optional leading icon. +export component Button inherits StateLayer { + in property text; + // Glyph from `Icons`; empty for none. + in property icon; + in property kind: ButtonKind.filled; + + property contained: root.kind == ButtonKind.filled || root.kind == ButtonKind.tonal; + property content: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-content) + : root.kind == ButtonKind.filled ? Theme.on-primary + : root.kind == ButtonKind.tonal ? Theme.on-secondary-container + : Theme.primary; + + height: 40px; + border-radius: Theme.corner-full(self.height); + background: !root.contained ? transparent + : !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-container) + : root.kind == ButtonKind.filled ? Theme.primary + : Theme.secondary-container; + border-width: root.kind == ButtonKind.outlined ? Theme.hairline : 0; + border-color: root.enabled ? Theme.outline : Theme.on-surface.with-alpha(Theme.disabled-container); + tint: root.content; + animate background, border-color { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + + accessible-role: button; + accessible-label: root.text; + accessible-enabled: root.enabled; + accessible-action-default => { + self.activate(); + } + + HorizontalLayout { + padding-left: root.kind == ButtonKind.text ? Theme.space-3 : root.icon != "" ? Theme.space-4 : Theme.space-6; + padding-right: root.kind == ButtonKind.text ? (root.icon != "" ? Theme.space-4 : Theme.space-3) : Theme.space-6; + spacing: Theme.space-2; + + if root.icon != "": VerticalLayout { + alignment: center; + + Icon { + glyph: root.icon; + size: 18px; + color: root.content; + } + } + + Text { + text: root.text; + color: root.content; + font-size: Theme.label-large.size; + font-weight: Theme.label-large.weight; + vertical-alignment: center; + overflow: elide; + } + } +} diff --git a/crates/tunal/ui/components/chip.slint b/crates/tunal/ui/components/chip.slint new file mode 100644 index 0000000..080103b --- /dev/null +++ b/crates/tunal/ui/components/chip.slint @@ -0,0 +1,87 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { Icon, Icons } from "icon.slint"; +import { StateLayer } from "state-layer.slint"; + +// Filter chips toggle `checked`; assist chips run an action and may carry an icon. +export enum ChipKind { filter, assist } + +// The chip's width is fixed by its label: the leading slot is always reserved. When the +// check (or icon) is hidden the label sits centred, so checking it slides the label over +// instead of resizing the chip and pushing its neighbours. +export component Chip inherits StateLayer { + in property text; + // Assist chips: leading glyph from `Icons`; empty for none. + in property icon; + in property kind: ChipKind.filter; + in-out property checked; + + property on: root.kind == ChipKind.filter && root.checked; + property lead-shown: root.kind == ChipKind.filter ? root.checked : root.icon != ""; + property lead-size: 18px; + property label-x: Theme.space-2 + root.lead-size + Theme.space-2; + property content: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-content) + : root.on ? Theme.on-secondary-container + : root.kind == ChipKind.assist ? Theme.on-surface + : Theme.on-surface-variant; + + height: 32px; + min-width: root.label-x + label.preferred-width + Theme.space-4; + preferred-width: self.min-width; + horizontal-stretch: 0; + border-radius: Theme.corner-sm; + background: !root.on ? transparent : root.enabled ? Theme.secondary-container : Theme.on-surface.with-alpha(Theme.disabled-container); + border-width: root.on ? 0 : Theme.hairline; + border-color: root.enabled ? Theme.outline-variant : Theme.on-surface.with-alpha(Theme.disabled-container); + tint: root.content; + animate background, border-color { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + + activated => { + if root.kind == ChipKind.filter { + root.checked = !root.checked; + } + } + + // Role must be constant; checkable tells filter chips apart. + accessible-role: button; + accessible-label: root.text; + accessible-enabled: root.enabled; + accessible-checkable: root.kind == ChipKind.filter; + accessible-checked: root.on; + accessible-action-default => { + self.activate(); + } + + Icon { + x: Theme.space-2; + y: (root.height - self.height) / 2; + glyph: root.kind == ChipKind.filter ? Icons.check : root.icon; + size: root.lead-size; + color: !root.enabled ? root.content : root.kind == ChipKind.assist ? Theme.primary : root.content; + opacity: root.lead-shown ? 1 : 0; + transform-scale: root.lead-shown ? 1 : 0.6; + animate opacity, transform-scale { + duration: Motion.time(Motion.short4); + easing: Motion.emphasized-decelerate; + } + } + + label := Text { + x: root.lead-shown ? root.label-x : (root.width - self.width) / 2; + y: 0; + height: root.height; + width: self.preferred-width; + text: root.text; + color: root.content; + font-size: Theme.label-large.size; + font-weight: Theme.label-large.weight; + vertical-alignment: center; + animate x { + duration: Motion.time(Motion.short4); + easing: Motion.emphasized; + } + } +} diff --git a/crates/tunal/ui/components/icon-button.slint b/crates/tunal/ui/components/icon-button.slint new file mode 100644 index 0000000..67ebdc0 --- /dev/null +++ b/crates/tunal/ui/components/icon-button.slint @@ -0,0 +1,63 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { Icon } from "icon.slint"; +import { StateLayer } from "state-layer.slint"; + +// An icon-only button. Always give it a `tooltip` naming its action. With `toggle` it flips +// `checked` on click and shows a tonal container while checked. +export component IconButton inherits StateLayer { + // Glyph from `Icons`. + in property icon; + in property toggle; + in-out property checked; + in property size: 40px; + in property icon-size: 24px; + + property on: root.toggle && root.checked; + property content: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-content) + : root.on ? Theme.on-secondary-container + : Theme.on-surface-variant; + + width: root.size; + height: root.size; + // Pressed, the circle squashes towards a squircle on top of the squeeze. + border-radius: root.pressed ? (root.size >= 40px ? Theme.corner-md : Theme.corner-sm) : Theme.corner-full(root.size); + background: !root.on ? transparent : root.enabled ? Theme.secondary-container : Theme.on-surface.with-alpha(Theme.disabled-container); + tint: root.content; + squeeze: Motion.squeeze-small; + animate border-radius { + duration: Motion.time(root.pressed ? Motion.short2 : Motion.short3); + easing: Motion.standard; + } + animate background { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + + activated => { + if root.toggle { + root.checked = !root.checked; + } + } + + accessible-role: button; + accessible-label: root.tooltip; + accessible-enabled: root.enabled; + accessible-checkable: root.toggle; + accessible-checked: root.checked; + accessible-action-default => { + self.activate(); + } + + Icon { + x: (root.width - self.width) / 2; + y: (root.height - self.height) / 2; + glyph: root.icon; + size: root.icon-size; + color: root.content; + animate color { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + } +} diff --git a/crates/tunal/ui/components/icon.slint b/crates/tunal/ui/components/icon.slint index e02adc7..b9b160b 100644 --- a/crates/tunal/ui/components/icon.slint +++ b/crates/tunal/ui/components/icon.slint @@ -23,4 +23,13 @@ export component Icon inherits Text { export global Icons { out property folder: "\u{e2c7}"; out property home: "\u{e88a}"; + out property check: "\u{e5ca}"; + out property close: "\u{e5cd}"; + out property cancel: "\u{e5c9}"; + out property add: "\u{e145}"; + out property search: "\u{e8b6}"; + out property star: "\u{e838}"; + out property grid-view: "\u{e9b0}"; + out property music-note: "\u{e405}"; + out property description: "\u{e873}"; } diff --git a/crates/tunal/ui/components/list-row.slint b/crates/tunal/ui/components/list-row.slint new file mode 100644 index 0000000..39a0e12 --- /dev/null +++ b/crates/tunal/ui/components/list-row.slint @@ -0,0 +1,85 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { Icon } from "icon.slint"; +import { StateLayer } from "state-layer.slint"; + +// One row of a list: leading icon, title, optional supporting line, and a trailing slot for +// the row's children. Selection grows a tonal fill from the centre. +export component ListRow inherits StateLayer { + // Glyph from `Icons`; empty for none. + in property icon; + in property title; + in property supporting; + in property selected; + + property title-color: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-content) + : root.selected ? Theme.on-secondary-container + : Theme.on-surface; + property detail-color: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-content) + : root.selected ? Theme.on-secondary-container + : Theme.on-surface-variant; + + height: root.supporting == "" ? 40px : 56px; + border-radius: Theme.corner-full(self.height); + squeeze: Motion.squeeze-large; + ring-offset: -Theme.focus-ring-width; + + accessible-role: list-item; + accessible-label: root.title; + accessible-description: root.supporting; + accessible-enabled: root.enabled; + accessible-item-selectable: true; + accessible-item-selected: root.selected; + accessible-action-default => { + self.activate(); + } + + Rectangle { + border-radius: root.border-radius; + background: root.enabled ? Theme.secondary-container : Theme.on-surface.with-alpha(Theme.disabled-container); + opacity: root.selected ? 1 : 0; + transform-scale-x: root.selected ? 1 : Motion.squeeze; + animate opacity, transform-scale-x { + duration: Motion.time(Motion.short4); + easing: Motion.emphasized-decelerate; + } + } + + HorizontalLayout { + padding-left: Theme.space-4; + padding-right: Theme.space-2; + spacing: Theme.space-3; + + if root.icon != "": VerticalLayout { + alignment: center; + + Icon { + glyph: root.icon; + color: root.detail-color; + } + } + + VerticalLayout { + alignment: center; + horizontal-stretch: 1; + + Text { + text: root.title; + color: root.title-color; + font-size: Theme.body-medium.size; + font-weight: Theme.body-medium.weight; + overflow: elide; + } + + if root.supporting != "": Text { + text: root.supporting; + color: root.detail-color; + font-size: Theme.body-small.size; + font-weight: Theme.body-small.weight; + overflow: elide; + } + } + + @children + } +} diff --git a/crates/tunal/ui/components/state-layer.slint b/crates/tunal/ui/components/state-layer.slint new file mode 100644 index 0000000..8ea4c77 --- /dev/null +++ b/crates/tunal/ui/components/state-layer.slint @@ -0,0 +1,155 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; + +// A state shown regardless of the pointer and focus, for gallery screenshots. +export enum ForceState { none, hover, pressed, focused } + +// The small label an icon-only control shows on hover. +export component Tooltip inherits Rectangle { + in property text; + + background: Theme.inverse-surface; + border-radius: Theme.corner-xs; + height: 24px; + + HorizontalLayout { + padding-left: Theme.space-2; + padding-right: Theme.space-2; + + Text { + text: root.text; + color: Theme.inverse-on-surface; + font-size: Theme.body-small.size; + font-weight: Theme.body-small.weight; + vertical-alignment: center; + } + } +} + +// Shared by every control: hover and press tint, press squeeze, keyboard focus ring and +// tooltip. A control inherits it, sets its shape (`border-radius`) and container colours, and +// puts its content in as children. Space and Enter activate the control when it has focus. +export component StateLayer inherits Rectangle { + in property enabled: true; + in property force-state: ForceState.none; + // Colour role the tint is mixed from: the control's content colour. + in property tint: Theme.on-surface; + // Off when the control draws the tint itself from `tint-opacity` (the switch halo). + in property fill-tint: true; + // Scale while pressed; 1 for no squeeze. + in property squeeze: Motion.squeeze; + in property tooltip; + // Gap between shape and focus ring; `-Theme.focus-ring-width` draws the ring inside the + // shape, for controls stacked edge to edge (rows, tabs). + in property ring-offset: Theme.focus-ring-offset; + + out property hovered: enabled && (touch.has-hover || force-state == ForceState.hover); + out property pressed: enabled && (touch.pressed || force-state == ForceState.pressed); + out property focused: enabled && (keyboard-focus || force-state == ForceState.focused); + out property tint-opacity: pressed ? Theme.state-press : focused ? Theme.state-focus : hovered ? Theme.state-hover : 0; + + // For users of the control. + callback clicked; + // For the control itself (toggle its own state), called before `clicked`. + callback activated; + + property keyboard-focus; + property ring-inset: Theme.focus-ring-width + root.ring-offset; + + animate tint-opacity { + duration: Motion.time(root.hovered || root.pressed ? Motion.short3 : Motion.short2); + easing: Motion.standard; + } + + // Scales from the centre; the layout size stays fixed so neighbours don't move. + transform-scale: pressed ? squeeze : 1; + animate transform-scale { + duration: Motion.time(root.pressed ? Motion.short2 : Motion.short3); + easing: Motion.standard; + } + + public function activate() { + root.activated(); + root.clicked(); + } + + FocusScope { + x: 0; + width: 0; + enabled: root.enabled; + focus-on-click: false; + + // Only keyboard focus shows the ring. + focus-gained(reason) => { + root.keyboard-focus = reason == FocusReason.tab-navigation; + } + focus-lost => { + root.keyboard-focus = false; + } + key-pressed(event) => { + if event.text == Key.Space || event.text == Key.Return { + root.activate(); + return accept; + } + reject + } + } + + touch := TouchArea { + enabled: root.enabled; + clicked => { + root.activate(); + } + changed has-hover => { + if !self.has-hover { + root.tip-due = false; + tip.close(); + } + } + changed pressed => { + if self.pressed { + tip.close(); + } + } + } + + @children + + // Above the content so it also shows over a selection fill; 8–10 % barely touches text. + Rectangle { + visible: root.fill-tint; + border-radius: root.border-radius; + background: root.tint.with-alpha(root.tint-opacity); + } + + if root.focused: Rectangle { + x: -root.ring-inset; + y: -root.ring-inset; + width: root.width + 2 * root.ring-inset; + height: root.height + 2 * root.ring-inset; + border-width: Theme.focus-ring-width; + border-color: Theme.secondary; + border-radius: root.border-radius + root.ring-inset; + } + + // Runs only while hovered and the tooltip is not yet shown: nothing ticks when idle. + property tip-due; + Timer { + interval: Motion.tooltip-delay; + running: root.tooltip != "" && touch.has-hover && !touch.pressed && !root.tip-due; + triggered => { + root.tip-due = true; + tip.show(); + } + } + + tip := PopupWindow { + close-policy: no-auto-close; + x: (root.width - self.width) / 2; + y: root.height + Theme.space-1; + + Tooltip { + text: root.tooltip; + } + } +} diff --git a/crates/tunal/ui/components/switch.slint b/crates/tunal/ui/components/switch.slint new file mode 100644 index 0000000..77f76ed --- /dev/null +++ b/crates/tunal/ui/components/switch.slint @@ -0,0 +1,75 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { StateLayer } from "state-layer.slint"; + +// An on/off switch. The thumb slides and grows when on, grows further while pressed, and a +// halo behind it carries the hover and press tint. +export component Switch inherits StateLayer { + in-out property checked; + + property halo-size: 40px; + property thumb-size: root.pressed ? 28px : root.checked ? 24px : 16px; + // Centre of the thumb. + property thumb-x: root.checked ? root.width - root.height / 2 : root.height / 2; + + width: 52px; + height: 32px; + border-radius: Theme.corner-full(self.height); + background: root.checked + ? (root.enabled ? Theme.primary : Theme.on-surface.with-alpha(Theme.disabled-container)) + : (root.enabled ? Theme.surface-container-highest : Theme.surface-container-highest.with-alpha(Theme.disabled-container)); + border-width: root.checked ? 0 : 2px; + border-color: root.enabled ? Theme.outline : Theme.on-surface.with-alpha(Theme.disabled-container); + // The thumb grows instead of the whole switch squeezing. + squeeze: 1; + fill-tint: false; + animate background, border-color { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + animate thumb-x { + duration: Motion.time(Motion.short4); + easing: Motion.emphasized; + } + animate thumb-size { + duration: Motion.time(root.pressed ? Motion.short2 : Motion.short3); + easing: Motion.standard; + } + + activated => { + root.checked = !root.checked; + } + + accessible-role: switch; + accessible-enabled: root.enabled; + accessible-checkable: true; + accessible-checked: root.checked; + accessible-action-default => { + self.activate(); + } + + Rectangle { + x: root.thumb-x - self.width / 2; + y: (root.height - self.height) / 2; + width: root.halo-size; + height: root.halo-size; + border-radius: Theme.corner-full(self.height); + background: (root.checked ? Theme.primary : Theme.on-surface).with-alpha(root.tint-opacity); + } + + Rectangle { + x: root.thumb-x - self.width / 2; + y: (root.height - self.height) / 2; + width: root.thumb-size; + height: root.thumb-size; + border-radius: Theme.corner-full(self.height); + background: !root.enabled + ? (root.checked ? Theme.surface : Theme.on-surface.with-alpha(Theme.disabled-content)) + : root.checked ? (root.hovered || root.pressed ? Theme.primary-container : Theme.on-primary) + : (root.hovered || root.pressed ? Theme.on-surface-variant : Theme.outline); + animate background { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + } +} diff --git a/crates/tunal/ui/components/tab.slint b/crates/tunal/ui/components/tab.slint new file mode 100644 index 0000000..6df2f41 --- /dev/null +++ b/crates/tunal/ui/components/tab.slint @@ -0,0 +1,128 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { Icon, Icons } from "icon.slint"; +import { IconButton } from "icon-button.slint"; +import { StateLayer } from "state-layer.slint"; + +// One tab: icon, title and close button. The active indicator belongs to `TabBar` so it can +// slide between tabs. +export component Tab inherits StateLayer { + in property title; + // Glyph from `Icons`; empty for none. + in property icon; + in property active; + in property closable: true; + callback close(); + + property content: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-content) + : root.active ? Theme.primary + : Theme.on-surface-variant; + + height: 40px; + border-radius: Theme.corner-sm; + squeeze: Motion.squeeze-large; + ring-offset: -Theme.focus-ring-width; + + accessible-role: tab; + accessible-label: root.title; + accessible-enabled: root.enabled; + accessible-item-selectable: true; + accessible-item-selected: root.active; + accessible-action-default => { + self.activate(); + } + + HorizontalLayout { + padding-left: Theme.space-3; + padding-right: root.closable ? Theme.space-1 : Theme.space-3; + spacing: Theme.space-2; + + if root.icon != "": VerticalLayout { + alignment: center; + + Icon { + glyph: root.icon; + size: 18px; + color: root.content; + } + } + + Text { + horizontal-stretch: 1; + text: root.title; + color: root.content; + font-size: Theme.label-large.size; + font-weight: Theme.label-large.weight; + vertical-alignment: center; + overflow: elide; + animate color { + duration: Motion.time(Motion.short4); + easing: Motion.standard; + } + } + + if root.closable: VerticalLayout { + alignment: center; + + IconButton { + icon: Icons.close; + size: 28px; + icon-size: 18px; + tooltip: "Close tab"; + enabled: root.enabled; + clicked => { + root.close(); + } + } + } + } +} + +export struct TabItem { + title: string, + icon: string, +} + +// A row of equal-width tabs with one indicator that slides to the active tab. +export component TabBar { + in property <[TabItem]> tabs; + in-out property current; + in property max-tab-width: 240px; + callback selected(index: int); + callback close(index: int); + + property tab-width: tabs.length == 0 ? 0 : min(max-tab-width, root.width / tabs.length); + property indicator-height: 3px; + + height: 40px + indicator-height; + accessible-role: tab-list; + + for tab[index] in root.tabs: Tab { + x: index * root.tab-width; + y: 0; + width: root.tab-width; + title: tab.title; + icon: tab.icon; + active: index == root.current; + clicked => { + root.current = index; + root.selected(index); + } + close => { + root.close(index); + } + } + + if root.tabs.length > 0: Rectangle { + x: root.current * root.tab-width + Theme.space-2; + y: root.height - self.height; + width: root.tab-width - 2 * Theme.space-2; + height: root.indicator-height; + border-radius: Theme.corner-full(self.height); + background: Theme.primary; + animate x, width { + duration: Motion.time(Motion.medium2); + easing: Motion.emphasized; + } + } +} diff --git a/crates/tunal/ui/components/text-field.slint b/crates/tunal/ui/components/text-field.slint new file mode 100644 index 0000000..5e983c5 --- /dev/null +++ b/crates/tunal/ui/components/text-field.slint @@ -0,0 +1,127 @@ +import { Theme } from "../theme.slint"; +import { Motion } from "../motion.slint"; +import { Icons } from "icon.slint"; +import { IconButton } from "icon-button.slint"; +import { ForceState } from "state-layer.slint"; + +// A single-line text field: label above, outlined frame, clear button while there is text, +// and a message line below (supporting text, or the error in its place). The message line +// is always reserved so an error never pushes the content under the field. +export component TextField { + in property label; + in property placeholder; + in property supporting; + in property error; + in property enabled: true; + in property force-state: ForceState.none; + in-out property text; + callback edited(text: string); + callback accepted(text: string); + + out property focused: enabled && (input.has-focus || force-state == ForceState.focused); + property hovered: enabled && (touch.has-hover || force-state == ForceState.hover); + property failed: enabled && error != ""; + property disabled: Theme.on-surface.with-alpha(Theme.disabled-content); + + // The input itself is the accessible text field. + forward-focus: input; + + VerticalLayout { + spacing: Theme.space-1; + + if root.label != "": Text { + text: root.label; + color: !root.enabled ? root.disabled : root.failed ? Theme.error : root.focused ? Theme.primary : Theme.on-surface-variant; + font-size: Theme.body-small.size; + font-weight: Theme.body-small.weight; + overflow: elide; + } + + Rectangle { + height: 40px; + border-radius: Theme.corner-xs; + border-width: root.focused ? 2px : Theme.hairline; + border-color: !root.enabled ? Theme.on-surface.with-alpha(Theme.disabled-container) + : root.failed ? Theme.error + : root.focused ? Theme.primary + : root.hovered ? Theme.on-surface + : Theme.outline; + animate border-color { + duration: Motion.time(Motion.short3); + easing: Motion.standard; + } + + // Hover only; the input below takes the clicks. + touch := TouchArea { + enabled: root.enabled; + mouse-cursor: MouseCursor.text; + } + + HorizontalLayout { + padding-left: Theme.space-4; + padding-right: Theme.space-1; + spacing: Theme.space-1; + + Rectangle { + horizontal-stretch: 1; + + if root.text == "": Text { + width: 100%; + text: root.placeholder; + color: root.enabled ? Theme.on-surface-variant : root.disabled; + font-size: Theme.body-medium.size; + font-weight: Theme.body-medium.weight; + vertical-alignment: center; + overflow: elide; + } + + input := TextInput { + width: 100%; + text <=> root.text; + accessible-label: root.label; + accessible-placeholder-text: root.placeholder; + enabled: root.enabled; + single-line: true; + color: root.enabled ? Theme.on-surface : root.disabled; + selection-background-color: Theme.primary-container; + selection-foreground-color: Theme.on-primary-container; + font-size: Theme.body-medium.size; + font-weight: Theme.body-medium.weight; + vertical-alignment: center; + edited => { + root.edited(self.text); + } + accepted => { + root.accepted(self.text); + } + } + } + + if root.text != "" && root.enabled: VerticalLayout { + alignment: center; + + IconButton { + icon: Icons.cancel; + size: 32px; + icon-size: 20px; + tooltip: "Clear"; + clicked => { + root.text = ""; + root.edited(""); + input.focus(); + } + } + } + } + } + + Text { + text: root.failed ? root.error : root.supporting; + color: !root.enabled ? root.disabled : root.failed ? Theme.error : Theme.on-surface-variant; + font-size: Theme.body-small.size; + font-weight: Theme.body-small.weight; + min-height: Theme.body-small.line-height; + overflow: elide; + } + } +} diff --git a/crates/tunal/ui/gallery.slint b/crates/tunal/ui/gallery.slint new file mode 100644 index 0000000..0cdfc52 --- /dev/null +++ b/crates/tunal/ui/gallery.slint @@ -0,0 +1,326 @@ +import { Theme } from "theme.slint"; +import { Icon, Icons } from "components/icon.slint"; +import { ForceState, Tooltip } from "components/state-layer.slint"; +import { Button, ButtonKind } from "components/button.slint"; +import { IconButton } from "components/icon-button.slint"; +import { Chip, ChipKind } from "components/chip.slint"; +import { Switch } from "components/switch.slint"; +import { ListRow } from "components/list-row.slint"; +import { Tab, TabBar } from "components/tab.slint"; +import { TextField } from "components/text-field.slint"; + +// Every control in every state, for screenshots: `tunal --gallery --screenshot `. +// Columns force the state; the last one is the disabled control. + +component Caption inherits Text { + color: Theme.on-surface-variant; + font-size: Theme.label-medium.size; + font-weight: Theme.label-medium.weight; + vertical-alignment: center; +} + +component Row { + in property name; + + HorizontalLayout { + spacing: Theme.space-4; + + Caption { + width: 120px; + text: root.name; + } + + @children + } +} + +component Cell { + width: 184px; + + HorizontalLayout { + alignment: start; + + VerticalLayout { + alignment: center; + + @children + } + } +} + +export component Gallery inherits Window { + title: "Tunal controls"; + icon: @image-url("../../../assets/tunal.png"); + preferred-width: 1200px; + preferred-height: 1100px; + background: Theme.surface; + + property <[ForceState]> states: [ForceState.none, ForceState.hover, ForceState.pressed, ForceState.focused, ForceState.none]; + property disabled-column: 4; + + VerticalLayout { + padding: Theme.space-6; + spacing: Theme.space-3; + alignment: start; + + Row { + for caption in ["Rest", "Hover", "Pressed", "Focused", "Disabled"]: Cell { + Caption { + text: caption; + } + } + } + + Row { + name: "Filled button"; + for state[i] in root.states: Cell { + Button { + text: "New folder"; + icon: Icons.add; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + + Row { + name: "Tonal button"; + for state[i] in root.states: Cell { + Button { + kind: ButtonKind.tonal; + text: "Copy"; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + + Row { + name: "Outlined button"; + for state[i] in root.states: Cell { + Button { + kind: ButtonKind.outlined; + text: "Cancel"; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + + Row { + name: "Text button"; + for state[i] in root.states: Cell { + Button { + kind: ButtonKind.text; + text: "Rename"; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + + Row { + name: "Icon buttons"; + for state[i] in root.states: Cell { + HorizontalLayout { + spacing: Theme.space-2; + + IconButton { + icon: Icons.search; + tooltip: "Search"; + force-state: state; + enabled: i != root.disabled-column; + } + + IconButton { + icon: Icons.grid-view; + tooltip: "Icon view"; + toggle: true; + force-state: state; + enabled: i != root.disabled-column; + } + + IconButton { + icon: Icons.grid-view; + tooltip: "Icon view"; + toggle: true; + checked: true; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + } + + Row { + name: "Filter chips"; + for state[i] in root.states: Cell { + HorizontalLayout { + spacing: Theme.space-2; + + Chip { + text: "Music"; + force-state: state; + enabled: i != root.disabled-column; + } + + Chip { + text: "Music"; + checked: true; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + } + + Row { + name: "Assist chip"; + for state[i] in root.states: Cell { + Chip { + kind: ChipKind.assist; + text: "Add tag"; + icon: Icons.add; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + + Row { + name: "Switches"; + for state[i] in root.states: Cell { + HorizontalLayout { + spacing: Theme.space-4; + + Switch { + force-state: state; + enabled: i != root.disabled-column; + } + + Switch { + checked: true; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + } + + Row { + name: "List rows"; + for state[i] in root.states: Cell { + VerticalLayout { + spacing: Theme.space-1; + width: 176px; + + ListRow { + icon: Icons.folder; + title: "Documents"; + force-state: state; + enabled: i != root.disabled-column; + } + + ListRow { + icon: Icons.folder; + title: "Pictures"; + selected: true; + force-state: state; + enabled: i != root.disabled-column; + } + + ListRow { + icon: Icons.music-note; + title: "A very long track name that does not fit.flac"; + supporting: "4.2 MB"; + force-state: state; + enabled: i != root.disabled-column; + + VerticalLayout { + alignment: center; + + Icon { + glyph: Icons.star; + size: 18px; + } + } + } + } + } + } + + Row { + name: "Tabs"; + for state[i] in root.states: Cell { + VerticalLayout { + spacing: Theme.space-1; + width: 176px; + + Tab { + title: "Home"; + icon: Icons.home; + active: true; + force-state: state; + enabled: i != root.disabled-column; + } + + Tab { + title: "Downloads"; + icon: Icons.folder; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + } + + Row { + name: "Text fields"; + for state[i] in root.states: Cell { + VerticalLayout { + spacing: Theme.space-1; + width: 176px; + + TextField { + label: "Name"; + placeholder: "Folder name"; + force-state: state; + enabled: i != root.disabled-column; + } + + TextField { + label: "Name"; + text: "notes/2026.txt"; + error: "Names can't contain /"; + force-state: state; + enabled: i != root.disabled-column; + } + } + } + } + + Row { + name: "Tab bar"; + + TabBar { + width: 600px; + current: 1; + tabs: [ + { title: "Home", icon: Icons.home }, + { title: "Downloads", icon: Icons.folder }, + { title: "Music", icon: Icons.music-note }, + ]; + } + } + + Row { + name: "Tooltip"; + + Cell { + Tooltip { + text: "Search"; + } + } + } + } +} diff --git a/crates/tunal/ui/motion.slint b/crates/tunal/ui/motion.slint index b974906..d5aa5e3 100644 --- a/crates/tunal/ui/motion.slint +++ b/crates/tunal/ui/motion.slint @@ -31,6 +31,14 @@ export global Motion { out property standard-decelerate: cubic-bezier(0, 0, 0, 1); out property standard-accelerate: cubic-bezier(0.3, 0, 1, 1); + // Press squeeze (scale while held): small controls squeeze most, wide ones least. + out property squeeze-small: 0.9; + out property squeeze: 0.96; + out property squeeze-large: 0.985; + + // Hover time before a tooltip shows. A delay, not motion: reduced motion keeps it. + out property tooltip-delay: 500ms; + public pure function time(d: duration) -> duration { reduced ? 0ms : d } diff --git a/crates/tunal/ui/theme.slint b/crates/tunal/ui/theme.slint index 81c25f8..8a96bd2 100644 --- a/crates/tunal/ui/theme.slint +++ b/crates/tunal/ui/theme.slint @@ -68,6 +68,10 @@ export global Theme { // Hairline borders. out property hairline: 1px; + // Keyboard focus ring, drawn outside the control's shape. + out property focus-ring-width: 2px; + out property focus-ring-offset: 2px; + // Type: the system UI face plus the icon font; four sizes. out property icon-font: "Material Symbols Rounded"; out property title-large: { size: 22px, weight: 400, line-height: 28px }; diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index ccb57af..e8df0d7 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -26,3 +26,4 @@ D-021 — 2026-11-18 — Playlist sort: a sort option "Playlist sort" offered on D-022 — 2026-11-18 — Fallback theme seed `#3F6FB5` (muted blue) when the portal gives no accent; palettes are `material-colors` 0.5 `ThemeBuilder` defaults (tonal spot, spec 2021) exported as ARGB `Palette` structs; library warnings go to stderr as one `tunal-theme: …` line (no logging crate yet) — S002 — S002, S003. D-023 — 2026-11-18 — Window minimum size 720×480 px (preferred 960×640): fits a 240 px sidebar plus a usable content column; Slint 1.19 can't drive the icon font's variation axes (font-weight doesn't reach `wght`), so `Icon` has size only and draws the default instance (wght 400, FILL 0); easing tokens live in an internal `Motion` global and Rust sets the reduced flag through `MotionPrefs` (easing properties can't be exported) — S003 — S003 and every UI plan. D-024 — 2026-11-18 — Location URIs are `scheme://authority/path` with the path as raw bytes (percent-encoded only in Display); every backend implements the object-safe blocking `Location` trait in `tunal-core` (chunked `list` with a `ControlFlow` sink, `watch` returning a drop guard), unsupported ops return `Error::Unsupported`, and views gate actions on `capabilities()` — S006 — S007–S014, S024–S029. +D-025 — 2026-11-18 — Controls: every control inherits `StateLayer` (tint drawn above content, `clicked` for users and `activated` for the control's own toggling; inherited properties must be written `root.x`); `TextField` is built on the builtin `TextInput` because std `LineEdit` (material) takes its colours from the fixed `MaterialPalette` and can't use our tokens; the software renderer ignores `transform-scale`, so press squeeze shows only in a real window — S004 — every UI plan, S035. diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 0f3784f..cf55f44 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -27,5 +27,13 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done, - Not done: nothing. URI schemes `trash:///`, `ios://`, `mtp://`, `sftp://user@host:port/path` come with their plans. - Later: local `rename` uses a check-then-rename (race); `renameat2(RENAME_NOREPLACE)` would need `libc`/`rustix`. +## S004 — Base animated controls +- Done: `components/state-layer.slint`: `ForceState { none, hover, pressed, focused }`; `Tooltip { text }`; `StateLayer` (base via `inherits`; `enabled`, `force-state`, `tint`, `fill-tint`, `squeeze`, `tooltip`, `ring-offset`; out `hovered/pressed/focused/tint-opacity`; `clicked` for users, `activated` for the control itself; `activate()`; Space/Enter; ring only on Tab focus; tooltip Timer runs only while hovered). +- `Button { text, icon, kind: ButtonKind { filled, tonal, outlined, text } }` · `IconButton { icon, toggle, checked, size, icon-size }` (circle → squircle on press) · `Chip { text, icon, kind: ChipKind { filter, assist }, checked }` (fixed width, label slides, check fades/scales) · `Switch { checked }` (thumb slides/grows, halo tint) · `ListRow { icon, title, supporting, selected, trailing @children }` · `Tab { title, icon, active, closable; close() }` · `TabBar { tabs: [TabItem { title, icon }], current, max-tab-width; selected(int), close(int) }` (equal widths, sliding indicator) · `TextField { label, placeholder, supporting, error, enabled, force-state, text; edited, accepted; out focused }`. +- Tokens: `Motion.squeeze-small/squeeze/squeeze-large`, `Motion.tooltip-delay`; `Theme.focus-ring-width/offset`; Icons check, close, cancel, add, search, star, grid-view, music-note, description. `theme_bridge::Themed` trait (MainWindow, Gallery); `screenshot::run(options, new)`; `tunal --gallery [--screenshot …]` (screenshot forces reduced motion). +- Verified: workspace build, clippy -D warnings, fmt --check, literal grep empty; gallery PNGs light + dark looked at (all states), bad argument → usage, exit 1. +- Not done: press squeeze is invisible in PNGs (software renderer ignores `transform-scale`, D-025); live hover/tooltip/animation not watched (no hidden session); `TextField` uses `TextInput`, not `LineEdit` (D-025). +- Later: focus ring on `TextField` is its 2 px border only; long tab bars (more tabs than fit) need scrolling. + ## Later -