portal

rschmukler 2023-03-13T16:24:15.052659Z

Is there any way to specify initial render depth with metadata on an item?

👀 1
djblue 2023-03-13T19:38:23.891499Z

Not currently, although this question does come up from time to time. What expectations would you have if portal supported that metadata? Portal does have the ability to https://github.com/djblue/portal/blob/master/src/portal/ui/theme.cljs#L19 but it isn't exposed to users yet.

djblue 2023-03-13T19:42:00.984459Z

Another option that has been mentioned previously is allowing toggle expand recursively

rschmukler 2023-03-13T20:33:41.539769Z

I would love to see an option to either pass in the max depth (like you pass in the theme) option to p/open or be able to pass it as metadata (eg. The depth it will render the items children to)

rschmukler 2023-03-14T00:47:28.654569Z

re. toggle expand universally, that would be nice but I think the metadata is much more powerful (as I personally have my own helper functions for things like rendering to tables, etc) - the toggle means interfacing with the UI (unless portal exposes it via the library) while the metadata means my functions can just do it automatically.

djblue 2023-03-14T01:03:16.438839Z

Supporting render depth via metadata first works for me, what are you thinking it would look like? Currently, here is some of the metadata portal understand:

{:portal.viewer/table {:columns [:a :b :c]}
 :portal.viewer/for
 {:code :portal.viewer/code
  :time :portal.viewer/relative-time}
 :portal.viewer/code {:language :clojure}}

djblue 2023-03-14T01:03:53.267339Z

The config has been per viewer, but this one feels more universal 🤔

rschmukler 2023-03-14T01:04:02.712779Z

{:portal.viewer/max-depth 5}

🤔 1
djblue 2023-03-14T01:04:20.248359Z

Maybe

{:portal.viewer/inspector {:max-depth 5}}

rschmukler 2023-03-14T01:04:42.258009Z

I would consider not limiting to the inspector since the table and tree also can have depth, right?

djblue 2023-03-14T01:05:07.056669Z

Kinda, in that they recurse via the inspector

djblue 2023-03-14T01:06:25.386639Z

We could also go a little crazy and do:

{:portal.viewer/theme {:max-depth 5}}

djblue 2023-03-14T01:06:46.614889Z

This would open the door to configure the entire subtree differently

rschmukler 2023-03-14T01:06:47.597909Z

I saw (via github code search) that it was theme based, but to me that seems a bit like an implementation detail

rschmukler 2023-03-14T01:06:55.681499Z

That's interesting

djblue 2023-03-14T01:07:01.701969Z

True

rschmukler 2023-03-14T01:07:03.615909Z

I don't have too much opinion on it, to be honest

djblue 2023-03-14T01:07:26.938419Z

That's fair, but what are the other things you might want to be able to drive?

djblue 2023-03-14T01:08:07.450119Z

I think :portal.viewer/options might be a little less theme specific

djblue 2023-03-14T01:08:25.054959Z

Like pass these options to the current viewer and every viewer is usually wrapped via the inspector

rschmukler 2023-03-14T01:08:35.228869Z

The reason I lean toward root is just that I think of the nested maps as config for the individual inspectors. As a new user, if you don't know that a sub-inspector recursively invokes a new instance of the :portal.viewer/inspector then you might think that the config only applies to the :portal.viewer/inspector and not things like tables, etc

👍 1
rschmukler 2023-03-14T01:09:10.156199Z

:portal.viewer/options is good - I would consider whether things could be consolidated a bit into there

🤔 1
rschmukler 2023-03-14T01:09:44.791649Z

ie. right now you need to know multiple different namespaced keywords, as well as the un-namespaced keys that go into those maps to be able to configure things

rschmukler 2023-03-14T01:10:09.147089Z

{:portal.viewer/options
  {:portal.viewer.table/columns [:a :b :c]}}

rschmukler 2023-03-14T01:10:26.173819Z

I'm not suggesting its worth having a breaking change, just that there's a lot to unpack right now as a new user looking for this stuff

rschmukler 2023-03-14T01:11:22.467279Z

I'm also not sure that having nested maps is better than just having further namespaced keywords on the root-metadata... after all that seems the point of namespaced keywords

👍 1
djblue 2023-03-14T01:12:51.625839Z

True, although I like being able to specify different options for different viewers independently

rschmukler 2023-03-14T01:12:52.595619Z

Again, no real strong opinions here. I think solid documentation can allow for any decision

rschmukler 2023-03-14T01:13:09.483769Z

Yeah that's very true

djblue 2023-03-14T01:13:52.428389Z

That's kinda why things are {viewer options-map ...} although the :portal.viewer/for broke that a little

djblue 2023-03-14T01:14:00.121839Z

Now we can't have a for viewer be configurable lol

rschmukler 2023-03-14T01:14:06.581759Z

😄

rschmukler 2023-03-14T01:14:31.485949Z

You could do

rschmukler 2023-03-14T01:14:34.988099Z

:portal/for

rschmukler 2023-03-14T01:14:46.995019Z

and leave :portal.viewer reserved for viewers

🤔 1
rschmukler 2023-03-14T01:14:55.783489Z

Same then for :portal/options

djblue 2023-03-14T01:16:51.348459Z

Okay, I'll play with some of these. Thanks for the help 🙏

rschmukler 2023-03-14T01:17:37.867089Z

Thank you for the responses and the consideration 🙏 . Portal has become a daily tool for me. The clojure.core.protocols/nav integration is chef_kiss

❤️ 1