♻️ (pagetop): Sustituye StyleSheet::inline

- `StyleSheet::inline` se resuelve ahora con `ResponsiveStyles`.
- `StyleSheet` se simplifica a sólo hojas de estilo externas.
- `ResponsiveStyles` añade `add_styles()` para declarar varias
  propiedades en una sola llamada.
- `AssetsOp` gana un constructor por variante y conversiones
  "From<Favicon/Preload/StyleSheet/JavaScript>" para pasarlos
  directamente a `with_assets()`.
This commit is contained in:
Manuel Cillero 2026-09-12 20:44:17 +02:00
parent 0b8f3f3000
commit 64113aff09
21 changed files with 764 additions and 497 deletions

View file

@ -178,42 +178,40 @@ impl Theme for Bootsier {
// Las URLs de las fuentes deben coincidir exactamente con las declaradas en @font-face de
// _bootsier-custom.scss; cualquier discrepancia hace que el navegador descargue dos veces.
page.alter_assets(AssetsOp::AddPreload(
Preload::font("/bootsier/fonts/bootsier.font.woff2").with_weight(-99),
))
.alter_assets(AssetsOp::AddPreload(
Preload::font("/bootsier/fonts/bootsier.font.italic.woff2").with_weight(-99),
))
.alter_assets(AssetsOp::AddStyleSheet(
StyleSheet::from("/bootsier/css/bootsier.min.css")
.with_version(ADMINLTE_VERSION)
.with_weight(-99),
))
.alter_assets(AssetsOp::AddJavaScript(
JavaScript::defer("/bootsier/js/bootsier.bundle.min.js")
.with_version(BOOTSTRAP_VERSION)
.with_weight(-99),
))
.alter_assets(AssetsOp::AddJavaScript(
JavaScript::defer("/bootsier/js/bootsier.extended.min.js")
.with_version(ADMINLTE_VERSION)
.with_weight(-99),
))
.alter_assets(AssetsOp::AddJavaScript(
JavaScript::defer("/bootsier/js/bootsier.dialog.min.js")
.with_version(BOOTSTRAP_VERSION)
.with_weight(-99),
))
.alter_assets(AssetsOp::AddJavaScript(
JavaScript::defer("/bootsier/js/bootsier.confirm.min.js")
.with_version(BOOTSTRAP_VERSION)
.with_weight(-99),
))
.alter_body_props(PropsOp::set("data-confirm-ok", confirm_ok))
.alter_body_props(PropsOp::set("data-confirm-cancel", confirm_cancel))
.alter_child_in(
&CoreRegions::Footer,
ChildOp::AddIfEmpty(PoweredBy::new().into()),
);
page.alter_assets(Preload::font("/bootsier/fonts/bootsier.font.woff2").with_weight(-99))
.alter_assets(
Preload::font("/bootsier/fonts/bootsier.font.italic.woff2").with_weight(-99),
)
.alter_assets(
StyleSheet::from("/bootsier/css/bootsier.min.css")
.with_version(ADMINLTE_VERSION)
.with_weight(-99),
)
.alter_assets(
JavaScript::defer("/bootsier/js/bootsier.bundle.min.js")
.with_version(BOOTSTRAP_VERSION)
.with_weight(-99),
)
.alter_assets(
JavaScript::defer("/bootsier/js/bootsier.extended.min.js")
.with_version(ADMINLTE_VERSION)
.with_weight(-99),
)
.alter_assets(
JavaScript::defer("/bootsier/js/bootsier.dialog.min.js")
.with_version(BOOTSTRAP_VERSION)
.with_weight(-99),
)
.alter_assets(
JavaScript::defer("/bootsier/js/bootsier.confirm.min.js")
.with_version(BOOTSTRAP_VERSION)
.with_weight(-99),
)
.alter_body_props(PropsOp::set("data-confirm-ok", confirm_ok))
.alter_body_props(PropsOp::set("data-confirm-cancel", confirm_cancel))
.alter_child_in(
&CoreRegions::Footer,
ChildOp::AddIfEmpty(PoweredBy::new().into()),
);
}
}

View file

@ -41,11 +41,11 @@ async fn render_admin(cx: &mut Context) -> Markup {
cx.alter_body_props(PropsOp::add_classes(
"layout-fixed sidebar-expand-lg bg-body-tertiary",
));
cx.alter_assets(AssetsOp::AddJavaScript(
cx.alter_assets(
JavaScript::defer("/bootsier/js/bootsier.shell.min.js")
.with_version(ADMINLTE_VERSION)
.with_weight(-88),
));
);
// `CoreRegions::Aside` es una región neutra del core: la usa `pagetop-admin` para su menú de
// secciones sin que este tema tenga que depender de él. `BootsierRegions::Sidebar` sigue
// disponible para que cualquier extensión añada elementos propios a mano.