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

@mulesoft-labs/design-system-primitive-tokens

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mulesoft-labs/design-system-primitive-tokens

Primitive tokens are an abstraction of Salesforce's UI into name and value design properties

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Salesforce Lightning Design System Primitive Tokens for MuleSoft Citizen Applications

Build Status Dependabot Status

  • Primitive tokens are an abstraction of Salesforce's UI into name and value design properties.

Quick start

  1. Clone the project with git clone https://github.com/salesforce-ux/design-system-primitive-tokens.git
  2. Run npm install in the root design-system-primitive-tokens folder.

Build Tokens

Generate Tokens

npm run build

Lint Tokens

npm run lint

Tests

npm run test

Publish

npm run publish-package - Increments version, builds and pushes to NPM package

Add new aliases

Within the design-tokens folder you will find an aliases folder. This is where re-usable aliases will reside. Aliases can be imported into any token YAML file and referenced as a value with {!ALIAS_NAME} syntax. Note Aliases cannot be consumed outside of a tokens YAML file.

Importing aliases

imports:
- ../aliases/colors.yml

Using an alias

props:
  COLOR_BACKGROUND:
    value: '{!PALETTE_GRAY_2}'

Adding a new token

Within the design-tokens folder you will find a primitive folder. This is where consumable named tokens reside. They can either reference an alias as its value or a string value.

## primitive/background-color.yml
global:
  type: color
  category: background-color
  cssProperties:
  - 'background*'
  - 'border*'
  - box-shadow
imports:
- ../aliases/colors.yml
props:
  COLOR_BACKGROUND:
    value: '{!PALETTE_GRAY_2}'
    comment: Default background color for the whole app.

Naming your token

The naming convention for a primitive token is:

CATEGORY_PROPERTY_ATTRIBUTE_RELATIONSHIP_STATE

  • Category — [required] Indicates the category of the token.
  • Property — [optional] Semantic UI property being described. By negating a property declaration, token is valid as a generic UI property.
  • Attribute — [optional] Semantic characteristic of a property.
  • Relationship — [optional] If necessary, a relational name that is relative to other tokens of similar types. E.g. primary vs secondary
  • State — [optional] If necessary, the state of a token when used in the context of interaction design. E.g. hover, focus, selected

Usage combinations

## Category + Property
COLOR_BACKGROUND
## Category + Property + Attribute 
SIZING_WIDTH_SMALL
## Category + Property + State 
COLOR_BACKGROUND_SELECTED
## Category + Property + Theme
COLOR_BACKGROUND_INVERSE
## Category + Property + Attribute + State
COLOR_BORDER_DESTRUCTIVE_HOVER
## Category + Property + Attribute + Relationship 
COLOR_TEXT_LINK_WEAK_SECONDARY
## Category + Property + Attribute + Relationship + State 
COLOR_TEXT_LINK_WEAK_SECONDAY_HOVER

Categories

Categories => PropertiesToken PrefixUsage Description
ColorCOLORGeneric UI color
└── BrandCOLOR_BRANDBrand color associated to theming algorithm
└── BackgroundCOLOR_BACKGROUNDGeneric UI background colors
└── BorderCOLOR_BORDERGeneric UI border colors
└── GradientCOLOR_GRADIENTGeneric UI gradient colors
└── TextCOLOR_TEXTGeneric UI text colors
└── Text LinkCOLOR_TEXT_LINKGeneric UI text link colors
FontFONTSalesforce font family declarations
└── StyleFONT_STYLESupported font family styles
└── SizeFONT_SIZEGeneric typographic scale for fonts
└── WeightFONT_WEIGHTSupported font family weights
OpacityOPACITYGeneric opacity levels
Line-heightLINE-HEIGHTRelative line-height declarations
SpacingSPACINGBox-model spacing declarations, padding and margin
RadiusRADIUSGeneric UI radius values
SizingSIZINGGeneric UI sizing, can be used on box-model
└── BorderSIZING_BORDERGeneric UI border widths
└── SquareSIZING_SQUAREGeneric UI dimensions to output a 1:1 square
└── WidthSIZING_WIDTHGeneric UI widths
ShadowSHADOWGeneric shadows used for depth
DurationDURATIONGeneric timing durations for animations
TouchTOUCHTouch specific values
Media QueryMQSupported media queries
DepthDEPTHZ-index declarations for stacking context
VariableVARDynamic values that change based on user prefs
└── SpacingVAR_SPACINGDynamic box-model spacing declarations
└── Font-sizeVAR_FONT_SIZEDynamic font-size declarations

Adding a new category

If you need to add a new token category that does not currently exist, create a YAML file associated with the category you'd like to have a reference to.

primitive/
└── new_category.yml

Once the file is created, you will need to import its reference into base.yml inside of the primitive folder. After the file and its content have been created, it would be a good idea to run npm run test -- -u to update tests to reflect your additions.

## primitive/base.yml
imports:
- ./new_category.yml

Licenses

FAQs

Package last updated on 13 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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