This seems to work well, but please let me know if anything should be changed.
A few things to note:
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-
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.
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.
This seems to work well, but please let me know if anything should be changed.
A few things to note:
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-
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.
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.