You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					30 lines
				
				641 B
			
		
		
			
		
	
	
					30 lines
				
				641 B
			| 
											2 years ago
										 | /* eslint-disable */ | ||
|  | var object = require('../wxs/object.wxs'); | ||
|  | var style = require('../wxs/style.wxs'); | ||
|  | 
 | ||
|  | function kebabCase(word) { | ||
|  |   var newWord = word | ||
|  |     .replace(getRegExp("[A-Z]", 'g'), function (i) { | ||
|  |       return '-' + i; | ||
|  |     }) | ||
|  |     .toLowerCase() | ||
|  |     .replace(getRegExp("^-"), ''); | ||
|  | 
 | ||
|  |   return newWord; | ||
|  | } | ||
|  | 
 | ||
|  | function mapThemeVarsToCSSVars(themeVars) { | ||
|  |   var cssVars = {}; | ||
|  |   object.keys(themeVars).forEach(function (key) { | ||
|  |     var cssVarsKey = '--' + kebabCase(key); | ||
|  |     cssVars[cssVarsKey] = themeVars[key]; | ||
|  |   }); | ||
|  | 
 | ||
|  |   return style(cssVars); | ||
|  | } | ||
|  | 
 | ||
|  | module.exports = { | ||
|  |   kebabCase: kebabCase, | ||
|  |   mapThemeVarsToCSSVars: mapThemeVarsToCSSVars, | ||
|  | }; |