diff options
| author | Henry Jameson <me@hjkos.com> | 2024-06-22 00:54:23 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2024-06-22 00:54:23 +0300 |
| commit | 6846b4fe8a1829f8897f48acda7e0a272ffb216e (patch) | |
| tree | 04d798e10db265b26a159e65e5f87f574a911b91 /src/services/theme_data | |
| parent | aae508f5a14556c34bfad0cd334c25591ce721c3 (diff) | |
| parent | 4c3e2979756fa374eafcd385c6fffc64d8c8ffcd (diff) | |
Merge remote-tracking branch 'origin/develop' into appearance-tab
Diffstat (limited to 'src/services/theme_data')
| -rw-r--r-- | src/services/theme_data/iss_utils.js | 6 | ||||
| -rw-r--r-- | src/services/theme_data/theme_data_3.service.js | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/services/theme_data/iss_utils.js b/src/services/theme_data/iss_utils.js index 2d9dd0b5..83ca8242 100644 --- a/src/services/theme_data/iss_utils.js +++ b/src/services/theme_data/iss_utils.js @@ -1,3 +1,5 @@ +import { sortBy } from 'lodash' + // "Unrolls" a tree structure of item: { parent: { ...item2, parent: { ...item3, parent: {...} } }} // into an array [item2, item3] for iterating export const unroll = (item) => { @@ -24,7 +26,7 @@ export const getAllPossibleCombinations = (array) => { }) const flatCombos = newCombos.reduce((acc, x) => [...acc, ...x], []) const uniqueComboStrings = new Set() - const uniqueCombos = flatCombos.map(x => x.toSorted()).filter(x => { + const uniqueCombos = flatCombos.map(sortBy).filter(x => { if (uniqueComboStrings.has(x.join())) { return false } else { @@ -64,7 +66,7 @@ export const genericRuleToSelector = components => (rule, ignoreOutOfTreeSelecto } const selectors = [realSelector, applicableVariant, ...applicableStates] - .toSorted((a, b) => { + .sort((a, b) => { if (a.startsWith(':')) return 1 if (/^[a-z]/.exec(a)) return -1 else return 0 diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js index 645f2e5e..d1043c52 100644 --- a/src/services/theme_data/theme_data_3.service.js +++ b/src/services/theme_data/theme_data_3.service.js @@ -1,6 +1,6 @@ import { convert, brightness } from 'chromatism' import sum from 'hash-sum' -import { flattenDeep } from 'lodash' +import { flattenDeep, sortBy } from 'lodash' import { alphaBlend, getTextColor, @@ -226,7 +226,7 @@ export const init = (extraRuleset, ultimateBackgroundColor, debug) => { combination.variant === 'normal' ? '' : combination.variant[0].toUpperCase() + combination.variant.slice(1).toLowerCase(), - ...combination.state.filter(x => x !== 'normal').toSorted().map(state => state[0].toUpperCase() + state.slice(1).toLowerCase()) + ...sortBy(combination.state.filter(x => x !== 'normal')).map(state => state[0].toUpperCase() + state.slice(1).toLowerCase()) ].join('') let inheritedTextColor = computedDirectives.textColor |
