Skip to content

chore: Adds theme optimisation and default theme layer#163

Merged
pan-kot merged 3 commits into
mainfrom
layered-themes
Apr 26, 2026
Merged

chore: Adds theme optimisation and default theme layer#163
pan-kot merged 3 commits into
mainfrom
layered-themes

Conversation

@pan-kot
Copy link
Copy Markdown
Member

@pan-kot pan-kot commented Apr 15, 2026

Changes

The PR introduces default CSS layer wrapping the base theme. This is a preparation for the follow-up change to generate override themes as .css files (see prototype: cloudscape-design/components#4416), in addition to the current build-time theming approach. The override themes will use a separate layer with a higher priority to ensure it is applied on top of the base theme.

Additionally, the PR includes several output optimisations (AWSUI-16016):

  1. Single and multi transformers produce identical rules (expected) that can be merged together;
  2. The media queries of the adjacent selectors are merged;
  3. Adjacent selectors having the same media and definitions are merged in a single comma-separated selector.

Testing

  1. New unit tests
  2. Existing tests including snapshot tests
  3. Manual verification in the components repository
  4. Screenshot tests in the internal pipeline
  5. Dry run to live

In the components repository, I ran the project build to see how the changes affect the generated base-component styles, where the theme declarations live:

  1. old-styles.scoped.css - 279Kb / 33.2Kb gzipped
  2. new-styles.scoped.css - 213K / 29.6Kb gzipped

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.57%. Comparing base (f183e40) to head (941270e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #163      +/-   ##
==========================================
+ Coverage   97.52%   97.57%   +0.05%     
==========================================
  Files          48       48              
  Lines        2621     2637      +16     
  Branches      508      549      +41     
==========================================
+ Hits         2556     2573      +17     
+ Misses         65       64       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pan-kot pan-kot marked this pull request as ready for review April 15, 2026 13:02
@pan-kot pan-kot requested a review from a team as a code owner April 15, 2026 13:02
@pan-kot pan-kot requested review from gethinwebster, jkuelz and taheramr and removed request for a team April 15, 2026 13:02
Copy link
Copy Markdown
Member

@gethinwebster gethinwebster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@pan-kot pan-kot added this pull request to the merge queue Apr 26, 2026
Merged via the queue into main with commit bc65c82 Apr 26, 2026
64 of 65 checks passed
@pan-kot pan-kot deleted the layered-themes branch April 26, 2026 17:44
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