1pub mod layout;
2pub mod node;
3pub mod span;
4pub mod style;
5pub mod theme;
6
7use std::collections::HashMap;
8
9pub use layout::{
10 Alignment, Breakpoint, Direction, Justification, LayoutConstraints, Length, Padding,
11};
12pub use node::InterpolatedPart;
13pub use node::{AttributeValue, EventBinding, EventKind, WidgetKind, WidgetNode};
14pub use span::Span;
15pub use style::{
16 Background, Border, BorderRadius, BorderStyle, Color, Gradient, ImageFit, Shadow,
17 StyleProperties, Transform,
18};
19pub use theme::{
20 FontWeight, IcedPaletteColors, SpacingScale, StateSelector, StyleClass, Theme, ThemeDocument,
21 ThemeError, ThemeErrorKind, ThemePalette, Typography, WidgetState,
22};
23
24#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
39pub struct DampenDocument {
40 pub version: SchemaVersion,
42
43 pub root: WidgetNode,
45
46 pub themes: HashMap<String, crate::ir::theme::Theme>,
48
49 pub style_classes: HashMap<String, crate::ir::theme::StyleClass>,
51
52 pub global_theme: Option<String>,
54
55 pub follow_system: bool,
57}
58
59impl Default for DampenDocument {
60 fn default() -> Self {
62 Self {
63 version: SchemaVersion { major: 1, minor: 0 },
64 root: WidgetNode::default(),
65 themes: HashMap::new(),
66 style_classes: HashMap::new(),
67 global_theme: None,
68 follow_system: true,
69 }
70 }
71}
72
73#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
81pub struct SchemaVersion {
82 pub major: u16,
84 pub minor: u16,
86}
87
88impl Default for SchemaVersion {
89 fn default() -> Self {
91 Self { major: 1, minor: 0 }
92 }
93}