Skip to content

Commit c16f2de

Browse files
committed
Render unknown block types as warning-colored placeholders with dashed outline
1 parent a71d376 commit c16f2de

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/lib/components/nodes/BaseNode.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@
461461
class:preview-hovered={showPreview}
462462
class:subsystem-type={isSubsystemType}
463463
class:show-labels={showPortLabels}
464+
class:missing-type={!typeDef && data.type !== NODE_TYPES.SUBSYSTEM && data.type !== NODE_TYPES.INTERFACE}
464465
data-rotation={rotation}
465466
style="width: {nodeDimensions.width}px; height: {nodeDimensions.height}px; --node-color: {nodeColor};"
466467
ondblclick={handleDoubleClick}
@@ -520,6 +521,8 @@
520521
{/if}
521522
{#if typeDef}
522523
<span class="node-type">{typeDef.name}</span>
524+
{:else if data.type !== NODE_TYPES.SUBSYSTEM && data.type !== NODE_TYPES.INTERFACE}
525+
<span class="node-type missing">{data.type} (missing)</span>
523526
{/if}
524527
</div>
525528

@@ -758,6 +761,22 @@
758761
margin-top: 2px;
759762
}
760763
764+
.node-type.missing {
765+
color: var(--warning);
766+
}
767+
768+
/* Visual marker for nodes whose block type isn't registered (e.g. file
769+
loaded with a toolbox dependency the user hasn't installed). */
770+
.node.missing-type {
771+
--node-color: var(--warning);
772+
opacity: 0.85;
773+
}
774+
775+
.node.missing-type .node-content,
776+
.node.missing-type :global(.node-shape) {
777+
border-style: dashed;
778+
}
779+
761780
/* Pinned parameters - rectangular, clipped by node-clip's overflow:hidden */
762781
.pinned-params {
763782
display: flex;

0 commit comments

Comments
 (0)