Skip to content

Commit

Permalink
fix: make css stroke, cubicbezier and fontfamily transitive
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Jun 6, 2024
1 parent 4f1efea commit 4556712
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions __integration__/__snapshots__/customFormats.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,12 @@ snapshots["integration custom formats inline custom with new args should match s
"type": "value"
},
"fontFamily/css": {
"type": "value"
"type": "value",
"transitive": true
},
"cubicBezier/css": {
"type": "value"
"type": "value",
"transitive": true
},
"strokeStyle/css/shorthand": {
"type": "value",
Expand Down Expand Up @@ -1781,10 +1783,12 @@ snapshots["integration custom formats register custom format with new args shoul
"type": "value"
},
"fontFamily/css": {
"type": "value"
"type": "value",
"transitive": true
},
"cubicBezier/css": {
"type": "value"
"type": "value",
"transitive": true
},
"strokeStyle/css/shorthand": {
"type": "value",
Expand Down
6 changes: 5 additions & 1 deletion lib/common/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,8 @@ export default {
*/
'fontFamily/css': {
type: 'value',
// typography properties can be references, while fontFamily prop might not
transitive: true,
filter: (token, options) => {
const type = options.usesDtcg ? token.$type : token.type;
return !!type && ['fontFamily', 'typography'].includes(type);
Expand All @@ -1148,6 +1150,8 @@ export default {
*/
'cubicBezier/css': {
type: 'value',
// transition properties can be references, while timingFunction might not be
transitive: true,
filter: (token, options) => {
const type = options.usesDtcg ? token.$type : token.type;
return !!type && ['cubicBezier', 'transition'].includes(type);
Expand All @@ -1172,7 +1176,7 @@ export default {
*/
'strokeStyle/css/shorthand': {
type: 'value',
// border properties can be references
// border properties can be references, while style property might not be
transitive: true,
filter: (token, options) => (options.usesDtcg ? token.$type : token.type) === 'strokeStyle',
transform: (token, _, options) => {
Expand Down

0 comments on commit 4556712

Please sign in to comment.