@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,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RV32IInstrMemNode Component
|
|
3
|
+
*
|
|
4
|
+
* Renders RV32I instruction memory with:
|
|
5
|
+
* - Drag-and-drop binary file loading
|
|
6
|
+
* - Inline code editor with compile button (calls /api/compile)
|
|
7
|
+
* - Uses onLoadMemory callback to write data via engine.setNode()
|
|
8
|
+
*/
|
|
9
|
+
"use client";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { useCallback, useState, useRef } from 'react';
|
|
12
|
+
import { BaseNode } from './BaseNode';
|
|
13
|
+
const LANGUAGES = [
|
|
14
|
+
{ value: 'c', label: 'C' },
|
|
15
|
+
{ value: 'cpp', label: 'C++' },
|
|
16
|
+
{ value: 'rust', label: 'Rust' },
|
|
17
|
+
{ value: 'asm', label: 'ASM' },
|
|
18
|
+
];
|
|
19
|
+
const PLACEHOLDER_CODE = {
|
|
20
|
+
c: `void _start() {
|
|
21
|
+
volatile int *uart = (volatile int *)0x80000000;
|
|
22
|
+
const char *msg = "Hello from C!\\n";
|
|
23
|
+
while (*msg) *uart = *msg++;
|
|
24
|
+
while (1);
|
|
25
|
+
}`,
|
|
26
|
+
cpp: `extern "C" void _start() {
|
|
27
|
+
volatile int *uart = (volatile int *)0x80000000;
|
|
28
|
+
const char *msg = "Hello from C++!\\n";
|
|
29
|
+
while (*msg) *uart = *msg++;
|
|
30
|
+
while (1) {}
|
|
31
|
+
}`,
|
|
32
|
+
rust: `#![no_std]
|
|
33
|
+
#![no_main]
|
|
34
|
+
|
|
35
|
+
#[no_mangle]
|
|
36
|
+
pub extern "C" fn _start() -> ! {
|
|
37
|
+
let uart = 0x80000000 as *mut u32;
|
|
38
|
+
for &b in b"Hello from Rust!\\n" {
|
|
39
|
+
unsafe { core::ptr::write_volatile(uart, b as u32); }
|
|
40
|
+
}
|
|
41
|
+
loop {}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[panic_handler]
|
|
45
|
+
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }`,
|
|
46
|
+
asm: `.global _start
|
|
47
|
+
.text
|
|
48
|
+
_start:
|
|
49
|
+
# Write 'H' to UART
|
|
50
|
+
li t0, 0x80000000
|
|
51
|
+
li a0, 72
|
|
52
|
+
sw a0, 0(t0)
|
|
53
|
+
1: j 1b`,
|
|
54
|
+
};
|
|
55
|
+
export function RV32IInstrMemNode({ data, selected }) {
|
|
56
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
57
|
+
const [showCodeEditor, setShowCodeEditor] = useState(false);
|
|
58
|
+
const [language, setLanguage] = useState('c');
|
|
59
|
+
const [code, setCode] = useState('');
|
|
60
|
+
const [compileStatus, setCompileStatus] = useState('idle');
|
|
61
|
+
const [compileError, setCompileError] = useState('');
|
|
62
|
+
const [loadedFilename, setLoadedFilename] = useState(null);
|
|
63
|
+
const [loadedSize, setLoadedSize] = useState(0);
|
|
64
|
+
const fileInputRef = useRef(null);
|
|
65
|
+
const inputPorts = data.inputNames.map((name, index) => ({
|
|
66
|
+
name, index, type: 'input',
|
|
67
|
+
}));
|
|
68
|
+
const outputPorts = data.outputNames.map((name, index) => ({
|
|
69
|
+
name, index, type: 'output',
|
|
70
|
+
}));
|
|
71
|
+
const loadBinary = useCallback((binary, filename) => {
|
|
72
|
+
const memoryMap = new Map();
|
|
73
|
+
for (let i = 0; i < binary.length; i++) {
|
|
74
|
+
if (binary[i] !== 0)
|
|
75
|
+
memoryMap.set(i, binary[i]);
|
|
76
|
+
}
|
|
77
|
+
setLoadedFilename(filename);
|
|
78
|
+
setLoadedSize(binary.length);
|
|
79
|
+
data.onLoadMemory?.(memoryMap);
|
|
80
|
+
}, [data.onLoadMemory]);
|
|
81
|
+
const handleFileLoad = useCallback(async (file) => {
|
|
82
|
+
const buffer = await file.arrayBuffer();
|
|
83
|
+
loadBinary(new Uint8Array(buffer), file.name);
|
|
84
|
+
}, [loadBinary]);
|
|
85
|
+
const handleDrop = useCallback((e) => {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
setIsDragOver(false);
|
|
89
|
+
const file = e.dataTransfer.files[0];
|
|
90
|
+
if (file)
|
|
91
|
+
handleFileLoad(file);
|
|
92
|
+
}, [handleFileLoad]);
|
|
93
|
+
const handleDragOver = useCallback((e) => {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
setIsDragOver(true);
|
|
97
|
+
}, []);
|
|
98
|
+
const handleDragLeave = useCallback((e) => {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
e.stopPropagation();
|
|
101
|
+
setIsDragOver(false);
|
|
102
|
+
}, []);
|
|
103
|
+
const handleClickDropZone = useCallback((e) => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
fileInputRef.current?.click();
|
|
106
|
+
}, []);
|
|
107
|
+
const handleFileInputChange = useCallback((e) => {
|
|
108
|
+
const file = e.target.files?.[0];
|
|
109
|
+
if (file)
|
|
110
|
+
handleFileLoad(file);
|
|
111
|
+
e.target.value = '';
|
|
112
|
+
}, [handleFileLoad]);
|
|
113
|
+
const handleClear = useCallback((e) => {
|
|
114
|
+
e.stopPropagation();
|
|
115
|
+
setLoadedFilename(null);
|
|
116
|
+
setLoadedSize(0);
|
|
117
|
+
data.onLoadMemory?.(new Map());
|
|
118
|
+
}, [data.onLoadMemory]);
|
|
119
|
+
const handleCompile = useCallback(async () => {
|
|
120
|
+
const sourceCode = code || PLACEHOLDER_CODE[language] || '';
|
|
121
|
+
if (!sourceCode.trim())
|
|
122
|
+
return;
|
|
123
|
+
setCompileStatus('compiling');
|
|
124
|
+
setCompileError('');
|
|
125
|
+
try {
|
|
126
|
+
const resp = await fetch('/api/compile', {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: { 'Content-Type': 'application/json' },
|
|
129
|
+
body: JSON.stringify({ source: sourceCode, language }),
|
|
130
|
+
});
|
|
131
|
+
const result = await resp.json();
|
|
132
|
+
if (!result.success) {
|
|
133
|
+
setCompileStatus('error');
|
|
134
|
+
setCompileError(result.stderr || result.error || 'Compilation failed');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const b64 = result.binary ?? '';
|
|
138
|
+
const raw = atob(b64);
|
|
139
|
+
const binary = new Uint8Array(raw.length);
|
|
140
|
+
for (let i = 0; i < raw.length; i++)
|
|
141
|
+
binary[i] = raw.charCodeAt(i);
|
|
142
|
+
loadBinary(binary, `program.${language}`);
|
|
143
|
+
setCompileStatus('success');
|
|
144
|
+
setTimeout(() => setCompileStatus('idle'), 2000);
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
setCompileStatus('error');
|
|
148
|
+
setCompileError(e instanceof Error ? e.message : 'Network error');
|
|
149
|
+
}
|
|
150
|
+
}, [code, language, loadBinary]);
|
|
151
|
+
const handleToggleCodeEditor = useCallback((e) => {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
setShowCodeEditor(prev => !prev);
|
|
154
|
+
}, []);
|
|
155
|
+
return (_jsxs(_Fragment, { children: [_jsx("input", { ref: fileInputRef, type: "file", accept: ".bin,.elf", onChange: handleFileInputChange, className: "hidden" }), _jsx(BaseNode, { inputPorts: inputPorts, outputPorts: outputPorts, selected: selected, className: "min-w-[140px]", showPortLabels: data.showPortLabels, onPortClick: data.onPortClick, glowUnconnected: data.glowUnconnected, children: _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("div", { className: "px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]", children: data.label || 'InstrMem' }), _jsx("div", { className: "px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]", children: "IMEM" }), _jsx("div", { className: `
|
|
156
|
+
flex flex-col items-center gap-1 p-2 rounded border-2 border-dashed cursor-pointer transition-all w-full
|
|
157
|
+
${isDragOver
|
|
158
|
+
? 'border-blue-500 bg-blue-500/10'
|
|
159
|
+
: loadedFilename
|
|
160
|
+
? 'border-green-500/50 bg-green-500/10'
|
|
161
|
+
: 'border-[var(--embed-border)] hover:border-blue-400 hover:bg-blue-500/5'}
|
|
162
|
+
`, onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onClick: handleClickDropZone, title: loadedFilename ? 'Click to replace' : 'Drop .bin or click', children: loadedFilename ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-xs text-green-400 font-medium truncate max-w-[120px]", children: loadedFilename }), _jsxs("div", { className: "text-xs text-[var(--embed-text-muted)]", children: [loadedSize, " bytes"] }), _jsx("button", { onClick: handleClear, className: "text-xs text-red-400 hover:text-red-300 hover:underline", children: "Clear" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-xs text-[var(--embed-text-muted)]", children: "Drop .bin" }), _jsx("div", { className: "text-xs text-[var(--embed-text-muted)]", children: "or click" })] })) }), _jsx("button", { onClick: handleToggleCodeEditor, className: `
|
|
163
|
+
w-full px-2 py-1 text-xs rounded transition-colors
|
|
164
|
+
${showCodeEditor
|
|
165
|
+
? 'bg-violet-500/20 text-violet-400'
|
|
166
|
+
: 'bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-muted)] hover:bg-violet-500/10 hover:text-violet-400'}
|
|
167
|
+
`, children: showCodeEditor ? 'Hide Code' : 'Code' }), showCodeEditor && (_jsxs("div", { className: "flex flex-col gap-2 w-full min-w-[280px] nodrag", onClick: (e) => e.stopPropagation(), children: [_jsx("div", { className: "flex gap-1", children: LANGUAGES.map(lang => (_jsx("button", { onClick: () => setLanguage(lang.value), className: `
|
|
168
|
+
px-2 py-0.5 text-xs rounded transition-colors
|
|
169
|
+
${language === lang.value
|
|
170
|
+
? 'bg-violet-500/30 text-violet-300'
|
|
171
|
+
: 'bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-muted)] hover:bg-[var(--embed-bg-tertiary)]/80'}
|
|
172
|
+
`, children: lang.label }, lang.value))) }), _jsx("textarea", { value: code, onChange: (e) => setCode(e.target.value), placeholder: PLACEHOLDER_CODE[language], className: "w-full h-32 p-2 text-xs font-mono rounded border border-[var(--embed-border)] bg-[var(--embed-bg-code)] text-[var(--embed-text-primary)] resize-y", spellCheck: false }), _jsx("button", { onClick: handleCompile, disabled: compileStatus === 'compiling', className: `
|
|
173
|
+
w-full px-3 py-1.5 text-xs font-medium rounded transition-colors
|
|
174
|
+
${compileStatus === 'compiling'
|
|
175
|
+
? 'bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-muted)] cursor-wait'
|
|
176
|
+
: compileStatus === 'success'
|
|
177
|
+
? 'bg-green-600 text-white'
|
|
178
|
+
: 'bg-violet-600 hover:bg-violet-500 text-white'}
|
|
179
|
+
`, children: compileStatus === 'compiling' ? 'Compiling...'
|
|
180
|
+
: compileStatus === 'success' ? 'Loaded!'
|
|
181
|
+
: 'Compile & Load' }), compileStatus === 'error' && compileError && (_jsx("div", { className: "p-2 text-xs font-mono rounded bg-red-500/10 text-red-400 max-h-24 overflow-y-auto whitespace-pre-wrap", children: compileError }))] }))] }) })] }));
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=RV32IInstrMemNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RV32IInstrMemNode.js","sourceRoot":"","sources":["../../src/nodes/RV32IInstrMemNode.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,CAAC;;AAEb,OAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAmB,MAAM,YAAY,CAAC;AAGvD,MAAM,SAAS,GAAG;IAChB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;IAC1B,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;IAC9B,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;CACtB,CAAC;AAEX,MAAM,gBAAgB,GAA2B;IAC/C,CAAC,EAAE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CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACxC,WAAW,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACvC,SAAS,EAAC,mJAAmJ,EAC7J,UAAU,EAAE,KAAK,GACjB,EAGF,iBACE,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,aAAa,KAAK,WAAW,EACvC,SAAS,EAAE;;oBAEP,aAAa,KAAK,WAAW;wCAC7B,CAAC,CAAC,0EAA0E;wCAC5E,CAAC,CAAC,aAAa,KAAK,SAAS;4CAC3B,CAAC,CAAC,yBAAyB;4CAC3B,CAAC,CAAC,8CACN;iBACD,YAEA,aAAa,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc;wCAC7C,CAAC,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS;4CACzC,CAAC,CAAC,gBAAgB,GACb,EAGR,aAAa,KAAK,OAAO,IAAI,YAAY,IAAI,CAC5C,cAAK,SAAS,EAAC,uGAAuG,YACnH,YAAY,GACT,CACP,IACG,CACP,IACG,GACG,IACV,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NodeData } from './NodeData';
|
|
2
|
+
interface RasterDisplayNodeProps {
|
|
3
|
+
data: NodeData;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function RasterDisplayNode({ data, selected }: RasterDisplayNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=RasterDisplayNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RasterDisplayNode.d.ts","sourceRoot":"","sources":["../../src/nodes/RasterDisplayNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,UAAU,sBAAsB;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CA+C3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseNode } from './BaseNode';
|
|
3
|
+
export function RasterDisplayNode({ data, selected }) {
|
|
4
|
+
const pixels = data.__pixels ?? new Array(64).fill(0);
|
|
5
|
+
const GRID_SIZE = 8;
|
|
6
|
+
const PIXEL_SIZE = 16;
|
|
7
|
+
const PIXEL_GAP = 2;
|
|
8
|
+
return (_jsx(BaseNode, { selected: selected, inputPorts: data.inputNames.map((name, index) => ({ name, index, type: 'input' })), outputPorts: data.outputNames.map((name, index) => ({ name, index, type: 'output' })), className: "min-w-[160px]", showPortLabels: data.showPortLabels, onPortClick: data.onPortClick, glowUnconnected: data.glowUnconnected, children: _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("div", { className: "px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]", children: data.label || 'RasterDisplay' }), _jsx("svg", { width: GRID_SIZE * PIXEL_SIZE + (GRID_SIZE - 1) * PIXEL_GAP, height: GRID_SIZE * PIXEL_SIZE + (GRID_SIZE - 1) * PIXEL_GAP, className: "border-2 border-gray-700 rounded bg-black", style: { imageRendering: 'pixelated' }, children: pixels.map((value, index) => {
|
|
9
|
+
const x = index % GRID_SIZE;
|
|
10
|
+
const y = Math.floor(index / GRID_SIZE);
|
|
11
|
+
return (_jsx("rect", { x: x * (PIXEL_SIZE + PIXEL_GAP), y: y * (PIXEL_SIZE + PIXEL_GAP), width: PIXEL_SIZE, height: PIXEL_SIZE, fill: value !== 0 ? '#00ff00' : '#1a1a1a' }, index));
|
|
12
|
+
}) }), _jsx("div", { className: "text-xs text-[var(--embed-text-secondary)]", children: "8\u00D78 raster scan" })] }) }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=RasterDisplayNode.js.map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,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,SAAS,EAC5D,SAAS,EAAC,2CAA2C,EACrD,KAAK,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,YAErC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;wBAC3B,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,CAAC;wBAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;wBACxC,OAAO,CACL,eAEE,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,EAC/B,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,EAC/B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IALpC,KAAK,CAMV,CACH,CAAC;oBACJ,CAAC,CAAC,GACE,EACN,cAAK,SAAS,EAAC,4CAA4C,qCAErD,IACF,GACG,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NodeData } from './NodeData';
|
|
2
|
+
interface RegisterNodeProps {
|
|
3
|
+
data: NodeData;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function RegisterNode({ data, selected }: RegisterNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=RegisterNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterNode.d.ts","sourceRoot":"","sources":["../../src/nodes/RegisterNode.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,UAAU,iBAAiB;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CA8BjE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseNode } from './BaseNode';
|
|
3
|
+
import { CompositeBadge } from './CompositeBadge';
|
|
4
|
+
export function RegisterNode({ data, selected }) {
|
|
5
|
+
const initialValue = typeof data.arguments?.initial === 'number' ? data.arguments.initial : 0;
|
|
6
|
+
const inputPorts = data.inputNames.map((name, index) => ({
|
|
7
|
+
name, index, type: 'input',
|
|
8
|
+
}));
|
|
9
|
+
const outputPorts = data.outputNames.map((name, index) => ({
|
|
10
|
+
name, index, type: 'output',
|
|
11
|
+
}));
|
|
12
|
+
return (_jsx(BaseNode, { inputPorts: inputPorts, outputPorts: outputPorts, selected: selected, className: "min-w-[100px]", showPortLabels: data.showPortLabels, onPortClick: data.onPortClick, glowUnconnected: data.glowUnconnected, children: _jsxs("div", { className: "relative flex flex-col items-center gap-2", children: [data.isComposite && _jsx(CompositeBadge, {}), _jsx("div", { className: "px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]", children: data.label || 'Register' }), _jsx("div", { className: "px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]", children: "REG" }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("div", { className: "text-xs text-[var(--embed-text-secondary)]", children: "Initial:" }), _jsx("div", { className: "px-2 py-1 bg-blue-500/20 text-blue-400 rounded font-mono text-xs", children: initialValue })] })] }) }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=RegisterNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterNode.js","sourceRoot":"","sources":["../../src/nodes/RegisterNode.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAmB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,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NodeData } from './NodeData';
|
|
2
|
+
interface ScreenNodeProps {
|
|
3
|
+
data: NodeData;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function ScreenNode({ data, selected }: ScreenNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ScreenNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenNode.d.ts","sourceRoot":"","sources":["../../src/nodes/ScreenNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,UAAU,eAAe;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAiD7D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseNode } from './BaseNode';
|
|
3
|
+
export function ScreenNode({ data, selected }) {
|
|
4
|
+
const GRID_W = data.arguments?.width ?? 8;
|
|
5
|
+
const GRID_H = data.arguments?.height ?? 8;
|
|
6
|
+
const TOTAL_PIXELS = GRID_W * GRID_H;
|
|
7
|
+
const pixels = data.__pixels ?? new Array(TOTAL_PIXELS).fill(0);
|
|
8
|
+
const PIXEL_SIZE = GRID_W <= 8 ? 16 : GRID_W <= 16 ? 8 : 4;
|
|
9
|
+
const PIXEL_GAP = GRID_W <= 8 ? 2 : GRID_W <= 16 ? 1 : 0;
|
|
10
|
+
return (_jsx(BaseNode, { selected: selected, inputPorts: data.inputNames.map((name, index) => ({ name, index, type: 'input' })), outputPorts: data.outputNames.map((name, index) => ({ name, index, type: 'output' })), className: "min-w-[160px]", showPortLabels: data.showPortLabels, onPortClick: data.onPortClick, glowUnconnected: data.glowUnconnected, children: _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("div", { className: "px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]", children: data.label || 'Screen' }), _jsx("svg", { width: GRID_W * PIXEL_SIZE + (GRID_W - 1) * PIXEL_GAP, height: GRID_H * PIXEL_SIZE + (GRID_H - 1) * PIXEL_GAP, className: "border-2 border-gray-700 rounded bg-black", style: { imageRendering: 'pixelated' }, children: pixels.slice(0, TOTAL_PIXELS).map((value, index) => {
|
|
11
|
+
const x = index % GRID_W;
|
|
12
|
+
const y = Math.floor(index / GRID_W);
|
|
13
|
+
return (_jsx("rect", { x: x * (PIXEL_SIZE + PIXEL_GAP), y: y * (PIXEL_SIZE + PIXEL_GAP), width: PIXEL_SIZE, height: PIXEL_SIZE, fill: value !== 0 ? '#00ff00' : '#1a1a1a' }, index));
|
|
14
|
+
}) }), _jsxs("div", { className: "text-xs text-[var(--embed-text-secondary)]", children: [GRID_W, "\u00D7", GRID_H, " pixels"] })] }) }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ScreenNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenNode.js","sourceRoot":"","sources":["../../src/nodes/ScreenNode.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAmB;IAC5D,MAAM,MAAM,GAAI,IAAI,CAAC,SAAS,EAAE,KAAgB,IAAI,CAAC,CAAC;IACtD,MAAM,MAAM,GAAI,IAAI,CAAC,SAAS,EAAE,MAAiB,IAAI,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;IACrC,MAAM,MAAM,GAAI,IAAI,CAAC,QAAqB,IAAI,IAAI,KAAK,CAAC,YAAY,CAAC,CA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EAAE,YAErC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;wBAClD,MAAM,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;wBACzB,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;wBACrC,OAAO,CACL,eAEE,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,EAC/B,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,EAC/B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IALpC,KAAK,CAMV,CACH,CAAC;oBACJ,CAAC,CAAC,GACE,EACN,eAAK,SAAS,EAAC,4CAA4C,aACxD,MAAM,YAAS,MAAM,eAClB,IACF,GACG,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NodeData } from './NodeData';
|
|
2
|
+
interface UartTxNodeProps {
|
|
3
|
+
data: NodeData;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function UartTxNode({ data, selected }: UartTxNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=UartTxNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UartTxNode.d.ts","sourceRoot":"","sources":["../../src/nodes/UartTxNode.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,UAAU,eAAe;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAwC7D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { BaseNode } from './BaseNode';
|
|
4
|
+
export function UartTxNode({ data, selected }) {
|
|
5
|
+
const textAreaRef = useRef(null);
|
|
6
|
+
const text = data.__uartText ?? '';
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (textAreaRef.current) {
|
|
9
|
+
textAreaRef.current.scrollTop = textAreaRef.current.scrollHeight;
|
|
10
|
+
}
|
|
11
|
+
}, [text]);
|
|
12
|
+
const lineCount = text ? text.split('\n').length : 0;
|
|
13
|
+
const charCount = text.length;
|
|
14
|
+
return (_jsx(BaseNode, { selected: selected, inputPorts: data.inputNames.map((name, index) => ({ name, index, type: 'input' })), outputPorts: data.outputNames.map((name, index) => ({ name, index, type: 'output' })), className: "min-w-[200px]", showPortLabels: data.showPortLabels, onPortClick: data.onPortClick, glowUnconnected: data.glowUnconnected, children: _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("div", { className: "px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]", children: data.label || 'UART TX' }), _jsx("pre", { ref: textAreaRef, className: "w-full h-32 overflow-auto rounded border-2 border-gray-700 bg-black text-green-400 font-mono text-xs p-2 whitespace-pre-wrap break-all", style: { minWidth: '180px', maxHeight: '200px' }, children: text || _jsx("span", { className: "text-[var(--embed-text-muted)]", children: "// UART output appears here" }) }), _jsxs("div", { className: "text-xs text-[var(--embed-text-secondary)]", children: [charCount, " chars, ", lineCount, " lines"] })] }) }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=UartTxNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UartTxNode.js","sourceRoot":"","sources":["../../src/nodes/UartTxNode.tsx"],"names":[],"mappings":";AACA,OAAO,EAA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cAAK,SAAS,EAAC,gEAAgE,YAC5E,IAAI,CAAC,KAAK,IAAI,SAAS,GACpB,EACN,cACE,GAAG,EAAE,WAAW,EAChB,SAAS,EAAC,wIAAwI,EAClJ,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAE/C,IAAI,IAAI,eAAM,SAAS,EAAC,gCAAgC,4CAAmC,GACxF,EACN,eAAK,SAAS,EAAC,4CAA4C,aACxD,SAAS,cAAU,SAAS,cACzB,IACF,GACG,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical node components for circuit rendering.
|
|
3
|
+
*
|
|
4
|
+
* Props-driven, store-free, theme-aware via CSS custom properties.
|
|
5
|
+
* Single source of truth — used by embed, editor, and blog.
|
|
6
|
+
*/
|
|
7
|
+
export { BaseNode } from './BaseNode';
|
|
8
|
+
export type { PortConfig, BaseNodeProps } from './BaseNode';
|
|
9
|
+
export { CompositeBadge } from './CompositeBadge';
|
|
10
|
+
export type { NodeData } from './NodeData';
|
|
11
|
+
export { InputNode } from './InputNode';
|
|
12
|
+
export { NumericInputNode } from './NumericInputNode';
|
|
13
|
+
export { EthFrameInputNode } from './EthFrameInputNode';
|
|
14
|
+
export { OutputNode } from './OutputNode';
|
|
15
|
+
export { ScreenNode } from './ScreenNode';
|
|
16
|
+
export { RasterDisplayNode } from './RasterDisplayNode';
|
|
17
|
+
export { ConsoleNode } from './ConsoleNode';
|
|
18
|
+
export { UartTxNode } from './UartTxNode';
|
|
19
|
+
export { EmbedConsoleNode } from './EmbedConsoleNode';
|
|
20
|
+
export { EmbedScreenNode } from './EmbedScreenNode';
|
|
21
|
+
export { LogicGateNode } from './LogicGateNode';
|
|
22
|
+
export { RegisterNode } from './RegisterNode';
|
|
23
|
+
export { RAMNode } from './RAMNode';
|
|
24
|
+
export { ROMNode } from './ROMNode';
|
|
25
|
+
export { NicFifoNode } from './NicFifoNode';
|
|
26
|
+
export { RV32IInstrMemNode } from './RV32IInstrMemNode';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nodes/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical node components for circuit rendering.
|
|
3
|
+
*
|
|
4
|
+
* Props-driven, store-free, theme-aware via CSS custom properties.
|
|
5
|
+
* Single source of truth — used by embed, editor, and blog.
|
|
6
|
+
*/
|
|
7
|
+
// Base
|
|
8
|
+
export { BaseNode } from './BaseNode';
|
|
9
|
+
export { CompositeBadge } from './CompositeBadge';
|
|
10
|
+
// Input nodes
|
|
11
|
+
export { InputNode } from './InputNode';
|
|
12
|
+
export { NumericInputNode } from './NumericInputNode';
|
|
13
|
+
export { EthFrameInputNode } from './EthFrameInputNode';
|
|
14
|
+
// Output / display nodes
|
|
15
|
+
export { OutputNode } from './OutputNode';
|
|
16
|
+
export { ScreenNode } from './ScreenNode';
|
|
17
|
+
export { RasterDisplayNode } from './RasterDisplayNode';
|
|
18
|
+
export { ConsoleNode } from './ConsoleNode';
|
|
19
|
+
export { UartTxNode } from './UartTxNode';
|
|
20
|
+
// Lightweight embed variants (legacy aliases)
|
|
21
|
+
export { EmbedConsoleNode } from './EmbedConsoleNode';
|
|
22
|
+
export { EmbedScreenNode } from './EmbedScreenNode';
|
|
23
|
+
// Logic / structural
|
|
24
|
+
export { LogicGateNode } from './LogicGateNode';
|
|
25
|
+
export { RegisterNode } from './RegisterNode';
|
|
26
|
+
export { RAMNode } from './RAMNode';
|
|
27
|
+
export { ROMNode } from './ROMNode';
|
|
28
|
+
export { NicFifoNode } from './NicFifoNode';
|
|
29
|
+
export { RV32IInstrMemNode } from './RV32IInstrMemNode';
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nodes/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO;AACP,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,8CAA8C;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
12
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/primitives/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;;8EA4BnB,CAAA;AAED,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,QAAA,MAAM,MAAM,uFAUX,CAAA;AAGD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
9
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
10
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
11
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
12
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
13
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-9 px-4 py-2",
|
|
17
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
18
|
+
lg: "h-10 rounded-md px-8",
|
|
19
|
+
icon: "h-9 w-9",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default",
|
|
24
|
+
size: "default",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const Button = React.forwardRef(({ className, variant, size, ...props }, ref) => {
|
|
28
|
+
return (_jsx("button", { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
29
|
+
});
|
|
30
|
+
Button.displayName = "Button";
|
|
31
|
+
export { Button, buttonVariants };
|
|
32
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/primitives/button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,MAAM,cAAc,GAAG,GAAG,CACxB,uSAAuS,EACvS;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EACL,+DAA+D;YACjE,WAAW,EACT,8EAA8E;YAChF,OAAO,EACL,0FAA0F;YAC5F,SAAS,EACP,wEAAwE;YAC1E,KAAK,EAAE,8CAA8C;YACrD,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,eAAe;YACxB,EAAE,EAAE,6BAA6B;YACjC,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,SAAS;SAChB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAA;AAQD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC9C,OAAO,CACL,iBACE,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAC3D,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAA;AACH,CAAC,CACF,CAAA;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Button, buttonVariants, type ButtonProps } from './button';
|
|
2
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, } from './tooltip';
|
|
3
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, } from './sheet';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Button, buttonVariants } from './button';
|
|
2
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, } from './tooltip';
|
|
3
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, } from './sheet';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAC;AACpE,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function SheetContent({ className, children, side, showCloseButton, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
7
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
8
|
+
showCloseButton?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
15
|
+
//# sourceMappingURL=sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../src/primitives/sheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AAIxD,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,2CAE5E;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,2CAErD;AAED,iBAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAEnD;AAwBD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG;IACvD,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,2CA8BA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQxE;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAQnD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,2CAQzD;AAED,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { XIcon } from "lucide-react";
|
|
3
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
function Sheet({ ...props }) {
|
|
6
|
+
return _jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
7
|
+
}
|
|
8
|
+
function SheetTrigger({ ...props }) {
|
|
9
|
+
return _jsx(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
10
|
+
}
|
|
11
|
+
function SheetClose({ ...props }) {
|
|
12
|
+
return _jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
|
|
13
|
+
}
|
|
14
|
+
function SheetPortal({ ...props }) {
|
|
15
|
+
return _jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
16
|
+
}
|
|
17
|
+
function SheetOverlay({ className, ...props }) {
|
|
18
|
+
return (_jsx(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
21
|
+
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", side === "right" &&
|
|
22
|
+
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", side === "left" &&
|
|
23
|
+
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", side === "top" &&
|
|
24
|
+
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", side === "bottom" &&
|
|
25
|
+
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [_jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
26
|
+
}
|
|
27
|
+
function SheetHeader({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "sheet-header", className: cn("flex flex-col gap-1.5 p-4", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function SheetFooter({ className, ...props }) {
|
|
31
|
+
return (_jsx("div", { "data-slot": "sheet-footer", className: cn("mt-auto flex flex-col gap-2 p-4", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function SheetTitle({ className, ...props }) {
|
|
34
|
+
return (_jsx(SheetPrimitive.Title, { "data-slot": "sheet-title", className: cn("text-foreground font-semibold", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function SheetDescription({ className, ...props }) {
|
|
37
|
+
return (_jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn("text-muted-foreground text-sm", className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
40
|
+
//# sourceMappingURL=sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.js","sourceRoot":"","sources":["../../src/primitives/sheet.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,SAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAoD;IAC3E,OAAO,KAAC,cAAc,CAAC,IAAI,iBAAW,OAAO,KAAK,KAAK,GAAI,CAAA;AAC7D,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EAC4C;IACpD,OAAO,KAAC,cAAc,CAAC,OAAO,iBAAW,eAAe,KAAK,KAAK,GAAI,CAAA;AACxE,CAAC;AAED,SAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,cAAc,CAAC,KAAK,iBAAW,aAAa,KAAK,KAAK,GAAI,CAAA;AACpE,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,cAAc,CAAC,MAAM,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EAC4C;IACpD,OAAO,CACL,KAAC,cAAc,CAAC,OAAO,iBACX,eAAe,EACzB,SAAS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E,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACgD;IACxD,OAAO,CACL,KAAC,cAAc,CAAC,WAAW,iBACf,mBAAmB,EAC7B,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EACL,KAAK,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
8
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/primitives/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAItD,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,2CAQxD;AAED,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAEpD;AAED,iBAAS,cAAc,CAAC,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,2CAEvD;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,UAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,2CAiBvD;AAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
5
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
|
|
6
|
+
}
|
|
7
|
+
function Tooltip({ ...props }) {
|
|
8
|
+
return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
9
|
+
}
|
|
10
|
+
function TooltipTrigger({ ...props }) {
|
|
11
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
12
|
+
}
|
|
13
|
+
function TooltipContent({ className, sideOffset = 0, children, ...props }) {
|
|
14
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })] }) }));
|
|
15
|
+
}
|
|
16
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
17
|
+
//# sourceMappingURL=tooltip.js.map
|