Skip to content

feat(api): javascript api for custom ui building#3303

Draft
pankgeorg wants to merge 73 commits intomainfrom
pg/frontend-api
Draft

feat(api): javascript api for custom ui building#3303
pankgeorg wants to merge 73 commits intomainfrom
pg/frontend-api

Conversation

@pankgeorg
Copy link
Member

@pankgeorg pankgeorg commented Jul 31, 2025

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

@fonsp
Copy link
Member

fonsp commented Jul 31, 2025

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})

@fonsp
Copy link
Member

fonsp commented Jul 31, 2025

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)

Replace brittle string matching with proper TOML parser for cell metadata.
This makes the parser more robust and extensible, supporting all TOML data
types (booleans, numbers, strings, arrays, etc.) instead of hardcoded patterns.

Changes:
- Add @iarna/toml dependency for TOML parsing/serialization
- Refactor parseCellMetadata() to use TOML.parse()
- Refactor serializeCellMetadata() to use TOML.stringify()
- Fix merge conflicts in test/test_fs.js

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants