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