diff --git a/crates/atomic/src/lib.rs b/crates/atomic/src/lib.rs index 2fa589d099..5aa3c75cd4 100644 --- a/crates/atomic/src/lib.rs +++ b/crates/atomic/src/lib.rs @@ -548,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}; @@ -560,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() { @@ -595,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 b1da9be0a2..fcafd2ca78 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/color-ui/src/ui/mod.rs b/crates/color-ui/src/ui/mod.rs index 58a1ee6bf8..54fb837833 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 e6887a0e76..28de7cc7b1 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 3d2c3100d7..ca6748ed04 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 1e2a783449..dfe187fd0e 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 0000000000..ace5e86685 --- /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 3951d5e6b9..aa3521991e 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 c0fadd96e2..7dbd80260f 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 b792fe9409..cfc007bbfa 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 f34cac5066..9f15599130 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 071ae4684a..efe960a134 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 2fc10109bd..0b08850bbd 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 e4e60c79ac..e0aa1babf9 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/owner_only.rs b/crates/platform/src/owner_only.rs index 506907e031..e664dcffe4 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/editor.rs b/crates/text/src/ui/editor.rs index 29a7d6b94e..93a9a5ee64 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 b8a9da4ec5..c9a0e265f6 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 327efd8fb7..1911106a6a 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 c57e37138d..6f2dd81168 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 3b688f220b..6101f7a76b 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/size.rs b/crates/theme/src/tokens/size.rs index 070402c7fe..ce32a174a8 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/tests/dumps/tokens/adwaita-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt index b9775df30a..28bb4e5401 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt @@ -152,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 3473dc1141..049f56f19c 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt @@ -152,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 7c79ce22fb..46ae206f3e 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt index 35e209a7cf..cf3838c0da 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt index 2cccdc47d2..1bfc924395 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt @@ -152,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 6bfe73ca8d..829789b5bf 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt @@ -152,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 407efd953a..8becd841b2 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt index 259fec4249..3be11340e7 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt index 72f92b55c7..032d4a3230 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt @@ -152,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 8f7404506e..d13f08ba9d 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt @@ -152,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 2f6d4bf660..a9ad075e49 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt index 0b9ef0d530..c3197b3d9f 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt index 17c3f20e58..b18e615c97 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt @@ -152,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 f57a97bb24..7c1bdafc65 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt @@ -152,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 b903fb3d89..c04d76f9d1 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt index 3af9fd4631..f7448bea32 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt index b3763445ed..6f2fb58490 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt @@ -152,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 c8dbe72541..f7033fe8fa 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt @@ -152,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 ae5183f13a..8dfdb66731 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt @@ -152,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 2a8d84d2ae..4959b6cc60 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt @@ -152,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 f3bb516737..a7a3b4adf6 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt @@ -152,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 0f4b69e824..ca17d13ecc 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt @@ -152,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 18bb48150d..cddf7cf0d7 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt @@ -152,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 b0303accff..134343b10a 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt @@ -152,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 13727cb0fa..4989b3eaf0 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt @@ -152,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 066d41b5ff..68563809d0 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt @@ -152,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 2b68b4b3bc..b52c28cad2 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt index 36bb43ae8a..e9b370a382 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt index e0e59ac2f2..b94b40adb8 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt @@ -152,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 d0d601bedc..16a7e2e94e 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt @@ -152,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 4b8f20dd78..5223539c48 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt @@ -152,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 1072f5fb83..bf757ef21e 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt @@ -152,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 95496cba80..feea7e8c09 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt @@ -152,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 7f321c715a..ac715e1054 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt @@ -152,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 d4a16141c3..109721a5c8 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt @@ -152,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 7010fd5072..546ddb2ce0 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt @@ -152,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 68e27a0bf2..e6d3fca3b1 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt @@ -152,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 5378f8d1ad..20995a4ed6 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt @@ -152,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 eb4dc5245b..41ef2b8fb8 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 @@ -152,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-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt index 2006a70008..1cfb24ce16 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt index a72a2ce930..0613337f34 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt index aa80bb3ec8..d4bc3c92cf 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 @@ -152,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 6c2d5ac981..c08ddb36e3 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 @@ -152,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 a056292cd7..4e755587f0 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 @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt index 0432039e9b..d101cd1e89 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 @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt index 3fb00c5b05..946945fae4 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt @@ -152,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 9cb3857e54..102ba36e01 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt @@ -152,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 aee7987759..5f921a8cd1 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt index 97f1148052..6b320a4809 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt index 2105907f30..809ad26579 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt @@ -152,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 77f6ccdf66..17b68a56a3 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt @@ -152,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 69a634cf7d..c8213d01c7 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt @@ -152,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 d535ed6bac..e7bd9f094f 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt @@ -152,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 d3052e3dcc..1da506ba38 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt @@ -152,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 ba3c5a1ba7..0765c69df4 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt @@ -152,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 2ca46e3628..aa6f1f5aff 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt @@ -152,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 3e5f7d544c..608d7b62fe 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt @@ -152,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 81709fae15..3ec91240c3 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 @@ -152,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 52074cba6f..5074be5a19 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 @@ -152,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 cbd58a3e9f..9c81b7d0c9 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 @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt index 2aa846b608..2b5e409fdf 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 @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt index 7c96649c4c..da22e8f42e 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt @@ -152,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 aa84dca3f7..4c0a039d71 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt @@ -152,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 cba6ebd6b3..72edc0bc3e 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt index 3f1d0c6f82..0b3cebd636 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt @@ -152,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-high-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt index 238bc1c669..696d0c65d3 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt @@ -152,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 23d08b1452..d02a991db0 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt @@ -152,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 0a5a53a709..0eed9e1dc0 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt @@ -152,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-standard-compact.txt b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt index 343cf762a0..4795b318f1 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt @@ -152,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/vectorcraft-modern-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt index 05862e073e..203058f17e 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt index 4c5d9b971a..ef5cc26a98 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt index 14a5252355..bbd3c86685 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt index e4068c5d4e..82eb87700f 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt index d7384b50f6..675d61735b 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-light-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt index ae25fc6242..7e7995f7b6 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt index f610585cb7..e3e7042afd 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt index aeeae13fd3..b964bb193a 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt index 97a4824005..be7069df77 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt index c8561174b8..c0a17cbc7f 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt index e84b9e3e75..a0e76f1a57 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt index 841009d9c7..beac805f45 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt index c520b18b0a..f1f2199d9b 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-light-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt index 38de13e382..1591b94cf8 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt index bfeee3a203..edea9520bd 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/vectorcraft-modern-medium-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt index 3cdc856659..4da02566e1 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 @@ -68,7 +68,7 @@ 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 @@ -152,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/themes/vectorcraft-modern-medium.json b/crates/theme/themes/vectorcraft-modern-medium.json index bc43e6148d..ce7aa47004 100644 --- a/crates/theme/themes/vectorcraft-modern-medium.json +++ b/crates/theme/themes/vectorcraft-modern-medium.json @@ -32,6 +32,7 @@ "state.hover": "#c5ccd6", "state.pressed": "#d4b5b6", "state.selected": "#d4bbbd", + "state.text_selection": "#d9472f8c", "surface.background": "#c4cad4", "surface.canvas": "#b9c0cb", "surface.control": "#c9d0da", @@ -53,6 +54,7 @@ "state.hover": "#353c49", "state.pressed": "#633f3e", "state.selected": "#573b3d", + "state.text_selection": "#f06a528c", "surface.background": "#1b1f27", "surface.canvas": "#1e222a", "surface.control": "#39404d", diff --git a/crates/theme/themes/vectorcraft-modern.json b/crates/theme/themes/vectorcraft-modern.json index 27424c4737..49853128a1 100644 --- a/crates/theme/themes/vectorcraft-modern.json +++ b/crates/theme/themes/vectorcraft-modern.json @@ -32,6 +32,7 @@ "state.hover": "#e3e7ed", "state.pressed": "#edcbc8", "state.selected": "#eed2d0", + "state.text_selection": "#d9472f8c", "surface.background": "#e6e9ee", "surface.canvas": "#dfe3e9", "surface.control": "#e3e7ed", @@ -53,6 +54,7 @@ "state.hover": "#262b35", "state.pressed": "#593330", "state.selected": "#4c2e2e", + "state.text_selection": "#f06a528c", "surface.background": "#0b0d12", "surface.canvas": "#101217", "surface.control": "#282d37", diff --git a/crates/ui-canvas/src/canvas/mod.rs b/crates/ui-canvas/src/canvas/mod.rs index 162b9fa290..88a0dd64db 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 0625da39d9..a175bb976c 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 8a1e4ed55e..8542c6d682 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 58d1094cb5..732817ba20 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 81e96c0b4c..669d2136dc 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 9d357c830c..0f9e0c80dc 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 d2b6a8b731..69b91085d6 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_controls/task_bar.rs b/crates/ui-canvas/tests/it/canvas_controls/task_bar.rs index 74405a0917..6aa85685b2 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 2faac53ce7..34dc4a8640 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 1c178e9d66..a92e7820ed 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 1d74217e4f..a02bea21bb 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 291dda3b8c..fb634c8430 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 cf5d2c5d6f..502851b41b 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 ac8624c33b..4705042554 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/label.rs b/crates/ui-contract/src/contract/label.rs index b10a44bcbf..236d7bf1ab 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 671948bf99..62274da560 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 07d50ddcce..8e5785bc8f 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