feat: improve help view
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 1m24s
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 1m24s
This commit is contained in:
@ -2,13 +2,25 @@
|
||||
import type { Node, NodeInput } from "@nodes/types";
|
||||
import NestedSettings from "./NestedSettings.svelte";
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
import type { GraphManager } from "$lib/graph-interface/graph-manager";
|
||||
|
||||
export let manager: GraphManager;
|
||||
export let node: Node | undefined;
|
||||
|
||||
function filterInputs(inputs: Record<string, NodeInput>) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(inputs).filter(([key, value]) => {
|
||||
return value.hidden === true;
|
||||
}),
|
||||
Object.entries(inputs)
|
||||
.filter(([key, value]) => {
|
||||
return value.hidden === true;
|
||||
})
|
||||
.map(([key, value]) => {
|
||||
//@ts-ignore
|
||||
value.__node_type = node?.tmp?.type.id;
|
||||
//@ts-ignore
|
||||
value.__node_input = key;
|
||||
return [key, value];
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@ -26,14 +38,12 @@
|
||||
return writable(store);
|
||||
}
|
||||
|
||||
export let manager: GraphManager;
|
||||
|
||||
export let node: Node | undefined;
|
||||
let nodeDefinition: Record<string, NodeInput> | undefined;
|
||||
$: nodeDefinition = node?.tmp?.type
|
||||
? filterInputs(node.tmp.type.inputs)
|
||||
: undefined;
|
||||
$: store = node ? createStore(node.props, nodeDefinition) : undefined;
|
||||
$: console.log(nodeDefinition, store);
|
||||
|
||||
let lastPropsHash = "";
|
||||
function updateNode() {
|
||||
|
@ -27,7 +27,6 @@
|
||||
function isNodeInput(v: Input | Nested): v is Input {
|
||||
return v && "type" in v;
|
||||
}
|
||||
console.log({ settings, store });
|
||||
</script>
|
||||
|
||||
{#if $store}
|
||||
@ -35,7 +34,11 @@
|
||||
{@const value = settings[key]}
|
||||
<div class="wrapper" class:first-level={depth === 0}>
|
||||
{#if value !== undefined && isNodeInput(value)}
|
||||
<div class="input input-{settings[key].type}">
|
||||
<div
|
||||
class="input input-{settings[key].type}"
|
||||
data-node-type={value?.__node_type || null}
|
||||
data-node-input={value?.__node_input || null}
|
||||
>
|
||||
{#if value.type === "button"}
|
||||
<button on:click={() => value?.callback?.()}
|
||||
>{value.label || key}</button
|
||||
|
Reference in New Issue
Block a user