ResolvedStyle Struct

Platform Contract

#include <vortex/vstyle.h>

Public Members

std::string fill
bool fillIsGradient { false }
std::string borderFill
bool borderIsGradient { false }
double borderThickness { 0 }
double radiusTL { 0 }
double radiusTR { 0 }
double radiusBL { 0 }
double radiusBR { 0 }
std::string textColor
double marginL { 0 }
double marginT { 0 }
double marginR { 0 }
double marginB { 0 }
double paddingL { 0 }
double paddingT { 0 }
double paddingR { 0 }
double paddingB { 0 }
std::string fontFamily
double fontSize { 0 }
double fontWeight { 0 }
std::string direction
std::string crossAlign
std::string justify
std::string scroll
double spacing { 0 }
double grow { 0 }
double shrink { -1 }
double width { 0 }
double height { 0 }
double maxWidth { 0 }
double aspectRatio { 0 }
double opacity { 1.0 }
bool visible { true }
bool collapsed { false }
double translateX { 0 }
double translateY { 0 }
double rotation { 0 }
std::string intent
std::string overlay
bool secret { false }
bool multiline { false }
bool readOnly { false }
bool wrap { true }
std::string fit
bool autoplay { false }
bool loop { false }
bool muted { false }
bool controls { false }
std::string text
std::string placeholder
std::string iconSource
std::string mediaSource
std::string qrData
std::string href
std::string tag
std::string anchor
std::string bind
double heightVp { 0 }
std::string codeBg

Detailed Description

Style values resolved for a single node, ready for a reconciler to apply to its native widget.

resolve_style() reads the attributes of a node's style for the active states and stores the winning values here, so reconcilers never read .lyr files themselves. Each RenderNode carries one as its style. A member that neither the style nor its bases set keeps the default shown in its declaration.

Colors are hex strings ("#rrggbb" or "#aarrggbb"). A fill can instead be a gradient of two stops, each a position and a color, which is stored as the comma-joined stops with fillIsGradient (or borderIsGradient) set:

Fill.Start: 0                   // fill = "0:#3a3c42,1:#42454d"
Fill.Start Color: "#3a3c42"     // fillIsGradient = true
Fill.End: 1
Fill.End Color: "#42454d"

A node's content sits inside both its border and its padding, so the content inset on each side is borderThickness plus that side's padding.

While building the render tree, the core also adjusts some resolved values: apply_mobile_scale() enlarges pixel sizes on mobile, runtime binds like VApp::bind_height() replace authored values, and bind fills values from app data.

How states change values

Each attribute takes its most specific value for the active states, so the same style can resolve differently:

Card << Vortex/Box:
    Fill: "#25272b"
    Layout.Direction: "Row" @Narrow: "Column"
    Padding.(Left,Right): 16 @Narrow: 8
Member Without @Narrow With @Narrow
fill "#25272b" "#25272b"
direction "Row" "Column"
paddingL, paddingR 16 8

Attributes and members

Each style attribute resolves into the members beside it. Border/Fill and Border/Thickness belong to the style's Border child layer, and a group like Margins.(Left,Top,Right,Bottom) is a Layers name expansion whose names match the members in order.

Attribute Members
Fill fill, fillIsGradient
Border/Fill borderFill, borderIsGradient
Border/Thickness borderThickness
Corner Radii.(Top,Bottom) (Left,Right) radiusTL, radiusTR, radiusBL, radiusBR
Text Color textColor
Margins.(Left,Top,Right,Bottom) marginL, marginT, marginR, marginB
Padding.(Left,Top,Right,Bottom) paddingL, paddingT, paddingR, paddingB
Font.Family fontFamily
Font.Size fontSize
Font.Weight fontWeight
Layout.Direction direction
Layout.Align crossAlign
Layout.Justify justify
Layout.Scroll scroll
Layout.Spacing spacing
Layout.Grow grow
Layout.Shrink shrink
Size.Width width
Size.Height height
Size.Max Width maxWidth
Aspect Ratio aspectRatio
Opacity opacity
Visible visible
Collapsed collapsed
Transform.Offset X translateX
Transform.Offset Y translateY
Transform.Rotation rotation
Intent intent
Overlay overlay
Secret secret
Multiline multiline
Read Only readOnly
Wrap wrap
Fit fit
Autoplay, Loop, Muted, Controls autoplay, loop, muted, controls
Text text
Placeholder placeholder
Source iconSource, mediaSource
Data qrData
Href href
Tag tag
Anchor anchor
Bind bind
Size.Height Viewport heightVp

codeBg is the one member without an attribute, since the core sets it from the active theme.

Member Variable Documentation

std::string fill

Color or gradient that fills the widget

bool fillIsGradient { false }

True when fill is a gradient

std::string borderFill

Color or gradient that fills the widget's border

bool borderIsGradient { false }

True when borderFill is a gradient

double borderThickness { 0 }

The widget's border thickness (px)

double radiusTL { 0 }

Top-left corner radius of the widget (px)

double radiusTR { 0 }

Top-right corner radius of the widget (px)

double radiusBL { 0 }

Bottom-left corner radius of the widget (px)

double radiusBR { 0 }

Bottom-right corner radius of the widget (px)

std::string textColor

Color of text and icons

double marginL { 0 }

Left space outside the widget (handled by parent layout)

double marginT { 0 }

Top space outside the widget (handled by parent layout)

double marginR { 0 }

Right space outside the widget (handled by parent layout)

double marginB { 0 }

Bottom space outside the widget (handled by parent layout)

double paddingL { 0 }

Left space between the widget's border and its content

double paddingT { 0 }

Top space between the widget's border and its content

double paddingR { 0 }

Right space between the widget's border and its content

double paddingB { 0 }

Bottom space between the widget's border and its content

std::string fontFamily

Font family name for text. The generic "monospace" maps to the platform's default. "" is the reconciler default.

double fontSize { 0 }

Pixel size for text; 0 is reconciler default

double fontWeight { 0 }

Numeric text weight (100-900); 0 is reconciler default

std::string direction

Direction that children are laid out.

Option Default Orients children...
"Column" ☑ vertically
"Column-Reverse" vertically in reversed order
"Row" horizontally
"Row-Reverse" horizontally in reversed order

std::string crossAlign

Cross-axis alignment of children. If direction == "Row", then this controls the vertical alignment, whereas direction == "Column" means this controls the horizontal alignment.

The associated margins of the children are factored into each result. For example, if direction == "Row" and this == "Start", the children are aligned to the top-side offset by their individual marginT distances.

Option Default Aligns children...
"Start" along the top ("Row") or left ("Column") edge
"Center" ☑ centered between the top & bottom ("Row") or left & right ("Column") edges
"End" along the bottom ("Row") or right ("Column") edge
"Stretch" filling the available height ("Row") or width ("Column")

std::string justify

Main-axis placement of the child block, when there's leftover space.

Unlike the cross-axis where children are aligned within their own lanes, on the main-axis, children sit one after another, and justify shifts the whole group. If direction == "Row" and there is free space available:

Start:   [A][B][C]·········
Center:  ····[A][B][C]·····
End:     ·········[A][B][C]

If any of the children in the block are set to grow, the justify field is irrelevant because a growing child leaves no free space.

Start:   [A][B][C·········]  // Since `C` grows, justify is irrelevant
Center:  [A][B][C·········]
End:     [A][B][C·········]
Option Default Shifts child block...
"Start" to the left ("Row") or top ("Column") edge
"Center" ☑ centered between the left & right ("Row") or top & bottom ("Column") edges
"End" to the right ("Row") or bottom ("Column") edge

std::string scroll

Enabled scrolling directions.

Option Default Scrolling is...
"" (empty) ☑ disabled
"Vertical" enabled for vertically overflowing content
"Horizontal" enabled for horizontally overflowing content
"Both" enabled for both vertically & horizontally overflowing content

double spacing { 0 }

Gap between children (px)

double grow { 0 }

Growth factor of this child along the parent's main-axis. When applied, the parent's leftover space is split between this child and any other growing siblings. No factor (the default value of 0) means the node keeps its content size.

The leftover space consumed by this child is calculated using a ratio of its factor divided by the factor total of all the parent's growing children:

ratio   = factor / total
consume = ratio * leftover

Two Grow: 1 children divide the space evenly (both get 1/2). If they are Grow: 1 and Grow: 2, then the space is divided into thirds (1/3 and 2/3). A single growing child takes all of the leftover space regardless of its growth factor (a lone Grow: 3 produces 3/3).

[A......][B......]  // `A/Grow: 1` & `B/Grow: 1`
[A....][B........]  // `A/Grow: 1` & `B/Grow: 2`
[A...............]  // `A/Grow: 3`

If any of the children are set to grow, justify is irrelevant because a growing child leaves no free space, unless the growing children have their sizes capped.

double shrink { -1 }

Static-web only: Prevents shrinking below the content size when set to a value of 0.

double width { 0 }

Fixed width (px).

A value of 0 means the width is unfixed (the width of the content unless the node grows or is stretched).

double height { 0 }

Fixed height (px).

A value of 0 means the height is unfixed (the height of the content unless the node grows or is stretched).

double maxWidth { 0 }

Fills the width up to the set value (px), or up to the available space if it's narrower.

A value of 0 means no constraint is applied. If a fixed width is set, then this field is ignored.

double aspectRatio { 0 }

Image/Video nodes only Ratio of horizontal-to-vertical pixels used to derive a height value by dividing the width by the ratio.

If an aspect ratio is set, then height is ignored. A value of 0 means no ratio is applied.

ratio  = horizontal pixels / vertical pixels
height = width / ratio

// For example: a width of `1920` & a desired 16:9 aspect ratio
ratio  = 16 / 9          // 1.7778; This is what you set `aspectRatio` to
height = 1920 / ratio    // 1080

The aspect ratio frames the rendering of an Image/Video node, whereas fit controls how the actual image/video fits within that frame.

double opacity { 1.0 }

Render-time opacity; value in the range [0,1]

bool visible { true }

When false, the node is dropped from the render tree

bool collapsed { false }

When true, the reconciler animates the node's height to 0, and then back to the natural content height when false (un-collapsed).

Unlike visible which removes the node from the tree, a collapsed node stays in the tree to permit the collapsing/expanding animation.

double translateX { 0 }

Sliding overlays only: Render-time horizontal offset expressed as a fraction of the node's width (a value of 0 keeps the node in place, while a value of 1 fully shifts it by its own width).

double translateY { 0 }

Sliding overlays only: Render-time vertical offset expressed as a fraction of the node's height (a value of 0 keeps the node in place, while a value of 1 fully shifts it by its own height).

double rotation { 0 }

Icon nodes only: Render-time clockwise rotation in degrees.

std::string intent

Optional semantic action for binding a platform behavior, like "window:close" on an exit button or "window:drag" on a titlebar box. Platforms ignore intents that they don't handle.

std::string overlay

How the node is presented outside of its parent's normal layout flow.

Option Default Presents the node as...
"" (empty) ☑ a normal child in its parent's layout flow
"Modal" a dialog centered over a darkening backdrop
"PinnedBottom" a bar floated over the content at its parent's bottom
"BottomSheet" a drawer floated over the content at the bottom edge
"ModalSheet" a bottom sheet that slides up into view
"SideSheet" a panel that slides in from the right edge

A "Modal" node is a movable frameless window on desktop, and a fixed, centered element on web and Android. It opens and closes through normal visibility (visible or VApp::bind_visible()), so each one is a single Insert or Remove patch.

A "PinnedBottom" bar reserves its height at the bottom of its parent, so it can slide off-screen through translateY without reflowing the content. The titlebar uses it in @Narrow, where the bar sits at the bottom of the window and hides away on scroll.

The three sheets float over their anchor, the nearest ancestor that doesn't scroll, and reserve no space in it:

  • A "BottomSheet" is centered up to maxWidth and grows upward over the content when its body expands (for example, a body with Visible: 0 @Expanded: 1).
  • A "ModalSheet" is also centered up to maxWidth, but rests fully off-screen and slides up when its translateY changes. It stacks above a "SideSheet" and has no scrim, so it needs a button to close.
  • A "SideSheet" fills its anchor's height, capped at maxWidth (0 fills the width), and slides in through translateX. A darkening scrim covers the rest of the anchor, and clicking it sends a "click" event to the sheet's path so that the app can close it.

The sliding sheets stay in the tree while closed so they can animate in both directions, with a state variant driving the slide:

Comment Drawer << Vortex/Box:
    Overlay: "ModalSheet"
    Size.Max Width: 560
    Transform.Offset Y: 1 @Open: 0     // Off-screen until `@Open`

bool secret { false }

Editor nodes only: Hides the typed value, like a password field, when true.

bool multiline { false }

Editor nodes only: Makes the editor a multi-line text box that wraps its text and aligns it to the top, instead of a single-line field.

The box doesn't grow with its text, so set its size with height. The placeholder also stays in place instead of floating, filling the box while the editor is empty.

bool readOnly { false }

Editor nodes only: Lets the user select and copy the editor's text without typing into it.

App code still changes the value with VApp::bind_text(). A read-only multi-line editor also scrolls to the bottom each time its value changes, like a log.

bool wrap { true }

Text and Editor nodes only: Wraps long lines to the available width when true (the default).

When false, a Text node stays on one line, and a multi-line Editor scrolls horizontally instead. Single-line editors ignore this field.

Build Log << Vortex/Editor:
    Multiline: 1
    Read Only: 1
    Wrap: 0         // Long paths stay on one line

std::string fit

Image/Video nodes only: How the media fills its frame when their aspect ratios differ.

Option Default Fits the media...
"Cover" ☑ to fill the whole frame, cropping what overflows
"Contain" entirely inside the frame, letterboxing the rest

An empty value means "Cover". The frame's shape comes from the node's size or aspectRatio. The desktop reconciler also applies this field to Icon nodes.

bool autoplay { false }

Video nodes only: Starts playback as soon as the video loads. Browsers only honor it when muted is also true.

bool loop { false }

Video nodes only: Restarts playback at the end

bool muted { false }

Video nodes only: Starts with the sound off

bool controls { false }

Video nodes only: Shows native player controls

std::string text

Literal text from the style's Text attribute, like a label's copy or an Editor's initial value.

This is only the starting value. Reconcilers read RenderNode::text, which begins as this value and is replaced by VApp::bind_text() or a text bind (like a list row's Field: bind). Empty when the style sets no Text, leaving the text to app code.

std::string placeholder

Editor nodes only: Placeholder text that fills the field while it's empty and unfocused, then floats up as a smaller label once the user focuses or types in it.

The placeholder isn't the field's value. The initial value comes from text, and app code reads what the user types with VApp::editor_text(), since the typed value stays out of the render tree. A multiline editor keeps its placeholder in place instead of floating it.

std::string iconSource

Icon nodes only: Name of the SVG file to load, without its extension (like "close" for close.svg).

The reconciler looks in the app's icon directories first, then the framework's, and recolors the icon to textColor. Resolves from the Source attribute, like mediaSource.

std::string mediaSource

Image/Video nodes only: Path or URL of the media to display, like a photo, an MP4 video, or an SVG logo. A path resolves against the app's media directories.

Raster images and videos display as they are. An SVG image renders as a live vector, and recolors to textColor like an icon when the style sets Text Color (otherwise it keeps its own colors).

The Source attribute resolves into both this and iconSource, and the reconciler reads whichever one matches the node's type. VApp::bind_media_source() replaces it at runtime.

std::string qrData

QR nodes only: Payload encoded into the QR code, like a URL.

Resolves from the Data attribute rather than Source, so a QR node can't be confused with an icon or image. Only the payload is stored here: the core (for web and Android) or the desktop reconciler encodes it with encode_qr() when needed. VApp::bind_qr_data() replaces it at runtime, and an empty payload paints only the node's fill.

std::string href

Link nodes only: Target URL that the static-web emitter writes as the link's <a href>. Runtime reconcilers ignore it.

VApp::bind_href() replaces it at runtime, and an Href: bind sets it per list row.

std::string tag

Static-web only: HTML element that the emitter writes for this node in place of a div or span, like "h1", "nav", "section", or "li".

Semantic elements make generated pages easier for search engines and browser reader modes to read. An empty value uses the emitter's default element, and runtime reconcilers ignore this field.

Page Title << Vortex/Text:
    Tag: "h1"

std::string anchor

Static-web only: ID of the emitted element, so that links can jump to it.

For example, Anchor: "install" lets a link ending in #install jump to the node. An empty value emits no ID, and runtime reconcilers ignore this field.

std::string bind

Data bindings that the core applies while building the render tree, filling the node from app or theme data, or generating its children.

Reconcilers can ignore this field, since the core has already applied it by the time they see the node.

Two binds generate the node's children, replacing any that the style declares. Each must be the whole Bind value:

Bind Generates...
"ThemeList" one button per loaded theme, from the first child as a template
"List:<key>" one row per entry that the app passes to VApp::set_list() for that key

A list's first child is its row template, and an optional second child is a separator placed between rows. Each row resolves with @First or @Last added at the ends, so a template can restyle the end rows (like rounding only the outer corners).

Theme binds set a node's text from theme metadata:

Bind Sets the node's text to...
"ActiveThemeName" the active theme's name
"ActiveThemePublisher" the active theme's publisher
"ThemeName" the name of the theme that its "ThemeList" button is for
"ThemePublisher" the publisher of that same theme

Row binds fill a node inside a list's row template from one of the row's fields:

Bind Sets the node's...
"Field:<field>" text, or mediaSource (Image/Video) or iconSource (Icon)
"Href:<field>" href
"Placeholder:<field>" placeholder
"Opacity:<field>" opacity: 0 if the field is missing, empty, "0", or "false", and 1 otherwise
"MaxWidth:<field>" maxWidth
"Aspect:<field>" aspectRatio
"Indent:<field>" marginL (to inset threaded replies by depth, for example)
"Grow:<field>" grow
"State:<state>:<field>" states, adding the named state unless the field is missing, empty, "0", or "false"

Except for Field: and Opacity:, a missing or empty field (or an invalid number) leaves the authored value, so a template can carry a default. A missing field hides a Field: node, except an Icon, which keeps its authored source. An Image/Video node is also hidden when the field is empty.

Every bind except "ThemeList" and "List:" can be combined with others in one Bind value, separated by ;:

Post Image << Vortex/Image:
    Bind: "Field:image; Aspect:aspect"  // Per-row source and shape

double heightVp { 0 }

Height as a fraction of the viewport's height, from the Size.Height Viewport attribute (0.7 is 70% of the viewport).

The core converts it into a pixel height while building the render tree, using the height that the platform reports through VPlatform::set_viewport_height(), so reconcilers only need height. The style's Size.Height stays as the fallback until a viewport height is reported, and a VApp::bind_height() value takes precedence over both. Mobile scaling skips it, since it's a fraction rather than a pixel length. A value of 0 means unset.

Camera << Vortex/Scanner:
    Size.Height: 400            // Used until the viewport is reported
    Size.Height Viewport: 0.7   // 70% of the viewport's height

std::string codeBg

Markdown nodes only: Background color behind inline code and code blocks, so code reads as a tinted surface over the body text.

The core sets it from the active theme's Secondary color rather than from a style attribute, so all three reconcilers theme code the same way. Empty for every other node type.

› Documentation
Appearance
Theme
—