fix: reduce handle size and remove overlapping labels
- Flow handles: 12px → 8px (rounded square) - Data handles: 10px → 6px (circle) - Border: 2px → 1.5px with softer opacity - Removed label text from handles (color indicates type) - Removed wrapper div — handles render directly via React Flow
This commit is contained in:
parent
06fb1ede75
commit
8ec0c194ff
2 changed files with 13 additions and 42 deletions
|
|
@ -5,7 +5,7 @@ import { NODE_SOCKETS } from "./types";
|
||||||
|
|
||||||
interface NodeHandlesProps {
|
interface NodeHandlesProps {
|
||||||
nodeType: string;
|
nodeType: string;
|
||||||
dynamicOutputs?: Array<{ id: string; label: string }>;
|
dynamicOutputs?: Array<{ id: string }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NodeHandles({ nodeType, dynamicOutputs }: NodeHandlesProps) {
|
export function NodeHandles({ nodeType, dynamicOutputs }: NodeHandlesProps) {
|
||||||
|
|
@ -28,7 +28,6 @@ export function NodeHandles({ nodeType, dynamicOutputs }: NodeHandlesProps) {
|
||||||
key={socket.id}
|
key={socket.id}
|
||||||
id={socket.id}
|
id={socket.id}
|
||||||
socketType={socket.type}
|
socketType={socket.type}
|
||||||
label={socket.label}
|
|
||||||
isInput={true}
|
isInput={true}
|
||||||
style={{ top: `${topPercent}%` }}
|
style={{ top: `${topPercent}%` }}
|
||||||
/>
|
/>
|
||||||
|
|
@ -41,7 +40,6 @@ export function NodeHandles({ nodeType, dynamicOutputs }: NodeHandlesProps) {
|
||||||
key={socket.id}
|
key={socket.id}
|
||||||
id={socket.id}
|
id={socket.id}
|
||||||
socketType={socket.type}
|
socketType={socket.type}
|
||||||
label={socket.label}
|
|
||||||
isInput={false}
|
isInput={false}
|
||||||
style={{ top: `${topPercent}%` }}
|
style={{ top: `${topPercent}%` }}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,32 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Handle, Position, type HandleProps } from "@xyflow/react";
|
import { Handle, Position } from "@xyflow/react";
|
||||||
import { SOCKET_COLORS, type SocketType } from "./types";
|
import { SOCKET_COLORS, type SocketType } from "./types";
|
||||||
|
|
||||||
interface TypedHandleProps {
|
interface TypedHandleProps {
|
||||||
id: string;
|
id: string;
|
||||||
socketType: SocketType;
|
socketType: SocketType;
|
||||||
label?: string;
|
|
||||||
isInput: boolean;
|
isInput: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TypedHandle({
|
export function TypedHandle({ id, socketType, isInput, style }: TypedHandleProps) {
|
||||||
id,
|
|
||||||
socketType,
|
|
||||||
label,
|
|
||||||
isInput,
|
|
||||||
style,
|
|
||||||
}: TypedHandleProps) {
|
|
||||||
const color = SOCKET_COLORS[socketType];
|
const color = SOCKET_COLORS[socketType];
|
||||||
const isFlow = socketType === "flow";
|
const isFlow = socketType === "flow";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
|
||||||
className="absolute flex items-center gap-1.5"
|
|
||||||
style={{
|
|
||||||
[isInput ? "left" : "right"]: -6,
|
|
||||||
top: "50%",
|
|
||||||
transform: "translateY(-50%)",
|
|
||||||
...style,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Handle
|
<Handle
|
||||||
type={isInput ? "target" : "source"}
|
type={isInput ? "target" : "source"}
|
||||||
position={isInput ? Position.Left : Position.Right}
|
position={isInput ? Position.Left : Position.Right}
|
||||||
id={id}
|
id={id}
|
||||||
style={{
|
style={{
|
||||||
background: color,
|
background: color,
|
||||||
width: isFlow ? 12 : 10,
|
width: isFlow ? 8 : 6,
|
||||||
height: isFlow ? 12 : 10,
|
height: isFlow ? 8 : 6,
|
||||||
borderRadius: isFlow ? 2 : "50%",
|
borderRadius: isFlow ? 2 : "50%",
|
||||||
border: `2px solid ${color}40`,
|
border: `1.5px solid ${color}60`,
|
||||||
|
...style,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{label && (
|
|
||||||
<span
|
|
||||||
className="text-[9px] font-mono leading-none whitespace-nowrap pointer-events-none"
|
|
||||||
style={{
|
|
||||||
color: `${color}cc`,
|
|
||||||
[isInput ? "paddingLeft" : "paddingRight"]: 2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue