diff --git a/.vscode/settings.json b/.vscode/settings.json index 4fafcea..b36583f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,7 @@ { "rust-analyzer.linkedProjects": [ "./dyesub-tool/Cargo.toml", + "./dyesub/Cargo.toml", + "./svg-units/Cargo.toml", ] } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index ff223b3..b8c9100 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -400,19 +400,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "669a445ee724c5c69b1b06fe0b63e70a1c84bc9bb7d9696cd4f4e3ec45050408" [[package]] -name = "dyesub-tool" +name = "dyesub" version = "0.1.0" dependencies = [ "askama", + "derive_more", + "kle-serial", + "lazy_static", + "serde_json", + "svg-units", +] + +[[package]] +name = "dyesub-tool" +version = "0.1.0" +dependencies = [ "class_list", "derive_more", "kle-serial", "lazy_static", "leptos", - "regex", "serde_json", "strum", "strum_macros", + "svg-units", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1776,6 +1787,17 @@ dependencies = [ "syn 2.0.28", ] +[[package]] +name = "svg-units" +version = "0.1.0" +dependencies = [ + "derive_more", + "lazy_static", + "regex", + "strum", + "strum_macros", +] + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index 7cb6ede..28f5169 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] -members = ["dyesub-tool"] +members = ["dyesub-tool", "dyesub", "svg-units"] resolver = "2" \ No newline at end of file diff --git a/dyesub-tool/Cargo.toml b/dyesub-tool/Cargo.toml index db45730..0002f49 100644 --- a/dyesub-tool/Cargo.toml +++ b/dyesub-tool/Cargo.toml @@ -4,13 +4,12 @@ version = "0.1.0" edition = "2021" [dependencies] -askama = "0.12.0" +svg-units = { path = "../svg-units" } class_list = "0.1.1" derive_more = "0.99.17" kle-serial = "0.2.2" lazy_static = "1.4.0" leptos = { version = "0.4.8", features = ["csr", "nightly"] } -regex = "1.9.3" serde_json = "1.0.105" strum = "0.25.0" strum_macros = "0.25.2" diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs index 4f7358a..174ee5b 100644 --- a/dyesub-tool/src/main.rs +++ b/dyesub-tool/src/main.rs @@ -3,10 +3,6 @@ mod components; mod error; mod models; -#[allow(dead_code)] -mod render; -#[allow(dead_code)] -pub mod svg; mod utils; use leptos::*; diff --git a/dyesub/Cargo.toml b/dyesub/Cargo.toml new file mode 100644 index 0000000..28d731b --- /dev/null +++ b/dyesub/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "dyesub" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +svg-units = { path = "../svg-units" } +askama = "0.12.0" +derive_more = "0.99.17" +kle-serial = "0.2.2" +lazy_static = "1.4.0" +serde_json = "1.0.105" diff --git a/dyesub-tool/src/render.rs b/dyesub/src/lib.rs similarity index 95% rename from dyesub-tool/src/render.rs rename to dyesub/src/lib.rs index d8c4bda..d68aef9 100644 --- a/dyesub-tool/src/render.rs +++ b/dyesub/src/lib.rs @@ -4,7 +4,7 @@ use askama::Template; use derive_more::From; use lazy_static::lazy_static; -use crate::svg::{SVGMeasure, SVGUnit}; +use svg_units::{SVGMeasure, SVGUnit}; #[derive(Template)] #[template(path = "document.xml")] @@ -28,7 +28,7 @@ lazy_static! { } mod filters { - use crate::svg::{SVGMeasure, SVGUnit}; + use svg_units::{SVGMeasure, SVGUnit}; pub fn kle_font_units(kle_font_units: &usize) -> askama::Result { Ok(SVGMeasure::new( diff --git a/dyesub-tool/templates/document.xml b/dyesub/templates/document.xml similarity index 100% rename from dyesub-tool/templates/document.xml rename to dyesub/templates/document.xml diff --git a/flake.nix b/flake.nix index e808a0d..c76bdcd 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,7 @@ Updating `cargoHash`: version = "0.1.0"; buildAndTestSubdir = "dyesub-tool"; buildInputs = with pkgs; [ trunk ]; - cargoHash = "sha256-aaEDYeGIiAH1RsO7zTJKefnT8aKCbIT3ssukW25GLDY="; + cargoHash = "sha256-52zTjWRXq058BhuRj2A7mvWzC88UCEolodnBcfa3Ol8="; meta = meta // { description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift 拇指シフト keycaps."; }; diff --git a/svg-units/Cargo.toml b/svg-units/Cargo.toml new file mode 100644 index 0000000..4189723 --- /dev/null +++ b/svg-units/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "svg-units" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +derive_more = "0.99.17" +lazy_static = "1.4.0" +regex = "1.9.3" +strum = "0.25.0" +strum_macros = "0.25.2" diff --git a/dyesub-tool/src/svg/mod.rs b/svg-units/src/lib.rs similarity index 100% rename from dyesub-tool/src/svg/mod.rs rename to svg-units/src/lib.rs diff --git a/dyesub-tool/src/svg/measure.rs b/svg-units/src/measure.rs similarity index 100% rename from dyesub-tool/src/svg/measure.rs rename to svg-units/src/measure.rs diff --git a/dyesub-tool/src/svg/tests.rs b/svg-units/src/tests.rs similarity index 98% rename from dyesub-tool/src/svg/tests.rs rename to svg-units/src/tests.rs index c8690b9..fbf8eb1 100644 --- a/dyesub-tool/src/svg/tests.rs +++ b/svg-units/src/tests.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use crate::svg::{SVGMeasure, SVGUnit}; +use crate::{SVGMeasure, SVGUnit}; #[test] fn add() { diff --git a/dyesub-tool/src/svg/unit.rs b/svg-units/src/unit.rs similarity index 100% rename from dyesub-tool/src/svg/unit.rs rename to svg-units/src/unit.rs