How to programmatically add a custom template that appears in Site Editor from a plugin?

How to programmatically add a custom template that appears in Site Editor from a plugin?