Deno TUI 2.1.0
Release 2.1.0 🎉
BREAKING CHANGES
- Views properties (
rectangle
,offset
andmaxOffset
) are now a signals.
Changelog
- Added Layouts, which simplify creation of apps that require more complex positioning or responsivness.
VerticalLayout
,HorizontalLayout
andGridLayout
are available.examples/calculator.ts
andexamples/layout.ts
showcase how to useGridLayout
- additional documentation is available as JSDoc of these classes.
- A lot of functionality has been added to signals
Effect
andComputed
now track causes of their updates- These causes are passed to their
update
method as an optionnew Computed((cause) => { ... })
,new Effect((cause) => { ... })
- These causes are passed to their
- Properties which take either object or signal of that object now have better typings
SignalOfObject
type has been added, which provides that functionality
- New
when
anddrop
Signal
methods- They are here for easier state management over your signals
drop
is basicallyunsubscribe
forwhen
when
usage:
// Basically this
button.state.when("active", () => {
++counter;
});
// Is equivalent to this
button.state.subscribe((state) => {
if (state === "active") {
++counter;
}
});
- Fixed bug whereas some keypresses could lag behind actual component state
- Canvas has received a number of performance optimizations, which visibly reduced CPU usage
- It only updates objects that actually need to be updated
- It loops over objects only once, instead of twice like before
- If object's rectangle hasn't changed it doesn't try to update its intersections
- When object gets erased its subscriptions and effects are hang until it gets drawn again
- TextObject should update a bit more efficiently
textWidth
,stripStyles
andcropToWidth
string utility functions have been highly optimized
- Keypresses are now read at the same rate as
Tui
'srefreshRate
- This significantly lowers CPU usage when object is reactive to mouse or keypresses without introducing visible latency
- Fixed a bug where resizing wouldn't update elements at last row and/or column of the terminal
- Fixed
smooth
option not being properly respected inProgressBar
component - Tui has now
rectangle
property
calculator_showcase.webm
demo_showcase.webm
layout_showcase.webm
Full Changelog: 2.0.0...2.1.0