aura-gui 0.2.1

UI nativa acelerada por GPU para escritorio, Android e iOS, en un solo crate: estilo tipo Tailwind, componentes, sombras, animaciones y agentes de IA. Reposo a cero. Licencia AGPL-3.0 o comercial.
//! Utilidades de layout de Tailwind: posición, dirección inversa, `flex-*`, `self-*`, `content-*` y desbordamiento.
//! Se expande dentro de `Styled`; los tipos (`Align`, `Justify`…) se resuelven en `styled.rs`.

/// `z-10`, `-z-10`: orden de apilado entre hermanos.
macro_rules! z_indexes {
    ($($name:ident = $z:literal;)*) => {
        setters! { $($name => |s| s.extra_mut().z = Some($z);)* }
    };
}

macro_rules! layout_utilities {
    () => {
        z_indexes! {
            z_0 = 0; z_10 = 10; z_20 = 20; z_30 = 30; z_40 = 40; z_50 = 50;
            neg_z_10 = -10; neg_z_20 = -20; neg_z_30 = -30; neg_z_40 = -40; neg_z_50 = -50;
        }

        /// `z-[N]`: cualquier orden de apilado.
        fn z(mut self, order: i16) -> Self {
            self.style().extra_mut().z = Some(order);
            self
        }

        setters! {
            relative => |s| s.absolute = Some(false);
            // No hay `position: fixed` aparte: dentro del árbol equivale a `absolute` respecto a su contenedor.
            fixed => |s| s.absolute = Some(true);

            flex_row_reverse => |s| {
                s.direction = Some(Direction::Row);
                s.extra_mut().reverse = Some(true);
            };
            flex_col_reverse => |s| {
                s.direction = Some(Direction::Column);
                s.extra_mut().reverse = Some(true);
            };
            flex_nowrap => |s| s.wrap = Some(false);

            flex_auto => |s| {
                s.flex_grow = Some(1.0);
                s.flex_shrink = Some(1.0);
                s.flex_basis = Some(Length::Auto);
            };
            flex_initial => |s| {
                s.flex_grow = Some(0.0);
                s.flex_shrink = Some(1.0);
                s.flex_basis = Some(Length::Auto);
            };
            flex_none => |s| {
                s.flex_grow = Some(0.0);
                s.flex_shrink = Some(0.0);
                s.flex_basis = Some(Length::Auto);
            };
            grow => |s| s.flex_grow = Some(1.0);
            grow_0 => |s| s.flex_grow = Some(0.0);
            shrink => |s| s.flex_shrink = Some(1.0);
            shrink_0 => |s| s.flex_shrink = Some(0.0);

            items_stretch => |s| s.align_items = Some(Align::Stretch);
            items_baseline => |s| s.align_items = Some(Align::Baseline);
            justify_around => |s| s.justify_content = Some(Justify::SpaceAround);
            justify_evenly => |s| s.justify_content = Some(Justify::SpaceEvenly);

            self_auto => |s| s.align_self = None;
            self_start => |s| s.align_self = Some(Align::Start);
            self_center => |s| s.align_self = Some(Align::Center);
            self_end => |s| s.align_self = Some(Align::End);
            self_stretch => |s| s.align_self = Some(Align::Stretch);
            self_baseline => |s| s.align_self = Some(Align::Baseline);

            content_start => |s| s.extra_mut().align_content = Some(Justify::Start);
            content_center => |s| s.extra_mut().align_content = Some(Justify::Center);
            content_end => |s| s.extra_mut().align_content = Some(Justify::End);
            content_between => |s| s.extra_mut().align_content = Some(Justify::SpaceBetween);
            content_around => |s| s.extra_mut().align_content = Some(Justify::SpaceAround);
            content_evenly => |s| s.extra_mut().align_content = Some(Justify::SpaceEvenly);

            overflow_visible => |s| {
                s.overflow_x = Some(Overflow::Visible);
                s.overflow_y = Some(Overflow::Visible);
            };
            overflow_x_hidden => |s| s.overflow_x = Some(Overflow::Hidden);
            overflow_y_hidden => |s| s.overflow_y = Some(Overflow::Hidden);
            overflow_x_scroll => |s| s.overflow_x = Some(Overflow::Scroll);
            overflow_scroll => |s| {
                s.overflow_x = Some(Overflow::Scroll);
                s.overflow_y = Some(Overflow::Scroll);
            };
            // Como `overflow-auto`: la barra aparece solo si el contenido no cabe.
            overflow_auto => |s| s.overflow_y = Some(Overflow::Scroll);
        }
    };
}

pub(crate) use {layout_utilities, z_indexes};