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        // Initial sync system - runs once when text input is fully initialized
19        sync_initial_text_content,
20
21        // Native input systems
22        handle_keyboard_input,
23        handle_tab_navigation,
24        handle_click_outside,  // Must run BEFORE handle_mouse_input to avoid race condition
25        handle_mouse_input,     // This sets focus on clicked inputs
26        handle_mouse_drag,
27        update_cursor_blink,
28        update_focus_visual,    // Maintain focus border color
29        render_text,
30        render_selection,
31
32        // Clear button functionality
33        handle_clear_button_clicks
34    ]
35});