fastdom: clean

This commit is contained in:
jean-emmanuel 2022-01-26 16:40:39 +01:00
parent df74279db2
commit 2f38353483
3 changed files with 21 additions and 35 deletions

View file

@ -11,8 +11,7 @@ var UiWidget = require('./ui-widget'),
scriptGlobals = ScriptVm.globals,
editors = {}, editorModes = {
javascript: require('brace/mode/javascript')
},
fastdom = require('fastdom')
}
function createEditor(name, language, syntaxChecker) {
var el = html`<div id="#editor${name}"></div>`
@ -157,33 +156,25 @@ class UiInspectorField extends UiWidget {
colorData = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = 'transparent'
// fastdom.measure(()=>{
try {
val = chroma(style.getPropertyValue(colorData.css).trim()).hex('rgba')
} catch(e) {}
// fastdom.mutate(()=>{
this.container.appendChild(html`
<osc-inspector-color type="text" name="${this.name}" value="${val}" style="--color-picker-value: ${val}"></osc-inspector-color>
`)
// })
try {
val = chroma(style.getPropertyValue(colorData.css).trim()).hex('rgba')
} catch(e) {}
this.container.appendChild(html`
<osc-inspector-color type="text" name="${this.name}" value="${val}" style="--color-picker-value: ${val}"></osc-inspector-color>
`)
// })
} else if (stringValue === 'auto' && this.widget.constructor.cssVariables.some(x=>x.js === this.name)) {
// fastdom.measure(()=>{
let style = window.getComputedStyle(this.widget.container),
data = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = style.getPropertyValue(data.css).trim()
let style = window.getComputedStyle(this.widget.container),
data = this.widget.constructor.cssVariables.find(x=>x.js === this.name),
val = style.getPropertyValue(data.css).trim()
if (data.toJs) val = data.toJs(val)
// fastdom.mutate(()=>{
this.container.appendChild(html`
<div class="computed-value">${val}</div>
`)
// })
if (data.toJs) val = data.toJs(val)
this.container.appendChild(html`
<div class="computed-value">${val}</div>
`)
// })
}