diff --git a/studio/src/renderer/src/editor/nodeLayout.test.ts b/studio/src/renderer/src/editor/nodeLayout.test.ts index e13463f28..07fd4fad0 100644 --- a/studio/src/renderer/src/editor/nodeLayout.test.ts +++ b/studio/src/renderer/src/editor/nodeLayout.test.ts @@ -49,7 +49,7 @@ describe('layoutNodes', () => { expect(placedAt(layout, ['parts', 1]).y).toBeGreaterThan(placedAt(layout, ['parts', 0]).y + 300) }) - it('puts a node where it was dragged, and marks which nodes have ports', () => { + it('puts a node where it was dragged, and marks which nodes have sockets', () => { const layout = layoutNodes([node([], [node(['parts', 0])])], height, new Map([[JSON.stringify(['parts', 0]), { x: 500, y: 44 }]])) const part = placedAt(layout, ['parts', 0]) diff --git a/studio/src/renderer/src/editor/nodeLayout.ts b/studio/src/renderer/src/editor/nodeLayout.ts index ba78d9b13..5e2ba68a3 100644 --- a/studio/src/renderer/src/editor/nodeLayout.ts +++ b/studio/src/renderer/src/editor/nodeLayout.ts @@ -19,9 +19,9 @@ export interface PlacedNode { x: number y: number height: number - /** Whether it grows from another node, so it has an input port. */ + /** Whether it grows from another node, so it has an input socket. */ grown: boolean - /** Whether other nodes grow from it, so it has an output port. */ + /** Whether other nodes grow from it, so it has an output socket. */ growing: boolean } diff --git a/studio/src/renderer/src/studio/NodeBox.tsx b/studio/src/renderer/src/studio/NodeBox.tsx index 928510c1d..3b65ab23b 100644 --- a/studio/src/renderer/src/studio/NodeBox.tsx +++ b/studio/src/renderer/src/studio/NodeBox.tsx @@ -6,9 +6,9 @@ import { NODE_HEADER, NODE_STRIPE, type NodeRows } from '../editor/nodeRows' import { colorOfKind, colorOfRole } from './nodeColors' import { NodeRowView } from './NodeRows' -/** Where a node's ports sit below its top: level with the middle of its header. */ -export const PORT_TOP = NODE_STRIPE + NODE_HEADER / 2 -const PORT_SIZE = 9 +/** Where a node's sockets sit below its top: level with the middle of its header. */ +export const SOCKET_TOP = NODE_STRIPE + NODE_HEADER / 2 +const SOCKET_SIZE = 9 const CHIP_FILL_ALPHA = '47' interface NodeBoxProps { @@ -25,8 +25,8 @@ interface NodeBoxProps { /** * One node as the editor draws it: a stripe in the colour of its kind, a header with its title and roles, and a row - * per setting, edited in place. A part has an input port on its left, a ring to drag when it can grow elsewhere; a - * node others grow from has an output port on its right. + * per setting, edited in place. A part has an input socket on its left, a ring to drag when it can grow elsewhere; a + * node others grow from has an output socket on its right. */ export const NodeBox = memo(function NodeBox({ placed, rows, selected, dropTarget, offset, locked }: NodeBoxProps): React.JSX.Element { const { node } = placed @@ -47,8 +47,8 @@ export const NodeBox = memo(function NodeBox({ placed, rows, selected, dropTarge {rows.rows.map((row) => ( ))} - {placed.grown && } - {placed.growing && } + {placed.grown && } + {placed.growing && } ) }) @@ -76,20 +76,20 @@ function RoleChip({ role }: { role: string }): React.JSX.Element { } // A part that can grow elsewhere has a ring for an input, a handle to drag onto the node it should grow from. -function InputPort({ handle }: { handle: boolean }): React.JSX.Element { +function InputSocket({ handle }: { handle: boolean }): React.JSX.Element { return ( ) } -function portStyle(side: 'left' | 'right'): React.CSSProperties { - return { [side]: -PORT_SIZE / 2, top: PORT_TOP - PORT_SIZE / 2, width: PORT_SIZE, height: PORT_SIZE } +function socketStyle(side: 'left' | 'right'): React.CSSProperties { + return { [side]: -SOCKET_SIZE / 2, top: SOCKET_TOP - SOCKET_SIZE / 2, width: SOCKET_SIZE, height: SOCKET_SIZE } } diff --git a/studio/src/renderer/src/studio/NodeCanvas.tsx b/studio/src/renderer/src/studio/NodeCanvas.tsx index 9a2fd2461..d25e4ee7a 100644 --- a/studio/src/renderer/src/studio/NodeCanvas.tsx +++ b/studio/src/renderer/src/studio/NodeCanvas.tsx @@ -98,7 +98,7 @@ export function NodeCanvas({ roots, types, values, file, selectedId, locked, sug return } event.currentTarget.setPointerCapture(event.pointerId) - if (target.closest('[data-port="regrow"]') !== null) { + if (target.closest('[data-socket="regrow"]') !== null) { setGesture({ kind: 'regrowing', placed, pointer: view.graphPoint(event.clientX, event.clientY), target: null }) } else { setGesture({ kind: 'moving', placed, start: { x: event.clientX, y: event.clientY }, moved: false, offset: { x: 0, y: 0 } }) diff --git a/studio/src/renderer/src/studio/NodeWires.tsx b/studio/src/renderer/src/studio/NodeWires.tsx index c07bfd1ec..c2d924a5d 100644 --- a/studio/src/renderer/src/studio/NodeWires.tsx +++ b/studio/src/renderer/src/studio/NodeWires.tsx @@ -2,7 +2,7 @@ import { memo } from 'react' import { cn } from '@/lib/utils' import { NODE_WIDTH, type PlacedNode, type PlacedWire, type Point } from '../editor/nodeLayout' import { colorOfKind } from './nodeColors' -import { PORT_TOP } from './NodeBox' +import { SOCKET_TOP } from './NodeBox' /** The wire to a part placed once per copy, such as a branch of branches, rather than once. */ export const EACH_COPY_WIRE = 'each copy' @@ -41,7 +41,7 @@ export const NodeWires = memo(function NodeWires({ wires, selectedId, moved, reg return ( ${to.id}`} - d={curve({ x: start.x + NODE_WIDTH, y: start.y + PORT_TOP }, { x: end.x, y: end.y + PORT_TOP })} + d={curve({ x: start.x + NODE_WIDTH, y: start.y + SOCKET_TOP }, { x: end.x, y: end.y + SOCKET_TOP })} className={cn('fill-none', lit ? 'stroke-primary' : !copies && 'stroke-input')} style={copies && !lit ? { stroke: colorOfKind(from.node.kind) } : undefined} strokeWidth={lit ? 2 : 1.5} @@ -52,7 +52,7 @@ export const NodeWires = memo(function NodeWires({ wires, selectedId, moved, reg })} {regrow !== null && (