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

@ -25,11 +25,11 @@ before_deploy:
- npm run package -- --all
- npm run package-node
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-linux-x64/resources/app/server/
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux && echo "true" > osc-midi.json
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-win32-x64/resources/app/server/
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe && echo "true" > osc-midi.json
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-x64/open-stage-control.app/Contents/Resources/app/server
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx && echo "true" > osc-midi.json
- cd $TRAVIS_BUILD_DIR
- npm run deb64
- cd dist

View file

@ -1,10 +1,31 @@
# Changelog
## next
## 1.9.11
- bug fixes
- range: value not properly updated with set()
## 1.9.10
- bug fixes
- matrix: regression from 1.9.8 (broken nested @{} syntax in props property)
- misc
- midi: detect missing binary (eg when deleted by antivirus) and print a message
## 1.9.9
- bug fixes
- matrix: regression from 1.9.8
## 1.9.8
- bug fixes
- matrix: update children when `props` is modified even when the result for `$ = 0` doesn't change
- fragments: fragment widgets empty when reloading
- panel: scrollbar issue on iOS 13+
- scripting
- expose `console.clear()`

View file

@ -7,7 +7,7 @@ Open Stage Control
- Website: https://openstagecontrol.ammd.net/
- Forum: https://openstagecontrol.discourse.group/
- IRC: Freenode #openstagecontrol
- IRC: Libera.chat #openstagecontrol
----

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.9.7",
"version": "1.9.10",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -801,7 +801,7 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="script_script">script<a class="headerlink" href="#script_script" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed whenever the widget's receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>. |
| <h6 id="script_script">script<a class="headerlink" href="#script_script" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed whenever the widget receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>. |
| <h6 id="script_event">event<a class="headerlink" href="#script_event" title="Permanent link">#</a></h6> | `string` | <code>"value"</code> | Define which events trigger the script's execution.<br/><br/>Choices: `value`, `keyboard`, `once` |
| <h6 id="script_keyBinding">keyBinding<a class="headerlink" href="#script_keyBinding" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation).<br/><br/>If the editor is enabled, some keys / combos will not work. |
| <h6 id="script_keyRepeat">keyRepeat<a class="headerlink" href="#script_keyRepeat" title="Permanent link">#</a></h6> | `boolean` | <code>true</code> | Set to `false` to prevent keydown repeats when holding the key combo pressed |

View file

@ -123,7 +123,7 @@ Returns the value of a widget's custom variable.
- `name`: variable name as a string.
- `value`: new value for the variable.
Sets the value of a widget's custom variable. If `ìd` contains wildcards, affects all matching widgets.
Sets the value of a widget's custom variable (see [advanced syntaxes](./advanced-syntaxes.md##ustom-variables-varvariablename-default)). If `ìd` contains wildcards, affects all matching widgets.
----

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':

View file

@ -49,6 +49,10 @@ class FragmentManager {
this.deleteFragment(resolvedPath)
})
} else {
ipc.send('fragmentLoad', {path: path, fileContent: this.fragments[resolvedPath]}, clientId)
}
}

View file

@ -18,11 +18,19 @@ var midiBinaries = {
win32: 'osc-midi-windows.exe'
}
var expectMidiBinaries = false,
expectMidiBinariesError = false
try {
expectMidiBinaries = eval('require("./osc-midi.json")')
} catch(e) {}
var pythonPathOverride
if (process.arch === 'x64' && midiBinaries[process.platform]) {
var p = path.resolve(__dirname, midiBinaries[process.platform])
if (fs.existsSync(p)) {
pythonPathOverride = p
} else if (expectMidiBinaries) {
expectMidiBinariesError = true
}
}
@ -30,6 +38,8 @@ class MidiConverter {
constructor() {
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
this.py = new PythonShell('python/midi.py', Object.assign({
args: [
'--params',
@ -112,6 +122,8 @@ class MidiConverter {
static list() {
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, pythonOptions), function(e, results) {
if (e) {
if (e.code === 'ENOENT') {
@ -138,6 +150,14 @@ class MidiConverter {
}
static midiBinariesError() {
console.error(`(ERROR, MIDI) Could not find midi binary file ${p}\nIt may have been deleted by your antivirus.`)
console.log('(INFO, MIDI) Falling back to python implementation (see https://openstagecontrol.ammd.net/docs/midi/midi-configuration/).')
expectMidiBinariesError = false
}
}
module.exports = MidiConverter