xusd
7 days ago 998218675eb243d43912c203174a6b72b299c0f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* 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,
};