UNPKG

@nex-ui/system

Version:

A lightweight and performant styling library based on Emotion, focusing on component architecture and developer experience.

29 lines (25 loc) 930 B
'use strict'; var utils = require('@nex-ui/utils'); function createSelectors({ selectors, getMediaSelectors }) { const selectorMap = new Map(); utils.forEach(selectors, (value, key)=>{ if (!utils.isString(value)) { console.error(`[Nex UI] system: Expect the selector value to be a string, but what is currently received is %o.`, value); return; } selectorMap.set(`_${key}`, value); }); const mediaSelectors = getMediaSelectors(); utils.forEach(mediaSelectors, (selector, key)=>{ const k = `_${key}`; if (selectorMap.get(k)) { console.error('[Nex UI] system: The selector %s has already been defined in the breakpoint.', selector); return; } selectorMap.set(k, selector); }); return { getCustomizedSelector: (key)=>selectorMap.get(key) }; } exports.createSelectors = createSelectors;