simple-circuit-engine 0.0.8 → 0.0.10
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 +19 -11
- package/CLAUDE.md +4 -3
- package/README.md +4 -4
- package/dist/{CircuitRunner-FXM_s5ll.js → CircuitRunner-DEb7JdNf.js} +543 -211
- package/dist/CircuitRunner-DEb7JdNf.js.map +1 -0
- package/dist/core/index.js +923 -604
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.ts +779 -140
- package/dist/index.js +96 -68
- package/dist/scene/index.d.ts +3 -2
- package/dist/scene/index.js +37 -26
- package/dist/{setup-aoI3UTB5.js → setup-AB1vFiis.js} +3176 -1571
- package/dist/setup-AB1vFiis.js.map +1 -0
- package/package.json +1 -1
- package/dist/CircuitRunner-FXM_s5ll.js.map +0 -1
- package/dist/setup-aoI3UTB5.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -14,20 +14,25 @@ import {
|
|
|
14
14
|
Circuit,
|
|
15
15
|
BehaviorRegistry,
|
|
16
16
|
registerBasicComponentsBehaviors,
|
|
17
|
+
registerGatesComponentsBehaviors,
|
|
17
18
|
} from 'simple-circuit-engine/core';
|
|
18
19
|
import {
|
|
19
20
|
CircuitEngine,
|
|
20
21
|
engineOptions,
|
|
21
|
-
|
|
22
|
+
GroupedFactoryRegistry,
|
|
22
23
|
DefaultVisualFactory,
|
|
23
24
|
registerBasicComponentsFactories,
|
|
25
|
+
registerGatesComponentsFactories,
|
|
24
26
|
} from 'simple-circuit-engine/scene';
|
|
25
27
|
|
|
26
28
|
// Create component factory registry and behavior registry with basic components
|
|
27
29
|
const componentsFactoryRegistry = registerBasicComponentsFactories(
|
|
28
|
-
new
|
|
30
|
+
new GroupedFactoryRegistry(new DefaultVisualFactory())
|
|
29
31
|
);
|
|
32
|
+
registerGatesComponentsFactories(componentsFactoryRegistry); //... other groups of components if needed
|
|
33
|
+
|
|
30
34
|
const behaviorRegistry = registerBasicComponentsBehaviors(new BehaviorRegistry());
|
|
35
|
+
registerGatesComponentsBehaviors(behaviorRegistry); //... other groupsof components if needed
|
|
31
36
|
|
|
32
37
|
// Instanciate and Initialize CircuitEngine (it creates and uses a new Circuit by default)
|
|
33
38
|
const engine = new CircuitEngine(componentsFactoryRegistry, behaviorRegistry);
|
|
@@ -67,7 +72,7 @@ animate();
|
|
|
67
72
|
- `CircuitRunner` - Tick-based simulation orchestrator
|
|
68
73
|
- `SimulationState` - Circuit state at a given tick
|
|
69
74
|
- `BehaviorRegistry` - Maps ComponentType → behavior logic
|
|
70
|
-
- `registerBasicComponentsBehaviors()` - Registers built-in behaviors
|
|
75
|
+
- `registerBasicComponentsBehaviors()` - Registers basic components built-in behaviors
|
|
71
76
|
|
|
72
77
|
### Types
|
|
73
78
|
|
|
@@ -84,15 +89,19 @@ animate();
|
|
|
84
89
|
|
|
85
90
|
### Visual Factories
|
|
86
91
|
|
|
87
|
-
- `
|
|
92
|
+
- `GroupedFactoryRegistry` - Register groups of components referencing types and their visual factories
|
|
88
93
|
- `DefaultVisualFactory` - Fallback factory for unknown types
|
|
89
|
-
- `registerBasicComponentsFactories()` - Registers built-in factories
|
|
94
|
+
- `registerBasicComponentsFactories()` - Registers basic components built-in factories
|
|
90
95
|
|
|
91
96
|
### Tools (Edit Mode)
|
|
92
97
|
|
|
93
|
-
- `BuildTool` - Primary editing tool
|
|
94
|
-
- `
|
|
95
|
-
|
|
98
|
+
- `BuildTool` - Primary unified editing tool (add/drag/move/rotate/remove/wire/copy-cut/paste one element)
|
|
99
|
+
- `MultiSelectTool` - Rectangle selection + bulk ops (drag, copy-cut/paste, remove multiple elements)
|
|
100
|
+
|
|
101
|
+
### Widgets
|
|
102
|
+
|
|
103
|
+
- `ComponentPicketWidget` - Widget for selecting component to add in BuildTool (edit mode)
|
|
104
|
+
- `ConfigPanelWidget.ts` - Widget for editing components configuration (edit mode)
|
|
96
105
|
|
|
97
106
|
### Managers
|
|
98
107
|
|
|
@@ -130,10 +139,9 @@ engine.on('simulationTick', (state) => { ... });
|
|
|
130
139
|
### Non-Goals
|
|
131
140
|
|
|
132
141
|
- **NOT realistic physics**: This is a discrete graph model, not SPICE
|
|
133
|
-
- **
|
|
142
|
+
- **No analog simulation**: No voltage drops, current limiting, etc.
|
|
134
143
|
- **Circuit states are boolean**: Tension/current are on/off, not continuous values
|
|
135
|
-
- **
|
|
136
|
-
|
|
144
|
+
- **NOT for production circuits**: Educational purposes only
|
|
137
145
|
|
|
138
146
|
### Do NOT
|
|
139
147
|
|
package/CLAUDE.md
CHANGED
|
@@ -68,9 +68,10 @@ src/scene/
|
|
|
68
68
|
| +-- CircuitWriter.ts # Writes scene changes to core model
|
|
69
69
|
| +-- SelectionManager.ts # Tracks selected elements
|
|
70
70
|
| +-- tools/
|
|
71
|
-
| +-- BuildTool.ts # Unified
|
|
71
|
+
| +-- BuildTool.ts # Unified build tool (state machine)
|
|
72
|
+
| +-- ComponentPickerWidget.ts # Widget for selecting component to add in BuildTool
|
|
73
|
+
| +-- ConfigPanelWidget.ts # Widget for changing components configuration
|
|
72
74
|
| +-- MultiSelectTool.ts # Rectangle selection + bulk operations
|
|
73
|
-
| +-- AddComponentTool.ts # Component placement tool
|
|
74
75
|
+-- simulation/
|
|
75
76
|
| +-- CircuitRunnerController.ts # Simulation mode controller
|
|
76
77
|
+-- shared/
|
|
@@ -81,7 +82,7 @@ src/scene/
|
|
|
81
82
|
| +-- BranchingPointVisualFactory.ts # BP visuals
|
|
82
83
|
| +-- components/
|
|
83
84
|
| | +-- ComponentVisualFactory.ts # Interface + base class
|
|
84
|
-
| | +--
|
|
85
|
+
| | +-- GroupedFactoryRegistry.ts # Register groups of components referencing types and their visual factories
|
|
85
86
|
| | +-- ... # Components factories
|
|
86
87
|
| +-- types.ts # Shared type definitions
|
|
87
88
|
| +-- utils/ # Geometry, camera, lighting utilities
|
package/README.md
CHANGED
|
@@ -37,11 +37,11 @@ This code set up the main CircuitEngine instance in edit mode on a new Circuit,
|
|
|
37
37
|
```javascript
|
|
38
38
|
import { WebGLRenderer } from 'three';
|
|
39
39
|
import { Circuit, BehaviorRegistry, registerBasicComponentsBehaviors } from 'simple-circuit-engine/core';
|
|
40
|
-
import { CircuitEngine, engineOptions,
|
|
40
|
+
import { CircuitEngine, engineOptions, GroupedFactoryRegistry, DefaultVisualFactory, registerBasicComponentsBehaviors } from 'simple-circuit-engine/scene';
|
|
41
41
|
|
|
42
|
-
// Create component factory registry with
|
|
43
|
-
const componentsFactoryRegistry = registerBasicComponentsFactories(new
|
|
44
|
-
// Create behavior registry with
|
|
42
|
+
// Create component factory registry with basic components visual factories (for scene objects creation - rendering)
|
|
43
|
+
const componentsFactoryRegistry = registerBasicComponentsFactories(new GroupedFactoryRegistry(new DefaultVisualFactory()));
|
|
44
|
+
// Create behavior registry with basic components behaviors (for simulation)
|
|
45
45
|
const behaviorRegistry = registerBasicComponentsBehaviors(new BehaviorRegistry());
|
|
46
46
|
|
|
47
47
|
// Initialize CircuitEngine
|