Coder Social home page Coder Social logo

adobe / spectrum-tokens Goto Github PK

View Code? Open in Web Editor NEW
75.0 12.0 16.0 2.45 MB

Tokens used by Spectrum, Adobe's design system.

Home Page: http://opensource.adobe.com/spectrum-tokens/visualizer/

License: Apache License 2.0

JavaScript 99.67% Shell 0.33%
design-system design-tokens hacktoberfest

spectrum-tokens's Introduction

Note: for Spectrum 2 tokens, look at the beta branch and beta tagged packages on NPM.

Spectrum Tokens Monorepo

This repo uses:

Packages in this monorepo:

Setup monorepo locally

  1. Install pnpm using this guide.
  2. Install dependencies
    pnpm i

Build all packages locally

Run build script

pnpm moon run :build

Run all tests locally

pnpm moon run :test

spectrum-tokens's People

Contributors

castastrophe avatar garthdb avatar github-actions[bot] avatar jawinn avatar lazd avatar misterbrownlee avatar mrcjhicks avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spectrum-tokens's Issues

Data for corner-radius-* and checkbox-* has malformed nested sets

Expected Behaviour

Nested sets should have the sets object for all defined conditionals, such as:

{
  "corner-radius-75": {
    "sets": {
      "spectrum": {
        "sets": {
          "desktop": {
            "value": "2px"
          },
          "mobile": {
            "value": "2px"
          }
        }
      },
      "express": {
        "sets": {
          "desktop": {
            "value": "3px"
          },
          "mobile": {
            "value": "4px"
          }
        }
      }
    }
  }
}

Actual Behaviour

Only one sets object was present, nested conditionals were added without an additional sets object

See https://github.com/adobe/spectrum-tokens/blob/beta/src/layout.json

Observe the following:

{
  "corner-radius-75": {
    "sets": {
      "spectrum": {
        "desktop": {
          "value": "2px"
        },
        "mobile": {
          "value": "2px"
        }
      },
      "express": {
        "desktop": {
          "value": "3px"
        },
        "mobile": {
          "value": "4px"
        }
      }
    }
  }
}

Similar errors are present in https://github.com/adobe/spectrum-tokens/blob/beta/src/component-layout.json#L65-L84

Config rename not reflected in package.json

"main": "config.js",

It looks like the config.js file was renamed but the package.json was not updated to reflect the change. This means that require.resolve is not able to find the asset in question.

Not a blocking issue; I was able to work around the issue by updating from require.resolve("@adobe/spectrum-tokens") to require.resolve("@adobe/spectrum-tokens/package.json").

Typing and/or schema validation

Is there a way to include typing information in the token json?

Internal Slack link

In this example, a variable was updated from --spectrum-font-weight-black: 900; to --spectrum-font-weight-black: black; which ended up being an invalid type when applied to the CSS font-weight property. Since that particular property was not in use, there was no way for to validate if it was going to work in CSS or not (it's a valid custom property after all, pretty much everything is). Perhaps there's a way to include typing information so we can filter/highlight potential issues automatically in future?

Add animation tokens

We should publish, at a minimum, duration tokens. We used to publish curves as well, but I'm not sure those are usable (I know Spectrum CSS never used them).

  --spectrum-animation-duration-100: 130ms;

s2 color palette json is missing the wireframe color for Gray 300 and Gray 1000.

Expected Behaviour

Gray 300 and Gray 1000 wireframe colors are defined.

Actual Behaviour

Gray 300 and 1000 wireframe colors are missing.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Go to https://github.com/adobe/spectrum-tokens/blob/3db614647c23623cd3ee104a5841fa88fd8a7994/packages/tokens/src/color-palette.json#L182C3-L197C5 and https://github.com/adobe/spectrum-tokens/blob/3db614647c23623cd3ee104a5841fa88fd8a7994/packages/tokens/src/color-palette.json#L318C1-L333C5 and observe missing value.

Platform and Version

Src from snapshot branch.

Sample Code that illustrates the problem

Logs taken while reproducing problem

None

Add edge-to-visual-only tokens

We should publish edge-to-visual-only tokens for use when there is only a visual within a component and no text. Currently, specs assume horizontal centering, but this data is necessary for some implementations (i.e. CSS subtracts these values from the text-only padding to get the icon-only padding, as text-only is default):

.spectrum--medium {
  /* edge-to-visual-only is used for icon-only buttons */
  --spectrum-edge-to-visual-only-75: 4px;
  --spectrum-edge-to-visual-only-100: 7px;
  --spectrum-edge-to-visual-only-200: 10px;
  --spectrum-edge-to-visual-only-300: 13px;
}

.spectrum--large {
  /* edge-to-visual-only is used for icon-only buttons */
  --spectrum-edge-to-visual-only-75: 5px;
  --spectrum-edge-to-visual-only-100: 9px;
  --spectrum-edge-to-visual-only-200: 13px;
  --spectrum-edge-to-visual-only-300: 16px;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.