aboutsummaryrefslogtreecommitdiff
path: root/src/services/style_setter
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2024-02-22 18:04:28 +0200
committerHenry Jameson <me@hjkos.com>2024-02-22 18:04:28 +0200
commit7d2faccd4f62e8ff6c2f6cc9b8b11d890a6ab974 (patch)
tree3b4b281caa49a94d85283dcd22083c1f60bbf706 /src/services/style_setter
parent779b3dc1228030740ccfbd5192bcd368b526ce56 (diff)
fonts support, cleanup
Diffstat (limited to 'src/services/style_setter')
-rw-r--r--src/services/style_setter/style_setter.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
index ed6c8505..1cda7213 100644
--- a/src/services/style_setter/style_setter.js
+++ b/src/services/style_setter/style_setter.js
@@ -6,25 +6,22 @@ import { getCssRules } from '../theme_data/css_utils.js'
import { defaultState } from '../../modules/config.js'
export const applyTheme = (input) => {
- console.log({ ...input })
let extraRules
- let fonts
if (input.themeType !== 1) {
const t0 = performance.now()
- const { rules, theme } = generatePreset(input)
- fonts = rules.fonts
+ const { theme } = generatePreset(input)
const t1 = performance.now()
- console.log('Themes 2 initialization took ' + (t1 - t0) + 'ms')
+ console.debug('Themes 2 initialization took ' + (t1 - t0) + 'ms')
extraRules = convertTheme2To3(theme)
} else {
- console.log(input)
+ console.debug(input)
extraRules = convertTheme2To3(input)
}
const t1 = performance.now()
const themes3 = init(extraRules, '#FFFFFF')
const t2 = performance.now()
- console.log('Themes 3 initialization took ' + (t2 - t1) + 'ms')
+ console.debug('Themes 3 (eager) initialization took ' + (t2 - t1) + 'ms')
const head = document.head
const body = document.body
body.classList.add('hidden')
@@ -33,8 +30,6 @@ export const applyTheme = (input) => {
head.appendChild(styleEl)
const styleSheet = styleEl.sheet
- styleSheet.toString()
- styleSheet.insertRule(`:root { ${fonts} }`, 'index-max')
getCssRules(themes3.eager, themes3.staticVars).forEach(rule => {
// Hack to support multiple selectors on same component
if (rule.match(/::-webkit-scrollbar-button/)) {
@@ -58,7 +53,7 @@ export const applyTheme = (input) => {
styleSheet.insertRule(rule, 'index-max')
})
const t3 = performance.now()
- console.log('Themes 3 finalization took ' + (t3 - t2) + 'ms')
+ console.debug('Themes 3 finalization (lazy) took ' + (t3 - t2) + 'ms')
})
}