Title a collapsed Variables or Properties node by what it does
Collapsed, the node reads "Set 2 variables", "Get width" or "No properties"; expanded it is always "Variables" / "Properties". The Properties node shows its object type (and behavior) as a line under the title instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
58f19a3451
commit
0376ae175d
11 files changed
+182
-69
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { portDefOf, VARIABLES } from '../../nested';
|
||||
import { collapsedTitle, portDefOf, VARIABLES } from '../../nested';
|
||||
import { type NodeDef, withInlineDefault } from '../../NodeRegistry';
|
||||
import { writeTyped } from '../../values';
|
||||
import { exec } from '../shared';
|
||||
@@ -21,9 +21,8 @@ export const Variables: NodeDef = {
|
||||
declaredPort: (port) => withInlineDefault(portDefOf(port)),
|
||||
derivePorts: ({ node }) => {
|
||||
const ports = node.ports ?? [];
|
||||
const only = ports.length === 1 ? ports[0]?.key : undefined;
|
||||
const shape = ports.some((p) => p.write) ? { inputs: [exec()], outputs: [exec()] } : {};
|
||||
return only ? { ...shape, label: only } : shape;
|
||||
return node.collapsed ? { ...shape, label: collapsedTitle(ports, 'variables') } : shape;
|
||||
},
|
||||
read: (ctx) => ctx.variables,
|
||||
run: (ctx, inputs, _params, def) => {
|
||||
|
||||
Reference in new issue
Block a user