diff --git a/.travis.yml b/.travis.yml index 95ad0b73..a59d45d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index d28fb799..92eb53a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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()` diff --git a/README.md b/README.md index 23a1dce3..b98c5313 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Open Stage Control - Website: https://openstagecontrol.ammd.net/ - Forum: https://openstagecontrol.discourse.group/ -- IRC: Freenode #openstagecontrol +- IRC: Libera.chat #openstagecontrol ---- diff --git a/package.json b/package.json index 5e1c5b43..40e3ac58 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index b99c3923..66ef5847 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -801,7 +801,7 @@ | property | type |default | description | | --- | --- | --- | --- | - |
script#
| `script` | "" | Script executed whenever the widget's receives the defined event. See documentation. | + |
script#
| `script` | "" | Script executed whenever the widget receives the defined event. See documentation. | |
event#
| `string` | "value" | Define which events trigger the script's execution.

Choices: `value`, `keyboard`, `once` | |
keyBinding#
| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation).

If the editor is enabled, some keys / combos will not work. | |
keyRepeat#
| `boolean` | true | Set to `false` to prevent keydown repeats when holding the key combo pressed | diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 4b8abffa..f13be1a4 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -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. ---- diff --git a/src/client/editor/context-menu.js b/src/client/editor/context-menu.js index 9f965873..a1113cb9 100644 --- a/src/client/editor/context-menu.js +++ b/src/client/editor/context-menu.js @@ -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' }) diff --git a/src/client/editor/index.js b/src/client/editor/index.js index 7e9f5f97..b2246c39 100644 --- a/src/client/editor/index.js +++ b/src/client/editor/index.js @@ -438,6 +438,8 @@ class Editor { case 't': if (!this.selectedWidgets.length) return this.widgetTree.showWidget(editor.selectedWidgets[0]) + this.widgetTree.blinkSelected() + break diff --git a/src/client/ui/ui-tree.js b/src/client/ui/ui-tree.js index 6b24e37c..0d4ed0e2 100644 --- a/src/client/ui/ui-tree.js +++ b/src/client/ui/ui-tree.js @@ -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 diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 37892089..7a227bf7 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -235,6 +235,7 @@ class Widget extends EventEmitter { } } + this.style = null this.container = html`
` @@ -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``, - 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`` + 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() { diff --git a/src/client/widgets/containers/matrix.js b/src/client/widgets/containers/matrix.js index 4b6fc4f2..71305b36 100644 --- a/src/client/widgets/containers/matrix.js +++ b/src/client/widgets/containers/matrix.js @@ -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 diff --git a/src/client/widgets/containers/modal.js b/src/client/widgets/containers/modal.js index 21831c87..99cabbb9 100644 --- a/src/client/widgets/containers/modal.js +++ b/src/client/widgets/containers/modal.js @@ -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) diff --git a/src/client/widgets/containers/panel.js b/src/client/widgets/containers/panel.js index b829d3dc..05fc3896 100644 --- a/src/client/widgets/containers/panel.js +++ b/src/client/widgets/containers/panel.js @@ -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': diff --git a/src/server/fragment-manager.js b/src/server/fragment-manager.js index 542ccca8..17593c01 100644 --- a/src/server/fragment-manager.js +++ b/src/server/fragment-manager.js @@ -49,6 +49,10 @@ class FragmentManager { this.deleteFragment(resolvedPath) }) + } else { + + ipc.send('fragmentLoad', {path: path, fileContent: this.fragments[resolvedPath]}, clientId) + } } diff --git a/src/server/midi.js b/src/server/midi.js index f0657e6c..15b0edbe 100644 --- a/src/server/midi.js +++ b/src/server/midi.js @@ -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