An idea.... really must make it in real world within your constraints and see how hot it gets.
So basically you want 3.3v at max 300mA ... or 1w
tiny bridge rectifier to get a peak voltage of 1.414 x Vac ex.. peak of ~ 340v for 240v AC or ~150v DC for 110v AC
could use a single diode and do half wave rectification, but then you may need a bigger input capacitor.
LR8K4 linear regulator: 1.2V to 440V/20 mA out, TO-252AA-3 :
https://uk.farnell.com/microchip/lr8k4-g/linear-volt-reg-0-02a-440v-to/dp/2448524Use this to bring the voltage down to something that a cheap (relatively) and small switching regulator can handle, ex 60v ... 60v x 0.020 A = 1.2w ... you'll need only around 1.1w to get 3.3v @ 300mA with 0.1w for losses.
So the linear regulator needs at least 12v above the output voltage to regulate, so for 60v out, you need 72v min input, let's go with 75v for safety.
You have 60v 0.02A output, and with linear regulators that's also the input current.
So you can estimate the capacitor size required to have a minimum of 75v DC at the input of the regulator.
C = Current / [ 2 x AC freq. x (Vdc peak - Vdc min) ]
For 110v AC ( go with 100v AC to account for variations in grid power) you have 100 x 1.414 = ~ 140v peak DC so
C = 0.02 / [ 2 x 60 Hz x (140 - 75) ] = 0.02 / 120 x 65 = 0.02/7800 = 2.564 uF ... so a 2.7uF or 3.3uF or 4.7uF 250v+ capacitor would be enough
For 230v AC (go with 210v AC to account for variations ) you have 210x1.414 = ~300v DC so
C = 0.02 / [ 2 x 50Hz x (300 - 75) ] = 0.02 / 22500 = ~0.89uF so a 1uF 420v+ would be enough
now you have min 75v DC in, 60v out at 20mA ... you can use a switching regulator to convert 60v to 3.3v
If budget is not an issue, a 9$ (in 1qty) LTC3630 would fit the requirements : chip, inductor, couple ceramic resistors and capacitors and you're good to go. over 80% efficient with 65v in , 3.3v out at 100mA+
Link :
https://www.digikey.com/product-detail/en/linear-technology-analog-devices/LTC3630IMSE-TRPBF/LTC3630IMSE-TRPBFCT-ND/8566932
Something cheaper at 4$ would be LM5166 :
https://www.digikey.com/product-detail/en/texas-instruments/LM5166YDRCR/296-47663-6-ND/8133067As the switching frequency is lower (~200kHz with such high voltage) , you'd need bigger inductor... also a bit less efficient , a bit over 70% efficient at 65v in - > 3.3v out

and others you can easily find with some filters on a distributor like Digikey...
The big issue you're gonna have is HEAT ... the microchip part being a linear regulator, it will throw away the excess as heat.
For example, if you design with an input capacitor big enough to have minimum 75v at 20mA but your product actually consumes much less than 1w, the input capacitor will go up close to your high voltage because it never discharges completely.
Let's say your product uses 150mA at 3.3v (0.33 watts) and these are converted with 80% efficiency by the switching regulator ... that means 0.41 watts were taken from LDO.
0.41w / 60 = 0.006875 A ... let's just round to 7mA
So you may have an average of 120v DC at the input, and 60v on the output ... that means the regulator will dissipate (120v - 60v) x 0.007A = 0.42 watts ... this will raise the temperature of the LDO by around 50 degrees, so the chip will be around 70-80c hot ... datasheet says 80c/w thermal resistance... if placed on pcb with plenty of copper that drops a bit but still...
Still, you'll cook that 1uF..4.7uF electrolytic on the input...
Ideally you really want to decide on a maximum power that's lower, like let's say absolute maximum 200mA at 3.3v