
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@spectrum-css/tokens
Advanced tools
Core tokens builder for Spectrum CSS
This package uses StyleDictionary to build Spectrum core tokens for CSS.
package.json
file.--system
) that are used to map the component-level class styles to the core tokens from the desired context. These are generated by the postcss-add-theming-layer
plugin as part of the build and should not be relied upon for naming consistency across releases. Do not attempt to overwrite or extend these variables in your application.Though the token data in this package focus on only the current context (Spectrum 2), our team is committed to offering backwards compatibility for Spectrum 1 and Express through at least December of 2024.
To this end, every component that requires backward mapping support will include:
dist/themes/spectrum.css
dist/themes/express.css
dist/themes/spectrum-two.css
Consumers should load only the mappings for the components they are using in their application. This will ensure that the component-level mappings are aligned with the base CSS for each component. Spectrum 1 and Express component mappings should be loaded with the global-vars.css
and appropriate color and scale assets from the last version of the tokens package: v14.x. Loading the Spectrum 1 or Express component-level mappings with the Spectrum 2 global variables will result in incorrect values being applied to the components and will break the desired design for the component.
The output is concatenated into a single dist/index.css
for use in a vanilla HTML application. This entire file should be imported, and the relevant classes should be toggled to swap out core tokens.
On the <body>
element, start with .spectrum
, add in .spectrum--light
, then .spectrum--medium
. To switch to another context, add .spectrum--legacy
or .spectrum--express
.
For additional guidance on which assets to load, see the architecture section below.
All compiled assets are shipped from the dist
folder. Most of the assets are available in the dist/css
folder. The component-level mappings for Spectrum 1, Express, and Spectrum 2 exist in the components output as theme assets. These should be loaded with the appropriate global variables and color and scale assets from the last version of the tokens package: v14.x.
global-vars.css
: Shared global, unchanging tokens.light-vars.css
: Tokens specific to the light color.dark-vars.css
: Tokens specific to the dark color.medium-vars.css
: Tokens specific to the medium (desktop) scale.large-vars.css
: Tokens specific to the large (mobile) scale.index.css
: The above files rolled up into 1 css file for convenience; best for use in a vanilla HTML application.Overrides and additions to core tokens can be added to custom/*-vars.css
.
Ensure that you add new values to the appropriate color, or scale file:
global-vars.css
- Shared global, unchanging tokenslight-vars.css
- Tokens specific to the light colordark-vars.css
- Tokens specific to the dark colormedium-vars.css
- Tokens specific to the medium (desktop) scalelarge-vars.css
- Tokens specific to the large (mobile) scaleValues added here will be copied over and concatenated with the custom properties being generated from the core tokens by StyleDictionary.
There are no additional contextual folders (i.e., dist/css/spectrum/
) because this package supports no other theming systems outside of the component token mappings. All global tokens are found in the dist/css
folder.
For more notes on how the token data has changed, see the @adobe/spectrum-tokens release documentation.
FAQs
The Spectrum CSS tokens package
The npm package @spectrum-css/tokens receives a total of 7,819 weekly downloads. As such, @spectrum-css/tokens popularity was classified as popular.
We found that @spectrum-css/tokens demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.