From f1fcf78f6c7349b4c4ee1f3cbdc9f67813391f66 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Fri, 19 Apr 2024 20:30:51 +0200 Subject: [PATCH] feat: style settings better --- Cargo.lock | 59 ++-------------------- app/src/lib/settings/NestedSettings.svelte | 2 + app/src/lib/settings/Settings.svelte | 4 +- nodes/max/plantarium/output/Cargo.toml | 2 +- packages/types/package.json | 5 +- packages/types/src/inputs.ts | 21 ++++++-- packages/types/src/lib.rs | 1 + packages/types/src/parameters.ts | 26 ---------- pnpm-lock.yaml | 10 +++- 9 files changed, 41 insertions(+), 89 deletions(-) delete mode 100644 packages/types/src/parameters.ts diff --git a/Cargo.lock b/Cargo.lock index e018115..53fd35f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,12 +36,6 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -54,7 +48,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen", ] @@ -92,12 +86,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "libc" -version = "0.2.153" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - [[package]] name = "log" version = "0.4.21" @@ -171,12 +159,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "once_cell" version = "1.19.0" @@ -196,7 +178,6 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-test", "web-sys", - "wee_alloc", ] [[package]] @@ -366,7 +347,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -391,7 +372,7 @@ version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -460,37 +441,3 @@ dependencies = [ "js-sys", "wasm-bindgen", ] - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/app/src/lib/settings/NestedSettings.svelte b/app/src/lib/settings/NestedSettings.svelte index 80b3769..4afb3cb 100644 --- a/app/src/lib/settings/NestedSettings.svelte +++ b/app/src/lib/settings/NestedSettings.svelte @@ -53,6 +53,8 @@ } details { padding: 1rem; + min-height: 69px; + box-sizing: border-box; border-bottom: solid thin var(--outline); } diff --git a/app/src/lib/settings/Settings.svelte b/app/src/lib/settings/Settings.svelte index a740308..d5ce1d9 100644 --- a/app/src/lib/settings/Settings.svelte +++ b/app/src/lib/settings/Settings.svelte @@ -116,6 +116,8 @@ h1 { border-bottom: solid thin var(--outline); + box-sizing: border-box; + height: 70px; } .content { @@ -129,7 +131,7 @@ } .tabs > button { - height: 30px; + height: 35px; padding: 5px; border-radius: 0px; background: none; diff --git a/nodes/max/plantarium/output/Cargo.toml b/nodes/max/plantarium/output/Cargo.toml index 0436921..1f025df 100644 --- a/nodes/max/plantarium/output/Cargo.toml +++ b/nodes/max/plantarium/output/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib", "rlib"] [features] -default = ["console_error_panic_hook", "wee_alloc"] +default = ["console_error_panic_hook"] console_error_panic_hook = ["dep:console_error_panic_hook"] [dependencies] diff --git a/packages/types/package.json b/packages/types/package.json index 23d0414..e09178c 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -5,5 +5,8 @@ "main": "src/index.ts", "keywords": [], "author": "", - "license": "ISC" + "license": "ISC", + "dependencies": { + "zod": "^3.22.5" + } } diff --git a/packages/types/src/inputs.ts b/packages/types/src/inputs.ts index eebc24c..3c9db2a 100644 --- a/packages/types/src/inputs.ts +++ b/packages/types/src/inputs.ts @@ -31,6 +31,23 @@ type NodeInputSeed = { value?: number; } +type NodeInputVec3 = { + type: "vec3"; + value?: number[]; +} + +type NodeInputModel = { + type: "model"; +} + +type NodeInputPlant = { + type: "plant" +} + +type InputTypes = (NodeInputSeed | NodeInputBoolean | NodeInputFloat | NodeInputInteger | NodeInputSelect | NodeInputSeed | NodeInputVec3 | NodeInputModel | NodeInputPlant); + +type InputId = InputTypes["type"]; + type DefaultOptions = { internal?: boolean; external?: boolean; @@ -38,10 +55,8 @@ type DefaultOptions = { label?: string | false; } -type InputTypes = (NodeInputSeed | NodeInputBoolean | NodeInputFloat | NodeInputInteger | NodeInputSelect); - export type NodeInput = InputTypes & { - type: InputTypes["type"] | InputTypes["type"][]; + type: InputId | InputId[]; } & DefaultOptions; diff --git a/packages/types/src/lib.rs b/packages/types/src/lib.rs index a187f12..3467976 100644 --- a/packages/types/src/lib.rs +++ b/packages/types/src/lib.rs @@ -130,3 +130,4 @@ pub struct NodeType { #[serde(skip_serializing_if = "Option::is_none")] pub outputs: Option>, } + diff --git a/packages/types/src/parameters.ts b/packages/types/src/parameters.ts deleted file mode 100644 index b0cb153..0000000 --- a/packages/types/src/parameters.ts +++ /dev/null @@ -1,26 +0,0 @@ -type RandomParameter = { - type: "random"; - min: Parameter; - max: Parameter; - seed: number; -} - - -type MathParameter = { - type: "math"; - op_type: number; - a: Parameter; - b: Parameter; -} - - -type NoiseParameter = { - type: "noise"; - frequency: Parameter; - amplitude: Parameter; - seed: number; -} - - -type Parameter = number | RandomParameter | MathParameter | NoiseParameter; - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31fbf2a..4de3a5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -218,7 +218,11 @@ importers: specifier: ^1.5.0 version: 1.5.0 - packages/types: {} + packages/types: + dependencies: + zod: + specifier: ^3.22.5 + version: 3.22.5 packages/ui: dependencies: @@ -5098,3 +5102,7 @@ packages: /yoga-layout@2.0.1: resolution: {integrity: sha512-tT/oChyDXelLo2A+UVnlW9GU7CsvFMaEnd9kVFsaiCQonFAXd3xrHhkLYu+suwwosrAEQ746xBU+HvYtm1Zs2Q==} dev: false + + /zod@3.22.5: + resolution: {integrity: sha512-HqnGsCdVZ2xc0qWPLdO25WnseXThh0kEYKIdV5F/hTHO75hNZFp8thxSeHhiPrHZKrFTo1SOgkAj9po5bexZlw==} + dev: false