thoughts.md

 1Much of element styling is now handled by an external engine.
 2
 3
 4How do I make an element hover.
 5
 6There's a hover style.
 7
 8Hoverable needs to wrap another element. That element can be styled.
 9
10```rs
11struct Hoverable<E: Element> {
12
13}
14
15impl<V> Element<V> for Hoverable {
16
17}
18
19```
20
21
22
23```rs
24#[derive(Styled, Interactive)]
25pub struct Div {
26    declared_style: StyleRefinement,
27    interactions: Interactions
28}
29
30pub trait Styled {
31    fn declared_style(&mut self) -> &mut StyleRefinement;
32    fn compute_style(&mut self) -> Style {
33        Style::default().refine(self.declared_style())
34    }
35
36    // All the tailwind classes, modifying self.declared_style()
37}
38
39impl Style {
40    pub fn paint_background<V>(layout: Layout, cx: &mut PaintContext<V>);
41    pub fn paint_foreground<V>(layout: Layout, cx: &mut PaintContext<V>);
42}
43
44pub trait Interactive<V> {
45    fn interactions(&mut self) -> &mut Interactions<V>;
46
47    fn on_click(self, )
48}
49
50struct Interactions<V> {
51    click: SmallVec<[<Rc<dyn Fn(&mut V, &dyn Any, )>; 1]>,
52}
53
54
55```
56
57
58```rs
59
60
61trait Stylable {
62    type Style;
63
64    fn with_style(self, style: Self::Style) -> Self;
65}
66
67
68
69
70
71
72```