feat: node store interface

This commit is contained in:
2024-04-20 02:41:18 +02:00
parent 1d203c687c
commit 78c88e4d66
51 changed files with 772 additions and 552 deletions

View File

@@ -20,8 +20,8 @@
const socketId = `${node.id}-${id}`;
const graph = getGraphManager();
const graphId = graph.id;
const inputSockets = graph.inputSockets;
const graphId = graph?.id;
const inputSockets = graph?.inputSockets;
const elementId = `input-${Math.random().toString(36).substring(7)}`;
@@ -34,10 +34,10 @@
function handleMouseDown(ev: MouseEvent) {
ev.preventDefault();
ev.stopPropagation();
setDownSocket({
setDownSocket?.({
node,
index: id,
position: getSocketPosition(node, id),
position: getSocketPosition?.(node, id),
});
}
@@ -76,7 +76,7 @@
class:disabled={$possibleSocketIds && !$possibleSocketIds.has(socketId)}
>
{#key id && graphId}
<div class="content" class:disabled={$inputSockets.has(socketId)}>
<div class="content" class:disabled={$inputSockets?.has(socketId)}>
{#if inputType.label !== false}
<label for={elementId}>{input.label || id}</label>
{/if}