Tiny 240/120V AC power supply for logic device

Has anyone seen or heard of an onboard switch-mode power supply circuit that could supply 5v at around 50mA? I have a lot of projects in mind that could benefit from a very small and very cheap mains power supply incorporated into the board. This would eliminate the need to run low voltage wiring in distributed control systems. For example home automation where you want to mount a XBee chip in behind a light switch. The problem is always the power supply to run the logic device. Something to run the logic device and a optocoupler or two would only need around 50mA. Does anyone with experience in switch-mode power supplies have any thoughts on this?

Yes, Mouser.com carries such animals.
example:
3.3V for xbee
http://www.mouser.com/ProductDetail/RECOM-Power/RAC01-33SC/?qs=sGAEpiMZZMsuBfEaN9EhVc2YZ4jw9niG
5V for 'regular' logic
http://www.mouser.com/ProductDetail/RECOM-Power/RAC01-05SC/?qs=sGAEpiMZZMsuBfEaN9EhVVuZwUusrdb%2F

The approach used here might be cheaper, but is definitely more fussy and I would guess that 50mA would be at the high end of what it could supply. It's also as dangerous as hell to work on. Have a look at the last diagram and surrounding discussion on this page:
http://www.mhennessy2.f9.co.uk/gainclone/control.htm

Wow, talk about interfacing to the national grid!, thats one circuit Ill never use! XD

Thanks Gardner for the circuit. This is exactly the kind of thing i am looking for.
Also thanks Crossroads, the mouser parts are probably easier for prototyping. Think I'm going to get a few of them!
C'mon Lakes! Try it sometime! A 240v whack is usually always your own fault. Only in very rare cases does it stop your heart XD