chore: adds support to parse "transparent" token references#3452
Conversation
🦋 Changeset detectedLatest commit: 86f2141 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
🚀 Deployed on https://pr-3452--spectrum-css.netlify.app |
File metricsSummaryTotal size: 2.25 MB* Table reports on changes to a package's main file. tokens
* An ASCII character in UTF-8 is 8 bits or 1 byte. |
f9665ba to
7820d75
Compare
7820d75 to
892feda
Compare
7429c49 to
5d1daf9
Compare
castastrophe
left a comment
There was a problem hiding this comment.
It seems like there's a lot of great overlap here with the transparent mapping and the rgb-mapping. What are your thoughts on adding that functionality directly to the rgb-mapping plugin rather than building a new one?
079d274 to
6938024
Compare
c68f4e3 to
d2272ea
Compare
b4310e6 to
9602337
Compare
jawinn
left a comment
There was a problem hiding this comment.
Nice work on this. I did a diff on the tokens index CSS and it looks like what is expected.
I just had a few questions/comments, which shouldn't be blocking.
Will we need another PR after this releases in order to do a new release of our tokens package using the new @spectrum-tools/postcss-rgb-mapping version? Unless there is a way for changesets to handle it at the same time.
51481bd to
d39a4de
Compare
* adds transparent mapping into rgb-mapping plugin - custom properties that reference transparent tokens will now be mapped to their corresponding transparent rgb/opacity tokens - extends the work that the rgb-mapping plugin already does * test: add plugin test cases * chore(plugins/postcss-rgb-mapping): update README.md
d39a4de to
43258c8
Compare
fb9b498 to
86f2141
Compare
* feat(tokens): add transparent token handling * adds transparent mapping into rgb-mapping plugin - custom properties that reference transparent tokens will now be mapped to their corresponding transparent rgb/opacity tokens - extends the work that the rgb-mapping plugin already does * test: add plugin test cases * chore(plugins/postcss-rgb-mapping): update README.md * chore: add changeset
* chore: adds support to parse "transparent" token references (#3452) * feat(tokens): add transparent token handling * adds transparent mapping into rgb-mapping plugin - custom properties that reference transparent tokens will now be mapped to their corresponding transparent rgb/opacity tokens - extends the work that the rgb-mapping plugin already does * test: add plugin test cases * chore(plugins/postcss-rgb-mapping): update README.md * chore: add changeset * chore: release (#3673) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(tokens): support style-dictionary build in windows env (#2500) --------- Co-authored-by: Marissa Huysentruyt <69602589+marissahuysentruyt@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* feat(tokens): add transparent token handling * adds transparent mapping into rgb-mapping plugin - custom properties that reference transparent tokens will now be mapped to their corresponding transparent rgb/opacity tokens - extends the work that the rgb-mapping plugin already does * test: add plugin test cases * chore(plugins/postcss-rgb-mapping): update README.md * chore: add changeset
Description
This PR builds upon the idea the the rgb-mapping plugin introduced to the repo.
--spectrum-disabled-content-color: var(--spectrum-transparent-white-200)--spectrum-disabled-content-color-rgband--spectrum-disabled-content-color-opacity--spectrum-disabled-content-color-rgb: var(--spectrum-transparent-white-200-rgb)--spectrum-disabled-content-color: rgba(var(--spectrum-disabled-content-color-rgb), var(--spectrum-disabled-content-color-opacity)This PR does not refactor any CSS to use the newly created custom properties that should occur with this PR. No VRT diffs should occur.
Jira/Specs
CSS-451
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
nvm use && git clean -dfX && yarn install && yarn clean && yarn buildfor a fresh build and installyarn test:pluginsin your terminal and verify all plugin tests pass, includingpostcss-rgb-mappingyarn startto verify the project runs as expected, with no errorsREADMEin thepluginsdirectory. The new documentation should make sense, be accurate, and be grammar-free.Additional validation
Compare the
dist/global-vars.csswith the newindex.cssthat was just generated whenyarn build&yarn startwere run.In
tokens/dist/global-vars.css, you should see approximately 15 instances of a custom property's value set to a token like--spectrum-transparent-*. These are the custom properties this PR is targeting, listed below:dist/global-vars.css--spectrum-disabled-static-white-background-color--spectrum-disabled-static-black-background-color--spectrum-disabled-static-white-content-color--spectrum-disabled-static-black-content-color--spectrum-disabled-static-white-border-color--spectrum-disabled-static-black-border-color--spectrum-static-black-track-color--spectrum-static-white-track-color--spectrum-static-black-track-indicator-color--spectrum-static-white-track-indicator-color--spectrum-color-loupe-drop-shadow-color--spectrum-color-loupe-inner-border--spectrum-floating-action-button-drop-shadow-colorAdditionally, there are component-level properties pointing to a transparent token for light mode and dark mode:
tokens/custom/dark-vars.css--spectrum-calendar-day-background-color-downtokens/custom/light-vars.css--spectrum-calendar-day-background-color-downVerify that each of the custom properties listed above has new
-rgband-opacitycustom properties in thedist/css/index.css.For instance, you should see something like this in
dist/global-vars.css:--spectrum-static-black-track-color: var(--spectrum-transparent-black-300);After the plugin runs, the
dist/css/index.cssshould contain additional-rgband-opacitycustom properties. Those new properties should have values that reflect the correspondingtransparent-black-300-rgband-opacityprops as well, like so:Finally, the value for
--spectrum-static-black-track-colorutilizes the new-rgband-opacitycustom properties:Regression testing
Validate:
Screenshots
To-do list