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