Design an AC/DC Nonisolated Switching Mode Power Supply
It seems to me that you are against using a transformer because you believe it might be too large or need hand-winding yourself. The impact of this decision is: -


Non-isolated output voltage (potentially unsafe)
Problems finding a buck converter chip that will operate at over 300 volts DC


Let me try and put your mind at rest with this off-the-shelf design supported by Premier Magnetics: -



This is just one of dozens of designs that they make (and sell) the transformers for. The one above happens to produce 5 volts out at up to 0.6 amps. The transformer is here: -



It measures about 17mm x 16mm so it isn't massive and it gives you peace of mind. On page 2 of this document you get the full list of the transformers they sell.


  For the previous designs I was using the HLK-PM01 PSU, but that's
  wasting a lot of space.


That device appears to be about 30mm x 20mm so the above circuit should compare favourably.