✨ Completa la API de temas con setup_component!
Elimina `action::theme` fusionando sus responsabilidades en `action::component`. Renombra `AlterMarkup` a `TransformMarkup` y `FnActionAlterMarkup` a `FnActionTransformMarkup`. Simplifica `ActionKey` y mueve los tipos de función al módulo de componente.
This commit is contained in:
parent
0c648fb95a
commit
04e3d5b3c2
18 changed files with 178 additions and 279 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
use crate::base::action::FnActionWithComponent;
|
||||
use super::FnActionWithComponent;
|
||||
|
||||
/// Ejecuta [`FnActionWithComponent`] antes de renderizar el componente.
|
||||
pub struct BeforeRender<C: Component> {
|
||||
|
|
@ -57,24 +57,14 @@ impl<C: Component> BeforeRender<C> {
|
|||
pub(crate) fn dispatch(component: &mut C, cx: &mut Context) {
|
||||
// Primero despacha las acciones para el tipo de componente.
|
||||
dispatch_actions(
|
||||
&ActionKey::new(
|
||||
UniqueId::of::<Self>(),
|
||||
None,
|
||||
Some(UniqueId::of::<C>()),
|
||||
None,
|
||||
),
|
||||
&ActionKey::new(UniqueId::of::<Self>(), Some(UniqueId::of::<C>()), None),
|
||||
|action: &Self| (action.f)(component, cx),
|
||||
);
|
||||
|
||||
// Y luego despacha las aciones para el tipo de componente con un identificador dado.
|
||||
if let Some(id) = component.id() {
|
||||
dispatch_actions(
|
||||
&ActionKey::new(
|
||||
UniqueId::of::<Self>(),
|
||||
None,
|
||||
Some(UniqueId::of::<C>()),
|
||||
Some(id),
|
||||
),
|
||||
&ActionKey::new(UniqueId::of::<Self>(), Some(UniqueId::of::<C>()), Some(id)),
|
||||
|action: &Self| (action.f)(component, cx),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue