npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wix/design-system-tokens

v1.16.6

Published

Design system tokens

Downloads

5,341

Readme

Wix Design System Tokens

This package contains:

  1. JSON files containing WDS token definitions.
  2. style-dictionary script to process these files and create required output.
  3. output generated with style-dictionary.

How it works

Source files which are used to generate style-dictionary output are stored in src/tokens directory in JSON format. These files are processed by style-dictionary, which transforms data into a specific structure & format and outputs files to root tokens directory.

To generate output, run

$ yarn generate

Since this package just exports static files, the build script is only used to prepare package for publishing by moving generated files to the root of the package to allow more elegant imports.

Build & Configuration

Build entry point is generate.ts file which controls the execution of input parsing & output generation. Main configuration for expected output is stored in build-config.ts file. Current solution is partly customized, we use custom Format and Transform to suit our needs.

You can find more details on Style Dictionary and its' configuration here.

Consumption

Tokens are available in 2 themes - default and Studio. Default theme resides at the root of the package, while Studio theme is under the studio directory. Each theme has files named foundation, semantic and component, these correspond directly to the tiers of the tokens. File named all contains the tokens from all of the tiers.

Custom Formats

Style Dictionary allows to create your own output format, it's called Formats. These are our custom formats:

css/properties-stylable

It outputs Stylable file with .st.css extension. This file contains:

  1. Variable declarations using partially correct @property rule syntax, which in this form is only valid for Stylable pre-processor.
  2. Variable definitions under .root class.
@property st-global(--wds-color-border-dark-primary);
...
.root {
  --wds-color-border-dark-primary: #868aa5;
  ...
}

Custom Transforms

Style Dictionary supports defining your own custom token value parsers, they're called Transforms. We have several custom transforms.

color/gradient

Only applies to tokens which have attribute "type": "gradient". Refer to transforms/color-gradient.ts to find object structure definition. Outputs linear-gradient function to be assigned to background property.

background: var(--wds-color-fill-gradient-light-bottom-to-top);

shadow/box

Only applies to tokens which have attribute "type": "shadow". Refer to transforms/shadow.ts to find object structure definition. Outputs shadow values to be assigned to box-shadow property.

box-shadow: var(--wds-shadow-focus-warning);

size/px-custom

Only applies to tokens which have attribute "type": "float". Adds px unit to token values.