2024-04-15 22:13:43 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import type { Node, NodeInput } from "@nodes/types";
|
|
|
|
import { getGraphManager } from "../graph/context.js";
|
|
|
|
import { Input } from "@nodes/ui";
|
|
|
|
|
|
|
|
export let node: Node;
|
|
|
|
export let input: NodeInput;
|
|
|
|
export let id: string;
|
|
|
|
|
|
|
|
const graph = getGraphManager();
|
|
|
|
|
|
|
|
let value = node?.props?.[id] ?? input.value;
|
|
|
|
|
2024-04-18 13:16:33 +02:00
|
|
|
export let elementId: string = `input-${Math.random().toString(36).substring(7)}`;
|
2024-04-15 22:13:43 +02:00
|
|
|
|
|
|
|
$: if (node?.props?.[id] !== value) {
|
|
|
|
node.props = { ...node.props, [id]: value };
|
|
|
|
graph.save();
|
|
|
|
graph.execute();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<Input id="input-{elementId}" {input} bind:value />
|