List and Table widgets done, just the BarChart widget to reproduce the original Rust TUI demo, after that going to switch to polishing and documentation... (oops, actually BarChart, Tab, Sparkline and Gauge, but meh... can do them later)
so the next interesting part is parsing output from /dev/tty into events, in addition to key input, it should allow mouse support and some other stuff. Will be borrowing heavily from crossterm as there's .... lots of detail.
now ported / reimplemented a useful chunk of the crossterm "event" system, so you can pop events (e.g. sanitised key presses, focus, terminal resize) from a buffer. also it's calling out to stty to do a couple of things like (un)setting "raw" mode and disabling "echo".
I'm just about happy with the API now, although some widgets are missing from the ratatui port, and some features are missing from the crossterm port, all the bases are covered.
time to write + generate documentation... thinking a github page, probably Sphinx/RST although tempted to use Hugo 🤔
@dantleech it would be an understatement to say I don’t love php but I do love me some TUI goodness and it’s been real exciting following this journey ❤️
@kitchen PHP is pretty OK depending on which rock you find it under. Probably not the best choice for a TUI but 🤷 . have enjoyed following your journey too 😄
there are some architectural changes I'm thinking of making vs. Ratatui:
Ratatui's widgets render themsevles ... which is convenient, but it does mean you probably need global state at some point (caching, or loading fonts for example).
I'm thinking to split the widget data from a widget rendering service which can have fat dependencies - so each widget will (mostly) require 2 classes - the lightweight widget (config and state) and the renderer.
Ratatui uses the builder pattern extrensively to mutate the widgets. This is mostly convenient, but also adds complexity, considering dropping the builder pattern and just using navitve constructors... but then you'd still want static constructors and then it all starts to get complicated again.
thinking it would be a great PoC to add a @phpbench extension which uses PHP-TUI for progress widgets and reports (and include that extension as a dev depdency for PHP-TUIs benchmarks)
round 2 of documentation done: https://php-tui.github.io/php-tui the docs are getting better... (well, some of it got slightly worse, but more steps forward than back)
I've tagged a 0.0.2 of #php TUI - lots of bug fixes, linear gradient and the gauge, image, and barchart widgets, DX improvements for styling, inline and fixed viewports and more and a slightly pimped up README:
@dantleech I won’t lie and say I love php but I will say it’s been a hell of a lot of fun watching you do this and seeing the awesome results. Fucking great job!
Add comment