Skip to main content

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 JSON response from docs.rs crate status endpoint.
37///
38/// Example JSON: `{"doc_status": true, "version": "0.6.23"}`
39#[derive(Clone, Data, Default, Deserialize, New)]
40pub struct DocsStatus {
41    /// Whether the documentation build succeeded.
42    #[get(type(copy))]
43    pub doc_status: bool,
44    /// The latest version string of the crate.
45    pub version: String,
46}
47
48/// Configuration for bridge initialization.
49///
50/// Allows customization of bridge behavior.
51#[derive(Clone, Debug, Default)]
52pub struct BridgeConfig {
53    /// The global bridge object key on window.
54    pub global_key: &'static str,
55    /// The core module key.
56    pub core_key: &'static str,
57    /// The invoke function key.
58    pub invoke_key: &'static str,
59}