Pluto.jl
Pluto.jl copied to clipboard
feat(api): javascript api for custom ui building
These are a bunch of utilities extracted from Editor.jl (thank you claude) that allow for easy embedding of Pluto in other web applications.
Try this Pull Request!
Open Julia and type:
julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="pg/frontend-api")
julia> using Pluto
We could factor out the inline definition of real_action in Editor.js into a separate file. We can structure it as a function:
create_actions_for(client, {get_state, set_state}) -> PlutoActions
and Editor.js would call it with:
create_actions_for(client, {get_state: () => this.state.notebook(), set_state: this.setStatePromise})
import MinimalPlutoDisplay as MPD
function cool_plot(x)
const diplay = MPD.create_display(
let
import PlutoPlotly
PlutoPlotly.plot($x)
end)
end
And it would:
- Not start a new process
- Use the Pluto Julia-JS communication
- Use Pluto's display (same script execution, styling maybe, etc)