➖ 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,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use crate::core::action::ActionTrait;
|
||||
use crate::SmartDefault;
|
||||
use crate::AutoDefault;
|
||||
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
pub type Action = Box<dyn ActionTrait>;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct ActionsList(Arc<RwLock<Vec<Action>>>);
|
||||
|
||||
impl ActionsList {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::core::component::Context;
|
||||
use crate::SmartDefault;
|
||||
use crate::AutoDefault;
|
||||
|
||||
pub type FnIsRenderable = fn(cx: &Context) -> bool;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Renderable {
|
||||
#[default(_code = "render_always")]
|
||||
pub check: FnIsRenderable,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::core::component::{AnyComponents, ArcAnyComponent, ArcAnyOp};
|
||||
use crate::core::theme::ThemeRef;
|
||||
use crate::{LazyStatic, SmartDefault, TypeId};
|
||||
use crate::{AutoDefault, LazyStatic, TypeId};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::RwLock;
|
||||
|
|
@ -11,7 +11,7 @@ static THEME_REGIONS: LazyStatic<RwLock<HashMap<TypeId, ComponentsInRegions>>> =
|
|||
static COMMON_REGIONS: LazyStatic<RwLock<ComponentsInRegions>> =
|
||||
LazyStatic::new(|| RwLock::new(ComponentsInRegions::default()));
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct ComponentsInRegions(HashMap<&'static str, AnyComponents>);
|
||||
|
||||
impl ComponentsInRegions {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ pub mod javascript;
|
|||
pub mod stylesheet;
|
||||
|
||||
use crate::html::{html, Markup};
|
||||
use crate::{SmartDefault, Weight};
|
||||
use crate::{AutoDefault, Weight};
|
||||
|
||||
pub trait AssetsTrait {
|
||||
fn path(&self) -> &str;
|
||||
|
|
@ -14,7 +14,7 @@ pub trait AssetsTrait {
|
|||
fn prepare(&self) -> Markup;
|
||||
}
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Assets<T>(Vec<T>);
|
||||
|
||||
impl<T: AssetsTrait> Assets<T> {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::html::assets::AssetsTrait;
|
||||
use crate::html::{html, Markup};
|
||||
use crate::{SmartDefault, Weight};
|
||||
use crate::{AutoDefault, Weight};
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct HeadScript {
|
||||
path : String,
|
||||
code : String,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::html::assets::AssetsTrait;
|
||||
use crate::html::{html, Markup};
|
||||
use crate::{SmartDefault, Weight};
|
||||
use crate::{AutoDefault, Weight};
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct HeadStyles {
|
||||
path : String,
|
||||
styles: String,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::html::assets::AssetsTrait;
|
||||
use crate::html::{html, Markup};
|
||||
use crate::{SmartDefault, Weight};
|
||||
use crate::{AutoDefault, Weight};
|
||||
|
||||
#[derive(Default, Eq, PartialEq)]
|
||||
pub enum ModeJS {
|
||||
|
|
@ -11,7 +11,7 @@ pub enum ModeJS {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct JavaScript {
|
||||
path : String,
|
||||
prefix : &'static str,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::html::assets::AssetsTrait;
|
||||
use crate::html::{html, Markup};
|
||||
use crate::{SmartDefault, Weight};
|
||||
use crate::{AutoDefault, Weight};
|
||||
|
||||
pub enum TargetMedia {
|
||||
Default,
|
||||
|
|
@ -10,7 +10,7 @@ pub enum TargetMedia {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct StyleSheet {
|
||||
path : String,
|
||||
prefix : &'static str,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::html::{html, Markup};
|
||||
use crate::SmartDefault;
|
||||
use crate::AutoDefault;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct Favicon(Vec<Markup>);
|
||||
|
||||
impl Favicon {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
//! **OptionClasses** assumes that the order of the classes is irrelevant
|
||||
//! (<https://stackoverflow.com/a/1321712>), and duplicate classes will not be allowed.
|
||||
|
||||
use crate::{fn_with, SmartDefault};
|
||||
use crate::{fn_with, AutoDefault};
|
||||
|
||||
pub enum ClassesOp {
|
||||
Add,
|
||||
|
|
@ -20,7 +20,7 @@ pub enum ClassesOp {
|
|||
Set,
|
||||
}
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct OptionClasses(Vec<String>);
|
||||
|
||||
impl OptionClasses {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{fn_with, SmartDefault};
|
||||
use crate::{fn_with, AutoDefault};
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct OptionId(Option<String>);
|
||||
|
||||
impl OptionId {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{fn_with, SmartDefault};
|
||||
use crate::{fn_with, AutoDefault};
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct OptionName(Option<String>);
|
||||
|
||||
impl OptionName {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{fn_with, SmartDefault};
|
||||
use crate::{fn_with, AutoDefault};
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct OptionString(Option<String>);
|
||||
|
||||
impl OptionString {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::html::Markup;
|
||||
use crate::locale::{L10n, LanguageIdentifier};
|
||||
use crate::{fn_with, SmartDefault};
|
||||
use crate::{fn_with, AutoDefault};
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct OptionTranslated(L10n);
|
||||
|
||||
impl OptionTranslated {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{concat_string, SmartDefault};
|
||||
use crate::{concat_string, AutoDefault};
|
||||
|
||||
// About pixels: Pixels (px) are relative to the viewing device. For low-dpi devices, 1px is one
|
||||
// device pixel (dot) of the display. For printers and high resolution screens 1px implies multiple
|
||||
|
|
@ -10,7 +10,7 @@ use crate::{concat_string, SmartDefault};
|
|||
// About viewport: If the browser window size is 50cm wide, 1vw = 0.5cm.
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub enum Value {
|
||||
#[default]
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -81,10 +81,7 @@ pub use concat_string::concat_string;
|
|||
/// Enables flexible identifier concatenation in macros, allowing new items with pasted identifiers.
|
||||
pub use paste::paste;
|
||||
|
||||
/// Custom derive for automatically implementing the [Default] trait with customized default values.
|
||||
pub use smart_default::SmartDefault;
|
||||
|
||||
pub use pagetop_macros::{fn_with, main, test, ComponentClasses};
|
||||
pub use pagetop_macros::{fn_with, main, test, AutoDefault, ComponentClasses};
|
||||
|
||||
// *************************************************************************************************
|
||||
// GLOBAL.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
//! ```
|
||||
|
||||
use crate::html::{Markup, PreEscaped};
|
||||
use crate::{config, kv, LazyStatic, SmartDefault, LOCALES_PAGETOP};
|
||||
use crate::{config, kv, AutoDefault, LazyStatic, LOCALES_PAGETOP};
|
||||
|
||||
pub use fluent_templates;
|
||||
pub use unic_langid::LanguageIdentifier;
|
||||
|
|
@ -164,7 +164,7 @@ macro_rules! static_locales {
|
|||
};
|
||||
}
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
enum L10nOp {
|
||||
#[default]
|
||||
None,
|
||||
|
|
@ -172,7 +172,7 @@ enum L10nOp {
|
|||
Translate(String),
|
||||
}
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(AutoDefault)]
|
||||
pub struct L10n {
|
||||
op: L10nOp,
|
||||
locales: Option<&'static Locales>,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
//! The PageTop Prelude.
|
||||
|
||||
// Re-exported macros and derives.
|
||||
pub use crate::{concat_string, fn_with, html, main, paste, test, SmartDefault};
|
||||
pub use crate::{concat_string, fn_with, html, main, paste, test, AutoDefault, ComponentClasses};
|
||||
|
||||
// Global.
|
||||
pub use crate::{HashMapResources, LazyStatic, TypeId, Weight};
|
||||
|
||||
// Functions and macro helpers.
|
||||
pub use crate::util;
|
||||
pub use crate::{kv, ComponentClasses};
|
||||
|
||||
// MACROS.
|
||||
|
||||
|
|
@ -20,6 +19,8 @@ pub use crate::static_locales;
|
|||
pub use crate::{service_for_static_files, static_files};
|
||||
// crate::core::actions
|
||||
pub use crate::actions;
|
||||
// crate::util
|
||||
pub use crate::kv;
|
||||
|
||||
// API.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue