@effindomv2/fui-rs 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "fui-rs"
3
- version = "0.1.14"
3
+ version = "0.1.15"
4
4
  edition = "2021"
5
5
  license = "AGPL-3.0-only OR LicenseRef-EffinDom-Commercial"
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effindomv2/fui-rs",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "private": false,
5
5
  "license": "AGPL-3.0-only OR LicenseRef-EffinDom-Commercial",
6
6
  "description": "EffinDom v2 Rust frontend framework SDK and host generators",
package/src/lib.rs CHANGED
@@ -433,6 +433,7 @@ pub mod prelude {
433
433
  FileWorkerProcessResult, FileWriteProgress,
434
434
  };
435
435
  pub use crate::focus_visibility::show_keyboard_focus_for_key_event;
436
+ pub use crate::frame_scheduler::{mark_needs_commit, on_loaded, LoadedEventArgs};
436
437
  pub use crate::fui_component;
437
438
  pub use crate::image_sampling::{ImageSampling, ImageSamplingMode};
438
439
  pub use crate::logger;
@@ -17,82 +17,6 @@ impl CustomDrawable {
17
17
  }
18
18
  }
19
19
 
20
- pub fn width(&self, width: f32, unit: Unit) -> &Self {
21
- self.base.width(width, unit);
22
- self
23
- }
24
-
25
- pub fn width_len(&self, length: Length) -> &Self {
26
- self.base.width_len(length);
27
- self
28
- }
29
-
30
- pub fn height(&self, height: f32, unit: Unit) -> &Self {
31
- self.base.height(height, unit);
32
- self
33
- }
34
-
35
- pub fn height_len(&self, length: Length) -> &Self {
36
- self.base.height_len(length);
37
- self
38
- }
39
-
40
- pub fn bg_color(&self, color: u32) -> &Self {
41
- self.base.bg_color(color);
42
- self
43
- }
44
-
45
- pub fn corner_radius(&self, radius: f32) -> &Self {
46
- self.base.corner_radius(radius);
47
- self
48
- }
49
-
50
- pub fn border(&self, width: f32, color: u32) -> &Self {
51
- self.base.border(width, color);
52
- self
53
- }
54
-
55
- pub fn border_config(&self, border: Border) -> &Self {
56
- self.base.border_config(border);
57
- self
58
- }
59
-
60
- pub fn opacity(&self, value: f32) -> &Self {
61
- self.base.opacity(value);
62
- self
63
- }
64
-
65
- pub fn drop_shadow(
66
- &self,
67
- color: u32,
68
- offset_x: f32,
69
- offset_y: f32,
70
- blur_sigma: f32,
71
- spread: f32,
72
- ) -> &Self {
73
- self.base
74
- .drop_shadow(color, offset_x, offset_y, blur_sigma, spread);
75
- self
76
- }
77
-
78
- pub fn linear_gradient(
79
- &self,
80
- sx: f32,
81
- sy: f32,
82
- ex: f32,
83
- ey: f32,
84
- offsets: Vec<f32>,
85
- colors: Vec<u32>,
86
- ) -> &Self {
87
- self.base.linear_gradient(sx, sy, ex, ey, offsets, colors);
88
- self
89
- }
90
-
91
- pub fn child<T: Node>(&self, child: &T) -> &Self {
92
- self.base.child(child);
93
- self
94
- }
95
-
96
20
  pub fn mark_dirty(&self) {
97
21
  let handle = self.handle();
98
22
  if handle != NodeHandle::INVALID {
@@ -147,3 +71,51 @@ impl Node for CustomDrawable {
147
71
  }));
148
72
  }
149
73
  }
74
+
75
+ impl HasFlexBoxRoot for CustomDrawable {
76
+ fn flex_box_root(&self) -> &FlexBox {
77
+ &self.base
78
+ }
79
+ }
80
+
81
+ impl ThemeBindable for CustomDrawable {
82
+ fn theme_binding_node(&self) -> NodeRef {
83
+ self.base.retained_node_ref()
84
+ }
85
+
86
+ fn weak_theme_target(&self) -> Box<dyn Fn() -> Option<Self>> {
87
+ let weak_base = self.base.downgrade();
88
+ let draw_callback = self.draw_callback.clone();
89
+ Box::new(move || {
90
+ weak_base.upgrade().map(|base| Self {
91
+ base,
92
+ draw_callback: draw_callback.clone(),
93
+ })
94
+ })
95
+ }
96
+ }
97
+
98
+ #[cfg(test)]
99
+ mod tests {
100
+ use super::*;
101
+
102
+ fn assert_flex_box_surface<T: FlexBoxSurface>() {}
103
+ fn assert_theme_bindable<T: ThemeBindable>() {}
104
+
105
+ #[test]
106
+ fn custom_drawable_exposes_generic_retained_visual_surfaces() {
107
+ assert_flex_box_surface::<CustomDrawable>();
108
+ assert_theme_bindable::<CustomDrawable>();
109
+
110
+ let drawable = CustomDrawable::new(|_| {});
111
+ drawable
112
+ .width(300.0, Unit::Pixel)
113
+ .height(200.0, Unit::Pixel)
114
+ .min_width(120.0, Unit::Pixel)
115
+ .margin(1.0, 2.0, 3.0, 4.0)
116
+ .padding(5.0, 6.0, 7.0, 8.0)
117
+ .corner_radius(12.0)
118
+ .bg_color(0x112233FF)
119
+ .clip_to_bounds(true);
120
+ }
121
+ }