diff --git a/CHANGELOG.md b/CHANGELOG.md
index 499899c8..97476c6c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- widgets
- **new** `gyroscope` widget
- **new** `frame` widget
+ - **breaking change** in `panel`: dropped Visual Format Language support (`layout` and `spacing` properties)
- misc
- the client app can be translated (https://github.com/jean-emmanuel/open-stage-control/issues/302)
diff --git a/package.json b/package.json
index e5304323..1414774c 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,6 @@
"homepage": "http://osc.ammd.net/",
"license": "GPL-3.0",
"dependencies": {
- "autolayout": "0.7.0",
"babel-core": "^6.26.3",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-preset-env": "^1.7.0",
@@ -37,7 +36,6 @@
"jquery": "3.3.1",
"json5": "1.0.1",
"keyboardjs": "github:jean-emmanuel/KeyboardJS",
- "kiwi.js": "1.0.2",
"licensify": "3.1.3",
"mathjs": "^5.0.1",
"minimatch": "^3.0.4",
diff --git a/src/browser/js/app/editor/index.js b/src/browser/js/app/editor/index.js
index 65d12478..14ae06e2 100644
--- a/src/browser/js/app/editor/index.js
+++ b/src/browser/js/app/editor/index.js
@@ -490,7 +490,7 @@ var Editor = class Editor {
type = this.selectedWidgets[0].props.type == 'tab' ? 'tab' : 'widget',
parent = this.selectedWidgets[0].parent
- if (this.deleting || this.selectedWidgets[0].getProp('id') === 'root') return
+ if (this.deleting || this.selectedWidgets[0].getProp('id') === 'root') return
this.deleting = true
diff --git a/src/browser/js/app/widgets/buttons/dropdown.js b/src/browser/js/app/widgets/buttons/dropdown.js
index b1de4b0f..6c37a5ed 100644
--- a/src/browser/js/app/widgets/buttons/dropdown.js
+++ b/src/browser/js/app/widgets/buttons/dropdown.js
@@ -5,40 +5,17 @@ class Dropdown extends Widget {
static defaults() {
- return {
- type:'dropdown',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style: 'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_dropdown:'dropdown',
- values:{'Value 1':1,'Value 2':2},
+ values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [
+ '`Array` of possible values to switch between : `[1,2,3]`',
+ '`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept',
+ 'An empty option will always be prepended to values (sends an osc message without any value); it can be hidden by adding `option:first-child{display:none}` to the widget\'s `css`'
+ ]}
- _value: 'value',
- default:'',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/buttons/push.js b/src/browser/js/app/widgets/buttons/push.js
index 3f8860c6..5dc008f4 100644
--- a/src/browser/js/app/widgets/buttons/push.js
+++ b/src/browser/js/app/widgets/buttons/push.js
@@ -5,38 +5,22 @@ class Push extends Widget {
static defaults() {
- return {
- type:'push',
- id:'auto',
- linkId:'',
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_push: 'push',
- on:1,
- off:0,
- norelease:false,
+ on: {type: '*', value: 1, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ off: {type: '*', value: 0, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ norelease: {type: 'boolean', value: false, help: 'Set to `true` to prevent sending any osc message when releasing the button'},
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ }, ['_value', 'default', 'value'])
}
diff --git a/src/browser/js/app/widgets/buttons/switch.js b/src/browser/js/app/widgets/buttons/switch.js
index be1fb187..ff525660 100644
--- a/src/browser/js/app/widgets/buttons/switch.js
+++ b/src/browser/js/app/widgets/buttons/switch.js
@@ -5,42 +5,18 @@ module.exports = class Switch extends Widget {
static defaults() {
- return {
- type:'switch',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_switch:'switch',
- horizontal:false,
- showValues:false,
- values:{'Value 1':1,'Value 2':2},
+ horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'},
+ showValues: {type: 'boolean', value: false, help: 'If values is an object, set to `true` to display both values and labels instead of labels only'},
+ values: {type: 'array|object', value: {'Value 1':1,'Value 2':2}, help: [
+ '`Array` of possible values to switch between : `[1,2,3]`',
+ '`Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won\'t be kept',
+ ]}
- _value: 'value',
- default:'',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/buttons/toggle.js b/src/browser/js/app/widgets/buttons/toggle.js
index 761c2d00..1e0b059b 100644
--- a/src/browser/js/app/widgets/buttons/toggle.js
+++ b/src/browser/js/app/widgets/buttons/toggle.js
@@ -5,43 +5,22 @@ class Toggle extends Widget {
static defaults() {
- return {
- type:'toggle',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_toggle: 'toggle',
- doubleTap: false,
- led: false,
- on:1,
- off:0,
+ doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be toggled instead of a single tap'},
+ led: {type: 'boolean', value: false, help: 'Set to `true` to display the toggle\'s state with a led'},
+ on: {type: '*', value: 1, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ off: {type: '*', value: 0, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]}
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/common/widget.js b/src/browser/js/app/widgets/common/widget.js
index bc64da15..b7d0188c 100644
--- a/src/browser/js/app/widgets/common/widget.js
+++ b/src/browser/js/app/widgets/common/widget.js
@@ -31,9 +31,86 @@ setTimeout(()=>{
class Widget extends EventEmitter {
- static defaults() {
+ static defaults(insert={}, except=[], push={}) {
- throw new Error('Calling unimplemented static defaults() method')
+ var defaults = {
+
+ type: {type: 'string', value: 'auto', help: ''},
+ id: {type: 'string', value: 'auto', help: 'Widgets sharing the same `id` will act as clones and update each other\'s value(s) without sending extra osc messages.' },
+ linkId: {type: 'string|array', value: '', help: [
+ 'Widgets sharing the same `linkId` update each other\'s value(s) AND send their respective osc messages.',
+ 'When prefixed with >>, the `linkId` will make the widget act as a master (sending but not receiving)',
+ 'When prefixed with <<, the `linkId` will make the widget act as a slave (receiving but not sending)'
+ ]},
+
+ _geometry:'geometry',
+
+ left: {type: 'number|string', value: 'auto', help: [
+ 'When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).',
+ 'Otherwise, the widget will be absolutely positioned'
+ ]},
+ top: {type: 'number|percentage', value: 'auto', help: [
+ 'When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).',
+ 'Otherwise, the widget will be absolutely positioned'
+ ]},
+ width: {type: 'number|percentage', value: 'auto', help: ''},
+ height: {type: 'number|percentage', value: 'auto', help: ''},
+
+ _style:'style',
+
+ label: {type: 'string|boolean', value: 'auto', help: [
+ 'Set to `false` to hide completely',
+ 'Insert icons using the prefix ^ followed by the icon\'s name : ^play, ^pause, etc'
+ ]},
+ color: {type: 'string', value: 'auto', help: 'CSS color code. Set to "auto" to inherit from parent widget.'},
+ css: {type: 'string', value: '', help: 'CSS rules'},
+
+ _value: 'value',
+
+ default: {type: '*', value: '', help: 'If set, the widget will be initialized with this value when the session is loaded.'},
+ value: {type: '*', value: '', help: 'Define the widget\'s value depending on other widget\'s values / properties using property inheritance and property maths'},
+
+ _osc: 'osc',
+
+ precision: {type: 'integer|string', value: 2, help: [
+ 'Defines the number of decimals to display and to send.',
+ 'Set to `0` to send integers only.',
+ 'Data type can be specified by appending a valid osc type tag to the precision value, for example : `3d` will make the widget send double precision numbers rounded to three decimals'
+ ]},
+ address: {type: 'string', value: 'auto', help: 'OSC address for sending messages, it must start with a /'},
+ preArgs: {type: '*|array', value: '', help: [
+ 'A value or array of values that will be prepended to the OSC messages.',
+ 'Values can be defined as objects if the osc type tag needs to be specified: `{type: "i", value: 1}`'
+ ]},
+ target: {type: 'string|array|null', value: '', help: [
+ 'An string or or array of strings formatted as follow: `ip:port` or `["ip:port"]`.',
+ 'If midi is enabled, targets can be `midi:device_name`.',
+ 'The special item `"self"` can be used to refer to the emitting client directly.',
+ 'If no target is set, messages can still be sent if the server has default targets',
+ 'The server\'s default targets can be bypassed by setting of the items to `null`'
+ ]},
+ bypass: {type: 'boolean', value: false, help: 'Set to `true` to prevent the widget from sending any osc message'}
+
+ }
+
+ // okay that's bad, but keys happen to be ordered anyway...
+
+ var alterDefaults = {}
+
+ for (var k in defaults) {
+ if (k === '_value') {
+ for (var l in insert) {
+ alterDefaults[l] = insert[l]
+ }
+ }
+ if (except.indexOf(k) < 0) alterDefaults[k] = defaults[k]
+ }
+
+ for (var m in push) {
+ alterDefaults[m] = push[m]
+ }
+
+ return alterDefaults
}
diff --git a/src/browser/js/app/widgets/containers/clone.js b/src/browser/js/app/widgets/containers/clone.js
index f9dafe1f..1fec3cb3 100644
--- a/src/browser/js/app/widgets/containers/clone.js
+++ b/src/browser/js/app/widgets/containers/clone.js
@@ -10,29 +10,17 @@ class Clone extends Widget {
static defaults() {
- return {
- type:'clone',
- id:'auto',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- css:'',
+ return super.defaults({
_clone:'clone',
- widgetId:'',
+ widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'},
_overrides:'overrides',
- props:{},
- }
+ props: {type: 'object', value: {}, help: 'Cloned widget\'s properties to override'},
+
+ }, ['label', 'color', 'linkId', '_value', 'default', 'value', '_osc', 'precison', 'address', 'preArgs', 'target', 'bypass'])
}
diff --git a/src/browser/js/app/widgets/containers/modal.js b/src/browser/js/app/widgets/containers/modal.js
index 398176ed..b36a39a6 100644
--- a/src/browser/js/app/widgets/containers/modal.js
+++ b/src/browser/js/app/widgets/containers/modal.js
@@ -1,4 +1,5 @@
var Panel = require('./panel'),
+ Widget = require('../common/widget'),
{icon, iconify} = require('../../ui/utils'),
resize = require('../../events/resize'),
doubletab = require('../mixins/double_tap')
@@ -7,53 +8,25 @@ module.exports = class Modal extends Panel {
static defaults() {
- return {
- type:'modal',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return Widget.defaults({
_modal:'modal',
- doubleTap: false,
- popupLabel:'',
- popupWidth:'80%',
- popupHeight:'80%',
- popupLeft:'auto',
- popupTop:'auto',
- layout:'',
- spacing:0,
+ doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'},
+ popupLabel: {type: 'string', value: '', help: 'Alternative label for the modal popup'},
+ popupWidth: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
+ popupHeight: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
+ popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
+ popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- precision:0,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false,
+ }, [], {
_chidlren:'children',
- variables:'@{parent.variables}',
+ variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
+ widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object'}
- widgets:[],
- }
+ })
}
diff --git a/src/browser/js/app/widgets/containers/panel.js b/src/browser/js/app/widgets/containers/panel.js
index 678a8af6..f6a4904b 100644
--- a/src/browser/js/app/widgets/containers/panel.js
+++ b/src/browser/js/app/widgets/containers/panel.js
@@ -1,5 +1,4 @@
var Widget = require('../common/widget'),
- autolayout = require('autolayout/dist/autolayout.kiwi.js'),
widgetManager = require('../../managers/widgets'),
parser = require('../../parser'),
editor
@@ -12,50 +11,26 @@ class Panel extends Widget {
static defaults() {
- return {
- type:'panel',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_panel:'panel',
- scroll:true,
- border:true,
- layout:'',
- spacing:0,
+ scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
+ border: {type: 'boolean', value: true, help: 'By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too'},
- _value: 'value (tab selection)',
- default: '',
- value: '',
-
- _osc:'osc (tab selection)',
-
- precision:0,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false,
+ }, [], {
_children:'children',
- variables:'@{parent.variables}',
+ variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
+ widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'},
+ tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A panel cannot contain widgets and tabs simultaneously'},
+
+ _value: 'value (tab selection)',
+ _osc:'osc (tab selection)'
+
+ })
- widgets:[],
- tabs:[]
- }
}
@@ -97,7 +72,6 @@ class Panel extends Widget {
} else if (this.getProp('widgets') && this.getProp('widgets').length) {
parser.parse(this.getProp('widgets'), this.widget, this)
- if (this.getProp('layout') != '') this.parseLayout()
}
@@ -109,7 +83,7 @@ class Panel extends Widget {
}
if (this.getProp('widgets') && !this.getProp('widgets').length) {
this.disabledProps.push(
- 'layout', 'spacing', 'scroll'
+ 'scroll'
)
}
@@ -139,61 +113,6 @@ class Panel extends Widget {
}
- parseLayout() {
-
- var children = DOM.get(this.widget, '> .widget')
-
- try {
-
- var layout = this.getProp('layout').replace(/\$([0-9])+/g, (m)=>{
- return widgetManager.getWidgetByElement(children[m.replace('$','')]).getProp('id')
- })
-
- this.layout = new autolayout.View({
- constraints: autolayout.VisualFormat.parse(layout.split('\\n').join('\n').split(' ').join(''), {extended: true}),
- spacing: this.getProp('spacing')
- })
-
- this.on('resize',(event)=>{
- if (!event.width) return
- this.layout.setSize(event.width, event.height)
- this.applyLayout()
- }, {element: this.widget})
-
- delete this.errors.layout
-
- } catch(err) {
-
- this.errors.layout = `Visual Format Language error in ${this.getProp('id')}.layout: ${err.message} (line ${err.line})`
- }
-
- }
-
- applyLayout() {
-
- DOM.each(this.widget, '> .widget', (widgetContainer)=>{
-
- var widget = widgetManager.getWidgetByElement(widgetContainer),
- id = widget.getProp('id')
-
- if (!this.layout.subViews[id]) return
-
- widget.container.classList.add('absolute-position')
- widget.container.style.minHeight = 'auto'
- widget.container.style.minWidth = 'auto'
-
- for (var prop of ['height', 'width', 'top', 'left']) {
- delete widget.props[prop]
- widget.container.style[prop] = this.layout.subViews[id][prop] + 'px'
- }
-
- if (widget.container.classList.contains('editing')) editor.select(widget, {refresh:true})
-
- DOM.dispatchEvent(window, 'resize')
-
- })
- }
-
setValue(v, options={}) {
if (this.tabs.length && typeof v == 'number' && v >= 0 && v < this.tabs.length) {
diff --git a/src/browser/js/app/widgets/containers/root.js b/src/browser/js/app/widgets/containers/root.js
index 7bd740c5..1756f728 100644
--- a/src/browser/js/app/widgets/containers/root.js
+++ b/src/browser/js/app/widgets/containers/root.js
@@ -1,39 +1,23 @@
var Panel = require('./panel'),
+ Widget = require('../common/widget'),
{iconify} = require('../../ui/utils')
module.exports = class Root extends Panel {
static defaults() {
- return {
-
- type:'root',
- id: 'root',
- linkId:'',
-
- _style:'style',
-
- color:'auto',
- css:'',
-
- _value: 'value (tab selection)',
- default: '',
- value: '',
-
- _osc:'osc (tab selection)',
-
- precision:0,
- address:'/root',
- preArgs:[],
- target:[],
- bypass:false,
+ return Widget.defaults({}, ['label', '_geometry', 'left', 'top', 'width', 'height'], {
_children:'children',
- variables:{},
+ variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
+ tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object'},
+ id: {type: 'string', value: 'root', help: 'Widgets sharing the same id will act as clones and update each other\'s value(s) without sending extra osc messages' },
- tabs:[]
- }
+ _value: 'value (tab selection)',
+ _osc:'osc (tab selection)'
+
+ })
}
diff --git a/src/browser/js/app/widgets/containers/strip.js b/src/browser/js/app/widgets/containers/strip.js
index 1c0206d0..9ba76193 100644
--- a/src/browser/js/app/widgets/containers/strip.js
+++ b/src/browser/js/app/widgets/containers/strip.js
@@ -1,43 +1,28 @@
-var Panel = require('./panel')
+var Panel = require('./panel'),
+ Widget = require('../common/widget')
module.exports = class Strip extends Panel {
static defaults() {
- return {
- type:'strip',
- id:'auto',
- linkId:'',
-
- _style:'style',
-
- label:'auto',
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
- color:'auto',
- css:'',
+ return Widget.defaults({
_strip: 'strip',
- scroll:true,
- horizontal:false,
- stretch:false,
- border:true,
- spacing:0,
+ scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
+ horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display widgets horizontally'},
+ stretch: {type: 'boolean', value: true, help: 'Set to `true` to stretch widgets evenly'},
+ border: {type: 'boolean', value: true, help: 'By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too'},
+ spacing: {type: 'integer|percentage', value: 0, help: 'Adds space between widgets. Percents are always relative to the strips width'}
- _osc:'osc',
-
- address:'auto',
- preArgs:[],
+ }, [], {
_children:'children',
- variables:'@{parent.variables}',
+ variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
+ widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object'}
- widgets:[]
- }
+ })
}
diff --git a/src/browser/js/app/widgets/containers/tab.js b/src/browser/js/app/widgets/containers/tab.js
index 768cbc10..bfaef791 100644
--- a/src/browser/js/app/widgets/containers/tab.js
+++ b/src/browser/js/app/widgets/containers/tab.js
@@ -1,46 +1,24 @@
var Panel = require('./panel'),
+ Widget = require('../common/widget'),
resize = require('../../events/resize')
module.exports = class Tab extends Panel {
static defaults() {
- return {
- type:'tab',
- id:'auto',
- linkId:'',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
-
- _panel:'panel',
-
- layout:'',
- spacing:0,
-
- _value: 'value (tab selection)',
-
- default: '',
- value: '',
-
- _osc:'osc (tab selection)',
-
- precision:0,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false,
+ return Widget.defaults({}, ['_geometry', 'left', 'top', 'width', 'height'], {
_children:'children',
- variables:'@{parent.variables}',
+ variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
+ widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A tab cannot contain widgets and tabs simultaneously'},
+ tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A tab cannot contain widgets and tabs simultaneously'},
- widgets:[],
- tabs:[]
- }
+
+ _value: 'value (tab selection)',
+ _osc:'osc (tab selection)'
+
+ })
}
diff --git a/src/browser/js/app/widgets/inputs/gyroscope.js b/src/browser/js/app/widgets/inputs/gyroscope.js
index 03142ce8..9a5305be 100644
--- a/src/browser/js/app/widgets/inputs/gyroscope.js
+++ b/src/browser/js/app/widgets/inputs/gyroscope.js
@@ -7,33 +7,16 @@ class Gyroscope extends Widget {
static defaults() {
- return {
- type:'gyroscope',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_gyroscope: 'gyroscope',
- frequency: 30,
- normalize: true,
- compass: false,
- screenAdjusted: false,
- precision: 2
+ frequency: {type: 'number', value: 30, help: 'Value update frequency (updates per seconds)'},
+ normalize: {type: 'boolean', value: true, help: 'Normalize gravity related values'},
+ compass: {type: 'boolean', value: false, help: 'Set to `true` to return the orientation values with respect to the actual north direction of the world instead of the head direction of the device'},
+ screenAdjusted: {type: 'boolean', value: false, help: 'Set to `true` to return screen adjusted values'}
- }
+ })
}
diff --git a/src/browser/js/app/widgets/inputs/input.js b/src/browser/js/app/widgets/inputs/input.js
index a2bfe826..43baf134 100644
--- a/src/browser/js/app/widgets/inputs/input.js
+++ b/src/browser/js/app/widgets/inputs/input.js
@@ -5,43 +5,16 @@ module.exports = class Input extends Canvas {
static defaults() {
- return {
- type:'input',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_input:'input',
- vertical:false,
- align: '',
- unit: '',
- editable:true,
+ vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},
+ align: {type: 'string', value: '', help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
+ unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'},
+ editable: {type: 'boolean', value: true, help: 'Set to `false` to make the input non-editable'}
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/inputs/keys.js b/src/browser/js/app/widgets/inputs/keys.js
index bcf368d7..7ee1722e 100644
--- a/src/browser/js/app/widgets/inputs/keys.js
+++ b/src/browser/js/app/widgets/inputs/keys.js
@@ -6,32 +6,24 @@ class Keys extends Widget {
static defaults() {
- return {
- type:'keys',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_keys:'keys',
- binding:'',
- keydown:'',
- keyup:'',
- repeat:true,
+ binding: {type: 'string|array', value: '', help: 'Key combo `string` or `array` of strings (see KeyboardJS documentation)'},
+ keydown: {type: 'string', value: '', help: [
+ 'This property is evaluated each time the key combo is pressed. Formulas are given extras variables in this context:',
+ '- `key`: pressed key name (usefull for handling multiple keys with a single keys widget)',
+ '- `ctrl`: control key state',
+ '- `alt`: alt key state',
+ '- `shift`: shift key state',
+ '- `super`: command/windows key state'
+ ]},
+ keyup: {type: 'string', value: '', help: 'Same as `keydown`, but evaluated when releasing the key combo'},
+ repeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'},
+
+ })
- }
}
diff --git a/src/browser/js/app/widgets/inputs/script.js b/src/browser/js/app/widgets/inputs/script.js
index e7fe3d45..1e8f4826 100644
--- a/src/browser/js/app/widgets/inputs/script.js
+++ b/src/browser/js/app/widgets/inputs/script.js
@@ -7,36 +7,22 @@ class Script extends Widget {
static defaults() {
- return {
- type:'script',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_script:'script',
- condition: 1,
- script:'',
+ condition: {type: 'string', value: 1, help: [
+ 'When the widget receives a value, if this property return a falsy value, the script property won\'t be evaluated. If it\'s non-falsy, it will be evaluated normally. Formulas are given one extra variable in this context:',
+ '- `value`: the value received by the widget'
+ ]},
+ script: {type: 'string', value: '', help: [
+ 'This property is evaluated each time the widget receives a value if condition is non-falsy. Formulas are given extras variables in this context:',
+ '- `value`: the value received by the widget',
+ '- `send(target, address, arg1, arg2, ...)`: function for sending osc messages (ignores the script\'s targets and the server\'s defaults unless `target` is `false`; ignores the script\'s `preArgs`)',
+ '- `set(id, value)`: function for setting a widget\'s value'
+ ]}
- _osc:'osc',
-
- address:'auto',
- preArgs:[],
- target: []
-
- }
+ })
}
diff --git a/src/browser/js/app/widgets/matrices/keyboard.js b/src/browser/js/app/widgets/matrices/keyboard.js
index a10bff63..0d321cbb 100644
--- a/src/browser/js/app/widgets/matrices/keyboard.js
+++ b/src/browser/js/app/widgets/matrices/keyboard.js
@@ -6,41 +6,34 @@ module.exports = class Keyboard extends _matrix_base {
static defaults() {
- return {
- type:'keyboard',
- id:'auto',
+ return super.defaults({
+ _matrix: 'matrix',
- _geometry:'geometry',
+ keys: {type: 'number', value: 25, help: 'Defines the number keys'},
+ start: {type: 'number', value: 48, help: [
+ 'MIDI note number to start with (default is C4)',
+ 'Standard keyboards settings are: `[25, 48]`, `[49, 36]`, `[61, 36]`, `[88, 21]`'
+ ]},
+ traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
+ on: {type: '*', value: 1, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ off: {type: '*', value: 0, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
+ }, ['_value', 'default', 'value'], {
- _style:'style',
+ split: {type: 'boolean|string', value: false, help: [
+ '`true`: the widget\'s index will be appended to the matrice\'s osc address',
+ '`false`: it will be prepended to the widget\'s preArgs',
+ '`string`: will be used to define the widgets\' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\\$`))'
+ ]},
- label:'auto',
- color:'auto',
- css:'',
-
- _matrix: 'Matrix',
-
- keys:25,
- start:48,
- traversing:true,
- on:1,
- off:0,
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/matrices/matrix.js b/src/browser/js/app/widgets/matrices/matrix.js
index 94955110..bc27c6aa 100644
--- a/src/browser/js/app/widgets/matrices/matrix.js
+++ b/src/browser/js/app/widgets/matrices/matrix.js
@@ -6,45 +6,22 @@ class Matrix extends _matrix_base {
static defaults() {
- return {
- type:'matrix',
- id:'auto',
+ return super.defaults({
- _geometry:'geometry',
+ _matrix: 'matrix',
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
+ widgetType: {type: 'string', value: 'toggle', help: 'Defines the type of the widgets in the matrix'},
+ matrix: {type: 'array', value: [2,2], help: 'Defines the number of columns and and rows in the matrix'},
+ start: {type: 'integer', value: 0, help: 'First widget\'s index'},
+ spacing: {type: 'integer', value: 0, help: 'Adds space between widgets'},
+ traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
+ border: {type: 'boolean', value: true, help: 'Set to `false` to disables the widgets\' borders'},
+ props: {type: 'object', value: {}, help: [
+ 'Defines a set of property to override the widgets\' defaults.',
+ 'Formulas in this field are resolved with an extra variable representing each widget\'s index: `$`'
+ ]}
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
-
- _matrix: 'Matrix',
-
- widgetType: 'toggle',
- matrix: [2,2],
- start:0,
- spacing:0,
- traversing:true,
- borders:true,
- props:{},
-
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ }, [], {})
}
diff --git a/src/browser/js/app/widgets/matrices/multifader.js b/src/browser/js/app/widgets/matrices/multifader.js
index a4b3356b..65cc1b5c 100644
--- a/src/browser/js/app/widgets/matrices/multifader.js
+++ b/src/browser/js/app/widgets/matrices/multifader.js
@@ -6,33 +6,19 @@ module.exports = class Multifader extends _matrix_base {
static defaults() {
- return {
- type:'multifader',
- id:'auto',
+ return super.defaults({
- _geometry:'geometry',
+ _matrix:'matrix',
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
-
- _matrix:'Matrix',
-
- strips:2,
- start:0,
- traversing:true,
-
- _value: 'value',
- default: '',
- value: '',
+ strips: {type: 'integer', value: 2, help: [
+ 'Number of faders in the row, each fader will inherit its parent\'s properties and the following ones (where i is the fader\'s index in the row)',
+ '- `id`: same as the widget\'s with /i appended to it',
+ '- `label`: i',
+ '- `address`: see split',
+ ]},
+ start: {type: 'integer', value: 0, help: 'First widget\'s index'},
+ traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
_fader: 'fader',
@@ -41,7 +27,6 @@ module.exports = class Multifader extends _matrix_base {
unit:'',
origin: 'auto',
snap:true,
-
meter:false,
alignRight:false,
horizontal:false,
@@ -50,16 +35,15 @@ module.exports = class Multifader extends _matrix_base {
compact:false,
dashed:false,
+ }, [], {
- _osc:'osc',
+ split: {type: 'boolean|string', value: false, help: [
+ '- `true`: the widget\'s index will be appended to the matrice\'s osc address',
+ '- `false`: it will be prepended to the widget\'s preArgs',
+ '- `string`: will be used to define the widgets\' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\\$`))'
+ ]}
- precision:2,
- address:'auto',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/matrices/multipush.js b/src/browser/js/app/widgets/matrices/multipush.js
index 061d9b88..e8908919 100644
--- a/src/browser/js/app/widgets/matrices/multipush.js
+++ b/src/browser/js/app/widgets/matrices/multipush.js
@@ -5,46 +5,41 @@ module.exports = class Multipush extends _matrix_base {
static defaults() {
- return {
- type:'multipush',
- id:'auto',
+ return super.defaults({
- _geometry:'geometry',
+ _matrix: 'matrix',
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
+ matrix: {type: 'array', value: [2,2], help: [
+ 'Defines the number of columns and and rows in the matrix. Each cell will contain a push button that will inherit its parent\'s properties and the following ones (where i is the push\'s index)',
+ '- `id`: same as the widget\'s with /i appended to it',
+ '- `label`: i',
+ '- `address`: see split'
+ ]},
+ start: {type: 'integer', value: 0, help: 'First widget\'s index'},
+ traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
+ spacing: {type: 'integer', value: 0, help: 'Adds space between widgets'},
- _style:'style',
+ _push: 'push',
- label:'auto',
- color:'auto',
- css:'',
+ on: {type: '*', value: 1, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ off: {type: '*', value: 0, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ norelease: {type: 'boolean', value: false, help: 'Set to `true` to prevent sending any osc message when releasing the button'},
- _matrix: 'Matrix',
+ }, ['_value', 'default', 'value'], {
- matrix: [2,2],
- start:0,
- spacing:0,
- traversing:true,
- on:1,
- off:0,
- norelease:false,
+ split: {type: 'boolean|string', value: false, help: [
+ '`true`: the widget\'s index will be appended to the matrice\'s osc address',
+ '`false`: it will be prepended to the widget\'s preArgs',
+ '`string`: will be used to define the widgets\' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\\$`))'
+ ]}
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/matrices/multitoggle.js b/src/browser/js/app/widgets/matrices/multitoggle.js
index 0c1b641b..7c765dd1 100644
--- a/src/browser/js/app/widgets/matrices/multitoggle.js
+++ b/src/browser/js/app/widgets/matrices/multitoggle.js
@@ -5,46 +5,41 @@ module.exports = class Multitoggle extends _matrix_base {
static defaults() {
- return {
- type:'multitoggle',
- id:'auto',
+ return super.defaults({
- _geometry:'geometry',
+ _matrix:'matrix',
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
+ matrix: {type: 'array', value: [2,2], help: [
+ 'Defines the number of columns and and rows in the matrix. Each cell will contain a toggle button that will inherit its parent\'s properties and the following ones (where i is the toggle\'s index)',
+ '- `id`: same as the widget\'s with /i appended to it',
+ '- `label`: i',
+ '- `address`: see split'
+ ]},
+ start: {type: 'integer', value: 0, help: 'First widget\'s index'},
+ spacing: {type: 'integer', value: 0, help: 'Adds space between widgets'},
+ traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
- _style:'style',
+ _toggle: 'toggle',
- label:'auto',
- color:'auto',
- css:'',
+ led: {type: 'boolean', value: false, help: 'Set to `true` to display the toggle\'s state with a led'},
+ on: {type: '*', value: 1, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see preArgs)'
+ ]},
+ off: {type: '*', value: 0, help: [
+ 'Set to `null` to send send no argument in the osc message',
+ 'Can be an `object` if the type needs to be specified (see `preArgs`)'
+ ]},
- _matrix: 'Matrix',
+ }, [], {
- matrix: [2,2],
- start:0,
- spacing:0,
- traversing:true,
- led: false,
- on:1,
- off:0,
+ split: {type: 'boolean|string', value: false, help: [
+ '`true`: the widget\'s index will be appended to the matrice\'s osc address',
+ '`false`: it will be prepended to the widget\'s `preArgs`',
+ '`string`: will be used to define the widgets\' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\\$`))'
+ ]}
- _value: 'value',
- default: '',
- value: '',
-
- _osc: 'osc',
-
- precision:2,
- address:'auto',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/pads/multixy.js b/src/browser/js/app/widgets/pads/multixy.js
index a47dde8d..c741a5bb 100644
--- a/src/browser/js/app/widgets/pads/multixy.js
+++ b/src/browser/js/app/widgets/pads/multixy.js
@@ -11,50 +11,39 @@ module.exports = class MultiXy extends Pad {
static defaults() {
- return {
- type:'xy',
- id:'auto',
- linkId:'',
+ return super.defaults({
- _geometry:'geometry',
+ _mutlixy: 'multi xy',
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
+ points: {type: 'integer|array', value: 2, help: [
+ 'Defines the number of points on the pad',
+ 'Can be an array of strings that will be used as labels for the points (ex: `[\'A\', \'B\']`)'
+ ]},
- _style:'style',
- label:'auto',
- color:'auto',
- css:'',
+ _xy: 'xy',
- _mutlixy:'multi xy',
+ pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size'},
+ snap: {type: 'boolean', value: false, help: [
+ 'By default, the points are dragged from their initial position.',
+ 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates',
+ ]},
+ spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'},
+ pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
+ rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis'},
+ rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
+ logScaleX: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (log10)'},
+ logScaleY: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (log10)'}
- points: 2,
- pointSize: 20,
- snap:false,
- spring:false,
- pips: true,
- rangeX:{min:0,max:1},
- rangeY:{min:0,max:1},
- logScaleX:false,
- logScaleY:false,
+ }, [], {
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- precision:2,
- address:'auto',
- touchAddress:'',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
+ split: {type: 'boolean|object', value: false, help: [
+ 'Set to `true` to send separate osc messages for each point\'s x and y axis. The address will be the same as the widget\'s with `/N/x` or `/N/y` appended to it, where N is the point\'s id (or the point\'s label if points is an array)',
+ 'Can be set as an `object` to specify a different address : `[\'/0/x\', \'/0/y\', \'/1/x\', \'/2/y\']`',
+ 'Note: the widget will only respond to its original osc address, not to the splitted version'
+ ]}
+ })
}
diff --git a/src/browser/js/app/widgets/pads/rgb.js b/src/browser/js/app/widgets/pads/rgb.js
index 548a2125..e83cf54d 100644
--- a/src/browser/js/app/widgets/pads/rgb.js
+++ b/src/browser/js/app/widgets/pads/rgb.js
@@ -11,43 +11,26 @@ module.exports = class Rgb extends Pad {
static defaults() {
- return {
- type:'rgb',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- css:'',
+ return super.defaults({
_rgb:'rgb',
- input: true,
- snap:false,
- spring:false,
- range: {min:0,max:255},
+ snap: {type: 'boolean', value: false, help: [
+ 'By default, the points are dragged from their initial position.',
+ 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates',
+ ]},
+ spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'},
+ range: {type: 'object', value: {min: 0, max: 255}, help: 'Defines the widget\'s output scale.'},
+ input: {type: 'boolean', value: true, help: 'Set to `false` to hide the built-in input widget'},
- _value: 'value',
- default: '',
- value: '',
+ }, ['color'], {
- _osc:'osc',
-
- precision:0,
- address:'auto',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ split: {type: 'boolean|object', value: false, help: [
+ 'Set to `true` to send separate osc messages for for r and g & b. The address will be the same as the widget\'s with `/r`, `/g` or `/b` appended to it',
+ 'Can be set as an `object` to specify a different address : `[\'/r\', \'/g\', \'b\']`',
+ 'Note: the widget will only respond to its original osc address, not to the splitted version'
+ ]}
+ })
}
diff --git a/src/browser/js/app/widgets/pads/xy.js b/src/browser/js/app/widgets/pads/xy.js
index 64ce4e45..7577db6d 100644
--- a/src/browser/js/app/widgets/pads/xy.js
+++ b/src/browser/js/app/widgets/pads/xy.js
@@ -10,51 +10,37 @@ module.exports = class Xy extends Pad {
static defaults() {
- return {
- type:'xy',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_xy:'xy',
- input: true,
- pips: true,
- pointSize: 20,
- snap:false,
- spring:false,
- doubleTap:false,
- rangeX:{min:0,max:1},
- rangeY:{min:0,max:1},
- logScaleX:false,
- logScaleY:false,
+ pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size'},
+ snap: {type: 'boolean', value: false, help: [
+ 'By default, the points are dragged from their initial position.',
+ 'If set to `true`, touching anywhere on the widget\'s surface will make them snap to the touching coordinates',
+ ]},
+ spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its default value when released'},
+ pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
+ rangeX: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the x axis'},
+ rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
+ logScaleX: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (log10)'},
+ logScaleY: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (log10)'},
+ input: {type: 'boolean', value: true, help: 'Set to false to hide the built-in input widget'},
+ doubleTap: {type: 'boolean|string', value: false, help: [
+ 'Set to `true` to make the fader reset to its default value when receiving a double tap.',
+ 'Can also be an osc address, which case the widget will just send an osc message: `/ `'
+ ]},
- _value: 'value',
- default: '',
- value: '',
+ }, [], {
- _osc:'osc',
+ touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`)'},
+ split: {type: 'boolean|object', value: false, help: [
+ 'Set to `true` to send separate osc messages for each point\'s x and y axis. The address will be the same as the widget\'s with `/x` or `/y` appended to it',
+ 'Can be set as an `object` to specify a different address : [\'/osc_address_x\', \'/osc_address_y\']',
+ 'Note: the widget will only respond to its original osc address, not to the splitted version'
+ ]}
- precision:2,
- address:'auto',
- touchAddress:'',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ })
}
@@ -276,7 +262,7 @@ module.exports = class Xy extends Pad {
}
getSplit() {
-
+
return this.getProp('split')?
typeof this.getProp('split') == 'object' && this.getProp('split').length == 2 ?
this.getProp('split')
diff --git a/src/browser/js/app/widgets/plots/eq.js b/src/browser/js/app/widgets/plots/eq.js
index 54401c46..abca866f 100644
--- a/src/browser/js/app/widgets/plots/eq.js
+++ b/src/browser/js/app/widgets/plots/eq.js
@@ -6,43 +6,18 @@ module.exports = class Eq extends _plots_base {
static defaults() {
- return {
- type:'eq',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_eq:'eq',
- pips:true,
- resolution:128,
- rangeY: {min:-20,max:20},
- origin: 'auto',
- logScaleX: false,
- smooth: false,
+ pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'},
+ resolution: {type: 'number', value: 128, help: 'Defines the number of points used to compute the frequency response'},
+ rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
+ origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
+ logScaleX: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (log10)'},
+ smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- address:'auto',
- preArgs:[],
-
- }
+ }, ['target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/frame.js b/src/browser/js/app/widgets/plots/frame.js
index 5b37110d..c3a4201c 100644
--- a/src/browser/js/app/widgets/plots/frame.js
+++ b/src/browser/js/app/widgets/plots/frame.js
@@ -6,34 +6,13 @@ class Frame extends Widget {
static defaults() {
- return {
- type:'frame',
- id:'auto',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
- label:'auto',
- css:'',
+ return super.defaults({
_frame: 'frame',
- border: true,
- _value: 'value',
- default: '',
- value: '',
+ border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'},
- _osc:'osc',
-
- address:'auto',
- preArgs:[],
-
- }
+ }, ['color', 'target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/image.js b/src/browser/js/app/widgets/plots/image.js
index 41b0b391..4be33139 100644
--- a/src/browser/js/app/widgets/plots/image.js
+++ b/src/browser/js/app/widgets/plots/image.js
@@ -5,43 +5,27 @@ module.exports = class Led extends Widget {
static defaults() {
- return {
- type:'image',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- // color:'auto',
- css:'',
+ return super.defaults({
_image:'image',
size: 'cover',
position: 'center',
repeat: 'no-repeat',
- border: true,
- cache: true,
- stream: '',
+ border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'},
+ cache: {type: 'boolean', value: true, help: [
+ 'Set to false to disable image caching (forces file reload when updating or editing the widget).',
+ 'When true, sending `reload` to the widget reloads its image without changing its value'
+ ]}
- _value: 'value',
- default: '',
- value: '',
+ }, ['color', 'target', 'precision', 'bypass'], {
- _osc:'osc',
+ value: {type: 'string', value: '', help: [
+ '- File `url` or `absolute path`',
+ '- Base64 encoded image : `data:image/...`'
+ ]}
- preArgs:[],
- address:'auto'
-
- }
+ })
}
diff --git a/src/browser/js/app/widgets/plots/led.js b/src/browser/js/app/widgets/plots/led.js
index 839e4031..04269c82 100644
--- a/src/browser/js/app/widgets/plots/led.js
+++ b/src/browser/js/app/widgets/plots/led.js
@@ -5,39 +5,14 @@ module.exports = class Led extends Widget {
static defaults() {
- return {
- type:'led',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_led:'led',
- range:{min:0,max:1},
- logScale:false,
+ range: {type: 'object', value: {min:0,max:1}, help: 'Value to led intensity mapping range'},
+ logScale: {type: 'boolean', value: false, help: 'Set to `true` to use a logarithmic mapping scale)'},
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- preArgs:[],
- address:'auto'
-
- }
+ }, ['target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/meter.js b/src/browser/js/app/widgets/plots/meter.js
index 137dd3b3..150e2b98 100644
--- a/src/browser/js/app/widgets/plots/meter.js
+++ b/src/browser/js/app/widgets/plots/meter.js
@@ -4,46 +4,31 @@ module.exports = class Meter extends Fader {
static defaults() {
- return {
- type:'fader',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
-
+ return super.defaults({
_meter:'meter',
- range:{min:0,max:1},
- logScale:false,
- origin:'auto',
- unit:'',
- alignRight:false,
- horizontal:false,
- pips:false,
- dashed:false,
- gradient:[],
+ range: {type: 'object', value: {min:0,max:1}, help: 'See fader\'s `range`'},
+ logScale: {type: 'boolean', value: false, help: 'See fader\'s `logScale`'},
+ origin: {type: 'number', value: 'auto', help: 'See fader\'s `origin`'},
+ unit: {type: 'string', value: 'auto', help: 'See fader\'s `unit`'},
+ alignRight: {type: 'boolean', value: false, help: 'See fader\'s `alignRight`'},
+ horizontal: {type: 'boolean', value: false, help: 'See fader\'s `horizontal`'},
+ pips: {type: 'boolean', value: false, help: 'See fader\'s `pips`'},
+ dashed: {type: 'boolean', value: false, help: 'See fader\'s `dashed`'},
+ gradient: {type: 'array', value: [], help: 'When set, the meter\'s gauge will be filled with a linear color gradient : each item must be a CSS color string. Example: `["blue", "red"]`'},
- _value: 'value',
- default: '',
- value: '',
+ }, ['target', 'precision', 'bypass'], {
- _osc:'osc',
+ css: {type: 'string', value: '', help: [
+ 'Available CSS variables:'
+ `- '--color-gauge: color;'`,
+ '- `--color-knob: color;`',
+ `- '--color-pips: color;'`,
+ `- '--gauge-opacity: number;'`
+ ]},
- address:'auto',
- preArgs:[]
- }
+ })
}
diff --git a/src/browser/js/app/widgets/plots/plot.js b/src/browser/js/app/widgets/plots/plot.js
index 38681be5..9fd671c9 100644
--- a/src/browser/js/app/widgets/plots/plot.js
+++ b/src/browser/js/app/widgets/plots/plot.js
@@ -4,23 +4,8 @@ module.exports = class Plot extends _plots_base {
static defaults() {
- return {
- type:'plot',
- id:'auto',
- linkId:'',
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_plot:'plot',
@@ -34,16 +19,7 @@ module.exports = class Plot extends _plots_base {
smooth: false,
pips:true,
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- address:'auto',
- preArgs:[],
-
- }
+ }, ['target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/rgbled.js b/src/browser/js/app/widgets/plots/rgbled.js
index 7c2e09e4..76e957c5 100644
--- a/src/browser/js/app/widgets/plots/rgbled.js
+++ b/src/browser/js/app/widgets/plots/rgbled.js
@@ -5,33 +5,7 @@ module.exports = class Rbgled extends Widget {
static defaults() {
- return {
- type:'rgbled',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- css:'',
-
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- preArgs:[],
- address:'auto'
-
- }
+ return super.defaults({}, ['color', 'target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/svg.js b/src/browser/js/app/widgets/plots/svg.js
index fd3a7462..4056e2b1 100644
--- a/src/browser/js/app/widgets/plots/svg.js
+++ b/src/browser/js/app/widgets/plots/svg.js
@@ -5,34 +5,13 @@ class Svg extends Widget {
static defaults() {
- return {
- type:'svg',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_svg:'svg',
svg:'',
- _osc:'osc',
-
- preArgs:[],
- address:'auto'
-
- }
+ }, ['color', 'target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/text.js b/src/browser/js/app/widgets/plots/text.js
index abf82151..0808868e 100644
--- a/src/browser/js/app/widgets/plots/text.js
+++ b/src/browser/js/app/widgets/plots/text.js
@@ -5,23 +5,7 @@ module.exports = class Text extends Widget {
static defaults() {
- return {
- type:'text',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_text: 'text',
@@ -29,15 +13,7 @@ module.exports = class Text extends Widget {
wrap:false,
align:'',
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- preArgs:[],
- address:'auto',
- }
+ }, ['color', 'target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/plots/visualizer.js b/src/browser/js/app/widgets/plots/visualizer.js
index d7867718..21653556 100644
--- a/src/browser/js/app/widgets/plots/visualizer.js
+++ b/src/browser/js/app/widgets/plots/visualizer.js
@@ -5,23 +5,7 @@ module.exports = class Visualizer extends _plots_base {
static defaults() {
- return {
- type:'visualizer',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_visualizer:'visualizer',
@@ -32,15 +16,7 @@ module.exports = class Visualizer extends _plots_base {
smooth: false,
pips:true,
- _value: 'value',
- default: '',
- value: '',
-
- _osc:'osc',
-
- address:'auto',
- preArgs:[],
- }
+ }, ['target', 'precision', 'bypass'], {})
}
diff --git a/src/browser/js/app/widgets/sliders/encoder.js b/src/browser/js/app/widgets/sliders/encoder.js
index fe2fa64f..0ca951f7 100644
--- a/src/browser/js/app/widgets/sliders/encoder.js
+++ b/src/browser/js/app/widgets/sliders/encoder.js
@@ -30,23 +30,7 @@ module.exports = class Encoder extends Widget {
static defaults() {
- return {
- type:'encoder',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_encoder: 'encoder',
@@ -57,15 +41,11 @@ module.exports = class Encoder extends Widget {
snap:false,
doubleTap:false,
- _osc:'osc',
+ }, [], {
- precision:2,
- address:'auto',
- touchAddress:'',
- preArgs:[],
- target:[],
- bypass:false
- }
+ touchAddress:''
+
+ })
}
diff --git a/src/browser/js/app/widgets/sliders/fader.js b/src/browser/js/app/widgets/sliders/fader.js
index 5d869870..35dacbca 100644
--- a/src/browser/js/app/widgets/sliders/fader.js
+++ b/src/browser/js/app/widgets/sliders/fader.js
@@ -6,23 +6,7 @@ module.exports = class Fader extends Slider {
static defaults() {
- return {
- type:'fader',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_fader:'fader',
@@ -39,22 +23,14 @@ module.exports = class Fader extends Slider {
range:{min:0,max:1},
logScale:false,
unit:'',
- origin: 'auto',
+ origin: 'auto'
- _value: 'value',
- default: '',
- value: '',
+ }, [], {
- _osc:'osc',
-
- precision:2,
- address:'auto',
touchAddress:'',
- meterAddress:'',
- preArgs:[],
- target:[],
- bypass:false
- }
+ meterAddress:''
+
+ })
}
diff --git a/src/browser/js/app/widgets/sliders/knob.js b/src/browser/js/app/widgets/sliders/knob.js
index 5c1b1c6d..4b3559c4 100644
--- a/src/browser/js/app/widgets/sliders/knob.js
+++ b/src/browser/js/app/widgets/sliders/knob.js
@@ -5,23 +5,7 @@ module.exports = class Knob extends Slider {
static defaults() {
- return {
- type:'knob',
- id:'auto',
- linkId:'',
-
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
+ return super.defaults({
_knob:'knob',
@@ -35,21 +19,13 @@ module.exports = class Knob extends Slider {
range:{min:0,max:1},
logScale:false,
unit:'',
- origin: 'auto',
+ origin: 'auto'
- _value: 'value',
- default: '',
- value: '',
+ }, [], {
- _osc:'osc',
+ touchAddress:''
- precision:2,
- address:'auto',
- touchAddress:'',
- preArgs:[],
- target:[],
- bypass:false
- }
+ })
}
diff --git a/src/browser/js/app/widgets/sliders/range.js b/src/browser/js/app/widgets/sliders/range.js
index d2ef4bb4..c8b1336a 100644
--- a/src/browser/js/app/widgets/sliders/range.js
+++ b/src/browser/js/app/widgets/sliders/range.js
@@ -175,25 +175,9 @@ module.exports = class Range extends Widget {
static defaults() {
- return {
- type:'range',
- id:'auto',
- linkId:'',
+ return super.defaults({
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
-
- _fader:'fader',
+ _range:'range',
horizontal:false,
alignRight:false,
@@ -205,20 +189,12 @@ module.exports = class Range extends Widget {
range:{min:0,max:1},
logScale:false,
- _value: 'value',
- default: '',
- value: '',
+ }, [], {
- _osc:'osc',
-
- precision:2,
- address:'auto',
touchAddress:'',
- preArgs:[],
- split:false,
- target:[],
- bypass:false
- }
+ split:false
+
+ })
}
diff --git a/src/browser/js/app/widgets/switchers/switcher.js b/src/browser/js/app/widgets/switchers/switcher.js
index deaeb826..32e78f79 100644
--- a/src/browser/js/app/widgets/switchers/switcher.js
+++ b/src/browser/js/app/widgets/switchers/switcher.js
@@ -7,41 +7,20 @@ module.exports = class Switcher extends _switchers_base {
static defaults() {
- return {
- type:'switcher',
- id:'auto',
- linkId:'',
+ return super.defaults({
- _geometry:'geometry',
-
- left:'auto',
- top:'auto',
- width:'auto',
- height:'auto',
-
- _style:'style',
-
- label:'auto',
- color:'auto',
- css:'',
-
- _switcher:'Switcher',
+ _switcher:'switcher',
horizontal:false,
linkedWidgets:'',
values:['A', 'B'],
- _value: 'value',
- default: '',
- value: '',
+ }, [], {
- _osc:'osc',
+ touchAddress:'',
+ split:false
- address:'auto',
- preArgs:[],
- target:[],
- bypass:false
- }
+ })
}