thoughts.md

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