Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/eds-tokens

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/eds-tokens - npm Package Compare versions

Comparing version 0.9.2 to 1.0.0-beta-1

build/css/index-trimmed.css

2

dist/types/types/index.d.ts

@@ -58,3 +58,3 @@ import { typography } from '../base/typography';

export type Focus = {
type?: 'dashed' | string;
type?: string;
color: string;

@@ -61,0 +61,0 @@ width: string;

{
"name": "@equinor/eds-tokens",
"version": "0.9.2",
"version": "1.0.0-beta-1",
"description": "Design tokens for the Equinor Design System",

@@ -14,3 +14,11 @@ "type": "module",

"./tokens.css": "./tokens.css",
"./elements.css": "./elements.css"
"./elements.css": "./elements.css",
"./css/variables.css": "./build/css/variables-trimmed.min.css",
"./css/variables-verbose.css": "./build/css/variables-verbose.min.css",
"./css/spacing/primitives.css": "./build/css/spacing/primitives.css",
"./css/spacing/comfortable.css": "./build/css/spacing/comfortable-verbose.css",
"./css/spacing/spacious.css": "./build/css/spacing/spacious-verbose.css",
"./json/spacing/flat/*": "./build/json/spacing/flat/*.json",
"./json/spacing/nested/*": "./build/json/spacing/nested/*.json",
"./ts/spacing/*": "./build/ts/spacing/*.ts"
},

@@ -35,2 +43,3 @@ "types": "./dist/types/index.d.ts",

"dist/*",
"build/*",
"commonjs/*",

@@ -47,19 +56,41 @@ "tokens.css",

"devDependencies": {
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"rollup": "^3.25.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/node": "^20.12.12",
"lightningcss-cli": "^1.25.1",
"prettier": "3.0.0",
"rollup": "^4.18.0",
"rollup-plugin-delete": "^2.0.0",
"typescript": "^4.9.4"
"typescript": "^5.4.5",
"copyfiles": "^2.4.1",
"rimraf": "^5.0.7",
"@equinor/eds-tokens-sync": "1.0.0",
"@equinor/eds-tokens-build": "1.0.0"
},
"engines": {
"pnpm": ">=4",
"node": ">=10.0.0"
},
"browserslist": "defaults, not IE 11",
"scripts": {
"build": "rollup -c --bundleConfigAsCjs && tsc",
"build": "rollup -c --bundleConfigAsCjs && pnpm run types",
"dev": "rollup -c -w",
"types": "tsc"
"types": "tsc",
"prettier:check": "prettier --check src/",
"_prebuild:css-index": "copyfiles ./src/css/*.css ./build/css --flat",
"_build:css:verbose": "lightningcss --bundle ./build/css/index-verbose.css -o ./build/css/variables-verbose.css",
"_build:css:trimmed": "lightningcss --bundle ./build/css/index-trimmed.css -o ./build/css/variables-trimmed.css",
"_build:css": "pnpm run _build:css:verbose && pnpm run _build:css:trimmed",
"_build:css-min": "lightningcss --minify --bundle ./build/css/variables-verbose.css -o ./build/css/variables-verbose.min.css && lightningcss --minify ./build/css/variables-trimmed.css -o ./build/css/variables-trimmed.min.css",
"test": "jest",
"tokens-in-code:build:css": "pnpm run _prebuild:css-index && pnpm run _build:css && pnpm run _build:css-min",
"tokens-in-code:clean": "rimraf build",
"tokens-in-code:build": "pnpm run tokens-in-code:clean && eds-tokens-build && pnpm run tokens-in-code:build:css",
"update-tokens:primitives": "sync-figma-to-tokens --file-key cVaqjfgt3gDiqbx10q3Pj8",
"update-tokens:themes": "sync-figma-to-tokens --file-key aRgKtCisnm98k9kVy6zasL",
"update-tokens:spacing-primitives": "sync-figma-to-tokens --file-key cpNchKjiIM19dPqTxE0fqg",
"update-tokens:spacing-modes": "sync-figma-to-tokens --file-key FQQqyumcpPQoiFRCjdS9GM",
"update-tokens": "pnpm run update-tokens:primitives && pnpm run update-tokens:themes && pnpm run update-tokens:spacing-primitives && pnpm run update-tokens:spacing-modes",
"update-figma:primitives": "sync-tokens-to-figma --file-key cVaqjfgt3gDiqbx10q3Pj8",
"update-figma:themes": "sync-tokens-to-figma --file-key aRgKtCisnm98k9kVy6zasL",
"update-figma:spacing-primitives": "sync-tokens-to-figma --file-key cpNchKjiIM19dPqTxE0fqg",
"update-figma:spacing-modes": "sync-tokens-to-figma --file-key FQQqyumcpPQoiFRCjdS9GM",
"update-figma": "pnpm run update-figma:primitives && pnpm run update-figma:themes"
}
}
# @equinor/eds-tokens
[Design tokens] used in the Equinor Design System (EDS), such as colours, typography, spacings etc…
[Design tokens] used in the Equinor Design System (EDS), such as colours, spacings and typography.

@@ -8,8 +8,4 @@ ## Installation

```sh
npm install @equinor/eds-tokens
pnpm add @equinor/eds-tokens
```
If you use Typescript, make sure you have typescript >= 3.8 as a devDependency:
```sh
npm install typescript --save-dev
```

@@ -33,1 +29,81 @@ ## Usage

[design tokens]: https://css-tricks.com/what-are-design-tokens/
# Sync variables in Figma to tokens in code
This repository contains a couple of GitHub Actions workflows:
- Sync tokens to Figma
- Sync Figma variables to tokens
These workflows demonstrate bi-directional syncing between variables in Figma and design tokens in a codebase using Figma's [Variables REST API](https://www.figma.com/developers/api#variables). For more background and a graphical representation of what these workflows do, see our [Syncing design systems using Variables REST API](https://www.figma.com/community/file/1270821372236564565) FigJam file.
To use these workflows, you should copy the code in this repository into your organization and modify it to suit the needs of your design processes.
## Prerequisites
To use the "Sync Figma variables to tokens" workflow, you must be a full member of an Enterprise org in Figma. To use the "Sync tokens to Figma" workflow, you must also have an editor seat.
Both workflows assume that you have a single Figma file with local variable collections, along with one or more tokens json files in the `tokens/` directory that adhere\* to the [draft W3C spec for Design Tokens](https://tr.designtokens.org/format/). For demonstration purposes, this directory contains the tokens exported from the [Get started with variables](https://www.figma.com/community/file/1253086684245880517/Get-started-with-variables) Community file. Have a copy of this file ready if you want to try out the workflow with these existing tokens.
> \*See `src/token_types.ts` for more details on the format of the expected tokens json files, including the deviations from the draft design tokens spec we've had to make. **We expect there to be one tokens file per variable collection and mode.**
In addition, you must also have a [personal access token](https://www.figma.com/developers/api#access-tokens) for the Figma API to allow these workflows to authenticate with the API. For the "Sync Figma variables to tokens" workflow, the token must have at least the Read-only Variables scope selected. For the "Sync tokens to Figma" workflow, the token must have the Read and write Variables scope selected.
## Usage
Before running either of these workflows, you'll need to create an [encrypted secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) in your repository named `GH_ACTION_VARIABLES_SYNC_FIGMA_TOKEN` containing your personal access token.
Both workflows are configured to [run manually](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow) for demonstration purposes, and are designed to be as conservative as possible in their functionality (see details below).
### Sync Figma variables to tokens
To run the "Sync Figma variables to tokens" workflow:
- Open the workflow under the **Actions** tab in your repository and click **Run workflow**
- You will be asked to provide the file key of the Figma file. The file key can be obtained from any Figma file URL: `https://www.figma.com/file/{file_key}/{title}`.
- After the workflow finishes, you should see a new pull request if there are changes to be made to the tokens files in the `tokens/` directory. If there are no changes to be made, then a pull request will not be created.
This workflow has some key behaviors to note:
- After generating the new tokens json files, this workflow creates a pull request for someone on the team to review. If you prefer, you can modify the workflow to commit directly to a designated branch without creating a pull request.
- If a variable collection or mode is removed from the Figma file, the corresponding tokens file will not be removed from the codebase.
### Sync tokens to Figma
To run the "Sync tokens to Figma" workflow:
- Open the workflow under the **Actions** tab in your repository and click **Run workflow**
- You will be asked to provide the file key of the Figma file. The file key can be obtained from any Figma file URL: `https://www.figma.com/file/{file_key}/{title}`. Note: if you are trying out this workflow for the first time, use a file that is separate from your design system to avoid any unintended changes.
- After the workflow finishes, open the file in Figma and observe that the variables should be updated to reflect the tokens in your tokens files.
This workflow has some key behaviors to note:
- Though this workflow is configured to run manually, you're free to modify it to run on code push to a specified branch once you are comfortable with its behavior.
- When syncing to a Figma file that does not have any variable collections, this workflow will add brand-new collections and variables. When syncing to a Figma file that has existing variable collections, this workflow will modify collections and variables **in-place** using name matching. That is, it will look for existing collections and variables by name, modify their properties and values if names match, and create new variables if names do not match.
- The workflow will not remove variables or variable collections that have been removed in your tokens files.
- When mapping aliases to existing local variables, we assume that variable names are unique _across all collections_ in the Figma file. Figma allows duplicate variable names across collections, so you should make sure that aliases don't have naming conflicts in your file.
- For optional Figma variable properties like scopes and code syntax, the workflow will not modify these properties in Figma if the tokens json files do not contain those properties.
- If a string variable is bound to a text node content in the same file, and the text node uses a [shared font in the organization](https://help.figma.com/hc/en-us/articles/360039956774), that variable cannot be updated and will result in a 400 response.
## Local development
You can run the GitHub actions locally by running `pnpm install` and creating a `.env` file.
Example:
```
PERSONAL_ACCESS_TOKEN="your_personal_access_token"
```
[How to create your personal access token](https://www.figma.com/developers/api#access-tokens)
and then running:
```sh
# Defaults to writing to the tokens directory
pnpm run update-tokens
# and / or
pnpm run update-figma
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc