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.
Files changed (77) hide show
  1. package/AGENTS.md +7 -5
  2. package/README.md +8 -8
  3. package/dist/core/index.js +110 -85
  4. package/dist/core/setup.d.ts +10 -0
  5. package/dist/core/simulation/behaviors/index.d.ts +10 -0
  6. package/dist/core/simulation/behaviors/interface/EightInputBehavior.d.ts +9 -0
  7. package/dist/core/simulation/behaviors/interface/EightLightBehavior.d.ts +9 -0
  8. package/dist/core/simulation/behaviors/interface/FourInputBehavior.d.ts +9 -0
  9. package/dist/core/simulation/behaviors/interface/FourLightBehavior.d.ts +9 -0
  10. package/dist/core/simulation/behaviors/interface/InputBehaviorMixin.d.ts +37 -0
  11. package/dist/core/simulation/behaviors/interface/LightBehaviorMixin.d.ts +60 -0
  12. package/dist/core/simulation/behaviors/interface/OneInputBehavior.d.ts +9 -0
  13. package/dist/core/simulation/behaviors/interface/OneLightBehavior.d.ts +9 -0
  14. package/dist/core/simulation/behaviors/interface/TwoInputBehavior.d.ts +9 -0
  15. package/dist/core/simulation/behaviors/interface/TwoLightBehavior.d.ts +9 -0
  16. package/dist/core/simulation/behaviors/interface/index.d.ts +0 -0
  17. package/dist/core/simulation/states/index.d.ts +10 -0
  18. package/dist/core/simulation/states/interface/EightInputState.d.ts +6 -0
  19. package/dist/core/simulation/states/interface/EightLightState.d.ts +6 -0
  20. package/dist/core/simulation/states/interface/FourInputState.d.ts +6 -0
  21. package/dist/core/simulation/states/interface/FourLightState.d.ts +6 -0
  22. package/dist/core/simulation/states/interface/InputState.d.ts +45 -0
  23. package/dist/core/simulation/states/interface/LightState.d.ts +54 -0
  24. package/dist/core/simulation/states/interface/OneInputState.d.ts +6 -0
  25. package/dist/core/simulation/states/interface/OneLightState.d.ts +6 -0
  26. package/dist/core/simulation/states/interface/TwoInputState.d.ts +6 -0
  27. package/dist/core/simulation/states/interface/TwoLightState.d.ts +6 -0
  28. package/dist/core/simulation/types.d.ts +9 -1
  29. package/dist/core/topology/Component.d.ts +4 -0
  30. package/dist/core/topology/ENode.d.ts +7 -2
  31. package/dist/core/topology/index.d.ts +2 -0
  32. package/dist/core/topology/networkTraversal.d.ts +50 -0
  33. package/dist/core/topology/types.d.ts +13 -2
  34. package/dist/{core-b6Q8w2sn.js → core-HH6iRWtB.js} +1850 -739
  35. package/dist/core-HH6iRWtB.js.map +1 -0
  36. package/dist/i18n/index.d.ts +276 -0
  37. package/dist/i18n/locales/en.json.d.ts +98 -0
  38. package/dist/i18n/locales/fr.json.d.ts +98 -0
  39. package/dist/index.js +172 -135
  40. package/dist/scene/CircuitEngine.d.ts +36 -4
  41. package/dist/scene/index.d.ts +6 -2
  42. package/dist/scene/index.js +62 -50
  43. package/dist/scene/setup.d.ts +10 -0
  44. package/dist/scene/shared/AbstractCircuitController.d.ts +5 -3
  45. package/dist/scene/shared/HoverManager.d.ts +15 -0
  46. package/dist/scene/shared/components/index.d.ts +10 -0
  47. package/dist/scene/shared/components/interface/EightInputVisualFactory.d.ts +15 -0
  48. package/dist/scene/shared/components/interface/EightLightVisualFactory.d.ts +15 -0
  49. package/dist/scene/shared/components/interface/FourInputVisualFactory.d.ts +15 -0
  50. package/dist/scene/shared/components/interface/FourLightVisualFactory.d.ts +15 -0
  51. package/dist/scene/shared/components/interface/InputVisualFactoryBase.d.ts +50 -0
  52. package/dist/scene/shared/components/interface/LightVisualFactoryBase.d.ts +46 -0
  53. package/dist/scene/shared/components/interface/OneInputVisualFactory.d.ts +15 -0
  54. package/dist/scene/shared/components/interface/OneLightVisualFactory.d.ts +15 -0
  55. package/dist/scene/shared/components/interface/TwoInputVisualFactory.d.ts +15 -0
  56. package/dist/scene/shared/components/interface/TwoLightVisualFactory.d.ts +15 -0
  57. package/dist/scene/shared/types.d.ts +34 -2
  58. package/dist/scene/shared/utils/ControlsUtils.d.ts +1 -1
  59. package/dist/scene/shared/utils/GeometryUtils.d.ts +35 -0
  60. package/dist/scene/static/CircuitController.d.ts +12 -1
  61. package/dist/scene/static/tools/BuildTool.d.ts +77 -0
  62. package/dist/scene/static/tools/MultiWiringPlacement.d.ts +40 -0
  63. package/dist/scene/widgets/HelpWidget.d.ts +13 -0
  64. package/dist/scene/widgets/ModeWidget.d.ts +16 -0
  65. package/dist/scene/widgets/MultiWiringWidget.d.ts +21 -0
  66. package/dist/scene/{static → widgets}/PinTooltipWidget.d.ts +2 -1
  67. package/dist/scene/widgets/SimulationPlayerWidget.d.ts +62 -0
  68. package/dist/scene/widgets/ToolsWidget.d.ts +18 -0
  69. package/dist/scene/widgets/WidgetsManager.d.ts +65 -0
  70. package/dist/scene/widgets/assets/icons.d.ts +20 -0
  71. package/dist/scene/widgets/index.d.ts +9 -0
  72. package/dist/scene/widgets/styles.d.ts +33 -0
  73. package/dist/{scene-D4QcWeiq.js → scene-C1xhdw_B.js} +3311 -1478
  74. package/dist/scene-C1xhdw_B.js.map +1 -0
  75. package/package.json +2 -2
  76. package/dist/core-b6Q8w2sn.js.map +0 -1
  77. 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 s, B as r, C as i, Ct as o, D as n, Dt as l, E as c, Et as u, F as S, G as h, H as y, I as B, J as C, K as m, L as d, M as p, N as g, O as F, Ot as G, P as E, Q as N, R as v, S as V, St as T, T as A, Tt as L, U as I, V as D, W as M, X as O, Y as R, Z as _, _ as b, _t as P, a as f, at as w, b as X, bt as k, c as H, ct as U, d as x, dt as W, et as z, f as Y, ft as j, g as q, gt as J, h as K, ht as Q, i as Z, it as $, j as aa, k as ta, kt as ea, l as sa, lt as ra, m as ia, mt as oa, n as na, nt as la, o as ca, ot as ua, p as Sa, pt as ha, q as ya, r as Ba, rt as Ca, s as ma, st as da, t as pa, tt as ga, u as Fa, ut as Ga, v as Ea, vt as Na, w as va, wt as Va, x as Ta, xt as Aa, y as La, yt as Ia, z as Da } from "./core-b6Q8w2sn.js";
2
- import { A as Oa, B as Ra, C as _a, D as ba, E as Pa, F as fa, G as wa, H as Xa, I as ka, J as Ha, K as Ua, L as xa, M as Wa, N as za, O as Ya, P as ja, R as qa, S as Ja, T as Ka, U as Qa, V as Za, W as $a, X as at, Y as tt, Z as et, _ as st, a as rt, b as it, c as ot, d as nt, f as lt, g as ct, h as ut, i as St, j as ht, k as yt, l as Bt, m as Ct, n as mt, o as dt, p as pt, q as gt, r as Ft, s as Gt, t as Et, u as Nt, v as vt, w as Vt, x as Tt, y as At, z as Lt } from "./scene-D4QcWeiq.js";
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
- Q as ALL_LOGIC_FAMILIES,
5
- Fa as AdderBehavior,
6
- E as AdderState,
7
- dt as AdderVisualFactory,
8
- B as ArithmeticState,
9
- Ha as BRANCHING_POINT_SENTINEL,
10
- ta as BatteryBehavior,
11
- z as BatteryState,
12
- Pa as BatteryVisualFactory,
13
- aa as BehaviorRegistry,
14
- Za as BranchingPointVisualFactory,
15
- gt as BuildTool,
16
- J as CIRCUIT_FILE_VERSION,
17
- Oa as CMP_MATERIALS,
18
- P as COMPONENT_TYPE_METADATA,
19
- l as CameraOptions,
20
- ua as Circuit,
21
- ka as CircuitController,
22
- ja as CircuitEngine,
23
- Ga as CircuitMetadata,
24
- W as CircuitOptions,
25
- Z as CircuitRunner,
26
- fa as CircuitRunnerController,
27
- $a as CircuitWriter,
28
- V as ClockBehavior,
29
- ya as ClockState,
30
- vt as ClockVisualFactory,
31
- ht as CmpMatCategory,
32
- Wa as CmpMatType,
33
- za as CmpMatVariant,
34
- j as Component,
35
- tt as ComponentPickerWidget,
36
- ga as ComponentState,
37
- Na as ComponentType,
38
- Ia as DEFAULT_LOGIC_FAMILY,
39
- Ya as DefaultVisualFactory,
40
- ca as DirtyTracker,
41
- i as DoubleThrowSwitchBehavior,
42
- C as DoubleThrowSwitchState,
43
- At as DoubleThrowSwitchVisualFactory,
44
- oa as ENode,
45
- k as ENodeSourceType,
46
- Aa as ENodeType,
47
- sa as EightBitAdderBehavior,
48
- g as EightBitAdderState,
49
- rt as EightBitAdderVisualFactory,
50
- H as EightBitOnesComplementBehavior,
51
- p as EightBitOnesComplementState,
52
- St as EightBitOnesComplementVisualFactory,
53
- ma as EventQueue,
54
- yt as FactoryRegistry,
55
- ba as GroupedFactoryRegistry,
56
- x as HalfAdderBehavior,
57
- S as HalfAdderState,
58
- Gt as HalfAdderVisualFactory,
59
- Qa as HitboxLayers,
60
- Xa as HoverManager,
61
- Ta as InverterBehavior,
62
- m as InverterState,
63
- st as InverterVisualFactory,
64
- Ka as LabelVisualFactory,
65
- F as LightbulbBehavior,
66
- t as LightbulbState,
67
- Vt as LightbulbVisualFactory,
68
- ea as Memoize,
69
- s as MemoizeExpiring,
70
- Ua as MultiSelectTool,
71
- La as Nand4GateBehavior,
72
- M as Nand4GateState,
73
- ut as Nand4GateVisualFactory,
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
- I as Nand8GateState,
76
- Ct as Nand8GateVisualFactory,
77
- X as NandGateBehavior,
78
- h as NandGateState,
79
- ct as NandGateVisualFactory,
80
- q as Nor4GateBehavior,
81
- D as Nor4GateState,
82
- lt as Nor4GateVisualFactory,
83
- K as Nor8GateBehavior,
84
- r as Nor8GateState,
85
- nt as Nor8GateVisualFactory,
86
- b as NorGateBehavior,
87
- y as NorGateState,
88
- pt as NorGateVisualFactory,
89
- Va as Position,
90
- G as Position3D,
91
- n as RectangleLEDBehavior,
92
- _ as RectangleLEDState,
93
- _a as RectangleLEDVisualFactory,
94
- c as RelayBehavior,
95
- O as RelayState,
96
- Ja as RelayVisualFactory,
97
- o as Rotation,
98
- at as SCE_NS,
99
- $ as SIMULATION_SPEED,
100
- wa as SelectionManager,
101
- la as SimulationState,
102
- A as SmallLEDBehavior,
103
- N as SmallLEDState,
104
- Tt as SmallLEDVisualFactory,
105
- f as StateManager,
106
- va as SwitchBehavior,
107
- R as SwitchState,
108
- it as SwitchVisualFactory,
109
- w as TRANSITION_DEFAULTS,
110
- ha as Wire,
111
- Ra as WireVisualManager,
112
- Sa as Xor4GateBehavior,
113
- v as Xor4GateState,
114
- Bt as Xor4GateVisualFactory,
115
- Y as Xor8GateBehavior,
116
- d as Xor8GateState,
117
- ot as Xor8GateVisualFactory,
118
- ia as XorGateBehavior,
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
- Nt as XorGateVisualFactory,
121
- da as classifyGate,
122
- U as computeGateDelay,
123
- ra as computeTransitionSpan,
124
- xa as controllerOptions,
125
- qa as engineOptions,
126
- L as findPositionBestIndex,
127
- T as generateUUID,
128
- e as getTransitionSpan,
129
- Lt as mapControlsOptions,
130
- pa as registerArithmeticComponentsBehaviors,
131
- Et as registerArithmeticComponentsFactories,
132
- na as registerBasicComponentsBehaviors,
133
- mt as registerBasicComponentsFactories,
134
- Ba as registerGatesComponentsBehaviors,
135
- Ft as registerGatesComponentsFactories,
136
- et as registerSceTranslations,
137
- u as simplifyPositions,
138
- Ca as unionElectricalStates
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
- * @param container - HTMLElement to mount the scene
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
  */
@@ -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';
@@ -1,52 +1,64 @@
1
- import { A as s, B as t, C as r, D as o, E as i, F as e, G as l, H as c, I as u, J as n, K as y, L as F, M as V, N as C, O as g, P as p, R as m, S as d, T as G, U as N, V as M, W as h, Y as E, _ as A, a as B, b as L, c as R, d as S, f as T, g as b, h as I, i as O, j as D, k as H, l as P, m as f, n as w, o as W, p as _, q as k, r as v, s as x, t as X, u as j, v as q, w as z, x as J, y as K, z as U } from "../scene-D4QcWeiq.js";
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
- W as AdderVisualFactory,
4
- n as BRANCHING_POINT_SENTINEL,
5
- i as BatteryVisualFactory,
6
- M as BranchingPointVisualFactory,
7
- k as BuildTool,
8
- s as CMP_MATERIALS,
9
- u as CircuitController,
10
- p as CircuitEngine,
11
- e as CircuitRunnerController,
12
- h as CircuitWriter,
13
- q as ClockVisualFactory,
14
- D as CmpMatCategory,
15
- V as CmpMatType,
16
- C as CmpMatVariant,
17
- E as ComponentPickerWidget,
18
- g as DefaultVisualFactory,
19
- K as DoubleThrowSwitchVisualFactory,
20
- B as EightBitAdderVisualFactory,
21
- O as EightBitOnesComplementVisualFactory,
22
- H as FactoryRegistry,
23
- o as GroupedFactoryRegistry,
24
- x as HalfAdderVisualFactory,
25
- N as HitboxLayers,
26
- c as HoverManager,
27
- A as InverterVisualFactory,
28
- G as LabelVisualFactory,
29
- z as LightbulbVisualFactory,
30
- y as MultiSelectTool,
31
- I as Nand4GateVisualFactory,
32
- f as Nand8GateVisualFactory,
33
- b as NandGateVisualFactory,
34
- T as Nor4GateVisualFactory,
35
- S as Nor8GateVisualFactory,
36
- _ as NorGateVisualFactory,
37
- r as RectangleLEDVisualFactory,
38
- d as RelayVisualFactory,
39
- l as SelectionManager,
40
- J as SmallLEDVisualFactory,
41
- L as SwitchVisualFactory,
42
- t as WireVisualManager,
43
- P as Xor4GateVisualFactory,
44
- R as Xor8GateVisualFactory,
45
- j as XorGateVisualFactory,
46
- F as controllerOptions,
47
- m as engineOptions,
48
- U as mapControlsOptions,
49
- X as registerArithmeticComponentsFactories,
50
- w as registerBasicComponentsFactories,
51
- v as registerGatesComponentsFactories
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
  };
@@ -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
+ }