diff --git a/app/src/lib/graph-interface/graph/Wrapper.svelte b/app/src/lib/graph-interface/graph/Wrapper.svelte index b272b65..60d18be 100644 --- a/app/src/lib/graph-interface/graph/Wrapper.svelte +++ b/app/src/lib/graph-interface/graph/Wrapper.svelte @@ -27,6 +27,8 @@ export let showGrid = false; export let snapToGrid = false; + export let settingTypes = {}; + const updateSettings = debounce((s) => { manager.setSettings(s); }, 200); @@ -36,7 +38,8 @@ } manager.on("settings", (settings) => { - dispatch("settings", settings); + settingTypes = settings.types; + $settings = settings.values; }); manager.on("result", (result) => { diff --git a/app/src/lib/node-registry-client.ts b/app/src/lib/node-registry-client.ts index 529b905..8fc35e0 100644 --- a/app/src/lib/node-registry-client.ts +++ b/app/src/lib/node-registry-client.ts @@ -3,6 +3,8 @@ import { createWasmWrapper } from "@nodes/utils"; import { createLogger } from "./helpers"; const log = createLogger("node-registry"); +log.mute(); + export class RemoteNodeRegistry implements NodeRegistry { status: "loading" | "ready" | "error" = "loading"; @@ -10,9 +12,6 @@ export class RemoteNodeRegistry implements NodeRegistry { constructor(private url: string) { } - async loadNode(id: `${string}/${string}/${string}`) { - } - async fetchUsers() { const response = await fetch(`${this.url}/nodes/users.json`); if (!response.ok) { @@ -58,6 +57,10 @@ export class RemoteNodeRegistry implements NodeRegistry { const nodes = await Promise.all(nodeIds.map(async id => { + if (this.nodes.has(id)) { + return this.nodes.get(id); + } + const wasmResponse = await this.fetchNode(id); const wrapper = createWasmWrapper(wasmResponse); diff --git a/app/src/lib/node-store/NodeStore.svelte b/app/src/lib/node-store/NodeStore.svelte index c448eb6..6190726 100644 --- a/app/src/lib/node-store/NodeStore.svelte +++ b/app/src/lib/node-store/NodeStore.svelte @@ -4,7 +4,7 @@ import BreadCrumbs from "./BreadCrumbs.svelte"; import DraggableNode from "./DraggableNode.svelte"; - export let nodeRegistry: RemoteNodeRegistry; + export let registry: RemoteNodeRegistry; const activeId = localStore< `${string}` | `${string}/${string}` | `${string}/${string}/${string}` @@ -20,7 +20,7 @@
{key}: {Math.floor(value * 100) / 100}ms
{/each} diff --git a/app/src/lib/performance/index.ts b/app/src/lib/performance/index.ts index 694e160..761dcdd 100644 --- a/app/src/lib/performance/index.ts +++ b/app/src/lib/performance/index.ts @@ -1,6 +1,6 @@ import { readable, type Readable } from "svelte/store"; -type PerformanceData = { +export type PerformanceData = { total: Record{key.description}
{/if} diff --git a/app/src/lib/settings/NestedSettings.svelte b/app/src/lib/settings/panels/NestedSettings.svelte similarity index 80% rename from app/src/lib/settings/NestedSettings.svelte rename to app/src/lib/settings/panels/NestedSettings.svelte index b94a8b3..93fc8c1 100644 --- a/app/src/lib/settings/NestedSettings.svelte +++ b/app/src/lib/settings/panels/NestedSettings.svelte @@ -4,8 +4,12 @@ import Input from "@nodes/ui"; import type { Writable } from "svelte/store"; + type Button = { type: "button"; label?: string; callback: () => void }; + + type Input = NodeInput | Button; + interface Nested { - [key: string]: Nested | NodeInput; + [key: string]: (Nested & { __title?: string }) | Input; } export let id: string; @@ -20,22 +24,23 @@ export let depth = 0; const keys = Object.keys(settings).filter((key) => key !== "__title"); - function isNodeInput(v: NodeInput | Nested): v is NodeInput { + function isNodeInput(v: Input | Nested): v is Input { return v && "type" in v; } + console.log({ settings, store }); -{#if store} +{#if $store} {#each keys as key} {@const value = settings[key]}