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

@nordnet/design-tokens

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nordnet/design-tokens - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

build/types/accessibilityTheme.ts

50

config.js

@@ -28,52 +28,12 @@ function getConfig(theme) {

},
ios: {
transformGroup: "ios",
buildPath: `build/ios/${theme}-theme/`,
typescript: {
transformGroup: "js",
buildPath: "build/types/",
files: [
{
destination: "StyleDictionaryColor.h",
format: "ios/colors.h",
className: "StyleDictionaryColor",
type: "StyleDictionaryColorName",
filter: {
type: "color",
},
destination: `${theme}Theme.ts`,
format: "typescript",
},
{
destination: "StyleDictionaryColor.m",
format: "ios/colors.m",
className: "StyleDictionaryColor",
type: "StyleDictionaryColorName",
filter: {
type: "color",
},
},
],
},
iosSwift: {
transformGroup: "ios-swift",
buildPath: `build/ios-swift/${theme}-theme/`,
files: [
{
destination: "StyleDictionary.swift",
format: "ios-swift/class.swift",
className: "StyleDictionary",
filter: {},
},
],
},
iosSwiftSeparateEnums: {
transformGroup: "ios-swift-separate",
buildPath: "build/ios-swift/",
files: [
{
destination: "StyleDictionaryColor.swift",
format: "ios-swift/enum.swift",
className: "StyleDictionaryColor",
filter: {
type: "color",
},
},
],
},
},

@@ -80,0 +40,0 @@ };

{
"name": "@nordnet/design-tokens",
"version": "1.0.4",
"version": "1.1.0",
"description": "",

@@ -23,2 +23,3 @@ "main": "index.js",

"devDependencies": {
"json-to-ts": "^1.7.0",
"semantic-release": "^20.1.1",

@@ -25,0 +26,0 @@ "style-dictionary": "^3.7.2"

const StyleDictionary = require("style-dictionary");
const assert = require("node:assert");
const JsonToTS = require('json-to-ts');
const { getConfig } = require("./config");
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
const args = process.argv.slice(2).reduce((acc, pairStr) => {

@@ -25,4 +30,42 @@ const [_key, value] = pairStr.split("=");

StyleDictionary.registerFormat({
name: 'typescript/accurate-module-declarations',
formatter: function({ dictionary }) {
return 'declare const root: RootObject\n' +
'export default root\n' +
JsonToTS(dictionary.properties).join('\n');
},
});
StyleDictionary.registerFormat({
name: `typescript`,
formatter: function({dictionary}) {
function getValues() {
return dictionary.allTokens.map(token => {
let value = JSON.stringify(token.value);
// the `dictionary` object now has `usesReference()` and
// `getReferences()` methods. `usesReference()` will return true if
// the value has a reference in it. `getReferences()` will return
// an array of references to the whole tokens so that you can access their
// names or any other attributes.
if (dictionary.usesReference(token.original.value)) {
// Note: make sure to use `token.original.value` because
// `token.value` is already resolved at this point.
const refs = dictionary.getReferences(token.original.value);
refs.forEach(ref => {
value = value.replace(ref.value, function() {
return `${ref.name}`;
});
});
}
return `${token.name}: ${typeof value};`
}).join(`\n`)
}
return `export type ${capitalizeFirstLetter(args.theme)}Theme = { \n${getValues()}\n };`
}
});
const StyleDictionaryExtended = StyleDictionary.extend(baseConfig);
StyleDictionaryExtended.buildAllPlatforms();
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