Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/components/CustomEdge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
type EdgeValidationStatus = {
hasError: boolean;
hasWarning: boolean;
isDead: boolean;
};

let { id, sourceX, sourceY, targetX, targetY, selected }: EdgeProps = $props();
Expand All @@ -17,13 +18,16 @@

const hasError = $derived(!!validationStatus?.hasError);
const hasWarning = $derived(!hasError && !!validationStatus?.hasWarning);
const isDead = $derived(!!validationStatus?.isDead);

const edgeStyle = $derived(
hasError
? 'stroke: #ef4444; stroke-width: 2px;'
: hasWarning
? 'stroke: #f59e0b; stroke-width: 2px;'
: undefined
: isDead
? 'stroke: #9ca3af; stroke-width: 1.5px; stroke-dasharray: 6 4; opacity: 0.5;'
: undefined
);

const [edgePath] = $derived(
Expand Down
20 changes: 18 additions & 2 deletions src/lib/components/NodeUI.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
validationStatus?: {
hasError: boolean;
hasWarning: boolean;
isDead: boolean;
issues: Issue[];
} | null;
}>();
Expand Down Expand Up @@ -51,6 +52,7 @@
const hasWarning = $derived(!hasError && !!validationStatus?.hasWarning);
// Normalise issues so the template never sees `undefined`
const issues = $derived(validationStatus?.issues ?? []);
const isDead = $derived(validationStatus ? !!validationStatus?.isDead : true);
</script>

{#if isEndNode}
Expand All @@ -64,14 +66,19 @@
isConnectable={true}
/>
{/each}
<div class="node-container circular" class:error={hasError} class:warning={hasWarning}>
<div
class="node-container circular"
class:error={hasError}
class:warning={hasWarning}
class:dead={isDead}
>
<span class="circular-label">
{definition.label}
</span>
</div>
</div>
{:else}
<div class="node-container" class:error={hasError} class:warning={hasWarning}>
<div class="node-container" class:error={hasError} class:warning={hasWarning} class:dead={isDead}>
{#each inputIndices as i (i)}
{@const isMixer = definition.category === 'mixer'}
{@const leftOffset = isMixer ? (i === 0 ? 30 : 150) : 90}
Expand Down Expand Up @@ -357,4 +364,13 @@
.validation-messages li.message-warning {
color: #92400e;
}

.node-container.dead,
.node-container.circular.dead {
opacity: 0.35;
filter: grayscale(0.6);
border-style: dashed;
border-color: #9ca3af; /* neutral grey */
box-shadow: none;
}
</style>