Introducing shadow-cljs Inspect

I do have a few ideas but nothing too certain yet. I know that I want some kind of “table” view. Suppose you have a vector of maps in Clojure. Each map respresents a certain “Entity”, lets use “Product” as an example.

The UI might display this as

[{:product-id 1 :product-name "Foo" ...}
 {:product-id 2 :product-name "Bar" ...}
 ...]

While this is decent for small amounts of data it becomes rather unwieldy quickly (even tens of rows). Given that hash-maps will also have keys in different order the data you are looking for might be hard to find and in different places for each row.

So instead the UI should be able to detect this kind of data and let you select the “columns” you want to see and then display the data in a better format while still allowing you to select specific values in more detail.

Excuse the bad ASCII art you can imagine how a table would look in an actual UI.

| Id | Name          |
----------------------
| 1  | Foo           |
| 2  | Bar           |

Sometimes you’ll want to configure this table ad-hoc in the UI itself. Sometimes it might be better to do this when submitting the value via some metadata or so. Sometimes this may require extra support from the runtime, the whole point of this after all is that this runs remote and never requires transmitting ALL data to the UI (eg. sort the table by :product-name). I have built variants of this in the past but they all either broke completely when trying to “inspect” larger values or became really slow and not fun to use.

I know basically nothing about visualizations though. I have built a few basic graphs in the past but thats about it. I’m really interested in example use-cases though. Maybe there are some standard cases that can be included by default.

1 Like