Crate plasmo

source ·
Expand description

Rink

A beautiful terminal user interfaces library in Rust.


Leverage CSS, HTML, and Rust to build beautiful, portable, terminal user interfaces. Rink is the cross-framework library that powers Dioxus-TUI

demo app

Background

You can use Html-like semantics with inline styles, tree hierarchy, components, and more in your text-based user interface (TUI) application.

Rink is essentially a port of Ink but for Rust. Rink doesn’t depend on Node.js or any other JavaScript runtime, so your binaries are portable and beautiful.

Limitations

  • Subset of Html Terminals can only render a subset of HTML. We support as much as we can.
  • Particular frontend design Terminals and browsers are and look different. Therefore, the same design might not be the best to cover both renderers.

Status

WARNING: Rink is currently under construction!

Rendering a Dom works fine, but the ecosystem of widgets is not ready yet. Additionally, some bugs in the flexbox implementation might be quirky at times.

Features

Rink features:

  • Flexbox-based layout system
  • CSS selectors
  • inline CSS support
  • Built-in focusing system
  • Widgets
  • Support for events, hooks, and callbacks1
  • Html tags2

1 Basic keyboard, mouse, and focus events are implemented. 2 Currently, most HTML tags don’t translate into any meaning inside of Rink. So an input element won’t mean anything nor does it have any additional functionality.

Re-exports

Modules

Structs

Enums

Traits

  • Trait to create constant percent values from plain numbers
  • Trait to create constant percent values from plain numbers
  • Trait to create constant points values from plain numbers
  • Any item that implements the LayoutTree can be layed out using Taffy’s algorithms.
  • Trait to abstract over auto values
  • Trait to create constant points values from plain numbers
  • Trait to abstract over grid line values
  • Trait to abstract over grid span values
  • Trait to abstract over max_content values
  • Trait to abstract over min_content values
  • Trait to abstract over zero values

Functions

  • Returns the auto value for that type
  • Returns a grid template containing count evenly sized tracks
  • Returns a value of the inferred type which represent a constant of points
  • Shorthand for minmax(0, Nfr). Probably what you want if you want exactly evenly sized tracks.
  • Create a Fraction track sizing function (fr in CSS)
  • Apply the flexbox algorithm and recursively layout the specified node
  • Specifies a grid line to place a grid item between in CSS Grid Line coordinates:
  • Returns the auto value for that type
  • Returns the auto value for that type
  • Returns a MinMax with min value of min and max value of max
  • Returns a value of the inferred type which represent a constant of points
  • Returns a value of the inferred type which represent a constant of points
  • Returns an auto-repeated track definition
  • Returns a GridPlacement::Span
  • Returns the zero value for that type

Type Aliases

  • Used to control how the specified Nodes is aligned. Overrides the parent Node’s AlignItems property. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
  • A grid line placement specification. Used for grid-[row/column]-[start/end]. Named tracks are not implemented.
  • Sets the distribution of space between and around content items For Flexbox it controls alignment in the main axis For Grid it controls alignment in the inline axis
  • Used to control how child Nodes are aligned. Does not apply to Flexbox, and will be ignored if specified on a flex container For Grid it controls alignment in the inline axis
  • Used to control how the specified Nodes is aligned. Overrides the parent Node’s JustifyItems property. Does not apply to Flexbox, and will be ignored if specified on a flex child For Grid it controls alignment in the inline axis
  • A node in a layout.
  • The sizing function for a grid track (row/column) (either auto-track or template track) May either be a MinMax variant which specifies separate values for the min-/max- track sizing functions or a scalar value which applies to both track sizing functions.