mirror of
https://github.com/enso-org/enso.git
synced 2024-11-27 02:55:06 +03:00
828d160c56
Introduce new APIs for managing focus and using focus to inform delivery of keyboard events. Use new APIs to implement the following behavior: Focus: - If the component browser is opened, its initial state is *focused*. - If the node input area's text component is clicked, the component browser's state becomes *blurred*. - If a click occurs anywhere in the component browser, the component browser's state becomes *focused*. Event dispatch: - When the component browser is in the *focused* state, it handles certain keyboard events (chiefly, arrow keys). - If the component browser handles an event, the event is not received by other components. - If an event occurs that the component browser doesn't handle, the node input area's text component receives the event. [vokoscreenNG-2023-06-29_10-55-00.webm](https://github.com/enso-org/enso/assets/1047859/f1d9d07c-8c32-4482-ba32-15b6e4e20ae7) # Important Notes Changes to display object interface: - **`display::Object` can now be derived.** - Introduce display object *focus receiver* concept. Many components, when receiving focus, should actually be focused indirectly by focusing a descendant. - For example, when the CB Panel receives focus, its descendant at `self.model().grid.model().grid` should be focused, because that's the underlying Grid View, which has its own event handlers. By allowing each level of the hierarchy to define a `focus_receiver`, focus can reach the right object without the CB panel having to know structural details of its descendants. - When delegating to a field's `display::Object` implementation, the derived implementation uses the child's `focus_receiver`, which will normally be the correct behavior. **Changes to `shortcut` API**: - New `View::focused_shortcuts()` is a focus-aware alternative to `View::default_shortcuts()` (which should now only be used for global shortcuts, i.e. shortcuts that don't depend on whether the component is focused). It's based on the *Keyboard Event* API (see below), so events propagate up the focus hierarchy until a shortcut is executed and `stop_propagation()` is called; this allows sensible resolution of event targets when more than one component is capable of handling the same keypress. Keypress dataflow overview: DOM -> KeyboardManager -> FrpKeyboard -> KeyboardEvents -> Shortcut. Low-level keyboard changes to support Focus: - New `KeyboardManager`: Attaches DOM event handlers the same way as `MouseManager`. - New *Keyboard Event* API: `on_event::<KeyDown>()`. Events propagate up the focus hierarchy. This API is used for low-level keyboard listeners such a `Text`, which may need complex logic to determine whether a key is handled (rather than having a closed set of bindings, which can be handled by `shortcut`). - FRP keyboard: Now attaches to the `KeyboardManager` API. It now serves primarily to produce Keyboard Events (it still performs the role of making `KeyUp` events saner in a couple different ways). The FRP keyboard can also be used directly as a global keyboard, for such things as reacting to modifier state. Misc: - Updated the workspace `syn` to version 2. Crates still depending on legacy `syn` now do so through the workspace-level `syn_1` alias.
154 lines
4.7 KiB
TOML
154 lines
4.7 KiB
TOML
[workspace]
|
|
resolver = "2"
|
|
# Listing only the "root" crates of each app/library. All path dependencies are included in the workspace automatically.
|
|
# If you want to add sub crate (like `app/gui/config` or `lib/rust/ensogl/examples`), just add it as a path dependency
|
|
# where plausible.
|
|
# Any GUI functionality that is not used by the main entry point should be defined somewhere with `examples` in the
|
|
# path, e.g. `lib/rust/ensogl/examples`, or `app/gui/view/examples`; this is used to optimize the application for
|
|
# loading the IDE.
|
|
members = [
|
|
"app/gui",
|
|
"app/gui/language/parser",
|
|
"app/gui/enso-profiler-enso-data",
|
|
"build/cli",
|
|
"build/macros/proc-macro",
|
|
"build/ci-gen",
|
|
"build/cli",
|
|
"build/intellij-run-config-gen",
|
|
"build/deprecated/rust-scripts",
|
|
"build/shader-tools",
|
|
"lib/rust/*",
|
|
"lib/rust/parser/doc-parser",
|
|
"lib/rust/parser/src/syntax/tree/visitor",
|
|
"lib/rust/parser/jni",
|
|
"lib/rust/parser/generate-java",
|
|
"lib/rust/parser/debug",
|
|
"lib/rust/ensogl/pack",
|
|
"lib/rust/profiler/data",
|
|
"lib/rust/profiler/demo-data",
|
|
"integration-test",
|
|
"tools/language-server/logstat",
|
|
"tools/language-server/wstest",
|
|
]
|
|
# The default memebers are those we want to check and test by default.
|
|
default-members = ["app/gui", "lib/rust/*"]
|
|
|
|
# We are using a version with extended functionality. The changes have been PR'd upstream:
|
|
# https://github.com/rustwasm/console_error_panic_hook/pull/24
|
|
# Remove this patch when the issue is resolved.
|
|
[patch.crates-io]
|
|
console_error_panic_hook = { git = 'https://github.com/enso-org/console_error_panic_hook' }
|
|
|
|
[profile.dev]
|
|
opt-level = 0
|
|
lto = false
|
|
debug = 0
|
|
debug-assertions = true
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = "thin"
|
|
codegen-units = 16
|
|
incremental = true
|
|
debug = false
|
|
debug-assertions = false
|
|
|
|
[profile.bench]
|
|
opt-level = 3
|
|
lto = true
|
|
debug = false
|
|
debug-assertions = false
|
|
|
|
[profile.test]
|
|
opt-level = 0
|
|
lto = false
|
|
debug = 1
|
|
debug-assertions = true
|
|
|
|
[profile.integration-test]
|
|
inherits = "test"
|
|
opt-level = 2
|
|
|
|
[profile.buildscript]
|
|
inherits = "dev"
|
|
opt-level = 1
|
|
lto = false
|
|
debug = true
|
|
debug-assertions = true
|
|
|
|
[workspace.dependencies]
|
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
# !!!!!!!!!! WARNING !!!!!!!!!!
|
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
# We are tryingto maintain minimum set of dependencies. Before adding a new dependency, consult it
|
|
# with the core development team. Thank you!
|
|
console-subscriber = "0.1.8"
|
|
nix = "0.26.1"
|
|
octocrab = { git = "https://github.com/enso-org/octocrab", default-features = false, features = [
|
|
"rustls",
|
|
] }
|
|
regex = { version = "1.6.0" }
|
|
serde_yaml = { version = "0.9.16" }
|
|
serde-wasm-bindgen = { version = "0.4.5" }
|
|
tokio = { version = "1.23.0", features = ["full", "tracing"] }
|
|
tokio-stream = { version = "0.1.12", features = ["fs"] }
|
|
tokio-util = { version = "0.7.4", features = ["full"] }
|
|
wasm-bindgen = { version = "0.2.84", features = [] }
|
|
wasm-bindgen-test = { version = "0.3.34" }
|
|
anyhow = { version = "1.0.66" }
|
|
failure = { version = "0.1.8" }
|
|
derive_more = { version = "0.99" }
|
|
assert_approx_eq = { version = "1.1.0" }
|
|
backtrace = { version = "0.3.53" }
|
|
boolinator = { version = "2.4.0" }
|
|
derivative = { version = "2.2" }
|
|
futures = { version = "0.3" }
|
|
itertools = { version = "0.10.5" }
|
|
lazy_static = { version = "1.4" }
|
|
paste = { version = "1.0" }
|
|
serde_json = { version = "1.0", features = ["raw_value"] }
|
|
smallvec = { version = "1.0.0" }
|
|
weak-table = { version = "0.3.0" }
|
|
gen-iter = { version = "0.2.1" }
|
|
js-sys = { version = "0.3" }
|
|
owned_ttf_parser = { version = "0.15.1" }
|
|
nalgebra = { version = "0.26.1", features = ["serde-serialize"] }
|
|
const_format = { version = "0.2.22" }
|
|
convert_case = { version = "0.6.0" }
|
|
multi-map = { version = "1.3.0" }
|
|
ordered-float = { version = "3.0.0" }
|
|
rustybuzz = { version = "0.5.1" }
|
|
bincode = { version = "2.0.0-rc.1" }
|
|
byte-unit = { version = "4.0.14", features = ["serde"] }
|
|
bytes = { version = "1.1.0" }
|
|
matches = { version = "0.1" }
|
|
console_error_panic_hook = { version = "0.1.6" }
|
|
reqwest = { version = "0.11.5" }
|
|
proc-macro2 = { version = "1.0.50" }
|
|
syn = { version = "2.0", features = [
|
|
"full",
|
|
"extra-traits",
|
|
"printing",
|
|
"parsing",
|
|
"visit",
|
|
"visit-mut",
|
|
] }
|
|
syn_1 = { package = "syn", version = "1.0", features = [
|
|
"full",
|
|
"extra-traits",
|
|
"printing",
|
|
"parsing",
|
|
"visit",
|
|
"visit-mut",
|
|
] }
|
|
quote = { version = "1.0.23" }
|
|
semver = { version = "1.0.0", features = ["serde"] }
|
|
strum = { version = "0.24.0", features = ["derive"] }
|
|
thiserror = "1.0.40"
|
|
bytemuck = { version = "1.13.1", features = ["derive"] }
|
|
bitflags = { version = "2.2.1" }
|
|
superslice = { version = "1.0.0" }
|
|
# We don't use serde-wasm-bindgen in some cases, because it cannot deal properly with flattened fields, see:
|
|
# https://github.com/cloudflare/serde-wasm-bindgen/issues/9
|
|
gloo-utils = { version = "0.1.7" }
|