🚚 Renaming base components

This commit is contained in:
Manuel Cillero 2023-10-20 00:46:40 +02:00
parent dbe1ec03ac
commit e8e7f62d6c
28 changed files with 87 additions and 87 deletions

View file

@ -3,13 +3,13 @@ use crate::html::{JavaScript, StyleSheet};
use crate::Weight;
// Context parameters.
pub const PARAM_BASE_ASSETS_WEIGHT: &str = "base.assets.weight";
pub const PARAM_BASE_WEIGHT: &str = "base.weight";
pub const PARAM_BASE_INCLUDE_ICONS: &str = "base.include.icon";
pub const PARAM_BASE_INCLUDE_FLEX_ASSETS: &str = "base.include.flex";
pub const PARAM_BASE_INCLUDE_MENU_ASSETS: &str = "base.include.menu";
pub(crate) fn add_assets_for_base(cx: &mut Context) {
let weight = cx.get_param::<Weight>(PARAM_BASE_ASSETS_WEIGHT).unwrap_or(-90);
pub(crate) fn add_base_assets(cx: &mut Context) {
let weight = cx.get_param::<Weight>(PARAM_BASE_WEIGHT).unwrap_or(-90);
cx.alter(ContextOp::AddStyleSheet(
StyleSheet::at("/base/css/root.css")
@ -80,35 +80,35 @@ impl ToString for BreakPoint {
}
mod html;
pub use html::{Html, COMPONENT_HTML};
pub use html::{Html, COMPONENT_BASE_HTML};
mod l10n;
pub use l10n::{L10n, COMPONENT_L10N};
pub use l10n::{L10n, COMPONENT_BASE_L10N};
mod wrapper;
pub use wrapper::{Wrapper, WrapperType, COMPONENT_WRAPPER};
pub use wrapper::{Wrapper, WrapperType, COMPONENT_BASE_WRAPPER};
pub mod flex;
mod icon;
pub use icon::{Icon, COMPONENT_ICON};
pub use icon::{Icon, COMPONENT_BASE_ICON};
mod heading;
pub use heading::{Heading, HeadingDisplay, HeadingType, COMPONENT_HEADING};
pub use heading::{Heading, HeadingDisplay, HeadingType, COMPONENT_BASE_HEADING};
mod paragraph;
pub use paragraph::{Paragraph, ParagraphDisplay, COMPONENT_PARAGRAPH};
pub use paragraph::{Paragraph, ParagraphDisplay, COMPONENT_BASE_PARAGRAPH};
mod anchor;
pub use anchor::{Anchor, AnchorTarget, AnchorType, COMPONENT_ANCHOR};
pub use anchor::{Anchor, AnchorTarget, AnchorType, COMPONENT_BASE_ANCHOR};
mod image;
pub use image::{Image, ImageSize, COMPONENT_IMAGE};
pub use image::{Image, ImageSize, COMPONENT_BASE_IMAGE};
mod block;
pub use block::{Block, COMPONENT_BLOCK};
mod site_branding;
pub use site_branding::{SiteBranding, COMPONENT_BRANDING};
pub use block::{Block, COMPONENT_BASE_BLOCK};
mod branding;
pub use branding::{Branding, COMPONENT_BASE_BRANDING};
mod powered_by;
pub use powered_by::{PoweredBy, PoweredByLogo, COMPONENT_POWEREDBY};
pub use powered_by::{PoweredBy, PoweredByLogo, COMPONENT_BASE_POWEREDBY};
pub mod menu;
pub use menu::{Menu, COMPONENT_MENU};
pub use menu::{Menu, COMPONENT_BASE_MENU};
pub mod form;
pub use form::{Form, FormMethod, COMPONENT_FORM};
pub use form::{Form, FormMethod, COMPONENT_BASE_FORM};

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_ANCHOR);
new_handle!(COMPONENT_BASE_ANCHOR);
#[derive(Default)]
pub enum AnchorType {
@ -45,7 +45,7 @@ impl ComponentTrait for Anchor {
}
fn handle(&self) -> Handle {
COMPONENT_ANCHOR
COMPONENT_BASE_ANCHOR
}
fn id(&self) -> Option<String> {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_BLOCK);
new_handle!(COMPONENT_BASE_BLOCK);
actions_for_component!(Block);
@ -24,7 +24,7 @@ impl ComponentTrait for Block {
}
fn handle(&self) -> Handle {
COMPONENT_BLOCK
COMPONENT_BASE_BLOCK
}
fn id(&self) -> Option<String> {

View file

@ -1,13 +1,13 @@
use crate::prelude::*;
use crate::LOCALES_PAGETOP;
new_handle!(COMPONENT_BRANDING);
new_handle!(COMPONENT_BASE_BRANDING);
type SiteSlogan = TypedComponent<L10n>;
type SiteLogo = TypedComponent<Image>;
#[rustfmt::skip]
pub struct SiteBranding {
pub struct Branding {
weight : Weight,
renderable: Renderable,
name : String,
@ -17,9 +17,9 @@ pub struct SiteBranding {
}
#[rustfmt::skip]
impl Default for SiteBranding {
impl Default for Branding {
fn default() -> Self {
SiteBranding {
Branding {
weight : Weight::default(),
renderable: Renderable::default(),
name : config::SETTINGS.app.name.to_owned(),
@ -30,17 +30,17 @@ impl Default for SiteBranding {
}
}
impl ComponentTrait for SiteBranding {
impl ComponentTrait for Branding {
fn new() -> Self {
SiteBranding::default()
Branding::default()
}
fn handle(&self) -> Handle {
COMPONENT_BRANDING
COMPONENT_BASE_BRANDING
}
fn id(&self) -> Option<String> {
Some("site-branding".to_owned())
Some("pt-branding".to_owned())
}
fn weight(&self) -> Weight {
@ -76,8 +76,8 @@ impl ComponentTrait for SiteBranding {
}
}
impl SiteBranding {
// SiteBranding BUILDER.
impl Branding {
// Branding BUILDER.
#[fn_builder]
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
@ -115,7 +115,7 @@ impl SiteBranding {
self
}
// SiteBranding GETTERS.
// Branding GETTERS.
pub fn name(&self) -> &String {
&self.name

View file

@ -1,7 +1,7 @@
mod container;
pub use container::{Container, COMPONENT_FLEX_CONTAINER};
pub use container::{Container, COMPONENT_BASE_FLEX_CONTAINER};
mod item;
pub use item::{Item, COMPONENT_FLEX_ITEM};
pub use item::{Item, COMPONENT_BASE_FLEX_ITEM};
use crate::prelude::*;

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_FLEX_CONTAINER);
new_handle!(COMPONENT_BASE_FLEX_CONTAINER);
actions_for_component!(Container);
@ -26,7 +26,7 @@ impl ComponentTrait for Container {
}
fn handle(&self) -> Handle {
COMPONENT_FLEX_CONTAINER
COMPONENT_BASE_FLEX_CONTAINER
}
fn id(&self) -> Option<String> {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_FLEX_ITEM);
new_handle!(COMPONENT_BASE_FLEX_ITEM);
actions_for_component!(Item);
@ -28,7 +28,7 @@ impl ComponentTrait for Item {
}
fn handle(&self) -> Handle {
COMPONENT_FLEX_ITEM
COMPONENT_BASE_FLEX_ITEM
}
fn id(&self) -> Option<String> {

View file

@ -1,11 +1,11 @@
mod form_main;
pub use form_main::{Form, FormMethod, COMPONENT_FORM};
pub use form_main::{Form, FormMethod, COMPONENT_BASE_FORM};
mod input;
pub use input::{Input, InputType, COMPONENT_INPUT};
pub use input::{Input, InputType, COMPONENT_BASE_INPUT};
mod hidden;
pub use hidden::{Hidden, COMPONENT_HIDDEN};
pub use hidden::{Hidden, COMPONENT_BASE_HIDDEN};
mod date;
pub use date::{Date, COMPONENT_DATE};
pub use date::{Date, COMPONENT_BASE_DATE};
mod button;
pub use button::{Button, ButtonType, COMPONENT_BUTTON};
pub use button::{Button, ButtonType, COMPONENT_BASE_BUTTON};

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_BUTTON);
new_handle!(COMPONENT_BASE_BUTTON);
#[derive(Default)]
pub enum ButtonType {
@ -32,7 +32,7 @@ impl ComponentTrait for Button {
}
fn handle(&self) -> Handle {
COMPONENT_BUTTON
COMPONENT_BASE_BUTTON
}
fn weight(&self) -> Weight {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_DATE);
new_handle!(COMPONENT_BASE_DATE);
#[rustfmt::skip]
#[derive(Default)]
@ -27,7 +27,7 @@ impl ComponentTrait for Date {
}
fn handle(&self) -> Handle {
COMPONENT_DATE
COMPONENT_BASE_DATE
}
fn weight(&self) -> Weight {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_FORM);
new_handle!(COMPONENT_BASE_FORM);
actions_for_component!(Form);
@ -33,7 +33,7 @@ impl ComponentTrait for Form {
}
fn handle(&self) -> Handle {
COMPONENT_FORM
COMPONENT_BASE_FORM
}
fn id(&self) -> Option<String> {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_HIDDEN);
new_handle!(COMPONENT_BASE_HIDDEN);
#[rustfmt::skip]
#[derive(Default)]
@ -16,7 +16,7 @@ impl ComponentTrait for Hidden {
}
fn handle(&self) -> Handle {
COMPONENT_HIDDEN
COMPONENT_BASE_HIDDEN
}
fn weight(&self) -> Weight {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_INPUT);
new_handle!(COMPONENT_BASE_INPUT);
#[derive(Default)]
pub enum InputType {
@ -48,7 +48,7 @@ impl ComponentTrait for Input {
}
fn handle(&self) -> Handle {
COMPONENT_INPUT
COMPONENT_BASE_INPUT
}
fn weight(&self) -> Weight {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_HEADING);
new_handle!(COMPONENT_BASE_HEADING);
#[derive(Default)]
pub enum HeadingType {
@ -46,7 +46,7 @@ impl ComponentTrait for Heading {
}
fn handle(&self) -> Handle {
COMPONENT_HEADING
COMPONENT_BASE_HEADING
}
fn id(&self) -> Option<String> {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_HTML);
new_handle!(COMPONENT_BASE_HTML);
#[derive(Default)]
pub struct Html(Markup);
@ -11,7 +11,7 @@ impl ComponentTrait for Html {
}
fn handle(&self) -> Handle {
COMPONENT_HTML
COMPONENT_BASE_HTML
}
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_ICON);
new_handle!(COMPONENT_BASE_ICON);
#[rustfmt::skip]
#[derive(Default)]
@ -17,7 +17,7 @@ impl ComponentTrait for Icon {
}
fn handle(&self) -> Handle {
COMPONENT_ICON
COMPONENT_BASE_ICON
}
fn weight(&self) -> Weight {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_IMAGE);
new_handle!(COMPONENT_BASE_IMAGE);
const IMG_FLUID: &str = "pt-img__fluid";
const IMG_FIXED: &str = "pt-img__fixed";
@ -32,7 +32,7 @@ impl ComponentTrait for Image {
}
fn handle(&self) -> Handle {
COMPONENT_IMAGE
COMPONENT_BASE_IMAGE
}
fn id(&self) -> Option<String> {

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use std::collections::HashMap;
new_handle!(COMPONENT_L10N);
new_handle!(COMPONENT_BASE_L10N);
#[derive(Default)]
pub enum L10nOp {
@ -25,7 +25,7 @@ impl ComponentTrait for L10n {
}
fn handle(&self) -> Handle {
COMPONENT_L10N
COMPONENT_BASE_L10N
}
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {

View file

@ -1,17 +1,17 @@
mod menu_main;
pub use menu_main::{Menu, COMPONENT_MENU};
pub use menu_main::{Menu, COMPONENT_BASE_MENU};
mod item;
pub use item::{Item, ItemType, COMPONENT_MENU_ITEM};
pub use item::{Item, ItemType, COMPONENT_BASE_MENU_ITEM};
mod submenu;
pub use submenu::{Submenu, COMPONENT_MENU_SUBMENU};
pub use submenu::{Submenu, COMPONENT_BASE_MENU_SUBMENU};
mod megamenu;
pub use megamenu::{Megamenu, COMPONENT_MENU_MEGAMENU};
pub use megamenu::{Megamenu, COMPONENT_BASE_MENU_MEGAMENU};
mod group;
pub use group::{Group, COMPONENT_MENU_GROUP};
pub use group::{Group, COMPONENT_BASE_MENU_GROUP};
mod element;
pub use element::{Element, ElementType, COMPONENT_MENU_ELEMENT};
pub use element::{Element, ElementType, COMPONENT_BASE_MENU_ELEMENT};

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use super::Submenu;
new_handle!(COMPONENT_MENU_ELEMENT);
new_handle!(COMPONENT_BASE_MENU_ELEMENT);
type Content = TypedComponent<Html>;
type SubmenuItems = TypedComponent<Submenu>;
@ -31,7 +31,7 @@ impl ComponentTrait for Element {
}
fn handle(&self) -> Handle {
COMPONENT_MENU_ELEMENT
COMPONENT_BASE_MENU_ELEMENT
}
fn weight(&self) -> Weight {

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use super::Element;
new_handle!(COMPONENT_MENU_GROUP);
new_handle!(COMPONENT_BASE_MENU_GROUP);
type Elements = TypedComponents<Element>;
@ -21,7 +21,7 @@ impl ComponentTrait for Group {
}
fn handle(&self) -> Handle {
COMPONENT_MENU_GROUP
COMPONENT_BASE_MENU_GROUP
}
fn id(&self) -> Option<String> {

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use super::{Megamenu, Submenu};
new_handle!(COMPONENT_MENU_ITEM);
new_handle!(COMPONENT_BASE_MENU_ITEM);
type Label = TypedComponent<L10n>;
type Content = TypedComponent<Html>;
@ -39,7 +39,7 @@ impl ComponentTrait for Item {
}
fn handle(&self) -> Handle {
COMPONENT_MENU_ITEM
COMPONENT_BASE_MENU_ITEM
}
fn weight(&self) -> Weight {

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use super::Group;
new_handle!(COMPONENT_MENU_MEGAMENU);
new_handle!(COMPONENT_BASE_MENU_MEGAMENU);
type Groups = TypedComponents<Group>;
@ -21,7 +21,7 @@ impl ComponentTrait for Megamenu {
}
fn handle(&self) -> Handle {
COMPONENT_MENU_MEGAMENU
COMPONENT_BASE_MENU_MEGAMENU
}
fn id(&self) -> Option<String> {

View file

@ -3,7 +3,7 @@ use crate::LOCALES_PAGETOP;
use super::Item;
new_handle!(COMPONENT_MENU);
new_handle!(COMPONENT_BASE_MENU);
actions_for_component!(Menu);
@ -22,7 +22,7 @@ impl ComponentTrait for Menu {
}
fn handle(&self) -> Handle {
COMPONENT_MENU
COMPONENT_BASE_MENU
}
fn id(&self) -> Option<String> {

View file

@ -2,7 +2,7 @@ use crate::prelude::*;
use super::Item;
new_handle!(COMPONENT_MENU_SUBMENU);
new_handle!(COMPONENT_BASE_MENU_SUBMENU);
type TitleSubmenu = TypedComponent<L10n>;
type Items = TypedComponents<Item>;
@ -23,7 +23,7 @@ impl ComponentTrait for Submenu {
}
fn handle(&self) -> Handle {
COMPONENT_MENU_SUBMENU
COMPONENT_BASE_MENU_SUBMENU
}
fn id(&self) -> Option<String> {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_PARAGRAPH);
new_handle!(COMPONENT_BASE_PARAGRAPH);
#[derive(Default)]
pub enum ParagraphDisplay {
@ -31,7 +31,7 @@ impl ComponentTrait for Paragraph {
}
fn handle(&self) -> Handle {
COMPONENT_PARAGRAPH
COMPONENT_BASE_PARAGRAPH
}
fn id(&self) -> Option<String> {

View file

@ -1,7 +1,7 @@
use crate::prelude::*;
use crate::LOCALES_PAGETOP;
new_handle!(COMPONENT_POWEREDBY);
new_handle!(COMPONENT_BASE_POWEREDBY);
#[derive(Default, Eq, PartialEq)]
pub enum PoweredByLogo {
@ -33,7 +33,7 @@ impl ComponentTrait for PoweredBy {
}
fn handle(&self) -> Handle {
COMPONENT_POWEREDBY
COMPONENT_BASE_POWEREDBY
}
fn id(&self) -> Option<String> {

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
new_handle!(COMPONENT_WRAPPER);
new_handle!(COMPONENT_BASE_WRAPPER);
actions_for_component!(Wrapper);
@ -35,7 +35,7 @@ impl ComponentTrait for Wrapper {
}
fn handle(&self) -> Handle {
COMPONENT_WRAPPER
COMPONENT_BASE_WRAPPER
}
fn id(&self) -> Option<String> {