From 63ce58968799269500f4b304c297f3d2bc180c59 Mon Sep 17 00:00:00 2001 From: jrmoulton Date: Fri, 25 Oct 2024 11:58:11 -0600 Subject: [PATCH] rename navigatable to navigable Navigable is generally considered correct and is also consistent with other parts of the code base. --- examples/counter/src/main.rs | 6 +++--- examples/keyboard_handler/src/main.rs | 2 +- examples/layout/src/tab_navigation.rs | 2 +- examples/themes/src/main.rs | 8 ++++---- examples/widget-gallery/src/clipboard.rs | 2 +- examples/widget-gallery/src/dropdown.rs | 2 +- examples/widget-gallery/src/inputs.rs | 4 ++-- examples/widget-gallery/src/main.rs | 2 +- examples/window-scale/src/main.rs | 6 +++--- src/id.rs | 2 +- src/inspector.rs | 4 ++-- src/views/button.rs | 2 +- src/views/checkbox.rs | 2 +- src/views/decorator.rs | 4 ++-- src/views/dropdown.rs | 2 +- src/views/editor/view.rs | 2 +- src/views/list.rs | 2 +- src/views/radio_button.rs | 12 ++++++------ src/views/slider.rs | 2 +- src/views/text_input.rs | 2 +- src/views/toggle_button.rs | 2 +- src/views/virtual_list.rs | 2 +- 22 files changed, 37 insertions(+), 37 deletions(-) diff --git a/examples/counter/src/main.rs b/examples/counter/src/main.rs index 631b75fb..427409e3 100644 --- a/examples/counter/src/main.rs +++ b/examples/counter/src/main.rs @@ -28,7 +28,7 @@ fn app_view() -> impl IntoView { set_counter.update(|value| *value += 1); } }) - .keyboard_navigatable(), + .keyboard_navigable(), "Decrement" .on_click_stop({ move |_| { @@ -45,7 +45,7 @@ fn app_view() -> impl IntoView { .hover(|s| s.background(Color::rgb8(244, 67, 54))) .active(|s| s.color(Color::WHITE).background(Color::RED)) }) - .keyboard_navigatable(), + .keyboard_navigable(), "Reset to 0" .on_click_stop(move |_| { println!("Reset counter pressed"); // will not fire if button is disabled @@ -63,7 +63,7 @@ fn app_view() -> impl IntoView { .hover(|s| s.background(Color::LIGHT_YELLOW)) .active(|s| s.color(Color::WHITE).background(Color::YELLOW_GREEN)) }) - .keyboard_navigatable(), + .keyboard_navigable(), ) .style(|s| { s.class(LabelClass, |s| { diff --git a/examples/keyboard_handler/src/main.rs b/examples/keyboard_handler/src/main.rs index 955e236d..11918a70 100644 --- a/examples/keyboard_handler/src/main.rs +++ b/examples/keyboard_handler/src/main.rs @@ -14,7 +14,7 @@ fn app_view() -> impl IntoView { .items_center() .justify_center() }); - view.keyboard_navigatable() + view.keyboard_navigable() .on_event_stop(EventListener::KeyDown, move |e| { if let Event::KeyDown(e) = e { if e.key.logical_key == Key::Character("q".into()) { diff --git a/examples/layout/src/tab_navigation.rs b/examples/layout/src/tab_navigation.rs index 3a8f249d..6774da59 100644 --- a/examples/layout/src/tab_navigation.rs +++ b/examples/layout/src/tab_navigation.rs @@ -32,7 +32,7 @@ fn tab_button( active_tab: ReadSignal, ) -> impl IntoView { label(move || this_tab) - .keyboard_navigatable() + .keyboard_navigable() .on_click_stop(move |_| { set_active_tab.update(|v: &mut usize| { *v = tabs diff --git a/examples/themes/src/main.rs b/examples/themes/src/main.rs index 59c4a5e5..082cb515 100644 --- a/examples/themes/src/main.rs +++ b/examples/themes/src/main.rs @@ -102,7 +102,7 @@ fn app_view() -> impl IntoView { set_theme.update(|theme| *theme = !*theme); } }) - .keyboard_navigatable(), + .keyboard_navigable(), stack(( label(move || format!("Value: {}", counter.get())).class(Label), text("Increment") @@ -112,7 +112,7 @@ fn app_view() -> impl IntoView { set_counter.update(|value| *value += 1); } }) - .keyboard_navigatable(), + .keyboard_navigable(), text("Decrement") .class(Button) .on_click_stop({ @@ -120,7 +120,7 @@ fn app_view() -> impl IntoView { set_counter.update(|value| *value -= 1); } }) - .keyboard_navigatable(), + .keyboard_navigable(), text("Reset to 0") .class(Button) .on_click_stop(move |_| { @@ -128,7 +128,7 @@ fn app_view() -> impl IntoView { set_counter.update(|value| *value = 0); }) .disabled(move || counter.get() == 0) - .keyboard_navigatable(), + .keyboard_navigable(), )) .class(Frame) .style(|s| s.items_center()), diff --git a/examples/widget-gallery/src/clipboard.rs b/examples/widget-gallery/src/clipboard.rs index 53b9a5ee..bbb28f91 100644 --- a/examples/widget-gallery/src/clipboard.rs +++ b/examples/widget-gallery/src/clipboard.rs @@ -19,7 +19,7 @@ pub fn clipboard_view() -> impl IntoView { }), form_item("Copy from input".to_string(), 120.0, move || { h_stack(( - text_input(text1).keyboard_navigatable(), + text_input(text1).keyboard_navigable(), button("Copy").action(move || { let _ = Clipboard::set_contents(text1.get()); }), diff --git a/examples/widget-gallery/src/dropdown.rs b/examples/widget-gallery/src/dropdown.rs index 40176edc..7eed6a05 100644 --- a/examples/widget-gallery/src/dropdown.rs +++ b/examples/widget-gallery/src/dropdown.rs @@ -66,7 +66,7 @@ pub fn dropdown_view() -> impl IntoView { // view for each item in the list |item| label(move || item).into_any(), ) - .keyboard_navigatable() + .keyboard_navigable() }),) }) } diff --git a/examples/widget-gallery/src/inputs.rs b/examples/widget-gallery/src/inputs.rs index 284ed613..b55250f3 100644 --- a/examples/widget-gallery/src/inputs.rs +++ b/examples/widget-gallery/src/inputs.rs @@ -17,7 +17,7 @@ pub fn text_input_view() -> impl IntoView { form_item("Simple Input:".to_string(), 120.0, move || { text_input(text) .placeholder("Placeholder text") - .keyboard_navigatable() + .keyboard_navigable() }), form_item("Styled Input:".to_string(), 120.0, move || { text_input(text) @@ -44,7 +44,7 @@ pub fn text_input_view() -> impl IntoView { .font_weight(Weight::BOLD) }) }) - .keyboard_navigatable() + .keyboard_navigable() }), form_item("Disabled Input:".to_string(), 120.0, move || { text_input(text).disabled(|| true) diff --git a/examples/widget-gallery/src/main.rs b/examples/widget-gallery/src/main.rs index 297d2d6b..826874f5 100644 --- a/examples/widget-gallery/src/main.rs +++ b/examples/widget-gallery/src/main.rs @@ -95,7 +95,7 @@ fn app_view() -> impl IntoView { EventPropagation::Continue } }) - .keyboard_navigatable() + .keyboard_navigable() .draggable() .style(move |s| { s.flex_row() diff --git a/examples/window-scale/src/main.rs b/examples/window-scale/src/main.rs index 0282d7e8..3a18c5b0 100644 --- a/examples/window-scale/src/main.rs +++ b/examples/window-scale/src/main.rs @@ -23,7 +23,7 @@ fn app_view() -> impl IntoView { .on_click_stop(move |_| { set_counter.update(|value| *value += 1); }) - .keyboard_navigatable(), + .keyboard_navigable(), label(|| "Decrement") .class(Button) .on_click_stop(move |_| { @@ -34,7 +34,7 @@ fn app_view() -> impl IntoView { .hover(|s| s.background(Color::rgb8(244, 67, 54))) .active(|s| s.background(Color::RED)) }) - .keyboard_navigatable(), + .keyboard_navigable(), label(|| "Reset to 0") .class(Button) .on_click_stop(move |_| { @@ -48,7 +48,7 @@ fn app_view() -> impl IntoView { .hover(|s| s.background(Color::LIGHT_YELLOW)) .active(|s| s.background(Color::YELLOW_GREEN)) }) - .keyboard_navigatable(), + .keyboard_navigable(), ) }), stack({ diff --git a/src/id.rs b/src/id.rs index 40f5f255..51673477 100644 --- a/src/id.rs +++ b/src/id.rs @@ -505,7 +505,7 @@ impl ViewId { } /// Mark this view as a view that can be navigated to using the keyboard - pub fn keyboard_navigatable(&self) { + pub fn keyboard_navigable(&self) { self.add_update_message(UpdateMessage::KeyboardNavigable { id: *self }); } diff --git a/src/inspector.rs b/src/inspector.rs index 000315a4..68253688 100644 --- a/src/inspector.rs +++ b/src/inspector.rs @@ -425,7 +425,7 @@ fn add_event( capture: &Rc, ) -> impl View { let capture = capture.clone(); - row.keyboard_navigatable() + row.keyboard_navigable() .on_secondary_click({ let name = name.clone(); move |_| { @@ -810,7 +810,7 @@ fn capture_view( .margin_bottom(21.0) .margin_right(21.0) }) - .keyboard_navigatable() + .keyboard_navigable() .on_event_stop(EventListener::KeyUp, { move |event: &Event| { if let Event::KeyUp(key) = event { diff --git a/src/views/button.rs b/src/views/button.rs index b80ebd27..33ee526a 100644 --- a/src/views/button.rs +++ b/src/views/button.rs @@ -19,7 +19,7 @@ impl Button { pub fn new(child: impl IntoView) -> Self { let id = ViewId::new(); id.add_child(Box::new(child.into_view())); - Button { id }.keyboard_navigatable().class(ButtonClass) + Button { id }.keyboard_navigable().class(ButtonClass) } pub fn action(self, mut on_press: impl FnMut() + 'static) -> Self { diff --git a/src/views/checkbox.rs b/src/views/checkbox.rs index c1fe75b0..69927195 100644 --- a/src/views/checkbox.rs +++ b/src/views/checkbox.rs @@ -19,7 +19,7 @@ fn checkbox_svg(checked: impl SignalGet + 'static) -> impl IntoView { svg(CHECKBOX_SVG) .update_value(svg_str) .class(CheckboxClass) - .keyboard_navigatable() + .keyboard_navigable() } /// The `Checkbox` struct provides various methods to create and manage checkboxes. diff --git a/src/views/decorator.rs b/src/views/decorator.rs index 23461cce..725e14b1 100644 --- a/src/views/decorator.rs +++ b/src/views/decorator.rs @@ -124,9 +124,9 @@ pub trait Decorators: IntoView + Sized { } /// Allows the element to be navigated to with the keyboard. Similar to setting tabindex="0" in html. - fn keyboard_navigatable(self) -> Self::DV { + fn keyboard_navigable(self) -> Self::DV { let view = self.into_view(); - view.id().keyboard_navigatable(); + view.id().keyboard_navigable(); view } diff --git a/src/views/dropdown.rs b/src/views/dropdown.rs index bec30d72..2bad8da5 100644 --- a/src/views/dropdown.rs +++ b/src/views/dropdown.rs @@ -203,7 +203,7 @@ impl Dropdown { } }) .style(|s| s.size_full()) - .keyboard_navigatable() + .keyboard_navigable() .on_event_stop(EventListener::PointerDown, move |_| {}) .on_event_stop(EventListener::FocusLost, move |_| { dropdown_id.update_state(Message::ListFocusLost); diff --git a/src/views/editor/view.rs b/src/views/editor/view.rs index 0112abdd..f2b62199 100644 --- a/src/views/editor/view.rs +++ b/src/views/editor/view.rs @@ -966,7 +966,7 @@ pub fn editor_view( is_active, inner_node: None, } - .keyboard_navigatable() + .keyboard_navigable() .on_event(EventListener::ImePreedit, move |event| { if !is_active.get_untracked() { return EventPropagation::Continue; diff --git a/src/views/list.rs b/src/views/list.rs index ad3c5fbd..c4948ecf 100644 --- a/src/views/list.rs +++ b/src/views/list.rs @@ -103,7 +103,7 @@ where child, onaccept: None, } - .keyboard_navigatable() + .keyboard_navigable() .on_event(EventListener::KeyDown, move |e| { if let Event::KeyDown(key_event) = e { match key_event.key.logical_key { diff --git a/src/views/radio_button.rs b/src/views/radio_button.rs index 797363ac..c94edd3e 100644 --- a/src/views/radio_button.rs +++ b/src/views/radio_button.rs @@ -46,7 +46,7 @@ impl RadioButton { value_container( radio_button_svg(represented_value.clone(), inbound_signal.read_only()) - .keyboard_navigatable() + .keyboard_navigable() .on_click_stop(move |_| { outbound_signal.set(represented_value.clone()); }), @@ -65,7 +65,7 @@ impl RadioButton { where T: Eq + PartialEq + Clone + 'static, { - radio_button_svg(represented_value, actual_value).keyboard_navigatable() + radio_button_svg(represented_value, actual_value).keyboard_navigable() } /// Creates a new radio button with a signal that provides and updates its selected state. @@ -82,7 +82,7 @@ impl RadioButton { let cloneable_represented_value = represented_value.clone(); radio_button_svg(cloneable_represented_value.clone(), actual_value) - .keyboard_navigatable() + .keyboard_navigable() .on_click_stop(move |_| { actual_value.set(cloneable_represented_value.clone()); }) @@ -109,7 +109,7 @@ impl RadioButton { )) .class(LabeledRadioButtonClass) .style(|s| s.items_center()) - .keyboard_navigatable() + .keyboard_navigable() .on_click_stop(move |_| { outbound_signal.set(represented_value.clone()); }), @@ -135,7 +135,7 @@ impl RadioButton { )) .class(LabeledRadioButtonClass) .style(|s| s.items_center()) - .keyboard_navigatable() + .keyboard_navigable() } /// Creates a new labeled radio button with a signal that provides and updates its selected state. @@ -158,7 +158,7 @@ impl RadioButton { )) .class(LabeledRadioButtonClass) .style(|s| s.items_center()) - .keyboard_navigatable() + .keyboard_navigable() .on_click_stop(move |_| { actual_value.set(cloneable_represented_value.clone()); }) diff --git a/src/views/slider.rs b/src/views/slider.rs index 2530222c..5fd7e0cc 100644 --- a/src/views/slider.rs +++ b/src/views/slider.rs @@ -326,7 +326,7 @@ impl Slider { style: Default::default(), } .class(SliderClass) - .keyboard_navigatable() + .keyboard_navigable() } pub fn new_get(percent: impl SignalGet + 'static) -> Self { diff --git a/src/views/text_input.rs b/src/views/text_input.rs index 90e02163..8e9ab80d 100644 --- a/src/views/text_input.rs +++ b/src/views/text_input.rs @@ -165,7 +165,7 @@ pub fn text_input(buffer: RwSignal) -> TextInput { is_focused: false, last_cursor_action_on: Instant::now(), } - .keyboard_navigatable() + .keyboard_navigable() .on_event_stop(EventListener::FocusGained, move |_| { is_focused.set(true); }) diff --git a/src/views/toggle_button.rs b/src/views/toggle_button.rs index b0594874..c551dcc4 100644 --- a/src/views/toggle_button.rs +++ b/src/views/toggle_button.rs @@ -271,7 +271,7 @@ impl ToggleButton { style: Default::default(), } .class(ToggleButtonClass) - .keyboard_navigatable() + .keyboard_navigable() } pub fn new_rw(state: impl SignalGet + SignalUpdate + Copy + 'static) -> Self { diff --git a/src/views/virtual_list.rs b/src/views/virtual_list.rs index d582da44..3271472c 100644 --- a/src/views/virtual_list.rs +++ b/src/views/virtual_list.rs @@ -168,7 +168,7 @@ where child, } .class(ListClass) - .keyboard_navigatable() + .keyboard_navigable() .on_event(EventListener::KeyDown, move |e| { if let Event::KeyDown(key_event) = e { match key_event.key.logical_key {