euv_ui/component/bridge/hook/struct.rs
1use crate::*;
2
3/// Reactive state for the native bridge system info feature.
4///
5/// Aggregates all signals needed for the bridge permissions display.
6#[derive(Clone, Copy, Data, New)]
7pub struct UseEuvNativeBridge {
8 /// Whether the native bridge is available on this platform.
9 #[get(type(copy))]
10 pub available: Signal<bool>,
11 /// Whether data is currently being loaded from the native bridge.
12 #[get(type(copy))]
13 pub loading: Signal<bool>,
14 /// The resolved bridge group permissions.
15 #[get(type(copy))]
16 pub permissions: Signal<String>,
17}
18
19/// Reactive state for the cache update feature.
20///
21/// Tracks the documentation build status, the latest version string,
22/// and whether a cache update is currently in progress.
23#[derive(Clone, Copy, Data, New)]
24pub struct UseCacheUpdate {
25 /// Whether the docs.rs build status indicates documentation is available.
26 #[get(type(copy))]
27 pub doc_status: Signal<bool>,
28 /// The latest version string returned by docs.rs.
29 #[get(type(copy))]
30 pub version: Signal<String>,
31 /// Whether a cache update operation is currently in progress.
32 #[get(type(copy))]
33 pub updating: Signal<bool>,
34}
35
36/// The result returned by a cache update closure.
37///
38/// The UI component uses this value to update its internal state signals
39/// without knowing how the update check was performed.
40#[derive(Clone, Data, New)]
41pub struct UpdateResult {
42 /// Whether the documentation build succeeded.
43 #[get(type(copy))]
44 pub doc_status: bool,
45 /// The latest version string of the crate.
46 pub version: String,
47 /// Whether a cache update operation was triggered.
48 #[get(type(copy))]
49 pub updating: bool,
50}
51
52/// Configuration for bridge initialization.
53///
54/// Allows customization of bridge behavior.
55#[derive(Clone, Data, Debug, Default, New)]
56pub struct BridgeConfig {
57 /// The global bridge object key on window.
58 #[get(type(copy))]
59 pub global_key: &'static str,
60 /// The core module key.
61 #[get(type(copy))]
62 pub core_key: &'static str,
63 /// The invoke function key.
64 #[get(type(copy))]
65 pub invoke_key: &'static str,
66}