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§

pub use query::Query;

Modules§

query

Structs§

Config
Event
File
Files
FormData
InnerInputState
Layout
The final result of a layout algorithm for a single Node.
Line
An abstract “line”. Represents any type that has a start and an end
Point
A 2-dimensional coordinate.
Rect
An axis-aligned UI rectangle
RinkInputHandler
Size
The width and height of a Rect
Style
The flexbox layout information for a single Node.
Taffy
A tree of UI Nodes, suitable for UI layout
TuiContext

Enums§

AlignContent
Sets the distribution of space between and around content items For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
AlignItems
Used to control how child Nodes are aligned. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
AvailableSpace
The amount of space available to a node in a given axis https://www.w3.org/TR/css-sizing-3/#available
Dimension
A unit of linear measurement
Display
Sets the layout used for the children of this node
EventData
FlexDirection
The direction of the flexbox layout main axis.
FlexWrap
Controls whether flex items are forced onto one line or can wrap onto multiple lines.
GridAutoFlow
Controls whether grid items are placed row-wise or column-wise. And whether the sparse or dense packing algorithm is used.
GridTrackRepetition
The first argument to a repeated track definition. This type represents the type of automatic repetition to perform.
InputEvent
LengthPercentage
A unit of linear measurement
LengthPercentageAuto
A unit of linear measurement
MaxTrackSizingFunction
Maximum track sizing function
MinTrackSizingFunction
Minimum track sizing function
Position
The positioning strategy for this item.
RenderingMode
TrackSizingFunction
The sizing function for a grid track (row/column) See https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns

Traits§

Driver
FromFlex
Trait to create constant percent values from plain numbers
FromPercent
Trait to create constant percent values from plain numbers
FromPoints
Trait to create constant points values from plain numbers
LayoutTree
Any item that implements the LayoutTree can be layed out using Taffy’s algorithms.
TaffyAuto
Trait to abstract over auto values
TaffyFitContent
Trait to create constant points values from plain numbers
TaffyGridLine
Trait to abstract over grid line values
TaffyGridSpan
Trait to abstract over grid span values
TaffyMaxContent
Trait to abstract over max_content values
TaffyMinContent
Trait to abstract over min_content values
TaffyZero
Trait to abstract over zero values

Functions§

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

Type Aliases§

AlignSelf
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
GridPlacement
A grid line placement specification. Used for grid-[row/column]-[start/end]. Named tracks are not implemented.
JustifyContent
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
JustifyItems
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
JustifySelf
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
Node
A node in a layout.
NonRepeatedTrackSizingFunction
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.