simple-circuit-engine 0.0.11 → 0.0.12
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/AGENTS.md +10 -7
- package/CLAUDE.md +4 -6
- package/README.md +5 -2
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +74 -2114
- package/dist/core/setup.d.ts +17 -0
- package/dist/core/simulation/CircuitRunner.d.ts +176 -0
- package/dist/core/simulation/DirtyTracker.d.ts +87 -0
- package/dist/core/simulation/EventQueue.d.ts +68 -0
- package/dist/core/simulation/StateManager.d.ts +100 -0
- package/dist/core/simulation/behaviors/BehaviorRegistry.d.ts +70 -0
- package/dist/core/simulation/behaviors/ComponentBehavior.d.ts +53 -0
- package/dist/core/simulation/behaviors/basic/BatteryBehavior.d.ts +14 -0
- package/dist/core/simulation/behaviors/basic/ClockBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/DoubleThrowSwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/LightbulbBehavior.d.ts +23 -0
- package/dist/core/simulation/behaviors/basic/RectangleLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/RelayBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/SmallLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/SwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/index.d.ts +20 -0
- package/dist/core/simulation/behaviors/gates/InverterBehavior.d.ts +29 -0
- package/dist/core/simulation/behaviors/gates/Nand4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nand8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NandGateBehavior.d.ts +28 -0
- package/dist/core/simulation/behaviors/gates/Nor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/Xor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Xor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/XorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/index.d.ts +34 -0
- package/dist/core/simulation/behaviors/index.d.ts +24 -0
- package/dist/core/simulation/behaviors/types.d.ts +101 -0
- package/dist/core/simulation/index.d.ts +18 -0
- package/dist/core/simulation/states/ComponentState.d.ts +57 -0
- package/dist/core/simulation/states/SimulationState.d.ts +46 -0
- package/dist/core/simulation/states/basic/BatteryState.d.ts +16 -0
- package/dist/core/simulation/states/basic/ClockState.d.ts +16 -0
- package/dist/core/simulation/states/basic/DoubleThrowSwitchState.d.ts +21 -0
- package/dist/core/simulation/states/basic/LightbulbState.d.ts +21 -0
- package/dist/core/simulation/states/basic/RectangleLEDState.d.ts +9 -0
- package/dist/core/simulation/states/basic/RelayState.d.ts +25 -0
- package/dist/core/simulation/states/basic/SmallLEDState.d.ts +21 -0
- package/dist/core/simulation/states/basic/SwitchState.d.ts +25 -0
- package/dist/core/simulation/states/gates/InverterState.d.ts +17 -0
- package/dist/core/simulation/states/gates/Nand4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nand8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NandGateState.d.ts +16 -0
- package/dist/core/simulation/states/gates/Nor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/XorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/index.d.ts +25 -0
- package/dist/core/simulation/states/index.d.ts +26 -0
- package/dist/core/simulation/states/types.d.ts +32 -0
- package/dist/core/simulation/types.d.ts +155 -0
- package/dist/core/topology/Circuit.d.ts +420 -0
- package/dist/core/topology/CircuitMetadata.d.ts +24 -0
- package/dist/core/topology/CircuitOptions.d.ts +14 -0
- package/dist/core/topology/Component.d.ts +152 -0
- package/dist/core/topology/ENode.d.ts +200 -0
- package/dist/core/topology/Wire.d.ts +130 -0
- package/dist/core/topology/delays.d.ts +52 -0
- package/dist/core/topology/index.d.ts +14 -0
- package/dist/core/topology/types.d.ts +175 -0
- package/dist/core/utils/CameraOptions.d.ts +83 -0
- package/dist/core/utils/MemoizeDecorator.d.ts +9 -0
- package/dist/core/utils/Position.d.ts +166 -0
- package/dist/core/utils/Position3D.d.ts +77 -0
- package/dist/core/utils/Rotation.d.ts +82 -0
- package/dist/core/utils/index.d.ts +24 -0
- package/dist/core/utils/types.d.ts +35 -0
- package/dist/core-Bjta9Y7_.js +2707 -0
- package/dist/core-Bjta9Y7_.js.map +1 -0
- package/dist/index.d.ts +13 -6306
- package/dist/index.js +117 -110
- package/dist/scene/CircuitEngine.d.ts +270 -0
- package/dist/scene/index.d.ts +0 -1
- package/dist/scene/index.js +43 -39
- package/dist/scene/setup.d.ts +18 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +211 -0
- package/dist/scene/shared/BranchingPointVisualFactory.d.ts +70 -0
- package/dist/scene/shared/EventEmitter.d.ts +92 -0
- package/dist/scene/shared/HoverManager.d.ts +151 -0
- package/dist/scene/shared/SelectionManager.d.ts +159 -0
- package/dist/scene/shared/WireVisualManager.d.ts +242 -0
- package/dist/scene/shared/components/ComponentVisualFactory.d.ts +438 -0
- package/dist/scene/shared/components/DefaultVisualFactory.d.ts +51 -0
- package/dist/scene/shared/components/FactoryRegistry.d.ts +84 -0
- package/dist/scene/shared/components/GroupedFactoryRegistry.d.ts +153 -0
- package/dist/scene/shared/components/basic/BatteryVisualFactory.d.ts +13 -0
- package/dist/scene/shared/components/basic/ClockVisualFactory.d.ts +79 -0
- package/dist/scene/shared/components/basic/DoubleThrowSwitchVisualFactory.d.ts +87 -0
- package/dist/scene/shared/components/basic/LabelVisualFactory.d.ts +148 -0
- package/dist/scene/shared/components/basic/LightbulbVisualFactory.d.ts +72 -0
- package/dist/scene/shared/components/basic/RectangleLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/RelayVisualFactory.d.ts +92 -0
- package/dist/scene/shared/components/basic/SmallLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/SwitchVisualFactory.d.ts +85 -0
- package/dist/scene/shared/components/gates/InverterVisualFactory.d.ts +104 -0
- package/dist/scene/shared/components/gates/Nand4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nand8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NandGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Nor4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nor8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NorGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Xor4GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/Xor8GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/XorGateVisualFactory.d.ts +103 -0
- package/dist/scene/shared/components/index.d.ts +29 -0
- package/dist/scene/shared/components/types.d.ts +43 -0
- package/dist/scene/shared/types.d.ts +476 -0
- package/dist/scene/shared/utils/CameraUtils.d.ts +23 -0
- package/dist/scene/shared/utils/ColorUtils.d.ts +26 -0
- package/dist/scene/shared/utils/ControlsUtils.d.ts +8 -0
- package/dist/scene/shared/utils/GeometryUtils.d.ts +261 -0
- package/dist/scene/shared/utils/LayerConstants.d.ts +40 -0
- package/dist/scene/shared/utils/LightingUtils.d.ts +31 -0
- package/dist/scene/shared/utils/MaterialUtils.d.ts +73 -0
- package/dist/scene/shared/utils/Options.d.ts +16 -0
- package/dist/scene/simulation/CircuitRunnerController.d.ts +227 -0
- package/dist/scene/static/CircuitController.d.ts +227 -0
- package/dist/scene/static/CircuitWriter.d.ts +146 -0
- package/dist/scene/static/PinTooltipWidget.d.ts +26 -0
- package/dist/scene/static/tools/BuildTool.d.ts +286 -0
- package/dist/scene/static/tools/ComponentPickerWidget.d.ts +82 -0
- package/dist/scene/static/tools/ConfigPanelWidget.d.ts +93 -0
- package/dist/scene/static/tools/MultiSelectTool.d.ts +265 -0
- package/dist/scene-CVsDdySt.js +7357 -0
- package/dist/scene-CVsDdySt.js.map +1 -0
- package/package.json +24 -25
- package/dist/CircuitRunner-BQQlhwjD.js +0 -1981
- package/dist/CircuitRunner-BQQlhwjD.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/scene/index.js.map +0 -1
- package/dist/setup-CIq_kgaw.js +0 -10230
- package/dist/setup-CIq_kgaw.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -9,7 +9,7 @@ Educational electronic / computer circuit Build & Simulation engine with THREE.j
|
|
|
9
9
|
## Quick Start
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { WebGLRenderer } from 'three';
|
|
12
|
+
import { WebGLRenderer, Clock } from 'three';
|
|
13
13
|
import {
|
|
14
14
|
Circuit,
|
|
15
15
|
CircuitOptions,
|
|
@@ -50,11 +50,15 @@ renderer.setSize(container.clientWidth, container.clientHeight);
|
|
|
50
50
|
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
51
51
|
// Append renderer to DOM
|
|
52
52
|
container.appendChild(renderer.domElement);
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
// Animation loop
|
|
55
|
+
const clock = new Clock();
|
|
54
56
|
function animate() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
requestAnimationFrame(animate);
|
|
58
|
+
const delta = clock.getDelta();
|
|
59
|
+
engine.update(delta);
|
|
60
|
+
engine.getControls().update();
|
|
61
|
+
renderer.render(engine.getScene(), engine.getCamera());
|
|
58
62
|
}
|
|
59
63
|
animate();
|
|
60
64
|
```
|
|
@@ -156,7 +160,6 @@ engine.on('simulationTick', (state) => { ... });
|
|
|
156
160
|
|
|
157
161
|
```json
|
|
158
162
|
{
|
|
159
|
-
"three": "^0.
|
|
160
|
-
"lil-gui": "^0.21.0"
|
|
163
|
+
"three": "^0.183.2"
|
|
161
164
|
}
|
|
162
165
|
```
|
package/CLAUDE.md
CHANGED
|
@@ -8,15 +8,15 @@ Last updated: 2026-03-14
|
|
|
8
8
|
|
|
9
9
|
## Goals and principles
|
|
10
10
|
|
|
11
|
-
To provide a vulgarization library that teaches the frontier between electronics and low level coding.
|
|
11
|
+
To provide a vulgarization library that teaches the frontier between electronics and low level coding.
|
|
12
12
|
The electrical model is very simplified (no level of voltage/current, resistance, capacitance or inductance, type or frequency of current)
|
|
13
|
-
and reduced to a logic state (has voltage/electrons sink true or false, has ground/electrons source true or false)/event engine.
|
|
13
|
+
and reduced to a logic state (has voltage/electrons sink true or false, has ground/electrons source true or false)/event engine.
|
|
14
14
|
However, it aims to teach real-world electronic design principles so modeling of components propagation delay and logic families is emphasized.
|
|
15
15
|
|
|
16
16
|
## Active Technologies
|
|
17
17
|
|
|
18
|
-
- TypeScript
|
|
19
|
-
- Three.js 0.
|
|
18
|
+
- TypeScript 6.0+ (strict mode), targeting ES2022
|
|
19
|
+
- Three.js 0.183+ (scene, camera, controls, 3D objects, Line2)
|
|
20
20
|
- lil-gui as helper for small interactive modal forms
|
|
21
21
|
- in-memory circuit model, optional loading/saving from/to a JSON file
|
|
22
22
|
|
|
@@ -32,7 +32,6 @@ Simple Circuit Engine follows a **Model-Controller** architecture with clear sep
|
|
|
32
32
|
The core module is **dependency-free** and contains all domain logic.
|
|
33
33
|
Refer to its [CLAUDE.md](src/core/CLAUDE.md) for more details.
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
### Scene Module (`src/scene/`)
|
|
37
36
|
|
|
38
37
|
The scene module handles Three.js visualization, user interaction and simulation animation.
|
|
@@ -53,4 +52,3 @@ npm test && npm run lint
|
|
|
53
52
|
## Code Style
|
|
54
53
|
|
|
55
54
|
TypeScript (strict mode), targeting ES2022: Follow standard conventions
|
|
56
|
-
|
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ In addition to `simple-circuit-engine` you must import the `three` and `lil-gui`
|
|
|
35
35
|
This code set up the main CircuitEngine instance in edit mode on a new Circuit, handles THREE.js objects creation and rendering/animation in the canva-container HTML element.
|
|
36
36
|
|
|
37
37
|
```javascript
|
|
38
|
-
import { WebGLRenderer } from 'three';
|
|
38
|
+
import { WebGLRenderer, Clock } from 'three';
|
|
39
39
|
import { Circuit, CircuitOptions, BehaviorRegistry, registerBasicComponentsBehaviors } from 'simple-circuit-engine/core';
|
|
40
40
|
import { CircuitEngine, engineOptions, GroupedFactoryRegistry, DefaultVisualFactory, registerBasicComponentsBehaviors } from 'simple-circuit-engine/scene';
|
|
41
41
|
|
|
@@ -62,9 +62,12 @@ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
|
62
62
|
// Append renderer to DOM
|
|
63
63
|
container.appendChild(renderer.domElement);
|
|
64
64
|
|
|
65
|
-
// Animation loop
|
|
65
|
+
// Animation loop
|
|
66
|
+
const clock = new Clock();
|
|
66
67
|
function animate() {
|
|
67
68
|
requestAnimationFrame(animate);
|
|
69
|
+
const delta = clock.getDelta();
|
|
70
|
+
engine.update(delta);
|
|
68
71
|
engine.getControls().update();
|
|
69
72
|
renderer.render(engine.getScene(), engine.getCamera());
|
|
70
73
|
}
|
package/dist/core/index.d.ts
CHANGED