microsoft-webui-protocol 0.0.18

Core protocol definitions for WebUI framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

// This file is @generated by prost-build from proto/webui.proto.
// Do not edit manually. Regenerate with: cargo xtask proto
// This file is @generated by prost-build.
/// Root protocol containing all fragment records.
/// Per-component metadata keyed by tag name.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ComponentData {
    /// Non-WebUI client-side template payload.
    /// FAST plugins store complete <f-template> HTML here.
    #[prost(string, tag = "1")]
    pub template: ::prost::alloc::string::String,
    /// Component CSS content for the Module strategy.
    /// Contains the full CSS content when CssStrategy::Module is active.
    /// Empty for Link and Style strategies (CSS is handled via <link> tags
    /// or inline <style> tags baked into raw fragments by the parser).
    #[prost(string, tag = "2")]
    pub css: ::prost::alloc::string::String,
    /// External stylesheet href for the Link CSS strategy.
    /// Set to e.g. "/my-card.css" when the component has a CSS file and the
    /// build used CssStrategy::Link. Empty for Style/Module strategies and
    /// for components without CSS.
    /// The handler uses css_strategy and dom_strategy on WebUIProtocol to
    /// decide what to emit in <head>:
    ///    Link + Shadow → <link rel="preload"> (shadow root has the stylesheet)
    ///    Link + Light  → <link rel="stylesheet"> (no shadow root to host it)
    #[prost(string, tag = "3")]
    pub css_href: ::prost::alloc::string::String,
    /// WebUI plugin JSON-safe component metadata.
    /// Stored separately from executable condition closures so handlers can emit
    /// the static metadata in application/json data blocks.
    #[prost(string, tag = "4")]
    pub template_json: ::prost::alloc::string::String,
    /// WebUI plugin component-local JavaScript condition closure array.
    /// Empty when the component has no conditions or boolean attributes.
    #[prost(string, tag = "5")]
    pub template_functions: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebUiProtocol {
    #[prost(map = "string, message", tag = "1")]
    pub fragments: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        FragmentList,
    >,
    /// Sorted, deduplicated CSS custom property names used across all components
    /// and entry page styles (e.g., "colorBrandBackground", "spacingMedium").
    /// Only usage via var(--name) is included; local definitions are excluded.
    #[prost(string, repeated, tag = "2")]
    pub tokens: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Per-component data keyed by tag name (f-template + CSS).
    #[prost(map = "string, message", tag = "3")]
    pub components: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ComponentData,
    >,
    /// Build-wide CSS delivery strategy. Determines how the handler emits
    /// CSS-related tags in <head> for components with css_href.
    #[prost(enumeration = "CssStrategy", tag = "4")]
    pub css_strategy: i32,
    /// Build-wide DOM encapsulation strategy. Combined with css_strategy to
    /// decide preload vs stylesheet emission.
    #[prost(enumeration = "DomStrategy", tag = "5")]
    pub dom_strategy: i32,
}
/// A list of fragments (needed because protobuf maps cannot have repeated values directly).
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FragmentList {
    #[prost(message, repeated, tag = "1")]
    pub fragments: ::prost::alloc::vec::Vec<WebUiFragment>,
}
/// A single fragment — one of several types.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebUiFragment {
    #[prost(oneof = "web_ui_fragment::Fragment", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9")]
    pub fragment: ::core::option::Option<web_ui_fragment::Fragment>,
}
/// Nested message and enum types in `WebUIFragment`.
pub mod web_ui_fragment {
    #[derive(serde::Serialize, serde::Deserialize)]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Fragment {
        #[prost(message, tag = "1")]
        Raw(super::WebUiFragmentRaw),
        #[prost(message, tag = "2")]
        Component(super::WebUiFragmentComponent),
        #[prost(message, tag = "3")]
        ForLoop(super::WebUiFragmentFor),
        #[prost(message, tag = "4")]
        Signal(super::WebUiFragmentSignal),
        #[prost(message, tag = "5")]
        IfCond(super::WebUiFragmentIf),
        #[prost(message, tag = "6")]
        Attribute(super::WebUiFragmentAttribute),
        #[prost(message, tag = "7")]
        Plugin(super::WebUiFragmentPlugin),
        #[prost(message, tag = "8")]
        Route(super::WebUiFragmentRoute),
        #[prost(message, tag = "9")]
        Outlet(super::WebUiFragmentOutlet),
    }
}
/// Declarative route definition linking a URL path template to a component.
/// Nested routes are expressed via repeated children.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebUiFragmentRoute {
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub fragment_id: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub exact: bool,
    /// Nested child routes rendered at the component's <outlet />.
    #[prost(message, repeated, tag = "4")]
    pub children: ::prost::alloc::vec::Vec<WebUiFragmentRoute>,
    /// Comma-separated allowlist of query parameters forwarded as attributes.
    /// Empty string means no query params are forwarded (deny-by-default).
    #[prost(string, tag = "5")]
    pub allowed_query: ::prost::alloc::string::String,
    /// When true, the router preserves the mounted component instance across
    /// navigations instead of destroying and recreating it. Opt-in per route.
    #[prost(bool, tag = "6")]
    pub keep_alive: bool,
    /// Cache tag templates for this route (e.g. "thread:{threadId}", "inbox").
    /// Placeholders like {param} are resolved at render time with actual param values.
    #[prost(string, repeated, tag = "7")]
    pub cache_tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Invalidation tag templates (e.g. "inbox", "thread:{threadId}").
    /// After a mutation action on this route, these tags are auto-invalidated.
    /// Supports {param} placeholders resolved at render time.
    #[prost(string, repeated, tag = "8")]
    pub invalidates: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Component tag name for the pending/loading UI (e.g. "mail-skeleton").
    /// Validated at build time — build fails if the component does not exist.
    #[prost(string, tag = "9")]
    pub pending_component: ::prost::alloc::string::String,
    /// Component tag name for the error boundary UI (e.g. "error-page").
    /// Validated at build time — build fails if the component does not exist.
    #[prost(string, tag = "10")]
    pub error_component: ::prost::alloc::string::String,
}
/// Outlet placeholder — marks where matched child route content renders.
/// Components use this to indicate where nested route children are rendered.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WebUiFragmentOutlet {}
/// Opaque plugin-specific data passed from parser plugin to handler plugin.
/// WebUI framework does not interpret this data — it is a pass-through conduit.
/// Each parser/handler plugin pair defines its own binary contract for the data field.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WebUiFragmentPlugin {
    #[prost(bytes = "vec", tag = "1")]
    pub data: ::prost::alloc::vec::Vec<u8>,
}
/// Static text or HTML content.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WebUiFragmentRaw {
    #[prost(string, tag = "1")]
    pub value: ::prost::alloc::string::String,
}
/// Reference to a reusable component fragment.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WebUiFragmentComponent {
    #[prost(string, tag = "1")]
    pub fragment_id: ::prost::alloc::string::String,
}
/// Loop directive iterating over a collection.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WebUiFragmentFor {
    #[prost(string, tag = "1")]
    pub item: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub collection: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub fragment_id: ::prost::alloc::string::String,
}
/// Dynamic data binding via signal.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WebUiFragmentSignal {
    #[prost(string, tag = "1")]
    pub value: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub raw: bool,
}
/// Conditional rendering fragment.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebUiFragmentIf {
    #[prost(message, optional, tag = "1")]
    pub condition: ::core::option::Option<ConditionExpr>,
    #[prost(string, tag = "2")]
    pub fragment_id: ::prost::alloc::string::String,
}
/// Dynamic attribute binding.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebUiFragmentAttribute {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// For simple dynamic attrs, the signal name.
    #[prost(string, tag = "2")]
    pub value: ::prost::alloc::string::String,
    /// For mixed (template) attrs, the sub-stream ID.
    #[prost(string, tag = "3")]
    pub template: ::prost::alloc::string::String,
    /// True for :-prefixed complex attributes.
    #[prost(bool, tag = "4")]
    pub complex: bool,
    /// True for the first dynamic attribute on a component element.
    #[prost(bool, tag = "5")]
    pub attr_start: bool,
    /// True for skipped attributes (class, style, role, data-*, aria-*).
    #[prost(bool, tag = "6")]
    pub attr_skip: bool,
    /// True for static attribute values on components.
    #[prost(bool, tag = "7")]
    pub raw_value: bool,
    /// For ?-prefixed boolean attributes, the condition tree.
    #[prost(message, optional, tag = "8")]
    pub condition_tree: ::core::option::Option<ConditionExpr>,
}
/// A condition expression tree.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConditionExpr {
    #[prost(oneof = "condition_expr::Expr", tags = "1, 2, 3, 4")]
    pub expr: ::core::option::Option<condition_expr::Expr>,
}
/// Nested message and enum types in `ConditionExpr`.
pub mod condition_expr {
    #[derive(serde::Serialize, serde::Deserialize)]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Expr {
        #[prost(message, tag = "1")]
        Predicate(super::Predicate),
        #[prost(message, tag = "2")]
        Not(::prost::alloc::boxed::Box<super::NotCondition>),
        #[prost(message, tag = "3")]
        Compound(::prost::alloc::boxed::Box<super::CompoundCondition>),
        #[prost(message, tag = "4")]
        Identifier(super::IdentifierCondition),
    }
}
/// Simple comparison predicate.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Predicate {
    #[prost(string, tag = "1")]
    pub left: ::prost::alloc::string::String,
    #[prost(enumeration = "ComparisonOperator", tag = "2")]
    pub operator: i32,
    #[prost(string, tag = "3")]
    pub right: ::prost::alloc::string::String,
}
/// Negation wrapper.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NotCondition {
    #[prost(message, optional, boxed, tag = "1")]
    pub condition: ::core::option::Option<::prost::alloc::boxed::Box<ConditionExpr>>,
}
/// Two conditions joined by a logical operator.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompoundCondition {
    #[prost(message, optional, boxed, tag = "1")]
    pub left: ::core::option::Option<::prost::alloc::boxed::Box<ConditionExpr>>,
    #[prost(enumeration = "LogicalOperator", tag = "2")]
    pub op: i32,
    #[prost(message, optional, boxed, tag = "3")]
    pub right: ::core::option::Option<::prost::alloc::boxed::Box<ConditionExpr>>,
}
/// Single identifier (variable name).
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct IdentifierCondition {
    #[prost(string, tag = "1")]
    pub value: ::prost::alloc::string::String,
}
/// CSS delivery strategy chosen at build time.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CssStrategy {
    Link = 0,
    Style = 1,
    Module = 2,
}
impl CssStrategy {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Link => "CSS_STRATEGY_LINK",
            Self::Style => "CSS_STRATEGY_STYLE",
            Self::Module => "CSS_STRATEGY_MODULE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "CSS_STRATEGY_LINK" => Some(Self::Link),
            "CSS_STRATEGY_STYLE" => Some(Self::Style),
            "CSS_STRATEGY_MODULE" => Some(Self::Module),
            _ => None,
        }
    }
}
/// DOM encapsulation strategy chosen at build time.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DomStrategy {
    Shadow = 0,
    Light = 1,
}
impl DomStrategy {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Shadow => "DOM_STRATEGY_SHADOW",
            Self::Light => "DOM_STRATEGY_LIGHT",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "DOM_STRATEGY_SHADOW" => Some(Self::Shadow),
            "DOM_STRATEGY_LIGHT" => Some(Self::Light),
            _ => None,
        }
    }
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum LogicalOperator {
    Unspecified = 0,
    And = 1,
    Or = 2,
}
impl LogicalOperator {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "LOGICAL_OPERATOR_UNSPECIFIED",
            Self::And => "AND",
            Self::Or => "OR",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "LOGICAL_OPERATOR_UNSPECIFIED" => Some(Self::Unspecified),
            "AND" => Some(Self::And),
            "OR" => Some(Self::Or),
            _ => None,
        }
    }
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ComparisonOperator {
    Unspecified = 0,
    GreaterThan = 1,
    LessThan = 2,
    Equal = 3,
    NotEqual = 4,
    GreaterThanOrEqual = 5,
    LessThanOrEqual = 6,
}
impl ComparisonOperator {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "COMPARISON_OPERATOR_UNSPECIFIED",
            Self::GreaterThan => "GREATER_THAN",
            Self::LessThan => "LESS_THAN",
            Self::Equal => "EQUAL",
            Self::NotEqual => "NOT_EQUAL",
            Self::GreaterThanOrEqual => "GREATER_THAN_OR_EQUAL",
            Self::LessThanOrEqual => "LESS_THAN_OR_EQUAL",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "COMPARISON_OPERATOR_UNSPECIFIED" => Some(Self::Unspecified),
            "GREATER_THAN" => Some(Self::GreaterThan),
            "LESS_THAN" => Some(Self::LessThan),
            "EQUAL" => Some(Self::Equal),
            "NOT_EQUAL" => Some(Self::NotEqual),
            "GREATER_THAN_OR_EQUAL" => Some(Self::GreaterThanOrEqual),
            "LESS_THAN_OR_EQUAL" => Some(Self::LessThanOrEqual),
            _ => None,
        }
    }
}