feat: migrate most of graph-manager to svelte-5
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 2m44s
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 2m44s
This commit is contained in:
@ -3,23 +3,33 @@
|
||||
import { getGraphManager } from "../graph/context.js";
|
||||
import { Input } from "@nodes/ui";
|
||||
|
||||
export let node: Node;
|
||||
export let input: NodeInput;
|
||||
export let id: string;
|
||||
type Props = {
|
||||
node: Node;
|
||||
input: NodeInput;
|
||||
id: string;
|
||||
elementId?: string;
|
||||
};
|
||||
|
||||
const {
|
||||
node,
|
||||
input,
|
||||
id,
|
||||
elementId = `input-${Math.random().toString(36).substring(7)}`,
|
||||
}: Props = $props();
|
||||
|
||||
const graph = getGraphManager();
|
||||
|
||||
let value = node?.props?.[id] ?? input.value;
|
||||
let value = $state(node?.props?.[id] ?? input.value);
|
||||
|
||||
export let elementId: string = `input-${Math.random().toString(36).substring(7)}`;
|
||||
|
||||
$: if (node?.props?.[id] !== value) {
|
||||
node.props = { ...node.props, [id]: value };
|
||||
if (graph) {
|
||||
graph.save();
|
||||
graph.execute();
|
||||
$effect(() => {
|
||||
if (value !== undefined && node?.props?.[id] !== value) {
|
||||
node.props = { ...node.props, [id]: value };
|
||||
if (graph) {
|
||||
graph.save();
|
||||
graph.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<Input id="input-{elementId}" {input} bind:value />
|
||||
|
Reference in New Issue
Block a user