euv_core/dynamic/hub/enum.rs
1use super::*;
2
3/// Serializable native UI node primitive used in component-level and page-level dynamic updates.
4#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
5#[serde(rename_all = "snake_case")]
6pub enum DynamicNodeKind {
7 /// Vertical flexbox container.
8 #[default]
9 Column,
10 /// Horizontal flexbox container.
11 Row,
12 /// Uniform-column grid container.
13 Grid,
14 /// Generic box container.
15 View,
16 /// Styled elevated surface card container.
17 Card,
18 /// Native text run node.
19 Text,
20 /// Interactive clickable button dispatching a `DynamicActionEvent`.
21 Button,
22 /// Compact pill status badge.
23 Badge,
24 /// Horizontal hairline separator.
25 Divider,
26}
27
28/// Granularity scope of a dynamic update operation.
29#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
30#[serde(rename_all = "snake_case")]
31pub enum DynamicUpdateScope {
32 /// Surgical update scoped to a single named component slot.
33 #[default]
34 Component,
35 /// Page-level update scoped to a route (override existing or inject new route).
36 Page,
37 /// Atomic multi-target bundle updating components and pages together.
38 Bundle,
39}
40
41/// Validation and runtime errors returned by `DynamicUpdateHub` operations.
42#[derive(Clone, Debug, Eq, Hash, PartialEq)]
43pub enum DynamicUpdateError {
44 /// Target component ID or page route was empty or whitespace-only.
45 EmptyTargetId,
46 /// Supplied checksum did not match the deterministic FNV-1a digest of the update payload.
47 ChecksumMismatch {
48 /// Target component ID or route path.
49 target: String,
50 /// Checksum declared by the incoming manifest.
51 expected: u64,
52 /// Deterministically computed checksum of the payload.
53 actual: u64,
54 },
55 /// Incoming version was lower than or equal to the active version without `allow_downgrade`.
56 VersionRegression {
57 /// Target component ID or route path.
58 target: String,
59 /// Currently active version number.
60 current: u64,
61 /// Rejected incoming version number.
62 incoming: u64,
63 },
64 /// Remote JSON manifest failed deserialization.
65 InvalidJson(String),
66 /// Rollback requested on a component or page with no applied dynamic revision.
67 NoHistoryToRollback(String),
68}
69
70/// Internal representation of a mounted dynamic update payload (SDUI descriptor or native Rust closure).
71#[derive(Clone, CustomDebug)]
72pub(crate) enum DynamicPayload {
73 /// Declarative cross-platform server-driven UI tree specification.
74 Spec(DynamicNodeSpec),
75 /// Hot-swapped native Rust builder closure.
76 Native(#[debug(skip)] DynamicBuilderFn),
77}