Sign in

    mizchi/crater/types does not have a README file

    AlignSelf

    pub(all) enum AlignSelf {
    Auto
    Start
    End
    Center
    Stretch
    Baseline
    }

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

    Alignment

    pub(all) enum Alignment {
    Start
    End
    FlexStart
    FlexEnd
    Center
    SpaceBetween
    SpaceAround
    SpaceEvenly
    Stretch
    Baseline
    }

    Alignment for justify-content, align-items, etc. Note: Start/End are physical/logical directions (not affected by flex-wrap direction) FlexStart/FlexEnd are flex-relative (affected by wrap-reverse)
    impl Eq for Alignment
    impl Show for Alignment

    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
    }

    CSS box-sizing property
    impl Eq for BoxSizing
    impl Show for BoxSizing

    Clear

    pub(all) enum Clear {
    None
    Left
    Right
    Both
    }

    CSS clear property
    impl Eq for Clear
    impl Show for Clear

    ClipRect

    pub(all) enum ClipRect {
    Auto
    Rect(Double, Double, Double, Double)
    }

    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 Eq for ClipRect
    impl Show for ClipRect

    ClipRect::default

    fn ClipRect::default() -> ClipRect

    Color

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

    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)
    }

    CSS dimension value: length, percentage, auto, or intrinsic sizing keywords
    impl Eq for Dimension
    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

    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
    }

    CSS display property
    impl Eq for Display
    impl Show for Display

    FlexDirection

    pub(all) enum FlexDirection {
    Row
    RowReverse
    Column
    ColumnReverse
    }

    Flex direction
    impl Eq for FlexDirection

    FlexWrap

    pub(all) enum FlexWrap {
    NoWrap
    Wrap
    WrapReverse
    }

    Flex wrap mode
    impl Eq for FlexWrap
    impl Show for FlexWrap

    Float

    pub(all) enum Float {
    None
    Left
    Right
    }

    CSS float property
    impl Eq for Float
    impl Show for Float

    GridAutoFlow

    pub(all) enum GridAutoFlow {
    Row
    Column
    RowDense
    ColumnDense
    }

    Grid auto-flow direction
    impl Eq for GridAutoFlow

    GridLine

    pub(all) struct GridLine {
    start : GridPlacement
    end : GridPlacement
    }

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

    GridLine::auto

    fn GridLine::auto() -> GridLine

    GridPlacement

    pub(all) enum GridPlacement {
    Auto
    Line(Int)
    Span(Int)
    }

    Grid line placement for grid items
    impl Eq for GridPlacement

    IntrinsicSize

    pub(all) struct IntrinsicSize {
    min_width : Double
    max_width : Double
    min_height : Double
    max_height : Double
    }

    Intrinsic size measurement result

    IntrinsicSize::default

    fn IntrinsicSize::default() -> IntrinsicSize

    Default intrinsic size for leaf nodes without measure function Matches Taffy behavior: empty/unmeasured nodes have zero intrinsic size

    Layout

    pub(all) struct Layout {
    id : String
    x : Double
    y : Double
    width : Double
    height : Double
    margin : Rect[Double]
    padding : Rect[Double]
    border : Rect[Double]
    overflow_x : Overflow
    overflow_y : Overflow
    scroll_width : Double
    scroll_height : Double
    children : Array[Layout]
    text : String?
    }

    Complete layout result for a node

    Layout::to_bounding_rect

    fn Layout::to_bounding_rect(self : Layout) -> BoundingRect

    LayoutContext

    pub(all) struct LayoutContext {
    available_width : Double
    available_height : Double?
    sizing_mode : SizingMode
    viewport_width : Double
    viewport_height : Double
    stretch_width : Bool
    stretch_height : Bool
    }

    Context for layout computation

    LayoutResult

    pub(all) struct LayoutResult {
    layout : Layout
    warnings : Array[LayoutWarning]
    }

    Result of layout computation with warnings

    LayoutWarning

    pub(all) enum LayoutWarning {
    UnsupportedFloat(String)
    UnsupportedPosition(String)
    UnsupportedDisplay(String)
    }

    Warnings emitted during layout computation

    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]

    MaxTrackSizing

    pub(all) enum MaxTrackSizing {
    Length(Double)
    Percent(Double)
    Fr(Double)
    Auto
    MinContent
    MaxContent
    }

    Maximum track sizing function for minmax()

    MeasureFunc

    pub(all) struct MeasureFunc {
    func : (Double, Double) -> IntrinsicSize
    }

    Measure function type - called to determine intrinsic size of a node Parameters: (available_width, available_height) -> IntrinsicSize

    MinTrackSizing

    pub(all) enum MinTrackSizing {
    Length(Double)
    Percent(Double)
    Auto
    MinContent
    MaxContent
    }

    Minimum track sizing function for minmax()

    Overflow

    pub(all) enum Overflow {
    Visible
    Hidden
    Clip
    Scroll
    Auto
    }

    CSS overflow property
    impl Eq for Overflow
    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
    }

    CSS position property
    impl Eq for Position
    impl Show for Position

    Rect

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

    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
    }

    Repeat count for repeat() function
    impl Eq for RepeatCount
    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)
    }

    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]

    SizingMode

    pub(all) enum SizingMode {
    Definite
    MaxContent
    }

    Sizing mode for layout computation Definite: Use available space (normal flow) MaxContent: Use intrinsic max-content (shrink-to-fit)
    impl Eq for SizingMode

    TrackSizingFunction

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

    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.

    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

    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