Documentation ¶
Index ¶
- Constants
- Variables
- func AlignToString(value Align) string
- func Baseline(node *Node) float32
- func CalculateLayout(node *Node, parentWidth float32, parentHeight float32, ...)
- func ConfigCopy(dest *Config, src *Config)
- func DefaultLog(config *Config, node *Node, level LogLevel, format string, args ...interface{}) int
- func DimensionToString(value Dimension) string
- func DirectionToString(value Direction) string
- func DisplayToString(value Display) string
- func EdgeToString(value Edge) string
- func ExperimentalFeatureToString(value ExperimentalFeature) string
- func FlexDirectionToString(value FlexDirection) string
- func FloatIsUndefined(value float32) bool
- func FloatsEqual(a float32, b float32) bool
- func IsNaN(f float32) (is bool)
- func JustifyToString(value Justify) string
- func LogLevelToString(value LogLevel) string
- func MeasureModeToString(value MeasureMode) string
- func NaN() float32
- func NodeCopyStyle(dstNode *Node, srcNode *Node)
- func NodePrint(node *Node, options PrintOptions)
- func NodeStyleSetFlexBasisAuto(node *Node)
- func NodeTypeToString(value NodeType) string
- func OverflowToString(value Overflow) string
- func PositionTypeToString(value PositionType) string
- func PrintOptionsToString(value PrintOptions) string
- func UnitToString(value Unit) string
- func ValueEqual(a Value, b Value) bool
- func WrapToString(value Wrap) string
- type Align
- type BaselineFunc
- type CachedMeasurement
- type Config
- type Dimension
- type Direction
- type Display
- type Edge
- type ExperimentalFeature
- type FlexDirection
- type Justify
- type Layout
- type LogLevel
- type Logger
- type MeasureFunc
- type MeasureMode
- type Node
- func (node *Node) GetChild(idx int) *Node
- func (node *Node) InsertChild(child *Node, idx int)
- func (node *Node) LayoutGetBorder(edge Edge) float32
- func (node *Node) LayoutGetBottom() float32
- func (node *Node) LayoutGetHeight() float32
- func (node *Node) LayoutGetLeft() float32
- func (node *Node) LayoutGetMargin(edge Edge) float32
- func (node *Node) LayoutGetPadding(edge Edge) float32
- func (node *Node) LayoutGetRight() float32
- func (node *Node) LayoutGetTop() float32
- func (node *Node) LayoutGetWidth() float32
- func (node *Node) MarkDirty()
- func (node *Node) RemoveChild(child *Node)
- func (node *Node) Reset()
- func (node *Node) SetMeasureFunc(measureFunc MeasureFunc)
- func (node *Node) StyleGetBorder(edge Edge) float32
- func (node *Node) StyleGetFlexGrow() float32
- func (node *Node) StyleGetFlexShrink() float32
- func (node *Node) StyleGetHeight() Value
- func (node *Node) StyleGetMargin(edge Edge) Value
- func (node *Node) StyleGetMaxHeight() Value
- func (node *Node) StyleGetMaxWidth() Value
- func (node *Node) StyleGetMinHeight() Value
- func (node *Node) StyleGetMinWidth() Value
- func (node *Node) StyleGetPadding(edge Edge) Value
- func (node *Node) StyleGetPosition(edge Edge) Value
- func (node *Node) StyleGetWidth() Value
- func (node *Node) StyleSetAlignContent(alignContent Align)
- func (node *Node) StyleSetAlignItems(alignItems Align)
- func (node *Node) StyleSetAlignSelf(alignSelf Align)
- func (node *Node) StyleSetAspectRatio(aspectRatio float32)
- func (node *Node) StyleSetBorder(edge Edge, border float32)
- func (node *Node) StyleSetDirection(direction Direction)
- func (node *Node) StyleSetDisplay(display Display)
- func (node *Node) StyleSetFlex(flex float32)
- func (node *Node) StyleSetFlexBasis(flexBasis float32)
- func (node *Node) StyleSetFlexBasisPercent(flexBasis float32)
- func (node *Node) StyleSetFlexDirection(flexDirection FlexDirection)
- func (node *Node) StyleSetFlexGrow(flexGrow float32)
- func (node *Node) StyleSetFlexShrink(flexShrink float32)
- func (node *Node) StyleSetFlexWrap(flexWrap Wrap)
- func (node *Node) StyleSetHeight(height float32)
- func (node *Node) StyleSetHeightAuto()
- func (node *Node) StyleSetHeightPercent(height float32)
- func (node *Node) StyleSetJustifyContent(justifyContent Justify)
- func (node *Node) StyleSetMargin(edge Edge, margin float32)
- func (node *Node) StyleSetMarginAuto(edge Edge)
- func (node *Node) StyleSetMarginPercent(edge Edge, margin float32)
- func (node *Node) StyleSetMaxHeight(maxHeight float32)
- func (node *Node) StyleSetMaxHeightPercent(maxHeight float32)
- func (node *Node) StyleSetMaxWidth(maxWidth float32)
- func (node *Node) StyleSetMaxWidthPercent(maxWidth float32)
- func (node *Node) StyleSetMinHeight(minHeight float32)
- func (node *Node) StyleSetMinHeightPercent(minHeight float32)
- func (node *Node) StyleSetMinWidth(minWidth float32)
- func (node *Node) StyleSetMinWidthPercent(minWidth float32)
- func (node *Node) StyleSetOverflow(overflow Overflow)
- func (node *Node) StyleSetPadding(edge Edge, padding float32)
- func (node *Node) StyleSetPaddingPercent(edge Edge, padding float32)
- func (node *Node) StyleSetPosition(edge Edge, position float32)
- func (node *Node) StyleSetPositionPercent(edge Edge, position float32)
- func (node *Node) StyleSetPositionType(positionType PositionType)
- func (node *Node) StyleSetWidth(width float32)
- func (node *Node) StyleSetWidthAuto()
- func (node *Node) StyleSetWidthPercent(width float32)
- type NodePrinter
- type NodeType
- type Overflow
- type PositionType
- type PrintFunc
- type PrintOptions
- type Size
- type Style
- type Unit
- type Value
- type Wrap
Constants ¶
const (
// EdgeCount is count of edges
EdgeCount = 9
)
Variables ¶
var ( // ValueUndefined defines undefined YGValue ValueUndefined = Value{Undefined, UnitUndefined} // ValueAuto defines auto YGValue ValueAuto = Value{Undefined, UnitAuto} )
var (
NAN = math.Float32frombits(uvnan)
)
var ( // Undefined defines undefined value Undefined = NAN )
var ( // ValueZero defines a zero value ValueZero = Value{Value: 0, Unit: UnitPoint} )
Functions ¶
func AlignToString ¶
AlignToString returns string version of Align enum
func CalculateLayout ¶
func CalculateLayout(node *Node, parentWidth float32, parentHeight float32, parentDirection Direction)
CalculateLayout calculates layout
func DefaultLog ¶
DefaultLog is default logging function
func DimensionToString ¶
DimensionToString returns string version of Dimension enum
func DirectionToString ¶
DirectionToString returns string version of Direction enum
func DisplayToString ¶
DisplayToString returns string version of Display enum
func EdgeToString ¶
EdgeToString returns string version of Edge enum
func ExperimentalFeatureToString ¶
func ExperimentalFeatureToString(value ExperimentalFeature) string
ExperimentalFeatureToString returns string version of ExperimentalFeature enum
func FlexDirectionToString ¶
func FlexDirectionToString(value FlexDirection) string
FlexDirectionToString returns string version of FlexDirection enum
func FloatIsUndefined ¶
FloatIsUndefined returns true if value is undefined
func FloatsEqual ¶
FloatsEqual returns true if floats are approx. equal
func JustifyToString ¶
JustifyToString returns string version of Justify enum
func LogLevelToString ¶
LogLevelToString returns string version of LogLevel enum
func MeasureModeToString ¶
func MeasureModeToString(value MeasureMode) string
MeasureModeToString returns string version of MeasureMode enum
func NodePrint ¶
func NodePrint(node *Node, options PrintOptions)
NodePrint prints node to standard output.
func NodeStyleSetFlexBasisAuto ¶
func NodeStyleSetFlexBasisAuto(node *Node)
NodeStyleSetFlexBasisAuto sets flex basis auto
func NodeTypeToString ¶
NodeTypeToString returns string version of NodeType enum
func OverflowToString ¶
OverflowToString returns string version of Overflow enum
func PositionTypeToString ¶
func PositionTypeToString(value PositionType) string
PositionTypeToString returns string version of PositionType enum
func PrintOptionsToString ¶
func PrintOptionsToString(value PrintOptions) string
PrintOptionsToString returns string version of PrintOptions enum
func UnitToString ¶
UnitToString returns string version of Unit enum
func ValueEqual ¶
ValueEqual returns true if values are equal
func WrapToString ¶
WrapToString returns string version of Wrap enum
Types ¶
type Align ¶
type Align int
Align describes align flex attribute
const ( // AlignAuto is "auto" AlignAuto Align = iota // AlignFlexStart is "flex-start" AlignFlexStart // AlignCenter if "center" AlignCenter // AlignFlexEnd is "flex-end" AlignFlexEnd // AlignStretch is "strech" AlignStretch // AlignBaseline is "baseline" AlignBaseline // AlignSpaceBetween is "space-between" AlignSpaceBetween // AlignSpaceAround is "space-around" AlignSpaceAround )
type BaselineFunc ¶
BaselineFunc describes function for baseline
type CachedMeasurement ¶
type CachedMeasurement struct {
// contains filtered or unexported fields
}
CachedMeasurement describes measurements
type Config ¶
type Config struct { UseWebDefaults bool UseLegacyStretchBehaviour bool PointScaleFactor float32 Logger Logger Context interface{} // contains filtered or unexported fields }
Config describes a configuration
func ConfigGetDefault ¶
func ConfigGetDefault() *Config
ConfigGetDefault returns default config, only for C#
func (*Config) IsExperimentalFeatureEnabled ¶
func (config *Config) IsExperimentalFeatureEnabled(feature ExperimentalFeature) bool
IsExperimentalFeatureEnabled returns if experimental feature is enabled
func (*Config) SetExperimentalFeatureEnabled ¶
func (config *Config) SetExperimentalFeatureEnabled(feature ExperimentalFeature, enabled bool)
SetExperimentalFeatureEnabled enables experimental feature
func (*Config) SetPointScaleFactor ¶
SetPointScaleFactor sets scale factor
type Edge ¶
type Edge int
Edge represents an edge
const ( // EdgeLeft is left edge EdgeLeft Edge = iota // EdgeTop is top edge EdgeTop // EdgeRight is right edge EdgeRight // EdgeBottom is bottom edge EdgeBottom // EdgeStart is start edge EdgeStart // EdgeEnd is end edge EdgeEnd // EdgeHorizontal is horizontal edge EdgeHorizontal // EdgeVertical is vertical edge EdgeVertical // EdgeAll is all edge EdgeAll )
type ExperimentalFeature ¶
type ExperimentalFeature int
ExperimentalFeature defines experimental features
const ( // ExperimentalFeatureWebFlexBasis is web flex basis ExperimentalFeatureWebFlexBasis ExperimentalFeature = iota )
type FlexDirection ¶
type FlexDirection int
FlexDirection describes "flex-direction" property
const ( // FlexDirectionColumn is "column" FlexDirectionColumn FlexDirection = iota // FlexDirectionColumnReverse is "column-reverse" FlexDirectionColumnReverse // FlexDirectionRow is "row" FlexDirectionRow // FlexDirectionRowReverse is "row-reverse" FlexDirectionRowReverse )
type Layout ¶
type Layout struct { Position [4]float32 Dimensions [2]float32 Margin [6]float32 Border [6]float32 Padding [6]float32 Direction Direction HadOverflow bool // contains filtered or unexported fields }
Layout describes position information after layout is finished
type Logger ¶
type Logger func(config *Config, node *Node, level LogLevel, format string, args ...interface{}) int
Logger defines logging function
type MeasureFunc ¶
type MeasureFunc func(node *Node, width float32, widthMode MeasureMode, height float32, heightMode MeasureMode) Size
MeasureFunc describes function for measuring
type MeasureMode ¶
type MeasureMode int
MeasureMode defines measurement mode
const ( // MeasureModeUndefined is undefined MeasureModeUndefined MeasureMode = iota // MeasureModeExactly is exactly MeasureModeExactly // MeasureModeAtMost is at-most MeasureModeAtMost )
type Node ¶
type Node struct { Style Style Layout Layout Parent *Node Children []*Node NextChild *Node Measure MeasureFunc Baseline BaselineFunc Print PrintFunc Config *Config Context interface{} IsDirty bool NodeType NodeType // contains filtered or unexported fields }
Node describes a an element
func NewNodeWithConfig ¶
NewNodeWithConfig creates new node with config
func (*Node) InsertChild ¶
InsertChild inserts a child
func (*Node) LayoutGetBorder ¶
LayoutGetBorder gets border
func (*Node) LayoutGetBottom ¶
LayoutGetBottom gets bottom
func (*Node) LayoutGetHeight ¶
LayoutGetHeight gets height
func (*Node) LayoutGetMargin ¶
LayoutGetMargin gets margin
func (*Node) LayoutGetPadding ¶
LayoutGetPadding gets padding
func (*Node) RemoveChild ¶
RemoveChild removes child node
func (*Node) SetMeasureFunc ¶
func (node *Node) SetMeasureFunc(measureFunc MeasureFunc)
SetMeasureFunc sets measure function
func (*Node) StyleGetBorder ¶
StyleGetBorder gets border
func (*Node) StyleGetFlexGrow ¶
StyleGetFlexGrow gets flex grow
func (*Node) StyleGetFlexShrink ¶
StyleGetFlexShrink gets flex shrink
func (*Node) StyleGetMargin ¶
StyleGetMargin gets margin
func (*Node) StyleGetMaxHeight ¶
StyleGetMaxHeight gets max height
func (*Node) StyleGetMaxWidth ¶
StyleGetMaxWidth gets max width
func (*Node) StyleGetMinHeight ¶
StyleGetMinHeight gets min height
func (*Node) StyleGetMinWidth ¶
StyleGetMinWidth gets min width
func (*Node) StyleGetPadding ¶
StyleGetPadding gets padding
func (*Node) StyleGetPosition ¶
StyleGetPosition gets position
func (*Node) StyleSetAlignContent ¶
StyleSetAlignContent sets align content
func (*Node) StyleSetAlignItems ¶
StyleSetAlignItems sets align content
func (*Node) StyleSetAlignSelf ¶
StyleSetAlignSelf sets align self
func (*Node) StyleSetAspectRatio ¶
StyleSetAspectRatio sets axpect ratio
func (*Node) StyleSetBorder ¶
StyleSetBorder sets border
func (*Node) StyleSetDirection ¶
StyleSetDirection sets direction
func (*Node) StyleSetDisplay ¶
StyleSetDisplay sets display
func (*Node) StyleSetFlexBasis ¶
StyleSetFlexBasis sets flex basis
func (*Node) StyleSetFlexBasisPercent ¶
StyleSetFlexBasisPercent sets flex basis percent
func (*Node) StyleSetFlexDirection ¶
func (node *Node) StyleSetFlexDirection(flexDirection FlexDirection)
StyleSetFlexDirection sets flex directions
func (*Node) StyleSetFlexGrow ¶
StyleSetFlexGrow sets flex grow
func (*Node) StyleSetFlexShrink ¶
StyleSetFlexShrink sets flex shrink
func (*Node) StyleSetFlexWrap ¶
StyleSetFlexWrap sets flex wrap
func (*Node) StyleSetHeight ¶
StyleSetHeight sets height
func (*Node) StyleSetHeightAuto ¶
func (node *Node) StyleSetHeightAuto()
StyleSetHeightAuto sets height auto
func (*Node) StyleSetHeightPercent ¶
StyleSetHeightPercent sets height percent
func (*Node) StyleSetJustifyContent ¶
StyleSetJustifyContent sets justify content
func (*Node) StyleSetMargin ¶
StyleSetMargin sets margin
func (*Node) StyleSetMarginAuto ¶
StyleSetMarginAuto sets margin auto
func (*Node) StyleSetMarginPercent ¶
StyleSetMarginPercent sets margin percent
func (*Node) StyleSetMaxHeight ¶
StyleSetMaxHeight sets max width
func (*Node) StyleSetMaxHeightPercent ¶
StyleSetMaxHeightPercent sets max height percent
func (*Node) StyleSetMaxWidth ¶
StyleSetMaxWidth sets max width
func (*Node) StyleSetMaxWidthPercent ¶
StyleSetMaxWidthPercent sets max width percent
func (*Node) StyleSetMinHeight ¶
StyleSetMinHeight sets min width
func (*Node) StyleSetMinHeightPercent ¶
StyleSetMinHeightPercent sets min height percent
func (*Node) StyleSetMinWidth ¶
StyleSetMinWidth sets min width
func (*Node) StyleSetMinWidthPercent ¶
StyleSetMinWidthPercent sets width percent
func (*Node) StyleSetOverflow ¶
StyleSetOverflow sets overflow
func (*Node) StyleSetPadding ¶
StyleSetPadding sets padding
func (*Node) StyleSetPaddingPercent ¶
StyleSetPaddingPercent sets padding percent
func (*Node) StyleSetPosition ¶
StyleSetPosition sets position
func (*Node) StyleSetPositionPercent ¶
StyleSetPositionPercent sets position percent
func (*Node) StyleSetPositionType ¶
func (node *Node) StyleSetPositionType(positionType PositionType)
StyleSetPositionType sets position type
func (*Node) StyleSetWidth ¶
StyleSetWidth sets width
func (*Node) StyleSetWidthAuto ¶
func (node *Node) StyleSetWidthAuto()
StyleSetWidthAuto sets width auto
func (*Node) StyleSetWidthPercent ¶
StyleSetWidthPercent sets width percent
type NodePrinter ¶
type NodePrinter struct {
// contains filtered or unexported fields
}
NodePrinter node printer.
func NewNodePrinter ¶
func NewNodePrinter(writer io.Writer, options PrintOptions) *NodePrinter
NewNodePrinter creates new node printer.
type PositionType ¶
type PositionType int
PositionType is "position" property
const ( // PositionTypeRelative is "relative" PositionTypeRelative PositionType = iota // PositionTypeAbsolute is "absolute" PositionTypeAbsolute )
type PrintOptions ¶
type PrintOptions int
const ( PrintOptionsLayout PrintOptions = 1 << iota PrintOptionsStyle PrintOptionsChildren )
type Style ¶
type Style struct { Direction Direction FlexDirection FlexDirection JustifyContent Justify AlignContent Align AlignItems Align AlignSelf Align PositionType PositionType FlexWrap Wrap Overflow Overflow Display Display Flex float32 FlexGrow float32 FlexShrink float32 FlexBasis Value Margin [EdgeCount]Value Position [EdgeCount]Value Padding [EdgeCount]Value Border [EdgeCount]Value Dimensions [2]Value MinDimensions [2]Value MaxDimensions [2]Value // Yoga specific properties, not compatible with flexbox specification AspectRatio float32 }
Style describes CSS flexbox style of the node