💥 OneComponents are now TypedComponents

This commit is contained in:
Manuel Cillero 2023-08-19 11:37:01 +02:00
parent 66117992c1
commit f2031307d7
23 changed files with 301 additions and 313 deletions

View file

@ -22,8 +22,8 @@ pub enum AnchorTarget {
Context(String),
}
type AnchorIcon = ComponentOne<Icon>;
type AnchorHtml = ComponentOne<L10n>;
type AnchorIcon = TypedComponent<Icon>;
type AnchorHtml = TypedComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]

View file

@ -12,7 +12,7 @@ pub struct Block {
id : IdentifierValue,
classes : Classes,
title : AttributeValue,
stuff : MixComponents,
stuff : ArcComponents,
template : String,
}
@ -94,12 +94,12 @@ impl Block {
}
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.stuff.alter(MixOp::Add(ComponentArc::with(component)));
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
self
}
#[fn_builder]
pub fn alter_components(&mut self, op: MixOp) -> &mut Self {
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
self.stuff.alter(op);
self
}
@ -120,7 +120,7 @@ impl Block {
&self.title
}
pub fn components(&self) -> &MixComponents {
pub fn components(&self) -> &ArcComponents {
&self.stuff
}

View file

@ -23,7 +23,7 @@ pub struct Container {
classes : Classes,
inner_classes : Classes,
container_type: ContainerType,
stuff : MixComponents,
stuff : ArcComponents,
template : String,
}
@ -155,12 +155,12 @@ impl Container {
}
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.stuff.alter(MixOp::Add(ComponentArc::with(component)));
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
self
}
#[fn_builder]
pub fn alter_components(&mut self, op: MixOp) -> &mut Self {
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
self.stuff.alter(op);
self
}
@ -185,7 +185,7 @@ impl Container {
&self.container_type
}
pub fn components(&self) -> &MixComponents {
pub fn components(&self) -> &ArcComponents {
&self.stuff
}

View file

@ -13,7 +13,7 @@ pub struct Container {
renderable: Renderable,
id : IdentifierValue,
classes : Classes,
items : LisComponents<flex::Item>,
items : TypedComponents<flex::Item>,
template : String,
}
@ -83,12 +83,12 @@ impl Container {
}
pub fn with_item(mut self, item: flex::Item) -> Self {
self.items.alter(LisOp::Add(ComponentOne::with(item)));
self.items.alter(TypedOp::Add(TypedComponent::with(item)));
self
}
#[fn_builder]
pub fn alter_items(&mut self, op: LisOp<flex::Item>) -> &mut Self {
pub fn alter_items(&mut self, op: TypedOp<flex::Item>) -> &mut Self {
self.items.alter(op);
self
}
@ -105,7 +105,7 @@ impl Container {
&self.classes
}
pub fn items(&self) -> &LisComponents<flex::Item> {
pub fn items(&self) -> &TypedComponents<flex::Item> {
&self.items
}

View file

@ -44,7 +44,7 @@ pub struct Item {
id : IdentifierValue,
classes : Classes,
size : ItemSize,
stuff : MixComponents,
stuff : ArcComponents,
template : String,
}
@ -136,12 +136,12 @@ impl Item {
}
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.stuff.alter(MixOp::Add(ComponentArc::with(component)));
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
self
}
#[fn_builder]
pub fn alter_components(&mut self, op: MixOp) -> &mut Self {
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
self.stuff.alter(op);
self
}
@ -162,7 +162,7 @@ impl Item {
&self.size
}
pub fn components(&self) -> &MixComponents {
pub fn components(&self) -> &ArcComponents {
&self.stuff
}

View file

@ -10,7 +10,7 @@ pub enum ButtonType {
Reset,
}
type ButtonValue = ComponentOne<L10n>;
type ButtonValue = TypedComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]

View file

@ -21,7 +21,7 @@ pub struct Form {
action : AttributeValue,
charset : AttributeValue,
method : FormMethod,
stuff : MixComponents,
stuff : ArcComponents,
template : String,
}
@ -121,12 +121,12 @@ impl Form {
}
pub fn with_element(mut self, element: impl ComponentTrait) -> Self {
self.stuff.alter(MixOp::Add(ComponentArc::with(element)));
self.stuff.alter(ArcOp::Add(ArcComponent::with(element)));
self
}
#[fn_builder]
pub fn alter_elements(&mut self, op: MixOp) -> &mut Self {
pub fn alter_elements(&mut self, op: ArcOp) -> &mut Self {
self.stuff.alter(op);
self
}
@ -155,7 +155,7 @@ impl Form {
&self.method
}
pub fn elements(&self) -> &MixComponents {
pub fn elements(&self) -> &ArcComponents {
&self.stuff
}

View file

@ -13,8 +13,8 @@ pub enum InputType {
Url,
}
type InputLabel = ComponentOne<L10n>;
type InputHelpText = ComponentOne<L10n>;
type InputLabel = TypedComponent<L10n>;
type InputHelpText = TypedComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]

View file

@ -44,7 +44,7 @@ pub struct Column {
id : IdentifierValue,
classes : Classes,
size : ColumnSize,
stuff : MixComponents,
stuff : ArcComponents,
template : String,
}
@ -136,12 +136,12 @@ impl Column {
}
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.stuff.alter(MixOp::Add(ComponentArc::with(component)));
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
self
}
#[fn_builder]
pub fn alter_components(&mut self, op: MixOp) -> &mut Self {
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
self.stuff.alter(op);
self
}
@ -162,7 +162,7 @@ impl Column {
&self.size
}
pub fn components(&self) -> &MixComponents {
pub fn components(&self) -> &ArcComponents {
&self.stuff
}

View file

@ -13,7 +13,7 @@ pub struct Row {
renderable: Renderable,
id : IdentifierValue,
classes : Classes,
columns : LisComponents<grid::Column>,
cols : TypedComponents<grid::Column>,
template : String,
}
@ -83,13 +83,13 @@ impl Row {
}
pub fn with_column(mut self, column: grid::Column) -> Self {
self.columns.alter(LisOp::Add(ComponentOne::with(column)));
self.cols.alter(TypedOp::Add(TypedComponent::with(column)));
self
}
#[fn_builder]
pub fn alter_columns(&mut self, op: LisOp<grid::Column>) -> &mut Self {
self.columns.alter(op);
pub fn alter_columns(&mut self, op: TypedOp<grid::Column>) -> &mut Self {
self.cols.alter(op);
self
}
@ -105,8 +105,8 @@ impl Row {
&self.classes
}
pub fn columns(&self) -> &LisComponents<grid::Column> {
&self.columns
pub fn columns(&self) -> &TypedComponents<grid::Column> {
&self.cols
}
pub fn template(&self) -> &str {

View file

@ -25,7 +25,7 @@ pub enum HeadingDisplay {
Subtitle,
}
type HeadingText = ComponentOne<L10n>;
type HeadingText = TypedComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]

View file

@ -20,7 +20,7 @@ pub struct Paragraph {
renderable: Renderable,
id : IdentifierValue,
classes : Classes,
stuff : MixComponents,
stuff : ArcComponents,
display : ParagraphDisplay,
template : String,
}
@ -90,12 +90,12 @@ impl Paragraph {
}
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.stuff.alter(MixOp::Add(ComponentArc::with(component)));
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
self
}
#[fn_builder]
pub fn alter_components(&mut self, op: MixOp) -> &mut Self {
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
self.stuff.alter(op);
self
}
@ -130,7 +130,7 @@ impl Paragraph {
&self.classes
}
pub fn components(&self) -> &MixComponents {
pub fn components(&self) -> &ArcComponents {
&self.stuff
}

View file

@ -6,8 +6,8 @@ use crate::LOCALES_MINIMAL;
new_handle!(COMPONENT_BRANDING);
type SiteSlogan = ComponentOne<L10n>;
type SiteLogo = ComponentOne<Image>;
type SiteSlogan = TypedComponent<L10n>;
type SiteLogo = TypedComponent<Image>;
#[rustfmt::skip]
pub struct SiteBranding {