Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-scissors-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': minor
---

When expanding object-value tokens, add some metadata about what type the token belonged to before expanding, and which property. This is useful e.g. for transforms to target specific object-value properties like lineHeights. When expanding, the type is aligned to the `number` type (DTCG), but you may want to transform `lineHeight` (not a known DTCG type) tokens but not all `number` tokens.
120 changes: 120 additions & 0 deletions __tests__/StyleDictionary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,38 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.
color: {
type: 'color',
value: '#000',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'color',
type: 'border',
},
},
},
},
style: {
type: 'strokeStyle',
value: 'solid',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'style',
type: 'border',
},
},
},
},
width: {
type: 'dimension',
value: '2px',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'width',
type: 'border',
},
},
},
},
},
});
Expand Down Expand Up @@ -573,14 +597,38 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.
color: {
type: 'color',
value: '#000',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'color',
type: 'border',
},
},
},
},
style: {
type: 'strokeStyle',
value: 'solid',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'style',
type: 'border',
},
},
},
},
width: {
type: 'dimension',
value: '2px',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'width',
type: 'border',
},
},
},
},
},
});
Expand Down Expand Up @@ -631,14 +679,38 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.
color: {
type: 'color',
value: '#000',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'color',
type: 'border',
},
},
},
},
style: {
type: 'strokeStyle',
value: 'solid',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'style',
type: 'border',
},
},
},
},
width: {
type: 'dimension',
value: '2px',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'width',
type: 'border',
},
},
},
},
},
borderTwo: input.borderTwo,
Expand All @@ -648,28 +720,76 @@ Use log.verbosity "verbose" or use CLI option --verbose for more details.
color: {
type: 'color',
value: '#000',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'color',
type: 'border',
},
},
},
},
style: {
type: 'strokeStyle',
value: 'solid',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'style',
type: 'border',
},
},
},
},
width: {
type: 'dimension',
value: '2px',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'width',
type: 'border',
},
},
},
},
},
borderTwo: {
color: {
type: 'color',
value: '#ccc',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'color',
type: 'border',
},
},
},
},
style: {
type: 'strokeStyle',
value: 'dashed',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'style',
type: 'border',
},
},
},
},
width: {
type: 'dimension',
value: '1px',
$extensions: {
'com.styledictionary': {
preExpand: {
prop: 'width',
type: 'border',
},
},
},
},
},
});
Expand Down
Loading