bevy_bsml 0.14.10

A UI library to compose UI elements using simple markup language, inspired by svelte and tailwindcss
Documentation
//! Defines the number of rows a grid has and the sizes of those rows. If grid items are given explicit placements then more rows may
//! be implicitly generated by items that are placed out of bounds. The sizes of those rows are controlled by `grid_auto_rows` property.
//!
//! <https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows>

use crate::class::ApplyClass;
use bevy_ui::{RepeatedGridTrack, Style};
use derive_more::From;

#[derive(Debug, Clone, From, PartialEq)]
pub struct GridTemplateRows(pub RepeatedGridTrack);

pub fn grid_rows(repeat: u16) -> GridTemplateRows {
    GridTemplateRows(RepeatedGridTrack::flex(repeat, 1.))
}

impl ApplyClass<GridTemplateRows> for Style {
    #[inline]
    fn apply_class(&mut self, class: &GridTemplateRows) {
        if !self.grid_template_rows.is_empty() {
            self.grid_template_rows.clear();
        }
        self.grid_template_rows.push(class.0.clone());
    }
}