portal

djblue 2023-08-04T06:13:05.482999Z

Would people be interested in a Portal development / internals talk? If so, any specific topics?

👍 10
👍🏻 2
👎 1
djblue 2023-09-09T20:59:18.503219Z

Do you have any links I can use to see how the integration was done to achieve this? I want to make sure I keep things working as I fix issues with that branch.

Daniel Slutsky 2023-09-10T02:43:48.087299Z

Thanks! Haven't pushed it yet. I'll write an example, hopefully today.

Daniel Slutsky 2023-08-04T11:18:08.347499Z

That would be fantastic. 💜 Two topics that would be lovely to hear about: • creating new viewers with cljs or js dependencies ◦ (maybe demonstrated through what https://github.com/mentat-collective/emmy-viewers/ does?) • creating extensions (embedding portal in other pieces of tooling) ◦ e.g., is there a recommended way to embed a (standalone) portal viewer in a blog post?

☝️ 1
1
djblue 2023-09-17T02:35:16.609519Z

I got around to merging the required changes to get the scittle example working https://github.com/djblue/portal/commit/5f8d51a435f4be4e8e146d700622c2f95f4e031a. The api is located in a different place but is the same. I update the example to use the new api.

djblue 2023-09-17T02:39:56.768719Z

Also, updated the standalone js bundle deployed at https://djblue.github.io/portal/main.js to also provide this api 👍

djblue 2023-09-17T02:43:00.522039Z

If you pull from the standalone version, you can't lock to a specific version. I could see deploying <version>/main.js if this is useful 🤔

djblue 2023-09-17T02:49:36.186489Z

Also, it might be kinda cool if loading the bundle.js, registered a scittle namespace kinda like reagent 🤔

djblue 2023-09-17T02:51:33.954799Z

Although, because these are two different shadow-cljs builds, the code probably can't interop very well since each have their own version of cljs.

Daniel Slutsky 2023-09-17T04:54:19.780399Z

Great! I'll use it soon. 🙏 The current use case (embedding Portal views in a notebook/blogpost/book) will not require interop. It will even be simpler than the Scittle-based example I shared earlier. As @timothypratley pointed out to me, the simplest thing to do would be to just use Portal from a Javascript snippet with the Clojure value converted to JSON. One practical question, I guess, will be how to set up custom Portal viewers (like the https://github.com/mentat-collective/emmy-viewers collection).

djblue 2023-09-17T05:01:47.298339Z

Good to know 👍 I think there will be a couple of different problems getting emmy-viewers setup in this type of environment. The first couple that come to mind are npm dependencies and loading the cljs for the viewer. Also, I'm not sure how the clj bits of emmy interact with the cljs bits.

👍 1
Daniel Slutsky 2023-09-10T19:51:59.911069Z

BTW the image above demonstrates wrong behaviour, due to a mistake of mine. Instead of passing {:x (0 1 2)} to portal, I am transforming it internally to something else, and that is why it is displayed that way.

Daniel Slutsky 2023-09-10T20:06:45.363899Z

@djblue here is a small example demonstrating the use of embedded portal (similar to what I'm hoping to use in Clay & Quarto): This commit includes two files: • example.html - an HTML document calling Portal using #scittlesrc/examples/scittle.clj - a Clojure namespace to generate that document. https://github.com/daslu/portal/commit/e127f9a83ec95b51a9bdc2923670eb40994fce45

djblue 2023-08-18T03:46:04.534869Z

@daslu I have some https://github.com/djblue/portal/compare/master...clerk-vs-code-notebook stuff I made for clerk. Would love to collaborate to see if the API's make sense for embedding in other contexts, such as blog posts or https://github.com/scicloj/kind-portal.

Daniel Slutsky 2023-08-18T05:14:56.776569Z

Ohh wonderful! I'll look 🙏

❤️ 1
Daniel Slutsky 2023-08-21T21:03:26.421839Z

cc @timothypratley

Daniel Slutsky 2023-09-08T13:39:47.868439Z

@djblue I finally tried the approach above (by building the clerk-vs-code-notebook branch locally). Really nice!! The image below shows a couple of code examples rendered through https://scicloj.github.io/clay/ + https://quarto.org/. This means we can have Portal viewers in our notebooks, docs, books, blog posts, etc. cc @kiraemclean @timothypratley Are you planning to merge clerk-vs-code-notebook ? (it is not a pressing for me, just curious about the plans)

djblue 2023-09-08T17:01:16.082069Z

I think I still had some issues I needed to work through, but I do intend to merge it 👍

🙏 1
djblue 2023-09-19T03:58:07.472839Z

Ok, js/portal_api is now available with the https://github.com/djblue/portal/releases/tag/0.48.0 release.

👍 1