Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tkow committed Oct 30, 2022
1 parent 496a0bf commit ad7f4fa
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/internals/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,11 @@ export function processTheme(theme) {
return { definition, values };
}

const THEME_PRIORITIZED_KEYS = [
'colors',
'radii',
'sizes',
'space',
'borderStyles',
'borderWidths',
'fonts',
'fontSizes',
'fontWeights',
'lineHeights',
'zIndices',
'letterSpacings',
];
const THEME_KEYS = Object.keys(THEME_VALUES);

function searchHaveTokenConfigKey(theme, themeMap, key) {
for (let i = 0, len = THEME_PRIORITIZED_KEYS.length; i < len; i++) {
const configKey = THEME_PRIORITIZED_KEYS[i];
for (let i = 0, len = THEME_KEYS.length; i < len; i++) {
const configKey = THEME_KEYS[i];
if (key in (themeMap[configKey] || {}) && theme?.[configKey]) {
return configKey;
}
Expand All @@ -148,7 +135,7 @@ export function processStyles({ styles, theme, config }) {

return Object.entries(styles).reduce((acc, [key, val]) => {
if (utils && key in utils) {
// NOTE: Deepmerge for media propeties.
// NOTE: Deepmerge for media properties.
acc = merge(
acc,
processStyles({ styles: utils[key](val), theme, config })
Expand Down

0 comments on commit ad7f4fa

Please sign in to comment.