@foresthubai/workflow-builder 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -661
- package/NOTICE +16 -16
- package/README.md +110 -93
- package/dist/components/ui/command.d.ts +2 -2
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/graph/BaseNode.js +10 -10
- package/dist/graph/reactFlowRegistry.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/toolbars/CanvasTabsToolbar.d.ts +11 -0
- package/dist/toolbars/CanvasTabsToolbar.d.ts.map +1 -0
- package/dist/toolbars/CanvasTabsToolbar.js +101 -0
- package/dist/toolbars/CanvasTabsToolbar.js.map +1 -0
- package/package.json +2 -2
- package/src/BuilderLayout.tsx +345 -345
- package/src/Canvas.tsx +261 -261
- package/src/CanvasEditor.tsx +142 -142
- package/src/CanvasTabsToolbar.tsx +176 -176
- package/src/RightConfigPanel.tsx +266 -266
- package/src/WorkflowBuilder.tsx +412 -412
- package/src/cn.ts +6 -6
- package/src/components/ui/add-button.tsx +39 -39
- package/src/components/ui/alert-dialog.tsx +141 -141
- package/src/components/ui/alert.tsx +59 -59
- package/src/components/ui/badge.tsx +36 -36
- package/src/components/ui/button.tsx +85 -85
- package/src/components/ui/card.tsx +79 -79
- package/src/components/ui/checkbox.tsx +28 -28
- package/src/components/ui/collapsible.tsx +9 -9
- package/src/components/ui/command.tsx +153 -153
- package/src/components/ui/delete-button.tsx +23 -23
- package/src/components/ui/dialog.tsx +125 -125
- package/src/components/ui/dropdown-menu.tsx +198 -198
- package/src/components/ui/input.tsx +55 -55
- package/src/components/ui/label.tsx +24 -24
- package/src/components/ui/readonly-banner.tsx +15 -15
- package/src/components/ui/resizable.tsx +43 -43
- package/src/components/ui/scroll-area.tsx +102 -102
- package/src/components/ui/select.tsx +160 -160
- package/src/components/ui/separator.tsx +29 -29
- package/src/components/ui/switch.tsx +27 -27
- package/src/components/ui/textarea.tsx +51 -51
- package/src/components/ui/toast.tsx +127 -127
- package/src/components/ui/toaster.tsx +33 -33
- package/src/components/ui/toggle-group.tsx +59 -59
- package/src/components/ui/toggle.tsx +43 -43
- package/src/components/ui/tooltip.tsx +32 -32
- package/src/dialogs/NodePickerDialog.tsx +84 -84
- package/src/dialogs/ValidationDialog.tsx +184 -184
- package/src/graph/BaseNode.tsx +557 -557
- package/src/graph/CustomEdge.tsx +185 -185
- package/src/graph/CustomNode.tsx +16 -16
- package/src/graph/FunctionCallNode.tsx +30 -30
- package/src/graph/PortHandle.tsx +189 -189
- package/src/graph/reactFlowRegistry.ts +26 -26
- package/src/hooks/use-toast.ts +125 -125
- package/src/hooks/useAvailableVariables.ts +20 -20
- package/src/hooks/useCanvasHistory.ts +22 -22
- package/src/hooks/useCanvasTabs.ts +168 -168
- package/src/hooks/useFunctionDiagnosticsSync.ts +40 -40
- package/src/hooks/useFunctionRegistry.ts +26 -26
- package/src/hooks/useFunctions.ts +44 -44
- package/src/hooks/useGraph.ts +161 -161
- package/src/hooks/useNodeDefinitions.ts +82 -82
- package/src/hooks/useParamErrors.ts +26 -26
- package/src/hooks/useResolvedTheme.ts +30 -30
- package/src/hooks/useResourceDiagnosticsSync.ts +58 -58
- package/src/hooks/useSuppressThemeTransition.ts +79 -79
- package/src/hooks/useWorkflowSerialization.ts +127 -127
- package/src/i18n/index.ts +53 -53
- package/src/i18n/locales/de.json +501 -501
- package/src/i18n/locales/en.json +557 -557
- package/src/index.ts +27 -27
- package/src/inputs/ExpressionInput.tsx +297 -297
- package/src/inputs/ParameterEditor.tsx +515 -515
- package/src/inputs/PortSection.tsx +144 -144
- package/src/panels/BuilderSidebar.tsx +301 -301
- package/src/panels/ChannelConfigPanel.tsx +49 -49
- package/src/panels/ChannelsPanel.tsx +28 -28
- package/src/panels/DebugConsolePanel.tsx +73 -73
- package/src/panels/DebugContextPanel.tsx +77 -77
- package/src/panels/DebugExternalIOPanel.tsx +180 -180
- package/src/panels/DiagnosticsPanel.tsx +170 -170
- package/src/panels/EdgeConfigPanel.tsx +104 -104
- package/src/panels/FunctionConfigPanel.tsx +179 -179
- package/src/panels/FunctionListPanel.tsx +45 -45
- package/src/panels/MemoryConfigPanel.tsx +55 -55
- package/src/panels/MemoryPanel.tsx +40 -40
- package/src/panels/ModelConfigPanel.tsx +41 -41
- package/src/panels/ModelsPanel.tsx +36 -36
- package/src/panels/NodeConfigPanel.tsx +630 -630
- package/src/panels/NodeLibrary.tsx +288 -288
- package/src/panels/ResourceConfigPanel.tsx +132 -132
- package/src/panels/ResourceListPanel.tsx +113 -113
- package/src/panels/VariableConfigPanel.tsx +161 -161
- package/src/panels/VariablesPanel.tsx +145 -145
- package/src/stores/canvasStore.test.ts +44 -44
- package/src/stores/canvasStore.ts +245 -245
- package/src/stores/debugStore.ts +74 -74
- package/src/stores/diagnosticsStore.ts +130 -130
- package/src/stores/editorStore.ts +202 -202
- package/src/styles/index.css +526 -526
- package/src/utils/categoryConstants.ts +26 -26
- package/src/utils/channelOperations.ts +86 -86
- package/src/utils/connectionRules.ts +137 -137
- package/src/utils/functionOperations.ts +179 -179
- package/src/utils/graphOperations.ts +550 -550
- package/src/utils/history.ts +207 -207
- package/src/utils/memoryOperations.ts +57 -57
- package/src/utils/migrateFunctionNodes.ts +107 -107
- package/src/utils/modelOperations.ts +55 -55
- package/src/utils/paramDisplay.ts +71 -71
- package/src/utils/resourceHelpers.ts +32 -32
- package/src/utils/translation.ts +28 -28
- package/src/utils/variableOperations.ts +75 -75
- package/tailwind-preset.ts +166 -166
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
import { Button } from "../components/ui/button";
|
|
2
|
-
import { Input } from "../components/ui/input";
|
|
3
|
-
import { Label } from "../components/ui/label";
|
|
4
|
-
import { Switch } from "../components/ui/switch";
|
|
5
|
-
import { Loader2, Play } from "lucide-react";
|
|
6
|
-
import { useCallback, useMemo, useState } from "react";
|
|
7
|
-
import { useTranslation } from "react-i18next";
|
|
8
|
-
import { NodeCategory, getInput, type NodeData, type ExternalInput } from "@foresthubai/workflow-core/node";
|
|
9
|
-
import { getOrCreateCanvasStore } from "../stores/canvasStore";
|
|
10
|
-
import { useDebugStore, type DebugSessionPhase } from "../stores/debugStore";
|
|
11
|
-
|
|
12
|
-
interface DebugExternalIOPanelProps {
|
|
13
|
-
canvasId: string;
|
|
14
|
-
onStep: (nodeId?: string) => void;
|
|
15
|
-
getNodeCategory: (node: NodeData) => NodeCategory | undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const DebugExternalIOPanel = ({ canvasId, onStep, getNodeCategory }: DebugExternalIOPanelProps) => {
|
|
19
|
-
const { t } = useTranslation();
|
|
20
|
-
const phase = useDebugStore((s) => s.phase);
|
|
21
|
-
|
|
22
|
-
const cursorNodeId = getCursorNodeId(phase);
|
|
23
|
-
const canvasStore = getOrCreateCanvasStore(canvasId);
|
|
24
|
-
const cursorNode = canvasStore((s) =>
|
|
25
|
-
cursorNodeId ? (s.nodes.find((n) => n.id === cursorNodeId)?.data ?? null) : null,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const requirements = useMemo(() => (cursorNode ? getInput(cursorNode as NodeData) : []), [cursorNode]);
|
|
29
|
-
|
|
30
|
-
const isTrigger = cursorNode ? getNodeCategory(cursorNode as NodeData) === NodeCategory.Trigger : false;
|
|
31
|
-
const isStepping = phase.status === "stepping";
|
|
32
|
-
const canStep = phase.status === "paused" || (phase.status === "idle" && cursorNodeId);
|
|
33
|
-
|
|
34
|
-
// Local state for mock values
|
|
35
|
-
const [gpioValues, setGpioValues] = useState<Record<string, number>>({});
|
|
36
|
-
const [serialValues, setSerialValues] = useState<string[]>([""]);
|
|
37
|
-
|
|
38
|
-
const handleStep = useCallback(() => {
|
|
39
|
-
// External-state injection (gpio/serial) is part of the not-yet-implemented
|
|
40
|
-
// debug contract (DebugExternalState). For now we only signal which node to
|
|
41
|
-
// step; the collected input values below are not yet wired to the engine.
|
|
42
|
-
onStep(cursorNodeId ?? undefined);
|
|
43
|
-
}, [cursorNodeId, onStep]);
|
|
44
|
-
|
|
45
|
-
if (!cursorNodeId) {
|
|
46
|
-
return <div className="text-sm text-muted-foreground text-center py-4">{t("debug.selectNode")}</div>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (isTrigger) {
|
|
50
|
-
return (
|
|
51
|
-
<div className="space-y-3">
|
|
52
|
-
<div className="text-sm text-muted-foreground bg-muted/50 rounded px-3 py-2">
|
|
53
|
-
{t("debug.triggerNotSteppable")}
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<div className="space-y-4">
|
|
61
|
-
{/* Node label */}
|
|
62
|
-
<div className="text-sm font-medium">
|
|
63
|
-
{(cursorNode as NodeData)?.label || (cursorNode as NodeData)?.type}
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
{/* Requirements */}
|
|
67
|
-
{requirements.length === 0 ? (
|
|
68
|
-
<div className="text-xs text-muted-foreground">{t("debug.noInputsNeeded")}</div>
|
|
69
|
-
) : (
|
|
70
|
-
<div className="space-y-3">
|
|
71
|
-
{requirements.map((req, i) => (
|
|
72
|
-
<ExternalInputField
|
|
73
|
-
key={i}
|
|
74
|
-
requirement={req}
|
|
75
|
-
gpioValues={gpioValues}
|
|
76
|
-
setGpioValues={setGpioValues}
|
|
77
|
-
serialValues={serialValues}
|
|
78
|
-
setSerialValues={setSerialValues}
|
|
79
|
-
serialIndex={requirements.slice(0, i).filter((r) => r.kind === "serial").length}
|
|
80
|
-
/>
|
|
81
|
-
))}
|
|
82
|
-
</div>
|
|
83
|
-
)}
|
|
84
|
-
|
|
85
|
-
{/* Step button */}
|
|
86
|
-
<Button className="w-full gap-2" onClick={handleStep} disabled={!canStep || isStepping}>
|
|
87
|
-
{isStepping ? (
|
|
88
|
-
<>
|
|
89
|
-
<Loader2 className="w-4 h-4 animate-spin" />
|
|
90
|
-
{t("debug.stepping")}
|
|
91
|
-
</>
|
|
92
|
-
) : (
|
|
93
|
-
<>
|
|
94
|
-
<Play className="w-4 h-4" />
|
|
95
|
-
{t("debug.step")}
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
98
|
-
</Button>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// ---------------------------------------------------------------------------
|
|
104
|
-
// Sub-components
|
|
105
|
-
// ---------------------------------------------------------------------------
|
|
106
|
-
|
|
107
|
-
function ExternalInputField({
|
|
108
|
-
requirement,
|
|
109
|
-
gpioValues,
|
|
110
|
-
setGpioValues,
|
|
111
|
-
serialValues,
|
|
112
|
-
setSerialValues,
|
|
113
|
-
serialIndex,
|
|
114
|
-
}: {
|
|
115
|
-
requirement: ExternalInput;
|
|
116
|
-
gpioValues: Record<string, number>;
|
|
117
|
-
setGpioValues: React.Dispatch<React.SetStateAction<Record<string, number>>>;
|
|
118
|
-
serialValues: string[];
|
|
119
|
-
setSerialValues: React.Dispatch<React.SetStateAction<string[]>>;
|
|
120
|
-
serialIndex: number;
|
|
121
|
-
}) {
|
|
122
|
-
const { t } = useTranslation();
|
|
123
|
-
|
|
124
|
-
if (requirement.kind === "gpio") {
|
|
125
|
-
const pinKey = String(requirement.pinReference ?? "?");
|
|
126
|
-
const value = gpioValues[pinKey] ?? 0;
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<div className="space-y-1">
|
|
130
|
-
<Label className="text-xs font-medium">
|
|
131
|
-
{t("debug.gpioPin", { pin: requirement.pinReference ?? "?" })}
|
|
132
|
-
<span className="text-muted-foreground ml-1">({requirement.dataType})</span>
|
|
133
|
-
</Label>
|
|
134
|
-
{requirement.dataType === "bool" ? (
|
|
135
|
-
<Switch
|
|
136
|
-
checked={!!value}
|
|
137
|
-
onCheckedChange={(checked) => setGpioValues((prev) => ({ ...prev, [pinKey]: checked ? 1 : 0 }))}
|
|
138
|
-
/>
|
|
139
|
-
) : (
|
|
140
|
-
<Input
|
|
141
|
-
type="number"
|
|
142
|
-
value={value}
|
|
143
|
-
onChange={(e) => setGpioValues((prev) => ({ ...prev, [pinKey]: parseInt(e.target.value) || 0 }))}
|
|
144
|
-
className="h-8 font-mono text-sm"
|
|
145
|
-
min={0}
|
|
146
|
-
max={4095}
|
|
147
|
-
/>
|
|
148
|
-
)}
|
|
149
|
-
</div>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Serial input
|
|
154
|
-
return (
|
|
155
|
-
<div className="space-y-1">
|
|
156
|
-
<Label className="text-xs font-medium">{t("debug.serialInput")}</Label>
|
|
157
|
-
<Input
|
|
158
|
-
value={serialValues[serialIndex] ?? ""}
|
|
159
|
-
onChange={(e) => {
|
|
160
|
-
setSerialValues((prev) => {
|
|
161
|
-
const next = [...prev];
|
|
162
|
-
next[serialIndex] = e.target.value;
|
|
163
|
-
return next;
|
|
164
|
-
});
|
|
165
|
-
}}
|
|
166
|
-
placeholder={t("debug.serialPlaceholder")}
|
|
167
|
-
className="h-8 font-mono text-sm"
|
|
168
|
-
/>
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// ---------------------------------------------------------------------------
|
|
174
|
-
// Helpers
|
|
175
|
-
// ---------------------------------------------------------------------------
|
|
176
|
-
|
|
177
|
-
function getCursorNodeId(phase: DebugSessionPhase): string | null {
|
|
178
|
-
if (phase.status === "paused" || phase.status === "stepping") return phase.cursorNodeId;
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
1
|
+
import { Button } from "../components/ui/button";
|
|
2
|
+
import { Input } from "../components/ui/input";
|
|
3
|
+
import { Label } from "../components/ui/label";
|
|
4
|
+
import { Switch } from "../components/ui/switch";
|
|
5
|
+
import { Loader2, Play } from "lucide-react";
|
|
6
|
+
import { useCallback, useMemo, useState } from "react";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
8
|
+
import { NodeCategory, getInput, type NodeData, type ExternalInput } from "@foresthubai/workflow-core/node";
|
|
9
|
+
import { getOrCreateCanvasStore } from "../stores/canvasStore";
|
|
10
|
+
import { useDebugStore, type DebugSessionPhase } from "../stores/debugStore";
|
|
11
|
+
|
|
12
|
+
interface DebugExternalIOPanelProps {
|
|
13
|
+
canvasId: string;
|
|
14
|
+
onStep: (nodeId?: string) => void;
|
|
15
|
+
getNodeCategory: (node: NodeData) => NodeCategory | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const DebugExternalIOPanel = ({ canvasId, onStep, getNodeCategory }: DebugExternalIOPanelProps) => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const phase = useDebugStore((s) => s.phase);
|
|
21
|
+
|
|
22
|
+
const cursorNodeId = getCursorNodeId(phase);
|
|
23
|
+
const canvasStore = getOrCreateCanvasStore(canvasId);
|
|
24
|
+
const cursorNode = canvasStore((s) =>
|
|
25
|
+
cursorNodeId ? (s.nodes.find((n) => n.id === cursorNodeId)?.data ?? null) : null,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const requirements = useMemo(() => (cursorNode ? getInput(cursorNode as NodeData) : []), [cursorNode]);
|
|
29
|
+
|
|
30
|
+
const isTrigger = cursorNode ? getNodeCategory(cursorNode as NodeData) === NodeCategory.Trigger : false;
|
|
31
|
+
const isStepping = phase.status === "stepping";
|
|
32
|
+
const canStep = phase.status === "paused" || (phase.status === "idle" && cursorNodeId);
|
|
33
|
+
|
|
34
|
+
// Local state for mock values
|
|
35
|
+
const [gpioValues, setGpioValues] = useState<Record<string, number>>({});
|
|
36
|
+
const [serialValues, setSerialValues] = useState<string[]>([""]);
|
|
37
|
+
|
|
38
|
+
const handleStep = useCallback(() => {
|
|
39
|
+
// External-state injection (gpio/serial) is part of the not-yet-implemented
|
|
40
|
+
// debug contract (DebugExternalState). For now we only signal which node to
|
|
41
|
+
// step; the collected input values below are not yet wired to the engine.
|
|
42
|
+
onStep(cursorNodeId ?? undefined);
|
|
43
|
+
}, [cursorNodeId, onStep]);
|
|
44
|
+
|
|
45
|
+
if (!cursorNodeId) {
|
|
46
|
+
return <div className="text-sm text-muted-foreground text-center py-4">{t("debug.selectNode")}</div>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isTrigger) {
|
|
50
|
+
return (
|
|
51
|
+
<div className="space-y-3">
|
|
52
|
+
<div className="text-sm text-muted-foreground bg-muted/50 rounded px-3 py-2">
|
|
53
|
+
{t("debug.triggerNotSteppable")}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className="space-y-4">
|
|
61
|
+
{/* Node label */}
|
|
62
|
+
<div className="text-sm font-medium">
|
|
63
|
+
{(cursorNode as NodeData)?.label || (cursorNode as NodeData)?.type}
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
{/* Requirements */}
|
|
67
|
+
{requirements.length === 0 ? (
|
|
68
|
+
<div className="text-xs text-muted-foreground">{t("debug.noInputsNeeded")}</div>
|
|
69
|
+
) : (
|
|
70
|
+
<div className="space-y-3">
|
|
71
|
+
{requirements.map((req, i) => (
|
|
72
|
+
<ExternalInputField
|
|
73
|
+
key={i}
|
|
74
|
+
requirement={req}
|
|
75
|
+
gpioValues={gpioValues}
|
|
76
|
+
setGpioValues={setGpioValues}
|
|
77
|
+
serialValues={serialValues}
|
|
78
|
+
setSerialValues={setSerialValues}
|
|
79
|
+
serialIndex={requirements.slice(0, i).filter((r) => r.kind === "serial").length}
|
|
80
|
+
/>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
{/* Step button */}
|
|
86
|
+
<Button className="w-full gap-2" onClick={handleStep} disabled={!canStep || isStepping}>
|
|
87
|
+
{isStepping ? (
|
|
88
|
+
<>
|
|
89
|
+
<Loader2 className="w-4 h-4 animate-spin" />
|
|
90
|
+
{t("debug.stepping")}
|
|
91
|
+
</>
|
|
92
|
+
) : (
|
|
93
|
+
<>
|
|
94
|
+
<Play className="w-4 h-4" />
|
|
95
|
+
{t("debug.step")}
|
|
96
|
+
</>
|
|
97
|
+
)}
|
|
98
|
+
</Button>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Sub-components
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
function ExternalInputField({
|
|
108
|
+
requirement,
|
|
109
|
+
gpioValues,
|
|
110
|
+
setGpioValues,
|
|
111
|
+
serialValues,
|
|
112
|
+
setSerialValues,
|
|
113
|
+
serialIndex,
|
|
114
|
+
}: {
|
|
115
|
+
requirement: ExternalInput;
|
|
116
|
+
gpioValues: Record<string, number>;
|
|
117
|
+
setGpioValues: React.Dispatch<React.SetStateAction<Record<string, number>>>;
|
|
118
|
+
serialValues: string[];
|
|
119
|
+
setSerialValues: React.Dispatch<React.SetStateAction<string[]>>;
|
|
120
|
+
serialIndex: number;
|
|
121
|
+
}) {
|
|
122
|
+
const { t } = useTranslation();
|
|
123
|
+
|
|
124
|
+
if (requirement.kind === "gpio") {
|
|
125
|
+
const pinKey = String(requirement.pinReference ?? "?");
|
|
126
|
+
const value = gpioValues[pinKey] ?? 0;
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div className="space-y-1">
|
|
130
|
+
<Label className="text-xs font-medium">
|
|
131
|
+
{t("debug.gpioPin", { pin: requirement.pinReference ?? "?" })}
|
|
132
|
+
<span className="text-muted-foreground ml-1">({requirement.dataType})</span>
|
|
133
|
+
</Label>
|
|
134
|
+
{requirement.dataType === "bool" ? (
|
|
135
|
+
<Switch
|
|
136
|
+
checked={!!value}
|
|
137
|
+
onCheckedChange={(checked) => setGpioValues((prev) => ({ ...prev, [pinKey]: checked ? 1 : 0 }))}
|
|
138
|
+
/>
|
|
139
|
+
) : (
|
|
140
|
+
<Input
|
|
141
|
+
type="number"
|
|
142
|
+
value={value}
|
|
143
|
+
onChange={(e) => setGpioValues((prev) => ({ ...prev, [pinKey]: parseInt(e.target.value) || 0 }))}
|
|
144
|
+
className="h-8 font-mono text-sm"
|
|
145
|
+
min={0}
|
|
146
|
+
max={4095}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Serial input
|
|
154
|
+
return (
|
|
155
|
+
<div className="space-y-1">
|
|
156
|
+
<Label className="text-xs font-medium">{t("debug.serialInput")}</Label>
|
|
157
|
+
<Input
|
|
158
|
+
value={serialValues[serialIndex] ?? ""}
|
|
159
|
+
onChange={(e) => {
|
|
160
|
+
setSerialValues((prev) => {
|
|
161
|
+
const next = [...prev];
|
|
162
|
+
next[serialIndex] = e.target.value;
|
|
163
|
+
return next;
|
|
164
|
+
});
|
|
165
|
+
}}
|
|
166
|
+
placeholder={t("debug.serialPlaceholder")}
|
|
167
|
+
className="h-8 font-mono text-sm"
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Helpers
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
|
|
177
|
+
function getCursorNodeId(phase: DebugSessionPhase): string | null {
|
|
178
|
+
if (phase.status === "paused" || phase.status === "stepping") return phase.cursorNodeId;
|
|
179
|
+
return null;
|
|
180
|
+
}
|