-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual editor #31
Comments
Source code manipulationGeneral process:
We can use libcst or astor for this. LibCST is probably better because it'll preserve things like commenting and formatting Example program |
LimitationsIf there's any indirection, e.g. using a variable instead of assigning literal values, then this is going to be difficult to programmatically update from the UI. It's technically do-able, (e.g. look up alias reference), but this becomes quite complicated beyond the simplest indirections. Instead, we'll show a disabled input with a tooltip to explain why it's not editable. Instead of having shared values; we should steer app developers to instead use theming, which is dependent on Angular Material's new theming to be launched. |
Command DialogWe can provide a flexible way of allowing users to search through commands (inspired by Raycast when they have focused on a component. (We can also later provide a hotkey, e.g. cmd+K, to open the dialog even without a focused component).
This is a flexible way of adding richer, assistive feature into Mesop editor over time while keeping a minimal and consistent UI |
Different cases to handle:
|
Motivation
One of the challenges with developing Mesop applications for Python engineers with limited FE experience is that creating layouts and dealing with styling has a substantive learning curve.
By providing a visual editor, we can lower the barrier to entry and improve the velocity of Mesop app developers.
Prior Art
There's many similar attempts, but perhaps the most relevant example is Puck which is an open-source visual editor for React; it provides a very intuitive user experience. One of the differences, though, is that Puck emits JSON (a data structure of the component tree), but I'd like to emit Python code to close the gap between code produced by the visual editor vs. hand-written.
Design
High-level component structure
Interfaces
Server -> client
From client to server
Generating ComponentConfig proto from Python API
Example program:
Flows
When you drag a component, it will create a placeholder component and emit a user event. EditorEvent. Inside EditorEvent, there's three types: 1) create, 2) edit, and 3) delete. After the user event, we will do a hot reload.
Implementation notes
Tasks
--prod
) which determines which binary to use.ComponentLibrary
component for left sidenav andComponentFieldsEditor
andComponentOutline
components for right sidenavinspect
and get the call-site; the frame before mesop/components)ComponentConfig
as part of RenderEvent in editor mode.Nice to haves:
Open questions
The text was updated successfully, but these errors were encountered: