Skip to content

Deno TUI 2.1.0

Compare
Choose a tag to compare
@Im-Beast Im-Beast released this 01 Aug 18:53
· 21 commits to main since this release

Release 2.1.0 🎉

BREAKING CHANGES

  • Views properties (rectangle, offset and maxOffset) are now a signals.

Changelog

  • Added Layouts, which simplify creation of apps that require more complex positioning or responsivness.
    • VerticalLayout, HorizontalLayout and GridLayout are available.
    • examples/calculator.ts and examples/layout.ts showcase how to use GridLayout
    • additional documentation is available as JSDoc of these classes.
  • A lot of functionality has been added to signals
    • Effect and Computed now track causes of their updates
      • These causes are passed to their update method as an option
        • new Computed((cause) => { ... }), new Effect((cause) => { ... })
    • 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 and drop Signal methods
      • They are here for easier state management over your signals
      • drop is basically unsubscribe for when
      • 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 and cropToWidth string utility functions have been highly optimized
  • Keypresses are now read at the same rate as Tui's refreshRate
    • 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 in ProgressBar component
  • Tui has now rectangle property
calculator_showcase.webm
demo_showcase.webm
layout_showcase.webm

Full Changelog: 2.0.0...2.1.0