Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@beatgig/synth-core
Advanced tools
@beatgig/synth-core
The Synth core library provides functions to work with token declarations.
yarn add @beatgig/synth-core
string
string
string
string
string
string
Array.<String>
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
string
Array.<String>
object
string
Returns a CSS declaration mapping to the given token.
string
Returns a CSS property mapping to the given token.
TokenParts
Returns an object containing all the parts of a Synth token.
string
Returns a the value of the given token declaration.
boolean
Validates that the given value is a valid Synth token declaration.
boolean
Validates that the given value is a valid Synth token name.
boolean
Validates that the given value is a valid Synth token type.
object
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
Array.<String>
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
string
Kind: global constant
Since: 1.0.0
Array.<String>
Kind: global constant
Since: 1.0.0
object
Kind: global constant
Since: 1.0.0
string
Returns a CSS declaration mapping to the given token.
Kind: global constant
Since: 1.0.0
Param | Type | Description |
---|---|---|
tokens | object | A valid Synth token declaration object. |
tokenName | string | A valid Synth token name. |
Example
getCSSDeclaration({
color: {
background: {
button: 'red',
},
},
}, 'color:background:button')
// => "background-color: red;"
string
Returns a CSS property mapping to the given token.
Kind: global constant
Since: 1.0.0
Param | Type | Description |
---|---|---|
tokenType | string | A valid Synth token type, e.g. color:text . |
Example
getCSSProperty('color:background')
// => "background-color"
getCSSProperty('typography:font')
// => "font-family"
TokenParts
Returns an object containing all the parts of a Synth token.
Kind: global constant
Since: 1.0.0
Param | Type | Description |
---|---|---|
tokenName | string | A valid Synth token name, e.g. color:text:button . |
Example
getTokenParts('color:background:button')
// => { category: 'color', name: 'button', property: 'background' }
getTokenParts('color:background:button:hover')
// => { category: 'color', name: 'button:hover', property: 'background' }
string
Returns a the value of the given token declaration.
Kind: global constant
Since: 1.0.0
Param | Type | Description |
---|---|---|
tokens | object | A valid Synth token declaration object. |
tokenName | string | A valid Synth token name. |
Example
getTokenValue({
color: {
background: {
button: 'red',
},
},
}, 'color:background:button')
// => "red"
boolean
Validates that the given value is a valid Synth token declaration.
Kind: global constant
Since: 1.0.0
Param | Type |
---|---|
tokens | object |
Example
isTokenDeclaration({
color: {
background: {
button: 'red',
},
},
})
// => true
isTokenDeclaration('size:maxWidth')
// => false
isTokenDeclaration({})
// => false
boolean
Validates that the given value is a valid Synth token name.
Kind: global constant
Since: 1.0.0
Param | Type |
---|---|
tokenName | string |
Example
isTokenName('color:text:button')
// => true
isTokenName('@lightGrey')
// => true
isTokenName('hello:world:button')
// => false
isTokenName('hello')
// => false
boolean
Validates that the given value is a valid Synth token type.
Kind: global constant
Since: 1.0.0
Param | Type |
---|---|
tokenType | string |
Example
isTokenType('color:text')
// => true
isTokenType('size:maxWidth')
// => true
isTokenType('hello:world')
// => false
isTokenType('hello')
// => false
object
Kind: global typedef
Properties
Name | Type |
---|---|
category | string |
name | string |
property | string |
FAQs
Core library to manage token declarations
We found that @beatgig/synth-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.