@effindomv2/fui-rs 0.1.13 → 0.1.14

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.
Files changed (3) hide show
  1. package/Cargo.toml +1 -1
  2. package/package.json +1 -1
  3. package/src/lib.rs +20 -1
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "fui-rs"
3
- version = "0.1.13"
3
+ version = "0.1.14"
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.13",
3
+ "version": "0.1.14",
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
@@ -317,13 +317,22 @@ macro_rules! ui {
317
317
  #[macro_export]
318
318
  macro_rules! fui_component {
319
319
  ($component:ty => $root:ident) => {
320
+ $crate::fui_component!(@impl $component => $root, [root]);
321
+ };
322
+ ($component:ty => $root:ident, owner: $owner:ident) => {
323
+ $crate::fui_component!(@impl $component => $root, [owner $owner]);
324
+ };
325
+ ($component:ty => $root:ident, owners: [$($owner:ident),+ $(,)?]) => {
326
+ $crate::fui_component!(@impl $component => $root, [owners $($owner),+]);
327
+ };
328
+ (@impl $component:ty => $root:ident, $owner_spec:tt) => {
320
329
  impl $crate::Node for $component {
321
330
  fn retained_node_ref(&self) -> $crate::node::NodeRef {
322
331
  $crate::Node::retained_node_ref(&self.$root)
323
332
  }
324
333
 
325
334
  fn retained_owner_attachment(&self) -> Option<std::rc::Rc<dyn std::any::Any>> {
326
- $crate::Node::retained_owner_attachment(&self.$root)
335
+ $crate::fui_component!(@owner_attachment self, $root, $owner_spec)
327
336
  }
328
337
 
329
338
  fn build_self(&self) {
@@ -337,6 +346,16 @@ macro_rules! fui_component {
337
346
  }
338
347
  }
339
348
  };
349
+ (@owner_attachment $this:ident, $root:ident, [root]) => {
350
+ $crate::Node::retained_owner_attachment(&$this.$root)
351
+ };
352
+ (@owner_attachment $this:ident, $root:ident, [owner $owner:ident]) => {{
353
+ let owner: std::rc::Rc<dyn std::any::Any> = $this.$owner.clone();
354
+ Some(owner)
355
+ }};
356
+ (@owner_attachment $this:ident, $root:ident, [owners $($owner:ident),+]) => {
357
+ Some(std::rc::Rc::new(($($this.$owner.clone(),)+)))
358
+ };
340
359
  }
341
360
 
342
361
  pub mod prelude {