1mod derive_register_component;
2mod dynamic_spacing;
3
4use proc_macro::TokenStream;
5
6/// Generates the DynamicSpacing enum used for density-aware spacing in the UI.
7#[proc_macro]
8pub fn derive_dynamic_spacing(input: TokenStream) -> TokenStream {
9 dynamic_spacing::derive_spacing(input)
10}
11
12/// Registers components that implement the `Component` trait.
13///
14/// This proc macro is used to automatically register structs that implement
15/// the `Component` trait with the [`component::ComponentRegistry`].
16///
17/// If the component trait is not implemented, it will generate a compile-time error.
18///
19/// # Example
20///
21/// ```
22/// use ui_macros::RegisterComponent;
23///
24/// #[derive(RegisterComponent)]
25/// struct MyComponent;
26///
27/// impl Component for MyComponent {
28/// // Component implementation
29/// }
30/// ```
31///
32/// This example will add MyComponent to the ComponentRegistry.
33#[proc_macro_derive(RegisterComponent)]
34pub fn derive_register_component(input: TokenStream) -> TokenStream {
35 derive_register_component::derive_register_component(input)
36}