simple-circuit-engine 0.0.12 → 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.
- package/AGENTS.md +2 -1
- package/CLAUDE.md +2 -0
- package/dist/core/index.js +83 -73
- package/dist/core/setup.d.ts +8 -0
- package/dist/core/simulation/behaviors/arithmetic/AdderBehavior.d.ts +28 -0
- package/dist/core/simulation/behaviors/arithmetic/ArithmeticBehaviorMixin.d.ts +63 -0
- package/dist/core/simulation/behaviors/arithmetic/EightBitAdderBehavior.d.ts +51 -0
- package/dist/core/simulation/behaviors/arithmetic/EightBitOnesComplementBehavior.d.ts +29 -0
- package/dist/core/simulation/behaviors/arithmetic/HalfAdderBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/arithmetic/index.d.ts +7 -0
- package/dist/core/simulation/behaviors/index.d.ts +4 -0
- package/dist/core/simulation/states/arithmetic/AdderState.d.ts +16 -0
- package/dist/core/simulation/states/arithmetic/ArithmeticState.d.ts +53 -0
- package/dist/core/simulation/states/arithmetic/EightBitAdderState.d.ts +25 -0
- package/dist/core/simulation/states/arithmetic/EightBitOnesComplementState.d.ts +18 -0
- package/dist/core/simulation/states/arithmetic/HalfAdderState.d.ts +16 -0
- package/dist/core/simulation/states/arithmetic/index.d.ts +7 -0
- package/dist/core/simulation/states/index.d.ts +5 -0
- package/dist/core/simulation/types.d.ts +1 -1
- package/dist/core/topology/Component.d.ts +2 -1
- package/dist/core/topology/types.d.ts +19 -5
- package/dist/{core-Bjta9Y7_.js → core-b6Q8w2sn.js} +1505 -652
- package/dist/core-b6Q8w2sn.js.map +1 -0
- package/dist/i18n/index.d.ts +882 -0
- package/dist/i18n/locales/en.json.d.ts +268 -0
- package/dist/i18n/locales/fr.json.d.ts +268 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +137 -120
- package/dist/scene/CircuitEngine.d.ts +13 -0
- package/dist/scene/index.d.ts +1 -1
- package/dist/scene/index.js +50 -45
- package/dist/scene/setup.d.ts +8 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +6 -0
- package/dist/scene/shared/components/arithmetic/AdderVisualFactory.d.ts +54 -0
- package/dist/scene/shared/components/arithmetic/EightBitAdderVisualFactory.d.ts +45 -0
- package/dist/scene/shared/components/arithmetic/EightBitOnesComplementVisualFactory.d.ts +63 -0
- package/dist/scene/shared/components/arithmetic/HalfAdderVisualFactory.d.ts +55 -0
- package/dist/scene/shared/components/arithmetic/index.d.ts +4 -0
- package/dist/scene/shared/components/index.d.ts +4 -0
- package/dist/scene/shared/types.d.ts +0 -2
- package/dist/scene/shared/utils/GeometryUtils.d.ts +76 -0
- package/dist/scene/static/CircuitController.d.ts +1 -0
- package/dist/scene/static/PinTooltipWidget.d.ts +5 -0
- package/dist/scene/static/tools/BuildTool.d.ts +4 -0
- package/dist/scene/static/tools/ComponentPickerWidget.d.ts +7 -0
- package/dist/scene/static/tools/ConfigPanelWidget.d.ts +14 -0
- package/dist/{scene-CVsDdySt.js → scene-D4QcWeiq.js} +2487 -1099
- package/dist/scene-D4QcWeiq.js.map +1 -0
- package/package.json +14 -9
- package/dist/core-Bjta9Y7_.js.map +0 -1
- package/dist/scene-CVsDdySt.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,122 +1,139 @@
|
|
|
1
|
-
import { $ as t, A as s, B as
|
|
2
|
-
import { A as
|
|
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";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
y as
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
la as
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
4
|
+
Q as ALL_LOGIC_FAMILIES,
|
|
5
|
+
Fa as AdderBehavior,
|
|
6
|
+
E as AdderState,
|
|
7
|
+
dt as AdderVisualFactory,
|
|
8
|
+
B as ArithmeticState,
|
|
9
|
+
Ha as BRANCHING_POINT_SENTINEL,
|
|
10
|
+
ta as BatteryBehavior,
|
|
11
|
+
z as BatteryState,
|
|
12
|
+
Pa as BatteryVisualFactory,
|
|
13
|
+
aa as BehaviorRegistry,
|
|
14
|
+
Za as BranchingPointVisualFactory,
|
|
15
|
+
gt as BuildTool,
|
|
16
|
+
J as CIRCUIT_FILE_VERSION,
|
|
17
|
+
Oa as CMP_MATERIALS,
|
|
18
|
+
P as COMPONENT_TYPE_METADATA,
|
|
19
|
+
l as CameraOptions,
|
|
20
|
+
ua as Circuit,
|
|
21
|
+
ka as CircuitController,
|
|
22
|
+
ja as CircuitEngine,
|
|
23
|
+
Ga as CircuitMetadata,
|
|
24
|
+
W as CircuitOptions,
|
|
25
|
+
Z as CircuitRunner,
|
|
26
|
+
fa as CircuitRunnerController,
|
|
27
|
+
$a as CircuitWriter,
|
|
28
|
+
V as ClockBehavior,
|
|
29
|
+
ya as ClockState,
|
|
30
|
+
vt as ClockVisualFactory,
|
|
31
|
+
ht as CmpMatCategory,
|
|
32
|
+
Wa as CmpMatType,
|
|
33
|
+
za as CmpMatVariant,
|
|
34
|
+
j as Component,
|
|
35
|
+
tt as ComponentPickerWidget,
|
|
36
|
+
ga as ComponentState,
|
|
37
|
+
Na as ComponentType,
|
|
38
|
+
Ia as DEFAULT_LOGIC_FAMILY,
|
|
39
|
+
Ya as DefaultVisualFactory,
|
|
40
|
+
ca as DirtyTracker,
|
|
41
|
+
i as DoubleThrowSwitchBehavior,
|
|
42
|
+
C as DoubleThrowSwitchState,
|
|
43
|
+
At as DoubleThrowSwitchVisualFactory,
|
|
44
|
+
oa as ENode,
|
|
45
|
+
k as ENodeSourceType,
|
|
46
|
+
Aa as ENodeType,
|
|
47
|
+
sa as EightBitAdderBehavior,
|
|
48
|
+
g as EightBitAdderState,
|
|
49
|
+
rt as EightBitAdderVisualFactory,
|
|
50
|
+
H as EightBitOnesComplementBehavior,
|
|
51
|
+
p as EightBitOnesComplementState,
|
|
52
|
+
St as EightBitOnesComplementVisualFactory,
|
|
53
|
+
ma as EventQueue,
|
|
54
|
+
yt as FactoryRegistry,
|
|
55
|
+
ba as GroupedFactoryRegistry,
|
|
56
|
+
x as HalfAdderBehavior,
|
|
57
|
+
S as HalfAdderState,
|
|
58
|
+
Gt as HalfAdderVisualFactory,
|
|
59
|
+
Qa as HitboxLayers,
|
|
60
|
+
Xa as HoverManager,
|
|
61
|
+
Ta as InverterBehavior,
|
|
62
|
+
m as InverterState,
|
|
63
|
+
st as InverterVisualFactory,
|
|
64
|
+
Ka as LabelVisualFactory,
|
|
65
|
+
F as LightbulbBehavior,
|
|
66
|
+
t as LightbulbState,
|
|
67
|
+
Vt as LightbulbVisualFactory,
|
|
68
|
+
ea as Memoize,
|
|
69
|
+
s as MemoizeExpiring,
|
|
70
|
+
Ua as MultiSelectTool,
|
|
71
|
+
La as Nand4GateBehavior,
|
|
72
|
+
M as Nand4GateState,
|
|
73
|
+
ut as Nand4GateVisualFactory,
|
|
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
|
|
122
139
|
};
|
|
@@ -102,6 +102,19 @@ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
|
|
|
102
102
|
* Current operating mode
|
|
103
103
|
*/
|
|
104
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;
|
|
105
118
|
/**
|
|
106
119
|
* Switch between edit and simulation modes.
|
|
107
120
|
*
|
package/dist/scene/index.d.ts
CHANGED
|
@@ -40,4 +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';
|
|
43
|
+
export { registerBasicComponentsFactories, registerGatesComponentsFactories, registerArithmeticComponentsFactories } from './setup';
|
package/dist/scene/index.js
CHANGED
|
@@ -1,47 +1,52 @@
|
|
|
1
|
-
import { A as s, B as t, C as r, D as o, E as i, F as e,
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
L as
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
|
47
52
|
};
|
package/dist/scene/setup.d.ts
CHANGED
|
@@ -16,3 +16,11 @@ export declare function registerBasicComponentsFactories(registry: IGroupedFacto
|
|
|
16
16
|
* @returns The input registry for chaining
|
|
17
17
|
*/
|
|
18
18
|
export declare function registerGatesComponentsFactories(registry: IGroupedFactoryRegistry): IGroupedFactoryRegistry;
|
|
19
|
+
/**
|
|
20
|
+
* Register all arithmetic components visual factories in the arithmetic group
|
|
21
|
+
* Arithmetic components are : HalfAdder
|
|
22
|
+
* @public
|
|
23
|
+
* @param registry - A grouped factory registry to populate
|
|
24
|
+
* @returns The input registry for chaining
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerArithmeticComponentsFactories(registry: IGroupedFactoryRegistry): IGroupedFactoryRegistry;
|
|
@@ -129,6 +129,12 @@ export declare abstract class AbstractCircuitController extends EventEmitter<Con
|
|
|
129
129
|
* Get the current circuit being visualized
|
|
130
130
|
*/
|
|
131
131
|
getCircuit(): Circuit | null;
|
|
132
|
+
/**
|
|
133
|
+
* Refresh any user-visible strings in owned widgets after the consumer has
|
|
134
|
+
* switched i18next to a new language. Default is a no-op for controllers
|
|
135
|
+
* that own no translated widgets.
|
|
136
|
+
*/
|
|
137
|
+
setLanguage(_lng: string): void;
|
|
132
138
|
protected abstract onSetCircuit(): void;
|
|
133
139
|
/**
|
|
134
140
|
* Loads a new circuit to visualize or null for clearing the scene
|
|
@@ -0,0 +1,54 @@
|
|
|
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 Adder components.
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - An `envelope` rectangular frame (EmptyRectangleGeometry)
|
|
10
|
+
* - A horizontal `separator` box dividing upper/lower chambers
|
|
11
|
+
* - A `sumFiller` (RectangleWithNailGeometry) in the upper chamber;
|
|
12
|
+
* its material is animated blue↔red following the sum output state
|
|
13
|
+
* - A `plus` box inside the sumFiller (visual cue)
|
|
14
|
+
* - A `carryFiller` (RectangleWithNailGeometry) box in the lower chamber; its material is animated
|
|
15
|
+
* blue↔red following the carry output state
|
|
16
|
+
* - pin groups for vcc, inputA, inputB, sum, carry, gnd
|
|
17
|
+
*
|
|
18
|
+
* Animation:
|
|
19
|
+
* - sumFiller ↔ blue/red based on sum output (current/next state)
|
|
20
|
+
* - carryFiller ↔ blue/red based on carry output (current/next state)
|
|
21
|
+
*/
|
|
22
|
+
export declare class AdderVisualFactory extends ComponentVisualFactoryBase {
|
|
23
|
+
private readonly ENVELOPE_GEOM;
|
|
24
|
+
/** Horizontal separator splitting upper/lower chambers at Z=0 */
|
|
25
|
+
private readonly SEPARATOR_GEOM;
|
|
26
|
+
private readonly SEPARATOR_SIDE_GEOM;
|
|
27
|
+
private readonly CELL_FILLER_GEOM;
|
|
28
|
+
/** Small box inside sumFiller (visual cue for the XOR "+") */
|
|
29
|
+
private readonly PLUS_GEOM;
|
|
30
|
+
protected readonly FILLER_COLOR_HIGH: THREE.Color;
|
|
31
|
+
protected readonly FILLER_COLOR_LOW: THREE.Color;
|
|
32
|
+
protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
|
|
33
|
+
protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
|
|
34
|
+
constructor();
|
|
35
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
36
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
37
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
38
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
39
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
40
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
41
|
+
private _setFillerColor;
|
|
42
|
+
private _ensureClonedFillerMaterial;
|
|
43
|
+
private _restoreSharedFillerMaterial;
|
|
44
|
+
private _cleanupMixer;
|
|
45
|
+
/**
|
|
46
|
+
* Animate sumFiller and carryFiller fill colors over the transition span.
|
|
47
|
+
* Builds a single AnimationClip with up to two target tracks per filler
|
|
48
|
+
* (color, emissive, emissiveIntensity) — only for fillers whose value changes.
|
|
49
|
+
*/
|
|
50
|
+
private _animateFillers;
|
|
51
|
+
private _pushFillerTracks;
|
|
52
|
+
/** Find a child mesh by its userData.part name */
|
|
53
|
+
protected findPartMesh(object3D: THREE.Object3D, part: string): THREE.Mesh | null;
|
|
54
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 EightBitAdder components.
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - An `envelope` frame (KuKoGeometry)
|
|
10
|
+
* - A vertical `separator` dividing carry/sum cells
|
|
11
|
+
* - 7 horizontal separators dividing ith cells
|
|
12
|
+
* - 16 cells carry i / sum i representing state
|
|
13
|
+
* cells materials are animated blue↔red following the component state
|
|
14
|
+
* - pin groups for vcc, 2*8 inputs, 8*sums, carryIn, carryOut and gnd
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare class EightBitAdderVisualFactory extends ComponentVisualFactoryBase {
|
|
18
|
+
private readonly ENVELOPE_GEOM;
|
|
19
|
+
private readonly VERTICAL_SEPARATOR_GEOM;
|
|
20
|
+
private readonly HORIZONTAL_SEPARATOR_GEOM;
|
|
21
|
+
private readonly CELL_FILLER_GEOM;
|
|
22
|
+
protected readonly FILLER_COLOR_HIGH: THREE.Color;
|
|
23
|
+
protected readonly FILLER_COLOR_LOW: THREE.Color;
|
|
24
|
+
protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
|
|
25
|
+
protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
|
|
26
|
+
constructor();
|
|
27
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
28
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
29
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
30
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
31
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
32
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
33
|
+
private _setCellColor;
|
|
34
|
+
private _ensureClonedMaterial;
|
|
35
|
+
private _restoreSharedMaterial;
|
|
36
|
+
private _cleanupMixer;
|
|
37
|
+
/** Collect all 16 cell meshes with their state bit position. */
|
|
38
|
+
private _findCellMeshes;
|
|
39
|
+
/**
|
|
40
|
+
* Animate the 16 cells over the transition span.
|
|
41
|
+
* Builds a single AnimationClip with tracks only for cells whose bit changes.
|
|
42
|
+
*/
|
|
43
|
+
private _animateCells;
|
|
44
|
+
private _pushCellTracks;
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 EightBitOnesComplement components.
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - An `envelope` frame (EmptyRectangleGeometry)
|
|
10
|
+
* - A vertical `separator` dividing flag area / outputs cells
|
|
11
|
+
* - 7 horizontal separators dividing ith cells
|
|
12
|
+
* - 2 rectangles with nail filler, 3 animated box geometry and 2 filler boxes for flag area
|
|
13
|
+
* - 8 cells outputs i representing output state
|
|
14
|
+
* cells materials are animated blue↔red following the component state
|
|
15
|
+
* - pin groups for vcc, 8 inputs, 8*outputs and gnd
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare class EightBitOnesComplementVisualFactory extends ComponentVisualFactoryBase {
|
|
19
|
+
private readonly ENVELOPE_GEOM;
|
|
20
|
+
private readonly VERTICAL_SEPARATOR_GEOM;
|
|
21
|
+
private readonly HORIZONTAL_SEPARATOR_GEOM;
|
|
22
|
+
private readonly CELL_FILLER_GEOM;
|
|
23
|
+
private readonly INDICATOR_MINUS_GEOM;
|
|
24
|
+
private readonly INDICATOR_PLUS_GEOM;
|
|
25
|
+
private readonly INDICATOR_FILLER_GEOM;
|
|
26
|
+
protected readonly FILLER_COLOR_HIGH: THREE.Color;
|
|
27
|
+
protected readonly FILLER_COLOR_LOW: THREE.Color;
|
|
28
|
+
protected readonly FILLER_COLOR_NEUTRAL: THREE.Color;
|
|
29
|
+
protected readonly FILLER_EMISSIVE_BLACK: THREE.Color;
|
|
30
|
+
protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
|
|
31
|
+
protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
|
|
32
|
+
protected readonly FILLER_EMISSIVE_NEUTRAL_INTENSITY = 0;
|
|
33
|
+
constructor();
|
|
34
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
35
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
36
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
37
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
38
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
39
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the target color state for a cell given its kind and the bit value:
|
|
42
|
+
* - `output`: high→red, low→blue
|
|
43
|
+
* - `minus`: high→blue, low→red (inverted vs output — blue minus = complement active)
|
|
44
|
+
* - `plus`: high→white (blends with envelope, hiding the +), low→red
|
|
45
|
+
*/
|
|
46
|
+
private _cellTarget;
|
|
47
|
+
private _setCellColor;
|
|
48
|
+
private _ensureClonedMaterial;
|
|
49
|
+
private _restoreSharedMaterial;
|
|
50
|
+
private _cleanupMixer;
|
|
51
|
+
/**
|
|
52
|
+
* Collect all animated cells (8 outputs + minus + 2 plus parts).
|
|
53
|
+
* Output cells read bits 0–7; the three indicator cells all read bit 8
|
|
54
|
+
* (the invert flag) but render it with different color rules.
|
|
55
|
+
*/
|
|
56
|
+
private _findCellMeshes;
|
|
57
|
+
/**
|
|
58
|
+
* Animate all cells over the transition span.
|
|
59
|
+
* Builds a single AnimationClip with tracks only for cells whose bit changes.
|
|
60
|
+
*/
|
|
61
|
+
private _animateCells;
|
|
62
|
+
private _pushCellTracks;
|
|
63
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 Half Adder components.
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - An `envelope` rectangular frame (EmptyRectangleGeometry)
|
|
10
|
+
* - A horizontal `separator` box dividing upper/lower chambers
|
|
11
|
+
* - A `sumFiller` (RectangleWithNailGeometry) in the upper chamber;
|
|
12
|
+
* its material is animated blue↔red following the sum output state
|
|
13
|
+
* - A `halfPlus` small box inside the sumFiller (visual cue)
|
|
14
|
+
* - A `carryFiller` box in the lower chamber; its material is animated
|
|
15
|
+
* blue↔red following the carry output state
|
|
16
|
+
* - pin groups for vcc, inputA, inputB, sum, carry, gnd
|
|
17
|
+
*
|
|
18
|
+
* Animation:
|
|
19
|
+
* - sumFiller ↔ blue/red based on sum output (current/next state)
|
|
20
|
+
* - carryFiller ↔ blue/red based on carry output (current/next state)
|
|
21
|
+
*/
|
|
22
|
+
export declare class HalfAdderVisualFactory extends ComponentVisualFactoryBase {
|
|
23
|
+
private readonly ENVELOPE_GEOM;
|
|
24
|
+
/** Horizontal separator splitting upper/lower chambers at Z=0 */
|
|
25
|
+
private readonly SEPARATOR_GEOM;
|
|
26
|
+
private readonly SEPARATOR_SIDE_GEOM;
|
|
27
|
+
private readonly SUM_FILLER_GEOM;
|
|
28
|
+
/** Small box inside sumFiller (visual cue for the XOR "+") */
|
|
29
|
+
private readonly HALF_PLUS_GEOM;
|
|
30
|
+
private readonly CARRY_FILLER_GEOM;
|
|
31
|
+
protected readonly FILLER_COLOR_HIGH: THREE.Color;
|
|
32
|
+
protected readonly FILLER_COLOR_LOW: THREE.Color;
|
|
33
|
+
protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
|
|
34
|
+
protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
|
|
35
|
+
constructor();
|
|
36
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
37
|
+
protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
|
|
38
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
39
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
40
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
41
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
42
|
+
private _setFillerColor;
|
|
43
|
+
private _ensureClonedFillerMaterial;
|
|
44
|
+
private _restoreSharedFillerMaterial;
|
|
45
|
+
private _cleanupMixer;
|
|
46
|
+
/**
|
|
47
|
+
* Animate sumFiller and carryFiller fill colors over the transition span.
|
|
48
|
+
* Builds a single AnimationClip with up to two target tracks per filler
|
|
49
|
+
* (color, emissive, emissiveIntensity) — only for fillers whose value changes.
|
|
50
|
+
*/
|
|
51
|
+
private _animateFillers;
|
|
52
|
+
private _pushFillerTracks;
|
|
53
|
+
/** Find a child mesh by its userData.part name */
|
|
54
|
+
protected findPartMesh(object3D: THREE.Object3D, part: string): THREE.Mesh | null;
|
|
55
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AdderVisualFactory } from './AdderVisualFactory';
|
|
2
|
+
export { HalfAdderVisualFactory } from './HalfAdderVisualFactory';
|
|
3
|
+
export { EightBitAdderVisualFactory } from './EightBitAdderVisualFactory';
|
|
4
|
+
export { EightBitOnesComplementVisualFactory } from './EightBitOnesComplementVisualFactory';
|