WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@jkuelz
Copy link
Member

@jkuelz jkuelz commented Dec 3, 2025

Description

This adds an internal prop to our visual context definition that gets forwarded to our theme builder in order to support multi-mode color generation for reference tokens.

Some contexts use dark mode tokens in light mode (top navigation, content header), this happens in the style-dictionary folder of this package. However, color generation of reference palettes from seed values doesn't happen until the tokens are processed in the theming-core package. While by default there will be a single palette generated that's used for both light and dark mode, someone could define two separate palettes for reference tokens, and the theme needs to know which one to use.

Related links, issue #, if available: SIM: D351729488, Internal counterpart CR-238953785
This change needs theming PR to be merged to pass dryrun.

How has this been tested?

dev-pipeline: AwsUi-v3-jkuelz

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

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

@jkuelz jkuelz marked this pull request as ready for review December 3, 2025 10:35
@jkuelz jkuelz requested a review from a team as a code owner December 3, 2025 10:35
@jkuelz jkuelz requested review from a team, amanabiy and georgylobko and removed request for a team and amanabiy December 3, 2025 10:35
tokenCategories.forEach(({ tokens, mode: modeId, referenceTokens }) => {
const mode = modes.find(mode => mode.id === modeId);
if (referenceTokens) {
builder.addReferenceTokens(referenceTokens, mode);
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the mode argument is not supported here, so you need to modify this function to make it work

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that is the theming-core PR that's mentioned in the description.

Copy link
Member

Choose a reason for hiding this comment

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

How did you test this? Did you link the packages locally?

Copy link
Member Author

Choose a reason for hiding this comment

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

I linked the packages locally and ran them in my dev-pipeline. There is also an internal counterpart to this here: CR-238953785

}, {} as StyleDictionary.ExpandedMotionScopeDictionary);
};

export const expandReferenceTokens = (referenceTokens: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd replace any with a more specific type here. This function clearly expects an object with a color prop here

@jkuelz jkuelz force-pushed the jkuelz-context-default-mode branch from 7374c59 to 23e230d Compare December 8, 2025 04:05
@jkuelz jkuelz requested a review from georgylobko December 8, 2025 04:09
@jkuelz jkuelz force-pushed the jkuelz-context-default-mode branch from 23e230d to 3df2ad7 Compare December 8, 2025 04:14
@jkuelz jkuelz force-pushed the jkuelz-context-default-mode branch from c199534 to d4b1a80 Compare December 10, 2025 16:20
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.12%. Comparing base (2b06070) to head (d4b1a80).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4085   +/-   ##
=======================================
  Coverage   97.12%   97.12%           
=======================================
  Files         864      864           
  Lines       25327    25327           
  Branches     9141     9140    -1     
=======================================
  Hits        24599    24599           
- Misses        681      722   +41     
+ Partials       47        6   -41     

☔ 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.

@jkuelz jkuelz added this pull request to the merge queue Dec 10, 2025
Merged via the queue into main with commit b5728e6 Dec 10, 2025
49 checks passed
@jkuelz jkuelz deleted the jkuelz-context-default-mode branch December 10, 2025 17:50
jperals added a commit that referenced this pull request Dec 12, 2025
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.

2 participants