encre_css/plugins/transition/transition_delay/
mod.rs1#![doc = include_str!("README.md")]
2#![doc(alias = "transition")]
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 match context.modifier {
11 Modifier::Builtin { value, .. } => value.parse::<usize>().is_ok(),
12 Modifier::Arbitrary { value, .. } => is_matching_time(value),
13 }
14 }
15
16 fn handle(&self, context: &mut ContextHandle) {
17 match context.modifier {
18 Modifier::Builtin { value, .. } => {
19 context
20 .buffer
21 .line(format_args!("transition-delay: {value}ms;"));
22 }
23 Modifier::Arbitrary { value, .. } => {
24 context
25 .buffer
26 .line(format_args!("transition-delay: {value};"));
27 }
28 }
29 }
30}