@@ -2,77 +2,50 @@ import StyleDictionary from "style-dictionary"
2
2
import * as Utils from "./utils"
3
3
import _ from "lodash"
4
4
5
-
6
- const tokenOverrides = {
7
- "globalColorBrand10" : "#001919" ,
8
- "globalColorBrand20" : "#012826" ,
9
- "globalColorBrand30" : "#01322e" ,
10
- "globalColorBrand40" : "#033f38" ,
11
- "globalColorBrand50" : "#054d43" ,
12
- "globalColorBrand60" : "#0a5c50" ,
13
- "globalColorBrand70" : "#0c695a" ,
14
- "globalColorBrand80" : "#117865" ,
15
- "globalColorBrand90" : "#1f937e" ,
16
- "globalColorBrand100" : "#2aac94" ,
17
- "globalColorBrand110" : "#3abb9f" ,
18
- "globalColorBrand120" : "#52c7aa" ,
19
- "globalColorBrand130" : "#78d3b9" ,
20
- "globalColorBrand140" : "#9ee0cb" ,
21
- "globalColorBrand150" : "#c0ecdd" ,
22
- "globalColorBrand160" : "#e3f7ef" ,
23
- }
24
-
25
- const constructCssName = ( path : any , prop : any ) : string =>
5
+ const constructName = ( path : any , prop : any ) : string =>
26
6
{
27
- let newName = path [ 0 ] !== "Global" && prop . attributes . category === "color" ? `color${ Utils . pascalCase ( path ) } ` : _ . camelCase ( path . join ( "" ) )
7
+ let newName = path [ 0 ] !== "Global" && prop . attributes . category === "color" ? `color${ Utils . pascalCase ( path ) } ` : _ . camelCase ( path . join ( " " ) )
28
8
newName = newName . replace ( "Rest" , "" )
29
-
30
- // Check if the constructed name is in the tokenOverrides object
31
- if ( tokenOverrides . hasOwnProperty ( newName ) )
32
- {
33
- prop . value = tokenOverrides [ newName ]
34
- }
35
-
36
9
return newName
37
10
}
38
11
39
12
StyleDictionary . registerTransform ( {
40
13
name : "dcs/name/json" ,
41
14
type : "name" ,
42
- transformer : prop => `${ constructCssName ( Utils . getTokenExportPath ( prop ) , prop ) } ` ,
15
+ transformer : prop => `${ constructName ( Utils . getTokenExportPath ( prop ) , prop ) } ` ,
43
16
} )
44
17
45
18
StyleDictionary . registerTransform ( {
46
19
name : "dcs/alias/json" ,
47
20
type : "value" ,
48
21
matcher : prop => "resolvedAliasPath" in prop ,
49
- transformer : prop => `var(--${ constructCssName ( prop . resolvedAliasPath , prop ) } )` ,
22
+ transformer : prop => `var(--${ constructName ( prop . resolvedAliasPath , prop ) } )` ,
50
23
} )
51
24
52
25
StyleDictionary . registerTransform ( {
53
26
name : "dcs/name/css" ,
54
27
type : "name" ,
55
- transformer : prop => `${ constructCssName ( Utils . getTokenExportPath ( prop ) , prop ) } ` ,
28
+ transformer : prop => `${ constructName ( Utils . getTokenExportPath ( prop ) , prop ) } ` ,
56
29
} )
57
30
58
31
StyleDictionary . registerTransform ( {
59
32
name : "dcs/alias/css" ,
60
33
type : "value" ,
61
34
matcher : prop => "resolvedAliasPath" in prop ,
62
- transformer : prop => `var(--${ constructCssName ( prop . resolvedAliasPath , prop ) } )` ,
35
+ transformer : prop => `var(--${ constructName ( prop . resolvedAliasPath , prop ) } )` ,
63
36
} )
64
37
65
38
StyleDictionary . registerTransform ( {
66
39
name : "dcs/name/mixins" ,
67
40
type : "name" ,
68
- transformer : prop => `${ constructCssName ( Utils . getTokenExportPath ( prop ) , prop ) } ` ,
41
+ transformer : prop => `${ constructName ( Utils . getTokenExportPath ( prop ) , prop ) } ` ,
69
42
} )
70
43
71
44
StyleDictionary . registerTransform ( {
72
45
name : "dcs/alias/mixins" ,
73
46
type : "value" ,
74
47
matcher : prop => "resolvedAliasPath" in prop ,
75
- transformer : prop => `var(--${ constructCssName ( prop . resolvedAliasPath , prop ) } )` ,
48
+ transformer : prop => `var(--${ constructName ( prop . resolvedAliasPath , prop ) } )` ,
76
49
} )
77
50
78
51
StyleDictionary . registerTransformGroup ( {
@@ -120,7 +93,7 @@ StyleDictionary.registerFormat({
120
93
const tokens : any = { }
121
94
for ( const thisProp of sortedProps )
122
95
{
123
- tokens [ constructCssName ( thisProp . path , thisProp ) ] = thisProp . value
96
+ tokens [ constructName ( thisProp . path , thisProp ) ] = thisProp . value
124
97
}
125
98
126
99
return JSON . stringify ( tokens , /* replacer: */ undefined , /* space: */ "\t" )
0 commit comments