feat(node): initial leaf / shape nodes
All checks were successful
🚀 Lint & Test & Deploy / release (pull_request) Successful in 4m1s

This commit is contained in:
2026-02-09 18:32:52 +01:00
parent 235ee5d979
commit 8865b9b032
10 changed files with 88 additions and 18 deletions

View File

@@ -194,7 +194,11 @@ export class GraphState {
if (node?.inputs?.[key] === undefined) continue;
if ('setting' in node.inputs[key]) continue;
if (node.inputs[key].hidden) continue;
if (node.inputs[key].type === 'shape') {
if (
node.inputs[key].type === 'shape'
&& node.inputs[key].external !== true
&& node.inputs[key].internal !== false
) {
height += 20;
continue;
}

View File

@@ -31,11 +31,24 @@
return 0;
}
let value = $state(getDefaultValue());
let value = $state(structuredClone($state.snapshot(getDefaultValue())));
function diffArray(a: number[], b?: number[] | number) {
if (!Array.isArray(b)) return true;
if (Array.isArray(a) !== Array.isArray(b)) return true;
if (a.length !== b.length) return true;
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return true;
}
return false;
}
$effect(() => {
if (value !== undefined && node?.props?.[id] !== value) {
node.props = { ...node.props, [id]: value };
const a = $state.snapshot(value);
const b = $state.snapshot(node?.props?.[id]);
const isDiff = Array.isArray(a) ? diffArray(a, b) : a !== b;
if (value !== undefined && isDiff) {
node.props = { ...node.props, [id]: a };
if (graph) {
graph.save();
graph.execute();

View File

@@ -18,7 +18,8 @@
const inputType = $derived(node?.state?.type?.inputs?.[id]);
const socketId = $derived(`${node.id}-${id}`);
const height = $derived(input.type === 'shape' ? 200 : 100);
const isShape = $derived(input.type === 'shape' && input.external !== true);
const height = $derived(isShape ? 200 : 100);
const graphState = getGraphState();
const graphId = graph?.id;