meo-canvas
    Preparing search index...

    Interface Style

    Everything a node can be styled with.

    Flat, as CSS is flat and as the Rust Style is: a reader never has to know which group gap lives in versus background. The renderer keeps the four groups because the wire format needs them separated.

    interface Style {
        alignContent?: Align;
        alignItems?: Align;
        alignSelf?: Align;
        aspectRatio?: number;
        backdropFilter?: string;
        backgroundColor?: Color;
        backgroundImage?: BackgroundImage;
        border?: Sides<number>;
        borderColor?: Sides<Color>;
        borderRadius?: Corners;
        borderStyle?: BorderStyle;
        boxShadow?: BoxShadow | readonly BoxShadow[];
        boxSizing?: BoxSizing;
        color?: Color;
        columns?: number;
        direction?: Direction;
        display?: Display;
        dither?: boolean;
        filter?: string;
        flexBasis?: Dimension;
        flexDirection?: FlexDirection;
        flexGrow?: number;
        flexShrink?: number;
        flexWrap?: FlexWrap;
        fontFamily?: string;
        fontSize?: number;
        fontStyle?: FontStyle;
        fontVariant?: readonly FontVariant[];
        fontWeight?: FontWeight;
        frame?: number;
        gap?: Length | { column?: Length | undefined; row?: Length | undefined };
        gradient?: Gradient;
        gridArea?: readonly [number, number, number, number];
        gridAutoColumns?: TrackSize;
        gridAutoFlow?: GridAutoFlow;
        gridAutoRows?: TrackSize;
        gridColumn?: GridPlacement;
        gridRow?: GridPlacement;
        gridTemplateColumns?: readonly TrackSize[];
        gridTemplateRows?: readonly TrackSize[];
        height?: Dimension;
        justifyContent?: Justify;
        letterSpacing?: Spacing;
        lineGap?: number;
        lineHeight?: LineHeight;
        margin?: Sides<Dimension>;
        mask?: Mask;
        maxHeight?: Dimension;
        maxWidth?: Dimension;
        minHeight?: Dimension;
        minWidth?: Dimension;
        mixBlendMode?: BlendMode;
        objectFit?: ObjectFit;
        objectPosition?: readonly [Length, Length];
        opacity?: number;
        overflow?: OverflowValue;
        padding?: Sides<Length>;
        paintOrder?: PaintOrder;
        position?: Sides<Length>;
        positionType?: PositionType;
        textAlign?: TextAlign;
        textDecoration?: TextDecoration;
        textShadow?: TextShadow | readonly TextShadow[];
        textStroke?: TextStroke;
        transform?: Transform;
        verticalAlign?: VerticalAlign;
        width?: Dimension;
        wordSpacing?: Spacing;
        zIndex?: number;
    }
    Index
    alignContent?: Align

    Cross-axis distribution of wrapped lines.

    alignItems?: Align

    Cross-axis placement of children.

    alignSelf?: Align

    This node's own cross-axis placement.

    aspectRatio?: number

    Width divided by height, honoured when one axis is automatic.

    backdropFilter?: string

    A CSS filter applied to what shows through this node.

    backgroundColor?: Color

    The box's fill.

    backgroundColor, as v1 spells it and as CSS names the property, and distinct from Style.color, which is the text colour. The two sit adjacent and mean different things; that is CSS's trap and keeping its names is what lets a design be ported without translation.

    backgroundImage?: BackgroundImage

    A picture painted over the gradient.

    border?: Sides<number>

    Border thickness, which occupies space whether or not it is painted.

    borderColor?: Sides<Color>

    Border colour, on every edge or per edge.

    One property, as v1 has one. The scene splits it — a fallback colour beside per-edge overrides — but that split exists for the wire format's convenience rather than the caller's, so the encoder routes the scalar form to one field and the edge form to the other and no v2-only name reaches this surface.

    borderRadius?: Corners

    Corner radii.

    borderStyle?: BorderStyle

    How the border is drawn. Defaults to 'none', which draws no border and reserves no space for one however wide Style.border is.

    One style for all four edges, where Style.border and Style.borderColor are per-edge. CSS has four border-*-style longhands and this has none, so a border drawn on three edges is spelled through the widths — border: { right: 4, bottom: 4, left: 4 } — rather than by turning one edge's style off. Measured: an omitted or zero edge draws nothing and reserves nothing, which is what 'none' does for the whole node.

    So the capability is there and the spelling is not uniform: borders come on with a style and one edge goes off with a width.

    boxShadow?: BoxShadow | readonly BoxShadow[]

    Shadows cast by the box, nearest first.

    One or many, as v1 takes them. Later shadows are drawn behind earlier ones, which is CSS's order.

    boxSizing?: BoxSizing

    Whether width and height include padding and border.

    color?: Color

    The colour glyphs are drawn in, CSS's color. Inherits.

    On an Image it is the tint an SVG source resolves currentColor against, read from the node itself rather than inherited — a browser passes a page's color into inline SVG and not into an <img>, and this is the second kind.

    So one property has two behaviours, decided by the element: it inherits into text and does not cross into an image's document. That is CSS's own rule rather than an inconsistency here, and it is the kind of thing a later reader tidies into consistency and breaks.

    It recolours a document authored for currentColor and leaves a hardcoded fill alone: an icon whose paths say fill="currentColor" takes this colour, one whose paths say fill="#000000" stays black, and neither is an error. Set on a raster source it is an error, raised when the image is drawn: a bitmap has no currentColor, and ignoring the request would be the silent wrong picture.

    Image({ src: 'star.svg', width: 40, height: 40, color: '#e8c07a' })
    
    columns?: number

    A shorthand for that many equal columns.

    v1's columns, and pure sugar: columns: 3 is gridTemplateColumns: [fr(1), fr(1), fr(1)] and reaches the renderer as exactly those tracks. Nothing new crosses the wire, which is the test of whether a shorthand is a shorthand — if it needed a slot of its own, the long form could not express it and that would be a different finding.

    Naming both this and Style.gridTemplateColumns is refused rather than resolved by precedence: a caller who wrote both meant one of them, and nothing here can tell which.

    Being sugar, it has no separate identity once it reaches the renderer, so a failure reading these tracks names gridTemplateColumns however they were written.

    direction?: Direction

    Inline direction, which decides which edge is the start.

    display?: Display

    How this node's children are arranged.

    dither?: boolean

    Whether gradients are dithered.

    filter?: string

    A CSS filter applied to this node's own drawing.

    flexBasis?: Dimension

    Size along the main axis before growing or shrinking.

    flexDirection?: FlexDirection

    The axis children run along.

    flexGrow?: number

    Share of free space this node absorbs.

    flexShrink?: number

    Share of overflow this node gives up.

    flexWrap?: FlexWrap

    Whether children overflow onto further lines.

    fontFamily?: string

    The family name text is drawn in. Inherits.

    fontSize?: number

    Em size in logical pixels. Inherits.

    fontStyle?: FontStyle

    Upright or italic. Inherits.

    fontVariant?: readonly FontVariant[]

    OpenType features applied to the run.

    Reaches the measurer as well as the painter: diagonal-fractions moves a nineteen-character sample from 220.61 to 211.04, so a feature that only reached the drawing would lay text out at one width and paint it at another.

    fontWeight?: FontWeight

    Weight from 1 to 1000. Inherits.

    frame?: number

    Which frame of an animated source to draw. Read only by an image.

    gap?: Length | { column?: Length | undefined; row?: Length | undefined }

    Space between children. One value for both axes, or each named.

    row is the gap between rows, so it separates children stacked vertically -- the axis names the gap it opens, not the direction it runs.

    Type Declaration

    • Length
    • { column?: Length | undefined; row?: Length | undefined }
      • Optional Readonlycolumn?: Length | undefined

        Space between columns, separating children placed side by side.

      • Optional Readonlyrow?: Length | undefined

        Space between rows, separating children stacked vertically.

    gradient?: Gradient

    A gradient painted over the background colour.

    One kind per geometry, each carrying only what it reads.

    gridArea?: readonly [number, number, number, number]

    Both axes at once, as CSS's grid-area orders them.

    [rowStart, columnStart, rowEnd, columnEnd], lines counting from one and the two ends exclusive — [1, 1, 3, 2] is the item covering rows 1 and 2 of column 1, which is CSS's reading of grid-area: 1 / 1 / 3 / 2. Sugar over Style.gridRow and Style.gridColumn, so it adds nothing to the wire.

    Naming this beside either of those is refused, for the reason Style.columns is.

    Adding nothing to the wire means it has no identity there either, so a failure reading a placement names gridColumn or gridRow — the axis it was reading — rather than the shorthand that supplied it.

    gridAutoColumns?: TrackSize

    Size given to columns the template does not name.

    gridAutoFlow?: GridAutoFlow

    The order auto-placement fills tracks in.

    gridAutoRows?: TrackSize

    Size given to rows the template does not name.

    gridColumn?: GridPlacement

    Where this item sits on the column axis.

    gridRow?: GridPlacement

    Where this item sits on the row axis.

    gridTemplateColumns?: readonly TrackSize[]

    The grid's column tracks.

    The CSS spelling rather than v1's templateColumns, and the rule already decides it: the names are CSS's, because someone porting a design should not have to translate. v1's shorter name was unambiguous only because its grid properties lived on a separate GridProps type; in one flat style it would sit beside padding with nothing saying which box model it belongs to. Where v1 itself diverges from the reference, the reference wins — the same clause that settled the bare container's defaults.

    gridTemplateRows?: readonly TrackSize[]

    The grid's row tracks.

    height?: Dimension

    Requested height.

    justifyContent?: Justify

    Main-axis distribution of children.

    letterSpacing?: Spacing

    Space added between characters. Inherits.

    lineGap?: number

    Extra space between lines, in pixels. Inherits.

    lineHeight?: LineHeight

    How tall a line box is. Inherits.

    A number is a multiple of the font size and is recomputed by whoever inherits it; '24px' is an absolute height and descends unchanged; '150%' is a share of this element's size, resolved here and inherited as the length it comes to. Leaving it out is CSS's normal, which is not the same as 1.

    margin?: Sides<Dimension>

    Space outside the border.

    mask?: Mask

    What of the node is drawn.

    Covers everything the node renders — background, border, content and children alike — as CSS's mask does, rather than only its contents. Applied within the node's own box, so content pushed outside by Style.transform is not masked back in.

    maxHeight?: Dimension

    Upper bound on the height.

    maxWidth?: Dimension

    Upper bound on the width.

    minHeight?: Dimension

    Lower bound on the height.

    minWidth?: Dimension

    Lower bound on the width.

    mixBlendMode?: BlendMode

    How this node composites onto what is beneath it.

    objectFit?: ObjectFit

    How an image fills its box.

    Read only by an image, as CSS's object-fit applies to replaced elements and is inert on everything else.

    objectPosition?: readonly [Length, Length]

    Where the image sits in its box when it does not fill it.

    CSS's object-position, as a horizontal and a vertical offset. Absent centres it, which is CSS's own initial value and what the Rust surface writes. Read only by an image.

    opacity?: number

    Opacity of this node and its subtree, from 0 to 1.

    overflow?: OverflowValue

    Clipping behaviour, on both axes.

    padding?: Sides<Length>

    Space inside the border.

    paintOrder?: PaintOrder

    Which of a glyph's fill and stroke is on top. Inherits.

    position?: Sides<Length>

    Offsets from the container's edges.

    positionType?: PositionType

    Whether the node is placed by the flow or by its own offsets.

    positionType, not position: v1 spells the offsets position, so the two would collide. A caller porting a v1 tree writes both and neither means the other.

    textAlign?: TextAlign

    How lines sit within the text box. Inherits.

    textDecoration?: TextDecoration

    A line through, over or under. Inherits.

    textShadow?: TextShadow | readonly TextShadow[]

    Shadows cast by the glyphs, nearest first.

    Distinct from Style.boxShadow: this follows the letterforms and that follows the border box.

    textStroke?: TextStroke

    An outline drawn along the glyph edges. Inherits.

    transform?: Transform

    Moves, turns and scales the node after it is laid out.

    Applied about Transform.originX and Transform.originY, which default to the middle of the box. Layout does not see it: a transformed node still occupies the space it was given, as CSS's transform does.

    verticalAlign?: VerticalAlign

    Where a line sits within its box. Inherits.

    width?: Dimension

    Requested width.

    wordSpacing?: Spacing

    Space added between words. Inherits.

    zIndex?: number

    Paint order among positioned siblings.