1#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
3pub enum AnchorLayout {
4 #[default]
6 Columns,
7 Stacked,
12}
13
14#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
19pub enum DotShape {
20 #[default]
22 Circle,
23 Diamond,
25 Square,
27 Hexagon,
29 Triangle,
31 Star,
33}
34
35impl DotShape {
36 pub fn path(self) -> &'static str {
41 match self {
42 DotShape::Circle => "M12 2.5A9.5 9.5 0 1 0 12 21.5A9.5 9.5 0 1 0 12 2.5Z",
44 DotShape::Diamond => "M12 2.5L21.5 12L12 21.5L2.5 12Z",
45 DotShape::Square => "M3 3H21V21H3Z",
46 DotShape::Hexagon => "M12 2.5L21 7.75V18.25L12 21.5L3 18.25V7.75Z",
47 DotShape::Triangle => "M4.5 3L21 12L4.5 21Z",
48 DotShape::Star => "M12 2L14.6 9.4L22 12L14.6 14.6L12 22L9.4 14.6L2 12L9.4 9.4Z",
49 }
50 }
51}
52
53#[derive(Clone, Debug)]
55pub struct NodeStyle {
56 pub background: String,
57 pub border: String,
58 pub outline_selected: String,
60 pub border_radius: String,
61 pub shadow: String,
62 pub shadow_selected: String,
63 pub min_width: String,
64 pub width: String,
70 pub opacity_dragging: f64,
71 pub padding_x: f64,
73 pub header_padding_y: f64,
75 pub body_padding_y: f64,
77 pub ports_padding_y: f64,
79 pub header_border_bottom: String,
81 pub header_background: String,
83 pub header_color: String,
85 pub header_font_size: String,
87 pub header_accent_height: f64,
89 pub field_label_color: String,
91 pub field_label_font_size: String,
93 pub field_gap: String,
95 pub field_label_min_width: String,
97 pub body_border_bottom: String,
99 pub anchor_layout: AnchorLayout,
101 pub cursor: String,
104 pub cursor_dragging: String,
106 pub cursor_resize: String,
108 pub resizable: bool,
110 pub resize_handle_width: f64,
114 pub resize_handle_color: String,
117 pub resize_min_width: f64,
121 pub resize_max_width: Option<f64>,
123}
124
125impl Default for NodeStyle {
126 fn default() -> Self {
127 Self {
128 background: "#1e1e22".into(),
129 border: "1px solid #3f3f46".into(),
130 outline_selected: "1.5px solid #ef4444".into(),
131 border_radius: "8px".into(),
132 shadow: "0 4px 12px rgba(0,0,0,0.4)".into(),
133 shadow_selected: "0 0 0 1px #ef4444, 0 4px 16px rgba(239,68,68,0.25)".into(),
134 min_width: "160px".into(),
135 width: String::new(),
136 opacity_dragging: 0.92,
137 padding_x: 10.0,
138 header_padding_y: 6.0,
139 body_padding_y: 6.0,
140 ports_padding_y: 4.0,
141 header_border_bottom: "1px solid #27272a".into(),
142 header_background: "#232327".into(),
143 header_color: "#a1a1aa".into(),
144 header_font_size: "12px".into(),
145 header_accent_height: 2.0,
146 field_label_color: "#71717a".into(),
147 field_label_font_size: "10px".into(),
148 field_gap: "6px".into(),
149 field_label_min_width: "38px".into(),
150 body_border_bottom: "1px solid #27272a".into(),
151 anchor_layout: AnchorLayout::Columns,
152 cursor: "grab".into(),
153 cursor_dragging: "grabbing".into(),
154 cursor_resize: "ew-resize".into(),
155 resizable: true,
156 resize_handle_width: 6.0,
157 resize_handle_color: "#71717a".into(),
158 resize_min_width: 120.0,
159 resize_max_width: None,
160 }
161 }
162}
163
164#[derive(Clone, Debug)]
166pub struct NodeMenuStyle {
167 pub background: String,
168 pub border: String,
169 pub shadow: String,
170 pub input_background: String,
171 pub input_border: String,
172 pub input_color: String,
173 pub placeholder_color: String,
174 pub category_color: String,
175 pub item_color: String,
176 pub description_color: String,
177 pub hover_background: String,
178 pub port_color: String,
179 pub empty_color: String,
180 pub divider: String,
181}
182
183impl Default for NodeMenuStyle {
184 fn default() -> Self {
185 Self {
186 background: "#1e1e22".into(),
187 border: "1px solid #3f3f46".into(),
188 shadow: "0 8px 24px rgba(0,0,0,0.5)".into(),
189 input_background: "#27272a".into(),
190 input_border: "1px solid #3f3f46".into(),
191 input_color: "#d4d4d8".into(),
192 placeholder_color: "#71717a".into(),
193 category_color: "#52525b".into(),
194 item_color: "#d4d4d8".into(),
195 description_color: "#71717a".into(),
196 hover_background: "rgba(99, 102, 241, 0.15)".into(),
197 port_color: "#a1a1aa".into(),
198 empty_color: "#71717a".into(),
199 divider: "1px solid #27272a".into(),
200 }
201 }
202}
203
204#[derive(Clone, Debug)]
206pub struct GroupStyle {
207 pub default_color: String,
208 pub border_radius: String,
209 pub error_border: String,
210 pub error_background: String,
211 pub error_label_color: String,
212 pub label_font_size: String,
213 pub label_font_weight: String,
214 pub input_background: String,
215}
216
217impl Default for GroupStyle {
218 fn default() -> Self {
219 Self {
220 default_color: "#8b5cf6".into(),
221 border_radius: "8px".into(),
222 error_border: "rgba(239, 68, 68, 0.5)".into(),
223 error_background: "rgba(239, 68, 68, 0.08)".into(),
224 error_label_color: "rgba(239, 68, 68, 0.8)".into(),
225 label_font_size: "10px".into(),
226 label_font_weight: "600".into(),
227 input_background: "transparent".into(),
228 }
229 }
230}
231
232#[derive(Clone, Debug)]
235pub struct AnchorStyle {
236 pub dot_size: f64,
238 pub dot_border_width: f64,
240 pub dot_color: String,
242 pub dot_connected_color: String,
244 pub dot_compatible_color: String,
246 pub dot_compatible_glow: String,
250 pub label_font_size: String,
252 pub label_color: String,
254 pub label_compatible_color: String,
256 pub row_height: f64,
258 pub first_port_y: f64,
261 pub dot_inset: f64,
263 pub row_padding: String,
265 pub row_gap: String,
267 pub incompatible_opacity: f64,
269 pub tooltip_background: String,
271 pub tooltip_border: String,
273 pub tooltip_color: String,
275}
276
277impl Default for AnchorStyle {
278 fn default() -> Self {
279 Self {
280 dot_size: 8.0,
281 dot_border_width: 1.5,
282 dot_color: "#71717a".into(),
283 dot_connected_color: "#71717a".into(),
284 dot_compatible_color: "#22d3ee".into(),
285 dot_compatible_glow:
286 "drop-shadow(0 0 2px #22d3ee) drop-shadow(0 0 5px rgba(34,211,238,0.45))".into(),
287 label_font_size: "11px".into(),
288 label_color: "#a1a1aa".into(),
289 label_compatible_color: "#22d3ee".into(),
290 row_height: 24.0,
291 first_port_y: 0.0, dot_inset: 14.0,
293 row_padding: "0 10px".into(),
294 row_gap: "6px".into(),
295 incompatible_opacity: 0.25,
296 tooltip_background: "#27272a".into(),
297 tooltip_border: "1px solid #3f3f46".into(),
298 tooltip_color: "#a1a1aa".into(),
299 }
300 }
301}