Compare commits

...

42 commits

Author SHA1 Message Date
1af30141d0 package: make sure entrypoint.sh is runnable in docker container 2026-11-15 02:10:46 +01:00
d81da1acd3 ci: forgejo docker build 2026-11-15 02:01:00 +01:00
c97416b2c3 package: docker init 2026-11-15 01:16:56 +01:00
jean-emmanuel
c3d993e46a docs: bump version 2026-11-08 01:40:00 +01:00
jean-emmanuel
f1dd12c601 misc: lint 2026-11-08 01:39:12 +01:00
jean-emmanuel
82edcfe282 log: 1.31.2 changes 2026-11-08 01:37:19 +01:00
jean-emmanuel
cd4e3b35bb editor: fix call stack overflow caused by commit c1720b4a 2026-11-08 01:24:26 +01:00
jean-emmanuel
2790b7d86e server: serve dev files for client src debugging 2026-11-08 00:30:32 +01:00
jean-emmanuel
a47050e7ad server: send state open error to appropriate client instead of all 2026-10-21 10:09:40 +02:00
jean-emmanuel
9eab8ce38b server: send session open error to appropriate client instead of all 2026-10-21 10:08:07 +02:00
jean-emmanuel
dd3ca188ab server: ipc: deduplicate packet serialization when sending to multiple clients 2026-10-21 10:06:26 +02:00
jean-emmanuel
aec5ba9d9c canvas: allow onResize to send and trigger widget synchronization and scripts 2026-10-06 09:10:36 +02:00
jean-emmanuel
000714d22b image: ensure default value is a string 2026-09-08 16:36:09 +02:00
jean-emmanuel
3263cf2ff1 server: fix allowed extension regexp, explicitely allow mjs src files 2026-08-30 17:18:27 +02:00
jean-emmanuel
db85c42989 docs: 1.31.1 2026-08-30 16:09:07 +02:00
jean-emmanuel
a73e2755dc clone: regression causing error when some widgets have a non-string id 2026-08-30 16:04:29 +02:00
jean-emmanuel
aee968cba9 package: v1.31.0 2026-08-24 14:21:48 +02:00
jean-emmanuel
dcfde67d71 console: only hint focus when editor is enabled 2026-08-24 10:59:52 +02:00
jean-emmanuel
81d5e84044 console: visually indicate focus and blur with escape key 2026-08-24 10:49:43 +02:00
jean-emmanuel
883fb811e8 client: make console message area focusable and prevent editor kbd shortcuts when focused 2026-08-24 10:40:19 +02:00
jean-emmanuel
54d32c4c3f log: scrollbar init fix 2026-08-14 12:52:42 +02:00
jean-emmanuel
e7baf46890 scrollbar: rm debug log 2026-08-14 12:50:26 +02:00
jean-emmanuel
ce0ae02c8b scrollbar: fix initial value in vertical mode 2026-08-14 12:50:05 +02:00
jean-emmanuel
efe5629396 log: typo 2026-08-14 12:37:43 +02:00
jean-emmanuel
7c38dedcc7 log: latest changes 2026-08-14 09:31:49 +02:00
jean-emmanuel
af6cc4b911 tray: keep alive when closing if the server is running 2026-08-14 09:31:11 +02:00
jean-emmanuel
64642274d8 mac: quit app when last window is destroyed 2026-08-14 09:30:29 +02:00
jean-emmanuel
af1a8a8715 log: fix typo 2026-08-13 19:52:20 +02:00
jean-emmanuel
6605f1d2b3 log: phrasing 2026-08-13 19:50:34 +02:00
jean-emmanuel
4d1b8e924a scope: rename property, and log new feature 2026-08-13 19:29:25 +02:00
jean-emmanuel
d69d3b7f13 scope: tweakedy tweakeda fonk 2026-08-13 19:14:29 +02:00
jean-emmanuel
83090d2e06 scrollbar: typo 2026-08-13 18:09:18 +02:00
jean-emmanuel
83456acbff scopes: fix some issues in clone and adapt scrollbar 2026-08-13 18:08:29 +02:00
jean-emmanuel
08b837ff98 scope: continue implementation, adjust clone target acquire mechanism, add scoped linkId 2026-08-13 17:50:57 +02:00
jean-emmanuel
0e8c77a700 widgets: fix widget removal from linkId table when '<<' or '>>' prefixes are present 2026-08-13 16:55:33 +02:00
jean-emmanuel
a36811954d widgets: amend not_editable clean 2026-08-13 15:17:52 +02:00
jean-emmanuel
39c9d4a46d scoping: first id scoping implementation 2026-08-12 16:10:31 +02:00
jean-emmanuel
593ec4c53d widget: clean not-editable css class 2026-08-12 16:09:43 +02:00
jean-emmanuel
8c22384ddb widgets: better not_editable widget flag implementation 2026-08-09 10:30:11 +02:00
jean-emmanuel
7981b6fdd6 osc: avoid object serialization from custom module to client 2026-08-06 12:43:23 +02:00
jean-emmanuel
27d87f2238 stacktrace: missing indentation 2026-07-09 09:08:11 +02:00
jean-emmanuel
c49a731134 midi: fix unrecognized no_auto_note_off option 2026-07-08 11:38:57 +02:00
44 changed files with 1039 additions and 170 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
node_modules
app
sessions

View file

@ -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}}

1
.gitignore vendored
View file

@ -14,3 +14,4 @@ properties-reference.md
# packaging
dist/
sessions/

View file

@ -1,5 +1,32 @@
# Changelog
## 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
## 1.31.1
- bug fixes
- clone: regression causing error when some widgets have a non-string id
## 1.31.0
- widgets
- 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
- 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)
## 1.30.4

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
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
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]

View file

@ -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.

49
basesession.json Normal file
View file

@ -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": []
}
}

8
docker-compose.yml Normal file
View file

@ -0,0 +1,8 @@
services:
app:
build: .
volumes:
- ./sessions:/sessions
ports:
- 8080:8080

10
entrypoint.sh Normal file
View file

@ -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

563
package-lock.json generated
View file

@ -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",

View file

@ -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.2",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -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

View file

@ -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.

View file

@ -5,7 +5,7 @@ edit_uri: tree/master/resources/docs/
copyright: "Copyleft © Jean-Emmanuel Doucet @ <a href='http://ammd.net'>AMMD</a> (<a href='https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/LICENSE'>GNU/GPLv3</a>)"
site_description: "Libre and modular OSC / MIDI controller"
site_dir: '../app/docs/'
latest_release: 1.30.4
latest_release: 1.31.2
theme:
name: 'material'

View file

@ -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
}

View file

@ -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)

View file

@ -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()
@ -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]
}

View file

@ -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]] = []
@ -180,7 +184,9 @@ 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)
// 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)
}
@ -260,7 +266,22 @@ class WidgetManager extends EventEmitter {
}
getWidgetById(id) {
getWidgetById(id, scope) {
/*
scopable: return matching widgets only for the closest scope with results
*/
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)

View file

@ -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)

View file

@ -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}`)

View file

@ -22,8 +22,7 @@ class ColorPicker extends UiWidget {
alphaStroke: 0,
snap: true,
alpha: true
}, parent: this})
this.rgb.container.classList.add('not-editable')
}, parent: this, meta: {not_editable: true}})
this.container = html`
<div class="color-picker">

View file

@ -17,7 +17,7 @@ class UiConsole extends UiSidePanel {
this.header = DOM.get(this.container, 'osc-panel-header')[0]
this.header.appendChild(html`<label>${locales('console')}</label>`)
this.messages = this.content.appendChild(html`<osc-console></osc-console>`)
this.messages = this.content.appendChild(html`<osc-console tabIndex="-1"></osc-console>`)
this.inputWrapper = this.content.appendChild(html`<osc-console-input></osc-console-inpu>`)
this.input = this.inputWrapper.appendChild(html`<textarea rows="1"></textarea>`)
@ -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)=>{
@ -106,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()
}

View file

@ -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)

View file

@ -189,9 +189,11 @@ 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
this.scopes = []
if (options.value !== undefined) this.value = options.value
@ -390,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
@ -416,6 +436,25 @@ class Widget extends EventEmitter {
createPropsCache() {
/*
scopable: cache id prefixes (scopes), from nearest to farthest
*/
this.scopes = []
if (this.meta.scopable) {
var parent = this.parent
do {
if (parent.getProp('scoped')) {
this.scopes.push(parent.scopeId)
}
parent = parent.parent
} 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('/') + '/'
}
}
// include global scope
if (this.scopes.length) this.scopes.push('')
// @{props} links lists
this.linkedProps = {}
this.nestedLinkedProps = {}
@ -527,6 +566,22 @@ class Widget extends EventEmitter {
if (widget === this) id = 'this'
/*
scopable: attempt to resolve scoped widget updates against ids in advanced syntax blocks
*/
if (this.scopes.length) {
var unprefixedId
for (var p of this.scopes) {
if (id.includes(p)) {
unprefixedId = id.replace(p, '')
if (this.nestedLinkedProps[unprefixedId] || linkedProps[unprefixedId]) {
id = unprefixedId
break
}
}
}
}
if (this.nestedLinkedProps[id]) {
this.updateLinkedPropsWithNesting(id)
}
@ -617,7 +672,7 @@ class Widget extends EventEmitter {
var widgets = id == 'parent' && this.parent ?
[this.parent] : id == 'this' ? [this] :
widgetManager.getWidgetById(id)
widgetManager.getWidgetById(id, this.scopes)
if (!widgets.length) {
var parent = this.parent
@ -908,8 +963,26 @@ class Widget extends EventEmitter {
}
}
return propValue
return this.transformProp(propName, propValue)
}
transformProp(propName, propValue) {
switch (propName) {
/*
scopable: prefix id with the closest (most restrictive) scope
*/
case 'id':
if (this.scopes.length) {
propValue = this.scopes[0] + propValue
}
break
}
return propValue
}
@ -945,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) {
@ -1140,7 +1212,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
}
@ -1179,6 +1251,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)
}

View file

@ -23,6 +23,11 @@ class Clone extends Container() {
class_specific: {
widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'},
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: 'Cloned widget\'s properties to override'},
},
value: null,
@ -47,8 +52,11 @@ class Clone extends Container() {
this.cloneLock = false
this.cloneTarget = null
this.targetRank = null
this.cloneClass = []
this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped')
this.modalBreakout = 0
this.container.classList.add('empty')
@ -62,34 +70,18 @@ class Clone extends Container() {
parent = parent.parent
}
this.bindTarget(this.getCloneTarget())
if (this.cloneTarget) this.createClone(true)
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
if (id === this.getProp('widgetId') && this.isValidCloneTarget(widget)) {
if (String(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()
}
@ -116,15 +108,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() {
@ -132,32 +115,53 @@ 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.scopes.length ? this.scopes : [''],
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(w=>this.isValidCloneTarget(w))
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)
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
if (!target) {
rank++
continue
}
}
return target
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
}
}
if (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
}
}
@ -180,7 +184,12 @@ class Clone extends Container() {
parser.parse({
data: data,
parentNode: this.widget,
parent: this
parent: this,
meta: {
not_editable: true,
clone: true,
scopable: true
}
})
this.updateContainer(!init)
@ -196,14 +205,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
@ -216,18 +227,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})
}
@ -287,10 +294,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) {
@ -312,10 +315,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()

View file

@ -29,6 +29,11 @@ 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'},
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'},
},
value: null,
@ -51,20 +56,13 @@ class Fragment extends Container() {
this.noValueState = true
this.scopeId = this.getProp('scoped') === true ? this.hash : this.getProp('scoped') === false ? '' : this.getProp('scoped')
this.modalBreakout = 0
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 +121,12 @@ class Fragment extends Container() {
parser.parse({
data: data,
parentNode: this.widget,
parent: this
parent: this,
meta: {
not_editable: true,
fragment: true,
scopable: true
}
})
this.updateContainer(!init)
@ -146,10 +149,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) {

View file

@ -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') {

View file

@ -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
}

View file

@ -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}
})
}
}

View file

@ -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] = []

View file

@ -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') {

View file

@ -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})
}

View file

@ -57,9 +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('not-editable', 'pad')
this.pad.container.classList.add('pad')
this.widget.appendChild(this.pad.container)
this.pad.on('value-changed',(e)=>{
e.stopPropagation = true
@ -76,8 +76,8 @@ export default class Rgb extends Widget {
snap:this.getProp('snap'),
range:{min:0,max:360},
decimals:2
}, parent: this})
this.hue.container.classList.add('not-editable', 'hue')
}, 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
@ -97,8 +97,8 @@ export default class Rgb extends Widget {
default: 255,
input:false,
decimals:2
}, parent: this})
this.alpha.container.classList.add('not-editable', 'alpha')
}, 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

View file

@ -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)
else return widgetManager.getWidgetById(id, widget.scopes)
}

View file

@ -43,36 +43,60 @@ export default class Scrollbar extends StaticProperties(Fader, {
super(options)
this.scrollTarget = null
this.targetRank = null
this.thumbSize = 1
if (!this.getProp('horizontal')) {
// invert vertical fader
this.rangeVals[0] = 1
this.rangeVals[1] = 0
this.setValue(this.getSpringValue())
}
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.includes(this.getProp('widgetId')) && widget.getProp('scroll')) {
if (id === this.getProp('widgetId') && widget.getProp('scroll')) {
this.unbindTarget()
this.bindTarget(widget)
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
}
}
this.getScrollTarget()
}
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) {
rank++
continue
}
if (rank < this.targetRank || this.targetRank == null) {
this.unbindTarget()
this.bindTarget(target, rank)
}
return
}
}
draginitHandle(e) {
@ -134,13 +158,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) {

View file

@ -62,6 +62,11 @@ osc-console {
user-select: text;
}
.editor-enabled osc-console:focus {
outline: 1rem dotted var(--color-accent);
outline-offset: -1rem;
}
osc-console-message {
user-select: text;

View file

@ -131,9 +131,7 @@ app.on('ready',()=>{
})
app.on('window-all-closed', function() {
if (process.platform !== 'darwin') {
app.quit()
}
app.quit()
})
export default app

View file

@ -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

View file

@ -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)
})
@ -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)
})

View file

@ -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)

View file

@ -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 (let id in this.clients) {
if (id != except) {
this.clients[id].send(packet)
}
}
}
}

View file

@ -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
}
},

View file

@ -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)}
}
}
}

View file

@ -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',
@ -244,7 +249,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