Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
jean-emmanuel 2021-06-15 20:09:32 +02:00
commit 7ffa07282a
15 changed files with 109 additions and 47 deletions

View file

@ -85,13 +85,7 @@ var handleClick = function(event) {
label: icon('project-diagram') + ' ' + locales('editor_show_in_tree'),
action: ()=>{
editor.widgetTree.showWidget(editor.selectedWidgets[0])
DOM.each(editor.widgetTree.list, '.editing', (el)=>{
el.classList.add('editor-blink')
el.scrollIntoView({block: 'center'})
setTimeout(()=>{
el.classList.remove('editor-blink')
}, 800)
})
editor.widgetTree.blinkSelected()
},
shortcut: 't'
})

View file

@ -438,6 +438,8 @@ class Editor {
case 't':
if (!this.selectedWidgets.length) return
this.widgetTree.showWidget(editor.selectedWidgets[0])
this.widgetTree.blinkSelected()
break

View file

@ -223,6 +223,18 @@ class UiTree extends UiWidget {
}
blinkSelected() {
DOM.each(this.list, '.editing', (el)=>{
el.classList.add('editor-blink')
el.scrollIntoView({block: 'center'})
setTimeout(()=>{
el.classList.remove('editor-blink')
}, 800)
})
}
select() {
// hint selection in folded containers

View file

@ -235,6 +235,7 @@ class Widget extends EventEmitter {
}
}
this.style = null
this.container = html`
<div class="widget ${options.props.type}-container" id="${this.hash}" data-widget="${this.hash}"></div>
`
@ -516,7 +517,7 @@ class Widget extends EventEmitter {
if (content.indexOf('@{') >= 0) {
content = balancedReplace('@', '{', '}', content, (subcontent)=>{
return this.resolveProp(propName, '@{' + subcontent + '}', storeLinks ? 'nested' : false, this)
return this.resolveProp(content, '@{' + subcontent + '}', storeLinks ? 'nested' : false, this)
})
}
@ -1028,51 +1029,61 @@ class Widget extends EventEmitter {
var prefix = '#' + this.hash,
scopedCss = scopeCss(css, prefix),
scopedCss = '',
unScopedCss = ''
if (css.includes('{')) {
try {
scopedCss = scopeCss(css, prefix)
try {
dummyDOM.style = css
unScopedCss = dummyDOM.getAttribute('style') || ''
dummyDOM.style = css
unScopedCss = dummyDOM.getAttribute('style') || ''
} catch(err) {
} catch(err) {
// fallback for browser that don't allow assigning "style" property
css
// fallback for browser that don't allow assigning "style" property
css
.replace(/\{[^}]*\}/g, '')
.replace(/^[^@#.]*:.*/gm, (m)=>{
unScopedCss += m[m.length - 1] === ';' ? m : m + ';'
})
}
if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1')
if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix)
} else {
unScopedCss = css
}
if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1')
if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix)
var style = html`<style>${unScopedCss ? prefix + '{' + unScopedCss + '}\n' : ''}${scopedCss}</style>`,
oldStyle = DOM.get(this.container, '> style')[0]
var style = (unScopedCss ? prefix + '{' + unScopedCss + '}\n' : '') + scopedCss
if (oldStyle) {
this.container.replaceChild(style, oldStyle)
if (this.style) {
this.style.innerText = style
} else if (scopedCss.length || unScopedCss.length){
this.container.insertBefore(style, this.container.childNodes[0] || null)
this.style = html`<style>${style}</style>`
this.container.insertBefore(this.style, this.container.childNodes[0] || null)
}
// apply extra css classes
if (!deepEqual(extraCssClasses, this.extraCssClasses)) {
if (this.extraCssClasses && this.extraCssClasses.length) {
this.container.classList.remove(...this.extraCssClasses)
this.extraCssClasses = []
}
if (this.extraCssClasses && this.extraCssClasses.length) {
this.container.classList.remove(...this.extraCssClasses)
this.extraCssClasses = []
}
if (extraCssClasses.length) {
this.container.classList.add(...extraCssClasses)
this.extraCssClasses = extraCssClasses
if (extraCssClasses.length) {
this.container.classList.add(...extraCssClasses)
this.extraCssClasses = extraCssClasses
}
}
@ -1090,9 +1101,6 @@ class Widget extends EventEmitter {
}
return style
}
setCssVariables() {

View file

@ -176,9 +176,10 @@ class Matrix extends Panel {
propValue = JSON.stringify(propValue)
}
var data = []
for (var i = 0; i < this.getProp('quantity'); i++) {
data[i] = super.resolveProp(propName, propValue, storeLinks, originalWidget, originalPropName, {$: i})
var data = [],
quantity = this.resolveProp('quantity', undefined, false, false, false)
for (var i = 0; i < quantity; i++) {
data[i] = super.resolveProp(propName, propValue, i === 0 ? storeLinks : false, originalWidget, originalPropName, {$: i})
}
return data

View file

@ -69,7 +69,7 @@ class Modal extends Panel {
this.popupContent = DOM.get(this.popup, '.popup-content')[0]
if (iOS13) {
if (iOS13 && this.getProp('scroll')) {
for (let dir in this.iosScrollbars) {
this.container.removeChild(this.iosScrollbars[dir].container)
this.popupContent.appendChild(this.iosScrollbars[dir].container)

View file

@ -85,7 +85,7 @@ class Panel extends Container() {
this.container.classList.add('contains-widgets')
if (iOS13) {
if (iOS13 && this.getProp('scroll')) {
faderDefaults = faderDefaults || Fader.defaults()._props()
@ -291,7 +291,7 @@ class Panel extends Container() {
case 'colorBg':
this.setCssVariables()
case 'colorWidget':
if (iOS13) this.checkScrollBars()
if (iOS13 && this.getProp('scroll')) this.checkScrollBars()
case 'colorText':
case 'colorFill':
case 'colorStroke':