Skip to content
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
.idea
.idea
dist
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ members = [

[workspace.dependencies]
case = "1.0"
cssparser = "0.34"
const_format = "0.2"
cssparser = "0.34"
dominator = "0.5"
futures = "0.3"
futures-signals = "0.3"
futures-signals-component-macro = { version = "0.4.0", features = [
"dominator",
] }
gloo-timers = { version = "0.3.0", features = ["futures"]}
log = "0.4"
matchit = "0.8"
nom = "7.1"
Expand Down
12 changes: 6 additions & 6 deletions crates/dominator-css-bindgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ license = "MIT"
keywords = ["web", "wasm", "css", "style"]

[dependencies]
case.workspace = true
cssparser.workspace = true
nom.workspace = true
proc-macro2.workspace = true
quote.workspace = true
thiserror.workspace = true
case = { workspace = true}
cssparser = { workspace = true}
nom = { workspace = true}
proc-macro2 = { workspace = true}
quote = { workspace = true}
thiserror = { workspace = true}
4 changes: 2 additions & 2 deletions crates/dwind-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ license = "MIT"
keywords = ["web", "wasm", "css", "style"]

[dependencies]
dominator.workspace = true
futures-signals.workspace = true
dominator = { workspace = true}
futures-signals = { workspace = true}
5 changes: 2 additions & 3 deletions crates/dwind-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ license = "MIT"
keywords = ["web", "wasm", "css", "style"]

[dependencies]

serde.workspace = true
serde_json.workspace = true
serde = { workspace = true}
serde_json = { workspace = true}
20 changes: 10 additions & 10 deletions crates/dwind-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dwind-macros"
version = "0.2.2"
version = "0.3.0"
edition = "2021"
description = "Macros used by the dwind crate for applying dominator classes to components using a custom language"
homepage = "https://github.com/JedimEmO/dwind"
Expand All @@ -12,17 +12,17 @@ keywords = ["web", "wasm", "css", "style"]
proc-macro = true

[dependencies]
dominator.workspace = true
dominator = { workspace = true }
dwind-base = { path = "../dwind-base", version = "0.1.0" }
nom.workspace = true
proc-macro2.workspace = true
quote.workspace = true
nom = { workspace = true }
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["parsing", "proc-macro"] }


[dev-dependencies]
const_format.workspace = true
dominator.workspace = true
futures-signals.workspace = true
once_cell.workspace = true
wasm-bindgen-test.workspace = true
const_format = { workspace = true }
dominator = { workspace = true }
futures-signals = { workspace = true }
once_cell = { workspace = true }
wasm-bindgen-test = { workspace = true }
10 changes: 8 additions & 2 deletions crates/dwind-macros/src/codegen/string_rendering.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
pub fn class_name_to_struct_identifier(input: &String) -> String {
input.to_uppercase().replace('-', "_")
input
.to_uppercase()
.replace('-', "_")
.replace('.', "_")
.replace('/', "_OF_")
}

pub fn class_name_to_raw_identifier(input: &String) -> String {
format!(
"{}_RAW",
class_name_to_struct_identifier(&sanitize_class_prefix(input))
class_name_to_struct_identifier(&sanitize_class_prefix(
&input.replace("/", "_").replace(".", "_")
))
)
}

Expand Down
28 changes: 26 additions & 2 deletions crates/dwind-macros/src/grammar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ fn is_extended_alphanumeric(chars: Vec<char>) -> impl Fn(char) -> bool {
}

fn css_identifier(input: &str) -> IResult<&str, &str> {
let parser = take_while1(is_extended_alphanumeric(vec!['_', '-']));
let parser = take_while1(is_extended_alphanumeric(vec!['_', '-', '.', '/']));

parser(input)
}

fn color(input: &str) -> IResult<&str, &str> {
let parser = take_while1(is_extended_alphanumeric(vec![
'#', '%', '_', '-', '@', '(', ')',
'#', '%', '_', '-', '@', '(', ')', '.', '/',
]));

parser(input)
Expand Down Expand Up @@ -308,7 +308,30 @@ mod test {
variant: None,
}]
);

assert_eq!(
parse_class_string("foo/0.25").unwrap(),
vec![DwindClassSelector {
class_name: "foo/0.25".to_string(),
pseudo_classes: vec![],
conditionals: vec![],
generator_params: vec![],
variant: None,
}]
);

assert_eq!(
parse_class_string("foo[1/2]").unwrap(),
vec![DwindClassSelector {
class_name: "foo".to_string(),
pseudo_classes: vec![],
conditionals: vec![],
generator_params: vec!["1/2".to_string()],
variant: None,
}]
);
}

#[test]
fn verify_generator_parser() {
assert_eq!(
Expand Down Expand Up @@ -347,6 +370,7 @@ mod test {
assert_eq!(css_identifier("foo").unwrap().1, "foo".to_string());
assert_eq!(css_identifier("foo-bar").unwrap().1, "foo-bar".to_string());
assert_eq!(css_identifier("foo_baz").unwrap().1, "foo_baz".to_string());
assert_eq!(css_identifier("foo/0.2").unwrap().1, "foo/0.2".to_string());
}

#[test]
Expand Down
18 changes: 9 additions & 9 deletions crates/dwind/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dwind"
version = "0.4.0"
version = "0.5.0"
edition = "2021"
description = "Style your DOMINATOR applications using a tailwind-like syntax and utility class collection!"
homepage = "https://github.com/JedimEmO/dwind"
Expand All @@ -9,18 +9,18 @@ license = "MIT"
keywords = ["web", "wasm", "css", "style"]

[dependencies]
const_format.workspace = true
dominator.workspace = true
const_format = { workspace = true}
dominator = { workspace = true}
dominator-css-bindgen = { path = "../dominator-css-bindgen", version = "0.1.0" }
dwind-base = { path = "../dwind-base", version = "0.1.0" }
dwind-macros = { path = "../dwind-macros", version = "0.2.2" }
futures-signals.workspace = true
modern-normalize-cssys = { path = "../modern-normalize-cssys", version = "0.2" }
once_cell.workspace = true
dwind-macros = { path = "../dwind-macros", version = "0.3.0" }
futures-signals = { workspace = true}
modern-normalize-cssys = { path = "../modern-normalize-cssys", version = "0.2.0" }
once_cell = { workspace = true}
serde = { workspace = true, features = ["derive"] }

[build-dependencies]
dominator-css-bindgen = { path = "../dominator-css-bindgen", version = "0.1.0" }
dwind-build = { path = "../dwind-build", version = "0.1.0" }
serde.workspace = true
serde_json.workspace = true
serde = { workspace = true}
serde_json = { workspace = true}
16 changes: 7 additions & 9 deletions crates/dwind/resources/css/base.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

.sticky {
position: sticky;
}

:root {
color-scheme: dark;
}
Expand All @@ -18,10 +13,11 @@ body {
min-height: 100%;
}

ul,li {
ul,
li {
padding: 0;
margin: 0;
list-style: none ;
list-style: none;
}

*,
Expand Down Expand Up @@ -57,7 +53,9 @@ pre {
margin: 0;
}

*, :after, :before {
*,
:after,
:before {
box-sizing: border-box;
border: 0 solid #e5e7eb;
}
}
Loading
Loading