Recursive AI

CSS support in component stylesheets

All oneui docs

A component stylesheet, a style:prop directive and a static style="…" attribute are checked at build time against a table of what the renderer draws: the properties onerender computes plus the SVG presentation properties its SVG renderer takes from the page cascade (219 longhands) and the shorthands onerender or OneHtml expand (78), plus custom properties (--x). An unknown property is OUI0101 with the closest name suggested. For the 68 properties whose grammar is only keywords (for example flex-direction) the value is checked too (OUI0102); other values are checked for balance and emptiness only, until the renderer's typed parsers are reachable from a build-time tool. var() and env() values are not checked.

Selectors: type, class, id, attribute, combinators and the pseudo-classes and elements listed in the OUI0103 message. At-rules: @media, @supports, @layer, @keyframes, @font-face. Nested rules, @import, @container, @scope, @page and @namespace are errors.

The table

src/OneUI.Generators/Css/CssSupport.g.cs is generated:

dotnet build tools/css-table
dotnet <artifacts>/bin/css-table/debug/css-table.dll src/OneUI.Generators/Css/CssSupport.g.cs

The tool references the pinned RecursiveAI.OneRender and RecursiveAI.OneHtml packages (versions in Directory.Packages.props). It reads the property list onerender computes (an internal table, read by reflection), its shorthand expander's names, the shorthands OneHtml has a grammar for, and each property's grammar from OneHtml's specification-derived property table. Rerun it when those packages are bumped.

SVG presentation properties (fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, the *-opacity properties and the rest the SVG renderer reads from the cascade) are accepted, so icons can be coloured from a stylesheet, currentColor included. The table is not per element: the same properties pass on HTML elements, where they have no effect. color-rendering (not in OneHtml's table) is still OUI0101. cursor, text-overflow, scrollbar-width, scrollbar-color and scrollbar-gutter are accepted: the pinned engine applies them.