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