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