package
0.0.0-20210722152315-6515ceb4a127
Repository: https://github.com/mitchellh/go-glint.git
Documentation: pkg.go.dev

# README

flex - CSS flexbox layout implementation in Go

Go implementation of flexbox CSS layout algorithm.

A pure Go port of Facebook's Yoga.

How to use

Read tutorial or look at _test.go files.

Status

The port is finished. The code works and passess all Yoga tests.

The API is awkward by Go standards but it's the best I could do given that I want to stay close to C version.

Logic is currently synced up to https://github.com/facebook/yoga/commit/f45059e1e696727c1282742b89d2c8bf06345254

How the port was made

You can read a detailed story.

In short:

  • manually ported C code to Go, line-by-line
  • manually ported tests to Go
  • tweak the API from C style to be more Go like. The structure and logic still is very close to C code (this makes porting future C changes easy)

# Functions

AlignToString returns string version of Align enum.
Baseline retuns baseline.
CalculateLayout calculates layout.
ConfigCopy copies a config.
ConfigGetDefault returns default config, only for C#.
DefaultLog is default logging function.
DimensionToString returns string version of Dimension enum.
DirectionToString returns string version of Direction enum.
DisplayToString returns string version of Display enum.
EdgeToString returns string version of Edge enum.
ExperimentalFeatureToString returns string version of ExperimentalFeature enum.
FlexDirectionToString returns string version of FlexDirection enum.
FloatIsUndefined returns true if value is undefined.
FloatsEqual returns true if floats are approx.
IsNaN reports whether f is an IEEE 754 ``not-a-number'' value.
JustifyToString returns string version of Justify enum.
LogLevelToString returns string version of LogLevel enum.
MeasureModeToString returns string version of MeasureMode enum.
NaN returns an IEEE 754 ``not-a-number'' value.
NewConfig creates new config.
NewNode creates a new node.
NewNodePrinter creates new node printer.
NewNodeWithConfig creates new node with config.
NodeCopyStyle copies style.
NodePrint prints node to standard output.
NodeStyleSetFlexBasisAuto sets flex basis auto.
NodeTypeToString returns string version of NodeType enum.
OverflowToString returns string version of Overflow enum.
PositionTypeToString returns string version of PositionType enum.
PrintOptionsToString returns string version of PrintOptions enum.
UnitToString returns string version of Unit enum.
ValueEqual returns true if values are equal.
WrapToString returns string version of Wrap enum.

# Constants

AlignAuto is "auto".
AlignBaseline is "baseline".
AlignCenter if "center".
AlignFlexEnd is "flex-end".
AlignFlexStart is "flex-start".
AlignSpaceAround is "space-around".
AlignSpaceBetween is "space-between".
AlignStretch is "strech".
DimensionHeight is height.
DimensionWidth is width.
DirectionInherit is "inherit".
DirectionLTR is "ltr".
DirectionRTL is "rtl".
DisplayFlex is "flex".
DisplayNone is "none".
EdgeAll is all edge.
EdgeBottom is bottom edge.
EdgeCount is count of edges.
EdgeEnd is end edge.
EdgeHorizontal is horizontal edge.
EdgeLeft is left edge.
EdgeRight is right edge.
EdgeStart is start edge.
EdgeTop is top edge.
EdgeVertical is vertical edge.
ExperimentalFeatureWebFlexBasis is web flex basis.
FlexDirectionColumn is "column".
FlexDirectionColumnReverse is "column-reverse".
FlexDirectionRow is "row".
FlexDirectionRowReverse is "row-reverse".
JustifyCenter is "center".
JustifyFlexEnd is "flex-end".
JustifyFlexStart is "flex-start".
JustifySpaceAround is "space-around".
JustifySpaceBetween is "space-between".
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MeasureModeAtMost is at-most.
MeasureModeExactly is exactly.
MeasureModeUndefined is undefined.
NodeTypeDefault is default node.
NodeTypeText is text node.
OverflowHidden is "hidden".
OverflowScroll is "scroll".
OverflowVisible is "visible".
PositionTypeAbsolute is "absolute".
PositionTypeRelative is "relative".
No description provided by the author
No description provided by the author
No description provided by the author
UnitAuto is "auto".
UnitPercent is "percent".
UnitPoint is "point".
UnitUndefined is "undefined".
WrapNoWrap is "no-wrap".
WrapWrap is "wrap".
WrapWrapReverse is "reverse".

# Variables

No description provided by the author
Undefined defines undefined value.
ValueAuto defines auto YGValue.
ValueUndefined defines undefined YGValue.
ValueZero defines a zero value.

# Structs

CachedMeasurement describes measurements.
Config describes a configuration.
Layout describes position information after layout is finished.
Node describes a an element.
NodePrinter node printer.
Size describes size.
Style describes CSS flexbox style of the node.
Value describes value.

# Type aliases

Align describes align flex attribute.
BaselineFunc describes function for baseline.
Dimension represents dimention.
Direction represents right-to-left or left-to-right direction.
Display is "display" property.
Edge represents an edge.
ExperimentalFeature defines experimental features.
FlexDirection describes "flex-direction" property.
Justify is "justify" property.
Logger defines logging function.
LogLevel represents log level.
MeasureFunc describes function for measuring.
MeasureMode defines measurement mode.
NodeType defines node type.
Overflow describes "overflow" property.
PositionType is "position" property.
PrintFunc defines function for printing.
No description provided by the author
Unit is "unit" property.
Wrap is "wrap" property.