Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: revert Yew legacy for compatibility #74

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ gloo-utils = "0.2"
leptos = { version = "0.6", features = ["csr"] }
leptos-use = "0.10"
rand = { version = "0.8", default-features = false, features = ["getrandom"] }
yew = { version = "0.21", features = ["csr"], optional = true }
wasm-bindgen = "0.2.92"

[dependencies.web-sys]
Expand Down Expand Up @@ -61,3 +62,8 @@ crate-type = ["cdylib"]
[[example]]
name = "text"
crate-type = ["cdylib"]

[features]
legacy = [
"yew",
]
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: all clean doc doc-open examples examples-release fmt fmt-check fmt-leptos linter prepare pre-commit serve test
.PHONY: all clean doc doc-open examples examples-release fmt fmt-check fmt-leptos legacy linter prepare pre-commit serve test

all:
@echo ──────────── Build release ────────────────────
@cargo build --release
@cargo b -r

clean:
@echo ──────────── Clean ────────────────────────────
Expand Down Expand Up @@ -36,6 +36,10 @@ fmt-check:
@echo ──────────── Check format ─────────────────────
@cargo fmt --all -- --check

legacy:
@echo ──────────── Build legacy release ─────────────
@cargo b -rF legacy

linter:
@echo ──────────── Run linter ───────────────────────
@cargo clippy --all-targets -- --no-deps -D warnings -A clippy::derive_partial_eq_without_eq
Expand All @@ -52,4 +56,4 @@ serve: examples

test: all
@echo ──────────── Run tests ────────────────────────
@cargo test --release
@cargo t -r
3 changes: 3 additions & 0 deletions src/legacy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod properties;
pub mod utils;
pub mod widgets;
7 changes: 7 additions & 0 deletions src/legacy/properties.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//! Components properties.

mod align;
mod color;

pub use align::{Align, VAlign};
pub use color::Color;
27 changes: 27 additions & 0 deletions src/legacy/properties/align.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// Horizontal align.
#[derive(Clone, Default, PartialEq)]
pub enum Align {
/// Left horizontal align.
Left,
/// Center horizontal align.
#[default]
Center,
/// Right horizontal align.
Right,
/// Fill all horizontal space.
Fill,
}

/// Vertical align.
#[derive(Clone, Default, PartialEq)]
pub enum VAlign {
/// Top vertical align.
Top,
/// Middle vertical align.
#[default]
Middle,
/// Bottom vertical align.
Bottom,
/// Fill all vertical space.
Fill,
}
310 changes: 310 additions & 0 deletions src/legacy/properties/color.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,310 @@
use derive_more::Display;

// TODO: Define all colors

/// Helper type to work with colors.
#[derive(Clone, Copy, Default, Display, PartialEq)]
pub enum Color {
/// No color.
#[default]
None,
/// Arbitrary color with the string value.
#[display(fmt = "{_0}")]
Value(&'static str),

/// Alice Blue color.
AliceBlue,
/// Antique White color.
AntiqueWhite,
///
Aqua,
///
Aquamarine,
///
Azure,
///
Aeige,
///
Bisque,
///
Black,
///
BlanchedAlmond,
///
Blue,
///
BlueViolet,
///
Brown,
///
BurlyWood,
///
CadetBlue,
///
Chartreuse,
///
Chocolate,
///
Coral,
///
CornflowerBlue,
///
Cornsilk,
///
Crimson,
///
Cyan,
///
DarkBlue,
///
DarkCyan,
///
DarkGoldenrod,
///
DarkGray,
///
DarkGreen,
///
DarkGrey,
///
DarkKhaki,
///
DarkMagenta,
///
DarkOliveGreen,
///
DarkOrange,
///
DarkOrchid,
///
DarkRed,
///
DarkSalmon,
///
DarkSeaGreen,
///
DarkSlateBlue,
///
DarkSlateGray,
///
DarkSlateGrey,
///
///
DarkTurquoise,
///
DarkViolet,
///
DeepPink,
///
DeepSkyBlue,
///
DimGray,
///
DimGrey,
///
DodgerBlue,
///
Firebrick,
///
FloralWhite,
///
ForestGreen,
///
Fuchsia,
///
Gainsboro,
///
GhostWhite,
///
Gold,
///
Goldenrod,
///
Gray,
///
Green,
///
GreenYellow,
///
Grey,
///
Honeydew,
///
HotPink,
///
IndianRed,
///
Indigo,
///
Ivory,
///
Khaki,
///
Lavender,
///
LavenderBlush,
///
LawnGreen,
///
Lemonchiffon,
///
LightBlue,
///
LightCoral,
///
LightCyan,
///
LightGoldenrodYellow,
///
LightGray,
///
LightGreen,
///
LightGrey,
///
LightPink,
///
LightSalmon,
///
LightSeaGreen,
///
LightSkyBlue,
///
LightSlateGray,
///
LightSlateGrey,
///
LightsteelBlue,
///
LightYellow,
///
Lime,
///
LimeGreen,
///
Linen,
///
Magenta,
///
Maroon,
///
MediumAquamarine,
///
MediumBlue,
///
MediumOrchid,
///
MediumPurple,
///
MediumSeaGreen,
///
MediumSlateBlue,
///
MediumSpringGreen,
///
MediumTurquoise,
///
MediumVioletRed,
///
MidnightBlue,
///
MintCream,
///
MistyRose,
///
Moccasin,
///
NavajoWhite,
///
Navy,
///
Oldlace,
///
Olive,
///
Olivedrab,
///
Orange,
///
OrangeRed,
///
Orchid,
///
PaleGoldenrod,
///
PaleGreen,
///
PaleTurquoise,
///
PaleVioletRed,
///
Papayawhip,
///
Peachpuff,
///
Peru,
///
Pink,
///
Plum,
///
PowderBlue,
///
Purple,
///
Red,
///
RosyBrown,
///
RoyalBlue,
///
SaddleBrown,
///
Salmon,
///
SandyBrown,
///
SeaGreen,
///
Seashell,
///
Sienna,
///
Silver,
///
SkyBlue,
///
SlateBlue,
///
SlateGray,
///
SlateGrey,
///
Snow,
///
SpringGreen,
///
SteelBlue,
///
Tan,
///
Teal,
///
Thistle,
///
Tomato,
///
Turquoise,
///
Violet,
///
Wheat,
///
White,
///
WhiteSmoke,
///
Yellow,
/// Yellow Green color
YellowGreen,
}
Loading
Loading