diff --git a/crates/atomic/src/lib.rs b/crates/atomic/src/lib.rs index c0bbcf555..5aa3c75cd 100644 --- a/crates/atomic/src/lib.rs +++ b/crates/atomic/src/lib.rs @@ -491,7 +491,6 @@ fn name_taken(e: &io::Error, tmp: &Path) -> bool { /// The Windows attributes a replaced file passes on to its stage: hidden and system, the two that /// say who should see the file. A read-only file is never replaced, the archive bit is the /// system's to set on a changed file, and the others describe how the volume stores it. - #[cfg(windows)] const KEPT_ATTRIBUTES: u32 = 0x2 | 0x4; @@ -549,8 +548,12 @@ const MAX_XATTR_TOTAL_BYTES: usize = 64 * 1024 * 1024; /// binding, quarantine, resource forks) to the stage. The attributes are as untrusted as the /// bytes, so the reads are bounded; one that cannot be read or written whole, or passes a bound, /// refuses the save rather than dropping the user's metadata unnoticed. Only a volume without -/// extended attributes (`ENOTSUP`) is skipped. `com.apple.provenance` belongs to macOS, which -/// gives the new file its own. Compression bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). +/// extended attributes (`ENOTSUP`) is skipped. So is a file whose data the user may not read when +/// its attribute names can't be listed either, as with mode 0200: its attributes are dropped, as +/// before attributes were kept, since the user can't read them (or its bytes) at all. One whose +/// data is denied but whose names can be listed (an ACL that denies reading) refuses the save. +/// `com.apple.provenance` belongs to macOS, which gives the new file its own. Compression +/// bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). #[cfg(target_os = "macos")] fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { use rustix::fs::{Mode, OFlags, XattrFlags, fgetxattr, fgetxattr_query, flistxattr, fsetxattr, open}; @@ -561,6 +564,7 @@ fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { let source = match open(target, OFlags::RDONLY | OFlags::CLOEXEC | OFlags::NOFOLLOW | OFlags::NONBLOCK, Mode::empty()) { Ok(fd) => File::from(fd), Err(Errno::NOENT | Errno::LOOP) => return Ok(()), + Err(Errno::ACCESS) => return unreadable_has_no_attributes(target), Err(e) => return Err(e.into()), }; if !source.metadata()?.is_file() { @@ -596,6 +600,27 @@ fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { Ok(()) } +/// For a target whose data can't be opened for reading: `Ok` when the user can list no extended +/// attribute names on it (none, only `com.apple.provenance`, none supported, or listing is denied too, +/// as for mode 0200, whose attributes are then dropped); otherwise refuse the save, as the attributes +/// can't be copied without opening the file. The names are read without following a link, by path. +#[cfg(target_os = "macos")] +fn unreadable_has_no_attributes(target: &Path) -> io::Result<()> { + use rustix::fs::llistxattr; + use rustix::io::Errno; + let mut names = vec![0u8; MAX_XATTR_NAMES_BYTES]; + match llistxattr(target, names.as_mut_slice()) { + Ok(0) | Err(Errno::NOTSUP | Errno::ACCESS | Errno::NOENT) => Ok(()), + Ok(len) if names.get(..len).is_some_and(|names| names.split(|b| *b == 0).all(|name| name.is_empty() || name == b"com.apple.provenance")) => { + Ok(()) + } + Ok(_) | Err(Errno::RANGE) => { + Err(io::Error::new(io::ErrorKind::PermissionDenied, "the file can't be read, so its extended attributes can't be copied")) + } + Err(e) => Err(e.into()), + } +} + /// Read one attribute value of `size` bytes (already within the bounds) with `read`, then ask /// its size again with `query_size`. A read that does not fill `size`, or a size that changed, /// is refused: a growing resource fork returns the prefix that fits instead of an error. diff --git a/crates/atomic/tests/atomic_tests.rs b/crates/atomic/tests/atomic_tests.rs index b1da9be0a..fcafd2ca7 100644 --- a/crates/atomic/tests/atomic_tests.rs +++ b/crates/atomic/tests/atomic_tests.rs @@ -99,3 +99,49 @@ fn private_staging_preserves_existing_modes_after_callback() -> io::Result<()> { assert_no_temp(&d.0); Ok(()) } + +/// Extended attribute names on `path`, read by path. +#[cfg(target_os = "macos")] +fn xattr_names(path: &Path) -> Vec> { + let mut names = vec![0u8; 64 * 1024]; + let len = rustix::fs::listxattr(path, names.as_mut_slice()).unwrap_or(0); + names.truncate(len); + names.split(|b| *b == 0).filter(|n| !n.is_empty()).map(<[u8]>::to_vec).collect() +} + +/// A write-only file (mode 0200) saves: macOS lets its owner neither read its data nor list its +/// attributes, so its attributes are dropped, as before attributes were kept. +#[cfg(target_os = "macos")] +#[test] +fn a_write_only_file_saves_and_drops_the_attributes_it_cannot_read() -> io::Result<()> { + use std::os::unix::fs::PermissionsExt; + let d = TempDir::new("write_only_xattrs"); + let p = d.0.join("doc.craft"); + std::fs::write(&p, ORIGINAL)?; + rustix::fs::setxattr(&p, "com.craft.t", b"tag", rustix::fs::XattrFlags::empty())?; + std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o200))?; + atomic_write(&p, b"new")?; + std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o600))?; + assert_eq!(std::fs::read(&p)?, b"new"); + assert!(!xattr_names(&p).iter().any(|n| n == b"com.craft.t"), "the unreadable attribute is dropped"); + Ok(()) +} + +/// A file whose data an ACL denies but whose attribute names can be listed is not replaced: its +/// attributes can't be copied without its data, and the save refuses rather than drop them. +#[cfg(target_os = "macos")] +#[test] +fn an_unreadable_file_with_listable_attributes_is_not_replaced() -> io::Result<()> { + let d = TempDir::new("acl_denied_xattrs"); + let p = d.0.join("doc.craft"); + std::fs::write(&p, ORIGINAL)?; + rustix::fs::setxattr(&p, "com.craft.t", b"tag", rustix::fs::XattrFlags::empty())?; + let denied = std::process::Command::new("/bin/chmod").arg("+a").arg("everyone deny read").arg(&p).status()?; + assert!(denied.success(), "the ACL is set"); + let result = atomic_write(&p, b"new"); + let _ = std::process::Command::new("/bin/chmod").arg("-N").arg(&p).status(); + assert!(result.is_err(), "the save is refused"); + assert_eq!(std::fs::read(&p)?, ORIGINAL, "the original is unchanged"); + assert!(xattr_names(&p).iter().any(|n| n == b"com.craft.t"), "and keeps its attribute"); + Ok(()) +} diff --git a/crates/automation/src/server.rs b/crates/automation/src/server.rs index b2f9fdd1d..c6808156d 100644 --- a/crates/automation/src/server.rs +++ b/crates/automation/src/server.rs @@ -1,7 +1,7 @@ //! The loopback JSON-lines TCP transport: one request per line, one reply per line. -use std::io::{BufReader, Write}; -use std::net::{SocketAddr, TcpListener, TcpStream}; +use std::io::{BufReader, Read, Write}; +use std::net::{Shutdown, SocketAddr, TcpListener, TcpStream}; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::{Receiver, Sender, channel}; @@ -89,6 +89,7 @@ pub fn serve_with_deadline( let Some(permit) = limiter.try_acquire() else { let _ = configure_stream(&stream); let _ = writeln!(stream, "{}", json!({"id": null, "ok": false, "error": "connection limit reached"})); + close_after_reply(&stream); continue; }; let tx = tx.clone(); @@ -179,4 +180,27 @@ fn serve_connection(stream: TcpStream, token: &str, tx: &Sender, break; } } + close_after_reply(&out); +} + +/// How long a closing connection's leftover input is read and dropped ([`close_after_reply`]). +const CLOSE_LINGER: Duration = Duration::from_millis(250); + +/// Closes `stream` after its last reply without resetting it: the write side ends first, so the client reads the +/// reply and then the end of the stream, and what the client still sends is read and dropped until it closes too, for +/// at most [`CLOSE_LINGER`]. A socket closed with input unread is reset instead, and the client loses the reply +/// (Linux) or reads the reset where the end of the stream should be (Windows). +fn close_after_reply(mut stream: &TcpStream) { + let _ = stream.shutdown(Shutdown::Write); + let deadline = motion::now() + CLOSE_LINGER; + let mut sink = [0; 1024]; + loop { + let left = deadline.saturating_duration_since(motion::now()); + if left.is_zero() || stream.set_read_timeout(Some(left)).is_err() { + return; + } + if matches!(stream.read(&mut sink), Ok(0) | Err(_)) { + return; + } + } } diff --git a/crates/behavior/src/grid.rs b/crates/behavior/src/grid.rs index b9c1e5bfd..bd782a0e9 100644 --- a/crates/behavior/src/grid.rs +++ b/crates/behavior/src/grid.rs @@ -119,10 +119,11 @@ impl GridCursor { cursor } - /// A cursor for the sweep that asks each column for its least: every column but a `Fixed` one is placed as a - /// `Content` column whose cells measure in no bound along x, so each column measures its widest cell. + /// A cursor for the sweep that asks each column for its least: the cells of every `Content` and `Fill` column + /// measure in no bound along x, so each column measures its widest cell. A `Fill` column stays one, so a child + /// that fills its width measures its own width there, where a `Content` column would hold it and take none. pub fn unbounded(flow: Flow, columns: &[ColumnWidth], gap: Vec2) -> Self { - let mut cursor = Self::new(flow, &as_content(columns), gap, &GridMeasure::default()); + let mut cursor = Self::new(flow, columns, gap, &GridMeasure::default()); cursor.unbounded = true; cursor } @@ -185,7 +186,7 @@ impl GridCursor { let count = self.columns.len().max(1); let (column, _, _, top) = self.next_place(); let width = match self.columns.get(column) { - Some(ColumnWidth::Content) if self.unbounded => f32::INFINITY, + Some(ColumnWidth::Content | ColumnWidth::Fill { .. }) if self.unbounded => f32::INFINITY, Some(ColumnWidth::Content) => { // Every other column keeps at least its least: a column that fills keeps only that, and so does a // content column when each column measures alone. diff --git a/crates/color-ui/src/ui/mod.rs b/crates/color-ui/src/ui/mod.rs index 58a1ee6bf..54fb83783 100644 --- a/crates/color-ui/src/ui/mod.rs +++ b/crates/color-ui/src/ui/mod.rs @@ -64,8 +64,8 @@ pub use hud::{ColorHud, ColorHudOutput}; pub use info::{InfoColor, InfoMeasure, InfoPanel, InfoReadings, InfoWords}; pub use lut_picker::{LutChoice, LutPicker, LutPickerOutput, LutWords}; pub use paint_chip::{ - FillKind, GradientPreview, ImagePreview, Paint, PaintChip, PaintChipOutput, PaintEditor, PaintLink, PaintLinkKind, PaintList, PaintListEvent, - PaintListOptions, PaintListOutput, PaintRow, PaintWords, + FillKind, GradientPreview, ImagePreview, Paint, PaintChip, PaintChipOutput, PaintChipSize, PaintEditor, PaintLink, PaintLinkKind, PaintList, + PaintListEvent, PaintListOptions, PaintListOutput, PaintRow, PaintWords, }; pub use pair::{DropAccepts, PairWell, SwatchPair, SwatchPairOutput, Well}; pub use palette::{SwatchPalette, SwatchPaletteOutput}; diff --git a/crates/color-ui/src/ui/paint_chip.rs b/crates/color-ui/src/ui/paint_chip.rs index e6887a0e7..28de7cc7b 100644 --- a/crates/color-ui/src/ui/paint_chip.rs +++ b/crates/color-ui/src/ui/paint_chip.rs @@ -14,12 +14,13 @@ use craft_behavior::{Axis, EditEvent, EditEvents, Metrics, PartKey}; use craft_cms::convert::CmykConverter; use craft_keymap::Mods; use craft_theme::Srgba; -use craft_ui::buttons::Button; +use craft_ui::buttons::{Button, PopupMark}; use craft_ui::choice::{ChoiceWords, RING_SHARE, Segmented, Swatch, SwatchStyle, paint_ring}; use craft_ui::contract::{ Access, Activation, Bind, Common, Component, Cx, DisabledLook, Edit as _, EditResponse, Entry, Meta as _, Outcome, Overlay, OverlayUi, Overlays as _, Pages, PaintUi, PartsCx, Pointer as _, PopupKind, Props as _, Remember as _, Role, Show as _, ShowContainer as _, WordSetCx as _, }; +use craft_ui::controls::disclosure::DisclosureGlyph; use craft_ui::layout_components::Row; use craft_ui::patterns::presets::{DefaultOpen, PresetBrowser, PresetEvent, PresetRowMenu, PresetState}; use craft_ui::primitives::textures::CachedTexture; @@ -39,8 +40,10 @@ pub(crate) mod stories; pub use paint_list::{PaintLink, PaintLinkKind, PaintList, PaintListEvent, PaintListOptions, PaintListOutput, PaintRow}; -/// The chip is this many control heights wide. +/// A regular chip is this many control heights wide. const CHIP_WIDTH_IN_HEIGHTS: f32 = 1.5; +/// A swatch chip's side is a rail button's over this, so three to a row fill a one-column rail's cell. +const SWATCHES_PER_RAIL_BUTTON: f32 = 3.0; /// The most tiles a pattern chip draws; a tile so small that more would fit is drawn as one stretched image. const MAX_TILES: f32 = 4096.0; /// The No Color diagonal stops this many control heights short of the chip's edges. @@ -202,6 +205,21 @@ impl PaintEditor<'_, T> { } } +/// How large a [`PaintChip`] is; every size paints the same well. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum PaintChipSize { + /// A control high and 1.5 times as wide: a panel's or an options bar's chip. + #[default] + Regular, + /// A square well of `size.icon.md` in a slot a control high and `space.gap.item` wider than the well: a chip among + /// a bar's buttons, as a contextual task bar's Fill and Stroke. + Compact, + /// A square a third of `size.rail.button` on a side that opens no popover: a tool rail's Color, Gradient and None, + /// three to a row. + Swatch, +} + /// The style of a paint chip. #[derive(Clone, Debug, PartialEq, ComponentStyle)] #[non_exhaustive] @@ -210,8 +228,10 @@ pub struct PaintChipStyle { metrics: Metrics, #[style(focus)] focus: FocusLook, - /// The chip's height. - height: f32, + /// The well's size. + well: egui::Vec2, + /// The chip's size before the room of its mark: the well's, or for a compact chip the slot round it. + slot: egui::Vec2, /// The chip's corners. radius: egui::CornerRadius, /// The ring on the chip's outline. @@ -222,6 +242,12 @@ pub struct PaintChipStyle { none_mark: StyleColor, /// The swatch look the ring is painted with. swatch: SwatchStyle, + /// The side of the dropdown arrow a chip with [`PopupMark::Menu`] shows after its well. + arrow: f32, + /// The room the arrow takes after the well: the arrow with a tight gap on each side. + arrow_room: f32, + /// The arrow's colour. + arrow_color: StyleColor, } impl PaintChipStyle { @@ -231,7 +257,7 @@ impl PaintChipStyle { none_fill: self.none_fill, none_mark: self.none_mark, edge: self.edge, - height: self.height, + height: self.well.y, radius: self.radius, ring, swatch: self.swatch.clone(), @@ -352,7 +378,8 @@ pub(crate) fn paint_well(ui: &mut PaintUi<'_>, cx: &Cx<'_, impl craft_ui::contra } } -/// A paint chip, a control high and 1.5 times as wide. +/// A paint chip as large as its [`chip_size`](Self::chip_size) (by default a control high and 1.5 times as wide), with the +/// room of its [`popup_mark`](Self::popup_mark) after it. /// /// - Look: a solid paint fills the chip over the checkerboard (alpha shows); a gradient is a /// start-to-end ramp through its stops; No Color is the field fill with a `status.bad` diagonal @@ -400,6 +427,15 @@ pub struct PaintChip<'a> { /// The chip draws as a stroke ring through the one ring painter. #[prop] ring: bool, + /// The mark after the well that tells the chip opens more than it shows: [`PopupMark::Menu`] draws the shared + /// dropdown arrow, inside the chip's hit area. None by default; a chip has no tool group mark, so + /// [`PopupMark::ToolGroup`] draws none. + #[prop] + popup_mark: PopupMark, + /// How large the chip is; [`PaintChipSize::Regular`] by default. + #[style_key] + #[prop] + chip_size: PaintChipSize, /// The request of the Color Picker… button, for this pass. pick_color: Option, /// The modifiers of this pass's click on a chip without a popover. @@ -426,6 +462,8 @@ impl<'a> PaintChip<'a> { full_picker: false, popover: true, ring: false, + popup_mark: PopupMark::None, + chip_size: PaintChipSize::Regular, pick_color: None, clicked: None, } @@ -485,6 +523,24 @@ impl<'a> PaintChip<'a> { self.gradient.as_ref().map(|(default, _)| default) } + /// The room after the well the mark takes: the arrow's for [`PopupMark::Menu`], none otherwise. + fn mark_room(&self, style: &PaintChipStyle) -> f32 { + if self.popup_mark == PopupMark::Menu { style.arrow_room } else { 0.0 } + } + + /// Whether a click opens the popover: on unless [`popover`](Self::popover) is off or the chip is a swatch. + fn opens(&self) -> bool { + self.popover && self.chip_size != PaintChipSize::Swatch + } + + /// The well and the mark's room in the chip's `rect`: a compact chip's well is centred in its slot, every other + /// fills it. + fn layout(&self, rect: Rect, style: &PaintChipStyle, rtl: bool) -> (Rect, Rect) { + let (slot, mark) = split_mark(rect, self.mark_room(style), rtl); + let well = if self.chip_size == PaintChipSize::Compact { Rect::from_center_size(slot.center(), style.well) } else { slot }; + (well, mark) + } + /// The paint a switch to `kind` sets. fn switched(&self, kind: FillKind, solid: Srgba) -> Paint { match kind { @@ -497,6 +553,13 @@ impl<'a> PaintChip<'a> { } } +/// `rect` split into the well and the mark's room, `room` wide at its end edge. +fn split_mark(rect: Rect, room: f32, rtl: bool) -> (Rect, Rect) { + let at = if rtl { rect.left() + room } else { rect.right() - room }; + let (left, right) = (Rect::from_min_max(rect.min, pos2(at, rect.max.y)), Rect::from_min_max(pos2(at, rect.min.y), rect.max)); + if rtl { (right, left) } else { (left, right) } +} + fn kind_label(words: &PaintWords, kind: FillKind) -> Label { match kind { FillKind::None => words.no_color.clone(), @@ -526,18 +589,37 @@ impl Component for PaintChip<'_> { type Style = PaintChipStyle; type Output = PaintChipOutput; - fn style(cx: &StyleCx<'_>, _: PaintChipStyleKey) -> PaintChipStyle { + fn style(cx: &StyleCx<'_>, key: PaintChipStyleKey) -> PaintChipStyle { let colors = &cx.tokens.color; let metrics = craft_ui::choice::SwatchMetrics::of(cx); + let arrow = cx.tokens.size.icon.glyph_sm; + let (well, slot) = match key.chip_size { + PaintChipSize::Regular => { + let well = vec2(metrics.side * CHIP_WIDTH_IN_HEIGHTS, metrics.side); + (well, well) + } + PaintChipSize::Compact => { + let well = egui::Vec2::splat(cx.tokens.size.icon.md); + (well, vec2(well.x + cx.tokens.space.gap.item, metrics.side)) + } + PaintChipSize::Swatch => { + let well = egui::Vec2::splat(cx.tokens.size.rail.button / SWATCHES_PER_RAIL_BUTTON); + (well, well) + } + }; PaintChipStyle { metrics: Metrics::new(), focus: cx.focus_look(), - height: metrics.side, + well, + slot, radius: metrics.radius, edge: cx.color(colors.line.control_edge), none_fill: cx.color(colors.surface.sunken), none_mark: cx.color(colors.status.bad.solid), swatch: Swatch::style(cx, Swatch::new(Label::default(), Srgba::BLACK).style_key()), + arrow, + arrow_room: arrow + 2.0 * cx.tokens.space.gap.tight, + arrow_color: cx.color(colors.text.muted), } } @@ -546,12 +628,13 @@ impl Component for PaintChip<'_> { } fn measure(&mut self, cx: &craft_ui::contract::MeasureCx<'_, Self>) -> egui::Vec2 { - vec2(cx.style.height * CHIP_WIDTH_IN_HEIGHTS, cx.style.height) + cx.style.slot + vec2(self.mark_room(cx.style), 0.0) } fn parts(&mut self, rect: egui::Rect, cx: &mut PartsCx<'_, Self>) { - let part = cx.part(WELL, rect); - if self.popover { + let (well, _) = self.layout(rect, cx.style, cx.flow.is_rtl()); + let part = cx.part(WELL, well); + if self.opens() { let _ = part.toggles("picker"); } } @@ -567,7 +650,7 @@ impl Component for PaintChip<'_> { cx.memory::().0 = Some(color); } let activation = cx.activation().filter(|_: &Activation| cx.resolved.enabled); - if !self.popover { + if !self.opens() { self.clicked = activation.map(|activation| activation.mods); return; } @@ -583,7 +666,7 @@ impl Component for PaintChip<'_> { } fn overlay(&mut self, ui: &mut OverlayUi<'_>, cx: &mut Cx<'_, Self>) { - if !self.popover { + if !self.opens() { return; } let popup = cx.popup("picker"); @@ -694,17 +777,23 @@ impl Component for PaintChip<'_> { Some(paint) => access.value(value_text(&words, paint)), None => access.value(cx.words::().swatch_mixed.as_str()), }; - if self.popover { + if self.opens() { access.has_popup(PopupKind::Dialog); } } fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { + let (well, mark) = self.layout(cx.rect, cx.style, cx.flow.is_rtl()); + if self.popup_mark == PopupMark::Menu { + let mut arrow = DisclosureGlyph::dropdown_of(cx.env.get()); + arrow.color = Some(cx.style.arrow_color); + ui.draw().icon(Rect::from_center_size(mark.center(), vec2(cx.style.arrow, cx.style.arrow)), &arrow); + } let Some(paint) = cx.value().cloned() else { ui.face(WELL, Swatch::new(cx.resolved.label.to_owned(), Mixed::::Mixed)); return; }; - paint_well(ui, cx, cx.rect, &paint, &cx.style.well_look(self.ring)); + paint_well(ui, cx, well, &paint, &cx.style.well_look(self.ring)); } fn finish(self, cx: Cx<'_, Self>) -> PaintChipOutput { diff --git a/crates/color-ui/src/ui/paint_chip/stories.rs b/crates/color-ui/src/ui/paint_chip/stories.rs index 3d2c3100d..ca6748ed0 100644 --- a/crates/color-ui/src/ui/paint_chip/stories.rs +++ b/crates/color-ui/src/ui/paint_chip/stories.rs @@ -1,12 +1,13 @@ //! Stories of the paint chip and the paint list. -use super::{GradientPreview, ImagePreview, Paint, PaintChip, PaintLink, PaintLinkKind, PaintList, PaintListOptions, PaintRow}; +use super::{GradientPreview, ImagePreview, Paint, PaintChip, PaintChipSize, PaintLink, PaintLinkKind, PaintList, PaintListOptions, PaintRow}; use craft_behavior::Mixed; use craft_theme::Srgba; +use craft_ui::buttons::PopupMark; use craft_ui::contract::Role; use craft_ui::contract::{Bind, Props as _, Show as _, ShowContainer as _, Validity}; use craft_ui::display::{Shade, Text}; -use craft_ui::layout_components::Stack; +use craft_ui::layout_components::{Row, Stack}; use craft_ui::patterns::presets::PresetState; use craft_ui::primitives::FacePaint; use craft_ui::runtime::env::Message; @@ -89,6 +90,55 @@ fn paint_chip_ring(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { first.unwrap_or_default() } +/// Fill and Stroke chips with the menu mark: the dropdown arrow after the well, inside the chip. +#[story(PaintChip<'static>, covers = [], drive = Drive::Never)] +fn paint_chip_menu_mark(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let paints = data.value("paints", [Paint::Solid(BLUE), Paint::Solid(Srgba::rgb(0.1, 0.1, 0.1))]); + let mut first = None; + Stack::new().show(ui, |ui, _| { + for (index, (label, paint)) in ["Fill", "Stroke"].into_iter().zip(paints.iter_mut()).enumerate() { + let shown = PaintChip::new(label, Bind::bound(paint), BLUE).ring(index == 1).popup_mark(PopupMark::Menu).show(ui); + if index == 0 { + first = Some(StoryOutput::from(shown)); + } + } + }); + first.unwrap_or_default() +} + +/// Compact Fill and Stroke chips in a row, as among a task bar's buttons: a small well in a control-high slot. +#[story(PaintChip<'static>, covers = [], drive = Drive::Never)] +fn paint_chip_compact(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let paints = data.value("paints", [Paint::Solid(BLUE), Paint::Solid(Srgba::rgb(0.1, 0.1, 0.1))]); + let mut first = None; + Row::new().show(ui, |ui, _| { + for (index, (label, paint)) in ["Fill", "Stroke"].into_iter().zip(paints.iter_mut()).enumerate() { + let shown = PaintChip::new(label, Bind::bound(paint), BLUE).ring(index == 1).chip_size(PaintChipSize::Compact).popover(false).show(ui); + if index == 0 { + first = Some(StoryOutput::from(shown)); + } + } + }); + first.unwrap_or_default() +} + +/// A tool rail's Color, Gradient and None as swatch chips, three in a row; a click opens nothing. +#[story(PaintChip<'static>, covers = [], drive = Drive::Never)] +fn paint_chip_swatches(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let gradient = GradientPreview::new(vec![(0.0, Srgba::rgb(1.0, 1.0, 1.0)), (1.0, Srgba::rgb(0.0, 0.0, 0.0))]); + let paints = data.value("paints", [Paint::Solid(BLUE), Paint::Gradient(gradient), Paint::None]); + let mut first = None; + Row::new().show(ui, |ui, _| { + for (index, (label, paint)) in ["Color", "Gradient", "None"].into_iter().zip(paints.iter_mut()).enumerate() { + let shown = PaintChip::new(label, Bind::bound(paint), BLUE).chip_size(PaintChipSize::Swatch).show(ui); + if index == 0 { + first = Some(StoryOutput::from(shown)); + } + } + }); + first.unwrap_or_default() +} + /// A gradient whose face is the host's painter: one coloured rect over the checker. #[story(PaintChip<'static>, covers = [], drive = Drive::Never)] fn paint_chip_gradient_face(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { diff --git a/crates/color-ui/tests/it/main.rs b/crates/color-ui/tests/it/main.rs index 1e2a78344..dfe187fd0 100644 --- a/crates/color-ui/tests/it/main.rs +++ b/crates/color-ui/tests/it/main.rs @@ -3,6 +3,7 @@ pub(crate) mod area_gamut; pub(crate) mod color_parts; pub(crate) mod gradient_bar; +pub(crate) mod paint_chip; pub(crate) mod paint_list; pub(crate) mod pair; pub(crate) mod panels; diff --git a/crates/color-ui/tests/it/paint_chip.rs b/crates/color-ui/tests/it/paint_chip.rs new file mode 100644 index 000000000..ace5e8668 --- /dev/null +++ b/crates/color-ui/tests/it/paint_chip.rs @@ -0,0 +1,40 @@ +//! `PaintChip`'s menu mark, the arrow after the well that is part of the chip, and its swatch size. + +use craft_color_ui::ui::{Paint, PaintChip, PaintChipSize}; +use craft_theme::Srgba; +use craft_ui::buttons::PopupMark; +use craft_ui::contract::{Bind, Role, Show as _}; +use craft_ui::testing::{Fixture, trial}; +use std::cell::Cell; +use std::rc::Rc; + +/// A click on the menu mark, past the well, opens the chip's popover, as a click on the well does. +#[trial] +fn a_click_on_the_menu_mark_opens_the_popover() { + let mut fixture = Fixture::new(|ui| { + let mut paint = Paint::Solid(Srgba::rgb(0.2, 0.4, 0.8)); + let _ = PaintChip::new("Fill", Bind::bound(&mut paint), Srgba::BLACK).popup_mark(PopupMark::Menu).show(ui); + }); + fixture.settle(); + let chip = fixture.by_role(Role::COLOR_WELL).first().copied().expect("the chip is a colour well"); + // The mark's room is at the chip's end edge, past the well. + fixture.click_at(egui::pos2(chip.rect.right() - 2.0, chip.rect.center().y)).idle(4); + assert!(!fixture.by_role(Role::RADIO_BUTTON).is_empty(), "the popover's kind switch shows"); +} + +/// A swatch chip opens no popover: a click reports its modifiers for the host's command. +#[trial] +fn a_click_on_a_swatch_chip_opens_nothing_and_reports_the_click() { + let clicked = Rc::new(Cell::new(false)); + let seen = Rc::clone(&clicked); + let mut fixture = Fixture::new(move |ui| { + let mut paint = Paint::None; + let out = PaintChip::new("None", Bind::bound(&mut paint), Srgba::BLACK).chip_size(PaintChipSize::Swatch).show(ui); + seen.set(seen.get() || out.clicked.is_some()); + }); + fixture.settle(); + let chip = fixture.by_role(Role::COLOR_WELL).first().copied().expect("the chip is a colour well"); + fixture.click(&chip).idle(4); + assert!(clicked.get(), "the click is reported"); + assert!(fixture.by_role(Role::RADIO_BUTTON).is_empty(), "no popover opens"); +} diff --git a/crates/draw/src/ui/artboard/properties.rs b/crates/draw/src/ui/artboard/properties.rs index 3951d5e6b..aa3521991 100644 --- a/crates/draw/src/ui/artboard/properties.rs +++ b/crates/draw/src/ui/artboard/properties.rs @@ -87,7 +87,7 @@ impl<'a> ArtboardProperties<'a> { }); // A glyph-labelled number field; the pairs share a row, as W and H in the shape panel. let field = |ui: &mut Ui, glyph: &Label, name: &Label, value: f64, range: &RangeInclusive| { - let side = SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::text(glyph.clone()))).scrub(true); + let side = SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::caption(glyph.clone()))).scrub(true); Field::new(name.clone()) .side(side) .show(ui, |ui, _| { diff --git a/crates/draw/src/ui/shape/panel.rs b/crates/draw/src/ui/shape/panel.rs index c0fadd96e..7dbd80260 100644 --- a/crates/draw/src/ui/shape/panel.rs +++ b/crates/draw/src/ui/shape/panel.rs @@ -527,7 +527,7 @@ impl<'p, 'a> Cells<'p, 'a> { /// The side label of a cell shown by a short glyph (W, H) instead of its caption, which scrubs it. pub(super) fn glyph_side(glyph: &Label) -> SideLabel { - SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::text(glyph.clone()))).scrub(true) + SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::caption(glyph.clone()))).scrub(true) } /// The change a Sides value makes: a whole number of sides in range. diff --git a/crates/draw/src/ui/transform/transform_fields.rs b/crates/draw/src/ui/transform/transform_fields.rs index b792fe940..cfc007bbf 100644 --- a/crates/draw/src/ui/transform/transform_fields.rs +++ b/crates/draw/src/ui/transform/transform_fields.rs @@ -503,7 +503,7 @@ impl Cells<'_> { /// inside the field. fn side_and_name(&self, field: TransformField, form: Form) -> (SideLabel, Label) { let words = &self.words; - let beside = |glyph: &Label| SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::text(glyph.clone()))); + let beside = |glyph: &Label| SideLabel::new().kind(LabelKind::Glyph(GlyphLabel::caption(glyph.clone()))); let (side, name) = match field { TransformField::X => (beside(&words.x_glyph), &words.x_name), TransformField::Y => (beside(&words.y_glyph), &words.y_name), diff --git a/crates/i18n/src/region.rs b/crates/i18n/src/region.rs index f34cac506..9f1559913 100644 --- a/crates/i18n/src/region.rs +++ b/crates/i18n/src/region.rs @@ -389,11 +389,10 @@ fn read_system() -> Region { Region::from_tag(&sys_locale::get_locale().unwrap_or_default()) } -#[cfg(test)] +#[cfg(all(test, unix, not(any(target_vendor = "apple", target_os = "android"))))] mod tests { use super::*; - #[cfg(all(unix, not(any(target_vendor = "apple", target_os = "android"))))] #[test] fn each_locale_category_decides_its_own_part_and_lc_all_all_of_them() { let env = diff --git a/crates/menu/tests/it/bar.rs b/crates/menu/tests/it/bar.rs index 071ae4684..efe960a13 100644 --- a/crates/menu/tests/it/bar.rs +++ b/crates/menu/tests/it/bar.rs @@ -1,5 +1,6 @@ //! The in-window bar's own rules over the model. +use craft_host::target::Os; use craft_menu::{Item, Menu, MenuBar, MenuBarUi, Node}; use craft_ui::contract::Tracked; use craft_ui::testing::{Fixture, trial}; @@ -18,6 +19,8 @@ fn a_disabled_submenu_is_greyed_and_does_not_open() { let mut fixture = Fixture::new(move |ui| { MenuBarUi::new(&bar).show(ui); }); + // The in-window bar's rules; a Mac's menus are in the system bar. + fixture.os(Os::Linux); fixture.settle(); let Some(file) = fixture.by_label("File") else { panic!("the bar shows File") }; fixture.click(&file).settle(); diff --git a/crates/pages/src/ui/view.rs b/crates/pages/src/ui/view.rs index 2fc10109b..0b08850bb 100644 --- a/crates/pages/src/ui/view.rs +++ b/crates/pages/src/ui/view.rs @@ -1544,7 +1544,8 @@ impl KeyMoves { /// Page Up and Down a screen less a key line (a row when not continuous, and with Cmd), Home and End the first /// and last page, Up and Down a key line (not continuous, a turn once the row is at its edge that way), Left and /// Right a key line sideways while the current page or spread has more to show that way, else a turn of a page or - /// spread; Cmd with Left or Right turns at once. Home and End with Shift or Cmd, and Page Up, Page Down, Up and + /// spread; Cmd with Left or Right turns at once. Home and End with Shift, or with Cmd off macOS (which gives Cmd + /// with them no move), and Page Up, Page Down, Up and /// Down with Shift and Cmd together, go to the first or last page; Alt, and Shift alone with the other keys, /// leave them to nothing. fn of( diff --git a/crates/pages/tests/it/views.rs b/crates/pages/tests/it/views.rs index e4e60c79a..e0aa1babf 100644 --- a/crates/pages/tests/it/views.rs +++ b/crates/pages/tests/it/views.rs @@ -1007,12 +1007,11 @@ fn shift_and_command_with_the_page_keys_and_arrows_go_to_the_ends() { ); focus_canvas(&mut fixture); let keys = [(Key::PageDown, both, 4), (Key::PageUp, both, 0), (Key::ArrowDown, both, 4), (Key::ArrowUp, both, 0)]; - let ends = [ - (Key::End, Modifiers::SHIFT, 4), - (Key::Home, Modifiers::SHIFT, 0), - (Key::End, Modifiers::COMMAND, 4), - (Key::Home, Modifiers::COMMAND, 0), - ]; + // Off macOS Ctrl+End and Ctrl+Home go to the ends too; macOS gives Cmd with Home and End no move. + let mut ends = vec![(Key::End, Modifiers::SHIFT, 4), (Key::Home, Modifiers::SHIFT, 0)]; + if !cfg!(target_os = "macos") { + ends.extend([(Key::End, Modifiers::COMMAND, 4), (Key::Home, Modifiers::COMMAND, 0)]); + } for (key, mods, want) in keys.into_iter().chain(ends) { fixture.key(key, mods); fixture.idle(2); diff --git a/crates/platform/src/browser_files.rs b/crates/platform/src/browser_files.rs index a00309b25..3d18b37ca 100644 --- a/crates/platform/src/browser_files.rs +++ b/crates/platform/src/browser_files.rs @@ -38,7 +38,10 @@ pub struct BrowserFiles { /// An embedding page's save ([`BrowserFiles::page_saves`]): given the file name, the bytes and whether the user asked /// for Save As, `None` when no page hosts the app, else the page's answer. -pub type PageSave = Arc Option> + Send + Sync>; +pub type PageSave = Arc; + +/// The callback behind a [`PageSave`]. +pub type PageSaveFn = dyn Fn(&str, &[u8], bool) -> Option> + Send + Sync; /// Tickets of one service, shared with the tasks that answer them. #[derive(Default)] @@ -178,7 +181,7 @@ fn write_name(path: &Path) -> String { /// A write's route: the embedding page when `page` answers (`Ok(true)`), else `download` (`Ok(false)`). pub(crate) fn page_or_download( - page: Option<&(dyn Fn(&str, &[u8], bool) -> Option> + Send + Sync)>, + page: Option<&PageSaveFn>, name: &str, bytes: &[u8], save_as: bool, diff --git a/crates/platform/src/owner_only.rs b/crates/platform/src/owner_only.rs index 506907e03..e664dcffe 100644 --- a/crates/platform/src/owner_only.rs +++ b/crates/platform/src/owner_only.rs @@ -2,23 +2,23 @@ //! //! On Windows a file created in a folder inherits the folder's access list, and folders such as //! a new folder at a drive root, `C:\Users\Public` or `C:\ProgramData` let every signed-in user -//! read what is created in them. [`restrict_to_owner`] replaces the whole list with the current -//! user and SYSTEM only, makes that user the owner, and checks the result. [`create_private_dir`] +//! read what is created in them. `restrict_to_owner` replaces the whole list with the current +//! user and SYSTEM only, makes that user the owner, and checks the result. `create_private_dir` //! does the same for a new folder whose list the files created in it inherit, so a file can be -//! private from the moment it exists. [`read_with_sddl`] reads a file and its security descriptor +//! private from the moment it exists. `read_with_sddl` reads a file and its security descriptor //! through one handle. [`foreign_access`] reads the descriptor in SDDL form, which names accounts //! by SID and so reads the same in every Windows language, and says why another user could have //! written or could read the file. They run the tools Windows ships rather than calling the //! security API directly, which would need `unsafe`. /// Why the file whose security descriptor is `sddl` (`O:` owner and `D:` access list, in SDDL or -/// as [`read_with_sddl`] writes it) can't be trusted as user `me`'s own: it is owned by someone else, it has no +/// as `read_with_sddl` writes it) can't be trusted as user `me`'s own: it is owned by someone else, it has no /// access list (everyone may use it), or it lets an account other than `me` or SYSTEM use it. /// Accounts are compared by SID; `None` means it is `me`'s alone. /// /// Stricter than OpenSSH's rule for private keys, which also lets Administrators in: an entry for /// the Administrators group would let another administrator read the token without taking the -/// file over. [`restrict_to_owner`] never grants it, so the app's own file always passes; a file +/// file over. `restrict_to_owner` never grants it, so the app's own file always passes; a file /// that inherited it from a user's folder is refused. pub fn foreign_access(sddl: &str, me: &str) -> Option { let me = me.trim(); diff --git a/crates/text/src/ui/character/format_text.rs b/crates/text/src/ui/character/format_text.rs index 5f697ac1a..5a5de1ef6 100644 --- a/crates/text/src/ui/character/format_text.rs +++ b/crates/text/src/ui/character/format_text.rs @@ -138,8 +138,8 @@ const LINE_PRESETS: [LineSpacing; 5] = /// superscript, subscript; line and paragraph spacing; scale and character spacing). A control in `unsupported` is /// disabled with its reason. It keeps no state between passes: each pass reports only the edits of its own input. /// -/// - Font: the family field the Character controls show: craft-font-manager's `FontPicker` over -/// [`font_picker`](Self::font_picker) (with the host's rows), else a `Select` of `families`. A family pick is +/// - Font: the family field the Character controls show: craft-font-manager's `FontPicker` with +/// `font-picker` and `font_picker` (with the host's rows), else a `Select` of `families`. A family pick is /// `Character(Family(..))`, a style row pick `Character(Family(..))` then `Character(Style(..))`, and a host row /// pick `HostFont(key)`. /// - Size, paragraph spacing and character spacing are lengths in points; horizontal scale is a percentage. A scrub diff --git a/crates/text/src/ui/editor.rs b/crates/text/src/ui/editor.rs index 29a7d6b94..93a9a5ee6 100644 --- a/crates/text/src/ui/editor.rs +++ b/crates/text/src/ui/editor.rs @@ -376,6 +376,11 @@ impl EditorMode { } } +/// `text` on one line: each line ending (`\r\n`, `\r` or `\n`) becomes one space. +fn one_line(text: &str) -> String { + text.replace("\r\n", " ").replace(['\r', '\n'], " ") +} + /// What the editor did this pass. #[derive(Debug)] #[non_exhaustive] @@ -572,6 +577,80 @@ fn show_i_beam(cx: &mut Cx<'_, TextEditor<'_>>, phase: &PressPhase, vertical: bo } } +/// Applies one pass's editor steps to `edits` in order: typing, the marked text, moves, deletes, selections, the edit +/// commands and the commands keys fired. Returns the text a Copy or Cut put on the clipboard, and whether a command +/// asked for the character panel. +fn apply_steps( + edits: &mut Edits<'_>, + steps: Vec>, + mode: EditorMode, + masked: bool, + pasted: Option<&str>, + fallback: Rect, +) -> (Option, bool) { + let mut copied: Option = None; + let mut ending: Option> = None; + let mut character_panel = false; + for step in steps { + // A commit or cancel ends the session; an input method's committed text still lands. + if (edits.done.commit || edits.done.cancel) && ending.is_none() { + break; + } + let input = match step { + EditorStep::Input(input) => input, + EditorStep::Command(command, _) => { + edits.command(command, &mut character_panel); + continue; + } + _ => continue, + }; + if let Some(range) = ending.take() { + if let EditorInput::Text(text) = &input { + edits.commit_marked(range, text); + continue; + } + edits.drop_marked(range); + } + match input { + EditorInput::Preedit { text, cursor, .. } => { + let active = cursor.map(|bytes| byte_range_to_chars(&text, bytes)); + ending = edits.preedit(&text, active); + } + EditorInput::ImeCommit => ending = edits.session.preedit.take(), + EditorInput::Text(text) => edits.done.changed |= edits.insert_typed(&text), + EditorInput::Newline { .. } if edits.session.preedit.is_none() && mode.multiline() => { + edits.done.changed |= edits.insert_text("\n", EditKind::Typed); + } + EditorInput::Tab if mode.takes_tab() => edits.done.changed |= edits.insert_text("\t", EditKind::Typed), + EditorInput::Move(step, mods) => edits.motion(step, mods), + EditorInput::Delete { forward, by, .. } => edits.done.changed |= edits.delete(forward, by), + EditorInput::DeleteSurrounding { before, after, unit, .. } => edits.done.changed |= edits.delete_around(before, after, unit), + EditorInput::Select { anchor, focus, .. } => { + let lines = lines_of(&mut *edits.host, fallback); + edits.end_composition(); + edits.selection = TextSelection { anchor: char_at(&lines, anchor), caret: char_at(&lines, focus) }; + } + EditorInput::Edit(EditCommand::SelectAll) => edits.select_all(), + EditorInput::Edit(EditCommand::Copy) if !masked => copied = edits.selected_text(), + EditorInput::Edit(EditCommand::Cut) if !masked => { + copied = edits.selected_text(); + edits.done.changed |= edits.delete_selection(); + } + EditorInput::Edit(EditCommand::Paste) => { + if let Some(text) = pasted { + let text = if mode.multiline() { text.to_string() } else { one_line(text) }; + edits.done.changed |= edits.insert_text(&text, EditKind::Pasted); + } + } + _ => {} + } + } + if let Some(range) = ending { + edits.drop_marked(range); + } + (copied, character_panel) +} + /// The clipboard's text when the pass's input asks to paste and the clipboard has it ready. fn pasted_text(cx: &mut Cx<'_, TextEditor<'_>>, steps: &[EditorStep]) -> Option> { if !steps.iter().any(|step| matches!(step, EditorStep::Input(EditorInput::Edit(EditCommand::Paste)))) { @@ -636,7 +715,6 @@ impl Component for TextEditor<'_> { let now = cx.now(); let pasted = pasted_text(cx, &steps); let (mode, masked) = (self.mode, self.masked); - let mut copied: Option = None; let mut session = std::mem::take(cx.memory::()); let mut edits = Edits { host: &mut *self.host, @@ -652,64 +730,7 @@ impl Component for TextEditor<'_> { edits.reconcile(); let fallback = space.doc_rect(cx.rect); - let mut ending: Option> = None; - let mut character_panel = false; - for step in steps { - // A commit or cancel ends the session; an input method's committed text still lands. - if (edits.done.commit || edits.done.cancel) && ending.is_none() { - break; - } - let input = match step { - EditorStep::Input(input) => input, - EditorStep::Command(command, _) => { - edits.command(command, &mut character_panel); - continue; - } - _ => continue, - }; - if let Some(range) = ending.take() { - if let EditorInput::Text(text) = &input { - edits.commit_marked(range, text); - continue; - } - edits.drop_marked(range); - } - match input { - EditorInput::Preedit { text, cursor, .. } => { - let active = cursor.map(|bytes| byte_range_to_chars(&text, bytes)); - ending = edits.preedit(&text, active); - } - EditorInput::ImeCommit => ending = edits.session.preedit.take(), - EditorInput::Text(text) => edits.done.changed |= edits.insert_typed(&text), - EditorInput::Newline { .. } if edits.session.preedit.is_none() && mode.multiline() => { - edits.done.changed |= edits.insert_text("\n", EditKind::Typed); - } - EditorInput::Tab if mode.takes_tab() => edits.done.changed |= edits.insert_text("\t", EditKind::Typed), - EditorInput::Move(step, mods) => edits.motion(step, mods), - EditorInput::Delete { forward, by, .. } => edits.done.changed |= edits.delete(forward, by), - EditorInput::DeleteSurrounding { before, after, unit, .. } => edits.done.changed |= edits.delete_around(before, after, unit), - EditorInput::Select { anchor, focus, .. } => { - let lines = lines_of(&mut *edits.host, fallback); - edits.end_composition(); - edits.selection = TextSelection { anchor: char_at(&lines, anchor), caret: char_at(&lines, focus) }; - } - EditorInput::Edit(EditCommand::SelectAll) => edits.select_all(), - EditorInput::Edit(EditCommand::Copy) if !masked => copied = edits.selected_text(), - EditorInput::Edit(EditCommand::Cut) if !masked => { - copied = edits.selected_text(); - edits.done.changed |= edits.delete_selection(); - } - EditorInput::Edit(EditCommand::Paste) => { - if let Some(text) = &pasted { - edits.done.changed |= edits.insert_text(text, EditKind::Pasted); - } - } - _ => {} - } - } - if let Some(range) = ending { - edits.drop_marked(range); - } + let (copied, character_panel) = apply_steps(&mut edits, steps, mode, masked, pasted.as_deref(), fallback); // A press is the pass's last pointer event (H0), so the pass's editor input came before it. match press.phase { PressPhase::Down { start, .. } if start.button == craft_behavior::PointerButton::Primary => { diff --git a/crates/theme/sizes/comfortable.json b/crates/theme/sizes/comfortable.json index b8a9da4ec..c9a0e265f 100644 --- a/crates/theme/sizes/comfortable.json +++ b/crates/theme/sizes/comfortable.json @@ -19,6 +19,7 @@ "options_narrow": 36.0, "status": 30.0, "tab": 30.0, + "tab_large": 38.0, "title": 38.0 }, "checker": 4.0, diff --git a/crates/theme/sizes/compact.json b/crates/theme/sizes/compact.json index 327efd8fb..1911106a6 100644 --- a/crates/theme/sizes/compact.json +++ b/crates/theme/sizes/compact.json @@ -19,6 +19,7 @@ "options_narrow": 28.0, "status": 24.0, "tab": 26.0, + "tab_large": 32.0, "title": 32.0 }, "checker": 4.0, diff --git a/crates/theme/src/dump.rs b/crates/theme/src/dump.rs index c57e37138..6f2dd8116 100644 --- a/crates/theme/src/dump.rs +++ b/crates/theme/src/dump.rs @@ -153,8 +153,10 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) { let RailSizes { width, button } = rail; out.line("size.rail.width", len(*width)); out.line("size.rail.button", len(*button)); - let BarSizes { title, tab, status, options, options_narrow } = bar; - for (k, v) in [("title", title), ("tab", tab), ("status", status), ("options", options), ("options_narrow", options_narrow)] { + let BarSizes { title, tab, tab_large, status, options, options_narrow } = bar; + for (k, v) in + [("title", title), ("tab", tab), ("tab_large", tab_large), ("status", status), ("options", options), ("options_narrow", options_narrow)] + { out.line(&format!("size.bar.{k}"), len(*v)); } out.line("size.panel_header", len(*panel_header)); diff --git a/crates/theme/src/sizes.rs b/crates/theme/src/sizes.rs index 3b688f220..6101f7a76 100644 --- a/crates/theme/src/sizes.rs +++ b/crates/theme/src/sizes.rs @@ -102,6 +102,7 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec> { "base.size.rail.button" Num 16.0..=64.0 => s.rail.button; "base.size.bar.title" Num 16.0..=80.0 => s.bar.title; "base.size.bar.tab" Num 16.0..=64.0 => s.bar.tab; + "base.size.bar.tab_large" Num 16.0..=80.0 => s.bar.tab_large; "base.size.bar.status" Num 16.0..=64.0 => s.bar.status; "base.size.bar.options" Num 16.0..=80.0 => s.bar.options; "base.size.bar.options_narrow" Num 16.0..=80.0 => s.bar.options_narrow; diff --git a/crates/theme/src/tokens/color.rs b/crates/theme/src/tokens/color.rs index 276475311..35e7a7916 100644 --- a/crates/theme/src/tokens/color.rs +++ b/crates/theme/src/tokens/color.rs @@ -64,6 +64,9 @@ pub struct SurfaceColors { pub raised: Rgba, /// Fields and wells. pub sunken: Rgba, + /// The resting fill of a filled control (`Emphasis::Filled`): a neutral tile with no edge. Follows + /// `state.hover` unless pinned. + pub control: Rgba, /// The face of a knob that rides on a track: slider and switch thumbs. Light in both modes. pub knob: Rgba, /// Translucent cover behind modal surfaces. @@ -112,6 +115,8 @@ pub struct LineColors { pub border: Rgba, /// The boundary of a control that must be seen to be used (fields, checkboxes). pub control_edge: Rgba, + /// The edge of an outlined neutral control (an outline or soft button); follows `text.muted` unless pinned. + pub outline: Rgba, /// The outline of a `surface.knob` face; clear where the face stands out on its own (dark /// mode). pub knob_edge: Rgba, @@ -321,13 +326,14 @@ impl ColorTokens { chrome: c, raised: c, sunken: c, + control: c, knob: c, scrim: c, inverse: c, shadow: c, }, text: TextColors { normal: c, muted: c, faint: c, disabled: c, on_accent: c, on_strong: c, on_status: c, on_selected: c, on_inverse: c }, - line: LineColors { divider: c, border: c, control_edge: c, knob_edge: c, frame: c, mark: c, grip: c, focus: c }, + line: LineColors { divider: c, border: c, control_edge: c, outline: c, knob_edge: c, frame: c, mark: c, grip: c, focus: c }, accent: AccentColors { solid: c, hover: c, @@ -438,6 +444,8 @@ color_tokens! { SurfaceRaised = "surface.raised" => surface.raised; /// `surface.sunken` SurfaceSunken = "surface.sunken" => surface.sunken; + /// `surface.control` + SurfaceControl = "surface.control" => surface.control; /// `surface.knob` SurfaceKnob = "surface.knob" => surface.knob; /// `surface.scrim` @@ -470,6 +478,8 @@ color_tokens! { LineBorder = "line.border" => line.border; /// `line.control_edge` LineControlEdge = "line.control_edge" => line.control_edge; + /// `line.outline` + LineOutline = "line.outline" => line.outline; /// `line.knob_edge` LineKnobEdge = "line.knob_edge" => line.knob_edge; /// `line.frame` diff --git a/crates/theme/src/tokens/size.rs b/crates/theme/src/tokens/size.rs index 070402c7f..ce32a174a 100644 --- a/crates/theme/src/tokens/size.rs +++ b/crates/theme/src/tokens/size.rs @@ -225,6 +225,8 @@ pub struct BarSizes { pub title: f32, /// Tab strip. pub tab: f32, + /// Tab strip in its large form: large document tabs. + pub tab_large: f32, /// Status bar. pub status: f32, /// Tool options bar. diff --git a/crates/theme/src/values.rs b/crates/theme/src/values.rs index e6feee4ff..f99b78b45 100644 --- a/crates/theme/src/values.rs +++ b/crates/theme/src/values.rs @@ -201,6 +201,8 @@ pub(super) fn source(token: ColorToken, mode: Mode) -> ColorSource { T::SurfaceChrome => Same(T::SurfacePanel), T::SurfaceRaised => Anchored(pick(4, 1)), T::SurfaceSunken => Anchored(1), + // A filled tile rests on the theme's own hover fill, so the pointer adds only its edge. + T::SurfaceControl => Same(T::StateHover), // Near white in both modes (dark: about 236/255), as macOS, GNOME and PhotoCraft knobs. A // knob face is not a background grey, so it stays on the curve. T::SurfaceKnob => Neutral(pick(12, 1)), @@ -223,6 +225,7 @@ pub(super) fn source(token: ColorToken, mode: Mode) -> ColorSource { T::LineDivider => Anchored(6), T::LineBorder => Anchored(7), T::LineControlEdge => Anchored(8), + T::LineOutline => Same(T::TextMuted), // A light knob needs an outline on a light panel (PhotoCraft's `text_dim`); on a dark one // its face is the edge. The Pro themes pin PhotoCraft's dark ring. T::LineKnobEdge => { @@ -385,6 +388,7 @@ const TEXT_BGS: &[Bg] = &[ Token(T::SurfaceChrome), Token(T::SurfaceRaised), Token(T::SurfaceSunken), + Token(T::SurfaceControl), Token(T::StateHover), Token(T::StatePressed), ]; diff --git a/crates/theme/src/variant.rs b/crates/theme/src/variant.rs index fb9d58b0d..02046db83 100644 --- a/crates/theme/src/variant.rs +++ b/crates/theme/src/variant.rs @@ -19,6 +19,8 @@ pub enum Emphasis { Outline, /// No fill or edge until a state fills it. Ghost, + /// A neutral tile (`surface.control`) with no edge at rest; the pointer and the press fill it by state and edge it. + Filled, } /// What a variant says about its subject. The one tone type of the component layer: messages, notices, badges and @@ -142,7 +144,7 @@ impl ToneTokens { soft_fill: T::SurfaceSunken, on_soft: T::TextNormal, fg: T::TextNormal, - edge: T::TextMuted, + edge: T::LineOutline, solid: T::TextMuted, solid_hover: T::TextMuted, solid_pressed: T::TextNormal, @@ -237,6 +239,16 @@ impl VariantLook { VariantLook::new(state_fill, text(fg)).muted(muted).edge(States::new(edge, lit, lit, c.line.divider)).radius(button) } Emphasis::Ghost => VariantLook::new(state_fill, text(fg)).muted(muted).radius(button).edge(flat(clear)), + // A neutral tile takes the control edge under the pointer and the accent's under the press; a toned one keeps + // its edge. Disabled, it dims as a solid one does. + Emphasis::Filled => { + let (lit, pressed) = if tone == Tone::Neutral { (c.line.control_edge, c.accent.border) } else { (edge, edge) }; + let dimmed = crate::derive::mix(c.surface.control, c.state.disabled_fill, DISABLED_SOLID_DIM); + VariantLook::new(States::new(c.surface.control, c.state.hover, c.state.pressed, dimmed), text(fg)) + .muted(muted) + .edge(States::new(clear, lit, pressed, clear)) + .radius(button) + } } } } diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt index 5d1a23d50..28bb4e540 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #404044ff surface.sunken = #404044ff +surface.control = #48484cff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #18181bff line.border = #404044ff line.control_edge = #4c4c50ff +line.outline = #fafafcff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #cacbcfff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt index fe791bffa..049f56f19 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #404044ff surface.sunken = #404044ff +surface.control = #48484cff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #18181bff line.border = #404044ff line.control_edge = #4c4c50ff +line.outline = #fafafcff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #cacbcfff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt index af3f43df8..46ae206f3 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #39393eff surface.sunken = #404044ff +surface.control = #48484cff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #18181bff line.border = #404044ff line.control_edge = #4c4c50ff +line.outline = #c0c0c2ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a5a6aaff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.83 < 4.50 warning = text.faint on surface.chrome: 4.30 < 4.50 warning = text.faint on surface.raised: 3.65 < 4.50 warning = text.faint on surface.sunken: 3.28 < 4.50 +warning = text.faint on surface.control: 2.90 < 4.50 warning = text.faint on state.hover: 2.90 < 4.50 warning = text.faint on state.pressed: 2.32 < 4.50 warning = text.on_accent on accent.solid: 3.77 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt index 6488a6712..cf3838c0d 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #39393eff surface.sunken = #404044ff +surface.control = #48484cff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #18181bff line.border = #404044ff line.control_edge = #4c4c50ff +line.outline = #c0c0c2ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a5a6aaff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.83 < 4.50 warning = text.faint on surface.chrome: 4.30 < 4.50 warning = text.faint on surface.raised: 3.65 < 4.50 warning = text.faint on surface.sunken: 3.28 < 4.50 +warning = text.faint on surface.control: 2.90 < 4.50 warning = text.faint on state.hover: 2.90 < 4.50 warning = text.faint on state.pressed: 2.32 < 4.50 warning = text.on_accent on accent.solid: 3.77 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt index 2b6cd2593..1bfc92439 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ebebedff +surface.control = #e2e2e5ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #dedee1ff line.border = #dadaddff line.control_edge = #dadaddff +line.outline = #403f43ff line.knob_edge = #403f43ff line.frame = #dadaddff line.mark = #5c5c60ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt index e5a195684..829789b5b 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ebebedff +surface.control = #e2e2e5ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #dedee1ff line.border = #dadaddff line.control_edge = #dadaddff +line.outline = #403f43ff line.knob_edge = #403f43ff line.frame = #dadaddff line.mark = #5c5c60ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt index 5070d3350..8becd841b 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ebebedff +surface.control = #e2e2e5ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #dedee1ff line.border = #dadaddff line.control_edge = #dadaddff +line.outline = #646468ff line.knob_edge = #646468ff line.frame = #dadaddff line.mark = #78777cff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 2.77 < 4.50 warning = text.faint on surface.chrome: 2.77 < 4.50 warning = text.faint on surface.raised: 2.77 < 4.50 warning = text.faint on surface.sunken: 2.32 < 4.50 +warning = text.faint on surface.control: 2.14 < 4.50 warning = text.faint on state.hover: 2.14 < 4.50 warning = text.faint on state.pressed: 1.87 < 4.50 warning = text.on_accent on accent.solid: 3.77 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt index 842e67f43..3be11340e 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ebebedff +surface.control = #e2e2e5ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #dedee1ff line.border = #dadaddff line.control_edge = #dadaddff +line.outline = #646468ff line.knob_edge = #646468ff line.frame = #dadaddff line.mark = #78777cff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 2.77 < 4.50 warning = text.faint on surface.chrome: 2.77 < 4.50 warning = text.faint on surface.raised: 2.77 < 4.50 warning = text.faint on surface.sunken: 2.32 < 4.50 +warning = text.faint on surface.control: 2.14 < 4.50 warning = text.faint on state.hover: 2.14 < 4.50 warning = text.faint on state.pressed: 1.87 < 4.50 warning = text.on_accent on accent.solid: 3.77 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt index f0eecfcea..032d4a323 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #595959ff surface.sunken = #454545ff +surface.control = #595959ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #3e3e3eff line.border = #424242ff line.control_edge = #686868ff +line.outline = #ffffffff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #f4f4f4ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt index 2d3c6d01c..d13f08ba9 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #595959ff surface.sunken = #454545ff +surface.control = #595959ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #3e3e3eff line.border = #424242ff line.control_edge = #686868ff +line.outline = #ffffffff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #f4f4f4ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt index ce055072c..a9ad075e4 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #5c5c5cff surface.sunken = #454545ff +surface.control = #626262ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #3e3e3eff line.border = #424242ff line.control_edge = #686868ff +line.outline = #d4d4d4ff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #cacacaff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -254,6 +257,7 @@ warning = accent.solid on surface.panel: 2.30 < 3.00 warning = accent.solid on surface.raised: 2.00 < 3.00 warning = accent.solid on surface.sunken: 2.87 < 3.00 warning = text.normal on state.pressed: 4.27 < 4.50 +warning = text.muted on surface.control: 4.12 < 4.50 warning = text.muted on state.hover: 4.12 < 4.50 warning = text.muted on state.pressed: 3.34 < 4.50 warning = text.faint on surface.background: 3.84 < 4.50 @@ -261,6 +265,7 @@ warning = text.faint on surface.panel: 2.94 < 4.50 warning = text.faint on surface.chrome: 2.94 < 4.50 warning = text.faint on surface.raised: 2.56 < 4.50 warning = text.faint on surface.sunken: 3.67 < 4.50 +warning = text.faint on surface.control: 2.33 < 4.50 warning = text.faint on state.hover: 2.33 < 4.50 warning = text.faint on state.pressed: 1.89 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt index a2b9e32bf..c3197b3d9 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #5c5c5cff surface.sunken = #454545ff +surface.control = #626262ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #3e3e3eff line.border = #424242ff line.control_edge = #686868ff +line.outline = #d4d4d4ff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #cacacaff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -254,6 +257,7 @@ warning = accent.solid on surface.panel: 2.30 < 3.00 warning = accent.solid on surface.raised: 2.00 < 3.00 warning = accent.solid on surface.sunken: 2.87 < 3.00 warning = text.normal on state.pressed: 4.27 < 4.50 +warning = text.muted on surface.control: 4.12 < 4.50 warning = text.muted on state.hover: 4.12 < 4.50 warning = text.muted on state.pressed: 3.34 < 4.50 warning = text.faint on surface.background: 3.84 < 4.50 @@ -261,6 +265,7 @@ warning = text.faint on surface.panel: 2.94 < 4.50 warning = text.faint on surface.chrome: 2.94 < 4.50 warning = text.faint on surface.raised: 2.56 < 4.50 warning = text.faint on surface.sunken: 3.67 < 4.50 +warning = text.faint on surface.control: 2.33 < 4.50 warning = text.faint on state.hover: 2.33 < 4.50 warning = text.faint on state.pressed: 1.89 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt index ac1b8d28e..b18e615c9 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #3c3c3cff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #585858ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt index 134734f33..7c1bdafc6 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #3c3c3cff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #585858ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt index aa7569104..c04d76f9d 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #404040ff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #737373ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.87 < 4.50 warning = text.faint on surface.chrome: 3.87 < 4.50 warning = text.faint on surface.raised: 4.09 < 4.50 warning = text.faint on surface.sunken: 4.42 < 4.50 +warning = text.faint on surface.control: 3.41 < 4.50 warning = text.faint on state.hover: 3.41 < 4.50 warning = text.faint on state.pressed: 2.81 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt index c03751afd..f7448bea3 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #404040ff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #737373ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.87 < 4.50 warning = text.faint on surface.chrome: 3.87 < 4.50 warning = text.faint on surface.raised: 4.09 < 4.50 warning = text.faint on surface.sunken: 4.42 < 4.50 +warning = text.faint on surface.control: 3.41 < 4.50 warning = text.faint on state.hover: 3.41 < 4.50 warning = text.faint on state.pressed: 2.81 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt index 60712a358..6f2fb5849 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff surface.sunken = #262a30ff +surface.control = #32363bff surface.knob = #e9ebeeff surface.scrim = #00000080 surface.inverse = #e9ebeeff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #2e3236ff line.border = #34383dff line.control_edge = #44494fff +line.outline = #ccd3daff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a5a9b0ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt index b4021b657..f7033fe8f 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff surface.sunken = #262a30ff +surface.control = #32363bff surface.knob = #e9ebeeff surface.scrim = #00000080 surface.inverse = #e9ebeeff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #2e3236ff line.border = #34383dff line.control_edge = #44494fff +line.outline = #ccd3daff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a5a9b0ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt index 24760ee19..8dfdb6673 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff surface.sunken = #262a30ff +surface.control = #32363bff surface.knob = #e9ebeeff surface.scrim = #00000080 surface.inverse = #e9ebeeff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #2e3236ff line.border = #34383dff line.control_edge = #44494fff +line.outline = #c8ced5ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #84898fff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt index 764eb548a..4959b6cc6 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff surface.sunken = #262a30ff +surface.control = #32363bff surface.knob = #e9ebeeff surface.scrim = #00000080 surface.inverse = #e9ebeeff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #2e3236ff line.border = #34383dff line.control_edge = #44494fff +line.outline = #c8ced5ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #84898fff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt index ba6752c50..a7a3b4adf 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff surface.sunken = #f9fafcff +surface.control = #e2e6ebff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #252729ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d6dadeff line.border = #cbd0d5ff line.control_edge = #b8bfc6ff +line.outline = #363f48ff line.knob_edge = #363f48ff line.frame = #b8bfc6ff line.mark = #595d63ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt b/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt index f75fbb1fb..ca17d13ec 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff surface.sunken = #f9fafcff +surface.control = #e2e6ebff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #252729ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d6dadeff line.border = #cbd0d5ff line.control_edge = #b8bfc6ff +line.outline = #363f48ff line.knob_edge = #363f48ff line.frame = #b8bfc6ff line.mark = #595d63ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt index 29ab888a8..cddf7cf0d 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff surface.sunken = #f9fafcff +surface.control = #e2e6ebff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #252729ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d6dadeff line.border = #cbd0d5ff line.control_edge = #b8bfc6ff +line.outline = #363f48ff line.knob_edge = #363f48ff line.frame = #b8bfc6ff line.mark = #74797eff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt index b833a27ef..134343b10 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff surface.sunken = #f9fafcff +surface.control = #e2e6ebff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #252729ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d6dadeff line.border = #cbd0d5ff line.control_edge = #b8bfc6ff +line.outline = #363f48ff line.knob_edge = #363f48ff line.frame = #b8bfc6ff line.mark = #74797eff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt index 4ce8a9c7d..4989b3eaf 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff surface.sunken = #ffffffff +surface.control = #e2ded6ff surface.knob = #d4d0c8ff surface.scrim = #00000059 surface.inverse = #282624ff @@ -22,6 +23,7 @@ text.on_inverse = #fdfcfcff line.divider = #808080ff line.border = #808080ff line.control_edge = #808080ff +line.outline = #2e2e2eff line.knob_edge = #2e2e2eff line.frame = #808080ff line.mark = #4e4a44ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt b/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt index 60d43c258..68563809d 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff surface.sunken = #ffffffff +surface.control = #e2ded6ff surface.knob = #d4d0c8ff surface.scrim = #00000059 surface.inverse = #282624ff @@ -22,6 +23,7 @@ text.on_inverse = #fdfcfcff line.divider = #808080ff line.border = #808080ff line.control_edge = #808080ff +line.outline = #2e2e2eff line.knob_edge = #2e2e2eff line.frame = #808080ff line.mark = #4e4a44ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt index 340a328e5..b52c28cad 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff surface.sunken = #ffffffff +surface.control = #e2ded6ff surface.knob = #d4d0c8ff surface.scrim = #00000059 surface.inverse = #282624ff @@ -22,6 +23,7 @@ text.on_inverse = #fdfcfcff line.divider = #808080ff line.border = #808080ff line.control_edge = #808080ff +line.outline = #404040ff line.knob_edge = #404040ff line.frame = #808080ff line.mark = #68655eff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -255,5 +258,6 @@ warning = text.faint on surface.panel: 2.57 < 4.50 warning = text.faint on surface.chrome: 2.57 < 4.50 warning = text.faint on surface.raised: 2.57 < 4.50 warning = text.faint on surface.sunken: 3.95 < 4.50 +warning = text.faint on surface.control: 2.94 < 4.50 warning = text.faint on state.hover: 2.94 < 4.50 warning = text.faint on state.pressed: 2.04 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt index 79c77b1d7..e9b370a38 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff surface.sunken = #ffffffff +surface.control = #e2ded6ff surface.knob = #d4d0c8ff surface.scrim = #00000059 surface.inverse = #282624ff @@ -22,6 +23,7 @@ text.on_inverse = #fdfcfcff line.divider = #808080ff line.border = #808080ff line.control_edge = #808080ff +line.outline = #404040ff line.knob_edge = #404040ff line.frame = #808080ff line.mark = #68655eff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -255,5 +258,6 @@ warning = text.faint on surface.panel: 2.57 < 4.50 warning = text.faint on surface.chrome: 2.57 < 4.50 warning = text.faint on surface.raised: 2.57 < 4.50 warning = text.faint on surface.sunken: 3.95 < 4.50 +warning = text.faint on surface.control: 2.94 < 4.50 warning = text.faint on state.hover: 2.94 < 4.50 warning = text.faint on state.pressed: 2.04 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt index b9d505a78..b94b40adb 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff surface.sunken = #131317ff +surface.control = #303034ff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #47474cff line.border = #3c3c43ff line.control_edge = #77777cff +line.outline = #cacbd3ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a3a3a7ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt index e1cad0d55..16a7e2e94 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff surface.sunken = #131317ff +surface.control = #303034ff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #47474cff line.border = #3c3c43ff line.control_edge = #77777cff +line.outline = #cacbd3ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a3a3a7ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt index 903c5ba99..5223539c4 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff surface.sunken = #131317ff +surface.control = #303034ff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #47474cff line.border = #3c3c43ff line.control_edge = #77777cff +line.outline = #aeaeb6ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #838388ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt index b138c9204..bf757ef21 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff surface.sunken = #131317ff +surface.control = #303034ff surface.knob = #ebebedff surface.scrim = #00000080 surface.inverse = #ebebedff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #47474cff line.border = #3c3c43ff line.control_edge = #77777cff +line.outline = #aeaeb6ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #838388ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt index 78c9803a9..feea7e8c0 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ffffffff +surface.control = #f7f7f7ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d9d9d9ff line.border = #dadadeff line.control_edge = #b2b2b2ff +line.outline = #4f4f56ff line.knob_edge = #4f4f56ff line.frame = #b2b2b2ff line.mark = #6c6c71ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt b/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt index f83ed8295..ac715e105 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ffffffff +surface.control = #f7f7f7ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d9d9d9ff line.border = #dadadeff line.control_edge = #b2b2b2ff +line.outline = #4f4f56ff line.knob_edge = #4f4f56ff line.frame = #b2b2b2ff line.mark = #6c6c71ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt index d1bfd929b..109721a5c 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ffffffff +surface.control = #f7f7f7ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d9d9d9ff line.border = #dadadeff line.control_edge = #b2b2b2ff +line.outline = #5e5e66ff line.knob_edge = #5e5e66ff line.frame = #b2b2b2ff line.mark = #89898eff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt index 71b3f318d..546ddb2ce 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff surface.sunken = #ffffffff +surface.control = #f7f7f7ff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #262628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d9d9d9ff line.border = #dadadeff line.control_edge = #b2b2b2ff +line.outline = #5e5e66ff line.knob_edge = #5e5e66ff line.frame = #b2b2b2ff line.mark = #89898eff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt index 5be55aa62..e6d3fca3b 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff surface.sunken = #242424ff +surface.control = #424242ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #1e1e1eff line.border = #1e1e1eff line.control_edge = #4a4a4aff +line.outline = #ecececff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #bfbfbfff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt index de51e0f92..20995a4ed 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff surface.sunken = #242424ff +surface.control = #424242ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #1e1e1eff line.border = #1e1e1eff line.control_edge = #4a4a4aff +line.outline = #ecececff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #bfbfbfff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt index c2eaff5bf..41ef2b8fb 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt @@ -6,6 +6,7 @@ surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff surface.sunken = #242424ff +surface.control = #424242ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #1e1e1eff line.border = #1e1e1eff line.control_edge = #4a4a4aff +line.outline = #b2b2b2ff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #9c9c9cff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.25 < 4.50 warning = text.faint on surface.chrome: 3.25 < 4.50 warning = text.faint on surface.raised: 2.79 < 4.50 warning = text.faint on surface.sunken: 3.93 < 4.50 +warning = text.faint on surface.control: 2.54 < 4.50 warning = text.faint on state.hover: 2.54 < 4.50 warning = text.faint on state.pressed: 2.11 < 4.50 warning = status.bad.fg on surface.panel: 3.81 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt index 81b473467..1cfb24ce1 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff surface.sunken = #242424ff +surface.control = #424242ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #1e1e1eff line.border = #1e1e1eff line.control_edge = #4a4a4aff +line.outline = #b2b2b2ff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #9c9c9cff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.25 < 4.50 warning = text.faint on surface.chrome: 3.25 < 4.50 warning = text.faint on surface.raised: 2.79 < 4.50 warning = text.faint on surface.sunken: 3.93 < 4.50 +warning = text.faint on surface.control: 2.54 < 4.50 warning = text.faint on state.hover: 2.54 < 4.50 warning = text.faint on state.pressed: 2.11 < 4.50 warning = status.bad.fg on surface.panel: 3.81 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt index 080fa8035..0613337f3 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff surface.sunken = #242424ff +surface.control = #424242ff surface.knob = #ebebebff surface.scrim = #00000080 surface.inverse = #ebebebff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #1e1e1eff line.border = #1e1e1eff line.control_edge = #4a4a4aff +line.outline = #b2b2b2ff line.knob_edge = #282828ff line.frame = #0d0d0dff line.mark = #9c9c9cff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.25 < 4.50 warning = text.faint on surface.chrome: 3.25 < 4.50 warning = text.faint on surface.raised: 2.79 < 4.50 warning = text.faint on surface.sunken: 3.93 < 4.50 +warning = text.faint on surface.control: 2.54 < 4.50 warning = text.faint on state.hover: 2.54 < 4.50 warning = text.faint on state.pressed: 2.11 < 4.50 warning = status.bad.fg on surface.panel: 3.81 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt index cdfa675c6..d4bc3c92c 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff surface.sunken = #d6d6d6ff +surface.control = #c6c6c6ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #9e9e9eff line.border = #a0a0a0ff line.control_edge = #8c8c8cff +line.outline = #1e1e1eff line.knob_edge = #282828ff line.frame = #8c8c8cff line.mark = #3f3f3fff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt index 2b5a5f71c..c08ddb36e 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff surface.sunken = #d6d6d6ff +surface.control = #c6c6c6ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #9e9e9eff line.border = #a0a0a0ff line.control_edge = #8c8c8cff +line.outline = #1e1e1eff line.knob_edge = #282828ff line.frame = #8c8c8cff line.mark = #3f3f3fff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt index 56e08dc89..4e755587f 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff surface.sunken = #d6d6d6ff +surface.control = #c6c6c6ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #9e9e9eff line.border = #a0a0a0ff line.control_edge = #8c8c8cff +line.outline = #343434ff line.knob_edge = #282828ff line.frame = #8c8c8cff line.mark = #595959ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -258,6 +261,7 @@ warning = text.faint on surface.panel: 3.17 < 4.50 warning = text.faint on surface.chrome: 3.17 < 4.50 warning = text.faint on surface.raised: 3.35 < 4.50 warning = text.faint on surface.sunken: 4.33 < 4.50 +warning = text.faint on surface.control: 3.68 < 4.50 warning = text.faint on state.hover: 3.68 < 4.50 warning = text.faint on state.pressed: 2.71 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt index dbc152600..d101cd1e8 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff surface.sunken = #d6d6d6ff +surface.control = #c6c6c6ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #9e9e9eff line.border = #a0a0a0ff line.control_edge = #8c8c8cff +line.outline = #343434ff line.knob_edge = #282828ff line.frame = #8c8c8cff line.mark = #595959ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -258,6 +261,7 @@ warning = text.faint on surface.panel: 3.17 < 4.50 warning = text.faint on surface.chrome: 3.17 < 4.50 warning = text.faint on surface.raised: 3.35 < 4.50 warning = text.faint on surface.sunken: 4.33 < 4.50 +warning = text.faint on surface.control: 3.68 < 4.50 warning = text.faint on state.hover: 3.68 < 4.50 warning = text.faint on state.pressed: 2.71 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt index 22be98be1..946945fae 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #3c3c3cff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #585858ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt index 38bc28082..102ba36e0 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #3c3c3cff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #585858ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt index e876cec31..5f921a8cd 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #404040ff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #737373ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.87 < 4.50 warning = text.faint on surface.chrome: 3.87 < 4.50 warning = text.faint on surface.raised: 4.09 < 4.50 warning = text.faint on surface.sunken: 4.42 < 4.50 +warning = text.faint on surface.control: 3.41 < 4.50 warning = text.faint on state.hover: 3.41 < 4.50 warning = text.faint on state.pressed: 2.81 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt index 8203da6e6..6b320a480 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff surface.sunken = #ffffffff +surface.control = #e2e2e2ff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262626ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #d6d6d6ff line.border = #d6d6d6ff line.control_edge = #bababaff +line.outline = #404040ff line.knob_edge = #282828ff line.frame = #bababaff line.mark = #737373ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -256,6 +259,7 @@ warning = text.faint on surface.panel: 3.87 < 4.50 warning = text.faint on surface.chrome: 3.87 < 4.50 warning = text.faint on surface.raised: 4.09 < 4.50 warning = text.faint on surface.sunken: 4.42 < 4.50 +warning = text.faint on surface.control: 3.41 < 4.50 warning = text.faint on state.hover: 3.41 < 4.50 warning = text.faint on state.pressed: 2.81 < 4.50 warning = text.on_accent on accent.solid: 3.34 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt index f57a89138..809ad2657 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff surface.sunken = #40404bff +surface.control = #444450ff surface.knob = #eaeaf0ff surface.scrim = #00000080 surface.inverse = #eaeaf0ff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0eff line.divider = #24242cff line.border = #464652ff line.control_edge = #545462ff +line.outline = #e5e6f2ff line.knob_edge = #00000000 line.frame = #0d0d0eff line.mark = #b8bac5ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt index 1f7c5de6b..17b68a56a 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff surface.sunken = #40404bff +surface.control = #444450ff surface.knob = #eaeaf0ff surface.scrim = #00000080 surface.inverse = #eaeaf0ff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0eff line.divider = #24242cff line.border = #464652ff line.control_edge = #545462ff +line.outline = #e5e6f2ff line.knob_edge = #00000000 line.frame = #0d0d0eff line.mark = #b8bac5ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt index 707f88624..c8213d01c 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff surface.sunken = #40404bff +surface.control = #444450ff surface.knob = #eaeaf0ff surface.scrim = #00000080 surface.inverse = #eaeaf0ff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0eff line.divider = #24242cff line.border = #464652ff line.control_edge = #545462ff +line.outline = #d4d4e0ff line.knob_edge = #00000000 line.frame = #0d0d0eff line.mark = #9697a1ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt index 9b2f4f060..e7bd9f094 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff surface.sunken = #40404bff +surface.control = #444450ff surface.knob = #eaeaf0ff surface.scrim = #00000080 surface.inverse = #eaeaf0ff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0eff line.divider = #24242cff line.border = #464652ff line.control_edge = #545462ff +line.outline = #d4d4e0ff line.knob_edge = #00000000 line.frame = #0d0d0eff line.mark = #9697a1ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt index d038a9703..1da506ba3 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff surface.sunken = #faf9fcff +surface.control = #e4e2eaff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #272628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d2cfdaff line.border = #d0cdd7ff line.control_edge = #bebbc9ff +line.outline = #3e3c4cff line.knob_edge = #3e3c4cff line.frame = #bebbc9ff line.mark = #5b5b5eff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt b/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt index 72be51120..0765c69df 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff surface.sunken = #faf9fcff +surface.control = #e4e2eaff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #272628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d2cfdaff line.border = #d0cdd7ff line.control_edge = #bebbc9ff +line.outline = #3e3c4cff line.knob_edge = #3e3c4cff line.frame = #bebbc9ff line.mark = #5b5b5eff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt index d89410361..aa6f1f5af 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff surface.sunken = #faf9fcff +surface.control = #e4e2eaff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #272628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d2cfdaff line.border = #d0cdd7ff line.control_edge = #bebbc9ff +line.outline = #3e3c4cff line.knob_edge = #3e3c4cff line.frame = #bebbc9ff line.mark = #777679ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt index 01b162c40..608d7b62f 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff surface.sunken = #faf9fcff +surface.control = #e4e2eaff surface.knob = #fcfcfdff surface.scrim = #00000059 surface.inverse = #272628ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfdff line.divider = #d2cfdaff line.border = #d0cdd7ff line.control_edge = #bebbc9ff +line.outline = #3e3c4cff line.knob_edge = #3e3c4cff line.frame = #bebbc9ff line.mark = #777679ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt index b0e805d0c..3ec91240c 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff surface.sunken = #00252fff +surface.control = #0e4a5aff surface.knob = #e2edf1ff surface.scrim = #00000080 surface.inverse = #e2edf1ff @@ -22,6 +23,7 @@ text.on_inverse = #0c0d0eff line.divider = #00252fff line.border = #00252fff line.control_edge = #15505fff +line.outline = #ddf6ffff line.knob_edge = #00000000 line.frame = #0c0d0eff line.mark = #b0c8cfff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt index 01310a50b..5074be5a1 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff surface.sunken = #00252fff +surface.control = #0e4a5aff surface.knob = #e2edf1ff surface.scrim = #00000080 surface.inverse = #e2edf1ff @@ -22,6 +23,7 @@ text.on_inverse = #0c0d0eff line.divider = #00252fff line.border = #00252fff line.control_edge = #15505fff +line.outline = #ddf6ffff line.knob_edge = #00000000 line.frame = #0c0d0eff line.mark = #b0c8cfff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt index 577065c0b..9c81b7d0c 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff surface.sunken = #00252fff +surface.control = #0e4a5aff surface.knob = #e2edf1ff surface.scrim = #00000080 surface.inverse = #e2edf1ff @@ -22,6 +23,7 @@ text.on_inverse = #0c0d0eff line.divider = #00252fff line.border = #00252fff line.control_edge = #15505fff +line.outline = #657b83ff line.knob_edge = #00000000 line.frame = #0c0d0eff line.mark = #8ca4abff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -253,6 +256,7 @@ motion.reduced = false warning = text.normal on surface.panel: 4.11 < 4.50 warning = text.normal on surface.chrome: 4.11 < 4.50 warning = text.normal on surface.raised: 3.50 < 4.50 +warning = text.normal on surface.control: 3.10 < 4.50 warning = text.normal on state.hover: 3.10 < 4.50 warning = text.normal on state.pressed: 2.49 < 4.50 warning = text.muted on surface.background: 3.61 < 4.50 @@ -260,6 +264,7 @@ warning = text.muted on surface.panel: 2.92 < 4.50 warning = text.muted on surface.chrome: 2.92 < 4.50 warning = text.muted on surface.raised: 2.49 < 4.50 warning = text.muted on surface.sunken: 3.61 < 4.50 +warning = text.muted on surface.control: 2.20 < 4.50 warning = text.muted on state.hover: 2.20 < 4.50 warning = text.muted on state.pressed: 1.77 < 4.50 warning = text.faint on surface.background: 2.99 < 4.50 @@ -267,6 +272,7 @@ warning = text.faint on surface.panel: 2.42 < 4.50 warning = text.faint on surface.chrome: 2.42 < 4.50 warning = text.faint on surface.raised: 2.06 < 4.50 warning = text.faint on surface.sunken: 2.99 < 4.50 +warning = text.faint on surface.control: 1.82 < 4.50 warning = text.faint on state.hover: 1.82 < 4.50 warning = text.faint on state.pressed: 1.46 < 4.50 warning = status.warn.fg on surface.panel: 4.05 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt index dd7f24655..2b5e409fd 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff surface.sunken = #00252fff +surface.control = #0e4a5aff surface.knob = #e2edf1ff surface.scrim = #00000080 surface.inverse = #e2edf1ff @@ -22,6 +23,7 @@ text.on_inverse = #0c0d0eff line.divider = #00252fff line.border = #00252fff line.control_edge = #15505fff +line.outline = #657b83ff line.knob_edge = #00000000 line.frame = #0c0d0eff line.mark = #8ca4abff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -253,6 +256,7 @@ motion.reduced = false warning = text.normal on surface.panel: 4.11 < 4.50 warning = text.normal on surface.chrome: 4.11 < 4.50 warning = text.normal on surface.raised: 3.50 < 4.50 +warning = text.normal on surface.control: 3.10 < 4.50 warning = text.normal on state.hover: 3.10 < 4.50 warning = text.normal on state.pressed: 2.49 < 4.50 warning = text.muted on surface.background: 3.61 < 4.50 @@ -260,6 +264,7 @@ warning = text.muted on surface.panel: 2.92 < 4.50 warning = text.muted on surface.chrome: 2.92 < 4.50 warning = text.muted on surface.raised: 2.49 < 4.50 warning = text.muted on surface.sunken: 3.61 < 4.50 +warning = text.muted on surface.control: 2.20 < 4.50 warning = text.muted on state.hover: 2.20 < 4.50 warning = text.muted on state.pressed: 1.77 < 4.50 warning = text.faint on surface.background: 2.99 < 4.50 @@ -267,6 +272,7 @@ warning = text.faint on surface.panel: 2.42 < 4.50 warning = text.faint on surface.chrome: 2.42 < 4.50 warning = text.faint on surface.raised: 2.06 < 4.50 warning = text.faint on surface.sunken: 2.99 < 4.50 +warning = text.faint on surface.control: 1.82 < 4.50 warning = text.faint on state.hover: 1.82 < 4.50 warning = text.faint on state.pressed: 1.46 < 4.50 warning = status.warn.fg on surface.panel: 4.05 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt index 0dcd9ab91..da22e8f42 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff surface.sunken = #232326ff +surface.control = #2c2c30ff surface.knob = #ebebecff surface.scrim = #00000080 surface.inverse = #ebebecff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #26262aff line.border = #28282cff line.control_edge = #343439ff +line.outline = #c8c8d0ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a0a1a4ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt index b0f1e9c7c..4c0a039d7 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff surface.sunken = #232326ff +surface.control = #2c2c30ff surface.knob = #ebebecff surface.scrim = #00000080 surface.inverse = #ebebecff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #26262aff line.border = #28282cff line.control_edge = #343439ff +line.outline = #c8c8d0ff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #a0a1a4ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt index 62ca1f276..72edc0bc3 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff surface.sunken = #232326ff +surface.control = #2c2c30ff surface.knob = #ebebecff surface.scrim = #00000080 surface.inverse = #ebebecff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #26262aff line.border = #28282cff line.control_edge = #343439ff +line.outline = #96969eff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #818185ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -256,5 +259,6 @@ warning = text.faint on surface.panel: 2.79 < 4.50 warning = text.faint on surface.chrome: 2.95 < 4.50 warning = text.faint on surface.raised: 2.52 < 4.50 warning = text.faint on surface.sunken: 2.52 < 4.50 +warning = text.faint on surface.control: 2.23 < 4.50 warning = text.faint on state.hover: 2.23 < 4.50 warning = text.faint on state.pressed: 1.87 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt index 83ce16e5e..0b3cebd63 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff surface.sunken = #232326ff +surface.control = #2c2c30ff surface.knob = #ebebecff surface.scrim = #00000080 surface.inverse = #ebebecff @@ -22,6 +23,7 @@ text.on_inverse = #0d0d0dff line.divider = #26262aff line.border = #28282cff line.control_edge = #343439ff +line.outline = #96969eff line.knob_edge = #00000000 line.frame = #0d0d0dff line.mark = #818185ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -256,5 +259,6 @@ warning = text.faint on surface.panel: 2.79 < 4.50 warning = text.faint on surface.chrome: 2.95 < 4.50 warning = text.faint on surface.raised: 2.52 < 4.50 warning = text.faint on surface.sunken: 2.52 < 4.50 +warning = text.faint on surface.control: 2.23 < 4.50 warning = text.faint on state.hover: 2.23 < 4.50 warning = text.faint on state.pressed: 1.87 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt index fb7962477..696d0c65d 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff surface.sunken = #f2f2f5ff +surface.control = #e8e8edff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262627ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #e2e2e8ff line.border = #dedee4ff line.control_edge = #d6d6dcff +line.outline = #45444eff line.knob_edge = #45444eff line.frame = #d6d6dcff line.mark = #626164ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 diff --git a/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt b/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt index 93e56fa30..d02a991db 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt @@ -6,6 +6,7 @@ surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff surface.sunken = #f2f2f5ff +surface.control = #e8e8edff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262627ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #e2e2e8ff line.border = #dedee4ff line.control_edge = #d6d6dcff +line.outline = #45444eff line.knob_edge = #45444eff line.frame = #d6d6dcff line.mark = #626164ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 diff --git a/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt index 3d5f8106b..0eed9e1dc 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt @@ -6,6 +6,7 @@ surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff surface.sunken = #f2f2f5ff +surface.control = #e8e8edff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262627ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #e2e2e8ff line.border = #dedee4ff line.control_edge = #d6d6dcff +line.outline = #60606aff line.knob_edge = #60606aff line.frame = #d6d6dcff line.mark = #7d7d80ff @@ -150,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -255,5 +258,6 @@ warning = text.faint on surface.panel: 2.86 < 4.50 warning = text.faint on surface.chrome: 2.71 < 4.50 warning = text.faint on surface.raised: 2.93 < 4.50 warning = text.faint on surface.sunken: 2.62 < 4.50 +warning = text.faint on surface.control: 2.40 < 4.50 warning = text.faint on state.hover: 2.40 < 4.50 warning = text.faint on state.pressed: 2.15 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt index 9fccbc41a..4795b318f 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt @@ -6,6 +6,7 @@ surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff surface.sunken = #f2f2f5ff +surface.control = #e8e8edff surface.knob = #fcfcfcff surface.scrim = #00000059 surface.inverse = #262627ff @@ -22,6 +23,7 @@ text.on_inverse = #fcfcfcff line.divider = #e2e2e8ff line.border = #dedee4ff line.control_edge = #d6d6dcff +line.outline = #60606aff line.knob_edge = #60606aff line.frame = #d6d6dcff line.mark = #7d7d80ff @@ -150,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -255,5 +258,6 @@ warning = text.faint on surface.panel: 2.86 < 4.50 warning = text.faint on surface.chrome: 2.71 < 4.50 warning = text.faint on surface.raised: 2.93 < 4.50 warning = text.faint on surface.sunken: 2.62 < 4.50 +warning = text.faint on surface.control: 2.40 < 4.50 warning = text.faint on state.hover: 2.40 < 4.50 warning = text.faint on state.pressed: 2.15 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt index 4efc3b228..203058f17 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff surface.sunken = #0f1116ff +surface.control = #282d37ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff -text.muted = #bbc4d5ff -text.faint = #bbc4d5ff -text.disabled = #82868fff +text.muted = #c7d1e1ff +text.faint = #c7d1e2ff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff +line.outline = #4a5363ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #989da5ff +line.mark = #a3a8b0ff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f26b53ff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff -state.text_selection = #f26b5346 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #262b3540 @@ -95,14 +99,14 @@ data.cyan = #00c8ebff data.magenta = #e909a2ff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #bbc4d580 +data.backdrop = #c7d1e180 data.selection = #f26b5359 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #dfe4ec1a -caption.inactive = #bbc4d5ff -caption.pressed = #bbc4d5ff +caption.inactive = #c7d1e2ff +caption.pressed = #c7d1e1ff edge.light = #3d4048ff edge.dark = #000000ff shape.radius.sm = 3 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt index 783dfa13a..ef5cc26a9 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt @@ -6,23 +6,27 @@ surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff surface.sunken = #0f1116ff +surface.control = #282d37ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff -text.muted = #bbc4d5ff -text.faint = #bbc4d5ff -text.disabled = #82868fff +text.muted = #c7d1e1ff +text.faint = #c7d1e2ff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff +line.outline = #4a5363ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #989da5ff +line.mark = #a3a8b0ff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f26b53ff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff -state.text_selection = #f26b5346 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #262b3540 @@ -95,14 +99,14 @@ data.cyan = #00c8ebff data.magenta = #e909a2ff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #bbc4d580 +data.backdrop = #c7d1e180 data.selection = #f26b5359 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #dfe4ec1a -caption.inactive = #bbc4d5ff -caption.pressed = #bbc4d5ff +caption.inactive = #c7d1e2ff +caption.pressed = #c7d1e1ff edge.light = #3d4048ff edge.dark = #000000ff shape.radius.sm = 2 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt index d89eec9a4..bbd3c8668 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff surface.sunken = #0f1116ff +surface.control = #282d37ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff text.muted = #969fafff text.faint = #5a6271ff -text.disabled = #82868fff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff +line.outline = #4a5363ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #797e86ff +line.mark = #83878fff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff -state.text_selection = #f06a5246 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #262b3540 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +253,12 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.06 < 4.50 warning = text.faint on surface.background: 3.17 < 4.50 warning = text.faint on surface.panel: 2.81 < 4.50 warning = text.faint on surface.chrome: 2.81 < 4.50 warning = text.faint on surface.raised: 2.53 < 4.50 warning = text.faint on surface.sunken: 3.08 < 4.50 +warning = text.faint on surface.control: 2.25 < 4.50 warning = text.faint on state.hover: 2.31 < 4.50 -warning = text.faint on state.pressed: 2.00 < 4.50 +warning = text.faint on state.pressed: 1.76 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt index bd51c9429..82eb87700 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt @@ -6,23 +6,27 @@ surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff surface.sunken = #0f1116ff +surface.control = #282d37ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff text.muted = #969fafff text.faint = #5a6271ff -text.disabled = #82868fff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff +line.outline = #4a5363ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #797e86ff +line.mark = #83878fff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff -state.text_selection = #f06a5246 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #262b3540 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +253,12 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.06 < 4.50 warning = text.faint on surface.background: 3.17 < 4.50 warning = text.faint on surface.panel: 2.81 < 4.50 warning = text.faint on surface.chrome: 2.81 < 4.50 warning = text.faint on surface.raised: 2.53 < 4.50 warning = text.faint on surface.sunken: 3.08 < 4.50 +warning = text.faint on surface.control: 2.25 < 4.50 warning = text.faint on state.hover: 2.31 < 4.50 -warning = text.faint on state.pressed: 2.00 < 4.50 +warning = text.faint on state.pressed: 1.76 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt index 40242a0b5..675d61735 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff surface.sunken = #ffffffff +surface.control = #e3e7edff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #3d4452ff -text.faint = #3f444fff -text.disabled = #848689ff +text.muted = #383f4dff +text.faint = #3a3f4aff +text.disabled = #9aa1adff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff -line.knob_edge = #3d4452ff +line.outline = #a4abb8ff +line.knob_edge = #383f4dff line.frame = #c3c9d3ff -line.mark = #5f6062ff +line.mark = #5a5b5dff line.grip = #e2e4e7ff line.focus = #c4321aff accent.solid = #af1c00ff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff -state.text_selection = #af1c0046 +state.text_selection = #d9472f8c state.match = #8378005a state.match_current = #f0a3306e state.stripe = #e3e7ed40 @@ -95,14 +99,14 @@ data.cyan = #00829aff data.magenta = #e0009cff data.yellow = #837800ff data.scope = #282828ff -data.backdrop = #3d445280 +data.backdrop = #383f4d80 data.selection = #af1c0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #3f444fff -caption.pressed = #3d4452ff +caption.inactive = #3a3f4aff +caption.pressed = #383f4dff edge.light = #ffffffff edge.dark = #a0a1a4ff shape.radius.sm = 3 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt index 5542f8faa..7e7995f7b 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt @@ -6,23 +6,27 @@ surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff surface.sunken = #ffffffff +surface.control = #e3e7edff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #3d4452ff -text.faint = #3f444fff -text.disabled = #848689ff +text.muted = #383f4dff +text.faint = #3a3f4aff +text.disabled = #9aa1adff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff -line.knob_edge = #3d4452ff +line.outline = #a4abb8ff +line.knob_edge = #383f4dff line.frame = #c3c9d3ff -line.mark = #5f6062ff +line.mark = #5a5b5dff line.grip = #e2e4e7ff line.focus = #c4321aff accent.solid = #af1c00ff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff -state.text_selection = #af1c0046 +state.text_selection = #d9472f8c state.match = #8378005a state.match_current = #f0a3306e state.stripe = #e3e7ed40 @@ -95,14 +99,14 @@ data.cyan = #00829aff data.magenta = #e0009cff data.yellow = #837800ff data.scope = #282828ff -data.backdrop = #3d445280 +data.backdrop = #383f4d80 data.selection = #af1c0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #3f444fff -caption.pressed = #3d4452ff +caption.inactive = #3a3f4aff +caption.pressed = #383f4dff edge.light = #ffffffff edge.dark = #a0a1a4ff shape.radius.sm = 2 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt index 69eedb01e..e3e7042af 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff surface.sunken = #ffffffff +surface.control = #e3e7edff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #58606eff text.faint = #9aa1adff -text.disabled = #848689ff +text.disabled = #9aa1adff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff +line.outline = #a4abb8ff line.knob_edge = #58606eff line.frame = #c3c9d3ff -line.mark = #7a7c7eff +line.mark = #757678ff line.grip = #e2e4e7ff line.focus = #d9472fff accent.solid = #d9472fff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff -state.text_selection = #d9472f46 +state.text_selection = #d9472f8c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #e3e7ed40 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +253,12 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.22 < 4.50 warning = text.faint on surface.background: 2.14 < 4.50 warning = text.faint on surface.panel: 2.38 < 4.50 warning = text.faint on surface.chrome: 2.38 < 4.50 warning = text.faint on surface.raised: 2.51 < 4.50 warning = text.faint on surface.sunken: 2.60 < 4.50 +warning = text.faint on surface.control: 2.10 < 4.50 warning = text.faint on state.hover: 2.10 < 4.50 -warning = text.faint on state.pressed: 1.87 < 4.50 +warning = text.faint on state.pressed: 1.73 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt index aff055622..b964bb193 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt @@ -6,23 +6,27 @@ surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff surface.sunken = #ffffffff +surface.control = #e3e7edff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #58606eff text.faint = #9aa1adff -text.disabled = #848689ff +text.disabled = #9aa1adff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff +line.outline = #a4abb8ff line.knob_edge = #58606eff line.frame = #c3c9d3ff -line.mark = #7a7c7eff +line.mark = #757678ff line.grip = #e2e4e7ff line.focus = #d9472fff accent.solid = #d9472fff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff -state.text_selection = #d9472f46 +state.text_selection = #d9472f8c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #e3e7ed40 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +253,12 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.22 < 4.50 warning = text.faint on surface.background: 2.14 < 4.50 warning = text.faint on surface.panel: 2.38 < 4.50 warning = text.faint on surface.chrome: 2.38 < 4.50 warning = text.faint on surface.raised: 2.51 < 4.50 warning = text.faint on surface.sunken: 2.60 < 4.50 +warning = text.faint on surface.control: 2.10 < 4.50 warning = text.faint on state.hover: 2.10 < 4.50 -warning = text.faint on state.pressed: 1.87 < 4.50 +warning = text.faint on state.pressed: 1.73 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt index 8e0d025e3..be7069df7 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff surface.sunken = #1a1e26ff +surface.control = #39404dff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff -text.muted = #d3dcedff -text.faint = #d2ddeeff -text.disabled = #808692ff +text.muted = #d9e3f4ff +text.faint = #d8e3f4ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff -text.on_selected = #e8ebf1ff +text.on_selected = #f5f9ffff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff +line.outline = #5a6476ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #abb2beff +line.mark = #b0b7c3ff line.grip = #3b404bff line.focus = #fc755cff accent.solid = #fc755cff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff -state.text_selection = #fc755c46 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #353c4940 @@ -95,14 +99,14 @@ data.cyan = #00c8ebff data.magenta = #f423abff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #d3dced80 +data.backdrop = #d9e3f480 data.selection = #fc755c59 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #e4e9f11a -caption.inactive = #d2ddeeff -caption.pressed = #d3dcedff +caption.inactive = #d8e3f4ff +caption.pressed = #d9e3f4ff edge.light = #4e535eff edge.dark = #000001ff shape.radius.sm = 3 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt index 6f0078e78..c0a17cbc7 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt @@ -6,23 +6,27 @@ surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff surface.sunken = #1a1e26ff +surface.control = #39404dff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff -text.muted = #d3dcedff -text.faint = #d2ddeeff -text.disabled = #808692ff +text.muted = #d9e3f4ff +text.faint = #d8e3f4ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff -text.on_selected = #e8ebf1ff +text.on_selected = #f5f9ffff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff +line.outline = #5a6476ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #abb2beff +line.mark = #b0b7c3ff line.grip = #3b404bff line.focus = #fc755cff accent.solid = #fc755cff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff -state.text_selection = #fc755c46 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #353c4940 @@ -95,14 +99,14 @@ data.cyan = #00c8ebff data.magenta = #f423abff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #d3dced80 +data.backdrop = #d9e3f480 data.selection = #fc755c59 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #e4e9f11a -caption.inactive = #d2ddeeff -caption.pressed = #d3dcedff +caption.inactive = #d8e3f4ff +caption.pressed = #d9e3f4ff edge.light = #4e535eff edge.dark = #000001ff shape.radius.sm = 2 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt index f2ce55a49..a0e76f1a5 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff surface.sunken = #1a1e26ff +surface.control = #39404dff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff text.muted = #99a2b2ff text.faint = #626b7aff -text.disabled = #808692ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e8ebf1ff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff +line.outline = #5a6476ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #89909bff +line.mark = #8e95a0ff line.grip = #3b404bff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff -state.text_selection = #f06a5246 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #353c4940 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,12 +253,14 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on surface.control: 4.05 < 4.50 warning = text.muted on state.hover: 4.31 < 4.50 -warning = text.muted on state.pressed: 3.75 < 4.50 +warning = text.muted on state.pressed: 3.53 < 4.50 warning = text.faint on surface.background: 3.07 < 4.50 warning = text.faint on surface.panel: 2.60 < 4.50 warning = text.faint on surface.chrome: 2.60 < 4.50 warning = text.faint on surface.raised: 2.25 < 4.50 warning = text.faint on surface.sunken: 3.10 < 4.50 +warning = text.faint on surface.control: 1.94 < 4.50 warning = text.faint on state.hover: 2.06 < 4.50 -warning = text.faint on state.pressed: 1.80 < 4.50 +warning = text.faint on state.pressed: 1.69 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt index d7e3d29eb..beac805f4 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt @@ -6,23 +6,27 @@ surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff surface.sunken = #1a1e26ff +surface.control = #39404dff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff text.muted = #99a2b2ff text.faint = #626b7aff -text.disabled = #808692ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e8ebf1ff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff +line.outline = #5a6476ff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #89909bff +line.mark = #8e95a0ff line.grip = #3b404bff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff -state.text_selection = #f06a5246 +state.text_selection = #f06a528c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #353c4940 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,12 +253,14 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on surface.control: 4.05 < 4.50 warning = text.muted on state.hover: 4.31 < 4.50 -warning = text.muted on state.pressed: 3.75 < 4.50 +warning = text.muted on state.pressed: 3.53 < 4.50 warning = text.faint on surface.background: 3.07 < 4.50 warning = text.faint on surface.panel: 2.60 < 4.50 warning = text.faint on surface.chrome: 2.60 < 4.50 warning = text.faint on surface.raised: 2.25 < 4.50 warning = text.faint on surface.sunken: 3.10 < 4.50 +warning = text.faint on surface.control: 1.94 < 4.50 warning = text.faint on state.hover: 2.06 < 4.50 -warning = text.faint on state.pressed: 1.80 < 4.50 +warning = text.faint on state.pressed: 1.69 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt index ca6e14c28..f1f2199d9 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff +surface.control = #c9d0daff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #2a303eff -text.faint = #2a303dff -text.disabled = #82868eff +text.muted = #292f3dff +text.faint = #29303cff +text.disabled = #7d8594ff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff -line.knob_edge = #2a303eff +line.outline = #8a93a2ff +line.knob_edge = #292f3dff line.frame = #9aa2b0ff -line.mark = #4a4d54ff +line.mark = #494c53ff line.grip = #c3c8d0ff line.focus = #a81a00ff accent.solid = #af1b00ff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff -state.text_selection = #af1b0046 +state.text_selection = #d9472f8c state.match = #776c005a state.match_current = #f0a3306e state.stripe = #c5ccd640 @@ -95,14 +99,14 @@ data.cyan = #00758bff data.magenta = #cb008dff data.yellow = #776c00ff data.scope = #282828ff -data.backdrop = #2a303e80 +data.backdrop = #292f3d80 data.selection = #af1b0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #2a303dff -caption.pressed = #2a303eff +caption.inactive = #29303cff +caption.pressed = #292f3dff edge.light = #ffffffff edge.dark = #82878eff shape.radius.sm = 3 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt index 315233d45..1591b94cf 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt @@ -6,23 +6,27 @@ surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff +surface.control = #c9d0daff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #2a303eff -text.faint = #2a303dff -text.disabled = #82868eff +text.muted = #292f3dff +text.faint = #29303cff +text.disabled = #7d8594ff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff -line.knob_edge = #2a303eff +line.outline = #8a93a2ff +line.knob_edge = #292f3dff line.frame = #9aa2b0ff -line.mark = #4a4d54ff +line.mark = #494c53ff line.grip = #c3c8d0ff line.focus = #a81a00ff accent.solid = #af1b00ff @@ -60,11 +64,11 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff -state.text_selection = #af1b0046 +state.text_selection = #d9472f8c state.match = #776c005a state.match_current = #f0a3306e state.stripe = #c5ccd640 @@ -95,14 +99,14 @@ data.cyan = #00758bff data.magenta = #cb008dff data.yellow = #776c00ff data.scope = #282828ff -data.backdrop = #2a303e80 +data.backdrop = #292f3d80 data.selection = #af1b0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #2a303dff -caption.pressed = #2a303eff +caption.inactive = #29303cff +caption.pressed = #292f3dff edge.light = #ffffffff edge.dark = #82878eff shape.radius.sm = 2 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt index e15440c53..edea9520b 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt @@ -6,23 +6,27 @@ surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff +surface.control = #c9d0daff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #4a5160ff text.faint = #7d8594ff -text.disabled = #82868eff +text.disabled = #7d8594ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff +line.outline = #8a93a2ff line.knob_edge = #4a5160ff line.frame = #9aa2b0ff -line.mark = #64676eff +line.mark = #63676dff line.grip = #c3c8d0ff line.focus = #cd3b24ff accent.solid = #d9472fff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff -state.text_selection = #d9472f46 +state.text_selection = #d9472f8c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #c5ccd640 @@ -134,6 +138,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -145,6 +152,7 @@ size.rail.width = 50 size.rail.button = 36 size.bar.title = 38 size.bar.tab = 30 +size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -245,11 +254,12 @@ motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false warning = accent.solid on surface.panel: 3.00 < 3.00 -warning = text.muted on state.pressed: 4.25 < 4.50 +warning = text.muted on state.pressed: 4.20 < 4.50 warning = text.faint on surface.background: 2.25 < 4.50 warning = text.faint on surface.panel: 2.59 < 4.50 warning = text.faint on surface.chrome: 2.59 < 4.50 warning = text.faint on surface.raised: 2.75 < 4.50 warning = text.faint on surface.sunken: 3.14 < 4.50 +warning = text.faint on surface.control: 2.39 < 4.50 warning = text.faint on state.hover: 2.30 < 4.50 -warning = text.faint on state.pressed: 1.98 < 4.50 +warning = text.faint on state.pressed: 1.96 < 4.50 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt index 7051e2d8e..4da02566e 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt @@ -6,23 +6,27 @@ surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff +surface.control = #c9d0daff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #4a5160ff text.faint = #7d8594ff -text.disabled = #82868eff +text.disabled = #7d8594ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff +line.outline = #8a93a2ff line.knob_edge = #4a5160ff line.frame = #9aa2b0ff -line.mark = #64676eff +line.mark = #63676dff line.grip = #c3c8d0ff line.focus = #cd3b24ff accent.solid = #d9472fff @@ -60,11 +64,11 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff -state.text_selection = #d9472f46 +state.text_selection = #d9472f8c state.match = #f0dc005a state.match_current = #f0a3306e state.stripe = #c5ccd640 @@ -134,6 +138,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -145,6 +152,7 @@ size.rail.width = 40 size.rail.button = 30 size.bar.title = 32 size.bar.tab = 26 +size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 @@ -191,6 +199,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -245,11 +254,12 @@ motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false warning = accent.solid on surface.panel: 3.00 < 3.00 -warning = text.muted on state.pressed: 4.25 < 4.50 +warning = text.muted on state.pressed: 4.20 < 4.50 warning = text.faint on surface.background: 2.25 < 4.50 warning = text.faint on surface.panel: 2.59 < 4.50 warning = text.faint on surface.chrome: 2.59 < 4.50 warning = text.faint on surface.raised: 2.75 < 4.50 warning = text.faint on surface.sunken: 3.14 < 4.50 +warning = text.faint on surface.control: 2.39 < 4.50 warning = text.faint on state.hover: 2.30 < 4.50 -warning = text.faint on state.pressed: 1.98 < 4.50 +warning = text.faint on state.pressed: 1.96 < 4.50 diff --git a/crates/theme/themes/vectorcraft-modern-medium.json b/crates/theme/themes/vectorcraft-modern-medium.json index 7c416f16e..ce7aa4700 100644 --- a/crates/theme/themes/vectorcraft-modern-medium.json +++ b/crates/theme/themes/vectorcraft-modern-medium.json @@ -24,17 +24,21 @@ "line.border": "#a9b0bc", "line.control_edge": "#9aa2b0", "line.divider": "#bcc3ce", + "line.outline": "#8a93a2", "seeds": { "accent": "#d9472f", "neutral": "#d3d8e0" }, "state.hover": "#c5ccd6", - "state.pressed": "#b6bec9", - "state.selected": "#e7c4bd", + "state.pressed": "#d4b5b6", + "state.selected": "#d4bbbd", + "state.text_selection": "#d9472f8c", "surface.background": "#c4cad4", "surface.canvas": "#b9c0cb", + "surface.control": "#c9d0da", "surface.panel": "#d3d8e0", "surface.sunken": "#e9ecf1", + "text.disabled": "#7d8594", "text.faint": "#7d8594", "text.muted": "#4a5160", "text.normal": "#1b1f27" @@ -46,13 +50,17 @@ "line.border": "#11141a", "line.control_edge": "#3a414e", "line.divider": "#323946", + "line.outline": "#5a6476", "state.hover": "#353c49", - "state.pressed": "#3d4553", - "state.selected": "#4a3236", + "state.pressed": "#633f3e", + "state.selected": "#573b3d", + "state.text_selection": "#f06a528c", "surface.background": "#1b1f27", "surface.canvas": "#1e222a", + "surface.control": "#39404d", "surface.panel": "#272c36", "surface.sunken": "#1a1e26", + "text.disabled": "#626b7a", "text.faint": "#626b7a", "text.muted": "#99a2b2", "text.normal": "#e4e9f1" diff --git a/crates/theme/themes/vectorcraft-modern.json b/crates/theme/themes/vectorcraft-modern.json index be251b3e4..49853128a 100644 --- a/crates/theme/themes/vectorcraft-modern.json +++ b/crates/theme/themes/vectorcraft-modern.json @@ -24,17 +24,21 @@ "line.border": "#d0d5dd", "line.control_edge": "#c3c9d3", "line.divider": "#dde1e8", + "line.outline": "#a4abb8", "seeds": { "accent": "#d9472f", "neutral": "#f3f5f8" }, "state.hover": "#e3e7ed", - "state.pressed": "#d5dbe3", - "state.selected": "#f8d9d2", + "state.pressed": "#edcbc8", + "state.selected": "#eed2d0", + "state.text_selection": "#d9472f8c", "surface.background": "#e6e9ee", "surface.canvas": "#dfe3e9", + "surface.control": "#e3e7ed", "surface.panel": "#f3f5f8", "surface.sunken": "#ffffff", + "text.disabled": "#9aa1ad", "text.faint": "#9aa1ad", "text.muted": "#58606e", "text.normal": "#1b1f27" @@ -46,13 +50,17 @@ "line.border": "#06070a", "line.control_edge": "#2c323e", "line.divider": "#232832", + "line.outline": "#4a5363", "state.hover": "#262b35", - "state.pressed": "#2f3541", - "state.selected": "#3a2a2c", + "state.pressed": "#593330", + "state.selected": "#4c2e2e", + "state.text_selection": "#f06a528c", "surface.background": "#0b0d12", "surface.canvas": "#101217", + "surface.control": "#282d37", "surface.panel": "#181b22", "surface.sunken": "#0f1116", + "text.disabled": "#5a6271", "text.faint": "#5a6271", "text.muted": "#969faf", "text.normal": "#dfe4ec" diff --git a/crates/ui-canvas/src/canvas/mod.rs b/crates/ui-canvas/src/canvas/mod.rs index 162b9fa29..88a0dd64d 100644 --- a/crates/ui-canvas/src/canvas/mod.rs +++ b/crates/ui-canvas/src/canvas/mod.rs @@ -44,7 +44,7 @@ pub use raster_source::{PixelRect, RasterSource}; pub(crate) mod pasteboard; pub(crate) mod split; -pub use pasteboard::{PageBorder, PageFill, PageFrame, Pasteboard, PasteboardColor, PasteboardOutput, PasteboardStyle}; +pub use pasteboard::{ArtboardEdge, PageBorder, PageFill, PageFrame, Pasteboard, PasteboardColor, PasteboardOutput, PasteboardStyle}; pub use split::{PanePress, SplitAt, SplitLayout, SplitPane, SplitPaneAt, SplitStyle, SplitViews, SplitViewsOutput, TabDrop, TabDropTarget}; pub use words::SplitWords; diff --git a/crates/ui-canvas/src/canvas/pasteboard/mod.rs b/crates/ui-canvas/src/canvas/pasteboard/mod.rs index 0625da39d..a175bb976 100644 --- a/crates/ui-canvas/src/canvas/pasteboard/mod.rs +++ b/crates/ui-canvas/src/canvas/pasteboard/mod.rs @@ -12,7 +12,7 @@ use crate::contract::{ Access, Bind, Common, Component, Cx, MeasureCx, Name, NoValue, Outcome, Overlay, OverlayUi, Overlays as _, PaintUi, PartsCx, Pointer as _, Props as _, Rename, Role, Show as _, }; -use crate::primitives::{Checker, CheckerArea, PaintShape, PaintSlot, Rule, StrokeWidth, TextRun, paint_surround}; +use crate::primitives::{Checker, CheckerArea, PaintShape, PaintSlot, Rule, StrokeColor, StrokeWidth, TextRun, paint_surround}; use crate::runtime::env::Label; use crate::runtime::focus::{FocusPolicy, Initial}; use crate::runtime::memory::Remember as _; @@ -77,6 +77,23 @@ pub enum PageBorder { None, } +/// How the edges of artboards (pages marked with [`PageFrame::active()`]) show which one is active. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum ArtboardEdge { + /// The active artboard's edge in `accent.solid`, the others in `line.border`, all at `stroke.thin`. + #[default] + Accent, + /// Colours that read against the paper rather than the chrome: the active artboard's edge black at `stroke.thin`, + /// the others mid grey at a hairline. + Plain, +} + +/// The edge of the active artboard under [`ArtboardEdge::Plain`]: black. +const PLAIN_ACTIVE: DataColor = DataColor::new(Color32::BLACK); +/// The edge of another artboard under [`ArtboardEdge::Plain`]: grey 120. +const PLAIN_OTHER: DataColor = DataColor::new(Color32::from_gray(120)); + /// What fills a page under the document. #[derive(Clone, Copy, Debug, PartialEq)] #[non_exhaustive] @@ -97,9 +114,9 @@ pub struct PageFrame { pub name: Option, /// The page's own fill under the document (an artboard's background), or `None` for none. pub fill: Option, - /// An artboard's edge: `Some(true)` for the active board (an accent edge, its name in the normal text colour), - /// `Some(false)` for another board (a faint dark edge, its name muted); `None` for a plain page, which only the - /// border shows. + /// An artboard's edge: `Some(true)` for the active board (its name in the normal text colour), `Some(false)` for + /// another board (its name muted), each edged as the pasteboard's [`ArtboardEdge`] says; `None` for a plain page, + /// which only the border shows. pub active: Option, /// Whether a double press on the page's name renames the page. pub renames: bool, @@ -216,6 +233,9 @@ pub struct Pasteboard<'a> { /// The border round each page; a drop shadow by default. #[prop] border: PageBorder, + /// How the artboards' edges show the active one; the accent by default. + #[prop] + artboard_edge: ArtboardEdge, /// Document rects the pasteboard does not cover, subtracted like the pages. #[prop] uncovered: &'a [DocRect], @@ -239,6 +259,7 @@ impl<'a> Pasteboard<'a> { common: Common::new(), pages, border: PageBorder::DropShadow, + artboard_edge: ArtboardEdge::Accent, uncovered: &[], shows_outside: false, name_sizes: Vec::new(), @@ -477,16 +498,17 @@ impl Component for Pasteboard<'_> { surround(); } let aligned = view.axis_aligned(); - let edge = |quad: &[Pos2; 4], color: StyleColor| { + // An edge in `color`, at `stroke.thin` or a hairline: `rule` is the same colour as the snapped rule paints it. + let edge = |quad: &[Pos2; 4], rule: Color32, color: StrokeColor, hairline: bool| { if aligned { let rect = bounds(quad); - let look = RuleLook { color: color.egui(), width: RuleWidth::Points(style.edge) }; + let look = RuleLook { color: rule, width: if hairline { RuleWidth::Hairline } else { RuleWidth::Points(style.edge) } }; let corners = [rect.left_top(), rect.right_top(), rect.right_bottom(), rect.left_bottom()]; for (from, to) in corners.into_iter().zip(corners.into_iter().cycle().skip(1)) { edges.painter.extend(Rule::shapes(&look, from, to, edges.pixels_per_point())); } } else { - draw.stroke(&polygon(quad), StrokeWidth::Thin, color); + draw.stroke(&polygon(quad), if hairline { StrokeWidth::Hairline } else { StrokeWidth::Thin }, color); } }; let shown = |page: &PageFrame| page.name.is_some() || bounds(&view.quad(page.rect)).intersects(view.rect); @@ -519,10 +541,19 @@ impl Component for Pasteboard<'_> { for (at, page) in self.pages.iter().enumerate().filter(|(_, page)| shown(page)) { let quad = view.quad(page.rect); if self.border == PageBorder::Line { - edge(&quad, style.outline); + edge(&quad, style.outline.egui(), style.outline.into(), false); } if let Some(active) = page.active { - edge(&quad, if active { style.active_edge } else { style.outline }); + match self.artboard_edge { + ArtboardEdge::Accent => { + let color = if active { style.active_edge } else { style.outline }; + edge(&quad, color.egui(), color.into(), false); + } + ArtboardEdge::Plain => { + let color = if active { PLAIN_ACTIVE } else { PLAIN_OTHER }; + edge(&quad, color.0, color.into(), !active); + } + } } if let (Some(name), Some(size)) = (&page.name, self.name_sizes.get(at).copied().flatten()) { let rect = name_rect(&view, page, style.name_gap, size); diff --git a/crates/ui-canvas/src/canvas/pasteboard/stories.rs b/crates/ui-canvas/src/canvas/pasteboard/stories.rs index 8a1e4ed55..8542c6d68 100644 --- a/crates/ui-canvas/src/canvas/pasteboard/stories.rs +++ b/crates/ui-canvas/src/canvas/pasteboard/stories.rs @@ -1,6 +1,6 @@ //! Stories of the pasteboard. -use super::{NAME, PageBorder, PageFrame, Pasteboard, PasteboardColor}; +use super::{ArtboardEdge, NAME, PageBorder, PageFrame, Pasteboard, PasteboardColor}; use crate::canvas::Canvas; use crate::canvas::testing::canvas_story::{StoryDocument, on_canvas_view, on_canvas_with, story_view}; use crate::contract::Show as _; @@ -53,6 +53,17 @@ fn artboards(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { on_canvas_view(ui, view, Some(&StoryDocument::STANDARD), |ui, at, _| Pasteboard::new("Pasteboard", pages).border(border).show_at(ui, at)) } +/// The two artboards under `ArtboardEdge::Plain`: the active one edged in black, the other in mid grey at a hairline, +/// as a drawing app's artboards read against the paper. +#[story(Pasteboard<'static>, covers = [], drive = Drive::Never)] +fn artboards_with_plain_edges(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let view = view_values(data, 0.0); + let pages: &[PageFrame] = data.value("pages", boards()); + on_canvas_view(ui, view, Some(&StoryDocument::STANDARD), |ui, at, _| { + Pasteboard::new("Pasteboard", pages).artboard_edge(ArtboardEdge::Plain).show_at(ui, at) + }) +} + #[story(Pasteboard<'static>, covers = [Default], drive = Drive::Never)] fn page_with_a_line(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let view = view_values(data, 0.0); diff --git a/crates/ui-canvas/src/canvas_controls/mod.rs b/crates/ui-canvas/src/canvas_controls/mod.rs index 58d1094cb..732817ba2 100644 --- a/crates/ui-canvas/src/canvas_controls/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/mod.rs @@ -27,7 +27,7 @@ pub use line_preview::{LineGuideStyle, StraightLinePreview}; pub use marquee::{Marquee, MarqueeLook, MarqueeShape, MarqueeStyle, Run}; pub use outline::{HoverMask, HoverOutline, HoverShape, OutlineStyle, SelectionOutline, SelectionOutlineLook, path_runs}; pub use pixel_grid::{GridSegment, PixelGrid, PixelGridStyle}; -pub use task_bar::{TaskBar, TaskBarCx, TaskBarDismiss, TaskBarKind, TaskBarOutput, TaskBarPlace}; +pub use task_bar::{TaskBar, TaskBarCx, TaskBarDismiss, TaskBarGrip, TaskBarHang, TaskBarKind, TaskBarOutput, TaskBarPlace}; // End of canvas-controls-b. // Brush overlays. diff --git a/crates/ui-canvas/src/canvas_controls/task_bar.rs b/crates/ui-canvas/src/canvas_controls/task_bar.rs index 81e96c0b4..669d2136d 100644 --- a/crates/ui-canvas/src/canvas_controls/task_bar.rs +++ b/crates/ui-canvas/src/canvas_controls/task_bar.rs @@ -10,18 +10,19 @@ use crate::buttons::IconButton; use crate::canvas::canvas_space; use crate::contract::overlay::{Anchor, Dismiss, Outside, Place, PlacementChange, PlacementKind}; use crate::contract::{ - Bind, BindMut, Common, Component, Container, ContainerProps, Cx, DragBand, HeaderRegion, Inner, Mount, NoValue, Outcome, Overlay, Pad, PopupKind, - Props as _, Role, Show as _, ShowContainer as _, Sizing, Trigger, + Bind, BindMut, Common, Component, Container, ContainerProps, Cx, DragBand, Gap, HeaderRegion, Inner, MeasureCx, Mount, NoValue, Outcome, Overlay, + Pad, PaintUi, PopupKind, Props as _, Role, Show as _, ShowContainer as _, Sizing, Styled as _, Trigger, }; use crate::display::{Divider, Icon}; use crate::menu::{Menu, MenuItem, PanelMenu, PanelRow}; -use crate::primitives::IconSpec; +use crate::primitives::{IconSpec, PaintShape}; use crate::runtime::env::{Env, Label}; use crate::runtime::overlay::CloseReason; -use crate::style::{ComponentStyle, StyleCx, SurfaceKind}; +use crate::style::{ComponentStyle, StyleColor, StyleCx, SurfaceKind, UiTokens}; use craft_behavior::kurbo::Point; use craft_behavior::overlay::{Align, PlaceRequest, Side}; use craft_behavior::{EditEvent, GesturePhase, IconId, Metrics, Mixed, Sense}; +use craft_theme::{Stateful, States}; use egui::{Pos2, Rect, Response, Ui, Vec2}; use std::sync::Arc; @@ -67,10 +68,10 @@ impl TaskBarPlace { /// members and a More menu (Hide, Pin, Reset, then the host's rows). One place, pin and Hide setting for Crop and /// Frame. /// -/// - Place: on `side` of the anchor's bounds on screen (below, centred, by default), a section gap away, following the -/// anchor each pass; it flips to the other side when there is no room. Dragged by its grip (any free point of the -/// bar), it keeps its offset from that place while the anchor moves or the bar grows; a press with no drag changes -/// nothing. A moved bar whose offset place would cover the `keep_clear` point shows at its unmoved place and keeps +/// - Place: on `side` of the anchor's bounds on screen (below, centred, by default), a section gap away (or as far as +/// [`hang_gap`](Self::hang_gap) says), following the anchor each pass; it flips to the other side when there is no +/// room. Dragged by its grip (any free point of the bar), it keeps its offset from that place while the anchor moves +/// or the bar grows; a press with no drag changes nothing. A moved bar whose offset place would cover the `keep_clear` point shows at its unmoved place and keeps /// its offset. Pinned, it stays where it shows. /// - Area: the bar shows inside `area` (the canvas rect): a move stays inside it, and a stored place outside it comes /// back inside, its left and top edges winning where the bar does not fit. Its members continue on a new line when @@ -112,6 +113,16 @@ pub struct TaskBar<'a> { /// default. #[prop] compact: bool, + /// How the task bar's grip looks: the `grip` icon by default. + #[prop] + grip: TaskBarGrip, + /// The space between the bar's members, in place of the tool bar's tight gap: `Gap::Item` sets them a control gap + /// apart. + #[prop(into)] + member_gap: Option, + /// How far from its anchor's bounds a bar hung from document points hangs: a section gap by default. + #[prop] + hang_gap: TaskBarHang, } /// What a bar hangs from: the screen bounds of document points, or the canvas view's top edge, aligned in reading @@ -136,6 +147,30 @@ pub enum TaskBarKind { Fixed, } +/// How the grip of a [`TaskBar`] looks. Either way the grip takes no press of its own: the bar's move band under it +/// moves the bar. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[non_exhaustive] +pub enum TaskBarGrip { + /// The `grip` icon. + #[default] + Icon, + /// One rounded upright bar, a value track's groove wide and the members' line less a row gap at each end tall, in + /// the control edge's line colour; muted text under the pointer and while the bar moves (VectorCraft's). + Bar, +} + +/// How far from its anchor's bounds a [`TaskBar`] hangs. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[non_exhaustive] +pub enum TaskBarHang { + /// A section gap away. + #[default] + Gap, + /// The handle ring and a section gap away: clear of a selection's handles on that side and their hit area. + ClearOfHandles, +} + /// What an outside press does to a [`TaskBar`]. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[non_exhaustive] @@ -257,6 +292,9 @@ impl<'a> TaskBar<'a> { keep_clear: None, dismiss: TaskBarDismiss::Close, compact: false, + grip: TaskBarGrip::Icon, + member_gap: None, + hang_gap: TaskBarHang::Gap, } } @@ -283,6 +321,9 @@ impl<'a> TaskBar<'a> { keep_clear: None, dismiss: TaskBarDismiss::Close, compact: false, + grip: TaskBarGrip::Icon, + member_gap: None, + hang_gap: TaskBarHang::Gap, } } @@ -311,7 +352,7 @@ impl<'a> TaskBar<'a> { /// Shows the bar inside `area`; `body` fills its members. pub fn show(self, ui: &mut Ui, area: Rect, mut body: impl FnMut(&mut Ui, &mut TaskBarCx<'_>) -> R) -> Inner { - let TaskBar { label, hang, mut place, rows, kind, side, align, keep_clear, dismiss, compact } = self; + let TaskBar { label, hang, mut place, rows, kind, side, align, keep_clear, dismiss, compact, grip: grip_look, member_gap, hang_gap } = self; let side = side.unwrap_or(match kind { TaskBarKind::Task | TaskBarKind::Fixed => Side::Below, TaskBarKind::Selection => Side::Above, @@ -329,7 +370,8 @@ impl<'a> TaskBar<'a> { bounds.extend_with(at); bounds }); - let gap = env.tokens.space.gap.section; + let clear = if hang_gap == TaskBarHang::ClearOfHandles { env.tokens.size.handle.ring } else { 0.0 }; + let gap = env.tokens.space.gap.section + clear; // A fixed bar keeps the gap on both sides of its anchor: it opens above when there is no room below. let rect = if kind == TaskBarKind::Fixed { bounds.expand2(Vec2::new(0.0, gap)) } else { hang_rect(bounds, gap, side) }; (room && bounds.is_finite()).then(|| Hung { @@ -357,14 +399,25 @@ impl<'a> TaskBar<'a> { let mut menu = MoreMenu { words: Arc::clone(&words), offered: movable, pinned: held.pinned, rows, placed: false, pick: None }; // Only the task bar moves, so only it starts with the grip. let grip = movable.then(|| words.task_bar_move.clone()); - let mut shown = layer.show(ui, |ui, _| { + let mut shown = layer.show(ui, |ui, layer| { + let moving = layer.moving(); // The bar is the one surface: the grip is its first member, on the members' line inside its padding. let bar = Bar::new(Label::Empty, BarKind::Tool).surface(SurfaceKind::Floating).wrap(); // A compact bar takes a popup's smaller corners and lighter shadow, as production's small frame. let bar = if compact { bar.compact().surface(SurfaceKind::Popup) } else { bar }; + let bar = match member_gap { + Some(gap) => bar.gap(gap), + None => bar, + }; bar.show(ui, |ui, _| { - if let Some(grip) = &grip { - let _ = Icon::new(IconSpec::svg(IconId::new("grip"))).label(grip.clone()).show(ui); + match (&grip, grip_look) { + (Some(grip), TaskBarGrip::Bar) => { + let _ = GripBar { common: Common::new(), moving }.label(grip.clone()).show(ui); + } + (Some(grip), _) => { + let _ = Icon::new(IconSpec::svg(IconId::new("grip"))).label(grip.clone()).show(ui); + } + (None, _) => {} } menu.placed = false; let inner = body(ui, &mut TaskBarCx { menu: &mut menu }); @@ -498,6 +551,70 @@ fn settled(held: TaskBarPlace, shown: Rect, area: Rect, moved: Option, pic next } +/// The style of the [`TaskBarGrip::Bar`] grip. +#[derive(Clone, Debug, PartialEq, ComponentStyle)] +#[non_exhaustive] +pub struct GripBarStyle { + #[style(metrics)] + metrics: Metrics, + /// The bar's width and height. + size: Vec2, + /// The bar's ink: the line colour at rest, muted text under the pointer. + ink: Stateful, + /// The ink while the bar moves. + moving: StyleColor, +} + +/// The [`TaskBarGrip::Bar`] grip: one rounded upright bar centred on the members' line. It senses only hover, so a +/// press on it reaches the layer's move band under it. +#[derive(crate::contract::Component, crate::contract::Props)] +#[component(unregistered)] +struct GripBar { + #[common] + common: Common, + /// The layer's move band is moving the bar this pass. + moving: bool, +} + +impl Component for GripBar { + const ROLE: Role = Role::IMAGE; + const PARTS: bool = false; + const INPUT: craft_behavior::Input = craft_behavior::Input::Display; + const SHOWS_LABEL: bool = false; + const OVERLAYS: bool = false; + type Style = GripBarStyle; + type Output = Response; + + fn style(cx: &StyleCx<'_>, _: GripBarStyleKey) -> GripBarStyle { + let colors = &cx.tokens.color; + let (rest, lit) = (cx.color(colors.line.control_edge), cx.color(colors.text.muted)); + GripBarStyle { + metrics: Metrics::new(), + size: Vec2::new(cx.tokens.size.groove, cx.control().height - 2.0 * cx.tokens.space.gap.row), + ink: Stateful::new(rest).off(States::new(rest, lit, lit, rest)), + moving: lit, + } + } + + fn measure(&mut self, cx: &MeasureCx<'_, Self>) -> Vec2 { + cx.style.size + } + + fn sense(&self) -> Sense { + Sense::HOVER + } + + fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { + let ink = if self.moving { cx.style.moving } else { cx.resolve(&cx.style.ink) }; + let bar = Rect::from_center_size(cx.rect.center(), cx.style.size); + ui.draw().fill(&PaintShape::Rect(bar, UiTokens::corner(cx.style.size.x / 2.0)), ink); + } + + fn finish(self, cx: Cx<'_, Self>) -> Response { + cx.response.clone() + } +} + /// The style of the task bar's layer: the surface comes from the container. #[derive(Clone, Debug, Default, PartialEq, ComponentStyle)] #[non_exhaustive] diff --git a/crates/ui-canvas/src/canvas_controls/task_bar/stories.rs b/crates/ui-canvas/src/canvas_controls/task_bar/stories.rs index 9d357c830..0f9e0c80d 100644 --- a/crates/ui-canvas/src/canvas_controls/task_bar/stories.rs +++ b/crates/ui-canvas/src/canvas_controls/task_bar/stories.rs @@ -1,9 +1,9 @@ //! Stories of `TaskBar`. -use super::{TaskBar, TaskBarDismiss, TaskBarPlace}; +use super::{TaskBar, TaskBarDismiss, TaskBarGrip, TaskBarHang, TaskBarPlace}; use crate::buttons::{Button, IconButton}; use crate::canvas::testing::canvas_story::{StoryDocument, on_canvas}; -use crate::contract::{Props as _, Show as _}; +use crate::contract::{Gap, Props as _, Show as _}; use crate::menu::PanelRow; use crate::runtime::commands::{CommandRef, EditCommands}; use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story}; @@ -198,3 +198,48 @@ fn placed_and_pinned(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { .output }) } + +/// Points the pointer at the grip. +fn hover_grip(fixture: &mut Fixture) { + if let Some(grip) = fixture.by_label("Move bar") { + fixture.frame(vec![crate::testing::pointer::moved(grip.center())]); + fixture.idle(8); + } +} + +/// Drags the bar by its grip and holds it there, the button down. +fn drag_grip(fixture: &mut Fixture) { + if let Some(grip) = fixture.by_label("Move bar") { + fixture.drag_hold_at(grip.center(), egui::vec2(-40.0, 30.0)); + } +} + +/// The bar grip: one rounded upright bar in the line colour. +#[story(TaskBar<'static>, covers = [], drive = Drive::Never)] +fn bar_grip(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + configured(ui, data, &turned_frame(), None, |bar| bar.grip(TaskBarGrip::Bar)) +} + +/// The bar grip under the pointer: muted text. +#[story(TaskBar<'static>, covers = [], drive = Drive::Custom(hover_grip))] +fn bar_grip_hovered(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + configured(ui, data, &turned_frame(), None, |bar| bar.grip(TaskBarGrip::Bar)) +} + +/// The bar grip while the bar moves: muted text. +#[story(TaskBar<'static>, covers = [], drive = Drive::Custom(drag_grip))] +fn bar_grip_dragged(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + configured(ui, data, &turned_frame(), None, |bar| bar.grip(TaskBarGrip::Bar)) +} + +/// A bar whose members stand a control gap apart. +#[story(TaskBar<'static>, covers = [], drive = Drive::Never)] +fn control_gap(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + configured(ui, data, &turned_frame(), None, |bar| bar.member_gap(Gap::Item)) +} + +/// A bar hung clear of the frame's handles: the handle ring and a section gap below it. +#[story(TaskBar<'static>, covers = [], drive = Drive::Never)] +fn clear_of_handles(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + configured(ui, data, &turned_frame(), None, |bar| bar.hang_gap(TaskBarHang::ClearOfHandles)) +} diff --git a/crates/ui-canvas/tests/it/canvas/crop.rs b/crates/ui-canvas/tests/it/canvas/crop.rs index d2b6a8b73..69b91085d 100644 --- a/crates/ui-canvas/tests/it/canvas/crop.rs +++ b/crates/ui-canvas/tests/it/canvas/crop.rs @@ -451,6 +451,7 @@ fn a_quick_drag_in_one_frame_starts_at_the_press() { assert_eq!((events.first(), events.last()), (Some(&"begin"), Some(&"commit")), "{events:?}"); } +/// Control is pressed once the resize has started: on macOS a press with Control held is a secondary click. #[trial] fn the_control_key_held_during_a_resize_turns_snapping_off() { for (held, right) in [(Modifiers::NONE, 310.0), (Modifiers::CTRL, 307.0)] { @@ -459,7 +460,13 @@ fn the_control_key_held_during_a_resize_turns_snapping_off() { s.snap_x = Some(310.0); s }); - rig.drag(rig.at(300.0, 220.0), rig.at(307.0, 220.0), held); + let (from, to) = (rig.at(300.0, 220.0), rig.at(307.0, 220.0)); + rig.press(from); + rig.frames.hold(held); + rig.move_to(from.lerp(to, 0.5)); + rig.move_to(to); + rig.release(to); + rig.frames.hold(Modifiers::NONE); assert!((rig.rect().x1 - right).abs() < 1e-6, "{held:?}: {:?}", rig.rect()); } } diff --git a/crates/ui-canvas/tests/it/canvas/navigate.rs b/crates/ui-canvas/tests/it/canvas/navigate.rs index 87694e16f..bcb8801f4 100644 --- a/crates/ui-canvas/tests/it/canvas/navigate.rs +++ b/crates/ui-canvas/tests/it/canvas/navigate.rs @@ -152,6 +152,42 @@ fn cmd_or_ctrl_with_page_down_scrolls_a_focused_canvas_sideways_on_every_os() { } } +const NEXT_ARTBOARD: &str = "canvasTrial.nextArtboard"; + +/// A page key the app binds to a command runs it ahead of the canvas's page scroll, with nothing focused and with the +/// canvas focused (Page Down goes to the next artboard); an unbound page key still scrolls the view. +#[trial] +fn a_bound_page_key_runs_its_command_and_an_unbound_one_pages_the_canvas() { + let view = Rc::new(Cell::new(CanvasView::new(egui::Rect::ZERO, Point::new(2000.0, 2000.0), 1.0))); + let shown = Rc::clone(&view); + let mut fixture = Fixture::new(move |ui| { + let mut given = shown.get(); + given.rect = ui.available_rect_before_wrap(); + let canvas = Canvas::new("Document").document(Size::new(4000.0, 4000.0)).view(given).show(ui, |_, _| {}); + shown.set(canvas.output.view.unwrap_or(given)); + }); + let binding = Binding::parse("PageDown").expect("the trial's chord parses"); + let catalog = + AppCatalog::new(vec![CommandDef::new(NEXT_ARTBOARD, "Next Artboard", Scope::app()).with_default(binding)], 1).expect("the catalog is valid"); + fixture.commands(CommandInput::new().catalog(catalog)); + fixture.settle(); + let page = |fixture: &mut Fixture, key: Key| { + frame::take_output(fixture.ctx()); + let before = view.get().center; + fixture.key(key, Modifiers::NONE).settle(); + let fired: Vec = frame::take_output(fixture.ctx()).fired.into_iter().map(|fired| fired.command.id).collect(); + (fired, view.get().center != before) + }; + assert_eq!(fixture.focused(), None, "nothing is focused"); + assert_eq!(page(&mut fixture, Key::PageDown), (vec![NEXT_ARTBOARD.to_owned()], false), "unfocused: the bound Page Down runs its command"); + assert_eq!(page(&mut fixture, Key::PageUp), (Vec::new(), true), "unfocused: the unbound Page Up scrolls"); + let canvas = fixture.by_role(Role::CANVAS)[0]; + fixture.click(&canvas); + assert!(fixture.focused().is_some(), "the click focuses the canvas"); + assert_eq!(page(&mut fixture, Key::PageDown), (vec![NEXT_ARTBOARD.to_owned()], false), "focused: the bound Page Down runs its command"); + assert_eq!(page(&mut fixture, Key::PageUp), (Vec::new(), true), "focused: the unbound Page Up scrolls"); +} + #[trial] fn cmd_or_ctrl_with_page_down_on_a_focused_canvas_control_scrolls_the_canvas_sideways() { let view = Rc::new(Cell::new(CanvasView::new(egui::Rect::ZERO, Point::new(2000.0, 2000.0), 1.0))); diff --git a/crates/ui-canvas/tests/it/canvas/tool_keys.rs b/crates/ui-canvas/tests/it/canvas/tool_keys.rs index aab42724d..41eedb0ef 100644 --- a/crates/ui-canvas/tests/it/canvas/tool_keys.rs +++ b/crates/ui-canvas/tests/it/canvas/tool_keys.rs @@ -20,7 +20,7 @@ use craft_ui::dialog::Dialog; use craft_ui::display::Text; use craft_ui::popover::Popover; use craft_ui::primitives::Draw; -use craft_ui::runtime::commands::{self, EditCommands, FireSource}; +use craft_ui::runtime::commands::{self, CommandSet as _, EditCommands, FireSource}; use craft_ui::runtime::frame::take_output; use craft_ui::testing::access::Declared; use craft_ui::testing::focus::{AccessActionKind, key_release}; @@ -169,6 +169,21 @@ fn a_fired_command_whose_key_the_tool_claims_reaches_it_with_nothing_focused() { assert!(take_output(canvas.fixture().ctx()).fired.is_empty(), "no app command ran"); } +/// A command a button fires runs as the button's command, though the tool claims its key: only a menu's or the +/// palette's stands for the key (a toolbar's tool button finishes a gesture the tool holds the keyboard for). +#[trial] +fn a_pointer_fired_command_whose_key_the_tool_claims_runs_as_a_command() { + let mut canvas = ToolFixture::new("Document", Outline::new(true)); + canvas.fixture().settle(); + assert_eq!(canvas.fixture().focused(), None, "nothing is focused"); + take_output(canvas.fixture().ctx()); + assert!(commands::fire(canvas.fixture().ctx(), EditCommands::Delete, FireSource::Pointer), "Delete runs"); + canvas.fixture().settle(); + assert_eq!(canvas.tool().seen, [], "the tool got no Delete"); + let fired = take_output(canvas.fixture().ctx()).fired; + assert!(fired.iter().any(|fired| fired.command.id == EditCommands::Delete.id()), "the app's Delete ran: {fired:?}"); +} + /// A tool that takes every key the host offers it, and the lone Alt tap while `taps`. #[derive(Default)] struct Taker { diff --git a/crates/ui-canvas/tests/it/canvas_controls/task_bar.rs b/crates/ui-canvas/tests/it/canvas_controls/task_bar.rs index 74405a091..6aa85685b 100644 --- a/crates/ui-canvas/tests/it/canvas_controls/task_bar.rs +++ b/crates/ui-canvas/tests/it/canvas_controls/task_bar.rs @@ -6,7 +6,7 @@ use craft_behavior::CanvasView; use craft_behavior::kurbo::{Point, Vec2 as DocVec}; use craft_behavior::overlay::{Align, Side}; use craft_ui::buttons::Button; -use craft_ui::canvas_controls::{TaskBar, TaskBarDismiss, TaskBarPlace}; +use craft_ui::canvas_controls::{TaskBar, TaskBarDismiss, TaskBarGrip, TaskBarHang, TaskBarPlace}; use craft_ui::contract::{Bind, Show as _}; use craft_ui::menu::PanelRow; use craft_ui::runtime::commands::{CommandRef, EditCommands}; @@ -523,3 +523,49 @@ fn a_compact_task_bar_is_smaller_and_shows_every_member_whole() { assert!(button.is_positive() && compact.expand(SLACK).contains_rect(button), "each member shows whole in {compact:?}: {button:?}"); } } + +/// The fill of the bar grip painted inside `grip` among `shapes`. +fn grip_ink(shapes: &[egui::Shape], grip: Rect) -> Option { + shapes.iter().find_map(|shape| match shape { + egui::Shape::Rect(rect) if grip.contains_rect(rect.rect) => Some(rect.fill), + _ => None, + }) +} + +/// The bar grip lights under the pointer and while the bar moves, and goes back to its rest ink after the drop. +#[trial] +fn the_bar_grip_lights_under_the_pointer_and_while_the_bar_moves() { + let scene = scene(); + let mut fixture = fixture_with(&scene, |bar| bar.grip(TaskBarGrip::Bar)); + fixture.settle(); + let grip = fixture.by_label("Move bar").expect("the grip is named"); + let rest = grip_ink(&fixture.frame_shapes(), grip.rect).expect("the grip paints its bar"); + + fixture.frame(vec![moved(grip.center())]).idle(8); + let hovered = grip_ink(&fixture.frame_shapes(), grip.rect); + assert!(hovered.is_some_and(|ink| ink != rest), "the grip lights under the pointer: {hovered:?} against {rest:?}"); + + let by = Vec2::new(-60.0, 30.0); + fixture.drag_hold_at(grip.center(), by); + let moving = grip_ink(&fixture.frame_shapes(), grip.rect.translate(by)); + assert!(moving.is_some_and(|ink| ink != rest), "the grip is lit while the bar moves: {moving:?} against {rest:?}"); + + fixture.release_at(grip.center() + by).frame(vec![moved(grip.center() + by + Vec2::new(0.0, 200.0))]).idle(8); + let dropped = fixture.by_label("Move bar").expect("the grip is named"); + assert_eq!(grip_ink(&fixture.frame_shapes(), dropped.rect), Some(rest), "the grip is back to rest once dropped and left"); +} + +/// A bar hung clear of the handles hangs farther below its anchor than the default, by the handle ring at least. +#[trial] +fn a_bar_clear_of_the_handles_hangs_farther_below_its_anchor() { + let below = |configure: fn(TaskBar<'_>) -> TaskBar<'_>| { + let scene = scene(); + let mut fixture = fixture_with(&scene, configure); + fixture.settle(); + let seen = seen(&scene); + seen.rect.top() - seen.bounds.bottom() + }; + let (default, clear) = (below(|bar| bar), below(|bar| bar.hang_gap(TaskBarHang::ClearOfHandles))); + assert!(default > 0.0, "the bar hangs below its anchor: {default}"); + assert!(clear > default + 2.0 * SLACK, "the bar clear of the handles hangs farther below: {clear} against {default}"); +} diff --git a/crates/ui-contract/src/contract/body.rs b/crates/ui-contract/src/contract/body.rs index 2faac53ce..34dc4a864 100644 --- a/crates/ui-contract/src/contract/body.rs +++ b/crates/ui-contract/src/contract/body.rs @@ -33,7 +33,6 @@ pub use regions::pad_of; #[doc(hidden)] pub use reorder::REORDER_BAND; pub use scroll::{STRIP_BACK, STRIP_FORWARD}; -#[cfg(feature = "suite")] pub(crate) use window::MOVE_BAND; use window::WindowMode; pub use window::grip_band; @@ -128,6 +127,10 @@ pub(super) struct BodyHooks<'b> { /// found it has to run again at (`ColumnGroup::scope_measured`). settle: Option, unsettled: Option, + /// How far the ranked units of an end region that joins the body's fit (`EndRegion::fit`) give way in the + /// measuring run's second sweep, and the body's shortfall a first sweep found. + end_fit: Option, + end_unfit: Option, extent: Option, /// The content extent a measuring run found that leaves another view than the one the run laid the content out /// for: the run lays it out again at that view. @@ -232,6 +235,8 @@ impl<'b> BodyHooks<'b> { reached: None, settle: None, unsettled: None, + end_fit: None, + end_unfit: None, extent: None, view_moves: None, view: None, diff --git a/crates/ui-contract/src/contract/body/hooks.rs b/crates/ui-contract/src/contract/body/hooks.rs index 1c178e9d6..a92e7820e 100644 --- a/crates/ui-contract/src/contract/body/hooks.rs +++ b/crates/ui-contract/src/contract/body/hooks.rs @@ -165,8 +165,9 @@ impl ShapeHooks for BodyHooks<'_> { self.region_gap = gap_of(&env.tokens, Gap::Tight); self.end_gap = gap_of(&env.tokens, props.end.map_or(Gap::Tight, |end| end.gap)); self.header_gap = header_gap_of(props, &env.tokens); - self.after_rule = layout::flow_start(&ctx, env) == Some(true); - self.rules = RuleBands::of(props, &env.tokens, crate::runtime::egui::scale::pixels_per_point(&ctx), self.after_rule); + let start = layout::flow_start(&ctx, env); + self.after_rule = start == Some(true); + self.rules = RuleBands::of(props, env, crate::runtime::egui::scale::pixels_per_point(&ctx), start); self.least_width = least_of(&env.tokens, props.least_width); let quiet = stage.is_peek() || crate::runtime::measure::active(&ctx); if !matches!(props.mount, Mount::Inline | Mount::Pane(_)) @@ -629,7 +630,15 @@ impl ShapeHooks for BodyHooks<'_> { self.label_step(ui, env, cx.core, &mut plan); // B3 body, if open, under the body env; the gate is read after the header changed it. if plan.is_open { + let fits_end = !plan.real && self.end_fit.is_none() && props.end.is_some_and(|end| end.fit); + if fits_end { + layout::ask_shortfall(&plan.ctx, plan.layout_id); + } self.body_step(comp, ui, env, cx.core, &mut plan); + // The end region's ranked units give up the body's shortfall. + if fits_end && let Some(short) = layout::take_shortfall(&plan.ctx, plan.layout_id) { + self.end_unfit = Some(short); + } self.after_body(ui, env, &mut plan); if plan.real && props.end.is_some() { self.end_step(comp, ui, cx, &mut plan); @@ -820,13 +829,44 @@ impl BodyHooks<'_> { (layer, rect): (areas::LayerKey, Rect), values: &AppValues, ) { - if self.props.label_column { + if self.props.end.is_some_and(|end| end.fit) { + self.fitting_sweeps(comp, at, cx, (layer, rect), values); + } else if self.props.label_column { self.settling_sweeps(comp, at, cx, (layer, rect), values); } else { self.sweep(comp, at, cx, (layer, rect), values); } } + /// An end region that joins the body's fit (`EndRegion::fit`) gives way before the body: when the body's units ask + /// for more than the line the region leaves, the sweep is taken back and the content runs once more with the + /// region's first row giving up the body's shortfall by its ranked units, so they leave before a body unit narrows + /// or leaves. + #[inline(never)] + fn fitting_sweeps( + &mut self, + comp: &mut C, + at: &Measuring<'_, '_>, + cx: &mut Cx<'_, C>, + (layer, rect): (areas::LayerKey, Rect), + values: &AppValues, + ) { + let ctx = at.ui.ctx().clone(); + let (unfit, _) = crate::contract::draft( + &ctx, + || { + self.sweep(comp, at, cx, (layer, rect), values); + self.end_unfit.take() + }, + Option::is_none, + ); + if let Some(short) = unfit { + self.end_fit = Some(short); + self.sweep(comp, at, cx, (layer, rect), values); + (self.end_fit, self.end_unfit) = (None, None); + } + } + /// A label group settles its columns before a measure inside stands: when a row of a body that shows at its /// measured width read a column narrower than the group's widest, the sweep is taken back and the content runs /// once more with the group opened at the widths the first sweep found. @@ -1291,7 +1331,8 @@ impl BodyHooks<'_> { ..line }); } - let frame = RegionFrame { id: plan.id, rtl: plan.rtl, node: plan.node, env: &plan.line_env, gap: plan.gap }; + let fitted = self.end_fit.filter(|_| !plan.real).map(|short| plan.line_env.derive_local(|scoped| scoped.rank_short = Some(short))); + let frame = RegionFrame { id: plan.id, rtl: plan.rtl, node: plan.node, env: fitted.as_ref().unwrap_or(&plan.line_env), gap: plan.gap }; let closed = self.end_region(comp, ui, &mut end_cx, &frame, props, end, line); plan.close = plan.close.or(closed); } @@ -1860,8 +1901,9 @@ impl BodyHooks<'_> { self.region_gap = gap_of(&at.env.tokens, Gap::Tight); self.end_gap = gap_of(&at.env.tokens, props.end.map_or(Gap::Tight, |end| end.gap)); self.header_gap = header_gap_of(&props, &at.env.tokens); - self.after_rule = layout::flow_start(at.ui.ctx(), at.env) == Some(true); - self.rules = RuleBands::of(&props, &at.env.tokens, crate::runtime::egui::scale::pixels_per_point(at.ui.ctx()), self.after_rule); + let start = layout::flow_start(at.ui.ctx(), at.env); + self.after_rule = start == Some(true); + self.rules = RuleBands::of(&props, at.env, crate::runtime::egui::scale::pixels_per_point(at.ui.ctx()), start); self.least_width = least_of(&at.env.tokens, props.least_width); self.room = match at.width { Some(width) => Vec2::new(width, props.room_height.unwrap_or(f32::INFINITY)), diff --git a/crates/ui-contract/src/contract/body/regions.rs b/crates/ui-contract/src/contract/body/regions.rs index 1d74217e4..a02bea21b 100644 --- a/crates/ui-contract/src/contract/body/regions.rs +++ b/crates/ui-contract/src/contract/body/regions.rs @@ -3,7 +3,7 @@ use super::BodyHooks; use super::scroll::scroll_of; use crate::contract::cx::BodyCx; -use crate::contract::{Container, ContainerProps, FooterPlace, Gap, HeaderParts, LeastWidth, Mount, Pad, PadEdges, Sizing}; +use crate::contract::{Container, ContainerProps, FooterPlace, Gap, HeaderParts, LeastWidth, Mount, Pad, PadEdges, SectionRhythm, Sizing}; use crate::layout::{ColumnGroup, Columns, Reached}; use crate::primitives::{RectSide, Rule}; use crate::runtime::access::{self}; @@ -70,11 +70,16 @@ pub(super) fn pad_vec(tokens: &UiTokens, pad: Pad, edges: PadEdges) -> Vec2 { /// The room the rules between a container's regions take, in points: the divider rule's width on the display for each /// rule the container draws, none for one it doesn't. Each rule lies in a band of its own, so it shares no pixel with -/// a region's content at any scale. +/// a region's content at any scale. Under `SectionRhythm::Spaced` the rule above a header has room around it. #[derive(Clone, Copy, Debug, Default)] pub(super) struct RuleBands { + /// Before the rule above the header: what makes the gap the container's `Stack` leaves before it up to + /// `space.gap.section`. + pub(super) lead: f32, /// Above a header with `HeaderRegion::rule_above`. pub(super) above: f32, + /// Between the rule above and the header: `space.gap.row`. + pub(super) trail: f32, /// Under a stacked header with `HeaderRegion::rule`, before its gap. pub(super) under: f32, /// Between a footer with `FooterRegion::rule` and the content beside it: over the footer, or under it in the end @@ -85,18 +90,31 @@ pub(super) struct RuleBands { } impl RuleBands { - /// The bands of `props`' rules in `tokens` on a display of `pixels_per_point`. A rule above separates the - /// container from what precedes it in flow: right after a rule (`after_rule`) there is none. - pub(super) fn of(props: &ContainerProps, tokens: &UiTokens, pixels_per_point: f32, after_rule: bool) -> Self { + /// The bands of `props`' rules under `env` on a display of `pixels_per_point`, for a container whose flow start is + /// `start` (`layout::flow_start`). A rule above separates the container from what precedes it in flow: right after + /// a rule there is none, and at its flow's start nothing precedes it to stand off from. + pub(super) fn of(props: &ContainerProps, env: &Env, pixels_per_point: f32, start: Option) -> Self { + let tokens = &env.tokens; let width = rule_look(tokens, RuleKind::Divider).width.points(pixels_per_point); let on = |rule: bool| if rule { width } else { 0.0 }; + let above = on(start != Some(true) && props.header.is_some_and(|header| header.rule_above)); + let spaced = above > 0.0 && env.get::() == SectionRhythm::Spaced; + let gaps = &tokens.tokens().space.gap; + let stack_gap = env.stack_gap.filter(|(body, _)| env.flow_body == Some(*body)).map_or(0.0, |(_, gap)| gap); RuleBands { - above: on(!after_rule && props.header.is_some_and(|header| header.rule_above)), + lead: if spaced && start.is_none() { (gaps.section - stack_gap).max(0.0) } else { 0.0 }, + above, + trail: if spaced { gaps.row } else { 0.0 }, under: on(props.header.is_some_and(|header| header.rule && !header.inline)), footer: on(props.footer.is_some_and(|footer| footer.rule)), end: on(props.end.is_some_and(|end| end.rule)), } } + + /// The band of the rule above the header with the room around it. + pub(super) fn above_band(&self) -> f32 { + self.lead + self.above + self.trail + } } /// Whether a ruled footer's rule lies under it: a footer at the top of the end region separates itself from the end @@ -405,7 +423,7 @@ impl<'b> BodyHooks<'b> { let end_h = sizes.end.map_or(0.0, |end| end.y) + if in_end { footer_h } else { 0.0 }; // An inline header takes no height of its own: the line is as high as the taller of header and body. A rule // above the header takes its band either way. - let stacked_h = self.rules.above + if inline { 0.0 } else { header_h + self.header_space(header_h) }; + let stacked_h = self.rules.above_band() + if inline { 0.0 } else { header_h + self.header_space(header_h) }; let top = inner.min.y + stacked_h; // Along an axis the container is not given, its body is offered the room the container was offered and the // container takes what the body took. @@ -457,7 +475,7 @@ impl<'b> BodyHooks<'b> { let width = if rtl && !width.is_finite() { crate::contract::MAX_EXTENT } else { width }; let (left, right) = if rtl { (inner.max.x - width, inner.max.x) } else { (inner.min.x, inner.min.x + width) }; let band = |top: f32, bottom: f32| Rect::from_min_max(Pos2::new(left, top), Pos2::new(right, bottom.max(top))); - let header_top = inner.min.y + self.rules.above; + let header_top = inner.min.y + self.rules.above_band(); let header = band(header_top, if props.header.is_some() { header_top + header_h.max(0.0) } else { header_top }); let mut body = band(top, bottom); let header = if inline { @@ -476,7 +494,7 @@ impl<'b> BodyHooks<'b> { header }; let across = |top: f32, width: f32| (width > 0.0).then(|| (Rect::from_x_y_ranges(inner.x_range(), top..=top + width), RectSide::Top)); - let above = across(inner.min.y, self.rules.above); + let above = across(inner.min.y + self.rules.lead, self.rules.above); let under = if inline { None } else { across(header.max.y, self.rules.under) }; // The end region keeps the width it measured (with a footer in it, the wider of the two) and takes the end // edge; the body takes the rest. Before its first measure it spans the line and the body keeps its width. diff --git a/crates/ui-contract/src/contract/body/size.rs b/crates/ui-contract/src/contract/body/size.rs index 291dda3b8..fb634c843 100644 --- a/crates/ui-contract/src/contract/body/size.rs +++ b/crates/ui-contract/src/contract/body/size.rs @@ -57,6 +57,7 @@ pub(crate) struct EnvFacts { given_column: bool, unbounded: (bool, bool), row_room: Option, + rank_short: Option, row_line: Option, offered: Option, measure: Option, @@ -77,6 +78,7 @@ impl EnvFacts { given_column: env.given_column, unbounded: env.unbounded, row_room: env.row_room, + rank_short: env.rank_short, row_line: env.row_line, offered: env.offered, measure: env.measure, @@ -269,7 +271,7 @@ impl<'b> BodyHooks<'b> { } else { ((line.x + gap(end.x, end_gap)).max(across.x), line.y.max(end.y) + across.y) }; - let above = self.rules.above; + let above = self.rules.above_band(); if inline { Vec2::new(width, height + above) } else { diff --git a/crates/ui-contract/src/contract/container.rs b/crates/ui-contract/src/contract/container.rs index cf5d2c5d6..502851b41 100644 --- a/crates/ui-contract/src/contract/container.rs +++ b/crates/ui-contract/src/contract/container.rs @@ -307,6 +307,20 @@ pub enum HeaderEdge { End, } +/// The room around the rule above a header ([`HeaderRegion::rule_above`]), as a `Section` has. An app sets it once at its +/// root (`RootEnv::values`); the default is `Tight`. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::runtime::env::EnvValue, crate::contract::MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum SectionRhythm { + /// The rule takes the gap its flow leaves before the container, and the header follows it at once. + #[default] + Tight, + /// The rule stands `space.gap.section` below what precedes it in its `Stack`, in place of the stack's gap (no room + /// at its flow's start), and the header `space.gap.row` below it: production VectorCraft's panel sections. + Spaced, +} + /// A header region, filled by `Container::header`. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[non_exhaustive] @@ -492,12 +506,22 @@ pub struct EndRegion { /// Whether a rule separates the end region from the body, in a band of its own along the region's edge that /// faces it. pub rule: bool, + /// Whether the region joins the body's fit: when the body's units ask for more than the line the region leaves, + /// the region's units that carry a `fit_rank` leave first, lowest rank first, until the body's units fit at their + /// ideal widths, before any body unit narrows or leaves. + pub fit: bool, } impl EndRegion { /// An end region as high as the line, `space.gap.tight` from the body, with no rule. pub const fn new() -> Self { - EndRegion { full_height: false, gap: Gap::Tight, rule: false } + EndRegion { full_height: false, gap: Gap::Tight, rule: false, fit: false } + } + + /// Whether the region joins the body's fit. + pub const fn fit(mut self, on: bool) -> Self { + self.fit = on; + self } /// Whether a rule separates the end region from the body. diff --git a/crates/ui-contract/src/contract/cx/body.rs b/crates/ui-contract/src/contract/cx/body.rs index ac8624c33..470504255 100644 --- a/crates/ui-contract/src/contract/cx/body.rs +++ b/crates/ui-contract/src/contract/cx/body.rs @@ -84,6 +84,13 @@ impl<'a> BodyCx<'a> { self.field_message.clone() } + /// Whether a drag of the container's move band (`DragBand::Move`) moves its layer in this pass, from the pass the + /// drag starts to the one before its release: a grip in the body shows the move. + pub fn moving(&self) -> bool { + let band = crate::primitives::sensing::part_press(self.memory.ctx(), self.resolved.id, crate::contract::MOVE_BAND.into()); + matches!(band.press.phase, craft_behavior::PressPhase::DragStart { .. } | craft_behavior::PressPhase::Drag { .. }) + } + /// Whether the body is open. pub fn is_open(&self) -> bool { *self.open diff --git a/crates/ui-contract/src/contract/cx/pointer.rs b/crates/ui-contract/src/contract/cx/pointer.rs index f7dc0b3cc..9f31c1299 100644 --- a/crates/ui-contract/src/contract/cx/pointer.rs +++ b/crates/ui-contract/src/contract/cx/pointer.rs @@ -197,7 +197,8 @@ impl Pointer for CxCore<'_> { let op = drag::current_operation(&self.ctx, craft_behavior::CopyKeys::Alt); let drop = target.accept(&payload, op)?; let ordinal = drag::next_ordinal(&self.ctx, self.id); - drag::register(&self.ctx, self.id, self.response.layer_id, target.mark(&drop), op, self.env.shared_tokens(), true, target.under_modal()); + let reach = drag::TargetReach { window: true, under_modal: target.under_modal() }; + drag::register(&self.ctx, self.id, self.response.layer_id, target.mark(&drop), op, self.env.shared_tokens(), reach); drag::take_drop(&self.ctx, self.id, ordinal, op, TypeId::of::

()).then_some(drop) } diff --git a/crates/ui-contract/src/contract/items/hooks.rs b/crates/ui-contract/src/contract/items/hooks.rs index 7039260b8..f25092d50 100644 --- a/crates/ui-contract/src/contract/items/hooks.rs +++ b/crates/ui-contract/src/contract/items/hooks.rs @@ -8,8 +8,7 @@ use super::{Held, ITEM_NODE, ItemsHooks, LastLayout, Lead, Placement, Renaming, use super::{request, rows}; use crate::contract::ValueOf; use crate::contract::collection::{ - CollectionEvent, CollectionProps, ColumnLayout, ContextMenuRequest, DropAt, Gestures, HoverLead, ItemsOut, OpenChange, PendingDrop, Rename, - RowState, ShownRow, + CollectionEvent, CollectionProps, ColumnLayout, DropAt, Gestures, HoverLead, ItemsOut, PendingDrop, Rename, RowState, ShownRow, }; use crate::contract::cx::{BodyCx, CxCore, Pointer as _}; use crate::contract::run::{Measuring, ShapeHooks, ShowAt}; @@ -644,16 +643,7 @@ impl ShapeHooks for ItemsHooks<'_, '_, C> { if let Some(row) = shown_rows.last_mut() { row.openers = self.item_openers(&row_ui, &ctx, id, cx.core.resolved.enabled, openers); } - if let Some(ask) = out.open_request() { - self.events.push(CollectionEvent::Open(OpenChange { key: key.clone(), open: ask.open, all: ask.all })); - } - if let Some(rect) = out.menu_request() { - crate::runtime::keys::request_context(&ctx, id, rect, None); - self.ask_menu(ContextMenuRequest { key: key.clone(), at: self.on_screen(rect.left_bottom()), column: None, part: None }); - } - if let Some(event) = out.into_event() { - self.events.push(CollectionEvent::Item(key.clone(), event)); - } + self.report_item_output(&ctx, id, &key, out); if state.renaming { self.rename_row(comp, &mut row_ui, (&ctx, id, rtl), (at, &key), label); } diff --git a/crates/ui-contract/src/contract/items/members.rs b/crates/ui-contract/src/contract/items/members.rs index 72b61d910..405d60dcc 100644 --- a/crates/ui-contract/src/contract/items/members.rs +++ b/crates/ui-contract/src/contract/items/members.rs @@ -2,7 +2,7 @@ //! arena, updated, painted and finished at their rows, reported as sub-nodes of the collection. use super::{ITEM_NODE, ItemsHooks, key_hash}; -use crate::contract::collection::{CollectionEvent, ContextMenuRequest, OpenChange, ShownRow}; +use crate::contract::collection::ShownRow; use crate::contract::run; use crate::contract::{Collection, Component as _, Cx, Internal, ItemOpener, ItemOutput as _, Meta as _}; use crate::primitives::sensing::{self, MemberSpec}; @@ -87,16 +87,7 @@ impl<'r, C: Collection> ItemsHooks<'_, 'r, C> { shown.openers = self.item_openers(ui, ctx, id, enabled, openers); } let label = output.label_rect().unwrap_or(row); - if let Some(ask) = output.open_request() { - self.events.push(CollectionEvent::Open(OpenChange { key: key.clone(), open: ask.open, all: ask.all })); - } - if let Some(rect) = output.menu_request() { - crate::runtime::keys::request_context(ctx, id, rect, None); - self.ask_menu(ContextMenuRequest { key: key.clone(), at: self.on_screen(rect.left_bottom()), column: None, part: None }); - } - if let Some(event) = output.into_event() { - self.events.push(CollectionEvent::Item(key.clone(), event)); - } + self.report_item_output(ctx, id, &key, output); if renaming { self.rename_row(comp, ui, (ctx, id, rtl), (at, &key), label); } diff --git a/crates/ui-contract/src/contract/items/press.rs b/crates/ui-contract/src/contract/items/press.rs index df7c59977..cf6819543 100644 --- a/crates/ui-contract/src/contract/items/press.rs +++ b/crates/ui-contract/src/contract/items/press.rs @@ -3,8 +3,8 @@ use super::drag::SlowClick; use super::lead::PickBy; use super::{ItemsHooks, Placement, RowPress, SECTION}; -use crate::contract::collection::{ActivateOn, CollectionEvent, CollectionProps, ContextMenuRequest, LeadSource, RowPressed, SelectMode}; -use crate::contract::{Collection, Cx, ItemOpener}; +use crate::contract::collection::{ActivateOn, CollectionEvent, CollectionProps, ContextMenuRequest, LeadSource, OpenChange, RowPressed, SelectMode}; +use crate::contract::{Collection, Cx, ItemOpener, ItemOutput}; use crate::runtime::egui::response; use crate::runtime::env::ArenaId; use crate::runtime::focus; @@ -380,6 +380,20 @@ impl ItemsHooks<'_, '_, C> { self.events.push(CollectionEvent::ContextMenu(request)); } + /// Reports what the shown item `key` asked for: opening or closing its children, its menu, and its event. + pub(super) fn report_item_output(&mut self, ctx: &Context, id: Id, key: &C::Key, output: impl ItemOutput) { + if let Some(ask) = output.open_request() { + self.events.push(CollectionEvent::Open(OpenChange { key: key.clone(), open: ask.open, all: ask.all })); + } + if let Some(rect) = output.menu_request() { + crate::runtime::keys::request_context(ctx, id, rect, None); + self.ask_menu(ContextMenuRequest { key: key.clone(), at: self.on_screen(rect.left_bottom()), column: None, part: None }); + } + if let Some(event) = output.into_event() { + self.events.push(CollectionEvent::Item(key.clone(), event)); + } + } + /// The response of each part an item asked to open a menu from (`ItemCx::part_opener`). pub(super) fn item_openers(&self, ui: &Ui, ctx: &Context, id: Id, enabled: bool, openers: Vec) -> Vec<(ItemOpener, egui::Response)> { item_openers(ui, ctx, id, enabled, openers) diff --git a/crates/ui-contract/src/contract/label.rs b/crates/ui-contract/src/contract/label.rs index b10a44bcb..236d7bf1a 100644 --- a/crates/ui-contract/src/contract/label.rs +++ b/crates/ui-contract/src/contract/label.rs @@ -13,5 +13,7 @@ mod step; pub use leaf::colon_of; pub(crate) use place::{control_after, label_gap}; pub(crate) use props::inside; -pub use props::{CaptionColumn, CellWidth, FieldLayout, GlyphLabel, InsideLabel, LabelKind, LabelPress, LabelScheme, Scrub, SideLabel}; +pub use props::{ + CaptionColumn, CellWidth, FieldLayout, GlyphColon, GlyphLabel, InsideLabel, LabelKind, LabelPress, LabelScheme, LinkLabelInk, Scrub, SideLabel, +}; pub(crate) use step::{LabelIn, LeafLabel, Trailing, flow_leaf, in_column, leaf, leaf_under, report_after_reach, run, show_leaf_in_flow}; diff --git a/crates/ui-contract/src/contract/label/leaf.rs b/crates/ui-contract/src/contract/label/leaf.rs index 671948bf9..62274da56 100644 --- a/crates/ui-contract/src/contract/label/leaf.rs +++ b/crates/ui-contract/src/contract/label/leaf.rs @@ -1,6 +1,6 @@ //! The side label as a leaf component: its node, press state, reset dot and colon. -use super::props::{FieldLayout, Glyph, LabelKind, LabelScheme}; +use super::props::{FieldLayout, Glyph, GlyphColon, LabelKind, LabelScheme, LinkLabelInk}; use super::step::LabelIn; use crate::contract::InBar; use crate::contract::{Component, Props}; @@ -174,10 +174,13 @@ impl Component for LabelLeaf { name: { let text = &cx.tokens.color.text; let (role, ink) = if key.after { (TypeRole::Body, text.normal) } else { (TypeRole::Label, text.muted) }; - if key.link { + let neutral = cx.env::() == LinkLabelInk::Neutral; + if key.link && !neutral { // A link label keeps its role, so it takes the room of the caption it is, in the link's ink. TextLook { role, ..cx.link_look(true) } } else { + // A neutral link label reads in the body ink; its underline still marks it. + let ink = if key.link { text.normal } else { ink }; let (ink, off) = (cx.color(ink), cx.color(text.disabled)); TextLook::new(role, Stateful::new(ink).off(States::new(ink, ink, ink, off))) } @@ -411,18 +414,20 @@ impl Component for LabelLeaf { } /// The colon a beside label draws after its shown text in a form (`LabelScheme::Form`), unless that text ends in one: -/// a text label's, and in a bar a glyph text's as well ("X:"). An inspector's labels draw none. The label's node and -/// the control keep the name as given. +/// a text label's, in a bar a glyph text's as well ("X:"), and under `GlyphColon::Form` a glyph caption's. An +/// inspector's labels draw none. The label's node and the control keep the name as given. pub(super) fn colon(env: &Env, input: &LabelIn<'_>) -> Option { if input.side.layout != FieldLayout::Beside || env.values.get::() == LabelScheme::Inspector { return None; } let text = match &input.side.kind { LabelKind::Text | LabelKind::Short(_) => env.view().resolve(input.side.kind.shown(input.text)), - LabelKind::Glyph(glyph) if env.values.get::().0 => match glyph.resolved(env.view()) { - Glyph::Text(text) => text, - Glyph::Icon(_) => return None, - }, + LabelKind::Glyph(glyph) if env.values.get::().0 || (glyph.caption && env.values.get::() == GlyphColon::Form) => { + match glyph.resolved(env.view()) { + Glyph::Text(text) => text, + Glyph::Icon(_) => return None, + } + } _ => return None, }; if text.as_str().is_empty() || text.as_str().ends_with([':', '\u{ff1a}']) { diff --git a/crates/ui-contract/src/contract/label/props.rs b/crates/ui-contract/src/contract/label/props.rs index 07d50ddcc..8e5785bc8 100644 --- a/crates/ui-contract/src/contract/label/props.rs +++ b/crates/ui-contract/src/contract/label/props.rs @@ -48,17 +48,26 @@ pub(super) enum Glyph { #[derive(Clone, Debug, PartialEq)] pub struct GlyphLabel { shown: Glyph, + /// The text stands for a word caption ([`GlyphLabel::caption`]). + pub(super) caption: bool, } impl GlyphLabel { /// Shows `icon`, as large as the control's icons. pub fn icon(icon: impl Into>) -> Self { - GlyphLabel { shown: Glyph::Icon(icon.into()) } + GlyphLabel { shown: Glyph::Icon(icon.into()), caption: false } } /// Shows `text`, resolved in the scope's language. pub fn text(text: impl Into

, Rect, &mut Ui, &mut BodyCx<'_>) + 'a, ) -> DockColumnOutput

{ - let (column, spec, auto_collapse, edge, own, arrow) = (self.column, self.spec, self.auto_collapse, self.edge, self.bar, self.arrow); + let (column, spec, auto_collapse, edge, own, arrow, card) = + (self.column, self.spec, self.auto_collapse, self.edge, self.bar, self.arrow, self.card); let mut bar = BarRecord::default(); let shown = &mut bar; let body = move |ui: &mut Ui, body: &mut BodyCx<'_>| { - let Some(sizes) = body.style::>().map(|style| style.sizes) else { return }; + let Some(style) = body.style::>() else { return }; + let sizes = style.sizes; + let inner = card_rect(body.rect, card, &sizes, edge, body.env.direction().is_rtl()); + if inner != body.rect { + // The groups' own surfaces keep to the card's rounded corners. + crate::primitives::frame_surfaces(ui, inner, style.card.radius); + } // The bar and the groups at the heights this pass's drag leaves them, in the measuring run and the real // run alike: the same plan `parts` lays out, so the dividers sit at the seams. let drags = |key: u64, divider: &Divider| divider::drag(body.part_press(DIVIDER.at(key)).phase, body.rect, false, divider); - let plan = column_plan(column, spec, body.rect, own, &sizes, drags); + let plan = column_plan(column, spec, inner, own, &sizes, drags); if own == ColumnBar::Own { let band = bar_band(ui, plan.bar, edge); *shown = show_bar(ui, band, true, auto_collapse, arrow, false, column_grip(column, spec, body)); @@ -272,9 +287,12 @@ impl<'a, P: Value + Hash + Debug + 'static> DockColumn<'a, P> { } /// The divider on the column's inner edge, which moves between the width bounds of its panels, or of its steps - /// for a stepped column ([`stepped`](super::stepped)), whose host takes the width as whole steps. + /// for a stepped column ([`stepped`](super::stepped)), whose host takes the width as whole steps; a card's inset + /// on top. fn edge_divider(&self, rect: Rect, sizes: &DockSizes) -> Divider { let (least, most) = sizes.shown_bounds(self.column, self.spec); + let inset = self.card.unwrap_or(0.0); + let (least, most) = (least + inset, most + inset); Divider::column_edge(rect, self.edge, (least, most.min((self.within.width() - sizes.least_pane).max(rect.width()))), sizes.reach) } @@ -286,11 +304,42 @@ impl<'a, P: Value + Hash + Debug + 'static> DockColumn<'a, P> { } } + /// Where the column's bar and groups sit in `rect`: inside its card, if it shows as one. + fn inner(&self, rect: Rect, rtl: bool, sizes: &DockSizes) -> Rect { + card_rect(rect, self.card, sizes, self.edge, rtl) + } + fn anchor(&self, group: usize) -> Option<&P> { self.column.groups.get(group).and_then(|group| group.panels.first()) } } +/// The card of a docked column in `rect`, the column's rect in a dock on the window edge `edge`: `rect` inset by +/// `card`, the card's outer inset ([`DockSizes::card_inset`]), on its outer side, the one towards `edge`, and by +/// [`DockSizes::card`] on its top and bottom; `rect` for a column that is no card. +pub(crate) fn card_rect(rect: Rect, card: Option, sizes: &DockSizes, edge: DockEdge, rtl: bool) -> Rect { + let Some(outer) = card else { return rect }; + let inner = rect.shrink2(egui::vec2(0.0, sizes.card)); + if (edge == DockEdge::Start) != rtl { inner.with_min_x(inner.left() + outer) } else { inner.with_max_x(inner.right() - outer) } +} + +/// The look of a docked column's card ([`DockConfig::column_cards`](super::DockConfig::column_cards)): `surface.panel` +/// with `shape.radius.surface` corners and no edge. +pub(crate) fn card_style(cx: &StyleCx<'_>) -> SurfaceStyle { + SurfaceStyle { radius: UiTokens::corner(cx.tokens.shape.radius.surface), edge: SurfaceEdge::None, shadow: None, ..cx.surface(SurfaceKind::Panel) } +} + +/// Paints a column in `rect` whose content sits in `card`: the card over the dock's background where the column is +/// one, else the column's panel surface. +pub(crate) fn paint_card(ui: &mut PaintUi<'_>, rect: Rect, card: Rect, style: &SurfaceStyle) { + if card == rect { + ui.draw().surface(rect, SurfaceKind::Panel, Corners::All); + } else { + ui.draw().surface(rect, SurfaceKind::Background, Corners::None); + ui.draw().surface_styled(card, style); + } +} + /// Where the groups of `column` sit in `rect`, the column's rect with its bar `bar`, as the column lays them out while /// no divider between them is dragged. pub fn group_rects

(column: &Column

, spec: &dyn Fn(&P) -> PanelSpec, rect: Rect, bar: ColumnBar, sizes: &DockSizes) -> Vec { @@ -364,6 +413,12 @@ impl Plan { /// The divider after each open group but the last: its part index (the group above it), its position among the open /// groups and the divider. + /// The room the dividers between the groups take in the column's `rect`: the body, inside the column's card if it + /// shows as one, in the frame of `rect` mirrored for right-to-left that dividers are declared in. + fn divider_room(&self, rect: Rect, rtl: bool) -> Rect { + Flow::new(rect, rtl).to_physical(self.body) + } + fn dividers(&self, rect: Rect, reach: f32) -> Vec<(u64, usize, Divider)> { let row = self.row(); self.open @@ -390,7 +445,7 @@ impl Component for DockColumn<'_, P> { } fn style(cx: &StyleCx<'_>, _: DockColumnStyleKey

) -> DockColumnStyle { - DockColumnStyle { metrics: Metrics::new(), sizes: DockSizes::style(cx) } + DockColumnStyle { metrics: Metrics::new(), sizes: DockSizes::style(cx), card: card_style(cx) } } fn sense(&self) -> Sense { @@ -401,13 +456,13 @@ impl Component for DockColumn<'_, P> { /// column in a floating window has the group dividers only. fn parts(&mut self, rect: Rect, cx: &mut PartsCx<'_, Self>) { let sizes = cx.style.sizes; - let plan = column_plan(self.column, self.spec, rect, self.bar, &sizes, |_, _| None); + let plan = column_plan(self.column, self.spec, self.inner(rect, cx.flow.is_rtl(), &sizes), self.bar, &sizes, |_, _| None); if self.bar == ColumnBar::Own && self.arrow.shown() { let (chevron, _) = bar_slots(plan.bar, self.edge, cx.flow.is_rtl()); let name = self.arrow.name(&cx.words::(), true); let _ = cx.part(CHEVRON, chevron).sense(Sense::CLICK | Sense::FOCUS).focusable().tooltip(name); } - let dividers = plan.dividers(rect, sizes.reach); + let dividers = plan.dividers(plan.divider_room(rect, cx.flow.is_rtl()), sizes.reach); for (key, _, divider) in dividers { divider::declare(cx, rect, DIVIDER, key, ÷r); } @@ -423,8 +478,9 @@ impl Component for DockColumn<'_, P> { let own = self.bar == ColumnBar::Own; self.collapse = own && self.arrow.shown() && cx.part_activated(CHEVRON).is_some(); let Some(base) = self.laid.take() else { return }; - let mut plan = column_plan(self.column, self.spec, rect, self.bar, &sizes, |key, divider| divider::pointer(cx, DIVIDER, key, divider)); - let dividers = base.dividers(rect, sizes.reach); + let inner = self.inner(rect, rtl, &sizes); + let mut plan = column_plan(self.column, self.spec, inner, self.bar, &sizes, |key, divider| divider::pointer(cx, DIVIDER, key, divider)); + let dividers = base.dividers(base.divider_room(rect, rtl), sizes.reach); let keyed: Vec<(u64, Divider)> = dividers.iter().map(|(key, _, divider)| (*key, *divider)).collect(); if let Some((key, coord)) = divider::keys(cx, DIVIDER, &keyed, sizes.step, sizes.jump) && let Some((_, index, divider)) = dividers.iter().find(|(at, ..)| *at == key) @@ -455,9 +511,13 @@ impl Component for DockColumn<'_, P> { fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { let Some(plan) = self.laid.as_ref() else { return }; // Painted here, not as the container's surface, which lies over what `paint` draws. - ui.draw().surface(cx.rect, SurfaceKind::Panel, Corners::All); + let card = self.inner(cx.rect, cx.flow.is_rtl(), &cx.style.sizes); + paint_card(ui, cx.rect, card, &cx.style.card); if self.bar == ColumnBar::Own { - ui.draw().surface(plan.bar, SurfaceKind::Background, Corners::None); + // A card's bar is part of the card. + if card == cx.rect { + ui.draw().surface(plan.bar, SurfaceKind::Background, Corners::None); + } if self.arrow.shown() { paint_chevron(ui, self.edge, self.arrow, true, cx.flow.is_rtl(), &cx.words::()); } @@ -473,7 +533,10 @@ impl Component for DockColumn<'_, P> { } return; } - ui.draw().surface(cx.rect, SurfaceKind::Frame, Corners::None); + // A card has no frame. + if self.card.is_none() { + ui.draw().surface(cx.rect, SurfaceKind::Frame, Corners::None); + } for pair in plan.open.windows(2) { ui.face(DIVIDER.at(pair[0] as u64), Splitter::new(Axis::Y)); } @@ -487,7 +550,7 @@ impl Component for DockColumn<'_, P> { let words = cx.words::(); let sizes = cx.style.sizes; let Some(plan) = self.laid.as_ref() else { return }; - for (key, _, divider) in plan.dividers(cx.rect, sizes.reach) { + for (key, _, divider) in plan.dividers(plan.divider_room(cx.rect, cx.flow.is_rtl()), sizes.reach) { divider::describe(access, DIVIDER, key, ÷r, words.resize.as_str(), sizes.step); } if self.bar == ColumnBar::Own { diff --git a/crates/ui-panels/src/docking/dock_column/stories.rs b/crates/ui-panels/src/docking/dock_column/stories.rs index 9e7409a50..ef8d5f3b0 100644 --- a/crates/ui-panels/src/docking/dock_column/stories.rs +++ b/crates/ui-panels/src/docking/dock_column/stories.rs @@ -1,12 +1,22 @@ //! Stories of `DockColumn`. -use crate::contract::ShowContainer as _; -use crate::docking::{ColumnBar, DockColumn, PanelSpec}; +use crate::contract::{ShowContainer as _, Tracked}; +use crate::docking::{ColumnBar, DockColumn, DockGrid, DockSizes, PanelSpec}; +use crate::rails::tool::stories::{BRUSH, tools}; +use crate::rails::{LastUsed, RailDensity, ToolRail, ToolSlot}; +use crate::runtime::env::Env; use crate::sections::Panel; use crate::testing::memory::global; use crate::testing::{Drive, StoryData, StoryOutput, story}; +use craft_behavior::Flow; use craft_behavior::dock::{Column, Group}; -use egui::Ui; +use egui::{Ui, UiBuilder}; + +/// The height of the card stories' columns. +const CARD_HEIGHT: f32 = 160.0; + +/// The width of the panel card story's column, before its card's inset. +const CARD_WIDTH: f32 = 240.0; fn spec(panel: &u8) -> PanelSpec { PanelSpec::new(format!("Panel {panel}")) @@ -36,3 +46,54 @@ fn in_a_floating_window(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { }) .into() } + +/// A docked column of a tool rail at the window edge shown as a card (`DockConfig::column_cards`), at each rail density +/// and one or two steps: inset on its outer, top and bottom sides, where the dock's background shows, with its bar and +/// its rail on the rounded panel card. The column is wider than its steps by the inset. +#[story(DockColumn<'static, u8>, covers = [], drive = Drive::Never)] +fn a_tool_rail_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let density = *data.choice("density", RailDensity::Dense, &[("Regular", RailDensity::Regular), ("Dense", RailDensity::Dense)]); + let steps = *data.ranged("steps", 1_u16, 1.0..=2.0); + let slots = Tracked::new((0..4_u8).map(|slot| ToolSlot::new(u32::from(slot), tools(&[slot]))).collect::>()); + let last = Tracked::new(LastUsed::default()); + let cells = slots.len(); + let spec = move |_: &u8| PanelSpec::new("Tools").grid(DockGrid::rail(cells).density(density)); + let column = Column::new(vec![Group::new(vec![0], 0)]).with_steps(steps); + let sizes = DockSizes { column_cards: true, ..DockSizes::of_scope(ui) }; + let width = sizes.natural(std::slice::from_ref(&column), &spec).first().map_or(0.0, |(width, _)| *width); + let room = Flow::new(ui.available_rect_before_wrap(), Env::of(ui).direction.is_rtl()).span(0.0, width); + let rect = room.with_max_y(room.top() + CARD_HEIGHT); + // The column takes the cell a dock gives it, as high as the dock, whatever its rail's height. + let shown = DockColumn::new("Panels", global("dock column", "rail card story"), &column, &spec).card(sizes.card_inset(0)).show_groups_at( + ui, + rect, + |_, rect, ui, _| { + let rail = ToolRail::new("Tools", &slots, &BRUSH, &last).density(density); + ui.scope_builder(UiBuilder::new().max_rect(rect), |ui| rail.show_rail(ui, |_, _| {})); + }, + ); + ui.advance_cursor_after_rect(rect); + shown.into() +} + +/// A docked panel column of two groups shown as a card (`DockConfig::column_cards`), at the window edge or inward of +/// another column: inset on its top and bottom, and on its outer side by the window edge's inset or by the gutter +/// between two cards, its bar and groups on the rounded panel card with no frame. +#[story(DockColumn<'static, u8>, covers = [], drive = Drive::Never)] +fn a_panel_column_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let at = *data.choice("place", 0_usize, &[("At the window edge", 0), ("Inward of another column", 1)]); + let column = Column::new(vec![Group::new(vec![0, 1], 0), Group::new(vec![2], 0)]); + let inset = DockSizes { column_cards: true, ..DockSizes::of_scope(ui) }.card_inset(at); + let room = Flow::new(ui.available_rect_before_wrap(), Env::of(ui).direction.is_rtl()).span(0.0, CARD_WIDTH + inset); + let rect = room.with_max_y(room.top() + 2.0 * CARD_HEIGHT); + let shown = DockColumn::new("Panels", global("dock column", "panel card story"), &column, &spec).card(inset).show_groups_at( + ui, + rect, + |group, rect, ui, _| { + let title = group.active_panel().map_or_else(String::new, |panel| spec(panel).label.as_str().to_owned()); + Panel::new(title).show_at(ui, rect, |_, _| ()); + }, + ); + ui.advance_cursor_after_rect(rect); + shown.into() +} diff --git a/crates/ui-panels/src/docking/flyout.rs b/crates/ui-panels/src/docking/flyout.rs index 8b62c56a1..645360fbc 100644 --- a/crates/ui-panels/src/docking/flyout.rs +++ b/crates/ui-panels/src/docking/flyout.rs @@ -90,13 +90,18 @@ impl Flyout { let bounded = self.within.is_finite(); let least = if bounded { self.least.min(self.within.size().max(Vec2::ZERO)) } else { self.least }; // A float place as well as the caller's position: the placement pins no edge, so the edge set alone decides - // the grips. + // the grips. The host's binding opens and closes the flyout, so a command leaves it open. let overlay = Overlay::popover() .place(Place::Float(FloatPlace::at(top_left))) .placed_at(top_left) .size_limits(SizeLimits::at_least(least)) .resize_edges(free.union(ResizeEdges::TOP).union(ResizeEdges::BOTTOM)) - .dismiss(Dismiss::new().outside(if self.auto_collapse { Outside::Close } else { Outside::Keep }).focus_left(self.auto_collapse)) + .dismiss( + Dismiss::new() + .outside(if self.auto_collapse { Outside::Close } else { Outside::Keep }) + .focus_left(self.auto_collapse) + .commands(false), + ) .body_scroll(false); if bounded { overlay.bounds(self.within) } else { overlay } } diff --git a/crates/ui-panels/src/docking/group.rs b/crates/ui-panels/src/docking/group.rs index f6cf1c585..16184feac 100644 --- a/crates/ui-panels/src/docking/group.rs +++ b/crates/ui-panels/src/docking/group.rs @@ -21,7 +21,7 @@ use crate::runtime::focus::{self, FocusTarget}; use crate::runtime::memory::sub; use crate::sections::FooterBar; use crate::style::{ComponentStyle, Corners, RuleLook, RuleWidth, StyleColor, StyleCx, SurfaceKind, TypeRole}; -use crate::tabs::{Tab, TabKind, TabStrip, TornOff}; +use crate::tabs::{PanelTabLook, Tab, TabKind, TabStrip, TornOff}; use craft_behavior::{CursorIcon, CursorPriority, DockSide, IconId, Metrics, PartKey, PressPhase, Sense, keyed}; use craft_theme::{ControlSize, GripMark, GripShape, Tokens}; use egui::{Id, Pos2, Rect, Response, Ui, Vec2}; @@ -347,6 +347,9 @@ pub struct DockGroup<'a, P: Clone + Hash + Send + Sync + 'static> { /// The wheel over the tabs shows the next or previous panel, one per wheel notch. #[prop(flag)] wheel_selects_tabs: bool, + /// The look of the tabs ([`DockConfig::tab_look`](super::DockConfig::tab_look)). + #[prop] + tab_look: PanelTabLook, /// The header shows the shown panel's title (with its count) and a close button in place of the tab strip, as a /// single titled panel does: the panels are shown from a rail, not by tabs. #[prop(flag)] @@ -368,6 +371,9 @@ pub struct DockGroup<'a, P: Clone + Hash + Send + Sync + 'static> { /// Whether the panel menu button shows beside the tabs; a context request on a tab opens the menu either way. #[prop] panel_menu_shown: bool, + /// The panel menu button's icon: `more` unless the dock gives another (`DockConfig::panel_menu_icon`). + #[prop] + panel_menu_icon: IconId, /// The state of each panel command for the shown panel, published in the group's scope every pass. #[prop] command_states: Vec<(DockCommands, CommandState)>, @@ -399,12 +405,14 @@ impl<'a, P: Clone + Hash + Send + Sync + PartialEq + Debug + 'static> DockGroup< movable: true, closable: false, wheel_selects_tabs: false, + tab_look: PanelTabLook::Plain, titled: false, dock: None, zones: ZoneRule::Fraction, in_window: false, menu: None, panel_menu_shown: true, + panel_menu_icon: IconId::new("more"), command_states: Vec::new(), extra: None, footer: None, @@ -429,8 +437,8 @@ impl<'a, P: Clone + Hash + Send + Sync + PartialEq + Debug + 'static> DockGroup< } /// The panel menu button's face. - fn menu_face(name: Label) -> IconButton<'static> { - IconButton::new(IconId::new("more")).size(ControlSize::Sm).popup(PopupKind::Menu).label(name) + fn menu_face(&self, name: Label) -> IconButton<'static> { + IconButton::new(self.panel_menu_icon.clone()).size(ControlSize::Sm).popup(PopupKind::Menu).label(name) } /// Starts a drag of the whole group: its drop region shows the group's name. @@ -523,7 +531,7 @@ impl Component for /// tabs meet it. fn paint_over(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { if cx.part_if_declared(MENU).is_some() { - ui.face(MENU, Self::menu_face(cx.words::().panel_menu.clone())); + ui.face(MENU, self.menu_face(cx.words::().panel_menu.clone())); } ui.draw().surface(cx.rect, SurfaceKind::Frame, Corners::None); } @@ -588,7 +596,7 @@ impl Container for fn header_parts(&self, cx: &MeasureCx<'_, Self>) -> HeaderParts { let band = grip_width(cx.tokens); let button = if self.shows_menu_button() { - cx.tokens.space.gap.item + cx.face(Self::menu_face(cx.words::().panel_menu.clone())).x + cx.tokens.space.gap.item + cx.face(self.menu_face(cx.words::().panel_menu.clone())).x } else { 0.0 }; @@ -662,6 +670,7 @@ impl Container for active: self.active, closable: self.closable, wheel_selects: self.wheel_selects_tabs, + look: self.tab_look, dock: self.dock, sent: Outbox::new(&mut sent), }; @@ -736,6 +745,7 @@ struct TabRow<'a, P> { active: PanelKey, closable: bool, wheel_selects: bool, + look: PanelTabLook, dock: Option, sent: Outbox<'a, TabEvent>, } @@ -764,6 +774,7 @@ fn tab_row(row: &mu let kind = if panels.iter().any(closes) { TabKind::Document } else { TabKind::Panel }; let mut strip = TabStrip::new(name) .kind(kind) + .panel_look(row.look) .shown(active) .tear_off() .natural_height(true) diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 7f5edb52d..42e0c7f4d 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -2,7 +2,8 @@ use super::divider::{self, Divider, Drag}; use super::dock_column::{ - BarRecord, CHEVRON, ColumnArrow, ColumnBar, bar_band, bar_slots, column_grip, describe_chevron, paint_chevron, register_edges, show_bar, + BarRecord, CHEVRON, ColumnArrow, ColumnBar, bar_band, bar_slots, card_rect, card_style, column_grip, describe_chevron, paint_card, paint_chevron, + register_edges, show_bar, }; use super::group::GripMarks; use super::{DockSizes, DockSpot, DockTargets, DockWords, DragUnit, Flyout, GroupAt, PanelKey, PanelSpec, Splitter, start_icon_drag}; @@ -17,7 +18,7 @@ use crate::menu::GroupItem; use crate::primitives::{IconSpec, TextRun}; use crate::runtime::env::Label; use crate::runtime::focus::KeyUse; -use crate::style::{ComponentStyle, Corners, GlyphRole, StyleColor, StyleCx, SurfaceKind}; +use crate::style::{ComponentStyle, Corners, GlyphRole, StyleColor, StyleCx, SurfaceKind, SurfaceStyle}; use craft_behavior::dock::{Column, DockEdge, Group}; use craft_behavior::overlay::Side; use craft_behavior::{Axis, CursorIcon, DockSide, Metrics, PartKey, PressPhase, Sense, Value}; @@ -163,6 +164,8 @@ pub struct IconicColumnStyle { name_gap: f32, /// The marks of a group's grip. grip: GripMarks, + /// The card of a column shown as one ([`card`](IconicColumn::card)). + card: SurfaceStyle, } /// A column collapsed to icons: the column bar over icon groups, one cell per panel. A panel without an icon shows the @@ -222,6 +225,11 @@ pub struct IconicColumn<'a, P: Value + Hash + 'static> { /// palette window, the work area. #[prop] within: Rect, + /// The inset on the outer side of the docked column's card, when it shows as one + /// ([`DockConfig::column_cards`](super::DockConfig::column_cards), [`DockSizes::card_inset`]): its bar and icons + /// sit inside the card, inset by that on its outer side and by [`DockSizes::card`] on its top and bottom. + #[prop] + card: Option, open: Bind<'a, Option

>, view: Option>, /// The bar's rect this pass. @@ -283,6 +291,7 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { auto_collapse: false, mode: IconicMode::Flyouts, within: Rect::NOTHING, + card: None, open, view: None, bar_rect: Rect::NOTHING, @@ -352,9 +361,12 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { } } - /// The divider on the column's inner edge: the width runs from the rail to the width the column expands to. + /// The divider on the column's inner edge: the width runs from the rail to the width the column expands to, and + /// a card's inset on top. fn edge_divider(&self, rect: Rect, sizes: &DockSizes) -> Divider { let (least, most) = sizes.iconic_bounds(self.column, self.spec); + let inset = self.card.unwrap_or(0.0); + let (least, most) = (least + inset, most + inset); let most = most.min((self.within.width() - sizes.least_pane).max(rect.width())); Divider::column_edge(rect, self.edge, (least, most), sizes.reach) } @@ -375,7 +387,9 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { self.column.groups.get(group).and_then(|group| group.panels.get(panel)) } + /// Where the parts sit in the column's `rect`: inside its card, if it shows as one. fn plan(&self, rect: Rect, sizes: &IconicSizes, rtl: bool) -> Plan { + let rect = card_rect(rect, self.card, &sizes.column, self.edge, rtl); let bar = Rect::from_min_max(rect.min, Pos2::new(rect.right(), (rect.top() + self.bar.height(&sizes.column)).min(rect.bottom()))); let body = Rect::from_min_max(Pos2::new(rect.left(), bar.bottom()), rect.max); let wide = body.width() >= sizes.labels; @@ -473,6 +487,7 @@ impl Component for IconicColumn<'_, P> { name_gap: cx.tokens.space.gap.item, // The references' grip: a row of upright ticks, in the theme's grip ink. grip: GripMarks::style(cx), + card: card_style(cx), } } @@ -613,9 +628,13 @@ impl Component for IconicColumn<'_, P> { fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { // Painted here, not as the container's surface, which lies over what `paint` draws. - ui.draw().surface(cx.rect, SurfaceKind::Panel, Corners::All); + let card = card_rect(cx.rect, self.card, &cx.style.sizes.column, self.edge, cx.flow.is_rtl()); + paint_card(ui, cx.rect, card, &cx.style.card); if self.bar == ColumnBar::Own { - ui.draw().surface(self.bar_rect, SurfaceKind::Background, Corners::None); + // A card's bar is part of the card. + if self.card.is_none() { + ui.draw().surface(self.bar_rect, SurfaceKind::Background, Corners::None); + } paint_chevron(ui, self.edge, ColumnArrow::Collapse, self.expanded(), cx.flow.is_rtl(), &cx.words::()); } let flat = self.flat(); diff --git a/crates/ui-panels/src/docking/iconic/stories.rs b/crates/ui-panels/src/docking/iconic/stories.rs index 7d79e2699..27b3d9ee6 100644 --- a/crates/ui-panels/src/docking/iconic/stories.rs +++ b/crates/ui-panels/src/docking/iconic/stories.rs @@ -4,7 +4,7 @@ use super::CELL; use crate::buttons::Button; use crate::contract::ShowContainer as _; use crate::contract::{Bind, BodyCx, Show as _, Validity}; -use crate::docking::{ColumnBar, GroupAt, IconicColumn, IconicColumnOutput, IconicMode, PanelSpec}; +use crate::docking::{ColumnBar, DockSizes, GroupAt, IconicColumn, IconicColumnOutput, IconicMode, PanelSpec}; use crate::runtime::commands::{CommandState, CommandStates}; use crate::runtime::env::{Env, Message}; use crate::sections::Panel; @@ -56,10 +56,20 @@ fn at_stage<'a>( ui: &mut Ui, column: IconicColumn<'a, u8>, view: impl FnMut(&Group, GroupAt, &mut Ui, &mut BodyCx<'_>) -> Option + 'a, +) -> IconicColumnOutput { + at_stage_wider(ui, column, 0.0, view) +} + +/// [`at_stage`] with the column `extra` wider than the rail: a card's inset. +fn at_stage_wider<'a>( + ui: &mut Ui, + column: IconicColumn<'a, u8>, + extra: f32, + view: impl FnMut(&Group, GroupAt, &mut Ui, &mut BodyCx<'_>) -> Option + 'a, ) -> IconicColumnOutput { let room = stage(ui); let env = Env::of(ui); - let width = env.tokens.tokens().size.rail.width; // design: allow[style/token-read](a story sizes its stage from the rail token) + let width = env.tokens.tokens().size.rail.width + extra; // design: allow[style/token-read](a story sizes its stage from the rail token) let cell = if env.direction.is_rtl() { Rect::from_min_max(room.min, egui::pos2(room.left() + width, room.bottom())) } else { @@ -81,6 +91,24 @@ fn icon_groups(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { .into() } +/// A docked column of icons shown as a card (`DockConfig::column_cards`), at the window edge or inward of another +/// column: inset on its top and bottom, and on its outer side by the window edge's inset or by the gutter between two +/// cards, its bar and icons on the rounded panel card over the dock's background. +#[story(IconicColumn<'static, u8>, covers = [], drive = Drive::Never)] +fn icons_as_a_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let at = *data.choice("place", 1_usize, &[("At the window edge", 0), ("Inward of another column", 1)]); + let inset = DockSizes { column_cards: true, ..DockSizes::of_scope(ui) }.card_inset(at); + let column = Column::new(vec![Group::new(vec![0, 1], 0), Group::new(vec![2], 0)]); + let column = IconicColumn::new("Panels", global("iconic column", "card story"), &column, Bind::kept(), &spec).card(inset); + at_stage_wider(ui, column, inset, |group, at, ui, _| { + let GroupAt::Show(rect) = at else { return None }; + let title = group.active_panel().map_or_else(String::new, |panel| spec(panel).label.as_str().to_owned()); + Panel::new(title).titled().show_at(ui, rect, |_, _| ()); + None + }) + .into() +} + /// Cells bound to their panels' toggle commands: a marked command whose panel is closed shows the marker. #[story(IconicColumn<'static, u8>, covers = [Default], drive = Drive::Never, commands = marked_states)] fn icon_groups_with_marked_panels(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 65ad0bdbf..1b1f02a33 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -1,15 +1,20 @@ //! Trials of `IconicColumn`: the letter of a panel without an icon, the names a wide column shows, the grips of its -//! groups, and the resizes of its flyouts. +//! groups, the resizes of its flyouts, and a flyout that a command leaves open. #![allow(clippy::panic, clippy::expect_used, reason = "trials assert by panicking")] use super::GRIP; +use crate::buttons::Button; +use crate::contract::overlay::{self, OpenFilter}; use crate::contract::{Bind, Show as _, ShowContainer as _}; use crate::docking::group::GRIP_ABOVE; use crate::docking::{ DockHeights, DockSizes, DockSpot, DockTargets, DragUnit, FlyoutResize, GroupAt, GroupDrag, GroupGrip, IconicColumn, PanelKey, PanelSpec, }; +use crate::runtime::commands::{AppCatalog, Binding, CommandDef, CommandInput, Scope}; use crate::runtime::drag; use crate::runtime::env::Direction; +use crate::runtime::focus::{FocusTarget, request}; +use crate::runtime::frame::take_output; use crate::sections::Panel; use crate::style::StyleCx; use crate::testing::memory::global; @@ -18,7 +23,7 @@ use crate::testing::{Fixture, trial}; use craft_behavior::DockSide; use craft_behavior::dock::{Action, Column, DockEdge, Group, Layout, Node}; use craft_behavior::overlay::Side; -use egui::{Pos2, Rect, Vec2}; +use egui::{Key, Modifiers, Pos2, Rect, UiBuilder, Vec2}; use std::cell::{Cell, RefCell}; use std::rc::Rc; @@ -238,6 +243,53 @@ fn a_press_outside_closes_the_flyout_only_with_auto_collapse() { } } +/// The app command the trials bind to a key. +const NUDGE: &str = "flyoutTrial.nudge"; + +/// A key that runs an app command, with a stop in the open flyout focused, leaves the flyout open and live in every +/// pass and the stop focused, with Auto-Collapse Iconic Panels off or on: the host's binding opens and closes a flyout, +/// and a command closes only the transient popups (menus, dropdowns, lists). +#[trial] +fn a_key_command_leaves_the_open_flyout_and_the_focus_in_it() { + for auto_collapse in [false, true] { + let (open, stop, faded) = (Rc::new(Cell::new(None)), Rc::new(Cell::new(None)), Rc::new(Cell::new(false))); + let (seen, shown, fade) = (Rc::clone(&open), Rc::clone(&stop), Rc::clone(&faded)); + let place = Rect::from_min_size(Pos2::ZERO, Vec2::new(RAIL, SCREEN.y)); + let mut fixture = Fixture::new(move |ui| { + let column = Column::new(vec![Group::new(vec![0, 1], 0)]); + let mut now = seen.get(); + IconicColumn::new("Panels", global("iconic column", "commands"), &column, Bind::bound(&mut now), &spec) + .within(screen()) + .auto_collapse(auto_collapse) + .show_flyouts_at(ui, place, |_, at, ui, _| { + let GroupAt::Show(rect) = at else { return None }; + shown.set(Some(ui.scope_builder(UiBuilder::new().max_rect(rect), |ui| Button::new("Snap").show(ui).id).inner)); + None + }); + // Last pass the open flyout was not among the live layers that take keys: it played its exit. + fade.set(fade.get() || (now.is_some() && !overlay::any_open(ui.ctx(), OpenFilter::Keys))); + seen.set(now); + }); + let binding = Binding::parse("F9").expect("the trial's chord parses"); + let catalog = AppCatalog::new(vec![CommandDef::new(NUDGE, NUDGE, Scope::app()).with_default(binding)], 1).expect("the catalog is taken"); + fixture.commands(CommandInput::new().catalog(catalog)).room(SCREEN).settle(); + let icon = fixture.by_label("Swatches").expect("the Swatches icon").rect.center(); + fixture.click_at(icon).settle(); + let button = stop.get().expect("the flyout shows its stop"); + request(fixture.ctx(), FocusTarget::Id(button)); + fixture.settle(); + assert_eq!(fixture.focused_stop().map(|(id, _)| id), Some(button), "auto-collapse {auto_collapse}: the flyout's stop has the focus"); + faded.set(false); + take_output(fixture.ctx()); + fixture.key(Key::F9, Modifiers::NONE).settle(); + let fired = take_output(fixture.ctx()).fired; + assert!(fired.iter().any(|fired| fired.command.id == NUDGE), "auto-collapse {auto_collapse}: the key runs its command"); + assert_eq!(open.get(), Some(1), "auto-collapse {auto_collapse}: the flyout stays open"); + assert!(!faded.get(), "auto-collapse {auto_collapse}: and never plays its exit"); + assert_eq!(fixture.focused_stop().map(|(id, _)| id), Some(button), "auto-collapse {auto_collapse}: and its stop keeps the focus"); + } +} + /// The top edge and the free top corner grow the flyout upward on either window edge: the bottom and the column-side /// edge stay, the column-side edge has no grip, and the new top is kept as an offset from the icons, so it survives /// another group's flyout and reopening. diff --git a/crates/ui-panels/src/docking/spec.rs b/crates/ui-panels/src/docking/spec.rs index 8fdb6c8dd..2fed17f8f 100644 --- a/crates/ui-panels/src/docking/spec.rs +++ b/crates/ui-panels/src/docking/spec.rs @@ -3,6 +3,7 @@ use super::DockSizes; use crate::contract::SizeLimits; use crate::primitives::IconSpec; +use crate::rails::RailDensity; use crate::runtime::commands::CommandRef; use crate::runtime::env::Label; use craft_host::target::WindowKind; @@ -71,8 +72,8 @@ enum GridWidths { /// `first`: the content's width at one column, a cell and the content's own padding on both sides; `step`: the /// width each further column adds, a cell and the gap before it. Content { first: f32, step: f32 }, - /// A tool rail's cells, sized by the dock's style. - Rail, + /// A tool rail's cells at a density, sized by the dock's style. + Rail(RailDensity), } impl DockGrid { @@ -84,14 +85,25 @@ impl DockGrid { /// The grid of a tool rail of `cells` cells: a rail button and the control padding on both sides at one column, /// a button and the tight gap for each further column, in the style the dock shows it in. pub fn rail(cells: usize) -> Self { - DockGrid { widths: GridWidths::Rail, most: u16::try_from(cells).unwrap_or(u16::MAX).max(1) } + DockGrid { widths: GridWidths::Rail(RailDensity::Regular), most: u16::try_from(cells).unwrap_or(u16::MAX).max(1) } + } + + /// A [`rail`](Self::rail) grid whose cells are the buttons of a rail at `density`, as the rail shows them + /// ([`ToolRail::density`](crate::rails::ToolRail::density)); a content grid is left as it is. + #[must_use] + pub fn density(mut self, density: RailDensity) -> Self { + if let GridWidths::Rail(at) = &mut self.widths { + *at = density; + } + self } /// The grid with its widths in points: a [`rail`](Self::rail) grid takes the rail widths of `sizes`. pub fn resolved(self, sizes: &DockSizes) -> Self { match self.widths { GridWidths::Content { .. } => self, - GridWidths::Rail => DockGrid::new(sizes.rail_first, sizes.rail_step, self.most), + GridWidths::Rail(RailDensity::Regular) => DockGrid::new(sizes.rail_first, sizes.rail_step, self.most), + GridWidths::Rail(RailDensity::Dense) => DockGrid::new(sizes.dense_rail_first, sizes.dense_rail_step, self.most), } } @@ -100,7 +112,7 @@ impl DockGrid { fn first_step(self) -> (f32, f32) { match self.widths { GridWidths::Content { first, step } => (first, step), - GridWidths::Rail => (0.0, 0.0), + GridWidths::Rail(_) => (0.0, 0.0), } } diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index d1a2954d3..467df4b57 100644 --- a/crates/ui-panels/src/docking/targets.rs +++ b/crates/ui-panels/src/docking/targets.rs @@ -6,6 +6,7 @@ use super::{DragUnit, PanelKey, PanelSpec, scale_widths, width_bounds}; use crate::contract::DropMark; +use crate::rails::RailDensity; use crate::runtime::frame::{self, PassStep, PerViewport, Stamped, Stored}; use crate::style::{RuleKind, RuleWidth, StyleCx}; use craft_behavior::DockSide; @@ -81,6 +82,20 @@ pub struct DockSizes { pub rail_first: f32, /// The width each further column of a tool rail adds: a rail button and the tight gap before it. pub rail_step: f32, + /// [`rail_first`](Self::rail_first) with the buttons of a dense rail ([`RailDensity::Dense`]). + pub dense_rail_first: f32, + /// [`rail_step`](Self::rail_step) with the buttons of a dense rail ([`RailDensity::Dense`]). + pub dense_rail_step: f32, + /// The inset of a docked column shown as a card ([`column_cards`](Self::column_cards)) on its top and bottom, and + /// on its outer side at the dock's window edge: `space.gap.stack`. + pub card: f32, + /// The gutter between two neighbouring cards of a dock, on the outer side of each card past the window edge's: + /// `space.gap.tight`. + pub card_gutter: f32, + /// Whether the dock shows its docked columns as cards + /// ([`DockConfig::column_cards`](super::DockConfig::column_cards)): off in the style, set by the dock that shows + /// them. + pub column_cards: bool, /// The height of a grip strip, the band with the dock's grip marks: above each icon group of a collapsed column, /// and under the column bar of a tool rail (a group whose panel has a [`DockGrid`](super::DockGrid)) that the host /// shows itself: the least hit size, or the theme's grip marks with `space.gap.tight` above and below them. @@ -103,6 +118,11 @@ impl DockSizes { /// The sizes of the style context `cx`. pub fn style(cx: &StyleCx<'_>) -> Self { let size = &cx.tokens.size; + let rail = |density: RailDensity| { + let button = density.button(cx.tokens); + (button + 2.0 * cx.tokens.space.pad.control, button + cx.tokens.space.gap.tight) + }; + let ((rail_first, rail_step), (dense_rail_first, dense_rail_step)) = (rail(RailDensity::Regular), rail(RailDensity::Dense)); DockSizes { zone_depth: size.rail.width, edge_band: size.control.md, @@ -127,8 +147,13 @@ impl DockSizes { jump: cx.control().height, iconic_least: size.rail.width, column: size.dock.column, - rail_first: size.rail.button + 2.0 * cx.tokens.space.pad.control, - rail_step: size.rail.button + cx.tokens.space.gap.tight, + rail_first, + rail_step, + dense_rail_first, + dense_rail_step, + card: cx.tokens.space.gap.stack, + card_gutter: cx.tokens.space.gap.tight, + column_cards: false, grip: super::group::grip_strip(cx.tokens), } } @@ -176,6 +201,18 @@ impl DockSizes { column.width.unwrap_or(self.column).clamp(lo, hi) } + /// The inset on the outer side of the card of a dock's docked column `at` from the window edge inwards: none + /// without [`column_cards`](Self::column_cards); [`card`](Self::card) for the first column, at the window edge; + /// [`card_gutter`](Self::card_gutter) for the others, which stand that far from their outer neighbour's card. A + /// docked column is that much wider than its content. + pub fn card_inset(&self, at: usize) -> f32 { + match (self.column_cards, at) { + (false, _) => 0.0, + (true, 0) => self.card, + (true, _) => self.card_gutter, + } + } + /// The width bounds of a column collapsed to icons, docked or floating: the rail width up to the width it expands /// to. A docked column's inner edge and a floating window's sides resize it within them. pub fn iconic_bounds

(&self, column: &Column

, spec: &dyn Fn(&P) -> PanelSpec) -> (f32, f32) { @@ -226,33 +263,41 @@ impl DockSizes { _ => return Vec::new(), }; let fixed = |column: &Column

| !column.iconic && self.stepped(column, spec).is_some(); + // Each column with its card's inset, which the scaling leaves as it is. let current: Vec<(f32, (f32, f32))> = columns .iter() - .map(|column| { - let width = self.width(column, spec); - (width, if fixed(column) { (width, width) } else { self.shown_bounds(column, spec) }) + .enumerate() + .map(|(at, column)| { + let (width, inset) = (self.width(column, spec), self.card_inset(at)); + let (lo, hi) = if fixed(column) { (width, width) } else { self.shown_bounds(column, spec) }; + (width + inset, (lo + inset, hi + inset)) }) .collect(); let widths = scale_widths(¤t, total); columns .iter() + .enumerate() .zip(current.iter().zip(widths)) - .filter(|(column, ((width, _), scaled))| !fixed(column) && (scaled - width).abs() >= 0.01) - .filter_map(|(column, (_, width))| { + .filter(|((_, column), ((width, _), scaled))| !fixed(column) && (scaled - width).abs() >= 0.01) + .filter_map(|((at, column), (_, width))| { + let width = width - self.card_inset(at); let panel = column.groups.iter().find_map(|group| group.panels.first())?.clone(); Some(if column.iconic { Action::resize_iconic(panel, Some(width)) } else { Action::resize_column(panel, width) }) }) .collect() } - /// The `(width, floor)` of every column, for [`fit_widths`](super::fit_widths): an expanded column shrinks down to - /// its least width, an iconic or stepped one keeps its width. + /// The `(width, floor)` of every column of a dock, from its window edge inwards, for + /// [`fit_widths`](super::fit_widths), each with its card's inset ([`card_inset`](Self::card_inset)): an expanded + /// column shrinks down to its least width, an iconic or stepped one keeps its width. pub fn natural

(&self, columns: &[Column

], spec: &dyn Fn(&P) -> PanelSpec) -> Vec<(f32, Option)> { columns .iter() - .map(|column| { + .enumerate() + .map(|(at, column)| { let keeps = column.iconic || self.stepped(column, spec).is_some(); - (self.width(column, spec), (!keeps).then(|| self.width_bounds(column, spec).0.max(1.0))) + let inset = self.card_inset(at); + (self.width(column, spec) + inset, (!keeps).then(|| self.width_bounds(column, spec).0.max(1.0) + inset)) }) .collect() } diff --git a/crates/ui-panels/src/rails/flyout.rs b/crates/ui-panels/src/rails/flyout.rs index b724a2066..b96af1e16 100644 --- a/crates/ui-panels/src/rails/flyout.rs +++ b/crates/ui-panels/src/rails/flyout.rs @@ -1,6 +1,6 @@ //! `FlyoutButton`: a rail button that stands for a group of tools and opens them as a flyout. -use super::tool::{RailTool, SlotDrop, SlotId, ToolDrag, ToolDropped, ToolTips}; +use super::tool::{RailDensity, RailTool, SlotDrop, SlotId, ToolDrag, ToolDropped, ToolTips}; use super::words::RailWords; use crate::buttons::{IconButton, PopupMark}; use crate::contract::overlay::{Anchor, Place}; @@ -234,7 +234,7 @@ impl Component for FlyoutButton<'_, T> { type Output = FlyoutOutput; fn style(cx: &StyleCx<'_>, _: FlyoutButtonStyleKey) -> FlyoutButtonStyle { - let side = cx.tokens.size.rail.button; + let side = cx.env::().button(cx.tokens); FlyoutButtonStyle { metrics: Metrics::new().min_size(Vec2::splat(side)), mark: cx.tokens.space.gap.tight, glyphs: cx.glyph_role() } } diff --git a/crates/ui-panels/src/rails/mod.rs b/crates/ui-panels/src/rails/mod.rs index 4f8046fb2..62bda74e8 100644 --- a/crates/ui-panels/src/rails/mod.rs +++ b/crates/ui-panels/src/rails/mod.rs @@ -12,7 +12,7 @@ pub(crate) mod tool; pub use drawer::{DrawerGroup, DrawerKind, ToolbarDrawer, ToolbarDrawerOutput, ToolbarEdit, apply_toolbar_edit, drop_edit}; pub use flyout::{FlyoutButton, FlyoutButtonStyle, FlyoutOutput, SlotEdit}; pub use tool::{ - DropAt, LastUsed, RailFooter, RailTool, SlotId, ToolDrag, ToolDropped, ToolRail, ToolRailOutput, ToolRailStyle, ToolSlot, ToolTips, drop_in_slot, - remembered, shown_tool, visible_slots, + DropAt, LastUsed, RailDensity, RailFooter, RailTool, SlotId, ToolDrag, ToolDropped, ToolRail, ToolRailOutput, ToolRailStyle, ToolSlot, ToolTips, + drop_in_slot, remembered, shown_tool, visible_slots, }; pub use words::RailWords; diff --git a/crates/ui-panels/src/rails/tool.rs b/crates/ui-panels/src/rails/tool.rs index 50730b552..ecd19c185 100644 --- a/crates/ui-panels/src/rails/tool.rs +++ b/crates/ui-panels/src/rails/tool.rs @@ -3,7 +3,7 @@ use super::flyout::{FlyoutButton, SlotEdit}; use super::words::RailWords; -use crate::buttons::IconButton; +use crate::buttons::{ActiveLook, IconButton}; use crate::contract::{ Access, Common, Component, Container, ContainerProps, Cx, FooterRegion, Gap, NoValue, Outcome, Pad, Pointer as _, Props as _, Role, Scroll, Show as _, ShowContainer as _, Sizing, WordSetCx as _, @@ -15,8 +15,8 @@ use crate::layout::RowAlign; use crate::layout_components::{Row, Stack}; use crate::runtime::access::Name; use crate::runtime::commands::resolver_in; -use crate::runtime::env::Label; -use crate::style::{ComponentStyle, GlyphRole, StyleCx, SurfaceKind, TypeRole}; +use crate::runtime::env::{AppValues, EnvValue, Label}; +use crate::style::{ComponentStyle, GlyphRole, StyleCx, SurfaceKind, TypeRole, UiTokens}; use crate::tabs::TornOff; use craft_behavior::overlay::Side; use craft_behavior::{IconId, Metrics, NavShape, Proposal, Roving, Sense, Value}; @@ -38,6 +38,30 @@ use drag::RailDrop; pub(crate) use drag::SlotDrop; pub use drag::{DropAt, ToolDrag, ToolDropped, drop_in_slot}; +/// How tightly a tool rail packs its buttons. A rail publishes its density to its content ([`ToolRail::density`]), +/// and the dock sizes the rail's column from the same density ([`DockGrid::density`]). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, EnvValue, MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum RailDensity { + /// Buttons `size.rail.button` square. + #[default] + Regular, + /// Buttons a control high (`size.control.md`) square: a denser step than the scope's density gives, for an app + /// whose compact toolbar packs its tools tighter than its other controls. + Dense, +} + +impl RailDensity { + /// The side of a rail button at this density. + pub fn button(self, tokens: &UiTokens) -> f32 { + match self { + RailDensity::Regular => tokens.size.rail.button, + RailDensity::Dense => tokens.size.control.md, + } + } +} + /// What the footer closure of [`ToolRail::show_rail`] is told. #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[non_exhaustive] @@ -158,6 +182,12 @@ pub struct ToolRail<'a, T: Value + MemoProps + PlainData + 'static> { /// The tips the tools' buttons and flyout rows show in place of the command tooltip, where a tool has one. #[prop] tips: Option<&'a dyn ToolTips>, + /// How tightly the rail packs its buttons; its columns follow the rail grid at that density. + #[prop] + density: RailDensity, + /// How the button of the current tool shows it is on. + #[prop] + active_look: ActiveLook, footer: Option>, /// The columns the rail lays out in this pass. columns: usize, @@ -194,6 +224,8 @@ impl<'a, T: Value + MemoProps + PlainData + 'static> ToolRail<'a, T> { mark: None, reveal: None, tips: None, + density: RailDensity::Regular, + active_look: ActiveLook::Accent, footer: None, columns: 1, shown: Rc::default(), @@ -225,7 +257,7 @@ impl<'a, T: Value + MemoProps + PlainData + 'static> ToolRail<'a, T> { Some(scope) => StyleCx::with_root_scoped(ui.ctx(), scope, DockSizes::style), None => DockSizes::of_scope(ui), }; - DockGrid::rail(cells).resolved(&sizes) + DockGrid::rail(cells).density(self.density).resolved(&sizes) } /// Sets up the pass for a rail `width` wide: its columns, its roving grid and its footer. Returns what the body @@ -517,6 +549,12 @@ impl Component for ToolRail<'_, T> { } } + /// The rail's density and active look reach its buttons. + fn content_env(&self, _: &Cx<'_, Self>, values: &mut AppValues) { + values.set(self.density); + values.set(self.active_look); + } + /// While the toolbar is edited the rail takes the drops its buttons do not: a blank toolbar's, and those in the room /// around the buttons. It registers after them, and declines over them. fn finish(self, mut cx: Cx<'_, Self>) -> ToolRailOutput { diff --git a/crates/ui-panels/src/rails/tool/stories.rs b/crates/ui-panels/src/rails/tool/stories.rs index 65ad66d16..f566e9d4a 100644 --- a/crates/ui-panels/src/rails/tool/stories.rs +++ b/crates/ui-panels/src/rails/tool/stories.rs @@ -1,9 +1,9 @@ //! Stories of `ToolRail`, and the commands its stories and the flyout's use as tools. -use super::{LastUsed, RailTool, ToolRail, ToolRailOutput, ToolSlot, ToolTips}; +use super::{LastUsed, RailDensity, RailTool, ToolRail, ToolRailOutput, ToolSlot, ToolTips}; +use crate::buttons::ActiveLook; use crate::contract::{MemoProps, Show as _, Tracked}; use crate::display::{Shade, Text}; -use crate::docking::{DockGrid, DockSizes}; use crate::runtime::env::Env; use crate::style::TypeRole; use crate::testing::{Drive, StoryData, StoryOutput, story}; @@ -66,10 +66,10 @@ fn captioned_slots() -> Vec> { ] } -/// Shows `rail` in a room as wide as the grid of `cells` cells at `columns` columns, the stage a dock column of that +/// Shows `rail` in a room as wide as its grid of `cells` cells at `columns` columns, the stage a dock column of that /// many steps gives it, at the reading start and at most `height` high. fn in_columns(ui: &mut Ui, columns: u8, cells: usize, height: Option, rail: ToolRail<'_, u8>) -> ToolRailOutput { - let width = DockGrid::rail(cells).resolved(&DockSizes::of_scope(ui)).width(u16::from(columns)); + let width = rail.grid(ui, cells).width(u16::from(columns)); let room = Flow::new(ui.available_rect_before_wrap(), Env::of(ui).direction.is_rtl()).span(0.0, width); ui.scope_builder(UiBuilder::new().max_rect(room), |ui| { if let Some(height) = height { @@ -116,6 +116,27 @@ fn tool_rail_captions(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { in_columns(ui, columns, slots.len(), None, ToolRail::new("Tools", &slots, &0, &last).captions()).into() } +/// The rail at each density in one or two columns: a dense rail's buttons are a control high, and its columns narrow +/// with them. +#[story(ToolRail<'static, u8>, covers = [], drive = Drive::Never)] +fn tool_rail_density(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let columns = *data.ranged("columns", 1_u8, 1.0..=2.0); + let density = *data.choice("density", RailDensity::Dense, &[("Regular", RailDensity::Regular), ("Dense", RailDensity::Dense)]); + let slots = Tracked::new(slots()); + let last = Tracked::new(LastUsed::default()); + in_columns(ui, columns, slots.len(), None, ToolRail::new("Tools", &slots, &BRUSH, &last).density(density)).into() +} + +/// The current tool (the brush) in each active look: the accent's soft fill and edge, or the pressed fill with no +/// edge. +#[story(ToolRail<'static, u8>, covers = [], drive = Drive::Never)] +fn tool_rail_active_look(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let look = *data.choice("active look", ActiveLook::Pressed, &[("Accent", ActiveLook::Accent), ("Pressed", ActiveLook::Pressed)]); + let slots = Tracked::new(slots()); + let last = Tracked::new(LastUsed::default()); + in_columns(ui, 1, slots.len(), None, ToolRail::new("Tools", &slots, &BRUSH, &last).active_look(look)).into() +} + /// The tips of the brush and the eraser: the tool's name over what it does. #[derive(MemoProps)] struct StoryTips; diff --git a/crates/ui-panels/src/rails/tool/trials.rs b/crates/ui-panels/src/rails/tool/trials.rs index e9241575c..a5067f8bd 100644 --- a/crates/ui-panels/src/rails/tool/trials.rs +++ b/crates/ui-panels/src/rails/tool/trials.rs @@ -4,7 +4,7 @@ use super::super::FlyoutButton; use super::stories::tools; -use super::{DropAt, LastUsed, ToolRail, ToolSlot}; +use super::{DropAt, LastUsed, RailDensity, ToolRail, ToolSlot}; use crate::buttons::Button; use crate::contract::Props as _; use crate::contract::Show as _; @@ -85,6 +85,29 @@ fn a_tool_rail_lays_out_the_most_whole_columns_its_width_holds() { assert_eq!(columns_of(&wide), LABELS.len(), "a wide room fills one row"); } +/// A dense rail's buttons are smaller than a regular rail's, and its dock grid narrows with them: at the dense grid's +/// width of two steps the dense rail shows two columns, as wide as that grid, where a regular rail fits one. +#[trial] +fn a_dense_rail_and_its_grid_narrow_together() { + let ctx = Fixture::new(|_| {}).ctx().clone(); + let sizes = DockSizes::of(&ctx); + let (regular, dense) = (DockGrid::rail(LABELS.len()).resolved(&sizes), DockGrid::rail(LABELS.len()).density(RailDensity::Dense).resolved(&sizes)); + assert!(dense.width(2) < regular.width(2), "the dense grid is narrower: {dense:?} against {regular:?}"); + let shown = |density: RailDensity| { + let (slots, last) = (Tracked::new(slots()), Tracked::new(LastUsed::default())); + let mut fixture = Fixture::new(move |ui| { + ToolRail::new("Tools", &slots, &0, &last).density(density).show_rail(ui, |_, _| {}); + }); + fixture.room(Vec2::new(dense.width(2), 800.0)).settle(); + (columns_of(&fixture), rect(&fixture, "Tools"), rect(&fixture, "Move")) + }; + let ((dense_columns, rail, dense_button), (regular_columns, _, regular_button)) = (shown(RailDensity::Dense), shown(RailDensity::Regular)); + assert_eq!(dense_columns, 2, "the dense rail fills its grid's two steps"); + assert!(near(rail.width(), dense.width(2)), "the dense rail is as wide as its grid: {rail:?}"); + assert!(regular_columns < dense_columns, "a regular rail fits fewer columns in the same width"); + assert!(dense_button.width() < regular_button.width(), "a dense button ({dense_button:?}) is smaller than a regular one ({regular_button:?})"); +} + /// The measure at a width is the size the rail shows at it: exactly its rows plus the footer between equal paddings, /// and fewer columns need more rows. #[trial] diff --git a/crates/ui-panels/src/sections/footer.rs b/crates/ui-panels/src/sections/footer.rs index 581ee146e..40427888a 100644 --- a/crates/ui-panels/src/sections/footer.rs +++ b/crates/ui-panels/src/sections/footer.rs @@ -392,6 +392,9 @@ pub enum DialogButtonLook { /// PdfCraft's: Cancel and an Alternate answer (Don't Save, No) are plain text (the ghost look) beside the accented /// accepting button, as production's prompts show them. Quiet, + /// VectorCraft's: every button but the accepting and the destructive one is a filled neutral tile with no edge + /// (`buttons::FILLED`). + Filled, } /// What a dialog button means; it decides the button's look and its place in the row. @@ -719,7 +722,7 @@ impl FooterBar { let armed_for = Env::of(&*ui).get::().0; let default_at = buttons.iter().position(|button| button.role == DialogRole::Accept && button.live(armed_for)); let least = if column { LeastWidth::DialogSideButton } else { LeastWidth::DialogButton }; - let quiet = Env::of(ui).get::() == DialogButtonLook::Quiet; + let look = Env::of(ui).get::(); let place = |ui: &mut Ui, shown: &mut Shown| { for at in display_order(&roles, os == Os::Windows, column) { let button = &buttons[at]; @@ -727,8 +730,11 @@ impl FooterBar { DialogRole::Accept => Variant::PRIMARY, DialogRole::Destructive => Variant::DANGER, // Production shows Cancel and Don't Save as plain text beside the accented answer. - DialogRole::Cancel | DialogRole::Alternate if quiet => Variant::GHOST, - DialogRole::Cancel | DialogRole::Other | DialogRole::Alternate | DialogRole::Alternative => Variant::SECONDARY, + DialogRole::Cancel | DialogRole::Alternate if look == DialogButtonLook::Quiet => Variant::GHOST, + DialogRole::Cancel | DialogRole::Other | DialogRole::Alternate | DialogRole::Alternative => match look { + DialogButtonLook::Filled => crate::buttons::FILLED, + DialogButtonLook::Standard | DialogButtonLook::Quiet => Variant::SECONDARY, + }, }; let live = button.live(armed_for); let mut widget = Button::new(button.label.clone()).variant(variant).enabled(live).least_width(least); diff --git a/crates/ui-panels/src/sections/footer/stories.rs b/crates/ui-panels/src/sections/footer/stories.rs index 5801a5ec4..8f82fd707 100644 --- a/crates/ui-panels/src/sections/footer/stories.rs +++ b/crates/ui-panels/src/sections/footer/stories.rs @@ -1,8 +1,9 @@ //! Stories of the footer actions. -use super::{DropAction, FooterAction, FooterBar}; +use super::{DialogButtonLook, DialogRole, DropAction, FooterAction, FooterBar, FooterButton}; use crate::buttons::IconButton; use crate::contract::{PopupKind, Props as _, Show as _, ShowContainer as _}; +use crate::runtime::env::with_env; use crate::story_kit::sample::words; use crate::testing::{Drive, StoryData, StoryOutput, story}; use craft_behavior::IconId; @@ -24,6 +25,25 @@ fn footer_actions(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { FooterBar::actions(actions).show_footer(ui).into() } +/// The dialog buttons of an app that sets `DialogButtonLook::Filled` at its root: Cancel, the Alternate answer and +/// another outcome are filled neutral tiles with no edge beside the accented OK, at rest, under the pointer and pressed. +#[story(FooterBar, covers = [], drive = Drive::Never, title = "Filled dialog buttons")] +fn footer_filled_buttons(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + let buttons = [ + FooterButton::new("Reset", DialogRole::Other), + FooterButton::new("Don't Save", DialogRole::Alternate), + FooterButton::new("Cancel", DialogRole::Cancel), + FooterButton::new("OK", DialogRole::Accept), + ]; + with_env( + ui, + |overrides| { + overrides.values.set(DialogButtonLook::Filled); + }, + |ui| FooterBar::buttons(buttons).show_footer(ui).into(), + ) +} + #[story(DropAction, covers = [Default], drive = Drive::Never)] fn drop_action(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { DropAction::new(|_: &u8| true) diff --git a/crates/ui-panels/src/sections/section.rs b/crates/ui-panels/src/sections/section.rs index c7b089b29..3b757380a 100644 --- a/crates/ui-panels/src/sections/section.rs +++ b/crates/ui-panels/src/sections/section.rs @@ -158,12 +158,13 @@ impl<'a> Section<'a> { self.props.header = Some(header); } - /// The header's weight: `Section` by default, under a rule; `Caption` for a quiet heading over a group of - /// controls, with no rule. + /// The header's weight: `Section` by default, under a rule; `Caption`, `Subheading`, `Quiet` or `Overline` for a + /// heading over a group of controls, with no rule. #[must_use] pub fn strength(mut self, strength: HeaderStrength) -> Self { self.strength = strength; - self.update_header(|header| header.rule_above(!matches!(strength, HeaderStrength::Caption | HeaderStrength::Overline))); + let quiet = matches!(strength, HeaderStrength::Caption | HeaderStrength::Subheading | HeaderStrength::Quiet | HeaderStrength::Overline); + self.update_header(|header| header.rule_above(!quiet)); self } diff --git a/crates/ui-panels/src/sections/section/stories.rs b/crates/ui-panels/src/sections/section/stories.rs index 4af0a2091..fd33261ef 100644 --- a/crates/ui-panels/src/sections/section/stories.rs +++ b/crates/ui-panels/src/sections/section/stories.rs @@ -1,8 +1,10 @@ //! Stories of `Section`. use super::Section; -use crate::contract::{Role, Show as _, ShowContainer as _}; +use crate::contract::{Props as _, Role, SectionRhythm, Show as _, ShowContainer as _}; use crate::display::Text; +use crate::layout_components::Stack; +use crate::runtime::env::with_env; use crate::sections::sample::body; use crate::sections::{HeaderAction, HeaderStrength}; use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story}; @@ -39,6 +41,12 @@ fn section_caption(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { shown.output.into() } +#[story(Section<'static>, covers = [], drive = Drive::Never)] +fn section_subheading(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + let shown = Section::fixed("Shape modes").strength(HeaderStrength::Subheading).show(ui, |ui, _| body(ui)); + shown.output.into() +} + #[story(Section<'static>, covers = [], drive = Drive::Never)] fn section_with_menu_and_reorder(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let shown = Section::new("Layers").open(data.bind("open", true)).actions([HeaderAction::Menu]).reorder(true).show(ui, |ui, _| body(ui)); @@ -55,3 +63,26 @@ fn section_with_controls(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { .show(ui, |ui, _| body(ui)); shown.output.into() } + +/// A row and two sections under each `SectionRhythm`: `Tight` (the default) gives each rule the stack's gap and its +/// header follows at once; `Spaced` stands each rule `space.gap.section` off what precedes it and its header +/// `space.gap.row` below it. +#[story(Section<'static>, covers = [], drive = Drive::Never)] +fn section_rhythm(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let mut column = |ui: &mut Ui, key: &'static str| { + Stack::new().id_salt(key).show(ui, |ui, _| { + Text::new("Fill").show(ui); + Section::new("Stroke").open(data.bind(key, true)).show(ui, |ui, _| body(ui)); + Section::fixed("Effects").show(ui, |ui, _| body(ui)); + }); + }; + column(ui, "tight"); + with_env( + ui, + |overrides| { + overrides.values.set(SectionRhythm::Spaced); + }, + |ui| column(ui, "spaced"), + ); + StoryOutput::default() +} diff --git a/crates/ui-panels/src/sections/title_row.rs b/crates/ui-panels/src/sections/title_row.rs index 953b466ab..babc26b1d 100644 --- a/crates/ui-panels/src/sections/title_row.rs +++ b/crates/ui-panels/src/sections/title_row.rs @@ -37,6 +37,12 @@ pub enum HeaderStrength { Heading, /// A quiet heading over a group of controls: label text, faint, as written, with no rule. Caption, + /// A sub-heading inside a section, over a group of its controls: label text in the normal ink, as written, with no + /// rule. + Subheading, + /// A muted line over the sections or controls it names: the caption role in the muted ink, as written, with no + /// rule. An inspector's kind line over its sections ("Ellipse"). + Quiet, /// A window's drag bar: one text row high (`size.row.text`), with label text; its action parts shrink to the row. Bar, /// A small overline over a group of controls: the caption role, faint, in capitals, with no rule. A document @@ -349,6 +355,8 @@ impl Component for TitleRow<'_> { HeaderStrength::Section => (cx.tokens.size.panel_header, TypeRole::BodyStrong, text.normal), HeaderStrength::Heading => (cx.tokens.size.panel_header, TypeRole::Heading, text.normal), HeaderStrength::Caption => (cx.control().height, TypeRole::Label, text.faint), + HeaderStrength::Subheading => (cx.control().height, TypeRole::Label, text.normal), + HeaderStrength::Quiet => (cx.control().height, TypeRole::Caption, text.muted), HeaderStrength::Bar => (cx.tokens.size.row.text, TypeRole::Label, text.normal), HeaderStrength::Overline => (cx.control().height, TypeRole::Caption, text.faint), }; @@ -506,7 +514,7 @@ impl Component for TitleRow<'_> { let overline = self.strength == HeaderStrength::Overline; let capitals = overline.then(|| cx.resolved.label.to_uppercase()); let mut title = TextRun::new(capitals.as_deref().unwrap_or(cx.resolved.label)).role(role).elide(); - if matches!(self.strength, HeaderStrength::Caption | HeaderStrength::Overline) { + if matches!(self.strength, HeaderStrength::Caption | HeaderStrength::Quiet | HeaderStrength::Overline) { title = title.color(cx.resolve(&cx.style.text.color)); } ui.draw().text_on_centre_line(placed.title, &title); diff --git a/crates/ui-panels/src/sections/title_row/stories.rs b/crates/ui-panels/src/sections/title_row/stories.rs index 75ec6c848..cb88755fa 100644 --- a/crates/ui-panels/src/sections/title_row/stories.rs +++ b/crates/ui-panels/src/sections/title_row/stories.rs @@ -62,6 +62,16 @@ fn title_row_caption(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { TitleRow::new("Preset details").strength(HeaderStrength::Caption).show(ui).edit.into() } +#[story(TitleRow<'static>, covers = [], drive = Drive::Never)] +fn title_row_subheading(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + TitleRow::new("Ellipse Properties:").strength(HeaderStrength::Subheading).show(ui).edit.into() +} + +#[story(TitleRow<'static>, covers = [], drive = Drive::Never)] +fn title_row_quiet(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + TitleRow::new("Ellipse").strength(HeaderStrength::Quiet).show(ui).edit.into() +} + #[story(TitleRow<'static>, covers = [], drive = Drive::Never)] fn title_row_bar(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { // A floating window's drag bar: no title, the Close action at the end. diff --git a/crates/ui-panels/tests/it/dialogs.rs b/crates/ui-panels/tests/it/dialogs.rs index 5f5d416f8..2d4b3c919 100644 --- a/crates/ui-panels/tests/it/dialogs.rs +++ b/crates/ui-panels/tests/it/dialogs.rs @@ -738,6 +738,17 @@ fn a_footer_cancel_is_a_ghost_button_beside_the_accent_answer() { assert!(!seen.contains(&Variant::SECONDARY), "no outlined button in the footer: {seen:?}"); } +/// VectorCraft's dialogs (`DialogButtonLook::Filled`) show Cancel and Don't Save as filled neutral tiles beside the +/// accented answer, not as outlines. +#[trial] +fn a_footer_cancel_is_a_filled_button_beside_the_accent_answer() { + use craft_theme::Variant; + let seen = footer_variants(Some(craft_ui::sections::DialogButtonLook::Filled)); + assert!(seen.contains(&craft_ui::buttons::FILLED), "Cancel is a filled button: {seen:?}"); + assert!(seen.contains(&Variant::PRIMARY), "Save is the accented button: {seen:?}"); + assert!(!seen.contains(&Variant::SECONDARY), "no outlined button in the footer: {seen:?}"); +} + /// The left edges of a Save anyway / Save as… / Cancel prompt's buttons on Linux, with the Alternate's role set to /// `role` when it names one. fn alternate_edges(role: Option) -> (f32, f32, f32) { diff --git a/crates/ui-panels/tests/it/sections/mod.rs b/crates/ui-panels/tests/it/sections/mod.rs index c5c8b214d..9a71809d9 100644 --- a/crates/ui-panels/tests/it/sections/mod.rs +++ b/crates/ui-panels/tests/it/sections/mod.rs @@ -7,4 +7,5 @@ pub(crate) mod footer_row; pub(crate) mod layout; pub(crate) mod panel_header; pub(crate) mod reorderable; +pub(crate) mod rhythm; pub(crate) mod stack; diff --git a/crates/ui-panels/tests/it/sections/rhythm.rs b/crates/ui-panels/tests/it/sections/rhythm.rs new file mode 100644 index 000000000..4fe61c1b7 --- /dev/null +++ b/crates/ui-panels/tests/it/sections/rhythm.rs @@ -0,0 +1,48 @@ +//! `SectionRhythm`: the room around the rule above a section's header. + +use craft_ui::contract::{SectionRhythm, Show as _, ShowContainer as _}; +use craft_ui::display::Text; +use craft_ui::layout_components::Stack; +use craft_ui::runtime::env::{Env, RootEnv}; +use craft_ui::sections::Section; +use craft_ui::testing::{Frames, trial}; +use egui::{Rect, Ui}; + +/// What a stack of a row and a fixed section shows under `rhythm`: the room from the row to the section's rule, the room +/// from the rule to the section's body, and `space.gap.section`. +fn rule_room(rhythm: SectionRhythm) -> (f32, f32, f32) { + let mut frames = Frames::new(); + let mut root = RootEnv::default(); + root.values.set(rhythm); + frames.root(root); + let (mut row, mut body, mut section_gap) = (Rect::NOTHING, Rect::NOTHING, 0.0); + let mut show = |ui: &mut Ui| { + section_gap = Env::of(ui).tokens.space.gap.section; + Stack::new().show(ui, |ui, _| { + row = Text::new("Fill").show(ui).rect; + Section::fixed("Stroke").show(ui, |ui, _| body = Text::new("Width").show(ui).rect); + }); + }; + frames.idle(2, &mut show); + let rule = frames + .frame_shapes(&mut show) + .iter() + .map(egui::Shape::visual_bounding_rect) + .find(|line| { + line.is_finite() && line.height() <= 2.0 && line.width() > body.width() && line.top() >= row.bottom() && line.bottom() <= body.top() + }) + .expect("the section draws its rule between the row and its body"); + (rule.top() - row.bottom(), body.top() - rule.bottom(), section_gap) +} + +/// Regression: a ruled section in a stack took only the stack's gap above its rule and its header right under it, so an +/// app could not keep production's room around its panel dividers. `Spaced` stands the rule `space.gap.section` off the +/// row above and the header further from the rule; `Tight` keeps the stack's rhythm. +#[trial] +fn a_spaced_section_stands_its_rule_off_the_row_above_and_its_header() { + let (tight_above, tight_below, _) = rule_room(SectionRhythm::Tight); + let (spaced_above, spaced_below, section_gap) = rule_room(SectionRhythm::Spaced); + assert!(spaced_above > tight_above, "the spaced rule stands further off the row ({spaced_above}) than the tight one ({tight_above})"); + assert!(spaced_above >= section_gap - 0.5, "the spaced rule stands a section gap ({section_gap}) off the row, not {spaced_above}"); + assert!(spaced_below > tight_below, "the spaced header stands further below its rule ({spaced_below}) than the tight one ({tight_below})"); +} diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 2ebfa1692..c8f50a75a 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -254,7 +254,7 @@ impl Drops<'_, P> { /// Takes a group or tab drag released on the root. fn take(&self, cx: &mut Cx<'_, DockRoot<'_, DockDropped

>>) -> Option> { let ctx = cx.core.ctx.clone(); - let sizes = *cx.style.sizes(); + let sizes = area_sizes(*cx.style.sizes(), self.config); let shell = cx.env.get::().0; let bounds = inset_top(shell.as_ref().map_or(cx.rect, ShellCx::float_bounds), self.top_inset); let space = float_space(&ctx, bounds, &sizes, self.config, self.specs); @@ -271,6 +271,13 @@ impl Drops<'_, P> { } } +/// The sizes a dock area lays out with: the dock's style, with its docked columns as cards when `config` shows them +/// ([`DockConfig::column_cards`]). +fn area_sizes(mut sizes: DockSizes, config: &DockConfig) -> DockSizes { + sizes.column_cards = config.column_cards; + sizes +} + /// What the area collects while it shows its parts. struct Report

{ actions: Vec>, @@ -444,6 +451,8 @@ struct ColumnAt

{ bar: ColumnBar, within: Rect, open: Option

, + /// The outer inset of the column's card, a docked column's in a dock that shows cards ([`DockSizes::card_inset`]). + card: Option, } /// What a column reported. @@ -526,7 +535,7 @@ impl<'a, P: Clone + Eq + Hash + Debug + Send + Sync + 'static> DockArea<'a, P> { let mut passed = None; open_requests::

(&ctx); let shown = root.show(ui, |ui, body| { - let Some(sizes) = body.style::>>().map(|style| *style.sizes()) else { return }; + let Some(sizes) = body.style::>>().map(|style| area_sizes(*style.sizes(), &config)) else { return }; let memory = body.memory::>(); memory.window_floor = memory.window_floor.max(current.layout().window_floor()); let input = Input { @@ -1093,7 +1102,9 @@ impl Pass<'_, P> { .zones(scene.config.zone_rule()) .movable(scene.permissions(shown).movable) .menu(move || panel_menu_rows(scene, &mut **panels.borrow_mut(), words, shown).0) - .panel_menu_shown(*hosted) + .panel_menu_shown(*hosted || scene.config.panel_menu_always) + .panel_menu_icon(scene.config.panel_menu_icon.clone()) + .tab_look(scene.config.tab_look) .command_states(states.clone()); if look.in_window { group = group.in_window(); @@ -1218,7 +1229,7 @@ impl Pass<'_, P> { let reading = plan.flow.to_physical(plan.rect); let start = plan.edge == DockEdge::Start; let mut cursor = if start { reading.left() } else { reading.right() }; - for (column, width) in plan.columns.iter().zip(widths) { + for (at, (column, width)) in plan.columns.iter().zip(widths).enumerate() { let span = if start { (cursor, cursor + width) } else { (cursor - width, cursor) }; cursor = if start { span.1 } else { span.0 }; let cell = plan.flow.to_physical(Rect::from_x_y_ranges(span.0..=span.1, reading.y_range())); @@ -1228,7 +1239,8 @@ impl Pass<'_, P> { // (photocraft#16461). Content taller than the dock scrolls inside. Only a floating stepped window is as // tall as its content. self.report.placed.push((first.clone(), cell)); - let at = ColumnAt { cell, edge: plan.edge, bar: ColumnBar::Own, within: body.rect, open: plan.open.clone() }; + let card = scene.sizes.column_cards.then(|| scene.sizes.card_inset(at)); + let at = ColumnAt { cell, edge: plan.edge, bar: ColumnBar::Own, within: body.rect, open: plan.open.clone(), card }; self.column(ui, body, column, at); } } @@ -1321,7 +1333,7 @@ impl Pass<'_, P> { let spec = |panel: &P| scene.spec(panel); let name = Label::from(body.words::().panels.as_str().to_owned()); let dock = self.dock; - let ColumnAt { mut cell, edge, bar, within, open } = at; + let ColumnAt { mut cell, edge, bar, within, open, card } = at; let in_window = bar == ColumnBar::Window; if in_window { DockTargets::

::register_room(ui.ctx(), dock, cell); @@ -1329,18 +1341,24 @@ impl Pass<'_, P> { let opens = if edge == DockEdge::Start { Side::End } else { Side::Start }; // Only a docked column's icons are a rail; a floating window's open flyouts. let mode = if in_window { IconicMode::Flyouts } else { scene.config.iconic_mode }; - let mut icons = |cell: Rect, open: Option

| { + // The width the user gives a column by its inner edge leaves out its card's inset. + let inset = card.unwrap_or(0.0); + let mut icons = |cell: Rect, open: Option

, card: Option| { let footer = scene.rail_footer.filter(|panel| mode == IconicMode::Rail && column.panels().any(|item| item == *panel)); let pass = RefCell::new(&mut *self); let draw = |ui: &mut Ui, rect: Rect, open: Option

| { - IconicColumn::new(name.clone(), dock, column, Bind::given(open), &spec) + let shown = IconicColumn::new(name.clone(), dock, column, Bind::given(open), &spec) .edge(edge) .opens(opens) .bar(bar) .within(within) .auto_collapse(scene.auto_collapse) - .mode(mode) - .show_flyouts_at(ui, rect, |group, at, ui, body| pass.borrow_mut().group_of(ui, body, group, at, in_window)) + .mode(mode); + let shown = match card { + Some(inset) => shown.card(inset), + None => shown, + }; + shown.show_flyouts_at(ui, rect, |group, at, ui, body| pass.borrow_mut().group_of(ui, body, group, at, in_window)) }; if let Some(panel) = footer { let height = IconicSizes::of(ui.ctx()).icons_height(column) + scene.sizes.bar; @@ -1362,10 +1380,11 @@ impl Pass<'_, P> { } }; let work = if column.iconic { - let Some(output) = icons(cell, open) else { return }; + let Some(output) = icons(cell, open, card) else { return }; self.report.flyout.extend(output.edit.events); self.rail_work(output.front); - ColumnWork { iconic: output.iconic, picked: output.picked, resized: Vec::new(), width: output.width, flyout: output.flyout } + let width = output.width.map(|width| width - inset); + ColumnWork { iconic: output.iconic, picked: output.picked, resized: Vec::new(), width, flyout: output.flyout } } else { if !in_window && scene.rail_beside(column) { // The rail keeps to the dock's window edge and the expanded column shows inward of it. @@ -1377,7 +1396,8 @@ impl Pass<'_, P> { (cell.with_min_x(cell.right() - rail), cell.with_max_x(cell.right() - rail)) }; cell = rest; - let Some(output) = icons(rail_cell, None) else { return }; + // The rail stands square at the window edge; the expanded column's card is inward of it. + let Some(output) = icons(rail_cell, None, None) else { return }; self.rail_work(output.front); // The rail's inner edge sets its own width, not the expanded column's. self.column_work(column, ColumnWork { iconic: output.iconic, picked: output.picked, resized: Vec::new(), width: None, flyout: None }); @@ -1391,10 +1411,15 @@ impl Pass<'_, P> { .arrow(self.arrow_of(column)) .within(within) .auto_collapse(scene.auto_collapse); + let shown = match card { + Some(inset) => shown.card(inset), + None => shown, + }; let output = shown.show_groups_at(ui, cell, |group, rect, ui, body| { self.group_of(ui, body, group, GroupAt::Show(rect), in_window); }); - ColumnWork { iconic: output.iconic, picked: output.picked, resized: output.resized, width: output.width, flyout: None } + let width = output.width.map(|width| width - inset); + ColumnWork { iconic: output.iconic, picked: output.picked, resized: output.resized, width, flyout: None } }; self.column_work(column, work); } @@ -1584,7 +1609,7 @@ impl Pass<'_, P> { // An OS window's flyouts and other layers take the room around the window (`overlay::layer_room`); an // in-app window's stay in the float area. let within = if opening.spec.is_some() { Rect::NOTHING } else { scene.bounds }; - let at = ColumnAt { cell: body.rect, edge, bar: ColumnBar::Window, within, open: open.clone() }; + let at = ColumnAt { cell: body.rect, edge, bar: ColumnBar::Window, within, open: open.clone(), card: None }; self.column(ui, body, &window.column, at); }); self.dock = area_dock; diff --git a/crates/ui-patterns/src/patterns/dock/area/stories.rs b/crates/ui-patterns/src/patterns/dock/area/stories.rs index 2dd2b3a58..9513ad85a 100644 --- a/crates/ui-patterns/src/patterns/dock/area/stories.rs +++ b/crates/ui-patterns/src/patterns/dock/area/stories.rs @@ -121,8 +121,12 @@ fn workspace(minimized: bool) -> Arc> { static SPECS: LazyLock> = LazyLock::new(|| Tracked::new(DemoSpecs)); fn dock(ui: &mut Ui, data: &mut StoryData, demo: &mut Demo, minimized: bool) -> StoryOutput { + dock_with(ui, data, demo, minimized, DockConfig::default()) +} + +fn dock_with(ui: &mut Ui, data: &mut StoryData, demo: &mut Demo, minimized: bool, config: DockConfig) -> StoryOutput { let (workspace, workspace_at) = data.value_at("workspace", workspace(minimized)); - DockArea::new("Dock", workspace_at.bind(&mut *workspace), &*SPECS, demo, DockConfig::default()).show(ui).into() + DockArea::new("Dock", workspace_at.bind(&mut *workspace), &*SPECS, demo, config).show(ui).into() } #[story(DockArea<'static, usize>, covers = [Default], drive = Drive::Never)] @@ -140,6 +144,14 @@ fn host_rows_above_the_dock_rows_in_a_panel_menu(ui: &mut Ui, data: &mut StoryDa dock(ui, data, &mut Demo { canvas_view: false, host_rows: true }, false) } +/// Every group shows its panel menu button, the three-line mark, whether its shown panel has rows of its own or only +/// the dock's (`DockConfig::panel_menu_always`, `DockConfig::panel_menu_icon`): VectorCraft's dock. +#[story(DockArea<'static, usize>, covers = [Default], drive = Drive::Never)] +fn a_menu_button_on_every_group(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let config = DockConfig::default().panel_menu_always(true).panel_menu_icon(IconId::new("menu")); + dock_with(ui, data, &mut Demo { canvas_view: false, host_rows: false }, false, config) +} + /// The floating group minimized: its window shows the title row and the tab strip at its width. #[story(DockArea<'static, usize>, covers = [Default], drive = Drive::Never)] fn a_minimized_floating_window(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { diff --git a/crates/ui-patterns/src/patterns/dock/switcher.rs b/crates/ui-patterns/src/patterns/dock/switcher.rs index dc56dd176..fc48ecb02 100644 --- a/crates/ui-patterns/src/patterns/dock/switcher.rs +++ b/crates/ui-patterns/src/patterns/dock/switcher.rs @@ -7,7 +7,7 @@ use crate::contract::{Bind, Entry, NoValue, Outcome, Props as _, Show as _, Sizi use crate::display::Divider; use crate::docking::{DockWords, WorkspaceCommands}; use crate::menu::MenuItem; -use crate::pickers::Select; +use crate::pickers::{Select, SelectLook}; use crate::runtime::commands::CommandRef; use crate::runtime::env::Env; use craft_behavior::dock::WorkspaceSet; @@ -44,12 +44,13 @@ pub struct WorkspaceSwitcher<'a, P> { set: &'a WorkspaceSet

, /// The header menu's command rows in place of the default ones ([`WorkspaceSwitcher::commands`]). commands: Option>, + look: SelectLook, } impl<'a, P> WorkspaceSwitcher<'a, P> { /// A switcher over `set`. pub fn new(set: &'a WorkspaceSet

) -> Self { - WorkspaceSwitcher { set, commands: None } + WorkspaceSwitcher { set, commands: None, look: SelectLook::Field } } /// The header menu's command rows, in place of the default `WorkspaceCommands` rows. @@ -58,14 +59,22 @@ impl<'a, P> WorkspaceSwitcher<'a, P> { self } + /// How the select looks and how wide it is: a field as wide as the widest workspace name by default, or a quiet box + /// as wide as the current one (`SelectLook::Quiet`). + pub fn look(mut self, look: SelectLook) -> Self { + self.look = look; + self + } + /// Shows the switcher and reports the workspace picked. pub fn show(self, ui: &mut Ui) -> WorkspaceSwitcherOutput { - let WorkspaceSwitcher { set, commands } = self; + let WorkspaceSwitcher { set, commands, look } = self; let words = Env::of(ui).words::(); let entries: Vec> = set.builtin.iter().chain(&set.saved).map(|w| Entry::new(w.id.clone(), w.name.clone())).collect(); let shown = Select::new(words.choose_workspace.clone(), Bind::given(set.current.clone()), &entries) .size(ControlSize::Sm) .sizing(Sizing::Content) + .look(look) .header_menu(|ui, _| match &commands { Some(rows) => { for row in rows { diff --git a/crates/ui-patterns/src/patterns/dock/switcher/stories.rs b/crates/ui-patterns/src/patterns/dock/switcher/stories.rs index 03e917f8b..4f894bb35 100644 --- a/crates/ui-patterns/src/patterns/dock/switcher/stories.rs +++ b/crates/ui-patterns/src/patterns/dock/switcher/stories.rs @@ -2,6 +2,7 @@ use super::WorkspaceSwitcher; use crate::docking::WorkspaceCommands; +use crate::pickers::SelectLook; use crate::testing::{Drive, StoryData, StoryOutput, story}; use craft_behavior::dock::{NamedWorkspace, Workspace, WorkspaceSet}; use egui::Ui; @@ -21,3 +22,13 @@ fn workspace_switcher_commands(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { let set = WorkspaceSet::new(vec![essentials]); WorkspaceSwitcher::new(&set).commands(vec![WorkspaceCommands::New.into(), WorkspaceCommands::Reset.into()]).show(ui).into() } + +/// A quiet switcher, as wide as the current workspace's name, beside a longer one: it sits on the panel surface with +/// no edge until it has focus. +#[story(WorkspaceSwitcher<'static, u32>, covers = [], drive = Drive::Never)] +fn workspace_switcher_quiet(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + let essentials = NamedWorkspace::new("essentials", "Essentials", Workspace::::default()); + let long = NamedWorkspace::new("print", "Print production and prepress", Workspace::::default()); + let set = WorkspaceSet::new(vec![essentials, long]); + WorkspaceSwitcher::new(&set).look(SelectLook::Quiet).show(ui).into() +} diff --git a/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs b/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs index cbc7b8c4f..b95aee9bb 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs @@ -2000,12 +2000,21 @@ impl StackDialog for HostedParamDialog { self.requests.answer_color(key, color); } - /// Sets the fields on a clone of the values and commits the clone only when every field is accepted. + /// Sets the fields on a clone of the values and commits the clone only when every field is accepted. The rows are + /// those the user sees: the host's labels and shown states over every tab's rows; a read-only dialog refuses all. fn set_json_fields(&mut self, _: &Context, fields: &[(String, Value)]) -> Result<(), String> { - let params = (self.build)(&mut self.fields).params.into_owned(); + let (params, read_only) = { + let mut dialog = (self.build)(&mut self.fields); + self.rows.apply(&mut dialog); + let ParamDialog { params, tabs, read_only, .. } = dialog; + (every_param(params, &tabs).into_owned(), read_only) + }; let mut staged = self.fields.clone(); let mut preview = self.preview_on; for (field, value) in fields { + if read_only { + return Err(FieldRefusal::Inactive.message(field)); + } match (field.as_str(), &self.presets) { ("preview", _) if self.previews => { preview = value.as_bool().ok_or_else(|| FieldRefusal::Rejects(value).message(field))?; @@ -2018,11 +2027,7 @@ impl StackDialog for HostedParamDialog { _ => set_param_field(¶ms, &mut staged, field, value.clone())?, } } - for param in params.iter().filter(|param| matches!(param.kind, ParamKind::Files { .. })) { - if let Some(request) = param.listing_after(&self.fields, &staged) { - self.requests.request_listing(request); - } - } + self.requests.request_set(¶ms, &self.fields, &staged); self.fields = staged; self.preview_on = preview; Ok(()) diff --git a/crates/ui-patterns/src/patterns/form_dialogs/host_requests.rs b/crates/ui-patterns/src/patterns/form_dialogs/host_requests.rs index ce5933cfe..af852f73f 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/host_requests.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/host_requests.rs @@ -223,13 +223,18 @@ impl HostRequests { pub fn set_field(&mut self, params: &[Param], fields: &mut DialogFields, field: &str, value: Value) -> Result<(), String> { let before = fields.clone(); super::set_param_field(params, fields, field, value)?; + self.request_set(params, &before, fields); + Ok(()) + } + + /// Files what a set through automation of the rows `params` from `before` to `after` files ([`set_field`](Self::set_field)). + pub fn request_set(&mut self, params: &[Param], before: &DialogFields, after: &DialogFields) { for param in params.iter().filter(|param| matches!(param.kind, ParamKind::Files { .. })) { - if let Some(request) = param.listing_after(&before, fields) { + if let Some(request) = param.listing_after(before, after) { self.request_listing(request); } } - self.request_edited(edited_rows(params, &before, fields)); - Ok(()) + self.request_edited(edited_rows(params, before, after)); } /// The row keys an edit changed since the last take. diff --git a/crates/ui-patterns/src/patterns/form_dialogs/rows.rs b/crates/ui-patterns/src/patterns/form_dialogs/rows.rs index 9ff040e87..4b4b03b86 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/rows.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/rows.rs @@ -13,7 +13,7 @@ use super::words::ParamWords; use crate::buttons::{Button, IconButton, ToggleButton}; use crate::choice::{Checkbox, Radio, RadioGroup, Swatch}; use crate::contract::{ - Bind, BodyCx, CanvasGesture, CaptionColumn, Entry, FieldLayout, LabelScheme, NoValue, Outcome, Props as _, Remember as _, Sampler as _, + Bind, BodyCx, CanvasGesture, CaptionColumn, Entry, FieldLayout, LabelScheme, NoValue, Outcome, Pad, Props as _, Remember as _, Sampler as _, Show as _, ShowContainer as _, SideLabel, Sizing, TooltipSpec, clicked, }; use crate::display::Text; @@ -26,6 +26,7 @@ use crate::pickers::{Select, UnitSelect}; use crate::runtime::env::{Env, Label, UnitKind, Units, with_env}; use crate::sections::{HeaderStrength, Section}; +use crate::style::SurfaceKind; use crate::text::{NumberField, RangeAlert, SelectableText, TextField, UnitPlacement}; use crate::value_drag::{AngleDial, PointPicker, SliderScale}; @@ -706,7 +707,14 @@ impl<'p> Pass<'p> { /// One section: its head, then its rows. fn section(&mut self, ui: &mut Ui, head: &Param, body: &[Param]) { let title = plain(&head.label); + let outer = self.heading.replace(title.as_str().to_owned()); match head.option().head() { + // A document dialog's option group: a caption over its rows on a card. + Head::Fixed if self.shaded => { + Section::fixed(title).id_salt(head.key.as_str()).strength(HeaderStrength::Caption).show(ui, |ui, _| { + Stack::new().fill_width().surface(SurfaceKind::Raised).pad(Pad::Control).show(ui, |ui, _| self.body(ui, body)); + }); + } Head::Fixed => { Section::fixed(title).id_salt(head.key.as_str()).show(ui, |ui, _| self.body(ui, body)); } @@ -724,6 +732,7 @@ impl<'p> Pass<'p> { }); } } + self.heading = outer; } /// `param` as the pass shows it, `compact` in a pair. diff --git a/crates/ui-patterns/src/patterns/panels/inspector.rs b/crates/ui-patterns/src/patterns/panels/inspector.rs index d4ede9326..c2b93509b 100644 --- a/crates/ui-patterns/src/patterns/panels/inspector.rs +++ b/crates/ui-patterns/src/patterns/panels/inspector.rs @@ -22,6 +22,9 @@ pub(crate) mod stories; /// - No target: the body is replaced by a centred notice, `empty` or "No properties", and the header shows the label. /// - The body can hold a `SectionStack` for sections the user reorders. /// - Padding: none of its own. An inspector is a dock body, docked or floating, and the dock group insets it. +/// - Title weight: a section heading's by default, as the headings of the sections under it; +/// [`title_strength`](Inspector::title_strength) gives another, such as `Quiet` for a muted kind line over the +/// sections. #[derive(crate::contract::Pattern)] pub struct Inspector<'a> { label: Label, @@ -30,6 +33,7 @@ pub struct Inspector<'a> { name: Option