Skip to content

feat: Added adopt-root-styles property for templated content - #46

Merged
damyanpetev merged 2 commits into
masterfrom
rkaraivanov/adopt-root-styles
Feb 13, 2026
Merged

feat: Added adopt-root-styles property for templated content#46
damyanpetev merged 2 commits into
masterfrom
rkaraivanov/adopt-root-styles

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Add support for adopting document-level styles into shadow DOM when using cell and header templates. This enables custom styles defined in the light DOM to be applied to templated content within web components.

Changes:

  • Added AdoptedStylesController to manage style adoption in shadow DOM
  • Added adopt-root-styles property to grid component
  • Implemented style adoption in cell and header components when templates are used
  • Added unit tests for AdoptedStylesController and style adoption functionality
  • Optimizeed rendering by replacing map directive with repeat directive

The controller caches adopted stylesheets per document and handles theme changes by invalidating the cache. Styles are only adopted when the property is enabled AND a template is provided, ensuring minimal overhead when not in use.

Add support for adopting document-level styles into shadow DOM when using
cell and header templates. This enables custom styles defined in the light
DOM to be applied to templated content within web components.

Changes:
- Added AdoptedStylesController to manage style adoption in shadow DOM
- Added `adopt-root-styles` property to grid component
- Implemented style adoption in cell and header components when templates are used
- Added unit tests for AdoptedStylesController and style adoption functionality
- Optimizeed rendering by replacing `map` directive with `repeat` directive

The controller caches adopted stylesheets per document and handles theme
changes by invalidating the cache. Styles are only adopted when the property
is enabled AND a template is provided, ensuring minimal overhead when not
in use.
@coveralls

coveralls commented Feb 10, 2026

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21987258855

Details

  • 179 of 185 (96.76%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 97.833%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/controllers/root-styles.ts 89 95 93.68%
Totals Coverage Status
Change from base Build 21486695420: -0.2%
Covered Lines: 3094
Relevant Lines: 3140

💛 - Coveralls

Comment thread src/components/cell.ts
@damyanpetev
damyanpetev merged commit 7fdd54c into master Feb 13, 2026
5 checks passed
@damyanpetev
damyanpetev deleted the rkaraivanov/adopt-root-styles branch February 13, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants