✨ Añade acciones base y renderizado de componentes
- Añade acciones BeforeRender y AfterRender para ejecutar código personalizado antes y después de renderizar un componente. - Introduce la acción PrepareRender para personalizar totalmente el renderizado de un componente. - Se actualizan las definiciones de acciones para utilizar el nuevo "trait" ActionDispatcher. - Se crea un nuevo trait ComponentTrait para definir componentes renderizables. - Se implementan las estructuras Children y Child para gestionar componentes hijos dentro de un componente padre. - Se añade OptionComponent para encapsular de forma segura componentes opcionales y poder usarlos en otros componentes.
This commit is contained in:
parent
f76a208520
commit
37df2ada75
28 changed files with 1102 additions and 147 deletions
|
@ -1,7 +1,9 @@
|
|||
use crate::core::theme::ThemeRef;
|
||||
use crate::global;
|
||||
|
||||
use std::sync::{LazyLock, RwLock};
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
// TEMAS *******************************************************************************************
|
||||
|
||||
|
@ -17,11 +19,11 @@ pub static DEFAULT_THEME: LazyLock<ThemeRef> =
|
|||
|
||||
// TEMA POR NOMBRE *********************************************************************************
|
||||
|
||||
/// Devuelve el tema identificado por su [`short_name`](AnyInfo::short_name).
|
||||
pub fn theme_by_short_name(short_name: impl AsRef<str>) -> Option<ThemeRef> {
|
||||
let short_name = short_name.as_ref().to_lowercase();
|
||||
match THEMES
|
||||
.read()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|t| t.short_name().to_lowercase() == short_name)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ pub type ThemeRef = &'static dyn ThemeTrait;
|
|||
/// Interfaz común que debe implementar cualquier tema de `PageTop`.
|
||||
///
|
||||
/// Un tema implementará [`ThemeTrait`] y los métodos que sean necesarios de [`ExtensionTrait`],
|
||||
/// aunque el único obligatorio es [`theme()`](crate::core::extension::ExtensionTrait#method.theme).
|
||||
/// aunque el único obligatorio es [`theme()`](ExtensionTrait::theme).
|
||||
///
|
||||
/// ```rust
|
||||
/// use pagetop::prelude::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue