{#each Object.keys(type[key]).filter((key) => key !== "title") as childKey}
}
- type={type[key] as Nested}
+ value={value[key] as SettingsValue}
+ type={type[key] as SettingsType}
depth={depth + 1}
/>
{/each}
@@ -103,9 +108,18 @@
user-select: none;
margin-bottom: 1em;
}
+
+ summary::marker { }
+
+ summary > p {
+ display: inline;
+ padding-left: 6px;
+ }
+
details {
padding: 1em;
padding-bottom: 0;
+ padding-left: 21px;
}
.input {
@@ -114,7 +128,7 @@
display: flex;
flex-direction: column;
gap: 10px;
- padding-left: 14px;
+ padding-left: 20px;
}
.input-boolean {
@@ -126,16 +140,12 @@
order: 2;
}
- .first-level > .input {
- padding-right: 1rem;
+ .first-level.input {
+ padding-left: 1em;
+ padding-right: 1em;
+ padding-bottom: 1px;
}
- .first-level {
- border-bottom: solid thin var(--outline);
- }
- .first-level > details {
- border: none;
- }
hr {
position: absolute;
margin: 0;
diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte
index 0fa1b5d..00d3885 100644
--- a/app/src/routes/+page.svelte
+++ b/app/src/routes/+page.svelte
@@ -5,9 +5,10 @@
import type { Graph, Node } from "@nodes/types";
import Viewer from "$lib/result-viewer/Viewer.svelte";
import Settings from "$lib/settings/Settings.svelte";
- import { AppSettingTypes, AppSettings } from "$lib/settings/app-settings";
- import { appSettings as _appSettings, AppSettingTypes as _AppSettingTypes} from "$lib/settings/app-settings.svelte";
- import { writable } from "svelte/store";
+ import {
+ appSettings,
+ AppSettingTypes,
+ } from "$lib/settings/app-settings.svelte";
import Keymap from "$lib/settings/panels/Keymap.svelte";
import { createKeyMap } from "$lib/helpers/createKeyMap";
import NodeStore from "$lib/node-store/NodeStore.svelte";
@@ -27,6 +28,7 @@
import { createPerformanceStore } from "@nodes/utils";
import BenchmarkPanel from "$lib/settings/panels/BenchmarkPanel.svelte";
import { debounceAsyncFunction } from "$lib/helpers";
+ import { onMount } from "svelte";
let performanceStore = createPerformanceStore();
@@ -38,24 +40,26 @@
const memoryRuntime = new MemoryRuntimeExecutor(nodeRegistry, runtimeCache);
memoryRuntime.perf = performanceStore;
- $: runtime = $AppSettings.useWorker ? workerRuntime : memoryRuntime;
+ const runtime = $derived(
+ appSettings.debug.useWorker ? workerRuntime : memoryRuntime,
+ );
- let activeNode: Node | undefined;
- let scene: Group;
- let updateViewerResult: (result: Int32Array) => void;
+ let activeNode = $state(undefined);
+ let scene = $state(null!);
let graph = localStorage.getItem("graph")
? JSON.parse(localStorage.getItem("graph")!)
: templates.defaultPlant;
- let graphInterface: ReturnType;
- $: manager = graphInterface?.manager;
- $: managerStatus = manager?.status;
- $: keymap = graphInterface?.keymap;
+ let graphInterface = $state>(null!);
+ let viewerComponent = $state>();
+ const manager = $derived(graphInterface?.manager);
+ const managerStatus = $derived(manager?.status);
async function randomGenerate() {
+ if (!manager) return;
const g = manager.serialize();
- const s = { ...$graphSettings, randomSeed: true };
+ const s = { ...graphSettings, randomSeed: true };
await handleUpdate(g, s);
}
@@ -66,18 +70,18 @@
callback: randomGenerate,
},
]);
- let graphSettings = writable>({});
- let graphSettingTypes = {};
+ let graphSettings = $state>({});
+ let graphSettingTypes = $state({});
const handleUpdate = debounceAsyncFunction(
- async (g: Graph, s: Record) => {
+ async (g: Graph, s: Record = graphSettings) => {
performanceStore.startRun();
try {
let a = performance.now();
- const graphResult = await runtime.execute(g, s);
+ const graphResult = await runtime.execute(g, $state.snapshot(s));
let b = performance.now();
- if ($AppSettings.useWorker) {
+ if (appSettings.debug.useWorker) {
let perfData = await runtime.getPerformanceData();
let lastRun = perfData?.at(-1);
if (lastRun?.total) {
@@ -91,7 +95,7 @@
}
}
- updateViewerResult(graphResult);
+ viewerComponent?.update(graphResult);
} catch (error) {
console.log("errors", error);
} finally {
@@ -100,32 +104,35 @@
},
);
- $: if (AppSettings) {
- //@ts-ignore
- AppSettingTypes.debug.stressTest.loadGrid.callback = () => {
- graph = templates.grid($AppSettings.amount, $AppSettings.amount);
- };
- //@ts-ignore
- AppSettingTypes.debug.stressTest.loadTree.callback = () => {
- graph = templates.tree($AppSettings.amount);
- };
- //@ts-ignore
- AppSettingTypes.debug.stressTest.lottaFaces.callback = () => {
- graph = templates.lottaFaces;
- };
- //@ts-ignore
- AppSettingTypes.debug.stressTest.lottaNodes.callback = () => {
- graph = templates.lottaNodes;
- };
- //@ts-ignore
- AppSettingTypes.debug.stressTest.lottaNodesAndFaces.callback = () => {
- graph = templates.lottaNodesAndFaces;
- };
- }
+ // $ if (AppSettings) {
+ // //@ts-ignore
+ // AppSettingTypes.debug.stressTest.loadGrid.callback = () => {
+ // graph = templates.grid($AppSettings.amount, $AppSettings.amount);
+ // };
+ // //@ts-ignore
+ // AppSettingTypes.debug.stressTest.loadTree.callback = () => {
+ // graph = templates.tree($AppSettings.amount);
+ // };
+ // //@ts-ignore
+ // AppSettingTypes.debug.stressTest.lottaFaces.callback = () => {
+ // graph = templates.lottaFaces;
+ // };
+ // //@ts-ignore
+ // AppSettingTypes.debug.stressTest.lottaNodes.callback = () => {
+ // graph = templates.lottaNodes;
+ // };
+ // //@ts-ignore
+ // AppSettingTypes.debug.stressTest.lottaNodesAndFaces.callback = () => {
+ // graph = templates.lottaNodesAndFaces;
+ // };
+ // }
function handleSave(graph: Graph) {
localStorage.setItem("graph", JSON.stringify(graph));
}
+ onMount(() => {
+ handleUpdate(graph);
+ });
@@ -134,10 +141,10 @@
@@ -146,21 +153,21 @@
bind:this={graphInterface}
{graph}
registry={nodeRegistry}
+ showGrid={appSettings.nodeInterface.showNodeGrid}
+ snapToGrid={appSettings.nodeInterface.snapToGrid}
bind:activeNode
- showGrid={$AppSettings.showNodeGrid}
- snapToGrid={$AppSettings.snapToGrid}
- bind:showHelp={$AppSettings.showHelp}
+ bind:showHelp={appSettings.nodeInterface.showHelp}
bind:settings={graphSettings}
bind:settingTypes={graphSettingTypes}
- onresult={(result) => handleUpdate(result, $graphSettings)}
+ onresult={(result) => handleUpdate(result)}
onsave={(graph) => handleSave(graph)}
/>
-
- {#if keymap}
-
- {/if}
+
@@ -188,7 +197,7 @@
id="performance"
title="Performance"
classes="text-red-400"
- hidden={!$AppSettings.showPerformancePanel}
+ hidden={!appSettings.debug.showPerformancePanel}
icon="i-tabler-brand-speedtest"
>
{#if $performanceStore}
@@ -199,7 +208,7 @@
id="benchmark"
title="Benchmark"
classes="text-red-400"
- hidden={!$AppSettings.showBenchmarkPanel}
+ hidden={!appSettings.debug.showBenchmarkPanel}
icon="i-tabler-graph"
>
diff --git a/nodes/max/plantarium/gravity/src/input.json b/nodes/max/plantarium/gravity/src/input.json
index df6b806..65cb62f 100644
--- a/nodes/max/plantarium/gravity/src/input.json
+++ b/nodes/max/plantarium/gravity/src/input.json
@@ -17,15 +17,15 @@
"type": "float",
"hidden": true,
"min": 0,
+ "max": 1,
"value": 0.5,
- "max": 1
},
"depth": {
"type": "integer",
"min": 1,
"max": 10,
+ "hidden": true,
"value": 1,
- "hidden": true
}
}
}
diff --git a/packages/ui/src/lib/Details.svelte b/packages/ui/src/lib/Details.svelte
index 7c3e9ad..5c21148 100644
--- a/packages/ui/src/lib/Details.svelte
+++ b/packages/ui/src/lib/Details.svelte
@@ -34,6 +34,6 @@
}
.content {
- padding-left: 12px;
+ /* padding-left: 12px; */
}