A modern AC/DC power supply, one for a laptop as a comment suggests, has 2 switching converter stages.
The first stage is a boost converter. The output of the boost converter is 400 VDC or greater so that at European high line the boost output is still above peak to peak line and hence above full-wave rectified line.
The boost converter makes its 400 V output from the rectified AC input. Note this is not rectified and filtered to DC plus ripple with a capacitor. The boost stage provides power factor correction (PFC) as well so it must see the AC line voltage waveform. PFC means that current drawn from line is approximately sinusoidal and in phase with line voltage.
When presented with 120 VAC, the boost stage draws more current to deliver the same output power. Ripple on the boost output will correspond to 60 Hz rather than 50 Hz line but otherwise variation in the line voltage is handled by the boost converter.
After the boost converter is some type of isolated converter. Lower power supplies will use a flyback because it requires fewer components. Flyback converters are not practical above a few 100 W because all the transferred energy must be stored in the transformer core. Higher power designs use forward converter topologies, resonant topologies, ect. These can be very interesting.
Another complication is that all products that interact with AC line need to be certified to safety, EMC, and other standards appropriate to the country where they are sold. Buying a AC/DC converter shifts this complexity and cost onto the supplier.
Unless you want to get into the complicated world of AC/DC conversion, I suggest you purchase an appropriate supply. Either:
- Buy an AC/DC converter with the maximum voltage and power you need a design a charging stage after it.
- Buy an appropriate AC/DC battery charger.
- Buy some modules (at least the AC/DC module) and add your own circuitry.
- Your design is so low power (less than 0.5 W) that something like directly regulating the output of AC coupled line is reasonable.
For the second option, I think you will find that products exist to meet your need. Search "Programmable battery charger" for example.
If you are trying to find out how these things work, take the cover off of a laptop power adapter you no longer need. Study its construction (not plugged in). Please do not plug it into AC line once you have taken it apart. High voltages and significant energy is exposed. The heat sinks, among other things, are likely live.