From c3002b99c3aecba9a99c591f765dcb918b2b5fae Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 10:54:56 +0100 Subject: [PATCH 001/114] value events: remove some useless flags --- src/client/managers/state.mjs | 6 +++--- src/client/widgets/common/widget.mjs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/managers/state.mjs b/src/client/managers/state.mjs index 9a20abf7..606a436b 100644 --- a/src/client/managers/state.mjs +++ b/src/client/managers/state.mjs @@ -65,7 +65,7 @@ var StateManager = class StateManager { if (widgets[j].setValue && !widgets[j].noValueState) { - widgets[j].setValue(value, {send:send, sync:true, fromState:true}) + widgets[j].setValue(value, {send:send, sync:true}) } @@ -226,7 +226,7 @@ var StateManager = class StateManager { if (this.valueStateQueue[id] !== undefined) { for (let w of widgetManager.getWidgetById(id)) { if (w.noValueState) continue - w.setValue(this.valueStateQueue[id], {sync: true, fromState:true, fromEdit: true}) + w.setValue(this.valueStateQueue[id], {sync: true, script: false}) } } } @@ -235,7 +235,7 @@ var StateManager = class StateManager { if (this.valueNewPropQueue[id] != this.valueOldPropQueue[id]) { for (let w of widgetManager.getWidgetById(id)) { if (w.noValueState) continue - w.setValue(w.getProp('value'), {sync: true, fromState:true}) + w.setValue(w.getProp('value'), {sync: true}) } } } diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index a2ceda03..22c42acc 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -241,7 +241,7 @@ class Widget extends EventEmitter { context: {value: 0, id: '', touch: undefined} }) this.on('value-changed', (e)=>{ - if (e.widget === this && this.mounted && !e.options.fromEdit && e.options.script !== false) { + if (e.widget === this && this.mounted && e.options.script !== false) { this.scripts.onValue.run({ value: e.options.widget ? e.options.widget.value : this.value, id: e.options.id || e.id From 414195c6219fcdfe2d5a12fa766a5767d5a42b9f Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 12:40:14 +0100 Subject: [PATCH 002/114] editor: rename changedProps vars and flag to editedProps to disambiguate --- src/client/editor/data-workers.mjs | 7 +++---- src/client/editor/index.mjs | 20 ++++++++++---------- src/client/remote-control.mjs | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/client/editor/data-workers.mjs b/src/client/editor/data-workers.mjs index 5b59f6eb..7bbccbda 100644 --- a/src/client/editor/data-workers.mjs +++ b/src/client/editor/data-workers.mjs @@ -14,16 +14,15 @@ var scrollState = {} function updateWidget(widget, options={}) { - if (options.changedProps) { + if (options.editedProps) { // alternate routine for small edits - var propNames = options.changedProps + var propNames = options.editedProps if ( // if non dynamic props have changed, skip this and use rebuild routine !propNames.some(n => !widget.isDynamicProp(n)) ) { - - var edited = widget.updateProps(options.changedProps, null, {fromEditor: true}) || widget + var edited = widget.updateProps(options.editedProps, null, {fromEditor: true}) || widget editor.widgetTree.updateTree(editor.selectedWidgets) diff --git a/src/client/editor/index.mjs b/src/client/editor/index.mjs index 37509314..399553b4 100644 --- a/src/client/editor/index.mjs +++ b/src/client/editor/index.mjs @@ -55,12 +55,12 @@ class Editor { try { - newWidgets.push(updateWidget(w, {changedProps: [propName], preventSelect: this.selectedWidgets.length > 1})) + newWidgets.push(updateWidget(w, {editedProps: [propName], preventSelect: this.selectedWidgets.length > 1})) } catch (e) { w.props[propName] = previousValue - updateWidget(w, {changedProps: [propName], preventSelect: this.selectedWidgets.length > 1}) + updateWidget(w, {editedProps: [propName], preventSelect: this.selectedWidgets.length > 1}) if (uiConsole.minimized) notifications.add({ class: 'error', @@ -916,7 +916,7 @@ class Editor { var newWidgets = [], area = this.widgetDragResize, - changedProps = [] + editedProps = [] for (var i = 0; i < this.selectedWidgets.length; i++) { @@ -938,7 +938,7 @@ class Editor { } else { w.props.width = newWidth } - changedProps.push('width') + editedProps.push('width') if (this.selectedWidgets.length > 1) { var newLeft = Math.max(nL, GRIDWIDTH) / PXSCALE @@ -947,7 +947,7 @@ class Editor { } else if (w.props.left !== 'auto'){ w.props.left = newLeft } - changedProps.push('left') + editedProps.push('left') } } @@ -959,7 +959,7 @@ class Editor { } else { w.props.height = newHeight } - changedProps.push('height') + editedProps.push('height') if (this.selectedWidgets.length > 1) { var newTop = Math.max(nT, GRIDWIDTH) / PXSCALE @@ -968,11 +968,11 @@ class Editor { } else if (w.props.top !== 'auto'){ w.props.top = newTop } - changedProps.push('top') + editedProps.push('top') } } - if (w.props.width !== undefined || w.props.height !== undefined) newWidgets.push(updateWidget(w, {changedProps: changedProps, preventSelect: this.selectedWidgets.length > 1})) + if (w.props.width !== undefined || w.props.height !== undefined) newWidgets.push(updateWidget(w, {editedProps: editedProps, preventSelect: this.selectedWidgets.length > 1})) } @@ -1009,7 +1009,7 @@ class Editor { w.props.left = newLeft } - newWidgets.push(updateWidget(w, {changedProps: ['top', 'left'], preventSelect: this.selectedWidgets.length > 1})) + newWidgets.push(updateWidget(w, {editedProps: ['top', 'left'], preventSelect: this.selectedWidgets.length > 1})) } @@ -1097,7 +1097,7 @@ class Editor { if (indexes) { options = {...indexes} } else { - options.changedProps = Object.keys(subpatch) + options.editedProps = Object.keys(subpatch) options.reuseChildren = false } diff --git a/src/client/remote-control.mjs b/src/client/remote-control.mjs index 7bcc8c35..10526a5d 100644 --- a/src/client/remote-control.mjs +++ b/src/client/remote-control.mjs @@ -31,7 +31,7 @@ var callbacks = { updateWidget(widget, { reuseChildren: !(newdata.widgets || newdata.tabs), - changedProps: Object.keys(newdata) + editedProps: Object.keys(newdata) }) } @@ -61,7 +61,7 @@ var callbacks = { updateWidget(widget, { reuseChildren: !(newdata.widgets || newdata.tabs), - changedProps: Object.keys(newdata) + editedProps: Object.keys(newdata) }) } From 80e5b048ea8aa110e1bd5c8052353a02c97581e0 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 12:50:34 +0100 Subject: [PATCH 003/114] switch: make values prop dynamic --- CHANGELOG.md | 1 + src/client/widgets/basics/dropdown.mjs | 3 --- src/client/widgets/basics/switch.mjs | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a6b2104..d8ddac2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - input: add `noCanvas` option to avoid blurry text under some circumstances - xy: add `clipX` and `clipY` proprties (allows multixy to set per-pads anges limits) - button: add `onTouch` script + - switch: make `values` property dynamic - editor - selecting a widget automatically shows it in the widget tree if it's not minimized diff --git a/src/client/widgets/basics/dropdown.mjs b/src/client/widgets/basics/dropdown.mjs index 2a204fc7..acf89442 100644 --- a/src/client/widgets/basics/dropdown.mjs +++ b/src/client/widgets/basics/dropdown.mjs @@ -84,8 +84,6 @@ class Dropdown extends MenuBase { `) } - this.setValue(this.value) - } setValue(v,options={}) { @@ -121,7 +119,6 @@ class Dropdown extends MenuBase { case 'values': this.parseValues() - this.setValue(this.value) return case 'label': this.setLabel() diff --git a/src/client/widgets/basics/switch.mjs b/src/client/widgets/basics/switch.mjs index 3b2c8f5e..88d12f31 100644 --- a/src/client/widgets/basics/switch.mjs +++ b/src/client/widgets/basics/switch.mjs @@ -108,6 +108,8 @@ class Switch extends MenuBase { super.parseValues() + this.widget.innerHTML = '' + for (var i = 0; i < this.values.length; i++) { this.widget.appendChild(html` @@ -116,6 +118,8 @@ class Switch extends MenuBase { } + this.setValue(this.value) + } setValue(v, options={}) { @@ -135,6 +139,19 @@ class Switch extends MenuBase { } + onPropChanged(propName, options, oldPropValue) { + + var ret = super.onPropChanged(...arguments) + + switch (propName) { + + case 'values': + this.parseValues() + } + + return ret + + } setCssVariables() { super.setCssVariables() @@ -144,6 +161,10 @@ class Switch extends MenuBase { } } +Switch.dynamicProps = Switch.prototype.constructor.dynamicProps.concat( + 'values' +) + Switch.cssVariables = Switch.prototype.constructor.cssVariables.concat( {js: 'colorTextOn', css: '--color-text-on'} ) From c1720b4a52c379c565cf20095ffd912bb0a3f3dd Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 13:47:13 +0100 Subject: [PATCH 004/114] widget: updateProps: add a special case for value property, when edited (remotely or from the editor), check against the value state instead to decide whether to update the state or not. The regular behavior that works well for other properties is otherwise confusing for the value as it is not ovious to the user that there are two values (the property and the state) --- src/client/widgets/common/widget.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 22c42acc..908728a4 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -931,7 +931,7 @@ class Widget extends EventEmitter { if (widget === this && updatedProps.includes(propName)) continue let propValue = this.resolveProp(propName, undefined, false), - oldPropValue = this.getProp(propName) + oldPropValue = propName == 'value' && options.fromEditor ? this.value : this.getProp(propName) if (!deepEqual(oldPropValue, propValue)) { From 5b3d3e671ca836e401512263e6c6d57054029df0 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 13:56:32 +0100 Subject: [PATCH 005/114] widget: amend c1720b4a52c379c565cf20095ffd912bb0a3f3dd to keep things as unchanged as possible --- src/client/widgets/common/widget.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 908728a4..9e6c278b 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -931,9 +931,12 @@ class Widget extends EventEmitter { if (widget === this && updatedProps.includes(propName)) continue let propValue = this.resolveProp(propName, undefined, false), - oldPropValue = propName == 'value' && options.fromEditor ? this.value : this.getProp(propName) + oldPropValue = this.getProp(propName) - if (!deepEqual(oldPropValue, propValue)) { + if ( + !deepEqual(oldPropValue, propValue) || + (propName == 'value' && options.fromEditor && !deepEqual(oldPropValue, this.value)) + ) { if (!this.isDynamicProp(propName)) { @@ -965,7 +968,6 @@ class Widget extends EventEmitter { } - } } From 4627fa9c02e8b7fa1df06b51f5c14f871d130d32 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 14:03:19 +0100 Subject: [PATCH 006/114] log: value state/prop change --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ddac2f..68dba96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - editor - selecting a widget automatically shows it in the widget tree if it's not minimized + - submitting an unchanged value for the `value` property will now affect the value state of the widget even if the property content itself did not change - scripting - user scripts are longer protected against infinite loop and the main window object may be reached (it's not supported to break out of scripting context, but resources are no longer wasted to prevent it) From 8cf854af2e5e6eb1871291bb572c0773ea13876b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 29 Dec 2025 18:38:53 +0100 Subject: [PATCH 007/114] noop: rename internal event for better clarity --- src/client/widgets/common/widget.mjs | 2 +- src/client/widgets/containers/clone.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 9e6c278b..530ac6ed 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -1002,7 +1002,7 @@ class Widget extends EventEmitter { // emit prop-changed event if not already // to make sure an advanced syntax changes don't go unnoticed by clone var unNotified = propNames.filter(n => !changedProps.includes(n)) - widgetManager.trigger('prop-changed-maybe', { + widgetManager.trigger('prop-src-changed', { id: this.getProp('id'), props: unNotified, widget: this, diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index b53f0eeb..5e503610 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -114,7 +114,7 @@ class Clone extends Container() { widgetManager.on('prop-changed', onPropChanged, {context: this}) // see common/widget.js @ updateProps() - widgetManager.on('prop-changed-maybe', onPropChanged, {context: this}) + widgetManager.on('prop-src-changed', onPropChanged, {context: this}) this.on('widget-created', (e)=>{ From f4af775a98b37a4f52427d5e561d5f9d3bb4cecd Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 30 Dec 2025 17:08:29 +0100 Subject: [PATCH 008/114] package: 1.30 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c5e8a489..8b523dde 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.30.0-beta10", + "version": "1.30.0", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" From 1aa3fbfef5ec367a80440e44c07dad548dbda070 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 30 Dec 2025 17:34:05 +0100 Subject: [PATCH 009/114] script-vm: fix setTimeout/setInterval override --- src/client/widgets/vm.mjs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/client/widgets/vm.mjs b/src/client/widgets/vm.mjs index 4a8b2cbd..24124ecd 100644 --- a/src/client/widgets/vm.mjs +++ b/src/client/widgets/vm.mjs @@ -53,6 +53,19 @@ class Vm { // global context this.globals = {} + this.globals.console = { + ...console, + log: (...msg)=>{ + msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m) : m) + this.getWidget().log(msg.join(' ')) + } + } + + this.globals.setTimeout = + this.globals.setInterval = ()=>{ + throw 'setTimeout and setInterval can\'t be used in the JS sandbox' + } + this.registerGlobals() // detach sandbox @@ -75,19 +88,6 @@ class Vm { registerGlobals() { - this.globals.console = { - ...console, - log: (...msg)=>{ - msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m) : m) - this.getWidget().log(msg.join(' ')) - } - } - - this.globals.setTimeout = - this.globals.setInterval = ()=>{ - throw 'setTimeout and setInterval can\'t be used in the JS sandbox' - } - this.globals.globals = globals for (var k in this.globals) { From 43ac672d943fde701b70d17bb03332d0e98b1ffe Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 30 Dec 2025 17:55:42 +0100 Subject: [PATCH 010/114] docs: new downloads --- resources/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index 4a51537a..bf45d845 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.29.8 +latest_release: 1.30.0 theme: name: 'material' From 2758a79ff5d8253daaec081132ce511b55de3044 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 30 Dec 2025 18:04:18 +0100 Subject: [PATCH 011/114] widget: last minute regression in updateProps --- src/client/widgets/common/widget.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 530ac6ed..4461ceba 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -935,7 +935,7 @@ class Widget extends EventEmitter { if ( !deepEqual(oldPropValue, propValue) || - (propName == 'value' && options.fromEditor && !deepEqual(oldPropValue, this.value)) + (option && options.fromEditor && propName == 'value' && !deepEqual(oldPropValue, this.value)) ) { if (!this.isDynamicProp(propName)) { From 665515b626c212d339c48cb3e5a77c1645dcfba2 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 30 Dec 2025 18:17:43 +0100 Subject: [PATCH 012/114] widget: fix typo --- src/client/widgets/common/widget.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 4461ceba..a2493fa6 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -935,7 +935,7 @@ class Widget extends EventEmitter { if ( !deepEqual(oldPropValue, propValue) || - (option && options.fromEditor && propName == 'value' && !deepEqual(oldPropValue, this.value)) + (options && options.fromEditor && propName == 'value' && !deepEqual(oldPropValue, this.value)) ) { if (!this.isDynamicProp(propName)) { From d0a76d4ce3b8dbeb6e85925511b0fc4ba8f239f2 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 3 Jan 2026 10:06:21 +0100 Subject: [PATCH 013/114] server: don't use path.resove on assets (fails on windows) and fix regexp --- src/server/node/server.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index ccf7c71a..4e720778 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -187,7 +187,7 @@ class WebServer extends EventEmitter { } else { if ( - path.resolve(url).match(/^\/assets|client\//) + url.match(/^\/+(assets|client)\//) ) { // osc asset files From c3f526070fef7a93eafb5a74197ce2e96f8bc56b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 7 Jan 2026 00:49:43 +0100 Subject: [PATCH 014/114] log: electron version --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68dba96c..a9b094ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,9 @@ - scrollbar styling is now done using only the standard css scrollbar-* properties) to be more in line with system scrollbars in general - panels no longer use their value to set/get their scrolling state, nor do they sync scrolling automatically. Instead there's now a dedicated scrollbar widget that can be used for this. +- misc + - now using electron v36.9.5 + ## 1.29.9 - build From b8c59db5f3c512a0632e468034dfb930351bce36 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 8 Jan 2026 21:24:58 +0100 Subject: [PATCH 015/114] server: fix user asset loading from folder named "assets" (or "client"). This also makes osc asset urls more clear --- CHANGELOG.md | 5 +++++ src/client/ui/ui-code-editor.mjs | 2 +- src/html/client.html | 26 +++++++++++++------------- src/server/node/server.mjs | 4 ++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9b094ef..03843598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.30.1 + +- bug fixes + - regression breaking user asset loading from a root directory named "assets" + ## 1.30.0 - bug fixes diff --git a/src/client/ui/ui-code-editor.mjs b/src/client/ui/ui-code-editor.mjs index 8046b637..fd7a8b63 100644 --- a/src/client/ui/ui-code-editor.mjs +++ b/src/client/ui/ui-code-editor.mjs @@ -20,7 +20,7 @@ var scriptGlobals = scriptVm.globals, const ace = window.ace -ace.config.set('basePath', '/client/ace/') +ace.config.set('basePath', '/__APP_DIR__/client/ace/') function setCommandEnabled(editor, name, enabled) { var command = editor.commands.byName[name] diff --git a/src/html/client.html b/src/html/client.html index 135a6e23..6191a0c8 100644 --- a/src/html/client.html +++ b/src/html/client.html @@ -8,19 +8,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index 4e720778..d12ae8df 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -187,7 +187,7 @@ class WebServer extends EventEmitter { } else { if ( - url.match(/^\/+(assets|client)\//) + url.match(/^\/+__APP_DIR__\//) ) { // osc asset files @@ -217,7 +217,7 @@ class WebServer extends EventEmitter { } else { try { - res.sendFile(path.resolve(__dirname + '/../../' + url)) + res.sendFile(path.resolve(__dirname + '/../../' + url.replace('__APP_DIR__/', ''))) return true } catch(e) {} From 0bfbf59f0fa41a7fac474125b55c635d1071599c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 8 Jan 2026 22:40:29 +0100 Subject: [PATCH 016/114] custom module: fix nativeRequire resolve path (somehow broke during esm migration) --- CHANGELOG.md | 1 + src/server/node/custom-module.mjs | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03843598..500f666f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - regression breaking user asset loading from a root directory named "assets" + - regression breaking custom module's `nativeRequire()` for locally installed modules ## 1.30.0 diff --git a/src/server/node/custom-module.mjs b/src/server/node/custom-module.mjs index 42ae942d..5169cd61 100644 --- a/src/server/node/custom-module.mjs +++ b/src/server/node/custom-module.mjs @@ -2,7 +2,7 @@ import fs from 'fs' import vm from 'vm' import chokidar from 'chokidar' import path from 'path' -import {globalPaths} from 'module' +import {Module} from 'module' import * as settings from './settings.mjs' var modulePathExtended = false, @@ -79,10 +79,9 @@ class CustomModule { } if (!this.submodule && !modulePathExtended) { - globalPaths.push( - path.resolve(path.dirname(this.filename)), - path.resolve(path.dirname(this.filename), 'node_modules') - ) + process.env.NODE_PATH += path.delimiter + path.resolve(path.dirname(this.filename)) + process.env.NODE_PATH += path.delimiter + path.resolve(path.dirname(this.filename), 'node_modules') + Module._initPaths() modulePathExtended = true } From 11af5edc70c68682512fcd767de45cb8a5dd556b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 8 Jan 2026 22:42:00 +0100 Subject: [PATCH 017/114] package: 1.30.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b523dde..8c7d19ae 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.30.0", + "version": "1.30.1", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" From bf72d38fcf215d7d96b7e35eb86d351a5186ee5c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 8 Jan 2026 22:53:26 +0100 Subject: [PATCH 018/114] docs: bump --- resources/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index bf45d845..316d62dd 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.30.0 +latest_release: 1.30.1 theme: name: 'material' From 750f89b6ce4030f0e4117a2ae90a1a9ca8414267 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 8 Jan 2026 22:56:39 +0100 Subject: [PATCH 019/114] docs: fix biuld for node 22 --- src/docs/client-shim.mjs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/docs/client-shim.mjs b/src/docs/client-shim.mjs index b1969900..dc87e8ca 100644 --- a/src/docs/client-shim.mjs +++ b/src/docs/client-shim.mjs @@ -60,10 +60,6 @@ window = { location: {search: ''}, Image: Function, document: document, - navigator: { - platform:'', - userAgent: '' - }, NodeList: Array, WebSocket: Object, localStorage: { @@ -81,7 +77,14 @@ window = { ENV: {id: ''}, IP: '', DOM +} +if (!global.navigator) { + // defined as getter since node 22 + window.navigator = { + platform:'', + userAgent: '' + } } Object.assign(global, window) From a425d8156cb2eb557499f91dbccec380a894ad95 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 9 Jan 2026 09:28:32 +0100 Subject: [PATCH 020/114] server: fix @imports from theme (don't serve it from osc_asset dir to let imports load from user locations) --- src/html/client.html | 2 +- src/server/node/server.mjs | 149 ++++++++++++++++++------------------- 2 files changed, 75 insertions(+), 76 deletions(-) diff --git a/src/html/client.html b/src/html/client.html index 6191a0c8..48ea3ece 100644 --- a/src/html/client.html +++ b/src/html/client.html @@ -10,7 +10,7 @@ - + diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index d12ae8df..e7e95491 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -154,6 +154,9 @@ class WebServer extends EventEmitter { var url = req.url if (url === '/qrcode'){ + + // qrcode image + res.setHeader('Content-Type', 'image/svg+xml') let str = this.qrcode, buf = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from(str) : new Buffer(str) @@ -162,6 +165,8 @@ class WebServer extends EventEmitter { } else if (url === '/' || url.indexOf('/?') === 0) { + // index.html + var ip = req.connection.remoteAddress.replace('::ffff:', '') var clientOptions = {} @@ -184,99 +189,93 @@ class WebServer extends EventEmitter { `)) .pipe(res) + } else if (url.indexOf('__APP_THEME__.css') != -1) { + + // user theme(s) + + res.setHeader('Content-Type', 'text/css') + + var etag = settings.read('theme') ? theme.hash : 'empty-theme' + res.setHeader('Cache-Control', 'no-cache') + res.setHeader('ETag', etag) + if (req.headers['if-none-match'] && req.headers['if-none-match'] === etag) { + res.statusCode = 304 + res.end() + return + } + + if (settings.read('theme')) { + let str = theme.get(), + buf = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from(str) : new Buffer(str) + res.write(buf) + } else { + res.write('') + } + res.end() + + } else if (url.match(/^\/+__APP_DIR__\//)) { + + // osc asset files + + try { + res.sendFile(path.resolve(__dirname + '/../../' + url.replace('__APP_DIR__/', ''))) + return true + } catch(e) {} + + + console.error(`(ERROR, HTTP) File not found: ${url}`) + + if (url.match(/\/client\/index.*\.js/)) { + console.warn('(WARNING) It seems a client attempted to load an older version of the app,', + 'this may occur when using a homescreen bookmark on mobile devices.', + 'If that\'s the case, please delete it and browse to the app\'s url again.') + } + + res.writeHead(404) + res.end() + + } else { - if ( - url.match(/^\/+__APP_DIR__\//) - ) { + // user files - // osc asset files + // windows absolute path fix + url = url.replace('_:_', ':') // escaped drive colon + url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash - if (url.indexOf('theme.css') != -1) { + if (url.match(/.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) { - res.setHeader('Content-Type', 'text/css') + // Resolution order: session path, theme path, absolute path + var id + if (req.headers.cookie) { + id = (req.headers.cookie.match(/client_id=([^;]+)/) || [])[1] + } - var etag = settings.read('theme') ? theme.hash : 'empty-theme' - res.setHeader('Cache-Control', 'no-cache') - res.setHeader('ETag', etag) - if (req.headers['if-none-match'] && req.headers['if-none-match'] === etag) { - res.statusCode = 304 - res.end() - return - } - - if (settings.read('theme')) { - let str = theme.get(), - buf = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from(str) : new Buffer(str) - res.write(buf) - } else { - res.write('') - } - res.end() - - } else { + var resolvedPath = this.resolvePath(decodeURI(url), id) + if (resolvedPath) { try { - res.sendFile(path.resolve(__dirname + '/../../' + url.replace('__APP_DIR__/', ''))) + res.sendFile(resolvedPath) return true } catch(e) {} + } - + if (!this.ignoredNotFound.includes(url)) { console.error(`(ERROR, HTTP) File not found: ${url}`) - - if (url.match(/\/client\/index.*\.js/)) { - console.warn('(WARNING) It seems a client attempted to load an older version of the app,', - 'this may occur when using a homescreen bookmark on mobile devices.', - 'If that\'s the case, please delete it and browse to the app\'s url again.') - } - - res.writeHead(404) - res.end() - } + res.writeHead(404) + res.end() + + } else if (url.includes('/osc-ping')) { + this.httpCheck(true) } else { - - // user files - - // windows absolute path fix - url = url.replace('_:_', ':') // escaped drive colon - url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash - - if (url.match(/.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) { - - // Resolution order: session path, theme path, absolute path - var id - if (req.headers.cookie) { - id = (req.headers.cookie.match(/client_id=([^;]+)/) || [])[1] - } - - var resolvedPath = this.resolvePath(decodeURI(url), id) - - if (resolvedPath) { - try { - res.sendFile(resolvedPath) - return true - } catch(e) {} - } - - if (!this.ignoredNotFound.includes(url)) { - console.error(`(ERROR, HTTP) File not found: ${url}`) - } - - res.writeHead(404) - res.end() - - } else if (url.includes('/osc-ping')) { - this.httpCheck(true) - } else { - res.writeHead(403) - res.end() - } - + res.writeHead(403) + res.end() } } + } httpCheck(ok, error) { From 08d4139844a368b3dc22571ee06bc5fe3c92a25a Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 9 Jan 2026 09:41:36 +0100 Subject: [PATCH 021/114] server: define sendFile as server method once and for all --- src/server/node/server.mjs | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index e7e95491..82d7eb94 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -129,27 +129,28 @@ class WebServer extends EventEmitter { } - httpRoute(req, res) { + sendFile(req, res, path) { - res.sendFile = (path)=>{ - var fpath = path.split('?')[0] - var stats = fs.statSync(fpath) - if (!stats || !stats.isFile()) { - throw `File "${fpath}" not found.` - } - var lastModified = new Date(stats.mtime) - lastModified.setMilliseconds(0) - res.setHeader('Cache-Control', 'no-cache') - res.setHeader('Last-Modified', lastModified.toUTCString()) - if ( - req.headers['if-modified-since'] && new Date(req.headers['if-modified-since']).getTime() >= lastModified.getTime() - ) { - res.statusCode = 304 - res.end() - return - } - return send(req, fpath).pipe(res) + var fpath = path.split('?')[0] + var stats = fs.statSync(fpath) + if (!stats || !stats.isFile()) { + throw `File "${fpath}" not found.` } + var lastModified = new Date(stats.mtime) + lastModified.setMilliseconds(0) + res.setHeader('Cache-Control', 'no-cache') + res.setHeader('Last-Modified', lastModified.toUTCString()) + if ( + req.headers['if-modified-since'] && new Date(req.headers['if-modified-since']).getTime() >= lastModified.getTime() + ) { + res.statusCode = 304 + res.end() + return + } + return send(req, fpath).pipe(res) + } + + httpRoute(req, res) { var url = req.url @@ -218,7 +219,7 @@ class WebServer extends EventEmitter { // osc asset files try { - res.sendFile(path.resolve(__dirname + '/../../' + url.replace('__APP_DIR__/', ''))) + this.sendFile(req, res, path.resolve(__dirname + '/../../' + url.replace('__APP_DIR__/', ''))) return true } catch(e) {} @@ -255,7 +256,7 @@ class WebServer extends EventEmitter { if (resolvedPath) { try { - res.sendFile(resolvedPath) + this.sendFile(req, res, resolvedPath) return true } catch(e) {} } From 4c008099cab164b9360acc24404608267f0adfe5 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 9 Jan 2026 18:52:24 +0100 Subject: [PATCH 022/114] docs: update browser requirements --- resources/docs/docs/getting-started/introduction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/docs/docs/getting-started/introduction.md b/resources/docs/docs/getting-started/introduction.md index 9c82bfd4..bcff82e9 100644 --- a/resources/docs/docs/getting-started/introduction.md +++ b/resources/docs/docs/getting-started/introduction.md @@ -18,9 +18,9 @@ The **server** can run on all [platforms supported by Electron](https://www.elec The **client** is compatible with the following browsers: - Firefox: version `75` and higher -- Chromium / Chrome: version `60` and higher +- Chromium / Chrome: version `75` and higher -iOS devices must be of version `10.3` or higher. +iOS devices must be of version `11` or higher. ## Installation From c59c4a8065d198bf95f1b6316a7410cb80423b59 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 20 Jan 2026 09:51:35 +0100 Subject: [PATCH 023/114] widgets: resolveProp: preserve numbers and booleans as strings in object values --- CHANGELOG.md | 5 +++++ package.json | 2 +- src/client/widgets/common/widget.mjs | 13 ++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 500f666f..434b6057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.30.2 + +- bug fixes + - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts + ## 1.30.1 - bug fixes diff --git a/package.json b/package.json index 8c7d19ae..f446937a 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.30.1", + "version": "1.30.2", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index a2493fa6..28accfe9 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -567,7 +567,7 @@ class Widget extends EventEmitter { } - resolveProp(propName, propValue, storeLinks=true, originalWidget, originalPropName, context) { + resolveProp(propName, propValue, storeLinks=true, originalWidget, originalPropName, context, recursive) { propValue = propValue !== undefined ? propValue : deepCopy(this.props[propName]) originalWidget = originalWidget || this @@ -886,7 +886,14 @@ class Widget extends EventEmitter { propValue = propValue.replace(new RegExp(k, 'g'), v) } - if (isJSON(propValue) && (propName !== 'label' || propValue === 'false')) { + if ( + // json heuristic + isJSON(propValue) && + // allow "false" string in label + (propName !== 'label' || propValue === 'false') && + // don't coerce booleans and numbers as strings in objects + (!recursive || (isNaN(propValue) && propValue != 'true' && propValue != 'false')) + ) { try { propValue = JSON.parse(propValue) } catch (err) {} @@ -894,7 +901,7 @@ class Widget extends EventEmitter { } else if (propValue != null && typeof propValue == 'object') { for (let k in propValue) { - propValue[k] = this.resolveProp(propName, propValue[k], storeLinks, originalWidget, originalPropName, context) + propValue[k] = this.resolveProp(propName, propValue[k], storeLinks, originalWidget, originalPropName, context, true) } } From 5bf5ab87548e28ee886e8796b784f1dda7614ef4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 22 Jan 2026 10:52:20 +0100 Subject: [PATCH 024/114] editor: preserve code editor undo history between consecutive edits of a same widget's property --- CHANGELOG.md | 3 +++ src/client/ui/ui-code-editor.mjs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 434b6057..13c64005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ - bug fixes - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts +- editor + - preserve code editor undo history between consecutive edits of a same widget's property + ## 1.30.1 - bug fixes diff --git a/src/client/ui/ui-code-editor.mjs b/src/client/ui/ui-code-editor.mjs index fd7a8b63..ecfe8e51 100644 --- a/src/client/ui/ui-code-editor.mjs +++ b/src/client/ui/ui-code-editor.mjs @@ -242,7 +242,11 @@ class CodeEditor { field.appendChild(this.helpBtn) field.appendChild(this.fsBtn) - editor.getSession().getUndoManager().reset() + if (this.hash !== widget.hash) { + // preserve undo history if widget is the same + editor.getSession().getUndoManager().reset() + this.hash = widget.hash + } editor.resize() From daa4fbfecfa4e050a72d61a8e54375341792769e Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 22 Jan 2026 11:57:37 +0100 Subject: [PATCH 025/114] code editor: keep fullscreen code editor focused and opened upon validation --- src/client/ui/ui-code-editor.mjs | 50 ++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/client/ui/ui-code-editor.mjs b/src/client/ui/ui-code-editor.mjs index ecfe8e51..62105432 100644 --- a/src/client/ui/ui-code-editor.mjs +++ b/src/client/ui/ui-code-editor.mjs @@ -133,7 +133,6 @@ class CodeEditor { var editor = this.editor, input = this.input - editor.fullscreen = false input.style.display = 'none' input._ace_input = editor.textarea input.tabIndex = -1 @@ -141,11 +140,6 @@ class CodeEditor { editor.setValue(input.value) editor.textarea.osc_input = input editor.textarea.tabIndex = 0 - editor.selection.setRange({start:0,end:0}) - if (!this.widget || widget.hash !== this.widget.hash) { - // preserve active line if widget is the same - editor.gotoLine(0) - } editor.removeAllListeners('focus') this.editor.on('focus', (e)=>{ @@ -161,27 +155,36 @@ class CodeEditor { this.editor.dirty = true }) - setTimeout(()=>{ - var pos = this.editor.getCursorPosition() - if (pos.row === undefined || pos.column === undefined) { - this.editor.gotoLine(0) - } - }) - this.typing = false setCommandEnabled(this.editor, 'indent', false) setCommandEnabled(this.editor, 'outdent', false) - this.editor.on('changeSelection', ()=>{ - if (this.typing) return - let pos = this.editor.getCursorPosition() - if (pos.row || pos.column) { - setCommandEnabled(this.editor, 'indent', true) - setCommandEnabled(this.editor, 'outdent', true) + setTimeout(()=>{ + if (this.pos) { + this.editor.moveCursorTo(this.pos.row, this.pos.column) + } else { + var pos = this.editor.getCursorPosition() + if (pos.row === undefined || pos.column === undefined) { + this.editor.gotoLine(0) + } + } - this.typing = true + + this.typing = false + this.editor.on('changeSelection', ()=>{ + if (this.typing) return + let pos = this.editor.getCursorPosition() + if (pos.row || pos.column) { + setCommandEnabled(this.editor, 'indent', true) + setCommandEnabled(this.editor, 'outdent', true) + } + this.typing = true + }) }) + + this.editor.on('blur', (e)=>{ + this.pos = this.editor.getCursorPosition() this.editor.setHighlightActiveLine(false) this.editor.setHighlightGutterLine(false) this.editor.selection.setRange({start:0,end:0}) @@ -242,13 +245,18 @@ class CodeEditor { field.appendChild(this.helpBtn) field.appendChild(this.fsBtn) + editor.selection.setRange({start:0,end:0}) + if (this.hash !== widget.hash) { // preserve undo history if widget is the same editor.getSession().getUndoManager().reset() this.hash = widget.hash + this.pos = null + } else if (editor.fullscreen) { + this.fullscreen() } - editor.resize() + editor.resize() } From 3da569700a3470eb4c7fa10e134aee797277c521 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 22 Jan 2026 12:04:50 +0100 Subject: [PATCH 026/114] code editor: add content changed hint --- CHANGELOG.md | 3 ++- src/client/ui/ui-code-editor.mjs | 5 +++++ src/scss/ui/inspector.scss | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c64005..3015a9c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts - editor - - preserve code editor undo history between consecutive edits of a same widget's property + - preserve code editor undo history between consecutive edits of a same widget's property + - preserve fullscreen code editor focus when saving / submitting ## 1.30.1 diff --git a/src/client/ui/ui-code-editor.mjs b/src/client/ui/ui-code-editor.mjs index 62105432..8998f752 100644 --- a/src/client/ui/ui-code-editor.mjs +++ b/src/client/ui/ui-code-editor.mjs @@ -141,6 +141,8 @@ class CodeEditor { editor.textarea.osc_input = input editor.textarea.tabIndex = 0 + this.field.classList.remove('dirty') + editor.removeAllListeners('focus') this.editor.on('focus', (e)=>{ this.parent.focusedInput = this.input @@ -153,6 +155,9 @@ class CodeEditor { this.editor.on('change', (e)=>{ this.input.value = this.editor.getValue() this.editor.dirty = true + if (this.editor.fullscreen) { + this.field.classList.add('dirty') + } }) this.typing = false diff --git a/src/scss/ui/inspector.scss b/src/scss/ui/inspector.scss index 1af9e113..e668e72d 100644 --- a/src/scss/ui/inspector.scss +++ b/src/scss/ui/inspector.scss @@ -190,6 +190,9 @@ osc-inspector-field { > label:before { content: var(--prefix); } + &.dirty label:after{ + content: "*" + } .btn { margin-top: 50rem; margin-right: 50rem; From 09aa7e8a632d5380a9f002129a36f3242a475a28 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 5 Feb 2026 13:28:14 +0100 Subject: [PATCH 027/114] rgb: don't break pad styling when updating hue (use correct method to update styles) --- src/client/widgets/pads/rgb.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/pads/rgb.mjs b/src/client/widgets/pads/rgb.mjs index 4b100027..734d4511 100644 --- a/src/client/widgets/pads/rgb.mjs +++ b/src/client/widgets/pads/rgb.mjs @@ -217,7 +217,7 @@ export default class Rgb extends Widget { if (!options.nohue && !options.dragged) { var hue = hsbToRgb({h:this.hsb.h,s:100,b:100}), hueStr = `rgb(${Math.round(hue.r)},${Math.round(hue.g)},${Math.round(hue.b)})` - this.pad.container.setAttribute('style',`background-color:${hueStr}`) + this.pad.container.style.setProperty('background-color', hueStr) this.hue.setValue(this.hsb.h, {sync: false, send:false, dragged:false}) } From e6824558727a74123bec52c4ecf9101910b69c30 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 10 Feb 2026 13:07:47 +0100 Subject: [PATCH 028/114] log: rgb fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3015a9c4..bd017e0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts + - rgb: fix rendering issue - editor - preserve code editor undo history between consecutive edits of a same widget's property From bfc1d182be865ed1d371f2f49f5bd1f0ec830ce4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 1 Mar 2026 11:12:34 +0100 Subject: [PATCH 029/114] patchbay: interaction and rendering issues + use draginit instead of fast-click --- CHANGELOG.md | 1 + src/client/widgets/containers/patchbay.mjs | 35 ++++++++++++++-------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd017e0e..4f279bd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - bug fixes - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts - rgb: fix rendering issue + - patchbay: interaction and rendering issues - editor - preserve code editor undo history between consecutive edits of a same widget's property diff --git a/src/client/widgets/containers/patchbay.mjs b/src/client/widgets/containers/patchbay.mjs index 931bac01..ceaf03db 100644 --- a/src/client/widgets/containers/patchbay.mjs +++ b/src/client/widgets/containers/patchbay.mjs @@ -200,31 +200,42 @@ class PatchBay extends Container(Canvas) { this.connecting = [] + this.mousePosition = [] + this.dragging = false - this.on('fast-click', (e)=>{ + this.on('draginit', (e)=>{ this.toggleConnection(e.target) - e.stopPropagation() + if (e.target === this.canvas) { + this.mousePosition = [e.offsetX, e.offsetY] + } else { + if (this.inputNodes.includes(e.target)) { + this.mousePosition = [e.offsetX - e.target.offsetWidth, e.offsetY + e.target.offsetTop] + } else { + this.mousePosition = [e.offsetX + this.canvas.offsetWidth, e.offsetY + e.target.offsetTop] + } + } }, {element: this.widget}) - - this.mousePosition = [] this.on('drag', (e)=>{ if (!this.connecting.length) { this.toggleConnection(e.target) } - if (e.target === this.canvas) { - this.mousePosition = [e.offsetX, e.offsetY] - } else if (this.mousePosition.length) { - this.mousePosition[0] += e.movementX - this.mousePosition[1] += e.movementY - } + this.mousePosition[0] += e.movementX + this.mousePosition[1] += e.movementY + this.dragging = true this.batchDraw() }, {element: this.widget}) + this.on('dragend', (e)=>{ - if (this.mousePosition.length) { + + if (this.dragging) { + // touch hover fix + var node = e.isTouch ? document.elementFromPoint(e.clientX, e.clientY) : e.target + this.mousePosition = [] - this.toggleConnection(e.target) + this.toggleConnection(node) } + this.dragging = false }, {element: this.widget}) From 84474499c7724d1fe99ede5a1b7280b42e12d385 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 1 Mar 2026 11:23:09 +0100 Subject: [PATCH 030/114] modal: use draginit as click handler (allows preventing touch event from parent container) --- src/client/widgets/containers/modal.mjs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/client/widgets/containers/modal.mjs b/src/client/widgets/containers/modal.mjs index 68ff0dfc..d611f46d 100644 --- a/src/client/widgets/containers/modal.mjs +++ b/src/client/widgets/containers/modal.mjs @@ -93,10 +93,12 @@ class Modal extends Panel { var closer = DOM.get(this.popup, '.closer')[0] - this.on('fast-click',(e)=>{ + this.on('draginit',(e)=>{ if ((e.target === this.popup || e.target === closer) && this.value == 1) { - e.detail.preventOriginalEvent = true this.setValue(0, {sync:true, send:true}) + } else if (!this.getProp('doubleTap') && e.target === this.toggle) { + if (e.capturedByEditor === true) return + this.setValue(1, {sync:true, send:true}) } }, {element: this.container}) @@ -104,17 +106,8 @@ class Modal extends Panel { doubleTap(this, ()=>{ this.setValue(1, {sync:true, send:true}) }, {element: this.toggle}) - } else { - this.on('fast-click',(e)=>{ - if (e.capturedByEditor === true) return - if (e.target === this.toggle) { - e.detail.preventOriginalEvent = true - this.setValue(1, {sync:true, send:true}) - } - }, {element: this.container}) } - this.escapeKeyHandler = ((e)=>{ if (e.key == 'Escape') this.setValue(0, {sync:true, send:true}) }).bind(this) From 270eb77802ef487017d8bbc18e0a2510435672d8 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 1 Mar 2026 11:44:56 +0100 Subject: [PATCH 031/114] log: modal click handler fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f279bd0..e0bbac97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - when using objects in properties, numbers-as-strings and booleans-as-strings values are now preserved instead of being converted to their litteral counterparts - rgb: fix rendering issue - patchbay: interaction and rendering issues + - `event.preventDefault` in `onTouch` now affect modal buttons - editor - preserve code editor undo history between consecutive edits of a same widget's property From 9961fb73b44761bb6c89471c5558aead7267412c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:27:42 +0100 Subject: [PATCH 032/114] menu: use click event in *toggle modes --- CHANGELOG.md | 2 ++ src/client/widgets/basics/menu.mjs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0bbac97..0c291a7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - rgb: fix rendering issue - patchbay: interaction and rendering issues - `event.preventDefault` in `onTouch` now affect modal buttons + - menu: use click event instead of tap in `toggle` and `doubleTap-toggle` modes + - editor - preserve code editor undo history between consecutive edits of a same widget's property diff --git a/src/client/widgets/basics/menu.mjs b/src/client/widgets/basics/menu.mjs index 45139331..dd9a6e43 100644 --- a/src/client/widgets/basics/menu.mjs +++ b/src/client/widgets/basics/menu.mjs @@ -96,7 +96,7 @@ class Menu extends MenuBase { doubleTap(this, (e)=>{ if (this.opened) return this.open(e) - }, {element: this.widget}) + }, {element: this.widget, click: this.mode.includes('toggle')}) this.on('draginit',(e)=>{ @@ -113,7 +113,7 @@ class Menu extends MenuBase { } else { - this.on('draginit',(e)=>{ + this.on(this.mode.includes('toggle') ? 'click' : 'draginit',(e)=>{ if (this.opened && this.mode.includes('toggle')) { From b016724d049d17dd1b81d12a3bb1ded58a0b5e48 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:28:05 +0100 Subject: [PATCH 033/114] modal, file: add `click` option --- src/client/widgets/basics/file.mjs | 3 ++- src/client/widgets/containers/modal.mjs | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client/widgets/basics/file.mjs b/src/client/widgets/basics/file.mjs index 55f19e0f..81d610b8 100644 --- a/src/client/widgets/basics/file.mjs +++ b/src/client/widgets/basics/file.mjs @@ -19,6 +19,7 @@ export default class File extends Widget { align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'}, hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'}, mode: {type: 'string', value: 'open', choices: ['open', 'save'], help: 'File browser mode'}, + click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap'}, }, class_specific: { directory: {type: 'string', value: 'auto', help: 'Default browsing directory'}, @@ -50,7 +51,7 @@ export default class File extends Widget { ext = '(' + ext.join('|') + ')' } - this.on('fast-click', (e)=>{ + this.on(this.getProp('click') ? 'click' : 'fast-click', (e)=>{ if (e.capturedByEditor === true) return diff --git a/src/client/widgets/containers/modal.mjs b/src/client/widgets/containers/modal.mjs index d611f46d..1b810164 100644 --- a/src/client/widgets/containers/modal.mjs +++ b/src/client/widgets/containers/modal.mjs @@ -18,7 +18,8 @@ class Modal extends Panel { return super.defaults().extend({ class_specific: { - doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'}, + doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap (allows scrolling when touching the modal button)'}, + click: {type: 'boolean', value: false, help: 'Set to `true` to make the modal open/close upon click event instead of tap (allows scrolling when touching the modal button)'}, }, geometry: { _separator_modal_geometry: 'Modal geometry', @@ -93,7 +94,7 @@ class Modal extends Panel { var closer = DOM.get(this.popup, '.closer')[0] - this.on('draginit',(e)=>{ + this.on(this.getProp('click') ? 'click' : 'draginit',(e)=>{ if ((e.target === this.popup || e.target === closer) && this.value == 1) { this.setValue(0, {sync:true, send:true}) } else if (!this.getProp('doubleTap') && e.target === this.toggle) { @@ -105,7 +106,7 @@ class Modal extends Panel { if (this.getProp('doubleTap')) { doubleTap(this, ()=>{ this.setValue(1, {sync:true, send:true}) - }, {element: this.toggle}) + }, {element: this.toggle, click: this.getProp('click')}) } this.escapeKeyHandler = ((e)=>{ From 6b37c4521e26784bd7fb2bd5adc0d3024d40d44c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:37:29 +0100 Subject: [PATCH 034/114] button: add `click` option & add missing move events to onTouch --- src/client/widgets/basics/button.mjs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/widgets/basics/button.mjs b/src/client/widgets/basics/button.mjs index ae048a66..c1f1ca23 100644 --- a/src/client/widgets/basics/button.mjs +++ b/src/client/widgets/basics/button.mjs @@ -45,6 +45,7 @@ class Button extends Widget { '- `tap` (no release, sends `on` as value)', ]}, doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'}, + click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap'}, decoupled: {type: 'boolean', value: false, help: [ 'Set to `true` make the local feedback update only when it receives a value from an osc/midi message that matches the `on` or `off` property.', 'When `decoupled`, the button\'s value is ambiguous: when interacted with, it will send the value that\'s requested (`on` or `off` for `toggle` and `push` modes, `on` for `tap` mode, `null` for `momentary`), otherwise it will return the value received from the feedback message (`on` or `off` property).', @@ -93,7 +94,8 @@ class Button extends Widget { var mode = this.getProp('mode'), tap = mode === 'momentary' || mode === 'tap', - push = mode === 'push' || tap + push = mode === 'push' || tap, + click = this.getProp('click') && mode !== 'push' if (push) { @@ -111,11 +113,11 @@ class Button extends Widget { if (tap) this.container.classList.add('active') - }, {element: this.container}) + }, {element: this.container, click: click}) } else { - this.on('draginit',(e)=>{ + this.on(click ? 'click': 'draginit',(e)=>{ if (this.touchActive) return @@ -167,11 +169,11 @@ class Button extends Widget { this.touchActive = true this.setValue(this.state ? this.getProp('off') : this.getProp('on'), {sync: true, send: true, y: e.offsetY, x: e.offsetX, local:true}) - }, {element: this.container}) + }, {element: this.container, click: click}) } else { - this.on('draginit',(e)=>{ + this.on(click ? 'click': 'draginit',(e)=>{ if (this.touchActive) return @@ -227,6 +229,7 @@ class Button extends Widget { } if (this.getProp('onTouch')) { + this.on('drag',(e)=>this.onTouch(e, 'move'), {element: this.container}) this.on('dragend',(e)=>this.onTouch(e, 'stop'), {element: this.container}) } From 99578d3be5e131db3cfeb6c143a0c98a9c47b163 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:38:56 +0100 Subject: [PATCH 035/114] log: update --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c291a7a..9fb76c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,10 @@ - patchbay: interaction and rendering issues - `event.preventDefault` in `onTouch` now affect modal buttons - menu: use click event instead of tap in `toggle` and `doubleTap-toggle` modes - + - button: missing `move` events in `onTouch` + +- widgets + - modal/button/file: add `click` property - editor - preserve code editor undo history between consecutive edits of a same widget's property From 91fb688d9d5f7ba4de7902dca209b2764845e314 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:41:38 +0100 Subject: [PATCH 036/114] button: amend click doc --- src/client/widgets/basics/button.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/basics/button.mjs b/src/client/widgets/basics/button.mjs index c1f1ca23..256cc335 100644 --- a/src/client/widgets/basics/button.mjs +++ b/src/client/widgets/basics/button.mjs @@ -45,7 +45,7 @@ class Button extends Widget { '- `tap` (no release, sends `on` as value)', ]}, doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'}, - click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap'}, + click: {type: 'boolean', value: false, help: 'Set to `true` to activate upon click event instead of tap (ignored if `mode` is `push`)'}, decoupled: {type: 'boolean', value: false, help: [ 'Set to `true` make the local feedback update only when it receives a value from an osc/midi message that matches the `on` or `off` property.', 'When `decoupled`, the button\'s value is ambiguous: when interacted with, it will send the value that\'s requested (`on` or `off` for `toggle` and `push` modes, `on` for `tap` mode, `null` for `momentary`), otherwise it will return the value received from the feedback message (`on` or `off` property).', From 27e3e6f1b3ee7fca72502eb4af786e2170e05d41 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:48:36 +0100 Subject: [PATCH 037/114] client: add noWarning option --- CHANGELOG.md | 3 +++ resources/docs/docs/client-options.md | 1 + src/client/editor/index.mjs | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb76c47..15b24d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ - editor - preserve code editor undo history between consecutive edits of a same widget's property - preserve fullscreen code editor focus when saving / submitting + +- client + - add `noWarning` client option ## 1.30.1 diff --git a/resources/docs/docs/client-options.md b/resources/docs/docs/client-options.md index d653890f..0a6e4a7b 100644 --- a/resources/docs/docs/client-options.md +++ b/resources/docs/docs/client-options.md @@ -19,6 +19,7 @@ Client options can be set either with the server's `--client-options` option, or | virtualKeyboard | 1 / 0 | 0 | (desktop only) set to 1 to enable the virtual keyboard by default | | notifications | 1 / 0 | 1 | set to 0 to hide notifications by default | | title | string | '' | replace window title | +| noWarning | 1 / 0 | 0 | set to 0 to disable unsaved session warnings | Example: diff --git a/src/client/editor/index.mjs b/src/client/editor/index.mjs index 399553b4..04466646 100644 --- a/src/client/editor/index.mjs +++ b/src/client/editor/index.mjs @@ -1024,7 +1024,9 @@ class Editor { pushHistory(indexes) { - this.unsavedSession = true + if (!ENV.noWarning) { + this.unsavedSession = true + } if (this.historyState > -1) { this.history.splice(0, this.historyState + 1) From a0fed34edba1cf81589eaaabcb7f110cd869747f Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:49:41 +0100 Subject: [PATCH 038/114] misc: space --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15b24d1c..e89dfaee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ - editor - preserve code editor undo history between consecutive edits of a same widget's property - preserve fullscreen code editor focus when saving / submitting - + - client - add `noWarning` client option From 3d12e85e56b8eda5cc147ce8eb856abd6fa48fb7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 10:53:45 +0100 Subject: [PATCH 039/114] scrollbar: prevent error --- src/client/widgets/sliders/scrollbar.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index a5bfcfea..d1fd2f44 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -166,6 +166,7 @@ export default class Scrollbar extends StaticProperties(Fader, { } fastdom.measure(()=>{ + if (!this.scrollTarget) return this.scrollTarget.on('scroll', onScroll) onScroll({}, true) }) From e2c48bd6ac02cef6df15ecb7ce7a0a94d1250261 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 11:20:49 +0100 Subject: [PATCH 040/114] script: escape html elements in widget log to avoid cyclic json error --- CHANGELOG.md | 1 + src/client/widgets/vm.mjs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e89dfaee..628917e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - `event.preventDefault` in `onTouch` now affect modal buttons - menu: use click event instead of tap in `toggle` and `doubleTap-toggle` modes - button: missing `move` events in `onTouch` + - error when logging `event` object in `onTouch` - widgets - modal/button/file: add `click` property diff --git a/src/client/widgets/vm.mjs b/src/client/widgets/vm.mjs index 24124ecd..389dceaa 100644 --- a/src/client/widgets/vm.mjs +++ b/src/client/widgets/vm.mjs @@ -56,7 +56,7 @@ class Vm { this.globals.console = { ...console, log: (...msg)=>{ - msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m) : m) + msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m, this.jsonReplacer) : m) this.getWidget().log(msg.join(' ')) } } @@ -143,6 +143,10 @@ class Vm { } + jsonReplacer(key, value) { + return value instanceof HTMLElement ? `<${value.tagName}#${value.id}>` : value + } + } export default Vm From 12508f89943f4e33134681ea6cce27fe449572e9 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 13:57:38 +0100 Subject: [PATCH 041/114] docs: bump version --- resources/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index 316d62dd..cabd1f32 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.30.1 +latest_release: 1.30.2 theme: name: 'material' From 43d18647b215c1fdc4582af8c8ba4b85a75538d4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 16:36:46 +0100 Subject: [PATCH 042/114] linux: workaround gtk conflict --- src/server/electron/electron-app.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/electron/electron-app.mjs b/src/server/electron/electron-app.mjs index bc2e082b..a06f7bde 100644 --- a/src/server/electron/electron-app.mjs +++ b/src/server/electron/electron-app.mjs @@ -21,6 +21,11 @@ if (settings.read('force-gpu')) { app.commandLine.appendSwitch('--ignore-gpu-blacklist') } +// Workaround bug in electron 36:https://github.com/electron/electron/issues/46538 +if (process.platform === 'linux') { + app.commandLine.appendSwitch('gtk-version', '3') +} + if (semver.gt(settings.infos.version, settings.read('version') || '0.0.0')) { // set temporary flag to clean electron browser cache in case of update settings.write('clearCache', true, true) From e4311271e938678eba7cdcbf3e7f7d2aa9004556 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 2 Mar 2026 17:28:18 +0100 Subject: [PATCH 043/114] misc: detailed comment --- src/server/electron/electron-app.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/electron/electron-app.mjs b/src/server/electron/electron-app.mjs index a06f7bde..f8a42272 100644 --- a/src/server/electron/electron-app.mjs +++ b/src/server/electron/electron-app.mjs @@ -21,7 +21,7 @@ if (settings.read('force-gpu')) { app.commandLine.appendSwitch('--ignore-gpu-blacklist') } -// Workaround bug in electron 36:https://github.com/electron/electron/issues/46538 +// Workaround bug in electron 36 + gnome: https://github.com/electron/electron/issues/46538 if (process.platform === 'linux') { app.commandLine.appendSwitch('gtk-version', '3') } From 3730aa719935fa8018c0e7055568d3c338698fbc Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 3 Mar 2026 08:29:09 +0100 Subject: [PATCH 044/114] scrollbar: prevent another error --- src/client/widgets/sliders/scrollbar.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index d1fd2f44..d4103252 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -102,6 +102,8 @@ export default class Scrollbar extends StaticProperties(Fader, { e.preventDefault() e.stopPropagation() + if (!this.scrollTarget) return + var increment if (this.getProp('horizontal')) { increment = e.deltaY / this.scrollTarget.scrollWidth * 100 From 8bec0552d4d9949f17fa395452c0781c516c9c8d Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 3 Mar 2026 08:29:24 +0100 Subject: [PATCH 045/114] scrollbar: fix drawing issue --- src/client/widgets/sliders/scrollbar.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index d4103252..9c6ea2e8 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -232,7 +232,8 @@ export default class Scrollbar extends StaticProperties(Fader, { this.ctx.fillStyle = this.cssVars.colorKnob this.ctx.beginPath() - d = d / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight) + // adjust position to keep knob within gauge boundaries + d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding if (this.cssVars.borderRadius > 0 && this.ctx.roundRect) { this.ctx.roundRect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight, PXSCALE * this.cssVars.borderRadius) } else { From 013b7faf9e9ef459156c054aff157be7e62e6dd9 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 3 Mar 2026 09:10:27 +0100 Subject: [PATCH 046/114] fader/range: fix compact mode drawing mistake --- src/client/widgets/sliders/fader.mjs | 3 ++- src/client/widgets/sliders/range.mjs | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/widgets/sliders/fader.mjs b/src/client/widgets/sliders/fader.mjs index 3a4d9f1c..180f6a99 100644 --- a/src/client/widgets/sliders/fader.mjs +++ b/src/client/widgets/sliders/fader.mjs @@ -313,7 +313,8 @@ class Fader extends Slider { this.ctx.fillStyle = this.cssVars.colorKnob this.ctx.beginPath() - d = d / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight) + // adjust position to keep knob within gauge boundaries + d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight) this.ctx.fill() diff --git a/src/client/widgets/sliders/range.mjs b/src/client/widgets/sliders/range.mjs index 1de960cb..55f5097c 100644 --- a/src/client/widgets/sliders/range.mjs +++ b/src/client/widgets/sliders/range.mjs @@ -301,16 +301,15 @@ class Range extends Fader { this.ctx.globalAlpha = 1 this.ctx.fillStyle = this.cssVars.colorKnob - var compactAdjust = 1 / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight) this.ctx.beginPath() - d *= compactAdjust + d = (d - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding this.ctx.rect(this.gaugePadding, d, width - this.gaugePadding * 2, knobHeight) this.ctx.fill() // extra knob this.ctx.beginPath() - d2 *= compactAdjust + d2 = (d2 - this.gaugePadding ) / (height - this.gaugePadding * 2 ) * (height - this.gaugePadding * 2 - knobHeight) + this.gaugePadding this.ctx.rect(this.gaugePadding, d2, width - this.gaugePadding * 2, knobHeight) this.ctx.fill() From d9c23bc67221cf12023bf7da21d89575292cef97 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 3 Mar 2026 09:46:14 +0100 Subject: [PATCH 047/114] eq: doc typo --- src/client/widgets/graphs/eq.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/graphs/eq.mjs b/src/client/widgets/graphs/eq.mjs index 9a459c76..e48ca40d 100644 --- a/src/client/widgets/graphs/eq.mjs +++ b/src/client/widgets/graphs/eq.mjs @@ -24,7 +24,7 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smoo '- `q`: number (Q factor, default: 1)', '- `gain`: number (default: 0)', '- `on`: boolean (default: true)', - '- `poles`: if `type` is "highpass" or "lowpass", indicates the number of poles for the filter (if omitted or 0, a biquad filter with Q factor is used). Set to 1 for 6dB/otaves roll-off, 2 for 12dB/octaves, etc.', + '- `poles`: if `type` is "highpass" or "lowpass", indicates the number of poles for the filter (if omitted or 0, a biquad filter with Q factor is used). Set to 1 for 6dB/octaves roll-off, 2 for 12dB/octaves, etc.', 'See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode' ]}, From dfe45cac01b2b02b0b14663c69d60eb510a139e1 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 26 Mar 2026 18:36:27 +0100 Subject: [PATCH 048/114] file: dedupe leading "/" when no root is set --- src/client/ui/ui-filebrowser.mjs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/client/ui/ui-filebrowser.mjs b/src/client/ui/ui-filebrowser.mjs index 3c17a9c6..c8774faf 100644 --- a/src/client/ui/ui-filebrowser.mjs +++ b/src/client/ui/ui-filebrowser.mjs @@ -143,11 +143,9 @@ export default function UiFilebrowser(options, callback) { document.addEventListener('keydown', keyDownHandler) ipc.on('listDir', (data)=>{ - path = data.path root = data.root - - ariane.textContent = path.replace(root, '/') + ariane.textContent = root ? path.replace(root, '/') : path files = data.files.filter(x=>x.folder || x.name.match(extRe)) From 51e33c0230cb9acfb8dc5b79674f352009f74674 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 26 Mar 2026 18:44:25 +0100 Subject: [PATCH 049/114] file: remember last visited directory per widget --- CHANGELOG.md | 5 +++++ src/client/ui/ui-filebrowser.mjs | 3 ++- src/client/widgets/basics/file.mjs | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 628917e9..da9751bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.30.3 + +-widgets + - file: remember last visited directy per widget if `directory` property is not set + ## 1.30.2 - bug fixes diff --git a/src/client/ui/ui-filebrowser.mjs b/src/client/ui/ui-filebrowser.mjs index c8774faf..766e3194 100644 --- a/src/client/ui/ui-filebrowser.mjs +++ b/src/client/ui/ui-filebrowser.mjs @@ -9,7 +9,7 @@ import UiModal from './ui-modal.mjs' import {DOM} from '../globals.mjs' -export default function UiFilebrowser(options, callback) { +export default function UiFilebrowser(options, callback, closeCallback) { var save = options.save, saveInputFocus = undefined, @@ -199,6 +199,7 @@ export default function UiFilebrowser(options, callback) { document.removeEventListener('keydown', keyDownHandler) document.removeEventListener('keyup', keyUpHandler) keyboardJS.setContext(previousKbContext) + if (closeCallback) closeCallback(path) }) browser.appendChild(ariane) diff --git a/src/client/widgets/basics/file.mjs b/src/client/widgets/basics/file.mjs index 81d610b8..61bb427c 100644 --- a/src/client/widgets/basics/file.mjs +++ b/src/client/widgets/basics/file.mjs @@ -45,6 +45,7 @@ export default class File extends Widget { if (this.getProp('hidePath')) this.widget.classList.add('hide-path') this.text = DOM.get(this.widget, '.text')[0] + this.lastDir = null var ext = this.getProp('extension') if (Array.isArray(ext)) { @@ -57,7 +58,7 @@ export default class File extends Widget { uiFilebrowser({ extension: ext.replace(/^\.?(.*)$/, '$1'), - directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'), + directory: this.getProp('directory') === 'auto' ? this.lastDir : this.getProp('directory'), loadDir: this.getProp('allowDir'), save: this.getProp('mode') === 'save' }, (path, root)=>{ @@ -71,6 +72,8 @@ export default class File extends Widget { send: true }) + }, (path)=>{ + this.lastDir = path }) }, {element: this.widget}) From 3407568b5f41f8a0a427231bdbfb990876436611 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 30 Mar 2026 19:11:10 +0200 Subject: [PATCH 050/114] knob: add horizontal mode --- CHANGELOG.md | 1 + src/client/widgets/sliders/knob.mjs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da9751bd..55d824e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ -widgets - file: remember last visited directy per widget if `directory` property is not set + - knob: add `horizontal` mode ## 1.30.2 diff --git a/src/client/widgets/sliders/knob.mjs b/src/client/widgets/sliders/knob.mjs index 05aa44f0..0e4355e2 100644 --- a/src/client/widgets/sliders/knob.mjs +++ b/src/client/widgets/sliders/knob.mjs @@ -25,8 +25,9 @@ class Knob extends Slider { angle: {type: 'number', value: 270, help: 'Defines the angle\'s width of the knob, in degrees'}, }, class_specific: { - mode: {type: 'string', value: 'vertical', choices: ['vertical', 'circular', 'snap', 'snap-alt'], help: [ + mode: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'circular', 'snap', 'snap-alt'], help: [ '- `vertical`: relative move in vertical motion', + '- `horizontal`: relative move in horizontal motion', '- `circular`: relative move in circular motion', '- `snap`: snap to touch position', '- `snap-alt`: alternative snap mode that allow jumping from `range.min` to `range.max`. `sensitivity` is ignored with this mode.', @@ -109,6 +110,10 @@ class Knob extends Slider { // vertical this.percent = -100 * (e.movementY / inertia * this.getProp('sensitivity')) / this.minDimension + this.percent + } else if ((this.getProp('mode') === 'horizontal' && !e.traversing)) { + // horizontal + this.percent = 100 * (e.movementX / inertia * this.getProp('sensitivity')) / this.minDimension + this.percent + } else { // snap or circular var offsetX = this.lastOffsetX + e.movementX, From 892cbd6886595217faa69403ad99500e638b615a Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 7 Apr 2026 12:46:23 +0200 Subject: [PATCH 051/114] eq: easy optimisation (don't compute response more than needed) --- CHANGELOG.md | 1 + src/client/widgets/graphs/eq.mjs | 77 ++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d824e9..316c5db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ -widgets - file: remember last visited directy per widget if `directory` property is not set - knob: add `horizontal` mode + - eq: filter responses are now only computed when needed; the widget's value is no longer exposed / sync'ed. ## 1.30.2 diff --git a/src/client/widgets/graphs/eq.mjs b/src/client/widgets/graphs/eq.mjs index e48ca40d..b3c0263c 100644 --- a/src/client/widgets/graphs/eq.mjs +++ b/src/client/widgets/graphs/eq.mjs @@ -53,20 +53,31 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smoo super(options) - this.calcResponse() + this.setupArrays() + this.calcPending = true + this.batchDraw() + + } + + setupArrays() { + + this.freqs = new Float32Array(this.width) + this.value = new Float32Array(this.width).fill(0) + + var i, + min = this.getProp('rangeX').min, + max = this.getProp('rangeX').max, + width = this.width + + for (i = 0; i < width; ++i) { + this.freqs[i] = mapToScale(i, [0, width], [min, max], -1, true) + } } calcResponse() { - var resolution = this.width, - frequencyHz = new Float32Array(resolution), - filterResponse = new Float32Array(resolution).fill(0), - Fs = this.getProp('rangeX').max * 2 - - for (let i = 0; i < resolution; ++i) { - frequencyHz[i] = mapToScale(i, [0, this.width], [this.getProp('rangeX').min, this.getProp('rangeX').max], -1, true) - } + this.value.fill(0) for (let filter of this.getProp('filters')) { @@ -85,31 +96,29 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smoo gain: filter.gain || 0, frequency: filter.freq || 1000, q: filter.q || 1, - poles, Fs - }, frequencyHz, filterResponse) + poles, + Fs: this.getProp('rangeX').max * 2 + }, this.freqs, this.value) } - this.setValue(filterResponse, {sync: true}) - - - } - setValue(v, options={}) { - - if (!(v instanceof Float32Array) && !(Array.isArray(v)) || v.length !== this.width) return - - this.value = v - this.batchDraw() - - if (options.sync) this.changed(options) - + draw() { + if (this.calcPending) { + this.calcResponse() + this.calcPending = false + } + super.draw() } resizeHandle(event){ super.resizeHandle(event) - if (this.width !== this.value.length) this.calcResponse() + if (this.width !== this.value.length) { + this.setupArrays() + this.calcPending = true + this.batchDraw() + } } @@ -119,7 +128,8 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smoo switch (propName) { case 'filters': - this.calcResponse() + this.calcPending = true + this.batchDraw() return } @@ -141,7 +151,8 @@ function biquadResponse(options, frequencyHz, filterResponse) { var {type, frequency, q, gain, Fs, poles} = options, len = frequencyHz.length, - a0, a1, a2, b1, b2,norm + a0, a1, a2, b1, b2,norm, + w, phi, y, i var V = Math.pow(10, Math.abs(gain) / 20) var K = Math.tan(Math.PI * frequency / Fs) @@ -264,15 +275,15 @@ function biquadResponse(options, frequencyHz, filterResponse) { break } - for (var i = 0; i < len; i++) { - var w = mapToScale(frequencyHz[i], [0, Fs / 2], [0, Math.PI], -1, false), - phi = Math.pow(Math.sin(w / 2), 2), - y = Math.log(Math.pow(a0 + a1 + a2, 2) - 4 * (a0 * a1 + 4 * a0 * a2 + a1 * a2) * phi + 16 * a0 * a2 * phi * phi) - - Math.log(Math.pow(1 + b1 + b2, 2) - 4 * (b1 + 4 * b2 + b1 * b2) * phi + 16 * b2 * phi *phi) + for (i = 0; i < len; i++) { + + w = mapToScale(frequencyHz[i], [0, Fs / 2], [0, Math.PI], -1, false), + phi = Math.pow(Math.sin(w / 2), 2), + y = Math.log(Math.pow(a0 + a1 + a2, 2) - 4 * (a0 * a1 + 4 * a0 * a2 + a1 * a2) * phi + 16 * a0 * a2 * phi * phi) - + Math.log(Math.pow(1 + b1 + b2, 2) - 4 * (b1 + 4 * b2 + b1 * b2) * phi + 16 * b2 * phi * phi) y = y * 10 / Math.LN10 - // if (y == -Infinity) y = -200 filterResponse[i] += y * poles From 9d79e857f85d18df0beb61e984a328c84469451c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 9 Apr 2026 14:59:03 +0200 Subject: [PATCH 052/114] scripting: add fileUpload function --- CHANGELOG.md | 3 +++ resources/docs/docs/widgets/scripting.md | 11 +++++++- src/client/ui/ui-fileupload.mjs | 8 +++--- src/client/widgets/scripts/script-vm.mjs | 32 ++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 316c5db5..6c905b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - knob: add `horizontal` mode - eq: filter responses are now only computed when needed; the widget's value is no longer exposed / sync'ed. +- scripting + - add `uploadFile` function for reading client-side files + ## 1.30.2 - bug fixes diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 45c94034..64921dea 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -416,10 +416,19 @@ Returns the instance of [Navigator](https://developer.mozilla.org/en-US/docs/Web #### `browseFile(options, callback)` -Opens the file file browser and pass selected file to a callback function (does not create nor read files by itself). +Opens the server file browser and pass selected file to a callback function (does not create nor read files by itself). - `options`: object with the following keys: - `extension`: allowed extension (default: "*") - `directory`: starting directory for browser (default: user's home) - `allowDir`: allow choosing a directory instead of a file (default: false) - `mode`: "save" or "open" +- `callback`: function called with 1 argument (file path) + +#### `uploadFile(options, callback)` + +Opens the client file upload prompt and pass the raw content of selected file to a callback function. + +- `options`: object with the following keys: + - `types`: equivalent of HTML attribute [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept) +- `callback`: function called with 1 argument (file content) diff --git a/src/client/ui/ui-fileupload.mjs b/src/client/ui/ui-fileupload.mjs index 3f03163a..818f5c06 100644 --- a/src/client/ui/ui-fileupload.mjs +++ b/src/client/ui/ui-fileupload.mjs @@ -12,7 +12,9 @@ export default function uiFileUpload(types, ok, error) { if (SINGLETON) CONTAINER.removeChild(SINGLETON) - SINGLETON = html`` + SINGLETON = html`` + + if (types) SINGLETON.accept = types CONTAINER.appendChild(SINGLETON) @@ -24,9 +26,9 @@ export default function uiFileUpload(types, ok, error) { uiLoading(locales('loading_upload')) - reader.onerror = reader.onabort = function() { + reader.onerror = reader.onabort = function(e) { uiLoading(false) - error() + error(e) } reader.onload = function(e) { diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs index 4170bedc..ac8ce537 100644 --- a/src/client/widgets/scripts/script-vm.mjs +++ b/src/client/widgets/scripts/script-vm.mjs @@ -6,6 +6,7 @@ import {urlParser} from '../utils.mjs' import Vm from '../vm.mjs' import ipc from '../../ipc/index.mjs' import uiFilebrowser from '../../ui/ui-filebrowser.mjs' +import uiFileUpload from '../../ui/ui-fileupload.mjs' import {setFOCUSABLE} from '../../globals.mjs' var toolbar @@ -627,6 +628,37 @@ class ScriptVm extends Vm { } } + this.globals.uploadFile = (options, callback)=>{ + this.checkContext('uploadFile') + if (typeof options === 'function') { + callback = options + options = {} + } + + + if (typeof callback === 'function') { + + var widget = this.getWidget(), + valueOptions = this.getValueOptions() + + uiFileUpload(options.types, (path, content)=>{ + this.setWidget(widget) + this.setValueOptions(valueOptions) + try { + callback(content) + } catch(e) { + widget.errorProp('script', 'uploadFile', e) + } + this.setWidget() + this.setValueOptions() + }, (e)=>{ + widget.errorProp('script', 'uploadFile', e) + }) + } else { + widget.errorProp('script', 'browseFile', 'callback argument must be a function') + } + } + super.registerGlobals() } From 6dbbc9318d5007eac50f11ce82b989626d84e529 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 21 Apr 2026 16:42:47 +0200 Subject: [PATCH 053/114] plot, eq: unclip line on y axis --- src/client/widgets/graphs/plot.mjs | 4 ++-- src/client/widgets/utils.mjs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client/widgets/graphs/plot.mjs b/src/client/widgets/graphs/plot.mjs index 21808f36..6259a00e 100644 --- a/src/client/widgets/graphs/plot.mjs +++ b/src/client/widgets/graphs/plot.mjs @@ -131,14 +131,14 @@ export default class Plot extends StaticProperties(Canvas, {bypass: true}) { if (this.value[i].length) { points.push(mapToScale(this.value[i][0], [this.rangeX.min, this.rangeX.max], [padding, this.width - padding], -1, this.logScaleX, true)) - points.push(mapToScale(this.value[i][1], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], -1, this.logScaleY, true)) + points.push(mapToScale(this.value[i][1], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], -1, this.logScaleY, true, true)) } else { if (i < length - 2 && this.value[i] === previousValue && this.value[i+1] === previousValue) { continue } nx = mapToScale(i, [0, this.value.length - 1], [padding, this.width - padding], -1, this.logScaleX, true) - ny = mapToScale(this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], -1, this.logScaleY, true) + ny = mapToScale(this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], -1, this.logScaleY, true, true) if (x !== nx || y !== ny) { points.push(nx) diff --git a/src/client/widgets/utils.mjs b/src/client/widgets/utils.mjs index 9ee90920..62482c86 100644 --- a/src/client/widgets/utils.mjs +++ b/src/client/widgets/utils.mjs @@ -17,10 +17,12 @@ export function clip(value,range) { // decimals: number (-1 to bypass) // log: true, or manual log scale (max log value) // revertLog: boolean -export function mapToScale(value, rangeIn, rangeOut, decimals, log, revertlog) { +export function mapToScale(value, rangeIn, rangeOut, decimals, log, revertlog, noClip) { // clip in - value = clip(value,[rangeIn[0], rangeIn[1]]) + if (!noClip) { + value = clip(value,[rangeIn[0], rangeIn[1]]) + } // normalize @@ -48,7 +50,9 @@ export function mapToScale(value, rangeIn, rangeOut, decimals, log, revertlog) { value = value * (rangeOut[1] - rangeOut[0]) + rangeOut[0] // clip out - value = clip(value, [rangeOut[0], rangeOut[1]]) + if (!noClip) { + value = clip(value, [rangeOut[0], rangeOut[1]]) + } // decimals if (decimals !== -1) value = parseFloat(value.toFixed(decimals)) From 22068ab47e7c724666bf053aa3b3a955f7249334 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 21 Apr 2026 16:43:51 +0200 Subject: [PATCH 054/114] log: update --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c905b52..af29d6ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - file: remember last visited directy per widget if `directory` property is not set - knob: add `horizontal` mode - eq: filter responses are now only computed when needed; the widget's value is no longer exposed / sync'ed. + - plot, eq: unclip line drawing on y-axis - scripting - add `uploadFile` function for reading client-side files From 7fc5372ca119fd5dfb091fdc21526154c8babc0c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 23 Apr 2026 10:14:03 +0200 Subject: [PATCH 055/114] scripting: add scrollIntoView() --- CHANGELOG.md | 1 + resources/docs/docs/widgets/scripting.md | 13 +++++++------ src/client/widgets/scripts/script-vm.mjs | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af29d6ca..3566ac9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - scripting - add `uploadFile` function for reading client-side files + - add `scrollIntoView` function ## 1.30.2 diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 64921dea..090bd3a0 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -328,10 +328,6 @@ Gives focus to a widget (ie input widget). If `id` is omitted or falsy, currentl Returns the scroll position of a container as a `[x, y]` array. -**Deprecated** - -Scrollable panels expose their scroll position normalized between 0 and 1 with their value. - ---- #### `setScroll(id, x, y)` @@ -341,9 +337,14 @@ Scrollable panels expose their scroll position normalized between 0 and 1 with t Sets the scroll state of a container. -**Deprecated** +---- + +#### `scrollIntoView(id, option)` +- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. +- `option`: `alignToTop` or `options` argument as defined in https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView + +Scroll containers to make widget(s) visible. -Scrollable panels expose their scroll position normalized between 0 and 1 with their value. ---- diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs index ac8ce537..e1781c58 100644 --- a/src/client/widgets/scripts/script-vm.mjs +++ b/src/client/widgets/scripts/script-vm.mjs @@ -279,6 +279,24 @@ class ScriptVm extends Vm { } + this.globals.scrollIntoView = (id, options)=>{ + + this.checkContext('setScroll') + + var widgets = this.resolveId(id) + + for (var i = widgets.length - 1; i >= 0; i--) { + + if (widgets[i].container && widgets[i].isVisible()) { + widgets[i].container.scrollIntoView(options) + } + + } + + } + + + this.globals.httpGet = (url, callback)=>{ this.checkContext('httpGet') From c84bbee02ef90c3755130398b6bb9344b70dc0e7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 23 Apr 2026 11:14:41 +0200 Subject: [PATCH 056/114] scrollbar: methodize target scroll handler and watch for target resize --- CHANGELOG.md | 5 ++- src/client/widgets/sliders/scrollbar.mjs | 50 ++++++++++++++---------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3566ac9b..cab4cbe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## 1.30.3 --widgets +- bug fixes + - scrollbar: missing update upon target container resize + +- widgets - file: remember last visited directy per widget if `directory` property is not set - knob: add `horizontal` mode - eq: filter responses are now only computed when needed; the widget's value is no longer exposed / sync'ed. diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index 9c6ea2e8..9291e63d 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -147,34 +147,42 @@ export default class Scrollbar extends StaticProperties(Fader, { this.unbindTarget() } }, {context: this}) - var onScroll = (e, init)=>{ - - if (!this.scrollTarget || e.locked) return - - var index = this.getProp('horizontal') ? 0 : 1, - size = this.getProp('horizontal') ? this.width : this.height - - this.thumbSize = this.scrollTarget.scrollThumb[index] - this.cssVars.knobSize = Math.max(this.thumbSize * size, 30) - - if (init && this.value) { - // panel (re)createed: restore scroll state - this.setValue(this.value, {fromScrollEvent: false, send: false, sync: false}) - } else if (this.scrollTarget.scroll[index] != this.value) { - // panel scrolling: update scroll state - this.setValue(this.scrollTarget.scroll[index], {fromScrollEvent: true, send: !init, sync: !init}) - } - - } fastdom.measure(()=>{ if (!this.scrollTarget) return - this.scrollTarget.on('scroll', onScroll) - onScroll({}, true) + this.scrollTarget.on('scroll', this.targetScroll.bind(this)) + this.scrollTarget.on('resize', ()=>{ + if (this.scrollTarget) { + this.scrollTarget.trigger('scroll', {}) + this.targetScroll({}, true) + } + }, {element: this.scrollTarget.widget}) + this.targetScroll({}, true) }) } + targetScroll(e, init) { + + if (!this.scrollTarget || (e && e.locked)) return + + var index = this.getProp('horizontal') ? 0 : 1, + size = this.getProp('horizontal') ? this.width : this.height + + this.thumbSize = this.scrollTarget.scrollThumb[index] + this.cssVars.knobSize = Math.max(this.thumbSize * size, 30) + + if (init && this.value) { + // panel (re)createed: restore scroll state + this.setValue(this.value, {fromScrollEvent: false, send: false, sync: false}) + } else if (this.scrollTarget.scroll[index] != this.value) { + // panel scrolling: update scroll state + this.setValue(this.scrollTarget.scroll[index], {fromScrollEvent: true, send: !init, sync: !init}) + } + + } + + setValue(v, options={}) { super.setValue(v, options) From 19a86aa31b044e4efb7d1ce2efcccbd346060e17 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 23 Apr 2026 15:21:33 +0200 Subject: [PATCH 057/114] docs: axisLock in multixy.pointsAttr --- src/client/widgets/pads/multixy.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/widgets/pads/multixy.mjs b/src/client/widgets/pads/multixy.mjs index cad103c1..9ee2b584 100644 --- a/src/client/widgets/pads/multixy.mjs +++ b/src/client/widgets/pads/multixy.mjs @@ -43,7 +43,8 @@ class MultiXy extends Pad { '- pointSize', '- label', '- clipX', - '- clipY' + '- clipY', + '- axisLock' ]}, snap: {type: 'boolean', value: false, help: [ 'By default, the points are dragged from their initial position.', From e163308e35503ac4461c29512790a35c98f80c98 Mon Sep 17 00:00:00 2001 From: Xavier <164179-xavier.x@users.noreply.framagit.org> Date: Tue, 28 Apr 2026 16:25:10 +0000 Subject: [PATCH 058/114] fix: tcp incoming messages being silently dropped --- src/server/node/osc/tcp.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/server/node/osc/tcp.mjs b/src/server/node/osc/tcp.mjs index 4a963372..b1096257 100644 --- a/src/server/node/osc/tcp.mjs +++ b/src/server/node/osc/tcp.mjs @@ -86,7 +86,6 @@ export default class OscTCPServer extends EventEmitter { this.clients = {} this.server = net.createServer(this.bindSocket.bind(this)) - this.on = this.server.on.bind(this.server) } bindSocket(socket) { From ed722923d90f1416e0716745b8339dab6ad38143 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 28 Apr 2026 18:27:40 +0200 Subject: [PATCH 059/114] log: tcp regression --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cab4cbe3..951d8602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - scrollbar: missing update upon target container resize + - server: regression breaking reception of osc message over tcp - widgets - file: remember last visited directy per widget if `directory` property is not set From a7708f6cd5ca0a8676671d3b4e8b082105506b94 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 28 Apr 2026 18:28:58 +0200 Subject: [PATCH 060/114] package: v1.30.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f446937a..05e43c59 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.30.2", + "version": "1.30.3", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" From 26a3d4ce601cf9c19a67645a1ee955f00c47e547 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 28 Apr 2026 18:49:00 +0200 Subject: [PATCH 061/114] docs: bump v --- resources/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index cabd1f32..a7e200fb 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.30.2 +latest_release: 1.30.3 theme: name: 'material' From b89d254386b7468e15a17258d5b33045de8819ec Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 28 Apr 2026 18:53:22 +0200 Subject: [PATCH 062/114] docs: fix rpm dl link --- resources/docs/download.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/docs/download.md b/resources/docs/download.md index ec05a3c9..d5089028 100644 --- a/resources/docs/download.md +++ b/resources/docs/download.md @@ -8,7 +8,7 @@
    -
  • GNU/Linux RPM (64-bit)
  • +
  • GNU/Linux RPM (64-bit)
  • GNU/Linux Debian (64-bit)
  • GNU/Linux (64-bit)
  • Node.js
  • From 614b0c237f21e13424de13b80bde25a2698f1fbf Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 10 May 2026 19:09:43 +0200 Subject: [PATCH 063/114] docs: remove git bug tracker --- resources/mkdocs.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index a7e200fb..2c4a8bc2 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -64,9 +64,6 @@ nav: - Remote control: docs/remote-control.md - Credits: docs/credits.md - Changelog: docs/changelog.md - - - Bug Tracker: - - 'Bug Tracker': 'https://framagit.org/jean-emmanuel/open-stage-control/-/issues' - Community: - 'Community forums': 'https://openstagecontrol.discourse.group' From 7e7c3f43e7d687b2719f10f57e2cf6f54927469b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 20 May 2026 09:50:38 +0200 Subject: [PATCH 064/114] ai: let's make things clear --- AI_POLICY.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 AI_POLICY.md diff --git a/AI_POLICY.md b/AI_POLICY.md new file mode 100644 index 00000000..25394e99 --- /dev/null +++ b/AI_POLICY.md @@ -0,0 +1,5 @@ +Anything AI-related is strictly prohibited from this project. + +If you think this project could benefit from a smart use of AI, think harder about \. + +If you still think this way, don't tell me ;). From d22f850598b4f8d2a079db86ded6f3de88f6d8dc Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 7 Jun 2026 16:20:37 +0200 Subject: [PATCH 065/114] notificaion: support icon transform suffixes (use utils.icons()) --- CHANGELOG.md | 6 ++++++ src/client/ui/notifications.mjs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 951d8602..05408995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog + +## 1.30.4 + +- bug fixes + - remote control: add support for icon transform suffixes + ## 1.30.3 - bug fixes diff --git a/src/client/ui/notifications.mjs b/src/client/ui/notifications.mjs index a5f93450..19bafba5 100644 --- a/src/client/ui/notifications.mjs +++ b/src/client/ui/notifications.mjs @@ -1,7 +1,9 @@ import html from 'nanohtml' +import raw from 'nanohtml/raw' import morph from 'nanomorph' import UiWidget from './ui-widget.mjs' import {DOM, ENV} from '../globals.mjs' +import {icon} from './utils' var DEFAULT_DURATION = 3500 @@ -21,7 +23,7 @@ class Toast { var toast = html`
    - + ${raw(icon(data.icon || (data.class === 'error' ? 'exclamation' : 'bell')))}
    ` From c40d30aa2b02948f0dd9faadd227b17082eda2b0 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 20 Jun 2026 19:08:43 +0200 Subject: [PATCH 066/114] encoder: add horizontal mode --- CHANGELOG.md | 3 +++ src/client/widgets/sliders/encoder.mjs | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05408995..73e58ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ - bug fixes - remote control: add support for icon transform suffixes +- widgets + - encoder: add `horizontal` mode + ## 1.30.3 - bug fixes diff --git a/src/client/widgets/sliders/encoder.mjs b/src/client/widgets/sliders/encoder.mjs index 0a5cf186..1e94c58f 100644 --- a/src/client/widgets/sliders/encoder.mjs +++ b/src/client/widgets/sliders/encoder.mjs @@ -33,10 +33,11 @@ export default class Encoder extends StaticProperties(Knob, {angle: 360, range: '- Set to `null` to send send no argument in the osc message', '- Can be an `object` if the type needs to be specified' ]}, - mode: {type: 'string', value: 'circular', choices: ['circular', 'snap', 'vertical'], help: [ + mode: {type: 'string', value: 'circular', choices: ['circular', 'snap', 'vertical', 'horizontal'], help: [ '- `circular`: relative move in circular motion', '- `snap`: snap to touch position and move in vertical motion', '- `vertical`: relative move in vertical motion', + '- `horizontal`: relative move in horizontal motion', ]}, doubleTap: {type: 'boolean', value: false, help: [ 'Set to `true` to make the fader reset to its `default` value when receiving a double tap.', @@ -116,7 +117,11 @@ export default class Encoder extends StaticProperties(Knob, {angle: 360, range: if ((this.getProp('mode') === 'vertical' && !e.traversing)) { // vertical - this.setPercent(this.percent + (-100 * e.movementY / this.height) * this.getProp('sensitivity') / inertia) + this.setPercent(this.percent - 100 * (e.movementY / inertia * this.getProp('sensitivity')) / this.minDimension) + + } else if ((this.getProp('mode') === 'horizontal' && !e.traversing)) { + // horizontal + this.setPercent(this.percent + 100 * (e.movementX / inertia * this.getProp('sensitivity')) / this.minDimension) } else { // snap or circular From c1d692ffba0c15b77bfc61270e9aebba7e1e0b01 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 20 Jun 2026 19:20:14 +0200 Subject: [PATCH 067/114] knob: add encoder design (& DRY) --- CHANGELOG.md | 1 + src/client/widgets/sliders/encoder.mjs | 62 +----- src/client/widgets/sliders/knob.mjs | 290 ++++++++++++++----------- 3 files changed, 170 insertions(+), 183 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e58ba5..834048cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - widgets - encoder: add `horizontal` mode + - knob: add `encoder` design ## 1.30.3 diff --git a/src/client/widgets/sliders/encoder.mjs b/src/client/widgets/sliders/encoder.mjs index 1e94c58f..5fe30ae6 100644 --- a/src/client/widgets/sliders/encoder.mjs +++ b/src/client/widgets/sliders/encoder.mjs @@ -1,7 +1,7 @@ import Knob from './knob.mjs' import StaticProperties from '../mixins/static_properties.mjs' -export default class Encoder extends StaticProperties(Knob, {angle: 360, range: {min: 0, max: 1}}) { +export default class Encoder extends StaticProperties(Knob, {angle: 360, range: {min: 0, max: 1}, design: 'encoder'}) { static description() { @@ -263,64 +263,4 @@ export default class Encoder extends StaticProperties(Knob, {angle: 360, range: } - draw() { - - var percent = this.percent, - d = this.percentToAngle(percent), - angle = 2 * Math.PI / 16, - min = this.percentToAngle(0), - max = this.percentToAngle(100), - minRadius = this.minDimension / 6, - maxRadius = this.minDimension / 2 - this.cssVars.lineWidth, - gaugeWidth = maxRadius - minRadius, - gaugeRadius = maxRadius - gaugeWidth / 2 - - this.clear() - - if (this.minDimension < 40) { - minRadius /= 2 - gaugeWidth = maxRadius - minRadius - gaugeRadius = maxRadius - gaugeWidth / 2 - } - - // fill - this.ctx.globalAlpha = this.cssVars.alphaFill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, d - angle, d + angle) - this.ctx.stroke() - } - - // stroke - if (this.cssVars.lineWidth) { - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.lineWidth = this.cssVars.lineWidth - - if (this.minDimension > 40) { - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI) - this.ctx.stroke() - } - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) - this.ctx.stroke() - - } - - } - } diff --git a/src/client/widgets/sliders/knob.mjs b/src/client/widgets/sliders/knob.mjs index 0e4355e2..a364e1ff 100644 --- a/src/client/widgets/sliders/knob.mjs +++ b/src/client/widgets/sliders/knob.mjs @@ -15,7 +15,7 @@ class Knob extends Slider { var defaults = super.defaults(Knob).extend({ style: { _separator_knob_style: 'Knob style', - design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line'], help: [ + design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line', 'encoder'], help: [ 'Design style', 'Note: "solid" design uses "colorStroke" for the central knob color.' ]}, @@ -193,153 +193,199 @@ class Knob extends Slider { this.clear() - if (this.getProp('design') === 'default') { + switch (this.getProp('design')) { + case 'default': + { + if (this.minDimension < 40) { + minRadius /= 2 + gaugeWidth = maxRadius - minRadius + gaugeRadius = maxRadius - gaugeWidth / 2 + } - if (this.minDimension < 40) { - minRadius /= 2 - gaugeWidth = maxRadius - minRadius - gaugeRadius = maxRadius - gaugeWidth / 2 - } + // fill + this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 + if (dashed) this.ctx.setLineDash(dashed) - if (dashed) this.ctx.setLineDash(dashed) + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) + this.ctx.stroke() + } + + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, o, d, o > d) + this.ctx.stroke() + } + + if (dashed) this.ctx.setLineDash([]) + + + // stroke + if (this.cssVars.lineWidth) { + this.ctx.globalAlpha = this.cssVars.alphaStroke + this.ctx.strokeStyle = this.cssVars.colorStroke + this.ctx.lineWidth = this.cssVars.lineWidth + + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) + this.ctx.stroke() + } + + + // knob + + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.cssVars.colorKnob + this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE + + let r1 = minRadius + this.gaugePadding, + r2 = maxRadius - this.gaugePadding, + a = 2 * Math.PI - d - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) this.ctx.stroke() + break } + case 'solid': + { + // center - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - - // stroke - if (this.cssVars.lineWidth) { this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke + this.ctx.fillStyle = this.cssVars.colorKnob + + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius / 1.25, 0, 2 * Math.PI) + this.ctx.fill() + + // fill + this.ctx.strokeStyle = this.cssVars.colorFill this.ctx.lineWidth = this.cssVars.lineWidth + if (dashed) this.ctx.setLineDash(dashed) + + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) + this.ctx.stroke() + } + + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) + this.ctx.stroke() + } + + if (dashed) this.ctx.setLineDash([]) + + // knob + + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.cssVars.colorBg + this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE + + let r1 = minRadius, + r2 = maxRadius / 1.25 + PXSCALE , + a = 2 * Math.PI - d + this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) this.ctx.stroke() + break } + case 'line': + { + // fill + this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.lineWidth = this.cssVars.lineWidth + if (dashed) this.ctx.setLineDash(dashed) - // knob + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) + this.ctx.stroke() + } - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) + this.ctx.stroke() + } - let r1 = minRadius + this.gaugePadding, - r2 = maxRadius - this.gaugePadding, - a = 2 * Math.PI - d + if (dashed) this.ctx.setLineDash([]) - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() + // knob - } else if (this.getProp('design') === 'solid') { + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.cssVars.colorKnob + this.ctx.lineWidth = this.cssVars.lineWidth - // center + let r1 = minRadius * 1.5, + r2 = maxRadius + this.cssVars.lineWidth / 2 - 0.5 * PXSCALE, + a = 2 * Math.PI - d - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius / 1.25, 0, 2 * Math.PI) - this.ctx.fill() - - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = this.cssVars.lineWidth - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) this.ctx.stroke() + break } + case 'encoder': + { + let angle = 2 * Math.PI / 16 - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) - this.ctx.stroke() + // fill + this.ctx.globalAlpha = this.cssVars.alphaFill + this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 + + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min - angle, max + angle) + this.ctx.stroke() + } + + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, d - angle, d + angle) + this.ctx.stroke() + } + + // stroke + if (this.cssVars.lineWidth) { + + this.ctx.globalAlpha = this.cssVars.alphaStroke + this.ctx.strokeStyle = this.cssVars.colorStroke + this.ctx.lineWidth = this.cssVars.lineWidth + + if (this.minDimension > 40) { + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI) + this.ctx.stroke() + } + + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) + this.ctx.stroke() + + } + + break } - - if (dashed) this.ctx.setLineDash([]) - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorBg - this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE - - let r1 = minRadius, - r2 = maxRadius / 1.25 + PXSCALE , - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - - - - } else { - - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = this.cssVars.lineWidth - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = this.cssVars.lineWidth - - let r1 = minRadius * 1.5, - r2 = maxRadius + this.cssVars.lineWidth / 2 - 0.5 * PXSCALE, - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - } @@ -369,7 +415,7 @@ class Knob extends Slider { this.ctx.globalAlpha = this.cssVars.alphaPipsText for (var p in this.pipTexts) { if (this.pipTexts[p] === undefined || (this.maxAngle === 360 && p === '100')) continue - var angle = this.percentToAngle(p), + let angle = this.percentToAngle(p), size = this.ctx.measureText(this.pipTexts[p]), x = this.width / 2 + radius * Math.cos(angle) - size.width / 2, y = this.height / 2 + radius * Math.sin(angle) From 045be39e8748c5221c56aff05258359d53fa6b74 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 20 Jun 2026 19:20:14 +0200 Subject: [PATCH 068/114] knob: add encoder design (& DRY) --- CHANGELOG.md | 1 + src/client/widgets/sliders/encoder.mjs | 62 +----- src/client/widgets/sliders/knob.mjs | 290 ++++++++++++++----------- 3 files changed, 170 insertions(+), 183 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e58ba5..834048cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - widgets - encoder: add `horizontal` mode + - knob: add `encoder` design ## 1.30.3 diff --git a/src/client/widgets/sliders/encoder.mjs b/src/client/widgets/sliders/encoder.mjs index 1e94c58f..5fe30ae6 100644 --- a/src/client/widgets/sliders/encoder.mjs +++ b/src/client/widgets/sliders/encoder.mjs @@ -1,7 +1,7 @@ import Knob from './knob.mjs' import StaticProperties from '../mixins/static_properties.mjs' -export default class Encoder extends StaticProperties(Knob, {angle: 360, range: {min: 0, max: 1}}) { +export default class Encoder extends StaticProperties(Knob, {angle: 360, range: {min: 0, max: 1}, design: 'encoder'}) { static description() { @@ -263,64 +263,4 @@ export default class Encoder extends StaticProperties(Knob, {angle: 360, range: } - draw() { - - var percent = this.percent, - d = this.percentToAngle(percent), - angle = 2 * Math.PI / 16, - min = this.percentToAngle(0), - max = this.percentToAngle(100), - minRadius = this.minDimension / 6, - maxRadius = this.minDimension / 2 - this.cssVars.lineWidth, - gaugeWidth = maxRadius - minRadius, - gaugeRadius = maxRadius - gaugeWidth / 2 - - this.clear() - - if (this.minDimension < 40) { - minRadius /= 2 - gaugeWidth = maxRadius - minRadius - gaugeRadius = maxRadius - gaugeWidth / 2 - } - - // fill - this.ctx.globalAlpha = this.cssVars.alphaFill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, d - angle, d + angle) - this.ctx.stroke() - } - - // stroke - if (this.cssVars.lineWidth) { - - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke - this.ctx.lineWidth = this.cssVars.lineWidth - - if (this.minDimension > 40) { - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI) - this.ctx.stroke() - } - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) - this.ctx.stroke() - - } - - } - } diff --git a/src/client/widgets/sliders/knob.mjs b/src/client/widgets/sliders/knob.mjs index 0e4355e2..a364e1ff 100644 --- a/src/client/widgets/sliders/knob.mjs +++ b/src/client/widgets/sliders/knob.mjs @@ -15,7 +15,7 @@ class Knob extends Slider { var defaults = super.defaults(Knob).extend({ style: { _separator_knob_style: 'Knob style', - design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line'], help: [ + design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line', 'encoder'], help: [ 'Design style', 'Note: "solid" design uses "colorStroke" for the central knob color.' ]}, @@ -193,153 +193,199 @@ class Knob extends Slider { this.clear() - if (this.getProp('design') === 'default') { + switch (this.getProp('design')) { + case 'default': + { + if (this.minDimension < 40) { + minRadius /= 2 + gaugeWidth = maxRadius - minRadius + gaugeRadius = maxRadius - gaugeWidth / 2 + } - if (this.minDimension < 40) { - minRadius /= 2 - gaugeWidth = maxRadius - minRadius - gaugeRadius = maxRadius - gaugeWidth / 2 - } + // fill + this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 + if (dashed) this.ctx.setLineDash(dashed) - if (dashed) this.ctx.setLineDash(dashed) + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) + this.ctx.stroke() + } + + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, o, d, o > d) + this.ctx.stroke() + } + + if (dashed) this.ctx.setLineDash([]) + + + // stroke + if (this.cssVars.lineWidth) { + this.ctx.globalAlpha = this.cssVars.alphaStroke + this.ctx.strokeStyle = this.cssVars.colorStroke + this.ctx.lineWidth = this.cssVars.lineWidth + + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) + this.ctx.stroke() + } + + + // knob + + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.cssVars.colorKnob + this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE + + let r1 = minRadius + this.gaugePadding, + r2 = maxRadius - this.gaugePadding, + a = 2 * Math.PI - d - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min, max) + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) this.ctx.stroke() + break } + case 'solid': + { + // center - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - - // stroke - if (this.cssVars.lineWidth) { this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.strokeStyle = this.cssVars.colorStroke + this.ctx.fillStyle = this.cssVars.colorKnob + + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius / 1.25, 0, 2 * Math.PI) + this.ctx.fill() + + // fill + this.ctx.strokeStyle = this.cssVars.colorFill this.ctx.lineWidth = this.cssVars.lineWidth + if (dashed) this.ctx.setLineDash(dashed) + + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) + this.ctx.stroke() + } + + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) + this.ctx.stroke() + } + + if (dashed) this.ctx.setLineDash([]) + + // knob + + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.cssVars.colorBg + this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE + + let r1 = minRadius, + r2 = maxRadius / 1.25 + PXSCALE , + a = 2 * Math.PI - d + this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) this.ctx.stroke() + break } + case 'line': + { + // fill + this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.lineWidth = this.cssVars.lineWidth + if (dashed) this.ctx.setLineDash(dashed) - // knob + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) + this.ctx.stroke() + } - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) + this.ctx.stroke() + } - let r1 = minRadius + this.gaugePadding, - r2 = maxRadius - this.gaugePadding, - a = 2 * Math.PI - d + if (dashed) this.ctx.setLineDash([]) - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() + // knob - } else if (this.getProp('design') === 'solid') { + this.ctx.globalAlpha = 1 + this.ctx.strokeStyle = this.cssVars.colorKnob + this.ctx.lineWidth = this.cssVars.lineWidth - // center + let r1 = minRadius * 1.5, + r2 = maxRadius + this.cssVars.lineWidth / 2 - 0.5 * PXSCALE, + a = 2 * Math.PI - d - this.ctx.globalAlpha = this.cssVars.alphaStroke - this.ctx.fillStyle = this.cssVars.colorKnob - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius / 1.25, 0, 2 * Math.PI) - this.ctx.fill() - - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = this.cssVars.lineWidth - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) + this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) + this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) this.ctx.stroke() + break } + case 'encoder': + { + let angle = 2 * Math.PI / 16 - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) - this.ctx.stroke() + // fill + this.ctx.globalAlpha = this.cssVars.alphaFill + this.ctx.strokeStyle = this.cssVars.colorFill + this.ctx.lineWidth = gaugeWidth - this.gaugePadding * 2 + + if (this.cssVars.alphaFillOff) { + this.ctx.globalAlpha = this.cssVars.alphaFillOff + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, min - angle, max + angle) + this.ctx.stroke() + } + + if (this.cssVars.alphaFillOn) { + this.ctx.globalAlpha = this.cssVars.alphaFillOn + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, gaugeRadius, d - angle, d + angle) + this.ctx.stroke() + } + + // stroke + if (this.cssVars.lineWidth) { + + this.ctx.globalAlpha = this.cssVars.alphaStroke + this.ctx.strokeStyle = this.cssVars.colorStroke + this.ctx.lineWidth = this.cssVars.lineWidth + + if (this.minDimension > 40) { + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, minRadius, 0, 2 * Math.PI) + this.ctx.stroke() + } + + this.ctx.beginPath() + this.ctx.arc(this.width / 2, this.height / 2, maxRadius, 0, 2 * Math.PI) + this.ctx.stroke() + + } + + break } - - if (dashed) this.ctx.setLineDash([]) - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorBg - this.ctx.lineWidth = this.cssVars.lineWidth + .5 * PXSCALE - - let r1 = minRadius, - r2 = maxRadius / 1.25 + PXSCALE , - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - - - - } else { - - // fill - this.ctx.strokeStyle = this.cssVars.colorFill - this.ctx.lineWidth = this.cssVars.lineWidth - - if (dashed) this.ctx.setLineDash(dashed) - - if (this.cssVars.alphaFillOff) { - this.ctx.globalAlpha = this.cssVars.alphaFillOff - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, min, max) - this.ctx.stroke() - } - - if (this.cssVars.alphaFillOn) { - this.ctx.globalAlpha = this.cssVars.alphaFillOn - this.ctx.beginPath() - this.ctx.arc(this.width / 2, this.height / 2, maxRadius, o, d, o > d) - this.ctx.stroke() - } - - if (dashed) this.ctx.setLineDash([]) - - // knob - - this.ctx.globalAlpha = 1 - this.ctx.strokeStyle = this.cssVars.colorKnob - this.ctx.lineWidth = this.cssVars.lineWidth - - let r1 = minRadius * 1.5, - r2 = maxRadius + this.cssVars.lineWidth / 2 - 0.5 * PXSCALE, - a = 2 * Math.PI - d - - this.ctx.beginPath() - this.ctx.moveTo(r1 * Math.cos(a) + this.width / 2, this.height / 2 - r1 * Math.sin(a)) - this.ctx.lineTo(r2 * Math.cos(a) + this.width / 2, this.height / 2 - r2 * Math.sin(a)) - this.ctx.stroke() - } @@ -369,7 +415,7 @@ class Knob extends Slider { this.ctx.globalAlpha = this.cssVars.alphaPipsText for (var p in this.pipTexts) { if (this.pipTexts[p] === undefined || (this.maxAngle === 360 && p === '100')) continue - var angle = this.percentToAngle(p), + let angle = this.percentToAngle(p), size = this.ctx.measureText(this.pipTexts[p]), x = this.width / 2 + radius * Math.cos(angle) - size.width / 2, y = this.height / 2 + radius * Math.sin(angle) From 79c04cc69ad9e63b2e708c65351d28fccc993ec0 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 4 Jul 2026 14:05:16 +0200 Subject: [PATCH 069/114] editor: fix moving/resing widgets inside folders when using percent units --- CHANGELOG.md | 1 + src/client/editor/index.mjs | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 834048cd..27b29e1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - bug fixes - remote control: add support for icon transform suffixes + - editor: fix moving/resing widgets inside folders when using percent units - widgets - encoder: add `horizontal` mode diff --git a/src/client/editor/index.mjs b/src/client/editor/index.mjs index 04466646..882b46e4 100644 --- a/src/client/editor/index.mjs +++ b/src/client/editor/index.mjs @@ -3,7 +3,7 @@ import {updateWidget, incrementWidget} from './data-workers.mjs' import {diff, diffToWidget} from './diff.mjs' import widgetManager from '../managers/widgets.mjs' import {deepCopy} from '../utils.mjs' -import {defaults} from '../widgets/index.mjs' +import {defaults, widgets} from '../widgets/index.mjs' import UiSelectArea from '../ui/ui-selectarea.mjs' import UiInspector from '../ui/ui-inspector.mjs' import UiTree from '../ui/ui-tree.mjs' @@ -905,6 +905,17 @@ class Editor { } + /* Utility function to retrieve the first sizable node */ + getWidgetParentContainer(widget) { + + while (widget.parent instanceof widgets.folder) { + widget = widget.parent + } + + return widget.container.parentNode + + } + resizeWidget(deltaW, deltaH) { if (!this.selectedWidgets.length) return @@ -934,7 +945,7 @@ class Editor { if (deltaW !== 0 && w.props.width !== undefined && w.parent.getProp('layout') !== 'vertical') { var newWidth = Math.max(nW, GRIDWIDTH) / PXSCALE if (typeof w.props.width === 'string' && w.props.width.indexOf('%') > -1) { - w.props.width = (100 * PXSCALE * newWidth / w.container.parentNode.offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' + w.props.width = (100 * PXSCALE * newWidth / this.getWidgetParentContainer(w).offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' } else { w.props.width = newWidth } @@ -943,7 +954,7 @@ class Editor { if (this.selectedWidgets.length > 1) { var newLeft = Math.max(nL, GRIDWIDTH) / PXSCALE if (typeof w.props.left === 'string' && w.props.left.indexOf('%') > -1) { - w.props.left = (100 * PXSCALE * newLeft / w.container.parentNode.offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' + w.props.left = (100 * PXSCALE * newLeft / this.getWidgetParentContainer(w).offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' } else if (w.props.left !== 'auto'){ w.props.left = newLeft } @@ -955,7 +966,7 @@ class Editor { if (deltaH !== 0 && w.props.height !== undefined && w.parent.getProp('layout') !== 'horizontal') { var newHeight = Math.max(nH, GRIDWIDTH) / PXSCALE if (typeof w.props.height === 'string' && w.props.height.indexOf('%') > -1) { - w.props.height = (100 * PXSCALE * newHeight / w.container.parentNode.offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' + w.props.height = (100 * PXSCALE * newHeight / this.getWidgetParentContainer(w).offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' } else { w.props.height = newHeight } @@ -964,7 +975,7 @@ class Editor { if (this.selectedWidgets.length > 1) { var newTop = Math.max(nT, GRIDWIDTH) / PXSCALE if (typeof w.props.top === 'string' && w.props.top.indexOf('%') > -1) { - w.props.top = (100 * PXSCALE * newTop / w.container.parentNode.offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' + w.props.top = (100 * PXSCALE * newTop / this.getWidgetParentContainer(w).offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' } else if (w.props.top !== 'auto'){ w.props.top = newTop } @@ -998,13 +1009,13 @@ class Editor { var newTop = Math.max(parseInt(w.container.offsetTop) / PXSCALE + deltaY, 0) if (typeof w.props.top === 'string' && w.props.top.indexOf('%') > -1) { - w.props.top = (100 * PXSCALE * newTop / w.container.parentNode.offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' + w.props.top = (100 * PXSCALE * newTop / this.getWidgetParentContainer(w).offsetHeight).toFixed(2).replace(/\.?0+$/, '') + '%' } else { w.props.top = newTop } var newLeft = Math.max(parseInt(w.container.offsetLeft) / PXSCALE + deltaX, 0) if (typeof w.props.left === 'string' && w.props.left.indexOf('%') > -1) { - w.props.left = (100 * PXSCALE * newLeft / w.container.parentNode.offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' + w.props.left = (100 * PXSCALE * newLeft / this.getWidgetParentContainer(w).offsetWidth).toFixed(2).replace(/\.?0+$/, '') + '%' } else { w.props.left = newLeft } From e44cf615b5916f49ab14e680bee63266a9f22c02 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 6 Jul 2026 17:33:02 +0200 Subject: [PATCH 070/114] clone: fix @{parent} bindings --- CHANGELOG.md | 1 + src/client/widgets/common/widget.mjs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27b29e1d..1afc20f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - bug fixes - remote control: add support for icon transform suffixes - editor: fix moving/resing widgets inside folders when using percent units + - clone: `@{parent.propertyName}` blocks in target widget now update when clone's parent property updates - widgets - encoder: add `horizontal` mode diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 28accfe9..2458bcdf 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -520,6 +520,9 @@ class Widget extends EventEmitter { if (widget === this.parent) { if (type === 'widget-created') return id = 'parent' + } else if (this.parent !== widgetManager && widget === this.parent.parent && this.parent.getProp('type') === 'clone') { + // ignore clone wrapper when resolving properties + id = 'parent' } if (widget === this) id = 'this' @@ -628,7 +631,7 @@ class Widget extends EventEmitter { } - // ignore clone wrapper in @parent stack (https://github.com/jean-emmanuel/open-stage-control/issues/379) + // ignore clone wrapper in @parent stack (https://framagit.org/jean-emmanuel/open-stage-control/-/work_items/379) if (widgets[0] === this.parent && this.parent !== widgetManager && this.parent.getProp('type') === 'clone') widgets = [this.parent.parent] if (storeLinks) { From fe5bbb47134e313c5ac6cc129445be94e89ecc50 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 6 Jul 2026 17:45:35 +0200 Subject: [PATCH 071/114] AI: update policy --- AI_POLICY.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AI_POLICY.md b/AI_POLICY.md index 25394e99..20067a2d 100644 --- a/AI_POLICY.md +++ b/AI_POLICY.md @@ -1,5 +1,7 @@ Anything AI-related is strictly prohibited from this project. -If you think this project could benefit from a smart use of AI, think harder about \. +If you think this project could benefit from a smart use of AI, think harder. -If you still think this way, don't tell me ;). +Think harder about the (hundreds of) millions of data workers that make your AI "smart", not to mention the monumental ecological waste it represents. + +If you still think this way, don't tell me. From ac7b0323e23656986342c721a384d53eee46779a Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 6 Jul 2026 17:50:13 +0200 Subject: [PATCH 072/114] package: 1.30.4 --- package.json | 2 +- resources/mkdocs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 05e43c59..10247368 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.30.3", + "version": "1.30.4", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index 2c4a8bc2..e4a96fac 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.30.3 +latest_release: 1.30.4 theme: name: 'material' From c49a731134d8c0680983dc7993ea721d8b23f907 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 8 Jul 2026 11:38:57 +0200 Subject: [PATCH 073/114] midi: fix unrecognized `no_auto_note_off` option --- CHANGELOG.md | 4 ++++ src/server/node/options.mjs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1afc20f5..98cea48f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.30.5 + +- bug fixes + - midi: unrecognized `no_auto_note_off` option ## 1.30.4 diff --git a/src/server/node/options.mjs b/src/server/node/options.mjs index 5bc10cc4..37358895 100644 --- a/src/server/node/options.mjs +++ b/src/server/node/options.mjs @@ -51,7 +51,7 @@ export default { }, 'm': {alias: 'midi', type: 'array', describe: 'midi router settings', check: (o)=>{ - var err = o.filter(item=>!item.match(/^(list|debug|jack|sysex|mtc|rpn|nrpn|active_sensing|note_off_velocity|pc_offset|path=(.*)|[^:]+:(virtual|[^,]+,[^,]+))$/)) + var err = o.filter(item=>!item.match(/^(list|debug|jack|sysex|mtc|rpn|nrpn|active_sensing|note_off_velocity|no_auto_note_off|pc_offset|path=(.*)|[^:]+:(virtual|[^,]+,[^,]+))$/)) return err.length ? `Invalid option${err.length > 1 ? 's' : ''}: ${err.join(', ')}` : true } }, From 27d87f223889175b6805b583ddc5a0ef981b5064 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 9 Jul 2026 09:08:11 +0200 Subject: [PATCH 074/114] stacktrace: missing indentation --- src/client/stacktrace.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/stacktrace.mjs b/src/client/stacktrace.mjs index 274128fe..e25bfd2f 100644 --- a/src/client/stacktrace.mjs +++ b/src/client/stacktrace.mjs @@ -6,7 +6,7 @@ window.onerror = function(msg,url,row,col, error) { StackTrace.fromError(error).then((stackframes)=>{ - var stringifiedStack = stackframes.join('\n') + var stringifiedStack = ' ' + stackframes.join('\n ') uiConsole.log('error', `${msg}\n${stringifiedStack}`) ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n${stringifiedStack}`) From 7981b6fdd676764e6e5b463f10e44994f210acc4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 6 Aug 2026 12:43:23 +0200 Subject: [PATCH 075/114] osc: avoid object serialization from custom module to client --- CHANGELOG.md | 3 +++ src/server/node/osc/index.mjs | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98cea48f..5efa2b70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ - bug fixes - midi: unrecognized `no_auto_note_off` option +- custom module + - objects transmitted using `receive()` will be reiceved as objects by the client app (instead of a json string) + ## 1.30.4 - bug fixes diff --git a/src/server/node/osc/index.mjs b/src/server/node/osc/index.mjs index 89870658..4b0444c0 100644 --- a/src/server/node/osc/index.mjs +++ b/src/server/node/osc/index.mjs @@ -53,13 +53,13 @@ export default class OscServer { if (typeof lastArg === 'object' && lastArg !== null && lastArg.clientId !== undefined) { options = args.pop() } - this.receiveOsc({host, port, address, args:args.map(x=>this.parseArg(x)), cm: 1}, options.clientId) + this.receiveOsc({host, port, address, args:args.map(x=>this.parseArg(x, null, true)), cm: 1}, options.clientId) }, }) : {} } - parseArg(arg, type){ + parseArg(arg, type, allowObjects = false){ if (arg === null) return null @@ -95,7 +95,15 @@ export default class OscServer { case 'string': return {type: 's', value: arg} default: - return {type: 's', value: JSON.stringify(arg)} + if (allowObjects) { + // Allow js objects in args when receiving from a custom module + // they will eventually be serialized (as json) with the rest of + // the ws message but the client will de-serialize it automatically + // note: type "o" is off-spec, but we don't use typetag in this case anyway + return {type: 'o', value: arg} + } else { + return {type: 's', value: JSON.stringify(arg)} + } } } From 8c22384ddbfa19ca293bb8963470149b32e6f338 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 9 Aug 2026 10:30:11 +0200 Subject: [PATCH 076/114] widgets: better not_editable widget flag implementation --- src/client/editor/context-menu.mjs | 2 +- src/client/editor/data-workers.mjs | 3 ++- src/client/editor/index.mjs | 2 +- src/client/parser.mjs | 6 ++++-- src/client/ui/ui-console.mjs | 3 +-- src/client/widgets/basics/button.mjs | 3 ++- src/client/widgets/common/widget.mjs | 3 ++- src/client/widgets/containers/clone.mjs | 15 +++++---------- src/client/widgets/containers/fragment.mjs | 12 ++---------- src/client/widgets/containers/keyboard.mjs | 5 ++--- src/client/widgets/containers/matrix.mjs | 13 ++++--------- src/client/widgets/containers/panel.mjs | 6 ++++-- src/client/widgets/containers/patchbay.mjs | 5 ++--- 13 files changed, 32 insertions(+), 46 deletions(-) diff --git a/src/client/editor/context-menu.mjs b/src/client/editor/context-menu.mjs index 7e1532a7..a13fbf26 100644 --- a/src/client/editor/context-menu.mjs +++ b/src/client/editor/context-menu.mjs @@ -35,7 +35,7 @@ var handleClick = function(event) { if (!targetWidget) return - while (targetWidget._not_editable && targetWidget.parent) { + while (targetWidget.meta.not_editable && targetWidget.parent) { targetWidget = targetWidget.parent } diff --git a/src/client/editor/data-workers.mjs b/src/client/editor/data-workers.mjs index 7bbccbda..3a1b1f8e 100644 --- a/src/client/editor/data-workers.mjs +++ b/src/client/editor/data-workers.mjs @@ -109,7 +109,8 @@ function updateWidget(widget, options={}) { variables: widget.variables, hash: widget.hash, children: children, - index: index + index: index, + meta: widget.meta }) newWidget.container.parentNode.replaceChild(newWidget.container, widget.container) diff --git a/src/client/editor/index.mjs b/src/client/editor/index.mjs index 882b46e4..9577cd1e 100644 --- a/src/client/editor/index.mjs +++ b/src/client/editor/index.mjs @@ -401,7 +401,7 @@ class Editor { } else if (e.key === 'ArrowRight') { - if (curWidget.children[0] && !curWidget.children[0]._not_editable) { + if (curWidget.children[0] && !curWidget.children[0].meta.not_editable) { toSelect = curWidget.children[0] } diff --git a/src/client/parser.mjs b/src/client/parser.mjs index 07c53724..38d6da48 100644 --- a/src/client/parser.mjs +++ b/src/client/parser.mjs @@ -45,7 +45,8 @@ var Parser = class Parser { index, hash, locals, - variables + variables, + meta } = options var props = data @@ -89,7 +90,8 @@ var Parser = class Parser { children, hash, locals, - variables + variables, + meta }) widgetManager.addWidget(widget) diff --git a/src/client/ui/ui-console.mjs b/src/client/ui/ui-console.mjs index ff3e9bd5..ba5caf75 100644 --- a/src/client/ui/ui-console.mjs +++ b/src/client/ui/ui-console.mjs @@ -59,14 +59,13 @@ class UiConsole extends UiSidePanel { console._clear() } - this.widget = new Widget({props: {id: 'CONSOLE'}, parent: widgetManager}) + this.widget = new Widget({props: {id: 'CONSOLE'}, parent: widgetManager, meta: {not_editable: true}}) this.script = new Script({ widget: this.widget, property: '', code: 'var navigator; return eval(input_code)', context: {input_code: ''} }) - this.widget._not_editable = true this.widget.hash = 'CONSOLE' this.input.addEventListener('keydown', (event)=>{ diff --git a/src/client/widgets/basics/button.mjs b/src/client/widgets/basics/button.mjs index 256cc335..7ce2b3d4 100644 --- a/src/client/widgets/basics/button.mjs +++ b/src/client/widgets/basics/button.mjs @@ -219,7 +219,8 @@ class Button extends Widget { ignoreDefaults: true, }, parentNode: this.widget, - parent: this + parent: this, + meta: {...this.meta} }) this.decoupledValue.on('value-changed', (e)=>{ this.container.classList.toggle('on', this.decoupledValue.value) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 2458bcdf..7e6f9491 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -189,6 +189,7 @@ class Widget extends EventEmitter { this.hash = options.hash || 'W' + nanoid(9) this.children = [] this.reCreateOptions = options.reCreateOptions + this.meta = options.meta || {} this.removed = false this.mounted = false this.visible = true @@ -1140,7 +1141,7 @@ class Widget extends EventEmitter { id = this.getProp('id') || this.props.id, widget = this // used for edit link in console - while (widget._not_editable && widget.parent !== widgetManager) { + while (widget.meta.not_editable && widget.parent !== widgetManager) { // ignore non editable widget = widget.parent } diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 5e503610..9eed0102 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -116,15 +116,6 @@ class Clone extends Container() { // see common/widget.js @ updateProps() widgetManager.on('prop-src-changed', onPropChanged, {context: this}) - this.on('widget-created', (e)=>{ - - if (e.widget !== this) { - e.widget.container.classList.add('not-editable') - e.widget._not_editable = true - } - - }) - } getCloneTarget() { @@ -180,7 +171,11 @@ class Clone extends Container() { parser.parse({ data: data, parentNode: this.widget, - parent: this + parent: this, + meta: { + not_editable: true, + clone: true + } }) this.updateContainer(!init) diff --git a/src/client/widgets/containers/fragment.mjs b/src/client/widgets/containers/fragment.mjs index d2014739..0b7ddc2b 100644 --- a/src/client/widgets/containers/fragment.mjs +++ b/src/client/widgets/containers/fragment.mjs @@ -56,15 +56,6 @@ class Fragment extends Container() { this.fragmentClass = [] this.container.classList.add('empty') - this.on('widget-created', (e)=>{ - - if (e.widget !== this) { - e.widget.container.classList.add('not-editable') - e.widget._not_editable = true - } - - }) - sessionManager.on('fragment-updated', (e)=>{ var {path} = e if (path === this.getProp('file') || path === this.getProp('fallback')) { @@ -123,7 +114,8 @@ class Fragment extends Container() { parser.parse({ data: data, parentNode: this.widget, - parent: this + parent: this, + meta: {not_editable: true} }) this.updateContainer(!init) diff --git a/src/client/widgets/containers/keyboard.mjs b/src/client/widgets/containers/keyboard.mjs index cb15135b..cdbfd8bc 100644 --- a/src/client/widgets/containers/keyboard.mjs +++ b/src/client/widgets/containers/keyboard.mjs @@ -135,12 +135,11 @@ class Keyboard extends Panel { var key = parser.parse({ data: data, parentNode: this.widget, - parent: this + parent: this, + meta: {not_editable: true} }) key._index = i - start - key.container.classList.add('not-editable') - key._not_editable = true key.container.classList.add('key') if (pattern[i % 12] == 'w') { diff --git a/src/client/widgets/containers/matrix.mjs b/src/client/widgets/containers/matrix.mjs index 0b04df15..32cb4c24 100644 --- a/src/client/widgets/containers/matrix.mjs +++ b/src/client/widgets/containers/matrix.mjs @@ -82,12 +82,11 @@ class Matrix extends Panel { var widget = parser.parse({ data: data, parentNode: this.widget, - parent: this + parent: this, + meta: {not_editable: true} }) widget._index = i - widget.container.classList.add('not-editable') - widget._not_editable = true this.value[i] = widget.getValue() @@ -161,12 +160,11 @@ class Matrix extends Panel { var widget = parser.parse({ data: data, parentNode: this.widget, - parent: this + parent: this, + meta: {not_editable: true} }) widget._index = i - widget.container.classList.add('not-editable') - widget._not_editable = true } @@ -209,9 +207,6 @@ class Matrix extends Panel { Object.assign(this.children[i].props, data) this.children[i].updateProps(Object.keys(data), this, options) - // this.children[i] might have been recreated - this.children[i].container.classList.add('not-editable') - this.children[i]._not_editable = true } diff --git a/src/client/widgets/containers/panel.mjs b/src/client/widgets/containers/panel.mjs index d4ce7b51..7ab1aa4c 100644 --- a/src/client/widgets/containers/panel.mjs +++ b/src/client/widgets/containers/panel.mjs @@ -156,7 +156,8 @@ class Panel extends Container() { parentNode: this.widget, parent: this, tab: true, - index: i + index: i, + meta: {...this.meta} }) } } @@ -198,7 +199,8 @@ class Panel extends Container() { data: this.getProp('widgets')[i], parentNode: this.widget, parent: this, - index: i + index: i, + meta: {...this.meta} }) } } diff --git a/src/client/widgets/containers/patchbay.mjs b/src/client/widgets/containers/patchbay.mjs index ceaf03db..cc10fc29 100644 --- a/src/client/widgets/containers/patchbay.mjs +++ b/src/client/widgets/containers/patchbay.mjs @@ -178,10 +178,9 @@ class PatchBay extends Container(Canvas) { label: k }, parentNode: DOM.get(this.widget, '.inputs')[0], - parent: this + parent: this, + meta: {not_editable: true} }) - w.container.classList.add('not-editable') - w._not_editable = true this.inputsWidgets.push(w) this.inputNodes.push(w.container) this.value[k] = [] From 593ec4c53d99226591e78c13f174347084f42148 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 12 Aug 2026 16:09:43 +0200 Subject: [PATCH 077/114] widget: clean not-editable css class --- src/client/ui/ui-colorpicker.mjs | 1 - src/client/widgets/common/widget.mjs | 1 + src/client/widgets/containers/clone.mjs | 4 ---- src/client/widgets/containers/fragment.mjs | 4 ---- src/client/widgets/pads/rgb.mjs | 3 --- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/client/ui/ui-colorpicker.mjs b/src/client/ui/ui-colorpicker.mjs index 54d625a5..8e39ea55 100644 --- a/src/client/ui/ui-colorpicker.mjs +++ b/src/client/ui/ui-colorpicker.mjs @@ -23,7 +23,6 @@ class ColorPicker extends UiWidget { snap: true, alpha: true }, parent: this}) - this.rgb.container.classList.add('not-editable') this.container = html`
    diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 7e6f9491..5c1c2693 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -1180,6 +1180,7 @@ class Widget extends EventEmitter { } this.container.classList.toggle('absolute-position', absolutePos) this.container.classList.toggle('flex-expand', this.getProp('expand')) + this.container.classList.toggle('not-editable', this.meta.not_editable) } diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 9eed0102..7c20cebf 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -282,10 +282,6 @@ class Clone extends Container() { this.container.classList.remove('empty') - for (var w of this.getAllChildren()) { - w.container.classList.add('not-editable') - } - if (checkResize) resize.check(this.widget) } else if (this.cloneClass.length) { diff --git a/src/client/widgets/containers/fragment.mjs b/src/client/widgets/containers/fragment.mjs index 0b7ddc2b..7bbd9b32 100644 --- a/src/client/widgets/containers/fragment.mjs +++ b/src/client/widgets/containers/fragment.mjs @@ -138,10 +138,6 @@ class Fragment extends Container() { this.container.classList.remove('empty') - for (var w of this.getAllChildren()) { - w.container.classList.add('not-editable') - } - if (checkResize) resize.check(this.widget) } else if (this.fragmentClass.length) { diff --git a/src/client/widgets/pads/rgb.mjs b/src/client/widgets/pads/rgb.mjs index 734d4511..b5a2f483 100644 --- a/src/client/widgets/pads/rgb.mjs +++ b/src/client/widgets/pads/rgb.mjs @@ -59,7 +59,6 @@ export default class Rgb extends Widget { pips: false, }, parent: this}) this.pad.sendValue = ()=>{} - this.pad.container.classList.add('not-editable', 'pad') this.widget.appendChild(this.pad.container) this.pad.on('value-changed',(e)=>{ e.stopPropagation = true @@ -77,7 +76,6 @@ export default class Rgb extends Widget { range:{min:0,max:360}, decimals:2 }, parent: this}) - this.hue.container.classList.add('not-editable', 'hue') this.widget.appendChild(this.hue.container) this.hue.on('value-changed',(e)=>{ e.stopPropagation = true @@ -98,7 +96,6 @@ export default class Rgb extends Widget { input:false, decimals:2 }, parent: this}) - this.alpha.container.classList.add('not-editable', 'alpha') this.widget.appendChild(this.alpha.container) this.alpha.on('value-changed',(e)=>{ e.stopPropagation = true From 39c9d4a46dae683d7bd938b26cbbd33ab5274416 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 12 Aug 2026 16:10:31 +0200 Subject: [PATCH 078/114] scoping: first id scoping implementation --- src/client/managers/widgets.mjs | 15 +++++- src/client/widgets/common/widget.mjs | 58 +++++++++++++++++++++- src/client/widgets/containers/clone.mjs | 9 +++- src/client/widgets/containers/fragment.mjs | 12 ++++- src/client/widgets/scripts/script-vm.mjs | 2 +- 5 files changed, 90 insertions(+), 6 deletions(-) diff --git a/src/client/managers/widgets.mjs b/src/client/managers/widgets.mjs index ecf9c036..174edde4 100644 --- a/src/client/managers/widgets.mjs +++ b/src/client/managers/widgets.mjs @@ -260,7 +260,20 @@ class WidgetManager extends EventEmitter { } - getWidgetById(id) { + getWidgetById(id, scope) { + + /* + scopable: cache id prefixes (clone scopes), from neaest to farthest + */ + if (scope) { + for (var prefix of scope) { + var prefixedId = Array.isArray(id) ? id.map(i=>prefix + i) : prefix + id + var widgets = this.getWidgetBy(prefixedId, this.idRoute) + + // return matching widgets for the first matching scope + if (widgets.length) return widgets + } + } return this.getWidgetBy(id, this.idRoute) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 5c1c2693..05036ae6 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -417,6 +417,24 @@ class Widget extends EventEmitter { createPropsCache() { + /* + scopable: cache id prefixes (clone scopes), from neaest to farthest + */ + this.idPrefix = [] + if (this.meta.scopable) { + var parent = this.parent + do { + if (parent.getProp('scopedId')) { + this.idPrefix.push(parent.scopeId) + } + parent = parent.parent + } while (parent.meta.scopable || parent.getProp('scopedId')) + for (var i=0; i Date: Thu, 13 Aug 2026 15:17:52 +0200 Subject: [PATCH 079/114] widgets: amend not_editable clean --- src/client/ui/ui-colorpicker.mjs | 2 +- src/client/widgets/common/widget.mjs | 2 +- src/client/widgets/pads/rgb.mjs | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client/ui/ui-colorpicker.mjs b/src/client/ui/ui-colorpicker.mjs index 8e39ea55..2b6df433 100644 --- a/src/client/ui/ui-colorpicker.mjs +++ b/src/client/ui/ui-colorpicker.mjs @@ -22,7 +22,7 @@ class ColorPicker extends UiWidget { alphaStroke: 0, snap: true, alpha: true - }, parent: this}) + }, parent: this, meta: {not_editable: true}}) this.container = html`
    diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 05036ae6..24005fce 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -1234,7 +1234,7 @@ class Widget extends EventEmitter { } this.container.classList.toggle('absolute-position', absolutePos) this.container.classList.toggle('flex-expand', this.getProp('expand')) - this.container.classList.toggle('not-editable', this.meta.not_editable) + this.container.classList.toggle('not-editable', !!this.meta.not_editable) } diff --git a/src/client/widgets/pads/rgb.mjs b/src/client/widgets/pads/rgb.mjs index b5a2f483..4db285b4 100644 --- a/src/client/widgets/pads/rgb.mjs +++ b/src/client/widgets/pads/rgb.mjs @@ -57,8 +57,9 @@ export default class Rgb extends Widget { decimals:2, pointSize: 10, pips: false, - }, parent: this}) + }, parent: this, meta: {not_editable: true}}) this.pad.sendValue = ()=>{} + this.pad.container.classList.add('pad') this.widget.appendChild(this.pad.container) this.pad.on('value-changed',(e)=>{ e.stopPropagation = true @@ -75,7 +76,8 @@ export default class Rgb extends Widget { snap:this.getProp('snap'), range:{min:0,max:360}, decimals:2 - }, parent: this}) + }, parent: this, meta: {not_editable: true}}) + this.hue.container.classList.add('hue') this.widget.appendChild(this.hue.container) this.hue.on('value-changed',(e)=>{ e.stopPropagation = true @@ -95,7 +97,8 @@ export default class Rgb extends Widget { default: 255, input:false, decimals:2 - }, parent: this}) + }, parent: this, meta: {not_editable: true}}) + this.alpha.container.classList.add('alpha') this.widget.appendChild(this.alpha.container) this.alpha.on('value-changed',(e)=>{ e.stopPropagation = true From 0e8c77a700b37f7dfdc3fbc6f8986db1c1619f23 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 16:55:33 +0200 Subject: [PATCH 080/114] widgets: fix widget removal from linkId table when '<<' or '>>' prefixes are present --- src/client/managers/widgets.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/managers/widgets.mjs b/src/client/managers/widgets.mjs index 174edde4..1241c746 100644 --- a/src/client/managers/widgets.mjs +++ b/src/client/managers/widgets.mjs @@ -180,7 +180,7 @@ class WidgetManager extends EventEmitter { if (address && this.addressRoute[address].indexOf(hash) != -1) this.addressRoute[address].splice(this.addressRoute[address].indexOf(hash), 1) if (!Array.isArray(linkId)) linkId = [linkId] - linkId = linkId.map(x=>String(x)) + linkId = linkId.map(x=>String(x).replace(/^<<\s*/, '')).filter(x=>x.indexOf('>>') < 0) for (var i in linkId) { if (linkId[i] && this.linkIdRoute[linkId[i]] && this.linkIdRoute[linkId[i]].indexOf(hash) != -1) this.linkIdRoute[linkId[i]].splice(this.linkIdRoute[linkId[i]].indexOf(hash), 1) } From 08b837ff98c2448ed8c90f52c0d787fb49ad7667 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 17:50:57 +0200 Subject: [PATCH 081/114] scope: continue implementation, adjust clone target acquire mechanism, add scoped linkId --- src/client/managers/widgets.mjs | 9 +- src/client/widgets/common/widget.mjs | 32 +++--- src/client/widgets/containers/clone.mjs | 112 ++++++++++----------- src/client/widgets/containers/fragment.mjs | 4 +- src/client/widgets/scripts/script-vm.mjs | 2 +- 5 files changed, 81 insertions(+), 78 deletions(-) diff --git a/src/client/managers/widgets.mjs b/src/client/managers/widgets.mjs index 1241c746..16bc9563 100644 --- a/src/client/managers/widgets.mjs +++ b/src/client/managers/widgets.mjs @@ -38,6 +38,8 @@ class WidgetManager extends EventEmitter { if (linkId) { if (!Array.isArray(linkId)) linkId = [linkId] linkId = linkId.map(x=>String(x).replace(/^>>\s*/, '')).filter(x=>x.indexOf('<<') < 0) + // scopable; prefix linkId with the closest (most restrictive) scope + if (widget.scopes.length) linkId = linkId.map(x => x + widget.scopes[0]) linkId = linkId.filter(x=>this.linkIdLock.indexOf(x)<0) this.linkIdLock = this.linkIdLock.concat(linkId) this.linkIdLockDepth++ @@ -117,6 +119,8 @@ class WidgetManager extends EventEmitter { if (linkId) { if (!Array.isArray(linkId)) linkId = [linkId] linkId = linkId.map(x=>String(x).replace(/^<<\s*/, '')).filter(x=>x.indexOf('>>') < 0) + // scopable; prefix linkId with the closest (most restrictive) scope + if (widget.scopes.length) linkId = linkId.map(x => x + widget.scopes[0]) for (var i in linkId) { if (linkId[i]) { if (!this.linkIdRoute[linkId[i]]) this.linkIdRoute[linkId[i]] = [] @@ -181,6 +185,8 @@ class WidgetManager extends EventEmitter { if (!Array.isArray(linkId)) linkId = [linkId] linkId = linkId.map(x=>String(x).replace(/^<<\s*/, '')).filter(x=>x.indexOf('>>') < 0) + // scopable; prefix linkId with the closest (most restrictive) scope + if (widget.scopes.length) linkId = linkId.map(x => x + widget.scopes[0]) for (var i in linkId) { if (linkId[i] && this.linkIdRoute[linkId[i]] && this.linkIdRoute[linkId[i]].indexOf(hash) != -1) this.linkIdRoute[linkId[i]].splice(this.linkIdRoute[linkId[i]].indexOf(hash), 1) } @@ -263,14 +269,13 @@ class WidgetManager extends EventEmitter { getWidgetById(id, scope) { /* - scopable: cache id prefixes (clone scopes), from neaest to farthest + scopable: return matching widgets only for the closest scope with results */ if (scope) { for (var prefix of scope) { var prefixedId = Array.isArray(id) ? id.map(i=>prefix + i) : prefix + id var widgets = this.getWidgetBy(prefixedId, this.idRoute) - // return matching widgets for the first matching scope if (widgets.length) return widgets } } diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 24005fce..0c89f166 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -193,6 +193,7 @@ class Widget extends EventEmitter { this.removed = false this.mounted = false this.visible = true + this.scopes = [] if (options.value !== undefined) this.value = options.value @@ -418,21 +419,20 @@ class Widget extends EventEmitter { createPropsCache() { /* - scopable: cache id prefixes (clone scopes), from neaest to farthest + scopable: cache id prefixes (scopes), from nearest to farthest */ - this.idPrefix = [] + this.scopes = [] if (this.meta.scopable) { var parent = this.parent do { if (parent.getProp('scopedId')) { - this.idPrefix.push(parent.scopeId) + this.scopes.push(parent.scopeId) } parent = parent.parent } while (parent.meta.scopable || parent.getProp('scopedId')) - for (var i=0; i{ @@ -78,24 +78,9 @@ class Clone extends Container() { var {id, widget} = e - if (id === this.getProp('widgetId') && this.isValidCloneTarget(widget)) { + if (id.includes(this.getProp('widgetId')) && this.isValidCloneTarget(widget)) { - var clone = this.children[0] - - this.unbindTarget() - - if (!clone) { - - this.updateContainer(false) - this.bindTarget(widget) - this.createClone() - - } else { - - this.bindTarget(widget) - this.updateClone() - - } + this.getCloneTarget() } @@ -129,32 +114,52 @@ class Clone extends Container() { // attempt to acquire a cloneTarget if 'widget-created' event has not been caught // (the target might have been created before the clone itself) - var widgets = widgetManager.getWidgetById(this.getProp('widgetId')) - .filter(el=>this.isValidCloneTarget(el)) + var scopes = this.prefixId || [''], + target = null, + rank = 0 - if (widgets.length === 0) return null - if (widgets.length === 1) { - return widgets[0] - } + for (var scope of scopes) { + var widgets = widgetManager.getWidgetById(this.getProp('widgetId'), scope) + .filter(el=>this.isValidCloneTarget(el)) + target = widgets[0] - // when duplicating clones pointing to an object with a static id, - // each clone will recreate an object with the same id internally - // we try to get the original one if there is more than 2 clone pointing to the same id (avoiding cloning the clone) + if (!target) continue - function isCreatedByAClone(wi){ - var parent = wi.parent - return parent && parent.getProp('type') === 'clone' - } - - var target = widgets[0] - for (var w of widgets) { - if (!isCreatedByAClone(w)) { - target = w - break + for (var w of widgets) { + // when duplicating clones pointing to an object with a static id, + // each clone will recreate an object with the same id internally + // we try to get the original one if there is more than 2 clone pointing to the same id (avoiding cloning the clone) + if (!(w.parent && w.parent.getProp('type') == 'clone')) { + target = w + break + } } - } - return target + if (target && (rank < this.targetRank || this.targetRank == null)) { + + var clone = this.children[0] + + this.unbindTarget() + + if (!clone) { + + this.updateContainer(false) + this.bindTarget(target, rank) + this.createClone() + + } else { + + this.bindTarget(target, rank) + this.updateClone() + + } + + return + } + + rank++ + + } } @@ -198,14 +203,16 @@ class Clone extends Container() { this.cloneTarget.off(undefined, undefined, this) this.cloneTarget = null + this.targetRank = null } - bindTarget(target) { + bindTarget(target, rank) { if (!target) return this.cloneTarget = target + this.targetRank = rank // listen for cloneTarget's deletion // if it is just edited, its recreation will be caught by the global 'widget-created' event handler @@ -218,18 +225,14 @@ class Clone extends Container() { // listen for cloneTarget's content updates this.cloneTarget.on('widget-created', (e)=>{ - var {widget} = e, - parent = widget.parent + var {widget} = e - while (parent !== this.cloneTarget && parent !== widgetManager) { - // if updated widget is in a nested clone, ignore it: - // it will be handled by the nested clone that targets it - if (parent.getProp('type') === 'clone') return - parent = parent.parent + // if updated widget is in a nested clone, ignore it: + // it will be handled by the nested clone that targets it + if (!widget.meta.clone) { + this.updateClone() } - this.updateClone() - }, {context: this}) } @@ -310,10 +313,7 @@ class Clone extends Container() { switch (propName) { case 'widgetId': - this.unbindTarget() - this.updateContainer(false) - this.bindTarget(this.getCloneTarget()) - if (this.cloneTarget) this.createClone() + this.getCloneTarget() return case 'props': if (this.children[0]) this.updateClone() diff --git a/src/client/widgets/containers/fragment.mjs b/src/client/widgets/containers/fragment.mjs index 20fa20fc..0ed04281 100644 --- a/src/client/widgets/containers/fragment.mjs +++ b/src/client/widgets/containers/fragment.mjs @@ -31,7 +31,7 @@ class Fragment extends Container() { fallback: {type: 'string', value: '', help: 'Fallack fragment file path, loaded if `file` can\'t be opened'}, scopedId: {type: 'boolean|string', value: false, help: [ 'Set to `true` to prefix all widget `id`s inside the clone with a unique identifier and make the fragment self-contained. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the fragment if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the fragment.', - 'Set to a string to define the `ìd` prefix manually.' + 'Set to a string to define the `ìd` prefix manually (a trailing slash will be added automatically).' ]}, props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Fragment widget\'s properties to override'}, }, @@ -55,7 +55,7 @@ class Fragment extends Container() { this.noValueState = true - this.scopeId = this.getProp('scopedId') === true ? this.hash + '/' : this.getProp('scopedId') === false ? '' : this.getProp('scopedId') + this.scopeId = this.getProp('scopedId') === true ? this.hash : this.getProp('scopedId') === false ? '' : this.getProp('scopedId') this.modalBreakout = 0 diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs index 50dbf97a..e5312e32 100644 --- a/src/client/widgets/scripts/script-vm.mjs +++ b/src/client/widgets/scripts/script-vm.mjs @@ -44,7 +44,7 @@ class ScriptVm extends Vm { if (id === 'this') return [widget] else if (id === 'parent' && widget.parent !== widgetManager) return [widget.parent] - else return widgetManager.getWidgetById(id, widget.meta.scopable ? widget.idPrefix : null) + else return widgetManager.getWidgetById(id, widget.scopes) } From 83456acbff7fdd681cefff15e7362a1b0f5948b6 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 18:03:57 +0200 Subject: [PATCH 082/114] scopes: fix some issues in clone and adapt scrollbar --- src/client/widgets/containers/clone.mjs | 8 ++-- src/client/widgets/sliders/scrollbar.mjs | 48 +++++++++++++++++------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 7ec6943a..7005d770 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -71,10 +71,10 @@ class Clone extends Container() { this.getCloneTarget() - // global listener to catch cloneTarget's creation if no target is locked widgetManager.on('widget-created', (e)=>{ - if (this.cloneTarget) return + // if in a non-scoped context we don't watch for a closer target once we have one + if (!this.scopes.length && this.cloneTarget) return var {id, widget} = e @@ -114,13 +114,13 @@ class Clone extends Container() { // attempt to acquire a cloneTarget if 'widget-created' event has not been caught // (the target might have been created before the clone itself) - var scopes = this.prefixId || [''], + var scopes = this.scopes.length ? this.scopes : [''], target = null, rank = 0 for (var scope of scopes) { var widgets = widgetManager.getWidgetById(this.getProp('widgetId'), scope) - .filter(el=>this.isValidCloneTarget(el)) + .filter(w=>this.isValidCloneTarget(w)) target = widgets[0] if (!target) continue diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index 9291e63d..d7c944e2 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -43,6 +43,7 @@ export default class Scrollbar extends StaticProperties(Fader, { super(options) this.scrollTarget = null + this.targetRank = null this.thumbSize = 1 if (!this.getProp('horizontal')) { @@ -50,29 +51,48 @@ export default class Scrollbar extends StaticProperties(Fader, { this.rangeVals[1] = 0 } + this.getScrollTarget() + widgetManager.on('widget-created', (e)=>{ - if (this.scrollTarget) return + // if in a non-scoped context we don't watch for a closer target once we have one + if (!this.scopes.length && this.scrollTarget) return var {id, widget} = e - if (id === this.getProp('widgetId') && widget.getProp('scroll')) { - this.unbindTarget() - this.bindTarget(widget) + if (id.includes(this.getProp('widgetId')) && widget.getProp('scroll')) { + this.getScrollTarget() } }, {context: this}) - var widgets = widgetManager.getWidgetById(this.getProp('widgetId')) - for (var widget of widgets) { - if (widget.getProp('scroll')) { - this.unbindTarget() - this.bindTarget(widget) - break - } - } } + getScrollTarget() { + + var scopes = this.scopes.length ? this.scopes : [''], + target = null, + rank = 0 + + for (var scope of scopes) { + var widgets = widgetManager.getWidgetById(this.getProp('widgetId'), scope) + .filter(w=w.getProp('scroll')) + target = widgets[0] + + if (!target) continue + + if (target && (rank < this.targetRank || this.targetRank == null)) { + + this.unbindTarget() + this.bindTarget(target, rank) + return + } + + rank++ + + } + + } draginitHandle(e) { @@ -134,13 +154,15 @@ export default class Scrollbar extends StaticProperties(Fader, { this.scrollTarget.off(undefined, undefined, this) this.scrollTarget = null + this.targetRank = null } - bindTarget(target) { + bindTarget(target, rank) { if (!target) return this.scrollTarget = target + this.targetRank = rank this.scrollTarget.on('widget-removed', (e)=>{ if (this.scrollTarget === e.widget) { From 83090d2e060d2230aa1f6f1acbfc1a9199b734d0 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 18:09:18 +0200 Subject: [PATCH 083/114] scrollbar: typo --- src/client/widgets/sliders/scrollbar.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index d7c944e2..1f355ae6 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -76,7 +76,7 @@ export default class Scrollbar extends StaticProperties(Fader, { for (var scope of scopes) { var widgets = widgetManager.getWidgetById(this.getProp('widgetId'), scope) - .filter(w=w.getProp('scroll')) + .filter(w=>w.getProp('scroll')) target = widgets[0] if (!target) continue From d69d3b7f1325bcbc4255e425377b042b1f3c9f75 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 19:14:29 +0200 Subject: [PATCH 084/114] scope: tweakedy tweakeda fonk --- src/client/managers/widgets.mjs | 5 ++++- src/client/widgets/common/widget.mjs | 10 ++++++---- src/client/widgets/containers/clone.mjs | 11 ++++++----- src/client/widgets/sliders/scrollbar.mjs | 16 ++++++++++------ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/client/managers/widgets.mjs b/src/client/managers/widgets.mjs index 16bc9563..cf569d9a 100644 --- a/src/client/managers/widgets.mjs +++ b/src/client/managers/widgets.mjs @@ -271,13 +271,16 @@ class WidgetManager extends EventEmitter { /* scopable: return matching widgets only for the closest scope with results */ - if (scope) { + if (scope && scope.length) { + if (!Array.isArray(scope)) scope = [scope] for (var prefix of scope) { var prefixedId = Array.isArray(id) ? id.map(i=>prefix + i) : prefix + id + var widgets = this.getWidgetBy(prefixedId, this.idRoute) if (widgets.length) return widgets } + return [] } return this.getWidgetBy(id, this.idRoute) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 0c89f166..5c76e3c7 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -431,9 +431,11 @@ class Widget extends EventEmitter { parent = parent.parent } while (parent.meta.scopable || parent.getProp('scopedId')) for (var i=0; i < this.scopes.length; i++) { - this.scopes[i] = this.scopes.slice(i).reverse().join('/') + this.scopes[i] = this.scopes.slice(i).reverse().join('/') + '/' } } + // include global scope + if (this.scopes.length) this.scopes.push('') // @{props} links lists this.linkedProps = {} @@ -549,11 +551,11 @@ class Widget extends EventEmitter { /* scopable: attempt to resolve scoped widget updates against ids in advanced syntax blocks */ - if (this.meta.scopable) { + if (this.scopes.length) { var unprefixedId for (var p of this.scopes) { if (id.includes(p)) { - unprefixedId = id.replace(p + '/', '') + unprefixedId = id.replace(p, '') if (this.nestedLinkedProps[unprefixedId] || linkedProps[unprefixedId]) { id = unprefixedId break @@ -957,7 +959,7 @@ class Widget extends EventEmitter { */ case 'id': if (this.scopes.length) { - propValue = this.scopes[0] + '/' + propValue + propValue = this.scopes[0] + propValue } break } diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 7005d770..287a4ba5 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -123,7 +123,10 @@ class Clone extends Container() { .filter(w=>this.isValidCloneTarget(w)) target = widgets[0] - if (!target) continue + if (!target) { + rank++ + continue + } for (var w of widgets) { // when duplicating clones pointing to an object with a static id, @@ -135,7 +138,7 @@ class Clone extends Container() { } } - if (target && (rank < this.targetRank || this.targetRank == null)) { + if (rank < this.targetRank || this.targetRank == null) { var clone = this.children[0] @@ -153,11 +156,9 @@ class Clone extends Container() { this.updateClone() } - - return } - rank++ + return } diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index 1f355ae6..6da7bc07 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -51,7 +51,6 @@ export default class Scrollbar extends StaticProperties(Fader, { this.rangeVals[1] = 0 } - this.getScrollTarget() widgetManager.on('widget-created', (e)=>{ @@ -59,13 +58,15 @@ export default class Scrollbar extends StaticProperties(Fader, { if (!this.scopes.length && this.scrollTarget) return var {id, widget} = e - if (id.includes(this.getProp('widgetId')) && widget.getProp('scroll')) { + this.getScrollTarget() } }, {context: this}) + this.getScrollTarget() + } getScrollTarget() { @@ -79,16 +80,19 @@ export default class Scrollbar extends StaticProperties(Fader, { .filter(w=>w.getProp('scroll')) target = widgets[0] - if (!target) continue + if (!target) { + rank++ + continue + } - if (target && (rank < this.targetRank || this.targetRank == null)) { + if (rank < this.targetRank || this.targetRank == null) { + if (this.scopes.length) this.log(rank) this.unbindTarget() this.bindTarget(target, rank) - return } - rank++ + return } From 4d1b8e924ae9d046f7cf486517d03fb59e614941 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 19:29:25 +0200 Subject: [PATCH 085/114] scope: rename property, and log new feature --- CHANGELOG.md | 5 ++++- src/client/widgets/common/widget.mjs | 4 ++-- src/client/widgets/containers/clone.mjs | 7 ++++--- src/client/widgets/containers/fragment.mjs | 9 +++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efa2b70..62a06368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog -## 1.30.5 +## 1.31.0 + +- widgets + - clone, fragment: add `scoped` property. This allows making a clone self-contained (independant from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) - bug fixes - midi: unrecognized `no_auto_note_off` option diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 5c76e3c7..c579ad94 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -425,11 +425,11 @@ class Widget extends EventEmitter { if (this.meta.scopable) { var parent = this.parent do { - if (parent.getProp('scopedId')) { + if (parent.getProp('scoped')) { this.scopes.push(parent.scopeId) } parent = parent.parent - } while (parent.meta.scopable || parent.getProp('scopedId')) + } while (parent.meta.scopable || parent.getProp('scoped')) for (var i=0; i < this.scopes.length; i++) { this.scopes[i] = this.scopes.slice(i).reverse().join('/') + '/' } diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 287a4ba5..5133ec5d 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -23,9 +23,10 @@ class Clone extends Container() { class_specific: { widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'}, - scopedId: {type: 'boolean|string', value: false, help: [ + scoped: {type: 'boolean|string', value: false, help: [ 'Set to `true` to prefix all cloned `id`s inside the clone with a unique identifier and make the clone independent from its original. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the clone if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the clone.', - 'Set to a string to define the `ìd` prefix manually (a trailing slash will be added automatically).' + '`clone` and `scrollbar` widgets will prioritize targets closer to their scope, falling back to farther target.', + 'Set this property to a string to define the `ìd` prefix manually (a trailing slash will be added automatically). This can be useful if one must access a scoped widget via scripting or remote control commands.' ]}, props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Cloned widget\'s properties to override'}, }, @@ -54,7 +55,7 @@ class Clone extends Container() { this.targetRank = null this.cloneClass = [] - this.scopeId = this.getProp('scopedId') === true ? this.hash : this.getProp('scopedId') === false ? '' : this.getProp('scopedId') + this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped') this.modalBreakout = 0 diff --git a/src/client/widgets/containers/fragment.mjs b/src/client/widgets/containers/fragment.mjs index 0ed04281..0979425f 100644 --- a/src/client/widgets/containers/fragment.mjs +++ b/src/client/widgets/containers/fragment.mjs @@ -29,9 +29,10 @@ class Fragment extends Container() { class_specific: { file: {type: 'string', value: '', help: 'Fragment file path (relative to the session or theme file location by default, falling back to absolute path)'}, fallback: {type: 'string', value: '', help: 'Fallack fragment file path, loaded if `file` can\'t be opened'}, - scopedId: {type: 'boolean|string', value: false, help: [ - 'Set to `true` to prefix all widget `id`s inside the clone with a unique identifier and make the fragment self-contained. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the fragment if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the fragment.', - 'Set to a string to define the `ìd` prefix manually (a trailing slash will be added automatically).' + scoped: {type: 'boolean|string', value: false, help: [ + 'Set to `true` to prefix all cloned `id`s inside the clone with a unique identifier and make the clone independent from its original. All `@{}` blocks and scripts will be prefixed automatically so that they resolve to widgets within the clone if possible, falling back to unprefixed ids otherwise. `linkId` will be prefixed as well but will only resolve within the clone.', + '`clone` and `scrollbar` widgets will prioritize targets closer to their scope, falling back to farther target.', + 'Set this property to a string to define the `ìd` prefix manually (a trailing slash will be added automatically). This can be useful if one must access a scoped widget via scripting or remote control commands.' ]}, props: {type: 'object', value: {}, editor: 'javascript', syntaxChecker: false, help: 'Fragment widget\'s properties to override'}, }, @@ -55,7 +56,7 @@ class Fragment extends Container() { this.noValueState = true - this.scopeId = this.getProp('scopedId') === true ? this.hash : this.getProp('scopedId') === false ? '' : this.getProp('scopedId') + this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped') this.modalBreakout = 0 From 6605f1d2b361ac960895898063bff55f974507f4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 19:50:34 +0200 Subject: [PATCH 086/114] log: phrasing --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62a06368..94008790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 1.31.0 - widgets - - clone, fragment: add `scoped` property. This allows making a clone self-contained (independant from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) + - clone, fragment: add `scoped` property. This allows making yje widget self-contained (independent from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) - bug fixes - midi: unrecognized `no_auto_note_off` option From af1a8a87159978663f40417adfdea916656db627 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 13 Aug 2026 19:52:20 +0200 Subject: [PATCH 087/114] log: fix typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94008790..68dab960 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ - midi: unrecognized `no_auto_note_off` option - custom module - - objects transmitted using `receive()` will be reiceved as objects by the client app (instead of a json string) + - objects transmitted using `receive()` will be received as objects by the client app (instead of a json string) ## 1.30.4 From 64642274d8ae148a180aff1ad32fc20cff6f70b4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 09:30:29 +0200 Subject: [PATCH 088/114] mac: quit app when last window is destroyed --- src/server/electron/electron-app.mjs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/server/electron/electron-app.mjs b/src/server/electron/electron-app.mjs index f8a42272..eac5e9b0 100644 --- a/src/server/electron/electron-app.mjs +++ b/src/server/electron/electron-app.mjs @@ -131,9 +131,7 @@ app.on('ready',()=>{ }) app.on('window-all-closed', function() { - if (process.platform !== 'darwin') { - app.quit() - } + app.quit() }) export default app From af6cc4b9116aa636d43242e500c79d531b919bbb Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 09:31:11 +0200 Subject: [PATCH 089/114] tray: keep alive when closing if the server is running --- src/server/electron/index.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/electron/index.mjs b/src/server/electron/index.mjs index f75f121d..1f9179a4 100644 --- a/src/server/electron/index.mjs +++ b/src/server/electron/index.mjs @@ -199,7 +199,7 @@ function startLauncher() { }) launcher.on('will-close', (e)=>{ - if (clientWindows.some(w=>w && !w.isDestroyed())) { + if (clientWindows.some(w=>w && !w.isDestroyed()) || serverProcess) { launcher.hide() e.preventDefault() } @@ -209,7 +209,7 @@ function startLauncher() { launcher.on('close', (e)=>{ - if (tray && clientWindows.some(w=>w && !w.isDestroyed()) && serverProcess) { + if (tray && (clientWindows.some(w=>w && !w.isDestroyed()) || serverProcess)) { launcher.hide() e.preventDefault() return From 7c38dedcc79eb56cb1e71aa6516dc5dfd41a1396 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 09:31:49 +0200 Subject: [PATCH 090/114] log: latest changes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68dab960..cc4f7c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - bug fixes - midi: unrecognized `no_auto_note_off` option + - MacOs: the app now quits when all windows are closed + - launcher: if the Tray icon is enabled, closing the launcher window won't quit the app if the server is running - custom module - objects transmitted using `receive()` will be received as objects by the client app (instead of a json string) From efe56293963f5c3a17c554b73aa75003b8a1fdc7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 12:37:43 +0200 Subject: [PATCH 091/114] log: typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc4f7c66..83847108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 1.31.0 - widgets - - clone, fragment: add `scoped` property. This allows making yje widget self-contained (independent from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) + - clone, fragment: add `scoped` property. This allows making the widget self-contained (independent from its original) by prefixing all widget ids automatically (and transparently resolving unprefixed ids in advanced syntaxes and scripts within the scope) - bug fixes - midi: unrecognized `no_auto_note_off` option From ce0ae02c8bf19b10927ec9b2822fe80837353cc8 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 12:50:05 +0200 Subject: [PATCH 092/114] scrollbar: fix initial value in vertical mode --- src/client/widgets/sliders/scrollbar.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index 6da7bc07..6ea82a19 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -47,8 +47,10 @@ export default class Scrollbar extends StaticProperties(Fader, { this.thumbSize = 1 if (!this.getProp('horizontal')) { + // invert vertical fader this.rangeVals[0] = 1 this.rangeVals[1] = 0 + this.setValue(this.getSpringValue()) } From e7baf468908de55711b8707cc9db3ccdf3a467ec Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 12:50:26 +0200 Subject: [PATCH 093/114] scrollbar: rm debug log --- src/client/widgets/sliders/scrollbar.mjs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/client/widgets/sliders/scrollbar.mjs b/src/client/widgets/sliders/scrollbar.mjs index 6ea82a19..e3dafd9f 100644 --- a/src/client/widgets/sliders/scrollbar.mjs +++ b/src/client/widgets/sliders/scrollbar.mjs @@ -88,8 +88,6 @@ export default class Scrollbar extends StaticProperties(Fader, { } if (rank < this.targetRank || this.targetRank == null) { - if (this.scopes.length) this.log(rank) - this.unbindTarget() this.bindTarget(target, rank) } From 54d32c4c3f3ea0a07b2e7d5be125e0823015cd7e Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 14 Aug 2026 12:52:42 +0200 Subject: [PATCH 094/114] log: scrollbar init fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83847108..b335605b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - midi: unrecognized `no_auto_note_off` option - MacOs: the app now quits when all windows are closed - launcher: if the Tray icon is enabled, closing the launcher window won't quit the app if the server is running + - scrollbar widget: fix initial value in vertical mode - custom module - objects transmitted using `receive()` will be received as objects by the client app (instead of a json string) From 883fb811e8429707b1895b4add542eda80e77bca Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 24 Aug 2026 10:40:19 +0200 Subject: [PATCH 095/114] client: make console message area focusable and prevent editor kbd shortcuts when focused --- CHANGELOG.md | 1 + src/client/editor/index.mjs | 2 +- src/client/ui/ui-console.mjs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b335605b..68cf041e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - MacOs: the app now quits when all windows are closed - launcher: if the Tray icon is enabled, closing the launcher window won't quit the app if the server is running - scrollbar widget: fix initial value in vertical mode + - console: fix copying using CmdOrCtrl+C when the editor is enabled - custom module - objects transmitted using `receive()` will be received as objects by the client app (instead of a json string) diff --git a/src/client/editor/index.mjs b/src/client/editor/index.mjs index 9577cd1e..d7e262f2 100644 --- a/src/client/editor/index.mjs +++ b/src/client/editor/index.mjs @@ -282,7 +282,7 @@ class Editor { if ( this.inspector.helpModalOpened || - e && e.target && e.target.tagName.match(/INPUT|TEXTAREA|SELECT/) + e && e.target && e.target.tagName.match(/INPUT|TEXTAREA|SELECT|OSC-CONSOLE/) ) return if (e) e.preventDefault() diff --git a/src/client/ui/ui-console.mjs b/src/client/ui/ui-console.mjs index ba5caf75..6ab82d36 100644 --- a/src/client/ui/ui-console.mjs +++ b/src/client/ui/ui-console.mjs @@ -17,7 +17,7 @@ class UiConsole extends UiSidePanel { this.header = DOM.get(this.container, 'osc-panel-header')[0] this.header.appendChild(html``) - this.messages = this.content.appendChild(html``) + this.messages = this.content.appendChild(html``) this.inputWrapper = this.content.appendChild(html``) this.input = this.inputWrapper.appendChild(html``) From 81d5e8404455046142860082d70bc32e1fa2cda1 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 24 Aug 2026 10:49:43 +0200 Subject: [PATCH 096/114] console: visually indicate focus and blur with escape key --- src/client/ui/ui-console.mjs | 6 ++++++ src/scss/ui/console.scss | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/client/ui/ui-console.mjs b/src/client/ui/ui-console.mjs index 6ab82d36..5c960158 100644 --- a/src/client/ui/ui-console.mjs +++ b/src/client/ui/ui-console.mjs @@ -105,6 +105,12 @@ class UiConsole extends UiSidePanel { this.inputSize() }) + this.messages.addEventListener('keydown', (event)=>{ + if (event.key == 'Escape') { + this.messages.blur() + } + }) + if (!READ_ONLY) this.enable() } diff --git a/src/scss/ui/console.scss b/src/scss/ui/console.scss index f91b2491..4d05b12b 100644 --- a/src/scss/ui/console.scss +++ b/src/scss/ui/console.scss @@ -60,6 +60,11 @@ osc-console { overflow-y: auto; border-bottom: 1rem dotted rgba(255,255,255,0.2); user-select: text; + + &:focus { + outline: 1rem dotted var(--color-accent); + outline-offset: -1rem; + } } osc-console-message { From dcfde67d711837e120467cbf83d2a677f4fc5785 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 24 Aug 2026 10:59:52 +0200 Subject: [PATCH 097/114] console: only hint focus when editor is enabled --- src/scss/ui/console.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scss/ui/console.scss b/src/scss/ui/console.scss index 4d05b12b..492f8e60 100644 --- a/src/scss/ui/console.scss +++ b/src/scss/ui/console.scss @@ -60,11 +60,11 @@ osc-console { overflow-y: auto; border-bottom: 1rem dotted rgba(255,255,255,0.2); user-select: text; +} - &:focus { - outline: 1rem dotted var(--color-accent); - outline-offset: -1rem; - } +.editor-enabled osc-console:focus { + outline: 1rem dotted var(--color-accent); + outline-offset: -1rem; } osc-console-message { From aee968cba9100644338efe3f5f64449e5732f7ec Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 24 Aug 2026 14:21:24 +0200 Subject: [PATCH 098/114] package: v1.31.0 --- package.json | 2 +- resources/mkdocs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 10247368..1089d758 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.30.4", + "version": "1.31.0", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index e4a96fac..c8b4e107 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.30.4 +latest_release: 1.31.0 theme: name: 'material' From a73e2755dc3fccd1a7b4a49b087de73f73bad774 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 30 Aug 2026 16:04:29 +0200 Subject: [PATCH 099/114] clone: regression causing error when some widgets have a non-string id --- CHANGELOG.md | 5 +++++ package.json | 2 +- src/client/widgets/containers/clone.mjs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68cf041e..ea8b3213 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.31.1 + +- bug fixes + - clone: regression causing error when some widgets have a non-string id + ## 1.31.0 - widgets diff --git a/package.json b/package.json index 1089d758..6f525a64 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.31.0", + "version": "1.31.1", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/src/client/widgets/containers/clone.mjs b/src/client/widgets/containers/clone.mjs index 5133ec5d..bf855b51 100644 --- a/src/client/widgets/containers/clone.mjs +++ b/src/client/widgets/containers/clone.mjs @@ -79,7 +79,7 @@ class Clone extends Container() { var {id, widget} = e - if (id.includes(this.getProp('widgetId')) && this.isValidCloneTarget(widget)) { + if (String(id).includes(this.getProp('widgetId')) && this.isValidCloneTarget(widget)) { this.getCloneTarget() From db85c429898a85d462e642a1a377dfe337c19644 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 30 Aug 2026 16:09:07 +0200 Subject: [PATCH 100/114] docs: 1.31.1 --- resources/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index c8b4e107..bf156ab2 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.31.0 +latest_release: 1.31.1 theme: name: 'material' From 3263cf2ff1b52607f3cb7d9dd9120c33b9ea36bf Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 30 Aug 2026 17:18:27 +0200 Subject: [PATCH 101/114] server: fix allowed extension regexp, explicitely allow mjs src files --- src/server/node/server.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index 82d7eb94..6aef83bb 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -244,7 +244,8 @@ class WebServer extends EventEmitter { url = url.replace('_:_', ':') // escaped drive colon url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash - if (url.match(/.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) { + if (url.match(/\.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i) || + url.match(/\.mjs$/) && !this.prod) { // Resolution order: session path, theme path, absolute path var id From 000714d22b7e0acd0c2cbf69f09c320be29bfa8c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 8 Sep 2026 16:36:09 +0200 Subject: [PATCH 102/114] image: ensure default value is a string --- src/client/widgets/frames/image.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/frames/image.mjs b/src/client/widgets/frames/image.mjs index 4e6d563e..9eae72c4 100644 --- a/src/client/widgets/frames/image.mjs +++ b/src/client/widgets/frames/image.mjs @@ -70,7 +70,7 @@ export default class Image extends StaticProperties(Widget, {bypass: true}) { if (!s.length) { - this.value = this.getProp('default') + this.value = String(this.getProp('default')) } else if (s != 'reload') { From aec5ba9d9c31fab780c587613151033b5010f7eb Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 6 Oct 2026 09:10:36 +0200 Subject: [PATCH 103/114] canvas: allow `onResize` to send and trigger widget synchronization and scripts --- CHANGELOG.md | 5 +++++ resources/docs/docs/widgets/canvas.md | 10 ++++++---- resources/docs/docs/widgets/scripting.md | 2 ++ src/client/widgets/pads/canvas.mjs | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea8b3213..6080f189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.31.2 + +- widgets + - canvas: allow `onResize` to send and trigger widget synchronization and scripts + ## 1.31.1 - bug fixes diff --git a/resources/docs/docs/widgets/canvas.md b/resources/docs/docs/widgets/canvas.md index 5ae9bb0d..dffea008 100644 --- a/resources/docs/docs/widgets/canvas.md +++ b/resources/docs/docs/widgets/canvas.md @@ -2,7 +2,7 @@ The canvas widget allows creating custom widgets with user-defined drawings and touch reactions. -It has two special properties, `touch` and `draw`, that work like the `script` property : they are used to defined scripts that will be executed when specific events occurs. +It has dedicated scripting properties (`onTouch`, `onDraw` and `onResize`) that work like the `onValue` property : they are used to defined scripts that will be executed when specific events occurs. This widget requires a good understanding of the javascript [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and of the javascript programming language in general. @@ -30,7 +30,7 @@ If this property is enabled, the widget will be redrawn at a fixed rate even if This script is executed when the widget is touched, when it is released, and during the movement of the pointer while the widget is touched. -This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: +This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - `value`: widget value - `width`: canvas width in pixels @@ -59,7 +59,7 @@ This script has access to the same variables and functions as the `script` prope This script is executed when the widget should be redrawn, which is when it's touched and when it receives a value. -This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: +This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - `value`: widget value - `width`: canvas width in pixels @@ -67,11 +67,13 @@ This script has access to the same variables and functions as the `script` prope - `ctx`: [canvas rendering context](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) of the widget - `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc +In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates. + ### `onResize` This script is executed when the widget has resized, before it is redrawn. -This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following: +This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following: - `value`: widget value - `width`: canvas width in pixels diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 090bd3a0..c02e975c 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -123,6 +123,8 @@ The following variables are available in this context: This script is specific to the root widget, it's called before any other widget is created and can be used to create global variables / functions accessible in other scripts. +In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates. + ## Available variables The following variables and functions are accessible in this context. diff --git a/src/client/widgets/pads/canvas.mjs b/src/client/widgets/pads/canvas.mjs index 052d81ca..8b0c62e1 100644 --- a/src/client/widgets/pads/canvas.mjs +++ b/src/client/widgets/pads/canvas.mjs @@ -180,7 +180,7 @@ class CanvasWidget extends Canvas { width: this.width, height: this.height, cssVars: this.cssVars - }, {sync: false, send: false}) + }, {sync: true, send: true}) } From dd3ca188ab88351284fd3ba698597ad84216d3b7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 21 Oct 2026 10:01:29 +0200 Subject: [PATCH 104/114] server: ipc: deduplicate packet serialization when sending to multiple clients --- src/server/node/ipc/client.mjs | 4 ++-- src/server/node/ipc/server.mjs | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/server/node/ipc/client.mjs b/src/server/node/ipc/client.mjs index be5207a9..5e17545e 100644 --- a/src/server/node/ipc/client.mjs +++ b/src/server/node/ipc/client.mjs @@ -97,9 +97,9 @@ class Client extends EventEmitter { } - send(event, data) { + send(packet) { - var packet = JSON.stringify([event, data]) + // see IpcServer.send if (this.connected()) { this.socket.send(packet) diff --git a/src/server/node/ipc/server.mjs b/src/server/node/ipc/server.mjs index e4eafd37..7efadcc7 100644 --- a/src/server/node/ipc/server.mjs +++ b/src/server/node/ipc/server.mjs @@ -66,12 +66,22 @@ class IpcServer { send(event, data, id, except) { - var clients = id ? [this.clients[id]] : this.clients + var packet = JSON.stringify([event, data]) - for (var k in clients) { - if (!except || this.clients[k] != this.clients[except]) { - if (clients[k]) clients[k].send(event, data) + if (id) { + // send to a single client + if (this.clients[id]){ + this.clients[id].send(packet) } + + } else { + // send to all clients except one if specified + for (var id in this.clients) { + if (id != except) { + this.clients[id].send(packet) + } + } + } } From 9eab8ce38ba7694ae7d897c8bc0ff7a72367903f Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 21 Oct 2026 10:08:07 +0200 Subject: [PATCH 105/114] server: send session open error to appropriate client instead of all --- src/server/node/ipc/callbacks.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/node/ipc/callbacks.mjs b/src/server/node/ipc/callbacks.mjs index 2376fee3..09063b10 100644 --- a/src/server/node/ipc/callbacks.mjs +++ b/src/server/node/ipc/callbacks.mjs @@ -136,7 +136,7 @@ export default class Callbacks { }, (error)=>{ - this.ipcServer.send('error', `Could not open session file:\n ${error}`) + this.ipcServer.send('error', `Could not open session file:\n ${error}`, clientId) }) From a47050e7ad31284553cca60441015f79b95cc5e0 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 21 Oct 2026 10:09:40 +0200 Subject: [PATCH 106/114] server: send state open error to appropriate client instead of all --- src/server/node/ipc/callbacks.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/node/ipc/callbacks.mjs b/src/server/node/ipc/callbacks.mjs index 09063b10..0d887fbc 100644 --- a/src/server/node/ipc/callbacks.mjs +++ b/src/server/node/ipc/callbacks.mjs @@ -287,7 +287,7 @@ export default class Callbacks { }, (error)=>{ - this.ipcServer.send('error', `Could not open state file:\n ${error}`) + this.ipcServer.send('error', `Could not open state file:\n ${error}`, clientId) }) From 2790b7d86ecefd1042977546084e378ebdc65352 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 8 Nov 2026 00:30:32 +0100 Subject: [PATCH 107/114] server: serve dev files for client src debugging --- src/server/node/server.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index 6aef83bb..3f7684fc 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -41,6 +41,11 @@ class WebServer extends EventEmitter { // add remote root or absolute this.resolveDirs.push(this.remoteRoot || '') + if (!this.prod) { + // add src root folder for debugging + this.resolveDirs.push(path.resolve(__dirname + '/../../../')) + } + this.ignoredNotFound = [ '/apple-touch-icon-precomposed.png', '/favicon.ico', From cd4e3b35bbddba7e3fbb819dffb1ae99212538d6 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 8 Nov 2026 01:24:26 +0100 Subject: [PATCH 108/114] editor: fix call stack overflow caused by commit c1720b4a --- src/client/widgets/common/widget.mjs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index c579ad94..a5626a35 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -392,6 +392,24 @@ class Widget extends EventEmitter { } + areEquivalentValueProps(a, b) { + /* See commit c1720b4a and https://openstagecontrol.discourse.group/t/widget-update-when-setting-value-via-edit/4186/7 + * for the root of this... + */ + + var currentValue = deepCopy(this.value) + var va, vb + + this.setValue(a, {coerceTest: true}) + va = deepCopy(this.value) + this.setValue(b, {coerceTest: true}) + vb = deepCopy(this.value) + + this.setValue(currentValue) + + return deepEqual(va, vb) + } + checkLinkedProps(propNames) { // Dynamic props cache check @@ -1000,9 +1018,8 @@ class Widget extends EventEmitter { if ( !deepEqual(oldPropValue, propValue) || - (options && options.fromEditor && propName == 'value' && !deepEqual(oldPropValue, this.value)) + (options && options.fromEditor && propName == 'value' && !this.areEquivalentValueProps(propValue, oldPropValue)) ) { - if (!this.isDynamicProp(propName)) { if (this.constructor._defaults[propName] === undefined) { From 82edcfe282cb2270f5226f88fde559056efc17ce Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 8 Nov 2026 01:37:19 +0100 Subject: [PATCH 109/114] log: 1.31.2 changes --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6080f189..ff189256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,11 @@ ## 1.31.2 +- bug fixes + - editor: fix regression (1.30.0) causing errors when editing the value property + - widgets - - canvas: allow `onResize` to send and trigger widget synchronization and scripts + - canvas: allow `onResize` to send and trigger widget synchronization and scripts ## 1.31.1 diff --git a/package.json b/package.json index 6f525a64..9bc10d3d 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.31.1", + "version": "1.31.2", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" From f1dd12c601ac0755f78ca8c9a0ad5b2036fd1cdb Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 8 Nov 2026 01:39:12 +0100 Subject: [PATCH 110/114] misc: lint --- src/server/node/ipc/server.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/node/ipc/server.mjs b/src/server/node/ipc/server.mjs index 7efadcc7..b3d707fb 100644 --- a/src/server/node/ipc/server.mjs +++ b/src/server/node/ipc/server.mjs @@ -76,7 +76,7 @@ class IpcServer { } else { // send to all clients except one if specified - for (var id in this.clients) { + for (let id in this.clients) { if (id != except) { this.clients[id].send(packet) } From c3d993e46a4dc57690c90d5e3d61d26388d140c3 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 8 Nov 2026 01:40:00 +0100 Subject: [PATCH 111/114] docs: bump version --- resources/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index bf156ab2..e6599ab8 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/ copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)" site_description: "Libre and modular OSC / MIDI controller" site_dir: '../app/docs/' -latest_release: 1.31.1 +latest_release: 1.31.2 theme: name: 'material' From c97416b2c37c4a28552422b1703d33de5379a69c Mon Sep 17 00:00:00 2001 From: RikSolo Date: Sun, 15 Nov 2026 01:16:56 +0100 Subject: [PATCH 112/114] package: docker init --- .dockerignore | 3 + .gitignore | 1 + Dockerfile | 28 +++ README.md | 6 + basesession.json | 49 ++++ docker-compose.yml | 8 + entrypoint.sh | 10 + package-lock.json | 563 ++++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 666 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 basesession.json create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..bc487890 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +app +sessions \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4a9197ae..71086d11 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ properties-reference.md # packaging dist/ +sessions/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..809ce8dd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM node:24-alpine + +RUN apk --no-cache add git + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +RUN mkdir /sessions +RUN touch /sessions/session.json + +EXPOSE 8080 + +ENV ELECTRON_RUN_AS_NODE=1 + +ENV SEND="127.0.0.1:8080" +ENV LOAD="/sessions/main.json" +ENV PORT=8080 +ENV OSC_PORT=8080 +ENV READ_ONLY=false + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/README.md b/README.md index 02b38289..89da9bd5 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,11 @@ Open Stage Control ---- +Docker additions by Rik Berkelder. + +mount `/sessions` directory. default session file is created and loaded there. + +--- + Copyleft © Jean-Emmanuel Doucet 2014-2025. This program is a free software released under the [GNU/GPL3](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/LICENSE) license. diff --git a/basesession.json b/basesession.json new file mode 100644 index 00000000..9ddad0bb --- /dev/null +++ b/basesession.json @@ -0,0 +1,49 @@ +{ + "createdWith": "Open Stage Control", + "version": "1.31.2", + "type": "session", + "content": { + "type": "root", + "lock": false, + "id": "root", + "visible": true, + "interaction": true, + "comments": "", + "width": "auto", + "height": "auto", + "colorText": "auto", + "colorWidget": "auto", + "alphaFillOn": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "colorBg": "auto", + "layout": "default", + "justify": "start", + "gridTemplate": "", + "contain": true, + "scroll": true, + "innerPadding": true, + "tabsPosition": "top", + "hideMenu": false, + "variables": "@{parent.variables}", + "traversing": false, + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "onTouch": "", + "onPreload": "", + "widgets": [], + "tabs": [] + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..314d2769 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + app: + build: . + volumes: + - ./sessions:/sessions + ports: + - 8080:8080 + \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..f4720cdf --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +test -f "$LOAD" || cp "basesession.json" "$LOAD" + +exec node app/index.js \ + --port $PORT \ + --osc-port $OSC_PORT \ + --send $SEND \ + --load $LOAD \ + --read-only=$READ_ONLY diff --git a/package-lock.json b/package-lock.json index a0d220ff..3956e018 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "open-stage-control", - "version": "1.30.0-beta9", + "version": "1.31.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "open-stage-control", - "version": "1.30.0-beta9", + "version": "1.31.2", "hasInstallScript": true, "license": "GPL-3.0", "dependencies": { @@ -2024,6 +2024,178 @@ "@parcel/watcher-win32-x64": "2.5.1" } }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz", + "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz", + "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz", + "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz", + "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz", + "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz", + "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", + "cpu": [ + "arm" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz", + "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz", + "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@parcel/watcher-linux-x64-glibc": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz", @@ -2043,6 +2215,89 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz", + "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz", + "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz", + "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz", + "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/@rollup/plugin-babel": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.1.0.tgz", @@ -2177,6 +2432,228 @@ } } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.50.1.tgz", + "integrity": "sha512-HJXwzoZN4eYTdD8bVV22DN8gsPCAj3V20NHKOs8ezfXanGpmVPR7kalUHd+Y31IJp9stdB87VKPFbsGY3H/2ag==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.50.1.tgz", + "integrity": "sha512-PZlsJVcjHfcH53mOImyt3bc97Ep3FJDXRpk9sMdGX0qgLmY0EIWxCag6EigerGhLVuL8lDVYNnSo8qnTElO4xw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.50.1.tgz", + "integrity": "sha512-xc6i2AuWh++oGi4ylOFPmzJOEeAa2lJeGUGb4MudOtgfyyjr4UPNK+eEWTPLvmPJIY/pgw6ssFIox23SyrkkJw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.50.1.tgz", + "integrity": "sha512-2ofU89lEpDYhdLAbRdeyz/kX3Y2lpYc6ShRnDjY35bZhd2ipuDMDi6ZTQ9NIag94K28nFMofdnKeHR7BT0CATw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.50.1.tgz", + "integrity": "sha512-wOsE6H2u6PxsHY/BeFHA4VGQN3KUJFZp7QJBmDYI983fgxq5Th8FDkVuERb2l9vDMs1D5XhOrhBrnqcEY6l8ZA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.50.1.tgz", + "integrity": "sha512-A/xeqaHTlKbQggxCqispFAcNjycpUEHP52mwMQZUNqDUJFFYtPHCXS1VAG29uMlDzIVr+i00tSFWFLivMcoIBQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.50.1.tgz", + "integrity": "sha512-54v4okehwl5TaSIkpp97rAHGp7t3ghinRd/vyC1iXqXMfjYUTm7TfYmCzXDoHUPTTf36L8pr0E7YsD3CfB3ZDg==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.50.1.tgz", + "integrity": "sha512-p/LaFyajPN/0PUHjv8TNyxLiA7RwmDoVY3flXHPSzqrGcIp/c2FjwPPP5++u87DGHtw+5kSH5bCJz0mvXngYxw==", + "cpu": [ + "arm" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.50.1.tgz", + "integrity": "sha512-2AbMhFFkTo6Ptna1zO7kAXXDLi7H9fGTbVaIq2AAYO7yzcAsuTNWPHhb2aTA6GPiP+JXh85Y8CiS54iZoj4opw==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.50.1.tgz", + "integrity": "sha512-Cgef+5aZwuvesQNw9eX7g19FfKX5/pQRIyhoXLCiBOrWopjo7ycfB292TX9MDcDijiuIJlx1IzJz3IoCPfqs9w==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.50.1.tgz", + "integrity": "sha512-RPhTwWMzpYYrHrJAS7CmpdtHNKtt2Ueo+BlLBjfZEhYBhK00OsEqM08/7f+eohiF6poe0YRDDd8nAvwtE/Y62Q==", + "cpu": [ + "loong64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.50.1.tgz", + "integrity": "sha512-eSGMVQw9iekut62O7eBdbiccRguuDgiPMsw++BVUg+1K7WjZXHOg/YOT9SWMzPZA+w98G+Fa1VqJgHZOHHnY0Q==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.50.1.tgz", + "integrity": "sha512-S208ojx8a4ciIPrLgazF6AgdcNJzQE4+S9rsmOmDJkusvctii+ZvEuIC4v/xFqzbuP8yDjn73oBlNDgF6YGSXQ==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.50.1.tgz", + "integrity": "sha512-3Ag8Ls1ggqkGUvSZWYcdgFwriy2lWo+0QlYgEFra/5JGtAd6C5Hw59oojx1DeqcA2Wds2ayRgvJ4qxVTzCHgzg==", + "cpu": [ + "riscv64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.50.1.tgz", + "integrity": "sha512-t9YrKfaxCYe7l7ldFERE1BRg/4TATxIg+YieHQ966jwvo7ddHJxPj9cNFWLAzhkVsbBvNA4qTbPVNsZKBO4NSg==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.50.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.50.1.tgz", @@ -2189,6 +2666,74 @@ "linux" ] }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.50.1.tgz", + "integrity": "sha512-nEvqG+0jeRmqaUMuwzlfMKwcIVffy/9KGbAGyoa26iu6eSngAYQ512bMXuqqPrlTyfqdlB9FVINs93j534UJrg==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.50.1.tgz", + "integrity": "sha512-RDsLm+phmT3MJd9SNxA9MNuEAO/J2fhW8GXk62G/B4G7sLVumNFbRwDL6v5NrESb48k+QMqdGbHgEtfU0LCpbA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.50.1.tgz", + "integrity": "sha512-hpZB/TImk2FlAFAIsoElM3tLzq57uxnGYwplg6WDyAxbYczSi8O2eQ+H2Lx74504rwKtZ3N2g4bCUkiamzS6TQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.50.1.tgz", + "integrity": "sha512-SXjv8JlbzKM0fTJidX4eVsH+Wmnp0/WcD8gJxIZyR6Gay5Qcsmdbi9zVtnbkGPG8v2vMR1AD06lGWy5FLMcG7A==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.50.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.50.1.tgz", + "integrity": "sha512-StxAO/8ts62KZVRAm4JZYq9+NqNsV7RvimNK+YM7ry//zebEH6meuugqW/P5OFUCjyQgui+9fUxT6d5NShvMvA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@serialport/binding-mock": { "version": "10.2.2", "resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-10.2.2.tgz", @@ -4818,6 +5363,20 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", From d81da1acd38cbb38dc1ff1b6528c95a73a98fe53 Mon Sep 17 00:00:00 2001 From: RikSolo Date: Sun, 15 Nov 2026 01:24:41 +0100 Subject: [PATCH 113/114] ci: forgejo docker build --- .forgejo/workflows/build.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .forgejo/workflows/build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 00000000..68eaa5f3 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build +on: [workflow_dispatch] + +jobs: + Deploy: + runs-on: docker + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + lfs: 'true' + + - name: Docker Login + run: | + docker login -u riksolo -p ${{secrets.CONTAINER_REGISTRY_TOKEN}} git.riksolo.com + + - name: Build and push + run: | + docker build -t git.riksolo.com/riksolo/open-stage-control:latest -t git.riksolo.com/riksolo/open-stage-control:${{github.sha}} . + docker push git.riksolo.com/riksolo/open-stage-control:latest + docker push git.riksolo.com/riksolo/open-stage-control:${{github.sha}} \ No newline at end of file From 1af30141d0aaa4c3911bf838129339af5fc0e4e9 Mon Sep 17 00:00:00 2001 From: RikSolo Date: Sun, 15 Nov 2026 02:10:46 +0100 Subject: [PATCH 114/114] package: make sure entrypoint.sh is runnable in docker container --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 809ce8dd..921666c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,4 +25,5 @@ ENV PORT=8080 ENV OSC_PORT=8080 ENV READ_ONLY=false +RUN chmod +x entrypoint.sh ENTRYPOINT ["./entrypoint.sh"]