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
@@ -0,0 +1,337 @@
1
+ import { Position, Rotation } from '../../../core/index.ts';
2
+ import { ExtrudeGeometry } from 'three';
3
+ /**
4
+ * Geometry Utilities
5
+ * @module scene/shared/utils/GeometryUtils
6
+ *
7
+ * Helper functions for creating Three.js geometries for grid and circuit elements
8
+ */
9
+ import * as THREE from 'three';
10
+ /**
11
+ * convenience to control standard rotations of meshes on X-Z plan
12
+ */
13
+ export type Direction2D = 'right' | 'bottom' | 'left' | 'top';
14
+ /**
15
+ * Create a grid helper for the scene
16
+ *
17
+ * @param size - Size of the grid
18
+ * @param divisions - Number of grid divisions
19
+ * @param colorCenterLine - Color for center lines
20
+ * @param colorGrid - Color for grid lines
21
+ * @returns GridHelper object
22
+ */
23
+ export declare function createGridHelper(size: number, divisions: number, colorCenterLine: number, colorGrid: number): THREE.GridHelper;
24
+ /**
25
+ * optimal number of grid divisions for a given size
26
+ * @param size
27
+ */
28
+ export declare function computeDivisionsForSize(size: number): number;
29
+ /**
30
+ * Components, branching points and wires intermediate points snap to the nearest integer grid point.
31
+ * @param position
32
+ * @constructor
33
+ */
34
+ export declare function nearestWorldSnapPosition(position: THREE.Vector3): THREE.Vector3;
35
+ /**
36
+ * Converts a world 3D position to the snapped 2D model grid position.
37
+ * @param position
38
+ * @constructor
39
+ */
40
+ export declare function worldToGridPosition(position: THREE.Vector3): Position;
41
+ /**
42
+ * Converts a model grid 2D position to the world 3D position.
43
+ * @param position
44
+ * @constructor
45
+ */
46
+ export declare function gridToWorldPosition(position: Position): THREE.Vector3;
47
+ /**
48
+ * Converts a world 3D rotation to the model grid 2D rotation.
49
+ * @param rotation
50
+ * @constructor
51
+ */
52
+ export declare function worldToGridRotation(rotation: THREE.Euler): Rotation;
53
+ /**
54
+ * Converts model grid 2D rotation to the world 3D rotation.
55
+ * @param rotation
56
+ * @constructor
57
+ */
58
+ export declare function gridToWorldRotation(rotation: Rotation): THREE.Euler;
59
+ /**
60
+ * Get the bounding box of a Three.js object in world space
61
+ *
62
+ * @param object - The Three.js object to get bounds for
63
+ * @returns Box3 representing the world-space bounding box
64
+ */
65
+ export declare function getObjectBoundingBox(object: THREE.Object3D): THREE.Box3;
66
+ /**
67
+ * Project a 3D world position to 2D screen coordinates
68
+ *
69
+ * @param worldPosition - Position in world space
70
+ * @param camera - Camera to use for projection
71
+ * @param width - Viewport width in pixels
72
+ * @param height - Viewport height in pixels
73
+ * @returns Screen coordinates {x, y} where (0,0) is top-left
74
+ */
75
+ export declare function worldToScreenPosition(worldPosition: THREE.Vector3, camera: THREE.Camera, width: number, height: number): {
76
+ x: number;
77
+ y: number;
78
+ };
79
+ /**
80
+ * Check if a 3D point (projected to screen space) is inside a 2D screen rectangle
81
+ *
82
+ * @param worldPosition - Position in world space
83
+ * @param camera - Camera to use for projection
84
+ * @param width - Viewport width in pixels
85
+ * @param height - Viewport height in pixels
86
+ * @param rect - Screen rectangle with min/max coordinates
87
+ * @returns true if the projected point is inside the rectangle
88
+ */
89
+ export declare function isPointInScreenRect(worldPosition: THREE.Vector3, camera: THREE.Camera, width: number, height: number, rect: {
90
+ minX: number;
91
+ minY: number;
92
+ maxX: number;
93
+ maxY: number;
94
+ }): boolean;
95
+ /**
96
+ * Check if an object's center point is inside a screen rectangle
97
+ * Used for rectangle selection of components and branching points
98
+ *
99
+ * @param object - The Three.js object to check
100
+ * @param camera - Camera to use for projection
101
+ * @param width - Viewport width in pixels
102
+ * @param height - Viewport height in pixels
103
+ * @param rect - Screen rectangle with min/max coordinates
104
+ * @returns true if object's center is inside the rectangle
105
+ */
106
+ export declare function isObjectInScreenRect(object: THREE.Object3D, camera: THREE.Camera, width: number, height: number, rect: {
107
+ minX: number;
108
+ minY: number;
109
+ maxX: number;
110
+ maxY: number;
111
+ }): boolean;
112
+ /**
113
+ * Create a ring geometry with given inner/outer radius and depth (y axis)
114
+ * @param innerRadius
115
+ * @param outerRadius
116
+ * @param depth
117
+ * @param steps
118
+ * @constructor
119
+ */
120
+ export declare function RingGeometry(innerRadius: number, outerRadius: number, depth: number, steps: number): ExtrudeGeometry;
121
+ /**
122
+ * Create an ExtrudeGeometry for the body of an AND gate.
123
+ * Shape is centered at origin: flat side on the left, semicircle on the right,
124
+ * matching the standard logic gate schematic representation.
125
+ * Handles both standard (width > height / 2) and tall (width ≤ height / 2) proportions.
126
+ *
127
+ * Input pins attach on the left flat side (x = -width/2).
128
+ * Output pin attaches at the rightmost point of the arc (x = +width/2).
129
+ *
130
+ * The thickness parameter controls a visual state trick:
131
+ * - LOW state: thin thickness → gate appears as an empty shell
132
+ * - HIGH state: thick thickness → gate appears filled
133
+ * - TRANSITIONING: medium thickness → gate appears half-filled
134
+ *
135
+ * @param width - Total width, from left flat edge to rightmost arc point
136
+ * @param height - Total height; also determines the arc radius (= height / 2)
137
+ * @param thickness - Wall thickness of the gate shell
138
+ * @param depth - Extrusion depth
139
+ * @param steps - Number of extrusion steps
140
+ * @constructor
141
+ */
142
+ export declare function AndGateGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
143
+ /**
144
+ * Create an ExtrudeGeometry for the inner hole of an AND gate body.
145
+ * Returns null when thickness is large enough that the gate has no hole.
146
+ * Handles both standard (width > height / 2) and tall (width ≤ height / 2) proportions.
147
+ *
148
+ * @param width - Total width, from left flat edge to rightmost arc point
149
+ * @param height - Total height
150
+ * @param thickness - Wall thickness of the gate shell
151
+ * @param depth - Extrusion depth
152
+ * @param steps - Number of extrusion steps
153
+ */
154
+ export declare function AndGateHoleGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry | null;
155
+ /**
156
+ * Create an ExtrudeGeometry for the body of an OR gate.
157
+ * Same structure as AndGateGeometry but the left side is a concave arc (curves inward)
158
+ * instead of a flat edge, matching the standard logic gate schematic representation.
159
+ * Handles both standard (width > height / 2) and tall (width ≤ height / 2) proportions.
160
+ *
161
+ * Input pins attach on the left curved side (nominally at x = -width/2).
162
+ * Output pin attaches at the rightmost point of the right arc (x = +width/2).
163
+ *
164
+ * The thickness parameter controls the same visual state trick as AndGateGeometry:
165
+ * - LOW state: thin thickness → gate appears as an empty shell
166
+ * - HIGH state: thick thickness → gate appears filled
167
+ * - TRANSITIONING: medium thickness → gate appears half-filled
168
+ *
169
+ * Back arc geometry: the concave left side bows inward (rightward) by backInset = halfH * 0.4.
170
+ * The arc center sits far to the left; u_b is its x-distance to the back-left corners.
171
+ * The inner hole back arc is concentric with the outer (same center, radius += 0.1), giving a
172
+ * truly constant perpendicular wall thickness of 0.1 along the entire back curve, independent
173
+ * of the thickness parameter.
174
+ *
175
+ * @param width - Total width, from leftmost back curve point to rightmost arc point
176
+ * @param height - Total height; also determines the right arc radius (= height / 2)
177
+ * @param thickness - Wall thickness of the gate shell
178
+ * @param depth - Extrusion depth
179
+ * @param steps - Number of extrusion steps
180
+ * @constructor
181
+ */
182
+ export declare function OrGateGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
183
+ /**
184
+ * Create an ExtrudeGeometry for the inner hole of an OR gate body.
185
+ * Returns null when thickness is large enough that the gate has no hole.
186
+ * Handles both standard (width > height / 2) and tall (width ≤ height / 2) proportions.
187
+ *
188
+ * @param width - Total width
189
+ * @param height - Total height
190
+ * @param thickness - Wall thickness of the gate shell
191
+ * @param depth - Extrusion depth
192
+ * @param steps - Number of extrusion steps
193
+ */
194
+ export declare function OrGateHoleGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry | null;
195
+ /**
196
+ * Create an ExtrudeGeometry for the XOR gate tail — the distinctive extra curved bar
197
+ * placed to the left of an OrGateGeometry body to form the full XOR gate symbol.
198
+ *
199
+ * Back-arc parameters (backInset, u_b, cx_b, r_b, angle_b) are identical to those in
200
+ * OrGateGeometry so this geometry aligns correctly when placed at the same centre.
201
+ *
202
+ * Note: the tail arc's centre is shifted left by tailWidth (radius stays constant = r_b), so
203
+ * the tail always spans the full gate height regardless of tailWidth.
204
+ * For bars to be visible, barsSeparation must be less than orHeight − 2 × thickness.
205
+ *
206
+ * @param orWidth - Width of the paired OR gate body
207
+ * @param orHeight - Height of the paired OR gate body
208
+ * @param tailWidth - How far left the tail arc's corners are from the OR gate's left corners
209
+ * @param thickness - Wall thickness of the arc shell AND height of each bar
210
+ * @param barsSeparation - Vertical gap between the two bars (centred on y = 0)
211
+ * @param depth - Extrusion depth
212
+ * @param steps - Number of extrusion steps
213
+ */
214
+ export declare function XorGateTailGeometry(orWidth: number, orHeight: number, tailWidth: number, thickness: number, barsSeparation: number, depth: number, steps?: number): ExtrudeGeometry;
215
+ /**
216
+ * Create an ExtrudeGeometry shaped like an L (or mirrored L) with a configurable
217
+ * angle between the two arms.
218
+ *
219
+ * Default orientation (`invert = false`) produces a `|_`-like shape:
220
+ * base arm extends to the right, stem arm extends upward at the given angle.
221
+ * When `invert = true` the shape is mirrored horizontally (`_|`-like):
222
+ * base arm extends to the left, stem arm mirrors accordingly.
223
+ *
224
+ * The `angle` parameter (in degrees) controls the inner angle between the two arms:
225
+ * - 90° → standard right-angle L
226
+ * - 120° → obtuse junction (`\_`-like)
227
+ * - 60° → acute junction
228
+ *
229
+ * Both the inner (concave) and outer (convex) junction corners are rounded
230
+ * equally with `junctionRadius` (similar to CSS border-radius).
231
+ * When 0 both corners are sharp. The arc sweep adapts to the angle: (180° − angle).
232
+ *
233
+ * The geometry is centered on its bounding box.
234
+ *
235
+ * At 90°, `width` and `height` correspond exactly to the bounding box dimensions.
236
+ * At other angles the bounding box changes but the arm lengths remain consistent:
237
+ * base inner arm = width − thickness, stem inner arm = height − thickness.
238
+ *
239
+ * @param width - Base arm length (bounding-box width at 90°)
240
+ * @param height - Stem arm length (bounding-box height at 90°)
241
+ * @param thickness - Arm thickness of the L
242
+ * @param angle - Inner angle between the two arms, in degrees (typically 30–150)
243
+ * @param invert - If true, mirror horizontally
244
+ * @param junctionRadius - Radius of the rounded junction corners, inner and outer (0 = sharp)
245
+ * @param depth - Extrusion depth
246
+ * @param steps - Number of extrusion steps
247
+ */
248
+ export declare function LGeometry(width: number, height: number, thickness: number, angle: number, invert: boolean, junctionRadius: number, depth: number, steps?: number): ExtrudeGeometry;
249
+ export declare function CyclicTrapezoidGeometry(width: number, tailHeight: number, headHeight: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
250
+ /**
251
+ * Create an ExtrudeGeometry shaped like an empty rectangle (frame/border).
252
+ * Shape is centered at origin. The inner hole is a smaller rectangle inset
253
+ * by `thickness` on all four sides.
254
+ *
255
+ * @param width - Total width of the outer rectangle
256
+ * @param height - Total height of the outer rectangle
257
+ * @param thickness - Wall thickness of the frame (inset on each side)
258
+ * @param depth - Extrusion depth
259
+ * @param steps - Number of extrusion steps
260
+ * @constructor
261
+ */
262
+ export declare function EmptyRectangleGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
263
+ /**
264
+ * Create an ExtrudeGeometry shaped like a rectangle with a rectangular "nail"
265
+ * (intrusion or protrusion)
266
+ * The main rectangle is centered at origin; the nail hangs inside or outside it.
267
+ *
268
+ * @param width - Total width of the rectangle
269
+ * @param height - Height of the main rectangle body
270
+ * @param nailWidth - Width of the nail intrusion
271
+ * @param nailHeight - Height of the nail
272
+ * @param nailX - Horizontal center of the nail, measured from the rectangle's left edge
273
+ * @param protusion - if false nail will enter inside the rectangle (intrusion), else outside (protusion)
274
+ * @param depth - Extrusion depth
275
+ * @param steps - Number of extrusion steps
276
+ * @throws Error if nail dimensions or position are geometrically invalid
277
+ * @constructor
278
+ */
279
+ export declare function RectangleWithNailGeometry(width: number, height: number, nailWidth: number, nailHeight: number, nailX: number, protusion: boolean, depth: number, steps?: number): ExtrudeGeometry;
280
+ /**
281
+ * Create an ExtrudeGeometry for the inner hole of a cyclic trapezoid.
282
+ * Returns null when the geometry should be solid (no hole).
283
+ *
284
+ * @param width - Total width
285
+ * @param tailHeight - Height of the left (tail) side
286
+ * @param headHeight - Height of the right (head) side (0 for triangle)
287
+ * @param thickness - Wall thickness
288
+ * @param depth - Extrusion depth
289
+ * @param steps - Number of extrusion steps
290
+ */
291
+ export declare function CyclicTrapezoidHoleGeometry(width: number, tailHeight: number, headHeight: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry | null;
292
+ /**
293
+ * Create an ExtrudeGeometry for a drip (teardrop) shape.
294
+ * The shape has a sharp pointed tip at the top and a rounded bottom.
295
+ * Shape is centered at origin.
296
+ *
297
+ * Construction: the rounded bottom is a circle of radius width/2 centered at
298
+ * y = -height/2 + width/2. Two straight tangent lines connect the circle to the
299
+ * tip at (0, +height/2). This requires height > width so the tip sits above the
300
+ * circle and the tangent lines exist.
301
+ *
302
+ * @param width - Total width
303
+ * @param height - Total height (must be > width)
304
+ * @param thickness - Wall thickness of the shell
305
+ * @param depth - Extrusion depth
306
+ * @param steps - Number of extrusion steps
307
+ * @throws Error if height <= width (tip too low for tangent construction)
308
+ * @constructor
309
+ */
310
+ export declare function DripGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
311
+ /**
312
+ * Create an ExtrudeGeometry for the inner hole of a drip shape.
313
+ * Returns null when thickness is large enough that the drip has no hole.
314
+ *
315
+ * @param width - Total width
316
+ * @param height - Total height (must be > width)
317
+ * @param thickness - Wall thickness
318
+ * @param depth - Extrusion depth
319
+ * @param steps - Number of extrusion steps
320
+ * @throws Error if height <= width
321
+ */
322
+ export declare function DripHoleGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry | null;
323
+ /**
324
+ * Create an ExtrudeGeometry shaped like japanese hiragana Ku and katakana Ko (くコ)
325
+ * Shape is centered horizontally at the junction between the two and vertically at the middle height
326
+ * by `kuThickness` on all four sides.
327
+ *
328
+ * @param kuWidth - width of the left ku part (outer)
329
+ * @param koWidth - width of the right ko part (outer)
330
+ * @param height - Total height of the outer geometry
331
+ * @param kuThickness - Wall kuThickness of the frame (inset on ku side)
332
+ * @param koThickness - Wall koThickness of the frame (inset on ko side)
333
+ * @param depth - Extrusion depth
334
+ * @param steps - Number of extrusion steps
335
+ * @constructor
336
+ */
337
+ export declare function KuKoGeometry(kuWidth: number, koWidth: number, height: number, kuThickness: number, koThickness: number, depth: number, steps?: number): ExtrudeGeometry;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Three.js Layer Constants for Hitbox Organization
3
+ * @module scene/shared/utils/LayerConstants
4
+ *
5
+ * Defines layer assignments for priority-based raycasting and rendering.
6
+ */
7
+ /**
8
+ * Three.js layer assignments for hitbox meshes and rendering
9
+ *
10
+ * Layers enable priority-based raycasting by querying layers sequentially.
11
+ * Lower layer numbers = higher priority for hover detection.
12
+ *
13
+ * @remarks
14
+ * - Layer 0 is reserved for default visual rendering
15
+ * - Hitbox layers (1-3) are invisible but raycastable
16
+ * - Camera.layers should include only layer 0 for rendering
17
+ * - Raycaster.layers is set per-query based on priority
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { HitboxLayers } from './LayerConstants';
22
+ *
23
+ * // Assign hitbox to component layer
24
+ * hitboxMesh.layers.set(HitboxLayers.COMPONENT);
25
+ *
26
+ * // Raycast only enode hitboxes
27
+ * raycaster.layers.set(HitboxLayers.ENODE);
28
+ * ```
29
+ */
30
+ export declare const HitboxLayers: {
31
+ /** Default layer for visual rendering (do not use for hitboxes) */
32
+ readonly DEFAULT: 0;
33
+ /** Enode hitboxes - highest hover priority */
34
+ readonly ENODE: 1;
35
+ /** Component hitboxes - medium hover priority */
36
+ readonly COMPONENT: 2;
37
+ /** Wire hitboxes - lowest hover priority */
38
+ readonly WIRE: 3;
39
+ };
40
+ export type HitboxLayerValue = (typeof HitboxLayers)[keyof typeof HitboxLayers];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Lighting Utilities
3
+ * @module scene/shared/utils/LightingUtils
4
+ *
5
+ * Helper functions for setting up scene lighting
6
+ */
7
+ import * as THREE from 'three';
8
+ /**
9
+ * Create an ambient light with default intensity
10
+ *
11
+ * @param color - Light color (hex)
12
+ * @param intensity - Light intensity (0-1)
13
+ * @returns AmbientLight
14
+ */
15
+ export declare function createAmbientLight(color?: number, intensity?: number): THREE.AmbientLight;
16
+ /**
17
+ * Create a directional light with default positioning
18
+ *
19
+ * @param color - Light color (hex)
20
+ * @param intensity - Light intensity
21
+ * @param position - Light position
22
+ * @returns DirectionalLight
23
+ */
24
+ export declare function createDirectionalLight(color?: number, intensity?: number, position?: THREE.Vector3): THREE.DirectionalLight;
25
+ /**
26
+ * Setup standard scene lighting (ambient + directional)
27
+ *
28
+ * @param scene - Scene to add lights to
29
+ * @returns Array of created lights
30
+ */
31
+ export declare function setupSceneLights(scene: THREE.Scene): THREE.Light[];
@@ -0,0 +1,73 @@
1
+ import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial.js';
2
+ /**
3
+ * Material Utilities
4
+ * @module scene/shared/utils/MaterialUtils
5
+ *
6
+ * Helper functions for creating and managing Three.js materials
7
+ */
8
+ import * as THREE from 'three';
9
+ /**
10
+ * Create a standard material with common defaults
11
+ *
12
+ * @param color - Base color (hex)
13
+ * @param options - Additional material options
14
+ * @returns MeshStandardMaterial
15
+ */
16
+ export declare function createStandardMaterial(color: number, options?: {
17
+ emissive?: number;
18
+ emissiveIntensity?: number;
19
+ metalness?: number;
20
+ roughness?: number;
21
+ transparent?: boolean;
22
+ opacity?: number;
23
+ }): THREE.MeshStandardMaterial;
24
+ /**
25
+ * Create a material for wire lines
26
+ *
27
+ * @param color - Line color (hex)
28
+ * @param linewidth - Line width (note: may not work on all platforms)
29
+ * @returns LineBasicMaterial
30
+ */
31
+ export declare function createLineMaterial(color?: number, linewidth?: number): THREE.LineBasicMaterial;
32
+ /**
33
+ * Create a LineMaterial for Line2 rendering with consistent line width
34
+ *
35
+ * Note: Resolution must be set after creation using material.resolution.set(width, height)
36
+ *
37
+ * @param color - Line color (hex, default: 0xffffff/white)
38
+ * @param linewidth - Line width in pixels (default: 2)
39
+ * @returns LineMaterial for Line2 objects
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const material = createLine2Material(0xffffff, 2);
44
+ * material.resolution.set(window.innerWidth, window.innerHeight);
45
+ * ```
46
+ */
47
+ export declare function createLine2Material(color?: number, linewidth?: number): LineMaterial;
48
+ /**
49
+ * Update material state for component state changes
50
+ *
51
+ * @param material - Material to update
52
+ * @param state - Component state data
53
+ */
54
+ export declare function updateMaterialState(material: THREE.MeshStandardMaterial, state: {
55
+ isActive?: boolean;
56
+ isHighlighted?: boolean;
57
+ customColor?: number;
58
+ emissiveIntensity?: number;
59
+ }): void;
60
+ /**
61
+ * Create a semi-transparent preview material
62
+ *
63
+ * @param baseColor - Base color
64
+ * @param opacity - Transparency level (0-1)
65
+ * @returns MeshStandardMaterial configured for preview
66
+ */
67
+ export declare function createPreviewMaterial(baseColor: number, opacity?: number): THREE.MeshStandardMaterial;
68
+ /**
69
+ * Create an error state material (for validation feedback)
70
+ *
71
+ * @returns MeshStandardMaterial in error state (red tint)
72
+ */
73
+ export declare function createErrorMaterial(): THREE.MeshStandardMaterial;
@@ -0,0 +1,16 @@
1
+ import { ControllerOptions, EngineOptions, MapControlsOptions } from '../types';
2
+ /**
3
+ * returns default complete mapControlsOptions or an autocompleted partial mapControlOptions
4
+ * @param options
5
+ */
6
+ export declare function mapControlsOptions(options?: MapControlsOptions | undefined): MapControlsOptions;
7
+ /**
8
+ * returns default complete controllerOptions or an autocompleted partial controllerOptions
9
+ * @param options
10
+ */
11
+ export declare function controllerOptions(options?: ControllerOptions | undefined): ControllerOptions;
12
+ /**
13
+ * returns default complete engineOptions or and autoCompleted partial engineOptions
14
+ * @param options
15
+ */
16
+ export declare function engineOptions(options?: EngineOptions | undefined): EngineOptions;