README

Milky2018/css/values does not have a README file

#
AlignSelf

pub(all) enum AlignSelf {
Auto
Start
End
Center
Stretch
Baseline
} derive(Eq,
Debug
)

Align-self value (can override align-items for individual items)
impl Show for AlignSelf

#
Alignment

pub(all) enum Alignment {
Start
End
Left
Right
FlexStart
FlexEnd
Center
SpaceBetween
SpaceAround
SpaceEvenly
Stretch
Baseline
} derive(Eq,
Debug
)

Alignment for justify-content, align-items, etc.
impl Show for Alignment

#
AnimationDirection

pub(all) enum AnimationDirection {
Normal
Reverse
Alternate
AlternateReverse
} derive(Eq,
Debug
)

animation-direction value.

#
AnimationFillMode

pub(all) enum AnimationFillMode {
None
Forwards
Backwards
Both
} derive(Eq,
Debug
)

animation-fill-mode value.

#
AnimationIterationCount

pub(all) enum AnimationIterationCount {
Count(Double)
Infinite
} derive(Eq,
Debug
)

animation-iteration-count value (<number> or infinite).

#
AnimationPlayState

pub(all) enum AnimationPlayState {
Running
Paused
} derive(Eq,
Debug
)

animation-play-state value.

#
BackgroundImage

pub(all) enum BackgroundImage {
None
Gradient(LinearGradient)
} derive(Eq,
Debug
)

Background image (currently only linear-gradient)

#
BoundingRect

pub(all) struct BoundingRect {
x : Double
y : Double
width : Double
height : Double
}

BoundingRect - the output of layout computation Matches browser's getBoundingClientRect()

#
BoundingRect::area

fn BoundingRect::area(self : BoundingRect) -> Double

Calculate the area of the bounding rect

#
BoundingRect::bottom

fn BoundingRect::bottom(self : BoundingRect) -> Double

Get the bottom edge (y + height)

#
BoundingRect::new

fn BoundingRect::new(x : Double, y : Double, width : Double, height : Double) -> BoundingRect

#
BoundingRect::right

fn BoundingRect::right(self : BoundingRect) -> Double

Get the right edge (x + width)

#
BoundingRect::union

fn BoundingRect::union(self : BoundingRect, other : BoundingRect) -> BoundingRect

Calculate union of two bounding rects

#
BoundingRect::zero

#
BoxSizing

pub(all) enum BoxSizing {
ContentBox
BorderBox
} derive(Eq,
Debug
)

CSS box-sizing property
impl Show for BoxSizing

#
Clear

pub(all) enum Clear {
None
Left
Right
Both
} derive(Eq,
Debug
)

CSS clear property
impl Show for Clear

#
ClipRect

pub(all) enum ClipRect {
Auto
Rect(top~ : Double, right~ : Double, bottom~ : Double, left~ : Double)
} derive(Eq,
Debug
)

CSS clip property value clip: rect(top, right, bottom, left) or auto Note: This is a deprecated property, but still widely used for accessibility
impl Show for ClipRect

#
ClipRect::default

fn ClipRect::default() -> ClipRect

#
Color

pub(all) struct Color {
r : Int
g : Int
b : Int
a : Double
} derive(
Debug
)

RGBA color with 8-bit channels and alpha
impl Eq for Color
impl Show for Color

#
Color::black

fn Color::black() -> Color

Black color

#
Color::is_opaque

fn Color::is_opaque(self : Color) -> Bool

#
Color::is_transparent

fn Color::is_transparent(self : Color) -> Bool

#
Color::rgb

fn Color::rgb(r : Int, g : Int, b : Int) -> Color

#
Color::rgba

fn Color::rgba(r : Int, g : Int, b : Int, a : Double) -> Color

#
Color::to_hex

fn Color::to_hex(self : Color) -> String

Convert to CSS hex string (#rrggbb or #rrggbbaa)

#
Color::to_rgba_string

fn Color::to_rgba_string(self : Color) -> String

Convert to CSS rgba() string

#
Color::transparent

fn Color::transparent() -> Color

Transparent color (alpha = 0)

#
Color::white

fn Color::white() -> Color

White color

#
Dimension

pub(all) enum Dimension {
Length(Double)
Percent(Double)
Auto
MinContent
MaxContent
FitContent(Double)
Calc(Double, Double)
MathFn(MathOp, Array[(Double, Double)])
} derive(Eq,
Debug
)

CSS dimension value: length, percentage, auto, or intrinsic sizing keywords
impl Show for Dimension

#
Dimension::eq_length

fn Dimension::eq_length(self : Dimension, value : Double) -> Bool

Check if dimension equals a specific length value

#
Dimension::eq_percent

fn Dimension::eq_percent(self : Dimension, value : Double) -> Bool

Check if dimension equals a specific percent value

#
Dimension::is_definite

fn Dimension::is_definite(self : Dimension) -> Bool

Check if dimension is a definite value (Length or Percent)

#
Dimension::is_intrinsic

fn Dimension::is_intrinsic(self : Dimension) -> Bool

Check if dimension requires intrinsic sizing

#
Dimension::resolve

fn Dimension::resolve(self : Dimension, context : Double) -> Double?

Resolve dimension to concrete value context: parent size for percentage calculation Note: MinContent, MaxContent, FitContent return None - they need intrinsic size calculation

#
Dimension::resolve_or

fn Dimension::resolve_or(self : Dimension, context : Double, fallback : Double) -> Double

Resolve with fallback value for Auto

Matches self directly rather than going through resolve, which returns a Double? and so boxes a Some(..) on every call. This is on the hot layout path (every width/height/padding/margin per element, plus all four sides via resolve_rect), where the intermediate Option allocation dominated.

#
Dimension::resolve_or_intrinsic

fn Dimension::resolve_or_intrinsic(self : Dimension, context : Double, fallback : Double) -> Double

Resolve dimension to length, treating intrinsic keywords as fallback

#
Display

pub(all) enum Display {
Block
Inline
InlineBlock
Flex
InlineFlex
Grid
InlineGrid
Table
InlineTable
TableRow
TableCell
TableCaption
TableRowGroup
TableHeaderGroup
TableFooterGroup
TableColumn
TableColumnGroup
None
Contents
FlowRoot
} derive(Eq,
Debug
)

CSS display property
impl Show for Display

#
Easing

pub(all) enum Easing {
Linear
Ease
EaseIn
EaseOut
EaseInOut
EaseInSine
EaseOutSine
EaseInOutSine
EaseInQuad
EaseOutQuad
EaseInOutQuad
EaseInCubic
EaseOutCubic
EaseInOutCubic
EaseInQuart
EaseOutQuart
EaseInOutQuart
EaseInQuint
EaseOutQuint
EaseInOutQuint
EaseInExpo
EaseOutExpo
EaseInOutExpo
EaseInCirc
EaseOutCirc
EaseInOutCirc
EaseInBack
EaseOutBack
EaseInOutBack
EaseInElastic
EaseOutElastic
EaseInOutElastic
EaseInBounce
EaseOutBounce
EaseInOutBounce
LinearFunction(Array[LinearEasingPoint])
CubicBezier(Double, Double, Double, Double)
Steps(Int, StepPosition)
} derive(Eq,
Debug
)

CSS easing/timing-function value without binding it to transitions or animations. Consumers can sample it against normalized progress [0, 1].
impl Show for Easing

#
Easing::apply

fn Easing::apply(self : Easing, start_value : Double, end_value : Double, progress : Double) -> Double

Apply the easing to a numeric range at normalized progress.

#
Easing::cubic_bezier

fn Easing::cubic_bezier(x1 : Double, y1 : Double, x2 : Double, y2 : Double) -> Easing

#
Easing::frame

fn Easing::frame(self : Easing, start_value : Double, end_value : Double, progress : Double) -> EasingFrame

Build one frame with the clamped input progress, eased progress and value.

#
Easing::frames

fn Easing::frames(self : Easing, start_value : Double, end_value : Double, count : Int) -> Array[EasingFrame]

Build evenly spaced frames across the easing range. The sequence includes both endpoints when count >= 2.

#
Easing::linear

fn Easing::linear(points : Array[LinearEasingPoint]) -> Easing?

#
Easing::sample

fn Easing::sample(self : Easing, progress : Double) -> Double

Sample the easing at normalized progress. Input progress is clamped to [0, 1]; cubic-bezier output may overshoot if its Y control points do.

#
Easing::steps

fn Easing::steps(count : Int, position : StepPosition) -> Easing

#
EasingFrame

pub(all) struct EasingFrame {
progress : Double
eased_progress : Double
value : Double
}

Eased value at one point in an interpolation sequence.
impl Show for EasingFrame

#
FlexDirection

pub(all) enum FlexDirection {
Row
RowReverse
Column
ColumnReverse
} derive(Eq,
Debug
)

Flex direction

#
FlexWrap

pub(all) enum FlexWrap {
NoWrap
Wrap
WrapReverse
} derive(Eq,
Debug
)

Flex wrap mode
impl Show for FlexWrap

#
Float

pub(all) enum Float {
None
Left
Right
} derive(Eq,
Debug
)

CSS float property
impl Show for Float

#
GradientStop

pub(all) struct GradientStop {
color : Color
position : Double
} derive(Eq,
Debug
)

A color stop in a gradient

#
GridAutoFlow

pub(all) enum GridAutoFlow {
Row
Column
RowDense
ColumnDense
} derive(Eq,
Debug
)

Grid auto-flow direction

#
GridLine

pub(all) struct GridLine {
start : GridPlacement
end : GridPlacement
} derive(Eq,
Debug
)

Grid line range (start and end)
impl Show for GridLine

#
GridLine::auto

fn GridLine::auto() -> GridLine

#
GridPlacement

pub(all) enum GridPlacement {
Auto
Line(Int)
Span(Int)
Named(String)
NamedLine(Int, String)
SpanNamed(Int, String)
} derive(Eq,
Debug
)

Grid line placement for grid items

#
GridTemplateKind

pub(all) enum GridTemplateKind {
Explicit
Subgrid
Masonry
} derive(Eq,
Debug
)

Kind of a grid template axis (grid-template-columns / -rows). Explicit is the normal <track-list> (or none when the track array is empty); Subgrid / Masonry are the alternative axis values.

#
Line

pub struct Line[T] {
start : T
end : T
}

A line segment with start and end points
impl Show for Line[T]

#
Line::new

fn[T] Line::new(start : T, end : T) -> Line[T]

#
LinearEasingPoint

pub(all) struct LinearEasingPoint {
input : Double
output : Double
} derive(Eq,
Debug
)

One point in a CSS linear() easing function.

#
LinearEasingPoint::new

fn LinearEasingPoint::new(input : Double, output : Double) -> LinearEasingPoint

#
LinearGradient

pub(all) struct LinearGradient {
angle_deg : Double
stops : Array[GradientStop]
} derive(Eq,
Debug
)

Linear gradient with angle and color stops

#
MathOp

pub(all) enum MathOp {
Min
Max
Clamp
} derive(Eq,
Debug
)

CSS comparison/math function selector for min() / max() / clamp().

#
MaxTrackSizing

pub(all) enum MaxTrackSizing {
Length(Double)
Percent(Double)
Fr(Double)
Auto
MinContent
MaxContent
} derive(Eq,
Debug
)

Maximum track sizing function for minmax()

#
MinTrackSizing

pub(all) enum MinTrackSizing {
Length(Double)
Percent(Double)
Auto
MinContent
MaxContent
} derive(Eq,
Debug
)

Minimum track sizing function for minmax()

#
Overflow

pub(all) enum Overflow {
Visible
Hidden
Clip
Scroll
Auto
} derive(Eq,
Debug
)

CSS overflow property
impl Show for Overflow

#
Point

pub struct Point[T] {
x : T
y : T
}

2D point with x and y coordinates
impl Show for Point[T]

#
Point::map

fn[T, U] Point::map(self : Point[T], f : (T) -> U) -> Point[U]

#
Point::new

fn[T] Point::new(x : T, y : T) -> Point[T]

#
Point::zero

fn Point::zero() -> Point[Double]

#
Position

pub(all) enum Position {
Static
Relative
Absolute
Fixed
} derive(Eq,
Debug
)

CSS position property
impl Show for Position

#
Rect

pub(all) struct Rect[T] {
left : T
right : T
top : T
bottom : T
} derive(Eq,
Debug
)

Rectangle with left, right, top, bottom edges Used for margin, padding, border, inset
impl Show for Rect[T]

#
Rect::all

fn[T] Rect::all(value : T) -> Rect[T]

Create a rect with all sides set to the same value

#
Rect::horizontal_sum

fn Rect::horizontal_sum(self : Rect[Double]) -> Double

Sum of left and right (horizontal axis)

#
Rect::map

fn[T, U] Rect::map(self : Rect[T], f : (T) -> U) -> Rect[U]

#
Rect::new

fn[T] Rect::new(left : T, right : T, top : T, bottom : T) -> Rect[T]

#
Rect::vertical_sum

fn Rect::vertical_sum(self : Rect[Double]) -> Double

Sum of top and bottom (vertical axis)

#
Rect::zero

fn Rect::zero() -> Rect[Double]

#
RepeatCount

pub(all) enum RepeatCount {
Count(Int)
AutoFill
AutoFit
} derive(Eq,
Debug
)

Repeat count for repeat() function
impl Show for RepeatCount

#
SingleTrackSizing

pub(all) enum SingleTrackSizing {
Length(Double)
Percent(Double)
Fr(Double)
Auto
MinContent
MaxContent
MinMax(MinTrackSizing, MaxTrackSizing)
FitContentLength(Double)
FitContentPercent(Double)
} derive(Eq,
Debug
)

Single track sizing function (non-repeating)

#
Size

pub struct Size[T] {
width : T
height : T
}

2D size with width and height
impl Show for Size[T]

#
Size::map

fn[T, U] Size::map(self : Size[T], f : (T) -> U) -> Size[U]

#
Size::new

fn[T] Size::new(width : T, height : T) -> Size[T]

#
Size::zero

fn Size::zero() -> Size[Double]

#
StepPosition

pub(all) enum StepPosition {
Start
End
JumpNone
JumpBoth
} derive(Eq,
Debug
)

Step timing function jump position.

#
TrackSizingFunction

pub(all) enum TrackSizingFunction {
Length(Double)
Percent(Double)
Fr(Double)
Auto
MinContent
MaxContent
MinMax(MinTrackSizing, MaxTrackSizing)
Repeat(RepeatCount, Array[SingleTrackSizing], Array[Array[String]])
FitContentLength(Double)
FitContentPercent(Double)
} derive(Eq,
Debug
)

Track sizing function for grid-template-rows/columns

#
apply_aspect_ratio_height

fn apply_aspect_ratio_height(width : Double, aspect_ratio : Double?) -> Double?

Apply aspect ratio to calculate height from width. Returns height if aspect_ratio is defined, otherwise returns None.

#
apply_aspect_ratio_width

fn apply_aspect_ratio_width(height : Double, aspect_ratio : Double?) -> Double?

Apply aspect ratio to calculate width from height. Returns width if aspect_ratio is defined, otherwise returns None.

#
apply_math_op

fn apply_math_op(op : MathOp, vals : Array[Double]) -> Double

Apply a min()/max()/clamp() reduction over already-resolved scalar values. clamp expects exactly 3 values (lo, val, hi); other lengths fall back to the first value (or 0.0 when empty) so callers never panic on malformed input.

#
clamp

fn clamp(value : Double, min_val : Double, max_val : Double) -> Double

Clamp a value between min and max CSS spec: min takes precedence over max when they conflict So apply max first (value cannot exceed max), then min (value cannot go below min)

#
max

fn max(a : Double, b : Double) -> Double

#
min

fn min(a : Double, b : Double) -> Double

#
parse_easing

fn parse_easing(value : String) -> Easing?

Parse a CSS easing keyword or basic timing function.

#
resolve_dimensions_with_aspect_ratio

fn resolve_dimensions_with_aspect_ratio(width : Double?, height : Double?, aspect_ratio : Double?, min_width : Double, max_width : Double, min_height : Double, max_height : Double) -> (Double?, Double?)

Resolve dimensions with aspect ratio. Given known dimension (width or height), aspect_ratio, and min/max constraints, returns the final (width, height) pair.

  • If width is known, height = width / aspect_ratio
  • If height is known, width = height * aspect_ratio
  • If both are known, aspect_ratio overrides the height
  • Min/max constraints are applied after aspect ratio calculation

#
resolve_rect

fn resolve_rect(rect : Rect[Dimension], parent_width : Double) -> Rect[Double]

Resolve a Rect[Dimension] (margin/padding/border) to Rect[Double] Uses parent_width for percentage resolution (CSS spec: percentages resolve against width)

#
resolve_rect_intrinsic

fn resolve_rect_intrinsic(rect : Rect[Dimension]) -> Rect[Double]

Resolve a dimension rect for intrinsic sizing Percentages resolve to 0 in intrinsic sizing contexts