vimeshjs / vimesh-ui

Vimesh UI is an ultra lightweight library to build UI components for Alpine.js
MIT License
125 stars 5 forks source link

Dynamic x-import ? #21

Open bakman2 opened 3 weeks ago

bakman2 commented 3 weeks ago

Would there be a way to make the x-import fully dynamic ? Currently it requires to be predefined. Could vimesh-ui somehow read the defined DOM elements and dynamically import them ? (at least for the default namespace).

I am working on a project where I want to use custom 'components', but I don't want 'the need' for the user to modify the html. If you have like 50 components, it would be a extremely long import string.

bakman2 commented 3 weeks ago

Hmm in your example on unpkg i see you use x-import:dynamic and $vui.import - perhaps these features could be documented here too ?

xinjie-zhang commented 3 weeks ago

I've added the x-import:dynamic help in the README. It is an existing feature, but it is a little different from what you need. A new auto import feature is implemented in the latest version. It is also explained in the README.

$vui.config.autoImport = true
xinjie-zhang commented 3 weeks ago

BTW, thanks for your great proposal. It is reasonable and make Vimesh UI easier to use.