ucd-library / ucdlib-theme

University branding, additional theme support, theme elements
MIT License
0 stars 0 forks source link

start of prop controller (#57) #59

Open UcDust opened 2 years ago

UcDust commented 2 years ago

This seems to work well, but please let me know if anything should be changed.

A few things to note:

  1. This assumes the lit parent element is setting its properties to some default value, like empty strings or empty objects, anything !undefined. If that's not a good approach, perhaps there's another way to see if a property exists in a lit element, even undefined. Like so- Screen Shot 2022-06-21 at 2 53 59 PM

  2. For the complex object with children key/values, I only check for the parent key to have already been set, I don't nest into the child elements. This is for when there are duplicate keys defined, we only want to use the first-defined element.

  3. For the :defined css, like ucdlib-properties:not(:defined) { display: none; }, I'm not sure of a good approach that could be defined in the child element itself. It seems like this would only work inside the parent lit element, which would add coding each time this is used. Can you think of a clean way around that? I was thinking perhaps changing it to shadow DOM might be an approach, since that can be accessed earlier, but I'm still not sure if it'll be accessible without showing a flash on the screen. In my tests though, it's not very noticeable.

UcDust commented 2 years ago

I've just added a basic documentation page to the brand app as well, and moved that :defined css to the theme css.