style-dictionary 4.3.2 → 4.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/examples/advanced/assets-base64-embed/package.json +1 -1
- package/examples/advanced/assets-base64-embed/tokens/color/font.json +3 -3
- package/examples/advanced/assets-base64-embed/tokens/size/font.json +1 -1
- package/examples/advanced/create-react-app/package.json +1 -1
- package/examples/advanced/create-react-app/style-dictionary/tokens/font.json +1 -1
- package/examples/advanced/create-react-native-app/package.json +1 -1
- package/examples/advanced/custom-parser/package.json +1 -1
- package/examples/advanced/custom-transforms/package.json +1 -1
- package/examples/advanced/flutter/style_dictionary/tokens/color/font.json +3 -3
- package/examples/advanced/font-face-rules/package.json +1 -1
- package/examples/advanced/format-helpers/package.json +1 -1
- package/examples/advanced/format-helpers/tokens/color.json +1 -1
- package/examples/advanced/matching-build-files/package.json +1 -1
- package/examples/advanced/matching-build-files/tokens/button/base.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/README.md +3 -3
- package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/tokens/globals/button.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/tokens/globals/color/base.json +5 -5
- package/examples/advanced/multi-brand-multi-platform/tokens/globals/color/font.json +4 -4
- package/examples/advanced/multi-brand-multi-platform/tokens/globals/font/index.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/tokens/globals/size/font.json +4 -4
- package/examples/advanced/node-modules-as-config-and-properties/components/button/base.js +2 -2
- package/examples/advanced/node-modules-as-config-and-properties/components/button/primary.js +2 -2
- package/examples/advanced/node-modules-as-config-and-properties/components/button/secondary.js +5 -5
- package/examples/advanced/node-modules-as-config-and-properties/package.json +1 -1
- package/examples/advanced/node-modules-as-config-and-properties/tokens/color/background.js +2 -2
- package/examples/advanced/node-modules-as-config-and-properties/tokens/color/border.js +1 -1
- package/examples/advanced/node-modules-as-config-and-properties/tokens/color/brand.js +10 -10
- package/examples/advanced/node-modules-as-config-and-properties/tokens/color/font.js +3 -3
- package/examples/advanced/node-modules-as-config-and-properties/tokens/size/font.js +2 -2
- package/examples/advanced/node-modules-as-config-and-properties/tokens/size/padding.js +2 -2
- package/examples/advanced/npm-module/package.json +1 -1
- package/examples/advanced/npm-module/tokens/color/font.json +3 -3
- package/examples/advanced/npm-module/tokens/size/font.json +1 -1
- package/examples/advanced/referencing_aliasing/README.md +6 -6
- package/examples/advanced/referencing_aliasing/package.json +1 -1
- package/examples/advanced/referencing_aliasing/tokens/button/button.json +3 -3
- package/examples/advanced/referencing_aliasing/tokens/color/base.json +2 -2
- package/examples/advanced/referencing_aliasing/tokens/color/font.json +3 -3
- package/examples/advanced/referencing_aliasing/tokens/size/font.json +1 -1
- package/examples/advanced/s3/package.json +1 -1
- package/examples/advanced/s3/tokens/color/font.json +3 -3
- package/examples/advanced/s3/tokens/size/font.json +1 -1
- package/examples/advanced/tailwind-preset/package.json +1 -1
- package/examples/advanced/tokens-deprecation/package.json +1 -1
- package/examples/advanced/tokens-deprecation/tokens/color/font.json +3 -3
- package/examples/advanced/tokens-deprecation/tokens/size/font.json +4 -4
- package/examples/advanced/transitive-transforms/package.json +1 -1
- package/examples/advanced/variables-in-outputs/package.json +1 -1
- package/examples/advanced/variables-in-outputs/tokens/color/background.json +4 -4
- package/examples/advanced/yaml-tokens/package.json +1 -1
- package/examples/advanced/yaml-tokens/tokens/color/core.yaml +7 -7
- package/examples/complete/tokens/color/background.json +16 -16
- package/examples/complete/tokens/color/border.json +10 -10
- package/examples/complete/tokens/color/brand.json +10 -10
- package/examples/complete/tokens/color/chart.json +9 -9
- package/examples/complete/tokens/color/font.json +22 -22
- package/examples/complete/tokens/font.json +2 -2
- package/examples/complete/tokens/size/font.json +1 -1
- package/examples/complete/tokens/size/padding.json +1 -1
- package/lib/StyleDictionary.js +2 -2
- package/lib/common/formatHelpers/createPropertyFormatter.d.ts +1 -1
- package/lib/common/formatHelpers/createPropertyFormatter.js +3 -3
- package/lib/common/formats.js +13 -2
- package/lib/common/transforms.d.ts +3 -3
- package/lib/common/transforms.js +17 -6
- package/lib/enums/transforms.d.ts +1 -1
- package/lib/enums/transforms.js +4 -1
- package/lib/utils/convertToDTCG.js +10 -12
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -187,7 +187,7 @@ This tells the style dictionary build system how and what to build. The default
|
|
|
187
187
|
"small": { "value": "10px" },
|
|
188
188
|
"medium": { "value": "16px" },
|
|
189
189
|
"large": { "value": "24px" },
|
|
190
|
-
"base": { "value": "{size.font.medium
|
|
190
|
+
"base": { "value": "{size.font.medium}" }
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"base": { "value": "{color.base.red
|
|
5
|
-
"secondary": { "value": "{color.base.green
|
|
6
|
-
"tertiary": { "value": "{color.base.gray.light
|
|
4
|
+
"base": { "value": "{color.base.red}", "type": "color" },
|
|
5
|
+
"secondary": { "value": "{color.base.green}", "type": "color" },
|
|
6
|
+
"tertiary": { "value": "{color.base.gray.light}", "type": "color" }
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"primary": { "value": "{color.core.black
|
|
5
|
-
"link": { "value": "{color.core.blue
|
|
6
|
-
"inverse": { "value": "{color.core.white
|
|
4
|
+
"primary": { "value": "{color.core.black}", "type": "color" },
|
|
5
|
+
"link": { "value": "{color.core.blue}", "type": "color" },
|
|
6
|
+
"inverse": { "value": "{color.core.white}", "type": "color" }
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"core": {
|
|
4
|
-
"greener": { "value": "{color.core.green
|
|
4
|
+
"greener": { "value": "{color.core.green}", "type": "color" },
|
|
5
5
|
"red": { "value": "#ff0000", "type": "color" },
|
|
6
6
|
"blue": { "value": "#0000ff", "type": "color" },
|
|
7
7
|
"green": { "value": "#00ff00", "type": "color" }
|
|
@@ -84,8 +84,8 @@ These values are used as "aliases" in the `tokens/global/color/base.json` file:
|
|
|
84
84
|
"base": {
|
|
85
85
|
...
|
|
86
86
|
},
|
|
87
|
-
"primary" : { "value": "{color.brand.primary
|
|
88
|
-
"secondary" : { "value": "{color.brand.secondary
|
|
87
|
+
"primary" : { "value": "{color.brand.primary}", "type": "color" },
|
|
88
|
+
"secondary" : { "value": "{color.brand.secondary}", "type": "color" },
|
|
89
89
|
...
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -112,7 +112,7 @@ the value `font.platform.system` is consumed by the `tokens/globals/font/index.j
|
|
|
112
112
|
"font": {
|
|
113
113
|
"family": {
|
|
114
114
|
"headers": { "value": "Montserrat", "type": "fontFamily" },
|
|
115
|
-
"base": { "value": "{font.platform.system
|
|
115
|
+
"base": { "value": "{font.platform.system}", "type": "fontFamily" }
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"red": { "value": "#FF0000", "type": "color" },
|
|
11
11
|
"green": { "value": "#00FF00", "type": "color" }
|
|
12
12
|
},
|
|
13
|
-
"primary": { "value": "{color.brand.primary
|
|
14
|
-
"secondary": { "value": "{color.brand.secondary
|
|
13
|
+
"primary": { "value": "{color.brand.primary}", "type": "color" },
|
|
14
|
+
"secondary": { "value": "{color.brand.secondary}", "type": "color" },
|
|
15
15
|
"action": {
|
|
16
|
-
"primary": { "value": "{color.primary
|
|
17
|
-
"secondary": { "value": "{color.secondary
|
|
18
|
-
"tertiary": { "value": "{color.base.gray.medium
|
|
16
|
+
"primary": { "value": "{color.primary}", "type": "color" },
|
|
17
|
+
"secondary": { "value": "{color.secondary}", "type": "color" },
|
|
18
|
+
"tertiary": { "value": "{color.base.gray.medium}", "type": "color" }
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"base": { "value": "{color.base.black
|
|
5
|
-
"primary": { "value": "{color.primary
|
|
6
|
-
"secondary": { "value": "{color.secondary
|
|
7
|
-
"tertiary": { "value": "{color.base.gray.light
|
|
4
|
+
"base": { "value": "{color.base.black}", "type": "color" },
|
|
5
|
+
"primary": { "value": "{color.primary}", "type": "color" },
|
|
6
|
+
"secondary": { "value": "{color.secondary}", "type": "color" },
|
|
7
|
+
"tertiary": { "value": "{color.base.gray.light}", "type": "color" }
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"size": {
|
|
3
3
|
"font": {
|
|
4
|
-
"small"
|
|
4
|
+
"small": {
|
|
5
5
|
"value": "0.75",
|
|
6
6
|
"comment": "the small size of the font"
|
|
7
7
|
},
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"value": "1",
|
|
10
10
|
"comment": "the medium size of the font"
|
|
11
11
|
},
|
|
12
|
-
"large"
|
|
12
|
+
"large": {
|
|
13
13
|
"value": "2",
|
|
14
14
|
"comment": "the large size of the font"
|
|
15
15
|
},
|
|
16
|
-
"base"
|
|
17
|
-
"value": "{size.font.medium
|
|
16
|
+
"base": {
|
|
17
|
+
"value": "{size.font.medium}",
|
|
18
18
|
"comment": "the base size of the font"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
padding: { value: '{size.padding.base
|
|
3
|
-
'font-size': { value: '{size.font.large
|
|
2
|
+
padding: { value: '{size.padding.base}', type: 'dimension' },
|
|
3
|
+
'font-size': { value: '{size.font.large}', type: 'fontSize' },
|
|
4
4
|
};
|
package/examples/advanced/node-modules-as-config-and-properties/components/button/primary.js
CHANGED
|
@@ -5,6 +5,6 @@ import base from './base.js';
|
|
|
5
5
|
// styles if you have a base style and variations.
|
|
6
6
|
export default {
|
|
7
7
|
...base,
|
|
8
|
-
'background-color': { value: '{color.background.link
|
|
9
|
-
color: { value: '{color.font.inverse.base
|
|
8
|
+
'background-color': { value: '{color.background.link}' },
|
|
9
|
+
color: { value: '{color.font.inverse.base}' },
|
|
10
10
|
};
|
package/examples/advanced/node-modules-as-config-and-properties/components/button/secondary.js
CHANGED
|
@@ -2,9 +2,9 @@ import base from './base.js';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
...base,
|
|
5
|
-
'background-color': { value: '{color.background.base
|
|
6
|
-
color: { value: '{color.font.link
|
|
7
|
-
'border-color': { value: '{color.border.base
|
|
8
|
-
'border-width': { value: '{size.border.width.base
|
|
9
|
-
'border-radius': { value: '{size.border.radius.base
|
|
5
|
+
'background-color': { value: '{color.background.base}' },
|
|
6
|
+
color: { value: '{color.font.link}' },
|
|
7
|
+
'border-color': { value: '{color.border.base}' },
|
|
8
|
+
'border-width': { value: '{size.border.width.base}' },
|
|
9
|
+
'border-radius': { value: '{size.border.radius.base}' },
|
|
10
10
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
primary: {
|
|
3
|
-
lighter: { value: '{color.core.teal.60
|
|
4
|
-
light: { value: '{color.core.teal.80
|
|
5
|
-
base: { value: '{color.core.teal.100
|
|
6
|
-
dark: { value: '{color.core.teal.120
|
|
7
|
-
darker: { value: '{color.core.teal.140
|
|
3
|
+
lighter: { value: '{color.core.teal.60}' },
|
|
4
|
+
light: { value: '{color.core.teal.80}' },
|
|
5
|
+
base: { value: '{color.core.teal.100}' },
|
|
6
|
+
dark: { value: '{color.core.teal.120}' },
|
|
7
|
+
darker: { value: '{color.core.teal.140}' },
|
|
8
8
|
},
|
|
9
9
|
secondary: {
|
|
10
|
-
lighter: { value: '{color.core.purple.60
|
|
11
|
-
light: { value: '{color.core.purple.80
|
|
12
|
-
base: { value: '{color.core.purple.100
|
|
13
|
-
dark: { value: '{color.core.purple.120
|
|
14
|
-
darker: { value: '{color.core.purple.140
|
|
10
|
+
lighter: { value: '{color.core.purple.60}' },
|
|
11
|
+
light: { value: '{color.core.purple.80}' },
|
|
12
|
+
base: { value: '{color.core.purple.100}' },
|
|
13
|
+
dark: { value: '{color.core.purple.120}' },
|
|
14
|
+
darker: { value: '{color.core.purple.140}' },
|
|
15
15
|
},
|
|
16
16
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
base: { value: '{color.core.grey.100
|
|
3
|
-
secondary: { value: '{color.core.grey.80
|
|
4
|
-
link: { value: '{color.brand.primary.base
|
|
2
|
+
base: { value: '{color.core.grey.100}' },
|
|
3
|
+
secondary: { value: '{color.core.grey.80}' },
|
|
4
|
+
link: { value: '{color.brand.primary.base}' },
|
|
5
5
|
inverse: {
|
|
6
6
|
base: { value: '#fff' },
|
|
7
7
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"base": { "value": "{color.base.red
|
|
5
|
-
"secondary": { "value": "{color.base.green
|
|
6
|
-
"tertiary": { "value": "{color.base.gray.light
|
|
4
|
+
"base": { "value": "{color.base.red}", "type": "color" },
|
|
5
|
+
"secondary": { "value": "{color.base.green}", "type": "color" },
|
|
6
|
+
"tertiary": { "value": "{color.base.gray.light}", "type": "color" }
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -16,7 +16,7 @@ The "build" command processes the JSON files in the `tokens` folder. Whenever it
|
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
token: {
|
|
19
|
-
"value": "{ref.to.object
|
|
19
|
+
"value": "{ref.to.object}"
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -31,11 +31,11 @@ Open the JSON files in the `tokens` folder and see how certain tokens are refere
|
|
|
31
31
|
For example, open `color/base.json` and see how the value of the "primary" color is a **reference** to the value of the "green" color, declared as:
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
"primary": { "value": "{color.base.green
|
|
34
|
+
"primary": { "value": "{color.base.green}" }
|
|
35
35
|
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
In this case, the string `"{color.base.green
|
|
38
|
+
In this case, the string `"{color.base.green}"` is resolved at build time, and gets its value from the value of the "green" base color, `"#00FF00"`.
|
|
39
39
|
|
|
40
40
|
The reference can point to another token in a **different JSON file**. For example open `color/font.json` and see how the value for the base/secondary font colors are references to the tokens declared in `color/base.json`:
|
|
41
41
|
|
|
@@ -43,8 +43,8 @@ The reference can point to another token in a **different JSON file**. For examp
|
|
|
43
43
|
{
|
|
44
44
|
"color": {
|
|
45
45
|
"font": {
|
|
46
|
-
"base" : { "value": "{color.base.red
|
|
47
|
-
"secondary": { "value": "{color.base.green
|
|
46
|
+
"base" : { "value": "{color.base.red}" },
|
|
47
|
+
"secondary": { "value": "{color.base.green}" }
|
|
48
48
|
...
|
|
49
49
|
```
|
|
50
50
|
|
|
@@ -55,7 +55,7 @@ It is also possible to create **chains of references**, where a value references
|
|
|
55
55
|
"button": {
|
|
56
56
|
"color": {
|
|
57
57
|
"primary": {
|
|
58
|
-
"value": "{color.primary
|
|
58
|
+
"value": "{color.primary}"
|
|
59
59
|
...
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"button": {
|
|
3
3
|
"color": {
|
|
4
4
|
"primary": {
|
|
5
|
-
"value": "{color.primary
|
|
5
|
+
"value": "{color.primary}",
|
|
6
6
|
"type": "color"
|
|
7
7
|
},
|
|
8
8
|
"secondary": {
|
|
9
|
-
"value": "{color.secondary
|
|
9
|
+
"value": "{color.secondary}",
|
|
10
10
|
"type": "color"
|
|
11
11
|
},
|
|
12
12
|
"danger": {
|
|
13
|
-
"value": "{color.base.red
|
|
13
|
+
"value": "{color.base.red}",
|
|
14
14
|
"type": "color"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"green": { "value": "#00FF00", "type": "color" },
|
|
12
12
|
"blue": { "value": "#0000FF", "type": "color" }
|
|
13
13
|
},
|
|
14
|
-
"primary": { "value": "{color.base.green
|
|
15
|
-
"secondary": { "value": "{color.base.blue
|
|
14
|
+
"primary": { "value": "{color.base.green}", "type": "color" },
|
|
15
|
+
"secondary": { "value": "{color.base.blue}", "type": "color" }
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"base": { "value": "{color.base.gray.dark
|
|
5
|
-
"faded": { "value": "{color.base.gray.medium
|
|
6
|
-
"error": { "value": "{color.base.red
|
|
4
|
+
"base": { "value": "{color.base.gray.dark}", "type": "color" },
|
|
5
|
+
"faded": { "value": "{color.base.gray.medium}", "type": "color" },
|
|
6
|
+
"error": { "value": "{color.base.red}", "type": "color" }
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"base": { "value": "{color.base.red
|
|
5
|
-
"secondary": { "value": "{color.base.green
|
|
6
|
-
"tertiary": { "value": "{color.base.gray.light
|
|
4
|
+
"base": { "value": "{color.base.red}", "type": "color" },
|
|
5
|
+
"secondary": { "value": "{color.base.green}", "type": "color" },
|
|
6
|
+
"tertiary": { "value": "{color.base.gray.light}", "type": "color" }
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"color": {
|
|
3
3
|
"font": {
|
|
4
|
-
"base"
|
|
5
|
-
"secondary": { "value": "{color.base.green
|
|
6
|
-
"tertiary"
|
|
4
|
+
"base": { "value": "{color.base.red}" },
|
|
5
|
+
"secondary": { "value": "{color.base.green}" },
|
|
6
|
+
"tertiary": { "value": "{color.base.gray.light}" }
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"size": {
|
|
3
3
|
"font": {
|
|
4
|
-
"small"
|
|
4
|
+
"small": {
|
|
5
5
|
"value": "0.75",
|
|
6
6
|
"comment": "the small size of the font"
|
|
7
7
|
},
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"value": "1",
|
|
10
10
|
"comment": "the medium size of the font"
|
|
11
11
|
},
|
|
12
|
-
"large"
|
|
12
|
+
"large": {
|
|
13
13
|
"value": "2",
|
|
14
14
|
"comment": "the large size of the font",
|
|
15
15
|
"deprecated": true,
|
|
16
16
|
"deprecated_comment": "replace with the \"medium\" size"
|
|
17
17
|
},
|
|
18
|
-
"base"
|
|
19
|
-
"value": "{size.font.medium
|
|
18
|
+
"base": {
|
|
19
|
+
"value": "{size.font.medium}",
|
|
20
20
|
"comment": "the base size of the font"
|
|
21
21
|
}
|
|
22
22
|
}
|