diff --git a/README.md b/README.md index 0c13837..84dc851 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ https://pflow-app.fly.dev/ * export to gno.land * export to solidity * export to js/ts + * export to python * support analysis * export to julia (jupyter notebook) @@ -30,3 +31,11 @@ https://pflow-app.fly.dev/ See [widget.html](./widget.html) for an example of how to next the pflow viewer in an html page. [embed-example](https://pflow.dev/embed/?m=petriNet&v=v0&p=place0&i=1&c=3&o=0&x=130&y=207&p=place1&i=0&c=0&o=1&x=395&y=299&t=txn0&x=46&y=116&t=txn1&x=227&y=112&t=txn2&x=43&y=307&t=txn3&x=235&y=306&s=txn0&e=place0&w=1&s=place0&e=txn1&w=3&s=txn2&e=place0&n=1&w=3&s=place0&e=txn3&n=1&w=1&s=txn3&e=place1&w=1) + +## Test model with shortURL v1 + +[test-model](http://localhost:3000/?m=PetriNet&v=v1&p=place0&c=3&i=1&o=0&x=130&y=207&t=txn0&x=46&y=116&t=txn1&x=227&y=112&t=txn2&x=43&y=307&t=txn3&x=235&y=306&s=txn0&e=place0&w=1&s=place0&e=txn1&w=3&s=txn2&e=place0&n=1&w=3&s=place0&e=txn3&n=1&w=1) + +``` +http://localhost:3000/?m=PetriNet&v=v1&p=place0&c=3&i=1&o=0&x=130&y=207&t=txn0&x=46&y=116&t=txn1&x=227&y=112&t=txn2&x=43&y=307&t=txn3&x=235&y=306&s=txn0&e=place0&w=1&s=place0&e=txn1&w=3&s=txn2&e=place0&n=1&w=3&s=place0&e=txn3&n=1&w=1 +``` diff --git a/TODO.md b/TODO.md index 7c473b4..3cba0bc 100644 --- a/TODO.md +++ b/TODO.md @@ -6,16 +6,27 @@ build of app.pflow.dev - no wallet connector - minimal build/viewer WIP --- -- [ ] Review roadmap.md - consider deploying gnoland-only version first - [ ] gno.land version needs multi-token support - [ ] url-visualizer on gno.land to build out multi-step actions -- [ ] in this project use ./static/form.html and ./static/model.svg as template +- [ ] fix token colors - changing colors in the editor should change the diagram +- [ ] fix capacity set to 0 does not remove capacity limitation +- [ ] test that permalink gets updated on edit +- [ ] minURL - add support for multi-token colors + + + DONE +---- +- [x] fix editor interactions - issue selecting text and last few lines of code +- [x] in this project use ./static/form.html and ./static/model.svg as template +- [x] Review roadmap.md - consider deploying gnoland-only version first BACKLOG ------- - [ ] fix failing tests - [ ] complete upgrades for colored tokens - [ ] check backward-compatible support for URL formats +- [ ] consider adopting https://github.com/microsoft/monaco-editor/tree/main for multi-language support +- [ ] review the plan to implement custom lexer/parser for go, julia, solidity, python ``` /?foo=1&bar=1&baz=1 ```` @@ -40,5 +51,3 @@ ICEBOX - [ ] exploring dom updates:update object.data - [ ] vs live updates inside an embedded SVG using postMessage(). -DONE ----- diff --git a/public/model.svg b/public/model.svg index 08f7e5e..27ce4d9 100644 --- a/public/model.svg +++ b/public/model.svg @@ -1,310 +1,401 @@ - - - - - + + + + + - - + + - - - { - "tokens": [ "black" ], - "places": {}, - "transitions": {}, - "arcs": [] - } - - + { "tokens": [ "black" ], "places": {}, + "transitions": {}, "arcs": [] } + - \ No newline at end of file +window.addEventListener('load', init); +document.addEventListener('DOMContentLoaded', init); +]]> + + diff --git a/src/App.css b/src/App.css index c1ad4dc..1fcc316 100644 --- a/src/App.css +++ b/src/App.css @@ -25,6 +25,7 @@ body { outline: none; margin-left: 15px; margin-top: 40px; + overflow: auto; } #controls { diff --git a/src/App.tsx b/src/App.tsx index ae49711..b927bba 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react'; import { Model, importUrl, ModelData } from './model/model'; import './App.css'; import CodeEditor from "@uiw/react-textarea-code-editor"; - import rehypePrism from "rehype-prism-plus"; const defaultModel: ModelData = { "modelType": "PetriNet", @@ -64,7 +63,7 @@ import React, { useEffect, useState } from 'react'; sourceElement.style.height = `${Math.max(height, 300)}px`; sourceElement.style.width = `${Math.max(width - 40, 300)}px`; } - setEditorHeight(window.innerHeight - 680); + setEditorHeight(height); }; handleResize(); @@ -90,7 +89,12 @@ import React, { useEffect, useState } from 'react'; @@ -125,18 +129,14 @@ import React, { useEffect, useState } from 'react'; value={modelState.toJson()} data-color-mode="light" language={"js"} - placeholder="source" - rehypePlugins={[ - [rehypePrism, { ignoreMissing: true, showLineNumbers: false }], - ]} + placeholder="source v1" padding={10} // @ts-ignore style={{ - fontSize: 14, minHeight: editorHeight, backgroundColor: "#FFFFFF", border: "1px solid #E0E0E0", - fontFamily: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", + fontFamily: "monospace", }} onChange={(evt) => { try { diff --git a/static/editor.html b/static/editor.html deleted file mode 100644 index b02be85..0000000 --- a/static/editor.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - pflow | model.svg - - - - - - - - pflow.xyz - PetriNet Metamodels - - - - - - - - - - - - - Status: Ready - - - - - - - - - - - - - - - - diff --git a/static/index.html b/static/index.html index a0349d0..3281a18 100644 --- a/static/index.html +++ b/static/index.html @@ -1,20 +1,273 @@ - + + + - pflow | metamodel + pflow | model.svg - + + + + + pflow.xyz - PetriNet Metamodels + + + + + + + + + + + + + Status: Ready + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/static/model.svg b/static/model.svg index 619d35f..f41fe41 100644 --- a/static/model.svg +++ b/static/model.svg @@ -1,23 +1,13 @@ - \ No newline at end of file +