@simten/ui 0.1.1
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 +176 -0
- package/README.md +41 -0
- package/dist/canvas/CircuitCanvas.d.ts +45 -0
- package/dist/canvas/CircuitCanvas.d.ts.map +1 -0
- package/dist/canvas/CircuitCanvas.js +293 -0
- package/dist/canvas/CircuitCanvas.js.map +1 -0
- package/dist/canvas/ClockControls.d.ts +31 -0
- package/dist/canvas/ClockControls.d.ts.map +1 -0
- package/dist/canvas/ClockControls.js +33 -0
- package/dist/canvas/ClockControls.js.map +1 -0
- package/dist/canvas/CompositeInspectorDialog.d.ts +24 -0
- package/dist/canvas/CompositeInspectorDialog.d.ts.map +1 -0
- package/dist/canvas/CompositeInspectorDialog.js +290 -0
- package/dist/canvas/CompositeInspectorDialog.js.map +1 -0
- package/dist/canvas/dagre-layout.d.ts +40 -0
- package/dist/canvas/dagre-layout.d.ts.map +1 -0
- package/dist/canvas/dagre-layout.js +86 -0
- package/dist/canvas/dagre-layout.js.map +1 -0
- package/dist/canvas/drill-down-view.d.ts +35 -0
- package/dist/canvas/drill-down-view.d.ts.map +1 -0
- package/dist/canvas/drill-down-view.js +134 -0
- package/dist/canvas/drill-down-view.js.map +1 -0
- package/dist/canvas/hooks/useDetectTheme.d.ts +6 -0
- package/dist/canvas/hooks/useDetectTheme.d.ts.map +1 -0
- package/dist/canvas/hooks/useDetectTheme.js +20 -0
- package/dist/canvas/hooks/useDetectTheme.js.map +1 -0
- package/dist/canvas/hooks/useIsMobile.d.ts +2 -0
- package/dist/canvas/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/canvas/hooks/useIsMobile.js +20 -0
- package/dist/canvas/hooks/useIsMobile.js.map +1 -0
- package/dist/canvas/hooks/useSimulationSession.d.ts +23 -0
- package/dist/canvas/hooks/useSimulationSession.d.ts.map +1 -0
- package/dist/canvas/hooks/useSimulationSession.js +41 -0
- package/dist/canvas/hooks/useSimulationSession.js.map +1 -0
- package/dist/canvas/index.d.ts +22 -0
- package/dist/canvas/index.d.ts.map +1 -0
- package/dist/canvas/index.js +17 -0
- package/dist/canvas/index.js.map +1 -0
- package/dist/canvas/label-utils.d.ts +10 -0
- package/dist/canvas/label-utils.d.ts.map +1 -0
- package/dist/canvas/label-utils.js +32 -0
- package/dist/canvas/label-utils.js.map +1 -0
- package/dist/canvas/node-types.d.ts +10 -0
- package/dist/canvas/node-types.d.ts.map +1 -0
- package/dist/canvas/node-types.js +29 -0
- package/dist/canvas/node-types.js.map +1 -0
- package/dist/canvas/projection.d.ts +19 -0
- package/dist/canvas/projection.d.ts.map +1 -0
- package/dist/canvas/projection.js +317 -0
- package/dist/canvas/projection.js.map +1 -0
- package/dist/canvas/types.d.ts +56 -0
- package/dist/canvas/types.d.ts.map +1 -0
- package/dist/canvas/types.js +6 -0
- package/dist/canvas/types.js.map +1 -0
- package/dist/canvas/useLayout.d.ts +21 -0
- package/dist/canvas/useLayout.d.ts.map +1 -0
- package/dist/canvas/useLayout.js +26 -0
- package/dist/canvas/useLayout.js.map +1 -0
- package/dist/editor/components/CircuitSelector.d.ts +9 -0
- package/dist/editor/components/CircuitSelector.d.ts.map +1 -0
- package/dist/editor/components/CircuitSelector.js +20 -0
- package/dist/editor/components/CircuitSelector.js.map +1 -0
- package/dist/editor/components/CircuitTabBar.d.ts +8 -0
- package/dist/editor/components/CircuitTabBar.d.ts.map +1 -0
- package/dist/editor/components/CircuitTabBar.js +23 -0
- package/dist/editor/components/CircuitTabBar.js.map +1 -0
- package/dist/editor/components/ClockControls.d.ts +6 -0
- package/dist/editor/components/ClockControls.d.ts.map +1 -0
- package/dist/editor/components/ClockControls.js +7 -0
- package/dist/editor/components/ClockControls.js.map +1 -0
- package/dist/editor/components/ComponentTooltip.d.ts +25 -0
- package/dist/editor/components/ComponentTooltip.d.ts.map +1 -0
- package/dist/editor/components/ComponentTooltip.js +82 -0
- package/dist/editor/components/ComponentTooltip.js.map +1 -0
- package/dist/editor/components/ConflictResolutionModal.d.ts +19 -0
- package/dist/editor/components/ConflictResolutionModal.d.ts.map +1 -0
- package/dist/editor/components/ConflictResolutionModal.js +20 -0
- package/dist/editor/components/ConflictResolutionModal.js.map +1 -0
- package/dist/editor/components/HierarchyBreadcrumb.d.ts +9 -0
- package/dist/editor/components/HierarchyBreadcrumb.d.ts.map +1 -0
- package/dist/editor/components/HierarchyBreadcrumb.js +32 -0
- package/dist/editor/components/HierarchyBreadcrumb.js.map +1 -0
- package/dist/editor/components/LabelEditor.d.ts +17 -0
- package/dist/editor/components/LabelEditor.d.ts.map +1 -0
- package/dist/editor/components/LabelEditor.js +40 -0
- package/dist/editor/components/LabelEditor.js.map +1 -0
- package/dist/editor/components/SignalOutputPanel.d.ts +11 -0
- package/dist/editor/components/SignalOutputPanel.d.ts.map +1 -0
- package/dist/editor/components/SignalOutputPanel.js +34 -0
- package/dist/editor/components/SignalOutputPanel.js.map +1 -0
- package/dist/editor/components/index.d.ts +9 -0
- package/dist/editor/components/index.d.ts.map +1 -0
- package/dist/editor/components/index.js +9 -0
- package/dist/editor/components/index.js.map +1 -0
- package/dist/editor/hooks/index.d.ts +1 -0
- package/dist/editor/hooks/index.d.ts.map +1 -0
- package/dist/editor/hooks/index.js +2 -0
- package/dist/editor/hooks/index.js.map +1 -0
- package/dist/editor/index.d.ts +5 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +5 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/lib/simulation/index.d.ts +7 -0
- package/dist/editor/lib/simulation/index.d.ts.map +1 -0
- package/dist/editor/lib/simulation/index.js +8 -0
- package/dist/editor/lib/simulation/index.js.map +1 -0
- package/dist/editor/lib/utils/circuit-flattener.d.ts +29 -0
- package/dist/editor/lib/utils/circuit-flattener.d.ts.map +1 -0
- package/dist/editor/lib/utils/circuit-flattener.js +230 -0
- package/dist/editor/lib/utils/circuit-flattener.js.map +1 -0
- package/dist/editor/lib/utils/component-utils.d.ts +28 -0
- package/dist/editor/lib/utils/component-utils.d.ts.map +1 -0
- package/dist/editor/lib/utils/component-utils.js +72 -0
- package/dist/editor/lib/utils/component-utils.js.map +1 -0
- package/dist/editor/lib/utils/index.d.ts +3 -0
- package/dist/editor/lib/utils/index.d.ts.map +1 -0
- package/dist/editor/lib/utils/index.js +3 -0
- package/dist/editor/lib/utils/index.js.map +1 -0
- package/dist/editor/lib/visualization/index.d.ts +2 -0
- package/dist/editor/lib/visualization/index.d.ts.map +1 -0
- package/dist/editor/lib/visualization/index.js +2 -0
- package/dist/editor/lib/visualization/index.js.map +1 -0
- package/dist/editor/lib/visualization/vcd-generator.d.ts +63 -0
- package/dist/editor/lib/visualization/vcd-generator.d.ts.map +1 -0
- package/dist/editor/lib/visualization/vcd-generator.js +269 -0
- package/dist/editor/lib/visualization/vcd-generator.js.map +1 -0
- package/dist/editor/stores/circuit-library-store.d.ts +25 -0
- package/dist/editor/stores/circuit-library-store.d.ts.map +1 -0
- package/dist/editor/stores/circuit-library-store.js +51 -0
- package/dist/editor/stores/circuit-library-store.js.map +1 -0
- package/dist/editor/stores/circuit-preview-store.d.ts +687 -0
- package/dist/editor/stores/circuit-preview-store.d.ts.map +1 -0
- package/dist/editor/stores/circuit-preview-store.js +226 -0
- package/dist/editor/stores/circuit-preview-store.js.map +1 -0
- package/dist/editor/stores/circuit-store.d.ts +354 -0
- package/dist/editor/stores/circuit-store.d.ts.map +1 -0
- package/dist/editor/stores/circuit-store.js +227 -0
- package/dist/editor/stores/circuit-store.js.map +1 -0
- package/dist/editor/stores/index.d.ts +11 -0
- package/dist/editor/stores/index.d.ts.map +1 -0
- package/dist/editor/stores/index.js +8 -0
- package/dist/editor/stores/index.js.map +1 -0
- package/dist/editor/stores/ui-store.d.ts +96 -0
- package/dist/editor/stores/ui-store.d.ts.map +1 -0
- package/dist/editor/stores/ui-store.js +101 -0
- package/dist/editor/stores/ui-store.js.map +1 -0
- package/dist/editor/types/circuit.d.ts +207 -0
- package/dist/editor/types/circuit.d.ts.map +1 -0
- package/dist/editor/types/circuit.js +62 -0
- package/dist/editor/types/circuit.js.map +1 -0
- package/dist/editor/types/index.d.ts +12 -0
- package/dist/editor/types/index.d.ts.map +1 -0
- package/dist/editor/types/index.js +11 -0
- package/dist/editor/types/index.js.map +1 -0
- package/dist/editor/types/testbench.d.ts +150 -0
- package/dist/editor/types/testbench.d.ts.map +1 -0
- package/dist/editor/types/testbench.js +85 -0
- package/dist/editor/types/testbench.js.map +1 -0
- package/dist/editor/types/testing.d.ts +88 -0
- package/dist/editor/types/testing.d.ts.map +1 -0
- package/dist/editor/types/testing.js +6 -0
- package/dist/editor/types/testing.js.map +1 -0
- package/dist/editor/types/ui-model.d.ts +68 -0
- package/dist/editor/types/ui-model.d.ts.map +1 -0
- package/dist/editor/types/ui-model.js +66 -0
- package/dist/editor/types/ui-model.js.map +1 -0
- package/dist/editor/types/ui.d.ts +33 -0
- package/dist/editor/types/ui.d.ts.map +1 -0
- package/dist/editor/types/ui.js +8 -0
- package/dist/editor/types/ui.js.map +1 -0
- package/dist/editor/types/visual.d.ts +45 -0
- package/dist/editor/types/visual.d.ts.map +1 -0
- package/dist/editor/types/visual.js +23 -0
- package/dist/editor/types/visual.js.map +1 -0
- package/dist/editor/utils/index.d.ts +5 -0
- package/dist/editor/utils/index.d.ts.map +1 -0
- package/dist/editor/utils/index.js +6 -0
- package/dist/editor/utils/index.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- 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/nodes/BaseNode.d.ts +20 -0
- package/dist/nodes/BaseNode.d.ts.map +1 -0
- package/dist/nodes/BaseNode.js +26 -0
- package/dist/nodes/BaseNode.js.map +1 -0
- package/dist/nodes/CompositeBadge.d.ts +6 -0
- package/dist/nodes/CompositeBadge.d.ts.map +1 -0
- package/dist/nodes/CompositeBadge.js +10 -0
- package/dist/nodes/CompositeBadge.js.map +1 -0
- package/dist/nodes/ConsoleNode.d.ts +8 -0
- package/dist/nodes/ConsoleNode.d.ts.map +1 -0
- package/dist/nodes/ConsoleNode.js +16 -0
- package/dist/nodes/ConsoleNode.js.map +1 -0
- package/dist/nodes/EmbedConsoleNode.d.ts +8 -0
- package/dist/nodes/EmbedConsoleNode.d.ts.map +1 -0
- package/dist/nodes/EmbedConsoleNode.js +24 -0
- package/dist/nodes/EmbedConsoleNode.js.map +1 -0
- package/dist/nodes/EmbedScreenNode.d.ts +8 -0
- package/dist/nodes/EmbedScreenNode.d.ts.map +1 -0
- package/dist/nodes/EmbedScreenNode.js +24 -0
- package/dist/nodes/EmbedScreenNode.js.map +1 -0
- package/dist/nodes/EthFrameInputNode.d.ts +8 -0
- package/dist/nodes/EthFrameInputNode.d.ts.map +1 -0
- package/dist/nodes/EthFrameInputNode.js +14 -0
- package/dist/nodes/EthFrameInputNode.js.map +1 -0
- package/dist/nodes/InputNode.d.ts +8 -0
- package/dist/nodes/InputNode.d.ts.map +1 -0
- package/dist/nodes/InputNode.js +57 -0
- package/dist/nodes/InputNode.js.map +1 -0
- package/dist/nodes/LogicGateNode.d.ts +8 -0
- package/dist/nodes/LogicGateNode.d.ts.map +1 -0
- package/dist/nodes/LogicGateNode.js +51 -0
- package/dist/nodes/LogicGateNode.js.map +1 -0
- package/dist/nodes/NicFifoNode.d.ts +8 -0
- package/dist/nodes/NicFifoNode.d.ts.map +1 -0
- package/dist/nodes/NicFifoNode.js +10 -0
- package/dist/nodes/NicFifoNode.js.map +1 -0
- package/dist/nodes/NodeData.d.ts +34 -0
- package/dist/nodes/NodeData.d.ts.map +1 -0
- package/dist/nodes/NodeData.js +2 -0
- package/dist/nodes/NodeData.js.map +1 -0
- package/dist/nodes/NumericInputNode.d.ts +8 -0
- package/dist/nodes/NumericInputNode.d.ts.map +1 -0
- package/dist/nodes/NumericInputNode.js +47 -0
- package/dist/nodes/NumericInputNode.js.map +1 -0
- package/dist/nodes/OutputNode.d.ts +8 -0
- package/dist/nodes/OutputNode.d.ts.map +1 -0
- package/dist/nodes/OutputNode.js +32 -0
- package/dist/nodes/OutputNode.js.map +1 -0
- package/dist/nodes/RAMNode.d.ts +8 -0
- package/dist/nodes/RAMNode.d.ts.map +1 -0
- package/dist/nodes/RAMNode.js +23 -0
- package/dist/nodes/RAMNode.js.map +1 -0
- package/dist/nodes/ROMNode.d.ts +8 -0
- package/dist/nodes/ROMNode.d.ts.map +1 -0
- package/dist/nodes/ROMNode.js +23 -0
- package/dist/nodes/ROMNode.js.map +1 -0
- package/dist/nodes/RV32IInstrMemNode.d.ts +16 -0
- package/dist/nodes/RV32IInstrMemNode.d.ts.map +1 -0
- package/dist/nodes/RV32IInstrMemNode.js +183 -0
- package/dist/nodes/RV32IInstrMemNode.js.map +1 -0
- package/dist/nodes/RasterDisplayNode.d.ts +8 -0
- package/dist/nodes/RasterDisplayNode.d.ts.map +1 -0
- package/dist/nodes/RasterDisplayNode.js +14 -0
- package/dist/nodes/RasterDisplayNode.js.map +1 -0
- package/dist/nodes/RegisterNode.d.ts +8 -0
- package/dist/nodes/RegisterNode.d.ts.map +1 -0
- package/dist/nodes/RegisterNode.js +14 -0
- package/dist/nodes/RegisterNode.js.map +1 -0
- package/dist/nodes/ScreenNode.d.ts +8 -0
- package/dist/nodes/ScreenNode.d.ts.map +1 -0
- package/dist/nodes/ScreenNode.js +16 -0
- package/dist/nodes/ScreenNode.js.map +1 -0
- package/dist/nodes/UartTxNode.d.ts +8 -0
- package/dist/nodes/UartTxNode.d.ts.map +1 -0
- package/dist/nodes/UartTxNode.js +16 -0
- package/dist/nodes/UartTxNode.js.map +1 -0
- package/dist/nodes/index.d.ts +27 -0
- package/dist/nodes/index.d.ts.map +1 -0
- package/dist/nodes/index.js +30 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/primitives/button.d.ts +12 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +32 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/index.d.ts +4 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/sheet.d.ts +15 -0
- package/dist/primitives/sheet.d.ts.map +1 -0
- package/dist/primitives/sheet.js +40 -0
- package/dist/primitives/sheet.js.map +1 -0
- package/dist/primitives/tooltip.d.ts +8 -0
- package/dist/primitives/tooltip.d.ts.map +1 -0
- package/dist/primitives/tooltip.js +17 -0
- package/dist/primitives/tooltip.js.map +1 -0
- package/dist/sandbox/SandboxProvider.d.ts +13 -0
- package/dist/sandbox/SandboxProvider.d.ts.map +1 -0
- package/dist/sandbox/SandboxProvider.js +34 -0
- package/dist/sandbox/SandboxProvider.js.map +1 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +3 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/useSandbox.d.ts +197 -0
- package/dist/sandbox/useSandbox.d.ts.map +1 -0
- package/dist/sandbox/useSandbox.js +250 -0
- package/dist/sandbox/useSandbox.js.map +1 -0
- package/dist/share/encode-source.d.ts +13 -0
- package/dist/share/encode-source.d.ts.map +1 -0
- package/dist/share/encode-source.js +31 -0
- package/dist/share/encode-source.js.map +1 -0
- package/dist/share/index.d.ts +2 -0
- package/dist/share/index.d.ts.map +1 -0
- package/dist/share/index.js +2 -0
- package/dist/share/index.js.map +1 -0
- package/dist/waveform/WaveformViewer.d.ts +30 -0
- package/dist/waveform/WaveformViewer.d.ts.map +1 -0
- package/dist/waveform/WaveformViewer.js +356 -0
- package/dist/waveform/WaveformViewer.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* ComponentTooltip Component
|
|
5
|
+
*
|
|
6
|
+
* Displays detailed information about a component on hover,
|
|
7
|
+
* similar to Turing Complete game tooltips.
|
|
8
|
+
* Shows component name, description, and input/output states.
|
|
9
|
+
*/
|
|
10
|
+
import { useState, useRef, useEffect } from 'react';
|
|
11
|
+
import { createPortal } from 'react-dom';
|
|
12
|
+
import { cn } from '../../lib/utils';
|
|
13
|
+
export function ComponentTooltip({ children, title, description, inputs = [], outputs = [], enabled = true, delayMs = 500, }) {
|
|
14
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
15
|
+
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
16
|
+
const timeoutRef = useRef(null);
|
|
17
|
+
const targetRef = useRef(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
return () => {
|
|
20
|
+
if (timeoutRef.current) {
|
|
21
|
+
clearTimeout(timeoutRef.current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
const handleMouseEnter = () => {
|
|
26
|
+
if (!enabled)
|
|
27
|
+
return;
|
|
28
|
+
if (timeoutRef.current) {
|
|
29
|
+
clearTimeout(timeoutRef.current);
|
|
30
|
+
}
|
|
31
|
+
timeoutRef.current = setTimeout(() => {
|
|
32
|
+
const rect = targetRef.current?.getBoundingClientRect();
|
|
33
|
+
if (rect) {
|
|
34
|
+
// Position tooltip to the right of the component with some offset
|
|
35
|
+
setPosition({
|
|
36
|
+
x: rect.right + 12,
|
|
37
|
+
y: rect.top + rect.height / 2,
|
|
38
|
+
});
|
|
39
|
+
setIsVisible(true);
|
|
40
|
+
}
|
|
41
|
+
}, delayMs);
|
|
42
|
+
};
|
|
43
|
+
const handleMouseLeave = () => {
|
|
44
|
+
if (timeoutRef.current) {
|
|
45
|
+
clearTimeout(timeoutRef.current);
|
|
46
|
+
}
|
|
47
|
+
setIsVisible(false);
|
|
48
|
+
};
|
|
49
|
+
const handleDragStart = () => {
|
|
50
|
+
// Immediately hide tooltip and clear any pending timeout when drag starts
|
|
51
|
+
if (timeoutRef.current) {
|
|
52
|
+
clearTimeout(timeoutRef.current);
|
|
53
|
+
}
|
|
54
|
+
setIsVisible(false);
|
|
55
|
+
};
|
|
56
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: targetRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onDragStart: handleDragStart, className: "h-full w-full", children: children }), isVisible &&
|
|
57
|
+
createPortal(_jsx(TooltipContent, { title: title, description: description, inputs: inputs, outputs: outputs, position: position }), document.body)] }));
|
|
58
|
+
}
|
|
59
|
+
function TooltipContent({ title, description, inputs, outputs, position }) {
|
|
60
|
+
return (_jsx("div", { className: "pointer-events-none fixed z-50", style: {
|
|
61
|
+
left: `${position.x}px`,
|
|
62
|
+
top: `${position.y}px`,
|
|
63
|
+
transform: 'translateY(-50%)',
|
|
64
|
+
}, children: _jsxs("div", { className: "min-w-[240px] rounded-lg border-2 border-gray-400 bg-gradient-to-br from-gray-50 to-white px-5 py-4 shadow-2xl shadow-black/20", children: [_jsx("div", { className: "mb-2 border-b border-gray-300 pb-2 text-base font-bold uppercase tracking-wide text-gray-800", children: title }), _jsx("div", { className: "mb-4 text-sm leading-relaxed text-gray-700", children: description }), inputs.length > 0 && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "mb-2 text-xs font-bold uppercase tracking-wider text-gray-600", children: "Inputs:" }), _jsx("div", { className: "space-y-2 rounded-md bg-gray-100/50 px-3 py-2", children: inputs.map((input) => (_jsx(PortRow, { port: input }, `input-${input.index}`))) })] })), outputs.length > 0 && (_jsxs("div", { children: [_jsx("div", { className: "mb-2 text-xs font-bold uppercase tracking-wider text-gray-600", children: "Outputs:" }), _jsx("div", { className: "space-y-2 rounded-md bg-gray-100/50 px-3 py-2", children: outputs.map((output) => (_jsx(PortRow, { port: output }, `output-${output.index}`))) })] }))] }) }));
|
|
65
|
+
}
|
|
66
|
+
function PortRow({ port }) {
|
|
67
|
+
const getStateColor = (value) => {
|
|
68
|
+
if (value === undefined) {
|
|
69
|
+
return 'bg-gray-300 border-gray-400';
|
|
70
|
+
}
|
|
71
|
+
return value ? 'bg-green-500 border-green-600' : 'bg-gray-400 border-gray-500';
|
|
72
|
+
};
|
|
73
|
+
const getStateText = (value) => {
|
|
74
|
+
if (value === undefined) {
|
|
75
|
+
return null; // Don't show status for unconnected/template ports
|
|
76
|
+
}
|
|
77
|
+
return value ? 'ON' : 'OFF';
|
|
78
|
+
};
|
|
79
|
+
const stateText = getStateText(port.value);
|
|
80
|
+
return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: cn('h-2.5 w-2.5 rounded-full border transition-colors', getStateColor(port.value)) }), _jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [_jsx("span", { className: "text-gray-700", children: port.label }), stateText && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-500", children: "-" }), _jsx("span", { className: cn('font-medium', port.value === true && 'text-green-600', port.value === false && 'text-gray-600'), children: stateText })] }))] })] }));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ComponentTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentTooltip.js","sourceRoot":"","sources":["../../../src/editor/components/ComponentTooltip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;GAMG;AAEH,OAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAkBrC,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,KAAK,EACL,WAAW,EACX,MAAM,GAAG,EAAE,EACX,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,IAAI,EACd,OAAO,GAAG,GAAG,GACS;IACtB,MAAM,CAAC,SAAS,E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AAS,EAAC,mCAAmC,aAChD,eAAM,SAAS,EAAC,eAAe,YAAE,IAAI,CAAC,KAAK,GAAQ,EAClD,SAAS,IAAI,CACZ,8BACE,eAAM,SAAS,EAAC,eAAe,kBAAS,EACxC,eACE,SAAS,EAAE,EAAE,CACX,aAAa,EACb,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,gBAAgB,EACvC,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,eAAe,CACxC,YAEA,SAAS,GACL,IACN,CACJ,IACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConflictResolutionModal Component
|
|
3
|
+
*
|
|
4
|
+
* Modal dialog for resolving conflicts between circuit code and canvas edits.
|
|
5
|
+
* Shows when both the TypeScript circuit code and canvas have been modified simultaneously.
|
|
6
|
+
*
|
|
7
|
+
* User can choose to:
|
|
8
|
+
* - Keep code changes (discard canvas changes)
|
|
9
|
+
* - Keep canvas changes (update code from canvas)
|
|
10
|
+
*/
|
|
11
|
+
interface ConflictResolutionModalProps {
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
onKeepCode: () => void;
|
|
14
|
+
onKeepCanvas: () => void;
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function ConflictResolutionModal({ isOpen, onKeepCode, onKeepCanvas, onCancel, }: ConflictResolutionModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=ConflictResolutionModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConflictResolutionModal.d.ts","sourceRoot":"","sources":["../../../src/editor/components/ConflictResolutionModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,UAAU,4BAA4B;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,EAAE,4BAA4B,kDA+D9B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConflictResolutionModal Component
|
|
3
|
+
*
|
|
4
|
+
* Modal dialog for resolving conflicts between circuit code and canvas edits.
|
|
5
|
+
* Shows when both the TypeScript circuit code and canvas have been modified simultaneously.
|
|
6
|
+
*
|
|
7
|
+
* User can choose to:
|
|
8
|
+
* - Keep code changes (discard canvas changes)
|
|
9
|
+
* - Keep canvas changes (update code from canvas)
|
|
10
|
+
*/
|
|
11
|
+
'use client';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { AlertTriangle } from 'lucide-react';
|
|
14
|
+
import { Button } from '../../primitives/button';
|
|
15
|
+
export function ConflictResolutionModal({ isOpen, onKeepCode, onKeepCanvas, onCancel, }) {
|
|
16
|
+
if (!isOpen)
|
|
17
|
+
return null;
|
|
18
|
+
return (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50", children: _jsxs("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full mx-4", children: [_jsxs("div", { className: "flex items-center gap-3 px-6 py-4 border-b border-gray-200", children: [_jsx(AlertTriangle, { className: "w-6 h-6 text-amber-500" }), _jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Conflict Detected" })] }), _jsxs("div", { className: "px-6 py-4", children: [_jsx("p", { className: "text-sm text-gray-700 mb-4", children: "Both the circuit code and the canvas have been modified since the last sync. Please choose which changes to keep:" }), _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded", children: [_jsx("h3", { className: "text-sm font-medium text-blue-900 mb-1", children: "Keep Code Changes" }), _jsx("p", { className: "text-xs text-blue-700", children: "The canvas will be updated to match the current circuit code. Any canvas-only changes will be lost." })] }), _jsxs("div", { className: "p-3 bg-green-50 border border-green-200 rounded", children: [_jsx("h3", { className: "text-sm font-medium text-green-900 mb-1", children: "Keep Canvas Changes" }), _jsx("p", { className: "text-xs text-green-700", children: "The circuit code will be regenerated from the current canvas state. Any code-only changes will be lost." })] })] })] }), _jsxs("div", { className: "flex gap-3 px-6 py-4 border-t border-gray-200 bg-gray-50", children: [_jsx(Button, { onClick: onCancel, variant: "outline", className: "flex-1", children: "Cancel" }), _jsx(Button, { onClick: onKeepCode, className: "flex-1 bg-blue-600 hover:bg-blue-700 text-white", children: "Keep Code" }), _jsx(Button, { onClick: onKeepCanvas, className: "flex-1 bg-green-600 hover:bg-green-700 text-white", children: "Keep Canvas" })] })] }) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ConflictResolutionModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConflictResolutionModal.js","sourceRoot":"","sources":["../../../src/editor/components/ConflictResolutionModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,CAAC;;AAGb,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AASjD,MAAM,UAAU,uBAAuB,CAAC,EACtC,MAAM,EACN,UAAU,EACV,YAAY,EACZ,QAAQ,GACqB;IAC7B,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,OAAO,CACL,cAAK,SAAS,EAAC,4EAA4E,YACzF,eAAK,SAAS,EAAC,oDAAoD,aAEjE,eAAK,SAAS,EAAC,4DAA4D,aACzE,KAAC,aAAa,IAAC,SAAS,EAAC,wBAAwB,GAAG,EACpD,aAAI,SAAS,EAAC,qCAAqC,kCAAuB,IACtE,EAGN,eAAK,SAAS,EAAC,WAAW,aACxB,YAAG,SAAS,EAAC,4BAA4B,kIAGrC,EAEJ,eAAK,SAAS,EAAC,WAAW,aACxB,eAAK,SAAS,EAAC,+CAA+C,aAC5D,aAAI,SAAS,EAAC,wCAAwC,kCAAuB,EAC7E,YAAG,SAAS,EAAC,uBAAuB,oHAGhC,IACA,EAEN,eAAK,SAAS,EAAC,iDAAiD,aAC9D,aAAI,SAAS,EAAC,yCAAyC,oCAAyB,EAChF,YAAG,SAAS,EAAC,wBAAwB,wHAGjC,IACA,IACF,IACF,EAGN,eAAK,SAAS,EAAC,0DAA0D,aACvE,KAAC,MAAM,IACL,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAC,SAAS,EACjB,SAAS,EAAC,QAAQ,uBAGX,EACT,KAAC,MAAM,IACL,OAAO,EAAE,UAAU,EACnB,SAAS,EAAC,iDAAiD,0BAGpD,EACT,KAAC,MAAM,IACL,OAAO,EAAE,YAAY,EACrB,SAAS,EAAC,mDAAmD,4BAGtD,IACL,IACF,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HierarchyBreadcrumb Component
|
|
3
|
+
*
|
|
4
|
+
* Renders a breadcrumb navigation bar when the user has drilled into
|
|
5
|
+
* a composite component. Shows the hierarchy path and allows navigation
|
|
6
|
+
* back to any level.
|
|
7
|
+
*/
|
|
8
|
+
export declare function HierarchyBreadcrumb(): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
//# sourceMappingURL=HierarchyBreadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HierarchyBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/editor/components/HierarchyBreadcrumb.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,wBAAgB,mBAAmB,mDA6DlC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HierarchyBreadcrumb Component
|
|
3
|
+
*
|
|
4
|
+
* Renders a breadcrumb navigation bar when the user has drilled into
|
|
5
|
+
* a composite component. Shows the hierarchy path and allows navigation
|
|
6
|
+
* back to any level.
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { useCircuitPreviewStore } from "../stores/circuit-preview-store";
|
|
12
|
+
export function HierarchyBreadcrumb() {
|
|
13
|
+
const drillDownStack = useCircuitPreviewStore((state) => state.drillDownStack);
|
|
14
|
+
const navigateTo = useCircuitPreviewStore((state) => state.navigateTo);
|
|
15
|
+
const compiledCircuits = useCircuitPreviewStore((state) => state.compiledCircuits);
|
|
16
|
+
const selectedCircuitIndex = useCircuitPreviewStore((state) => state.selectedCircuitIndex);
|
|
17
|
+
if (drillDownStack.length === 0)
|
|
18
|
+
return null;
|
|
19
|
+
// Get top-level circuit name
|
|
20
|
+
const topLevelName = selectedCircuitIndex >= 0 && selectedCircuitIndex < compiledCircuits.length
|
|
21
|
+
? compiledCircuits[selectedCircuitIndex].name
|
|
22
|
+
: "Circuit";
|
|
23
|
+
return (_jsxs("div", { className: "flex items-center gap-1 border-b border-gray-200 bg-gray-50 px-4 py-1.5 text-sm", children: [_jsx("span", { className: "mr-2 rounded bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase text-amber-700", children: "Read-Only" }), _jsx("button", { onClick: () => navigateTo(0), className: "text-blue-600 hover:text-blue-800 hover:underline", children: topLevelName }), drillDownStack.map((frame, index) => {
|
|
24
|
+
const isLast = index === drillDownStack.length - 1;
|
|
25
|
+
return (_jsxs(React.Fragment, { children: [_jsx("span", { className: "text-gray-400", children: ">" }), isLast ? (
|
|
26
|
+
// Current (deepest) segment — not clickable
|
|
27
|
+
_jsxs("span", { className: "font-medium text-gray-900", children: [frame.nodeLabel, " ", _jsxs("span", { className: "text-gray-500", children: ["(", frame.componentName, ")"] })] })) : (
|
|
28
|
+
// Intermediate segment — clickable
|
|
29
|
+
_jsxs("button", { onClick: () => navigateTo(index + 1), className: "text-blue-600 hover:text-blue-800 hover:underline", children: [frame.nodeLabel, " ", _jsxs("span", { className: "text-blue-400", children: ["(", frame.componentName, ")"] })] }))] }, frame.nodeId));
|
|
30
|
+
})] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=HierarchyBreadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HierarchyBreadcrumb.js","sourceRoot":"","sources":["../../../src/editor/components/HierarchyBreadcrumb.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,UAAU,mBAAmB;IACjC,MAAM,cAAc,GAAG,sBAAsB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,sBAAsB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvE,MAAM,gBAAgB,GAAG,sBAAsB,CAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAClC,CAAC;IACF,MAAM,oBAAoB,GAAG,sBAAsB,CACjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,oBAAoB,CACtC,CAAC;IAEF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE7C,6BAA6B;IAC7B,MAAM,YAAY,GAChB,oBAAoB,IAAI,CAAC,IAAI,oBAAoB,GAAG,gBAAgB,CAAC,MAAM;QACzE,CAAC,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,IAAI;QAC7C,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,CACL,eAAK,SAAS,EAAC,iFAAiF,aAE9F,eAAM,SAAS,EAAC,4FAA4F,0BAErG,EAGP,iBACE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAC5B,SAAS,EAAC,mDAAmD,YAE5D,YAAY,GACN,EAGR,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACnC,MAAM,MAAM,GAAG,KAAK,KAAK,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;gBAEnD,OAAO,CACL,MAAC,KAAK,CAAC,QAAQ,eACb,eAAM,SAAS,EAAC,eAAe,kBAAY,EAC1C,MAAM,CAAC,CAAC,CAAC;wBACR,4CAA4C;wBAC5C,gBAAM,SAAS,EAAC,2BAA2B,aACxC,KAAK,CAAC,SAAS,EAAE,GAAG,EACrB,gBAAM,SAAS,EAAC,eAAe,kBAAG,KAAK,CAAC,aAAa,SAAS,IACzD,CACR,CAAC,CAAC,CAAC;wBACF,mCAAmC;wBACnC,kBACE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,EACpC,SAAS,EAAC,mDAAmD,aAE5D,KAAK,CAAC,SAAS,EAAE,GAAG,EACrB,gBAAM,SAAS,EAAC,eAAe,kBAAG,KAAK,CAAC,aAAa,SAAS,IACvD,CACV,KAjBkB,KAAK,CAAC,MAAM,CAkBhB,CAClB,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LabelEditor Component
|
|
3
|
+
*
|
|
4
|
+
* Inline input field for editing component labels.
|
|
5
|
+
*/
|
|
6
|
+
interface LabelEditorProps {
|
|
7
|
+
initialValue: string;
|
|
8
|
+
onSave: (value: string) => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
position: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function LabelEditor({ initialValue, onSave, onCancel, position }: LabelEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=LabelEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/components/LabelEditor.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,UAAU,gBAAgB;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAkDzF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LabelEditor Component
|
|
3
|
+
*
|
|
4
|
+
* Inline input field for editing component labels.
|
|
5
|
+
*/
|
|
6
|
+
'use client';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { useEffect, useRef, useState } from 'react';
|
|
9
|
+
export function LabelEditor({ initialValue, onSave, onCancel, position }) {
|
|
10
|
+
const [value, setValue] = useState(initialValue);
|
|
11
|
+
const inputRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
// Auto-focus and select text
|
|
14
|
+
if (inputRef.current) {
|
|
15
|
+
inputRef.current.focus();
|
|
16
|
+
inputRef.current.select();
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
const handleKeyDown = (e) => {
|
|
20
|
+
if (e.key === 'Enter') {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
onSave(value.trim());
|
|
23
|
+
}
|
|
24
|
+
else if (e.key === 'Escape') {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
onCancel();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const handleBlur = () => {
|
|
30
|
+
// Save on blur
|
|
31
|
+
onSave(value.trim());
|
|
32
|
+
};
|
|
33
|
+
return (_jsx("div", { className: "fixed z-[100]", style: {
|
|
34
|
+
left: `${position.x}px`,
|
|
35
|
+
top: `${position.y}px`,
|
|
36
|
+
transform: 'translate(-50%, -100%)',
|
|
37
|
+
marginTop: '-8px',
|
|
38
|
+
}, children: _jsx("input", { ref: inputRef, type: "text", value: value, onChange: (e) => setValue(e.target.value), onKeyDown: handleKeyDown, onBlur: handleBlur, className: "rounded border-2 border-blue-500 bg-white px-2 py-1 text-sm font-medium shadow-lg focus:outline-none", style: { minWidth: '80px' }, onClick: (e) => e.stopPropagation() }) }));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=LabelEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelEditor.js","sourceRoot":"","sources":["../../../src/editor/components/LabelEditor.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;AAEb,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAS3D,MAAM,UAAU,WAAW,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAoB;IACxF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,6BAA6B;QAC7B,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACzB,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,aAAa,GAAG,CAAC,CAAwC,EAAE,EAAE;QACjE,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;YACtB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACvB,CAAC;aAAM,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC9B,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,eAAe;QACf,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO,CACL,cACE,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE;YACL,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,IAAI;YACtB,SAAS,EAAE,wBAAwB;YACnC,SAAS,EAAE,MAAM;SAClB,YAED,gBACE,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAC,sGAAsG,EAChH,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAC3B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,GACnC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SignalOutputPanel
|
|
3
|
+
*
|
|
4
|
+
* Displays circuit output port values in real-time during simulation.
|
|
5
|
+
* Pure presentational — receives portValues as a prop.
|
|
6
|
+
*/
|
|
7
|
+
export interface SignalOutputPanelProps {
|
|
8
|
+
portValues?: ReadonlyMap<string, boolean | number>;
|
|
9
|
+
}
|
|
10
|
+
export declare function SignalOutputPanel({ portValues }: SignalOutputPanelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=SignalOutputPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignalOutputPanel.d.ts","sourceRoot":"","sources":["../../../src/editor/components/SignalOutputPanel.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;CACpD;AAED,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,kDA+BvE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SignalOutputPanel
|
|
3
|
+
*
|
|
4
|
+
* Displays circuit output port values in real-time during simulation.
|
|
5
|
+
* Pure presentational — receives portValues as a prop.
|
|
6
|
+
*/
|
|
7
|
+
'use client';
|
|
8
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { useCircuitStore } from '../stores';
|
|
10
|
+
function formatValue(value) {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
return '—';
|
|
13
|
+
if (typeof value === 'boolean')
|
|
14
|
+
return value ? '1' : '0';
|
|
15
|
+
if (Math.abs(value) > 255) {
|
|
16
|
+
return `0x${(value >>> 0).toString(16).toUpperCase().padStart(8, '0')}`;
|
|
17
|
+
}
|
|
18
|
+
return String(value);
|
|
19
|
+
}
|
|
20
|
+
export function SignalOutputPanel({ portValues }) {
|
|
21
|
+
const circuit = useCircuitStore((state) => state.circuit);
|
|
22
|
+
if (!circuit || circuit.outputs.length === 0 || !portValues)
|
|
23
|
+
return null;
|
|
24
|
+
return (_jsx("div", { className: "flex items-center gap-3", children: circuit.outputs.map((output) => {
|
|
25
|
+
let value;
|
|
26
|
+
for (const [key, val] of portValues) {
|
|
27
|
+
if (key.endsWith(`.${output.name}`)) {
|
|
28
|
+
value = val;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return (_jsxs("div", { className: "flex items-center gap-1.5 rounded bg-gray-100 dark:bg-[#2a2a2e] px-2 py-1", children: [_jsxs("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [output.name, ":"] }), _jsx("span", { className: "font-mono text-xs font-semibold text-emerald-600 dark:text-emerald-400", children: formatValue(value) })] }, output.name));
|
|
32
|
+
}) }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=SignalOutputPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignalOutputPanel.js","sourceRoot":"","sources":["../../../src/editor/components/SignalOutputPanel.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,SAAS,WAAW,CAAC,KAAmC;IACtD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IACpC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACzD,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAC1E,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAMD,MAAM,UAAU,iBAAiB,CAAC,EAAE,UAAU,EAA0B;IACtE,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE1D,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAEzE,OAAO,CACL,cAAK,SAAS,EAAC,yBAAyB,YACrC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAmC,CAAC;YACxC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,EAAE,CAAC;gBACpC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;oBACpC,KAAK,GAAG,GAAG,CAAC;gBACd,CAAC;YACH,CAAC;YAED,OAAO,CACL,eAEE,SAAS,EAAC,2EAA2E,aAErF,gBAAM,SAAS,EAAC,0CAA0C,aACvD,MAAM,CAAC,IAAI,SACP,EACP,eAAM,SAAS,EAAC,wEAAwE,YACrF,WAAW,CAAC,KAAK,CAAC,GACd,KARF,MAAM,CAAC,IAAI,CASZ,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor component exports
|
|
3
|
+
*/
|
|
4
|
+
export { ReactFlowProvider } from '@xyflow/react';
|
|
5
|
+
export { ClockControls, type ClockControlsProps } from './ClockControls';
|
|
6
|
+
export { SignalOutputPanel } from './SignalOutputPanel';
|
|
7
|
+
export { CircuitSelector } from './CircuitSelector';
|
|
8
|
+
export { CircuitTabBar } from './CircuitTabBar';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor component exports
|
|
3
|
+
*/
|
|
4
|
+
export { ReactFlowProvider } from '@xyflow/react';
|
|
5
|
+
export { ClockControls } from './ClockControls';
|
|
6
|
+
export { SignalOutputPanel } from './SignalOutputPanel';
|
|
7
|
+
export { CircuitSelector } from './CircuitSelector';
|
|
8
|
+
export { CircuitTabBar } from './CircuitTabBar';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAA2B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/hooks/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/hooks/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAE1B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/editor/lib/simulation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/editor/lib/simulation/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circuit Flattener (IR v0.1)
|
|
3
|
+
*
|
|
4
|
+
* Expands composite components into a flat Circuit containing only primitives.
|
|
5
|
+
* This allows the simulator to work with nested components by flattening the
|
|
6
|
+
* hierarchy into a single level, avoiding recursive evaluation overhead.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - State isolation: Each instance gets unique IDs (componentId__nodeId)
|
|
10
|
+
* - Preserves all port connections through hierarchy
|
|
11
|
+
* - Recursively expands nested composites
|
|
12
|
+
* - Compatible with IR v0.1 Circuit/Node format
|
|
13
|
+
*/
|
|
14
|
+
import type { Circuit } from '../../types/circuit';
|
|
15
|
+
/**
|
|
16
|
+
* Flattened circuit contains only primitive nodes
|
|
17
|
+
*/
|
|
18
|
+
export interface FlattenedCircuit extends Circuit {
|
|
19
|
+
nodeMapping: Map<string, string[]>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Flatten a circuit by recursively expanding all composite components into primitives
|
|
23
|
+
*/
|
|
24
|
+
export declare function flattenCircuit(circuit: Circuit): FlattenedCircuit;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a circuit contains any composite components
|
|
27
|
+
*/
|
|
28
|
+
export declare function hasCompositeComponents(circuit: Circuit): boolean;
|
|
29
|
+
//# sourceMappingURL=circuit-flattener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circuit-flattener.d.ts","sourceRoot":"","sources":["../../../../src/editor/lib/utils/circuit-flattener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,OAAO,EAA8B,MAAM,qBAAqB,CAAC;AAI/E;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAE/C,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACpC;AASD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAiFjE;AA4KD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAWhE"}
|