chore: 0.0.7: bump deps & light code cleanup

This commit is contained in:
spushk 2026-10-05 23:43:03 +03:00
commit 4dfcb2646a
Signed by untrusted user who does not match committer: spushk
GPG key ID: 7797B761E105E8AA
19 changed files with 601 additions and 2114 deletions

View file

@ -9,7 +9,7 @@ members = [
exclude = ["examples"]
[workspace.package]
version = "0.0.6"
version = "0.0.7"
edition = "2024"
rust-version = "1.88"
authors = ["Svyatoslav Pushkarev <yiffyrusdev@yandex.ru>"]
@ -19,12 +19,12 @@ publish = true
[workspace.dependencies]
## Workspace
sabry_intrnl = { path = "sabry_intrnl", version = "0.0.6" }
sabry_procmacro = { path = "sabry_procmacro", version = "0.0.6" }
sabry_procmacro_impl = { path = "sabry_procmacro_impl", version = "0.0.6" }
sabry_build = { path = "sabry_build", version = "0.0.6" }
sabry_intrnl = { path = "sabry_intrnl", version = "0.0.7" }
sabry_procmacro = { path = "sabry_procmacro", version = "0.0.7" }
sabry_procmacro_impl = { path = "sabry_procmacro_impl", version = "0.0.7" }
sabry_build = { path = "sabry_build", version = "0.0.7" }
## CSS
lightningcss.version = "1.0.0-alpha.71"
lightningcss.version = "1.0.0-alpha.72"
lightningcss.default-features = false
grass.version = "^0.13"
grass.default-features = false
@ -32,7 +32,7 @@ raffia.version = "^0.12"
## Marshall
serde.version = "^1"
toml.version = "^1"
base64.version = "^0.22"
base64.version = "^0.23"
regex.version = "^1"
## Util
itertools.version = "^0.14"
@ -42,7 +42,7 @@ cfg-if.version = "^1"
thiserror.version = "^2"
proc-macro2.version = "^1"
quote.version = "^1"
syn.version = "^2"
syn.version = "^3"
[package]
name = "sabry"
@ -73,6 +73,7 @@ procmacro = ["dep:sabry_procmacro"]
build = ["dep:sabry_build"]
net-files = ["sabry_build/net-files"]
internals = []
nightly = ["sabry_procmacro?/nightly"]
[package.metadata.docs.rs]
all-features = true

File diff suppressed because it is too large Load diff

View file

@ -6,4 +6,5 @@ rust-version = "1.88"
publish = false
[dependencies]
sabry = { path = "../../", features = ["nightly"] }
sabry.path = "../../"
sabry.features = ["nightly"]

View file

@ -30,18 +30,19 @@ thiserror = "^1"
tracing.version = "0.1"
tracing.optional = true
http = "^1"
# sabry with sass
sabry = { path = "../../" }
sabry.path = "../../"
# our component library
leptos-components = { path = "../leptos-components" }
leptos-components.version = "0.0.0"
leptos-components.path = "../leptos-components"
[build-dependencies]
# sabry for build with sass
sabry = { path = "../../", features = ["build"] }
sabry.path = "../../"
sabry.features = ["build"]
# lets depend on our styles
define-styles = { path = "../define-styles" }
define-styles.version = "0.0.0"
define-styles.path = "../define-styles"
[features]
hydrate = ["leptos/hydrate"]

View file

@ -1,6 +1,32 @@
use leptos::prelude::*;
use sabry::styly;
/// Renders the home page of your application.
#[component]
pub fn Route() -> impl IntoView {
// Creates a reactive value to update the button
let count = RwSignal::new(0);
let on_click = move |_| *count.write() += 1;
view! {class = STYLE,
<leptos_components::Aside/> // lets use our component
<section class=style::table>
<h2>"Welcome to Leptos"</h2>
<h2 class="">
"This head is styled with lepty-scopes feature"
<br/>
<span class="">"And this child too!"</span>
</h2>
<button class=style::btn on:click=on_click>"Ima CRAZY button, clicked: " {count} " times!"</button>
<button class=style::_dark(style::btn) on:click=on_click>"Ima CRAZY button, clicked: " {count} " times!"</button>
<span class=style::card>"DISCLAIMER:"</span>
<p class=style::pocwarn>"This isn't a design example! Its just proof of sabry's capabilities."</p>
<p class=style::pocwarn>"Plz dont make websites/apps which look like this page :D"</p>
</section>
}
}
styly!(style {"
@use 'tokens';
@use 'utils';
@ -34,31 +60,4 @@ styly!(style {"
@include theme.surface(secondary);
text-transform: uppercase;
}
"});
/// Renders the home page of your application.
#[component]
pub fn Route() -> impl IntoView {
// Creates a reactive value to update the button
let count = RwSignal::new(0);
let on_click = move |_| *count.write() += 1;
view! {class = STYLE,
<leptos_components::Aside/> // lets use our component
<section class=style::table>
<h2>"Welcome to Leptos"</h2>
<h2 class="">
"This head is styled with lepty-scopes feature"
<br/>
<span class="">"And this child too!"</span>
</h2>
<button class=style::btn on:click=on_click>"Ima CRAZY button, clicked: " {count} " times!"</button>
<button class=style::_dark(style::btn) on:click=on_click>"Ima CRAZY button, clicked: " {count} " times!"</button>
<span class=style::card>"DISCLAIMER:"</span>
<p class=style::pocwarn>"This isn't a design example! Its just proof of sabry's capabilities."</p>
<p class=style::pocwarn>"Plz dont make websites/apps which look like this page :D"</p>
</section>
}
}

View file

@ -1,6 +1,6 @@
[package]
name = "leptos-components"
version = "0.1.0"
version = "0.0.0"
rust-version = "1.88"
edition = "2024"
publish = false
@ -12,12 +12,14 @@ crate-type = ["cdylib", "rlib"]
leptos.version = "^0.8"
leptos_meta.version = "^0.8"
leptos_router.version = "^0.8"
sabry = { path = "../../", features = ["const-scoping"] }
sabry.path = "../../"
sabry.features = ["const-scoping"]
[build-dependencies]
sabry = { path = "../../", features = ["build", "const-scoping"] }
define-styles = { path = "../define-styles" }
sabry.path = "../../"
sabry.features = ["build", "const-scoping"]
define-styles.version = "0.0.0"
define-styles.path = "../define-styles"
[features]
hydrate = ["leptos/hydrate"]

File diff suppressed because it is too large Load diff

View file

@ -6,11 +6,15 @@ rust-version = "1.88"
publish = false
[dependencies]
sabry = { path = "../../", features = ["nightly"] }
sabry.version = "0.0.7"
sabry.path = "../../"
sabry.features = ["nightly"]
[build-dependencies]
sabry = { path = "../../", features = ["build", "nightly"] }
define-styles = { path = "../define-styles" }
sabry.path = "../../"
sabry.features = ["build"]
define-styles.version = "0.0.0"
define-styles.path = "../define-styles"
[package.metadata.sabry]
css.bundle = "target/static/style.css"

View file

@ -1,29 +1,29 @@
[package]
name = "sabry_build"
description = "Sabry build magic as a separate crate"
version.workspace = true
repository.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
description = "Sabry build magic as a separate crate"
repository.workspace = true
license.workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
sabry_intrnl.workspace = true
sabry_intrnl.features = ["compile", "scope"]
sabry_procmacro_impl.workspace = true
sabry_procmacro_impl.features = ["const-compile"]
syn.workspace = true
syn.features = ["visit", "derive", "parsing", "full"]
proc-macro2.workspace = true
proc-macro2.features = ["span-locations"]
syn.workspace = true
syn.features = ["derive", "full", "parsing", "visit"]
thiserror.workspace = true
walkdir.workspace = true
[features]
net-files = []
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

View file

@ -50,8 +50,13 @@ impl<'ast> Visit<'ast> for StylyVisitor {
node.mac.span()
)
});
let macro_data =
styly::parse_macro_syntax(body, self.path.parent().map(|p| p.to_owned()))
let source_path = self.path.parent().unwrap_or_else(|| {
panic!(
"could not find source_file at {:?}: none parent exists",
node.mac.span()
)
});
let macro_data = styly::parse_macro_syntax(body, source_path.to_owned())
.unwrap_or_else(|e| {
panic!(
"could not parse `styly!` macro at {:?}: {e:?}",

View file

@ -1,33 +1,33 @@
[package]
name = "sabry_intrnl"
description = "Sabry internal, yet still public library"
version.workspace = true
repository.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
description = "Sabry internal, yet still public library"
repository.workspace = true
license.workspace = true
[dependencies]
syn.workspace = true
raffia.workspace = true
grass.workspace = true
grass.optional = true
lightningcss.workspace = true
lightningcss.optional = true
base64.workspace = true
base64.optional = true
thiserror.workspace = true
serde.workspace = true
serde.features = ["derive"]
toml.workspace = true
cfg-if.workspace = true
[features]
scope = ["dep:base64"]
compile = ["dep:lightningcss", "dep:grass"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
base64.workspace = true
base64.optional = true
grass.workspace = true
grass.optional = true
lightningcss.workspace = true
lightningcss.optional = true
raffia.workspace = true
syn.workspace = true
cfg-if.workspace = true
serde.workspace = true
serde.features = ["derive"]
thiserror.workspace = true
toml.workspace = true
[features]
compile = ["dep:grass", "dep:lightningcss"]
scope = ["dep:base64"]

View file

@ -377,35 +377,43 @@ impl ScopedSelector {
#[cfg(feature = "scope")]
pub fn sanitize_css_member(source: &str) -> String {
let mut target = String::with_capacity(source.len());
let mut next_uppercase: bool = false;
for (i, c) in source
.chars()
.filter(|c| c.is_alphanumeric() || *c == '-')
.enumerate()
{
// first gidit is prepended with 'n'
if i == 0 && c.is_numeric() {
target.push('n');
target.push(c);
let mut target = String::with_capacity(source.len() + 1);
for part in source.split('-').filter(|p| !p.is_empty()) {
let mut chars = part.chars().filter(|c| c.is_ascii() && c.is_alphanumeric());
match (chars.next(), chars.next()) {
(None, None) => continue,
(Some(f), None) => {
target.push(f);
continue;
}
// dash is omitted, replacing the next char with its uppercase
if c == '-' {
next_uppercase = true;
(Some(f), Some(s)) => {
target.push(f.to_ascii_uppercase());
target.push(s);
}
(None, Some(s)) => {
target.push(s);
continue;
}
let char = if next_uppercase {
next_uppercase = false;
c.to_ascii_uppercase()
} else {
c
};
target.push(char);
}
chars.for_each(|c| target.push(c));
}
match target.chars().next() {
Some(c) if c.is_numeric() => {
target.insert(0, 'n');
}
Some(c) => {
target.replace_range(..1, &c.to_ascii_lowercase().to_string());
}
_ => {
/* has to produce valid rust ident */
target.clear();
target.push_str("unknown");
}
}
target
}

View file

@ -1,13 +1,17 @@
[package]
name = "sabry_procmacro"
description = "Sabry proc-macro declarations"
version.workspace = true
repository.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
description = "Sabry proc-macro declarations"
repository.workspace = true
license.workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[lib]
proc-macro = true
@ -16,7 +20,4 @@ sabry_procmacro_impl.workspace = true
[features]
const-compile = ["sabry_procmacro_impl/const-compile"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
nightly = ["sabry_procmacro_impl/nightly"]

View file

@ -37,8 +37,11 @@ use sabry_procmacro_impl::impls::{
///
#[proc_macro]
pub fn scssy(input: TokenStream) -> TokenStream {
let source_path =
PathBuf::from_str(&proc_macro::Span::call_site().file()).expect("Irrefutable result");
let source_path = PathBuf::from_str(&proc_macro::Span::call_site().file())
.expect("Irrefutable result")
.parent()
.expect("The scssy procmacro callsite source file has no parent dir")
.to_owned();
scssy_macro_impl(input.into(), source_path).into()
}

View file

@ -1,30 +1,30 @@
[package]
name = "sabry_procmacro_impl"
description = "Sabry proc-macro internals reusable outside of proc-macro context"
version.workspace = true
repository.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
description = "Sabry proc-macro internals reusable outside of proc-macro context"
repository.workspace = true
license.workspace = true
[dependencies]
sabry_intrnl.workspace = true
sabry_intrnl.features = ["scope"]
raffia.workspace = true
syn.workspace = true
syn.features = ["parsing"]
quote.workspace = true
proc-macro2.workspace = true
proc-macro2.features = ["span-locations"]
regex.workspace = true
itertools.workspace = true
cfg-if.workspace = true
[features]
nightly = []
const-compile = ["sabry_intrnl/compile"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
cfg-if.workspace = true
itertools.workspace = true
proc-macro2.workspace = true
proc-macro2.features = ["span-locations"]
quote.workspace = true
raffia.workspace = true
regex.workspace = true
sabry_intrnl.workspace = true
sabry_intrnl.features = ["scope"]
syn.workspace = true
syn.features = ["parsing"]
[features]
const-compile = ["sabry_intrnl/compile"]
nightly = []

View file

@ -48,7 +48,7 @@ impl ArbitraryStyleBlock {
return Err(syn::Error::new(
path_tok.span(),
format!(
"Could not use path {path:?}: {:?}. If the path is relative and 'nightly' feature flag is set - this is likely false-positive",
"Could not use path {path:?}: {:?}. If the path is relative, nightly rust has to be used and `nightly` feature flag has to be set",
e.kind()
),
));

View file

@ -89,14 +89,12 @@ pub fn styly_macro_impl(input: TokenStream, source_path: PathBuf) -> TokenStream
_ => None,
};
let interp = interp.and_then(|i| match i.elements.first() {
interp.and_then(|i| match i.elements.first() {
Some(raffia::ast::SassInterpolatedIdentElement::Static(i)) => {
Some(i.raw.to_string())
}
_ => None,
});
interp
})
})
})
.unique()

9
tombi.toml Normal file
View file

@ -0,0 +1,9 @@
[[schemas]]
path = "tombi://www.schemastore.org/cargo.json"
include = ["Cargo.toml"]
format.rules.array-values-order.enabled = false
format.rules.table-keys-order.enabled = false
[[schemas.overrides]]
targets = ["workspace.dependencies", "dependencies", "dev-dependencies", "build-dependencies"]
format.rules = { table-keys-order.enabled = false }