From 7b745c75bf0e0137ad9c7e12cf65b4e0583ca048 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 17 Nov 2026 18:20:35 +0000 Subject: [PATCH 1/7] Colour picker: Photoshop's fixed Full arrangement, dialog buttons in a body slot - FooterPlace::Body and FooterSlot: a container's footer drawn at the cell its body keeps; the footer step still runs it, so roles, platform order, Enter, Escape and Alt-Reset stay the dialog's. Dialog::button_place(ButtonPlace { Foot, Side, Body }) replaces side_buttons(bool); every caller updated. - Grid::fit(GridFit { Stack, Fixed }) and layout::empty_cell, with the grid_fixed story. - ColorArea sizes by AreaShape { Plot, Square } from tokens, never from the room. - CompareSwatch: one block, new over current, one edge, captions, warnings column from the block's top. - ColorWarningChip arrangement enum (Stacked, Beside) replaces beside(bool); icon.sm chips. - Full: area and strip over Only Web Colors and the screen-pick button; compare block and actions slot over two field groups in grids that never stack; '#' in the radio column, hex field across the channel cells. No wrap, no alpha row, no OKLCH column (OKLCH rows join group 2 with their radios); Only Web Colors always shown. - Compact: width from the plot area and strip; hex row with the screen-pick button at its end. - ColorPickerDialog puts its buttons in the picker's slot; color_picker_dialog story. - Trials: Full arrangement across rooms, densities and themes; dialog proportions and button cell; compact width; body-placed dialog buttons and their keys. --- crates/color-ui/src/ui/area.rs | 29 +- crates/color-ui/src/ui/area/stories.rs | 14 +- crates/color-ui/src/ui/compare.rs | 185 +++++++++ crates/color-ui/src/ui/compare/stories.rs | 27 ++ crates/color-ui/src/ui/mod.rs | 11 +- crates/color-ui/src/ui/panel.rs | 6 +- crates/color-ui/src/ui/picker/compact.rs | 29 +- crates/color-ui/src/ui/picker/full.rs | 373 ++++++------------ crates/color-ui/src/ui/picker/mod.rs | 122 +++--- crates/color-ui/src/ui/picker/stories.rs | 43 +- crates/color-ui/src/ui/picker_dialog.rs | 17 +- crates/color-ui/src/ui/popover.rs | 2 +- crates/color-ui/src/ui/warning.rs | 169 ++++++++ crates/color-ui/src/ui/warning/stories.rs | 24 ++ crates/color-ui/tests/it/picker.rs | 266 ++++++++++--- .../src/ui/layer_style/contour/editor.rs | 4 +- crates/imaging/src/ui/layer_style/hosted.rs | 4 +- .../text/src/ui/character/paragraph_dialog.rs | 4 +- crates/text/src/ui/find/dialog.rs | 4 +- crates/text/src/ui/hyperlink.rs | 13 +- crates/text/src/ui/spelling.rs | 4 +- crates/timeline/src/ui/markers/dialog.rs | 4 +- crates/ui-contract/src/contract/body/hooks.rs | 56 ++- .../ui-contract/src/contract/body/regions.rs | 8 +- crates/ui-contract/src/contract/body/size.rs | 4 +- crates/ui-contract/src/contract/container.rs | 7 +- .../ui-contract/src/contract/footer_slot.rs | 89 +++++ crates/ui-contract/src/contract/mod.rs | 4 +- crates/ui-contract/src/layout/body.rs | 45 ++- crates/ui-contract/src/layout/mod.rs | 2 +- crates/ui-contract/src/runtime/env.rs | 12 + crates/ui-contract/src/runtime/env/view.rs | 5 + crates/ui-contract/src/runtime/pass_state.rs | 1 + crates/ui-panels/src/dialog/mod.rs | 2 +- crates/ui-panels/src/dialog/modal.rs | 46 ++- crates/ui-panels/src/dialog/stories.rs | 40 +- crates/ui-panels/src/dialog/trials.rs | 64 ++- .../src/patterns/form_dialogs/dialog.rs | 12 +- .../src/patterns/form_dialogs/form.rs | 21 +- .../src/patterns/form_dialogs/guides.rs | 5 +- .../src/patterns/form_dialogs/list_manager.rs | 21 +- .../ui-widgets/src/layout_components/mod.rs | 10 +- .../src/layout_components/stories.rs | 20 + 43 files changed, 1334 insertions(+), 494 deletions(-) create mode 100644 crates/color-ui/src/ui/compare.rs create mode 100644 crates/color-ui/src/ui/compare/stories.rs create mode 100644 crates/color-ui/src/ui/warning.rs create mode 100644 crates/color-ui/src/ui/warning/stories.rs create mode 100644 crates/ui-contract/src/contract/footer_slot.rs diff --git a/crates/color-ui/src/ui/area.rs b/crates/color-ui/src/ui/area.rs index bd41e554dd..0f3fe324bc 100644 --- a/crates/color-ui/src/ui/area.rs +++ b/crates/color-ui/src/ui/area.rs @@ -39,8 +39,9 @@ pub struct ColorAreaStyle { /// The area keeps its axes right to left: across still grows to the right. Its value text names both components /// ("Saturation 40 %, Brightness 70 %", from [`names`](ColorArea::names)). /// -/// It is at least `size.plot` and fills the width its row leaves; with `Props::sizing(Sizing::Fill)` it takes the room -/// on both axes, however small (the Color panel's field, as tall as its dock group leaves it). +/// Its size comes from its [`shape`](ColorArea::shape), never from the room: the compact pickers' field at plot +/// proportions, or the Color Picker dialog's square. With `Props::sizing(Sizing::Fill)` it takes the room on both axes +/// instead, however small (the Color panel's field, as tall as its dock group leaves it). #[derive(craft_ui::contract::Component, craft_ui::contract::Props)] pub struct ColorArea<'a> { #[common] @@ -56,12 +57,27 @@ pub struct ColorArea<'a> { /// The names of the across and down components in the value text; the model's channel names without them. #[prop] names: Option<[Label; 2]>, + /// The size of an area that does not fill its room; plot proportions by default. + #[prop] + shape: AreaShape, +} + +/// The size of a [`ColorArea`] that does not fill its room. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum AreaShape { + /// `size.plot.width` wide and `size.plot.height` tall: the field of the Color panel's popover and the compact + /// pickers, wider than tall. + #[default] + Plot, + /// A square `size.plot.width` on a side: the Color Picker dialog's field, as Photoshop's. + Square, } impl<'a> ColorArea<'a> { /// An area named `label` ("Saturation and brightness") showing `values`, values of `mode`'s model. pub fn new(label: impl Into