1use std::borrow::Cow;
2
3use bevy_app::prelude::*;
4use bevy_ecs::prelude::*;
5use bevy_ui::prelude::*;
6
7pub mod container;
8
9pub mod prelude {
10 pub use super::container::prelude::*;
11 pub use super::{SwoopUiPlugin, UiBase, UiToBundle};
12}
13
14pub struct SwoopUiPlugin;
15
16pub trait UiBase {
18 fn name_node(&mut self) -> &mut Name;
20
21 fn node_node(&mut self) -> &mut Node;
23
24 fn name(mut self, name: impl Into<Cow<'static, str>>) -> Self
26 where
27 Self: Sized,
28 {
29 self.name_node().set(name);
30 self
31 }
32
33 fn padding(mut self, padding: UiRect) -> Self
35 where
36 Self: Sized,
37 {
38 self.node_node().padding = padding;
39 self
40 }
41
42 fn frame(mut self, width: Val, height: Val) -> Self
44 where
45 Self: Sized,
46 {
47 let node = self.node_node();
48 node.width = width;
49 node.height = height;
50 self
51 }
52
53 fn width(mut self, width: Val) -> Self
55 where
56 Self: Sized,
57 {
58 self.node_node().width = width;
59 self
60 }
61
62 fn height(mut self, height: Val) -> Self
64 where
65 Self: Sized,
66 {
67 self.node_node().height = height;
68 self
69 }
70}
71
72pub trait UiToBundle {
74 fn pack(self) -> impl Bundle;
76}
77
78impl Plugin for SwoopUiPlugin {
79 fn build(&self, app: &mut App) {
80 todo!()
81 }
82}