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

@justeat/pie-design-tokens

Package Overview
Dependencies
Maintainers
25
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@justeat/pie-design-tokens - npm Package Compare versions

Comparing version 5.3.1 to 5.4.0

14

build/compileToCss.js

@@ -9,3 +9,3 @@ const {

variableGetterFactory,
writeToFile
writeToFile,
} = require('./helpers');

@@ -20,3 +20,3 @@

CATEGORIES_WITH_UNITS,
GLOBAL_TOKEN_KEY
GLOBAL_TOKEN_KEY,
} = CONSTANTS;

@@ -168,3 +168,3 @@

if (category.includes('font') && isAliasToken) {
Object.keys(value).forEach(key => {
Object.keys(value).forEach((key) => {
if (key === 'size--wide' || key === 'size--narrow' || key === 'size') {

@@ -199,3 +199,3 @@ const lineHeight = `line-height-${key}`;

// e.g. color/font/spacing
categoryKeys.forEach(category => {
categoryKeys.forEach((category) => {
const categoryName = convertWordToPascalCase(category);

@@ -232,3 +232,3 @@

*/
const compileToCss = tokens => {
const compileToCss = (tokens) => {
if (!tokens || !tokens.theme || typeof tokens.theme !== 'object') {

@@ -238,6 +238,6 @@ return false;

const themeKeys = Object.keys(tokens.theme).filter(key => key !== 'global');
const themeKeys = Object.keys(tokens.theme).filter((key) => key !== 'global');
if (themeKeys.length < 1) return false;
themeKeys.forEach(themeKey => {
themeKeys.forEach((themeKey) => {
const cssString = createCssFromTheme(themeKey, tokens.theme[themeKey]);

@@ -244,0 +244,0 @@ writeToFile(themeKey, 'css', cssString);

@@ -68,9 +68,9 @@ const { CONSTANTS, writeToFile } = require('./helpers');

*/
const parseThemes = tokens => {
const parseThemes = (tokens) => {
// first get the theme keys to loop through
const themeKeys = Object.keys(tokens.theme).filter(key => key !== 'global');
const themeKeys = Object.keys(tokens.theme).filter((key) => key !== 'global');
if (themeKeys.length < 1) return false;
// then loop through them
themeKeys.forEach(themeKey => {
themeKeys.forEach((themeKey) => {
const themeTokens = tokens.theme[themeKey];

@@ -80,3 +80,3 @@ const categoryKeys = Object.keys(themeTokens);

// Loop through the categories e.g. color/font/spacing
categoryKeys.forEach(category => {
categoryKeys.forEach((category) => {
// Loop through alias tokens in this category and convert them

@@ -92,3 +92,2 @@ if (typeof themeTokens[category][ALIAS_TOKEN_KEY] !== 'undefined') {

/**

@@ -95,0 +94,0 @@ * Default export. Called with the whole set of design tokens and handles calls out to other functions.

@@ -7,3 +7,3 @@ const {

writeToFile,
variableGetterFactory
variableGetterFactory,
} = require('./helpers');

@@ -18,3 +18,3 @@

CATEGORIES_WITH_UNITS,
GLOBAL_TOKEN_KEY
GLOBAL_TOKEN_KEY,
} = CONSTANTS;

@@ -126,3 +126,3 @@

if (category.includes('font') && isAliasToken) {
Object.keys(value).forEach(key => {
Object.keys(value).forEach((key) => {
if (key === 'size--wide' || key === 'size--narrow' || key === 'size') {

@@ -155,3 +155,3 @@ const lineHeight = `line-height-${key}`;

// e.g. color/font/spacing
categoryKeys.forEach(category => {
categoryKeys.forEach((category) => {
const categoryName = convertWordToPascalCase(category);

@@ -185,3 +185,3 @@

*/
const compileToScss = tokens => {
const compileToScss = (tokens) => {
if (!tokens || !tokens.theme || typeof tokens.theme !== 'object') {

@@ -191,6 +191,6 @@ return false;

const themeKeys = Object.keys(tokens.theme).filter(key => key !== 'global');
const themeKeys = Object.keys(tokens.theme).filter((key) => key !== 'global');
if (themeKeys.length < 1) return false;
themeKeys.forEach(themeKey => {
themeKeys.forEach((themeKey) => {
const scssString = createScssFromTheme(themeKey, tokens.theme[themeKey]);

@@ -197,0 +197,0 @@ writeToFile(themeKey, 'scss', scssString);

@@ -64,3 +64,3 @@ const { CONSTANTS, writeToFile } = require('./helpers');

const categoryKeys = Object.keys(themeTokens); // List of category keys (e.g. color/font/spacing)
categoryKeys.forEach(category => {
categoryKeys.forEach((category) => {
// Currently only compiling colours (as that's the output format for the variables atm)

@@ -91,3 +91,3 @@ if (compiledCategories.includes(category)) {

*/
const compileToXml = tokens => {
const compileToXml = (tokens) => {
if (!tokens || !tokens.theme || typeof tokens.theme !== 'object') {

@@ -97,3 +97,3 @@ return false;

const themeKeys = Object.keys(tokens.theme).filter(key => key !== 'global');
const themeKeys = Object.keys(tokens.theme).filter((key) => key !== 'global');
if (themeKeys.length < 1) return false;

@@ -100,0 +100,0 @@

@@ -15,7 +15,7 @@ const fs = require('fs');

IOS: 'ios',
WEB: 'web'
WEB: 'web',
},
SPECIAL_VALUES: ['$platform'],
VARIABLE_PREFIX_CSS: '--dt-', // design token
VARIABLE_PREFIX_SCSS: '$'
VARIABLE_PREFIX_SCSS: '$',
};

@@ -27,3 +27,3 @@

ios: jsonc.parse(fs.readFileSync(`platform/${CONSTANTS.PLATFORM_KEYS.IOS}.jsonc`).toString()),
web: jsonc.parse(fs.readFileSync(`platform/${CONSTANTS.PLATFORM_KEYS.WEB}.jsonc`).toString())
web: jsonc.parse(fs.readFileSync(`platform/${CONSTANTS.PLATFORM_KEYS.WEB}.jsonc`).toString()),
};

@@ -40,9 +40,9 @@

const compiledJson = {
theme: {}
theme: {},
};
const globalBaseTokens = tokens[CONSTANTS.GLOBAL_TOKEN_KEY];
const themeKeys = Object.keys(tokens.theme).filter(key => key !== CONSTANTS.GLOBAL_TOKEN_KEY);
const themeKeys = Object.keys(tokens.theme).filter((key) => key !== CONSTANTS.GLOBAL_TOKEN_KEY);
// loop through each theme
themeKeys.forEach(themeKey => {
themeKeys.forEach((themeKey) => {
const themeTokens = tokens.theme[themeKey];

@@ -54,3 +54,3 @@ const categoryKeys = Object.keys(themeTokens);

// Loop through categories (e.g. color/font/spacing)
categoryKeys.forEach(category => {
categoryKeys.forEach((category) => {
const categoryGlobals = globalBaseTokens[category];

@@ -69,3 +69,3 @@

const unorderedCategoryTokens = compiledJson.theme[themeKey][category][CONSTANTS.GLOBAL_TOKEN_KEY];
Object.keys(unorderedCategoryTokens).sort().forEach(key => {
Object.keys(unorderedCategoryTokens).sort().forEach((key) => {
let tokenValue = unorderedCategoryTokens[key];

@@ -96,3 +96,3 @@

const filename = `${dir}/${name}.${extension}`;
fs.writeFile(filename, data, (err => {
fs.writeFile(filename, data, ((err) => {
if (err) throw err;

@@ -108,3 +108,3 @@ console.log(`📝 Data written to file: ${filename}`); // eslint-disable-line no-console

*/
const convertWordToPascalCase = word => word.charAt(0).toUpperCase() + word.slice(1);
const convertWordToPascalCase = (word) => word.charAt(0).toUpperCase() + word.slice(1);

@@ -123,3 +123,3 @@ /**

*/
const variableGetterFactory = lang => (varName, insertCssVar = false) => {
const variableGetterFactory = (lang) => (varName, insertCssVar = false) => {
const prefix = lang === 'css'

@@ -166,3 +166,3 @@ ? CONSTANTS.VARIABLE_PREFIX_CSS

*/
const getConvertedShadowsToBoxShadowValues = values => {
const getConvertedShadowsToBoxShadowValues = (values) => {
const extractedShadowValues = values.map(({

@@ -176,3 +176,3 @@ x,

b,
opacity
opacity,
}) => `${x}px ${y}px ${blur}px ${spread}px rgba(${r}, ${g}, ${b}, ${opacity})`);

@@ -214,3 +214,3 @@

*/
const convertHexValueToHSL = hexcode => {
const convertHexValueToHSL = (hexcode) => {
if (typeof hexcode !== 'string' || !/^#[0-9A-F]{3}$|^#[0-9A-F]{6}$/i.test(hexcode)) {

@@ -273,3 +273,3 @@ throw new Error('Invalid hex color');

l: lightness,
s: saturation
s: saturation,
};

@@ -324,3 +324,3 @@ };

variableGetterFactory,
writeToFile
writeToFile,
};

@@ -9,3 +9,3 @@ const { writeToFile } = require('../helpers');

TEST_TOKENS_WITH_TWO_THEMES,
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE,
} = require('./testObjects');

@@ -18,3 +18,3 @@

...originalHelpers,
writeToFile: jest.fn()
writeToFile: jest.fn(),
};

@@ -32,3 +32,3 @@ });

[]
])('should not write any files when given an invalid input of %s', input => {
])('should not write any files when given an invalid input of %s', (input) => {
// Act

@@ -45,3 +45,3 @@ const result = compileToCss(input);

const result = compileToCss({
theme: {}
theme: {},
});

@@ -48,0 +48,0 @@

@@ -17,3 +17,3 @@ const { writeToFile } = require('../helpers');

[]
])('should not write any files when given an invalid input of %s', input => {
])('should not write any files when given an invalid input of %s', (input) => {
// Act

@@ -20,0 +20,0 @@ const result = compileToJson(input);

@@ -9,3 +9,3 @@ const { writeToFile } = require('../helpers');

TEST_TOKENS_WITH_TWO_THEMES,
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE,
} = require('./testObjects');

@@ -18,3 +18,3 @@

...originalHelpers,
writeToFile: jest.fn()
writeToFile: jest.fn(),
};

@@ -32,3 +32,3 @@ });

[]
])('should not write any files when given an invalid input of %s', input => {
])('should not write any files when given an invalid input of %s', (input) => {
// Act

@@ -45,3 +45,3 @@ const result = compileToScss(input);

const result = compileToScss({
theme: {}
theme: {},
});

@@ -48,0 +48,0 @@

@@ -10,3 +10,3 @@ const { writeToFile } = require('../helpers');

TEST_TOKENS_WITH_TWO_THEMES,
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE,
} = require('./testObjects');

@@ -25,3 +25,3 @@

[]
])('should not write any files when given an invalid input of %s', input => {
])('should not write any files when given an invalid input of %s', (input) => {
// Act

@@ -38,3 +38,3 @@ const result = compileToXml(input);

const result = compileToXml({
theme: {}
theme: {},
});

@@ -41,0 +41,0 @@

@@ -8,3 +8,3 @@ const {

convertHexValueToHSL,
variableGetterFactory
variableGetterFactory,
} = require('../helpers');

@@ -17,3 +17,3 @@

TEST_TOKENS_WITH_TWO_THEMES,
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE,
} = require('./testObjects');

@@ -144,3 +144,3 @@

['font', '14', '14'],
['font', 'Regular', 'Regular']
['font', 'Regular', 'Regular'],
)('should return non-pipe-delimited values as-is', () => {

@@ -184,3 +184,3 @@ // Arrange

];
/* eslint-disable vue/sort-keys */
const shadows = [

@@ -195,3 +195,3 @@ {

b: 36,
opacity: 0.03
opacity: 0.03,
},

@@ -206,3 +206,3 @@ {

b: 36,
opacity: 0.07
opacity: 0.07,
},

@@ -217,6 +217,5 @@ {

b: 36,
opacity: 0.06
opacity: 0.06,
}
];
/* eslint-disable vue/sort-keys */

@@ -305,3 +304,3 @@ // Act

false
])('should NOT wrap with `var` function (insertCssVar is %s)', insertCssVar => {
])('should NOT wrap with `var` function (insertCssVar is %s)', (insertCssVar) => {
// Arrange

@@ -308,0 +307,0 @@ const variableGetter = variableGetterFactory(lang);

@@ -9,3 +9,3 @@ const fs = require('fs');

'tokens.json'
])('should match %s', filename => {
])('should match %s', (filename) => {
// Arrange

@@ -12,0 +12,0 @@ const contents = fs.readFileSync(`dist/${filename}`).toString();

@@ -7,5 +7,5 @@ const TEST_FILE_CONTENTS = 'TEST_CONTENT';

orange: '#f36805',
red: '#d50525'
}
}
red: '#d50525',
},
},
};

@@ -19,7 +19,7 @@

blue: '#125fca',
orange: '#41301f'
}
}
}
}
orange: '#41301f',
},
},
},
},
};

@@ -30,4 +30,4 @@

color: {
orange: '#f36805'
}
orange: '#f36805',
},
},

@@ -38,7 +38,7 @@ theme: {

global: {
blue: '#125fca'
}
}
}
}
blue: '#125fca',
},
},
},
},
};

@@ -50,4 +50,4 @@

blue: '#c1dade',
orange: '#f36805'
}
orange: '#f36805',
},
},

@@ -58,7 +58,7 @@ theme: {

global: {
blue: '#125fca'
}
}
}
}
blue: '#125fca',
},
},
},
},
};

@@ -69,4 +69,4 @@

color: {
orange: '#f36805'
}
orange: '#f36805',
},
},

@@ -77,5 +77,5 @@ theme: {

global: {
blue: '#125fca'
}
}
blue: '#125fca',
},
},
},

@@ -85,7 +85,7 @@ newjet: {

global: {
blue: '#ebf6fa'
}
}
}
}
blue: '#ebf6fa',
},
},
},
},
};

@@ -97,4 +97,4 @@

blue: '#c1dade',
orange: '#f36805'
}
orange: '#f36805',
},
},

@@ -105,5 +105,5 @@ theme: {

global: {
blue: '#125fca'
}
}
blue: '#125fca',
},
},
},

@@ -113,7 +113,7 @@ newjet: {

global: {
blue: '#ebf6fa'
}
}
}
}
blue: '#ebf6fa',
},
},
},
},
};

@@ -128,3 +128,3 @@

TEST_TOKENS_WITH_TWO_THEMES,
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE
TEST_TOKENS_WITH_TWO_THEMES_AND_OVERRIDE,
};

@@ -1800,3 +1800,3 @@ {

},
"version": "5.3.1"
"version": "5.4.0"
}

@@ -31,3 +31,3 @@ const fs = require('fs');

ios: buildGlobalTokensIntoThemes(tokens, 'ios'),
web: buildGlobalTokensIntoThemes(tokens, 'web')
web: buildGlobalTokensIntoThemes(tokens, 'web'),
};

@@ -34,0 +34,0 @@

{
"name": "@justeat/pie-design-tokens",
"version": "5.3.1",
"version": "5.4.0",
"description": "Design Tokens for the PIE Component System",

@@ -42,3 +42,3 @@ "main": "index.js",

"devDependencies": {
"@justeat/eslint-config-fozzie": "5.1.0",
"@justeattakeaway/eslint-config-pie": "0.2.0",
"danger": "11.1.2",

@@ -45,0 +45,0 @@ "eslint": "8.23.1",

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