@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
18 lines • 606 B
JavaScript
import { keys } from '../wxs/object';
import { style } from '../wxs/style';
function kebabCase(word) {
var _word$replace;
var newWord = (_word$replace = word.replace(/[A-Z]/g, function (i) {
return '-' + i;
})) === null || _word$replace === void 0 ? void 0 : _word$replace.toLowerCase().replace(/^-/, '');
return newWord;
}
function mapThemeVarsToCSSVars(themeVars) {
var cssVars = {};
keys(themeVars).forEach(function (key) {
var cssVarsKey = '--' + kebabCase(key);
cssVars[cssVarsKey] = themeVars[key];
});
return style(cssVars);
}
export { kebabCase, mapThemeVarsToCSSVars };