@tokens-studio/sd-transforms
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -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 @@ /** |
@@ -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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78733
1317