🎨 Convierte el ciclo de renderizado en async

`prepare()` de `Component`, `render()` de `Region` y `Template`, y la
implementación de `ComponentRender` pasan a ser funciones async. Se
actualizan todos los componentes base, helpers, tests y ejemplos.
This commit is contained in:
Manuel Cillero 2026-07-06 00:48:41 +02:00
parent 9acd8cc51a
commit 9354894b3a
48 changed files with 436 additions and 365 deletions

View file

@ -12,16 +12,16 @@ use crate::locale::L10n;
/// fn render_logo(cx: &mut Context) -> Markup {
/// html! {
/// div class="logo_color" {
/// (PageTopSvg::Color.render(cx))
/// (PageTopSvg::Color.markup(cx))
/// }
/// div class="line_dark" {
/// (PageTopSvg::LineDark.render(cx))
/// (PageTopSvg::LineDark.markup(cx))
/// }
/// div class="line_light" {
/// (PageTopSvg::LineLight.render(cx))
/// (PageTopSvg::LineLight.markup(cx))
/// }
/// div class="line_red" {
/// (PageTopSvg::LineRGB(255, 0, 0).render(cx))
/// (PageTopSvg::LineRGB(255, 0, 0).markup(cx))
/// }
/// }
/// };
@ -41,8 +41,8 @@ pub enum PageTopSvg {
}
impl PageTopSvg {
/// Renderiza el SVG del logotipo según la variante elegida.
pub fn render(&self, cx: &Context) -> Markup {
/// Devuelve el marcado SVG del logotipo según la variante elegida.
pub fn markup(&self, cx: &Context) -> Markup {
let path_fills = match self {
Self::Color => self.logo_color(),
Self::LineDark => self.logo_line(10, 11, 9),

View file

@ -162,10 +162,11 @@ impl PropsOp {
/// props: Props,
/// }
///
/// #[async_trait]
/// impl Component for MyButton {
/// fn new() -> Self { Self::default() }
///
/// fn prepare(&self, cx: &mut Context) -> Result<Markup, ComponentError> {
/// async fn prepare(&self, cx: &mut Context) -> Result<Markup, ComponentError> {
/// Ok(html! {
/// button (self.props()) {
/// (self.label().using(cx))