fix: update generatedAt timestamp and clean up component metadata defaults
feat: enhance wire tracking in DynamicComponent for better event handling chore: mark subproject commits as dirty for rp2040js and wokwi-elements
This commit is contained in:
parent
0e366ee5dc
commit
e489a10255
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version": "1.0.0",
|
||||
"generatedAt": "2026-04-02T01:25:51.523Z",
|
||||
"generatedAt": "2026-04-07T14:03:23.074Z",
|
||||
"components": [
|
||||
{
|
||||
"id": "arduino-mega",
|
||||
|
|
@ -247,17 +247,9 @@
|
|||
"name": "imageData",
|
||||
"type": "string",
|
||||
"control": "text"
|
||||
},
|
||||
{
|
||||
"name": "protocol",
|
||||
"type": "select",
|
||||
"control": "select",
|
||||
"options": ["i2c", "spi"],
|
||||
"defaultValue": "i2c",
|
||||
"description": "Communication protocol"
|
||||
}
|
||||
],
|
||||
"defaultValues": { "protocol": "i2c" },
|
||||
"defaultValues": {},
|
||||
"pinCount": 0,
|
||||
"tags": [
|
||||
"ssd1306"
|
||||
|
|
@ -1332,11 +1324,9 @@
|
|||
},
|
||||
{
|
||||
"name": "color",
|
||||
"type": "select",
|
||||
"type": "string",
|
||||
"defaultValue": "red",
|
||||
"control": "select",
|
||||
"options": ["red", "green", "blue", "yellow", "orange", "white", "purple"],
|
||||
"description": "LED color"
|
||||
"control": "text"
|
||||
},
|
||||
{
|
||||
"name": "lightColor",
|
||||
|
|
|
|||
|
|
@ -59,6 +59,15 @@ export const DynamicComponent: React.FC<DynamicComponentProps> = ({
|
|||
// display to flash blank and lose its frame buffer.
|
||||
const hexEpoch = useSimulatorStore((s) => s.hexEpoch);
|
||||
|
||||
// Track wires connected to this component so attachEvents re-runs when
|
||||
// wires are added or removed (e.g. disconnecting an LED cathode from GND).
|
||||
const wireFingerprint = useSimulatorStore((s) => {
|
||||
const myWires = s.wires.filter(
|
||||
w => w.start.componentId === id || w.end.componentId === id
|
||||
);
|
||||
return myWires.map(w => w.id).join(',');
|
||||
});
|
||||
|
||||
// Check if component is interactive (has simulation logic with attachEvents)
|
||||
const logic = PartSimulationRegistry.get(metadata.id || id.split('-')[0]);
|
||||
const isInteractive = logic?.attachEvents !== undefined;
|
||||
|
|
@ -228,7 +237,7 @@ export const DynamicComponent: React.FC<DynamicComponentProps> = ({
|
|||
el.removeEventListener('button-press', onButtonPress);
|
||||
el.removeEventListener('button-release', onButtonRelease);
|
||||
};
|
||||
}, [id, handleComponentEvent, metadata.id, simulator, hexEpoch]);
|
||||
}, [id, handleComponentEvent, metadata.id, simulator, hexEpoch, wireFingerprint]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Reference in New Issue