This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-04
Channels
- # announcements (37)
- # babashka (4)
- # beginners (85)
- # calva (12)
- # chlorine-clover (4)
- # cider (20)
- # cljdoc (6)
- # clojure (37)
- # clojure-europe (44)
- # clojure-norway (46)
- # clojurescript (47)
- # conjure (1)
- # cursive (44)
- # datomic (23)
- # docs (2)
- # hyperfiddle (66)
- # introduce-yourself (4)
- # malli (16)
- # off-topic (7)
- # pathom (6)
- # portal (20)
- # re-frame (4)
- # releases (1)
- # shadow-cljs (56)
- # squint (1)
- # xtdb (9)
Would people be interested in a Portal development / internals talk? If so, any specific topics?
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?
@U066L8B18 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.
I think https://github.com/djblue/portal/compare/master...clerk-vs-code-notebook#diff-b69a3fbd7349681d65f08279e7d91dd1006084c636f6b571db9755379ea86325R16-R45is the main integration point 👌
@U1G869VNV 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 @UPGS9BS0L @U06S1EJPL
Are you planning to merge clerk-vs-code-notebook
?
(it is not a pressing for me, just curious about the plans)
I think I still had some issues I needed to work through, but I do intend to merge it 👍
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.
Thanks! Haven't pushed it yet. I'll write an example, hopefully today.
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.
@U1G869VNV 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 #C034FQN490E
• src/examples/scittle.clj
- a Clojure namespace to generate that document.
https://github.com/daslu/portal/commit/e127f9a83ec95b51a9bdc2923670eb40994fce45
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.
Also, updated the standalone js bundle deployed at https://djblue.github.io/portal/main.js to also provide this api 👍
If you pull from the standalone version, you can't lock to a specific version. I could see deploying
if this is useful :thinking_face:
Also, it might be kinda cool if loading the bundle.js, registered a scittle namespace kinda like reagent :thinking_face:
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.
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 @U06S1EJPL 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).
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.
Ok, js/portal_api
is now available with the https://github.com/djblue/portal/releases/tag/0.48.0 release.