implement a simple caching system for themes 3

This commit is contained in:
Henry Jameson 2024-04-22 23:40:39 +03:00
commit 5505a89e8a
8 changed files with 70 additions and 15 deletions

View file

@ -1,4 +1,5 @@
import { convert, brightness } from 'chromatism'
import sum from 'hash-sum'
import { flattenDeep } from 'lodash'
import {
alphaBlend,
@ -142,8 +143,12 @@ componentsContext.keys().forEach(key => {
components[component.name] = component
})
const checksum = sum(components)
const ruleToSelector = genericRuleToSelector(components)
export const getChecksum = () => checksum
export const init = (extraRuleset, ultimateBackgroundColor) => {
const staticVars = {}
const stacked = {}
@ -463,6 +468,7 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
return {
lazy: result.filter(x => typeof x === 'function'),
eager: result.filter(x => typeof x !== 'function'),
staticVars
staticVars,
checksum
}
}