Repeater field in Customizer

I’d like to develop a setting/control for Customizer that allows dynamically to add fields. The typical example would be the possibility to add an unlimited number of slides to an slider in a Theme. There would be a button in the Customizer setting called “Add new slide” that allows to add a new slide field.

For the sake of the responses, let’s make it easy: Just a text field per row. So each time we click on a “Add new row” button, a new text field is generated.

I’ve tried different approaches and my latest one was an attempt to use script templates (Mustache) like this example:

The problem is how to handle dynamically those settings? How to use the WP_Customize_Control to_json function and how to get that Mustache template and duplicate it every time we click on the “Add new” button? I have a very good background on PHP and a medium level on JS so I can understand advanced topics.

Solutions Collecting From Web of "Repeater field in Customizer"