mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 23:49:35 +00:00
stories: bind mixed story values through StoryData::bind_mixed
Scripted: Bind::bound_mixed(data.value(..)) becomes data.bind_mixed(..) at 35 sites, and an import of Bind that nothing else uses goes.
This commit is contained in:
@@ -247,7 +247,7 @@ fn tip_ellipse(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(TipEllipse<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn tip_ellipse_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
TipEllipse::new("Tip angle and roundness", Bind::bound_mixed(data.value("mixed", Mixed::<TipAngle>::Mixed))).show(ui).into()
|
||||
TipEllipse::new("Tip angle and roundness", data.bind_mixed("mixed", Mixed::<TipAngle>::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(TipEllipse<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -144,7 +144,7 @@ fn font_picker_arabic_sample(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
#[story(FontPicker<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn font_picker_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let catalog = catalog();
|
||||
FontPicker::new("Font family", Bind::bound_mixed(data.value("family", Mixed::<String>::Mixed)), &catalog).show(ui).into()
|
||||
FontPicker::new("Font family", data.bind_mixed("family", Mixed::<String>::Mixed), &catalog).show(ui).into()
|
||||
}
|
||||
|
||||
/// A family the catalog does not hold, which the check refuses.
|
||||
|
||||
@@ -43,7 +43,7 @@ fn levels_editor_stale(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(LevelsEditor<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn levels_editor_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
LevelsEditor::new("Levels", Bind::bound_mixed(data.value("mixed", Mixed::<Levels>::Mixed))).show(ui).into()
|
||||
LevelsEditor::new("Levels", data.bind_mixed("mixed", Mixed::<Levels>::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(LevelsEditor<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -87,7 +87,7 @@ fn curve_graph(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(CurveGraph<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn curve_graph_that_differs(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
CurveGraph::new("Curve", Bind::bound_mixed(data.value("mixed", Mixed::<Curve>::Mixed))).show(ui).into()
|
||||
CurveGraph::new("Curve", data.bind_mixed("mixed", Mixed::<Curve>::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
/// A graph that refuses a curve of more than two points.
|
||||
|
||||
@@ -60,7 +60,7 @@ fn edge_picker(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(EdgePicker<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn edge_picker_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
EdgePicker::new("Borders", Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).show(ui).into()
|
||||
EdgePicker::new("Borders", data.bind_mixed("mixed", Mixed::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(EdgePicker<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -33,7 +33,7 @@ fn timecode_field(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(TimecodeField<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn timecode_field_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
TimecodeField::new("Current time", Bind::bound_mixed(data.value("mixed", Mixed::<Tick>::Mixed)), drop_frame()).show(ui).edit.into()
|
||||
TimecodeField::new("Current time", data.bind_mixed("mixed", Mixed::<Tick>::Mixed), drop_frame()).show(ui).edit.into()
|
||||
}
|
||||
|
||||
#[story(TimecodeField<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -33,7 +33,7 @@ fn group_box_gate_off(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(GroupBox<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn group_box_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
GroupBox::new("Grid", Some(Bind::bound_mixed(data.value("mixed", Mixed::Mixed)))).show(ui, |ui, _| body(ui)).into()
|
||||
GroupBox::new("Grid", Some(data.bind_mixed("mixed", Mixed::Mixed))).show(ui, |ui, _| body(ui)).into()
|
||||
}
|
||||
|
||||
#[story(GroupBox<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
@@ -69,7 +69,7 @@ fn group_box_apply_on(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(GroupBox<'static>, covers = [], drive = Drive::Never)]
|
||||
fn group_box_apply_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
GroupBox::apply("Opacity", Bind::bound_mixed(data.value("mixed", Mixed::<bool>::Mixed))).show(ui, |_, _| {}).into()
|
||||
GroupBox::apply("Opacity", data.bind_mixed("mixed", Mixed::<bool>::Mixed)).show(ui, |_, _| {}).into()
|
||||
}
|
||||
|
||||
#[story(GroupBox<'static>, covers = [], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `TitleRow`.
|
||||
|
||||
use super::{HeaderAction, HeaderStrength, TitleRow};
|
||||
use crate::contract::{Bind, Pad, Show as _, ShowContainer as _, Validity};
|
||||
use crate::contract::{Pad, Show as _, ShowContainer as _, Validity};
|
||||
use crate::display::{Divider, Text};
|
||||
use crate::layout_components::Stack;
|
||||
use crate::primitives::IconSpec;
|
||||
@@ -38,7 +38,7 @@ fn title_row_with_disclosure(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(TitleRow<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn title_row_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
TitleRow::new("Grid").gate(Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).show(ui).edit.into()
|
||||
TitleRow::new("Grid").gate(data.bind_mixed("mixed", Mixed::Mixed)).show(ui).edit.into()
|
||||
}
|
||||
|
||||
#[story(TitleRow<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of the buttons.
|
||||
|
||||
use super::{Button, IconButton, Link, SplitButton, ToggleButton};
|
||||
use crate::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, Validity};
|
||||
use crate::contract::{Entry, Props as _, Show as _, ShowContainer as _, Validity};
|
||||
use crate::display::{Shade, Text};
|
||||
use crate::layout_components::{Grid, Row};
|
||||
use crate::primitives::IconSpec;
|
||||
@@ -127,7 +127,7 @@ fn toggle_button(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(ToggleButton<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn toggle_button_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
ToggleButton::new("Snap to grid", Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).show(ui).into()
|
||||
ToggleButton::new("Snap to grid", data.bind_mixed("mixed", Mixed::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(ToggleButton<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `Checkbox`.
|
||||
|
||||
use super::Checkbox;
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -25,7 +25,7 @@ fn checkbox_checked(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Checkbox<'static>, covers = [Mixed], drive = Drive::Never, group = "States", title = "Mixed")]
|
||||
fn checkbox_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Checkbox::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).label("Snap to grid").show(ui).into()
|
||||
Checkbox::new(data.bind_mixed("mixed", Mixed::Mixed)).label("Snap to grid").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Checkbox<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
@@ -52,7 +52,7 @@ fn checkbox_disabled_checked(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Checkbox<'static>, covers = [], drive = Drive::Never, group = "States", title = "Disabled mixed")]
|
||||
fn checkbox_disabled_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Checkbox::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).label("Disabled (mixed)").enabled(false).show(ui).into()
|
||||
Checkbox::new(data.bind_mixed("mixed", Mixed::Mixed)).label("Disabled (mixed)").enabled(false).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Checkbox<'static>, covers = [], group = "States", title = "Long label")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `RadioGroup` and `Radio`.
|
||||
|
||||
use super::{Radio, RadioGroup};
|
||||
use crate::contract::{Bind, FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel, Validity};
|
||||
use crate::contract::{FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel, Validity};
|
||||
use crate::display::{Shade, Text};
|
||||
use crate::layout_components::{Row, Stack};
|
||||
use crate::runtime::env::Message;
|
||||
@@ -88,7 +88,7 @@ fn radio_group_nested(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(RadioGroup<'static, u8>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn radio_group_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
column(ui, RadioGroup::new("Size", Bind::bound_mixed(data.value("mixed", Mixed::Mixed))))
|
||||
column(ui, RadioGroup::new("Size", data.bind_mixed("mixed", Mixed::Mixed)))
|
||||
}
|
||||
|
||||
#[story(RadioGroup<'static, u8>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `Rating`.
|
||||
|
||||
use super::Rating;
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -34,7 +34,7 @@ fn rating_compact(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Rating<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn rating_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Rating::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), 5).label("Rating").show(ui).into()
|
||||
Rating::new(data.bind_mixed("mixed", Mixed::Mixed), 5).label("Rating").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Rating<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -65,7 +65,7 @@ fn segmented_small(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Segmented<'static, u8>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn segmented_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Segmented::new("Size", Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), &sizes()).show(ui).into()
|
||||
Segmented::new("Size", data.bind_mixed("mixed", Mixed::Mixed), &sizes()).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Segmented<'static, u8>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `Switch`.
|
||||
|
||||
use super::Switch;
|
||||
use crate::contract::{Bind, Props as _, Show as _, ShowContainer as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, ShowContainer as _, Validity};
|
||||
use crate::display::Divider;
|
||||
use crate::layout_components::Stack;
|
||||
use crate::runtime::env::Message;
|
||||
@@ -37,7 +37,7 @@ fn switch_long_label(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Switch<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn switch_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Switch::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).label("Show rulers").show(ui).into()
|
||||
Switch::new(data.bind_mixed("mixed", Mixed::Mixed)).label("Show rulers").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Switch<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -16,7 +16,7 @@ fn disclosure(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Disclosure<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn disclosure_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Disclosure::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).label("Details").show(ui).into()
|
||||
Disclosure::new(data.bind_mixed("mixed", Mixed::Mixed)).label("Details").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Disclosure<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `SliderField`.
|
||||
|
||||
use super::SliderField;
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::{Message, UnitKind};
|
||||
use crate::testing::{Drive, StoryData, StoryOutput, story};
|
||||
use crate::value_drag::SliderScale;
|
||||
@@ -24,7 +24,7 @@ fn slider_field_log(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(SliderField<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn slider_field_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
SliderField::new("Opacity", Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), PERCENT).show(ui).into()
|
||||
SliderField::new("Opacity", data.bind_mixed("mixed", Mixed::Mixed), PERCENT).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(SliderField<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `ComboBox`.
|
||||
|
||||
use super::ComboBox;
|
||||
use crate::contract::{Bind, Entry, Show as _, Validity};
|
||||
use crate::contract::{Entry, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -29,7 +29,7 @@ fn combo_box_long(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
#[story(ComboBox<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn combo_box_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let options = options();
|
||||
ComboBox::new("Font", Bind::bound_mixed(data.value("mixed", Mixed::<String>::Mixed)), &options).show(ui).into()
|
||||
ComboBox::new("Font", data.bind_mixed("mixed", Mixed::<String>::Mixed), &options).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(ComboBox<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `DatePicker` and `Calendar`.
|
||||
|
||||
use super::{Calendar, CalendarView, DatePicker, DatePrecision, PickedDate};
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -29,7 +29,7 @@ fn date_picker_long(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(DatePicker<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn date_picker_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
DatePicker::new("From", Bind::bound_mixed(data.value("mixed", Mixed::<Option<PickedDate>>::Mixed))).show(ui).into()
|
||||
DatePicker::new("From", data.bind_mixed("mixed", Mixed::<Option<PickedDate>>::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(DatePicker<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `ReferencePoint`.
|
||||
|
||||
use super::ReferencePoint;
|
||||
use crate::contract::{Bind, Show as _, Validity};
|
||||
use crate::contract::{Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use craft_behavior::{Anchor9, Mixed};
|
||||
@@ -22,7 +22,7 @@ fn reference_point(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(ReferencePoint<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn reference_point_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
ReferencePoint::new("Reference point", Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).show(ui).into()
|
||||
ReferencePoint::new("Reference point", data.bind_mixed("mixed", Mixed::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(ReferencePoint<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -91,7 +91,7 @@ fn select_first(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
#[story(Select<'static, u8>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn select_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let entries = modes();
|
||||
Select::new("Blend mode", Bind::bound_mixed(data.value("mixed", Mixed::<u8>::Mixed)), &entries).show(ui).into()
|
||||
Select::new("Blend mode", data.bind_mixed("mixed", Mixed::<u8>::Mixed), &entries).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Select<'static, u8>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `TreePicker`.
|
||||
|
||||
use super::{TreeEntry, TreePicker};
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -35,7 +35,7 @@ fn tree_picker(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
#[story(TreePicker<'static, u32>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn tree_picker_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let entries = albums();
|
||||
TreePicker::new("Album", Bind::bound_mixed(data.value("mixed", Mixed::<Option<u32>>::Mixed)), &entries).show(ui).into()
|
||||
TreePicker::new("Album", data.bind_mixed("mixed", Mixed::<Option<u32>>::Mixed), &entries).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(TreePicker<'static, u32>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `AltTextField`.
|
||||
|
||||
use super::{AltText, AltTextField};
|
||||
use crate::contract::{Bind, Show as _, Validity};
|
||||
use crate::contract::{Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::pointer::{moved, secondary};
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
@@ -44,7 +44,7 @@ fn alt_text_field_long(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(AltTextField<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn alt_text_field_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
AltTextField::new(PROMPT, Bind::bound_mixed(data.value("mixed", Mixed::<AltText>::Mixed))).show(ui).into()
|
||||
AltTextField::new(PROMPT, data.bind_mixed("mixed", Mixed::<AltText>::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(AltTextField<'static>, covers = [], drive = Drive::Never)]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use super::ChipField;
|
||||
use crate::contract::Role;
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Fixture, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -59,7 +59,7 @@ fn chip_field_more(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(ChipField<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn chip_field_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
ChipField::new("Keywords", Bind::bound_mixed(data.value("mixed", Mixed::<Vec<String>>::Mixed))).show(ui).into()
|
||||
ChipField::new("Keywords", data.bind_mixed("mixed", Mixed::<Vec<String>>::Mixed)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(ChipField<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -35,7 +35,7 @@ fn linked_fields_equal_columns(ui: &mut Ui, data: &mut StoryData) -> StoryOutput
|
||||
|
||||
#[story(LinkedFields<'static, 2>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn linked_fields_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
LinkedFields::new("Size", Bind::bound_mixed(data.value("mixed", Mixed::<[Mixed<Option<f64>>; 2]>::Mixed)), Bind::given(false)).show(ui).into()
|
||||
LinkedFields::new("Size", data.bind_mixed("mixed", Mixed::<[Mixed<Option<f64>>; 2]>::Mixed), Bind::given(false)).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(LinkedFields<'static, 2>, covers = [], drive = Drive::Never)]
|
||||
|
||||
@@ -67,7 +67,7 @@ fn number_field(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Text::new(units.symbol(UnitKind::Degrees)).show(ui);
|
||||
});
|
||||
row("Mixed").show(ui, |ui, _| {
|
||||
NumberField::new("Mixed size", Bind::bound_mixed(data.value("mixed", Mixed::<Option<f64>>::Mixed)))
|
||||
NumberField::new("Mixed size", data.bind_mixed("mixed", Mixed::<Option<f64>>::Mixed))
|
||||
.unit(units.symbol(UnitKind::Points))
|
||||
.size(size)
|
||||
.show(ui);
|
||||
@@ -106,7 +106,7 @@ fn number_field_long(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(NumberField<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn number_field_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
NumberField::new("Size", Bind::bound_mixed(data.value("mixed", Mixed::<Option<f64>>::Mixed))).show(ui).edit.into()
|
||||
NumberField::new("Size", data.bind_mixed("mixed", Mixed::<Option<f64>>::Mixed)).show(ui).edit.into()
|
||||
}
|
||||
|
||||
#[story(NumberField<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -69,7 +69,7 @@ fn text_field_long(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(TextField<'static, PlainText>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn text_field_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
TextField::new("Name", Bind::bound_mixed(data.value("mixed", Mixed::<String>::Mixed))).placeholder("Mixed").show(ui).into()
|
||||
TextField::new("Name", data.bind_mixed("mixed", Mixed::<String>::Mixed)).placeholder("Mixed").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(TextField<'static, PlainText>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use super::{
|
||||
BadgeKind, BadgeSlot, BadgeVisibility, CaptionPlace, ThumbnailSlider, Tile, TileBadge, TileFlag, TileMark, TilePartEvent, TileStatus, TileZoom,
|
||||
};
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::list::{ThumbAspect, ToggleState};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::pictures::StoryPictures;
|
||||
@@ -131,7 +131,7 @@ fn thumbnail_slider_range(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(ThumbnailSlider<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn thumbnail_slider_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
ThumbnailSlider::new("Thumbnail Size", Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), TileZoom::Ladder).show(ui).into()
|
||||
ThumbnailSlider::new("Thumbnail Size", data.bind_mixed("mixed", Mixed::Mixed), TileZoom::Ladder).show(ui).into()
|
||||
}
|
||||
|
||||
#[story(ThumbnailSlider<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `AngleDial`.
|
||||
|
||||
use super::{AngleDial, AngleOrientation, FACE};
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Grip, StoryData, StoryOutput, story};
|
||||
use craft_behavior::Mixed;
|
||||
@@ -39,7 +39,7 @@ fn angle_dial_drag(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(AngleDial<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn angle_dial_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
AngleDial::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed))).label("Angle").show(ui).into()
|
||||
AngleDial::new(data.bind_mixed("mixed", Mixed::Mixed)).label("Angle").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(AngleDial<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -43,7 +43,7 @@ fn point_picker_drag(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(PointPicker<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn point_picker_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
PointPicker::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), RANGE, RANGE).label("Blur center").show(ui).into()
|
||||
PointPicker::new(data.bind_mixed("mixed", Mixed::Mixed), RANGE, RANGE).label("Blur center").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(PointPicker<'static>, covers = [Invalid], drive = Drive::Never)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stories of `RangeSlider`.
|
||||
|
||||
use super::{LOWER, RangeSlider};
|
||||
use crate::contract::{Bind, Props as _, Show as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, Validity};
|
||||
use crate::display::Progress;
|
||||
use crate::runtime::env::Message;
|
||||
use crate::testing::{Drive, Grip, StoryData, StoryOutput, story};
|
||||
@@ -23,7 +23,7 @@ fn range_slider(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(RangeSlider<'static>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn range_slider_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
RangeSlider::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), RANGE).label("Level").show(ui).into()
|
||||
RangeSlider::new(data.bind_mixed("mixed", Mixed::Mixed), RANGE).label("Level").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(RangeSlider<'static>, covers = [], drive = Drive::Never)]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! groups the old gallery did not have.
|
||||
|
||||
use super::{Slider, SliderScale, SliderThumb};
|
||||
use crate::contract::{Bind, Props as _, Show as _, ShowContainer as _, Validity};
|
||||
use crate::contract::{Props as _, Show as _, ShowContainer as _, Validity};
|
||||
use crate::display::Progress;
|
||||
use crate::form::Field;
|
||||
use crate::runtime::env::Message;
|
||||
@@ -107,7 +107,7 @@ fn slider(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(Slider<'static>, covers = [Mixed], drive = Drive::Never, group = "States", title = "Mixed")]
|
||||
fn slider_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
Slider::new(Bind::bound_mixed(data.value("mixed", Mixed::Mixed)), RANGE).label("Opacity").show(ui).into()
|
||||
Slider::new(data.bind_mixed("mixed", Mixed::Mixed), RANGE).label("Opacity").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(Slider<'static>, covers = [Invalid], drive = Drive::Never, group = "States", title = "Above the limit")]
|
||||
|
||||
@@ -71,7 +71,7 @@ fn thumb_row_hue_range(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
|
||||
#[story(ThumbRow<'static, 4>, covers = [Mixed], drive = Drive::Never)]
|
||||
fn thumb_row_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
levels(Bind::bound_mixed(data.value("mixed", Mixed::<[Mixed<f64>; 4]>::Mixed))).label("Levels").show(ui).into()
|
||||
levels(data.bind_mixed("mixed", Mixed::<[Mixed<f64>; 4]>::Mixed)).label("Levels").show(ui).into()
|
||||
}
|
||||
|
||||
#[story(ThumbRow<'static, 4>, covers = [], drive = Drive::Never)]
|
||||
|
||||
Reference in New Issue
Block a user