simple-circuit-engine 0.0.13 → 0.0.14
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 +7 -5
- package/README.md +8 -8
- package/dist/core/index.js +110 -85
- package/dist/core/setup.d.ts +10 -0
- package/dist/core/simulation/behaviors/index.d.ts +10 -0
- package/dist/core/simulation/behaviors/interface/EightInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/EightLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/FourInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/FourLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/InputBehaviorMixin.d.ts +37 -0
- package/dist/core/simulation/behaviors/interface/LightBehaviorMixin.d.ts +60 -0
- package/dist/core/simulation/behaviors/interface/OneInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/OneLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/TwoInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/TwoLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/index.d.ts +0 -0
- package/dist/core/simulation/states/index.d.ts +10 -0
- package/dist/core/simulation/states/interface/EightInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/EightLightState.d.ts +6 -0
- package/dist/core/simulation/states/interface/FourInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/FourLightState.d.ts +6 -0
- package/dist/core/simulation/states/interface/InputState.d.ts +45 -0
- package/dist/core/simulation/states/interface/LightState.d.ts +54 -0
- package/dist/core/simulation/states/interface/OneInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/OneLightState.d.ts +6 -0
- package/dist/core/simulation/states/interface/TwoInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/TwoLightState.d.ts +6 -0
- package/dist/core/simulation/types.d.ts +9 -1
- package/dist/core/topology/Component.d.ts +4 -0
- package/dist/core/topology/ENode.d.ts +7 -2
- package/dist/core/topology/index.d.ts +2 -0
- package/dist/core/topology/networkTraversal.d.ts +50 -0
- package/dist/core/topology/types.d.ts +13 -2
- package/dist/{core-b6Q8w2sn.js → core-HH6iRWtB.js} +1850 -739
- package/dist/core-HH6iRWtB.js.map +1 -0
- package/dist/i18n/index.d.ts +276 -0
- package/dist/i18n/locales/en.json.d.ts +98 -0
- package/dist/i18n/locales/fr.json.d.ts +98 -0
- package/dist/index.js +172 -135
- package/dist/scene/CircuitEngine.d.ts +36 -4
- package/dist/scene/index.d.ts +6 -2
- package/dist/scene/index.js +62 -50
- package/dist/scene/setup.d.ts +10 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +5 -3
- package/dist/scene/shared/HoverManager.d.ts +15 -0
- package/dist/scene/shared/components/index.d.ts +10 -0
- package/dist/scene/shared/components/interface/EightInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/EightLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/FourInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/FourLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/InputVisualFactoryBase.d.ts +50 -0
- package/dist/scene/shared/components/interface/LightVisualFactoryBase.d.ts +46 -0
- package/dist/scene/shared/components/interface/OneInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/OneLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/TwoInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/TwoLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/types.d.ts +34 -2
- package/dist/scene/shared/utils/ControlsUtils.d.ts +1 -1
- package/dist/scene/shared/utils/GeometryUtils.d.ts +35 -0
- package/dist/scene/static/CircuitController.d.ts +12 -1
- package/dist/scene/static/tools/BuildTool.d.ts +77 -0
- package/dist/scene/static/tools/MultiWiringPlacement.d.ts +40 -0
- package/dist/scene/widgets/HelpWidget.d.ts +13 -0
- package/dist/scene/widgets/ModeWidget.d.ts +16 -0
- package/dist/scene/widgets/MultiWiringWidget.d.ts +21 -0
- package/dist/scene/{static → widgets}/PinTooltipWidget.d.ts +2 -1
- package/dist/scene/widgets/SimulationPlayerWidget.d.ts +62 -0
- package/dist/scene/widgets/ToolsWidget.d.ts +18 -0
- package/dist/scene/widgets/WidgetsManager.d.ts +65 -0
- package/dist/scene/widgets/assets/icons.d.ts +20 -0
- package/dist/scene/widgets/index.d.ts +9 -0
- package/dist/scene/widgets/styles.d.ts +33 -0
- package/dist/{scene-D4QcWeiq.js → scene-C1xhdw_B.js} +3311 -1478
- package/dist/scene-C1xhdw_B.js.map +1 -0
- package/package.json +2 -2
- package/dist/core-b6Q8w2sn.js.map +0 -1
- package/dist/scene-D4QcWeiq.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,139 +1,176 @@
|
|
|
1
|
-
import { $ as t, A as e, At as
|
|
2
|
-
import { A as
|
|
1
|
+
import { $ as t, $t as s, A as e, At as i, B as r, Bt as o, C as n, Ct as c, D as l, Dt as h, E as u, Et as S, F as g, Ft as B, G as p, Gt as y, H as F, Ht as v, I as C, It as d, J as m, Jt as L, K as E, Kt as I, L as V, Lt as G, M as N, Mt as T, N as A, Nt as O, O as M, Ot as D, P as R, Pt as f, Q as w, Qt as P, R as _, Rt as b, S as X, St as W, T as x, Tt as H, U, Ut as k, V as z, Vt as Y, W as Q, Wt as j, X as q, Xt as J, Y as K, Yt as Z, Z as $, Zt as aa, _ as ta, _t as sa, a as ea, at as ia, b as ra, bt as oa, c as na, ct as ca, d as la, dt as ha, en as ua, et as Sa, f as ga, ft as Ba, g as pa, gt as ya, h as Fa, ht as va, i as Ca, it as da, j as ma, jt as La, k as Ea, kt as Ia, l as Va, lt as Ga, m as Na, mt as Ta, n as Aa, nt as Oa, o as Ma, ot as Da, p as Ra, pt as fa, q as wa, qt as Pa, r as _a, rt as ba, s as Xa, st as Wa, t as xa, tn as Ha, tt as Ua, u as ka, ut as za, v as Ya, vt as Qa, w as ja, wt as qa, x as Ja, xt as Ka, y as Za, yt as $a, z as at, zt as tt } from "./core-HH6iRWtB.js";
|
|
2
|
+
import { $ as et, A as it, B as rt, C as ot, D as nt, E as ct, F as lt, G as ht, H as ut, I as St, J as gt, K as Bt, L as pt, M as yt, N as Ft, O as vt, P as Ct, Q as dt, R as mt, S as Lt, T as Et, U as It, V as Vt, W as Gt, X as Nt, Y as Tt, Z as At, _ as Ot, a as Mt, at as Dt, b as Rt, c as ft, ct as wt, d as Pt, et as _t, f as bt, g as Xt, h as Wt, i as xt, it as Ht, j as Ut, k as kt, l as zt, lt as Yt, m as Qt, n as jt, nt as qt, o as Jt, ot as Kt, p as Zt, q as $t, r as as, rt as ts, s as ss, st as es, t as is, tt as rs, u as os, v as ns, w as cs, x as ls, y as hs, z as us } from "./scene-C1xhdw_B.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
4
|
+
o as ALL_LOGIC_FAMILIES,
|
|
5
|
+
Ja as AdderBehavior,
|
|
6
|
+
Ua as AdderState,
|
|
7
|
+
Ot as AdderVisualFactory,
|
|
8
|
+
ba as ArithmeticState,
|
|
9
|
+
Kt as BRANCHING_POINT_SENTINEL,
|
|
10
|
+
r as BatteryBehavior,
|
|
11
|
+
Ka as BatteryState,
|
|
12
|
+
pt as BatteryVisualFactory,
|
|
13
|
+
F as BehaviorRegistry,
|
|
14
|
+
et as BranchingPointVisualFactory,
|
|
15
|
+
Dt as BuildTool,
|
|
16
|
+
Y as CIRCUIT_FILE_VERSION,
|
|
17
|
+
Vt as CMP_MATERIALS,
|
|
18
|
+
v as COMPONENT_TYPE_METADATA,
|
|
19
|
+
P as CameraOptions,
|
|
20
|
+
La as Circuit,
|
|
21
|
+
gt as CircuitController,
|
|
22
|
+
ht as CircuitEngine,
|
|
23
|
+
B as CircuitMetadata,
|
|
24
|
+
d as CircuitOptions,
|
|
25
|
+
ea as CircuitRunner,
|
|
26
|
+
$t as CircuitRunnerController,
|
|
27
|
+
qt as CircuitWriter,
|
|
28
|
+
A as ClockBehavior,
|
|
29
|
+
Ta as ClockState,
|
|
30
|
+
kt as ClockVisualFactory,
|
|
31
|
+
ut as CmpMatCategory,
|
|
32
|
+
It as CmpMatType,
|
|
33
|
+
Gt as CmpMatVariant,
|
|
34
|
+
G as Component,
|
|
35
|
+
es as ComponentPickerWidget,
|
|
36
|
+
W as ComponentState,
|
|
37
|
+
k as ComponentType,
|
|
38
|
+
j as DEFAULT_LOGIC_FAMILY,
|
|
39
|
+
us as DefaultVisualFactory,
|
|
40
|
+
Xa as DirtyTracker,
|
|
41
|
+
R as DoubleThrowSwitchBehavior,
|
|
42
|
+
va as DoubleThrowSwitchState,
|
|
43
|
+
it as DoubleThrowSwitchVisualFactory,
|
|
44
|
+
tt as ENode,
|
|
45
|
+
y as ENodeSourceType,
|
|
46
|
+
I as ENodeType,
|
|
47
|
+
ra as EightBitAdderBehavior,
|
|
48
|
+
Sa as EightBitAdderState,
|
|
49
|
+
Xt as EightBitAdderVisualFactory,
|
|
50
|
+
Za as EightBitOnesComplementBehavior,
|
|
51
|
+
t as EightBitOnesComplementState,
|
|
52
|
+
Wt as EightBitOnesComplementVisualFactory,
|
|
53
|
+
Na as EightInputBehavior,
|
|
54
|
+
m as EightInputState,
|
|
55
|
+
os as EightInputVisualFactory,
|
|
56
|
+
Va as EightLightBehavior,
|
|
57
|
+
U as EightLightState,
|
|
58
|
+
Mt as EightLightVisualFactory,
|
|
59
|
+
na as EventQueue,
|
|
60
|
+
rt as FactoryRegistry,
|
|
61
|
+
Fa as FourInputBehavior,
|
|
62
|
+
K as FourInputState,
|
|
63
|
+
Pt as FourInputVisualFactory,
|
|
64
|
+
ka as FourLightBehavior,
|
|
65
|
+
Q as FourLightState,
|
|
66
|
+
Jt as FourLightVisualFactory,
|
|
67
|
+
mt as GroupedFactoryRegistry,
|
|
68
|
+
X as HalfAdderBehavior,
|
|
69
|
+
Oa as HalfAdderState,
|
|
70
|
+
ns as HalfAdderVisualFactory,
|
|
71
|
+
rs as HitboxLayers,
|
|
72
|
+
_t as HoverManager,
|
|
73
|
+
Ya as InputBehaviorMixin,
|
|
74
|
+
w as InputState,
|
|
75
|
+
Qt as InputVisualFactoryBase,
|
|
76
|
+
N as InverterBehavior,
|
|
77
|
+
fa as InverterState,
|
|
78
|
+
vt as InverterVisualFactory,
|
|
79
|
+
St as LabelVisualFactory,
|
|
80
|
+
Ra as LightBehaviorMixin,
|
|
81
|
+
wa as LightState,
|
|
82
|
+
zt as LightVisualFactoryBase,
|
|
83
|
+
at as LightbulbBehavior,
|
|
84
|
+
oa as LightbulbState,
|
|
85
|
+
lt as LightbulbVisualFactory,
|
|
86
|
+
ua as Memoize,
|
|
87
|
+
Ha as MemoizeExpiring,
|
|
88
|
+
Ht as MultiSelectTool,
|
|
89
|
+
e as Nand4GateBehavior,
|
|
90
|
+
ha as Nand4GateState,
|
|
91
|
+
ct as Nand4GateVisualFactory,
|
|
74
92
|
Ea as Nand8GateBehavior,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
za as Nand8GateState,
|
|
94
|
+
Et as Nand8GateVisualFactory,
|
|
95
|
+
ma as NandGateBehavior,
|
|
96
|
+
Ba as NandGateState,
|
|
97
|
+
nt as NandGateVisualFactory,
|
|
98
|
+
l as Nor4GateBehavior,
|
|
99
|
+
ca as Nor4GateState,
|
|
100
|
+
ot as Nor4GateVisualFactory,
|
|
101
|
+
u as Nor8GateBehavior,
|
|
102
|
+
Wa as Nor8GateState,
|
|
103
|
+
Lt as Nor8GateVisualFactory,
|
|
104
|
+
M as NorGateBehavior,
|
|
105
|
+
Ga as NorGateState,
|
|
106
|
+
cs as NorGateVisualFactory,
|
|
107
|
+
ta as OneInputBehavior,
|
|
108
|
+
$ as OneInputState,
|
|
109
|
+
Zt as OneInputVisualFactory,
|
|
110
|
+
ga as OneLightBehavior,
|
|
111
|
+
E as OneLightState,
|
|
112
|
+
ft as OneLightVisualFactory,
|
|
113
|
+
Z as Position,
|
|
114
|
+
s as Position3D,
|
|
115
|
+
_ as RectangleLEDBehavior,
|
|
116
|
+
Qa as RectangleLEDState,
|
|
117
|
+
Ct as RectangleLEDVisualFactory,
|
|
118
|
+
V as RelayBehavior,
|
|
119
|
+
sa as RelayState,
|
|
120
|
+
Ft as RelayVisualFactory,
|
|
121
|
+
L as Rotation,
|
|
122
|
+
wt as SCE_NS,
|
|
123
|
+
H as SIMULATION_SPEED,
|
|
124
|
+
ts as SelectionManager,
|
|
125
|
+
c as SimulationState,
|
|
126
|
+
C as SmallLEDBehavior,
|
|
127
|
+
$a as SmallLEDState,
|
|
128
|
+
yt as SmallLEDVisualFactory,
|
|
129
|
+
Ma as StateManager,
|
|
130
|
+
g as SwitchBehavior,
|
|
131
|
+
ya as SwitchState,
|
|
132
|
+
Ut as SwitchVisualFactory,
|
|
133
|
+
S as TRANSITION_DEFAULTS,
|
|
134
|
+
pa as TwoInputBehavior,
|
|
135
|
+
q as TwoInputState,
|
|
136
|
+
bt as TwoInputVisualFactory,
|
|
137
|
+
la as TwoLightBehavior,
|
|
138
|
+
p as TwoLightState,
|
|
139
|
+
ss as TwoLightVisualFactory,
|
|
140
|
+
Bt as WidgetsManager,
|
|
141
|
+
b as Wire,
|
|
142
|
+
dt as WireVisualManager,
|
|
143
|
+
ja as Xor4GateBehavior,
|
|
144
|
+
ia as Xor4GateState,
|
|
145
|
+
Rt as Xor4GateVisualFactory,
|
|
146
|
+
n as Xor8GateBehavior,
|
|
147
|
+
da as Xor8GateState,
|
|
148
|
+
hs as Xor8GateVisualFactory,
|
|
149
|
+
x as XorGateBehavior,
|
|
119
150
|
Da as XorGateState,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
151
|
+
ls as XorGateVisualFactory,
|
|
152
|
+
T as classifyGate,
|
|
153
|
+
O as computeGateDelay,
|
|
154
|
+
f as computeTransitionSpan,
|
|
155
|
+
Tt as controllerOptions,
|
|
156
|
+
Nt as engineOptions,
|
|
157
|
+
h as findBpsAtLogicDistance,
|
|
158
|
+
D as findBpsAtLogicDistanceWithPath,
|
|
159
|
+
Ia as findPinsReachableFromBp,
|
|
160
|
+
i as findPinsReachableFromBpWithPath,
|
|
161
|
+
J as findPositionBestIndex,
|
|
162
|
+
Pa as generateUUID,
|
|
163
|
+
z as getTransitionSpan,
|
|
164
|
+
At as mapControlsOptions,
|
|
165
|
+
xa as registerArithmeticComponentsBehaviors,
|
|
166
|
+
is as registerArithmeticComponentsFactories,
|
|
167
|
+
Aa as registerBasicComponentsBehaviors,
|
|
168
|
+
jt as registerBasicComponentsFactories,
|
|
169
|
+
_a as registerGatesComponentsBehaviors,
|
|
170
|
+
as as registerGatesComponentsFactories,
|
|
171
|
+
Ca as registerInterfaceComponentsBehaviors,
|
|
172
|
+
xt as registerInterfaceComponentsFactories,
|
|
173
|
+
Yt as registerSceTranslations,
|
|
174
|
+
aa as simplifyPositions,
|
|
175
|
+
qa as unionElectricalStates
|
|
139
176
|
};
|
|
@@ -25,8 +25,10 @@ import * as THREE from 'three';
|
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
28
|
+
* const renderer = new THREE.WebGLRenderer({ antialias: true });
|
|
28
29
|
* const engine = new CircuitEngine(factoryRegistry, behaviorRegistry);
|
|
29
|
-
* engine.initialize(container);
|
|
30
|
+
* engine.initialize(container, renderer);
|
|
31
|
+
* container.appendChild(renderer.domElement);
|
|
30
32
|
* engine.setCircuit(circuit);
|
|
31
33
|
*
|
|
32
34
|
* // Edit mode (default)
|
|
@@ -49,11 +51,13 @@ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
|
|
|
49
51
|
private _editController;
|
|
50
52
|
private _simulationController;
|
|
51
53
|
private _mode;
|
|
54
|
+
private _multiWiring;
|
|
52
55
|
private _initialized;
|
|
53
56
|
private _options;
|
|
54
57
|
private _disposed;
|
|
55
58
|
private _editControllerCleanup;
|
|
56
59
|
private _simulationControllerCleanup;
|
|
60
|
+
private _widgetsManager;
|
|
57
61
|
/**
|
|
58
62
|
* Create a new CircuitEngine instance.
|
|
59
63
|
*
|
|
@@ -71,15 +75,20 @@ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
|
|
|
71
75
|
*/
|
|
72
76
|
get isDisposed(): boolean;
|
|
73
77
|
/**
|
|
74
|
-
* Initialize the engine with a DOM container.
|
|
78
|
+
* Initialize the engine with a DOM container and a WebGLRenderer.
|
|
75
79
|
* Creates shared Three.js resources and both controllers.
|
|
76
80
|
*
|
|
77
|
-
*
|
|
81
|
+
* The caller owns the renderer and its canvas; the engine binds MapControls
|
|
82
|
+
* to `renderer.domElement` (not the container) so DOM overlays such as the
|
|
83
|
+
* integrated widgets can receive pointer events normally.
|
|
84
|
+
*
|
|
85
|
+
* @param container - HTMLElement to mount the scene (used for bounds, mouse tracking, widget overlay)
|
|
86
|
+
* @param renderer - WebGLRenderer owned by the consumer. Its canvas (`renderer.domElement`) is used for pointer input.
|
|
78
87
|
* @param options - Configuration options
|
|
79
88
|
* @throws {TypeError} If container is not a valid HTMLElement
|
|
80
89
|
* @throws {Error} If already initialized
|
|
81
90
|
*/
|
|
82
|
-
initialize(container: HTMLElement, options?: EngineOptions): void;
|
|
91
|
+
initialize(container: HTMLElement, renderer: THREE.WebGLRenderer, options?: EngineOptions): void;
|
|
83
92
|
/**
|
|
84
93
|
* Create shared resources for both controllers.
|
|
85
94
|
*/
|
|
@@ -174,6 +183,17 @@ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
|
|
|
174
183
|
* @throws {Error} If not in edit mode
|
|
175
184
|
*/
|
|
176
185
|
setEditModeEnabled(enabled: boolean): void;
|
|
186
|
+
/**
|
|
187
|
+
* Whether the multi-wiring flag is currently enabled.
|
|
188
|
+
* Wiring tools may use it to create several wires per pull (semantics handled
|
|
189
|
+
* by the tools; the engine only owns the flag and forwards changes).
|
|
190
|
+
*/
|
|
191
|
+
get multiWiring(): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Toggle the multi-wiring flag and forward to the edit controller.
|
|
194
|
+
* Emits `multiWiringChanged` once on transition.
|
|
195
|
+
*/
|
|
196
|
+
setMultiWiring(value: boolean): void;
|
|
177
197
|
/**
|
|
178
198
|
* Start automatic simulation playback.
|
|
179
199
|
*
|
|
@@ -198,6 +218,18 @@ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
|
|
|
198
218
|
* @throws {Error} If not in simulation mode
|
|
199
219
|
*/
|
|
200
220
|
stop(): void;
|
|
221
|
+
/**
|
|
222
|
+
* Request help for the current mode. Emits `helpRequested` with the active
|
|
223
|
+
* mode as payload; consumers decide how to render help (modal, sidebar, etc.).
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* engine.on('helpRequested', ({ mode }) => {
|
|
228
|
+
* openHelpDialog(mode);
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
requestHelp(): void;
|
|
201
233
|
/**
|
|
202
234
|
* Check if simulation is currently playing
|
|
203
235
|
*/
|
package/dist/scene/index.d.ts
CHANGED
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
* ```typescript
|
|
12
12
|
* import { CircuitController, FactoryRegistry } from 'simple-circuit-controller/scene';
|
|
13
13
|
*
|
|
14
|
+
* const renderer = new THREE.WebGLRenderer({ antialias: true });
|
|
14
15
|
* const registry = new FactoryRegistry(defaultFactory);
|
|
15
16
|
* const controller = new CircuitController(registry);
|
|
16
|
-
* controller.initialize(container);
|
|
17
|
+
* controller.initialize(container, renderer);
|
|
18
|
+
* container.appendChild(renderer.domElement);
|
|
17
19
|
* controller.setCircuit(circuit);
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
@@ -21,6 +23,8 @@ export { CircuitEngine } from './CircuitEngine';
|
|
|
21
23
|
export { CircuitController } from './static/CircuitController';
|
|
22
24
|
export { CircuitRunnerController } from './simulation/CircuitRunnerController';
|
|
23
25
|
export type { AbstractCircuitController } from './shared/AbstractCircuitController';
|
|
26
|
+
export { WidgetsManager } from './widgets';
|
|
27
|
+
export type { IEngineForWidgets } from './widgets';
|
|
24
28
|
export { BuildTool } from './static/tools/BuildTool';
|
|
25
29
|
export { MultiSelectTool } from './static/tools/MultiSelectTool';
|
|
26
30
|
export { ComponentPickerWidget, BRANCHING_POINT_SENTINEL, } from './static/tools/ComponentPickerWidget';
|
|
@@ -40,4 +44,4 @@ export * from './shared/types';
|
|
|
40
44
|
export { HitboxLayers } from './shared/utils/LayerConstants';
|
|
41
45
|
export type { HitboxLayerValue } from './shared/utils/LayerConstants';
|
|
42
46
|
export * from './shared/utils/Options';
|
|
43
|
-
export { registerBasicComponentsFactories, registerGatesComponentsFactories, registerArithmeticComponentsFactories } from './setup';
|
|
47
|
+
export { registerBasicComponentsFactories, registerGatesComponentsFactories, registerArithmeticComponentsFactories, registerInterfaceComponentsFactories } from './setup';
|
package/dist/scene/index.js
CHANGED
|
@@ -1,52 +1,64 @@
|
|
|
1
|
-
import { A as s, B as
|
|
1
|
+
import { $ as t, A as s, B as r, C as i, D as o, E as e, F as l, G as c, H as u, I as n, J as y, K as F, L as V, M as g, N as p, O as C, P as h, Q as m, R as d, S as G, T as L, U as I, V as N, W as E, X as M, Y as B, Z as T, _ as A, a as O, at as R, b as S, c as b, d as w, et as f, f as D, g as H, h as P, i as W, it as X, j as _, k, l as v, m as x, n as j, nt as q, o as z, ot as J, p as K, q as Q, r as U, rt as Y, s as Z, st as $, t as aa, tt as ta, u as sa, v as ra, w as ia, x as oa, y as ea, z as la } from "../scene-C1xhdw_B.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
3
|
+
A as AdderVisualFactory,
|
|
4
|
+
J as BRANCHING_POINT_SENTINEL,
|
|
5
|
+
V as BatteryVisualFactory,
|
|
6
|
+
t as BranchingPointVisualFactory,
|
|
7
|
+
R as BuildTool,
|
|
8
|
+
N as CMP_MATERIALS,
|
|
9
|
+
y as CircuitController,
|
|
10
|
+
c as CircuitEngine,
|
|
11
|
+
Q as CircuitRunnerController,
|
|
12
|
+
q as CircuitWriter,
|
|
13
|
+
k as ClockVisualFactory,
|
|
14
|
+
u as CmpMatCategory,
|
|
15
|
+
I as CmpMatType,
|
|
16
|
+
E as CmpMatVariant,
|
|
17
|
+
$ as ComponentPickerWidget,
|
|
18
|
+
la as DefaultVisualFactory,
|
|
19
|
+
s as DoubleThrowSwitchVisualFactory,
|
|
20
|
+
H as EightBitAdderVisualFactory,
|
|
21
|
+
P as EightBitOnesComplementVisualFactory,
|
|
22
|
+
sa as EightInputVisualFactory,
|
|
23
|
+
O as EightLightVisualFactory,
|
|
24
|
+
r as FactoryRegistry,
|
|
25
|
+
w as FourInputVisualFactory,
|
|
26
|
+
z as FourLightVisualFactory,
|
|
27
|
+
d as GroupedFactoryRegistry,
|
|
28
|
+
ra as HalfAdderVisualFactory,
|
|
29
|
+
ta as HitboxLayers,
|
|
30
|
+
f as HoverManager,
|
|
31
|
+
x as InputVisualFactoryBase,
|
|
32
|
+
C as InverterVisualFactory,
|
|
33
|
+
n as LabelVisualFactory,
|
|
34
|
+
v as LightVisualFactoryBase,
|
|
35
|
+
l as LightbulbVisualFactory,
|
|
36
|
+
X as MultiSelectTool,
|
|
37
|
+
e as Nand4GateVisualFactory,
|
|
38
|
+
L as Nand8GateVisualFactory,
|
|
39
|
+
o as NandGateVisualFactory,
|
|
40
|
+
i as Nor4GateVisualFactory,
|
|
41
|
+
G as Nor8GateVisualFactory,
|
|
42
|
+
ia as NorGateVisualFactory,
|
|
43
|
+
K as OneInputVisualFactory,
|
|
44
|
+
b as OneLightVisualFactory,
|
|
45
|
+
h as RectangleLEDVisualFactory,
|
|
46
|
+
p as RelayVisualFactory,
|
|
47
|
+
Y as SelectionManager,
|
|
48
|
+
g as SmallLEDVisualFactory,
|
|
49
|
+
_ as SwitchVisualFactory,
|
|
50
|
+
D as TwoInputVisualFactory,
|
|
51
|
+
Z as TwoLightVisualFactory,
|
|
52
|
+
F as WidgetsManager,
|
|
53
|
+
m as WireVisualManager,
|
|
54
|
+
S as Xor4GateVisualFactory,
|
|
55
|
+
ea as Xor8GateVisualFactory,
|
|
56
|
+
oa as XorGateVisualFactory,
|
|
57
|
+
B as controllerOptions,
|
|
58
|
+
M as engineOptions,
|
|
59
|
+
T as mapControlsOptions,
|
|
60
|
+
aa as registerArithmeticComponentsFactories,
|
|
61
|
+
j as registerBasicComponentsFactories,
|
|
62
|
+
U as registerGatesComponentsFactories,
|
|
63
|
+
W as registerInterfaceComponentsFactories
|
|
52
64
|
};
|
package/dist/scene/setup.d.ts
CHANGED
|
@@ -24,3 +24,13 @@ export declare function registerGatesComponentsFactories(registry: IGroupedFacto
|
|
|
24
24
|
* @returns The input registry for chaining
|
|
25
25
|
*/
|
|
26
26
|
export declare function registerArithmeticComponentsFactories(registry: IGroupedFactoryRegistry): IGroupedFactoryRegistry;
|
|
27
|
+
/**
|
|
28
|
+
* Register all interface components visual factories in the interface group.
|
|
29
|
+
* Interface components are:
|
|
30
|
+
* - inputs: OneInput, TwoInput, FourInput, EightInput
|
|
31
|
+
* - lights: OneLight, TwoLight, FourLight, EightLight
|
|
32
|
+
* @public
|
|
33
|
+
* @param registry - A grouped factory registry to populate
|
|
34
|
+
* @returns The input registry for chaining
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerInterfaceComponentsFactories(registry: IGroupedFactoryRegistry): IGroupedFactoryRegistry;
|
|
@@ -32,6 +32,7 @@ import * as THREE from 'three';
|
|
|
32
32
|
*/
|
|
33
33
|
export declare abstract class AbstractCircuitController extends EventEmitter<ControllerEventMap> {
|
|
34
34
|
protected _container: HTMLElement | null;
|
|
35
|
+
protected _renderer: THREE.WebGLRenderer | null;
|
|
35
36
|
protected _scene: THREE.Scene | null;
|
|
36
37
|
protected _grid: THREE.GridHelper | null;
|
|
37
38
|
protected _camera: THREE.PerspectiveCamera | null;
|
|
@@ -69,18 +70,19 @@ export declare abstract class AbstractCircuitController extends EventEmitter<Con
|
|
|
69
70
|
protected get grid(): THREE.GridHelper | null;
|
|
70
71
|
protected set grid(grid: THREE.GridHelper);
|
|
71
72
|
/**
|
|
72
|
-
* Initialize the controller with a DOM container.
|
|
73
|
+
* Initialize the controller with a DOM container and a WebGLRenderer.
|
|
73
74
|
* Creates scene, camera, lights, MapControls, and HoverManager.
|
|
74
75
|
*
|
|
75
76
|
* When sharedResources were provided in constructor, uses those instead
|
|
76
77
|
* of creating new resources. This enables the CircuitEngine facade pattern.
|
|
77
78
|
*
|
|
78
|
-
* @param container - HTMLElement to attach scene to
|
|
79
|
+
* @param container - HTMLElement to attach scene to (bounds, hover, mouse tracking)
|
|
80
|
+
* @param renderer - WebGLRenderer owned by the consumer; `renderer.domElement` is what MapControls binds to
|
|
79
81
|
* @param options - Optional configuration
|
|
80
82
|
* @throws {TypeError} If container is not a valid HTMLElement
|
|
81
83
|
* @throws {Error} If already initialized
|
|
82
84
|
*/
|
|
83
|
-
initialize(container: HTMLElement, options?: ControllerOptions): void;
|
|
85
|
+
initialize(container: HTMLElement, renderer: THREE.WebGLRenderer, options?: ControllerOptions): void;
|
|
84
86
|
/**
|
|
85
87
|
* Hook for subclasses to perform additional initialization.
|
|
86
88
|
* Called after base initialization but before emitting 'ready'.
|
|
@@ -55,6 +55,21 @@ export declare class HoverManager {
|
|
|
55
55
|
* @param normalizedY - Mouse Y in normalized HTML container coordinates [-1, 1]
|
|
56
56
|
*/
|
|
57
57
|
updateFromMouse(normalizedX: number, normalizedY: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Raycast against the descendants of the given component object3D at the
|
|
60
|
+
* last known mouse position and return all `userData.part` strings that
|
|
61
|
+
* are currently hit.
|
|
62
|
+
*
|
|
63
|
+
* Useful when a click on a component hitbox needs to be refined to a
|
|
64
|
+
* specific sub-part (e.g. one switch among many in a multi-input
|
|
65
|
+
* component). Unlike priority hover detection this method ignores hitbox
|
|
66
|
+
* layers and walks the full sub-tree.
|
|
67
|
+
*
|
|
68
|
+
* @param componentObject3D - Root object of the component to introspect
|
|
69
|
+
* @returns De-duplicated `part` strings hit, in raycast order. Empty if
|
|
70
|
+
* no annotated mesh is under the cursor.
|
|
71
|
+
*/
|
|
72
|
+
getHoveredComponentParts(componentObject3D: THREE.Object3D): string[];
|
|
58
73
|
/**
|
|
59
74
|
* Force update hover state at current mouse position
|
|
60
75
|
*
|
|
@@ -31,3 +31,13 @@ export { HalfAdderVisualFactory } from './arithmetic/HalfAdderVisualFactory';
|
|
|
31
31
|
export { AdderVisualFactory } from './arithmetic/AdderVisualFactory';
|
|
32
32
|
export { EightBitAdderVisualFactory } from './arithmetic/EightBitAdderVisualFactory';
|
|
33
33
|
export { EightBitOnesComplementVisualFactory } from './arithmetic/EightBitOnesComplementVisualFactory';
|
|
34
|
+
export { InputVisualFactoryBase } from './interface/InputVisualFactoryBase';
|
|
35
|
+
export { OneInputVisualFactory } from './interface/OneInputVisualFactory';
|
|
36
|
+
export { TwoInputVisualFactory } from './interface/TwoInputVisualFactory';
|
|
37
|
+
export { FourInputVisualFactory } from './interface/FourInputVisualFactory';
|
|
38
|
+
export { EightInputVisualFactory } from './interface/EightInputVisualFactory';
|
|
39
|
+
export { LightVisualFactoryBase } from './interface/LightVisualFactoryBase';
|
|
40
|
+
export { OneLightVisualFactory } from './interface/OneLightVisualFactory';
|
|
41
|
+
export { TwoLightVisualFactory } from './interface/TwoLightVisualFactory';
|
|
42
|
+
export { FourLightVisualFactory } from './interface/FourLightVisualFactory';
|
|
43
|
+
export { EightLightVisualFactory } from './interface/EightLightVisualFactory';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from '../../../../core/index.ts';
|
|
2
|
+
import { VisualContext } from '../../types';
|
|
3
|
+
import { InputVisualFactoryBase } from './InputVisualFactoryBase';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/** Visual factory for the EightInput component (eight-switch user input). */
|
|
6
|
+
export declare class EightInputVisualFactory extends InputVisualFactoryBase {
|
|
7
|
+
protected readonly bitCount = 8;
|
|
8
|
+
protected readonly holePositions: Array<{
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}>;
|
|
12
|
+
protected readonly envelopeHeight = 8.4;
|
|
13
|
+
constructor();
|
|
14
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
15
|
+
}
|