From 66fb04692984996e3e0d95cc076ad11bcfd8f481 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 16:04:55 +0200 Subject: [PATCH 1/8] button/tab: missing dynamic flag for label prop --- src/client/widgets/basics/button.js | 3 ++- src/client/widgets/containers/tab.js | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client/widgets/basics/button.js b/src/client/widgets/basics/button.js index 73824d64..73567e42 100644 --- a/src/client/widgets/basics/button.js +++ b/src/client/widgets/basics/button.js @@ -223,7 +223,8 @@ Button.cssVariables = Button.prototype.constructor.cssVariables.concat( Button.dynamicProps = Button.prototype.constructor.dynamicProps.concat( 'on', 'off', - 'norelease' + 'norelease', + 'label' ) module.exports = Button diff --git a/src/client/widgets/containers/tab.js b/src/client/widgets/containers/tab.js index f4e1aaf0..f6b75470 100644 --- a/src/client/widgets/containers/tab.js +++ b/src/client/widgets/containers/tab.js @@ -3,7 +3,7 @@ var Panel = require('./panel'), resize = require('../../events/resize'), {iconify} = require('../../ui/utils') -module.exports = class Tab extends Panel { +class Tab extends Panel { static description() { @@ -130,3 +130,9 @@ module.exports = class Tab extends Panel { } } + +Tab.dynamicProps = Tab.prototype.constructor.dynamicProps.concat( + 'label' +) + +module.exports = Tab From db12c286f0227d96d2301bab13b5b23c2a595bd4 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 16:05:11 +0200 Subject: [PATCH 2/8] script: better globals init --- src/client/widgets/vm.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/widgets/vm.js b/src/client/widgets/vm.js index e77847b5..be1903ae 100644 --- a/src/client/widgets/vm.js +++ b/src/client/widgets/vm.js @@ -2,19 +2,19 @@ var loopProtect = require('loop-protect'), {deepCopy} = require('../utils'), globals -setTimeout(()=>{ - globals = { - screen: {width: screen.width, height: screen.height}, - env: deepCopy(ENV), - url: document.location.host, - platform: navigator.platform - } -}) - class Vm { constructor() { + if (!globals) { + globals = { + screen: {width: screen.width, height: screen.height}, + env: deepCopy(ENV), + url: document.location.host, + platform: navigator.platform + } + } + this.sandbox = document.createElement('iframe') this.sandbox.style.display = 'none' this.sandbox.sandbox = 'allow-same-origin' From 0fbfbe5deddd008f7aa47daa4f67d5e982f1cc82 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 16:46:27 +0200 Subject: [PATCH 3/8] frame: allow non local urls --- CHANGELOG.md | 1 + src/client/widgets/frames/frame.js | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d749698..36be0293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ - dropdown: close menu when receiving a value - dropdown: removed empty 1st option - switch: removed `showValues` (inconsistent with menu/dropdown, feature covered by `values` property) + - frame: allow loading non local urls - widget removals - `push`, `toggle`: merged into `button` diff --git a/src/client/widgets/frames/frame.js b/src/client/widgets/frames/frame.js index 927ace17..a60f5062 100644 --- a/src/client/widgets/frames/frame.js +++ b/src/client/widgets/frames/frame.js @@ -1,6 +1,5 @@ var Widget = require('../common/widget'), html = require('nanohtml'), - {urlParser} = require('../utils'), locales = require('../../locales'), StaticProperties = require('../mixins/static_properties') @@ -47,9 +46,7 @@ class Frame extends StaticProperties(Widget, {bypass: true}) { this.value = v - var parser = urlParser(this.value) - - if (this.value && parser.isLocal()) { + if (this.value) { this.frame.setAttribute('src', this.value) this.widget.classList.remove('error') if (this.errorTextMounted) { From aa628399a78d5ba6b33b19481843be7b9a46afcd Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 16:47:14 +0200 Subject: [PATCH 4/8] package: alpha 18 --- package.json | 2 +- src/client/widgets/frames/frame.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3b892466..2849a8c8 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.0.0-alpha17", + "version": "1.0.0-alpha18", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/src/client/widgets/frames/frame.js b/src/client/widgets/frames/frame.js index a60f5062..38681c1b 100644 --- a/src/client/widgets/frames/frame.js +++ b/src/client/widgets/frames/frame.js @@ -18,7 +18,7 @@ class Frame extends StaticProperties(Widget, {bypass: true}) { }, ['decimals', 'bypass'], { value: {type: 'string', value: '', help: [ - 'External web page URL. Only local URLs are allowed (starting with `http://127.0.0.1/`, `http://10.x.x.x/`, `http://192.168.x.x/`, etc)', + 'External web page URL.', ]} }) From cf6ac7a2536757d4ffc81a5dd7f6fea5547a480a Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 16:55:42 +0200 Subject: [PATCH 5/8] package: fix shim --- scripts/client-shim.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/client-shim.js b/scripts/client-shim.js index 99a12013..ff175878 100644 --- a/scripts/client-shim.js +++ b/scripts/client-shim.js @@ -53,6 +53,7 @@ document = { } window = { + screen: {width: 800, height: 600}, addEventListener: ()=>{}, location: {}, document: document, From 212d7dc5c07b2662a178bcfbf7c98e0d800dd384 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 19:05:50 +0200 Subject: [PATCH 6/8] docs: update --- resources/docs/docs/widgets/properties-reference.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index e9569eb3..6e65237b 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -81,7 +81,7 @@ | property | type |default | description | | --- | --- | --- | --- | - |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely
- Insert icons using the prefix ^ followed by the icon's name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)
- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` | + |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely
- Insert icons using the prefix ^ followed by the icon's name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)
- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` | |
on#
| `*` | 1 | Set to `null` to send send no argument in the osc message | |
off#
| `*` | 0 | Set to `null` to send send no argument in the osc message. Must be different from `on`. | |
mode#
| `string` | "toggle" | Interraction mode:
- `toggle` (classic on/off switch)
- `push` (press & release)
- `tap` (no release)

Choices: `toggle`, `push`, `tap` | @@ -355,7 +355,7 @@ | property | type |default | description | | --- | --- | --- | --- | - |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely
- Insert icons using the prefix ^ followed by the icon's name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)
- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` | + |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely
- Insert icons using the prefix ^ followed by the icon's name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)
- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` | |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | |
traversing#
| `boolean` | false | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget | @@ -396,7 +396,7 @@ | property | type |default | description | | --- | --- | --- | --- | - |
value#
| `string` | "" | External web page URL. Only local URLs are allowed (starting with `http://127.0.0.1/`, `http://10.x.x.x/`, `http://192.168.x.x/`, etc) | + |
value#
| `string` | "" | External web page URL. | ??? api "
svg#
" Svg parser. @@ -710,7 +710,7 @@ | property | type |default | description | | --- | --- | --- | --- | |
event#
| `string` | "value" | Define which events trigger the script's execution.

Choices: `value`, `keyboard` | - |
script#
| `script` | "" | Script executed whenever the widget's receives the defined event. See documentation. | + |
script#
| `script` | "" | Script executed whenever the widget's receives the defined event. See documentation. | === "event: keyboard" From c048ede064f4e44f664af06c9bd9ce15473a5257 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 19:05:55 +0200 Subject: [PATCH 7/8] script: send(): use widget's target when omitted --- src/client/widgets/scripts/script-vm.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/widgets/scripts/script-vm.js b/src/client/widgets/scripts/script-vm.js index 11a978c5..19f0d79e 100644 --- a/src/client/widgets/scripts/script-vm.js +++ b/src/client/widgets/scripts/script-vm.js @@ -84,6 +84,7 @@ class ScriptVm extends Vm { if (target && target[0] === '/') { args.unshift(address) address = target + target = null } var overrides = { From fad234301f1c94020fb9bb2a6f5ce1fe057ce367 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 11 May 2020 19:50:23 +0200 Subject: [PATCH 8/8] osc receiver: allow receiving object args such as osc color args (#623) --- src/client/widgets/common/osc-receiver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/common/osc-receiver.js b/src/client/widgets/common/osc-receiver.js index fba6bf21..a21b97a6 100644 --- a/src/client/widgets/common/osc-receiver.js +++ b/src/client/widgets/common/osc-receiver.js @@ -53,7 +53,7 @@ module.exports = class OscReceiver { callback(args) { - if (typeof args !== 'object') args = [args] + if (!Array.isArray(args)) args = [args] var preArgs = this.usePreArgs ? (this.parent.getProp('preArgs') || []) : [] if (!Array.isArray(preArgs) && preArgs !== '') preArgs = [preArgs] if (args.length >= preArgs.length) {