Skip to content
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

Make it all configurable. #3

Merged
merged 5 commits into from
Sep 25, 2024
Merged

Make it all configurable. #3

merged 5 commits into from
Sep 25, 2024

Conversation

jperon
Copy link
Collaborator

@jperon jperon commented Mar 2, 2024

This is quite a big change. The idea came from @paulfitzmessage: with this one, it would be possible to create standalone widgets from the code of a "personalized" one.

With that, the name pug_py doesn’t say all it does: it’s now starting from a configuration, that will define an entrypoint (for example a pug or a py code) and possibly other editors.

Another change is that it now uses RapydScript instead of Transcrypt or Brython (or PyScript that I tested too), as it’s far easier to interact with js. The only caveat I saw is that, for functions which really expect a pure Array (like grist.docApi.applyUserActions), it’s necessary to call the Array constructor, or to convert a python list with Array.from(LIST).

@jperon jperon force-pushed the configurable branch 2 times, most recently from ff20a1a to 1777905 Compare March 2, 2024 17:33
@jperon
Copy link
Collaborator Author

jperon commented Mar 3, 2024

I had tested in my self-hosted instance, where the widgets are hosted in the same domain as Grist itself. Now I’m facing cross-origin problems while hosting at docs.getgrist.com. Perhaps I’ll have to go back to Brython…
@berhalak if you had time (but I don’t want to abuse), would you mind looking at this and, if possible, explain me what I’m doing wrong?

@jperon
Copy link
Collaborator Author

jperon commented Mar 3, 2024

@berhalak Never mind, I ended finding the problem. It came from RapydScript, which builds an iframe, but which used, to pass messages between the iframe and its parent, a "pythonesque" equality. This one used an __eq__ property, and its access was forbidden because of CORS.

@jperon jperon force-pushed the configurable branch 2 times, most recently from b7ed402 to 8863b53 Compare March 3, 2024 15:52
@jperon
Copy link
Collaborator Author

jperon commented Mar 3, 2024

So here is a very basic showcase, featuring a customizable Markdown widget.

@jperon
Copy link
Collaborator Author

jperon commented Mar 3, 2024

And here is a new version of the Kanban widget, which could very easily be put into its own repository, and whose configuration is more straight forward than the previous one.

@berhalak berhalak self-requested a review March 4, 2024 17:47
@berhalak
Copy link

Sorry for the delay @jperon, it was busy week for me.

@jperon
Copy link
Collaborator Author

jperon commented May 25, 2024

@berhalak Is there anything to do on my side, please? No hurry, but I’d like to have this merged before proposing widgets based on it if possible.
Many thanks!

@paulfitz
Copy link
Member

@jperon currently @berhalak is on vacation. In any case, I'm not sure it is practical to review this PR in its current form, it is so large. I understand a lot of the files are copies of material from elsewhere, but they'd still need to be read for Grist Labs to sign off on their content.

I'm happy to say we are finally going to make progress on having a way to mark custom widget's as "community written" or something similar. As long as we have a way to let the user know who they are trusting when they use a widget, we can start decentralizing a little bit. The new way to mark a widget is slated to be done by the end of July, and may happen earlier.

Very sorry this bottleneck has dragged on so long...

entrypoint = "pug" # Name of one of the codes below

# You may define various editors below. There must be at leat cfg and the entrypoint.
[[widget.codes]]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[[widget.codes]]
# You may define various editors below. There must be at least cfg and the entrypoint.

Copy link

@berhalak berhalak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice. One question about files in /js folders, I see jkanban and toastui* files. I think they are not needed?

@jperon
Copy link
Collaborator Author

jperon commented Sep 24, 2024

Looks nice. One question about files in /js folders, I see jkanban and toastui* files. I think they are not needed?

The reason I left them there is that I intended to make this widget suitable for offline use. It can’t integrate the whole js libs world, for sure… but those ones looked to me as a reasonable bundle for quite common needs in a custom widget.

@jperon
Copy link
Collaborator Author

jperon commented Sep 24, 2024

Sorry, related to jperon/kanban#1, I realized that I had uncommitted local changes… I had to rebase and force-push, so I think a "squash&merge" will be necessary to keep history clean.

@berhalak berhalak merged commit 5c67445 into master Sep 25, 2024
@berhalak berhalak deleted the configurable branch September 25, 2024 12:45
@paulfitz
Copy link
Member

The reason I left them there is that I intended to make this widget suitable for offline use. It can’t integrate the whole js libs world, for sure… but those ones looked to me as a reasonable bundle for quite common needs in a custom widget.

We do have a bundling mechanism for widgets that can pull in external dependencies. We use it to make the calendar widget (developed as a custom widget) available offline in Grist Desktop.

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.

3 participants