1pub mod ir;
2pub mod reactive;
3pub mod reconcile;
4pub mod dispatch;
5pub mod lifecycle;
6pub mod serialize;
7pub mod engine;
8pub mod state;
9pub mod logger;
10pub mod render;
11
12pub mod wasm;
18
19#[cfg(feature = "uniffi")]
21pub mod uniffi;
22
23#[cfg(feature = "uniffi")]
25::uniffi::setup_scaffolding!();
26
27pub use engine::Engine;
28
29pub use ir::{ast_to_ir, Element, Value};
30pub use lifecycle::{Module, ModuleInstance};
31pub use reconcile::Patch;
32pub use state::StateChange;
33
34#[cfg(test)]
35mod tailwind_tests {
36 use hypen_tailwind_parse::parse_classes;
37
38 #[test]
39 fn test_tailwind_parse_basic() {
40 let output = parse_classes("p-4 text-blue-500 bg-white");
41 assert_eq!(output.base.len(), 3);
42
43 let props = output.to_props();
44 assert_eq!(props.get("padding"), Some(&"1rem".to_string()));
45 assert_eq!(props.get("color"), Some(&"#3b82f6".to_string()));
46 assert_eq!(props.get("background-color"), Some(&"#ffffff".to_string()));
47 }
48
49 #[test]
50 fn test_tailwind_parse_with_breakpoints() {
51 let output = parse_classes("p-4 md:p-8 lg:p-12");
52
53 let props = output.to_props();
54 assert_eq!(props.get("padding"), Some(&"1rem".to_string()));
55 assert_eq!(props.get("padding@md"), Some(&"2rem".to_string()));
56 assert_eq!(props.get("padding@lg"), Some(&"3rem".to_string()));
57 }
58
59 #[test]
60 fn test_tailwind_parse_with_hover() {
61 let output = parse_classes("bg-white hover:bg-blue-500");
62
63 let props = output.to_props();
64 assert_eq!(props.get("background-color"), Some(&"#ffffff".to_string()));
65 assert_eq!(props.get("background-color:hover"), Some(&"#3b82f6".to_string()));
66 }
67
68 #[test]
69 fn test_tailwind_parse_layout() {
70 let output = parse_classes("flex justify-center items-center gap-4");
71
72 let props = output.to_props();
73 assert_eq!(props.get("display"), Some(&"flex".to_string()));
74 assert_eq!(props.get("justify-content"), Some(&"center".to_string()));
75 assert_eq!(props.get("align-items"), Some(&"center".to_string()));
76 assert_eq!(props.get("gap"), Some(&"1rem".to_string()));
77 }
78
79 #[test]
80 fn test_tailwind_parse_sizing() {
81 let output = parse_classes("w-full h-screen max-w-lg");
82
83 let props = output.to_props();
84 assert_eq!(props.get("width"), Some(&"100%".to_string()));
85 assert_eq!(props.get("height"), Some(&"100vh".to_string()));
86 assert_eq!(props.get("max-width"), Some(&"32rem".to_string()));
87 }
88}