Overview
Union is a style engine designed to take a description of a style in some input format, convert it into an abstraction representation of how to style elements and then feed that to an output that uses that information to perform the actual styling.
Style Rules, Elements and Selectors
At the core of Union are a collection of Styles that each contain a set pf StyleRules. Style rules define what properties should be applied to what Elements. Each style rule has a list of Selectors that try to match against an element's properties. This matching is done using an ElementQuery which will go through all style rules in a style and try to match them to its list of elements.
If multiple style rules match, they are sorted by the weight of the selectors and then combined. This results in a set of properties where each property has the value of the style rule with the highest weight that defines a value for that property. Properties are grouped together in a set of PropertyGroup classes. These are all part of the Union::Properties namespace.
Input Plugins
Styles and the rules they contain are defined by InputPlugins. An input plugin is responsible for converting some kind of input format into a set of style rules that can be matched and then used to style elements. An input plugin creates instances of styles along with the appropriate StyleLoader. The StyleLoader is used to create the actual instances of style rules as appropriate for the input format.
Output Plugins
All the information contained within the style rules needs to be transformed to actual rendering commands. This is handled by specific output plugins. These are not really plugins for Union itself but plugins that make use of Union to style different things. They are implementations of things like a QtQuick Controls style or QtWidgets QStyle.
Output plugins are responsible for creating instances of Element for each element that should be styled, adding the right information to these elements and then providing these elements to an ElementQuery to find out which style rules match the elements. They should then use the properties provided by the query to render the styling for the element.
Platform Integration
Certain details of Union, such as what the default style is, are dependant on the platform that is being used. To provide these values for a new platform, create a new PlatformPlugin.