Ugh, please no. Please don't paint UI-elements via JS, if you're not forced to. It makes for a poor experience for most users, not to mention accessibility.
What are you considering as "paint[ing] UI-elements" in this context? I don't see anything I would describe as "painting" in the code snippets ay those links.
I spent a lot of time early in my career working on some UI component libraries that I ultimately deemed a failure. However, I learned a lot from that. I’ve found that as I’ve settled into a more senior dev role, it’s become harder for me to experiment.
What I’m trying to say is that best case, you come up with something cool, and worst case, you learn from your mistakes and apply what you learned to the next project!