Clicking a flow input label opens a popover with its declaration and current value, and a way into the flow settings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
@@ -73,6 +73,7 @@ import {
|
||||
import { FIT_VIEW, FIT_VIEW_PANEL, FlowDock } from "./FlowDock"
|
||||
import { FlowNode, type FlowNodeData } from "./FlowNode"
|
||||
import { FlowPanel } from "./FlowPanel"
|
||||
import { InputInspector, type InspectedInput } from "./InputInspector"
|
||||
import { LiveEdge } from "./LiveEdge"
|
||||
import { type Direction, layoutGraph, type NodeShape } from "./layout"
|
||||
import { NodePanel } from "./NodePanel"
|
||||
@@ -293,6 +294,9 @@ function FlowEditorInner({
|
||||
)
|
||||
const [paletteOpen, setPaletteOpen] = useState(false)
|
||||
const [inspected, setInspected] = useState<InspectedEdge | null>(null)
|
||||
const [inspectedInput, setInspectedInput] = useState<InspectedInput | null>(
|
||||
null,
|
||||
)
|
||||
// The edges are derived, so xyflow's own selection would be thrown away on
|
||||
// every rebuild: the ids live here instead and are marked on at render.
|
||||
const [selectedEdges, setSelectedEdges] = useState<ReadonlySet<string>>(
|
||||
@@ -1221,9 +1225,26 @@ function FlowEditorInner({
|
||||
onNodesDelete={(deleted) =>
|
||||
deleteNodes(deleted.filter(isDocumentNode).map((node) => node.id))
|
||||
}
|
||||
onNodeClick={(_event, node) => {
|
||||
onNodeClick={(event, node) => {
|
||||
// An endpoint is somewhere else's: opening its panel here would
|
||||
// offer to edit a node this flow does not contain.
|
||||
// An input is read where it sits; editing it is one press on.
|
||||
const declared = node.id.startsWith("input:")
|
||||
? (flowDoc.inputs ?? []).find(
|
||||
(one) =>
|
||||
`input:${qualify(flowName, one.spec?.name ?? "")}` ===
|
||||
node.id,
|
||||
)
|
||||
: undefined
|
||||
if (declared) {
|
||||
const { left, top, width, height } =
|
||||
event.currentTarget.getBoundingClientRect()
|
||||
setInspectedInput({
|
||||
declared,
|
||||
rect: { left, top, width, height },
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!isDocumentNode(node)) {
|
||||
const wire = edges.find(
|
||||
(edge) => edge.source === node.id || edge.target === node.id,
|
||||
@@ -1244,6 +1265,7 @@ function FlowEditorInner({
|
||||
setFlowPanelOpen(false)
|
||||
setEditorExpanded(false)
|
||||
setInspected(null)
|
||||
setInspectedInput(null)
|
||||
}}
|
||||
onEdgeClick={(event, edge) => {
|
||||
const label = (id: string) => {
|
||||
@@ -1424,6 +1446,17 @@ function FlowEditorInner({
|
||||
onUnbind={unbind}
|
||||
/>
|
||||
|
||||
<InputInspector
|
||||
input={inspectedInput}
|
||||
flow={flowName}
|
||||
onClose={() => setInspectedInput(null)}
|
||||
onEdit={() => {
|
||||
setInspectedInput(null)
|
||||
setSelectedId(null)
|
||||
setFlowPanelOpen(true)
|
||||
}}
|
||||
/>
|
||||
|
||||
<CommandPalette
|
||||
open={paletteOpen}
|
||||
onOpenChange={setPaletteOpen}
|
||||
|
||||
Reference in New Issue
Block a user