This is a tui platform for Roc built on top of the excellent tui-rs.
My goal for making this platform is to learn more about Roc dev; to explore ideas for the Roc editor, and how to do Action-State in Roc.
I welcome any feedback or assistance!
Note that to close the app it is currently hardcoded in the platform to the 'ESC' key. This will be configurable when I add support for effects.
Here is the hello.roc
example.
# Model
Model : { text : Str }
init = \_ -> { text: "Hello world!" }
# Handle Events
update : Model, Event -> Model
update = \model, _ -> model
# Render UI
render : Model -> List Elem
render = \model ->
text = [[Elem.styled model.text { fg: Green }]]
[ Elem.layout [ Elem.paragraph { text } ] {} ]
Here is a demonstration of examples/todo.roc
.
and, here is a demonstration of examples/popup.roc
.
If your feeling brave you can use a URL release of this platform. For more information how to do this see the Roc Tutorial.
- Block widget
- Paragraph widget
- Responsive layouts
- Styling
- Scrolling for paragraphs
- Optional Records for better API
- List widget
- Add support for Popup/Modals
- Support for effects (e.g. close app)
- Support more widgets. Currently blocked on #4554
- Canvas widget
- Tabs
- Table
- Charts
- Sparkline
- More examples
- Support Tasks such as opening a File similar to CLI, needs investigation. Better to wait for improved
roc glue
support and packages - Better error handling, don't mess up terminal if Roc panics somehow
- Support for mouse input
- Write some tests
- Review the tui-rs docs and examples to understand the behaviour.
- Add feature to the Platform API
*.roc
files - Generate
platform/glue.rs
withroc glue platform/main.roc platform/src/glue.rs
note the comments inplatform/main.roc
- Use
cargo build
from the platform folder to fix any errors - Wire functionality into the platform host Rust code
- Update
hello.roc
and other examples - Rebuild release with
roc build --bundle .tar.br platform/main.roc
roc docs platform/main.roc
cd ./generated-docs
simple-http-server --nocache --index