YUI icon indicating copy to clipboard operation
YUI copied to clipboard

Support for element styles (similar to CSS classes)

Open shdwcat opened this issue 3 years ago • 0 comments

The idea for Styles is to be able to declare a set of properties, similar to a fragment, that can then be merged into the values for an element by setting the styles property.

// in theme file:
styles:
  cancel:
    background: red
    content: Cancel
    size: { w: 60, h: 30 }
    
// in screen/widget etc:
type: button
styles: cancel // could also specify multiple styles as an array

In this example a cancel style is declared, and then a button is declared as using the cancel style. The properties from the style would then be applied to the button (in listed order of styles), with priority just below instance properties, but above widget/theme properties.

This way we can re-use a 'cancel button' set of properties without needing to make a cancel_button widget, and being able to support additional styles in parallel, rather than the tree of intersecting styles that would be required to achieve the same goal with the widget system.

shdwcat avatar Jun 29 '22 02:06 shdwcat