crater-core

Layout output types (Layout, LayoutResult, LayoutContext, MeasureFunc, ...) and Node tree for crater. Depends on mizchi/css for value types.

moon add mizchi/crater-core@0.19.0
Download zip
Author
Version
0.19.0
License
Apache-2.0
Last updated
last month
Downloads
3K

Dependencies

README

mizchi/crater-core does not have a README file

#
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

#
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)
} derive(
Debug
)

Warnings emitted during layout computation

#
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

#
SizingMode

pub(all) enum SizingMode {
Definite
MaxContent
} derive(Eq)

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

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io