encre_css/plugins/layout/z_index/
mod.rs

1#![doc = include_str!("README.md")]
2#![doc(alias = "layout")]
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!(context.modifier, Modifier::Builtin { value, .. } if value.parse::<usize>().is_ok() || *value == "auto")
11    }
12
13    fn handle(&self, context: &mut ContextHandle) {
14        if let Modifier::Builtin { value, is_negative } = context.modifier {
15            context.buffer.line(format_args!(
16                "z-index: {}{value};",
17                format_negative(is_negative)
18            ));
19        }
20    }
21}