encre_css/plugins/interactivity/cursor/
mod.rs1#![doc = include_str!("README.md")]
2#![doc(alias = "interactivity")]
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, .. } => [
12 "auto",
13 "default",
14 "pointer",
15 "wait",
16 "text",
17 "move",
18 "help",
19 "not-allowed",
20 "none",
21 "context-menu",
22 "progress",
23 "cell",
24 "crosshair",
25 "vertical-text",
26 "alias",
27 "copy",
28 "no-drop",
29 "grab",
30 "grabbing",
31 "all-scroll",
32 "col-resize",
33 "row-resize",
34 "n-resize",
35 "e-resize",
36 "s-resize",
37 "w-resize",
38 "ne-resize",
39 "nw-resize",
40 "se-resize",
41 "sw-resize",
42 "ew-resize",
43 "ns-resize",
44 "nesw-resize",
45 "nwse-resize",
46 "zoom-in",
47 "zoom-out",
48 ]
49 .contains(&&**value),
50 Modifier::Arbitrary { value, .. } => is_matching_all(value),
51 }
52 }
53
54 fn handle(&self, context: &mut ContextHandle) {
55 match context.modifier {
56 Modifier::Builtin { value, .. } => {
57 context.buffer.line(format_args!("cursor: {value};"));
58 }
59 Modifier::Arbitrary { value, .. } => {
60 context.buffer.line(format_args!("cursor: {value};"));
61 }
62 }
63 }
64}