Releases: Im-Beast/deno_tui
Releases · Im-Beast/deno_tui
Deno TUI 0.5 – RC
Changelog
- Added missing JSDocs
- createTui now accepts
reader
andwriter
inoptions
argument - Added:
- Debug mode which disables rendering to terminal
- Can be toggled using
setDebugMode
function
- Can be toggled using
- New events
update
which fires before tui/component is drawncreateComponent
andremoveComponent
which fire to tui, parent and component itself when its created/removed.
- Debug mode which disables rendering to terminal
LabelComponent
now takesvalue
property which containstext
andalign
properties- Frames are now not inherited from
styler
property, instead they can be assigned usingframe
property in components that supported framing FrameComponent
now supports rounded corners viarounded
property- Moved
refreshRate
from property ofTui
to argument ofloopDrawing
function - Mostly replaced usage of
Dynamic
properties in favor of getters and setters - Created components now preserve getters and setters applied to
options
/extension
- Fix
NO_COLOR
support crashing in edge cases
Changes needed to make previous code work with this version
- Tui now takes
reader
andwriter
as properties in option
- const tui = createTui(Deno.stdin, Deno.stdout, {
+ const tui = createTui({
+ reader: Deno.stdin,
+ writer: Deno.stdout,
styler: tuiStyler,
});
- previous
draw
function has been renamed toloopDrawing
+ loopDrawing(tui);
- draw(tui);
- Replace dynamic component/tui properties with getters
const component = createComponent({
...,
- rectangle() {
+ get rectangle() {
...
},
});
- Using
getStaticValue
is now redundant in most of cases
- const rectangle = getStaticValue(component.rectangle);
+ const rectangle = component.rectangle;
- Remove
frame
property from styler and applyframe
property to components that support it
const styler = compileStyler<TuiStyler>({
foreground: "black",
background: "lightCyan",
},
- frame: {
- foreground: "white",
- background: "black",
- },
});
+ const frameStyler = compileStyler<TuiStyler>({
+ foreground: "white",
+ background: "black",
+ });
+ const frame = {
+ enabled: true,
+ styler: frameStyler,
+ };
const componentThatNeedsFrame = createComponent(..., {
...,
+ frame,
);
- Replace
menuItem
andmenuList
withbutton
andcombobox
respectively.
- createMenuList(menu, {
- label: "File",
+ createCombobox(menu, {
+ label: {
+ text: "File",
+ },
items: ["Open", "Save", "Close"],
+ expandItemsWidth: true,
});
- const help = createMenuItem(menu, {
- label: "Help",
+ const help = createButton(menu, {
+ label: {
+ text: "Help",
+ },
});
textAlign
andtext
properties have been moved tolabel
property in components andvalue
property inLabelComponent
createButton(..., {
...,
- label:
- `Some text`,
+ label: {
+ text:
+ `Some text.`,
+ },
});
createLabel(..., {
...,
- text: "Some text",
- textAlign: {
- vertical: "top",
- horizontal: "left",
+ value: {
+ text: "Some text",
+ align: {
+ vertical: "top",
+ horizontal: "left",
+ },
+ },
});
Deno TUI 0.4
Changelog
- Fixed typings for
AnyStyler
, creating styler usingcompileStyler
whilst using other object as a base now works as expected unload
event is now dispatched onSIGINT
signal- Mouse handler should now respect only left mouse click for focusing and activating components
- Canvas CPU usage should now be lower
- Improved
TextboxComponent
multiline controls - Tests
- Tests no longer share imports
emptyChanges
rendering test has been removed as it's impractical- External actions (modules used to execute outside of test) has been moved to
tests/actions
directory
- Most of the documentation should be done.
All changes should be backwards compatible with 0.3
Deno TUI 0.3
Changelog
- Fixed
combobox
z-fighting. - Move drawing FPS counter from
tui.ts
toexample.ts
- Added
NO_COLORS
support - Removed unused functions
- Removed
draw
andstopDrawing
fromTuiInstance
- Added new exported
draw
function which draws TuiInstance - Draw function doesn't get called automatically anymore
- Added new exported
- Greatly improved keyboard controls
- Added mouse controls
key_reader.ts
now supportsMousePress
es
- Moved given functionality to more proper locations
handleKeypresses
:keyboard.ts
->key_reader.ts
- Improve exiting script whilst rendering
- Added tests for modules in
src/
. - Fixed EventEmitter not working as expected
Changes needed to make previous code work with this version
- tui.draw();
+ draw(tui);
Deno TUI 0.2.1
Changelog
- Added license headers
- Added basic JSDoc for important things
Deno TUI 0.2.0
Changelog
- Box component now supports frame in
styler
- Because of this change code of button and textbox have been cleaned a little
- Added menuList component
- Improved textBox component
- Added support for multiline
- value property now takes
string[]
instead ofstring
- Supposedly fixed issue that caused child to not inherit parents styler
- New demo has been created
- Normalized naming scheme
- Components that accepted
text
property for automatically creating label for them now uselabel
- Components that accepted
- Fixed bug which caused textbox cursor to reveal hidden text
- Canvas should have lower CPU usage (probably still can be improved)
- Rendering framerate should be now more stable
TuiInstance.restartDrawing
got removed- compileStyler now respects bg colors.
Changes needed to make previous code work with this version
- Replace
text
properties forlabel
- Whenever you use
value
property of textbox be sure to join it with newlinestextbox.value.join("\n")
.
Deno TUI 0.1.0
Changelog
- Massive rendering overhaul
- New canvas and colors API
- When
smartRender
in canvas is set only changed parts of the screen are redrawn- H u g e performance gain
- Instead of using
crayon.js
TUI uses new colors module which precompiles styles
- When
- Drawing full-width characters is now supported
frame_buffer.ts
module has been removed and replaced fully withcanvas.ts
- New canvas and colors API
- Reactivity improvements
styler
property inTuiInstance
andTuiComponent
's can now be dynamic- Remember to use it only when reference to the object changes
- Fixed broken key reader (missing setRaw line)
- From this point on API changes shouldn't be that radical
Changes needed to make previous code work with this version
- const mainStyler: TuiStyler = {
- foreground: "white",
- ...
- };
- const componentStyler: TuiStyler = {
- ...mainStyler,
- background: "blue",
- };
+ const mainStyler = compileStyler<TuiStyler>({
+ foreground: "white",
+ ...
+ });
# You could potentially use compileStyler here too.
+ const componentStyler: TuiStyler = {
+ ...mainstyler,
+ background: keyword("bgBlue"),
+ });
Deno TUI 0.0.5
- Further reactivity improvements
Dynamic
generic type, used for creating dynamic typesgetStaticValue
function used to get static value from dynamic typemenuItem
components are now dynamic
- Frame now has easy way to add label
- New way to create components
- New
ExtendedTuiComponent
generic type- Used to create types for components that are expected to have properties other than regular
TuiComponent
type
- Used to create types for components that are expected to have properties other than regular
- New
- This provides better type checking and doesn't create unnecesarily more components
Example of creating new component – brief showcase, not full code
+ export type CheckboxComponent = ExtendedTuiComponent<
+ "checkbox",
+ {
+ value: boolean;
+ },
+ "valueChange",
+ boolean
+ >;
+
+ const checkbox: CheckboxComponent = createComponent("checkbox", CreateComponentOptions, {
+ value: false,
+ });
- export interface CheckboxComponent
- extends TuiComponent<"valueChange", boolean> {
- value: boolean;
- }
-
- const checkbox: CheckboxComponent = {
- ...createComponent("checkbox", CreateComponentOptions),
- value: false
- }
Deno TUI 0.0.4
- New
Deno.addSignalListener
API - Code unification (using for...of)
- Got rid of some useless typings
- You're now able to use functions that return string in
text
property of labels to make them dynamic
Deno TUI 0.0.3
- Fixed some styling and rendering issues
- Added menu and menuItem components
Deno TUI 0.0.2
- Major code refactor