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

@tokens-studio/sd-transforms

Package Overview
Dependencies
Maintainers
5
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tokens-studio/sd-transforms - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

dist/index.d.ts

@@ -28,2 +28,4 @@ export { register, getTransforms } from './register.js';

textCase: string;
lineHeight: string;
fontWeight: string;
};

@@ -30,0 +32,0 @@ /**

@@ -28,2 +28,6 @@ export { register, getTransforms } from './register.js';

textCase: 'other',
// even though this type does not yet exist in DTCG, it really should, since lineHeights can be both dimension or number
lineHeight: 'lineHeight',
// same as lineHeight except for fontWeight: recognized fontWeight keys (e.g. "regular") should be recognized as well as numbers
fontWeight: 'fontWeight',
},

@@ -30,0 +34,0 @@ /**

20

dist/preprocessors/add-font-styles.js

@@ -53,4 +53,4 @@ import { usesReferences, resolveReferences } from 'style-dictionary/utils';

const { weight, style } = splitWeightStyle(fontWeight, alwaysAddFontStyle);
tokenTypographyValue.fontWeight = weight;
if (style) {
tokenTypographyValue.fontWeight = weight;
tokenTypographyValue.fontStyle = style;

@@ -63,9 +63,15 @@ }

const { weight, style } = splitWeightStyle(fontWeight, alwaysAddFontStyle);
// since tokenFontWeightsValue is a primitive (string), we have to permutate the change directly
token[`${usesDtcg ? '$' : ''}value`] = weight;
if (style) {
slice[`fontStyle`] = {
...token,
[`${usesDtcg ? '$' : ''}type`]: 'fontStyle',
[`${usesDtcg ? '$' : ''}value`]: style,
// since tokenFontWeightsValue is a primitive (string), we have to permutate the change directly
slice[key] = {
weight: {
...token,
[`${usesDtcg ? '$' : ''}type`]: 'fontWeight',
[`${usesDtcg ? '$' : ''}value`]: weight,
},
style: {
...token,
[`${usesDtcg ? '$' : ''}type`]: 'fontStyle',
[`${usesDtcg ? '$' : ''}value`]: style,
},
};

@@ -72,0 +78,0 @@ }

@@ -0,1 +1,2 @@

import { typeDtcgDelegate } from 'style-dictionary/utils';
const typesMap = {

@@ -77,5 +78,6 @@ fontFamilies: 'fontFamily',

export function alignTypes(dictionary) {
const copy = structuredClone(dictionary);
// pre-emptively type dtcg delegate because otherwise we cannot align types properly here
const copy = typeDtcgDelegate(structuredClone(dictionary));
recurse(copy);
return copy;
}
{
"name": "@tokens-studio/sd-transforms",
"version": "1.1.0",
"version": "1.2.0",
"description": "Custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio",

@@ -44,3 +44,3 @@ "license": "MIT",

"peerDependencies": {
"style-dictionary": "^4.0.0"
"style-dictionary": "^4.0.1"
},

@@ -47,0 +47,0 @@ "devDependencies": {

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