encre_css/plugins/border/divide_style/
mod.rs

1#![doc = include_str!("README.md")]
2#![doc(alias = "border")]
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 ["solid", "dashed", "dotted", "double", "none"].contains(value))
11    }
12
13    fn needs_wrapping(&self) -> bool {
14        false
15    }
16
17    fn handle(&self, context: &mut ContextHandle) {
18        generate_at_rules(context, |context| {
19            generate_class(
20                context,
21                |context| match context.modifier {
22                    Modifier::Builtin { value, .. } => {
23                        context.buffer.line(format_args!("border-style: {value};"));
24                    }
25                    Modifier::Arbitrary { .. } => unreachable!(),
26                },
27                " > :not([hidden]) ~ :not([hidden])",
28            );
29        });
30    }
31}