1pub mod dispatch;
32pub mod engine;
33pub(crate) mod engine_core;
34pub mod error;
35pub mod ir;
36pub mod lifecycle;
37pub mod reactive;
38pub mod reconcile;
39pub mod serialize;
40pub mod state;
41
42#[doc(hidden)]
47pub mod render;
48
49#[doc(hidden)]
51pub mod logger;
52
53pub mod wasm;
59
60#[cfg(feature = "uniffi")]
62pub mod uniffi;
63
64#[cfg(feature = "uniffi")]
66::uniffi::setup_scaffolding!();
67
68pub use engine::Engine;
71pub use error::EngineError;
72
73pub use ir::{ast_to_ir_node, Element, IRNode, Value};
74pub use ir::{parse_svg, resolve_icons_in_ir, IconData, IconPath, ResourceRegistry};
75pub use lifecycle::{Module, ModuleInstance};
76pub use reconcile::Patch;
77pub use state::StateChange;
78
79#[cfg(test)]
80mod tailwind_tests {
81 use hypen_tailwind_parse::parse_classes;
82
83 #[test]
84 fn test_tailwind_parse_basic() {
85 let output = parse_classes("p-4 text-blue-500 bg-white");
86 assert_eq!(output.base.len(), 3);
87
88 let props = output.to_props();
89 assert_eq!(props.get("padding"), Some(&"1rem".to_string()));
90 assert_eq!(props.get("color"), Some(&"#3b82f6".to_string()));
91 assert_eq!(props.get("background-color"), Some(&"#ffffff".to_string()));
92 }
93
94 #[test]
95 fn test_tailwind_parse_with_breakpoints() {
96 let output = parse_classes("p-4 md:p-8 lg:p-12");
97
98 let props = output.to_props();
99 assert_eq!(props.get("padding"), Some(&"1rem".to_string()));
100 assert_eq!(props.get("padding@md"), Some(&"2rem".to_string()));
101 assert_eq!(props.get("padding@lg"), Some(&"3rem".to_string()));
102 }
103
104 #[test]
105 fn test_tailwind_parse_with_hover() {
106 let output = parse_classes("bg-white hover:bg-blue-500");
107
108 let props = output.to_props();
109 assert_eq!(props.get("background-color"), Some(&"#ffffff".to_string()));
110 assert_eq!(
111 props.get("background-color:hover"),
112 Some(&"#3b82f6".to_string())
113 );
114 }
115
116 #[test]
117 fn test_tailwind_parse_layout() {
118 let output = parse_classes("flex justify-center items-center gap-4");
119
120 let props = output.to_props();
121 assert_eq!(props.get("display"), Some(&"flex".to_string()));
122 assert_eq!(props.get("justify-content"), Some(&"center".to_string()));
123 assert_eq!(props.get("align-items"), Some(&"center".to_string()));
124 assert_eq!(props.get("gap"), Some(&"1rem".to_string()));
125 }
126
127 #[test]
128 fn test_tailwind_parse_sizing() {
129 let output = parse_classes("w-full h-screen max-w-lg");
130
131 let props = output.to_props();
132 assert_eq!(props.get("width"), Some(&"100%".to_string()));
133 assert_eq!(props.get("height"), Some(&"100vh".to_string()));
134 assert_eq!(props.get("max-width"), Some(&"32rem".to_string()));
135 }
136}