➖ Integrate "SmartDefault" as "AutoDefault" macro
This commit is contained in:
parent
cb38145bf5
commit
9e4f593dbd
51 changed files with 387 additions and 103 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use crate::core::component::{Context, ContextOp};
|
||||
use crate::html::{JavaScript, StyleSheet};
|
||||
use crate::{SmartDefault, Weight};
|
||||
use crate::{AutoDefault, Weight};
|
||||
|
||||
// Context parameters.
|
||||
pub const PARAM_BASE_WEIGHT: &str = "base.weight";
|
||||
|
|
@ -57,7 +57,7 @@ pub(crate) fn add_base_assets(cx: &mut Context) {
|
|||
// *************************************************************************************************
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum BreakPoint {
|
||||
#[default]
|
||||
None, /* Does not apply. Rest initially assume 1 pixel = 0.0625em */
|
||||
|
|
@ -88,7 +88,7 @@ impl ToString for BreakPoint {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ButtonStyle {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -119,7 +119,7 @@ impl ToString for ButtonStyle {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum FontSize {
|
||||
ExtraLarge,
|
||||
XxLarge,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Block {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Branding {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ButtonTarget {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -11,7 +11,7 @@ pub enum ButtonTarget {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Button {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use crate::prelude::*;
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum Direction {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -42,7 +42,7 @@ impl ToString for Direction {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum WrapAlign {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -65,7 +65,7 @@ impl ToString for WrapAlign {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ContentAlign {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -94,7 +94,7 @@ impl ToString for ContentAlign {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ContentJustify {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -123,7 +123,7 @@ impl ToString for ContentJustify {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemAlign {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -150,7 +150,7 @@ impl ToString for ItemAlign {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum Gap {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -175,7 +175,7 @@ impl ToString for Gap {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemGrow {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -210,7 +210,7 @@ impl ToString for ItemGrow {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemShrink {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -245,7 +245,7 @@ impl ToString for ItemShrink {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemSize {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
@ -284,7 +284,7 @@ impl ToString for ItemSize {
|
|||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemOffset {
|
||||
#[default]
|
||||
Default,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Container {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Item {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ActionButtonType {
|
||||
#[default]
|
||||
Submit,
|
||||
|
|
@ -18,7 +18,7 @@ impl ToString for ActionButtonType {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct ActionButton {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Date {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum FormMethod {
|
||||
#[default]
|
||||
Post,
|
||||
|
|
@ -8,7 +8,7 @@ pub enum FormMethod {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Form {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Hidden {
|
||||
weight: Weight,
|
||||
name : OptionName,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum InputType {
|
||||
#[default]
|
||||
Textfield,
|
||||
|
|
@ -12,7 +12,7 @@ pub enum InputType {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Input {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum HeadingType {
|
||||
#[default]
|
||||
H1,
|
||||
|
|
@ -11,7 +11,7 @@ pub enum HeadingType {
|
|||
H6,
|
||||
}
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum HeadingSize {
|
||||
ExtraLarge,
|
||||
XxLarge,
|
||||
|
|
@ -39,7 +39,7 @@ impl ToString for HeadingSize {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Heading {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Html(Markup);
|
||||
|
||||
impl ComponentTrait for Html {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Icon {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::prelude::*;
|
|||
const IMG_FLUID: &str = "pt-img__fluid";
|
||||
const IMG_FIXED: &str = "pt-img__fixed";
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ImageSize {
|
||||
#[default]
|
||||
Auto,
|
||||
|
|
@ -14,7 +14,7 @@ pub enum ImageSize {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Image {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use super::Submenu;
|
|||
type Content = ArcTypedComponent<Html>;
|
||||
type SubmenuItems = ArcTypedComponent<Submenu>;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ElementType {
|
||||
#[default]
|
||||
Void,
|
||||
|
|
@ -16,7 +16,7 @@ pub enum ElementType {
|
|||
// Element.
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Element {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::prelude::*;
|
|||
use super::Element;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Group {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ type Content = ArcTypedComponent<Html>;
|
|||
type SubmenuItems = ArcTypedComponent<Submenu>;
|
||||
type MegamenuGroups = ArcTypedComponent<Megamenu>;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemType {
|
||||
#[default]
|
||||
Void,
|
||||
|
|
@ -22,7 +22,7 @@ pub enum ItemType {
|
|||
// Item.
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Item {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::prelude::*;
|
|||
use super::Group;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Megamenu {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::prelude::*;
|
|||
use super::Item;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Menu {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::prelude::*;
|
|||
use super::Item;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Submenu {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Paragraph {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub enum PoweredByLogo {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct PoweredBy {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Translate(L10n);
|
||||
|
||||
impl ComponentTrait for Translate {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum WrapperType {
|
||||
#[default]
|
||||
Container,
|
||||
|
|
@ -11,7 +11,7 @@ pub enum WrapperType {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(ComponentClasses, SmartDefault)]
|
||||
#[derive(AutoDefault, ComponentClasses)]
|
||||
pub struct Wrapper {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue