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
use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::ui_interaction::UiInteraction; use crate::ui_layout::UiLayout; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UiLibrary { pub name: String, pub presets: Vec<UiLibraryPreset> } impl Default for UiLibrary { fn default() -> Self { UiLibrary { name: "".to_string(), presets: vec![] } } } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UiLibraryPreset { pub key: String, pub value: String, pub preset_calls: Vec<PresetCall>, pub sub_properties: Vec<UiProperty> } impl Default for UiLibraryPreset { fn default() -> Self { UiLibraryPreset { key: "".to_string(), value: "".to_string(), preset_calls: vec![], sub_properties: vec![] } } } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct PresetCall { pub name: String, pub preset: String } impl Default for PresetCall { fn default() -> Self { PresetCall { name: "".to_string(), preset: "".to_string() } } } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UiProperty { pub key: String, pub value: String } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct UiFlow { pub name: String, pub interactions: Vec<UiInteraction>, pub layout: Vec<UiLayout> } impl UiFlow { pub fn new(name: String) -> Self { UiFlow { name, interactions: vec![], layout: vec![] } } } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Component { pub name: String, pub child_components: Vec<String>, pub configs: HashMap<String, String>, } impl Default for Component { fn default() -> Self { Component { name: "".to_string(), child_components: vec![], configs: Default::default(), } } }