paulopes / panel-components

HTML components for Panel templates
Apache License 2.0
6 stars 1 forks source link

Enable adding module scripts #4

Open MarcSkovMadsen opened 4 years ago

MarcSkovMadsen commented 4 years ago

If I wan't to use Fast with panel-components I need to import a module in the head. As far as I can see this is not possible.

<script type="module" src="https://unpkg.com/@microsoft/fast-components"></script>

A lot of .js libraries that I integrate with or would like to integrate with requires module imports.

paulopes commented 4 years ago

Hi Marc,

I’ll try to respond to some of your comments, questions, and contributions, which I appreciate, but I am simply unable to find time to address them all. Regarding this question, it is possible to import a JavaScript module in the page’s head section, but only when the notebook is being served via the panel CLI command, given that Jupyter has already rendered the head when the our notebook is being displayed in Jupyter Lab. To include a script in the head you can use the .append_head_no_nb_js() method. There is an equivalent method for doing that for a CSS file.

MarcSkovMadsen commented 4 years ago

Thanks. But the issue here is that the script needs the attribute type set to module.

paulopes commented 4 years ago

Ah, I had missed that detail. I see.

I've added an append_head_no_nb_module method. It should do what you need. Please let me know.

Thank you for all the pull requests. I've merged all of them.

I realize that there is a lot more work to do, to document, test, improve in so many ways. I'll try to find some time to work on those things.

I hope you didn't think that I was being rude by not replying to you these last few days. You see, I am extremely busy at my full-time job. I have to prioritize that, especially this month as we have important business goals to meet.

MarcSkovMadsen commented 4 years ago

No. Problem.

The only thing i that i really have problems understanding is if bidirectional communication is really possible and how. An example with a button or checkbox would be really appreciated.

Like for example adding bidirectional communication to the fast example.