I created a prototype npm package that displays a popup for selected text on a website.

npm

Source code

Demo page

The following article was used as a reference for development.

You can try it by adding the following two lines to your website.

<script src="https://cdn.jsdelivr.net/npm/@nakamura196/text-popup/dist/main.min.js"></script>
<script>textPopup();</script>

I hope this is helpful as a reference for developing and publishing npm libraries.