TinyBit
Clipping region is a set of min/max x/y values applied to the existing region
A TUI lib
This is not yet production ready
T O D O
TODO: bugs:
- Text in template can be interpreted as attribute: text: "this:is_wrong"
- Style propagation is entirely nonsense
- Text widget is eating newline characters
- Padding is wrapping the element but should wrap the child
- How should padding behave when there are more than one child? * Add a container with padding and a node of the same type as self and move all the children into that node? * Don't allow padding as a property * Rename padding to margin
TODO:
-
Text widget
-
Expanded: https://api.flutter.dev/flutter/widgets/Expanded-class.html
-
Column: https://api.flutter.dev/flutter/widgets/Column-class.html
-
Container
-
Padding
-
Stacking: https://api.flutter.dev/flutter/widgets/Stack-class.html
-
Expanded
-
Viewport
-
Flexible
-
Visibility (render nothing vs exclude from widget tree)
-
Children at coords
-
Canvas
-
All widgets that can have a size: merge with constraints
-
Widgets should have required attributes (error on missing attribs)
-
needs_layout
property on widgets, so layout isn't calculated unless needed -
Canvas
- Figure out resize: can copy to another buffer
-
[o] Border
- Label is done via
Stacking
- "thick" border style
- Multi sized segments (not just single char)
- Specific edge border (e.g border-bottom, border-top, border-left...)
- Clipping?
- Label is done via
TODO: Template
- Custom widgets
- impl of Widget
- Register custom widgets with some lookup table
- Custom template
- Composition / includes
TODO: Optimisations
- Don't layout widgets outside of constraints
- Don't paint widgets outside of clipping / viewable space
- Text widget can store indices for sub strings
NOTE: misc ideas
- Pass json + template = render
Important:
- Styles do not cascade, and has to be reset between elements
- Width / height requirements for
Viewport
Layout flow
Constraints -> Size -> Global pos
- Parent passes constraints down to the child,
- the child returns its size,
- the parent sets the position.
Template syntax
//
is a comment
The first element can not have any indentation
container [width:10, height:5]:
Attributes
Attributes are written between [
and ]
String
string: "string value"
Number (i64)
num: 123
Boolean
bool_a: true, bool_b: false
Colour
TODO: list available colour names
foreground: red, background: reset, color: (10, 20, 30)