bevy_ui_builders/text_input/
plugin.rs

1//! Text input plugin
2
3use bevy::prelude::*;
4use bevy_plugin_builder::define_plugin;
5use super::native_input::*;
6use super::systems::handle_clear_button_clicks;
7
8// Plugin that provides the complete text input system
9define_plugin!(TextInputPlugin {
10    events: [
11        TextInputSubmitEvent,
12        TextInputChangeEvent
13    ],
14    custom_init: |app: &mut App| {
15        app.add_observer(init_text_input);
16    },
17    update: [
18        // Native input systems
19        handle_keyboard_input,
20        handle_tab_navigation,
21        handle_click_outside,  // Must run BEFORE handle_mouse_input to avoid race condition
22        handle_mouse_input,     // This sets focus on clicked inputs
23        handle_mouse_drag,
24        update_cursor_blink,
25        update_focus_visual,    // Maintain focus border color
26        render_text,
27        render_selection,
28
29        // Clear button functionality
30        handle_clear_button_clicks
31    ]
32});