plotnik_compiler/typegen/typescript/
config.rs1use plotnik_core::Colors;
4
5#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
7pub enum VoidType {
8 #[default]
10 Undefined,
11 Null,
13}
14
15#[derive(Clone, Debug)]
17pub struct Config {
18 pub(crate) export: bool,
20 pub(crate) emit_node_type: bool,
22 pub(crate) verbose_nodes: bool,
24 pub(crate) void_type: VoidType,
26 pub(crate) colors: Colors,
28}
29
30impl Default for Config {
31 fn default() -> Self {
32 Self {
33 export: true,
34 emit_node_type: true,
35 verbose_nodes: false,
36 void_type: VoidType::default(),
37 colors: Colors::OFF,
38 }
39 }
40}
41
42impl Config {
43 pub fn new() -> Self {
45 Self::default()
46 }
47
48 pub fn export(mut self, value: bool) -> Self {
50 self.export = value;
51 self
52 }
53
54 pub fn emit_node_type(mut self, value: bool) -> Self {
56 self.emit_node_type = value;
57 self
58 }
59
60 pub fn verbose_nodes(mut self, value: bool) -> Self {
62 self.verbose_nodes = value;
63 self
64 }
65
66 pub fn void_type(mut self, value: VoidType) -> Self {
68 self.void_type = value;
69 self
70 }
71
72 pub fn colored(mut self, enabled: bool) -> Self {
74 self.colors = Colors::new(enabled);
75 self
76 }
77}