simple-circuit-engine 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +13 -7
- package/CLAUDE.md +16 -103
- package/README.md +8 -5
- package/dist/core/index.d.ts +2 -23
- package/dist/core/index.js +75 -2000
- package/dist/core/setup.d.ts +17 -0
- package/dist/core/simulation/CircuitRunner.d.ts +176 -0
- package/dist/core/simulation/DirtyTracker.d.ts +87 -0
- package/dist/core/simulation/EventQueue.d.ts +68 -0
- package/dist/core/simulation/StateManager.d.ts +100 -0
- package/dist/core/simulation/behaviors/BehaviorRegistry.d.ts +70 -0
- package/dist/core/simulation/behaviors/ComponentBehavior.d.ts +53 -0
- package/dist/core/simulation/behaviors/basic/BatteryBehavior.d.ts +14 -0
- package/dist/core/simulation/behaviors/basic/ClockBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/DoubleThrowSwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/LightbulbBehavior.d.ts +23 -0
- package/dist/core/simulation/behaviors/basic/RectangleLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/RelayBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/SmallLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/SwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/index.d.ts +20 -0
- package/dist/core/simulation/behaviors/gates/InverterBehavior.d.ts +29 -0
- package/dist/core/simulation/behaviors/gates/Nand4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nand8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NandGateBehavior.d.ts +28 -0
- package/dist/core/simulation/behaviors/gates/Nor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/Xor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Xor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/XorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/index.d.ts +34 -0
- package/dist/core/simulation/behaviors/index.d.ts +24 -0
- package/dist/core/simulation/behaviors/types.d.ts +101 -0
- package/dist/core/simulation/index.d.ts +18 -0
- package/dist/core/simulation/states/ComponentState.d.ts +57 -0
- package/dist/core/simulation/states/SimulationState.d.ts +46 -0
- package/dist/core/simulation/states/basic/BatteryState.d.ts +16 -0
- package/dist/core/simulation/states/basic/ClockState.d.ts +16 -0
- package/dist/core/simulation/states/basic/DoubleThrowSwitchState.d.ts +21 -0
- package/dist/core/simulation/states/basic/LightbulbState.d.ts +21 -0
- package/dist/core/simulation/states/basic/RectangleLEDState.d.ts +9 -0
- package/dist/core/simulation/states/basic/RelayState.d.ts +25 -0
- package/dist/core/simulation/states/basic/SmallLEDState.d.ts +21 -0
- package/dist/core/simulation/states/basic/SwitchState.d.ts +25 -0
- package/dist/core/simulation/states/gates/InverterState.d.ts +17 -0
- package/dist/core/simulation/states/gates/Nand4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nand8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NandGateState.d.ts +16 -0
- package/dist/core/simulation/states/gates/Nor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/XorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/index.d.ts +25 -0
- package/dist/core/simulation/states/index.d.ts +26 -0
- package/dist/core/simulation/states/types.d.ts +32 -0
- package/dist/core/simulation/types.d.ts +155 -0
- package/dist/core/topology/Circuit.d.ts +420 -0
- package/dist/core/topology/CircuitMetadata.d.ts +24 -0
- package/dist/core/topology/CircuitOptions.d.ts +14 -0
- package/dist/core/topology/Component.d.ts +152 -0
- package/dist/core/topology/ENode.d.ts +200 -0
- package/dist/core/topology/Wire.d.ts +130 -0
- package/dist/core/topology/delays.d.ts +52 -0
- package/dist/core/topology/index.d.ts +14 -0
- package/dist/core/topology/types.d.ts +175 -0
- package/dist/core/utils/CameraOptions.d.ts +83 -0
- package/dist/core/utils/MemoizeDecorator.d.ts +9 -0
- package/dist/core/utils/Position.d.ts +166 -0
- package/dist/core/utils/Position3D.d.ts +77 -0
- package/dist/core/utils/Rotation.d.ts +82 -0
- package/dist/core/utils/index.d.ts +24 -0
- package/dist/core/utils/types.d.ts +35 -0
- package/dist/core-Bjta9Y7_.js +2707 -0
- package/dist/core-Bjta9Y7_.js.map +1 -0
- package/dist/index.d.ts +13 -6286
- package/dist/index.js +120 -100
- package/dist/scene/CircuitEngine.d.ts +270 -0
- package/dist/scene/index.d.ts +1 -2
- package/dist/scene/index.js +44 -38
- package/dist/scene/setup.d.ts +18 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +211 -0
- package/dist/scene/shared/BranchingPointVisualFactory.d.ts +70 -0
- package/dist/scene/shared/EventEmitter.d.ts +92 -0
- package/dist/scene/shared/HoverManager.d.ts +151 -0
- package/dist/scene/shared/SelectionManager.d.ts +159 -0
- package/dist/scene/shared/WireVisualManager.d.ts +242 -0
- package/dist/scene/shared/components/ComponentVisualFactory.d.ts +438 -0
- package/dist/scene/shared/components/DefaultVisualFactory.d.ts +51 -0
- package/dist/scene/shared/components/FactoryRegistry.d.ts +84 -0
- package/dist/scene/shared/components/GroupedFactoryRegistry.d.ts +153 -0
- package/dist/scene/shared/components/basic/BatteryVisualFactory.d.ts +13 -0
- package/dist/scene/shared/components/basic/ClockVisualFactory.d.ts +79 -0
- package/dist/scene/shared/components/basic/DoubleThrowSwitchVisualFactory.d.ts +87 -0
- package/dist/scene/shared/components/basic/LabelVisualFactory.d.ts +148 -0
- package/dist/scene/shared/components/basic/LightbulbVisualFactory.d.ts +72 -0
- package/dist/scene/shared/components/basic/RectangleLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/RelayVisualFactory.d.ts +92 -0
- package/dist/scene/shared/components/basic/SmallLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/SwitchVisualFactory.d.ts +85 -0
- package/dist/scene/shared/components/gates/InverterVisualFactory.d.ts +104 -0
- package/dist/scene/shared/components/gates/Nand4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nand8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NandGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Nor4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nor8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NorGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Xor4GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/Xor8GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/XorGateVisualFactory.d.ts +103 -0
- package/dist/scene/shared/components/index.d.ts +29 -0
- package/dist/scene/shared/components/types.d.ts +43 -0
- package/dist/scene/shared/types.d.ts +476 -0
- package/dist/scene/shared/utils/CameraUtils.d.ts +23 -0
- package/dist/scene/shared/utils/ColorUtils.d.ts +26 -0
- package/dist/scene/shared/utils/ControlsUtils.d.ts +8 -0
- package/dist/scene/shared/utils/GeometryUtils.d.ts +261 -0
- package/dist/scene/shared/utils/LayerConstants.d.ts +40 -0
- package/dist/scene/shared/utils/LightingUtils.d.ts +31 -0
- package/dist/scene/shared/utils/MaterialUtils.d.ts +73 -0
- package/dist/scene/shared/utils/Options.d.ts +16 -0
- package/dist/scene/simulation/CircuitRunnerController.d.ts +227 -0
- package/dist/scene/static/CircuitController.d.ts +227 -0
- package/dist/scene/static/CircuitWriter.d.ts +146 -0
- package/dist/scene/static/PinTooltipWidget.d.ts +26 -0
- package/dist/scene/static/tools/BuildTool.d.ts +286 -0
- package/dist/scene/static/tools/ComponentPickerWidget.d.ts +82 -0
- package/dist/scene/static/tools/ConfigPanelWidget.d.ts +93 -0
- package/dist/scene/static/tools/MultiSelectTool.d.ts +265 -0
- package/dist/scene-CVsDdySt.js +7357 -0
- package/dist/scene-CVsDdySt.js.map +1 -0
- package/package.json +24 -25
- package/dist/CircuitRunner-DEb7JdNf.js +0 -1809
- package/dist/CircuitRunner-DEb7JdNf.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/scene/index.js.map +0 -1
- package/dist/setup-AB1vFiis.js +0 -9918
- package/dist/setup-AB1vFiis.js.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for NOR gates components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Gate mesh
|
|
10
|
+
* - vcc, gnd, inputs and output pin groups
|
|
11
|
+
* - Component hitbox for raycasting
|
|
12
|
+
*
|
|
13
|
+
* Animation:
|
|
14
|
+
* - Emissive glow when Gate is high (based on simulation state)
|
|
15
|
+
*/
|
|
16
|
+
export declare class NorGateVisualFactory extends ComponentVisualFactoryBase {
|
|
17
|
+
/** Shared envelope geometry */
|
|
18
|
+
protected readonly ENVELOPE_GEOM: THREE.ExtrudeGeometry;
|
|
19
|
+
/** Shared inner hole geometry */
|
|
20
|
+
protected readonly HOLE_GEOM: THREE.ExtrudeGeometry;
|
|
21
|
+
/** Shared geometry for negative marker **/
|
|
22
|
+
protected readonly NEG_MARKER_GEOM: THREE.CylinderGeometry;
|
|
23
|
+
protected readonly HOLE_COLOR_HIGH: THREE.Color;
|
|
24
|
+
protected readonly HOLE_COLOR_LOW: THREE.Color;
|
|
25
|
+
protected readonly HOLE_EMISSIVE_HIGH_INTENSITY = 0.5;
|
|
26
|
+
protected readonly HOLE_EMISSIVE_LOW_INTENSITY = 0.2;
|
|
27
|
+
constructor();
|
|
28
|
+
defaultRotation(): number;
|
|
29
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
30
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get config form definition
|
|
33
|
+
*
|
|
34
|
+
* @param config - Optional current config to determine disabled state of transitionSpan
|
|
35
|
+
* @returns Form definition with defaultLogicFamily dropdown, activationLogic boolean, and transitionSpan number
|
|
36
|
+
*/
|
|
37
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
38
|
+
/**
|
|
39
|
+
* Map core config to form data
|
|
40
|
+
* Converts "positive"/"negative" strings to boolean
|
|
41
|
+
*
|
|
42
|
+
* @param config - Core component config
|
|
43
|
+
* @returns Form data with boolean activationLogic
|
|
44
|
+
*/
|
|
45
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
46
|
+
/**
|
|
47
|
+
* Map form data to core config
|
|
48
|
+
* Converts boolean to "positive"/"negative" strings
|
|
49
|
+
*
|
|
50
|
+
* @param formData - Form data with boolean activationLogic
|
|
51
|
+
* @returns Core config with string activationLogic
|
|
52
|
+
*/
|
|
53
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
54
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Update animation based on simulation state
|
|
57
|
+
*
|
|
58
|
+
* @param object3D - The Object3D created by createVisual()
|
|
59
|
+
* @param state - The component current simulation state
|
|
60
|
+
*/
|
|
61
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
62
|
+
private _setHoleColor;
|
|
63
|
+
private _ensureClonedHoleMaterial;
|
|
64
|
+
private _restoreSharedHoleMaterial;
|
|
65
|
+
private _cleanupMixer;
|
|
66
|
+
/**
|
|
67
|
+
* Animate the hole color between LOW and HIGH over the transition span.
|
|
68
|
+
* Reads current color for mid-transition support.
|
|
69
|
+
*/
|
|
70
|
+
private _animateHoleColor;
|
|
71
|
+
/**
|
|
72
|
+
* Find the envelope mesh within the component group
|
|
73
|
+
*
|
|
74
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
75
|
+
* @returns The envelope mesh if found, null otherwise
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Searches for a mesh with userData.part === 'envelope'
|
|
79
|
+
*/
|
|
80
|
+
protected findEnvelopeMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
81
|
+
/**
|
|
82
|
+
* Find the hole mesh within the component group
|
|
83
|
+
*
|
|
84
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
85
|
+
* @returns The hole mesh if found, null otherwise
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Searches for a mesh with userData.part === 'hole'
|
|
89
|
+
*/
|
|
90
|
+
protected findHoleMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
91
|
+
/**
|
|
92
|
+
* Find the negative marker mesh within the component group
|
|
93
|
+
*
|
|
94
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
95
|
+
* @returns The negative marker mesh if found, null otherwise
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* Searches for a mesh with userData.part === 'negativeMarker'
|
|
99
|
+
*/
|
|
100
|
+
protected findNegativeMarkerMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
101
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component } from '../../../../core/index.ts';
|
|
2
|
+
import { XorGateVisualFactory } from './XorGateVisualFactory';
|
|
3
|
+
import { VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for XOR gates components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Gate mesh
|
|
10
|
+
* - vcc, gnd, inputs and output pin groups
|
|
11
|
+
* - Component hitbox for raycasting
|
|
12
|
+
*
|
|
13
|
+
* Animation:
|
|
14
|
+
* - Emissive glow when Gate is high (based on simulation state)
|
|
15
|
+
*/
|
|
16
|
+
export declare class Xor4GateVisualFactory extends XorGateVisualFactory {
|
|
17
|
+
/** XOR tail geometry */
|
|
18
|
+
protected readonly TAIL_GEOM: THREE.ExtrudeGeometry;
|
|
19
|
+
/** Shared open envelope geometry */
|
|
20
|
+
protected readonly ENVELOPE_GEOM: THREE.ExtrudeGeometry;
|
|
21
|
+
/** Shared inner hole geometry */
|
|
22
|
+
protected readonly HOLE_GEOM: THREE.ExtrudeGeometry;
|
|
23
|
+
/** Shared geometry for negative marker **/
|
|
24
|
+
protected readonly NEG_MARKER_GEOM: THREE.CylinderGeometry;
|
|
25
|
+
constructor();
|
|
26
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
27
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
28
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component } from '../../../../core/index.ts';
|
|
2
|
+
import { XorGateVisualFactory } from './XorGateVisualFactory';
|
|
3
|
+
import { VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for XOR gates components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Gate mesh
|
|
10
|
+
* - vcc, gnd, inputs and output pin groups
|
|
11
|
+
* - Component hitbox for raycasting
|
|
12
|
+
*
|
|
13
|
+
* Animation:
|
|
14
|
+
* - Emissive glow when Gate is high (based on simulation state)
|
|
15
|
+
*/
|
|
16
|
+
export declare class Xor8GateVisualFactory extends XorGateVisualFactory {
|
|
17
|
+
/** XOR tail geometry */
|
|
18
|
+
protected readonly TAIL_GEOM: THREE.ExtrudeGeometry;
|
|
19
|
+
/** Shared open envelope geometry */
|
|
20
|
+
protected readonly ENVELOPE_GEOM: THREE.ExtrudeGeometry;
|
|
21
|
+
/** Shared inner hole geometry */
|
|
22
|
+
protected readonly HOLE_GEOM: THREE.ExtrudeGeometry;
|
|
23
|
+
/** Shared geometry for negative marker **/
|
|
24
|
+
protected readonly NEG_MARKER_GEOM: THREE.CylinderGeometry;
|
|
25
|
+
constructor();
|
|
26
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
27
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
28
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for XOR gates components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Gate mesh
|
|
10
|
+
* - vcc, gnd, inputs and output pin groups
|
|
11
|
+
* - Component hitbox for raycasting
|
|
12
|
+
*
|
|
13
|
+
* Animation:
|
|
14
|
+
* - Emissive glow when Gate is high (based on simulation state)
|
|
15
|
+
*/
|
|
16
|
+
export declare class XorGateVisualFactory extends ComponentVisualFactoryBase {
|
|
17
|
+
/** XOR tail geometry */
|
|
18
|
+
protected readonly TAIL_GEOM: THREE.ExtrudeGeometry;
|
|
19
|
+
/** Shared open envelope geometry */
|
|
20
|
+
protected readonly ENVELOPE_GEOM: THREE.ExtrudeGeometry;
|
|
21
|
+
/** Shared inner hole geometry */
|
|
22
|
+
protected readonly HOLE_GEOM: THREE.ExtrudeGeometry;
|
|
23
|
+
/** Shared geometry for negative marker **/
|
|
24
|
+
protected readonly NEG_MARKER_GEOM: THREE.CylinderGeometry;
|
|
25
|
+
protected readonly HOLE_COLOR_HIGH: THREE.Color;
|
|
26
|
+
protected readonly HOLE_COLOR_LOW: THREE.Color;
|
|
27
|
+
protected readonly HOLE_EMISSIVE_HIGH_INTENSITY = 0.5;
|
|
28
|
+
protected readonly HOLE_EMISSIVE_LOW_INTENSITY = 0.2;
|
|
29
|
+
constructor();
|
|
30
|
+
defaultRotation(): number;
|
|
31
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
32
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get config form definition for XOR/XNOR Gate
|
|
35
|
+
*
|
|
36
|
+
* @param config - Optional current config to determine disabled state of transitionSpan
|
|
37
|
+
* @returns Form definition with defaultLogicFamily dropdown, activationLogic boolean, and transitionSpan number
|
|
38
|
+
*/
|
|
39
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
40
|
+
/**
|
|
41
|
+
* Map core config to form data
|
|
42
|
+
* Converts "positive"/"negative" strings to boolean
|
|
43
|
+
*
|
|
44
|
+
* @param config - Core component config
|
|
45
|
+
* @returns Form data with boolean activationLogic
|
|
46
|
+
*/
|
|
47
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
48
|
+
/**
|
|
49
|
+
* Map form data to core config
|
|
50
|
+
* Converts boolean to "positive"/"negative" strings
|
|
51
|
+
*
|
|
52
|
+
* @param formData - Form data with boolean activationLogic
|
|
53
|
+
* @returns Core config with string activationLogic
|
|
54
|
+
*/
|
|
55
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
56
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Update animation based on simulation state
|
|
59
|
+
*
|
|
60
|
+
* @param object3D - The Object3D created by createVisual()
|
|
61
|
+
* @param state - The component current simulation state
|
|
62
|
+
*/
|
|
63
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
64
|
+
private _setHoleColor;
|
|
65
|
+
private _ensureClonedHoleMaterial;
|
|
66
|
+
private _restoreSharedHoleMaterial;
|
|
67
|
+
private _cleanupMixer;
|
|
68
|
+
/**
|
|
69
|
+
* Animate the hole color between LOW and HIGH over the transition span.
|
|
70
|
+
* Reads current color for mid-transition support.
|
|
71
|
+
*/
|
|
72
|
+
private _animateHoleColor;
|
|
73
|
+
/**
|
|
74
|
+
* Find the envelope mesh within the component group
|
|
75
|
+
*
|
|
76
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
77
|
+
* @returns The envelope mesh if found, null otherwise
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* Searches for a mesh with userData.part === 'envelope'
|
|
81
|
+
*/
|
|
82
|
+
protected findEnvelopeMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
83
|
+
/**
|
|
84
|
+
* Find the hole mesh within the component group
|
|
85
|
+
*
|
|
86
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
87
|
+
* @returns The hole mesh if found, null otherwise
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* Searches for a mesh with userData.part === 'hole'
|
|
91
|
+
*/
|
|
92
|
+
protected findHoleMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
93
|
+
/**
|
|
94
|
+
* Find the negative marker mesh within the component group
|
|
95
|
+
*
|
|
96
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
97
|
+
* @returns The negative marker mesh if found, null otherwise
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* Searches for a mesh with userData.part === 'negativeMarker'
|
|
101
|
+
*/
|
|
102
|
+
protected findNegativeMarkerMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
103
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component visual factories
|
|
3
|
+
* @module scene/shared/components
|
|
4
|
+
*/
|
|
5
|
+
export type { IFactoryRegistry, IComponentVisualFactory } from './ComponentVisualFactory.js';
|
|
6
|
+
export { CmpMatCategory, CmpMatVariant, CmpMatType, CMP_MATERIALS } from './types.js';
|
|
7
|
+
export { FactoryRegistry } from './FactoryRegistry.js';
|
|
8
|
+
export { DefaultVisualFactory } from './DefaultVisualFactory.js';
|
|
9
|
+
export type { ComponentGroup, IComponentGroupBuilder, IGroupedFactoryRegistry, } from './GroupedFactoryRegistry.js';
|
|
10
|
+
export { GroupedFactoryRegistry } from './GroupedFactoryRegistry.js';
|
|
11
|
+
export { BatteryVisualFactory } from './basic/BatteryVisualFactory';
|
|
12
|
+
export { LabelVisualFactory } from './basic/LabelVisualFactory';
|
|
13
|
+
export { LightbulbVisualFactory } from './basic/LightbulbVisualFactory';
|
|
14
|
+
export { RectangleLEDVisualFactory } from './basic/RectangleLEDVisualFactory';
|
|
15
|
+
export { RelayVisualFactory } from './basic/RelayVisualFactory';
|
|
16
|
+
export { SmallLEDVisualFactory } from './basic/SmallLEDVisualFactory';
|
|
17
|
+
export { SwitchVisualFactory } from './basic/SwitchVisualFactory';
|
|
18
|
+
export { DoubleThrowSwitchVisualFactory } from './basic/DoubleThrowSwitchVisualFactory';
|
|
19
|
+
export { ClockVisualFactory } from './basic/ClockVisualFactory';
|
|
20
|
+
export { InverterVisualFactory } from './gates/InverterVisualFactory';
|
|
21
|
+
export { NandGateVisualFactory } from './gates/NandGateVisualFactory';
|
|
22
|
+
export { Nand4GateVisualFactory } from './gates/Nand4GateVisualFactory';
|
|
23
|
+
export { Nand8GateVisualFactory } from './gates/Nand8GateVisualFactory';
|
|
24
|
+
export { NorGateVisualFactory } from './gates/NorGateVisualFactory';
|
|
25
|
+
export { Nor4GateVisualFactory } from './gates/Nor4GateVisualFactory';
|
|
26
|
+
export { Nor8GateVisualFactory } from './gates/Nor8GateVisualFactory';
|
|
27
|
+
export { XorGateVisualFactory } from './gates/XorGateVisualFactory';
|
|
28
|
+
export { Xor4GateVisualFactory } from './gates/Xor4GateVisualFactory';
|
|
29
|
+
export { Xor8GateVisualFactory } from './gates/Xor8GateVisualFactory';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Material Types
|
|
3
|
+
* @module scene/shared/components/types
|
|
4
|
+
*
|
|
5
|
+
* Enums and shared material dictionary for the component visual factory system.
|
|
6
|
+
* Materials are singleton instances shared across all factory instances.
|
|
7
|
+
*/
|
|
8
|
+
import * as THREE from 'three';
|
|
9
|
+
/** Material category — identifies a family of related shared materials */
|
|
10
|
+
export declare const enum CmpMatCategory {
|
|
11
|
+
WHITE = "WHITE",
|
|
12
|
+
SHINY_SILVER = "SHINY_SILVER",
|
|
13
|
+
GLASS = "GLASS",
|
|
14
|
+
DARK_GRAY = "DARK_GRAY"
|
|
15
|
+
}
|
|
16
|
+
/** Material variant — visual state within a category */
|
|
17
|
+
export declare const enum CmpMatVariant {
|
|
18
|
+
NORMAL = "NORMAL",
|
|
19
|
+
HOVERED = "HOVERED",
|
|
20
|
+
SELECTED = "SELECTED"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Material ownership type — stored on `material.userData.matType`.
|
|
24
|
+
* Numeric for fast comparison; determines how hover/select/animation interact.
|
|
25
|
+
*
|
|
26
|
+
* - **SHARED** — from CMP_MATERIALS dict; hover/select may swap to a variant
|
|
27
|
+
* - **FACTORY** — per-visual factory material; skip hover/select swap
|
|
28
|
+
* - **PRIVATE** — per-instance material (e.g. LED configurable color); skip hover/select swap
|
|
29
|
+
* - **ANIMATION_CLONE** — cloned from SHARED for animation; skip hover/select swap
|
|
30
|
+
*/
|
|
31
|
+
export declare const enum CmpMatType {
|
|
32
|
+
SHARED = 0,
|
|
33
|
+
FACTORY = 1,
|
|
34
|
+
PRIVATE = 2,
|
|
35
|
+
ANIMATION_CLONE = 3
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Shared material dictionary: CmpMatCategory → CmpMatVariant → MeshLambertMaterial.
|
|
39
|
+
*
|
|
40
|
+
* Every material carries `userData.matType` and `userData.matCat` (its category)
|
|
41
|
+
* (`CmpMatType.SHARED`) so hover/select logic can identify and swap them.
|
|
42
|
+
*/
|
|
43
|
+
export declare const CMP_MATERIALS: Readonly<Record<CmpMatCategory, Record<CmpMatVariant, THREE.MeshLambertMaterial>>>;
|