From 7ad068b9301c8d85fc9c281036495a141572bca6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 9 Mar 2026 22:02:28 +0300 Subject: [PATCH] pinakes-plugin-api: new UI widget types Signed-off-by: NotAShelf Change-Id: I83a72f3441e5370875239431123b0bbc6a6a6964 --- crates/pinakes-plugin-api/src/ui_schema.rs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crates/pinakes-plugin-api/src/ui_schema.rs b/crates/pinakes-plugin-api/src/ui_schema.rs index f6c1e8d..783237e 100644 --- a/crates/pinakes-plugin-api/src/ui_schema.rs +++ b/crates/pinakes-plugin-api/src/ui_schema.rs @@ -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 /// /// Elements are categorized into groups: