♻️ (bootsier): Renombra traits de extensión

Los traits con los que Bootsier añade métodos a componentes del núcleo
pasan de `<Componente>Bootsier` a `<Componente>BsExt`. SelectBootsier
se confundiría con componentes como SelectLanguage.
This commit is contained in:
Manuel Cillero 2026-10-08 21:19:41 +02:00
parent 08d673b89d
commit 144127776d
14 changed files with 43 additions and 43 deletions

View file

@ -70,21 +70,21 @@ mod token;
pub use token::*;
#[doc(hidden)]
pub use bs::badge::BadgeBootsier;
pub use bs::badge::BadgeBsExt;
#[doc(hidden)]
pub use bs::button::ButtonBootsier;
pub use bs::button::ButtonBsExt;
#[doc(hidden)]
pub use bs::dropdown::DropdownBootsier;
pub use bs::dropdown::DropdownBsExt;
#[doc(hidden)]
pub use bs::form::input::InputBootsier;
pub use bs::form::input::InputBsExt;
#[doc(hidden)]
pub use bs::form::select::SelectBootsier;
pub use bs::form::select::SelectBsExt;
#[doc(hidden)]
pub use bs::form::textarea::TextareaBootsier;
pub use bs::form::textarea::TextareaBsExt;
#[doc(hidden)]
pub use bs::nav::NavBootsier;
pub use bs::nav::NavBsExt;
#[doc(hidden)]
pub use bs::navbar::NavbarBootsier;
pub use bs::navbar::NavbarBsExt;
// Añade la clase de un punto de corte con un prefijo y un sufijo (opcional) a la cadena de clases,
// separada con un espacio de las que ya hubiera: `prefix-name-suffix`, sin `-suffix` si no hay

View file

@ -4,7 +4,7 @@ pub(crate) mod layout;
// Badge.
pub(crate) mod badge;
pub use badge::{Badge, BadgeBootsier};
pub use badge::{Badge, BadgeBsExt};
// Block.
pub use pagetop::base::component::Block;
@ -20,7 +20,7 @@ pub use pagetop::base::component::breadcrumb;
// Button.
pub mod button;
pub use button::{Button, ButtonBootsier};
pub use button::{Button, ButtonBsExt};
// Container.
pub mod container;
@ -37,18 +37,18 @@ pub mod dropdown;
#[doc(inline)]
pub use dropdown::Dropdown;
#[doc(inline)]
pub use dropdown::DropdownBootsier;
pub use dropdown::DropdownBsExt;
// Form.
pub mod form;
#[doc(inline)]
pub use form::Form;
#[doc(inline)]
pub use form::input::InputBootsier;
pub use form::input::InputBsExt;
#[doc(inline)]
pub use form::select::SelectBootsier;
pub use form::select::SelectBsExt;
#[doc(inline)]
pub use form::textarea::TextareaBootsier;
pub use form::textarea::TextareaBsExt;
// Image.
pub mod image;
@ -63,14 +63,14 @@ pub mod nav;
#[doc(inline)]
pub use nav::Nav;
#[doc(inline)]
pub use nav::NavBootsier;
pub use nav::NavBsExt;
// Navbar.
pub mod navbar;
#[doc(inline)]
pub use navbar::Navbar;
#[doc(inline)]
pub use navbar::NavbarBootsier;
pub use navbar::NavbarBsExt;
// Offcanvas.
pub mod offcanvas;

View file

@ -19,14 +19,14 @@ const EXTRA_COLOR: &str = "bootsier.badge.color";
/// let badge = bs::Badge::labeled(Lc::n("Beta")).with_color(BootsierColors::Dark);
/// ```
#[builder_impl]
pub trait BadgeBootsier {
pub trait BadgeBsExt {
/// Fuerza un color de la paleta de Bootsier, ignorando el que le correspondería a la `Intent`
/// del badge. `None` restablece el comportamiento por defecto (color derivado de la `Intent`).
fn with_color(self, color: impl Into<Option<BootsierColors>>) -> Self;
}
#[builder_impl]
impl BadgeBootsier for Badge {
impl BadgeBsExt for Badge {
fn with_color(mut self, color: impl Into<Option<BootsierColors>>) -> Self {
match color.into() {
Some(color) => self.alter_prop(PropsOp::set_extra(EXTRA_COLOR, color)),
@ -41,7 +41,7 @@ impl BadgeBootsier for Badge {
pub(crate) fn setup(badge: &mut Badge) {
// `Badge::setup()` (core) ya ha traducido la intención con `Theme::intent_color()`. La clase
// `badge-*` que hay que localizar es siempre la derivada de la `Intent`, con independencia de
// que `BadgeBootsier::with_color()` fuerce un color distinto para el destino `text-bg-*`.
// que `BadgeBsExt::with_color()` fuerce un color distinto para el destino `text-bg-*`.
let intent_color = BootsierColors::from(badge.intent()).as_str();
let color = badge
.props()

View file

@ -10,7 +10,7 @@ const EXTRA_ACTIVE: &str = "bootsier.button.active";
const EXTRA_FULL_WIDTH: &str = "bootsier.button.full_width";
const EXTRA_COLOR: &str = "bootsier.button.color";
// **< ButtonBootsier >*****************************************************************************
// **< ButtonBsExt >********************************************************************************
/// Extensión de Bootsier para [`Button`].
///
@ -36,7 +36,7 @@ const EXTRA_COLOR: &str = "bootsier.button.color";
/// .with_color(BootsierColors::Light);
/// ```
#[builder_impl]
pub trait ButtonBootsier {
pub trait ButtonBsExt {
/// Marca el botón como activo (`.active`, `aria-pressed="true"`).
fn with_active(self, active: bool) -> Self;
@ -50,7 +50,7 @@ pub trait ButtonBootsier {
}
#[builder_impl]
impl ButtonBootsier for Button {
impl ButtonBsExt for Button {
fn with_active(mut self, active: bool) -> Self {
self.alter_prop(PropsOp::set_extra(EXTRA_ACTIVE, active));
self

View file

@ -45,7 +45,7 @@ const EXTRA_MENU_POSITION: &str = "bootsier.dropdown.menu_position";
/// .with_item(bs::dropdown::Item::button(Lc::n("Sign out")));
/// ```
#[builder_impl]
pub trait DropdownBootsier {
pub trait DropdownBsExt {
/// Indica si el botón del menú está integrado en un grupo de botones.
fn with_button_grouped(self, grouped: bool) -> Self;
@ -68,7 +68,7 @@ pub trait DropdownBootsier {
}
#[builder_impl]
impl DropdownBootsier for Dropdown {
impl DropdownBsExt for Dropdown {
fn with_button_grouped(mut self, grouped: bool) -> Self {
self.alter_prop(PropsOp::set_extra(EXTRA_BUTTON_GROUPED, grouped));
self

View file

@ -14,16 +14,16 @@ pub use pagetop::base::component::form::radio;
pub mod select;
#[doc(inline)]
pub use select::SelectBootsier;
pub use select::SelectBsExt;
pub mod input;
#[doc(inline)]
pub use input::InputBootsier;
pub use input::InputBsExt;
pub mod textarea;
pub use textarea::Textarea;
#[doc(inline)]
pub use textarea::TextareaBootsier;
pub use textarea::TextareaBsExt;
pub use pagetop::base::component::form::Number;

View file

@ -23,7 +23,7 @@ const EXTRA_FLOATING_LABEL: &str = "bootsier.form.input.floating_label";
/// .with_floating_label(true);
/// ```
#[builder_impl]
pub trait InputBootsier {
pub trait InputBsExt {
/// Establece si la etiqueta se muestra flotante sobre el campo.
///
/// Cuando está activo, la etiqueta se superpone al campo y asciende al enfocarlo o cuando tiene
@ -33,7 +33,7 @@ pub trait InputBootsier {
}
#[builder_impl]
impl InputBootsier for Field {
impl InputBsExt for Field {
fn with_floating_label(mut self, floating: bool) -> Self {
self.alter_prop(PropsOp::set_extra(EXTRA_FLOATING_LABEL, floating));
self

View file

@ -25,7 +25,7 @@ const EXTRA_FLOATING_LABEL: &str = "bootsier.form.select.floating_label";
/// .with_item(bs::form::select::Item::new("en", Lc::n("English")));
/// ```
#[builder_impl]
pub trait SelectBootsier {
pub trait SelectBsExt {
/// Establece si la etiqueta se muestra flotante sobre el campo.
///
/// Cuando está activo, la etiqueta se superpone al control y permanece flotante siempre que
@ -38,7 +38,7 @@ pub trait SelectBootsier {
}
#[builder_impl]
impl SelectBootsier for Field {
impl SelectBsExt for Field {
fn with_floating_label(mut self, floating: bool) -> Self {
self.alter_prop(PropsOp::set_extra(EXTRA_FLOATING_LABEL, floating));
self

View file

@ -23,7 +23,7 @@ const EXTRA_FLOATING_LABEL: &str = "bootsier.form.textarea.floating_label";
/// .with_floating_label(true);
/// ```
#[builder_impl]
pub trait TextareaBootsier {
pub trait TextareaBsExt {
/// Establece si la etiqueta se muestra flotante sobre el campo.
///
/// Cuando está activo, la etiqueta se superpone al área de texto y asciende al enfocarlo o
@ -36,7 +36,7 @@ pub trait TextareaBootsier {
}
#[builder_impl]
impl TextareaBootsier for Textarea {
impl TextareaBsExt for Textarea {
fn with_floating_label(mut self, floating: bool) -> Self {
self.alter_prop(PropsOp::set_extra(EXTRA_FLOATING_LABEL, floating));
self

View file

@ -19,8 +19,8 @@ pub use pagetop::base::component::nav::{Item, ItemKind};
const EXTRA_KIND: &str = "bootsier.nav.kind";
// Marca interna (nunca expuesta en `NavBootsier`) que `theme::bs::navbar::item` fija sobre el clon
// de un `Nav` embebido en una `Navbar`, para que use `navbar-nav` en vez de `nav` como clase base.
// Marca interna (nunca expuesta en `NavBsExt`) que `theme::bs::navbar::item` fija sobre el clon de
// un `Nav` embebido en una `Navbar`, para que use `navbar-nav` en vez de `nav` como clase base.
pub(crate) const EXTRA_IN_NAVBAR: &str = "bootsier.nav.in_navbar";
/// Extensión de Bootsier para [`Nav`].
@ -47,13 +47,13 @@ pub(crate) const EXTRA_IN_NAVBAR: &str = "bootsier.nav.in_navbar";
/// .with_item(bs::nav::Item::link_disabled(Lc::n("Disabled"), "#"));
/// ```
#[builder_impl]
pub trait NavBootsier {
pub trait NavBsExt {
/// Cambia el estilo del menú (*Tabs*, *Pills*, *Underline* o *Default*).
fn with_kind(self, kind: Kind) -> Self;
}
#[builder_impl]
impl NavBootsier for Nav {
impl NavBsExt for Nav {
fn with_kind(mut self, kind: Kind) -> Self {
self.alter_prop(PropsOp::set_extra(EXTRA_KIND, kind));
self

View file

@ -19,7 +19,7 @@ mod panel;
pub use panel::Panel;
mod component;
pub use component::NavbarBootsier;
pub use component::NavbarBsExt;
pub(crate) use component::{render, setup};
mod item;

View file

@ -140,7 +140,7 @@ const EXTRA_LAYOUT: &str = "bootsier.navbar.layout";
/// ));
/// ```
#[builder_impl]
pub trait NavbarBootsier {
pub trait NavbarBsExt {
/// Crea una barra de navegación cuyo contenido se muestra en un panel lateral.
fn offcanvas(panel: bs::navbar::Panel) -> Self;
@ -154,7 +154,7 @@ pub trait NavbarBootsier {
}
#[builder_impl]
impl NavbarBootsier for Navbar {
impl NavbarBsExt for Navbar {
fn offcanvas(panel: bs::navbar::Panel) -> Self {
let mut navbar = Self::new();
navbar.alter_prop(PropsOp::set_extra(

View file

@ -1,4 +1,4 @@
// Verifies `BadgeBootsier::with_color()`: it overrides the Bootstrap color that `Badge` would
// Verifies `BadgeBsExt::with_color()`: it overrides the Bootstrap color that `Badge` would
// otherwise derive from its `Intent`, without disturbing the class that `Badge::setup()` (core)
// already generated from that `Intent`.

View file

@ -99,8 +99,8 @@
//! [`PropsOp::set_extra()`] para consumirlos en el `setup()` vía [`Theme::setup_component()`] o
//! en el `render()` vía [`Theme::render_component()`]), o aportar componentes propios.
//! `pagetop-bootsier` combina las tres estrategias: reexporta `Form`/`Fieldset` sin cambios,
//! extiende `Button`/`Badge`/`Dropdown`/`Nav`/`Navbar` con sus propios traits (`ButtonBootsier`,
//! `BadgeBootsier`, etc.), y añade componentes propios como `Offcanvas`.
//! extiende `Button`/`Badge`/`Dropdown`/`Nav`/`Navbar` con sus propios traits (`ButtonBsExt`,
//! `BadgeBsExt`, etc.), y añade componentes propios como `Offcanvas`.
//!
//! Para forzar una plantilla completamente distinta en una página concreta, se puede llamar
//! manualmente a [`with_template()`].