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

@linode/design-language-system

v2.8.0

Published

```bash yarn install ```

Downloads

25,359

Readme

Installation

yarn install

Build

[!note] You can use yarn storybook to view all the tokens we have available

yarn generate
yarn storybook

You should see something like this output:

==============================================
Theme: light

js
✔︎ dist/tokens-nested.es6.js
✔︎ dist/tokens-nested.d.ts
✔︎ dist/tokens.d.ts
✔︎ dist/tokens.es6.js

scss
✔︎ dist/tokens.scss

css
✔︎ dist/tokens.css
==============================================

This should have created a build directory and it should look like this:

├── dist/
│   ├── dark
│       ├── ...
│   ├── highContrast
│       ├── ...
│   ├── index.d.ts
│   ├── index.js
│   ├── theme.d.ts
│   ├── theme.es6.js
│   ├── tokens.css
│   ├── tokens.d.js
│   ├── tokens.es6.js
│   ├── tokens.scss

If you open style-dictionary/build.ts you will see there is 1 platforms defined for web (however, we can build for android, compose, ios, and ios-swift). Each platform has a transformGroup, buildPath, and files. The buildPath and files of the platform should match up to the files what were built. The files built should look like these:

JS

// tokens.es6.js
export const TokenColorNeutrals5 = "#F7F7FA";
export const TokenColorNeutrals10 = "#EDEDF2";
export const TokenColorNeutrals20 = "#E5E5EA";
export const TokenColorNeutrals30 = "#D6D6DD";
export const TokenColorNeutrals40 = "#C2C2CA";
export const TokenColorNeutrals50 = "#A3A3AB";
export const TokenColorNeutrals60 = "#83838C";
export const TokenColorNeutrals70 = "#717178";
export const TokenColorNeutrals80 = "#5E5E65";
export const TokenColorNeutrals90 = "#4B4B51";
export const TokenColorNeutrals100 = "#3A3A3F";

JS Nested

export default {
  Color: {
    Neutrals: {
      5: "#F7F7FA",
      10: "#EDEDF2",
      20: "#E5E5EA",
      30: "#D6D6DD",
      40: "#C2C2CA",
      50: "#A3A3AB",
      60: "#83838C",
      70: "#717178",
      80: "#5E5E65",
      90: "#4B4B51",
      100: "#3A3A3F"
    },
  }
}

SCSS

// tokens.scss
$token-color-neutrals-5: #F7F7FA;
$token-color-neutrals-10: #EDEDF2;
$token-color-neutrals-20: #E5E5EA;
$token-color-neutrals-30: #D6D6DD;
$token-color-neutrals-40: #C2C2CA;
$token-color-neutrals-50: #A3A3AB;
$token-color-neutrals-60: #83838C;
$token-color-neutrals-70: #717178;
$token-color-neutrals-80: #5E5E65;
$token-color-neutrals-90: #4B4B51;
$token-color-neutrals-100: #3A3A3F;

CSS

// tokens.css
--token-color-neutrals-5: #F7F7FA;
--token-color-neutrals-10: #EDEDF2;
--token-color-neutrals-20: #E5E5EA;
--token-color-neutrals-30: #D6D6DD;
--token-color-neutrals-40: #C2C2CA;
--token-color-neutrals-50: #A3A3AB;
--token-color-neutrals-60: #83838C;
--token-color-neutrals-70: #717178;
--token-color-neutrals-80: #5E5E65;
--token-color-neutrals-90: #4B4B51;
--token-color-neutrals-100: #3A3A3F;

This shows a few things happening:

  1. The build system does a deep merge of all the token JSON files defined in the source attribute of style-dictionary/build.ts. This allows you to split up the token JSON files however you want.
  2. The build system resolves references to other design tokens in other files as well. For example in tokens/alias/light.json the value {color.neutrals.white} gets resolved properly.

Example Usage in Apps

You may import each tier of tokens: Global, Alias, Component

import { Global, Alias, Component } from '@linode/design-language-system';

You may alternately access any token set under each tier:

import { Color, Interaction, Button } from '@linode/design-language-system';

You selectively import tokens by extending the path:

import { Button } from '@linode/design-language-system/components';

All of the above applies to themes:

import { Global, Alias, Component } from '@linode/design-language-system/themes/dark';