JuliaPluto / PlutoUI.jl

https://featured.plutojl.org/basic/plutoui.jl
The Unlicense
299 stars 54 forks source link

Fate of ExperimentalLayout #237

Open j-fu opened 1 year ago

j-fu commented 1 year ago

Hi, what are the plans with Layout/ExperimentalLayout ?

I find this highly useful, IMHO it can be released as part of the public API.

fonsp commented 1 year ago

Hey Jürgen!

There are a couple of things that I want to consider before releasing:

  1. Exposing CSS features: should we add lots of API like a keyword argument for grid_spacing that are mirrored by CSS properties grid-spacing, or should we focus more on giving you an easy passthrough to write the CSS features yourself? So it is about this balance between "you get to write CSS" and "Julian wrapper". My personal preference is the former, but I wonder what would be best for people without CSS experience.
  2. General feedback: I would love to learn more about how people are using ExperimentalLayout and their experience.
  3. Documentation
  4. I have been considering that the layout functions should be macros, like @vbox(...). The goal is to allow things like:
@vbox([
    @bind x Slider(1:10),
    plot(rand(x)),
])

This does not work currently, because updating x causes the entire cell to re-run.

j-fu commented 1 year ago

Hi, regarding CSS: I share your preference as this lowers the barrier for people who don't know and never will need to know CSS (I know only a little bit). OTOH there is so much what can be done with CSS that I think it makes no sense to try to match all of that. So I think it makes sense to provide keywords for some basic things and to document how CSS could be used. If the way keywords are introduced is flexible enough others could contribute here via PRs.

j-fu commented 1 year ago

As for feedback: I e.g. did this talk all with ExperimentalLayout: https://www.wias-berlin.de/people/fuhrmann/AdSciComp-WS2223/week3/

I am not sure though if enough Pluto users are aware of its existence.

j-fu commented 1 year ago
@vbox([
    @bind x Slider(1:10),
    plot(rand(x)),
])

I would use this immediatly, (especially in combination with vertical sliders...)

fonsp commented 7 months ago

Hey! Little update!

The plan is to release this as a separate package, PlutoLayout.jl, and to support this syntax:

@vbox([
    plot(rand(x)),
    @bind x Slider(1:10),
])

Reactivity

Note here also that @bind x comes after plot(x), which should work!

To support this, either it needs to be super integrated in Pluto, but this seems veeeeeery difficult and complicated. Or the alternative: we can create a tiny reactive framework within the cell using PlutoHooks! (Somehow this seems easier.) For this, PlutoLayout needs to understand how to order cells, and what the definitions and references of a cell are.

This is why I started working on https://github.com/JuliaPluto/ExpressionExplorer.jl (and https://github.com/fonsp/Pluto.jl/pull/2698): this makes the reactive analysis of Pluto.jl available to other packages (like PlutoLayout.jl). In particular, other packages can use it inside macros.

Display

The main feature of PlutoLayout.jl is its special display: it integrates with Pluto's frontend to create divs that are rendered using Preact, diffing each component individually. I think this mechanism should be made available using AbstractPlutoDingetjes.Display, or at least with a special MIME type.

Timeline

So the plan is: