simple-circuit-engine 0.0.11 → 0.0.13

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 (161) hide show
  1. package/AGENTS.md +11 -7
  2. package/CLAUDE.md +6 -6
  3. package/README.md +5 -2
  4. package/dist/core/index.d.ts +0 -1
  5. package/dist/core/index.js +85 -2115
  6. package/dist/core/setup.d.ts +25 -0
  7. package/dist/core/simulation/CircuitRunner.d.ts +176 -0
  8. package/dist/core/simulation/DirtyTracker.d.ts +87 -0
  9. package/dist/core/simulation/EventQueue.d.ts +68 -0
  10. package/dist/core/simulation/StateManager.d.ts +100 -0
  11. package/dist/core/simulation/behaviors/BehaviorRegistry.d.ts +70 -0
  12. package/dist/core/simulation/behaviors/ComponentBehavior.d.ts +53 -0
  13. package/dist/core/simulation/behaviors/arithmetic/AdderBehavior.d.ts +28 -0
  14. package/dist/core/simulation/behaviors/arithmetic/ArithmeticBehaviorMixin.d.ts +63 -0
  15. package/dist/core/simulation/behaviors/arithmetic/EightBitAdderBehavior.d.ts +51 -0
  16. package/dist/core/simulation/behaviors/arithmetic/EightBitOnesComplementBehavior.d.ts +29 -0
  17. package/dist/core/simulation/behaviors/arithmetic/HalfAdderBehavior.d.ts +22 -0
  18. package/dist/core/simulation/behaviors/arithmetic/index.d.ts +7 -0
  19. package/dist/core/simulation/behaviors/basic/BatteryBehavior.d.ts +14 -0
  20. package/dist/core/simulation/behaviors/basic/ClockBehavior.d.ts +24 -0
  21. package/dist/core/simulation/behaviors/basic/DoubleThrowSwitchBehavior.d.ts +33 -0
  22. package/dist/core/simulation/behaviors/basic/LightbulbBehavior.d.ts +23 -0
  23. package/dist/core/simulation/behaviors/basic/RectangleLEDBehavior.d.ts +24 -0
  24. package/dist/core/simulation/behaviors/basic/RelayBehavior.d.ts +33 -0
  25. package/dist/core/simulation/behaviors/basic/SmallLEDBehavior.d.ts +24 -0
  26. package/dist/core/simulation/behaviors/basic/SwitchBehavior.d.ts +33 -0
  27. package/dist/core/simulation/behaviors/basic/index.d.ts +20 -0
  28. package/dist/core/simulation/behaviors/gates/InverterBehavior.d.ts +29 -0
  29. package/dist/core/simulation/behaviors/gates/Nand4GateBehavior.d.ts +18 -0
  30. package/dist/core/simulation/behaviors/gates/Nand8GateBehavior.d.ts +18 -0
  31. package/dist/core/simulation/behaviors/gates/NandGateBehavior.d.ts +28 -0
  32. package/dist/core/simulation/behaviors/gates/Nor4GateBehavior.d.ts +18 -0
  33. package/dist/core/simulation/behaviors/gates/Nor8GateBehavior.d.ts +18 -0
  34. package/dist/core/simulation/behaviors/gates/NorGateBehavior.d.ts +22 -0
  35. package/dist/core/simulation/behaviors/gates/Xor4GateBehavior.d.ts +18 -0
  36. package/dist/core/simulation/behaviors/gates/Xor8GateBehavior.d.ts +18 -0
  37. package/dist/core/simulation/behaviors/gates/XorGateBehavior.d.ts +22 -0
  38. package/dist/core/simulation/behaviors/gates/index.d.ts +34 -0
  39. package/dist/core/simulation/behaviors/index.d.ts +28 -0
  40. package/dist/core/simulation/behaviors/types.d.ts +101 -0
  41. package/dist/core/simulation/index.d.ts +18 -0
  42. package/dist/core/simulation/states/ComponentState.d.ts +57 -0
  43. package/dist/core/simulation/states/SimulationState.d.ts +46 -0
  44. package/dist/core/simulation/states/arithmetic/AdderState.d.ts +16 -0
  45. package/dist/core/simulation/states/arithmetic/ArithmeticState.d.ts +53 -0
  46. package/dist/core/simulation/states/arithmetic/EightBitAdderState.d.ts +25 -0
  47. package/dist/core/simulation/states/arithmetic/EightBitOnesComplementState.d.ts +18 -0
  48. package/dist/core/simulation/states/arithmetic/HalfAdderState.d.ts +16 -0
  49. package/dist/core/simulation/states/arithmetic/index.d.ts +7 -0
  50. package/dist/core/simulation/states/basic/BatteryState.d.ts +16 -0
  51. package/dist/core/simulation/states/basic/ClockState.d.ts +16 -0
  52. package/dist/core/simulation/states/basic/DoubleThrowSwitchState.d.ts +21 -0
  53. package/dist/core/simulation/states/basic/LightbulbState.d.ts +21 -0
  54. package/dist/core/simulation/states/basic/RectangleLEDState.d.ts +9 -0
  55. package/dist/core/simulation/states/basic/RelayState.d.ts +25 -0
  56. package/dist/core/simulation/states/basic/SmallLEDState.d.ts +21 -0
  57. package/dist/core/simulation/states/basic/SwitchState.d.ts +25 -0
  58. package/dist/core/simulation/states/gates/InverterState.d.ts +17 -0
  59. package/dist/core/simulation/states/gates/Nand4GateState.d.ts +10 -0
  60. package/dist/core/simulation/states/gates/Nand8GateState.d.ts +10 -0
  61. package/dist/core/simulation/states/gates/NandGateState.d.ts +16 -0
  62. package/dist/core/simulation/states/gates/Nor4GateState.d.ts +10 -0
  63. package/dist/core/simulation/states/gates/Nor8GateState.d.ts +10 -0
  64. package/dist/core/simulation/states/gates/NorGateState.d.ts +10 -0
  65. package/dist/core/simulation/states/gates/Xor4GateState.d.ts +10 -0
  66. package/dist/core/simulation/states/gates/Xor8GateState.d.ts +10 -0
  67. package/dist/core/simulation/states/gates/XorGateState.d.ts +10 -0
  68. package/dist/core/simulation/states/gates/index.d.ts +25 -0
  69. package/dist/core/simulation/states/index.d.ts +31 -0
  70. package/dist/core/simulation/states/types.d.ts +32 -0
  71. package/dist/core/simulation/types.d.ts +155 -0
  72. package/dist/core/topology/Circuit.d.ts +420 -0
  73. package/dist/core/topology/CircuitMetadata.d.ts +24 -0
  74. package/dist/core/topology/CircuitOptions.d.ts +14 -0
  75. package/dist/core/topology/Component.d.ts +153 -0
  76. package/dist/core/topology/ENode.d.ts +200 -0
  77. package/dist/core/topology/Wire.d.ts +130 -0
  78. package/dist/core/topology/delays.d.ts +52 -0
  79. package/dist/core/topology/index.d.ts +14 -0
  80. package/dist/core/topology/types.d.ts +189 -0
  81. package/dist/core/utils/CameraOptions.d.ts +83 -0
  82. package/dist/core/utils/MemoizeDecorator.d.ts +9 -0
  83. package/dist/core/utils/Position.d.ts +166 -0
  84. package/dist/core/utils/Position3D.d.ts +77 -0
  85. package/dist/core/utils/Rotation.d.ts +82 -0
  86. package/dist/core/utils/index.d.ts +24 -0
  87. package/dist/core/utils/types.d.ts +35 -0
  88. package/dist/core-b6Q8w2sn.js +3560 -0
  89. package/dist/core-b6Q8w2sn.js.map +1 -0
  90. package/dist/i18n/index.d.ts +882 -0
  91. package/dist/i18n/locales/en.json.d.ts +268 -0
  92. package/dist/i18n/locales/fr.json.d.ts +268 -0
  93. package/dist/index.d.ts +14 -6306
  94. package/dist/index.js +136 -112
  95. package/dist/scene/CircuitEngine.d.ts +283 -0
  96. package/dist/scene/index.d.ts +1 -2
  97. package/dist/scene/index.js +50 -41
  98. package/dist/scene/setup.d.ts +26 -0
  99. package/dist/scene/shared/AbstractCircuitController.d.ts +217 -0
  100. package/dist/scene/shared/BranchingPointVisualFactory.d.ts +70 -0
  101. package/dist/scene/shared/EventEmitter.d.ts +92 -0
  102. package/dist/scene/shared/HoverManager.d.ts +151 -0
  103. package/dist/scene/shared/SelectionManager.d.ts +159 -0
  104. package/dist/scene/shared/WireVisualManager.d.ts +242 -0
  105. package/dist/scene/shared/components/ComponentVisualFactory.d.ts +438 -0
  106. package/dist/scene/shared/components/DefaultVisualFactory.d.ts +51 -0
  107. package/dist/scene/shared/components/FactoryRegistry.d.ts +84 -0
  108. package/dist/scene/shared/components/GroupedFactoryRegistry.d.ts +153 -0
  109. package/dist/scene/shared/components/arithmetic/AdderVisualFactory.d.ts +54 -0
  110. package/dist/scene/shared/components/arithmetic/EightBitAdderVisualFactory.d.ts +45 -0
  111. package/dist/scene/shared/components/arithmetic/EightBitOnesComplementVisualFactory.d.ts +63 -0
  112. package/dist/scene/shared/components/arithmetic/HalfAdderVisualFactory.d.ts +55 -0
  113. package/dist/scene/shared/components/arithmetic/index.d.ts +4 -0
  114. package/dist/scene/shared/components/basic/BatteryVisualFactory.d.ts +13 -0
  115. package/dist/scene/shared/components/basic/ClockVisualFactory.d.ts +79 -0
  116. package/dist/scene/shared/components/basic/DoubleThrowSwitchVisualFactory.d.ts +87 -0
  117. package/dist/scene/shared/components/basic/LabelVisualFactory.d.ts +148 -0
  118. package/dist/scene/shared/components/basic/LightbulbVisualFactory.d.ts +72 -0
  119. package/dist/scene/shared/components/basic/RectangleLEDVisualFactory.d.ts +86 -0
  120. package/dist/scene/shared/components/basic/RelayVisualFactory.d.ts +92 -0
  121. package/dist/scene/shared/components/basic/SmallLEDVisualFactory.d.ts +86 -0
  122. package/dist/scene/shared/components/basic/SwitchVisualFactory.d.ts +85 -0
  123. package/dist/scene/shared/components/gates/InverterVisualFactory.d.ts +104 -0
  124. package/dist/scene/shared/components/gates/Nand4GateVisualFactory.d.ts +27 -0
  125. package/dist/scene/shared/components/gates/Nand8GateVisualFactory.d.ts +27 -0
  126. package/dist/scene/shared/components/gates/NandGateVisualFactory.d.ts +101 -0
  127. package/dist/scene/shared/components/gates/Nor4GateVisualFactory.d.ts +27 -0
  128. package/dist/scene/shared/components/gates/Nor8GateVisualFactory.d.ts +27 -0
  129. package/dist/scene/shared/components/gates/NorGateVisualFactory.d.ts +101 -0
  130. package/dist/scene/shared/components/gates/Xor4GateVisualFactory.d.ts +29 -0
  131. package/dist/scene/shared/components/gates/Xor8GateVisualFactory.d.ts +29 -0
  132. package/dist/scene/shared/components/gates/XorGateVisualFactory.d.ts +103 -0
  133. package/dist/scene/shared/components/index.d.ts +33 -0
  134. package/dist/scene/shared/components/types.d.ts +43 -0
  135. package/dist/scene/shared/types.d.ts +474 -0
  136. package/dist/scene/shared/utils/CameraUtils.d.ts +23 -0
  137. package/dist/scene/shared/utils/ColorUtils.d.ts +26 -0
  138. package/dist/scene/shared/utils/ControlsUtils.d.ts +8 -0
  139. package/dist/scene/shared/utils/GeometryUtils.d.ts +337 -0
  140. package/dist/scene/shared/utils/LayerConstants.d.ts +40 -0
  141. package/dist/scene/shared/utils/LightingUtils.d.ts +31 -0
  142. package/dist/scene/shared/utils/MaterialUtils.d.ts +73 -0
  143. package/dist/scene/shared/utils/Options.d.ts +16 -0
  144. package/dist/scene/simulation/CircuitRunnerController.d.ts +227 -0
  145. package/dist/scene/static/CircuitController.d.ts +228 -0
  146. package/dist/scene/static/CircuitWriter.d.ts +146 -0
  147. package/dist/scene/static/PinTooltipWidget.d.ts +31 -0
  148. package/dist/scene/static/tools/BuildTool.d.ts +290 -0
  149. package/dist/scene/static/tools/ComponentPickerWidget.d.ts +89 -0
  150. package/dist/scene/static/tools/ConfigPanelWidget.d.ts +107 -0
  151. package/dist/scene/static/tools/MultiSelectTool.d.ts +265 -0
  152. package/dist/scene-D4QcWeiq.js +8745 -0
  153. package/dist/scene-D4QcWeiq.js.map +1 -0
  154. package/package.json +29 -25
  155. package/dist/CircuitRunner-BQQlhwjD.js +0 -1981
  156. package/dist/CircuitRunner-BQQlhwjD.js.map +0 -1
  157. package/dist/core/index.js.map +0 -1
  158. package/dist/index.js.map +0 -1
  159. package/dist/scene/index.js.map +0 -1
  160. package/dist/setup-CIq_kgaw.js +0 -10230
  161. package/dist/setup-CIq_kgaw.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,115 +1,139 @@
1
- import { A as e, b as o, d as r, C as s, m as i, i as n, c as l, D as c, k as u, h as S, E as y, e as G, j as h, P as N, a as B, R as F, S as C, n as p, l as v, T as g, f as E, g as m, s as L } from "./CircuitRunner-BQQlhwjD.js";
2
- import { BatteryBehavior as I, BatteryState as V, BehaviorRegistry as d, Circuit as D, CircuitMetadata as R, CircuitOptions as M, ComponentState as b, DoubleThrowSwitchBehavior as O, DoubleThrowSwitchState as A, InverterBehavior as _, InverterState as P, LightbulbBehavior as w, LightbulbState as X, Memoize as f, MemoizeExpiring as x, Nand4GateBehavior as U, Nand4GateState as W, Nand8GateBehavior as k, Nand8GateState as H, NandGateBehavior as j, NandGateState as z, Nor4GateBehavior as Y, Nor4GateState as q, Nor8GateBehavior as Q, Nor8GateState as J, NorGateBehavior as K, NorGateState as Z, RectangleLEDBehavior as $, RectangleLEDState as aa, RelayBehavior as ta, RelayState as ea, SmallLEDBehavior as oa, SmallLEDState as ra, SwitchBehavior as sa, SwitchState as ia, Wire as na, Xor4GateBehavior as la, Xor4GateState as ca, Xor8GateBehavior as ua, Xor8GateState as Sa, XorGateBehavior as ya, XorGateState as Ga, classifyGate as ha, computeGateDelay as Na, computeTransitionSpan as Ba, registerBasicComponentsBehaviors as Fa, registerGatesComponentsBehaviors as Ca } from "./core/index.js";
3
- import { d as va, i as ga, f as Ea, B as ma, a as La, C as Ta, b as Ia, e as Va, c as da, D as Da, n as Ra, F as Ma, G as ba, g as Oa, H as Aa, I as _a, L as Pa, j as wa, M as Xa, o as fa, p as xa, N as Ua, s as Wa, t as ka, q as Ha, R as ja, k as za, S as Ya, l as qa, m as Qa, W as Ja, u as Ka, v as Za, X as $a, x as at, y as tt, w as et, r as ot, h as rt } from "./setup-CIq_kgaw.js";
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";
4
3
  export {
5
- e as ALL_LOGIC_FAMILIES,
6
- va as BRANCHING_POINT_SENTINEL,
7
- I as BatteryBehavior,
8
- V as BatteryState,
9
- ga as BatteryVisualFactory,
10
- d as BehaviorRegistry,
11
- Ea as BranchingPointVisualFactory,
12
- ma as BuildTool,
13
- o as CIRCUIT_FILE_VERSION,
14
- r as COMPONENT_TYPE_METADATA,
15
- s as CameraOptions,
16
- D as Circuit,
17
- La as CircuitController,
18
- Ta as CircuitEngine,
19
- R as CircuitMetadata,
20
- M as CircuitOptions,
21
- i as CircuitRunner,
22
- Ia as CircuitRunnerController,
23
- Va as CircuitWriter,
24
- n as Component,
25
- da as ComponentPickerWidget,
26
- b as ComponentState,
27
- l as ComponentType,
28
- c as DEFAULT_LOGIC_FAMILY,
29
- Da as DefaultVisualFactory,
30
- u as DirtyTracker,
31
- O as DoubleThrowSwitchBehavior,
32
- A as DoubleThrowSwitchState,
33
- Ra as DoubleThrowSwitchVisualFactory,
34
- S as ENode,
35
- y as ENodeSourceType,
36
- G as ENodeType,
37
- h as EventQueue,
38
- Ma as FactoryRegistry,
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,
39
55
  ba as GroupedFactoryRegistry,
40
- Oa as HitboxLayers,
41
- Aa as HoverManager,
42
- _ as InverterBehavior,
43
- P as InverterState,
44
- _a as InverterVisualFactory,
45
- Pa as LabelVisualFactory,
46
- w as LightbulbBehavior,
47
- X as LightbulbState,
48
- wa as LightbulbVisualFactory,
49
- f as Memoize,
50
- x as MemoizeExpiring,
51
- Xa as MultiSelectTool,
52
- U as Nand4GateBehavior,
53
- W as Nand4GateState,
54
- fa as Nand4GateVisualFactory,
55
- k as Nand8GateBehavior,
56
- H as Nand8GateState,
57
- xa as Nand8GateVisualFactory,
58
- j as NandGateBehavior,
59
- z as NandGateState,
60
- Ua as NandGateVisualFactory,
61
- Y as Nor4GateBehavior,
62
- q as Nor4GateState,
63
- Wa as Nor4GateVisualFactory,
64
- Q as Nor8GateBehavior,
65
- J as Nor8GateState,
66
- ka as Nor8GateVisualFactory,
67
- K as NorGateBehavior,
68
- Z as NorGateState,
69
- Ha as NorGateVisualFactory,
70
- N as Position,
71
- B as Position3D,
72
- $ as RectangleLEDBehavior,
73
- aa as RectangleLEDState,
74
- ja as RectangleLEDVisualFactory,
75
- ta as RelayBehavior,
76
- ea as RelayState,
77
- za as RelayVisualFactory,
78
- F as Rotation,
79
- C as SIMULATION_SPEED,
80
- Ya as SelectionManager,
81
- p as SimulationState,
82
- oa as SmallLEDBehavior,
83
- ra as SmallLEDState,
84
- qa as SmallLEDVisualFactory,
85
- v as StateManager,
86
- sa as SwitchBehavior,
87
- ia as SwitchState,
88
- Qa as SwitchVisualFactory,
89
- g as TRANSITION_DEFAULTS,
90
- na as Wire,
91
- Ja as WireVisualManager,
92
- la as Xor4GateBehavior,
93
- ca as Xor4GateState,
94
- Ka as Xor4GateVisualFactory,
95
- ua as Xor8GateBehavior,
96
- Sa as Xor8GateState,
97
- Za as Xor8GateVisualFactory,
98
- ya as XorGateBehavior,
99
- Ga as XorGateState,
100
- $a as XorGateVisualFactory,
101
- ha as classifyGate,
102
- Na as computeGateDelay,
103
- Ba as computeTransitionSpan,
104
- at as controllerOptions,
105
- tt as engineOptions,
106
- E as findPositionBestIndex,
107
- m as generateUUID,
108
- et as mapControlsOptions,
109
- Fa as registerBasicComponentsBehaviors,
110
- ot as registerBasicComponentsFactories,
111
- Ca as registerGatesComponentsBehaviors,
112
- rt as registerGatesComponentsFactories,
113
- L as simplifyPositions
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,
74
+ 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,
119
+ 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
114
139
  };
115
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,283 @@
1
+ import { MapControls } from 'three/addons/controls/MapControls.js';
2
+ import { EventEmitter } from './shared/EventEmitter';
3
+ import { Circuit, BehaviorRegistry } from '../core/index.ts';
4
+ import { CircuitController } from './static/CircuitController';
5
+ import { CircuitRunnerController } from './simulation/CircuitRunnerController';
6
+ import { IFactoryRegistry } from './shared/components/ComponentVisualFactory';
7
+ import { EngineMode, CircuitEngineEventMap, EngineOptions, ToolType } from './shared/types';
8
+ /**
9
+ * CircuitEngine - Unified Facade for Circuit Editing and Simulation
10
+ * @module scene/CircuitEngine
11
+ *
12
+ * Provides a unified API for both static circuit editing and live simulation,
13
+ * managing mode transitions and resource sharing between controllers.
14
+ */
15
+ import * as THREE from 'three';
16
+ /**
17
+ * CircuitEngine - Unified Facade for Circuit Editing and Simulation
18
+ *
19
+ * Manages two internal controllers:
20
+ * - CircuitController: Static editing with tools, selection, and manipulation
21
+ * - CircuitRunnerController: Live simulation with playback and animation
22
+ *
23
+ * Both controllers share the same Three.js scene, camera, and visual objects,
24
+ * enabling seamless transitions between edit and simulation modes.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const engine = new CircuitEngine(factoryRegistry, behaviorRegistry);
29
+ * engine.initialize(container);
30
+ * engine.setCircuit(circuit);
31
+ *
32
+ * // Edit mode (default)
33
+ * engine.setEditModeEnabled(true);
34
+ * engine.setActiveTool('build');
35
+ *
36
+ * // Switch to simulation
37
+ * engine.setMode('simulation');
38
+ * engine.play();
39
+ *
40
+ * // Switch back to edit
41
+ * engine.setMode('edit');
42
+ * ```
43
+ */
44
+ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
45
+ private readonly _factoryRegistry;
46
+ private readonly _behaviorRegistry;
47
+ private _sharedResources;
48
+ private _container;
49
+ private _editController;
50
+ private _simulationController;
51
+ private _mode;
52
+ private _initialized;
53
+ private _options;
54
+ private _disposed;
55
+ private _editControllerCleanup;
56
+ private _simulationControllerCleanup;
57
+ /**
58
+ * Create a new CircuitEngine instance.
59
+ *
60
+ * @param factoryRegistry - Registry of component visual factories
61
+ * @param behaviorRegistry - Registry of component simulation behaviors
62
+ * @throws {TypeError} If factoryRegistry or behaviorRegistry is null/undefined
63
+ */
64
+ constructor(factoryRegistry: IFactoryRegistry, behaviorRegistry: BehaviorRegistry);
65
+ /**
66
+ * Check if engine is initialized
67
+ */
68
+ get isInitialized(): boolean;
69
+ /**
70
+ * Check if engine is disposed
71
+ */
72
+ get isDisposed(): boolean;
73
+ /**
74
+ * Initialize the engine with a DOM container.
75
+ * Creates shared Three.js resources and both controllers.
76
+ *
77
+ * @param container - HTMLElement to mount the scene
78
+ * @param options - Configuration options
79
+ * @throws {TypeError} If container is not a valid HTMLElement
80
+ * @throws {Error} If already initialized
81
+ */
82
+ initialize(container: HTMLElement, options?: EngineOptions): void;
83
+ /**
84
+ * Create shared resources for both controllers.
85
+ */
86
+ private _createSharedResources;
87
+ /**
88
+ * Setup event forwarding from both controllers to engine.
89
+ */
90
+ private _setupEventForwarding;
91
+ /**
92
+ * Teardown event forwarding cleanup.
93
+ */
94
+ private _teardownEventForwarding;
95
+ /**
96
+ * Dispose all resources and clean up.
97
+ *
98
+ * @throws {Error} If not initialized or already disposed
99
+ */
100
+ dispose(): void;
101
+ /**
102
+ * Current operating mode
103
+ */
104
+ get mode(): EngineMode;
105
+ /**
106
+ * Refresh all scene widgets to display strings in the given language.
107
+ *
108
+ * Does NOT change the consumer's i18next instance — the caller must have
109
+ * already called `i18next.changeLanguage(lng)` before invoking this. This
110
+ * method only signals the scene to re-read translations for currently-open
111
+ * widgets (pin tooltip, component picker, config panel).
112
+ *
113
+ * Safe to call at any point in the engine lifecycle after `initialize()`.
114
+ *
115
+ * @param lng - Target language code (e.g., 'en', 'fr')
116
+ */
117
+ setLanguage(lng: string): void;
118
+ /**
119
+ * Switch between edit and simulation modes.
120
+ *
121
+ * @param mode - Target mode to switch to
122
+ * @throws {Error} If not initialized
123
+ * @throws {Error} If switching to simulation without a circuit loaded
124
+ */
125
+ setMode(mode: EngineMode): void;
126
+ /**
127
+ * Transition from edit mode to simulation mode.
128
+ */
129
+ private _transitionToSimulation;
130
+ /**
131
+ * Transition from simulation mode to edit mode.
132
+ */
133
+ private _transitionToEdit;
134
+ /**
135
+ * Load a circuit for editing/simulation.
136
+ *
137
+ * @param circuit - Circuit to load, or null to clear
138
+ * @throws {Error} If not initialized
139
+ */
140
+ setCircuit(circuit: Circuit | null): void;
141
+ /**
142
+ * Get the currently loaded circuit
143
+ */
144
+ getCircuit(): Circuit | null;
145
+ /**
146
+ * Get the edit controller for advanced operations.
147
+ *
148
+ * @throws {Error} If not initialized
149
+ */
150
+ getEditController(): CircuitController;
151
+ /**
152
+ * Get the simulation controller for advanced operations.
153
+ *
154
+ * @throws {Error} If not initialized
155
+ */
156
+ getSimulationController(): CircuitRunnerController;
157
+ /**
158
+ * Activate an editing tool.
159
+ *
160
+ * @param toolType - Tool to activate
161
+ * @throws {Error} If not in edit mode
162
+ */
163
+ setActiveTool(toolType: ToolType): void;
164
+ /**
165
+ * Get the currently active tool
166
+ *
167
+ * @throws {Error} If not in edit mode
168
+ */
169
+ getActiveTool(): ToolType | null;
170
+ /**
171
+ * Enable or disable edit mode (tool system).
172
+ *
173
+ * @param enabled - True to enable, false to disable
174
+ * @throws {Error} If not in edit mode
175
+ */
176
+ setEditModeEnabled(enabled: boolean): void;
177
+ /**
178
+ * Start automatic simulation playback.
179
+ *
180
+ * @throws {Error} If not in simulation mode
181
+ */
182
+ play(): void;
183
+ /**
184
+ * Pause automatic simulation playback.
185
+ *
186
+ * @throws {Error} If not in simulation mode
187
+ */
188
+ pause(): void;
189
+ /**
190
+ * Execute a single simulation tick.
191
+ *
192
+ * @throws {Error} If not in simulation mode
193
+ */
194
+ step(): void;
195
+ /**
196
+ * Stop simulation and reset to initial state.
197
+ *
198
+ * @throws {Error} If not in simulation mode
199
+ */
200
+ stop(): void;
201
+ /**
202
+ * Check if simulation is currently playing
203
+ */
204
+ get isPlaying(): boolean;
205
+ /**
206
+ * Get current simulation tick
207
+ */
208
+ get currentTick(): number;
209
+ /**
210
+ * Tick interval in milliseconds
211
+ */
212
+ get tickInterval(): number;
213
+ set tickInterval(value: number);
214
+ /**
215
+ * Simulation speed in ticks per second.
216
+ * Range: 1-20 TPS. Works in both edit and simulation modes.
217
+ */
218
+ get simulationSpeed(): number;
219
+ set simulationSpeed(tps: number);
220
+ /**
221
+ * Minimum allowed simulation speed in ticks per second.
222
+ */
223
+ get minSimulationSpeed(): number;
224
+ /**
225
+ * Maximum allowed simulation speed in ticks per second.
226
+ */
227
+ get maxSimulationSpeed(): number;
228
+ /**
229
+ * Update active animations. Call once per frame from the render loop.
230
+ * No-op if not initialized, disposed, or not in simulation mode.
231
+ *
232
+ * @param delta - Time in seconds since last frame (from THREE.Clock.getDelta())
233
+ */
234
+ update(delta: number): void;
235
+ /**
236
+ * Get the Three.js scene for external rendering.
237
+ *
238
+ * @throws {Error} If not initialized
239
+ */
240
+ getScene(): THREE.Scene;
241
+ /**
242
+ * Get the camera for external rendering.
243
+ *
244
+ * @throws {Error} If not initialized
245
+ */
246
+ getCamera(): THREE.PerspectiveCamera;
247
+ /**
248
+ * Get the MapControls for external manipulation.
249
+ *
250
+ * @throws {Error} If not initialized
251
+ */
252
+ getControls(): MapControls;
253
+ /**
254
+ * Hook called before exporting the circuit visualization.
255
+ * Saves world informations such as camera position, in the circuit metadata.
256
+ */
257
+ beforeExport(): void;
258
+ /**
259
+ * Handle container resize.
260
+ *
261
+ * @param width - New width (optional, uses container if omitted)
262
+ * @param height - New height (optional, uses container if omitted)
263
+ */
264
+ onContainerResize(width?: number, height?: number): void;
265
+ /**
266
+ * Check that controller is initialized and not disposed.
267
+ *
268
+ * @throws {Error} If not initialized or disposed
269
+ */
270
+ private _checkInitialized;
271
+ /**
272
+ * Check that controller is in edit mode.
273
+ *
274
+ * @throws {Error} If not in edit mode
275
+ */
276
+ private _checkEditMode;
277
+ /**
278
+ * Check that engine is in simulation mode.
279
+ *
280
+ * @throws {Error} If not in simulation mode
281
+ */
282
+ private _checkSimulationMode;
283
+ }
@@ -40,5 +40,4 @@ export * from './shared/types';
40
40
  export { HitboxLayers } from './shared/utils/LayerConstants';
41
41
  export type { HitboxLayerValue } from './shared/utils/LayerConstants';
42
42
  export * from './shared/utils/Options';
43
- export { registerBasicComponentsFactories, registerGatesComponentsFactories } from './setup';
44
- //# sourceMappingURL=index.d.ts.map
43
+ export { registerBasicComponentsFactories, registerGatesComponentsFactories, registerArithmeticComponentsFactories } from './setup';
@@ -1,43 +1,52 @@
1
- import { d as t, i as r, f as o, B as i, a as e, C as l, b as c, e as u, c as n, D as y, n as F, F as V, G as g, g as G, H as C, I as N, L as p, j as d, M as m, o as L, p as R, N as S, s as b, t as h, q as B, R as D, k as E, S as I, l as M, m as T, W as w, u as H, v as O, X as W, x as X, y as f, w as v, r as x, h as P } from "../setup-CIq_kgaw.js";
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";
2
2
  export {
3
- t as BRANCHING_POINT_SENTINEL,
4
- r as BatteryVisualFactory,
5
- o as BranchingPointVisualFactory,
6
- i as BuildTool,
7
- e as CircuitController,
8
- l as CircuitEngine,
9
- c as CircuitRunnerController,
10
- u as CircuitWriter,
11
- n as ComponentPickerWidget,
12
- y as DefaultVisualFactory,
13
- F as DoubleThrowSwitchVisualFactory,
14
- V as FactoryRegistry,
15
- g as GroupedFactoryRegistry,
16
- G as HitboxLayers,
17
- C as HoverManager,
18
- N as InverterVisualFactory,
19
- p as LabelVisualFactory,
20
- d as LightbulbVisualFactory,
21
- m as MultiSelectTool,
22
- L as Nand4GateVisualFactory,
23
- R as Nand8GateVisualFactory,
24
- S as NandGateVisualFactory,
25
- b as Nor4GateVisualFactory,
26
- h as Nor8GateVisualFactory,
27
- B as NorGateVisualFactory,
28
- D as RectangleLEDVisualFactory,
29
- E as RelayVisualFactory,
30
- I as SelectionManager,
31
- M as SmallLEDVisualFactory,
32
- T as SwitchVisualFactory,
33
- w as WireVisualManager,
34
- H as Xor4GateVisualFactory,
35
- O as Xor8GateVisualFactory,
36
- W as XorGateVisualFactory,
37
- X as controllerOptions,
38
- f as engineOptions,
39
- v as mapControlsOptions,
40
- x as registerBasicComponentsFactories,
41
- P as registerGatesComponentsFactories
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
42
52
  };
43
- //# sourceMappingURL=index.js.map