refactor: widget props ok
This commit is contained in:
parent
4aa3dfa80e
commit
a56fea33bf
10 changed files with 110 additions and 64 deletions
|
|
@ -1,11 +1,6 @@
|
|||
var Widget = require('../common/widget'),
|
||||
widgetManager = require('../../managers/widgets'),
|
||||
parser = require('../../parser'),
|
||||
editor
|
||||
|
||||
setTimeout(()=>{
|
||||
editor = require('../../editor/')
|
||||
})
|
||||
parser = require('../../parser')
|
||||
|
||||
class Panel extends Widget {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ module.exports = class Meter extends Fader {
|
|||
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"]`'},
|
||||
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\']`'},
|
||||
|
||||
}, ['target', 'precision', 'bypass'], {
|
||||
|
||||
css: {type: 'string', value: '', help: [
|
||||
'Available CSS variables:'
|
||||
'Available CSS variables:',
|
||||
`- '--color-gauge: color;'`,
|
||||
'- `--color-knob: color;`',
|
||||
`- '--color-pips: color;'`,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ module.exports = class Plot extends _plots_base {
|
|||
|
||||
}, ['target', 'precision', 'bypass'], {
|
||||
|
||||
value: {type: 'array|string', help: [
|
||||
value: {type: 'array|string', help: [
|
||||
'- `Array` of `y` values',
|
||||
'- `Array` of `[x, y]` `array` values',
|
||||
'- `String` `array`',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = class Rbgled extends Widget {
|
|||
|
||||
return super.defaults({}, ['color', 'target', 'precision', 'bypass'], {
|
||||
|
||||
value: {type: 'array|string', help: [
|
||||
value: {type: 'array|string', help: [
|
||||
'- `Array`: `[r, g, b]` (`r`, `g` and `b` between `0` and `255`)',
|
||||
'- `Array`: `[r, g, b, alpha]` (`alpha` between `0` and `255`)',
|
||||
'- `String`: CSS color',
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module.exports = class Text extends Widget {
|
|||
vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},
|
||||
wrap: {type: 'boolean', value: false, help: [
|
||||
'Set to `true` to wrap long lines automatically.',
|
||||
'This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property'},
|
||||
'This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property',
|
||||
]},
|
||||
align: {type: 'string', value: '', help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
|
||||
|
|
|
|||
|
|
@ -10,26 +10,44 @@ module.exports = class Fader extends Slider {
|
|||
|
||||
_fader:'fader',
|
||||
|
||||
horizontal:false,
|
||||
alignRight:false,
|
||||
pips:true,
|
||||
input: true,
|
||||
meter:false,
|
||||
compact:false,
|
||||
dashed:false,
|
||||
snap:false,
|
||||
spring:false,
|
||||
doubleTap:false,
|
||||
range:{min:0,max:1},
|
||||
logScale:false,
|
||||
unit:'',
|
||||
origin: 'auto'
|
||||
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'},
|
||||
alignRight: {type: 'boolean', value: false, help: 'Set to `true` to invert the pip\'s and fader\'s position'},
|
||||
pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
input: {type: 'boolean', value: true, help: 'Set to `false` to hide the built-in input'},
|
||||
meter: {type: 'boolean', value: false, help: [
|
||||
'Set to true to display a vu-meter next in the fader',
|
||||
'- the meter\'s `id` will be the same as the widget\'s with `/meter` appended to it',
|
||||
'- the meter\'s `id` will be the same as the widget\'s with `/meter` appended to it'
|
||||
]},
|
||||
compact: {type: 'boolean', value: false, help: 'Set to `true` to display a compact alternative for the widget. Disables default mouse/touch focusing on the value display.'},
|
||||
dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'},
|
||||
snap: {type: 'boolean', value: false, help: 'By default, dragging the widget will modify it\'s value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position'},
|
||||
spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'},
|
||||
doubleTap: {type: 'boolean', 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, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`)'
|
||||
]},
|
||||
range: {type: 'object', value: {min:0,max:1}, help: [
|
||||
'Defines the breakpoints of the fader\'s scale:',
|
||||
'- keys can be percentages and/or `min` / `max`',
|
||||
'- values can be `number` or `object` if a custom label is needed',
|
||||
'Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`)'
|
||||
]},
|
||||
logScale: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the y axis'},
|
||||
unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the fader\'s gauge'},
|
||||
|
||||
}, [], {
|
||||
|
||||
touchAddress:'',
|
||||
meterAddress:''
|
||||
|
||||
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
|
||||
meterAddress: {type: 'string', value:'', help: 'OSC address for the built-in meter'},
|
||||
css: {type: 'string', value: '', help: [
|
||||
'Available CSS variables:',
|
||||
'- --color-gauge:color;',
|
||||
'- --color-knob:color;',
|
||||
'- --color-pips:color;',
|
||||
'- --gauge-opacity:number;'
|
||||
]}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,21 +9,35 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
_knob:'knob',
|
||||
|
||||
pips:true,
|
||||
input: true,
|
||||
dashed:false,
|
||||
pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
input: {type: 'boolean', value: true, help: 'Set to `false` to hide the built-in input'},
|
||||
dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'},
|
||||
angle:270,
|
||||
snap:false,
|
||||
spring:false,
|
||||
doubleTap:false,
|
||||
range:{min:0,max:1},
|
||||
logScale:false,
|
||||
unit:'',
|
||||
origin: 'auto'
|
||||
snap: {type: 'boolean', value: false, help: 'By default, dragging the widget will modify it\'s value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position'},
|
||||
spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'},
|
||||
doubleTap: {type: 'boolean', value: false, help: [
|
||||
'Set to `true` to make the knob reset to its `default` value when receiving a double tap.',
|
||||
'Can also be an osc address, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`)'
|
||||
]},
|
||||
range: {type: 'object', value: {min:0,max:1}, help: [
|
||||
'Defines the breakpoints of the fader\'s scale:',
|
||||
'- keys can be percentages and/or `min` / `max`',
|
||||
'- values can be `number` or `object` if a custom label is needed',
|
||||
'Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`)'
|
||||
]},
|
||||
logScale: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the y axis'},
|
||||
unit: {type: 'string', value: '', help: 'Unit will be appended to the displayed widget\'s value (it doesn\'t affect osc messages)'},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the knob\'s gauge'},
|
||||
|
||||
}, [], {
|
||||
|
||||
touchAddress:''
|
||||
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
|
||||
css: {type: 'string', value: '', help: [
|
||||
'Available CSS variables:',
|
||||
'- --color-gauge:color;',
|
||||
'- --color-knob:color;',
|
||||
'- --color-pips:color;'
|
||||
]}
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -179,20 +179,31 @@ module.exports = class Range extends Widget {
|
|||
|
||||
_range:'range',
|
||||
|
||||
horizontal:false,
|
||||
alignRight:false,
|
||||
input: true,
|
||||
compact:false,
|
||||
pips:true,
|
||||
snap:false,
|
||||
spring:false,
|
||||
range:{min:0,max:1},
|
||||
logScale:false,
|
||||
range: {type: 'object', value: {min:0,max:1}, help: 'See fader\'s `range`'},
|
||||
horizontal: {type: 'boolean', value: false, help: 'See fader\'s `horizontal`'},
|
||||
alignRight: {type: 'boolean', value: false, help: 'See fader\'s `alignRight`'},
|
||||
input: {type: 'boolean', value: true, help: 'See fader\'s `input`'},
|
||||
compact: {type: 'boolean', value: false, help: 'See fader\'s `compact`'},
|
||||
pips: {type: 'boolean', value: true, help: 'See fader\'s `pips`'},
|
||||
snap: {type: 'boolean', value: false, help: 'See fader\'s `snap`'},
|
||||
spring: {type: 'boolean', value: false, help: 'See fader\'s `spring`'},
|
||||
logScale: {type: 'boolean', value: false, help: 'See fader\'s `logScale`'},
|
||||
|
||||
}, [], {
|
||||
|
||||
touchAddress:'',
|
||||
split:false
|
||||
touchAddress: {type: 'string', value: '', help: 'See fader\'s `touchAddress`'},
|
||||
split: {type: 'boolean|object', value: false, help: [
|
||||
'Set to `true` to send separate osc messages for `low` and `high` handles. The `address` will be the same as the widget\'s with `/low` or `/high` appended to it',
|
||||
'Can be set as an object to specify a different `address` : `[\'/osc_address_low\', \'/osc_address_high\']`',
|
||||
'Note: the widget will only respond to its original osc address, not to the splitted version'
|
||||
]},
|
||||
css: {type: 'string', value: '', help: [
|
||||
'Available CSS variables:',
|
||||
'- --color-gauge:color;',
|
||||
'- --color-knob:color;',
|
||||
'- --color-pips:color;',
|
||||
'- --gauge-opacity:number;'
|
||||
]}
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,20 @@ module.exports = class Crossfader extends Switcher {
|
|||
|
||||
static defaults(){
|
||||
|
||||
var o = super.defaults()
|
||||
o.type = 'crossfader'
|
||||
delete o.values
|
||||
return super.defaults({
|
||||
|
||||
return o
|
||||
_crossfader: 'crossfader',
|
||||
|
||||
linkedWidgets: {type: 'string|array', value: '', help: [
|
||||
'- `String`: a widget\'s `id` whose state changes will be stored',
|
||||
'- `Array`: a list of widget `id` string'
|
||||
]},
|
||||
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'},
|
||||
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',
|
||||
]}
|
||||
})
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ module.exports = class Switcher extends _switchers_base {
|
|||
|
||||
return super.defaults({
|
||||
|
||||
_switcher:'switcher',
|
||||
|
||||
horizontal:false,
|
||||
linkedWidgets:'',
|
||||
values:['A', 'B'],
|
||||
|
||||
}, [], {
|
||||
|
||||
touchAddress:'',
|
||||
split:false
|
||||
_switcher: 'switcher',
|
||||
|
||||
linkedWidgets: {type: 'string|array', value: '', help: [
|
||||
'- `String`: a widget\'s `id` whose state changes will be stored',
|
||||
'- `Array`: a list of widget `id` string'
|
||||
]},
|
||||
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'},
|
||||
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',
|
||||
]}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue