diff --git a/crates/ui-contract/src/runtime/keys.rs b/crates/ui-contract/src/runtime/keys.rs index 98d86df41..2172328cd 100644 --- a/crates/ui-contract/src/runtime/keys.rs +++ b/crates/ui-contract/src/runtime/keys.rs @@ -5,7 +5,7 @@ use crate::runtime::commands::FirePhase; use crate::runtime::egui::input::Action; use crate::runtime::frame::PerViewport; -use craft_behavior::{EditCommand, Intent, PartRef}; +use craft_behavior::EditCommand; use craft_keymap::{Chord, Key, KeyInput, Layout, Mods}; use egui::{Context, Id, Vec2, ViewportId}; use std::collections::HashMap; @@ -24,6 +24,8 @@ pub use claims::claim; pub(crate) use claims::hold_escape; #[doc(hidden)] pub use claims::take_claimed; +/// The types `Intents` reads and returns, for an app that reads the window's intents (`with_window_intents`). +pub use craft_behavior::{AccessRequest, Intent, MoveMods, NavMove, PartRef}; #[doc(hidden)] pub use input::down; pub(crate) use input::{input_hook, queue_nav, take_menu_keys, take_nav}; diff --git a/docs/craft-framework.md b/docs/craft-framework.md index ce72c71b1..ba81e4841 100644 --- a/docs/craft-framework.md +++ b/docs/craft-framework.md @@ -163,7 +163,7 @@ An app with its own eframe `App` calls the hooks in `craft::ui::shell::embed`. ` | Close path | The runtime's window host owns the root window's close request. `embed::logic` asks the app through its closure, then hands the close to the platform quit where there is one (macOS). | | Input pacing | One press per pass: extra presses in one frame wait for the next passes. A press outside an open framework menu closes the menu and goes no further. After an OS resize of the window, the held pointer is released. | -The window's keys are the ones the runtime routes to no component: an Escape or a plain Enter while no framework stop is focused, and the arrows' nudge. `with_window_intents` offers them to its closure while nothing has framework focus. The closure takes what it handles (`Intents::take(Intent::Cancel)`) and returns whether it took anything; the rest stays for later readers. A framework scope that ran earlier in the pass takes them first (an open dialog takes the Escape that closes it), so the app reads them last in its UI to see what no component took. App code that read `Key::Escape`, `Key::Tab`, F6 or F10 from egui while none of its own widgets had focus reads these intents and `FrameOutput::chrome_toggles` instead; its own focused widgets and popups keep reading Tab and Escape from egui. +The window's keys are the ones the runtime routes to no component: an Escape or a plain Enter while no framework stop is focused, and the arrows' nudge. `with_window_intents` offers them to its closure while nothing has framework focus. The closure takes what it handles (`Intents::take(Intent::Cancel)`; `Intent` and the other types `Intents` reads are in `ui::runtime::keys`) and returns whether it took anything; the rest stays for later readers. A framework scope that ran earlier in the pass takes them first (an open dialog takes the Escape that closes it), so the app reads them last in its UI to see what no component took. App code that read `Key::Escape`, `Key::Tab`, F6 or F10 from egui while none of its own widgets had focus reads these intents and `FrameOutput::chrome_toggles` instead; its own focused widgets and popups keep reading Tab and Escape from egui. Framework dialogs the app keeps as values run on a `DialogHost`: the app calls `run(ui)` once per pass after its own UI and reads results with `take`.