pub mod dispatch;
pub mod engine;
pub(crate) mod engine_core;
pub mod error;
pub mod ir;
pub mod lifecycle;
pub mod portable;
pub mod reactive;
pub mod reconcile;
pub mod serialize;
pub mod state;
#[doc(hidden)]
pub mod render;
#[doc(hidden)]
pub mod logger;
pub mod wasm;
#[cfg(feature = "uniffi")]
pub mod uniffi;
#[cfg(feature = "uniffi")]
::uniffi::setup_scaffolding!();
pub use engine::Engine;
pub use error::EngineError;
pub use ir::{ast_to_ir_node, Element, IRNode, Value};
pub use ir::{parse_svg, resolve_icons_in_ir, IconData, IconPath, ResourceRegistry};
pub use lifecycle::{Module, ModuleInstance};
pub use portable::{
build_url, decode_uri_component, diff_paths, encode_uri_component, match_path, parse_query,
path_delete, path_get, path_has, path_set, session_step, DiffEntry, RouteMatch, SessionEffect,
SessionEvent, SessionPolicy, SessionState,
};
pub use reconcile::Patch;
pub use state::StateChange;
#[cfg(test)]
mod tailwind_tests {
use hypen_tailwind_parse::parse_classes;
#[test]
fn test_tailwind_parse_basic() {
let output = parse_classes("p-4 text-blue-500 bg-white");
assert_eq!(output.base.len(), 3);
let props = output.to_props();
assert_eq!(props.get("padding"), Some(&"1rem".to_string()));
assert_eq!(props.get("color"), Some(&"#3b82f6".to_string()));
assert_eq!(props.get("background-color"), Some(&"#ffffff".to_string()));
}
#[test]
fn test_tailwind_parse_with_breakpoints() {
let output = parse_classes("p-4 md:p-8 lg:p-12");
let props = output.to_props();
assert_eq!(props.get("padding"), Some(&"1rem".to_string()));
assert_eq!(props.get("padding@md"), Some(&"2rem".to_string()));
assert_eq!(props.get("padding@lg"), Some(&"3rem".to_string()));
}
#[test]
fn test_tailwind_parse_with_hover() {
let output = parse_classes("bg-white hover:bg-blue-500");
let props = output.to_props();
assert_eq!(props.get("background-color"), Some(&"#ffffff".to_string()));
assert_eq!(
props.get("background-color:hover"),
Some(&"#3b82f6".to_string())
);
}
#[test]
fn test_tailwind_parse_layout() {
let output = parse_classes("flex justify-center items-center gap-4");
let props = output.to_props();
assert_eq!(props.get("display"), Some(&"flex".to_string()));
assert_eq!(props.get("justify-content"), Some(&"center".to_string()));
assert_eq!(props.get("align-items"), Some(&"center".to_string()));
assert_eq!(props.get("gap"), Some(&"1rem".to_string()));
}
#[test]
fn test_tailwind_parse_sizing() {
let output = parse_classes("w-full h-screen max-w-lg");
let props = output.to_props();
assert_eq!(props.get("width"), Some(&"100%".to_string()));
assert_eq!(props.get("height"), Some(&"100vh".to_string()));
assert_eq!(props.get("max-width"), Some(&"32rem".to_string()));
}
}