♻️ (html): Añade valores extra a Props

- Reordena campos, variantes y métodos para mayor consistencia interna.
- Añade `extra_or`, `extra_or_default` y `extra_or_else` a `Props`.
- Mejora la documentación y amplía los tests de integración.
This commit is contained in:
Manuel Cillero 2026-07-09 00:05:28 +02:00
parent a26aa4d30a
commit 25713a8a13
26 changed files with 578 additions and 227 deletions

View file

@ -6,7 +6,7 @@ use crate::prelude::*;
/// opcional y un cuerpo que sólo se renderiza si existen componentes hijos (*children*).
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Block {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el título del bloque.
title: L10n,
@ -60,7 +60,7 @@ impl Block {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -65,7 +65,7 @@ impl fmt::Display for ButtonAction {
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Button {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el comportamiento del botón al activarse.
kind: ButtonAction,
@ -158,7 +158,7 @@ impl Button {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -105,7 +105,7 @@ impl Item {
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Field {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el nombre base compartido por todas las casillas del grupo.
name: AttrName,
@ -201,7 +201,7 @@ impl Field {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -39,7 +39,7 @@ use crate::prelude::*;
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Checkbox {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve la variante visual del control.
checkbox_kind: form::CheckboxKind,
@ -158,7 +158,7 @@ impl Checkbox {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -44,7 +44,7 @@ use crate::base::component::form;
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Form {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve la URL/ruta de destino del formulario.
action: AttrValue,
@ -99,7 +99,7 @@ impl Form {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -24,7 +24,7 @@ use crate::prelude::*;
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Fieldset {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve la leyenda del `fieldset`.
legend: Attr<L10n>,
@ -77,7 +77,7 @@ impl Fieldset {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -123,7 +123,7 @@ impl fmt::Display for Mode {
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Field {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el tipo de campo.
kind: Kind,
@ -302,7 +302,7 @@ impl Field {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -94,7 +94,7 @@ impl Item {
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Field {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el nombre compartido por todos los botones de opción del grupo.
name: AttrName,
@ -204,7 +204,7 @@ impl Field {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -31,7 +31,7 @@ use crate::prelude::*;
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Range {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el nombre del campo.
name: AttrName,
@ -112,7 +112,7 @@ impl Range {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -188,7 +188,7 @@ pub enum Entry {
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Field {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el nombre del campo.
name: AttrName,
@ -312,7 +312,7 @@ impl Field {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);

View file

@ -33,7 +33,7 @@ use crate::prelude::*;
/// ```
#[derive(AutoDefault, Clone, Debug, Getters)]
pub struct Textarea {
/// Devuelve identificador, clases CSS y atributos HTML del componente.
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
props: Props,
/// Devuelve el nombre del campo.
name: AttrName,
@ -142,7 +142,7 @@ impl Textarea {
self
}
/// Modifica identificador, clases CSS o atributos HTML del componente.
/// Modifica identificador, clases CSS, atributos HTML o valores extra del componente.
#[builder_fn]
pub fn with_prop(mut self, op: PropsOp) -> Self {
self.props.alter_prop(op);