Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Plot cell: allow async, multiple inputs, one output #19

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

justjake
Copy link

@justjake justjake commented May 7, 2022

This PR updates Plot cells to work as more fully-featured JS cells.

  • Plot cells can take multiple input dependencies: (dep1, dep2) => ... or no inputs, () => ....
  • Plot cells can be async, allowing them to access modules with await import(...): async dep => (await import('https://esm.sh/...'))(dep).
  • Plot cells can write a reactive result, using assignment syntax: resultName = () => [{ x: 1 }, { x: 2 }]. Currently this emits one relation, not a set of relations like code cells. A future change could use syntax like { table1, table2 } = () => ... to emit multiple relation outputs.
  • Cell outputs with outerHTML are rendered as HTML (as before). Array outputs are rendered as relations. Otherwise, the output is rendered as JSON. If Debug button to show Datalog AST #16 is merged, I'll replace the simple JSON renderer with the JSON tree inspector used there.

After these changes "plot" vs "code" seem like misnomers - perhaps we should rename these concepts to "datalog" and "js". However, that's a bigger policy/design change.

image

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant