Skip to main content

webui_protocol/
gen_webui.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT license.
3
4// This file is @generated by prost-build from proto/webui.proto.
5// Do not edit manually. Regenerate with: cargo xtask proto
6// This file is @generated by prost-build.
7/// Root protocol containing all fragment records.
8/// Per-component metadata keyed by tag name.
9#[derive(serde::Serialize, serde::Deserialize)]
10#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
11pub struct ComponentData {
12    /// Non-WebUI client-side template payload.
13    /// FAST plugins store complete <f-template> HTML here.
14    #[prost(string, tag = "1")]
15    pub template: ::prost::alloc::string::String,
16    /// Component CSS content for the Module strategy.
17    /// Contains the full CSS content when CssStrategy::Module is active.
18    /// Empty for Link and Style strategies (CSS is handled via <link> tags
19    /// or inline <style> tags baked into raw fragments by the parser).
20    #[prost(string, tag = "2")]
21    pub css: ::prost::alloc::string::String,
22    /// External stylesheet href for the Link CSS strategy.
23    /// Set to e.g. "/my-card.css" when the component has a CSS file and the
24    /// build used CssStrategy::Link. Empty for Style/Module strategies and
25    /// for components without CSS.
26    /// The handler uses css_strategy and dom_strategy on WebUIProtocol to
27    /// decide what to emit in <head>:
28    ///    Link + Shadow → <link rel="preload"> (shadow root has the stylesheet)
29    ///    Link + Light  → <link rel="stylesheet"> (no shadow root to host it)
30    #[prost(string, tag = "3")]
31    pub css_href: ::prost::alloc::string::String,
32    /// WebUI plugin JSON-safe component metadata.
33    /// Stored separately from executable condition closures so handlers can emit
34    /// the static metadata in application/json data blocks.
35    #[prost(string, tag = "4")]
36    pub template_json: ::prost::alloc::string::String,
37    /// WebUI plugin component-local JavaScript condition closure array.
38    /// Empty when the component has no conditions or boolean attributes.
39    #[prost(string, tag = "5")]
40    pub template_functions: ::prost::alloc::string::String,
41}
42#[derive(serde::Serialize, serde::Deserialize)]
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct WebUiProtocol {
45    #[prost(map = "string, message", tag = "1")]
46    pub fragments: ::std::collections::HashMap<
47        ::prost::alloc::string::String,
48        FragmentList,
49    >,
50    /// Sorted, deduplicated CSS custom property names used across all components
51    /// and entry page styles (e.g., "colorBrandBackground", "spacingMedium").
52    /// Only usage via var(--name) is included; local definitions are excluded.
53    #[prost(string, repeated, tag = "2")]
54    pub tokens: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
55    /// Per-component data keyed by tag name (f-template + CSS).
56    #[prost(map = "string, message", tag = "3")]
57    pub components: ::std::collections::HashMap<
58        ::prost::alloc::string::String,
59        ComponentData,
60    >,
61    /// Build-wide CSS delivery strategy. Determines how the handler emits
62    /// CSS-related tags in <head> for components with css_href.
63    #[prost(enumeration = "CssStrategy", tag = "4")]
64    pub css_strategy: i32,
65    /// Build-wide DOM encapsulation strategy. Combined with css_strategy to
66    /// decide preload vs stylesheet emission.
67    #[prost(enumeration = "DomStrategy", tag = "5")]
68    pub dom_strategy: i32,
69}
70/// A list of fragments (needed because protobuf maps cannot have repeated values directly).
71#[derive(serde::Serialize, serde::Deserialize)]
72#[derive(Clone, PartialEq, ::prost::Message)]
73pub struct FragmentList {
74    #[prost(message, repeated, tag = "1")]
75    pub fragments: ::prost::alloc::vec::Vec<WebUiFragment>,
76}
77/// A single fragment — one of several types.
78#[derive(serde::Serialize, serde::Deserialize)]
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct WebUiFragment {
81    #[prost(oneof = "web_ui_fragment::Fragment", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9")]
82    pub fragment: ::core::option::Option<web_ui_fragment::Fragment>,
83}
84/// Nested message and enum types in `WebUIFragment`.
85pub mod web_ui_fragment {
86    #[derive(serde::Serialize, serde::Deserialize)]
87    #[derive(Clone, PartialEq, ::prost::Oneof)]
88    pub enum Fragment {
89        #[prost(message, tag = "1")]
90        Raw(super::WebUiFragmentRaw),
91        #[prost(message, tag = "2")]
92        Component(super::WebUiFragmentComponent),
93        #[prost(message, tag = "3")]
94        ForLoop(super::WebUiFragmentFor),
95        #[prost(message, tag = "4")]
96        Signal(super::WebUiFragmentSignal),
97        #[prost(message, tag = "5")]
98        IfCond(super::WebUiFragmentIf),
99        #[prost(message, tag = "6")]
100        Attribute(super::WebUiFragmentAttribute),
101        #[prost(message, tag = "7")]
102        Plugin(super::WebUiFragmentPlugin),
103        #[prost(message, tag = "8")]
104        Route(super::WebUiFragmentRoute),
105        #[prost(message, tag = "9")]
106        Outlet(super::WebUiFragmentOutlet),
107    }
108}
109/// Declarative route definition linking a URL path template to a component.
110/// Nested routes are expressed via repeated children.
111#[derive(serde::Serialize, serde::Deserialize)]
112#[derive(Clone, PartialEq, ::prost::Message)]
113pub struct WebUiFragmentRoute {
114    #[prost(string, tag = "1")]
115    pub path: ::prost::alloc::string::String,
116    #[prost(string, tag = "2")]
117    pub fragment_id: ::prost::alloc::string::String,
118    #[prost(bool, tag = "3")]
119    pub exact: bool,
120    /// Nested child routes rendered at the component's <outlet />.
121    #[prost(message, repeated, tag = "4")]
122    pub children: ::prost::alloc::vec::Vec<WebUiFragmentRoute>,
123    /// Comma-separated allowlist of query parameters forwarded as attributes.
124    /// Empty string means no query params are forwarded (deny-by-default).
125    #[prost(string, tag = "5")]
126    pub allowed_query: ::prost::alloc::string::String,
127    /// When true, the router preserves the mounted component instance across
128    /// navigations instead of destroying and recreating it. Opt-in per route.
129    #[prost(bool, tag = "6")]
130    pub keep_alive: bool,
131    /// Cache tag templates for this route (e.g. "thread:{threadId}", "inbox").
132    /// Placeholders like {param} are resolved at render time with actual param values.
133    #[prost(string, repeated, tag = "7")]
134    pub cache_tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
135    /// Invalidation tag templates (e.g. "inbox", "thread:{threadId}").
136    /// After a mutation action on this route, these tags are auto-invalidated.
137    /// Supports {param} placeholders resolved at render time.
138    #[prost(string, repeated, tag = "8")]
139    pub invalidates: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
140    /// Component tag name for the pending/loading UI (e.g. "mail-skeleton").
141    /// Validated at build time — build fails if the component does not exist.
142    #[prost(string, tag = "9")]
143    pub pending_component: ::prost::alloc::string::String,
144    /// Component tag name for the error boundary UI (e.g. "error-page").
145    /// Validated at build time — build fails if the component does not exist.
146    #[prost(string, tag = "10")]
147    pub error_component: ::prost::alloc::string::String,
148}
149/// Outlet placeholder — marks where matched child route content renders.
150/// Components use this to indicate where nested route children are rendered.
151#[derive(serde::Serialize, serde::Deserialize)]
152#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
153pub struct WebUiFragmentOutlet {}
154/// Opaque plugin-specific data passed from parser plugin to handler plugin.
155/// WebUI framework does not interpret this data — it is a pass-through conduit.
156/// Each parser/handler plugin pair defines its own binary contract for the data field.
157#[derive(serde::Serialize, serde::Deserialize)]
158#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
159pub struct WebUiFragmentPlugin {
160    #[prost(bytes = "vec", tag = "1")]
161    pub data: ::prost::alloc::vec::Vec<u8>,
162}
163/// Static text or HTML content.
164#[derive(serde::Serialize, serde::Deserialize)]
165#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
166pub struct WebUiFragmentRaw {
167    #[prost(string, tag = "1")]
168    pub value: ::prost::alloc::string::String,
169}
170/// Reference to a reusable component fragment.
171#[derive(serde::Serialize, serde::Deserialize)]
172#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
173pub struct WebUiFragmentComponent {
174    #[prost(string, tag = "1")]
175    pub fragment_id: ::prost::alloc::string::String,
176}
177/// Loop directive iterating over a collection.
178#[derive(serde::Serialize, serde::Deserialize)]
179#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
180pub struct WebUiFragmentFor {
181    #[prost(string, tag = "1")]
182    pub item: ::prost::alloc::string::String,
183    #[prost(string, tag = "2")]
184    pub collection: ::prost::alloc::string::String,
185    #[prost(string, tag = "3")]
186    pub fragment_id: ::prost::alloc::string::String,
187}
188/// Dynamic data binding via signal.
189#[derive(serde::Serialize, serde::Deserialize)]
190#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
191pub struct WebUiFragmentSignal {
192    #[prost(string, tag = "1")]
193    pub value: ::prost::alloc::string::String,
194    #[prost(bool, tag = "2")]
195    pub raw: bool,
196}
197/// Conditional rendering fragment.
198#[derive(serde::Serialize, serde::Deserialize)]
199#[derive(Clone, PartialEq, ::prost::Message)]
200pub struct WebUiFragmentIf {
201    #[prost(message, optional, tag = "1")]
202    pub condition: ::core::option::Option<ConditionExpr>,
203    #[prost(string, tag = "2")]
204    pub fragment_id: ::prost::alloc::string::String,
205}
206/// Dynamic attribute binding.
207#[derive(serde::Serialize, serde::Deserialize)]
208#[derive(Clone, PartialEq, ::prost::Message)]
209pub struct WebUiFragmentAttribute {
210    #[prost(string, tag = "1")]
211    pub name: ::prost::alloc::string::String,
212    /// For simple dynamic attrs, the signal name.
213    #[prost(string, tag = "2")]
214    pub value: ::prost::alloc::string::String,
215    /// For mixed (template) attrs, the sub-stream ID.
216    #[prost(string, tag = "3")]
217    pub template: ::prost::alloc::string::String,
218    /// True for :-prefixed complex attributes.
219    #[prost(bool, tag = "4")]
220    pub complex: bool,
221    /// True for the first dynamic attribute on a component element.
222    #[prost(bool, tag = "5")]
223    pub attr_start: bool,
224    /// True for skipped attributes (class, style, role, data-*, aria-*).
225    #[prost(bool, tag = "6")]
226    pub attr_skip: bool,
227    /// True for static attribute values on components.
228    #[prost(bool, tag = "7")]
229    pub raw_value: bool,
230    /// For ?-prefixed boolean attributes, the condition tree.
231    #[prost(message, optional, tag = "8")]
232    pub condition_tree: ::core::option::Option<ConditionExpr>,
233}
234/// A condition expression tree.
235#[derive(serde::Serialize, serde::Deserialize)]
236#[derive(Clone, PartialEq, ::prost::Message)]
237pub struct ConditionExpr {
238    #[prost(oneof = "condition_expr::Expr", tags = "1, 2, 3, 4")]
239    pub expr: ::core::option::Option<condition_expr::Expr>,
240}
241/// Nested message and enum types in `ConditionExpr`.
242pub mod condition_expr {
243    #[derive(serde::Serialize, serde::Deserialize)]
244    #[derive(Clone, PartialEq, ::prost::Oneof)]
245    pub enum Expr {
246        #[prost(message, tag = "1")]
247        Predicate(super::Predicate),
248        #[prost(message, tag = "2")]
249        Not(::prost::alloc::boxed::Box<super::NotCondition>),
250        #[prost(message, tag = "3")]
251        Compound(::prost::alloc::boxed::Box<super::CompoundCondition>),
252        #[prost(message, tag = "4")]
253        Identifier(super::IdentifierCondition),
254    }
255}
256/// Simple comparison predicate.
257#[derive(serde::Serialize, serde::Deserialize)]
258#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
259pub struct Predicate {
260    #[prost(string, tag = "1")]
261    pub left: ::prost::alloc::string::String,
262    #[prost(enumeration = "ComparisonOperator", tag = "2")]
263    pub operator: i32,
264    #[prost(string, tag = "3")]
265    pub right: ::prost::alloc::string::String,
266}
267/// Negation wrapper.
268#[derive(serde::Serialize, serde::Deserialize)]
269#[derive(Clone, PartialEq, ::prost::Message)]
270pub struct NotCondition {
271    #[prost(message, optional, boxed, tag = "1")]
272    pub condition: ::core::option::Option<::prost::alloc::boxed::Box<ConditionExpr>>,
273}
274/// Two conditions joined by a logical operator.
275#[derive(serde::Serialize, serde::Deserialize)]
276#[derive(Clone, PartialEq, ::prost::Message)]
277pub struct CompoundCondition {
278    #[prost(message, optional, boxed, tag = "1")]
279    pub left: ::core::option::Option<::prost::alloc::boxed::Box<ConditionExpr>>,
280    #[prost(enumeration = "LogicalOperator", tag = "2")]
281    pub op: i32,
282    #[prost(message, optional, boxed, tag = "3")]
283    pub right: ::core::option::Option<::prost::alloc::boxed::Box<ConditionExpr>>,
284}
285/// Single identifier (variable name).
286#[derive(serde::Serialize, serde::Deserialize)]
287#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
288pub struct IdentifierCondition {
289    #[prost(string, tag = "1")]
290    pub value: ::prost::alloc::string::String,
291}
292/// CSS delivery strategy chosen at build time.
293#[derive(serde::Serialize, serde::Deserialize)]
294#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
295#[repr(i32)]
296pub enum CssStrategy {
297    Link = 0,
298    Style = 1,
299    Module = 2,
300}
301impl CssStrategy {
302    /// String value of the enum field names used in the ProtoBuf definition.
303    ///
304    /// The values are not transformed in any way and thus are considered stable
305    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
306    pub fn as_str_name(&self) -> &'static str {
307        match self {
308            Self::Link => "CSS_STRATEGY_LINK",
309            Self::Style => "CSS_STRATEGY_STYLE",
310            Self::Module => "CSS_STRATEGY_MODULE",
311        }
312    }
313    /// Creates an enum from field names used in the ProtoBuf definition.
314    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
315        match value {
316            "CSS_STRATEGY_LINK" => Some(Self::Link),
317            "CSS_STRATEGY_STYLE" => Some(Self::Style),
318            "CSS_STRATEGY_MODULE" => Some(Self::Module),
319            _ => None,
320        }
321    }
322}
323/// DOM encapsulation strategy chosen at build time.
324#[derive(serde::Serialize, serde::Deserialize)]
325#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
326#[repr(i32)]
327pub enum DomStrategy {
328    Shadow = 0,
329    Light = 1,
330}
331impl DomStrategy {
332    /// String value of the enum field names used in the ProtoBuf definition.
333    ///
334    /// The values are not transformed in any way and thus are considered stable
335    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
336    pub fn as_str_name(&self) -> &'static str {
337        match self {
338            Self::Shadow => "DOM_STRATEGY_SHADOW",
339            Self::Light => "DOM_STRATEGY_LIGHT",
340        }
341    }
342    /// Creates an enum from field names used in the ProtoBuf definition.
343    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
344        match value {
345            "DOM_STRATEGY_SHADOW" => Some(Self::Shadow),
346            "DOM_STRATEGY_LIGHT" => Some(Self::Light),
347            _ => None,
348        }
349    }
350}
351#[derive(serde::Serialize, serde::Deserialize)]
352#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
353#[repr(i32)]
354pub enum LogicalOperator {
355    Unspecified = 0,
356    And = 1,
357    Or = 2,
358}
359impl LogicalOperator {
360    /// String value of the enum field names used in the ProtoBuf definition.
361    ///
362    /// The values are not transformed in any way and thus are considered stable
363    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
364    pub fn as_str_name(&self) -> &'static str {
365        match self {
366            Self::Unspecified => "LOGICAL_OPERATOR_UNSPECIFIED",
367            Self::And => "AND",
368            Self::Or => "OR",
369        }
370    }
371    /// Creates an enum from field names used in the ProtoBuf definition.
372    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
373        match value {
374            "LOGICAL_OPERATOR_UNSPECIFIED" => Some(Self::Unspecified),
375            "AND" => Some(Self::And),
376            "OR" => Some(Self::Or),
377            _ => None,
378        }
379    }
380}
381#[derive(serde::Serialize, serde::Deserialize)]
382#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
383#[repr(i32)]
384pub enum ComparisonOperator {
385    Unspecified = 0,
386    GreaterThan = 1,
387    LessThan = 2,
388    Equal = 3,
389    NotEqual = 4,
390    GreaterThanOrEqual = 5,
391    LessThanOrEqual = 6,
392}
393impl ComparisonOperator {
394    /// String value of the enum field names used in the ProtoBuf definition.
395    ///
396    /// The values are not transformed in any way and thus are considered stable
397    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
398    pub fn as_str_name(&self) -> &'static str {
399        match self {
400            Self::Unspecified => "COMPARISON_OPERATOR_UNSPECIFIED",
401            Self::GreaterThan => "GREATER_THAN",
402            Self::LessThan => "LESS_THAN",
403            Self::Equal => "EQUAL",
404            Self::NotEqual => "NOT_EQUAL",
405            Self::GreaterThanOrEqual => "GREATER_THAN_OR_EQUAL",
406            Self::LessThanOrEqual => "LESS_THAN_OR_EQUAL",
407        }
408    }
409    /// Creates an enum from field names used in the ProtoBuf definition.
410    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
411        match value {
412            "COMPARISON_OPERATOR_UNSPECIFIED" => Some(Self::Unspecified),
413            "GREATER_THAN" => Some(Self::GreaterThan),
414            "LESS_THAN" => Some(Self::LessThan),
415            "EQUAL" => Some(Self::Equal),
416            "NOT_EQUAL" => Some(Self::NotEqual),
417            "GREATER_THAN_OR_EQUAL" => Some(Self::GreaterThanOrEqual),
418            "LESS_THAN_OR_EQUAL" => Some(Self::LessThanOrEqual),
419            _ => None,
420        }
421    }
422}