It can be done with three relays and two diodes. (Well, six relays and four diodes; you need left and right modules.) You have a relay to control power to the mirror and a relay for each of turn signal and running lights; each relay's control is 'cross-fed' from the other. The TS and RL relays each have a diode on the SRC lead to prevent unexpected operation of the turn signal and running lights.
Relay one:
NO
SRC: switched B+
LOAD: mirror lights
CTL: relay #2 LOAD and relay #3 LOAD
Relay two (RL control):
NC
SRC: diode to prevent backfeed to RL and relay #3 CTL, and diode connected to RL
LOAD: relay #1 CTL
CTL: TS
Relay three (TS control):
NC
SRC: diode to prevent backfeed to TS and to relay #2 CTL, and diode connected to TS
LOAD: relay #1 CTL
CTL: RL
Relay #2 SRC has a diode to prevent backfeed from TS through relay #2 to RL and to relay #2 CTL. Relay #3 SRC has a diode to prevent backfeed from RL through relay #3 to TS and to relay #2 CTL. Wthout the relay #3 diode, the (respective) turn signal would illuminate and the mirror lights flash rapidly (as fast as the relay can operate) when RL is turned on. Wthout the relay #2 diode, the running lights would illuminate and the mirror lights flash rapidly (as fast as the relay can operate) when TS is turned on. (Picture the toy that, when you press the button to open it, a finger comes out and pushes the button to close it.)
If I correctly puzzled my way through this:
If RL and TS are off, relay #1 is open and no mirror lights.
If RL is off, TS feeds through relay #3 to operate relay #1 (mirror lights): OFF opens and ON closes relay #1, thus running the mirror lights in sync with the turn signals. TS also opens and closes relay #2 which has no effect because RL is off.
If RL is on, it is fed through relay #2 to relay #1 control, turning the mirror lights on. RL is also fed to relay #3 control, opening that relay and preventing TS from reaching relay #1 CTL. In this case, TS ON opens and OFF closes relay #2, thus running the mirror lights opposite the turn signals.
Were you to build these as modules, each would have five leads:
SRC (from switched B+)
LOAD (to mirror)
TS (from the respective left or right turn signal)
RL (from the running lights)
G (to chassis/B-)
Glossary:
CTL: relay control input
G: chassis/B-
LOAD: relay out
NC: normally closed
NO: normally open
RL: running lights
SRC: relay in
TS: turn signal
The relay control output lead is always connected to - (negative).
It would be cool to build as you described and have a plug and play setup that anyone could use, but the trailer light adapter has been working well and it was way real easy for someone like me to figure out haha