encre_css/plugins/grid/grid_auto_flow/
mod.rs

1#![doc = include_str!("README.md")]
2#![doc(alias = "grid")]
3use crate::prelude::build_plugin::*;
4
5#[derive(Debug)]
6pub(crate) struct PluginDefinition;
7
8impl Plugin for PluginDefinition {
9    fn can_handle(&self, context: ContextCanHandle) -> bool {
10        matches!(
11            context.modifier,
12            Modifier::Builtin {
13                value: "row" | "col" | "dense" | "row-dense" | "col-dense",
14                ..
15            }
16        )
17    }
18
19    fn handle(&self, context: &mut ContextHandle) {
20        if let Modifier::Builtin { value, .. } = context.modifier {
21            context.buffer.line(format_args!(
22                "grid-auto-flow: {};",
23                match *value {
24                    "col" => "column",
25                    "row-dense" => "row dense",
26                    "col-dense" => "column dense",
27                    _ => value,
28                }
29            ));
30        }
31    }
32}