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

@quadient/design-tokens

v0.1.0

Published

Quadient design tokens generator tool. As an output, various types of formats are generated based on configuration in json input files.

Downloads

8

Readme

@quadient/design-tokens

Motivation

This package is a proposal on how we can cooperate, generate and share UX design tokens. As an output, various types of formats are generated. It is using a style-dictionary package (https://amzn.github.io/style-dictionary/#/) and provides only configuration for this tool.

Description

The input configuration is in the ./src/ folder. It contains the configuration *.json files with defined names and values of the tokens.

How to use

Because this package is not now available as a public npm package, you have to just clone, fork or download the repository.

In the root folder run npm i to download all the dependencies. Run npm run build to generate output files. If the build finished, there is a ./build/ folder with the generated output token formats.

Select the suitable output format and include it in your project. If you need another format, see the official format support documentation (https://amzn.github.io/style-dictionary/#/formats) and eventually update config.js to generate tokens in the appropriate format.

Branding

According to the UX specification, there is a primary color token which can be rewritten with your brand color. Primary color should be selected from the list of available (tested) primary variant colors. You can set primary color in ./src/brand.json and the value should be a value from the colors in ./src/colorPrimaryVariant.json

Configuration

The tested configuration is set in the config.js file. Transformation of px units is used for some output formats (e.g. javascript output does not contain px - to be able to call some mathematic operations with the token, whereas the css file contains px units to css interprets the token properly.) If you create a new *-.json input configuration file, you have to register this file in config.js in the source property (global mask is not used for the whole folder because with a list of individual files you are able to affect the order of the generated tokens).

Themes

By default there are two themes generated (first with default colors, the second one with inverted colors). Each theme has own file in output format. If you want to build only one theme, run npm run buildDefaultTheme or npm run buildDarkTheme.

Value Collision

During theme generating, info messages are printed into console. Messages such as e.g. Collision detected at: color.bg.ui100! Original value: {color.base.white.value}, New value: {color.base.grey1000.value} means that original value was rewritten by the theme value. It is not error, just information directly from style-dictionary package.

Example

./example/example.html use css output styles to present some basic color tokens with generated value. After change and rebuild configuration you can check the result here.

Limitations found

The tool is unable to directly add opacity on dynamic colors - to resolve this, convertToRGBa action and opacity transformation were added (see config.js for more details).