♻️ Refactoriza la API de Children e InRegion
- Patrón prototipo en `InRegion`: cada petición recibe clones profundos. - `ComponentClone` habilita clonar `dyn Component` de forma segura. - `ChildTyped<C>` renombrado a `Slot<C>`, elimina `ChildTypedOp`. - `Mutex` en lugar de `Arc<RwLock>` en `Child` y `Slot`. - `is_renderable` y `setup_before_prepare` reciben `&Context`. - Nuevos tests para `Children`, `ChildOp` y `Slot`.
This commit is contained in:
parent
04e3d5b3c2
commit
54f990b11c
33 changed files with 740 additions and 314 deletions
|
|
@ -3,7 +3,7 @@ use pagetop::prelude::*;
|
|||
/// Componente mínimo para probar `Markup` pasando por el ciclo real de renderizado de componentes
|
||||
/// (`ComponentRender`). El parámetro de contexto `"renderable"` se usará para controlar si el
|
||||
/// componente se renderiza (`true` por defecto).
|
||||
#[derive(AutoDefault)]
|
||||
#[derive(AutoDefault, Clone)]
|
||||
struct TestMarkupComponent {
|
||||
markup: Markup,
|
||||
}
|
||||
|
|
@ -13,11 +13,11 @@ impl Component for TestMarkupComponent {
|
|||
Self::default()
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &mut Context) -> bool {
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
cx.param_or::<bool>("renderable", true)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> Result<Markup, ComponentError> {
|
||||
fn prepare(&self, _cx: &mut Context) -> Result<Markup, ComponentError> {
|
||||
Ok(self.markup.clone())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue