RedHat-UX / red-hat-design-system

Red Hat's Design System
https://ux.redhat.com
MIT License
94 stars 18 forks source link

[feat] automatically load lightdom stylesheets #1801

Open bennypowers opened 2 weeks ago

bennypowers commented 2 weeks ago

Description

Say a user forgot to load rh-table-lightdom.css in the document

Suggested solution

/** pseudocode */
async connectedCallback() {
  super.connectedCallback();
  const root = this.getRootNode();
  if (!root.getComputedStyle().getPropertyName(this._lightdomcssBrandName)) {
    root.adoptedStyleSheets = [...root.adoptedStyleSheets, await import('./rh-table-lightdom.css')]
  }
}

Screenshots

No response

Example API

No response

Additional context

No response

bennypowers commented 2 weeks ago

probably best handled with a controller