Sign in

    mizchi/crater-css/computed does not have a README file

    ComputeContext

    pub(all) struct ComputeContext {
    parent_style :
    Style
    ?
    root_font_size : Double
    font_size : Double
    viewport_width : Double
    viewport_height : Double
    custom_properties : Map[String, String]
    }

    Computed values context for resolving relative units

    ComputeContext::new

    ComputeContext::with_parent

    ComputeContext::with_parent_and_vars

    fn ComputeContext::with_parent_and_vars(parent :
    Style
    , parent_vars : Map[String, String]) -> ComputeContext

    Create context with parent style and inherited custom properties

    ComputeContext::with_viewport

    fn ComputeContext::with_viewport(viewport_width : Double, viewport_height : Double) -> ComputeContext

    Create context with custom viewport dimensions

    CssColorValue

    pub(all) enum CssColorValue {
    Resolved(
    Color
    )
    CurrentColor
    Inherit
    }

    Result of parsing a CSS color value

    CssColorValue::get_color

    CssColorValue::is_resolved

    fn CssColorValue::is_resolved(self : CssColorValue) -> Bool

    apply_property_direct

    fn apply_property_direct(style :
    Style
    , property : String, value : String, ctx : ComputeContext) ->
    Style

    Apply a single CSS property to an existing style directly This skips the CSS string parsing step for better performance

    compute

    Compute a Style from cascaded values

    compute_inline

    fn compute_inline(inline_css : String, ctx : ComputeContext) ->
    Style

    Compute style from inline style string This is the standard function that applies box-sizing adjustment.

    compute_inline_raw

    fn compute_inline_raw(inline_css : String, ctx : ComputeContext) ->
    Style

    Compute style from inline style string (raw, without box-sizing adjustment) Use this when merging individual properties into an existing style. The caller is responsible for calling adjust_for_box_sizing on the final result.

    compute_with_vars

    Compute a Style and return updated custom properties Used when building a style tree to pass custom properties to children

    default_background_color

    fn default_background_color() ->
    Color

    Default color for background (transparent)

    default_color

    Default color for text (black)

    extract_border_width

    fn extract_border_width(value : String) ->
    Dimension

    Extract border width from shorthand value Handles formats like "3px", "solid 3px", "1px solid red", "none", etc.

    initial_value

    fn initial_value(property : String) -> String

    Get the initial value for a property as a string

    is_grid_area_name

    fn is_grid_area_name(value : String) -> Bool

    Check if a value is a named grid area identifier (not a number, auto, or span keyword)

    is_inherited

    fn is_inherited(property : String) -> Bool

    Whether a property is inherited by default

    parse_align_self

    fn parse_align_self(value : String) ->
    AlignSelf

    Parse align-self value

    parse_alignment

    fn parse_alignment(value : String) ->
    Alignment

    parse_alignment_with_overflow

    fn parse_alignment_with_overflow(value : String) -> (
    Alignment
    , Bool)

    Parse alignment value (justify-content, align-items, align-content) Note: flex-start/flex-end are flex-relative (affected by wrap-reverse) start/end are physical/logical (not affected by wrap-reverse)

    parse_aspect_ratio

    fn parse_aspect_ratio(value : String) -> Double?

    Parse aspect-ratio value

    parse_clear

    fn parse_clear(value : String) ->
    Clear

    Parse clear value

    parse_clear_with_direction

    fn parse_clear_with_direction(value : String, direction :
    Direction
    ) ->
    Clear

    parse_clip

    fn parse_clip(value : String) ->
    ClipRect

    Parse CSS clip property value Supports: auto, rect(top, right, bottom, left) Note: This is a deprecated property but widely used for accessibility

    parse_color

    fn parse_color(value : String) -> CssColorValue

    Parse a CSS color value (legacy - uses fallback only for var())

    parse_color_with_ctx

    fn parse_color_with_ctx(value : String, ctx : ComputeContext) -> CssColorValue

    Parse a CSS color value with context for proper var() resolution

    parse_dimension

    fn parse_dimension(value : String) ->
    Dimension

    Parse a dimension value from string

    parse_direction

    fn parse_direction(value : String) ->
    Direction

    Parse direction value (ltr/rtl)

    parse_display

    fn parse_display(value : String) ->
    Display

    Parse display value

    parse_flex_direction

    fn parse_flex_direction(value : String) ->
    FlexDirection

    Parse flex-direction value

    parse_flex_wrap

    fn parse_flex_wrap(value : String) ->
    FlexWrap

    Parse flex-wrap value

    parse_float

    fn parse_float(value : String) ->
    Float

    Parse float value

    parse_float_with_direction

    fn parse_float_with_direction(value : String, direction :
    Direction
    ) ->
    Float

    parse_grid_auto_flow

    fn parse_grid_auto_flow(value : String) ->
    GridAutoFlow

    Parse grid-auto-flow value

    parse_grid_line_shorthand

    Parse grid-column or grid-row shorthand Formats: , / , / span

    parse_grid_placement

    fn parse_grid_placement(value : String) ->
    GridPlacement

    Parse a grid placement value (for grid-column-start, grid-row-end, etc.) Supports: auto, , span

    parse_grid_template_areas_value

    fn parse_grid_template_areas_value(value : String) -> Array[String]

    Parse grid-template-areas CSS property value. The value is a series of quoted strings like: "header header" "sidebar main" "footer footer"

    parse_grid_template_shorthand

    Parse grid-template shorthand: <rows> / <columns>

    parse_grid_template_tracks

    fn parse_grid_template_tracks(value : String) -> Array[
    TrackSizingFunction
    ]

    Parse grid-template-columns or grid-template-rows value Delegate to the full parser to support minmax() and repeat().

    parse_integer

    fn parse_integer(value : String) -> Int

    Parse an integer value

    parse_linear_gradient

    fn parse_linear_gradient(value : String) ->
    BackgroundImage

    Parse a linear-gradient() value into a LinearGradient

    parse_number

    fn parse_number(value : String) -> Double

    Parse a number value

    parse_overflow

    fn parse_overflow(value : String) ->
    Overflow

    Parse overflow value

    parse_place_content

    Parse place-content shorthand. Returns (align_content, justify_content).

    parse_place_content_with_overflow

    fn parse_place_content_with_overflow(value : String) -> ((
    Alignment
    , Bool), (
    Alignment
    , Bool))?

    Parse place-content shorthand. Returns (align_content, justify_content).

    parse_position

    fn parse_position(value : String) ->
    Position

    Parse position value

    parse_scroll_snap_align

    Parse scroll-snap-align value as (inline, block). Supports keywords: none | start | end | center.

    parse_scroll_snap_type

    fn parse_scroll_snap_type(value : String) ->
    ScrollSnapType

    Parse scroll-snap-type value Supports a minimal subset: none | x mandatory | y mandatory | both mandatory.

    parse_text_align

    fn parse_text_align(value : String) ->
    TextAlign

    Parse text-align value

    parse_white_space

    fn parse_white_space(value : String) ->
    WhiteSpace

    Parse white-space value

    parse_writing_mode

    fn parse_writing_mode(value : String) ->
    WritingMode

    Parse writing-mode value

    resolve_current_color

    Resolve currentColor using parent's color

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io