owncloud / file-picker

Integrate ownCloud into your own product
https://owncloud.github.io/integration/file_picker/
Apache License 2.0
5 stars 7 forks source link

feat: bring back shadowRoot #222

Closed LukasHirt closed 1 year ago

LukasHirt commented 1 year ago

Summary

Since some of the styles used in the File picker can have an effect on the parent document, it is needed to handle the styles inside of shadowRoot and have them isolated.

One challenge though - vite does not inject styles into the built bundle when library mode is used in the config (open issue here https://github.com/vitejs/vite/issues/1579). This of course brings the problem of including the style inside the shadowRoot. Some plugins exists that can still handle the injection but unfortunately does not work with custom elements as it anyway tries to add the styles into the document instead of shadowRoot. This forces us to append the styles ourselves into the shadowRoot when the custom element is being constructed.

This change does not affect the lib build as the style.css file is still there and can be imported manually in a scoped context.

Theming will be handled via CSS custom properties.