Use constructed stylesheet to prevent chrome from shitting itself when

you open element picker
This commit is contained in:
Henry Jameson 2024-03-12 23:33:24 +02:00
parent 1e467ac6e1
commit 472aad52e1
2 changed files with 4 additions and 6 deletions

View File

@ -17,13 +17,11 @@ export const applyTheme = async (input) => {
// Assuming that "worst case scenario background" is panel background since it's the most likely one // Assuming that "worst case scenario background" is panel background since it's the most likely one
const themes3 = init(extraRules, extraRules[0].directives['--bg'].split('|')[1].trim()) const themes3 = init(extraRules, extraRules[0].directives['--bg'].split('|')[1].trim())
const head = document.head
const body = document.body const body = document.body
body.classList.add('hidden')
const styleEl = document.createElement('style') const styleSheet = new CSSStyleSheet()
head.appendChild(styleEl) document.adoptedStyleSheets = [styleSheet]
const styleSheet = styleEl.sheet body.classList.add('hidden')
getCssRules(themes3.eager, themes3.staticVars).forEach(rule => { getCssRules(themes3.eager, themes3.staticVars).forEach(rule => {
// Hacks to support multiple selectors on same component // Hacks to support multiple selectors on same component

View File

@ -448,7 +448,7 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
const t0 = performance.now() const t0 = performance.now()
const combinations = processInnerComponent(components.Root) const combinations = processInnerComponent(components.Root)
const t1 = performance.now() const t1 = performance.now()
console.debug('Tree tranveral took ' + (t1 - t0) + ' ms') console.debug('Tree traveral took ' + (t1 - t0) + ' ms')
const result = combinations.map((combination) => { const result = combinations.map((combination) => {
if (combination.lazy) { if (combination.lazy) {