@nex-ui/system
Version:
A lightweight and performant styling library based on Emotion, focusing on component architecture and developer experience.
24 lines (21 loc) • 683 B
JavaScript
import { __DEV__ } from '@nex-ui/utils';
import { isValidTokenCategory } from './utils.mjs';
function createScales(scales) {
const scaleMap = new Map();
for(const property in scales){
// istanbul ignore if
if (!Object.hasOwn(scales, property)) continue;
const category = scales[property];
if (!isValidTokenCategory(category)) {
if (__DEV__) {
console.error('[Nex-UI] sacles: Unknown token category: %s.', category);
}
continue;
}
scaleMap.set(property, category);
}
return {
getCategoryByProperty: (key)=>scaleMap.get(key)
};
}
export { createScales };