GUI plugins #9
1 changed files with 31 additions and 0 deletions
pinakes-plugin-api: new UI widget types
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I83a72f3441e5370875239431123b0bbc6a6a6964
commit
7ad068b930
|
|
@ -230,6 +230,37 @@ impl UiPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A widget that plugins can inject into existing host pages.
|
||||||
|
///
|
||||||
|
/// Widgets differ from pages in that they are embedded at a specific
|
||||||
|
/// `target` location within built-in views rather than occupying a full page.
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
|
pub struct UiWidget {
|
||||||
|
/// Unique identifier for this widget within the plugin
|
||||||
|
pub id: String,
|
||||||
|
|
||||||
|
/// Target injection point (matches `widget_location` constants)
|
||||||
|
pub target: String,
|
||||||
|
|
||||||
|
/// Content to render at the injection point
|
||||||
|
pub content: UiElement,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// String constants for widget injection locations.
|
||||||
|
///
|
||||||
|
/// Use these with `UiWidget::target` in plugin manifests:
|
||||||
|
/// ```toml
|
||||||
|
/// [[ui.widgets]]
|
||||||
|
/// id = "my-widget"
|
||||||
|
/// target = "library_header"
|
||||||
|
/// ```
|
||||||
|
pub mod widget_location {
|
||||||
|
pub const LIBRARY_HEADER: &str = "library_header";
|
||||||
|
pub const LIBRARY_SIDEBAR: &str = "library_sidebar";
|
||||||
|
pub const DETAIL_PANEL: &str = "detail_panel";
|
||||||
|
pub const SEARCH_FILTERS: &str = "search_filters";
|
||||||
|
}
|
||||||
|
|
||||||
/// Core UI element enum - the building block of all plugin UIs
|
/// Core UI element enum - the building block of all plugin UIs
|
||||||
///
|
///
|
||||||
/// Elements are categorized into groups:
|
/// Elements are categorized into groups:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue